:root {
  color-scheme: light;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #161616;
  background: #f5f7fa;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  --brand: #335cff;
  --brand-tint: #f2f5ff;
  --ink-soft: #5c5c5c;
  --muted: #626a76;
  --line: #e3e7ed;
  --surface: #ffffff;
  --canvas: #f5f7fa;
}

* { box-sizing: border-box; }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--canvas); }
a { color: inherit; cursor: pointer; }
button, summary, .field-control label, .login-form label { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid #2444d8; outline-offset: 3px; }

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar-inner { width: min(1180px, calc(100% - 48px)); min-height: 68px; margin: auto; display: flex; align-items: center; gap: 36px; }
.wordmark { color: #161616; font-size: 17px; font-weight: 750; letter-spacing: -0.045em; text-decoration: none; white-space: nowrap; }
.main-nav { display: flex; align-self: stretch; gap: 26px; }
.main-nav a { display: flex; align-items: center; min-height: 68px; border-bottom: 2px solid transparent; color: var(--muted); font-size: 14px; text-decoration: none; }
.main-nav a:hover, .main-nav a.active { color: var(--brand); }
.main-nav a.active { border-bottom-color: var(--brand); }
.logout-form { margin-left: auto; }
.text-button { min-height: 44px; padding: 0 8px; border: 0; background: transparent; color: var(--ink-soft); font: inherit; font-size: 14px; }
.text-button:hover { color: var(--brand); }
.text-button:active, .back-link:active { color: #2444d8; }
.main-nav a:active, .back-link:hover { color: #2444d8; }

.page-shell { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 46px 0 72px; }
.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 26px; }
.page-heading h1, .error-state h1 { margin: 4px 0 7px; font-size: clamp(28px, 4vw, 36px); letter-spacing: -0.045em; line-height: 1.15; }
.section-kicker { margin: 0; color: #52627d; font-size: 12px; font-weight: 650; }
.supporting-copy { max-width: 620px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.record-count { flex: 0 0 auto; margin: 0 0 3px; color: var(--muted); font-size: 13px; }
.record-count strong { color: #161616; font-size: 16px; font-weight: 700; }
.notice { margin: 0 0 20px; padding: 12px 15px; border: 1px solid transparent; border-radius: 5px; font-size: 14px; }
.notice-success { border-color: #9bd8b4; background: #eaf8ef; color: #145b35; }
.notice-error { border-color: #efb1b6; background: #fff0f1; color: #9c2631; }

.job-list, .consignee-list { display: grid; gap: 12px; }
.job-card, .consignee-card, .empty-state { background: var(--surface); border: 1px solid var(--line); border-radius: 7px; }
.job-overview { display: grid; grid-template-columns: minmax(180px, 0.9fr) minmax(0, 2fr); gap: 24px; padding: 20px 22px; }
.job-label { display: block; margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.job-identity h2, .consignee-heading h2 { margin: 0; font-size: 19px; font-weight: 690; letter-spacing: -0.025em; overflow-wrap: anywhere; }
.job-facts { display: grid; grid-template-columns: 1.4fr 0.8fr 0.7fr; gap: 18px; margin: 0; align-content: center; }
.job-facts div { min-width: 0; }
.job-facts dt, .saved-values dt { margin-bottom: 5px; color: var(--muted); font-size: 12px; }
.job-facts dd, .saved-values dd { margin: 0; color: #242832; font-size: 14px; line-height: 1.45; overflow-wrap: anywhere; }
.value-editor { border-top: 1px solid var(--line); }
.value-editor summary { min-height: 48px; display: flex; align-items: center; padding: 0 22px; color: var(--brand); font-size: 13px; font-weight: 620; list-style-position: inside; }
.value-editor summary:hover { background: #fafbff; }
.value-editor form { padding: 6px 22px 22px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.field-control label, .login-form label { display: block; margin-bottom: 6px; color: #353a44; font-size: 13px; font-weight: 580; }
.field-control input, .login-form input { width: 100%; min-height: 43px; padding: 9px 11px; border: 1px solid #cbd1db; border-radius: 4px; background: white; color: #161616; font: inherit; font-size: 14px; }
.field-control input:hover, .login-form input:hover { border-color: #8996ad; }
.field-control input:focus, .login-form input:focus { border-color: var(--brand); outline: 2px solid rgb(51 92 255 / 18%); outline-offset: 1px; }
.form-actions { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-top: 20px; }
.form-actions p { margin: 0; color: var(--muted); font-size: 12px; }
.primary-button { min-height: 44px; padding: 0 18px; border: 1px solid var(--brand); border-radius: 4px; background: var(--brand); color: white; font: inherit; font-size: 14px; font-weight: 630; }
.primary-button:hover { border-color: #2444d8; background: #2444d8; }
.primary-button:active { transform: translateY(1px); }

.consignee-card { padding: 20px 22px; }
.consignee-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding-bottom: 18px; }
.consignee-heading .section-kicker { margin-bottom: 5px; }
.consignee-summary { display: grid; justify-items: end; gap: 7px; }
.grand-total, .job-total { display: flex; align-items: baseline; gap: 12px; margin: 0; }
.grand-total span, .consignee-job-heading .job-total span { color: var(--muted); font-size: 12px; }
.grand-total strong { color: #161616; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.grand-total strong, .consignee-job-heading .job-total strong { overflow-wrap: anywhere; }
.consignee-jobs { border-top: 1px solid var(--line); }
.consignee-job { padding: 18px 0 2px; }
.consignee-job + .consignee-job { margin-top: 17px; border-top: 1px solid var(--line); }
.consignee-job-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.consignee-job-heading h3 { margin: 0; font-size: 15px; letter-spacing: -0.01em; }
.consignee-job-heading p { margin: 0; color: var(--muted); font-size: 12px; }
.consignee-job-heading .job-total { gap: 10px; color: #161616; font-size: 14px; }
.consignee-job-heading .job-total strong { font-size: 16px; font-weight: 680; font-variant-numeric: tabular-nums; }
.saved-values { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1px 24px; margin: 0; }
.saved-values > div { min-width: 0; padding: 10px 0; border-top: 1px solid #edf0f4; }
.saved-values dd { min-height: 20px; white-space: pre-wrap; }
.empty-inline { margin: 0; padding: 16px 0 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.empty-state { padding: 34px; }
.empty-state h2 { margin: 0 0 8px; font-size: 18px; }
.empty-state p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.55; }
.error-shell { padding-top: 70px; }
.error-state h1 { margin: 5px 0 10px; }
.back-link { display: inline-flex; align-items: center; min-height: 44px; margin-top: 17px; color: var(--brand); font-size: 14px; font-weight: 600; }
.site-footer { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 0 0 26px; color: var(--muted); font-size: 12px; }

.login-shell { min-height: calc(100vh - 40px); display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(280px, 0.75fr); background: white; }
.login-panel { width: min(440px, calc(100% - 48px)); margin: auto; padding: 55px 0; }
.login-wordmark { display: inline-block; margin-bottom: clamp(68px, 12vh, 112px); }
.login-copy { margin-bottom: 28px; }
.login-copy h1 { margin: 8px 0 10px; font-size: 36px; letter-spacing: -0.05em; }
.login-form { display: grid; gap: 9px; }
.login-form label:not(:first-of-type) { margin-top: 9px; }
.login-submit { width: 100%; margin-top: 14px; }
.login-aside { position: relative; min-height: 100vh; display: flex; flex-direction: column; justify-content: center; padding: 10%; background: #f2f5ff; }
.aside-rule { width: 44px; height: 3px; margin-bottom: 20px; background: var(--brand); }
.aside-label { margin: 0 0 13px; color: #52627d; font-size: 13px; font-weight: 650; }
.aside-copy { max-width: 360px; margin: 0; color: #303a4c; font-size: clamp(20px, 2.3vw, 28px); letter-spacing: -0.03em; line-height: 1.38; }
.aside-index { position: absolute; right: 10%; bottom: 36px; color: #66738d; font-size: 11px; font-weight: 650; letter-spacing: 0.06em; }

@media (max-width: 760px) {
  .topbar-inner { width: min(100% - 32px, 1180px); min-height: 60px; gap: 18px; }
  .main-nav { gap: 14px; }
  .main-nav a { min-height: 60px; font-size: 12px; }
  .wordmark { font-size: 15px; }
  .page-shell { width: min(100% - 32px, 1180px); padding: 30px 0 48px; }
  .page-heading { align-items: start; }
  .job-overview { grid-template-columns: 1fr; gap: 17px; padding: 18px; }
  .job-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .job-facts div:first-child { grid-column: 1 / -1; }
  .value-editor summary { padding: 0 18px; }
  .value-editor form { padding: 6px 18px 18px; }
  .consignee-card { padding: 18px; }
  .login-shell { grid-template-columns: 1fr; }
  .login-panel { padding: 42px 0 50px; }
  .login-wordmark { margin-bottom: 56px; }
  .login-aside { min-height: 230px; padding: 32px 24px 60px; }
  .aside-index { right: 24px; bottom: 22px; }
}

@media (max-width: 480px) {
  .topbar-inner { width: calc(100% - 24px); gap: 12px; flex-wrap: wrap; padding: 8px 0; }
  .main-nav { order: 3; width: 100%; justify-content: space-between; }
  .main-nav a { min-height: 38px; }
  .logout-form { margin-left: auto; }
  .page-shell { width: calc(100% - 24px); }
  .page-heading { flex-direction: column; gap: 12px; margin-bottom: 20px; }
  .job-facts { grid-template-columns: 1fr 1fr; }
  .field-grid, .saved-values { grid-template-columns: 1fr; }
  .form-actions { align-items: stretch; flex-direction: column; }
  .form-actions .primary-button { width: 100%; }
  .consignee-heading, .consignee-job-heading { align-items: flex-start; flex-direction: column; }
  .consignee-summary { justify-items: start; }
  .empty-state { padding: 24px 20px; }
}

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