/* Customer portal and billing. Colours only from tokens. */
.head-r { margin-left: auto; display: flex; gap: 10px; flex-wrap: wrap; }
.head .head-r .btn { margin-left: 0; }
.btn.sm { height: 32px; padding: 0 11px; font-size: 12.5px; gap: 6px; }
.btn.sm i { font-size: 15px; }
.stat-s { display: block; font-size: 12px; color: var(--ink-muted); font-weight: 500; letter-spacing: 0; margin-top: 2px; }

/* role switch */
.viewas { margin-bottom: 16px; }
.viewas small { display: block; color: var(--shell-muted); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; margin: 0 0 6px 2px; }
.viewas .seg { width: 100%; display: grid; grid-template-columns: 1fr 1fr; }
body.portal .sys, body.portal #playBtn, body.portal #phoneBtn { display: none; }

/* stock lots */
.g-portal { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); align-items: start; }
.lots { display: flex; flex-direction: column; }
.lot { display: grid; grid-template-columns: minmax(150px, 1.1fr) 120px minmax(170px, 1.3fr) auto; gap: 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--line); }
.lot:first-child { border-top: 0; padding-top: 4px; }
.lot-a { display: flex; gap: 10px; align-items: center; min-width: 0; }
.lot-a b { display: block; } .lot-a small { color: var(--ink-muted); font-size: 12px; }
.lot-c { width: 10px; height: 34px; border-radius: 4px; flex: none; box-shadow: 0 0 12px -2px currentColor; }
.lot-t { font-size: 20px; font-weight: 650; letter-spacing: -.02em; text-align: right; }
.lot-t small { font-size: 12px; color: var(--ink-muted); font-weight: 500; }
.lot-term { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.lot-tl { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-muted); }
.lot-term .track { height: 5px; }
.lot-term small { font-size: 11.5px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }

/* today's lorries timeline */
.tl { display: flex; flex-direction: column; gap: 14px; }
.tl-h { display: flex; align-items: center; gap: 8px; font-size: 12.5px; margin-bottom: 8px; flex-wrap: wrap; }
.tl-h .chip { margin-left: auto; }
.steps { display: flex; gap: 4px; }
.steps span { flex: 1; font-size: 11px; font-weight: 600; color: var(--ink-muted); padding-top: 7px; border-top: 3px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.steps span.ok { border-color: var(--brand); color: var(--ink); }
.steps span.now { border-color: var(--brand); color: var(--brand); box-shadow: 0 -6px 12px -8px var(--brand); }

/* orders vs estimate */
.ogrid { display: grid; gap: 20px; }
.ocard .card-h { gap: 10px; }
.onums { display: grid; grid-template-columns: auto auto minmax(180px, 1fr); gap: 28px; align-items: end; margin-bottom: 8px; }
.onums small { display: block; color: var(--ink-muted); font-size: 12.5px; font-weight: 600; }
.onums b { font-size: 20px; font-weight: 650; letter-spacing: -.02em; }
.onums b.big { font-size: 28px; color: var(--brand); }
.odiff { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.odiff .track { width: 100%; height: 6px; }
.ech { display: block; width: 100%; height: auto; overflow: visible; }
.ech .al.draw { stroke-dasharray: 2400; stroke-dashoffset: 2400; animation: draw 1.8s ease forwards; }
.ech .al { fill: none; stroke: var(--brand); stroke-width: 2.4; filter: drop-shadow(0 0 4px var(--brand)); }
.ech .overa { fill: color-mix(in srgb, var(--pending) 45%, transparent); }
.ech .est { stroke: var(--ink-muted); stroke-width: 1.2; stroke-dasharray: 5 5; }
.ech .estl { fill: var(--ink-muted); font-size: 11px; font-weight: 600; }
.ech .pt { fill: var(--surface-2); stroke: var(--brand); stroke-width: 2.2; }
.ech .pt.over { stroke: var(--pending); }
.ech .v { fill: var(--ink); font-size: 11.5px; font-weight: 700; font-family: "JetBrains Mono", monospace; }
.ech .v.over { fill: var(--pending); }
.ech .d { fill: var(--ink-muted); font-size: 11px; }

/* forms */
.frow { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.inp { width: 100%; height: 40px; border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; font: inherit; background: color-mix(in srgb, var(--surface) 70%, transparent); color: var(--ink); }
.inp:focus, .search input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.flatpickr-calendar { z-index: 90 !important; }

/* ticket */
.ticket { background: var(--surface); border: 1px dashed var(--line); border-radius: 12px; padding: 18px; }
.tk-h { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tk-h b { display: block; letter-spacing: .04em; } .tk-h small { color: var(--ink-muted); font-size: 12px; }
.qr { width: 84px; height: 84px; flex: none; background: var(--ink); border-radius: 6px; padding: 4px; }
.qr rect { fill: var(--surface); } .qr rect.w { fill: var(--ink); }
.tk-kv { display: grid; grid-template-columns: 90px 1fr; gap: 5px 12px; font-size: 13px; margin: 0 0 14px; }
.tk-kv dt { color: var(--ink-muted); } .tk-kv dd { margin: 0; font-weight: 600; }
.tk-w { width: 100%; border-collapse: collapse; font-family: "JetBrains Mono", monospace; text-align: center; }
.tk-w th { font-family: var(--font-body); font-size: 11.5px; color: var(--ink-muted); font-weight: 600; padding: 6px; border-bottom: 1px solid var(--line); }
.tk-w td { padding: 10px 6px; font-size: 16px; }
.tk-w td b { color: var(--brand); font-size: 18px; }
.tk-f { font-size: 11.5px; color: var(--ink-muted); margin: 12px 0 0; }

@media print {
  body * { visibility: hidden !important; }
  .ticket, .ticket * { visibility: visible !important; }
  .ticket { position: fixed; left: 0; top: 0; width: 100%; border: 1px solid var(--ink-muted); background: var(--surface-2); color: var(--ink); }
}

@media (max-width: 1100px) { .g-portal { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 860px) {
  .lot { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .lot-term { grid-column: 1 / -1; } .lot .btn { grid-column: 1 / -1; justify-self: start; }
  .onums { grid-template-columns: 1fr 1fr; gap: 14px; } .odiff { grid-column: 1 / -1; }
  .frow { grid-template-columns: minmax(0, 1fr); }
  .head-r { margin-left: 0; width: 100%; }
}
[data-theme="dark"] .swal2-confirm { background: var(--brand) !important; color: var(--brand-ink) !important; } [data-theme="dark"] .swal2-cancel { background: var(--surface) !important; color: var(--ink) !important; border: 1px solid var(--line) !important; }
