:root {
  color-scheme: light;
  --navy-950: #0c1724;
  --navy-900: #101c2b;
  --navy-800: #17283b;
  --ink: #172334;
  --muted: #627084;
  --muted-2: #8490a0;
  --canvas: #f3f5f7;
  --surface: #fbfcfd;
  --surface-2: #f7f9fb;
  --line: #dce2e8;
  --line-dark: #cbd3dc;
  --blue: #2466ad;
  --blue-dark: #174e89;
  --blue-soft: #eaf2fb;
  --green: #277251;
  --green-soft: #eaf5ef;
  --amber: #966518;
  --amber-soft: #fff5df;
  --red: #a4423e;
  --red-soft: #fbeceb;
  --dhl: #ffcc00;
  --radius: 9px;
  --font-ui: Aptos, "Segoe UI Variable", "Segoe UI", Arial, sans-serif;
  --font-data: "Cascadia Mono", "SFMono-Regular", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(36, 102, 173, .26);
  outline-offset: 2px;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  padding: 8px 12px;
  color: var(--surface);
  background: var(--blue-dark);
  border-radius: var(--radius);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100dvh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  color: #d7e0ea;
  background: var(--navy-900);
  border-right: 1px solid #26374a;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  height: 68px;
  padding: 0 18px;
  border-bottom: 1px solid rgba(223, 232, 241, .12);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 39px;
  height: 30px;
  color: var(--navy-950);
  background: #dfe8f1;
  border-radius: 6px;
  font-family: var(--font-data);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .04em;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  color: #f3f7fa;
  font-size: 14px;
  letter-spacing: -.01em;
}

.brand span {
  margin-top: 1px;
  color: #91a0b1;
  font-size: 11px;
}

.nav-list {
  display: grid;
  gap: 3px;
  padding: 16px 11px;
}

.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 27px 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 42px;
  padding: 6px 9px;
  color: #aebbc9;
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 7px;
  transition: color 140ms ease, background-color 140ms ease, transform 140ms ease;
}

.nav-item:hover {
  color: #edf3f8;
  background: rgba(219, 232, 244, .07);
}

.nav-item:active {
  transform: translateY(1px);
}

.nav-item.active {
  color: #f6f9fb;
  background: #20344b;
  box-shadow: inset 3px 0 0 #62a0df;
}

.nav-code {
  font-family: var(--font-data);
  font-size: 9px;
  letter-spacing: .04em;
  color: #74879a;
}

.active .nav-code {
  color: #91bce6;
}

.nav-count {
  min-width: 24px;
  padding: 1px 6px;
  color: #f6e5bf;
  text-align: center;
  background: rgba(227, 174, 75, .17);
  border: 1px solid rgba(227, 174, 75, .26);
  border-radius: 5px;
  font-family: var(--font-data);
  font-size: 10px;
}

.sidebar-footer {
  margin-top: auto;
  padding: 15px 18px 19px;
  border-top: 1px solid rgba(223, 232, 241, .12);
}

.workspace-label {
  margin-bottom: 7px;
  color: #91a0b1;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.system-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #ccddd4;
  font-size: 11px;
}

.status-signal {
  width: 7px;
  height: 7px;
  background: #58aa81;
  border-radius: 50%;
}

.sidebar-meta {
  margin-top: 15px;
  color: #74879a;
  font-size: 10px;
  line-height: 1.55;
}

.main-shell {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 9px 24px;
  background: rgba(251, 252, 253, .96);
  border-bottom: 1px solid var(--line);
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.topbar h1 {
  margin: 0;
  font-size: 17px;
  line-height: 1.2;
  letter-spacing: -.015em;
}

.topbar p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
}

.menu-button {
  display: none;
}

.period-select {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 8px 0 11px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 11px;
}

.period-select select {
  color: var(--ink);
  background: transparent;
  border: 0;
  font-size: 12px;
  font-weight: 650;
}

.search-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: 210px;
  height: 38px;
  padding: 0 9px 0 12px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  text-align: left;
}

.language-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  min-width: 78px;
  height: 38px;
  padding: 3px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-family: var(--font-data);
  font-size: 9px;
  transition: border-color 140ms ease, transform 140ms ease;
}

.language-toggle:hover {
  border-color: #b7c2cd;
}

.language-toggle:active {
  transform: translateY(1px);
}

.language-toggle span {
  display: grid;
  place-items: center;
  height: 28px;
  border-radius: 5px;
}

.language-toggle [data-lang-option="en"],
.language-toggle.zh [data-lang-option="zh"] {
  color: var(--ink);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  font-weight: 750;
}

.language-toggle.zh [data-lang-option="en"] {
  color: var(--muted);
  background: transparent;
  box-shadow: none;
  font-weight: 400;
}

kbd {
  padding: 2px 5px;
  color: var(--muted-2);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  font-family: var(--font-data);
  font-size: 9px;
}

.account {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 7px 3px 3px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  text-align: left;
}

.account:hover {
  background: var(--surface-2);
  border-color: var(--line);
}

.avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: #dce7f2;
  background: var(--navy-800);
  border-radius: 7px;
  font-family: var(--font-data);
  font-size: 10px;
  font-weight: 700;
}

.account-copy strong,
.account-copy small {
  display: block;
}

.account-copy strong {
  font-size: 11px;
}

.account-copy small {
  margin-top: 1px;
  color: var(--muted);
  font-size: 9px;
}

#workspace {
  width: 100%;
  max-width: 1600px;
  margin: 0 auto;
  padding: 22px 25px 44px;
}

.page-stack {
  display: grid;
  gap: 18px;
}

.page-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.page-intro h2 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -.025em;
}

.page-intro p {
  max-width: 680px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.action-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.button,
.button-secondary,
.text-button,
.icon-button {
  min-height: 36px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 650;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.button:active,
.button-secondary:active,
.text-button:active,
.icon-button:active {
  transform: translateY(1px);
}

.button {
  padding: 0 14px;
  color: #f7fafc;
  background: var(--blue);
  border: 1px solid var(--blue);
}

.button:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
}

.button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

.button-secondary {
  padding: 0 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-dark);
}

.button-secondary:hover {
  background: var(--surface-2);
  border-color: #b7c2cd;
}

.text-button {
  padding: 0 8px;
  color: var(--blue-dark);
  background: transparent;
  border: 0;
}

.text-button:hover {
  background: var(--blue-soft);
}

.button-danger {
  color: var(--red);
}

.metrics-strip {
  display: grid;
  grid-template-columns: 1.2fr repeat(5, 1fr);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.metric {
  min-width: 0;
  padding: 16px 17px 15px;
}

.metric + .metric {
  border-left: 1px solid var(--line);
}

.metric-label {
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: .055em;
  white-space: nowrap;
}

.metric-value {
  margin-top: 8px;
  font-family: var(--font-data);
  font-size: 20px;
  font-weight: 650;
  line-height: 1;
  letter-spacing: -.04em;
  white-space: nowrap;
}

.metric.primary .metric-value {
  font-size: 26px;
}

.metric-meta {
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
}

.metric-meta.positive {
  color: var(--green);
}

.metric-meta.warning {
  color: var(--amber);
}

.metric-meta.danger {
  color: var(--red);
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, .72fr);
  gap: 16px;
}

.panel {
  min-width: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 52px;
  padding: 11px 15px;
  border-bottom: 1px solid var(--line);
}

.panel-head h3 {
  margin: 0;
  font-size: 13px;
  letter-spacing: -.01em;
}

.panel-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.panel-body {
  padding: 15px;
}

.processing-summary {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 24px;
  align-items: center;
}

.completion-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 150px;
  height: 150px;
  margin: 5px auto;
  background: conic-gradient(var(--blue) 0 91.6%, #e7ebef 91.6% 100%);
  border-radius: 50%;
}

.completion-ring::after {
  content: "";
  position: absolute;
  width: 112px;
  height: 112px;
  background: var(--surface);
  border-radius: 50%;
}

.ring-label {
  position: relative;
  z-index: 1;
  text-align: center;
}

.ring-label strong {
  display: block;
  font-family: var(--font-data);
  font-size: 25px;
  letter-spacing: -.05em;
}

.ring-label span {
  color: var(--muted);
  font-size: 10px;
}

.processing-list {
  display: grid;
  gap: 2px;
}

.processing-row {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  min-height: 34px;
  padding: 3px 0;
  border-bottom: 1px solid #edf0f3;
}

.processing-row:last-child {
  border-bottom: 0;
}

.processing-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 11px;
}

.swatch {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.swatch.blue { background: var(--blue); }
.swatch.green { background: var(--green); }
.swatch.amber { background: #d4982e; }
.swatch.red { background: var(--red); }
.swatch.gray { background: #a8b2bd; }

.processing-row strong {
  font-family: var(--font-data);
  font-size: 11px;
}

.distribution-list {
  display: grid;
  gap: 12px;
}

.distribution-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(100px, 1.5fr) 82px;
  align-items: center;
  gap: 11px;
}

.distribution-name {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.distribution-bar {
  height: 6px;
  background: linear-gradient(90deg, var(--blue) var(--value), transparent var(--value));
  border-radius: 2px;
}

.distribution-value {
  font-family: var(--font-data);
  font-size: 10px;
  text-align: right;
}

.trend-bars {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  align-items: end;
  gap: 10px;
  height: 150px;
  padding-top: 12px;
}

.trend-month {
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: end;
  gap: 8px;
  height: 100%;
  color: var(--muted);
  text-align: center;
  font-size: 9px;
}

.trend-column {
  position: relative;
  width: min(28px, 65%);
  height: var(--height);
  margin: auto auto 0;
  background: #b9cde0;
  border-radius: 3px 3px 1px 1px;
}

.trend-month.current .trend-column {
  background: var(--blue);
}

.trend-column::before {
  content: attr(data-value);
  position: absolute;
  top: -17px;
  left: 50%;
  color: var(--muted);
  font-family: var(--font-data);
  font-size: 8px;
  white-space: nowrap;
  transform: translateX(-50%);
}

.split-lower {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, .75fr);
  gap: 16px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 11px;
}

.data-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 37px;
  padding: 0 10px;
  color: #586678;
  background: #f4f7f9;
  border-bottom: 1px solid var(--line-dark);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .035em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.data-table td {
  height: 43px;
  padding: 7px 10px;
  background: var(--surface);
  border-bottom: 1px solid #e9edf1;
  vertical-align: middle;
  white-space: nowrap;
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr:hover td {
  background: #f6f9fc;
}

.data-table tbody tr.selected td {
  background: #edf4fb;
}

.data-table tbody tr.attention td:first-child {
  box-shadow: inset 3px 0 0 #d49a35;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table .number,
.number {
  font-family: var(--font-data);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.data-table .muted-cell {
  color: var(--muted);
}

.data-table .strong-cell {
  color: #162336;
  font-weight: 650;
}

.invoice-source {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.dhl-marker {
  padding: 1px 4px;
  color: #6f1c1b;
  background: var(--dhl);
  border-radius: 3px;
  font-family: Arial, sans-serif;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: -.03em;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 7px;
  border: 1px solid transparent;
  border-radius: 5px;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.status-chip.classified,
.status-chip.confirmed {
  color: var(--green);
  background: var(--green-soft);
  border-color: #cce6d8;
}

.status-chip.review,
.status-chip.duplicate {
  color: var(--amber);
  background: var(--amber-soft);
  border-color: #efdbaa;
}

.status-chip.unclassified {
  color: #5c6876;
  background: #edf0f3;
  border-color: #d8dfe6;
}

.status-chip.conflict,
.status-chip.error,
.status-chip.import_error {
  color: var(--red);
  background: var(--red-soft);
  border-color: #efcfcd;
}

.confidence {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  font-family: var(--font-data);
  font-size: 10px;
}

.confidence.low { color: var(--amber); }
.confidence.high { color: var(--green); }

.compact-list {
  display: grid;
}

.compact-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid #e9edf1;
}

.compact-item:first-child {
  padding-top: 0;
}

.compact-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.compact-item strong,
.compact-item span {
  display: block;
}

.compact-item strong {
  font-size: 11px;
}

.compact-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.compact-amount {
  color: var(--red);
  font-family: var(--font-data);
  font-size: 10px;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.toolbar-search {
  flex: 1 1 240px;
  min-width: 180px;
}

.field-input,
.field-select,
.toolbar input,
.toolbar select {
  min-height: 36px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-dark);
  border-radius: 7px;
  font-size: 11px;
}

.toolbar input::placeholder,
.field-input::placeholder {
  color: #727f8e;
}

.toolbar-count {
  margin-left: auto;
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.classification-page {
  display: grid;
  gap: 12px;
}

.classification-header {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto auto;
  align-items: end;
  gap: 28px;
  padding: 2px 2px 9px;
  border-bottom: 1px solid var(--line-dark);
}

.classification-header h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.1;
  letter-spacing: -.025em;
}

.classification-header p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.classification-period,
.classification-progress {
  padding-left: 20px;
  border-left: 1px solid var(--line);
}

.classification-period span,
.classification-progress span {
  display: block;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.classification-period strong,
.classification-progress strong {
  display: block;
  margin-top: 4px;
  color: var(--ink);
  font-family: var(--font-data);
  font-size: 12px;
  white-space: nowrap;
}

.progress-inline {
  display: inline-block;
  width: 56px;
  height: 3px;
  margin-left: 7px;
  vertical-align: middle;
  background: linear-gradient(90deg, var(--green) 91.6%, transparent 91.6%);
}

.classification-toolbar {
  display: grid;
  grid-template-columns: minmax(210px, 1.7fr) repeat(4, minmax(112px, .65fr)) auto;
  align-items: center;
  gap: 7px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.classification-toolbar input,
.classification-toolbar select {
  width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 0 9px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  font-size: 10px;
}

.classification-toolbar input::placeholder {
  color: #6e7c8c;
}

.filter-reset {
  min-height: 34px;
  padding: 0 9px;
  color: var(--blue-dark);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 650;
  white-space: nowrap;
}

.filter-reset:hover {
  background: var(--blue-soft);
}

.classification-table-shell {
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border-top: 1px solid var(--line-dark);
  border-bottom: 1px solid var(--line-dark);
}

.classification-shell {
  overflow: hidden;
}

.classification-shell .data-table th:first-child,
.classification-shell .data-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
}

.classification-table-shell .data-table th:first-child,
.classification-table-shell .data-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 3;
}

.classification-table-shell .data-table {
  table-layout: fixed;
  min-width: 972px;
}

.classification-table-shell .data-table th {
  height: 34px;
  padding: 0 8px;
  font-size: 8px;
}

.classification-table-shell .data-table td {
  height: 41px;
  padding: 5px 8px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.classification-table-shell .data-table th:nth-child(1) { width: 34px; }
.classification-table-shell .data-table th:nth-child(2) { width: 70px; }
.classification-table-shell .data-table th:nth-child(3) { width: 140px; }
.classification-table-shell .data-table th:nth-child(4) { width: 108px; }
.classification-table-shell .data-table th:nth-child(5) { width: 140px; }
.classification-table-shell .data-table th:nth-child(6) { width: 100px; }
.classification-table-shell .data-table th:nth-child(7) { width: 90px; }
.classification-table-shell .data-table th:nth-child(8) { width: 120px; }
.classification-table-shell .data-table th:nth-child(9) { width: 70px; }
.classification-table-shell .data-table th:nth-child(10) { width: 100px; }

.shipment-cell strong,
.shipment-cell span,
.entity-cell strong,
.entity-cell span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
}

.shipment-cell strong {
  font-family: var(--font-data);
  font-size: 9px;
  font-weight: 600;
}

.shipment-cell span,
.entity-cell span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}

.entity-cell strong {
  font-size: 10px;
}

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 39px;
  padding: 5px 8px 5px 12px;
  color: var(--muted);
  background: var(--surface-2);
  border-top: 1px solid var(--line);
  font-size: 9px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}

.page-button {
  min-width: 27px;
  height: 27px;
  padding: 0 6px;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  font-family: var(--font-data);
  font-size: 9px;
}

.page-button:hover,
.page-button.active {
  color: var(--ink);
  background: var(--surface);
  border-color: var(--line-dark);
}

.sort-button {
  padding: 0;
  color: inherit;
  background: transparent;
  border: 0;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
}

.sort-button:hover {
  color: var(--blue-dark);
}

.bulk-bar {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 6px 11px;
  color: #e8f1f9;
  background: var(--navy-800);
  border-bottom: 1px solid #2f4358;
}

.bulk-bar .bulk-spacer {
  flex: 1;
}

.bulk-bar[hidden] {
  display: none;
}

.bulk-bar strong {
  margin-right: 8px;
  font-size: 11px;
}

.bulk-bar select {
  min-height: 31px;
  color: #eaf1f7;
  background: #22374c;
  border: 1px solid #496078;
  border-radius: 6px;
  font-size: 10px;
}

.bulk-bar .button {
  min-height: 31px;
  font-size: 10px;
}

.bulk-bar .text-button {
  min-height: 31px;
  color: #bfd2e3;
  font-size: 10px;
}

.check-cell {
  width: 35px;
  text-align: center;
}

.check-cell input {
  width: 14px;
  height: 14px;
  accent-color: var(--blue);
}

.inspection-drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 50;
  width: min(430px, 96vw);
  height: 100dvh;
  overflow: auto;
  background: var(--surface);
  border-left: 1px solid var(--line-dark);
  box-shadow: -18px 0 46px rgba(25, 43, 63, .12);
  transform: translateX(102%);
  visibility: hidden;
  transition: transform 220ms cubic-bezier(.16, 1, .3, 1);
}

.inspection-drawer.open {
  transform: translateX(0);
  visibility: visible;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 45;
  background: rgba(12, 23, 36, .08);
  opacity: 0;
  transition: opacity 180ms ease;
}

.drawer-backdrop.visible {
  opacity: 1;
}

.drawer-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 17px 19px;
  background: rgba(251, 252, 253, .97);
  border-bottom: 1px solid var(--line);
}

.drawer-head h2 {
  margin: 0;
  font-size: 16px;
}

.drawer-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-family: var(--font-data);
  font-size: 9px;
}

.icon-button {
  width: 32px;
  padding: 0;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.drawer-section {
  padding: 17px 19px;
  border-bottom: 1px solid var(--line);
}

.drawer-section h3 {
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.detail-grid {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 8px 14px;
}

.detail-grid dt {
  color: var(--muted);
  font-size: 10px;
}

.detail-grid dd {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 11px;
}

.match-card {
  padding: 12px;
  background: var(--blue-soft);
  border: 1px solid #ccdff1;
  border-radius: var(--radius);
}

.match-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
}

.match-card p {
  margin: 0;
  color: #4e657b;
  font-size: 10px;
}

.match-score {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
  margin-bottom: 11px;
}

.match-score strong {
  font-family: var(--font-data);
  font-size: 21px;
  letter-spacing: -.04em;
}

.match-score span {
  color: var(--muted);
  font-size: 9px;
}

.match-reasons {
  display: grid;
  gap: 7px;
}

.match-reason {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 9px;
  padding-bottom: 7px;
  border-bottom: 1px solid #e9edf1;
  font-size: 10px;
}

.match-reason:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.match-reason span:first-child {
  color: var(--muted);
}

.drawer-field {
  display: grid;
  gap: 6px;
}

.drawer-field label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
}

.drawer-field select {
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-dark);
  border-radius: 7px;
}

.alternative-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.alternative-option {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 9px;
  padding: 9px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.alternative-option input {
  accent-color: var(--blue);
}

.alternative-option span {
  font-size: 10px;
}

.drawer-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 19px;
  background: rgba(251, 252, 253, .98);
  border-top: 1px solid var(--line);
}

.import-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, .7fr);
  gap: 16px;
}

.upload-zone {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 18px;
  min-height: 128px;
  padding: 20px;
  background: var(--surface);
  border: 1px dashed #aebac6;
  border-radius: var(--radius);
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.upload-zone.dragover {
  background: var(--blue-soft);
  border-color: var(--blue);
  transform: translateY(-1px);
}

.upload-zone h3 {
  margin: 0;
  font-size: 15px;
}

.upload-zone p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.file-requirements {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 13px;
}

.requirement {
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.requirement strong,
.requirement span {
  display: block;
}

.requirement strong {
  font-size: 10px;
}

.requirement span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.workflow-steps {
  display: grid;
  gap: 0;
}

.workflow-step {
  position: relative;
  display: grid;
  grid-template-columns: 23px 1fr auto;
  align-items: center;
  gap: 9px;
  min-height: 39px;
  color: var(--muted);
}

.workflow-step + .workflow-step::before {
  content: "";
  position: absolute;
  top: -8px;
  left: 11px;
  width: 1px;
  height: 15px;
  background: var(--line-dark);
}

.step-index {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  background: var(--surface-2);
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  font-family: var(--font-data);
  font-size: 9px;
}

.workflow-step.done,
.workflow-step.active {
  color: var(--ink);
}

.workflow-step.done .step-index {
  color: var(--green);
  background: var(--green-soft);
  border-color: #bfddcd;
}

.workflow-step.active .step-index {
  color: var(--blue-dark);
  background: var(--blue-soft);
  border-color: #bfd6eb;
}

.workflow-step span:last-child {
  color: var(--muted);
  font-family: var(--font-data);
  font-size: 9px;
}

.progress-track {
  height: 5px;
  overflow: hidden;
  background: #e3e8ed;
  border-radius: 3px;
}

.progress-value {
  width: var(--progress, 0%);
  height: 100%;
  background: var(--blue);
  border-radius: inherit;
  transition: width 260ms cubic-bezier(.16, 1, .3, 1);
}

.import-file {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
  padding: 12px 0;
  border-bottom: 1px solid #e9edf1;
}

.import-file:last-child {
  border-bottom: 0;
}

.import-file strong {
  overflow: hidden;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.import-file span {
  color: var(--muted);
  font-size: 9px;
}

.import-result {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  margin-top: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.import-page {
  gap: 14px;
}

.import-header,
.import-compose,
.batch-actions,
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.import-header {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-dark);
}

.import-header h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -.025em;
}

.import-header p,
.section-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.fixture-flag,
.customer-type {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  color: #5b6672;
  background: #f2f4f6;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--font-data);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .045em;
  text-transform: uppercase;
  white-space: nowrap;
}

.fixture-flag.local {
  color: var(--green);
  background: var(--green-soft);
  border-color: #cce6d8;
}

.customer-type.internal {
  color: var(--blue-dark);
  background: var(--blue-soft);
  border-color: #bfd6eb;
  vertical-align: middle;
}

.customer-type.external {
  color: #4f5e6d;
  vertical-align: middle;
}

.import-compose {
  align-items: stretch;
  padding: 11px 0;
}

.period-field {
  display: grid;
  flex: 0 0 170px;
  gap: 5px;
}

.period-field span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.period-field input {
  min-height: 39px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-dark);
  border-radius: 7px;
}

.upload-zone.compact {
  flex: 1;
  min-height: 62px;
  padding: 10px 12px;
  border-style: solid;
}

.upload-zone.processing {
  cursor: wait;
  border-color: #c8d4df;
  background: #f5f7f9;
}

.upload-zone.compact strong,
.upload-zone.compact small {
  display: block;
}

.upload-zone.compact small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.parser-boundary {
  margin: -4px 0 0;
  padding: 8px 10px;
  color: #6b5a1e;
  background: #fff9df;
  border-left: 3px solid var(--yellow);
  font-size: 10px;
}

.data-section,
.batch-summary {
  min-width: 0;
  background: var(--surface);
  border-top: 1px solid var(--line-dark);
  border-bottom: 1px solid var(--line-dark);
}

.data-section > .section-heading,
.batch-summary > .section-heading {
  min-height: 48px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
}

.section-heading h3,
.batch-breakdown h4 {
  margin: 0;
  font-size: 12px;
}

.import-files-table {
  min-width: 850px;
}

.batch-metrics {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border-bottom: 1px solid var(--line);
}

.batch-metrics > div {
  padding: 12px;
}

.batch-metrics > div + div {
  border-left: 1px solid var(--line);
}

.batch-metrics span,
.batch-metrics strong,
.batch-metrics small {
  display: block;
}

.batch-metrics span {
  color: var(--muted);
  font-size: 9px;
}

.batch-metrics strong {
  margin-top: 4px;
  font-family: var(--font-data);
  font-size: 14px;
}

.batch-metrics small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}

.batch-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.batch-breakdown > div {
  padding: 12px;
}

.batch-breakdown > div + div {
  border-left: 1px solid var(--line);
}

.batch-breakdown h4 {
  margin-bottom: 6px;
}

.summary-line {
  display: grid;
  grid-template-columns: 1fr 70px 110px;
  gap: 10px;
  align-items: center;
  min-height: 27px;
  font-size: 10px;
}

.summary-line strong,
.summary-line em {
  font-family: var(--font-data);
  font-style: normal;
  text-align: right;
}

.summary-line em {
  color: var(--muted);
}

.batch-actions {
  justify-content: flex-start;
  padding: 10px 12px;
  border-top: 1px solid var(--line);
}

.batch-actions > span {
  margin-left: auto;
  color: var(--muted);
  font-size: 9px;
}

.batch-row {
  cursor: pointer;
}

.batch-row:hover {
  background: #f7f9fa;
}

.signal-empty,
.rule-empty span {
  color: var(--muted);
  font-size: 9px;
}

.rule-empty {
  display: grid;
  gap: 4px;
  padding: 18px 14px;
}

.result-cell {
  padding: 13px;
}

.result-cell + .result-cell {
  border-left: 1px solid var(--line);
}

.result-cell span,
.result-cell strong {
  display: block;
}

.result-cell span {
  color: var(--muted);
  font-size: 9px;
}

.result-cell strong {
  margin-top: 5px;
  font-family: var(--font-data);
  font-size: 15px;
}

.customers-page {
  gap: 14px;
}

.customers-intro h2 {
  margin: 0;
  font-size: 21px;
  letter-spacing: -.02em;
}

.customers-intro p {
  max-width: 720px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.customer-workspace {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-width: 0;
  background: var(--surface);
  border-top: 1px solid var(--line-dark);
  border-bottom: 1px solid var(--line-dark);
}

.customer-directory {
  min-width: 0;
  border-right: 1px solid var(--line);
}

.directory-head {
  padding: 15px 13px 12px;
  border-bottom: 1px solid var(--line);
}

.directory-head h3,
.section-heading h3 {
  margin: 0;
  font-size: 13px;
}

.directory-head p,
.section-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.directory-head label {
  display: block;
  margin: 13px 0 5px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
}

.directory-head input {
  width: 100%;
  min-height: 34px;
  padding: 0 9px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  font-size: 10px;
}

.directory-head input::placeholder {
  color: #6e7c8c;
}

.customer-list {
  max-height: 760px;
  overflow: auto;
}

.customer-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 58px;
  padding: 9px 12px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px solid #e9edf1;
}

.customer-row:hover {
  background: var(--surface-2);
}

.customer-row.active {
  background: #edf4fb;
  box-shadow: inset 3px 0 0 var(--blue);
}

.customer-row strong,
.customer-row small {
  display: block;
}

.customer-row strong {
  overflow: hidden;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.customer-row small {
  margin-top: 3px;
  color: var(--muted);
  font-family: var(--font-data);
  font-size: 8px;
}

.customer-rule-count {
  min-width: 32px;
  text-align: right;
}

.customer-rule-count strong {
  font-family: var(--font-data);
  font-size: 12px;
}

.customer-rule-count small {
  font-family: var(--font-ui);
}

.customer-list-empty {
  padding: 24px 14px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.customer-detail {
  min-width: 0;
}

.customer-profile-head {
  display: grid;
  grid-template-columns: minmax(250px, 1fr) auto;
  align-items: stretch;
  min-height: 92px;
  border-bottom: 1px solid var(--line-dark);
}

.customer-identity {
  align-self: center;
  padding: 16px 18px;
}

.customer-identity h2 {
  margin: 0;
  font-size: 19px;
  letter-spacing: -.02em;
}

.customer-identity p {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.customer-identity p strong {
  padding: 2px 5px;
  color: var(--ink);
  background: #e9eef3;
  border-radius: 4px;
  font-family: var(--font-data);
}

.customer-identity p span {
  padding-left: 7px;
  border-left: 1px solid var(--line-dark);
}

.profile-metrics {
  display: grid;
  grid-template-columns: repeat(3, 105px);
  margin: 0;
}

.profile-metrics div {
  display: flex;
  flex-direction: column-reverse;
  justify-content: center;
  padding: 12px;
  border-left: 1px solid var(--line);
}

.profile-metrics dt {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
}

.profile-metrics dd {
  margin: 0;
  font-family: var(--font-data);
  font-size: 15px;
  font-weight: 700;
}

.customer-section {
  padding: 17px 18px;
}

.customer-section + .customer-section {
  border-top: 1px solid var(--line-dark);
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.section-heading p {
  max-width: 690px;
}

.section-heading .button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.signal-matrix {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.signal-line {
  min-width: 0;
  padding: 12px 14px 12px 0;
  border-top: 1px solid var(--line);
}

.signal-line:nth-child(even) {
  padding-right: 0;
  padding-left: 14px;
  border-left: 1px solid var(--line);
}

.signal-line > div:first-child {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.signal-line > div:first-child strong {
  font-size: 9px;
}

.signal-line > div:first-child span {
  color: var(--muted-2);
  font-family: var(--font-data);
  font-size: 8px;
}

.token-row {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.token {
  padding: 3px 6px;
  color: #435366;
  background: #e9eef3;
  border: 1px solid #d4dce4;
  border-radius: 5px;
  font-family: var(--font-data);
  font-size: 8px;
}

.advanced-signals {
  margin-top: 3px;
  border-top: 1px solid var(--line-dark);
}

.advanced-signals summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0 0;
  cursor: pointer;
  list-style: none;
}

.advanced-signals summary::-webkit-details-marker {
  display: none;
}

.advanced-signals summary strong,
.advanced-signals summary small {
  display: block;
}

.advanced-signals summary strong {
  font-size: 10px;
}

.advanced-signals summary small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8px;
}

.disclosure-mark {
  color: var(--blue-dark);
  font-family: var(--font-data);
  font-size: 17px;
  transition: transform 150ms ease;
}

.advanced-signals[open] .disclosure-mark {
  transform: rotate(45deg);
}

.advanced-signal-grid {
  margin-top: 10px;
}

.rule-list {
  overflow-x: auto;
  border-top: 1px solid var(--line-dark);
}

.rule-list-head,
.rule-row {
  display: grid;
  grid-template-columns: minmax(260px, 1.5fr) minmax(145px, .8fr) 105px 54px 45px;
  align-items: center;
  gap: 12px;
  min-width: 760px;
}

.rule-list-head {
  min-height: 29px;
  padding: 0 10px;
  color: var(--muted-2);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.rule-row {
  min-height: 61px;
  padding: 7px 10px;
  border-bottom: 1px solid #e9edf1;
}

.rule-row:last-child {
  border-bottom: 0;
}

.rule-row.disabled {
  background: #fafbfc;
}

.rule-copy strong,
.rule-copy span,
.rule-evidence strong,
.rule-evidence span {
  display: block;
}

.rule-copy strong {
  font-size: 10px;
}

.rule-copy span,
.rule-evidence span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.rule-row.disabled .rule-copy strong,
.rule-row.disabled .rule-evidence strong {
  color: var(--muted);
}

.rule-evidence strong {
  font-family: var(--font-data);
  font-size: 9px;
}

.rule-priority-control {
  display: flex;
  align-items: center;
  gap: 9px;
}

.rule-priority-control > strong {
  min-width: 15px;
  font-family: var(--font-data);
  font-size: 11px;
}

.rule-priority-control > span {
  display: flex;
  gap: 3px;
}

.rule-priority-control button {
  width: 25px;
  height: 25px;
  padding: 0;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line-dark);
  border-radius: 5px;
}

.rule-priority-control button:hover:not(:disabled) {
  color: var(--blue-dark);
  background: var(--blue-soft);
}

.rule-priority-control button:disabled {
  cursor: default;
  opacity: .35;
}

.switch {
  position: relative;
  display: inline-block;
  width: 30px;
  height: 17px;
}

.switch input {
  width: 1px;
  height: 1px;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  background: #bac3cc;
  border-radius: 9px;
  transition: background-color 140ms ease;
}

.switch span::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 13px;
  height: 13px;
  background: #f8fafc;
  border-radius: 50%;
  transition: transform 140ms ease;
}

.switch input:checked + span {
  background: var(--green);
}

.switch input:checked + span::after {
  transform: translateX(13px);
}

.switch input:focus-visible + span {
  outline: 3px solid rgba(36, 102, 173, .26);
  outline-offset: 2px;
}

.history-table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--line-dark);
}

.history-table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 9px;
}

.history-table th {
  height: 30px;
  padding: 0 9px;
  color: var(--muted-2);
  text-align: left;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  font-size: 8px;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.history-table td {
  height: 43px;
  padding: 6px 9px;
  overflow: hidden;
  border-bottom: 1px solid #e9edf1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-table tr[data-history-row] {
  cursor: pointer;
}

.history-table tr[data-history-row]:hover td,
.history-table tr[data-history-row]:focus-visible td {
  background: #f0f5fa;
}

.history-table th:nth-child(1) { width: 74px; }
.history-table th:nth-child(2) { width: 130px; }
.history-table th:nth-child(3) { width: 170px; }
.history-table th:nth-child(4) { width: auto; }
.history-table th:nth-child(5) { width: 86px; }
.history-table th:nth-child(6) { width: 92px; }

.rule-dialog {
  width: min(590px, calc(100vw - 28px));
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  box-shadow: 0 26px 80px rgba(15, 31, 48, .24);
}

.rule-dialog::backdrop {
  background: rgba(12, 23, 36, .38);
}

.rule-dialog-shell {
  margin: 0;
}

.rule-dialog-shell > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 17px 18px;
  border-bottom: 1px solid var(--line);
}

.rule-dialog-shell h2 {
  margin: 0;
  font-size: 16px;
}

.rule-dialog-shell header p {
  max-width: 440px;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 9px;
}

.rule-dialog-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px;
  padding: 18px;
}

.form-field {
  display: grid;
  gap: 5px;
}

.form-field > span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
}

.form-field input,
.form-field select {
  width: 100%;
  min-height: 37px;
  padding: 0 10px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-dark);
  border-radius: 6px;
  font-size: 10px;
}

.form-field small {
  color: var(--muted);
  font-size: 8px;
}

.rule-value-field,
.rule-preview,
.advanced-rule-options {
  grid-column: 1 / -1;
}

.rule-preview {
  padding: 12px 13px;
  background: var(--blue-soft);
  border-left: 3px solid var(--blue);
}

.rule-preview span,
.rule-preview strong {
  display: block;
}

.rule-preview span {
  color: var(--muted);
  font-size: 8px;
}

.rule-preview strong {
  margin-top: 3px;
  font-size: 11px;
}

.advanced-rule-options {
  border-top: 1px solid var(--line);
}

.advanced-rule-options summary {
  display: flex;
  justify-content: space-between;
  padding: 11px 0 0;
  color: var(--blue-dark);
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
  list-style: none;
}

.advanced-rule-options summary::-webkit-details-marker {
  display: none;
}

.advanced-rule-options > div {
  display: grid;
  grid-template-columns: 150px 1fr;
  align-items: center;
  gap: 18px;
  padding-top: 12px;
}

.rule-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 9px;
}

.rule-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--blue);
}

.rule-dialog-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 8px;
  padding: 12px 18px;
  background: var(--surface-2);
  border-top: 1px solid var(--line);
}

.button-danger {
  min-height: 34px;
  padding: 0 11px;
  color: #8d3834;
  background: var(--surface);
  border: 1px solid #d9aaa7;
  border-radius: 6px;
  font-size: 9px;
  font-weight: 700;
}

.button-danger:hover {
  background: var(--red-soft);
}

.report-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(300px, .6fr);
  gap: 16px;
}

.report-callout {
  padding: 17px;
  color: #dce8f2;
  background: var(--navy-800);
  border: 1px solid #294058;
  border-radius: var(--radius);
}

.report-callout h3 {
  margin: 0;
  color: #f2f6f9;
  font-size: 14px;
}

.report-callout p {
  margin: 7px 0 15px;
  color: #afc0cf;
  font-size: 10px;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(330px, .55fr);
  gap: 16px;
}

.settings-section {
  padding: 0 15px;
}

.setting-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, .45fr);
  align-items: center;
  gap: 20px;
  min-height: 66px;
  border-bottom: 1px solid #e9edf1;
}

.setting-row:last-child {
  border-bottom: 0;
}

.setting-copy strong,
.setting-copy span {
  display: block;
}

.setting-copy strong {
  font-size: 11px;
}

.setting-copy span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
}

.setting-control {
  justify-self: end;
}

.state-list {
  display: grid;
  gap: 8px;
}

.state-preview {
  display: grid;
  grid-template-columns: 84px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 45px;
  padding: 8px 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
}

.state-preview strong {
  font-size: 10px;
}

.state-preview span {
  color: var(--muted);
  font-size: 9px;
}

.state-preview.error-state {
  background: var(--red-soft);
  border-color: #ecc9c7;
}

.skeleton-lines {
  display: grid;
  gap: 5px;
}

.skeleton-lines i {
  display: block;
  width: 100%;
  height: 5px;
  background: #dce3e9;
  border-radius: 2px;
}

.skeleton-lines i:last-child {
  width: 64%;
}

.empty-table {
  padding: 48px 20px;
  color: var(--muted);
  text-align: center;
}

.empty-table strong {
  display: block;
  margin-bottom: 5px;
  color: var(--ink);
}

.command-dialog {
  width: min(680px, calc(100vw - 30px));
  margin-top: 90px;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  box-shadow: 0 26px 80px rgba(15, 31, 48, .24);
}

.command-dialog::backdrop {
  background: rgba(12, 23, 36, .42);
}

.command-shell {
  margin: 0;
}

.command-input-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.command-input-row label {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 10px;
}

.command-input-row input {
  width: 100%;
  min-height: 40px;
  padding: 0 11px;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--line-dark);
  border-radius: 7px;
}

.command-results {
  max-height: 420px;
  overflow: auto;
  padding: 7px;
}

.command-result {
  display: grid;
  grid-template-columns: 100px 1fr auto;
  gap: 10px;
  width: 100%;
  padding: 10px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 0;
  border-radius: 7px;
}

.command-result:hover {
  background: var(--blue-soft);
}

.command-result small {
  color: var(--muted);
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 80;
  display: grid;
  gap: 8px;
}

.toast {
  min-width: 290px;
  padding: 11px 13px;
  color: #eaf1f7;
  background: var(--navy-800);
  border: 1px solid #324960;
  border-radius: var(--radius);
  box-shadow: 0 14px 38px rgba(12, 23, 36, .18);
  animation: toast-in 180ms ease both;
}

.toast strong,
.toast span {
  display: block;
}

.toast strong {
  font-size: 11px;
}

.toast span {
  margin-top: 2px;
  color: #b8c7d4;
  font-size: 9px;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 1220px) {
  .metrics-strip {
    grid-template-columns: repeat(3, 1fr);
  }

  .metric:nth-child(4) {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .metric:nth-child(5),
  .metric:nth-child(6) {
    border-top: 1px solid var(--line);
  }

  .account-copy,
  .period-select span {
    display: none;
  }

  .search-trigger {
    width: 150px;
  }

  .classification-toolbar {
    grid-template-columns: minmax(210px, 1.5fr) repeat(3, minmax(105px, .7fr));
  }
}

@media (max-width: 980px) {
  .overview-grid,
  .split-lower,
  .import-layout,
  .report-grid,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .batch-metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .batch-metrics > div:nth-child(4) {
    border-left: 0;
  }

  .batch-metrics > div:nth-child(n+4) {
    border-top: 1px solid var(--line);
  }

  .customer-workspace {
    grid-template-columns: 205px minmax(0, 1fr);
  }

  .customer-directory {
    border-right: 1px solid var(--line);
    border-bottom: 0;
  }

  .customer-list {
    display: block;
    max-height: 760px;
    overflow: auto;
  }

  .customer-row {
    border-right: 0;
  }

  .customer-profile-head {
    grid-template-columns: 1fr;
  }

  .customer-identity {
    border-bottom: 1px solid var(--line);
  }

  .profile-metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .profile-metrics div:first-child {
    border-left: 0;
  }

  .signal-matrix {
    grid-template-columns: 1fr;
  }

  .signal-line:nth-child(even) {
    padding-right: 14px;
    padding-left: 0;
    border-left: 0;
  }

  .rule-list-head {
    display: none;
  }

  .rule-row {
    grid-template-areas:
      "copy switch edit"
      "evidence priority priority";
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px 10px;
    min-width: 0;
    padding: 10px;
  }

  .rule-copy { grid-area: copy; }
  .rule-evidence { grid-area: evidence; }
  .rule-priority-control { grid-area: priority; justify-self: end; }
  .rule-row > .switch { grid-area: switch; }
  .rule-row > .text-button { grid-area: edit; }

  .distribution-row {
    grid-template-columns: minmax(100px, 1fr) minmax(100px, 1.3fr) 75px;
  }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    z-index: 60;
    width: 232px;
    transform: translateX(-102%);
    transition: transform 200ms cubic-bezier(.16, 1, .3, 1);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .menu-button {
    display: inline-flex;
    align-items: center;
    min-height: 34px;
    padding: 0 9px;
    color: var(--ink);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 7px;
    font-size: 10px;
  }

  .topbar {
    padding: 8px 12px;
  }

  .topbar-actions {
    gap: 5px;
  }

  .period-select,
  .account,
  .search-trigger span {
    display: none;
  }

  .language-toggle {
    min-width: 70px;
  }

  .search-trigger {
    width: auto;
    padding: 0 8px;
  }

  #workspace {
    padding: 16px 12px 34px;
  }

  .page-intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 12px;
  }

  .page-intro h2 {
    font-size: 20px;
  }

  .metrics-strip {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric:nth-child(3),
  .metric:nth-child(5) {
    border-left: 0;
  }

  .metric:nth-child(n+3) {
    border-top: 1px solid var(--line);
  }

  .processing-summary {
    grid-template-columns: 1fr;
  }

  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar-search {
    flex-basis: auto;
  }

  .toolbar-count {
    margin-left: 0;
  }

  .classification-header {
    grid-template-columns: 1fr auto;
    gap: 14px;
  }

  .classification-period {
    display: none;
  }

  .classification-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 8px 0;
  }

  .classification-toolbar .classification-search {
    grid-column: 1 / -1;
  }

  .classification-toolbar select:nth-of-type(4),
  .classification-toolbar select:nth-of-type(5) {
    display: block;
  }

  .classification-toolbar .filter-reset {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .file-requirements,
  .import-result {
    grid-template-columns: 1fr;
  }

  .import-compose,
  .batch-breakdown {
    grid-template-columns: 1fr;
  }

  .batch-breakdown > div + div {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .result-cell + .result-cell {
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .upload-zone {
    grid-template-columns: 1fr;
  }

  .customer-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(190px, 1fr));
    max-height: none;
    overflow: auto;
  }

  .customer-workspace {
    grid-template-columns: 1fr;
  }

  .customer-directory {
    border-right: 0;
    border-bottom: 1px solid var(--line-dark);
  }

  .customer-row {
    border-right: 1px solid #e9edf1;
  }

  .customer-profile-head {
    grid-template-columns: 1fr;
  }

  .customer-identity {
    border-bottom: 1px solid var(--line);
  }

  .profile-metrics {
    grid-template-columns: repeat(3, 1fr);
  }

  .profile-metrics div:first-child {
    border-left: 0;
  }

  .signal-matrix {
    grid-template-columns: 1fr;
  }

  .signal-line:nth-child(even) {
    padding-right: 14px;
    padding-left: 0;
    border-left: 0;
  }

  .rule-dialog-body,
  .advanced-rule-options > div {
    grid-template-columns: 1fr;
  }

  .rule-dialog-actions {
    grid-template-columns: 1fr 1fr;
  }

  .rule-dialog-actions > span {
    display: none;
  }

  .rule-dialog-actions .button-danger {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .setting-row {
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 12px 0;
  }

  .setting-control {
    justify-self: start;
  }
}
