@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;500;600;700&family=Red+Hat+Display:wght@500;700;800&display=swap');

/* ==========================================================================
   Palmers Workspace — design system
   Brand red is the accent, used sparingly: primary actions, the active state
   and the logo. Everything else is warm neutrals so the red means something.
   ========================================================================== */
:root{
  --red:#D62731; --red-600:#B91F29; --red-700:#9C1820; --red-50:#FDF1F1; --red-100:#F9DADB;
  --ink:#1D1818; --ink-2:#433C3C; --muted:#756D6C; --faint:#A39B9A;
  --bg:#F6F5F3; --surface:#FFFFFF; --sunken:#FAF9F7;
  --line:#E8E4E1; --line-strong:#D7D1CD;
  --green:#17804A; --green-50:#EBF7F0; --amber:#A8650A; --amber-50:#FDF4E5; --blue:#2459C4; --blue-50:#EEF3FD;
  --radius:12px; --radius-sm:8px;
  --shadow-sm:0 1px 2px rgba(29,24,24,.05);
  --shadow:0 1px 2px rgba(29,24,24,.04), 0 4px 16px rgba(29,24,24,.06);
  --shadow-lg:0 12px 40px rgba(29,24,24,.12);
  --font-head:'Red Hat Display',Arial,sans-serif; --font-body:'Open Sans',Arial,sans-serif;
  --focus:0 0 0 3px rgba(214,39,49,.22);
}
*{ box-sizing:border-box; }
html{ -webkit-text-size-adjust:100%; }
body{ margin:0; font:15px/1.55 var(--font-body); color:var(--ink); background:var(--bg); -webkit-font-smoothing:antialiased; }
a{ color:var(--red-600); text-decoration:none; } a:hover{ color:var(--red-700); text-decoration:underline; }
h1,h2,h3,h4{ font-family:var(--font-head); letter-spacing:-.01em; color:var(--ink); }
h1{ font-size:30px; line-height:1.2; font-weight:800; margin:0 0 6px; }
h2{ font-size:19px; font-weight:700; margin:0 0 4px; }
h3{ font-size:16px; font-weight:700; margin:0 0 6px; }
.lead{ color:var(--muted); margin:0 0 24px; max-width:68ch; }
.muted{ color:var(--muted); font-size:13.5px; } .error{ color:var(--red-600); }
.skip{ position:absolute; left:-999px; } .skip:focus{ left:16px; top:12px; z-index:100; background:#fff; padding:8px 12px; border-radius:8px; box-shadow:var(--shadow); }
:focus-visible{ outline:none; box-shadow:var(--focus); border-radius:6px; }
svg.i{ width:18px; height:18px; flex:none; stroke:currentColor; fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; vertical-align:-4px; }

/* --- Shell ------------------------------------------------------------ */
.topbar{ position:sticky; top:0; z-index:30; background:rgba(255,255,255,.92); backdrop-filter:saturate(1.4) blur(10px);
  border-bottom:1px solid var(--line); }
.topbar-in{ max-width:1180px; margin:0 auto; padding:0 28px; height:64px; display:flex; align-items:center; gap:28px; }
.brand{ display:flex; align-items:center; gap:12px; text-decoration:none!important; }
.brand img{ height:24px; width:auto; display:block; }
.brand-sub{ font-family:var(--font-head); font-weight:700; color:var(--ink-2); font-size:15px; padding-left:12px; border-left:1px solid var(--line-strong); }
.mainnav{ display:flex; gap:4px; flex:1; }
.mainnav a{ color:var(--ink-2); font-weight:600; font-size:14px; padding:8px 12px; border-radius:8px; text-decoration:none; }
.mainnav a:hover{ background:var(--bg); color:var(--ink); }
.mainnav a.on{ color:var(--ink); background:var(--bg); box-shadow:inset 0 -2px 0 var(--red); border-radius:8px 8px 0 0; }
.usermenu{ position:relative; }
.usermenu summary{ list-style:none; display:flex; align-items:center; gap:10px; cursor:pointer; padding:4px 6px 4px 4px; border-radius:999px; }
.usermenu summary::-webkit-details-marker{ display:none; }
.usermenu summary:hover{ background:var(--bg); }
.avatar{ width:34px; height:34px; border-radius:50%; background:var(--ink); color:#fff; display:grid; place-items:center; font:700 13px var(--font-head); letter-spacing:.02em; }
.who{ display:flex; flex-direction:column; line-height:1.2; font-size:13px; } .who b{ font-weight:600; } .who span{ color:var(--muted); font-size:12px; }
.menu{ position:absolute; right:0; top:calc(100% + 8px); min-width:200px; background:#fff; border:1px solid var(--line); border-radius:12px; box-shadow:var(--shadow-lg); padding:6px; }
.menu a,.menu button{ display:block; width:100%; text-align:left; padding:9px 12px; border-radius:8px; font:inherit; font-size:14px; color:var(--ink); background:none; border:0; cursor:pointer; text-decoration:none; }
.menu a:hover,.menu button:hover{ background:var(--bg); text-decoration:none; }
.menu hr{ border:0; border-top:1px solid var(--line); margin:6px 0; }
.inline{ display:inline; margin:0; }
.wrap{ max-width:1180px; margin:0 auto; padding:36px 28px 64px; }
.wrap-narrow{ max-width:860px; }
.foot{ max-width:1180px; margin:0 auto; padding:24px 28px 40px; color:var(--faint); font-size:12.5px; border-top:1px solid var(--line); display:flex; justify-content:space-between; gap:16px; flex-wrap:wrap; }

/* --- Messages --------------------------------------------------------- */
.messages{ margin:0 0 22px; display:grid; gap:8px; }
.msg{ margin:0; padding:12px 16px 12px 44px; border-radius:10px; font-size:14px; border:1px solid transparent; position:relative; }
.msg::before{ content:''; position:absolute; left:16px; top:50%; width:16px; height:16px; margin-top:-8px; border-radius:50%; background:currentColor; opacity:.9;
  -webkit-mask:var(--ico) center/contain no-repeat; mask:var(--ico) center/contain no-repeat; }
.msg-success{ background:var(--green-50); color:var(--green); border-color:#CBEBD8; --ico:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 0a8 8 0 100 16A8 8 0 008 0zm3.6 6.2l-4.2 4.2a.8.8 0 01-1.1 0L4.4 8.5a.8.8 0 111.1-1.1l1.3 1.3 3.7-3.6a.8.8 0 011.1 1.1z'/%3E%3C/svg%3E"); }
.msg-info{ background:var(--blue-50); color:var(--blue); border-color:#D7E3FA; --ico:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 0a8 8 0 100 16A8 8 0 008 0zm.9 12H7.1V7h1.8v5zM8 5.6a1.1 1.1 0 110-2.2 1.1 1.1 0 010 2.2z'/%3E%3C/svg%3E"); }
.msg-warning{ background:var(--amber-50); color:var(--amber); border-color:#F5DFB7; --ico:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 0a8 8 0 100 16A8 8 0 008 0zm.9 12H7.1v-1.8h1.8V12zm0-3.4H7.1V4h1.8v4.6z'/%3E%3C/svg%3E"); }
.msg-error{ background:var(--red-50); color:var(--red-600); border-color:var(--red-100); --ico:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 0a8 8 0 100 16A8 8 0 008 0zm.9 12H7.1v-1.8h1.8V12zm0-3.4H7.1V4h1.8v4.6z'/%3E%3C/svg%3E"); }

/* --- Buttons ---------------------------------------------------------- */
.btn{ display:inline-flex; align-items:center; justify-content:center; gap:8px; background:var(--red); color:#fff; text-decoration:none!important;
  padding:10px 18px; border-radius:10px; border:1px solid var(--red); cursor:pointer; font:600 14px/1.2 var(--font-body);
  box-shadow:0 1px 2px rgba(156,24,32,.25), inset 0 1px 0 rgba(255,255,255,.12); transition:background .15s, box-shadow .15s, transform .05s; white-space:nowrap; }
.btn:hover{ background:var(--red-600); border-color:var(--red-600); color:#fff; }
.btn:active{ transform:translateY(1px); }
.btn-ghost,.btn-secondary{ background:#fff; color:var(--ink); border-color:var(--line-strong); box-shadow:var(--shadow-sm); }
.btn-ghost:hover,.btn-secondary:hover{ background:var(--sunken); color:var(--ink); border-color:var(--faint); }
.btn-dark{ background:var(--ink); border-color:var(--ink); box-shadow:none; } .btn-dark:hover{ background:#000; border-color:#000; }
.btn-success{ background:var(--green); border-color:var(--green); box-shadow:none; } .btn-success:hover{ background:#116B3D; border-color:#116B3D; }
.btn-lg{ padding:13px 22px; font-size:15px; border-radius:12px; }
.btn-sm{ padding:7px 12px; font-size:13px; border-radius:8px; }
.btn-link{ background:none; border:0; color:var(--muted); font:600 14px var(--font-body); cursor:pointer; padding:8px 4px; }
.btn-link:hover{ color:var(--ink); }
.btn-row{ display:flex; gap:10px; flex-wrap:wrap; align-items:center; }

/* --- Page header ------------------------------------------------------ */
.crumbs{ font-size:13px; color:var(--muted); margin:0 0 10px; display:flex; gap:6px; align-items:center; }
.crumbs a{ color:var(--muted); } .crumbs a:hover{ color:var(--ink); }
.pagehead{ display:flex; justify-content:space-between; align-items:flex-end; gap:24px; margin-bottom:26px; flex-wrap:wrap; }
.pagehead .lead{ margin-bottom:0; }
.rowhead{ display:flex; justify-content:space-between; align-items:center; gap:16px; flex-wrap:wrap; }
.eyebrow{ font:700 12px var(--font-head); letter-spacing:.08em; text-transform:uppercase; color:var(--red); margin:0 0 6px; }

/* --- Surfaces --------------------------------------------------------- */
.card,.panel{ background:var(--surface); border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); }
.panel{ padding:24px 26px; margin:0 0 20px; scroll-margin-top:84px; }
.panel-head{ display:flex; justify-content:space-between; align-items:flex-start; gap:16px; margin-bottom:14px; flex-wrap:wrap; }
.panel-head p{ margin:2px 0 0; }
.panel-quiet{ background:var(--sunken); box-shadow:none; }

/* --- Badges & pills --------------------------------------------------- */
.pill{ display:inline-flex; align-items:center; gap:6px; font:700 12px var(--font-body); padding:3px 10px; border-radius:999px; white-space:nowrap; }
.pill::before{ content:''; width:6px; height:6px; border-radius:50%; background:currentColor; }
.pill-draft{ background:#F0EEEC; color:var(--ink-2); } .pill-in_review{ background:var(--amber-50); color:var(--amber); }
.pill-approved{ background:var(--green-50); color:var(--green); } .pill-sent_back{ background:var(--red-50); color:var(--red-600); }
.pill-review{ background:var(--blue-50); color:var(--blue); } .pill-ready{ background:var(--green-50); color:var(--green); }
.tag{ display:inline-flex; align-items:center; gap:4px; font:600 11px var(--font-body); padding:2px 8px; border-radius:999px; vertical-align:middle; margin-left:6px; white-space:nowrap; }
.tag-ai{ background:var(--blue-50); color:var(--blue); }
.tag-det{ background:#F0EEEC; color:var(--ink-2); }
.tag-bp{ background:#F0EEEC; color:var(--ink-2); } .tag-meta{ background:var(--green-50); color:var(--green); }

/* --- Dashboard -------------------------------------------------------- */
.hero{ display:flex; justify-content:space-between; align-items:center; gap:24px; flex-wrap:wrap; margin-bottom:28px; }
.hero h1{ font-size:32px; }
.stats{ display:grid; grid-template-columns:repeat(3,1fr); gap:16px; margin:0 0 28px; }
.stat{ display:flex; flex-direction:column; gap:2px; padding:20px 22px; text-decoration:none!important; color:inherit; transition:border-color .15s, transform .15s, box-shadow .15s; }
.stat:hover{ border-color:var(--line-strong); transform:translateY(-1px); box-shadow:var(--shadow-lg); color:inherit; }
.stat .num{ font:800 34px/1.1 var(--font-head); color:var(--ink); }
.stat .lbl{ display:flex; align-items:center; gap:8px; color:var(--muted); font-size:13.5px; font-weight:600; }
.stat .lbl::before{ content:''; width:8px; height:8px; border-radius:50%; background:var(--dot,var(--faint)); }
.stat-draft{ --dot:var(--faint); } .stat-review{ --dot:var(--amber); } .stat-approved{ --dot:var(--green); }
.dash-grid{ display:grid; grid-template-columns:minmax(0,1.6fr) minmax(0,1fr); gap:20px; align-items:start; }
.list{ list-style:none; margin:0; padding:0; }
.list li + li{ border-top:1px solid var(--line); }
.list a.row{ display:flex; align-items:center; gap:14px; padding:14px 4px; color:inherit; text-decoration:none; border-radius:8px; }
.list a.row:hover{ background:var(--sunken); }
.row-main{ flex:1; min-width:0; } .row-title,.row-sub{ display:block; } .row-title{ font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.row-sub{ color:var(--muted); font-size:13px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.row-end{ text-align:right; font-size:13px; color:var(--muted); white-space:nowrap; }
.chev{ color:var(--faint); }
.empty{ text-align:center; padding:36px 20px; color:var(--muted); }
.empty h3{ margin-bottom:4px; }
.tool-card{ padding:24px; }
.tool-card .ico{ width:44px; height:44px; border-radius:12px; display:grid; place-items:center; background:var(--red-50); color:var(--red); margin-bottom:14px; }
.tool-card .ico svg{ width:22px; height:22px; }
.tool-card.soon{ background:var(--sunken); box-shadow:none; border-style:dashed; }
.tool-card.soon .ico{ background:#EFECE9; color:var(--muted); }

/* --- Quote list ------------------------------------------------------- */
.toolbar{ display:flex; justify-content:space-between; align-items:center; gap:14px; margin:0 0 16px; flex-wrap:wrap; }
.filters{ display:flex; gap:4px; padding:4px; background:#EDEAE7; border-radius:12px; flex-wrap:wrap; }
.fchip{ font-size:13.5px; font-weight:600; padding:7px 14px; border-radius:9px; text-decoration:none!important; color:var(--ink-2); display:inline-flex; gap:8px; align-items:center; }
.fchip:hover{ color:var(--ink); background:rgba(255,255,255,.6); }
.fchip-on{ background:#fff; color:var(--ink); box-shadow:var(--shadow-sm); }
.fchip .count{ font-size:12px; color:var(--muted); background:rgba(0,0,0,.05); border-radius:999px; padding:0 7px; }
.search{ position:relative; } .search svg{ position:absolute; left:12px; top:50%; margin-top:-9px; color:var(--faint); }
.search input{ width:300px; max-width:100%; padding:10px 12px 10px 38px; border:1px solid var(--line-strong); border-radius:10px; font:inherit; font-size:14px; background:#fff; }
.search input:focus{ border-color:var(--red); box-shadow:var(--focus); outline:none; }
.qtable-wrap{ overflow-x:auto; padding:0; }
.qtable{ width:100%; border-collapse:collapse; }
.qtable th,.qtable td{ text-align:left; padding:14px 18px; border-bottom:1px solid var(--line); font-size:14px; vertical-align:middle; }
.qtable th{ background:var(--sunken); color:var(--muted); font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; }
.qtable tbody tr{ cursor:pointer; transition:background .1s; }
.qtable tbody tr:hover{ background:var(--sunken); }
.qtable tbody tr:last-child td{ border-bottom:0; }
.qtable .ref a{ font-weight:700; color:var(--ink); font-family:var(--font-head); }
.qtable .num{ text-align:right; font-variant-numeric:tabular-nums; white-space:nowrap; }
.qtable .job{ font-weight:600; } .qtable .sub{ display:block; color:var(--muted); font-size:13px; font-weight:400; }
.tbc{ color:var(--amber); font-size:12px; display:block; }

/* --- Quote detail ----------------------------------------------------- */
.qhead{ display:flex; justify-content:space-between; gap:24px; align-items:flex-start; flex-wrap:wrap; margin-bottom:22px; }
.qhead h1{ margin-bottom:8px; }
.qmeta{ display:flex; gap:10px 18px; align-items:center; flex-wrap:wrap; color:var(--muted); font-size:14px; }
.qmeta b{ color:var(--ink); font-weight:600; }
.qtotal{ text-align:right; } .qtotal .amt{ font:800 30px/1 var(--font-head); color:var(--ink); }
.qtotal .lbl{ font-size:12px; text-transform:uppercase; letter-spacing:.06em; color:var(--muted); font-weight:700; }
.steps{ display:flex; list-style:none; margin:0 0 22px; padding:0; counter-reset:step; background:#fff; border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); overflow:hidden; }
.steps li{ flex:1; display:flex; align-items:center; gap:10px; padding:14px 16px; font-size:13.5px; font-weight:600; color:var(--muted); position:relative; counter-increment:step; }
.steps li + li{ border-left:1px solid var(--line); }
.steps li::before{ content:counter(step); width:24px; height:24px; flex:none; border-radius:50%; display:grid; place-items:center; font-size:12px; background:#F0EEEC; color:var(--muted); }
.steps li.skipped{ color:var(--faint); } .steps li.skipped::before{ content:'–'; }
.steps li.done{ color:var(--ink-2); } .steps li.done::before{ content:'✓'; background:var(--green); color:#fff; }
.steps li.current{ color:var(--ink); background:var(--red-50); box-shadow:inset 0 -3px 0 var(--red); } .steps li.current::before{ background:var(--red); color:#fff; }
.nextstep{ display:flex; gap:18px; align-items:flex-start; justify-content:space-between; padding:22px 26px; margin-bottom:20px; border-left:4px solid var(--red); flex-wrap:wrap; }
.nextstep.ok{ border-left-color:var(--green); } .nextstep.wait{ border-left-color:var(--amber); }
.nextstep h2{ margin-bottom:4px; } .nextstep p{ margin:0; color:var(--ink-2); }
.checklist{ list-style:none; margin:10px 0 0; padding:0; display:grid; gap:6px; }
.checklist li{ display:flex; gap:10px; align-items:flex-start; font-size:14px; color:var(--ink-2); }
.checklist li::before{ content:''; width:16px; height:16px; margin-top:3px; flex:none; border-radius:50%; border:2px solid var(--red); }
.detail-grid{ display:grid; grid-template-columns:minmax(0,1fr) 300px; gap:20px; align-items:start; }
.side{ position:sticky; top:84px; display:grid; gap:16px; }
.side .panel{ margin:0; padding:20px; }
.side h3{ font-size:14px; text-transform:uppercase; letter-spacing:.05em; color:var(--muted); margin-bottom:10px; }
.tocnav a{ display:flex; align-items:center; gap:10px; padding:7px 10px; border-radius:8px; color:var(--ink-2); font-size:14px; font-weight:600; text-decoration:none; }
.tocnav a:hover{ background:var(--bg); color:var(--ink); }
.tocnav .dot{ width:8px; height:8px; border-radius:50%; background:var(--line-strong); }
.tocnav .dot.ok{ background:var(--green); } .tocnav .dot.warn{ background:var(--amber); } .tocnav .dot.bad{ background:var(--red); }
.kv{ display:grid; grid-template-columns:minmax(140px,220px) 1fr; gap:10px 20px; margin:0; }
.kv dt{ color:var(--muted); font-size:13.5px; } .kv dd{ margin:0; font-size:14.5px; overflow-wrap:anywhere; }
.structure-summary{ border:1px solid var(--line); border-radius:10px; padding:16px 18px; margin-top:12px; background:var(--sunken); }
.structure-summary h3{ display:flex; justify-content:space-between; gap:12px; font-size:15px; margin:0 0 10px; }
.structure-summary h3 .amt{ font-variant-numeric:tabular-nums; }
.reveal summary{ cursor:pointer; font-weight:600; color:var(--ink-2); font-size:14px; list-style:none; display:inline-flex; align-items:center; gap:6px; }
.reveal summary::-webkit-details-marker{ display:none; }
.reveal summary::before{ content:'▸'; transition:transform .15s; } .reveal[open] summary::before{ transform:rotate(90deg); }
.reveal[open] summary{ margin-bottom:12px; }
.timeline{ list-style:none; margin:0; padding:0; }
.timeline li{ position:relative; padding:0 0 14px 22px; font-size:13.5px; }
.timeline li::before{ content:''; position:absolute; left:4px; top:7px; width:8px; height:8px; border-radius:50%; background:var(--line-strong); }
.timeline li::after{ content:''; position:absolute; left:7.5px; top:18px; bottom:0; width:1px; background:var(--line); }
.timeline li:last-child::after{ display:none; }
.timeline b{ display:block; font-weight:600; } .timeline span{ color:var(--muted); font-size:12.5px; }
.timeline q{ display:block; margin-top:4px; color:var(--ink-2); font-style:italic; }
.review-actions{ display:flex; gap:8px; flex-wrap:wrap; }
.sendback{ display:grid; gap:10px; margin-top:14px; }
.sendback textarea{ width:100%; padding:10px 12px; border:1px solid var(--line-strong); border-radius:10px; font:inherit; font-size:14px; resize:vertical; }
.sendback textarea:focus{ border-color:var(--red); box-shadow:var(--focus); outline:none; }
.review-log{ margin-top:16px; }
.alert{ padding:12px 14px; border-radius:10px; font-size:14px; margin:0 0 14px; }
.alert-warn{ background:var(--amber-50); color:#7A4A07; border:1px solid #F5DFB7; }
.alert-error{ background:var(--red-50); color:var(--red-700); border:1px solid var(--red-100); }
.alert-quiet{ background:var(--sunken); color:var(--muted); border:1px solid var(--line); }

/* --- Cover & polish --------------------------------------------------- */
.cover-tone{ display:grid; grid-template-columns:220px 1fr; gap:14px; margin:0 0 18px; padding:16px; background:var(--sunken); border:1px solid var(--line); border-radius:10px; }
.cover-tone label{ font-size:13px; font-weight:600; display:flex; flex-direction:column; gap:6px; color:var(--ink-2); }
.cover-block{ margin:0 0 18px; } .cover-block > label{ display:block; font-weight:700; font-size:14px; margin-bottom:6px; }
.cover-block textarea.inp{ min-height:96px; line-height:1.6; }
.narrative{ border-top:1px solid var(--line); padding-top:18px; margin-top:18px; }
.narrative:first-of-type{ border-top:0; padding-top:0; margin-top:0; }
.narrative h3{ font-size:15px; margin:0 0 10px; }
.compare{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.compare .col{ display:flex; flex-direction:column; }
.choice{ display:flex; flex-direction:column; gap:8px; border:1.5px solid var(--line); border-radius:10px; padding:12px 14px; cursor:pointer; background:#fff; height:100%; transition:border-color .15s, background .15s; }
.choice:hover{ border-color:var(--line-strong); }
.choice:has(input:checked){ border-color:var(--red); background:var(--red-50); }
.choice.opt-disabled{ cursor:not-allowed; background:var(--sunken); }
.choice .box{ font-size:14px; color:var(--ink-2); line-height:1.6; }
.opt{ display:flex; align-items:center; gap:8px; font-size:13px; font-weight:700; color:var(--ink); }
.opt input{ width:auto; accent-color:var(--red); margin:0; }
.box-flagged{ border-color:var(--red-100)!important; }
.flag{ font-size:13px; color:var(--red-700); background:var(--red-50); border-radius:8px; padding:8px 10px; margin:0; }

/* --- Forms ------------------------------------------------------------ */
.inp,.qfield .inp,.login input{ width:100%; padding:11px 13px; border:1px solid var(--line-strong); border-radius:10px; font:inherit; font-size:14.5px; color:var(--ink); background:#fff; transition:border-color .15s, box-shadow .15s; }
.inp:hover{ border-color:var(--faint); }
.inp:focus,.login input:focus{ border-color:var(--red); box-shadow:var(--focus); outline:none; }
textarea.inp{ resize:vertical; min-height:84px; line-height:1.55; }
select.inp{ appearance:none; padding-right:38px; background:#fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23756D6C' stroke-width='1.8' fill='none' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 14px center; }
input[type=file].inp{ padding:9px; background:var(--sunken); border-style:dashed; cursor:pointer; }
input[type=checkbox],input[type=radio]{ accent-color:var(--red); width:17px; height:17px; }
.form-layout{ display:grid; grid-template-columns:210px minmax(0,1fr); gap:32px; align-items:start; }
.form-rail{ position:sticky; top:88px; }
.form-rail ol{ list-style:none; margin:0; padding:0; counter-reset:rail; display:grid; gap:2px; }
.form-rail ol a{ display:flex; gap:10px; align-items:center; padding:9px 10px; border-radius:9px; color:var(--ink-2); font-weight:600; font-size:14px; text-decoration:none; counter-increment:rail; }
.form-rail ol a::before{ content:counter(rail); width:24px; height:24px; border-radius:50%; display:grid; place-items:center; background:#fff; border:1px solid var(--line-strong); font-size:12px; color:var(--muted); flex:none; }
.form-rail ol a:hover{ background:#fff; color:var(--ink); }
.form-rail ol a.on{ background:#fff; color:var(--ink); box-shadow:var(--shadow-sm); } .form-rail ol a.on::before{ background:var(--red); color:#fff; border-color:var(--red); }
.form-rail .tip{ margin-top:18px; padding:14px; border-radius:10px; background:#fff; border:1px solid var(--line); font-size:12.5px; color:var(--muted); line-height:1.5; }
.qform{ margin:0; }
.fsec{ background:#fff; border:1px solid var(--line); border-radius:var(--radius); box-shadow:var(--shadow); padding:24px 26px 10px; margin:0 0 20px; scroll-margin-top:84px; }
.fsec > h2{ display:flex; align-items:center; gap:10px; }
.fsec > p.muted{ margin:2px 0 14px; }
.fgrid{ display:grid; grid-template-columns:1fr 1fr; gap:0 20px; }
.fgrid > .qfield-wide,.fgrid > .qfield:has(textarea){ grid-column:1 / -1; }
.qsection{ border:0; padding:0; margin:0 0 6px; min-width:0; }
.qsection legend{ font:700 12px var(--font-head); text-transform:uppercase; letter-spacing:.07em; color:var(--muted); padding:0; margin:14px 0 4px; }
.qfield{ margin:0 0 16px; min-width:0; }
.qfield > label{ display:flex; align-items:center; flex-wrap:wrap; gap:2px; font-size:14px; font-weight:600; margin-bottom:6px; color:var(--ink); }
.qfield-check{ display:flex; align-items:center; gap:10px; margin:0; padding:11px 14px; border:1px solid var(--line); border-radius:10px; background:#fff; cursor:pointer; transition:border-color .15s, background .15s; }
.qfield-check:hover{ border-color:var(--line-strong); }
.qfield-check:has(input:checked){ border-color:var(--red); background:var(--red-50); }
.qfield-check > label{ order:2; margin:0; font-weight:500; font-size:14px; cursor:pointer; flex:1; }
.qfield-check input{ order:1; width:auto; }
.qfield-check .hint{ display:none; }
.fgrid > .qfield-check{ margin:0 0 10px; align-self:end; }
.fgrid > .qfield[data-field="quote_style"],.fgrid > .qfield[data-field="inspection_pricing"],
.fgrid > .qfield[data-field="visual_link"]{ grid-column:1 / -1; }
.subsec .fgrid > .qfield-check{ margin-bottom:16px; }
.checks{ display:grid; grid-template-columns:repeat(auto-fill,minmax(250px,1fr)); gap:10px; margin:0 0 16px; }
.checks > .qfield:not(.qfield-check){ grid-column:1 / -1; margin:4px 0 6px; }
.qfield > div:has(input[type=radio]){ display:flex; gap:10px; flex-wrap:wrap; }
.qfield > div:has(input[type=radio]) label{ display:flex; align-items:center; gap:8px; font-weight:500; font-size:14px; padding:10px 14px; border:1px solid var(--line-strong); border-radius:10px; cursor:pointer; background:#fff; }
.qfield > div:has(input[type=radio]) label:has(input:checked){ border-color:var(--red); background:var(--red-50); }
.qfield ul{ list-style:none; padding:0; margin:0; display:flex; gap:10px; flex-wrap:wrap; }
.qfield ul label{ display:flex; align-items:center; gap:8px; font-weight:500; padding:9px 14px; border:1px solid var(--line-strong); border-radius:10px; cursor:pointer; background:#fff; }
.qfield ul label:has(input:checked){ border-color:var(--red); background:var(--red-50); }
.req{ color:var(--red); margin-left:2px; } .unit{ color:var(--muted); font-weight:400; font-size:12.5px; margin-left:4px; }
.hint{ color:var(--muted); font-size:12.5px; margin:6px 0 0; }
.qfield .error,.qfield p.error{ font-size:13px; margin:6px 0 0; }
.qfield:has(.error) .inp{ border-color:var(--red); }
.formerr{ color:var(--red-700); font-size:14px; background:var(--red-50); border:1px solid var(--red-100); padding:12px 16px; border-radius:10px; margin:0 0 18px; }
.formerr ul{ margin:0; padding-left:18px; }
.fsec:target,.structure-block:target{ animation:target-flash 2.4s ease-out; }
@keyframes target-flash{ 0%,35%{ box-shadow:0 0 0 3px var(--red-100), var(--shadow); border-color:var(--red); } 100%{ box-shadow:var(--shadow); } }
@media (prefers-reduced-motion: reduce){ .fsec:target,.structure-block:target{ animation:none; outline:3px solid var(--red-100); } }
.structure-block{ scroll-margin-top:84px; }
.structure-summary h3 .btn{ flex:none; }
.structure-block{ border:1px solid var(--line); border-radius:12px; padding:0; margin:0 0 16px; background:#fff; min-width:0; overflow:hidden; }
.structure-block > .rowhead{ padding:14px 18px; background:var(--sunken); border-bottom:1px solid var(--line); margin:0; }
.structure-body{ padding:18px 18px 4px; }
.structure-title{ font-size:15px; margin:0; display:flex; align-items:center; gap:10px; }
.structure-title .n{ width:26px; height:26px; border-radius:8px; background:var(--ink); color:#fff; display:grid; place-items:center; font-size:12.5px; }
.structure-block .del{ display:flex; align-items:center; gap:6px; font-size:13px; color:var(--muted); cursor:pointer; font-weight:600; }
.structure-block .del:has(input:checked){ color:var(--red-600); }
.structure-block.removing .structure-body{ opacity:.4; pointer-events:none; }
.subsec{ margin-top:4px; }
.subsec h4{ font:700 12px var(--font-head); text-transform:uppercase; letter-spacing:.07em; color:var(--muted); margin:8px 0 12px; padding-top:14px; border-top:1px dashed var(--line); }
.subsec .fgrid{ margin:0; }
.pick-type{ text-align:center; color:var(--muted); font-size:14px; padding:6px 0 18px; }
#add-structure{ width:100%; border-style:dashed; padding:14px; margin-bottom:20px; color:var(--ink-2); }
.qactions{ position:sticky; bottom:0; z-index:20; display:flex; align-items:center; justify-content:space-between; gap:16px;
  margin:8px 0 0; padding:14px 20px; background:rgba(255,255,255,.95); backdrop-filter:blur(8px); border:1px solid var(--line); border-radius:14px; box-shadow:var(--shadow-lg); }
.qactions .note{ color:var(--muted); font-size:13px; }
.panel .qactions,.panel-actions{ position:static; box-shadow:none; border:0; padding:0; background:none; margin-top:6px; justify-content:flex-start; }

/* --- SMART Scaffolder import entry (preview) --- */
.smart-entry{ display:flex; align-items:center; gap:14px; padding:16px 20px; margin:0 0 16px; color:inherit; text-decoration:none!important; transition:border-color .15s, transform .15s; }
.smart-entry:hover{ border-color:var(--red); transform:translateY(-1px); color:inherit; }
.smart-ico{ width:42px; height:42px; border-radius:12px; display:grid; place-items:center; background:var(--red-50); color:var(--red); flex:none; }
.smart-txt{ flex:1; min-width:0; } .smart-txt .muted{ display:block; }
.si-badge-sm{ font:700 10.5px var(--font-body); letter-spacing:.06em; text-transform:uppercase; color:var(--blue); background:var(--blue-50); border-radius:999px; padding:2px 8px; margin-left:6px; }

/* --- Company templates (new quote) --- */
.templates{ padding:22px 24px; margin:0 0 24px; }
.tpl-grid{ display:grid; grid-template-columns:repeat(auto-fill,minmax(230px,1fr)); gap:12px; }
.tpl{ margin:0; }
.tpl button{ width:100%; height:100%; text-align:left; display:flex; flex-direction:column; gap:4px; padding:14px 16px; border:1px solid var(--line); border-radius:10px; background:var(--sunken); cursor:pointer; font:inherit; color:var(--ink); transition:border-color .15s, background .15s, transform .15s; }
.tpl button:hover{ border-color:var(--red); background:#fff; transform:translateY(-1px); }
.tpl-name{ font-weight:700; } .tpl-sub{ color:var(--muted); font-size:13px; } .tpl-go{ color:var(--red-600); font-weight:600; font-size:13px; margin-top:6px; }

/* --- Sign in ---------------------------------------------------------- */
.auth{ min-height:100vh; display:grid; grid-template-columns:1.05fr 1fr; background:#fff; }
.auth-art{ position:relative; overflow:hidden; background:var(--ink); color:#fff; padding:48px; display:flex; flex-direction:column; justify-content:space-between; }
.auth-art::before{ content:''; position:absolute; inset:0; opacity:.16;
  background-image:linear-gradient(rgba(255,255,255,.5) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.5) 1px,transparent 1px);
  background-size:56px 56px; -webkit-mask:linear-gradient(160deg,#000 10%,transparent 75%); mask:linear-gradient(160deg,#000 10%,transparent 75%); }
.auth-art::after{ content:''; position:absolute; right:-120px; bottom:-120px; width:420px; height:420px; border-radius:50%; background:radial-gradient(closest-side,rgba(214,39,49,.55),transparent); }
.auth-art > *{ position:relative; z-index:1; }
.auth-art img{ height:30px; width:auto; align-self:flex-start; }
.auth-art h1{ color:#fff; font-size:40px; line-height:1.1; max-width:15ch; margin:0 0 14px; }
.auth-art p{ color:rgba(255,255,255,.72); max-width:42ch; margin:0; }
.auth-art .small{ font-size:12.5px; color:rgba(255,255,255,.5); }
.auth-form{ display:grid; place-items:center; padding:48px 28px; }
.login{ width:100%; max-width:380px; }
.login h1{ font-size:28px; } .login .lead{ margin-bottom:26px; }
.login label{ display:block; margin:0 0 16px; font-size:14px; font-weight:600; }
.login input{ margin-top:6px; }
.login .btn{ width:100%; margin-top:6px; }
.login .error,.login .alert{ margin-bottom:18px; }

/* --- Responsive ------------------------------------------------------- */
@media (max-width:1000px){
  .detail-grid,.dash-grid{ grid-template-columns:1fr; }
  .side{ position:static; }
  .form-layout{ grid-template-columns:1fr; } .form-rail{ display:none; }
}
@media (max-width:760px){
  .topbar-in{ padding:0 16px; gap:12px; } .brand-sub,.who{ display:none; }
  .mainnav a{ padding:8px; font-size:13.5px; }
  .wrap{ padding:24px 16px 48px; } .foot{ padding:20px 16px 32px; }
  h1,.hero h1{ font-size:25px; }
  .stats{ grid-template-columns:1fr 1fr 1fr; gap:10px; } .stat{ padding:14px; } .stat .num{ font-size:26px; }
  .fgrid,.compare,.cover-tone{ grid-template-columns:1fr; }
  .kv{ grid-template-columns:1fr; gap:2px 0; } .kv dd{ margin-bottom:10px; }
  .steps{ overflow-x:auto; } .steps li{ min-width:max-content; padding:12px; } .steps li span{ display:none; } .steps li.current span{ display:inline; }
  .panel,.fsec{ padding:18px 16px; }
  .auth{ grid-template-columns:1fr; } .auth-art{ padding:28px 24px; min-height:auto; } .auth-art h1{ font-size:28px; } .auth-art .hide-sm{ display:none; }
  .qtable .hide-sm{ display:none; } .qtable th,.qtable td{ padding:12px 10px; } .qtable td.ref{ white-space:nowrap; } .search input{ width:100%; } .search{ flex:1; }
  .qactions{ padding:10px 12px; border-radius:12px; } .qactions .note{ display:none; }
  .qactions .btn-row{ width:100%; justify-content:space-between; flex-wrap:nowrap; }
  .mainnav{ gap:0; } .mainnav a{ white-space:nowrap; } .mainnav .nav-new{ display:none; }
  .brand img{ height:20px; } .qtotal{ text-align:left; }
}
@media print{ .topbar,.foot,.qactions,.side{ display:none; } body{ background:#fff; } }
