/* Setpoint Quotes. Brand colours follow the Kühlen logo: blue #1f6fb8, orange #f39200. */
:root {
  --brand: #1f6fb8; --brand-600: #195f9f; --brand-700: #144c80; --brand-50: #eef5fc; --brand-100: #d9e8f7;
  --accent: #f39200; --accent-50: #fff5e6;
  --ink: #111c2a; --ink-2: #334155; --muted: #64748b; --faint: #94a3b8;
  --line: #e4e9f0; --line-2: #d3dbe5; --bg: #f5f7fa; --card: #fff; --hover: #f8fafc;
  --ok: #15803d; --ok-50: #ecfdf3; --warn: #b45309; --warn-50: #fffbeb; --bad: #b91c1c; --bad-50: #fef2f2;
  --r-sm: 6px; --r: 10px; --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .06);
  --shadow-lg: 0 12px 40px rgba(15, 23, 42, .18);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 var(--font); font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--ink); letter-spacing: -.01em; }
h1 { font-size: 22px; font-weight: 650; margin: 0; line-height: 1.25; }
h2 { font-size: 15px; font-weight: 600; margin: 0 0 12px; }
h3 { font-size: 14px; font-weight: 600; margin: 0; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 12.5px; }
.num, .tnum { font-variant-numeric: tabular-nums; }
.num { text-align: right; white-space: nowrap; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.between { justify-content: space-between; }
.grow { flex: 1; }
.icon { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---- Forms ---- */
input, select, textarea {
  font: inherit; color: var(--ink); width: 100%; padding: 8px 10px; background: #fff;
  border: 1px solid var(--line-2); border-radius: var(--r-sm); transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: var(--faint); }
input:hover, select:hover, textarea:hover { border-color: #b9c4d1; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(31, 111, 184, .15); }
input[type=checkbox], input[type=radio] { width: 16px; height: 16px; margin: 0; accent-color: var(--brand); cursor: pointer; flex: none; }
textarea { resize: vertical; min-height: 38px; line-height: 1.45; }
textarea.auto { resize: none; overflow: hidden; }
select { appearance: none; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2364748b' stroke-width='1.8'%3E%3Cpath d='M3 4.5l3 3 3-3'/%3E%3C/svg%3E") no-repeat right 10px center; padding-right: 30px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span, .label { font-size: 12.5px; font-weight: 550; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.check { display: inline-flex; gap: 8px; align-items: center; cursor: pointer; color: var(--ink-2); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.stack { display: grid; gap: 14px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px;
  font: 550 13.5px/1 var(--font); color: var(--ink); background: #fff; border: 1px solid var(--line-2);
  border-radius: var(--r-sm); cursor: pointer; white-space: nowrap; box-shadow: var(--shadow-sm); text-decoration: none !important;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { background: var(--hover); border-color: #b9c4d1; }
.btn:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(31, 111, 184, .25); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-600); border-color: var(--brand-600); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--ink-2); }
.btn.ghost:hover { background: rgba(15, 23, 42, .05); }
.btn.danger { color: var(--bad); }
.btn.danger:hover { background: var(--bad-50); border-color: #f3c2c2; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn.block { width: 100%; }
.btn.icon-only { width: 32px; padding: 0; height: 32px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
button.link { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }

/* ---- Cards ---- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.card-head h2 { margin: 0; }
.card + .card { margin-top: 16px; }

/* ---- Pills ---- */
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #eef2f6; color: var(--ink-2); white-space: nowrap; }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.s-draft { background: #f1f5f9; color: #475569; }
.s-sent { background: var(--brand-50); color: var(--brand-700); }
.s-viewed { background: var(--accent-50); color: #b45309; }
.s-accepted { background: var(--ok-50); color: var(--ok); }
.s-declined { background: var(--bad-50); color: var(--bad); }
.s-expired, .s-withdrawn { background: #f1f5f9; color: #64748b; }
.s-template { background: #f3effe; color: #6d28d9; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 5px; font-size: 11.5px; font-weight: 600; background: #f1f5f9; color: var(--ink-2); }
.chip.orange { background: var(--accent-50); color: #b45309; }
.chip.blue { background: var(--brand-50); color: var(--brand-700); }

/* ---- Staff shell ---- */
.nav { position: sticky; top: 0; z-index: 20; background: #0f2236; color: #c9d6e4; }
.nav-in { max-width: 1280px; margin: 0 auto; padding: 0 24px; height: 56px; display: flex; align-items: center; gap: 28px; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 650; font-size: 15px; letter-spacing: -.01em; text-decoration: none !important; }
.brand img { width: 26px; height: 26px; border-radius: 6px; background: #fff; padding: 2px; }
.nav-links { display: flex; gap: 2px; flex: 1; height: 100%; }
.nav-links a { display: flex; align-items: center; padding: 0 12px; color: #b4c3d3; font-weight: 500; text-decoration: none; border-bottom: 2px solid transparent; }
.nav-links a:hover { color: #fff; }
.nav-links a.on { color: #fff; border-bottom-color: var(--accent); }
.nav-user { display: flex; align-items: center; gap: 12px; font-size: 13px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; font-weight: 650; font-size: 12px; }
.nav-user button { background: none; border: 0; color: #b4c3d3; cursor: pointer; font: inherit; }
.nav-user button:hover { color: #fff; }
.page { max-width: 1280px; margin: 0 auto; padding: 28px 24px 64px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.crumb { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; margin-bottom: 6px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 50; background: #0f2236; color: #fff; padding: 10px 16px; border-radius: var(--r); box-shadow: var(--shadow-lg); font-weight: 500; max-width: min(560px, 92vw); animation: toast 4.5s ease forwards; }
@keyframes toast { 0% { opacity: 0; transform: translate(-50%, 8px); } 6%, 85% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; visibility: hidden; } }

/* ---- Stats ---- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 24px; }
.stat { padding: 16px 20px; }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat .v { font-size: 26px; font-weight: 650; letter-spacing: -.02em; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .d { font-size: 12.5px; color: var(--muted); }
.meter { height: 6px; background: #edf1f5; border-radius: 99px; overflow: hidden; margin-top: 10px; }
.meter i { display: block; height: 100%; background: var(--ok); border-radius: 99px; }

/* ---- Toolbar & tabs ---- */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.seg { display: flex; gap: 2px; background: #eef2f6; padding: 3px; border-radius: 8px; flex-wrap: wrap; }
.seg a { padding: 5px 12px; border-radius: 6px; color: var(--ink-2); font-weight: 550; font-size: 13px; text-decoration: none; display: inline-flex; gap: 6px; align-items: center; }
.seg a:hover { color: var(--ink); }
.seg a.on { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.seg .count { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.search { position: relative; min-width: 260px; }
.search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input { padding-left: 32px; height: 36px; }

/* ---- Lists ---- */
.list { display: grid; }
.list-head, .list-row { display: grid; gap: 16px; align-items: center; padding: 0 20px; }
.list-head { height: 38px; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; border-bottom: 1px solid var(--line); background: #fafbfd; }
.list-row { min-height: 60px; border-bottom: 1px solid var(--line); color: var(--ink); text-decoration: none !important; transition: background .1s; }
.list-row:hover { background: var(--hover); }
.list-row:last-child { border-bottom: 0; }
.q-cols { grid-template-columns: 80px minmax(0, 1fr) 150px 120px 110px; }
.c-cols { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1.2fr) 140px 80px; }
.i-cols { grid-template-columns: minmax(0, 1fr) 110px 110px 70px; }
.t-cols { grid-template-columns: minmax(0, 1fr) 120px 120px 90px; }
.ref { font-weight: 600; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.title-cell { min-width: 0; }
.title-cell .t { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.title-cell .s { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.when { color: var(--muted); font-size: 12.5px; text-align: right; white-space: nowrap; }
.money { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.empty { padding: 56px 24px; text-align: center; color: var(--muted); }
.empty h3 { color: var(--ink); margin-bottom: 4px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

/* ---- Dialog ---- */
dialog { border: 0; border-radius: var(--r-lg); padding: 0; width: min(560px, 94vw); box-shadow: var(--shadow-lg); color: var(--ink); }
dialog::backdrop { background: rgba(15, 23, 42, .45); backdrop-filter: blur(2px); }
.dlg-head { padding: 18px 22px 0; display: flex; justify-content: space-between; align-items: center; }
.dlg-head h2 { margin: 0; font-size: 17px; }
.dlg-body { padding: 16px 22px; }
.dlg-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: #fafbfd; border-radius: 0 0 var(--r-lg) var(--r-lg); }

/* ---- Menus ---- */
.menu { position: relative; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); padding: 6px; display: grid; }
.menu-pop form { display: contents; }
.menu-pop a, .menu-pop button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 6px; font: inherit; color: var(--ink); text-align: left; cursor: pointer; text-decoration: none !important; }
.menu-pop a:hover, .menu-pop button:hover { background: var(--hover); }
.menu-pop .danger { color: var(--bad); }
.menu-pop hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

/* ---- Editor ---- */
.ed-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.ed-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.ed-actions { display: flex; align-items: center; gap: 8px; }
.save-state { font-size: 12.5px; color: var(--muted); min-width: 90px; text-align: right; }
.save-state.err { color: var(--bad); }
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.side { position: sticky; top: 76px; display: grid; gap: 16px; }
.banner-note { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r); background: var(--accent-50); border: 1px solid #fde3b6; color: #7c4a03; font-size: 13px; margin-bottom: 16px; }

.sum-rows { display: grid; gap: 8px; font-variant-numeric: tabular-nums; }
.sum-rows div { display: flex; justify-content: space-between; gap: 12px; }
.sum-rows .total { padding-top: 10px; margin-top: 4px; border-top: 1px solid var(--line); font-weight: 650; font-size: 18px; }
.sum-rows .sub { color: var(--muted); font-size: 13px; }
.linkbox { display: flex; gap: 6px; }
.linkbox input { font-size: 12.5px; color: var(--muted); background: #fafbfd; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.timeline li { display: grid; grid-template-columns: 10px 1fr; gap: 10px; font-size: 13px; }
.timeline li::before { content: ""; width: 8px; height: 8px; margin-top: 6px; border-radius: 50%; background: var(--line-2); }
.timeline li.done::before { background: var(--brand); }
.timeline li.good::before { background: var(--ok); }
.timeline li.bad::before { background: var(--bad); }

/* Builder */
.li-head, .li { display: grid; grid-template-columns: 22px minmax(0, 1fr) 76px 112px 112px 64px; gap: 10px; align-items: start; }
.li-head { padding: 0 20px 8px; font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.li-head span:nth-child(n+3) { text-align: right; }
.lines { display: grid; }
.li { padding: 12px 20px; border-top: 1px solid var(--line); background: #fff; position: relative; }
.li:hover { background: #fcfdfe; }
.li.dragging { opacity: .4; }
.li.drop-before { box-shadow: inset 0 2px 0 var(--brand); }
.li.in-group { background: linear-gradient(90deg, var(--accent) 0 3px, transparent 3px); }
.grip { cursor: grab; color: var(--faint); display: grid; place-items: center; height: 34px; border-radius: 4px; }
.grip:hover { color: var(--ink-2); background: #f1f5f9; }
.li input, .li textarea { border-color: transparent; background: transparent; padding: 7px 8px; }
.li:hover input, .li:hover textarea, .li input:focus, .li textarea:focus { border-color: var(--line-2); background: #fff; }
.li .name { font-weight: 550; }
.li .desc { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.li .qty, .li .price { text-align: right; font-variant-numeric: tabular-nums; }
.li .amount { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; padding-top: 8px; white-space: nowrap; }
.li .amount.off { color: var(--faint); text-decoration: line-through; font-weight: 500; }
.li-tools { display: flex; gap: 2px; justify-content: flex-end; padding-top: 2px; opacity: .55; transition: opacity .1s; }
.li:hover .li-tools, .li:focus-within .li-tools { opacity: 1; }
.tool { width: 28px; height: 28px; display: grid; place-items: center; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--muted); }
.tool:hover { background: #eef2f6; color: var(--ink); }
.tool.on { color: var(--brand); background: var(--brand-50); }
.li-tags { display: flex; gap: 6px; flex-wrap: wrap; padding: 4px 8px 0; }
.li-more { grid-column: 2 / -1; display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; padding: 12px 14px; margin-top: 4px; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.li-more label { display: inline-flex; gap: 6px; align-items: center; color: var(--ink-2); }
.li-more input:not([type=checkbox]) { width: 104px; padding: 5px 8px; border: 1px solid var(--line-2); background: #fff; }
.li-more .grp { width: 170px !important; }
.li.heading .name { font-size: 15px; font-weight: 650; }
.li.heading, .li.text { grid-template-columns: 22px minmax(0, 1fr) 64px; }
.li.heading { background: #f8fafc; }
.li-kind { font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--faint); padding: 0 8px; }
.add-bar { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: #fafbfd; border-radius: 0 0 var(--r) var(--r); flex-wrap: wrap; align-items: center; }
.picker { position: relative; flex: 1; min-width: 260px; }
.picker .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.picker input { padding-left: 32px; height: 36px; background: #fff; }
.picker-pop { position: absolute; left: 0; right: 0; bottom: calc(100% + 6px); z-index: 25; background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); max-height: 320px; overflow: auto; padding: 6px; }
.picker-pop button { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; font: inherit; color: var(--ink); }
.picker-pop button .d { grid-column: 1; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-pop button .p { font-variant-numeric: tabular-nums; font-weight: 600; }
.picker-pop button.active, .picker-pop button:hover { background: var(--brand-50); }
.picker-pop .new { color: var(--brand); font-weight: 550; }
.empty-lines { padding: 32px 20px; text-align: center; color: var(--muted); border-top: 1px solid var(--line); }

.combo { position: relative; }
.combo-pop { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 25; background: #fff; border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow-lg); max-height: 300px; overflow: auto; padding: 6px; }
.combo-pop button { display: block; width: 100%; text-align: left; padding: 7px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; font: inherit; color: var(--ink); }
.combo-pop button small { display: block; color: var(--muted); font-size: 12px; }
.combo-pop button.active, .combo-pop button:hover { background: var(--brand-50); }

.thread { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 10px; }
.thread li { padding: 10px 14px; border-radius: var(--r); background: #f5f7fa; max-width: 88%; }
.thread li.staff { background: var(--brand-50); margin-left: auto; }
.thread .who { font-size: 12px; font-weight: 600; color: var(--ink-2); margin-bottom: 2px; }
.activity { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; font-size: 13px; }
.activity li { display: grid; grid-template-columns: 110px 1fr; gap: 12px; }
.activity time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }

/* Settings */
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 28px; align-items: start; }
.settings nav { position: sticky; top: 80px; display: grid; gap: 2px; }
.settings nav a { padding: 7px 10px; border-radius: 6px; color: var(--ink-2); font-weight: 500; text-decoration: none; }
.settings nav a:hover { background: #eef2f6; }
.status-list { list-style: none; padding: 0; margin: 0; display: grid; }
.status-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.status-list li:first-child { border-top: 0; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 8px; background: var(--faint); }
.dot.ok { background: var(--ok); }

/* Sign in */
body.bare { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 20% -10%, #dbe9f7 0, transparent 60%), var(--bg); }
.auth { width: min(400px, 100%); padding: 32px; }
.auth .logo { display: block; width: 170px; margin: 0 auto 6px; }
.auth .prod { text-align: center; color: var(--muted); font-weight: 600; letter-spacing: .02em; margin-bottom: 24px; }
.alert { padding: 10px 12px; border-radius: var(--r-sm); background: var(--bad-50); color: var(--bad); font-size: 13px; }

/* =================== Client quote =================== */
body.client { background: #eef2f6; }
.cq { max-width: 1120px; margin: 0 auto; padding: 28px 20px 120px; display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; align-items: start; }
.cq-main { min-width: 0; display: grid; gap: 20px; }
.cq-side { position: sticky; top: 24px; display: grid; gap: 16px; }
.banner { display: flex; gap: 10px; align-items: center; padding: 12px 16px; border-radius: var(--r); font-weight: 500; }
.banner.ok { background: var(--ok-50); color: var(--ok); border: 1px solid #bbe5c8; }
.banner.warn { background: var(--warn-50); color: var(--warn); border: 1px solid #f5dcae; }
.banner.info { background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--brand-100); }
.banner.muted-b { background: #f1f5f9; color: var(--ink-2); border: 1px solid var(--line); }

.doc { background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; }
.doc-top { padding: 32px 40px 28px; border-bottom: 1px solid var(--line); position: relative; }
.doc-top::before { content: ""; position: absolute; inset: 0 0 auto; height: 4px; background: linear-gradient(90deg, var(--brand) 0 70%, var(--accent) 70%); }
.doc-brand { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; flex-wrap: wrap; }
.doc-logo { width: 168px; height: auto; display: block; }
.doc-from { text-align: right; font-size: 12.5px; color: var(--muted); line-height: 1.6; }
.doc-from strong { color: var(--ink-2); }
.doc-title { font-size: 26px; font-weight: 700; letter-spacing: -.02em; margin: 28px 0 0; line-height: 1.2; }
.doc-facts { display: grid; grid-template-columns: repeat(4, auto); justify-content: start; gap: 8px 36px; margin-top: 20px; }
.doc-facts div { display: grid; gap: 2px; }
.doc-facts dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.doc-facts dd { margin: 0; font-weight: 550; }
.doc-body { padding: 28px 40px 36px; }
.intro { color: var(--ink-2); margin-bottom: 24px; font-size: 14.5px; line-height: 1.65; }

.items-head, .irow { display: grid; grid-template-columns: 28px minmax(0, 1fr) 70px 110px 120px; gap: 12px; align-items: start; }
.items-head { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 0 12px 10px; border-bottom: 1px solid var(--ink); }
.items-head span:nth-child(n+3) { text-align: right; }
.irow { padding: 14px 12px; border-bottom: 1px solid var(--line); }
.irow .ctl { padding-top: 2px; }
.irow .nm { font-weight: 600; }
.irow .ds { color: var(--muted); font-size: 13px; margin-top: 3px; line-height: 1.55; }
.irow .q, .irow .p, .irow .a { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.irow .a { font-weight: 600; }
.irow .p .muted { display: block; font-size: 12px; }
.irow input.qty { width: 64px; text-align: right; padding: 4px 6px; margin-top: -4px; }
.irow.excluded .nm, .irow.excluded .q, .irow.excluded .p { color: var(--faint); }
.irow.excluded .a { color: var(--faint); text-decoration: line-through; font-weight: 500; }
label.irow { cursor: pointer; transition: background .12s; }
label.irow:hover { background: #fafcff; }
.sec { padding: 26px 12px 8px; }
.sec h3 { font-size: 16px; font-weight: 650; color: var(--brand-700); }
.sec p { color: var(--muted); margin: 4px 0 0; font-size: 13px; }
.note-block { padding: 14px 12px; color: var(--ink-2); font-size: 13.5px; border-bottom: 1px solid var(--line); }
.cg { margin: 12px 0; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.cg-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; background: #fafbfd; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 13px; }
.cg .irow:last-child { border-bottom: 0; }
.cg .irow:has(input:checked) { background: var(--brand-50); }
.opt-tag { display: inline-block; margin-left: 6px; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: #b45309; background: var(--accent-50); padding: 1px 6px; border-radius: 4px; vertical-align: 1px; }

.totals { margin: 20px 0 0 auto; width: min(340px, 100%); display: grid; gap: 8px; font-variant-numeric: tabular-nums; }
.totals div { display: flex; justify-content: space-between; gap: 16px; }
.totals .grand { border-top: 2px solid var(--ink); padding-top: 10px; margin-top: 2px; font-size: 18px; font-weight: 700; }
.totals .dep { color: var(--muted); font-size: 13px; }
.terms { margin-top: 32px; padding-top: 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-2); line-height: 1.65; }
.terms h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stamp { display: inline-flex; gap: 8px; align-items: center; margin-top: 24px; padding: 10px 14px; border: 2px solid var(--ok); color: var(--ok); border-radius: 8px; font-weight: 700; }

.summary { padding: 20px; }
.summary .big { font-size: 30px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.summary .lbl { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.summary .rows { display: grid; gap: 6px; margin: 14px 0 18px; font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.summary .rows div { display: flex; justify-content: space-between; }
.summary .btn + .btn { margin-top: 8px; }
.contact-card { padding: 18px 20px; font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.contact-card strong { color: var(--ink); }

.panel { background: #fff; border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 28px 40px; }
.panel h2 { font-size: 18px; margin-bottom: 4px; }
.accept-panel { border-top: 4px solid var(--brand); }
.accept-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 16px; }
.choices { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 13px; color: var(--ink-2); }
.choices li { display: flex; justify-content: space-between; gap: 12px; }
.decline { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.decline summary { cursor: pointer; color: var(--muted); font-size: 13px; }
.sq-footer { text-align: center; font-size: 12px; color: var(--muted); padding: 8px 0 0; grid-column: 1 / -1; }
.sq-footer span { font-weight: 650; letter-spacing: .04em; color: var(--ink-2); }
.mbar { display: none; }

/* =================== Print / PDF =================== */
body.print { background: #fff; }
body.print .doc { box-shadow: none; border-radius: 0; max-width: 820px; margin: 0 auto; }
.print-note { max-width: 820px; margin: 16px auto; padding: 10px 14px; background: var(--brand-50); border-radius: var(--r); display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.print-footer { display: none; }
@media print {
  @page { size: A4; margin: 14mm 12mm 18mm; }
  body { font-size: 10pt; background: #fff; }
  .no-print { display: none !important; }
  .doc-top { padding: 0 0 16px; }
  .doc-top::before { display: none; }
  .doc-body { padding: 16px 0 0; }
  .irow, .sec, .cg { break-inside: avoid; }
  .items-head, .irow { grid-template-columns: 0 minmax(0, 1fr) 60px 100px 110px; }
  .irow .ctl { visibility: hidden; }
  .print-footer { display: block; position: fixed; bottom: 0; left: 0; right: 0; text-align: center; font-size: 8pt; color: #64748b; border-top: 1px solid #e4e9f0; padding-top: 4px; }
}

/* =================== Responsive =================== */
@media (max-width: 1080px) {
  .editor, .cq { grid-template-columns: 1fr; }
  .side, .cq-side { position: static; }
  .cq-side .summary { display: none; }
  .mbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: #fff; border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(15, 23, 42, .08); padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); align-items: center; justify-content: space-between; gap: 12px; }
  .mbar .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
  .mbar .big { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
  .settings { grid-template-columns: 1fr; }
  .settings nav { position: static; display: flex; flex-wrap: wrap; }
}
@media (max-width: 760px) {
  .nav-in { padding: 0 16px; gap: 12px; overflow-x: auto; }
  .nav-user span { display: none; }
  .page { padding: 20px 16px 48px; }
  .stats { grid-template-columns: 1fr; }
  .search { min-width: 0; width: 100%; }
  .q-cols { grid-template-columns: minmax(0, 1fr) auto; row-gap: 4px; padding: 10px 16px; }
  .q-cols .ref { grid-row: 1; grid-column: 1; font-size: 12px; }
  .q-cols .title-cell { grid-column: 1; }
  .q-cols .money { grid-row: 1; grid-column: 2; }
  .q-cols .pill { grid-column: 2; justify-self: end; }
  .q-cols .when { display: none; }
  .c-cols, .i-cols, .t-cols { grid-template-columns: minmax(0, 1fr) auto; padding: 10px 16px; }
  .c-cols > :nth-child(2), .c-cols > :nth-child(3), .i-cols > :nth-child(3), .t-cols > :nth-child(3) { display: none; }
  .list-head { display: none; }
  .li-head { display: none; }
  .li { grid-template-columns: 22px minmax(0, 1fr) 72px; padding: 12px; }
  .li .qty, .li .price { grid-row: 2; }
  .li .qty { grid-column: 2; justify-self: end; width: 70px; }
  .li .price { grid-column: 3; }
  .li .amount { grid-column: 2 / 4; grid-row: 3; }
  .li .li-tools { grid-column: 3; grid-row: 1; }
  .cq { padding: 12px 10px 110px; }
  .doc-top { padding: 24px 20px 20px; }
  .doc-body { padding: 16px 12px 24px; }
  .doc-from { text-align: left; }
  .doc-facts { grid-template-columns: repeat(2, auto); gap: 10px 24px; }
  .doc-title { font-size: 21px; }
  .items-head { display: none; }
  .irow { grid-template-columns: 26px minmax(0, 1fr) auto; row-gap: 4px; padding: 14px 8px; }
  .irow .q { grid-column: 2; text-align: left; color: var(--muted); font-size: 13px; }
  .irow .q::before { content: "Qty "; }
  .irow .p { display: none; }
  .irow .a { grid-column: 3; grid-row: 1; }
  .panel { padding: 22px 18px; }
  .accept-grid { grid-template-columns: 1fr; }
  .activity li { grid-template-columns: 1fr; gap: 0; }
}

/* Batch A */
.irow .code { display: inline-block; margin-right: 8px; font-size: 11.5px; font-weight: 600; color: var(--muted); background: #f1f5f9; border-radius: 4px; padding: 1px 6px; vertical-align: 1px; }
.banner-note .grow { flex: 1; }
.banner-note { align-items: center; flex-wrap: wrap; }
.menu-pop button[data-open] { font-weight: 500; }

/* Batch B */
.att-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.att-list li { display: flex; align-items: center; gap: 8px; }
.attachments { margin-top: 28px; padding-top: 18px; border-top: 1px solid var(--line); }
.attachments h2 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.attachments ul { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 6px; }
[data-text-pop] { min-width: 260px; max-height: 320px; overflow: auto; }
[data-text-pop] hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
@media print { .attachments a { color: inherit; text-decoration: none; } }

/* Batch C */
.cc-cols { grid-template-columns: 28px minmax(0, 1.4fr) minmax(0, 1.2fr) 140px 80px; }
.bulk-bar { display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--brand-50); border-bottom: 1px solid var(--brand-100); font-weight: 550; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips:empty { display: none; }
.chips .chip { height: auto; padding: 4px 8px; font-size: 12.5px; }
.chips .chip button { border: 0; background: none; cursor: pointer; font-size: 15px; line-height: 1; color: var(--muted); padding: 0 0 0 4px; }
.chart-card { padding: 18px 20px; margin-bottom: 24px; }
.chart-head { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.chart-kpis { display: flex; gap: 28px; flex-wrap: wrap; }
.chart-kpis .v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.chart-kpis .k { font-size: 12.5px; color: var(--muted); }
.chart-kpis .k i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: 3px; }
.chart-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.chart-controls select { width: auto; height: 32px; padding: 0 28px 0 10px; font-size: 13px; }
.chart svg { width: 100%; height: 200px; display: block; margin-top: 14px; }
.chart .grid line { stroke: var(--line); }
.chart .grid text, .chart .xl text { fill: var(--muted); font-size: 11px; }
@media (max-width: 760px) { .cc-cols { grid-template-columns: 28px minmax(0, 1fr) auto; } .cc-cols > :nth-child(3), .cc-cols > :nth-child(4) { display: none; } }

/* Batch D */
.team-row { padding-bottom: 14px; border-bottom: 1px solid var(--line); align-items: end; }
.team-row:last-of-type { border-bottom: 0; }
