:root {
  color-scheme: light;
  --ink: #18212f;
  --muted: #667085;
  --line: #e4e7ec;
  --surface: #ffffff;
  --canvas: #f6f8fb;
  --blue: #175cd3;
  --green: #087443;
  --green-soft: #ecfdf3;
  --amber: #b54708;
  --amber-soft: #fffaeb;
  --red: #b42318;
  --red-soft: #fef3f2;
  --purple: #6941c6;
  --purple-soft: #f9f5ff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); -webkit-font-smoothing: antialiased; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(28px, 3vw, 42px); letter-spacing: -0.04em; line-height: 1.1; }
h2 { font-size: 20px; letter-spacing: -0.02em; }

.topbar { background: linear-gradient(115deg, #101828 0%, #182b49 100%); color: #fff; padding: 30px clamp(20px, 5vw, 72px) 26px; display: flex; justify-content: space-between; gap: 32px; align-items: flex-end; box-shadow: 0 3px 14px rgb(16 24 40 / 15%); }
.topbar-copy { min-width: 260px; }
.subtitle { color: #b9c3d3; margin-top: 10px; }
.eyebrow { font-size: 11px; letter-spacing: .14em; font-weight: 800; color: #98a2b3; margin-bottom: 8px; }
.topbar-tools { display: grid; gap: 12px; justify-items: end; }
.workspace-chip { display: inline-flex; align-items: center; gap: 7px; color: #d0d5dd; font-size: 12px; font-weight: 700; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #32d583; box-shadow: 0 0 0 4px rgb(50 213 131 / 14%); }
.top-actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; justify-content: flex-end; }
.token-control { font-size: 12px; color: #cbd5e1; display: flex; align-items: center; gap: 8px; }
.token-help { color: #98a2b3; font-size: 11px; margin-right: 3px; }

input, select { border: 1px solid var(--line); border-radius: 8px; min-height: 38px; padding: 8px 10px; font: inherit; color: var(--ink); background: #fff; width: 100%; }
.token-control input { width: 150px; min-height: 34px; background: #1d2939; color: #fff; border-color: #475467; }
.token-control input::placeholder { color: #98a2b3; }
.page { max-width: 1500px; margin: 0 auto; padding: 28px clamp(16px, 4vw, 56px) 64px; }
.context-strip { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; padding: 14px 16px; background: #eef4ff; border: 1px solid #c7d7fe; border-radius: 12px; color: #193b73; }
.context-strip div { display: grid; gap: 3px; }
.context-strip span:not(.last-updated) { color: #526681; font-size: 12px; }
.last-updated { color: #526681; font-size: 12px; white-space: nowrap; }

.summary-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 12px; margin-bottom: 22px; }
.metric { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 17px; box-shadow: 0 1px 2px rgb(16 24 40 / 4%); overflow: hidden; }
.metric::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: #c7d7fe; }
.metric:nth-child(2)::before, .metric:nth-child(6)::before { background: #f79009; }
.metric:nth-child(4)::before { background: #12b76a; }
.metric-value { font-size: 27px; font-weight: 750; letter-spacing: -0.04em; }
.metric-label { color: var(--muted); font-size: 13px; margin-top: 6px; }

.two-column { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(280px, .7fr); gap: 18px; margin-bottom: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 18px; box-shadow: 0 1px 2px rgb(16 24 40 / 4%), 0 8px 24px rgb(16 24 40 / 3%); overflow: hidden; }
.panel-heading { padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); }
.panel-heading-tools { align-items: flex-end; }
.panel-description { color: var(--muted); font-size: 12px; margin-top: 5px; line-height: 1.45; }
.panel-tools { display: flex; align-items: center; gap: 10px; }
.search-control { width: 190px; }
.search-control input { min-height: 34px; padding: 7px 10px; font-size: 12px; background: #fcfcfd; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-size: 13px; }
th { position: sticky; top: 0; z-index: 1; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; background: #fcfcfd; white-space: nowrap; }
tbody tr:hover { background: #f8fafc; }
tbody tr:last-child td { border-bottom: 0; }
.shipment-id { font-weight: 700; }
.subline, .small-note { color: var(--muted); font-size: 12px; line-height: 1.5; }

.status { display: inline-flex; padding: 5px 8px; border-radius: 999px; font-size: 11px; font-weight: 750; letter-spacing: .03em; white-space: nowrap; }
.status-PENDING, .status-CANDIDATE { color: var(--amber); background: var(--amber-soft); }
.status-REVIEW_REQUIRED { color: var(--purple); background: var(--purple-soft); }
.status-SYNCED, .status-VALIDATED { color: var(--green); background: var(--green-soft); }
.status-SKIPPED { color: var(--muted); background: #f2f4f7; }
.status-FAILED { color: var(--red); background: var(--red-soft); }

.button { border: 0; border-radius: 8px; min-height: 36px; padding: 8px 13px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.button.primary { background: var(--blue); color: #fff; }
.button.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.topbar .button.secondary { background: #1d2939; color: #fff; border-color: #344054; }
.button.danger { background: var(--red-soft); color: var(--red); }
.button:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgb(16 24 40 / 12%); }
.button.primary:not(:disabled):hover { background: #1849a9; }
.button:disabled { opacity: .55; cursor: wait; }
.icon-button { border: 0; background: transparent; font-size: 28px; color: var(--muted); cursor: pointer; }
.count-pill { min-width: 28px; text-align: center; padding: 5px 9px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); font-weight: 750; font-size: 12px; }

.connection-list { padding: 2px 20px 12px; }
.connection-item { display: flex; justify-content: space-between; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.connection-item:last-child { border-bottom: 0; }
.connection-item > span:first-child { font-weight: 650; }
.connection-item > .subline { max-width: 58%; text-align: right; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 7px; background: #98a2b3; }
.dot.good { background: #12b76a; }
.dot.warn { background: #f79009; }
.notice { padding: 13px 15px; background: var(--red-soft); color: var(--red); border: 1px solid #fecdca; border-radius: 10px; margin-bottom: 16px; font-size: 13px; line-height: 1.45; }
.notice.success { background: var(--green-soft); color: var(--green); border-color: #abefc6; }
.info-note { display: grid; gap: 3px; margin: 4px 20px 20px; padding: 12px 13px; border: 1px solid #d6bbfb; border-radius: 9px; background: var(--purple-soft); color: #53389e; font-size: 12px; line-height: 1.45; }
.info-note strong { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }

.modal { position: fixed; inset: 0; background: rgb(16 24 40 / 62%); display: grid; place-items: center; padding: 20px; z-index: 10; }
.modal-card { background: #fff; width: min(780px, 100%); max-height: 90vh; overflow: auto; border-radius: 14px; box-shadow: 0 24px 48px rgb(16 24 40 / 22%); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; padding: 18px 20px; }
.form-grid label { display: grid; gap: 6px; font-size: 12px; font-weight: 700; color: var(--muted); }
.modal-actions { padding: 0 20px 18px; display: flex; gap: 8px; align-items: center; }
.spacer { flex: 1; }
details { border-top: 1px solid var(--line); padding: 14px 20px 20px; }
summary { cursor: pointer; color: var(--blue); font-size: 13px; font-weight: 700; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #101828; color: #d0d5dd; border-radius: 8px; padding: 14px; font-size: 11px; max-height: 320px; overflow: auto; margin-bottom: 0; }

@media (max-width: 1050px) {
  .summary-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .two-column { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-tools { width: 100%; justify-items: start; }
  .top-actions { justify-content: flex-start; }
}
@media (max-width: 700px) {
  .context-strip, .panel-heading-tools { align-items: flex-start; flex-direction: column; }
  .panel-tools { width: 100%; justify-content: space-between; }
  .search-control { flex: 1; width: auto; }
  .token-help { display: none; }
}
@media (max-width: 560px) {
  .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .modal-actions { flex-wrap: wrap; }
  .spacer { display: none; }
  .top-actions { display: grid; width: 100%; grid-template-columns: 1fr 1fr; }
  .token-control { grid-column: 1 / -1; justify-content: space-between; }
  .token-control input { flex: 1; width: auto; }
  .top-actions .button { width: 100%; }
  .connection-item { align-items: flex-start; flex-direction: column; gap: 5px; }
  .connection-item > .subline { max-width: 100%; text-align: left; }
}
