/* =============================================================================
 * DeVries Custom Welding — pricing calculator
 *
 * Dark by design, not by preference: this gets used on a phone in a workshop,
 * and it matches the calculator DCW already built. Brand colours come from
 * that app — DEVRIES blue, welding orange, money green.
 *
 * Everything sizes off the two scales below. A value that is not from a scale
 * is a mistake rather than a decision.
 * ========================================================================== */

:root{
  --bg:#0d0f12;
  --surface:#16191d;
  --surface-2:#1c2026;
  --surface-3:#22272e;
  --line:#2a2f36;
  --line-soft:#22262c;

  --ink:#e8eaed;
  --muted:#98a1ab;
  --faint:#6c757f;

  /* DCW brand: navy, orange, white. The navy is too dark to read against
     this surface, so links use it lightened; the logo keeps the real one on
     its white plate. */
  --brand-navy:#1e2f5b;
  --brand-orange:#ff3401;
  --brand-white:#ffffff;

  --blue:#5f8ada;
  --orange:#ff3401;
  --orange-dim:#d92a00;
  --green:#35c46a;
  --warn:#e0a42b;
  --err:#ef5350;

  /* spacing scale */
  --s1:.25rem;  --s2:.5rem;   --s3:.75rem;  --s4:1rem;
  --s5:1.5rem;  --s6:2rem;    --s7:3rem;

  /* type scale */
  --t-xs:.6875rem; --t-sm:.8125rem; --t-md:.9375rem;
  --t-lg:1.125rem; --t-xl:1.5rem;   --t-2xl:2rem;

  --radius:10px;
  --radius-sm:7px;
  --shadow:0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.25);

  /* anything a finger has to hit */
  --touch:44px;
}

*{box-sizing:border-box}
html{-webkit-text-size-adjust:100%}

body{
  margin:0;background:var(--bg);color:var(--ink);
  font:var(--t-md)/1.55 system-ui,-apple-system,"Segoe UI",Roboto,Helvetica,Arial,sans-serif;
  -webkit-font-smoothing:antialiased;
}

a{color:var(--blue);text-decoration:none}
a:hover{text-decoration:underline}
:focus-visible{outline:2px solid var(--blue);outline-offset:2px;border-radius:4px}

h1{font-size:var(--t-xl);font-weight:650;letter-spacing:-.02em;margin:0}
h2{
  font-size:var(--t-xs);font-weight:700;text-transform:uppercase;letter-spacing:.09em;
  color:var(--faint);margin:0 0 var(--s4);
  padding-bottom:var(--s2);border-bottom:1px solid var(--line-soft);
}
h2.bare,h2.mt{border-bottom:none;padding-bottom:0}
h2.mt{margin-top:var(--s5)}

/* --- header --------------------------------------------------------------- */
.bar{
  background:var(--surface);border-bottom:1px solid var(--line);
  padding:var(--s3) var(--s5) 0;position:sticky;top:0;z-index:30;
}
.bar-top{display:flex;align-items:center;gap:var(--s4)}
/* Transparent, straight on the header surface. The navy sits below the 3:1
   contrast line against this background, so the logo runs a little larger
   than it otherwise would to keep the wordmark comfortable to read. */
.brand{display:flex;align-items:center;text-decoration:none;flex-shrink:0}
.brand:hover{text-decoration:none}
.brand img{display:block;height:50px;width:auto}

/* one scrollable row, so adding a link never pushes the page down */
.bar nav{display:flex;gap:var(--s5);margin-top:var(--s3);overflow-x:auto;scrollbar-width:none}
.bar nav::-webkit-scrollbar{display:none}
.bar nav a{
  color:var(--muted);font-size:var(--t-sm);font-weight:550;white-space:nowrap;
  padding-bottom:var(--s3);border-bottom:2px solid transparent;
}
.bar nav a:hover{color:var(--ink);text-decoration:none}
.bar nav a[aria-current]{color:var(--ink);border-bottom-color:var(--orange)}
.bar .who{margin-left:auto;color:var(--faint);font-size:var(--t-sm);white-space:nowrap;
  overflow:hidden;text-overflow:ellipsis}
.bar .out{color:var(--faint);font-size:var(--t-sm);white-space:nowrap}
.bar .out:hover{color:var(--ink);text-decoration:none}

main{max-width:1120px;margin:0 auto;padding:var(--s5) var(--s5) var(--s7)}

/* --- page heading --------------------------------------------------------- */
.page-head{display:flex;align-items:flex-start;gap:var(--s4);flex-wrap:wrap;margin-bottom:var(--s5)}
/* Only push a trailing action to the right. With :last-child alone, a heading
   that is the only child pushes ITSELF right — which is how "New quote" ended
   up centred on the page. */
.page-head > :last-child:not(:first-child){margin-left:auto}
.page-sub{margin:var(--s1) 0 0;color:var(--faint);font-size:var(--t-sm)}

/* --- layout --------------------------------------------------------------- */
.cols{display:grid;grid-template-columns:minmax(0,1.15fr) minmax(0,.85fr);gap:var(--s5);align-items:start}
.col-form{min-width:0}
.col-price{min-width:0;position:sticky;top:7.75rem}

.card{
  background:var(--surface);border:1px solid var(--line);border-radius:var(--radius);
  padding:var(--s5);margin-bottom:var(--s4);box-shadow:var(--shadow);
}
.card:last-child{margin-bottom:0}
.card.narrow{max-width:440px}
.narrow-ish{max-width:580px}

/* --- forms ---------------------------------------------------------------- */
label{display:block;margin-bottom:var(--s4);font-size:var(--t-sm);font-weight:600;color:var(--muted)}
label:last-child{margin-bottom:0}
label.bare{margin-bottom:0}

.field-grid{display:grid;grid-template-columns:1fr 1fr;gap:0 var(--s4)}
.field-grid .span-2{grid-column:1 / -1}

input,select,textarea{
  display:block;width:100%;margin-top:var(--s2);
  min-height:var(--touch);padding:var(--s2) var(--s3);
  background:var(--surface-2);color:var(--ink);
  border:1px solid var(--line);border-radius:var(--radius-sm);
  font:inherit;font-weight:550;transition:border-color .12s, box-shadow .12s;
}
input::placeholder,textarea::placeholder{color:var(--faint);font-weight:400}
input:hover,select:hover,textarea:hover{border-color:#39414a}
input:focus,select:focus,textarea:focus{
  outline:none;border-color:var(--blue);box-shadow:0 0 0 3px rgba(74,127,212,.2);
}
input[type=number]{font-variant-numeric:tabular-nums}

/* No spinner arrows. They are a tiny target on a phone, they nudge a price by
   a cent when a thumb brushes them, and nobody prices a job by clicking up
   forty times. The arrow keys still step the value for anyone who wants that. */
input[type=number]{appearance:textfield;-moz-appearance:textfield}
input[type=number]::-webkit-outer-spin-button,
input[type=number]::-webkit-inner-spin-button{-webkit-appearance:none;margin:0}
textarea{resize:vertical;font-weight:400;min-height:5rem}

/* currency and percent sit inside the field, so no unit has to be typed */
.money-input,.pct-input{position:relative;display:block;margin-top:var(--s2)}
.money-input::before{content:"$";left:var(--s3)}
.pct-input::after{content:"%";right:var(--s3)}
.money-input::before,.pct-input::after{
  position:absolute;top:0;height:100%;display:flex;align-items:center;
  color:var(--faint);font-size:var(--t-sm);pointer-events:none;
}
.money-input input{padding-left:1.5rem}
.pct-input input{padding-right:1.75rem}
.money-input input,.pct-input input{margin-top:0}

.hint{display:block;margin-top:var(--s2);color:var(--faint);
  font-size:var(--t-xs);font-weight:400;line-height:1.5}
p.hint{margin-bottom:0}

/* --- buttons: one shape, four weights ------------------------------------- */
.btn,button{
  display:inline-flex;align-items:center;justify-content:center;
  min-height:var(--touch);padding:0 var(--s4);
  font:inherit;font-size:var(--t-sm);font-weight:650;
  border:1px solid var(--line);border-radius:var(--radius-sm);
  background:var(--surface-2);color:var(--ink);
  cursor:pointer;text-decoration:none;white-space:nowrap;
  transition:background .12s,border-color .12s,color .12s;
}
.btn:hover,button:hover{background:var(--surface-3);border-color:#39414a;text-decoration:none}
.btn.primary,button.primary{background:var(--orange);border-color:var(--orange);color:#fff}
.btn.primary:hover,button.primary:hover{background:var(--orange-dim);border-color:var(--orange-dim)}
.btn.ghost,button.ghost{background:transparent;color:var(--muted)}
.btn.ghost:hover,button.ghost:hover{background:var(--surface-2);color:var(--ink)}
.btn.danger,button.danger{background:transparent;color:var(--err);border-color:#5a2b2b}
.btn.danger:hover,button.danger:hover{background:rgba(239,83,80,.12);border-color:var(--err)}
.btn.small,button.small{min-height:36px;font-size:var(--t-xs);padding:0 var(--s3)}
.btn.disabled{background:transparent;color:var(--faint);cursor:default}
button.link{
  min-height:auto;padding:var(--s1) var(--s2);background:none;border:none;
  color:var(--blue);font-size:var(--t-xs);font-weight:550;text-decoration:underline;
}
button.link:hover{background:none;color:#6c9ae4}
.row{display:flex;gap:var(--s2);align-items:center;flex-wrap:wrap}

/* The pinned bottom bar is gone. It repeated the total that the price panel
   already shows a few centimetres away, and carried a second Save button.
   Every quote action now lives in the price panel, at every width. */

/* --- headline figure ------------------------------------------------------- */
.headline{border-left:3px solid var(--green);display:flex;flex-direction:column;gap:var(--s1)}
.hl-label{font-size:var(--t-xs);font-weight:700;text-transform:uppercase;letter-spacing:.08em;color:var(--faint)}
.hl-amount{font-size:var(--t-2xl);font-weight:700;color:var(--green);
  letter-spacing:-.03em;font-variant-numeric:tabular-nums;line-height:1.1}
.hl-sub{font-size:var(--t-sm);color:var(--muted)}
.headline .flash{margin:var(--s3) 0 0}

/* --- quotes list ----------------------------------------------------------- */
.q-list{list-style:none;margin:0;padding:0;border:1px solid var(--line);
  border-radius:var(--radius);overflow:hidden;background:var(--surface);box-shadow:var(--shadow)}
.q-list li + li{border-top:1px solid var(--line-soft)}
.q-item{
  display:grid;align-items:center;gap:var(--s1) var(--s4);
  grid-template-columns:6.5rem minmax(0,1fr) minmax(0,10rem) 6.5rem 7rem;
  padding:var(--s3) var(--s4);color:var(--ink);min-height:var(--touch);
}
/* An admin's row carries a sixth cell — who priced it. Without a column for
   it the total wrapped onto a second line under the quote number. */
.q-list.with-author .q-item{
  grid-template-columns:6.5rem minmax(0,1fr) minmax(0,9rem) 6.5rem 6.5rem 7rem;
}
.q-item:hover{background:var(--surface-2);text-decoration:none}
.q-num{font-size:var(--t-sm);font-weight:650;color:var(--blue);font-variant-numeric:tabular-nums}
.q-title{font-weight:550;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.q-client,.q-author,.q-date{font-size:var(--t-sm);color:var(--faint);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.q-total{text-align:right;font-weight:650;font-variant-numeric:tabular-nums}

.empty-state{text-align:center;padding:var(--s7) var(--s5)}
.empty-state h2{color:var(--ink);font-size:var(--t-lg);text-transform:none;letter-spacing:normal}
.empty-state p{color:var(--faint);margin:var(--s2) 0 var(--s5)}

/* --- price breakdown ------------------------------------------------------- */
table.lines{width:100%;border-collapse:collapse}
.lines td{padding:var(--s3) 0;border-bottom:1px solid var(--line-soft);vertical-align:top}
.lines td.r{text-align:right;font-variant-numeric:tabular-nums;font-weight:600;white-space:nowrap}
.lines .note{display:block;font-size:var(--t-xs);color:var(--faint);font-weight:400;margin-top:2px}
.lines tr.sub td{font-weight:700;border-bottom-color:var(--line)}
.lines tr.total td{border-bottom:none;border-top:2px solid var(--line);padding-top:var(--s4);font-weight:700}
.lines tr.total td:first-child{font-size:var(--t-sm);text-transform:uppercase;letter-spacing:.06em}
.lines tr.total td.r{font-size:var(--t-xl);color:var(--green);letter-spacing:-.02em}
.lines tr.total .note{text-transform:none;letter-spacing:normal;color:var(--faint);margin-top:var(--s1)}
.lines [data-field="gross_profit"]{color:var(--green)}
.min-note{margin-top:var(--s4)}
.hst-note{margin-top:var(--s3);padding-top:var(--s3);border-top:1px dashed var(--line)}

/* --- materials ------------------------------------------------------------- */
.mat-row{display:grid;grid-template-columns:1fr 9rem;align-items:center;gap:var(--s3);
  margin-bottom:var(--s2);font-weight:550;color:var(--muted)}
.mat-row > span:first-child{font-size:var(--t-sm)}
.mat-row .money-input{margin-top:0}
.mat-row input{margin-top:0;text-align:right}

.other-head{font-size:var(--t-xs);font-weight:700;text-transform:uppercase;letter-spacing:.08em;
  color:var(--faint);margin:var(--s4) 0 var(--s2);padding-top:var(--s3);
  border-top:1px solid var(--line-soft)}
.other-row{display:grid;grid-template-columns:1fr 9rem var(--touch);align-items:center;
  gap:var(--s2);margin-bottom:var(--s2)}
.other-row .money-input{margin-top:0}
.other-row input{margin-top:0}
.other-row input[type=number]{text-align:right}
.row-x{min-height:var(--touch);width:var(--touch);padding:0;background:transparent;
  border:1px solid var(--line);color:var(--faint);font-size:var(--t-lg);font-weight:400}
.row-x:hover{background:transparent;border-color:var(--err);color:var(--err)}

.mat-total{display:flex;justify-content:space-between;align-items:baseline;gap:var(--s4);
  margin-top:var(--s4);padding-top:var(--s3);border-top:2px solid var(--line)}
.mat-total span{font-size:var(--t-sm);font-weight:600;color:var(--muted)}
.mat-total strong{font-size:var(--t-lg);font-variant-numeric:tabular-nums}

/* --- rates ----------------------------------------------------------------- */
.derived{background:var(--surface-2);border:1px solid var(--line);border-left:3px solid var(--blue);
  border-radius:var(--radius-sm);padding:var(--s3) var(--s4);margin-bottom:var(--s4)}
.derived > span:first-child{display:block;font-size:var(--t-sm);font-weight:600;color:var(--muted)}
.derived strong{display:block;font-size:var(--t-lg);font-weight:650;margin:2px 0}

.rate-facts{margin:0;display:grid;grid-template-columns:1fr 1fr;gap:0 var(--s4)}
.rate-facts.wide{grid-template-columns:repeat(auto-fit,minmax(11.5rem,1fr))}
.rate-facts > div{display:flex;justify-content:space-between;gap:var(--s2);
  padding:var(--s2) 0;border-bottom:1px solid var(--line-soft)}
.rate-facts dt{color:var(--faint);font-size:var(--t-sm)}
.rate-facts dd{margin:0;font-weight:600;font-variant-numeric:tabular-nums}

.overrides{border:1px dashed var(--line);border-radius:var(--radius-sm);
  padding:0 var(--s4) var(--s3);background:var(--surface-2)}
.overrides summary{cursor:pointer;font-size:var(--t-sm);font-weight:650;color:var(--muted);
  list-style:none;display:flex;align-items:center;gap:var(--s2);min-height:var(--touch)}
.overrides summary::-webkit-details-marker{display:none}
.overrides summary::before{content:"\25B8";color:var(--faint);font-size:var(--t-xs)}
.overrides[open] summary::before{content:"\25BE"}
.overrides[open] summary{margin-bottom:var(--s3);border-bottom:1px solid var(--line)}
.admin-tag{font-size:.5625rem;font-weight:700;text-transform:uppercase;letter-spacing:.1em;
  color:var(--orange);border:1px solid var(--orange);border-radius:3px;padding:1px 5px}

/* --- tables ---------------------------------------------------------------- */
table.grid{width:100%;border-collapse:collapse;background:var(--surface);
  border:1px solid var(--line);border-radius:var(--radius);overflow:hidden;
  margin-bottom:var(--s4);box-shadow:var(--shadow)}
.grid th,.grid td{text-align:left;padding:var(--s3) var(--s4);
  border-bottom:1px solid var(--line-soft);vertical-align:middle}
.grid th{font-size:var(--t-xs);font-weight:700;text-transform:uppercase;letter-spacing:.07em;
  color:var(--faint);background:var(--surface-2)}
.grid tr:last-child td{border-bottom:none}
.grid tr.off td{opacity:.45}
.grid td.r{text-align:right;font-variant-numeric:tabular-nums;font-weight:600}
.grid .actions form{display:flex;flex-wrap:wrap;gap:var(--s1)}
.rates input{width:8.5rem;display:inline-block;margin:0;min-height:38px}
.rates .v{white-space:nowrap}
.rates .unit{color:var(--faint);margin-left:var(--s1);font-size:var(--t-sm)}
.table-wrap{overflow-x:auto;-webkit-overflow-scrolling:touch;margin-bottom:var(--s4)}
.table-wrap .grid{margin-bottom:0}

dl.facts{margin:0 0 var(--s4);display:grid;grid-template-columns:auto 1fr;gap:var(--s1) var(--s4)}
dl.facts dt{color:var(--faint);font-size:var(--t-sm)}
dl.facts dd{margin:0;font-weight:550}

/* --- messages -------------------------------------------------------------- */
.flash{padding:var(--s3) var(--s4);border-radius:var(--radius-sm);margin:0 0 var(--s4);
  font-size:var(--t-sm);border:1px solid var(--line);background:var(--surface-2)}
.flash-ok{border-color:rgba(53,196,106,.4);background:rgba(53,196,106,.08);color:var(--green)}
.flash-warn{border-color:rgba(224,164,43,.4);background:rgba(224,164,43,.08);color:var(--warn)}
.flash-err{border-color:rgba(239,83,80,.45);background:rgba(239,83,80,.08);color:var(--err)}
.offline{margin:0;padding:var(--s2) var(--s4);background:var(--warn);color:#231a05;
  font-size:var(--t-sm);font-weight:600;text-align:center}

.empty{color:var(--faint)}
.notes{white-space:pre-wrap;margin:0;color:var(--muted)}
.nowrap{white-space:nowrap}
code.temp{font-size:var(--t-md);background:var(--bg);padding:2px 6px;
  border:1px solid var(--line);border-radius:4px;color:var(--orange)}
h2.section{border-bottom:none;padding-bottom:0;margin:var(--s6) 0 var(--s1);color:var(--muted)}
h2.section + .hint{margin:0 0 var(--s3)}

/* =============================================================================
 * Price breakdown chart
 *
 * Categorical palette, fixed slot order, never cycled. Validated against this
 * app's own chart surface (#16191d): lightness band, chroma floor, CVD
 * separation (worst adjacent dE 8.4), normal-vision floor (19.3) and contrast
 * (all >= 3:1) all pass. The app commits to a dark surface, so these are the
 * dark steps and there is no light variant to swap in.
 * ========================================================================== */
.viz{
  --series-1:#3987e5;   /* blue    - direct labour          */
  --series-2:#d95926;   /* orange  - factory overhead       */
  --series-3:#199e70;   /* aqua    - materials              */
  --series-4:#c98500;   /* yellow  - manager's compensation */
  --series-5:#d55181;   /* magenta - admin fee              */
  --series-6:#008300;   /* green   - gross profit           */
  margin-top:var(--s5);padding-top:var(--s4);border-top:1px solid var(--line);
}
.viz-bar{display:flex;gap:2px;height:14px;margin-bottom:var(--s3)}
.viz-bar .seg{width:calc((100% - (var(--gaps, 5) * 2px)) * var(--pct) / 100);
  min-width:3px;background:var(--c);transition:filter .12s}
.viz-bar .seg:first-child{border-radius:4px 0 0 4px}
.viz-bar .seg:last-child{border-radius:0 4px 4px 0}
.viz-bar .seg:hover,.viz-bar .seg:focus-visible{filter:brightness(1.35);outline:none}
.viz-bar .seg:focus-visible{box-shadow:0 0 0 2px var(--surface),0 0 0 4px var(--ink)}

.seg-1,.sw-1{--c:var(--series-1)}
.seg-2,.sw-2{--c:var(--series-2)}
.seg-3,.sw-3{--c:var(--series-3)}
.seg-4,.sw-4{--c:var(--series-4)}
.seg-5,.sw-5{--c:var(--series-5)}
.seg-6,.sw-6{--c:var(--series-6)}

.viz-key{list-style:none;margin:0;padding:0}
.viz-key li{display:grid;grid-template-columns:10px 1fr auto 3.2rem;
  align-items:center;gap:var(--s3);padding:3px 0}
.viz-key .sw{width:10px;height:10px;border-radius:2px;background:var(--c)}
/* text keeps text tokens - the swatch carries identity, not the words */
.viz-key .k-label{font-size:var(--t-sm);color:var(--muted)}
.viz-key .k-amt{font-size:var(--t-sm);color:var(--ink);font-weight:600;font-variant-numeric:tabular-nums}
.viz-key .k-pct{font-size:var(--t-xs);color:var(--faint);text-align:right;font-variant-numeric:tabular-nums}
.viz-key li.dim{opacity:.45}
.viz-loss{margin-top:var(--s3);color:var(--warn)}

@media(forced-colors:active){
  .viz-bar .seg{forced-color-adjust:none;border:1px solid CanvasText}
}

/* =============================================================================
 * Tablet - the price panel stops fitting beside the form before the form
 * itself needs to change, so it moves below rather than being squeezed.
 * ========================================================================== */
@media(max-width:1000px){
  .cols{grid-template-columns:1fr}
  .col-price{position:static}
  /* Client and author drop out here, so both variants are back to four cells. */
  .q-item,.q-list.with-author .q-item{grid-template-columns:6rem minmax(0,1fr) 6.5rem 7rem}
  .q-client,.q-author{display:none}
}

/* =============================================================================
 * Phone
 * ========================================================================== */
@media(max-width:700px){
  .bar{padding:var(--s3) var(--s4) 0}
  .bar .who{display:none}          /* the name is not worth a row on a phone */
  main{padding:var(--s4) var(--s4) var(--s6)}

  h1{font-size:var(--t-lg)}
  .card{padding:var(--s4)}

  .field-grid{grid-template-columns:1fr;gap:0}
  /* Two columns fit at this width but the labels wrap inside them, which
     reads worse than one clean column. */
  .rate-facts,.rate-facts.wide{grid-template-columns:1fr}

  /* A secondary action stranded on its own right-aligned row looks like a
     mistake; keep it under the heading, left-aligned with everything else. */
  .page-head{margin-bottom:var(--s4)}
  .page-head > :last-child{margin-left:0}

  /* 16px stops iOS zooming the page when a field takes focus */
  input,select,textarea{font-size:16px}

  .mat-row{grid-template-columns:1fr 7.5rem;gap:var(--s2)}
  .other-row{grid-template-columns:1fr 7rem var(--touch);gap:var(--s2)}

  /* The list becomes cards: five columns is unreadable at this width.
     The admin selector is repeated because it is more specific than a bare
     .q-item, and the 1000px block above still applies down here — without it
     the admin list would keep the wide column layout on a phone. */
  .q-item,.q-list.with-author .q-item{
    grid-template-columns:1fr auto;
    grid-template-areas:"num total" "title total" "date total";
    padding:var(--s3) var(--s4);row-gap:2px;
  }
  .q-num{grid-area:num}
  .q-title{grid-area:title;white-space:normal}
  .q-date{grid-area:date}
  .q-total{grid-area:total;align-self:center;font-size:var(--t-lg)}
  .q-client,.q-author{display:none}

  /* Nothing is pinned to the bottom any more, so the page needs no room
     reserved for it. */
  .pa-row{grid-template-columns:1fr}

  .headline .hl-amount{font-size:var(--t-xl)}
  .grid th,.grid td{padding:var(--s2) var(--s3)}
}

@media(prefers-reduced-motion:reduce){
  *{transition:none!important;scroll-behavior:auto!important}
}

/* --- estimator preview ------------------------------------------------------
 * Deliberately loud. An admin who forgets they are in preview will think the
 * admin pages have vanished.
 * -------------------------------------------------------------------------- */
.preview-bar{
  display:flex;align-items:center;justify-content:center;gap:var(--s4);flex-wrap:wrap;
  background:var(--brand-navy);color:var(--brand-white);
  padding:var(--s2) var(--s4);font-size:var(--t-sm);font-weight:600;
  border-bottom:2px solid var(--brand-orange);
}
.preview-bar form{display:flex}
.viewas-form{display:flex;margin-left:var(--s2)}

@media(max-width:700px){
  .brand img{height:38px}
  .viewas-form{display:none}   /* the preview switch is a desk job */
  .preview-bar{font-size:var(--t-xs);gap:var(--s2)}
}

/* --- actions inside the price panel ---------------------------------------- */
.panel-actions{
  margin-top:var(--s5);padding-top:var(--s4);border-top:2px solid var(--line);
  display:flex;flex-direction:column;gap:var(--s1);
}
.panel-actions .btn{width:100%}
.panel-actions .hint{margin:0 0 var(--s3)}
.panel-actions .hint:last-of-type{margin-bottom:var(--s2)}
.pa-row{display:grid;grid-template-columns:1fr 1fr;gap:var(--s2);margin-top:var(--s2)}
.pa-row .btn{width:100%}
.delete-row{display:flex;justify-content:flex-end;margin-top:var(--s3)}

/* --- login ------------------------------------------------------------------
 * The one page with no header, so it gets its own centred layout and carries
 * the logo itself.
 * -------------------------------------------------------------------------- */
.login-screen{
  min-height:calc(100vh - var(--s5) * 2);
  display:flex;align-items:center;justify-content:center;
}
.login-box{width:100%;max-width:26rem}
.login-logo{
  display:block;width:min(15rem,70%);height:auto;
  margin:0 auto var(--s5);
}
.login-box .card{margin-bottom:0}
.login-box h1{font-size:var(--t-xl);text-align:center}
.login-box .page-sub{text-align:center;margin-bottom:var(--s5)}
.login-box button{width:100%;margin-top:var(--s2)}
.login-box .hint{text-align:center;margin-top:var(--s4)}

@media(max-width:700px){
  /* A sticky-ish centre fights the keyboard on a phone: when the field is
     focused the viewport shrinks and a vertically centred box jumps. Sit it
     near the top instead. */
  .login-screen{min-height:0;display:block;padding-top:var(--s5)}
  .login-logo{margin-bottom:var(--s4)}
}
