/* PerfumeList, redesign (phase 5). Taken from the approved prototype (design lab, round 2, port 5112).
   Light only. Commissioner for text (full Greek), JetBrains Mono for ids (offer ids, proofs, PO and invoice numbers).
   Colour: ink and greys; --hue only on order data and "first time"; red only on problems; one dark button per page. */

@font-face { font-family: "Commissioner"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/fonts/commissioner-latin-wght-normal.woff2) format("woff2-variations"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "Commissioner"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/fonts/commissioner-latin-ext-wght-normal.woff2) format("woff2-variations"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "Commissioner"; font-style: normal; font-display: swap; font-weight: 100 900; src: url(/fonts/commissioner-greek-wght-normal.woff2) format("woff2-variations"); unicode-range: U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-display: swap; font-weight: 100 800; src: url(/fonts/jetbrains-mono-latin-wght-normal.woff2) format("woff2-variations"); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-display: swap; font-weight: 100 800; src: url(/fonts/jetbrains-mono-latin-ext-wght-normal.woff2) format("woff2-variations"); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-display: swap; font-weight: 100 800; src: url(/fonts/jetbrains-mono-greek-wght-normal.woff2) format("woff2-variations"); unicode-range: U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF; }

:root {
  --ground: #f4f3f1;      /* stone */
  --surface: #ffffff;
  --raised: #f6f5f3;      /* hover rows, inner wells */
  --active: #e9e8e5;      /* active nav pill, selected row */
  --border: #e6e6e6;
  --rule: #f0f0f0;
  --control: #d4d4d4;
  --text: #0a0a0a;
  --muted: #5f5f5f;
  --faint: #6b6b6b;
  --primary: #141414;
  --primary-ink: #ffffff;
  --hue: #1d5fbf;          /* the one hue: order data and "first time" only */
  --hue-pale: #e8eef8;
  --hue-wash: #f3f6fc;     /* highlighted rows */
  --positive: #2e7d32;
  --negative: #c4242a;
  --warning: #92400e;
  --pill-positive-bg: #dcfae5; --pill-positive-ink: #04250e;
  --pill-negative-bg: #ffedea; --pill-negative-ink: #831c1e;
  --pill-warning-bg: #fffbeb;  --pill-warning-ink: #92400e;
  --pill-neutral-bg: #eeeeee;  --pill-neutral-ink: #3d3d3d;

  --font: "Commissioner", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --fs-title: 26px; --fs-section: 18px; --fs-kpi: 28px; --fs-body: 15px; --fs-small: 13px;

  --sidebar-width: 248px;
  --pad: 40px;
  --gap: 24px;
  --card-pad: 24px;
  --radius-card: 8px;
  --radius-control: 6px;
  --control-height: 36px;

  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --t-hover: 140ms; --t-ui: 200ms;

  --i-copy: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='black' stroke-width='1.5'%3E%3Crect x='5.5' y='5.5' width='8' height='8' rx='1.5'/%3E%3Cpath d='M10.5 5.5v-2a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2'/%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--text); font: 400 var(--fs-body)/22px var(--font); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p, figure, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
a.link, .prose a { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--control); }
a.link:hover, .prose a:hover { text-decoration-color: currentColor; }
:focus-visible { outline: 2px solid var(--hue); outline-offset: 2px; border-radius: 4px; }
table, .num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: 0.9em; letter-spacing: -0.01em; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-small); line-height: 18px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ---------- shell ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 20px 16px; overflow-y: auto; border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand-name { display: block; font-weight: 600; font-size: 16px; line-height: 20px; letter-spacing: -0.01em; }
.brand-scope { display: block; font-size: var(--fs-small); color: var(--muted); line-height: 16px; }
.search { position: relative; margin: 20px 0 8px; }
.search svg { position: absolute; left: 12px; top: 13px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.search input { width: 100%; height: 42px; padding: 0 38px 0 36px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); }
.search input::placeholder { color: var(--faint); }
.search kbd { position: absolute; right: 10px; top: 11px; }
.search input:focus + kbd { display: none; }
kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--control); border-radius: 4px; font: 500 12px/1 var(--font); color: var(--muted); background: var(--surface); }
.nav { display: grid; gap: 2px; margin-top: 12px; }
.nav-group { margin: 18px 8px 6px; font-size: var(--fs-small); color: var(--faint); }
.nav-item { display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 8px; border-radius: 6px; color: var(--muted); transition: background-color var(--t-hover) ease, color var(--t-hover) ease; }
.nav-item svg { width: 16px; height: 16px; flex: none; }
.nav-item:hover { background: var(--raised); color: var(--text); }
.nav-item[aria-current] { background: var(--active); color: var(--text); }
.nav-item .count { margin-left: auto; font-size: var(--fs-small); color: var(--text); font-weight: 500; }
.nav-sub { display: grid; margin: 2px 0 6px 34px; }
.nav-sub a { min-height: 30px; display: flex; align-items: center; padding: 0 8px; border-radius: 6px; color: var(--muted); font-size: 14px; }
.nav-sub a:hover { color: var(--text); background: var(--raised); }
.nav-sub a[aria-current="page"] { color: var(--text); font-weight: 500; }
.sidebar .bottom { margin-top: auto; padding-top: 16px; }
.user-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 600; background: #ebe7df; color: #3d3a33; flex: none; text-transform: uppercase; }
.user-row .who { flex: 1; line-height: 18px; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.user-menu { position: relative; flex: 1; min-width: 0; }
.user-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 0; border: 0; background: none; font: inherit; color: inherit; text-align: left; cursor: pointer; border-radius: 6px; }
.user-btn:hover .who { color: var(--text); }
.user-pop { position: absolute; left: 0; right: 0; bottom: calc(100% + 10px); background: var(--surface, #fff); border: 1px solid var(--rule); border-radius: 8px; padding: 4px; box-shadow: 0 4px 16px rgba(0,0,0,.12); }
.user-pop a { display: flex; align-items: center; min-height: 32px; padding: 0 10px; border-radius: 6px; color: var(--text); }
.user-pop a:hover { background: var(--raised); }
.user-pop a[aria-current] { background: var(--active); font-weight: 500; }
.user-row .who small { display: block; color: var(--muted); font-size: 12px; }
.linkish { border: 0; background: none; padding: 0; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--control); }
.linkish:hover { color: var(--text); }

.canvas { min-width: 0; padding: 32px var(--pad) 80px; }
.page { max-width: 1560px; }
.mobile-bar { display: none; }

/* ---------- title row ---------- */
.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.title-row h1 { font-size: var(--fs-title); line-height: 32px; font-weight: 600; letter-spacing: -0.015em; }
.title-row .sub { margin-top: 6px; color: var(--muted); }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.finding { margin-top: 10px; font-size: 16px; line-height: 24px; }

/* ---------- messages ---------- */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 12px 16px; margin-bottom: var(--gap); border-radius: var(--radius-control); background: var(--surface); border: 1px solid var(--border); }
.notice.neg { background: var(--pill-negative-bg); border-color: #f6d4cf; color: var(--pill-negative-ink); }
.notice.pos { background: var(--pill-positive-bg); border-color: #bfeccc; color: var(--pill-positive-ink); }

/* ---------- panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); min-width: 0; }
.panel + .panel, .section + .section { margin-top: var(--gap); }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px var(--card-pad) 16px; flex-wrap: wrap; }
.panel-head h2 { font-size: var(--fs-section); line-height: 24px; font-weight: 600; letter-spacing: -0.01em; }
.panel-head .sub { color: var(--muted); font-size: 14px; margin-top: 2px; }
.panel-body { padding: 0 var(--card-pad) var(--card-pad); }
.panel-foot { padding: 14px var(--card-pad); border-top: 1px solid var(--rule); }
.table-wrap { position: relative; overflow-x: auto; padding: 0 var(--card-pad) 8px; }

/* figures: a row of labelled numbers */
.figures { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.figure { padding: 18px var(--card-pad); border-left: 1px solid var(--rule); min-width: 0; }
.figure:first-child { border-left: 0; }
.figure .label { color: var(--muted); font-size: 14px; }
.figure .value { margin-top: 4px; font-size: var(--fs-kpi); line-height: 34px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.figure .value small { font-size: 15px; color: var(--muted); font-weight: 400; letter-spacing: 0; }
.figure .note { margin-top: 2px; color: var(--muted); font-size: var(--fs-small); line-height: 18px; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: var(--control-height); padding: 0 14px; border-radius: var(--radius-control); border: 1px solid var(--control); background: var(--surface); font-weight: 500; font-size: 14px; cursor: pointer; white-space: nowrap; transition: background-color var(--t-hover) ease, border-color var(--t-hover) ease; }
.btn:hover { background: var(--raised); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); }
.btn.primary:hover { background: #333; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--raised); }
.btn.danger { color: var(--negative); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn[disabled] { color: var(--faint); cursor: not-allowed; background: var(--raised); }
.icon-btn { display: inline-grid; place-items: center; width: 30px; height: 30px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; flex: none; }
.icon-btn:hover { background: var(--raised); color: var(--text); }
.icon-btn svg { width: 16px; height: 16px; }

/* copy chip: the value itself is the button (data-copy holds the text) */
.copy { display: inline-flex; align-items: center; gap: 6px; padding: 1px 6px; margin: -1px -6px; border: 0; border-radius: 4px; background: transparent; cursor: copy; text-align: left; color: inherit; font: inherit; }
.copy:hover { background: var(--raised); }
.copy::after { content: ""; width: 13px; height: 13px; flex: none; opacity: 0; background: currentColor; -webkit-mask: var(--i-copy) center / 13px no-repeat; mask: var(--i-copy) center / 13px no-repeat; transition: opacity var(--t-hover); color: var(--muted); }
.copy:hover::after, .copy:focus-visible::after { opacity: 1; }
.copy.boxed { padding: 4px 8px; margin: 0; border: 1px solid var(--control); background: var(--surface); }
.copy.boxed::after { opacity: 1; }

.input, select.input, textarea.input { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--control); border-radius: var(--radius-control); background: var(--surface); }
select.input { padding-right: 32px; appearance: none; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%235f5f5f' stroke-width='1.5' stroke-linecap='round'%3E%3Cpath d='m4 6 4 4 4-4'/%3E%3C/svg%3E") right 10px center / 16px no-repeat; }
textarea.input { height: auto; min-height: 84px; padding: 10px 12px; line-height: 22px; resize: vertical; }
.input::placeholder { color: var(--faint); }
.field { display: grid; gap: 8px; align-content: start; }
.field label { font-weight: 500; font-size: 14px; }
.field .hint { color: var(--muted); font-size: var(--fs-small); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-foot { display: flex; justify-content: flex-end; gap: 8px; }
.form-foot #add-line { margin-right: auto; }
.input.n { text-align: right; font-variant-numeric: tabular-nums; }
.title-row + .panel, form > .panel:first-of-type { margin-top: 0; }

/* tables of inputs (edit forms) */
.edit-lines td { padding-top: 6px; padding-bottom: 6px; vertical-align: middle; }
.edit-lines .line-error, .edit-lines .line-error .input { color: var(--negative); font-weight: 600; }
.edit-lines .line-error input[name="offer_id"] { border-color: var(--negative); background: var(--pill-negative-bg); }
.edit-lines td:first-child .input { width: 84px; }
.edit-lines td:nth-child(2) .input, .edit-lines td:nth-child(3) .input { width: 110px; }
.edit-lines td:nth-child(2) .input { text-align: left; }
.edit-lines td:nth-child(5) .input { width: 110px; margin-left: auto; display: block; }

.segmented { display: inline-flex; width: max-content; max-width: 100%; padding: 3px; border-radius: 8px; background: #ecebe8; }
.segmented button, .segmented a { display: inline-flex; align-items: center; height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); cursor: pointer; font-size: 14px; white-space: nowrap; }
.segmented [aria-pressed="true"], .segmented [aria-current] { background: var(--surface); color: var(--text); font-weight: 500; }
.segmented .n { margin-left: 6px; color: var(--faint); }

.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--border); margin-bottom: var(--gap); overflow-x: auto; overflow-y: hidden; }
.tabs button, .tabs a { position: relative; padding: 12px 0; border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 15px; white-space: nowrap; }
.tabs .n { margin-left: 6px; color: var(--faint); }
.tabs [aria-selected="true"], .tabs [aria-current] { color: var(--text); font-weight: 500; }
.tabs [aria-selected="true"] .n, .tabs [aria-current] .n { color: var(--text); }
.tabs [aria-selected="true"]::after, .tabs [aria-current]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--text); }

/* ---------- pills ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); white-space: nowrap; flex: none; line-height: 1; }
.pill.pos { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.pill.neg { background: var(--pill-negative-bg); color: var(--pill-negative-ink); }
.pill.warn { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.pill.hue { background: var(--hue-pale); color: #123c7a; }
.pill.off { background: #dedcd8; color: #2b2b2b; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--hue); display: inline-block; }
.attn { color: var(--negative); }

/* ---------- tables ---------- */
table { width: 100%; border-collapse: collapse; }
th { height: 40px; padding: 0 12px; text-align: left; font-weight: 400; font-size: var(--fs-small); color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 14px 12px; border-bottom: 1px solid var(--rule); vertical-align: baseline; }
th:first-child, td:first-child { padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
tbody tr:last-child td { border-bottom: 0; }
th.n, td.n { text-align: right; }
td .sub { display: block; font-size: var(--fs-small); line-height: 18px; color: var(--muted); margin-top: 2px; }
td .sub.attn { color: var(--negative); }
tr.link-row { cursor: pointer; }
tr.link-row:hover td { background: var(--raised); }
.strong { font-weight: 600; }
.money { font-weight: 600; }

/* ---------- small shared pieces ---------- */
.crumb { font-size: 14px; margin-bottom: 4px; }
.notes-box { padding: 12px 14px; border-radius: 6px; background: var(--raised); white-space: pre-wrap; }
.notes-box::before { display: block; margin-bottom: 2px; font-size: var(--fs-small); color: var(--muted); }
/* bar chart drawn on the server: .bars > .bar (.v value, .b bar with height %, .l label); .current in the hue */
.bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; height: 220px; }
.bar { display: grid; grid-template-rows: 20px minmax(0, 1fr) 20px; justify-items: center; min-width: 0; }
.bar .v { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; align-self: end; }
.bar .b { align-self: end; width: 100%; max-width: 28px; min-height: 1px; border-radius: 3px 3px 0 0; background: #cfcdc8; }
.bar.current .b { background: var(--hue); }
.bar.current .v { color: var(--text); font-weight: 500; }
.bar .l { font-size: 11px; color: var(--faint); white-space: nowrap; align-self: end; }

/* ---------- list pages (public/js/list.js) ---------- */
.list-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 16px var(--card-pad); border-bottom: 1px solid var(--border); }
.list-tools .filter { position: relative; flex: 1 1 280px; max-width: 420px; }
.list-tools .filter svg { position: absolute; left: 12px; top: 12px; width: 16px; height: 16px; color: var(--muted); pointer-events: none; }
.list-tools .filter .input { padding-left: 36px; }
.list-tools [data-shown] { margin-left: auto; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
.list-table { margin-top: 4px; }
.list-table td { padding-top: 12px; padding-bottom: 12px; }
.list-table td.title { font-weight: 500; }
.list-table td.title a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--control); }
.list-table .bottle { width: 30px; height: 40px; }
.list-table td.pic { width: 46px; padding-top: 6px; padding-bottom: 6px; vertical-align: middle; }
.list-table tbody tr[data-href] { cursor: pointer; }
.list-table tbody tr[data-href]:hover td { background: var(--raised); }
th .sort { display: inline-flex; align-items: center; gap: 4px; padding: 0; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; }
th .sort:hover { color: var(--text); }
th[aria-sort] .sort { color: var(--text); }
th[aria-sort="ascending"] .sort::after { content: "↑"; }
th[aria-sort="descending"] .sort::after { content: "↓"; }
th.n .sort { flex-direction: row-reverse; }
[data-none] { margin: 20px var(--card-pad) 24px; }

/* ---------- empty ---------- */
.empty { display: grid; place-items: center; gap: 6px; min-height: 96px; padding: 20px; border: 1px dashed var(--control); border-radius: var(--radius-control); color: var(--muted); text-align: center; }
.empty strong { color: var(--text); font-weight: 500; }

/* ---------- photos ---------- */
.bottle { background: #fff; border-radius: 6px; overflow: hidden; flex: none; display: grid; place-items: center; }
.bottle img { width: 100%; height: 100%; object-fit: contain; }
.bottle.none { background: var(--raised); color: #a9a6a0; border: 1px solid var(--rule); }
.bottle.none svg { width: 45%; height: 45%; }

/* PDF link (invoice, packing list, quotation) */
.doc { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); font-size: 14px; }
.doc:hover { border-color: var(--control); background: var(--raised); }
.doc svg { width: 16px; height: 16px; color: var(--negative); flex: none; }
.doc span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- toast, drawer, dialog ---------- */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 12px); opacity: 0; padding: 10px 16px; border-radius: 8px; background: var(--primary); color: #fff; font-size: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.16); transition: opacity var(--t-ui) ease, transform var(--t-ui) var(--ease-out); pointer-events: none; z-index: 60; max-width: min(560px, calc(100vw - 32px)); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast .mono { color: #e2e2e2; }

.scrim { position: fixed; inset: 0; background: rgba(20, 18, 14, .28); z-index: 40; opacity: 0; transition: opacity var(--t-ui) ease; }
.scrim.show { opacity: 1; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 100vw); background: var(--surface); z-index: 41; display: flex; flex-direction: column; box-shadow: -8px 0 32px rgba(0,0,0,.10); transform: translateX(24px); opacity: 0; transition: transform var(--t-ui) var(--ease-out), opacity var(--t-ui) ease; }
.drawer.show { transform: none; opacity: 1; }
.drawer header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 24px 28px 16px; border-bottom: 1px solid var(--rule); }
.drawer header h2 { font-size: 20px; line-height: 28px; font-weight: 600; }
.drawer header p { color: var(--muted); margin-top: 2px; }
.drawer .body { flex: 1; overflow-y: auto; padding: 24px 28px; }
.drawer footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 28px; border-top: 1px solid var(--rule); }

dialog.dialog { width: min(560px, calc(100vw - 32px)); padding: 0; border: 0; border-radius: 10px; background: var(--surface); color: var(--text); box-shadow: 0 16px 48px rgba(0,0,0,.18); }
dialog.dialog::backdrop { background: rgba(20, 18, 14, .28); }
dialog.dialog header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 14px; border-bottom: 1px solid var(--rule); }
dialog.dialog header h2 { font-size: 18px; line-height: 26px; font-weight: 600; }
dialog.dialog .body { padding: 20px 24px; display: grid; gap: 16px; }
dialog.dialog footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--rule); }

/* ---------- search pop-up ---------- */
.palette { position: fixed; top: 12vh; left: 50%; transform: translateX(-50%); width: min(680px, calc(100vw - 32px)); background: var(--surface); border-radius: 10px; box-shadow: 0 16px 48px rgba(0,0,0,.18); z-index: 50; overflow: hidden; }
.palette .q { display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--rule); }
.palette .q svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.palette .q input { flex: 1; min-width: 0; height: 60px; border: 0; outline: none; font-size: 18px; background: none; }
.palette .results { max-height: 56vh; overflow-y: auto; padding: 8px; }
.palette .results:empty { display: none; }
.palette .group { padding: 10px 10px 4px; font-size: var(--fs-small); color: var(--faint); }
.palette .res { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.palette .res[aria-selected="true"] { background: var(--active); }
.palette .res .t { flex: 1; min-width: 0; }
.palette .res .t > span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette .res .t small { display: block; color: var(--muted); font-size: var(--fs-small); line-height: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette .res .bottle { width: 30px; height: 40px; }
.palette .res.all { margin-top: 4px; color: var(--muted); }
.palette .res.all .t { padding: 4px 0; }
.palette .hintline { display: flex; flex-wrap: wrap; gap: 16px; padding: 10px 18px; border-top: 1px solid var(--rule); color: var(--faint); font-size: 12px; }
.palette .results .hintline { border-top: 0; padding: 10px; }
.search input { cursor: text; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(380px, 100%); }
.login-card .brand { padding: 0; margin-bottom: 28px; }
.login-card form { display: grid; gap: 16px; padding: 28px; }
.login-card h1 { font-size: 20px; line-height: 28px; font-weight: 600; }
.login-card .btn { width: 100%; height: 42px; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  :root { --pad: 24px; }
  .form-grid.cols-4 { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 45; background: var(--surface); transform: translateX(-100%); transition: transform var(--t-ui) var(--ease-out); }
  .sidebar.open { transform: none; }
  .mobile-bar { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--ground); position: sticky; top: 0; z-index: 30; }
  .mobile-bar .t { flex: 1; font-weight: 600; }
  .canvas { padding: 20px 16px 64px; }
  .title-row { flex-direction: column; }
  .actions { justify-content: flex-start; }
  .form-grid, .form-grid.cols-4 { grid-template-columns: 1fr; }
  .figure { border-left: 0; border-top: 1px solid var(--rule); }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; } }

/* ---------- forms on their own page ---------- */
.narrow-form { max-width: 640px; }
.form-body { padding-top: var(--card-pad); display: grid; gap: 20px; }
.hue-ink { color: var(--hue); font-weight: 600; }
.finding + .notes-box, .title-row + .notes-box { margin-bottom: var(--gap); }
.s-docs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: var(--gap); }
.s-notes::before { content: "Notes"; }
.title-row + .finding { margin: -8px 0 var(--gap); }

/* ---------- search page ---------- */
.search-page { position: relative; max-width: 680px; margin-bottom: var(--gap); }
.search-page svg { position: absolute; left: 14px; top: 15px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
.search-page .input { height: 48px; padding-left: 42px; font-size: 17px; }
.results { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 2px 16px; padding: 0 12px 16px; }
.results a { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 6px; }
.results a:hover { background: var(--raised); }
.results .bottle { width: 30px; height: 40px; }
.results .t { min-width: 0; }
.results .t > span { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results .t small { display: block; color: var(--muted); font-size: var(--fs-small); line-height: 18px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel-head h2 .muted { font-weight: 400; }

/* ---------- jobs (Google Sheet, Perfume images): partials/job-runner.hbs ---------- */
.job-steps li { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; gap: 16px; align-items: center; padding: 20px var(--card-pad); border-top: 1px solid var(--rule); }
.job-steps li:first-child { border-top: 0; }
.job-steps .k { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--raised); font-weight: 600; }
.job-steps .k svg { width: 16px; height: 16px; }
.job-steps h2 { font-size: 16px; font-weight: 600; }
.job-steps p { margin-top: 2px; font-size: 14px; }
.job-steps .btn { min-width: 130px; }
.job-out { padding: 16px var(--card-pad) var(--card-pad); border-top: 1px solid var(--border); }
.job-result { min-height: 22px; margin-bottom: 8px; font-weight: 500; }
.job-result.ok { color: var(--positive); }
.job-output { margin: 0; min-height: 140px; max-height: 520px; overflow: auto; padding: 12px 14px; border-radius: 6px; background: var(--raised); font: 13px/20px var(--mono); white-space: pre-wrap; }
.job-output:empty::before { content: "The output appears here."; color: var(--faint); font-family: var(--font); }

/* ---------- radio buttons as a segmented control ---------- */
.field .label { font-weight: 500; font-size: 14px; }
.segmented.radios label { position: relative; }
.segmented.radios input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.segmented.radios span { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 6px; color: var(--muted); font-size: 14px; }
.segmented.radios input:checked + span { background: var(--surface); color: var(--text); font-weight: 500; }
.segmented.radios input:focus-visible + span { outline: 2px solid var(--hue); outline-offset: 1px; }
.perfume-form { max-width: 820px; }

/* ---------- pages without the sidebar (templates/public.hbs) ---------- */
.plain { max-width: 720px; margin: 0 auto; padding: 32px 16px 64px; }
.plain > .brand { padding: 0; margin-bottom: 32px; }
.plain-h1 { font-size: var(--fs-title); line-height: 32px; font-weight: 600; margin-bottom: 6px; }
.plain .search-page { margin-top: 20px; }
.big-photo { display: grid; justify-items: center; gap: 16px; padding: 24px 0; }
.big-photo img { max-height: 70vh; width: min(520px, 100%); object-fit: contain; border-radius: 8px; background: #fff; }
.big-photo .bottle.none { width: 240px; height: 320px; }
.big-photo figcaption { display: grid; justify-items: center; gap: 2px; font-size: 18px; }
.lookup-results li + li { border-top: 1px solid var(--rule); }
.lookup-results a, .lookup-results li > span { display: flex; justify-content: space-between; gap: 16px; padding: 14px var(--card-pad); }
.lookup-results a:hover { background: var(--raised); }

/* ---------- paged lists (helpers/list.js, partials list-tools / list-pager / sort-th) ---------- */
.list-tools .shown { margin-left: auto; color: var(--muted); font-size: 14px; font-variant-numeric: tabular-nums; }
th a.sort { display: inline-flex; align-items: center; gap: 4px; color: inherit; }
th a.sort:hover, th[aria-sort] a.sort { color: var(--text); }
th[aria-sort="ascending"] a.sort::after { content: "↑"; }
th[aria-sort="descending"] a.sort::after { content: "↓"; }
th.n a.sort { flex-direction: row-reverse; }
[data-server].loading tbody { opacity: .5; transition: opacity var(--t-hover) .1s; }
.list-none { margin: 20px var(--card-pad) 8px; }
.pager { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 12px var(--card-pad) 16px; border-top: 1px solid var(--rule); }
.pages { display: flex; align-items: center; gap: 2px; }
.pages .btn { min-width: 32px; padding: 0 8px; }
.pages .btn.on { background: var(--active); border-color: transparent; }
.pages .gap { padding: 0 6px; color: var(--faint); }
.per-page { display: flex; align-items: center; gap: 4px; font-size: 14px; }
.per-page a { padding: 4px 8px; border-radius: 6px; color: var(--muted); }
.per-page a:hover { background: var(--raised); color: var(--text); }
.per-page a[aria-current] { background: var(--active); color: var(--text); font-weight: 500; }
.per-page .muted { margin-right: 4px; }

/* order stages, one colour each: received blue, payment due amber, in production green, shipped violet, invoiced plain text */
.stage { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 12px; font-weight: 500; background: var(--pill-neutral-bg); color: var(--pill-neutral-ink); }
.stage.received { background: var(--hue-pale); color: #123c7a; }
.stage.payment { background: var(--pill-warning-bg); color: var(--pill-warning-ink); }
.stage.production { background: var(--pill-positive-bg); color: var(--pill-positive-ink); }
.stage.shipped { background: #f0eafb; color: #4a2a85; }
.stage.invoiced { background: none; padding: 0; color: var(--muted); font-weight: 400; font-size: 14px; }

/* ---------- menu entry with something new in it (Client news): the one hue, a bold label and a pill ---------- */
.nav-item.lit { background: var(--hue-wash); color: var(--text); font-weight: 600; }
.nav-item.lit svg { color: var(--hue); }
.nav-item.lit .count { min-width: 22px; padding: 0 7px; border-radius: 999px; background: var(--hue); color: #fff; text-align: center; line-height: 20px; font-size: 12px; font-weight: 600; }
