/* Ibhar Alawla — interface styles
   Palette from the company mark: royal navy, ember orange, harbour cyan. */

@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 400; font-display: swap;
  src: local("IBM Plex Sans Arabic"), local("IBMPlexSansArabic-Regular"), url("../fonts/IBMPlexSansArabic-Regular.ttf") format("truetype"); }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 500; font-display: swap;
  src: local("IBM Plex Sans Arabic Medium"), local("IBMPlexSansArabic-Medium"), url("../fonts/IBMPlexSansArabic-Medium.ttf") format("truetype"); }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 600; font-display: swap;
  src: local("IBM Plex Sans Arabic SemiBold"), local("IBMPlexSansArabic-SemiBold"), url("../fonts/IBMPlexSansArabic-SemiBold.ttf") format("truetype"); }
@font-face { font-family: "IBM Plex Sans Arabic"; font-weight: 700; font-display: swap;
  src: local("IBM Plex Sans Arabic Bold"), local("IBMPlexSansArabic-Bold"), url("../fonts/IBMPlexSansArabic-Bold.ttf") format("truetype"); }

:root {
  --navy: #0A2B7E;
  --navy-deep: #08215F;
  --night: #071A45;
  --night-2: #0C2459;
  --orange: #F26A12;
  --orange-ink: #C4520A;
  --cyan: #0E8FB5;
  --paper: #F4F6FA;
  --surface: #FFFFFF;
  --surface-2: #F8F9FC;
  --ink: #101C38;
  --ink-2: #47536F;
  --ink-3: #7A86A1;
  --line: #DDE3EE;
  --line-2: #ECF0F6;
  --focus: #2F6BFF;
  --ok: #1B7A45;
  --warn: #A3640B;
  --bad: #B42318;
  --st-purchased: #56627E;
  --st-to_port: #A36A12;
  --st-shipped: #0B6FB0;
  --st-arrived: #0E8079;
  --st-delivered: #1B7A45;
  --st-cancelled: #B42318;
  --side-text: #C3CDE4;
  --side-muted: #8796BA;
  --shadow: 0 1px 2px rgba(16, 28, 56, .06), 0 8px 24px rgba(16, 28, 56, .06);
  --font: "IBM Plex Sans Arabic", "Inter", "Segoe UI", "Noto Sans Arabic", "Noto Naskh Arabic", "DejaVu Sans", system-ui, sans-serif;
  --r-s: 6px;
  --r-m: 10px;
  --r-l: 14px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --navy: #7EA6FF; --navy-deep: #A8C2FF; --night: #050D22; --night-2: #0A1634;
    --orange: #FF8A3D; --orange-ink: #FF9B57; --cyan: #4CC3E6;
    --paper: #0B1222; --surface: #111A2E; --surface-2: #0E1628; --ink: #E8EDF8; --ink-2: #AEB9D1; --ink-3: #7F8BA8;
    --line: #23314F; --line-2: #1A2640; --focus: #7EA6FF;
    --ok: #4CC38A; --warn: #E3A44A; --bad: #FF7A6E;
    --st-purchased: #A3AECB; --st-to_port: #E3A44A; --st-shipped: #5CB2F0; --st-arrived: #4CC9BE;
    --st-delivered: #4CC38A; --st-cancelled: #FF7A6E;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --navy: #7EA6FF; --navy-deep: #A8C2FF; --night: #050D22; --night-2: #0A1634;
  --orange: #FF8A3D; --orange-ink: #FF9B57; --cyan: #4CC3E6;
  --paper: #0B1222; --surface: #111A2E; --surface-2: #0E1628; --ink: #E8EDF8; --ink-2: #AEB9D1; --ink-3: #7F8BA8;
  --line: #23314F; --line-2: #1A2640; --focus: #7EA6FF;
  --ok: #4CC38A; --warn: #E3A44A; --bad: #FF7A6E;
  --st-purchased: #A3AECB; --st-to_port: #E3A44A; --st-shipped: #5CB2F0; --st-arrived: #4CC9BE;
  --st-delivered: #4CC38A; --st-cancelled: #FF7A6E;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  color-scheme: dark;
}

/* ------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 15px;
  line-height: 1.5; -webkit-font-smoothing: antialiased; }
[dir="rtl"] body { font-size: 15.5px; }
a { color: var(--navy); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 10px; }
img { max-width: 100%; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.num, .tabnum { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; unicode-bidi: isolate; }
.muted { color: var(--ink-2); }
.faint { color: var(--ink-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.hidden { display: none !important; }
.gap { display: inline-block; width: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round; }
[dir="rtl"] svg.i.flip { transform: scaleX(-1); }

/* ------------------------------------------------------------ shell */
.shell { display: grid; grid-template-columns: 252px minmax(0, 1fr); min-height: 100vh; }
.side { background: var(--night); color: var(--side-text); position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; padding: 18px 14px; gap: 6px; overflow-y: auto; z-index: 40; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 18px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand img { width: 40px; height: 40px; border-radius: 11px; }
.brand b { display: block; font-size: 15px; font-weight: 600; letter-spacing: .01em; }
.brand span { display: block; font-size: 12px; color: var(--side-muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 8px; color: var(--side-text);
  font-size: 14.5px; font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav a.on { background: rgba(126, 166, 255, .16); color: #fff; }
.nav a.on svg { color: var(--orange); }
.nav .count { margin-inline-start: auto; background: var(--orange); color: #fff; font-size: 12px; font-weight: 600;
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 11px; display: grid; place-items: center; }
.nav-sep { height: 1px; background: rgba(255, 255, 255, .08); margin: 10px 6px; }
.side-foot { margin-top: auto; padding: 12px 8px 4px; border-top: 1px solid rgba(255, 255, 255, .08);
  display: grid; gap: 10px; }
.who { display: flex; align-items: center; gap: 10px; }
.who .av { width: 34px; height: 34px; border-radius: 50%; background: var(--night-2); color: #fff; display: grid;
  place-items: center; font-weight: 600; font-size: 14px; border: 1px solid rgba(255, 255, 255, .12); }
.who b { display: block; color: #fff; font-size: 14px; font-weight: 500; }
.who span { font-size: 12px; color: var(--side-muted); }
.side-actions { display: grid; gap: 2px; }
.side-actions a, .side-actions button { display: flex; align-items: center; gap: 10px; width: 100%;
  height: 34px; padding: 0 10px; border-radius: 7px; border: 0; background: transparent; text-align: start;
  color: var(--side-text); font: inherit; font-size: 13.5px; cursor: pointer; }
.side-actions svg.i { width: 16px; height: 16px; color: var(--side-muted); }
.side-actions a:hover, .side-actions button:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; height: 62px;
  padding: 0 28px; background: color-mix(in srgb, var(--paper) 88%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); }
.topbar .menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 460px; }
.search svg { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.search input { width: 100%; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface);
  padding-inline: 38px 12px; font: inherit; color: var(--ink); }
.search input::placeholder { color: var(--ink-3); }
.top-actions { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.bell { position: relative; width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center;
  color: var(--ink-2); border: 1px solid var(--line); background: var(--surface); }
.bell:hover { text-decoration: none; color: var(--ink); }
.bell .dot { position: absolute; top: -5px; inset-inline-end: -5px; min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: 10px; background: var(--orange); color: #fff; font-size: 11.5px; font-weight: 600; display: grid;
  place-items: center; border: 2px solid var(--paper); }
.content { padding: 26px 28px 110px; width: 100%; max-width: 1280px; }
.preview-bar { background: var(--orange); color: #fff; text-align: center; font-size: 13.5px; padding: 7px 12px; font-weight: 500; }

.tabbar, .fab, .scrim { display: none; }

@media (max-width: 920px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset-block: 0; inset-inline-start: 0; width: 284px; height: auto; transform: translateX(-104%);
    transition: transform .22s ease; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  [dir="rtl"] .side { transform: translateX(104%); }
  body.nav-open .side { transform: none; }
  body.nav-open .scrim { display: block; position: fixed; inset: 0; background: rgba(4, 12, 32, .45); z-index: 35; }
  .topbar { padding: 0 14px; height: 58px; }
  .topbar .menu-btn { display: grid; }
  .search { max-width: none; }
  .content { padding: 18px 16px 120px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; inset-inline: 0; bottom: 0; z-index: 30;
    background: var(--surface); border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 0; font-size: 11.5px;
    color: var(--ink-2); font-weight: 500; }
  .tabbar a:hover { text-decoration: none; }
  .tabbar a.on { color: var(--navy); }
  .tabbar svg.i { width: 22px; height: 22px; }
  .fab { display: grid; place-items: center; position: fixed; inset-inline-end: 16px; bottom: calc(76px + env(safe-area-inset-bottom));
    width: 54px; height: 54px; border-radius: 50%; background: var(--orange); color: #fff; z-index: 31; border: 0;
    box-shadow: 0 6px 18px rgba(242, 106, 18, .4); cursor: pointer; }
  .fab svg.i { width: 24px; height: 24px; stroke-width: 2.2; }
  .fab-menu { position: fixed; inset-inline-end: 16px; bottom: calc(140px + env(safe-area-inset-bottom)); z-index: 32;
    background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; min-width: 210px; }
  .fab-menu a { display: flex; align-items: center; gap: 10px; padding: 11px 12px; border-radius: 9px; color: var(--ink); font-weight: 500; }
  .fab-menu a:hover { background: var(--surface-2); text-decoration: none; }
}
@media (min-width: 921px) { .fab-menu { display: none !important; } }
body:has(.form-bar) .fab { display: none; }
@media (max-width: 600px) {
  .form-bar { padding: 10px 12px; gap: 8px; }
  .form-bar .sum { gap: 14px; width: 100%; }
  .form-bar .sum div:nth-child(2) { display: none; }
  .form-bar .sum b { font-size: 16px; }
  .form-bar .btn { flex: 1; }
}

/* ------------------------------------------------------- page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  margin-bottom: 20px; }
.page-head .sub { color: var(--ink-2); margin-top: 6px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 13.5px; margin-bottom: 8px; }
.crumb:hover { color: var(--ink); }

/* ----------------------------------------------------------- buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 15px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit;
  font-size: 14.5px; font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { text-decoration: none; border-color: var(--ink-3); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-deep); border-color: var(--navy-deep); }
:root[data-theme="dark"] .btn.primary, :root[data-theme="dark"] .btn.primary:hover { color: #071A45; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #071A45; } }
.btn.accent { background: var(--orange); border-color: var(--orange); color: #fff; }
.btn.accent:hover { background: var(--orange-ink); border-color: var(--orange-ink); }
.btn.wa { background: #1FA855; border-color: #1FA855; color: #fff; }
.btn.wa:hover { background: #178a45; }
.btn.danger { color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface); color: var(--ink); }
.btn.small { height: 34px; padding: 0 11px; font-size: 13.5px; border-radius: 8px; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; padding: 0; font: inherit; color: var(--navy); cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn.danger { color: var(--bad); }

/* ------------------------------------------------------------- forms */
.form { display: grid; gap: 22px; }
.fieldset { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 20px 22px 22px; }
.fieldset > h2 { margin-bottom: 4px; }
.fieldset > .hint { color: var(--ink-2); margin: 0 0 16px; font-size: 14px; }
.fieldset.owner { border-color: color-mix(in srgb, var(--orange) 45%, var(--line)); background:
  linear-gradient(0deg, color-mix(in srgb, var(--orange) 3%, var(--surface)), color-mix(in srgb, var(--orange) 3%, var(--surface))); }
.grid { display: grid; gap: 14px 16px; grid-template-columns: repeat(12, minmax(0, 1fr)); }
.col-12 { grid-column: span 12; } .col-8 { grid-column: span 8; } .col-6 { grid-column: span 6; }
.col-4 { grid-column: span 4; } .col-3 { grid-column: span 3; }
@media (max-width: 760px) { .col-8, .col-6, .col-4 { grid-column: span 12; } .col-3 { grid-column: span 6; } }
.field { display: grid; gap: 6px; align-content: start; }
.field label, .label { font-size: 13.5px; font-weight: 500; color: var(--ink-2); }
.field .help { font-size: 12.5px; color: var(--ink-3); }
.input, .field input[type=text], .field input[type=number], .field input[type=date], .field input[type=email],
.field input[type=tel], .field input[type=password], .field input[type=search], .field select, .field textarea {
  width: 100%; height: 42px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font: inherit; font-size: 15px; padding: 0 12px; }
.field textarea { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: 2px solid color-mix(in srgb, var(--focus) 35%, transparent);
  border-color: var(--focus); }
.field.money input { text-align: end; font-variant-numeric: tabular-nums; }
.money-wrap { position: relative; }
.money-wrap span { position: absolute; inset-inline-start: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); }
.money-wrap input { padding-inline-start: 26px !important; }
.field .vin { text-transform: uppercase; letter-spacing: .04em; font-variant-numeric: tabular-nums; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14.5px; cursor: pointer; }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--navy); }
.form-bar { position: sticky; bottom: 0; z-index: 20; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 14px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); box-shadow: var(--shadow); }
.form-bar .sum { margin-inline-end: auto; display: flex; gap: 22px; flex-wrap: wrap; }
.form-bar .sum div { display: grid; }
.form-bar .sum span { font-size: 12.5px; color: var(--ink-2); }
.form-bar .sum b { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
@media (max-width: 920px) { .form-bar { bottom: calc(66px + env(safe-area-inset-bottom)); } }
.inline-calc { font-size: 12.5px; }
.combo { position: relative; }
.combo-list { position: absolute; z-index: 25; inset-inline: 0; top: calc(100% + 4px); max-height: 280px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 4px; }
.combo-list button { display: flex; width: 100%; gap: 10px; align-items: baseline; text-align: start; border: 0;
  background: none; padding: 9px 10px; border-radius: 7px; font: inherit; color: var(--ink); cursor: pointer; }
.combo-list button:hover, .combo-list button.on { background: var(--surface-2); }
.combo-list .code { color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.choice { display: grid; gap: 8px; }
.choice label { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: 10px; cursor: pointer; background: var(--surface); }
.choice label:has(input:checked) { border-color: var(--navy); box-shadow: inset 0 0 0 1px var(--navy); }
.choice input { width: 18px; height: 18px; accent-color: var(--navy); flex: none; }
.choice .ch-main { flex: 1; min-width: 0; }
.choice .ch-main b { font-weight: 600; }
.choice .ch-amt { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ------------------------------------------------------------ flashes */
.flashes { display: grid; gap: 8px; margin-bottom: 18px; }
.flash { padding: 12px 14px; border-radius: 10px; font-size: 14.5px; border: 1px solid; display: flex; gap: 10px; align-items: flex-start; }
.flash.ok { background: color-mix(in srgb, var(--ok) 9%, var(--surface)); border-color: color-mix(in srgb, var(--ok) 30%, transparent); }
.flash.error { background: color-mix(in srgb, var(--bad) 8%, var(--surface)); border-color: color-mix(in srgb, var(--bad) 35%, transparent); }

/* ------------------------------------------------------------ tables */
.tablewrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); overflow-x: auto; }
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 14px; }
.tbl th { text-align: start; font-weight: 500; color: var(--ink-2); font-size: 12.5px; padding: 11px 14px;
  border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--surface-2); }
.tbl th:first-child { border-start-start-radius: var(--r-l); }
.tbl th:last-child { border-start-end-radius: var(--r-l); }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tbl tr.link { cursor: pointer; }
.tbl tr.link:hover td { background: var(--surface-2); }
.tbl tfoot td { font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; background: var(--surface-2); }
.tbl .main { font-weight: 500; color: var(--ink); }
.tbl .sub { display: block; font-size: 12.5px; color: var(--ink-3); }
.tbl td.due { color: var(--orange-ink); font-weight: 600; }
.tbl td.credit { color: var(--ok); font-weight: 600; }
.tbl .void td { color: var(--ink-3); text-decoration: line-through; }
.tbl .void td .pill { text-decoration: none; }
@media (max-width: 700px) {
  .tbl.cards thead { display: none; }
  .tbl.cards, .tbl.cards tbody, .tbl.cards tr, .tbl.cards td { display: block; width: 100%; }
  .tbl.cards tr { padding: 12px 14px; border-bottom: 1px solid var(--line-2); }
  .tbl.cards tbody tr:last-child { border-bottom: 0; }
  .tbl.cards td { border: 0; padding: 2px 0; display: flex; justify-content: space-between; gap: 12px; text-align: end; }
  .tbl.cards td::before { content: attr(data-label); color: var(--ink-3); font-size: 13px; font-weight: 400; text-align: start; }
  .tbl.cards td.head { display: block; text-align: start; padding-bottom: 6px; }
  .tbl.cards td.head::before { content: none; }
  .tbl.cards td.num { text-align: end; }
  .tbl.cards tfoot tr { padding: 12px 14px; }
  .tbl.cards td:empty { display: none; }
}

/* ------------------------------------------------------------- pills */
.pill { --c: var(--st-purchased); display: inline-flex; align-items: center; gap: 7px; padding: 3px 10px 3px 9px;
  border-radius: 999px; font-size: 12.5px; font-weight: 600; white-space: nowrap; line-height: 1.5;
  color: var(--c); background: color-mix(in srgb, var(--c) 11%, transparent); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.pill.purchased { --c: var(--st-purchased); } .pill.to_port { --c: var(--st-to_port); }
.pill.shipped { --c: var(--st-shipped); } .pill.arrived { --c: var(--st-arrived); }
.pill.delivered { --c: var(--st-delivered); } .pill.cancelled { --c: var(--st-cancelled); }
.pill.paid { --c: var(--ok); } .pill.partial { --c: var(--warn); } .pill.unpaid { --c: var(--orange-ink); }
.pill.void, .pill.none { --c: var(--ink-3); }
.pill.plain::before { display: none; }
.tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; padding: 2px 9px; border-radius: 6px;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.tag.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, transparent); background: color-mix(in srgb, var(--warn) 8%, var(--surface)); }
.tag.owner { color: var(--orange-ink); border-color: color-mix(in srgb, var(--orange) 40%, transparent); background: color-mix(in srgb, var(--orange) 7%, var(--surface)); }

/* ------------------------------------------------------- figures band */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-l); overflow: hidden; }
.figure { padding: 16px 20px 18px; border-inline-start: 1px solid var(--line); min-width: 0; }
.figure:first-child { border-inline-start: 0; }
.figure .k { font-size: 13px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; }
.figure .v { font-size: 26px; font-weight: 600; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.figure .s { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; }
.figure.due .v { color: var(--orange-ink); }
.figure.credit .v { color: var(--ok); }
.figure.profit .v { color: var(--navy); }
@media (max-width: 700px) {
  .figures { grid-template-columns: 1fr 1fr; }
  .figure:nth-child(odd) { border-inline-start: 0; }
  .figure:nth-child(n+3) { border-top: 1px solid var(--line); }
  .figure .v { font-size: 21px; }
}

/* --------------------------------------------------------- the route */
.route-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); padding: 18px 20px 20px; }
.route-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.route { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: relative; }
.route::before { content: ""; position: absolute; inset-inline: 10%; top: 31px; height: 2px;
  background: repeating-linear-gradient(90deg, var(--line) 0 9px, transparent 9px 16px); }
.stop { --c: var(--st-purchased); position: relative; display: flex; flex-direction: column; align-items: center; text-align: center;
  gap: 2px; padding: 8px 4px; border-radius: 12px; color: var(--ink); }
.stop:hover { text-decoration: none; background: var(--surface-2); }
.stop .n { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--surface);
  border: 2px solid var(--c); color: var(--c); font-weight: 700; font-size: 17px; z-index: 1; font-variant-numeric: tabular-nums;
  margin-bottom: 6px; }
.stop.has .n { background: var(--c); color: #fff; }
:root[data-theme="dark"] .stop.has .n { color: #071A45; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .stop.has .n { color: #071A45; } }
.stop b { font-size: 14px; font-weight: 600; }
.stop span { font-size: 12px; color: var(--ink-3); }
.stop.purchased { --c: var(--st-purchased); } .stop.to_port { --c: var(--st-to_port); } .stop.shipped { --c: var(--st-shipped); }
.stop.arrived { --c: var(--st-arrived); } .stop.delivered { --c: var(--st-delivered); }
@media (max-width: 560px) {
  .route-wrap { padding: 14px 8px 12px; }
  .stop .n { width: 38px; height: 38px; font-size: 15px; }
  .route::before { top: 27px; }
  .stop b { font-size: 12px; }
  .stop span { display: none; }
}

/* journey (car page) */
.journey { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.journey .leg { --c: var(--line); display: grid; gap: 6px; font-size: 12.5px; color: var(--ink-3); }
.journey .leg i { display: block; height: 6px; border-radius: 3px; background: var(--c); }
.journey .leg.done { --c: color-mix(in srgb, var(--st-delivered) 55%, transparent); color: var(--ink-2); }
.journey .leg.now { --c: var(--navy); color: var(--ink); font-weight: 600; }
.journey.cancelled .leg { --c: var(--line); }

/* ------------------------------------------------------------ panels */
.cols { display: grid; gap: 20px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
.cols.wide-start { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
@media (max-width: 1100px) { .cols, .cols.wide-start { grid-template-columns: minmax(0, 1fr); } }
.stack { display: grid; gap: 20px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l); min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px;
  border-bottom: 1px solid var(--line-2); }
.panel-head h2 { font-size: 16px; }
.panel-head .more { font-size: 13.5px; }
.panel-body { padding: 16px 18px; }
.panel .tablewrap { border: 0; border-radius: 0 0 var(--r-l) var(--r-l); }
.panel .tbl th:first-child, .panel .tbl th:last-child { border-radius: 0; }
.panel.owner { border-color: color-mix(in srgb, var(--orange) 45%, var(--line)); }
.panel.owner .panel-head { background: color-mix(in srgb, var(--orange) 5%, var(--surface)); border-start-start-radius: var(--r-l); border-start-end-radius: var(--r-l); }
.empty { padding: 26px 18px; color: var(--ink-2); text-align: center; font-size: 14.5px; }
.empty .btn { margin-top: 12px; }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 9px 18px; font-size: 14.5px; }
.facts dt { color: var(--ink-2); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.lines { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.lines td { padding: 8px 0; border-bottom: 1px dashed var(--line); }
.lines td.num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; padding-inline-start: 16px; }
.lines tr.total td { border-bottom: 0; border-top: 1px solid var(--ink-3); font-weight: 600; padding-top: 10px; }
.lines tr.paid td { color: var(--ok); }
.lines tr.balance td { font-weight: 700; font-size: 17px; color: var(--orange-ink); border-bottom: 0; }
.lines tr.pending td { color: var(--ink-3); font-style: italic; }
.kv-big { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.kv-big b { font-size: 28px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* -------------------------------------------------------------- tasks */
.tasks { display: grid; }
.task { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 16px; padding: 15px 18px; border-bottom: 1px solid var(--line-2); }
.task:last-child { border-bottom: 0; }
.task .who-line { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.task .who-line b { font-size: 15px; }
.task .what { color: var(--ink-2); font-size: 14px; }
.task ul { margin: 6px 0 0; padding: 0; list-style: none; display: grid; gap: 3px; font-size: 13.5px; color: var(--ink-2); }
.task ul li b { color: var(--ink); font-weight: 500; }
.task .amt { text-align: end; }
.task .amt b { display: block; font-size: 19px; font-weight: 600; color: var(--orange-ink); font-variant-numeric: tabular-nums; }
.task .amt span { font-size: 12px; color: var(--ink-3); }
.task .acts { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.task.done { opacity: .78; }
.task.done .amt b { color: var(--ink-2); }

/* --------------------------------------------------------- toolbars */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.toolbar .field { min-width: 150px; }
.toolbar .field.grow { flex: 1; min-width: 220px; }
.toolbar .field input, .toolbar .field select { height: 40px; }
.segs { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 3px; gap: 2px; flex-wrap: wrap; }
.segs a { padding: 6px 12px; border-radius: 7px; font-size: 13.5px; color: var(--ink-2); font-weight: 500; white-space: nowrap; }
.segs a:hover { text-decoration: none; color: var(--ink); background: var(--surface-2); }
.segs a.on { background: var(--navy); color: #fff; }
:root[data-theme="dark"] .segs a.on { color: #071A45; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .segs a.on { color: #071A45; } }
.pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 16px; font-size: 14px; color: var(--ink-2); }
.result-count { font-size: 13.5px; color: var(--ink-2); margin: -6px 0 12px; }

/* -------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--ink-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; font-size: 14.5px; }
.tabs a:hover { text-decoration: none; color: var(--ink); }
.tabs a.on { color: var(--navy); border-bottom-color: var(--navy); }
.tabs .n { font-size: 12px; color: var(--ink-3); margin-inline-start: 4px; }

/* --------------------------------------------------------- client head */
.ident { display: flex; gap: 16px; align-items: center; }
.ident .code { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13px; color: var(--navy); padding: 3px 9px;
  border-radius: 7px; background: color-mix(in srgb, var(--navy) 8%, transparent); }
.contact { display: flex; gap: 14px; flex-wrap: wrap; color: var(--ink-2); font-size: 14px; margin-top: 8px; }
.contact span, .contact a { display: inline-flex; align-items: center; gap: 6px; }

/* ----------------------------------------------------------- billing */
.bill-client { border-bottom: 1px solid var(--line-2); }
.bill-client:last-child { border-bottom: 0; }
.bill-client .ch { display: flex; justify-content: space-between; gap: 12px; padding: 14px 18px 6px; align-items: baseline; flex-wrap: wrap; }
.bill-client .ch b { font-size: 15.5px; }
.bill-rows .tbl td { padding-block: 8px; }
.bill-rows input { width: 120px; height: 38px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
  color: var(--ink); font: inherit; text-align: end; padding: 0 10px; font-variant-numeric: tabular-nums; }
.bill-sum { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 4px 18px; padding: 10px 18px 16px;
  background: var(--surface-2); font-size: 13.5px; }
.bill-sum div { display: grid; }
.bill-sum span { color: var(--ink-2); }
.bill-sum b { font-variant-numeric: tabular-nums; font-size: 16px; font-weight: 600; }
.bill-sum .req b { color: var(--orange-ink); font-size: 18px; }
.callout { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; font-size: 14.5px;
  background: color-mix(in srgb, var(--cyan) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--cyan) 30%, transparent); }
.callout.warn { background: color-mix(in srgb, var(--warn) 8%, var(--surface)); border-color: color-mix(in srgb, var(--warn) 35%, transparent); }
.callout.owner { background: color-mix(in srgb, var(--orange) 6%, var(--surface)); border-color: color-mix(in srgb, var(--orange) 35%, transparent); }

/* ------------------------------------------------------------ reports */
.report-links { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.report-link { display: grid; gap: 6px; padding: 18px 20px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-l); color: var(--ink); }
.report-link:hover { text-decoration: none; border-color: var(--navy); }
.report-link b { font-size: 16px; font-weight: 600; display: flex; align-items: center; gap: 10px; }
.report-link span { color: var(--ink-2); font-size: 14px; }

/* -------------------------------------------------------------- login */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.login-art { background: radial-gradient(120% 90% at 20% 15%, #0F3C9E 0%, #072068 45%, #04123A 100%); color: #fff;
  padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art img { width: 84px; height: 84px; border-radius: 22px; }
.login-art h1 { font-size: 34px; font-weight: 600; max-width: 14ch; line-height: 1.2; margin-top: 28px; }
.login-art p { color: #B9C6E6; max-width: 40ch; margin-top: 12px; }
.login-art .wave { position: absolute; inset-inline: 0; bottom: 0; height: 120px; opacity: .25; }
.login-form { display: grid; place-items: center; padding: 32px 22px; }
.login-form form { width: 100%; max-width: 360px; display: grid; gap: 16px; }
.login-form h2 { font-size: 22px; }
.lang-switch { display: flex; gap: 8px; justify-content: center; font-size: 14px; }
@media (max-width: 820px) {
  .login-page { grid-template-columns: 1fr; }
  .login-art { padding: 26px 22px; min-height: 0; }
  .login-art h1 { font-size: 24px; margin-top: 16px; }
  .login-art .wave { display: none; }
}

/* ---------------------------------------------------------- dialogs */
details.confirm { display: inline-block; position: relative; }
details.confirm > summary { list-style: none; }
details.confirm > summary::-webkit-details-marker { display: none; }
details.confirm .pop { position: absolute; z-index: 25; inset-inline-end: 0; top: calc(100% + 6px); width: min(320px, 86vw);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 14px; display: grid; gap: 10px; }
.toast-preview { position: fixed; bottom: 90px; inset-inline: 0; margin: 0 auto; width: fit-content; max-width: 90vw; z-index: 60;
  background: var(--night); color: #fff; padding: 11px 16px; border-radius: 10px; font-size: 14px; box-shadow: var(--shadow); }

@media print {
  .side, .topbar, .tabbar, .fab, .form-bar, .actions, .toolbar, .no-print { display: none !important; }
  .shell { display: block; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
