/* La Briquette LAB — one stylesheet, no build step. */

:root {
  --bg: #f9fafb;
  --card: #ffffff;
  --border: #e5e7eb;
  --border-soft: #f3f4f6;
  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --muted-2: #9ca3af;
  --muted-3: #d1d5db;

  --green: #16a34a;
  --green-bg: #dcfce7;
  --green-ink: #15803d;
  --red: #dc2626;
  --red-bg: #fee2e2;
  --red-ink: #b91c1c;
  --orange: #f97316;
  --orange-bg: #ffedd5;
  --orange-ink: #c2410c;
  --yellow-bg: #fef9c3;
  --yellow-ink: #a16207;
  --blue: #2563eb;
  --blue-bg: #dbeafe;
  --blue-ink: #1d4ed8;
  --cyan-bg: #cffafe;
  --cyan-ink: #0e7490;
  --purple-bg: #f3e8ff;
  --purple-ink: #7e22ce;
  --indigo: #6366f1;
  --indigo-bg: #e0e7ff;
  --indigo-ink: #4338ca;

  --r: 12px;
  --r-sm: 8px;
  --sidebar: 248px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a.link { color: var(--blue); }
a.link:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 600; }

/* ── Shell ─────────────────────────────────────────────────────────── */

.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar);
  flex: 0 0 var(--sidebar);
  background: #fff;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
}

.sidebar-brand {
  height: 64px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand img { height: 30px; width: auto; }

/* The LAB stamp beside the logo — studs on top, like a brick. */
.lab-sign {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 5px 11px; border-radius: 5px;
  background: var(--ink); color: #fff;
  font-size: 12px; font-weight: 800; letter-spacing: .14em; line-height: 1;
  box-shadow: 0 2px 0 rgba(17, 24, 39, .35);
}
/* Four studs on top: one element cloned three times with box-shadow. */
.lab-sign::before {
  content: ''; position: absolute; top: -3px; left: 6px;
  width: 6px; height: 4px; border-radius: 3px 3px 1px 1px; background: var(--ink);
  box-shadow: 10px 0 0 var(--ink), 20px 0 0 var(--ink), 30px 0 0 var(--ink);
}

.nav { flex: 1; padding: 18px 12px; overflow-y: auto; }
.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  font-weight: 500;
  color: var(--muted);
  margin-bottom: 2px;
}
.nav-link:hover { background: var(--border-soft); color: var(--ink); }
.nav-link.active { background: var(--ink); color: #fff; }
.nav-link svg { width: 18px; height: 18px; flex: none; }

.sidebar-foot { border-top: 1px solid var(--border); padding: 14px 16px; }

.lang { display: flex; gap: 4px; margin-bottom: 12px; }
.lang a {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  padding: 3px 7px; border-radius: 6px; color: var(--muted-2);
}
.lang a:hover { color: var(--ink-2); }
.lang a.active { background: var(--ink); color: #fff; }

.who { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; flex: none;
  background: #1f2937; color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.who-name { font-weight: 500; font-size: 13px; }
.who-role { font-size: 11px; color: var(--muted-2); }

.sidebar-links { display: flex; gap: 10px; font-size: 12px; color: var(--muted); }
.sidebar-links .danger { color: #f87171; }
.sidebar-links .danger:hover { color: var(--red); }

.main { flex: 1; margin-left: var(--sidebar); display: flex; flex-direction: column; min-width: 0; }

.topbar {
  height: 64px;
  background: #fff;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 { flex: 1; font-size: 15px; }

.page { flex: 1; padding: 28px; }
/* Room under the last card, so the floating chat button never sits on it. */
body:has(.chat-dock) .page { padding-bottom: 96px; }

/* ── Alerts ────────────────────────────────────────────────────────── */

.alert {
  border-radius: var(--r);
  padding: 11px 16px;
  font-size: 13px;
  margin-bottom: 18px;
  border: 1px solid;
}
.alert-success { background: #f0fdf4; border-color: #bbf7d0; color: var(--green-ink); }
.alert-error   { background: #fef2f2; border-color: #fecaca; color: var(--red-ink); }
.alert-warn    { background: #fefce8; border-color: #fde68a; color: var(--yellow-ink); }
.alert-info    { background: #eff6ff; border-color: #bfdbfe; color: var(--blue-ink); }

/* The working note on a lead: a memo, set apart from what the customer wrote. */
.lead-note {
  background: #fefce8; border-left: 3px solid #fde68a; border-radius: var(--r-sm);
  padding: 8px 12px; font-size: 13px; color: var(--ink-2);
}

#toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 11px 16px; border-radius: var(--r-sm); font-size: 13px;
  box-shadow: 0 8px 24px rgba(17, 24, 39, .16); background: var(--ink); color: #fff;
  animation: toast-in .18s ease;
}
.toast.err { background: var(--red); }
/* A page with the floating chat: the toasts sit above its button. */
body:has(.chat-dock) #toasts { bottom: 84px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* ── Cards ─────────────────────────────────────────────────────────── */

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r);
}
.card + .card { margin-top: 20px; }
/* Side by side, the grid's gap spaces them: a margin would push one down. */
:is(.grid, .split) > .card + .card { margin-top: 0; }
.card-head {
  padding: 15px 20px;
  border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-body { padding: 20px; }
.card-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border-soft);
  background: var(--bg);
  border-radius: 0 0 var(--r) var(--r);
}
.card-title { font-size: 14px; font-weight: 600; }

.empty { padding: 40px 20px; text-align: center; color: var(--muted-2); font-size: 13px; }

/* ── Tables ────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted-2);
  padding: 10px 18px; border-bottom: 1px solid var(--border-soft); white-space: nowrap;
}
.table td { padding: 11px 18px; border-bottom: 1px solid var(--border-soft); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafafa; }
.table tfoot td { background: var(--bg); border-top: 2px solid var(--border); font-weight: 600; }
.table .num { text-align: right; white-space: nowrap; }
.table .cell-strong { font-weight: 500; color: var(--ink); }

/* ── Badges & chips ────────────────────────────────────────────────── */

.badge {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 999px;
  font-size: 11px; font-weight: 600; white-space: nowrap;
  background: var(--border-soft); color: var(--ink-2);
}
.badge.design_phase          { background: var(--purple-bg); color: var(--purple-ink); }
.badge.waiting_for_supplies  { background: var(--yellow-bg); color: var(--yellow-ink); }
.badge.production            { background: var(--blue-bg);   color: var(--blue-ink); }
.badge.ready_to_deliver      { background: var(--cyan-bg);   color: var(--cyan-ink); }
.badge.delivered             { background: var(--green-bg);  color: var(--green-ink); }
.badge.pending               { background: var(--border-soft); color: var(--muted); }
.badge.ongoing               { background: var(--blue-bg);   color: var(--blue-ink); }
.badge.proposal_sent         { background: var(--indigo-bg); color: var(--indigo-ink); }
.badge.modifying             { background: var(--orange-bg); color: var(--orange-ink); }
.badge.approved              { background: var(--green-bg);  color: var(--green-ink); }
.badge.warn                  { background: var(--yellow-bg); color: var(--yellow-ink); }
.badge.danger                { background: var(--red-bg);    color: var(--red-ink); }
.badge.info                  { background: var(--blue-bg);   color: var(--blue-ink); }
.badge.purple                { background: var(--purple-bg); color: var(--purple-ink); }

/* ── Buttons ───────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid transparent; border-radius: var(--r-sm);
  padding: 9px 16px; font: inherit; font-size: 13px; font-weight: 500;
  cursor: pointer; background: var(--ink); color: #fff;
  transition: background .12s, border-color .12s, color .12s;
  white-space: nowrap;
}
.btn:hover { background: #374151; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; }

.btn-ghost { background: #fff; border-color: var(--border); color: var(--ink-2); }
.btn-ghost:hover { background: var(--bg); border-color: var(--muted-3); }
.btn-green { background: var(--green); }
.btn-green:hover { background: #15803d; }
.btn-blue { background: var(--blue); }
.btn-blue:hover { background: #1d4ed8; }
.btn-danger { background: #fff; border-color: #fecaca; color: var(--red); }
.btn-danger:hover { background: #fef2f2; }
.btn-warn { background: #fff; border-color: #fed7aa; color: var(--orange-ink); }
.btn-warn:hover { background: #fff7ed; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-xs { padding: 4px 10px; font-size: 11px; border-radius: 6px; }
.btn-block { width: 100%; }

.btn-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: inherit; font-size: 12px; color: var(--muted); text-decoration: underline;
}
.btn-link:hover { color: var(--ink); background: none; }
.btn-link.danger { color: #f87171; }

/* ── Forms ─────────────────────────────────────────────────────────── */

fieldset.bare { border: 0; padding: 0; margin: 0; min-width: 0; }
fieldset.bare[disabled] { opacity: .72; }
fieldset.bare[disabled] .input { background: var(--bg); }

.field { margin-bottom: 14px; }
.field > label, .label {
  display: block; margin-bottom: 5px;
  font-size: 12px; font-weight: 500; color: var(--ink-2);
}
.input, select.input, textarea.input {
  display: block; width: 100%;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 8px 11px; font: inherit; font-size: 13px; color: var(--ink);
  background: #fff;
}
.input::placeholder { color: #c3c8cf; opacity: 1; }
.input:focus { outline: 2px solid var(--ink); outline-offset: -1px; border-color: transparent; }
textarea.input { resize: vertical; min-height: 62px; }
.input.w-sm { max-width: 340px; }
.input.w-xs { max-width: 190px; }
.input.tiny { padding: 5px 9px; font-size: 12px; }
.field-error { color: var(--red); font-size: 12px; margin-top: 4px; }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check input { width: 15px; height: 15px; accent-color: var(--ink); }

.file-input { font-size: 12px; color: var(--muted); }

/* ── Layout helpers ────────────────────────────────────────────────── */

.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.g6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; }
.span2 { grid-column: span 2; }

.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 16px; }
.stack-sm > * + * { margin-top: 8px; }

.mb-0 { margin-bottom: 0; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 18px; }
.mb-4 { margin-bottom: 24px; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }
.mt-4 { margin-top: 24px; }
.right { text-align: right; }
.center { text-align: center; }
.hide { display: none !important; }

.xs { font-size: 11px; }
.sm { font-size: 12px; }
.muted { color: var(--muted); }
.muted-2 { color: var(--muted-2); }
.strong { font-weight: 600; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.up { text-transform: uppercase; letter-spacing: .04em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* A name in a narrow column wraps rather than losing its end. */
.cell-wrap { white-space: normal; overflow-wrap: break-word; }
.pre { white-space: pre-line; }
.ok-text { color: var(--green-ink); }
.bad-text { color: var(--red); }
.warn-text { color: var(--orange-ink); }

.field-label { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-2); }
.field-value { margin-top: 2px; font-weight: 500; }

.max-sm { max-width: 560px; }
.max-md { max-width: 720px; }

/* ── KPI cards ─────────────────────────────────────────────────────── */

.kpi { background: #fff; border: 1px solid var(--border); border-radius: var(--r); padding: 16px; }
.kpi-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted-2); }
.kpi-value { font-size: 24px; font-weight: 700; margin-top: 6px; line-height: 1.1; }
.kpi-hint { font-size: 11px; color: var(--muted-2); margin-top: 5px; }
.kpi.alert { background: #fef2f2; border-color: #fecaca; margin-bottom: 0; padding: 16px; font-size: inherit; }
.kpi.alert .kpi-value { color: var(--red); }
.kpi.dark { background: var(--ink); border-color: var(--ink); }
.kpi.dark .kpi-value { color: #fff; }
.kpi.dark .kpi-label, .kpi.dark .kpi-hint { color: var(--muted); }
.kpi.good { background: #f0fdf4; border-color: #bbf7d0; }
.kpi.good .kpi-value { color: var(--green-ink); }
.kpi.soft-yellow { background: #fefce8; border-color: #fef08a; }
.kpi.soft-yellow .kpi-value { color: var(--yellow-ink); }
.kpi.soft-indigo { background: #eef2ff; border-color: #c7d2fe; }
.kpi.soft-indigo .kpi-value { color: var(--indigo-ink); }

/* ── Tabs & filters ────────────────────────────────────────────────── */

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin-bottom: 22px; }
.tab {
  background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 10px 16px; margin-bottom: -1px;
  font: inherit; font-size: 13px; font-weight: 500; color: var(--muted-2); cursor: pointer;
}
.tab:hover { color: var(--ink-2); }
.tab.active { color: var(--ink); border-bottom-color: var(--ink); }

.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.filters button {
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 6px 12px; font: inherit; font-size: 13px; font-weight: 500; color: var(--muted);
  cursor: pointer;
}
.filters button:hover { border-color: var(--muted-3); }
.filters button.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.filters .count { opacity: .6; font-size: 11px; margin-left: 4px; }

/* ── Bars & charts ─────────────────────────────────────────────────── */

.bar-track { height: 8px; background: var(--border-soft); border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; transition: width .6s ease; }
.bar-split { display: flex; height: 26px; border-radius: var(--r); overflow: hidden; gap: 2px; }
.bar-split > div { transition: width .6s ease; }

.c-parts, .c-blue { background: #60a5fa; }
.c-designer, .c-purple { background: #c084fc; }
.c-shipping, .c-yellow { background: #facc15; }
.c-production, .c-orange { background: #fb923c; }
.c-cyan { background: #22d3ee; }
.c-dark { background: var(--ink); }
.c-soft { background: #e5e7eb; }
.c-indigo { background: var(--indigo); }

.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--muted); margin-top: 12px; }
.dot, .legend .dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }

/* ── Period picker & line chart ────────────────────────────────────── */

.period-bar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r);
  padding: 12px 16px; margin-bottom: 20px;
}
.period-pill {
  display: inline-flex; background: #fff; border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 5px 12px;
  font-size: 12px; font-weight: 500; color: var(--muted);
}
.period-pill:hover { border-color: var(--muted-3); color: var(--ink-2); }
.period-pill.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.period-bar .filters { margin-bottom: 0; }
.period-bar .input.tiny { width: 140px; }

.chart-wrap { width: 100%; }
.linechart { width: 100%; height: 190px; display: block; overflow: visible; }
.linechart .grid { stroke: var(--border-soft); stroke-width: 1; vector-effect: non-scaling-stroke; }
/* Break-even, drawn only when a series goes negative. */
.linechart .zero {
  stroke: var(--muted-3); stroke-width: 1; stroke-dasharray: 4 4;
  vector-effect: non-scaling-stroke;
}
.linechart .line { fill: none; stroke-width: 2; vector-effect: non-scaling-stroke; }
.linechart .dot {
  stroke: #fff; stroke-width: 1.5; vector-effect: non-scaling-stroke;
  opacity: .85; cursor: pointer;
}
.linechart .dot:hover { opacity: 1; r: 6; }

.chart-tip {
  position: fixed; z-index: 200; pointer-events: none;
  background: var(--ink); color: #fff; border-radius: var(--r-sm);
  padding: 7px 11px; font-size: 12px; line-height: 1.45;
  box-shadow: 0 8px 24px rgba(17, 24, 39, .28);
  opacity: 0; transition: opacity .1s;
  display: flex; flex-direction: column; white-space: nowrap;
}
.chart-tip.on { opacity: 1; }
.chart-tip .l { font-size: 10px; color: var(--muted-3); text-transform: uppercase; letter-spacing: .04em; }
.chart-tip .n { font-size: 11px; color: var(--muted-3); }
.chart-tip .v { font-size: 14px; }

/* Stroke on the curves, fill on the points — never the other way round:
   a filled <polyline> paints the area under the curve. */
.linechart .line.c-indigo { stroke: var(--indigo); fill: none; }
.linechart .line.c-green  { stroke: var(--green);  fill: none; }
.linechart .line.c-blue   { stroke: var(--blue);   fill: none; }
.linechart .line.c-orange { stroke: var(--orange); fill: none; }
.linechart .line.c-purple { stroke: #c084fc; fill: none; }

.linechart .dot.c-indigo { fill: var(--indigo); }
.linechart .dot.c-green  { fill: var(--green); }
.linechart .dot.c-blue   { fill: var(--blue); }
.linechart .dot.c-orange { fill: var(--orange); }
.linechart .dot.c-purple { fill: #c084fc; }

.chart-x { display: flex; margin-top: 6px; }
.chart-x span {
  flex: 1; min-width: 0; text-align: center;
  font-size: 10px; color: var(--muted-2); white-space: nowrap;
  display: flex; justify-content: center;   /* a label wider than its slot spills evenly over the empty ones beside it */
}
.chart-x span:first-child { justify-content: flex-start; }
.chart-x span:last-child { justify-content: flex-end; }
@media (max-width: 720px) { .chart-x span.alt { visibility: hidden; } }
.dot-key { width: 10px; height: 10px; border-radius: 3px; display: inline-block; margin-right: 6px; vertical-align: -1px; }
.dot-key.c-indigo { background: var(--indigo); }
.dot-key.c-green  { background: var(--green); }
.dot-key.c-blue   { background: var(--blue); }
.dot-key.c-orange { background: var(--orange); }
.legend strong { margin-left: 4px; color: var(--ink); }

.chart { display: flex; align-items: flex-end; gap: 12px; height: 132px; }
.chart .col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.chart .col .val { font-size: 11px; font-weight: 600; }
.chart .col .bar { width: 100%; border-radius: 6px 6px 0 0; min-height: 4px; }
.chart .col .lbl { font-size: 10px; color: var(--muted-2); text-align: center; }

.daybox {
  width: 44px; height: 44px; border-radius: var(--r-sm); flex: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.daybox b { font-size: 14px; line-height: 1; }
.daybox span { font-size: 10px; line-height: 1; margin-top: 2px; }
.d-late { background: var(--red-bg); color: var(--red-ink); }
.d-soon { background: var(--orange-bg); color: var(--orange-ink); }
.d-warn { background: var(--yellow-bg); color: var(--yellow-ink); }
.d-ok   { background: var(--border-soft); color: var(--muted); }

.rank {
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; background: var(--border-soft); color: var(--muted-2);
}
.rank.first { background: var(--yellow-bg); color: var(--yellow-ink); }

/* ── Item / element rows ───────────────────────────────────────────── */

.list > * { border-bottom: 1px solid var(--border-soft); }
.list > *:last-child { border-bottom: 0; }
.list-row { padding: 12px 20px; display: flex; align-items: center; gap: 12px; }

.phase-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.phase-name { font-size: 12px; color: var(--muted); width: 118px; flex: none; }
.phase-box { background: var(--bg); border-bottom: 1px solid var(--border-soft); padding: 14px 20px; }
.phase-box > * + * { margin-top: 10px; }

.el-row { display: flex; align-items: center; gap: 10px; font-size: 13px; padding: 4px 0; }
.el-mark { width: 16px; text-align: center; font-size: 14px; flex: none; }
.el-mark.done { color: var(--green); }
.el-mark.sent { color: #93c5fd; }
.el-mark.late { color: var(--red); }
.el-mark.soon { color: var(--orange); }
.el-mark.idle { color: var(--muted-3); }

.thumbs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.thumbs.big { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.thumb { position: relative; display: block; }
.thumb img {
  width: 100%; height: 72px; object-fit: cover;
  border-radius: var(--r-sm); border: 1px solid var(--border-soft); display: block;
}
.thumbs.big .thumb img { height: 112px; }
.thumb .del {
  position: absolute; inset: 0; border: 0; border-radius: var(--r-sm);
  background: transparent; color: transparent; cursor: pointer;
  font: inherit; font-size: 11px; font-weight: 700;
}
.thumb:hover .del { background: rgba(0, 0, 0, .45); color: #fff; }
.thumb .del.marked { background: rgba(220, 38, 38, .8); color: #fff; }

.rate-bubble {
  display: inline-flex; align-items: center; margin-left: 6px;
  padding: 1px 8px; border-radius: 999px;
  background: var(--indigo-bg); color: var(--indigo-ink);
  font-size: 10px; font-weight: 700;
}

/* ── Quote status bar ──────────────────────────────────────────────── */

.quote-bar {
  display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r);
  padding: 14px 20px; margin-bottom: 20px;
}
.qb-status { min-width: 240px; }
.qb-figure { display: flex; flex-direction: column; gap: 2px; }
.qb-figure strong { font-size: 19px; font-weight: 700; line-height: 1.1; }
.qb-actions {
  margin-left: auto; display: flex; flex-wrap: wrap; align-items: center;
  justify-content: flex-end; gap: 8px 10px;
}
/* Why a button is disabled reads under the buttons, not squeezed beside them. */
.qb-actions > .xs { flex-basis: 100%; text-align: right; }

.qb-pill {
  background: #fff; border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 12px; font: inherit; font-size: 12px; font-weight: 500;
  color: var(--muted); cursor: pointer;
}
.qb-pill:hover { border-color: var(--muted-3); color: var(--ink-2); }
.qb-pill.active { border-color: transparent; font-weight: 600; }
.qb-pill.active.pending  { background: var(--border-soft); color: var(--ink-2); }
.qb-pill.active.info     { background: var(--blue-bg); color: var(--blue-ink); }
.qb-pill.active.approved { background: var(--green-bg); color: var(--green-ink); }
.qb-pill.active.danger   { background: var(--red-bg); color: var(--red-ink); }

/* ── Notifications ─────────────────────────────────────────────────── */

.notif { position: relative; }
.notif-btn {
  position: relative; background: none; border: 0; padding: 6px; cursor: pointer;
  color: var(--muted); border-radius: var(--r-sm); display: flex;
}
.notif-btn:hover { background: var(--border-soft); color: var(--ink); }
.notif-btn svg { width: 19px; height: 19px; }
.notif-btn.has-unread { color: var(--ink); }
.notif-dot {
  position: absolute; top: 0; right: 0;
  min-width: 15px; height: 15px; padding: 0 4px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 9px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}

.notif-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 60;
  width: 330px; max-height: 420px; overflow-y: auto;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: 0 16px 40px rgba(17, 24, 39, .16);
}
.notif-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 14px; border-bottom: 1px solid var(--border-soft); font-size: 13px;
}
.notif-item {
  display: block; padding: 10px 14px; border-bottom: 1px solid var(--border-soft);
}
.notif-item:last-child { border-bottom: 0; }
.notif-item:hover { background: var(--bg); }
.notif-item .t { display: block; font-size: 13px; font-weight: 500; }
.notif-item .b { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.notif-item .w { display: block; font-size: 10px; color: var(--muted-2); margin-top: 3px; }
.notif-item.unread { background: #f5f7ff; }
.notif-item.unread .t::before {
  content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%;
  background: var(--blue); margin-right: 6px; vertical-align: 1px;
}

/* ── Proposal history ──────────────────────────────────────────────── */

.proposals { background: #fdfcff; border-top: 1px solid var(--border-soft); }
.proposal {
  border-left: 2px solid var(--purple-bg); padding: 0 0 12px 12px; margin-bottom: 12px;
}
.proposal:last-child { margin-bottom: 0; padding-bottom: 0; }
.proposal.latest { border-left-color: var(--indigo); }
.proposal-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.proposal-files { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.proposal-files .thumb img { width: 96px; height: 72px; object-fit: cover; }
.proposal-answer {
  margin-top: 8px; padding: 6px 10px; background: #fff;
  border: 1px solid var(--border-soft); border-radius: var(--r-sm);
}

/* ── Chat dock ─────────────────────────────────────────────────────── */

.chat-open {
  display: flex; align-items: center; gap: 8px; width: 100%;
  background: none; border: 1px dashed var(--border); border-radius: var(--r-sm);
  padding: 8px 12px; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 600; color: var(--ink-2);
}
.chat-open:hover { border-color: var(--muted-3); background: var(--bg); }
.chat-open svg { width: 15px; height: 15px; color: var(--muted-2); }
.chat-open .grow { text-align: left; }

.chat-dock { position: fixed; right: 20px; bottom: 20px; z-index: 90; }

.chat-launcher {
  width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--ink); color: #fff; position: relative; margin-left: auto;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 24px rgba(17, 24, 39, .28);
}
.chat-launcher:hover { background: #374151; }
.chat-launcher svg { width: 22px; height: 22px; }
.chat-dot {
  position: absolute; top: -2px; right: -2px;
  min-width: 19px; height: 19px; padding: 0 5px; border-radius: 999px;
  background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; border: 2px solid #fff;
}

.chat-panel {
  position: absolute; right: 0; bottom: 64px; width: 370px;
  max-height: min(70vh, 560px); display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: 0 20px 50px rgba(17, 24, 39, .22); overflow: hidden;
}
.chat-head {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--border-soft); font-size: 13px;
}
.chat-head .x { background: none; border: 0; font-size: 15px; color: var(--muted-2); cursor: pointer; }
.chat-head .x:hover { color: var(--ink); }
.chat-search { width: 130px; flex: none; }

/* Expanded: the conversation takes the screen, search included. */
.chat-panel.expanded {
  position: fixed; inset: 4vh 4vw; width: auto; max-height: none;
  bottom: 4vh; right: 4vw;
}
.chat-panel.expanded .chat-search { width: 240px; }
.chat-panel.expanded .msg { max-width: 70%; }
.chat-panel.expanded .msg-image img { max-height: 320px; }
body.chat-expanded { overflow: hidden; }
body.chat-expanded .chat-launcher { display: none; }

.chat-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 10px; flex-shrink: 0; border-bottom: 1px solid var(--border-soft); }
.chat-tab {
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 11px; font: inherit; font-size: 11px; color: var(--muted); cursor: pointer;
  display: flex; text-align: left; align-items: center; gap: 5px;
}
.chat-tab.active { background: var(--ink); border-color: var(--ink); color: #fff; }

.chat-body { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.chat-thread { display: flex; flex-direction: column; min-height: 0; flex: 1; }

.composer { padding: 10px 12px; border-top: 1px solid var(--border-soft); }
.composer textarea.input { min-height: 44px; }
.composer-tools { display: flex; align-items: center; gap: 6px; margin-top: 6px; }
.composer-tools .tool {
  background: none; border: 1px solid var(--border); border-radius: var(--r-sm);
  width: 30px; height: 30px; font-size: 15px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center; color: var(--muted);
}
.composer-tools .tool:hover { border-color: var(--muted-3); background: var(--bg); }
.composer-tools .tool.has-files { border-color: var(--blue); color: var(--blue); }
.composer-tools .btn svg { width: 13px; height: 13px; }

/* What is staged for the next message */
.attach-preview {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px; margin-bottom: 8px;
  background: var(--bg); border: 1px solid var(--border-soft); border-radius: var(--r-sm);
}
.attach-chip {
  display: flex; align-items: center; gap: 6px; max-width: 100%;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 4px 6px 4px 4px; font-size: 11px;
}
.attach-chip img { width: 34px; height: 34px; object-fit: cover; border-radius: 5px; display: block; }
.attach-chip .ext {
  width: 34px; height: 34px; border-radius: 5px; background: var(--border-soft);
  display: flex; align-items: center; justify-content: center;
  font-size: 9px; font-weight: 700; color: var(--muted);
}
.attach-chip .nm { max-width: 120px; }
.attach-chip .rm {
  background: none; border: 0; color: var(--muted-2); cursor: pointer; font-size: 11px; padding: 2px 4px;
}
.attach-chip .rm:hover { color: var(--red); }

.emoji-pop {
  position: fixed; z-index: 120; width: 288px; max-height: 180px; overflow-y: auto;
  background: #fff; border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: 0 12px 32px rgba(17, 24, 39, .2); padding: 8px;
  display: flex; flex-wrap: wrap; gap: 2px;
}
.emoji {
  background: none; border: 0; cursor: pointer; font-size: 18px;
  width: 32px; height: 32px; border-radius: 6px; line-height: 1;
}
.emoji:hover { background: var(--border-soft); }

/* ── Messages ──────────────────────────────────────────────────────── */

.thread-log {
  flex: 1; min-height: 120px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 10px;
  padding: 12px;
}

.msg {
  background: var(--bg); border: 1px solid var(--border-soft);
  border-radius: var(--r-sm); padding: 9px 12px; max-width: 82%;
}
.msg.mine { align-self: flex-end; background: #eef2ff; border-color: #e0e7ff; }
.msg.proposal { background: #faf5ff; border-color: var(--purple-bg); max-width: 100%; }
.msg.decision { background: #f0fdf4; border-color: #dcfce7; max-width: 100%; }

.msg-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px; }
.msg-head .who { font-size: 12px; font-weight: 600; }
.msg-head .when { font-size: 10px; color: var(--muted-2); margin-left: auto; }
.msg-body { font-size: 13px; color: var(--ink-2); }

.msg-files { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.msg-image { display: block; width: 100%; }
.msg-image img {
  max-width: 100%; max-height: 200px; border-radius: var(--r-sm);
  border: 1px solid var(--border-soft); display: block; object-fit: cover;
}
.file-chip {
  display: inline-flex; align-items: center; gap: 6px; max-width: 240px;
  background: #fff; border: 1px solid var(--border); border-radius: 999px;
  padding: 4px 11px; font-size: 12px; color: var(--ink-2);
}
.file-chip:hover { border-color: var(--muted-3); background: var(--bg); }
.file-chip svg { width: 13px; height: 13px; flex: none; color: var(--muted-2); }

@media (max-width: 520px) {
  .chat-dock { right: 12px; bottom: 12px; }
  .chat-panel { width: calc(100vw - 24px); }
}

/* ── Banner ────────────────────────────────────────────────────────── */

.banner {
  background: var(--orange); color: #fff; border-radius: var(--r);
  padding: 16px 22px; display: flex; align-items: center; gap: 16px; margin-bottom: 20px;
  box-shadow: 0 6px 18px rgba(249, 115, 22, .25);
}
.banner > svg { width: 26px; height: 26px; flex: none; }
.banner .t { font-weight: 700; font-size: 16px; }
.banner .b { font-size: 13px; opacity: .92; margin-top: 2px; }
.banner button { background: none; border: 0; color: #fff; opacity: .7; font-size: 18px; cursor: pointer; }
.banner button:hover { opacity: 1; }

/* ── Modals ────────────────────────────────────────────────────────── */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0, 0, 0, .42);
  display: flex; align-items: center; justify-content: center; padding: 16px;
}
.modal {
  background: #fff; border-radius: 16px; width: 100%; max-width: 520px;
  max-height: 90vh; overflow-y: auto; box-shadow: 0 24px 60px rgba(0, 0, 0, .22);
}
.modal.narrow { max-width: 380px; }
.modal.wide { max-width: 680px; }
.modal-head {
  position: sticky; top: 0; background: #fff; z-index: 1;
  padding: 15px 20px; border-bottom: 1px solid var(--border-soft);
  display: flex; align-items: center; justify-content: space-between;
  border-radius: 16px 16px 0 0;
}
.modal-head h2 { font-size: 14px; }
.modal-head .x { background: none; border: 0; font-size: 16px; color: var(--muted-2); cursor: pointer; }
.modal-body { padding: 20px; }
.modal-actions { display: flex; align-items: center; gap: 12px; padding-top: 4px; }

/* ── Login ─────────────────────────────────────────────────────────── */

.login-page {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 24px; background: var(--bg);
}
.login-box { width: 100%; max-width: 380px; }
.login-logo { text-align: center; margin-bottom: 22px; }
.login-logo img { height: 56px; width: auto; }

/* ── Quote model: photos in, the studio's analysis out ─────────────── */

.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Kept for the eyes of the browser only: a default button, a hidden label. */
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

.alert-warn { background: var(--orange-bg); border-color: var(--orange-bg); color: var(--orange-ink); }

.studio { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }

.studio-thumbs {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px;
  margin: 4px 0 8px;
}
.studio-thumb {
  display: flex; flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--r-sm);
}
.studio-thumb img { display: block; width: 100%; aspect-ratio: 1; object-fit: cover; }
.studio-thumb-del {
  display: flex; align-items: center; gap: 4px;
  padding: 4px 6px;
  font-size: 11px; color: var(--muted);
  cursor: pointer;
}
.studio-thumb:has(input:checked) img { opacity: .35; }
.studio-thumb:has(input:checked) .studio-thumb-del { color: var(--red-ink); }

.studio-wait {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--r-sm);
}
.studio-spin {
  flex: none; width: 22px; height: 22px;
  border: 3px solid var(--border); border-top-color: var(--green);
  border-radius: 50%;
  animation: studio-spin .9s linear infinite;
}
@keyframes studio-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .studio-spin { animation-duration: 3s; } }

.studio-previews { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.studio-previews img {
  display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: contain;
  background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--r-sm);
}

.shape-viewer {
  position: relative;
  margin-bottom: 8px;
  background: radial-gradient(circle at 50% 35%, #fff, var(--bg));
  border: 1px solid var(--border); border-radius: var(--r-sm);
}
.shape-viewer canvas {
  display: block; width: 100%; aspect-ratio: 4 / 3;
  cursor: grab; touch-action: none;
}
.shape-viewer canvas:active { cursor: grabbing; }
.shape-rulers { position: absolute; left: 0; top: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.shape-rulers line { stroke: #2b3440; stroke-width: 1.25; stroke-linecap: round; }
.shape-rulers line.ext { stroke-opacity: .35; stroke-dasharray: 3 3; }
.shape-rulers rect { fill: #fff; stroke: #2b3440; stroke-opacity: .25; }
.shape-rulers text { font-size: 11px; font-weight: 600; fill: #2b3440; text-anchor: middle; dominant-baseline: central; }
.shape-hint { position: absolute; left: 8px; bottom: 6px; color: var(--muted); pointer-events: none; }
.shape-fallback { margin: 0; padding: 12px; }

.studio-notes { margin: 4px 0 0; padding-left: 18px; font-size: 12px; color: var(--muted); }
.studio-notes li + li { margin-top: 2px; }
.studio-notes.warn { color: var(--orange-ink); }

.studio-list summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.studio-list .table-wrap { max-height: 420px; overflow: auto; margin-top: 8px; }
.part-cell { display: flex; align-items: center; gap: 10px; }
.part-thumb {
  flex: none; width: 40px; height: 40px; border-radius: var(--r-sm);
  background: var(--bg); display: grid; place-items: center; overflow: hidden;
}
.part-thumb img { max-width: 100%; max-height: 100%; object-fit: contain; }

/* ── Quote chiffrage: steps, choices, margin ───────────────────────── */

.qsteps {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(148px, 1fr);
  gap: 6px;
  margin: 0 0 20px; padding: 0 0 2px;   /* 20px: the gap between two cards */
  list-style: none;
  overflow-x: auto;
}
.qsteps li { min-width: 0; }

.qstep {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 9px 12px;
  font: inherit; text-align: left;
  color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  cursor: pointer;
}
.qstep:hover { border-color: var(--muted-3); color: var(--ink-2); }
.qstep.active { border-color: var(--ink); color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }

.qstep-n {
  flex: none;
  display: grid; place-items: center;
  width: 22px; height: 22px;
  font-size: 11px; font-weight: 700;
  color: var(--muted); background: var(--border-soft);
  border-radius: 999px;
}
.qstep.active .qstep-n { background: var(--ink); color: #fff; }

.qstep-body { display: flex; flex-direction: column; min-width: 0; }
.qstep-t { font-size: 12px; font-weight: 600; }
.qstep-v { font-size: 11px; color: var(--muted-2); }
.qstep.active .qstep-v { color: var(--muted); }
.qstep-t, .qstep-v { overflow-wrap: anywhere; }

/* One step at a time. min-width guards the panels that hold a wide table or
   the mock-up's own grid from pushing the page sideways. */
.qpanel { min-width: 0; }

/* The running total follows the seller down every step. */
.qbar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border); border-radius: var(--r);
  box-shadow: 0 -6px 18px rgba(17, 24, 39, .07);
}

.qbar-figs { display: flex; align-items: center; gap: 26px; flex-wrap: wrap; }
.qbar-figs strong { display: block; margin-top: 2px; font-size: 15px; }
.qbar-price strong { font-size: 20px; color: var(--green-ink); }
.qbar-nav { display: flex; align-items: center; gap: 8px; }

/* Radio cards: the input is only there to be posted. */
.qpick { display: grid; gap: 12px; }
.qpick input[type="radio"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

.qcard {
  position: relative;
  display: flex; align-items: flex-start; gap: 12px;
  padding: 14px;
  background: var(--card);
  border: 1px solid var(--border); border-radius: var(--r);
  cursor: pointer;
}
.qcard:hover { border-color: var(--muted-3); }
.qcard.active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.qcard.tall { flex-direction: column; align-items: stretch; gap: 0; }

.qcard-ico { flex: none; color: var(--muted-2); }
.qcard-ico svg { display: block; width: 32px; height: 32px; }
.qcard.active .qcard-ico { color: var(--ink); }

.qcard-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.qcard-t { font-size: 13px; font-weight: 600; color: var(--ink); }
.qcard-d { font-size: 12px; color: var(--muted); }

.qbox {
  position: relative;              /* anchors the visually hidden radio */
  display: flex; flex-direction: column;
  background: var(--card);
  border: 1px solid var(--border); border-radius: var(--r);
  overflow: hidden;
}
.qbox.active { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.qbox-pick { display: flex; flex-direction: column; gap: 3px; padding: 14px; cursor: pointer; }
.qbox-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.qbox-t { font-size: 13px; font-weight: 600; }
.qbox-dims { color: var(--muted); }
.qbox-price { margin-top: 6px; font-size: 17px; font-weight: 600; }

.qbox-dl {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  margin-top: auto;
  font-size: 12px;
  background: var(--border-soft);
  border-top: 1px solid var(--border);
}
.qbox-dl svg { width: 15px; height: 15px; }
a.qbox-dl { color: var(--blue); }
a.qbox-dl:hover { text-decoration: underline; }
span.qbox-dl { color: var(--muted-2); }

.qtotals { display: flex; flex-wrap: wrap; gap: 12px; }
/* Capped: a step with a single figure should not stretch it across the card. */
.qtotal {
  flex: 1 1 190px;
  max-width: 320px;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--r-sm);
}
.qtotal strong { display: block; margin: 2px 0 1px; font-size: 18px; }

.qmini {
  padding: 10px;
  font-size: 12px; color: var(--muted);
  background: var(--card);
  border: 1px solid var(--border); border-radius: var(--r-sm);
}
.qmini > * + * { margin-top: 4px; }

/* The price the seller settles on: a slider to feel the room, a field to type
   the figure the customer actually asked for. */
.qprice { display: flex; align-items: center; gap: 14px; }
.qrange { flex: 1; min-width: 0; height: 22px; accent-color: var(--ink); }

.qprice-field { position: relative; flex: none; width: 150px; }
.qprice-field .input {
  padding-right: 42px;
  font-size: 17px; font-weight: 600; text-align: right;
}
.qprice-cur {
  position: absolute; right: 11px; top: 50%;
  transform: translateY(-50%);
  font-size: 12px; font-weight: 600; color: var(--muted-2);
  pointer-events: none;
}

.qprice-unit { display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }
.qprice-unit .qprice-field .input { font-size: 15px; }
.qmargin-scale { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; }
.qmargin-target { font-weight: 600; color: var(--muted); }

.qrangebox { padding: 12px 14px; border: 1px dashed var(--muted-3); border-radius: var(--r-sm); }

/* Quantity tiers, in the admin screen and read-only on the quote. */
.input.input-sm { padding: 5px 8px; font-size: 12px; }
.tier-table td, .tier-table th { padding: 5px 8px; }
[data-tier].active td { background: var(--yellow-bg); color: var(--yellow-ink); font-weight: 600; }

@media (max-width: 1080px) {
  /* Six steps no longer fit on one line: two rows of three, labels whole. */
  .qsteps { grid-auto-flow: row; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; }
  .qpick.g3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  .qpick.g2, .qpick.g3 { grid-template-columns: minmax(0, 1fr); }
  .qsteps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .qbar { flex-direction: column; align-items: stretch; }
  .qbar-nav { justify-content: flex-end; }
}

/* ── Responsive ────────────────────────────────────────────────────── */

@media (max-width: 1100px) {
  .split { grid-template-columns: minmax(0, 1fr); }
  .g6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
  .studio { grid-template-columns: minmax(0, 1fr); }
}

/* A tablet keeps its width for the page: the menu moves above it. */
@media (max-width: 1024px) {
  .sidebar { position: static; width: 100%; height: auto; flex: none; border-right: 0; border-bottom: 1px solid var(--border); }
  .app { flex-direction: column; }
  .main { margin-left: 0; }
  .nav { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px; }
  .nav-link { margin: 0; }
}

@media (max-width: 820px) {
  .page, .topbar { padding-left: 16px; padding-right: 16px; }
  /* The title keeps its line, next to the bell; the page actions wrap below it. */
  .topbar { height: auto; min-height: 56px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; position: static; }
  .topbar h1 { flex: 1 0 calc(100% - 60px); min-width: 0; overflow-wrap: break-word; }
  .topbar > .notif { order: 1; }
  .topbar > :not(h1):not(.notif) { order: 2; }
  .g2, .g3, .g4, .g6 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span2 { grid-column: span 1; }
  /* On a phone a row of controls goes to the line rather than past the edge. */
  .row { flex-wrap: wrap; }
  .el-row, .list-row { flex-wrap: wrap; row-gap: 4px; }
  .el-row > .grow, .list-row > .grow { flex: 1 0 60%; }
  .period-bar .input.tiny { width: auto; flex: 1 1 130px; }
}

@media (max-width: 520px) {
  .g2, .g3, .g4, .g6 { grid-template-columns: minmax(0, 1fr); }
  .phase-name { width: auto; }
}

/* ── Printable documents (quote, invoice) ─────────────────────────────── */
/* An A4 sheet on screen; the toolbar disappears and the sheet fills the   */
/* page when the browser prints or saves it as a PDF.                      */

.print-body { background: #e5e7eb; margin: 0; }
.doc-toolbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  justify-content: space-between; flex-wrap: wrap; padding: 10px 16px; background: var(--card);
  border-bottom: 1px solid var(--border);
}
.doc {
  box-sizing: border-box; width: 210mm; min-height: 297mm; margin: 24px auto; padding: 16mm 15mm;
  background: #fff; color: var(--ink); font-size: 12px; line-height: 1.45;
  box-shadow: 0 4px 24px rgba(17, 24, 39, .12);
}
.doc h1 { font-size: 22px; margin: 0; letter-spacing: -.01em; }
.doc h2 { font-size: 13px; margin: 18px 0 6px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.doc-head { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; }
.doc-logo { height: 42px; margin-bottom: 8px; }
.doc-issuer { font-size: 11px; color: var(--ink-2); }
.doc-issuer strong { font-size: 13px; color: var(--ink); }
.doc-title { text-align: right; }
.doc-title .ref { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; margin-top: 4px; }
.doc-meta { margin-top: 6px; font-size: 11px; color: var(--muted); }
.doc-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 22px; }
.doc-box { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; }
.doc-box .l { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 4px; }
.doc-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.doc-table th { text-align: left; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  border-bottom: 1.5px solid var(--ink); padding: 6px 6px; }
.doc-table td { border-bottom: 1px solid var(--border); padding: 7px 6px; vertical-align: top; }
.doc-table .num { text-align: right; white-space: nowrap; }
.doc-table .desc { color: var(--muted); font-size: 11px; margin-top: 2px; }
.doc-table tr.main td { background: #f9fafb; font-weight: 600; }
.doc-totals { margin-left: auto; width: 46%; margin-top: 10px; }
.doc-totals div { display: flex; justify-content: space-between; padding: 4px 6px; }
.doc-totals .grand { border-top: 1.5px solid var(--ink); font-weight: 700; font-size: 14px; margin-top: 4px; padding-top: 8px; }
.doc-note { margin-top: 16px; font-size: 11px; color: var(--ink-2); white-space: pre-line; }
.doc-foot { margin-top: 28px; padding-top: 10px; border-top: 1px solid var(--border); font-size: 10px; color: var(--muted); white-space: pre-line; }
.doc-stamp { display: inline-block; border: 2px solid currentColor; border-radius: 6px; padding: 2px 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; font-size: 12px; margin-top: 8px; }
.doc-stamp.paid { color: var(--green-ink); }
.doc-stamp.cancelled { color: var(--red-ink); }

@media screen and (max-width: 820px) {
  .doc { width: auto; min-height: 0; margin: 12px; padding: 18px 16px; }
  .doc-head, .doc-parties { display: block; }
  .doc-title { text-align: left; margin-top: 12px; }
  .doc-totals { width: auto; }
}

@page { size: A4; margin: 0; }
@media print {
  .print-body { background: #fff; }
  .doc-toolbar { display: none; }
  .doc { margin: 0; box-shadow: none; width: auto; min-height: 0; }
  .doc-table tr { break-inside: avoid; }
}
.table tr.row-main td { background: var(--bg); font-weight: 600; }
