:root {
  color-scheme: light;
  --ink: #15242d;
  --muted: #647582;
  --line: #dbe4e7;
  --surface: #fff;
  --surface-soft: #f7faf9;
  --canvas: #f1f5f4;
  --brand: #0f766e;
  --brand-dark: #0b5b55;
  --brand-soft: #e5f3f0;
  --danger: #b4232c;
  --shadow: 0 8px 24px rgb(25 47 52 / 7%);
}
* { box-sizing: border-box; }
html { min-width: 320px; }
body { margin: 0; font: 15px/1.55 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif; color: var(--ink); background: var(--canvas); }
a { color: var(--brand); text-underline-offset: 2px; }
.site-header { position: sticky; top: 0; z-index: 20; background: #12383a; color: #fff; box-shadow: 0 3px 16px rgb(12 38 40 / 18%); }
nav { max-width: 1380px; min-height: 64px; margin: auto; padding: 0 1.25rem; display: flex; align-items: center; gap: 1.25rem; }
nav a { color: #e7f3f1; text-decoration: none; }
.brand { display: inline-flex; align-items: center; gap: .65rem; font-weight: 760; font-size: 1.02rem; white-space: nowrap; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; display: inline-grid; place-items: center; background: #28a294; color: #fff; font-weight: 850; }
.nav-links { display: flex; align-items: center; gap: .2rem; }
.nav-links a { padding: .55rem .68rem; border-radius: 7px; font-size: .92rem; }
.nav-links a:hover, .nav-links a.active { background: rgb(255 255 255 / 12%); color: #fff; }
.account-menu { margin-left: auto; display: flex; align-items: center; gap: .7rem; font-size: .88rem; white-space: nowrap; }
.account-menu form { margin: 0; }
.user-chip { color: #a9d7d1; }
.nav-button { padding: .38rem .58rem; background: transparent; border: 1px solid rgb(255 255 255 / 25%); }
main { max-width: 1380px; margin: 1.75rem auto; padding: 0 1.25rem 4rem; }
h1, h2, h3 { line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: clamp(1.65rem, 2.5vw, 2.15rem); margin: 0; }
h2 { font-size: 1.15rem; margin: 0; }
.page-heading { margin-bottom: 1.2rem; }
.page-heading p { margin: .35rem 0 0; color: var(--muted); }
.split-heading, .section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.eyebrow { display: block; color: var(--brand); font-weight: 750; font-size: .78rem; letter-spacing: .08em; margin-bottom: .22rem; }
.panel, .card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 1.15rem; margin-bottom: 1rem; box-shadow: var(--shadow); }
.compact-panel { padding: 1rem 1.15rem; }
.stack-form > * + * { margin-top: 1rem; }
.actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin: 1rem 0; }
button, .button { min-height: 38px; border: 0; border-radius: 7px; background: var(--brand); color: #fff; padding: .55rem .9rem; font: inherit; font-weight: 680; text-decoration: none; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
button:hover, .button:hover { background: var(--brand-dark); }
button:disabled { cursor: wait; opacity: .72; }
.button.secondary { background: #42545f; }
.button.danger { background: var(--danger); }
.button.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.sticky-actions { width: 100%; padding: .7rem; margin-top: 0; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
input, select, textarea { width: 100%; min-height: 40px; border: 1px solid #afbdc3; border-radius: 7px; padding: .5rem .62rem; background: #fff; color: var(--ink); font: inherit; }
textarea { min-height: 76px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgb(15 118 110 / 14%); border-color: var(--brand); }
input[type=checkbox] { width: auto; min-height: 0; }
label { display: block; font-weight: 680; margin: 0 0 .32rem; font-size: .9rem; }
form p { margin: 0; }
.helptext, .field-hint { color: var(--muted); font-size: .82rem; }
.errorlist { list-style: none; margin: .3rem 0 0; padding: 0; color: var(--danger); font-size: .82rem; }
.alert { padding: .75rem .9rem; border-radius: 8px; }
.alert.error, [role=alert] { color: #871f27; background: #fff0f1; border: 1px solid #f2c5c9; }
.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.messages li { padding: .75rem .9rem; background: #ddf3ec; border: 1px solid #b9e0d4; border-radius: 8px; margin-bottom: .5rem; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 11px; background: #fff; box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: .72rem .75rem; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; vertical-align: middle; }
th { color: #566975; background: #f6f9f8; font-size: .8rem; font-weight: 750; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfdfc; }
.data-table { min-width: 1060px; }
.badge { display: inline-block; border-radius: 999px; background: #e7eef0; color: #3a4a54; padding: .17rem .58rem; font-size: .78rem; font-weight: 690; white-space: nowrap; }
.badge.delivered { background: #d8f1e6; color: #176044; }
.badge.voided, .badge.exception { background: #f8dfe1; color: #84242b; }
.inline-form { display: inline; }
.link-button { min-height: auto; background: none; border: 0; color: var(--brand); padding: 0 0 0 .3rem; text-decoration: underline; font-weight: 500; }
.link-button:hover { background: none; }
.danger-link { color: var(--danger); }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .9rem 1rem; }
.order-header-grid { grid-template-columns: 1.3fr 1fr 1fr .8fr; margin-top: 1rem; }
.batch-default-grid { margin-top: 1rem; }
.span-all { grid-column: 1 / -1; }
.notes-field textarea { min-height: 64px; }
.filter-bar { display: grid; grid-template-columns: repeat(5, minmax(145px, 1fr)); gap: .8rem; align-items: end; padding: 1rem; }
.detail-filter { grid-template-columns: 2fr repeat(3, minmax(150px, 1fr)) auto; }
.filter-actions { display: flex; gap: .5rem; align-items: end; }
.metrics { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .75rem; margin-bottom: 1rem; }
.compact-metrics { grid-template-columns: repeat(2, minmax(180px, 240px)); }
.metric { background: #fff; border: 1px solid var(--line); border-radius: 11px; padding: .9rem 1rem; box-shadow: var(--shadow); }
.metric span { color: var(--muted); font-size: .84rem; }
.metric strong { display: block; margin-top: .14rem; font-size: 1.35rem; }
.muted { color: var(--muted); }
.compact-copy { margin: .5rem 0 1rem; }
.shipment-sheet { padding: 0; overflow: hidden; }
.shipment-sheet > .section-heading, .shipment-sheet > .compact-copy { padding-left: 1.15rem; padding-right: 1.15rem; }
.shipment-sheet > .section-heading { padding-top: 1rem; }
.shipment-sheet-scroll { border: 0; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.shipment-entry-table { min-width: 1660px; table-layout: fixed; }
.shipment-entry-table th:nth-child(1) { width: 48px; }
.shipment-entry-table th:nth-child(2) { width: 170px; }
.shipment-entry-table th:nth-child(3), .shipment-entry-table th:nth-child(4) { width: 82px; }
.shipment-entry-table th:nth-child(5) { width: 104px; }
.shipment-entry-table th:nth-child(6) { width: 170px; }
.shipment-entry-table th:nth-child(7), .shipment-entry-table th:nth-child(8) { width: 118px; }
.shipment-entry-table th:nth-child(9), .shipment-entry-table th:nth-child(10), .shipment-entry-table th:nth-child(11) { width: 110px; }
.shipment-entry-table th:nth-child(12) { width: 120px; }
.shipment-entry-table th:nth-child(13) { width: 160px; }
.shipment-entry-table td { padding: .55rem; vertical-align: top; }
.shipment-entry-table input, .shipment-entry-table select { min-height: 36px; padding: .42rem .48rem; }
.row-number span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 750; }
.fee-preview { display: block; padding-top: .45rem; font-weight: 760; }
.row-overrides summary { color: var(--brand); cursor: pointer; font-weight: 680; padding: .4rem 0; }
.override-grid { display: grid; grid-template-columns: repeat(3, minmax(170px, 1fr)); gap: .7rem; width: 660px; padding: .75rem; margin-top: .4rem; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 9px; }
.provider-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.provider-card { margin: 0; }
.provider-card h2 { font-size: 1.3rem; }
.provider-card .section-heading p { margin: .25rem 0 0; }
.provider-actions { display: flex; gap: 1rem; padding: .75rem 0; margin: .75rem 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.channel-list { display: grid; gap: .45rem; }
.channel-item { display: flex; align-items: center; justify-content: space-between; padding: .62rem .72rem; border-radius: 8px; background: var(--surface-soft); }
.channel-item span { display: flex; gap: .6rem; align-items: center; }
.channel-item small { color: var(--muted); }
.master-form { max-width: 760px; }
.master-form > p + p { margin-top: .85rem; }
.action-cell > a { display: inline-block; margin: .15rem .45rem .15rem 0; }
.approval-history { margin-top: .45rem; color: var(--muted); font-size: .82rem; }
.approval-history summary { cursor: pointer; color: var(--brand); }
.empty-state { padding: 1.5rem; text-align: center; color: var(--muted); }
@media (max-width: 1100px) {
  nav { align-items: flex-start; flex-wrap: wrap; padding-top: .7rem; padding-bottom: .7rem; }
  .nav-links { order: 3; width: 100%; overflow-x: auto; }
  .account-menu { margin-left: auto; }
  .filter-bar, .detail-filter { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .order-header-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metrics { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 760px) {
  main { margin-top: 1.15rem; padding-left: .85rem; padding-right: .85rem; }
  nav { gap: .7rem; padding-left: .85rem; padding-right: .85rem; }
  .account-menu { width: 100%; margin: 0; overflow-x: auto; padding-bottom: .15rem; }
  .user-chip { margin-right: auto; }
  .split-heading, .section-heading { align-items: flex-start; flex-direction: column; }
  .form-grid, .filter-bar, .detail-filter, .provider-grid { grid-template-columns: 1fr; }
  .metrics, .compact-metrics { grid-template-columns: 1fr 1fr; }
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; min-width: 0; }
  table.responsive tr { border-bottom: 8px solid var(--canvas); padding: .65rem; }
  table.responsive td { border: 0; padding: .34rem; white-space: normal; }
  table.responsive td::before { content: attr(data-label) ": "; color: var(--muted); font-weight: 680; }
  table.responsive td.empty-state::before { content: ""; }
  .action-cell { padding-top: .65rem !important; }
  .shipment-sheet { margin-left: -.15rem; margin-right: -.15rem; }
}
@media (max-width: 430px) {
  .metrics, .compact-metrics, .order-header-grid { grid-template-columns: 1fr; }
  .nav-links a { padding-left: .5rem; padding-right: .5rem; }
}
