:root {
  --navy: #123c69;
  --navy-dark: #0b2949;
  --blue: #1d6fb8;
  --sky: #eaf3fb;
  --ink: #182230;
  --muted: #667085;
  --line: #d9e1ea;
  --panel: #ffffff;
  --bg: #f4f7fa;
  --green: #147d64;
  --green-soft: #e8f6f1;
  --amber: #9a5b13;
  --amber-soft: #fff5e6;
  --red: #b42318;
  --red-soft: #fff0ee;
  --radius: 14px;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.45; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
input, select, textarea { width: 100%; min-height: 42px; border: 1px solid #c9d3df; border-radius: 9px; padding: 9px 11px; color: var(--ink); background: #fff; }
textarea { min-height: 92px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(29,111,184,.12); }
label { display: grid; gap: 7px; color: #344054; font-weight: 700; font-size: 13px; }
label small, .fine-print { color: var(--muted); font-weight: 400; }
button { cursor: pointer; }
.app-header { min-height: 72px; background: var(--panel); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 10px max(24px, calc((100vw - 1240px)/2)); position: sticky; top: 0; z-index: 5; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand span:last-child { display: grid; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .06em; }
.brand-mark { width: 42px; height: 42px; border-radius: 11px; display: grid; place-items: center; background: var(--navy); color: #fff; font-weight: 900; }
.brand-mark.large { width: 58px; height: 58px; font-size: 20px; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.user-chip { color: var(--muted); font-size: 13px; }
.pilot-banner { padding: 10px 24px; color: #6b3d08; background: #fff1d6; border-bottom: 1px solid #e9c27d; text-align: center; font-size: 13px; font-weight: 800; }
.page { width: min(1240px, 100%); margin: 0 auto; padding: 32px 24px 60px; }
.auth-page { width: 100%; min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 0%, #e6f1fb 0, transparent 35%), linear-gradient(145deg, #f8fafc, #edf2f7); }
.auth-card { width: min(100%, 440px); background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 32px; box-shadow: 0 22px 70px rgba(18,60,105,.09); }
.wide-auth { width: min(100%, 720px); }
.auth-brand { display: flex; align-items: center; gap: 16px; margin-bottom: 26px; }
.auth-card h1 { margin: 4px 0 8px; font-size: 26px; line-height: 1.2; }
.auth-card p { color: var(--muted); }
.form-stack { display: grid; gap: 15px; }
.compact-form { max-width: 360px; margin-top: 22px; }
.otp-input { font-size: 25px; font-weight: 800; letter-spacing: .25em; text-align: center; }
.button { border: 1px solid var(--line); border-radius: 9px; min-height: 40px; padding: 9px 15px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; color: var(--ink); background: #fff; font-weight: 750; }
.button:hover { text-decoration: none; }
.button.primary { color: #fff; background: var(--navy); border-color: var(--navy); }
.button.primary:hover { background: var(--navy-dark); }
.button.secondary { background: var(--sky); color: var(--navy); border-color: #c7dced; }
.button.ghost { background: transparent; }
.button.danger-outline { color: var(--red); border-color: #e8b8b3; background: #fff; }
.button.full { width: 100%; }
.alert { border-radius: 10px; padding: 12px 14px; margin: 0 0 18px; }
.alert.error { color: var(--red); background: var(--red-soft); border: 1px solid #f1c2bd; }
.alert.warn { color: #73420d; background: var(--amber-soft); border: 1px solid #f0d3a8; }
.eyebrow { color: var(--blue); font-size: 12px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.lead { font-size: 16px; }
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 24px; }
.page-heading h1 { margin: 4px 0 4px; font-size: clamp(28px, 4vw, 38px); line-height: 1.14; letter-spacing: -.02em; }
.page-heading p { margin: 0; color: var(--muted); max-width: 760px; }
.breadcrumbs { display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.breadcrumbs > * + *::before { content: "/"; margin-right: 10px; color: #98a2b3; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 16px; }
.panel-head h2, .action-panel h2 { margin: 0; font-size: 19px; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.metric-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
.metric { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 17px 19px; display: grid; }
.metric span { color: var(--muted); font-size: 13px; }
.metric strong { font-size: 30px; }
.records { display: grid; }
.record { display: grid; grid-template-columns: minmax(180px, 1fr) auto minmax(160px, auto); align-items: center; gap: 18px; padding: 14px 4px; border-top: 1px solid #edf0f4; color: var(--ink); }
.record:first-child { border-top: 0; }
.record:hover { text-decoration: none; background: #fafcff; }
.record div { display: grid; }
.record div span, .record-meta { color: var(--muted); font-size: 12px; }
.compact-record { display: grid; padding: 12px 2px; border-top: 1px solid #edf0f4; color: var(--ink); }
.compact-record:first-of-type { border-top: 0; }
.compact-record span { color: var(--muted); font-size: 12px; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.two-column > .panel { margin-top: 0; }
.detail-layout { grid-template-columns: minmax(0, 1.65fr) minmax(300px, .75fr); align-items: start; }
.stack { display: grid; gap: 18px; }
.stack > .panel { margin: 0; }
.status { display: inline-flex; width: fit-content; padding: 5px 9px; border-radius: 999px; color: var(--navy); background: var(--sky); border: 1px solid #cce0f0; font-size: 12px; font-weight: 800; }
.status.documents_approved, .status.waiting_loading { color: var(--amber); background: var(--amber-soft); border-color: #f0d3a8; }
.status.in_transit { color: #145c9e; background: #eaf3fb; }
.status.unloaded, .status.bill_act_ready { color: var(--green); background: var(--green-soft); border-color: #bce2d5; }
.large-status { padding: 8px 12px; font-size: 13px; }
.journey-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.journey-step { border: 1px solid var(--line); border-radius: 11px; padding: 14px; display: flex; align-items: center; gap: 11px; color: var(--ink); }
.journey-step:hover { text-decoration: none; }
.journey-step > span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: #eef1f5; font-weight: 850; }
.journey-step.done > span { background: var(--green); color: #fff; }
.journey-step div { display: grid; }
.journey-step small { color: var(--muted); }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; }
.deal-card { border: 1px solid var(--line); border-radius: 12px; padding: 16px; color: var(--ink); display: grid; gap: 10px; }
.deal-card:hover { text-decoration: none; border-color: #a8c4dc; box-shadow: 0 9px 30px rgba(18,60,105,.06); }
.deal-card h3, .deal-card p { margin: 0; }
.deal-card p { color: var(--muted); font-size: 13px; }
.deal-top { display: flex; justify-content: space-between; gap: 10px; }
.service-tag { color: var(--blue); font-size: 12px; font-weight: 800; }
.empty { color: var(--muted); padding: 20px 4px; }
.action-empty { display: grid; place-items: start; gap: 8px; }
.form-panel { padding: 26px; }
fieldset { border: 0; margin: 0; padding: 0 0 26px; }
fieldset + fieldset { border-top: 1px solid var(--line); padding-top: 24px; }
legend { font-size: 18px; font-weight: 850; padding: 0; margin-bottom: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.span-2 { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; border-top: 1px solid var(--line); padding-top: 20px; }
.qr-panel { display: grid; grid-template-columns: auto 1fr; gap: 24px; align-items: center; background: #f8fafc; border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.qr-panel img { background: #fff; border-radius: 10px; }
.field-label { display: block; font-size: 12px; font-weight: 800; color: var(--muted); margin-bottom: 8px; }
.secret-key { display: block; overflow-wrap: anywhere; padding: 10px; background: #edf2f7; border-radius: 8px; font-size: 14px; }
.setup-steps { color: #344054; padding-left: 22px; }
.details-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin: 0; }
.details-grid div { min-width: 0; }
.details-grid dt { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.details-grid dd { margin: 5px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.document-list { display: grid; }
.document-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid #edf0f4; color: var(--ink); }
.document-row:first-child { border-top: 0; }
.document-row:hover { text-decoration: none; }
.document-row div { display: grid; min-width: 0; }
.document-row strong { overflow: hidden; text-overflow: ellipsis; }
.document-row small { color: var(--muted); }
.doc-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 9px; background: var(--sky); color: var(--navy); font-size: 11px; font-weight: 900; }
.upload-box { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(220px, 1.3fr) auto; align-items: center; gap: 12px; padding: 15px; margin-top: 16px; background: #f7fafc; border: 1px dashed #b7c6d6; border-radius: 11px; }
.upload-box div { display: grid; }
.upload-box small { color: var(--muted); }
.button-stack { display: grid; gap: 9px; }
.action-panel p { color: var(--muted); }
.timeline { margin: 0; padding: 0; list-style: none; display: grid; }
.timeline li { display: grid; grid-template-columns: 15px 1fr; gap: 10px; position: relative; padding-bottom: 16px; }
.timeline li > span { width: 11px; height: 11px; border-radius: 50%; background: var(--blue); margin-top: 5px; position: relative; z-index: 1; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 5px; top: 13px; bottom: -3px; width: 1px; background: var(--line); }
.timeline li div { display: grid; }
.timeline small { color: var(--muted); }
.timeline p { margin: 4px 0 0; color: #475467; }
.compact-timeline { max-height: 430px; overflow: auto; }
.stage-track { display: grid; grid-template-columns: repeat(6, 1fr); gap: 0; margin-bottom: 18px; }
.stage-step { text-align: center; position: relative; display: grid; justify-items: center; gap: 8px; color: var(--muted); }
.stage-step:not(:last-child)::before { content: ""; height: 2px; background: var(--line); position: absolute; left: 50%; right: -50%; top: 15px; }
.stage-step.done:not(:last-child)::before { background: var(--green); }
.stage-step span { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; background: #eef1f5; position: relative; z-index: 1; font-weight: 850; }
.stage-step.done span { background: var(--green); color: #fff; }
.stage-step.current span { background: var(--navy); color: #fff; box-shadow: 0 0 0 5px var(--sky); }
.stage-step small { font-size: 11px; }
.upload-pair { display: grid; gap: 12px; border-top: 1px solid var(--line); margin-top: 15px; padding-top: 15px; }
.upload-pair form { display: grid; gap: 8px; }
@media (max-width: 820px) {
  .app-header { position: static; padding: 10px 16px; }
  .user-chip { display: none; }
  .page { padding: 24px 15px 45px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .metric-grid, .two-column, .journey-steps { grid-template-columns: 1fr; }
  .detail-layout { grid-template-columns: 1fr; }
  .record { grid-template-columns: 1fr; gap: 7px; }
  .form-grid, .details-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .upload-box { grid-template-columns: 1fr; }
  .qr-panel { grid-template-columns: 1fr; justify-items: center; text-align: center; }
  .stage-track { overflow-x: auto; grid-template-columns: repeat(6, minmax(110px, 1fr)); }
}
