/*
 * Sistem Tempahan Yasin — "teal and white ledger".
 * One deep teal is the only brand colour: primary actions, the active nav item,
 * the current order step and the balance hero. Everything else is ink on white
 * with thin grey rules, small radii and no heavy shadows.
 */

:root {
  --ink: #1b1b1b;
  --ink-2: #3b3b3b;
  --muted: #6d6d6d;
  --line: #e9e9e9;
  --line-2: #d9d9d9;
  --canvas: #ffffff;
  --ghost: #faf8f5;
  --hover: #f4f2ee;

  --teal: #088177;
  --teal-600: #06736a;
  --teal-50: #e9f4f2;
  --teal-100: #cfe7e3;

  --red: #d80027;
  --red-50: #fdeef1;
  --yellow: #ffda44;
  --yellow-50: #fff8d8;
  --amber-ink: #6a5100;

  --r-card: 4px;
  --r-btn: 6px;
  --r-input: 4px;

  --font: 'Open Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Montserrat', 'Open Sans', system-ui, sans-serif;
  --focus: 0 0 0 3px rgba(8, 129, 119, 0.28);

  --sidebar-w: 248px;
  --bottom-nav-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  letter-spacing: -0.011em;
  color: var(--ink);
  background: var(--ghost);
  -webkit-font-smoothing: antialiased;
}
img, svg { display: block; max-width: 100%; }
a { color: var(--teal); text-decoration: none; }
a:hover { color: var(--teal-600); text-decoration: underline; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; margin: 0; text-wrap: balance; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--r-btn); }

.icon { width: 18px; height: 18px; flex: none; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.small { font-size: 13px; }
.strong { font-weight: 600; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow { font-size: 11.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.pos { color: var(--ink); }
.neg { color: var(--red); }

/* ------------------------------------------------------------ buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 9px 18px;
  font: 600 14px/1.2 var(--font); letter-spacing: -0.005em;
  border: 1px solid transparent; border-radius: var(--r-btn);
  background: none; color: var(--ink); cursor: pointer; white-space: nowrap;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn:hover { text-decoration: none; }
.btn .icon { width: 17px; height: 17px; }
.btn-primary { background: var(--teal); color: #fff; }
.btn-primary:hover { background: var(--teal-600); color: #fff; }
.btn-secondary { border-color: var(--teal); color: var(--teal); background: var(--canvas); }
.btn-secondary:hover { background: var(--teal-50); color: var(--teal-600); }
.btn-ghost { border-color: var(--line-2); background: var(--canvas); color: var(--ink); }
.btn-ghost:hover { background: var(--hover); color: var(--ink); }
.btn-danger { border-color: var(--red); color: var(--red); background: var(--canvas); }
.btn-danger:hover { background: var(--red-50); color: var(--red); }
.btn-inverse { background: #fff; color: var(--teal); }
.btn-inverse:hover { background: var(--teal-50); color: var(--teal-600); }
.btn-outline-light { border-color: rgba(255,255,255,.6); color: #fff; }
.btn-outline-light:hover { background: rgba(255,255,255,.12); color: #fff; }
.btn[hidden] { display: none; }
.btn-sm { min-height: 34px; padding: 6px 12px; font-size: 13px; }
.btn-block { width: 100%; }
.btn[disabled], .btn.is-busy { opacity: .55; cursor: not-allowed; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px;
  border: 0; border-radius: var(--r-btn); background: none; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--hover); }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
.actions-end { justify-content: flex-end; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; color: var(--teal); cursor: pointer; }

/* ------------------------------------------------------------ forms */

.form { display: grid; gap: 18px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .opt { font-weight: 400; color: var(--muted); }
.input, .field input:not([type=radio]):not([type=checkbox]):not([type=file]), .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 10px 12px;
  font: 16px/1.4 var(--font); color: var(--ink);
  background: var(--canvas); border: 1px solid var(--line-2); border-radius: var(--r-input);
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { min-height: 88px; resize: vertical; }
.field select { appearance: none; padding-right: 36px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%236d6d6d' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { outline: none; border-color: var(--teal); box-shadow: var(--focus); }
.field [aria-invalid="true"] { border-color: var(--red); }
.field input[readonly] { background: var(--ghost); color: var(--muted); }
.hint { font-size: 13px; color: var(--muted); }
.field-error { font-size: 13px; color: var(--red); font-weight: 500; }
.input-prefix { position: relative; }
.input-prefix > span { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 600; pointer-events: none; }
.input-prefix > input { padding-left: 44px !important; }
.input-lg input { font-family: var(--font-display) !important; font-size: 22px !important; font-weight: 600; min-height: 56px !important; }
.row { display: grid; gap: 18px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; }
.check input { margin-top: 3px; width: 18px; height: 18px; accent-color: var(--teal); }
.file-input input[type=file] { font: 14px var(--font); width: 100%; padding: 12px; border: 1px dashed var(--line-2); border-radius: var(--r-input); background: var(--ghost); }

/* design PDF upload & preview */
.design-upload { display: grid; gap: 12px; }
.dropzone { position: relative; display: grid; place-items: center; min-height: 132px; padding: 20px; border: 1px dashed var(--line-2); border-radius: var(--r-card); background: var(--ghost); text-align: center; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.is-over, .dropzone:focus-within { border-color: var(--teal); background: var(--teal-50); }
.dropzone input[type=file] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.dropzone[hidden] { display: none; }
.dropzone-body { display: grid; justify-items: center; gap: 4px; pointer-events: none; }
.dropzone-body .icon { width: 26px; height: 26px; color: var(--teal); margin-bottom: 4px; }
.dropzone-body strong { font-size: 15px; }
.dropzone-body span { font-size: 13px; color: var(--muted); }
.design-preview { display: grid; gap: 12px; }
.design-preview[hidden] { display: none; }
.design-file { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--canvas); }
.design-file > .icon { color: var(--teal); flex: none; }
.design-file div { flex: 1; min-width: 0; display: grid; }
.design-file strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.design-file span { font-size: 12.5px; color: var(--muted); }
.pdf-pages { display: grid; gap: 10px; max-height: 560px; overflow-y: auto; padding: 10px; background: var(--hover); border: 1px solid var(--line); border-radius: var(--r-card); }
.pdf-pages canvas { display: block; width: 100%; height: auto; background: #fff; border: 1px solid var(--line); }
.pdf-pages-view { margin-top: 16px; }
.design-info { display: grid; gap: 12px; }
.design-info[hidden] { display: none; }
.design-status { font-size: 13px; color: var(--muted); padding: 8px 12px; border-radius: var(--r-card); background: var(--ghost); border: 1px solid var(--line); }
.design-status.is-ok { background: var(--teal-50); border-color: var(--teal-100); color: var(--teal-600); }
.design-status.is-warn { background: var(--yellow-50); border-color: #f1dc86; color: var(--amber-ink); }
.disclosure-inline { margin-top: 14px; font-size: 14px; }
.impose-link { margin-top: 14px; }
.impose-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.impose-actions .check { align-items: center; font-size: 13px; }
.impose-actions .check input { margin-top: 0; }
.impose-summary { margin: 16px 0; }
.impose-sheets { display: flex; flex-wrap: wrap; gap: 16px; justify-content: center; padding: 16px; background: var(--hover); border: 1px solid var(--line); border-radius: var(--r-card); margin-bottom: 12px; }
.impose-sheets figure { margin: 0; display: grid; gap: 6px; justify-items: center; }
.impose-sheets canvas { display: block; max-width: 100%; height: auto; background: #fff; border: 1px solid var(--line-2); }
.impose-sheets figcaption { font-size: 12.5px; color: var(--muted); }
.disclosure-inline summary { cursor: pointer; font-weight: 600; color: var(--teal-600); }
.disclosure-inline .form { margin-top: 12px; }
td .sub .icon { width: 13px; height: 13px; vertical-align: -2px; margin-right: 4px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: 36px; padding: 6px 14px; border: 1px solid var(--line-2); border-radius: var(--r-btn);
  background: var(--canvas); font: 600 14px var(--font); color: var(--ink); cursor: pointer;
  font-variant-numeric: tabular-nums;
}
.chip:hover { border-color: var(--teal); }
.chip.is-active { border-color: var(--teal); background: var(--teal-50); color: var(--teal-600); }

.choice-cards { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.choice-card { position: relative; }
.choice-card input { position: absolute; opacity: 0; pointer-events: none; }
.choice-card label {
  display: grid; gap: 4px; height: 100%; padding: 14px; cursor: pointer;
  border: 1px solid var(--line-2); border-radius: var(--r-card); background: var(--canvas);
}
.choice-card label .icon { color: var(--muted); margin-bottom: 4px; }
.choice-card label strong { font-size: 14px; }
.choice-card label span { font-size: 13px; color: var(--muted); }
.choice-card input:checked + label { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); background: var(--teal-50); }
.choice-card input:checked + label .icon { color: var(--teal); }
.choice-card input:focus-visible + label { box-shadow: var(--focus); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters .field { flex: 1 1 160px; }
.filters .field-search { flex: 2 1 240px; }
.filters .btn { flex: none; }

/* ------------------------------------------------------------ surfaces */

.card { background: var(--canvas); border: 1px solid var(--line); border-radius: var(--r-card); min-width: 0; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.card-head h2 { font-size: 15px; font-family: var(--font); font-weight: 700; letter-spacing: -0.01em; }
.card-head .card-link { font-size: 13px; font-weight: 600; white-space: nowrap; }
.card-body { padding: 18px; }
.card-body.flush { padding: 0; }
.card-foot { padding: 12px 18px; border-top: 1px solid var(--line); background: var(--ghost); font-size: 13px; }
.section { margin-top: 24px; }
.stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
.grid-2, .grid-3, .grid-main { display: grid; gap: 16px; }
.grid-main > *, .grid-2 > * { min-width: 0; }

.note { display: flex; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--ghost); font-size: 14px; }
.note .icon { margin-top: 2px; color: var(--muted); }
.note-warn { background: var(--yellow-50); border-color: #f1dc86; color: var(--amber-ink); }
.note-warn .icon { color: var(--amber-ink); }
.note-teal { background: var(--teal-50); border-color: var(--teal-100); color: var(--teal-600); }
.note-teal .icon { color: var(--teal); }

.flash { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; margin-bottom: 16px; background: var(--canvas); border: 1px solid var(--line); border-left: 3px solid var(--ink); border-radius: var(--r-card); font-size: 14px; }
.flash > div { flex: 1; padding-top: 1px; }
.flash .icon { margin-top: 1px; }
.flash-success { border-left-color: var(--teal); }
.flash-success > .icon { color: var(--teal); }
.flash-error { border-left-color: var(--red); background: var(--red-50); border-color: #f6c9d2; border-left-color: var(--red); }
.flash-error > .icon { color: var(--red); }
.flash-close { border: 0; background: none; padding: 0; color: var(--muted); cursor: pointer; }
.flash-close .icon { width: 16px; height: 16px; }

.dl { margin: 0; display: grid; }
.dl > div { display: grid; grid-template-columns: minmax(110px, 38%) 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.dl > div:first-child { padding-top: 0; }
.dl > div:last-child { border-bottom: 0; padding-bottom: 0; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.empty { display: grid; justify-items: center; gap: 6px; padding: 36px 20px; text-align: center; }
.empty > .icon { width: 28px; height: 28px; color: var(--line-2); margin-bottom: 6px; }
.empty-title { font-weight: 600; }
.empty-text { font-size: 14px; color: var(--muted); max-width: 36ch; }
.empty .btn { margin-top: 10px; }

/* ------------------------------------------------------------ badges */

.badge {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  padding: 2px 8px; font-size: 12px; font-weight: 600; line-height: 18px; letter-spacing: 0;
  border: 1px solid transparent; border-radius: var(--r-card);
}
.badge-pending { background: var(--yellow-50); border-color: #f1dc86; color: var(--amber-ink); }
.badge-processing { background: var(--teal-50); color: var(--teal-600); }
.badge-ready { background: var(--teal-50); border-color: var(--teal); color: var(--teal-600); }
.badge-shipped { background: var(--canvas); border-color: var(--ink); color: var(--ink); }
.badge-completed, .badge-muted { background: #f0f0f0; color: var(--ink-2); }
.badge-cancelled { background: var(--red-50); color: var(--red); }
.badge-ok { background: var(--teal-50); color: var(--teal-600); }
.badge-danger { background: var(--red); color: #fff; }
.type { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin-right: 4px; }

/* ------------------------------------------------------------ tables */

.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; padding: 10px 16px; font-size: 11.5px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; background: var(--canvas); }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fcfbf9; }
.table .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table td.actions-cell { text-align: right; white-space: nowrap; }
.table .row-link { font-weight: 600; color: var(--ink); }
.table .row-link:hover { color: var(--teal); }
.table .sub { display: block; font-size: 12.5px; color: var(--muted); }
.table tfoot td { font-weight: 700; border-top: 1px solid var(--line-2); border-bottom: 0; }

/* Lists of orders/topups become cards on phones. */
@media (max-width: 719px) {
  .table.stack thead { display: none; }
  .table.stack, .table.stack tbody, .table.stack tr, .table.stack td { display: block; width: 100%; }
  .table.stack tr { padding: 12px 16px; border-bottom: 1px solid var(--line); }
  .table.stack tbody tr:last-child { border-bottom: 0; }
  .table.stack td { padding: 3px 0; border: 0; text-align: left !important; display: flex; justify-content: space-between; gap: 12px; }
  .table.stack td[data-label]::before { content: attr(data-label); color: var(--muted); font-size: 13px; }
  .table.stack td.stack-title { font-size: 15px; }
  .table.stack td.stack-title::before { display: none; }
  .table.stack tbody tr:hover td { background: none; }
  .table.stack td.actions-cell { justify-content: flex-end; padding-top: 8px; }
}

.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line); }
.pager-info { font-size: 13px; color: var(--muted); }

.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 16px; border-bottom: 1px solid var(--line); scrollbar-width: none; }
.tab { padding: 10px 12px; font-size: 14px; font-weight: 600; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.is-active { color: var(--teal); border-bottom-color: var(--teal); }
.tab .count { font-weight: 500; color: var(--muted); margin-left: 4px; }

/* ------------------------------------------------------------ page header, stats */

.page-header { margin-bottom: 20px; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 10px; }
.back-link .icon { width: 16px; height: 16px; }
.back-link:hover { color: var(--ink); text-decoration: none; }
.page-header-row { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; }
.page-sub { margin-top: 6px; color: var(--muted); font-size: 14px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.stats { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 20px; }
.stat { display: grid; gap: 4px; align-content: start; padding: 16px; background: var(--canvas); border: 1px solid var(--line); border-radius: var(--r-card); color: var(--ink); min-width: 0; }
a.stat:hover { border-color: var(--teal); text-decoration: none; color: var(--ink); }
.stat-label { font-size: 12px; font-weight: 600; color: var(--muted); letter-spacing: .02em; }
.stat-value { font-family: var(--font-display); font-size: 24px; font-weight: 600; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.stat-sub { font-size: 13px; color: var(--muted); }
.stat.is-alert { border-color: #f1dc86; background: var(--yellow-50); }
.stat.is-alert .stat-sub { color: var(--amber-ink); }
.stat.is-danger { border-color: #f6c9d2; background: var(--red-50); }
.stat.is-danger .stat-sub, .stat.is-danger .stat-value { color: var(--red); }

/* ------------------------------------------------------------ balance hero (agent) */

.balance-hero { background: var(--teal); color: #fff; border-radius: var(--r-card); padding: 22px 20px; display: grid; gap: 18px; }
.balance-hero .eyebrow { color: rgba(255,255,255,.78); }
.balance-amount { font-family: var(--font-display); font-weight: 500; font-size: 40px; line-height: 1.05; letter-spacing: -0.02em; margin-top: 6px; }
.balance-sub { color: rgba(255,255,255,.85); font-size: 14px; margin-top: 6px; }
.balance-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.balance-actions .btn { flex: 1 1 140px; }

/* ------------------------------------------------------------ order progress */

.stepper { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.step { position: relative; display: grid; grid-template-columns: 28px 1fr; column-gap: 12px; padding-bottom: 18px; }
.step:last-child { padding-bottom: 0; }
.step::before { content: ''; position: absolute; left: 13px; top: 28px; bottom: 2px; width: 2px; background: var(--line); }
.step:last-child::before { display: none; }
.step.is-done::before { background: var(--teal); }
.step-dot { grid-row: span 2; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; border: 2px solid var(--line-2); background: var(--canvas); color: #fff; }
.step-dot .icon { width: 15px; height: 15px; stroke-width: 3; }
.step.is-done .step-dot { background: var(--teal); border-color: var(--teal); }
.step.is-current .step-dot { border-color: var(--teal); box-shadow: inset 0 0 0 5px var(--canvas); background: var(--teal); }
.step-label { font-weight: 600; font-size: 14px; padding-top: 4px; }
.step.is-todo .step-label { color: var(--muted); font-weight: 500; }
.step-date { font-size: 12.5px; color: var(--muted); }
@media (min-width: 720px) {
  .stepper { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
  .step { grid-template-columns: 1fr; justify-items: center; text-align: center; padding: 0 4px; row-gap: 6px; }
  .step::before { left: calc(50% + 18px); right: calc(-50% + 18px); top: 13px; bottom: auto; width: auto; height: 2px; }
  .step-dot { grid-row: auto; }
  .step-label { padding-top: 0; }
}
.cancel-banner { display: flex; gap: 12px; padding: 14px 16px; background: var(--red-50); border: 1px solid #f6c9d2; border-radius: var(--r-card); color: var(--red); }
.cancel-banner > div { display: grid; gap: 2px; }
.cancel-banner span { color: var(--ink-2); font-size: 14px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item { position: relative; display: grid; grid-template-columns: 16px 1fr; gap: 12px; padding-bottom: 18px; }
.tl-item::before { content: ''; position: absolute; left: 7px; top: 16px; bottom: 0; width: 1px; background: var(--line-2); }
.tl-item:last-child { padding-bottom: 0; }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 9px; height: 9px; margin: 6px 0 0 3px; border-radius: 50%; background: var(--line-2); }
.tl-status .tl-dot { background: var(--ink); }
.tl-item:first-child .tl-dot { background: var(--teal); box-shadow: 0 0 0 4px var(--teal-50); }
.tl-cancelled .tl-dot, .tl-item:first-child.tl-cancelled .tl-dot { background: var(--red); box-shadow: none; }
.tl-title { font-weight: 600; font-size: 14px; }
.tl-note { font-size: 14px; color: var(--ink-2); margin-top: 2px; overflow-wrap: anywhere; }
.tl-meta { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* The running receipt beside the order form. */
.ledger-box { border: 1px solid var(--line); border-radius: var(--r-card); background: var(--canvas); }
.ledger-box .lb-row { display: flex; justify-content: space-between; gap: 12px; padding: 10px 16px; font-size: 14px; }
.ledger-box .lb-row + .lb-row { border-top: 1px dashed var(--line); }
.ledger-box .lb-row span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }
.ledger-box .lb-total { border-top: 1px solid var(--ink) !important; font-size: 15px; }
.ledger-box .lb-total span:first-child { font-weight: 700; }
.ledger-box .lb-total span:last-child { font-family: var(--font-display); font-size: 20px; }
.ledger-box .lb-after.is-short span:last-child { color: var(--red); }
.ledger-box .lb-head { padding: 12px 16px; border-bottom: 1px solid var(--line); }
.ledger-box .lb-msg { padding: 10px 16px; font-size: 13px; border-top: 1px solid var(--line); background: var(--ghost); }
.ledger-box .lb-msg.is-short { background: var(--red-50); color: var(--red); }

.bank-card { padding: 16px; border: 1px solid var(--line); border-radius: var(--r-card); background: var(--ghost); display: grid; gap: 2px; }
.bank-name { font-weight: 700; margin-top: 4px; }
.bank-no { font-family: var(--font-display); font-size: 20px; font-weight: 600; letter-spacing: .02em; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.bank-holder { font-size: 14px; }
.bank-note { font-size: 13px; color: var(--muted); margin-top: 8px; }
.copy-btn { display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border: 1px solid var(--line-2); border-radius: var(--r-btn); background: var(--canvas); font: 600 12px var(--font); letter-spacing: 0; color: var(--ink-2); cursor: pointer; }
.copy-btn .icon { width: 13px; height: 13px; }
.copy-btn.is-copied { border-color: var(--teal); color: var(--teal); }

.list { list-style: none; margin: 0; padding: 0; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-bottom: 1px solid var(--line); color: var(--ink); }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: #fcfbf9; text-decoration: none; color: var(--ink); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .title { font-weight: 600; font-size: 14px; }
.list-item .meta { font-size: 13px; color: var(--muted); }
.list-item .end { text-align: right; display: grid; justify-items: end; gap: 4px; }
.list-item > .icon:last-child { color: var(--line-2); }

.option-list a, .option-list button { display: flex; width: 100%; align-items: center; gap: 12px; padding: 12px 18px; border: 0; border-bottom: 1px solid var(--line); background: none; font: 600 14px var(--font); color: var(--ink); text-align: left; cursor: pointer; }
.option-list > :last-child, .option-list > :last-child > button { border-bottom: 0; }
.option-list a:hover, .option-list button:hover { background: #fcfbf9; text-decoration: none; }
.option-list .icon:first-child { color: var(--muted); }
.option-list .icon:last-child { margin-left: auto; color: var(--line-2); }
.option-list .danger, .option-list .danger .icon:first-child { color: var(--red); }

details.disclosure > summary { list-style: none; cursor: pointer; }
details.disclosure > summary::-webkit-details-marker { display: none; }
details.disclosure[open] > summary { border-bottom: 1px solid var(--line); }
.disclosure-body { padding: 16px 18px; }

.receipt-thumb { display: block; border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; background: var(--ghost); }
.receipt-thumb img { width: 100%; max-height: 520px; object-fit: contain; }

.amount-big { font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -0.02em; }
.meter { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--teal); }

/* ------------------------------------------------------------ brand */

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { text-decoration: none; color: var(--ink); }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-btn); background: var(--teal); color: #fff; flex: none; }
.brand-mark svg { width: 19px; height: 19px; }
.brand-text { display: grid; line-height: 1.15; }
.brand-text strong { font-family: var(--font-display); font-size: 17px; font-weight: 700; letter-spacing: -0.02em; }
.brand-text small { font-size: 11.5px; color: var(--muted); }
.brand-sm .brand-mark { width: 28px; height: 28px; }
.brand-sm .brand-mark svg { width: 16px; height: 16px; }
.brand-sm strong { font-family: var(--font-display); }

/* ------------------------------------------------------------ admin shell */

.layout-admin .shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 40; width: var(--sidebar-w);
  display: flex; flex-direction: column; background: var(--canvas); border-right: 1px solid var(--line);
  transform: translateX(-100%); transition: transform .2s ease;
}
.sidebar.is-open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.18); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 14px 16px 18px; border-bottom: 1px solid var(--line); }
.nav { flex: 1; overflow-y: auto; padding: 12px 10px; display: grid; gap: 2px; align-content: start; }
.nav-link { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--r-btn); font-size: 14px; font-weight: 500; color: var(--ink-2); }
.nav-link .icon { color: var(--muted); }
.nav-link:hover { background: var(--hover); color: var(--ink); text-decoration: none; }
.nav-link.is-active { background: var(--teal-50); color: var(--teal-600); font-weight: 600; }
.nav-link.is-active .icon { color: var(--teal); }
.nav-badge { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 10px; background: var(--ink); color: #fff; font-size: 11.5px; font-weight: 700; text-align: center; }
.nav-sep { height: 1px; background: var(--line); margin: 10px 4px; }
.sidebar-foot { display: flex; align-items: center; gap: 8px; padding: 12px 10px 12px 14px; border-top: 1px solid var(--line); }
.who { flex: 1; display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--ink); padding: 4px; border-radius: var(--r-btn); }
.who:hover { background: var(--hover); text-decoration: none; color: var(--ink); }
.who-text { display: grid; min-width: 0; line-height: 1.2; }
.who-text strong { font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-text small { font-size: 12px; color: var(--muted); }
.avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--ghost); border: 1px solid var(--line); font-weight: 700; font-size: 13px; flex: none; }
.sidebar-scrim { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.35); opacity: 0; pointer-events: none; transition: opacity .2s; }
.sidebar.is-open + .sidebar-scrim { opacity: 1; pointer-events: auto; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; height: 56px; padding: 0 8px; background: var(--canvas); border-bottom: 1px solid var(--line); }
.content { padding: 20px 16px 48px; max-width: 1180px; }

@media (min-width: 1024px) {
  .sidebar { transform: none; }
  .sidebar-close, .topbar, .sidebar-scrim { display: none; }
  .main { margin-left: var(--sidebar-w); }
  .content { padding: 32px 36px 64px; }
}

/* ------------------------------------------------------------ agent shell */

.agent-header { position: sticky; top: 0; z-index: 20; background: var(--canvas); border-bottom: 1px solid var(--line); }
.agent-header-inner { max-width: 1040px; margin: 0 auto; height: 60px; padding: 0 12px 0 16px; display: flex; align-items: center; gap: 12px; }
.agent-nav { display: none; }
.balance-chip { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--r-btn); color: var(--ink); font-weight: 700; font-size: 14px; }
.balance-chip .icon { width: 16px; height: 16px; color: var(--teal); }
.balance-chip:hover { border-color: var(--teal); text-decoration: none; color: var(--ink); }
.agent-content { max-width: 1040px; margin: 0 auto; padding: 20px 16px calc(var(--bottom-nav-h) + 32px + env(safe-area-inset-bottom)); }
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 25;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: var(--canvas); border-top: 1px solid var(--line);
}
.bottom-nav a { display: grid; justify-items: center; align-content: center; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); }
.bottom-nav a:hover { text-decoration: none; }
.bottom-nav a .icon { width: 22px; height: 22px; }
.bottom-nav a.is-active { color: var(--teal); }
.bottom-nav a.is-primary .icon { width: 36px; height: 36px; padding: 8px; margin-top: -4px; border-radius: 50%; background: var(--teal); color: #fff; }
.bottom-nav a.is-primary { color: var(--ink); }

@media (min-width: 880px) {
  .agent-nav { display: flex; gap: 2px; margin-left: 20px; }
  .agent-nav .nav-link { padding: 8px 12px; }
  .agent-nav .nav-link .icon { display: none; }
  .bottom-nav { display: none; }
  .agent-content { padding: 32px 24px 64px; }
}

/* ------------------------------------------------------------ sign-in */

.layout-auth { background: var(--ghost); }
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 20px; padding: 32px 16px; }
.auth-band { display: flex; justify-content: center; }
.auth-card { width: 100%; max-width: 420px; padding: 28px 24px; background: var(--canvas); border: 1px solid var(--line); border-radius: var(--r-card); }
.auth-card h1 { font-size: 24px; margin: 6px 0 20px; }
.auth-card .form { margin-top: 4px; }
.auth-foot { margin: 0; font-size: 14px; color: var(--muted); text-align: center; }
.debug { white-space: pre-wrap; font-size: 12px; background: var(--ghost); padding: 10px; border: 1px solid var(--line); margin-top: 14px; overflow-wrap: anywhere; }

/* ------------------------------------------------------------ responsive grids */

@media (min-width: 720px) {
  h1 { font-size: 28px; }
  .row-2 { grid-template-columns: 1fr 1fr; }
  .row-3 { grid-template-columns: 2fr 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
  .balance-hero { grid-template-columns: 1fr auto; align-items: end; padding: 28px; }
  .balance-amount { font-size: 48px; }
  .balance-actions .btn { flex: none; }
}
@media (min-width: 960px) {
  .grid-main { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .sticky-side { position: sticky; top: 84px; }
}

/* ------------------------------------------------------------ printed documents */

.layout-print { background: #e9e7e3; }
.print-toolbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; gap: 10px; padding: 10px 16px; background: var(--canvas); border-bottom: 1px solid var(--line); }
.paper { position: relative; width: 100%; max-width: 210mm; min-height: 270mm; margin: 20px auto; padding: 14mm 14mm; background: #fff; font-size: 13.5px; }
.doc-head { display: flex; justify-content: space-between; gap: 24px; padding-bottom: 18px; border-bottom: 2px solid var(--teal); }
.doc-company { display: flex; gap: 12px; }
.doc-company p { font-size: 12.5px; color: var(--ink-2); }
.doc-company-name { font-family: var(--font-display); font-weight: 700; font-size: 16px !important; color: var(--ink) !important; }
.doc-title { text-align: right; }
.doc-title h1 { font-size: 26px; text-transform: uppercase; letter-spacing: .04em; color: var(--teal); }
.doc-title p { font-weight: 700; margin-top: 4px; }
.doc-meta { margin: 20px 0; max-width: 420px; }
.doc-meta .dl > div { grid-template-columns: 170px 1fr; padding: 6px 0; font-size: 13px; }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin: 20px 0; }
.doc-party p { font-size: 13px; }
.doc-party .eyebrow { margin-bottom: 6px; }
.doc-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.doc-table th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--ink); }
.doc-table td { padding: 12px 10px; border-bottom: 1px solid var(--line); }
.doc-table .num { text-align: right; }
.doc-totals { margin-left: auto; width: min(100%, 320px); margin-top: 12px; }
.doc-totals > div { display: flex; justify-content: space-between; padding: 6px 10px; font-size: 13px; }
.doc-total { border-top: 2px solid var(--ink); font-weight: 700; font-size: 15px !important; margin-top: 4px; padding-top: 10px !important; }
.doc-amount { margin: 28px 0 8px; padding: 20px; border: 1px solid var(--line); background: var(--ghost); }
.doc-amount-value { font-family: var(--font-display); font-size: 36px; font-weight: 600; color: var(--teal); margin: 4px 0; }
.doc-note { margin-top: 18px; font-size: 13px; }
.doc-foot { position: absolute; left: 14mm; right: 14mm; bottom: 12mm; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--line); padding-top: 8px; }
.doc-stamp { position: absolute; top: 70mm; right: 22mm; transform: rotate(-12deg); padding: 6px 16px; border: 3px solid var(--red); color: var(--red); font: 700 26px var(--font-display); text-transform: uppercase; letter-spacing: .08em; opacity: .75; }
.doc-signs { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 56px; }
.doc-signs span { display: block; height: 56px; border-bottom: 1px solid var(--ink); }
.doc-signs small { color: var(--muted); font-size: 11.5px; }
.statement-print-head { display: none; }

@media print {
  @page { size: A4; margin: 0; }
  body { background: #fff !important; }
  .print-toolbar, .agent-header, .bottom-nav, .sidebar, .topbar, .no-print, .flash { display: none !important; }
  .paper { margin: 0; box-shadow: none; max-width: none; min-height: 297mm; }
  .main { margin: 0 !important; }
  .content, .agent-content { padding: 12mm !important; max-width: none; }
  .card { border-color: #ccc; }
  .statement-print-head { display: block; margin-bottom: 16px; }
  a { color: var(--ink); }
}
.auth-help { margin-top: 18px; }

/* ------------------------------------------------------------ small pieces */

.mb-16 { margin-bottom: 16px; }
.card-narrow { max-width: 640px; }
.steps-text { margin: 0 0 16px; padding-left: 20px; font-size: 14px; color: var(--ink-2); display: grid; gap: 4px; }
.card-head select.input { min-height: 34px; width: auto; padding: 4px 32px 4px 10px; font-size: 13px; }
.card-head form { margin: 0; }
.card-head > .hint { font-size: 12.5px; }
.inline-form { display: inline; }
.inline-details { display: inline-block; position: relative; text-align: left; }
.inline-details > summary { list-style: none; }
.inline-details > summary::-webkit-details-marker { display: none; }
.inline-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 10; width: 260px; padding: 14px; background: var(--canvas); border: 1px solid var(--line-2); border-radius: var(--r-card); box-shadow: 0 8px 24px rgba(0,0,0,.08); gap: 12px; }
@media (max-width: 719px) {
  .table.stack tfoot { display: none; }
  .inline-pop { right: auto; left: 0; }
}
.filters .chips { flex-basis: 100%; }
.disclosure > summary .icon { transition: transform .15s; color: var(--muted); }
.disclosure[open] > summary .icon { transform: rotate(90deg); }
.section > .note + .note, .note + .note { margin-top: 8px; }

.pickup-card { display: flex; gap: 12px; padding: 14px 16px; border: 1px solid var(--teal-100); border-radius: var(--r-card); background: var(--teal-50); font-size: 14px; }
.pickup-card > .icon { color: var(--teal); margin-top: 2px; }
.pickup-card > div { display: grid; gap: 4px; }
