/* ============================================================
   ORDERS APP

   List left, card right, each scrolling on its own so working down
   the queue never moves the thing you are reading.

   The shared system paints .panel, .card and .kpi all in --bg-elev
   on a lighter --bg page, so every surface sits at the same depth
   and nothing reads as foreground. Here the work lifts to near-white
   and the page stays on the beige. Scoped to this app — the shared
   files are loaded by several others and aren't ours to repaint.
   ============================================================ */

:root {
    --surface: #fffdf7;
    --lift: 0 1px 2px rgba(0,0,0,.04), 0 10px 26px -18px rgba(0,0,0,.22);
}

.app-main { max-width: 1480px; }
.page-header { margin-bottom: 14px; }
.page-header .meta { font-size: 12.5px; color: var(--text-dim); }

/* --- the two panes ------------------------------------------------------- */
.split {
    display: grid;
    grid-template-columns: 340px minmax(0, 1fr);
    gap: 16px;
    align-items: start;
}
@media (max-width: 1080px) { .split { grid-template-columns: 1fr; } }

.pane-list { display: flex; flex-direction: column; gap: 8px; position: sticky; top: 12px; }
.pane-list .input { background: var(--surface); }

.list-scroll {
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    display: flex; flex-direction: column; gap: 4px;
    padding-right: 4px;
}

.pane-order {
    max-height: calc(100vh - 150px);
    overflow-y: auto;
    padding-right: 4px;
}

/* --- list ---------------------------------------------------------------- */
.rep-head {
    display: flex; align-items: center; gap: 7px;
    padding: 14px 2px 5px;
    position: sticky; top: 0; z-index: 2;
    background: linear-gradient(var(--bg) 72%, transparent);
}
.rep-head:first-child { padding-top: 2px; }
.rep-name {
    font-size: 10.5px; font-weight: 700; letter-spacing: .07em;
    text-transform: uppercase; color: var(--text-muted);
}
.rep-count {
    font-size: 10px; font-weight: 700; color: var(--text-dim);
}

.row {
    display: grid; gap: 1px; width: 100%; text-align: left; cursor: pointer;
    background: var(--surface); border: 1px solid var(--border);
    border-left: 3px solid transparent;
    border-radius: var(--radius-sm); padding: 9px 11px;
    font: inherit; color: inherit;
    transition: border-color 120ms var(--ease), background 120ms var(--ease);
}
.row:hover { border-color: var(--border-strong); }
.row.on {
    border-left-color: var(--text);
    background: var(--bg-elev);
    border-color: var(--border-strong);
}

.row-top { display: flex; align-items: baseline; gap: 8px; }
.row-num { font-size: 13px; font-weight: 700; }
/* Age is the only thing that decides what to do next in a queue, so it is
   the only thing in the list carrying colour. */
.row-age { font-size: 11px; font-weight: 700; color: var(--text-dim); }
.row-age.red { color: var(--red); }
.row-age.amber { color: var(--amber); }
.row-total { margin-left: auto; font-size: 12.5px; font-weight: 600; }

.row-who { font-size: 12.5px; color: var(--text-muted); }
.row-bike {
    font-size: 11.5px; color: var(--text-dim);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-note {
    font-size: 10.5px; font-weight: 600; margin-top: 3px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.row-note.red { color: var(--red); }
.row-note.amber { color: var(--amber); }

/* --- the card ------------------------------------------------------------ */
.o-head { margin-bottom: 12px; }
.o-head-row { display: flex; align-items: baseline; gap: 14px; }
.o-head-row h2 { margin: 0; font-size: 21px; }
.o-head-row h2 span { font-weight: 400; color: var(--text-muted); }
.o-total {
    margin-left: auto; font-size: 21px; font-weight: 700;
   
}

/* What kind of sale this is, read before any figure. Three flat colours
   rather than three shades of the same one, because the point is telling
   them apart at a glance, not ranking them. */
.o-kinds { display: flex; gap: 5px; align-items: center; }
.kind {
    font-size: 10.5px; font-weight: 700; letter-spacing: .03em;
    padding: 3px 9px; border-radius: 999px; white-space: nowrap;
}
.kind.b2w { background: rgba(37,99,235,.12);  color: #1d4ed8; }
.kind.px  { background: rgba(34,160,107,.14); color: #15774f; }
.kind.dep { background: rgba(194,134,10,.16); color: #8a5e05; }
.o-meta {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
    font-size: 12.5px; margin-top: 4px; color: var(--text-muted);
}
.o-meta.dim { font-size: 11.5px; color: var(--text-dim); }
.o-meta a { color: inherit; }
.o-meta .sep { color: var(--border-strong); }
.o-link { margin-left: auto; font-weight: 600; white-space: nowrap; }
.link-btn {
    border: 0; background: none; padding: 0; cursor: pointer;
    font: inherit; font-size: 11px; color: var(--text-dim); text-decoration: underline;
}

/* Every card in a row is the same height, so the row reads as one band
   rather than three things that happen to be next to each other. */
.grid-2, .grid-3 {
    display: grid; gap: 12px; margin-bottom: 12px; align-items: stretch;
}
.grid-2 { grid-template-columns: 1.25fr 1fr; }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1320px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 780px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.box {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--lift);
    padding: 14px 16px; margin-bottom: 12px;
    display: flex; flex-direction: column;
}
.grid-2 > .box, .grid-3 > .box { margin-bottom: 0; }
.box h3 {
    font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
    color: var(--text-dim); margin: 0 0 9px; font-weight: 700;
}
.box hr { border: 0; border-top: 1px solid var(--border); margin: 9px 0; }

/* A card saying "nothing here" is still a row of the card, so it sets at the
   same size as the rows beside it. Left at body size it shouted across the
   three-card band while Delivery whispered its facts at 13px. */
.box p.muted { font-size: 13px; margin: 0; }
.box > p:last-child { margin-bottom: 0; }

/* One receipt grammar everywhere: label left, figure right, figures in a
   column the eye can run down. That is the whole point of a receipt. */
.rl {
    display: flex; justify-content: space-between; align-items: baseline;
    gap: 16px; padding: 5px 0; font-size: 13px;
}
.rl-k { min-width: 0; }
/* No tabular-nums anywhere in this app: Haffer gives the comma and full stop
   a full digit of advance under that feature, so £2,495.00 sets as
   "£2 , 495 . 00". Right alignment lines the column up without it. */
.rl-v { white-space: nowrap; text-align: right; }
.rl-sub { display: block; font-size: 11px; color: var(--text-dim); margin-top: 1px; }

.rl.item { border-bottom: 1px dotted var(--border); }
.rl.sub { border-top: 1px solid var(--border); margin-top: 4px; }
.rl.total {
    border-top: 2px solid var(--text); margin-top: 4px; padding-top: 8px;
    font-size: 14.5px; font-weight: 700;
}

.warn { color: var(--red); font-weight: 600; }
.note {
    margin: 9px 0 0; font-size: 11.5px; color: var(--text-dim);
    border-left: 2px solid var(--border-strong); padding-left: 9px;
}

/* sign-off */
.signoff {
    display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
    background: var(--surface); border: 1px solid var(--border-strong);
    border-radius: var(--radius); padding: 14px 16px; font-size: 13px;
}
.signoff .btn { margin-left: auto; }
.signoff.done { background: var(--bg-elev); border-color: var(--border); }

.toast {
    position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
    background: var(--text); color: var(--bg); z-index: 60;
    padding: 10px 18px; border-radius: 999px; font-size: 13px; font-weight: 600;
    box-shadow: 0 8px 28px -10px rgba(0,0,0,.5);
}

.loading-state, .empty-state {
    padding: 48px 10px; text-align: center; color: var(--text-dim); font-size: 13px;
}
.muted { color: var(--text-dim); }
code { font-size: 11.5px; background: var(--bg); padding: 1px 5px; border-radius: 4px; }

/* --- correcting a card --------------------------------------------------- */
.box h3 { display: flex; align-items: center; gap: 8px; }
.box-edit {
    margin-left: auto; cursor: pointer;
    font: inherit; font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
    padding: 3px 10px; border-radius: 999px;
    border: 1px solid var(--border-strong); background: var(--bg);
    color: var(--text-muted);
    transition: background 120ms var(--ease), color 120ms var(--ease);
}
.box-edit:hover { background: var(--text); border-color: var(--text); color: var(--bg); }

/* An author `display` beats the UA stylesheet's [hidden] { display: none },
   so the form has to opt out itself or it shows without anyone pressing Edit. */
.box-form { display: flex; flex-direction: column; gap: 9px; }
.box-form[hidden] { display: none; }
.box-form label {
    display: flex; flex-direction: column; gap: 3px;
    font-size: 11px; font-weight: 600; color: var(--text-muted);
}
.box-form input, .box-form select, .box-form textarea {
    font: inherit; font-size: 13px; font-weight: 400; color: var(--text);
    background: var(--bg); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 6px 8px; width: 100%;
}
.box-form input:focus, .box-form select:focus, .box-form textarea:focus {
    outline: none; border-color: var(--text); background: var(--surface);
}
.box-form textarea { resize: vertical; }
.box-form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 2px; }

/* --- payment, said in three parts ---------------------------------------- */
.pay-group + .pay-group { margin-top: 10px; }
.pay-head {
    display: block; font-size: 10px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--text-dim); margin-bottom: 1px;
}

/* The accounts number. It is the one figure on the card that decides whether
   anybody has to do anything, so it is never hidden — zero is an answer — and
   it covers EVERYTHING still to reach us, not just what the customer owes. A
   voucher we are waiting on is a balance left to pay too. */
.balance-block {
    margin-top: auto; padding-top: 10px;
    border-top: 2px solid var(--text);
}
.balance-block.owing {
    margin: 12px -16px -14px; padding: 10px 16px 12px;
    border-top-color: var(--red); color: var(--red);
    background: rgba(214,64,58,.07);
    border-radius: 0 0 var(--radius) var(--radius);
}
.balance {
    display: flex; justify-content: space-between; align-items: baseline; gap: 16px;
    font-size: 14px; font-weight: 700;
}
.balance strong { font-size: 18px; }
.balance-block.owing .balance strong { font-size: 22px; }
.balance-split {
    margin: 4px 0 0; font-size: 11.5px; text-align: right; color: var(--text-dim);
}
.balance-block.owing .balance-split { color: var(--red); opacity: .85; }

/* A section inside a card, for something that will grow its own controls. */
.subsection {
    margin-top: 14px; padding-top: 12px;
    border-top: 1px solid var(--border);
}
.sub-head {
    display: block; font-size: 10px; font-weight: 700; letter-spacing: .08em;
    text-transform: uppercase; color: var(--text-dim); margin-bottom: 4px;
}

