:root {
  --navy: #2c4a6e; --navy-dark: #223a57; --blue: #2f6fb5;
  --bg: #fff; --surface: #fff; --surface-2: #f4f6f8; --border: #dfe3e8; --border-strong: #c9d0d8; --control: #8a94a3;
  --text: #1f2933; --muted: #5f6b7a; --accent: var(--navy); --accent-text: #fff; --accent-soft: #e8eef5;
  --danger: #b42318; --danger-soft: #fdecea;
  --s-delivered: #217a4d; --s-delivered-bg: #e3f4ea;
  --s-ofd: #6b3fa0; --s-ofd-bg: #efe8f8;
  --s-transit: #2f6fb5; --s-transit-bg: #e4eefa;
  --s-label: #5f6b7a; --s-label-bg: #eceff3;
  --s-exception: #b45309; --s-exception-bg: #fdefdc;
  --s-notfound: #b42318; --s-notfound-bg: #fdecea;
  --s-unchecked: #6b7280; --s-unchecked-bg: #f1f3f5;
  --shadow: 0 1px 4px rgb(0 0 0 / .16);
  --radius: 4px;
  --font: Roboto, "Helvetica Neue", Helvetica, Arial, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--accent); color: var(--accent-text); padding: 8px 12px; border-radius: 8px; z-index: 100; }
.skip:focus { left: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); }

/* layout */
.topbar { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--border); }
.topbar-in { max-width: 1240px; margin: 0 auto; padding: 0 20px; height: 60px; display: flex; align-items: center; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.02em; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); display: grid; place-items: center; color: var(--accent-text); }
.brand-mark svg { width: 18px; height: 18px; }
.top-sp { flex: 1; }
.tag { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); }
main { max-width: 1240px; margin: 0 auto; padding: 28px 20px 80px; }
.page-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0; font-size: 26px; letter-spacing: -.02em; line-height: 1.2; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.grow { flex: 1; min-width: 0; }
.rcard, main { min-width: 0; }
.page-head h1, .rcard h2 { overflow-wrap: anywhere; }
.meta span { min-width: 0; overflow-wrap: anywhere; }

/* controls */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--border-strong); background: var(--surface); padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 600; font-size: 14px; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover:not(:disabled) { filter: brightness(1.08); background: var(--accent); }
.btn.danger { color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 13px; border-radius: 8px; }
.btn svg, .ico { width: 16px; height: 16px; flex: none; }
.input, .select { background: var(--surface); border: 1px solid var(--control); border-radius: 10px; padding: 9px 12px; min-width: 0; width: 100%; }
.input:focus, .select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%238a91ad'%3E%3Cpath d='M5.5 7.5L10 12l4.5-4.5z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; background-size: 18px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > label { font-size: 12px; font-weight: 600; color: var(--muted); }
.searchbox { position: relative; }
.searchbox .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.searchbox .input { padding-left: 38px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.filters { padding: 14px; display: grid; gap: 12px; margin-bottom: 18px; }
.filter-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; align-items: start; }
.input[type=date] { min-height: 40px; }
.result-line { display: flex; align-items: center; gap: 12px; margin: 0 2px 12px; color: var(--muted); font-size: 14px; }

/* status */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px 2px 8px; border-radius: 99px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--s-unchecked-bg); color: var(--s-unchecked); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-delivered { --c: var(--s-delivered); --cb: var(--s-delivered-bg); }
.st-out_for_delivery { --c: var(--s-ofd); --cb: var(--s-ofd-bg); }
.st-in_transit { --c: var(--s-transit); --cb: var(--s-transit-bg); }
.st-label_created { --c: var(--s-label); --cb: var(--s-label-bg); }
.st-exception { --c: var(--s-exception); --cb: var(--s-exception-bg); }
.st-not_found { --c: var(--s-notfound); --cb: var(--s-notfound-bg); }
.st-unchecked, .st-unsupported { --c: var(--s-unchecked); --cb: var(--s-unchecked-bg); }
.pill[class*="st-"] { color: var(--c); background: var(--cb); }
.carrier { display: inline-block; font-size: 11px; font-weight: 800; letter-spacing: .02em; padding: 2px 7px; border-radius: 6px; line-height: 1.4; }
.carrier.ups { background: #351c15; color: #ffb500; }
.carrier.fedex { background: #4d148c; color: #fff; }
.carrier.purolator { background: #d52b1e; color: #fff; }
.carrier.unknown { background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* report cards */
.report-list { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); }
.rcard { padding: 18px 20px; display: grid; gap: 12px; transition: border-color .12s, transform .12s; cursor: pointer; color: inherit; }
.rtitle { color: inherit; }
.rtitle:hover { text-decoration: none; color: var(--accent); }
.rcard:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent-soft) 35%, var(--surface)); text-decoration: none; }
.bar > i.st-unsupported { background: repeating-linear-gradient(45deg, var(--c) 0 3px, transparent 3px 6px); }
.rcard-top { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.rcard h2 { margin: 0; font-size: 17px; line-height: 1.3; letter-spacing: -.01em; overflow-wrap: anywhere; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--muted); font-size: 13px; margin-top: 4px; }
.meta span { display: inline-flex; align-items: center; gap: 5px; }
.chip { font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); white-space: nowrap; }
.chip.on { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.match { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.bar { display: flex; height: 8px; border-radius: 99px; overflow: hidden; background: var(--surface-2); gap: 2px; }
.bar > i { display: block; height: 100%; background: var(--c); min-width: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 13px; color: var(--muted); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend b { color: var(--text); font-weight: 650; }
.legend i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); display: inline-block; }

/* stat tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(128px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 12px; padding: 12px 14px; cursor: pointer; display: grid; gap: 2px; box-shadow: var(--shadow); }
.tile:hover { border-color: var(--border-strong); }
.tile[aria-pressed="true"] { border-color: var(--accent); outline: 2px solid var(--accent); outline-offset: -2px; }
.tile .n { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.tile .l { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.tile .l i { width: 8px; height: 8px; border-radius: 50%; background: var(--c, var(--muted)); }
.tile .n { color: var(--c, var(--text)); }
.progress { margin: 0 0 18px; }
.progress .meta { margin: 6px 0 0; }

/* table */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
th:first-child { border-top-left-radius: var(--radius); } th:last-child { border-top-right-radius: var(--radius); }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr { cursor: pointer; }
tbody tr:hover td { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: 0; }
.store-no { font-weight: 700; color: var(--accent); }
.trk { display: flex; align-items: center; gap: 8px; }
.trk .mono { font-size: 13px; }
.rowbtn { border: 0; background: transparent; padding: 2px; margin: -2px; cursor: pointer; border-radius: 99px; }
.copy { border: 0; background: transparent; padding: 4px; border-radius: 6px; cursor: pointer; color: var(--muted); display: inline-grid; }
.copy:hover { background: var(--surface-2); color: var(--text); }
.sub-line { font-size: 12.5px; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; border-top: 1px solid var(--border); flex-wrap: wrap; font-size: 14px; color: var(--muted); }
.pager .btns { display: flex; gap: 8px; align-items: center; }

/* banners */
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 10px; margin-bottom: 14px; font-size: 14px; background: var(--accent-soft); color: var(--text); border: 1px solid var(--border); }
.banner.warn { background: var(--s-exception-bg); border-color: transparent; }
.banner .ico { margin-top: 3px; color: var(--accent); }
.banner.warn .ico { color: var(--s-exception); }
.banner ul { margin: 2px 0 0; padding-left: 18px; }
.banner .x { margin-left: auto; border: 0; background: transparent; cursor: pointer; color: var(--muted); padding: 2px; }

/* empty / state */
.empty { text-align: center; padding: 56px 20px; display: grid; gap: 8px; justify-items: center; }
.empty .art { width: 72px; height: 72px; border-radius: 20px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; margin-bottom: 8px; }
.empty .art svg { width: 36px; height: 36px; }
.empty h1, .empty h2 { margin: 0; font-size: 20px; }
.empty p { margin: 0 0 8px; color: var(--muted); max-width: 420px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--border), var(--surface-2)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: 8px; height: 14px; }
@keyframes sk { to { background-position: -200% 0; } }
.spin { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: rot .7s linear infinite; display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }
.center-page { min-height: 70vh; display: grid; place-items: center; padding: 20px; }
.login { width: min(380px, 100%); padding: 28px; display: grid; gap: 16px; }
.login h1 { margin: 0; font-size: 22px; }

/* modal + drawer */
.overlay { position: fixed; inset: 0; background: rgb(10 12 24 / .55); z-index: 50; display: grid; place-items: center; padding: 16px; animation: fade .15s; }
.modal { width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; padding: 22px; display: grid; gap: 16px; }
.modal h2 { margin: 0; font-size: 19px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.drop { border: 2px dashed var(--border-strong); border-radius: 14px; padding: 30px 16px; text-align: center; cursor: pointer; display: grid; gap: 6px; justify-items: center; background: var(--surface-2); transition: border-color .12s, background .12s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop .ico { width: 30px; height: 30px; color: var(--accent); }
.err { color: var(--danger); background: var(--danger-soft); padding: 9px 12px; border-radius: 9px; font-size: 14px; }
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; }
.track { width: 42px; height: 24px; border-radius: 99px; background: var(--control); position: relative; transition: background .15s; flex: none; }
.track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + .track { background: var(--accent); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 2px solid var(--accent); outline-offset: 2px; }
.linkrow { display: flex; gap: 8px; }
.drawer-scrim { position: fixed; inset: 0; background: rgb(10 12 24 / .45); z-index: 40; animation: fade .15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(480px, 100%); background: var(--surface); z-index: 41; box-shadow: -8px 0 40px rgb(0 0 0 / .2); display: flex; flex-direction: column; animation: slide .2s ease-out; }
@keyframes fade { from { opacity: 0; } } @keyframes slide { from { transform: translateX(30px); opacity: 0; } }
.drawer-head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; gap: 12px; align-items: flex-start; }
.drawer-body { padding: 20px; overflow: auto; flex: 1; display: grid; gap: 20px; align-content: start; }
.drawer-foot { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.fact dt { font-size: 12px; color: var(--muted); font-weight: 600; }
.fact dd { margin: 2px 0 0; font-weight: 600; overflow-wrap: anywhere; }
.big-status { padding: 16px; border-radius: 12px; background: var(--cb, var(--surface-2)); color: var(--c, var(--text)); display: grid; gap: 2px; }
.big-status b { font-size: 20px; letter-spacing: -.01em; }
.big-status span { color: var(--text); opacity: .8; font-size: 14px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 26px; }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 8px; bottom: -2px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 0; top: 5px; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 3px solid var(--border-strong); }
.timeline li:first-child::after { border-color: var(--c, var(--accent)); background: var(--c, var(--accent)); }
.timeline .d { font-weight: 600; }
.timeline .w { font-size: 13px; color: var(--muted); }
h2.sec { margin: 0 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }

#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; justify-items: center; width: min(420px, calc(100% - 32px)); pointer-events: none; }
.toast { background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow); animation: fade .15s; }
.toast.bad { background: #b4232a; color: #fff; }

/* responsive */
@media (max-width: 760px) {
  main { padding: 18px 14px 60px; }
  .topbar-in { padding: 0 14px; }
  .page-head h1 { font-size: 22px; }
  .hide-sm { display: none !important; }
  table, tbody, tr, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tbody tr { padding: 12px 14px; border-bottom: 1px solid var(--border); display: grid; gap: 6px; }
  tbody tr:last-child { border-bottom: 0; }
  td { padding: 0; border: 0; }
  td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 650; }
  tbody tr:hover td { background: transparent; }
  .facts { grid-template-columns: 1fr; }
  .drawer { width: 100%; }
}
@media (pointer: coarse) {
  .btn, .input, .select { min-height: 44px; }
  .btn.sm, .copy, .banner .x { min-width: 44px; min-height: 44px; justify-content: center; }
  .copy { place-items: center; }
  .page-head a.muted { display: inline-block; padding: 12px 0; }
  .brand { min-height: 44px; }
}
@media (max-width: 760px) {
  .filter-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .drawer-foot .grow { flex-basis: 100%; }
  tbody tr { grid-template-columns: 1fr auto; align-items: center; }
  tbody td:nth-child(n+2):nth-child(-n+4) { grid-column: 1 / -1; }
  tbody td:nth-child(5) { grid-row: 1; grid-column: 2; text-align: right; }
  tbody td:nth-child(5)::before { display: none; }
  tbody td:nth-child(-n+3)[data-label]::before { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ===== Worktraq look: navy header, white cards with navy top border, grey buttons, solid status pills ===== */
body { background: var(--bg); font-size: 14px; }
.topbar { background: var(--navy); border-bottom: 0; backdrop-filter: none; }
.topbar-in { height: 64px; max-width: none; padding: 0 20px; gap: 18px; }
.brand { color: #fff; font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.brand-mark { background: rgb(255 255 255 / .14); border-radius: 6px; width: 34px; height: 34px; color: #fff; }
.brand-mark svg { width: 20px; height: 20px; }
.tag { background: rgb(255 255 255 / .16); color: #fff; border-radius: 4px; }
.navitem { display: grid; justify-items: center; gap: 4px; min-width: 76px; padding: 8px 10px; color: #fff; background: transparent; border: 0; border-radius: 4px; font-size: 12.5px; font-weight: 500; cursor: pointer; }
.navitem:hover { background: rgb(255 255 255 / .12); text-decoration: none; }
.navitem .ico { width: 24px; height: 24px; }
.topbar :focus-visible { outline-color: #fff; }
main { max-width: none; padding: 20px 20px 80px; }
.page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: 0; }
.page-head .sub { font-size: 14px; }

.card { border-radius: var(--radius); border: 1px solid var(--border); border-top: 3px solid var(--navy); box-shadow: var(--shadow); }
.drawer, .tile { border-radius: var(--radius); }
.tile { border: 1px solid var(--border); border-top: 3px solid var(--navy); box-shadow: var(--shadow); }
.tile[aria-pressed="true"] { outline-color: var(--blue); border-color: var(--blue); }
.rcard:hover { background: var(--surface-2); border-color: var(--border); border-top-color: var(--navy); }
.rtitle:hover { color: var(--blue); }

.btn { background: #eef0f3; border: 1px solid transparent; color: var(--text); border-radius: 6px; font-weight: 600; }
.btn:hover:not(:disabled) { background: #e1e5ea; }
.btn.primary { background: var(--navy); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--navy-dark); filter: none; }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; }
.input, .select { border-radius: 4px; border-color: var(--control); }
.input:focus, .select:focus { outline-color: var(--blue); }
:focus-visible { outline-color: var(--blue); }

/* tables: plain bold headers like the Worktraq grids */
th { background: transparent; color: var(--text); text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 700; border-bottom: 1px solid var(--border-strong); padding: 12px 14px; }
th:first-child, th:last-child { border-radius: 0; }
td { padding: 11px 14px; }
tbody tr:hover td { background: #f6f8fa; }
.store-no { color: var(--text); text-decoration: underline; font-weight: 600; }

/* status pills: solid colour, white text, no dot */
.pill { border-radius: 12px; padding: 3px 11px; font-size: 12px; font-weight: 700; }
.pill::before { display: none; }
.pill[class*="st-"] { background: var(--c); color: #fff; }
.chip { border-radius: 4px; }
.chip.on, .chip.match { background: var(--accent-soft); color: var(--navy); }
.banner { border-radius: 4px; }
.banner .ico { color: var(--navy); }
.pager { color: var(--muted); }
.bar { border-radius: 4px; height: 10px; }
.timeline li:first-child::after { background: var(--c, var(--navy)); border-color: var(--c, var(--navy)); }
.drop { border-radius: 6px; }
.drop .ico, .empty .art { color: var(--navy); }
.empty .art { background: var(--accent-soft); border-radius: 12px; }
.toast { background: var(--navy); color: #fff; border-radius: 4px; }
.skip { background: var(--navy); }
@media (max-width: 760px) {
  .topbar-in { padding: 0 12px; height: 58px; }
  .brand { font-size: 22px; }
  .navitem { min-width: 56px; padding: 6px 6px; font-size: 11.5px; }
  main { padding: 14px 12px 60px; }
}
