/* Hallmark · macrostructure: Workbench · tone: practical · anchor hue: blue
 * Pre-emit critique: P4 H4 E4 S4 R5 V4. */
:root {
  color-scheme: light;
  --paper: oklch(1 0 0);
  --background: oklch(.978 .004 250);
  --ink: oklch(.18 .022 250);
  --muted: oklch(.47 .028 250);
  --rule: oklch(.90 .012 250);
  --blue: oklch(.47 .17 252);
  --blue-hover: oklch(.41 .16 252);
  --blue-wash: oklch(.957 .022 251);
  --danger: oklch(.43 .17 24);
  --danger-paper: oklch(.963 .025 24);
  --font-interface: Inter, system-ui, "PingFang SC", "Microsoft YaHei", sans-serif;
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s8: 32px;
  --s10: 40px;
  --s12: 48px;
  --radius-sm: 6px;
  --radius: 12px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { overflow-x: clip; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--background);
  color: var(--ink);
  font: 15px/1.55 var(--font-interface);
}
h1, h2, p { margin: 0; }
h1, h2 { line-height: 1.25; overflow-wrap: anywhere; }
h1 { font-weight: 650; font-size: clamp(1.55rem, 3vw, 1.9rem); }
h2 { font-size: 1.06rem; font-weight: 650; }
button, input { font: inherit; }
button:focus-visible, input:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}
.masthead { background: var(--paper); border-bottom: 1px solid var(--rule); }
.masthead-inner {
  max-width: 1120px;
  min-height: 62px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: var(--s2) var(--s4);
  margin: auto;
  padding: var(--s2) var(--s6);
}
.brand, .account { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.brand strong { font-size: 1.18rem; white-space: nowrap; }
.brand span { color: var(--muted); border-left: 1px solid var(--rule); padding-left: var(--s3); white-space: nowrap; }
#customer-name { color: var(--muted); overflow-wrap: anywhere; }
.main { max-width: 1120px; margin: auto; padding: var(--s6) var(--s6) var(--s12); }
.access {
  max-width: 420px;
  margin: var(--s12) auto;
  padding: var(--s8);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  background: var(--paper);
}
.access p { margin-top: var(--s2); }
.access form { display: grid; margin-top: var(--s6); gap: var(--s2); }
.access form :is(label,button):not(:first-child) { margin-top: var(--s2); }
label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: var(--s1); }
input {
  min-width: 0;
  width: 100%;
  min-height: 44px;
  padding: var(--s2) var(--s3);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  background: var(--paper);
  color: var(--ink);
}
input::placeholder { color: var(--muted); }
.button {
  min-height: 44px;
  padding: var(--s2) var(--s4);
  border: 1px solid var(--rule);
  border-radius: var(--radius-sm);
  font-weight: 600;
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
}
.button:hover { background: var(--background); }
.button:active { background: var(--blue-wash); }
.button.primary { background: var(--blue); border-color: var(--blue); color: var(--paper); }
.button.primary:hover, .button.primary:active { background: var(--blue-hover); }
.button:disabled, input:disabled { opacity: .6; cursor: default; }
.muted { color: var(--muted); }
.message, .notice { padding: var(--s2) var(--s3); border-radius: var(--radius-sm); color: var(--muted); }
.notice { margin: var(--s4) 0; background: var(--paper); border: 1px solid var(--rule); }
.is-error { color: var(--danger); background: var(--danger-paper); }
#starting-retry { margin-top: var(--s3); }
.sections {
  display: flex;
  gap: var(--s5);
  border-bottom: 1px solid var(--rule);
  margin-bottom: var(--s6);
}
.sections button {
  min-height: 44px;
  padding: var(--s2) var(--s1);
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  white-space: nowrap;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}
.sections button:hover, .sections button[aria-current] { color: var(--blue); }
.sections button[aria-current] { border-color: var(--blue); }
.section-heading {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: var(--s4);
  align-items: flex-end;
  margin-bottom: var(--s4);
}
.fields, .shipment-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--s2); }
.fields input, .shipment-filters input[type="date"] { width: auto; min-width: 140px; }
.shipment-filters input[type="search"] { min-width: 184px; }
.summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr);
  gap: var(--s4);
  margin-bottom: var(--s4);
}
.balance-card, .sheet, .empty { background: var(--paper); border: 1px solid var(--rule); border-radius: var(--radius); }
.balance-card { min-width: 0; padding: var(--s6); }
.balance-card.featured { border-top: 3px solid var(--blue); }
.balance-card .metric { margin-top: var(--s2); font-size: clamp(1.6rem, 4vw, 2.3rem); font-weight: 650; line-height: 1.2; overflow-wrap: anywhere; }
.balance-card h2 { margin-bottom: var(--s2); font-size: .88rem; color: var(--muted); }
.summary-list { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s2) var(--s4); margin: 0; }
.summary-list dd { margin: 0; font-weight: 650; }
.summary-list dt { font-size: .82rem; color: var(--muted); }
.numeric { font-variant-numeric: tabular-nums; }
.sheet { margin-bottom: var(--s4); }
.sheet > h2 { padding: var(--s4); border-bottom: 1px solid var(--rule); }
.sheet-body { padding: var(--s4); }
.sheet-body > * + * { margin-top: var(--s3); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: var(--s3) var(--s4); vertical-align: top; overflow-wrap: anywhere; }
th { color: var(--muted); font-size: .82rem; font-weight: 600; }
tbody tr { border-top: 1px solid var(--rule); }
.empty { padding: var(--s6) var(--s4); color: var(--muted); }
.shipment-items { margin: 0; padding: 0; list-style: none; }
.shipment-items > li + li { border-top: 1px solid var(--rule); }
.shipment-item { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s4); padding: var(--s4); }
.shipment-item dt { margin: 0; color: var(--muted); font-size: .83rem; }
.shipment-item dd { margin: 0; overflow-wrap: anywhere; }
.order-title { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: var(--s2); padding: var(--s4); border-bottom: 1px solid var(--rule); }
.order-summary { margin: 0; border-top: 1px solid var(--rule); background: var(--background); }
.order-summary > div:last-child { font-weight: 650; }
.shipping h3 { margin: 0; font-size: .9rem; }
.shipping ul { margin-bottom: 0; padding-left: var(--s5); overflow-wrap: anywhere; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); margin-top: var(--s4); }

@media (max-width: 640px) {
  .masthead-inner, .main { padding-right: var(--s4); padding-left: var(--s4); }
  .section-heading { display: grid; grid-template-columns: minmax(0, 1fr); }
  .summary { grid-template-columns: minmax(0, 1fr); gap: var(--s2); }
  .balance-card { padding: var(--s4); }
  .access { margin-top: var(--s6); padding: var(--s6); }
  .shipment-filters { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
  .shipment-filters > div:first-child { grid-column: 1 / -1; }
  .shipment-filters input[type="search"] { min-width: 0; }
  .shipment-item { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  th, td { padding: var(--s2) var(--s3); }
  .mobile-rows, .mobile-rows tbody { display: block; }
  .mobile-rows thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: clip;
    clip-path: inset(50%);
  }
  .mobile-rows tr {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--s2) var(--s4);
    padding: var(--s3) var(--s4);
  }
  .mobile-rows tbody tr:first-child { border-top: 0; }
  .mobile-rows td { padding: 0; }
  .mobile-rows td:first-child { grid-column: 1 / -1; font-weight: 600; }
  .mobile-rows td:not(:first-child)::before {
    content: attr(data-label);
    display: block;
    font-size: .8rem;
    color: var(--muted);
  }
}

@media (max-width: 420px) {
  .mobile-rows tr { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
