/* Rigby workshop planner — demo V2.
   Layout: navy top bar, full-height workspace, detail drawer on the right.
   Charter: navy #00244B titles, #333 text, Garamond-like display face. */
:root {
  --navy: #00244B;
  --navy-2: #123A66;
  --ink: #333333;
  --muted: #6B7280;
  --paper: #F6F4EF;
  --card: #FFFFFF;
  --line: #E4E0D6;
  --gold: #B08D57;
  --metal: #5B6B7A;
  --wood: #8B5A2B;
  --case: #3E5A47;
  --ok: #3E7A55;
  --warn: #B8681F;
  --bad: #A93E33;
  /* Families of work (src/families.js): distinct hues from a gunmaker's palette. */
  --fam-order: #7C7466;   /* stone */
  --fam-gun: #00244B;     /* Rigby navy */
  --fam-wood: #8A4F22;    /* walnut */
  --fam-engrave: #9A7432; /* brass */
  --fam-metal: #3C6E93;   /* blued steel */
  --fam-test: #8E2B37;    /* oxblood */
  --fam-case: #2D6A4C;    /* racing green */
  --f-display: 'EB Garamond', Georgia, serif;
  --f-ui: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
  --f-mono: 'IBM Plex Mono', ui-monospace, Menlo, monospace;
  --crit: #00244B;        /* critical path */
  --soft: #B7C1CD;        /* other work */
  --label-w: 270px; /* Gantt label column, LABEL_W in src/gantt.js */

  /* Surfaces and tints. */
  --surface-2: #F1EEE6; --surface-3: #FCFBF8; --tint: #FBF8F1;
  --tint-gold: #F6EEDD; --tint-gold-bg: #FBF6EA; --tint-gold-line: #E8DEC8; --gold-ink: #8A6A2E;
  --tint-red: #F6E3E0; --tint-green: #E6F0EA; --tint-blue: #EEF1F5; --tint-blue-line: #D5DCE8;
  --track: #E7E2D8; --line-2: #DCD5C5; --muted-2: #A8A18F;
  --topbar: #00244B; --topbar-line: #00244B; --on-navy: #FFFFFF; --bar-fg: #FFFFFF; --soft-fg: #2A3E55;
  --mix: #FFFFFF; --deep: #000000;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--paper); color: var(--ink); font: 14px/1.45 var(--f-ui); -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.app { display: grid; grid-template-rows: auto 1fr; height: 100%; }
.section { display: grid; grid-template-rows: auto 1fr; min-height: 0; }
.section[hidden] { display: none; }

/* Top bar */
.topbar { display: flex; align-items: center; gap: 24px; padding: 12px 24px; background: var(--topbar); color: #fff; border-bottom: 1px solid var(--topbar-line); }
.brand { font-family: var(--f-display); font-size: 22px; letter-spacing: .02em; white-space: nowrap; }
.brand small { display: block; font-family: var(--f-ui); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: #C9D3E0; }
.nav { display: flex; gap: 4px; }
.nav button { background: transparent; border: 0; color: #C9D3E0; padding: 8px 14px; border-radius: 8px; font-weight: 500; }
.nav button.on { background: rgba(255,255,255,.12); color: #fff; }
.topbar .spacer { flex: 1; }
.topbar .today { font-family: var(--f-mono); font-size: 12px; color: #C9D3E0; white-space: nowrap; }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 12px; padding: 14px 24px; border-bottom: 1px solid var(--line); background: var(--card); flex-wrap: wrap; }
.toolbar h1 { font-family: var(--f-display); font-weight: 500; font-size: 26px; color: var(--navy); margin: 0 12px 0 0; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.seg button { border: 0; background: transparent; padding: 7px 14px; color: var(--muted); font-weight: 500; }
.seg button.on { background: var(--navy); color: var(--on-navy); }
.legend { display: flex; gap: 14px; margin-left: auto; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.legend i { display: inline-block; width: 16px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: middle; }

/* Workspace */
.workspace { display: grid; grid-template-columns: 1fr 0; min-height: 0; transition: grid-template-columns .2s; }
.workspace.has-detail { grid-template-columns: 1fr 360px; }
.gantt { min-height: 0; min-width: 0; position: relative; }

/* Gantt */
.g-scroll { position: absolute; inset: 0; overflow: auto; }
.g-headrow { position: sticky; top: 0; z-index: 4; display: flex; height: 44px; background: var(--card); border-bottom: 1px solid var(--line); }
.g-corner { position: sticky; left: 0; width: var(--label-w); flex: none; background: var(--card); z-index: 5; border-right: 1px solid var(--line); }
.g-head { position: relative; height: 44px; flex: none; }
.g-month { position: absolute; top: 6px; font-family: var(--f-display); font-size: 15px; color: var(--navy); padding-left: 6px; white-space: nowrap; }
.g-week { position: absolute; top: 26px; font: 10px var(--f-mono); color: var(--muted); padding-left: 3px; }
.g-body { position: relative; }
.g-grid { position: absolute; left: var(--label-w); top: 0; bottom: 0; pointer-events: none; }
.g-gridline { position: absolute; top: 0; bottom: 0; border-left: 1px solid var(--line); }
.g-gridline--week { border-left: 1px dashed var(--track); }
.g-today { position: absolute; top: 0; bottom: 0; border-left: 2px solid var(--gold); z-index: 2; }
.g-today span { position: sticky; top: 50px; display: inline-block; margin-left: 4px; font: 600 10px var(--f-ui); text-transform: uppercase; letter-spacing: .1em; color: var(--gold); background: var(--paper); padding: 1px 4px; border-radius: 4px; }
.g-row { display: flex; border-bottom: 1px solid var(--line); }
.g-row.is-group { background: var(--surface-2); border-bottom-color: var(--line-2); }
.g-label { position: sticky; left: 0; z-index: 3; width: var(--label-w); flex: none; padding: 6px 12px; background: var(--card); border-right: 1px solid var(--line); cursor: pointer; overflow: hidden; }
.g-row.is-group .g-label { background: var(--surface-2); }
.g-row.is-sub .g-label { padding: 0 12px 0 32px; display: flex; align-items: center; gap: 8px; }
.g-row.is-sub .g-label-main { flex: 1; min-width: 0; }
.g-row.is-sub .g-label-sub { flex: none; max-width: 80px; }
.g-swatch { position: absolute; left: 16px; top: 10px; bottom: 10px; width: 5px; border-radius: 3px; }
.g-label-main { font-weight: 600; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-label-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-row.is-sub .g-label-main { font-weight: 500; color: var(--ink); font-size: 13px; }
.g-track { position: relative; flex: none; }
.g-bar--absence { background: repeating-linear-gradient(45deg, var(--line-2) 0 4px, var(--track) 4px 8px); color: var(--ink); cursor: default; }
.g-bar--blocked { background: var(--bad); }
.g-bar.is-selected { outline: 2px solid var(--gold); outline-offset: 1px; z-index: 2; }

/* Detail drawer */
.detail { overflow: auto; background: var(--card); border-left: 1px solid var(--line); padding: 20px; }
.detail .kicker { font: 500 10.5px var(--f-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.detail h2 { font-family: var(--f-display); font-weight: 500; font-size: 24px; color: var(--navy); margin: 4px 0 12px; line-height: 1.15; }
.detail dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0 0 16px; font-size: 13px; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; color: var(--ink); }
.why { border-left: 3px solid var(--gold); background: var(--tint); padding: 10px 12px; border-radius: 0 8px 8px 0; font-size: 13.5px; }
.close { float: right; border: 0; background: transparent; font-size: 20px; color: var(--muted); line-height: 1; }
.chip { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; background: var(--tint-blue); color: var(--navy); }
.chip--running { background: var(--tint-gold); color: var(--gold-ink); }
.chip--done { background: var(--tint-green); color: var(--ok); }
.chip--blocked { background: var(--tint-red); color: var(--bad); }

.loading { padding: 40px; color: var(--muted); }

/* Sales */
.sales-wrap { overflow: auto; display: block; padding: 24px; }
.sales { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(320px, 1fr); gap: 20px; max-width: 1200px; margin: 0 auto; align-items: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; }
.card .kicker { font: 500 10.5px var(--f-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.card h2 { font-family: var(--f-display); font-weight: 500; font-size: 28px; color: var(--navy); margin: 4px 0 14px; line-height: 1.1; }
.card h3 { font: 600 12px var(--f-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--navy); margin: 22px 0 10px; }
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px 14px; }
.field { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.field.wide { grid-column: 1 / -1; }
.field input, .field select { font: 14px var(--f-ui); color: var(--ink); padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-3); }
.field.check { display: flex; align-items: center; gap: 8px; color: var(--ink); font-size: 13px; padding-top: 18px; }
.muted { color: var(--muted); margin: 0 0 10px; }
.opt-list { list-style: none; padding: 0; margin: 0 0 10px; border-top: 1px solid var(--line); }
.opt-list li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.opt-list span { color: var(--muted); }
.rules { border-radius: 10px; padding: 10px 12px; margin: 12px 0; font-size: 13px; }
.rules p { margin: 0 0 4px; }
.rules.ok { background: var(--tint-green); color: var(--ok); }
.rules.bad { background: var(--tint-red); color: var(--bad); }
.btn { border: 0; border-radius: 9px; padding: 10px 16px; background: var(--navy); color: var(--on-navy); font-weight: 600; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--navy); }
.btn-gold { background: var(--gold); }
.estimate { margin: 16px 0; padding: 16px; border-radius: 12px; background: var(--tint); border: 1px solid var(--tint-gold-line); }
.estimate .eta { font-family: var(--f-display); font-size: 34px; color: var(--navy); line-height: 1.1; margin: 4px 0 6px; }
.reasons { margin: 6px 0 0; padding-left: 18px; font-size: 13px; }
.reasons li { margin-bottom: 4px; }
.actions { display: flex; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.done-note { margin-top: 12px; color: var(--ok); font-weight: 600; }
.g-row.is-new .g-label { box-shadow: inset 4px 0 0 var(--gold); }

/* Draft plans */
/* Planning: toolbar, optional notice and draft bars, then the workspace takes the rest. */
.section#planningView { display: flex; flex-direction: column; }
.section#planningView[hidden] { display: none; }
#planningView > .workspace { flex: 1; min-height: 0; }
.draft-bar { background: var(--tint-gold-bg); border-bottom: 1px solid var(--tint-gold-line); padding: 12px 24px; max-height: 34vh; overflow: auto; }
.draft-bar[hidden] { display: none; }
.draft-head { display: flex; align-items: flex-start; gap: 16px; justify-content: space-between; }
.draft-head .kicker { font: 600 10.5px var(--f-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--gold-ink); }
.draft-title { font-family: var(--f-display); font-size: 19px; color: var(--navy); }
.draft-actions { display: flex; gap: 8px; flex: none; }
.draft-count { margin: 8px 0 4px; font-weight: 600; color: var(--navy); }
.draft-diff ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 6px 18px; }
.draft-diff li { font-size: 13px; padding: 6px 8px; border-radius: 8px; cursor: pointer; }
.draft-diff li:hover { background: var(--tint-gold); }
.draft-diff .muted { margin: 0 0 0 6px; }
.draft-diff .cause { color: var(--muted); font-size: 12px; margin-top: 2px; }
.delta { font: 600 11.5px var(--f-mono); padding: 1px 6px; border-radius: 6px; margin-left: 6px; }
.delta.late { background: var(--tint-red); color: var(--bad); }
.delta.early { background: var(--tint-green); color: var(--ok); }
.g-bar.is-draggable { cursor: grab; touch-action: none; }
.g-bar.is-dragging { cursor: grabbing; opacity: .85; z-index: 5; }
.g-row.is-moved .g-label { box-shadow: inset 4px 0 0 var(--gold); }
.hint { font-size: 12px; color: var(--muted); margin-top: 10px; }
.toolbar .btn { margin-left: 4px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: var(--on-navy); padding: 10px 16px; border-radius: 10px; font-weight: 500; z-index: 20; box-shadow: 0 8px 24px rgba(0,0,0,.2); }
.toast[hidden] { display: none; }
dialog { border: 1px solid var(--line); border-radius: 14px; padding: 22px 24px; width: min(440px, calc(100% - 32px)); color: var(--ink); }
dialog::backdrop { background: rgba(0, 36, 75, .35); }
dialog h2 { font-family: var(--f-display); font-weight: 500; color: var(--navy); font-size: 24px; margin: 4px 0 14px; }
dialog .fields { grid-template-columns: 1fr 1fr; }
dialog .actions { justify-content: flex-end; }


/* Workshop tablet */
.workshop-wrap { display: flex; align-items: center; justify-content: center; padding: 24px; overflow: auto; background: radial-gradient(circle at 50% 30%, var(--track), var(--line-2)); }
.tablet { width: min(1024px, 100%); aspect-ratio: 4 / 3; max-height: calc(100vh - 120px); background: #1C1F24; border-radius: 34px; padding: 22px; box-shadow: 0 30px 60px rgba(0,0,0,.25), inset 0 0 0 2px #2C3037; }
.tablet-screen { width: 100%; height: 100%; background: var(--paper); border-radius: 16px; overflow: auto; display: flex; flex-direction: column; }
.tab-head { display: flex; align-items: center; gap: 16px; padding: 22px 28px; background: var(--topbar); color: #fff; position: sticky; top: 0; z-index: 1; }
.tab-hello { font-family: var(--f-display); font-size: 30px; line-height: 1.1; }
.tab-date { color: #C9D3E0; font-size: 14px; margin-top: 2px; }
.tab-back { width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; font-size: 28px; line-height: 1; }
.tab-body { padding: 18px 28px 28px; }
.tab-section { font: 600 12px var(--f-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin: 14px 0 10px; }
.tab-card { display: flex; align-items: center; gap: 18px; background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; margin-bottom: 12px; transition: opacity .4s, transform .4s; }
.tab-card.is-running { border-color: var(--gold); box-shadow: inset 5px 0 0 var(--gold); }
.tab-card.is-done { opacity: .35; transform: scale(.98); }
.tab-card-main { flex: 1; min-width: 0; }
.tab-rifle { font: 600 13px var(--f-ui); color: var(--muted); letter-spacing: .02em; }
.tab-step { font-family: var(--f-display); font-size: 26px; color: var(--navy); line-height: 1.15; margin: 2px 0 4px; }
.tab-meta { font-size: 14px; color: var(--ink); }
.tab-btn { min-width: 132px; height: 64px; border-radius: 14px; border: 2px solid var(--navy); background: transparent; color: var(--navy); font-size: 20px; font-weight: 600; }
.tab-btn--done { background: var(--ok); border-color: var(--ok); color: #fff; }
.tab-btn:disabled { opacity: .5; }
.tab-empty { color: var(--muted); font-size: 15px; }
.tab-people { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; padding: 24px 28px; }
.tab-person { display: grid; justify-items: center; gap: 6px; padding: 20px 10px; border-radius: 16px; border: 1px solid var(--line); background: var(--card); font-size: 18px; font-weight: 600; color: var(--navy); }
.tab-person small { font-size: 12px; font-weight: 500; color: var(--muted); }
.tab-avatar { width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff; font-family: var(--f-display); font-size: 30px; }

.tab-actions { display: flex; gap: 10px; flex: none; }
.tab-btn--small { min-width: 104px; font-size: 17px; border-color: var(--line); color: var(--ink); }
.tab-card.is-paused { border-color: var(--warn); box-shadow: inset 5px 0 0 var(--warn); }
.tab-issue { margin-top: 6px; font-size: 13.5px; color: var(--warn); font-weight: 600; }
.tablet-screen { position: relative; }
.tab-sheet-backdrop { position: absolute; inset: 0; background: rgba(0, 36, 75, .35); display: flex; align-items: flex-end; border-radius: 16px; z-index: 3; }
.tab-sheet { width: 100%; background: var(--card); border-radius: 22px 22px 16px 16px; padding: 22px 28px 26px; display: grid; gap: 12px; }
.tab-kinds { display: flex; flex-wrap: wrap; gap: 10px; }
.tab-kind { height: 52px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-3); font-size: 16px; font-weight: 500; color: var(--ink); }
.tab-kind.on { background: var(--navy); color: var(--on-navy); border-color: var(--navy); }
.tab-sheet textarea { font: 16px var(--f-ui); padding: 12px; border: 1px solid var(--line); border-radius: 12px; resize: none; }
.tab-check { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.tab-check input { width: 22px; height: 22px; }
.tab-sheet-actions { display: flex; justify-content: flex-end; gap: 10px; }


/* Overview dashboard */
.dash-wrap { display: block; overflow: auto; padding: 24px; }
.dash { max-width: 1320px; margin: 0 auto; display: grid; gap: 18px; }

.muted-sm { font-size: 12.5px; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 18px; }
.dash-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.dash-h h2 { font-size: 22px !important; margin: 0 0 12px !important; }
.lnk { border: 0; background: none; color: var(--gold); font-weight: 600; padding: 0; }
.dash-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.dash-table th { text-align: left; font: 500 10.5px var(--f-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); padding: 0 8px 8px 0; border-bottom: 1px solid var(--line); }
.dash-table td { padding: 10px 8px 10px 0; border-bottom: 1px dashed var(--line); vertical-align: middle; }
.dash-table tbody tr { cursor: pointer; }
.dash-table tbody tr:hover td { background: var(--tint); }
.dash-table td.num { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--navy); }
.meter { height: 8px; border-radius: 6px; background: var(--track); overflow: hidden; min-width: 90px; }
.meter i { display: block; height: 100%; background: var(--navy); border-radius: 6px; }
.meter--load i.warm { background: var(--gold); }
.meter--load i.hot { background: var(--bad); }
.alerts { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.alert { padding: 10px 12px; border-radius: 10px; font-size: 13.5px; cursor: pointer; border-left: 4px solid var(--line); background: var(--surface-3); }
.alert--issue { border-left-color: var(--bad); }
.alert--pause { border-left-color: var(--warn); }
.alert--stock { border-left-color: var(--gold); }
.alert--ok { border-left-color: var(--ok); cursor: default; }
.dash-sub { font: 600 11px var(--f-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--navy); margin: 18px 0 8px; }
.lowstock, .queues, .loadbars, .today-list { list-style: none; margin: 0; padding: 0; }
.lowstock li, .queues li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.lowstock b.neg { color: var(--bad); }
.queues li small { color: var(--muted); }
.queues li span { flex: 1; }
.loadbars li { display: grid; grid-template-columns: 130px 1fr 52px; align-items: center; gap: 12px; padding: 6px 0; font-size: 13px; }
.loadbars li span { display: grid; font-weight: 600; color: var(--navy); }
.loadbars li small { font-weight: 400; color: var(--muted); font-size: 11.5px; }
.loadbars li b { text-align: right; font-variant-numeric: tabular-nums; }
.today-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; cursor: pointer; }
.today-list .dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.today-list b { min-width: 70px; color: var(--navy); }
@media (max-width: 1000px) { .dash-grid, .dash-grid--even { grid-template-columns: 1fr; } .dash-hero { grid-template-columns: 1fr; } }

/* World */
.world-wrap { display: block; position: relative; padding: 0; }
.world-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }

/* Production order */
.toolbar [hidden] { display: none; }
.queue-notice { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; padding: 10px 24px; background: var(--tint-blue); border-bottom: 1px solid var(--tint-blue-line); }
.queue-notice[hidden] { display: none; }
.queue-notice .kicker { font: 600 10.5px var(--f-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--navy-2); }
.queue-notice p { margin: 2px 0; font-size: 13.5px; }
.notice-actions { display: flex; gap: 8px; flex: none; }
.orders { position: absolute; inset: 0; overflow: auto; padding: 18px 24px 40px; }
.orders-hint { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.orders-cols { display: grid; grid-template-columns: 16px 28px 250px minmax(0, 1fr) 300px 64px; gap: 12px; padding: 0 16px 4px; font: 600 10px var(--f-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.orders-cols span:nth-child(1) { grid-column: 3; } .orders-cols span:nth-child(3) { text-align: right; }
.order-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; }
.order { position: relative; display: grid; grid-template-columns: 16px 28px 250px minmax(0, 1fr) 300px 64px; align-items: center; gap: 12px;
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--navy); border-radius: 9px; padding: 6px 12px; cursor: grab;
  transition: box-shadow .15s, transform .15s; }
.order:hover { box-shadow: 0 2px 10px rgba(0, 36, 75, .08); }
.order.is-dragging { opacity: .45; }
.order.is-dragged { animation: settle .9s ease-out; }
@keyframes settle { from { background: var(--tint-gold); transform: scale(1.01); } to { background: var(--card); transform: none; } }
.order.is-manual { border-left-color: var(--gold); }
.order.drop-before::before, .order.drop-after::after { content: ''; position: absolute; left: 0; right: 0; height: 3px; background: var(--gold); border-radius: 2px; }
.order.drop-before::before { top: -6px; }
.order.drop-after::after { bottom: -6px; }
.grip { color: var(--muted-2); letter-spacing: -2px; font-size: 14px; user-select: none; }
.order-pos { font: 600 18px var(--f-display); color: var(--navy); text-align: center; }
.order-head { display: flex; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; }
.order-head b { font-size: 14px; color: var(--navy); }
.order-rifles { display: flex; gap: 6px; flex-wrap: wrap; }
.order-rifle { display: inline-flex; gap: 6px; align-items: baseline; background: color-mix(in srgb, var(--c) 9%, var(--mix)); border-left: 3px solid var(--c); border-radius: 6px; padding: 4px 9px; font-size: 12.5px; cursor: pointer; }
.order-rifle:hover { background: color-mix(in srgb, var(--c) 16%, var(--mix)); }
.order-rifle { white-space: nowrap; max-width: 100%; }
.order-rifle small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.order-eta { display: flex; justify-content: flex-end; align-items: baseline; gap: 4px; }
.order-eta b { font-size: 14px; color: var(--navy); min-width: 72px; text-align: right; }
.order-eta .delta { font-size: 11.5px; white-space: nowrap; }
.order-move { display: flex; gap: 4px; justify-content: flex-end; opacity: 0; transition: opacity .15s; }
.order:hover .order-move, .order:focus-within .order-move { opacity: 1; }
.ibtn { width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 7px; background: var(--card); color: var(--navy); }
.ibtn:disabled { opacity: .3; cursor: default; }
.chip--manual { background: var(--tint-gold); color: var(--gold-ink); }
.alert--order { border-left-color: var(--navy-2); }

/* Overview: family colours */
.fchip { display: inline-flex; align-items: center; gap: 6px; margin: 2px 6px 2px 0; padding: 3px 9px 3px 7px; border-radius: 99px; font-size: 12px; font-weight: 500;
  color: color-mix(in srgb, var(--c) 85%, var(--deep)); background: color-mix(in srgb, var(--c) 12%, var(--mix)); white-space: nowrap; }
.fchip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: none; }
.fchip.is-next { background: transparent; border: 1px dashed color-mix(in srgb, var(--c) 45%, var(--mix)); }
.fchip.is-paused::before { border-radius: 1px; box-shadow: 3px 0 0 var(--c); width: 3px; margin-right: 3px; }
.dash-table td.now { line-height: 1.2; }
.prog { display: grid; grid-template-columns: 1fr 38px; align-items: center; gap: 10px; min-width: 170px; }
.prog-line { position: relative; height: 4px; border-radius: 2px; background: var(--track); }
.prog-line i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; background: var(--navy); }
.prog-line b { position: absolute; top: 50%; width: 11px; height: 11px; margin: -5.5px 0 0 -5.5px; border-radius: 50%; background: var(--card); border: 2.5px solid var(--gold); }
.prog small { font: 600 12px var(--f-ui); color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.alert { display: block; }
.al-ico { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-right: 8px; border-radius: 6px; font: 700 11px var(--f-ui); color: #fff; vertical-align: -4px; background: var(--muted); }
.alert--issue .al-ico { background: var(--fam-test); }
.alert--pause .al-ico { background: var(--warn); font-size: 8px; }
.alert--stock .al-ico { background: var(--fam-wood); }
.alert--order .al-ico { background: var(--fam-gun); }
.alert--issue { border-left-color: var(--fam-test); background: color-mix(in srgb, var(--fam-test) 5%, var(--mix)); }
.alert--stock { border-left-color: var(--fam-wood); background: color-mix(in srgb, var(--fam-wood) 5%, var(--mix)); }
.alert--order { background: color-mix(in srgb, var(--fam-gun) 4%, var(--mix)); }
.alert .muted-sm { margin-left: 28px; }
.meter--load i { background: var(--fam-metal); }
.meter--load i.warm { background: var(--fam-engrave); }
.meter--load i.hot { background: var(--fam-test); }
.today-list .serial { min-width: 64px; font-variant-numeric: tabular-nums; color: var(--muted); font-size: 12.5px; }



/* Gantt bars: one visual language, read straight off the bar.
   faint = done · brass = now · solid navy = sets the delivery date · outline = has margin · hatched = waiting */
.g-bar { position: absolute; border-radius: 5px; display: flex; align-items: center; overflow: hidden; cursor: pointer;
  font: 600 11.5px/1 var(--f-ui); color: #fff; background: var(--crit); box-shadow: 0 1px 2px rgba(0, 20, 40, .2); transition: filter .15s; }
.g-bar:hover { filter: brightness(1.12); }
.g-bar span { padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-bar.is-margin { background: var(--card); color: var(--navy); border: 1.5px solid color-mix(in srgb, var(--crit) 55%, var(--mix)); box-shadow: none; }
.g-bar--wait { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--crit) 32%, var(--mix)) 0 5px, color-mix(in srgb, var(--crit) 14%, var(--mix)) 5px 10px);
  color: var(--navy); border: 1px solid color-mix(in srgb, var(--crit) 50%, var(--mix)); box-shadow: none; }
.g-bar--wait.is-margin { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--crit) 12%, var(--mix)) 0 5px, var(--card) 5px 10px);
  border: 1.5px dashed color-mix(in srgb, var(--crit) 40%, var(--mix)); }
.g-bar.is-now { background: var(--gold); color: #1F1A10; border: 0; box-shadow: 0 0 0 2px color-mix(in srgb, var(--gold) 35%, transparent); }
.g-bar--wait.is-now { background: repeating-linear-gradient(135deg, var(--gold) 0 5px, color-mix(in srgb, var(--gold) 45%, var(--mix)) 5px 10px); }
.g-bar--paused.is-now { background: repeating-linear-gradient(90deg, var(--gold) 0 6px, color-mix(in srgb, var(--gold) 40%, var(--mix)) 6px 9px); }
.g-bar--done { background: #CFCABE; border: 0; box-shadow: none; transform: scaleY(.3); border-radius: 3px; } /* history: a slim trace */
.g-bar--done span { display: none; }
.g-bar--ghost { background: transparent; border: 1.5px dashed color-mix(in srgb, var(--crit) 40%, var(--mix)); box-shadow: none; z-index: 0; cursor: default; }
.g-bar.is-moved { outline: 2px solid var(--gold); outline-offset: 1px; }
.g-note { position: absolute; top: 50%; transform: translateY(-50%); font: italic 500 11.5px var(--f-ui); color: var(--muted); white-space: nowrap; pointer-events: none; }
.legend { align-items: center; }
.legend i.lg-done { height: 4px; background: #CFCABE; }
.legend i.lg-now { background: var(--gold); }
.legend i.lg-crit { background: var(--crit); }
.legend i.lg-margin { background: var(--card); border: 1.5px solid color-mix(in srgb, var(--crit) 55%, var(--mix)); box-sizing: border-box; }
.legend i.lg-wait { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--crit) 32%, var(--mix)) 0 4px, color-mix(in srgb, var(--crit) 12%, var(--mix)) 4px 8px); }

/* Overview, letterhead style */
.dash { gap: 20px; }
.dash-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 32px; align-items: end; padding: 30px 34px 28px; border-radius: 16px; color: #EDE6D6;
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(176, 141, 87, .16), transparent 55%),
    repeating-linear-gradient(115deg, rgba(255,255,255,.025) 0 1px, transparent 1px 9px),
    var(--navy);
  box-shadow: 0 10px 30px rgba(0, 36, 75, .18); position: relative; overflow: hidden; }
.dash-hero::after { content: ''; position: absolute; left: 34px; right: 34px; bottom: 0; height: 2px; background: linear-gradient(90deg, var(--gold), transparent); }
.hero-date { font: 500 11px var(--f-ui); letter-spacing: .16em; text-transform: uppercase; color: #C9B48A; }
.dash-hero h1 { font: 500 44px/1.05 var(--f-display); margin: 8px 0 10px; color: #fff; letter-spacing: .005em; }
.dash-hero p { margin: 0; font-size: 15px; color: #C9D3E0; max-width: 560px; }
.hero-stats { display: grid; grid-template-columns: repeat(4, auto); }
.stat { padding: 2px 24px; border-left: 1px solid rgba(255,255,255,.14); min-width: 120px; }
.stat-l { font: 600 10px var(--f-ui); letter-spacing: .14em; text-transform: uppercase; color: #9FB0C6; }
.stat-v { font: 500 36px/1.1 var(--f-display); color: #fff; margin: 6px 0 2px; font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; }
.stat-v small { font-size: 20px; margin-left: 2px; }
.stat-s { font-size: 12px; color: #9FB0C6; }
.stat.warn .stat-v { color: #E8C27E; }
.card { box-shadow: 0 1px 2px rgba(0, 36, 75, .04); }
.dash-h h2 { font-weight: 500 !important; }
.dash-lead { margin: -4px 0 14px; font-size: 13px; color: var(--muted); }
.dash-grid--even { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.months { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 0; border-top: 1px solid var(--line); }
.month { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 10px 4px 12px; border-right: 1px solid var(--line); min-height: 132px; }
.month:last-child { border-right: 0; }
.month-h { display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.month-h b { font: 500 16px var(--f-display); color: var(--navy); }
.month-h small { font-size: 10px; color: var(--muted); letter-spacing: .08em; }
.month-n { font: 600 11px var(--f-ui); color: var(--gold); height: 14px; }
.month.is-empty .month-h b { color: var(--muted-2); }
.month.is-later { background: var(--surface-3); border-radius: 0 0 10px 0; }
.month-r { border: 0; border-radius: 6px; padding: 4px 0; width: 100%; max-width: 64px; background: var(--navy); color: #fff; font: 600 11.5px var(--f-mono); cursor: pointer; transition: transform .12s, background .12s; }
.month-r:hover { transform: translateY(-1px); background: var(--gold); color: #1F1A10; }
.meter--load { position: relative; overflow: visible; }
.meter--load em { position: absolute; left: 90%; top: -3px; bottom: -3px; border-left: 1.5px dashed var(--muted-2); }
.queues li b { font-weight: 600; }
@media (max-width: 1150px) { .dash-hero { grid-template-columns: 1fr; } .hero-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } .stat:first-child { border-left: 0; padding-left: 0; } }

/* Records */
.records-wrap { display: block; overflow: auto; padding: 24px; }
.records { max-width: 1320px; margin: 0 auto; }
.rec-top { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.rec-top .seg button small { margin-left: 7px; font-size: 11px; opacity: .65; font-variant-numeric: tabular-nums; }
.seg--light button.on { background: var(--tint-gold); color: var(--gold-ink); }
.rec-search { margin-left: auto; font: 14px var(--f-ui); padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); min-width: 240px; color: var(--ink); }
.rec-lead { margin: 12px 0 12px; color: var(--muted); font-size: 13px; }
.rec-card { padding: 4px 0 0; overflow: hidden; }
.rec-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.rec-table th { position: sticky; top: 0; text-align: left; font: 600 10.5px var(--f-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
  padding: 12px 14px 10px; border-bottom: 1px solid var(--line); background: var(--card); }
.rec-table td { padding: 11px 14px; border-bottom: 1px solid var(--track); vertical-align: top; }
.rec-table tbody tr:hover td { background: var(--tint); }
.rec-table .num { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--navy); }
.rec-table .num.neg { color: var(--bad); }
.rec-table .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; }
.rlink { border: 0; background: none; padding: 0; font: 600 13px var(--f-mono); color: var(--navy); cursor: pointer; border-bottom: 1px dotted var(--muted-2); }
.rlink:hover { color: var(--gold-ink); border-bottom-color: var(--gold); }
.need { display: inline-flex; gap: 5px; align-items: baseline; margin: 0 8px 4px 0; padding: 2px 8px; border-radius: 6px; background: var(--tint-green); font-size: 12px; white-space: nowrap; }
.need.is-short { background: var(--tint-red); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--tint-gold); color: var(--gold-ink); font-size: 12px; font-weight: 600; }
.st { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.st--late { background: var(--bad); color: #fff; }
.st--soon { background: var(--tint-gold); color: var(--gold-ink); }
.st--later { background: var(--tint-blue); color: var(--navy-2); }
.st--low { background: var(--track); color: var(--ink); }
.st--ok { background: var(--tint-green); color: var(--ok); }
.rec-table .meter { margin: 6px 0 4px; max-width: 160px; }
.dash-h--sub { align-items: center; margin-top: 18px; }
.dash-h--sub .dash-sub { margin: 0; }
.lowstock li small { font-size: 12px; }

/* Viewing as: role switcher in the top bar */
.nav button[hidden] { display: none; }
.viewer { position: relative; }
.viewer-btn { display: flex; align-items: center; gap: 10px; padding: 5px 10px 5px 5px; border-radius: 99px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); color: #fff; }
.viewer-btn:hover { background: rgba(255,255,255,.12); }
.viewer-av { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--gold); color: #1F1A10; font: 600 15px var(--f-display); flex: none; }
.viewer-who { display: grid; text-align: left; line-height: 1.15; }
.viewer-who b { font-size: 13px; font-weight: 600; }
.viewer-who small { font-size: 10.5px; color: #C9D3E0; letter-spacing: .04em; }
.viewer-caret { font-size: 10px; color: #C9D3E0; }
.viewer-menu { position: absolute; right: 0; top: calc(100% + 8px); z-index: 50; width: 300px; padding: 8px; border-radius: 14px; background: var(--card);
  border: 1px solid var(--line); box-shadow: 0 18px 40px rgba(0, 20, 40, .22); }
.viewer-menu[hidden] { display: none; }
.viewer-kicker { font: 600 10px var(--f-ui); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); padding: 6px 10px 8px; }
.viewer-menu button { display: flex; gap: 12px; align-items: center; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 10px; color: var(--ink); font-size: 13.5px; }
.viewer-menu button:hover { background: var(--tint); }
.viewer-menu button.on { background: var(--tint-gold); }
.viewer-menu button b { color: var(--navy); }
.viewer-menu button small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.topbar { min-width: 0; }
@media (max-width: 1280px) { .topbar .today { display: none; } .topbar { gap: 16px; } .nav button { padding: 8px 11px; } }
@media (max-width: 1000px) { .viewer-who { display: none; } }
.workspace { overflow: hidden; } /* the closed detail drawer keeps its padding */

/* Progress of a closed rifle, in the label column */
.g-row.is-group .g-label { padding-right: 70px; }
.g-badge { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); width: 46px; text-align: right; }
.g-badge b { font: 600 12.5px var(--f-ui); color: var(--navy); font-variant-numeric: tabular-nums; }
.g-badge i { display: block; height: 3px; margin-top: 4px; border-radius: 2px; background: var(--track); overflow: hidden; }
.g-badge em { display: block; height: 100%; background: var(--gold); }
.g-bar span.is-short { padding: 0; width: 100%; text-align: center; font: 600 10.5px var(--f-mono); overflow: hidden; text-overflow: clip; }

/* Sales: quote list and editor */
.sales2 { display: grid; grid-template-columns: 270px minmax(0, 1fr) 360px; gap: 20px; max-width: 1500px; margin: 0 auto; align-items: start; }
.qlist { position: sticky; top: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px; }
.qlist-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.qlist-head h2 { font: 500 28px var(--f-display); color: var(--navy); margin: 2px 0 10px; }
.qlist .kicker, .qedit .kicker, .qnew .kicker { font: 600 10.5px var(--f-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.qdue { margin: 0 0 10px; padding: 8px 10px; border-radius: 9px; background: var(--tint-gold); color: var(--gold-ink); font-size: 13px; font-weight: 600; }
.qfilter { margin-bottom: 10px; }
.qsearch { width: 100%; margin: 0 0 10px; min-width: 0; }
.qitems { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.qitem { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--track); cursor: pointer; transition: background .12s, border-color .12s; }
.qitem:hover { background: var(--tint); }
.qitem.on { border-color: var(--navy); box-shadow: inset 3px 0 0 var(--navy); background: var(--tint); }
.qitem-top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.qitem-top b { color: var(--navy); }
.qitem-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.qempty { padding: 10px; }
.qst { padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--track); color: var(--ink); }
.qst--sent { background: var(--tint-blue); color: var(--navy-2); }
.qst--accepted { background: var(--tint-green); color: var(--ok); }
.qst--declined, .qst--expired { background: var(--tint-red); color: var(--bad); }
.qst--big { font-size: 13px; padding: 5px 14px; }
.qf { display: inline-block; margin-top: 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); }
.qf--today { color: var(--gold-ink); background: var(--tint-gold); padding: 2px 8px; border-radius: 6px; }
.qf--late { color: #fff; background: var(--bad); padding: 2px 8px; border-radius: 6px; }
.qedit { display: grid; gap: 14px; }
.qedit--empty { padding: 60px 20px; text-align: center; }
.qedit--empty h2 { font: 500 30px var(--f-display); color: var(--navy); margin: 6px 0; }
.qhead { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
.qhead h2 { font: 500 34px/1.1 var(--f-display); color: var(--navy); margin: 4px 0 0; }
.qnotice { padding: 10px 14px; border-radius: 10px; background: var(--tint-green); color: var(--ok); font-weight: 600; font-size: 13.5px; }
.qcard { padding: 18px 20px; }
.qcard-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.qcard-h h3 { margin: 0; font: 500 20px var(--f-display); color: var(--navy); text-transform: none; letter-spacing: 0; }
.qcard-h h3 .muted-sm { font-family: var(--f-ui); }
.qclient { display: flex; gap: 18px; flex-wrap: wrap; align-items: baseline; font-size: 13.5px; color: var(--muted); }
.qclient b { color: var(--ink); font-size: 15px; }
.qpick .rec-search { width: 100%; min-width: 0; }
.qpick-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.qpick-list button { width: 100%; text-align: left; display: flex; gap: 10px; align-items: baseline; border: 1px solid var(--track); background: var(--card); padding: 8px 10px; border-radius: 9px; }
.qpick-list button:hover { border-color: var(--navy); background: var(--tint); }
.qpick-list span { font-size: 12.5px; color: var(--muted); }
.qnew { margin-top: 12px; padding: 14px; border-radius: 12px; background: var(--tint); border: 1px dashed var(--line-2); }
.qnew .fields { margin: 8px 0 12px; }
.orow { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 10px; align-items: start; padding: 5px 0; }
.olab { font-size: 12px; color: var(--muted); padding-top: 6px; }
.ochips { display: flex; flex-wrap: wrap; gap: 5px; }
.ochip { border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 99px; padding: 4px 11px; font-size: 12.5px; line-height: 1.3; transition: background .12s, border-color .12s; }
.ochip small { margin-left: 6px; font-size: 11px; color: var(--muted); }
.ochip:hover:not(:disabled) { border-color: var(--navy); }
.ochip.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.ochip.on small { color: #C9D3E0; }
.ochip[data-cat] { border-color: hsl(var(--h) 35% 82%); background: hsl(var(--h) 45% 97%); color: hsl(var(--h) 35% 28%); }
.ochip[data-cat].on { background: hsl(var(--h) 52% 84%); border-color: hsl(var(--h) 40% 58%); color: hsl(var(--h) 45% 18%); font-weight: 600; }
.ochip[data-cat].on small { color: hsl(var(--h) 30% 32%); }
.ochip:disabled { cursor: default; }
.oopts { margin-top: 6px; padding-top: 8px; border-top: 1px dashed var(--track); }
.qspec { margin: 12px 0 0; padding: 12px 14px; border-radius: 10px; background: var(--tint-gold); border-left: 4px solid var(--warn); font-size: 13px; }
.qspec b { color: var(--gold-ink); }
.qspec p { margin: 4px 0 0; }
.qspec-note { font-size: 13px; color: var(--gold-ink); margin: 6px 0 10px; }
.qline-foot { display: flex; gap: 22px; align-items: flex-end; flex-wrap: wrap; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--track); }
.qprice { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.qprice-in { display: flex; align-items: center; gap: 6px; font-weight: 600; color: var(--navy); }
.qprice-in input { width: 130px; font: 600 15px var(--f-ui); padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-3); color: var(--navy); }
.qline-sums { display: grid; font-size: 12.5px; color: var(--muted); }
.qline-sums b { font: 500 22px var(--f-display); color: var(--navy); }
.qline-eta { margin-left: auto; text-align: right; }
.qline-eta b { display: block; font: 500 20px var(--f-display); color: var(--navy); }
.qadd { border: 1.5px dashed var(--line-2); background: transparent; border-radius: 12px; padding: 14px; color: var(--navy); font-weight: 600; }
.qadd:hover { border-color: var(--navy); background: var(--tint); }
.qsum-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 22px; }
.qtotal { display: flex; justify-content: space-between; align-items: baseline; padding-bottom: 8px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.qtotal span { color: var(--muted); }
.qtotal b { font: 500 32px var(--f-display); color: var(--navy); }
.qsum textarea { font: 14px var(--f-ui); padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-3); resize: vertical; }
.qfollow { margin-top: 10px; }
.qest .estimate { margin-top: 0; }
.qactions { justify-content: flex-end; border-top: 1px solid var(--track); padding-top: 14px; margin-top: 16px; }
@media (max-width: 1250px) { .sales2 { grid-template-columns: 250px minmax(0, 1fr); } .qrecap { grid-column: 2; position: static; } }
@media (max-width: 900px) { .sales2 { grid-template-columns: 1fr; } .qlist { position: static; } .qrecap { grid-column: auto; } }

/* Printed quote */
#printDoc { display: none; }
@media print {
  @page { margin: 16mm; }
  body > *:not(#printDoc) { display: none !important; }
  #printDoc { display: block; color: #222; font: 11pt/1.45 var(--f-ui); }
  .pd-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #00244B; padding-bottom: 10pt; margin-bottom: 16pt; }
  .pd-brand { font: 500 28pt var(--f-display); color: #00244B; }
  .pd-brand small { display: block; font: 600 8pt var(--f-ui); letter-spacing: .2em; text-transform: uppercase; color: #8A6A2E; }
  .pd-meta { display: grid; text-align: right; font-size: 10pt; color: #555; }
  .pd-meta b { color: #00244B; font-size: 12pt; }
  .pd-to { display: grid; margin-bottom: 18pt; font-size: 10pt; color: #555; }
  .pd-to b { color: #222; font-size: 12pt; }
  .pd-to .kicker { font: 600 8pt var(--f-ui); letter-spacing: .14em; text-transform: uppercase; color: #8A6A2E; }
  .pd-line { break-inside: avoid; margin-bottom: 16pt; }
  .pd-line h3 { font: 500 15pt var(--f-display); color: #00244B; margin: 0; }
  .pd-line p { margin: 2pt 0 6pt; }
  .pd-line table { width: 100%; border-collapse: collapse; font-size: 10pt; }
  .pd-line td { padding: 4pt 0; border-bottom: 1px solid #e5e1d8; }
  .pd-n { text-align: right; white-space: nowrap; }
  .pd-sub td { color: #555; }
  .pd-tot td { font-weight: 700; border-bottom: 1.5px solid #00244B; }
  .pd-spec { font-size: 9.5pt; color: #8A6A2E; }
  .pd-eta { font-size: 10pt; }
  .pd-grand { display: flex; justify-content: space-between; align-items: baseline; border-top: 2px solid #00244B; padding-top: 8pt; margin-top: 6pt; }
  .pd-grand b { font: 500 20pt var(--f-display); color: #00244B; }
  .pd-foot { font-size: 9pt; color: #666; margin-top: 14pt; }
  .pd-proto { font-size: 8pt; color: #999; margin-top: 18pt; }
}

.order-pct { font: 600 11.5px var(--f-ui); font-style: normal; color: var(--navy); margin-left: 4px; }
.order-done { display: inline-flex; align-items: center; gap: 6px; margin-right: 12px; font: 600 12px var(--f-ui); color: var(--muted); }
.order-done i { display: block; width: 44px; height: 3px; border-radius: 2px; background: var(--track); overflow: hidden; }
.order-done em { display: block; height: 100%; background: var(--gold); }
.order-rifles { min-width: 0; } .order-rifle { overflow: hidden; }

/* Running past its usual time */
.g-bar.is-over { box-shadow: inset -5px 0 0 var(--bad), 0 0 0 2px color-mix(in srgb, var(--gold) 35%, transparent); }
.g-note.is-over { color: var(--bad); font-style: normal; font-weight: 600; }

/* Workshop tablet, looking like the one at the bench */
.workshop-wrap { background: radial-gradient(120% 90% at 50% 20%, #E9E3D6, #CFC7B6 60%, #BEB49F); }
.tablet-stage { display: grid; justify-items: center; gap: 14px; width: 100%; }
.tablet { position: relative; background: linear-gradient(145deg, #2A2E35, #15181C); padding: 26px; border-radius: 40px;
  box-shadow: 0 40px 70px rgba(30, 24, 12, .35), 0 6px 14px rgba(0,0,0,.25), inset 0 0 0 2px #3A3F47, inset 0 0 0 6px #1A1D21; }
.tablet-cam { position: absolute; top: 10px; left: 50%; width: 8px; height: 8px; margin-left: -4px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #4B5563, #0B0D10); }
.tab-status { display: flex; justify-content: space-between; align-items: center; padding: 6px 18px; background: #000814; color: #9FB0C6; font: 500 11px var(--f-ui); letter-spacing: .04em; position: sticky; top: 0; z-index: 2; }
.tab-status b { color: #fff; font-weight: 600; }
.tab-head { top: 25px; }
.tablet-caption { margin: 0; font: italic 500 13px var(--f-ui); color: #5E5646; }
.tab-over { margin-top: 6px; font-size: 14px; color: var(--bad); font-weight: 600; }
.tab-btn--note { min-width: 88px; }
.tab-notes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.tab-note { display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 10px; background: var(--tint); font-size: 13.5px; color: var(--ink); }
.tab-note img { width: 36px; height: 36px; object-fit: cover; border-radius: 7px; }
.tab-photo { display: flex; align-items: center; gap: 14px; }
.tab-photo img { height: 84px; border-radius: 10px; }
.tab-photo-btn { display: inline-grid; place-items: center; cursor: pointer; }
.d-notes { list-style: none; padding: 0; margin: 6px 0 14px; display: grid; gap: 8px; }
.d-notes li { display: flex; gap: 10px; align-items: flex-start; font-size: 13px; }
.d-notes img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; }
.d-notes p { margin: 2px 0 0; }

/* Sales: configuration as dropdowns */
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px 14px; }
.qgrid--opts { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--track); }
.qsel { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.qsel span { display: flex; align-items: center; gap: 6px; }
.qsel span i { width: 7px; height: 7px; border-radius: 50%; background: hsl(var(--h, 215) 40% 70%); }
.qsel select { font: 14px var(--f-ui); color: var(--ink); padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-3); width: 100%; }
.qsel.has-value select { background: hsl(var(--h) 50% 95%); border-color: hsl(var(--h) 38% 72%); color: hsl(var(--h) 45% 20%); font-weight: 600; }
.qgrid > .qsel:not([style]) select { font-weight: 600; color: var(--navy); }
.qcheck { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink); padding-top: 18px; }
.qspec p em { font-style: normal; font-weight: 700; color: var(--warn); margin-left: 6px; }
/* Order summary, always in view */
.qrecap { position: sticky; top: 0; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; display: grid; gap: 12px;
  box-shadow: 0 6px 18px rgba(0, 36, 75, .06); }
.qrecap .kicker { font: 600 10.5px var(--f-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--gold-ink); }
.qrecap h2 { font: 500 26px/1.1 var(--f-display); color: var(--navy); margin: 0; }
.qr-line { border-top: 1px solid var(--line); padding-top: 10px; }
.qr-title { display: grid; margin-bottom: 6px; }
.qr-title b { color: var(--navy); }
.qr-title span { font-size: 12.5px; color: var(--muted); }
.qrecap .opt-list { border-top: 0; margin: 0; }
.qrecap .opt-list li { display: grid; grid-template-columns: 1fr auto 64px; gap: 8px; padding: 4px 0; font-size: 12.5px; }
.qrecap .opt-list em { font-style: normal; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.qr-spec { margin-top: 6px; padding: 6px 9px; border-radius: 8px; background: var(--tint-gold); color: var(--gold-ink); font-size: 12px; font-weight: 600; }
.qr-sum { display: flex; justify-content: space-between; align-items: baseline; margin-top: 8px; font-size: 12.5px; color: var(--muted); }
.qr-sum i { color: var(--warn); }
.qr-sum b { font: 500 20px var(--f-display); color: var(--navy); }
.qr-eta { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.qr-eta b { color: var(--navy); }
.qrecap .qtotal { border-top: 2px solid var(--navy); border-bottom: 0; padding-top: 10px; margin: 0; }
.qrecap .estimate { margin: 0; }
.qrecap .estimate .eta { font-size: 26px; }
.qrecap textarea { font: 14px var(--f-ui); padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-3); resize: vertical; }
.qr-actions { display: grid; gap: 8px; }
.qr-actions .btn { width: 100%; }
.qr-row { display: flex; gap: 6px; }
.qr-row .btn { flex: 1; padding: 9px 8px; font-size: 13px; }

/* 3D rifle in the quote */
.qviz { margin: 4px -20px 14px; }
.r3d { position: relative; height: 360px; background: radial-gradient(120% 110% at 50% 35%, #FBF8F1 0%, #EDE6D6 70%, #E2D9C6 100%); border-top: 1px solid var(--track); border-bottom: 1px solid var(--track); overflow: hidden; }
.r3d canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.r3d canvas:active { cursor: grabbing; }
.r3d-labels { position: absolute; inset: 0; pointer-events: none; transition: opacity .2s; }
.r3d-labels span { position: absolute; left: 0; top: 0; white-space: nowrap; padding: 3px 8px; border-radius: 6px; background: rgba(0, 36, 75, .88); color: #fff; font: 600 11px var(--f-ui); box-shadow: 0 2px 6px rgba(0,0,0,.15); }
.r3d-bar { position: absolute; left: 14px; right: 14px; bottom: 10px; display: flex; align-items: center; gap: 12px; }
.r3d-btn { border: 1px solid var(--navy); background: rgba(255,255,255,.85); color: var(--navy); border-radius: 99px; padding: 6px 14px; font-weight: 600; font-size: 12.5px; }
.r3d-btn.on { background: var(--navy); color: #fff; }
.r3d-note { margin-left: auto; font: italic 11.5px var(--f-ui); color: var(--muted); }
.qcard-h > span { display: flex; gap: 14px; }
