/* Books Review Queue: ledger paper, deep teal ink, amber for "needs you", violet for client questions. */
:root {
  color-scheme: light;
  --bg: #f3f2ec;
  --card: #ffffff;
  --card-2: #f8f7f2;
  --ink: #16212a;
  --ink-2: #34424d;
  --muted: #5e6a72;
  --dim: #8b949a;
  --line: #e3e1d7;
  --line-2: #cfccbf;
  --teal: #0f4f4c;
  --teal-2: #17706b;
  --teal-soft: #e1efeb;
  --amber: #9a5b00;
  --amber-2: #f2c14e;
  --amber-soft: #fbefd5;
  --red: #a3302a;
  --red-soft: #f8e3e0;
  --violet: #5b3fa0;
  --violet-soft: #ece6f8;
  --blue: #285a8c;
  --blue-soft: #e3edf7;
  --green: #22703f;
  --green-soft: #e2f2e7;
  --r: 12px;
  --serif: "Source Serif 4", Georgia, serif;
  --sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow: 0 1px 0 rgba(20, 30, 40, .03), 0 10px 28px rgba(20, 30, 40, .06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 14.5px/1.55 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; min-height: 100vh;
  background-image: repeating-linear-gradient(180deg, transparent 0 31px, rgba(15, 79, 76, .035) 31px 32px); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.small { font-size: 12.5px; }
.dim { color: var(--dim); }
.muted { color: var(--muted); }
h1, h2, h3, p { margin: 0; }
.wrap { width: 100%; max-width: 1480px; margin: 0 auto; padding: 0 28px; }
:focus-visible { outline: 2px solid var(--teal-2); outline-offset: 2px; }
svg { flex: none; }

/* ── Header ── */
.top { position: sticky; top: var(--lab-bar-h, 0px); z-index: 30; background: rgba(243, 242, 236, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); border-bottom: 1px solid var(--line-2); }
.top-row { display: flex; align-items: center; gap: 16px; padding: 12px 0 6px; }
.brand { display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; }
.mark { width: 40px; height: 40px; border-radius: 10px; background: var(--teal); color: #cfe6df; display: grid; place-items: center; flex: none; }
.mark svg { width: 30px; height: 30px; }
.brand-txt { min-width: 0; }
.brand-name { font: 600 20px/1.15 var(--serif); letter-spacing: -.01em; }
.brand-sub { font-size: 12.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me { display: flex; align-items: center; gap: 10px; flex: none; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--amber-soft); color: var(--amber); display: grid; place-items: center; font: 600 12px/1 var(--mono); }
.me-txt { display: flex; flex-direction: column; line-height: 1.2; }
.me-txt b { font-size: 13px; }
.me-txt small { font-size: 11.5px; color: var(--muted); }
.tabs { display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin: 0 -4px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 44px; border: 0; background: none; padding: 8px 12px; font-weight: 600; font-size: 13.5px; color: var(--muted); border-bottom: 2px solid transparent; }
.tabs button:hover { color: var(--ink); }
.tabs button[aria-current="page"] { color: var(--ink); border-bottom-color: var(--teal); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 99px; background: var(--amber-soft); color: var(--amber); font: 600 11px/20px var(--mono); text-align: center; }

/* ── Shared ── */
.main { padding: 26px 0 96px; }
.eyebrow { font: 500 11px/1.4 var(--mono); letter-spacing: .07em; text-transform: uppercase; color: var(--dim); }
.h-view { font: 600 30px/1.15 var(--serif); letter-spacing: -.015em; margin-top: 4px; }
.h-card { font: 600 18px/1.3 var(--serif); }
.h-detail { font: 600 24px/1.2 var(--serif); margin-top: 2px; overflow-wrap: anywhere; }
.h-sub { display: block; font: 600 12px/1.4 var(--sans); letter-spacing: .04em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 8px; }
.lede { margin-top: 6px; color: var(--muted); max-width: 72ch; }
.view-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 20px; }
.vh-tools { display: flex; gap: 10px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--shadow); min-width: 0; }
.pad { padding: 20px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--card); color: var(--ink); font-weight: 600; font-size: 13.5px; transition: background .15s, border-color .15s, color .15s; text-align: center; }
.btn svg { width: 16px; height: 16px; }
.btn:hover:not(:disabled) { border-color: var(--ink-2); }
.btn.primary { background: var(--teal); border-color: var(--teal); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--teal-2); border-color: var(--teal-2); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover:not(:disabled) { background: var(--card-2); border-color: var(--line); }
.btn.sm { min-height: 38px; padding: 7px 12px; font-size: 13px; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--teal-2); font-weight: 600; text-decoration: underline; cursor: pointer; }
select, input[type="search"], input:not([type]), textarea { min-height: 44px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--card); padding: 8px 12px; font-size: 14px; max-width: 100%; }
select:hover, input:hover, textarea:hover { border-color: var(--ink-2); }
.picker select { min-width: 240px; font-weight: 600; }
.sortby { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }
.sortby select { min-height: 38px; padding: 6px 10px; font-size: 13px; }

.pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 10px; border-radius: 99px; font: 600 12px/1.4 var(--sans); white-space: nowrap; }
.pill i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.t-me { background: var(--amber-soft); color: var(--amber); }
.t-wait { background: var(--violet-soft); color: var(--violet); }
.t-ready { background: var(--blue-soft); color: var(--blue); }
.t-done { background: var(--green-soft); color: var(--green); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 6px; font: 600 11px/1.5 var(--sans); white-space: nowrap; background: var(--card-2); color: var(--ink-2); border: 1px solid var(--line); }
.f-low { background: var(--amber-soft); color: var(--amber); border-color: #f0dcae; }
.f-new { background: var(--blue-soft); color: var(--blue); border-color: #c9dbee; }
.f-unusual { background: #fdeee0; color: #9a4a06; border-color: #f2d2b2; }
.f-personal { background: var(--red-soft); color: var(--red); border-color: #efc8c3; }
.f-tax { background: #eef3d9; color: #586b0c; border-color: #d9e3b0; }
.f-receipt { background: #efedf1; color: #5a5267; border-color: #dcd8e2; }
.f-answered, .f-asked { background: var(--violet-soft); color: var(--violet); border-color: #d9cff0; }
.f-moved { background: var(--teal-soft); color: var(--teal); border-color: #c6e0d9; }
.conf { display: inline-block; min-width: 42px; padding: 1px 6px; border-radius: 6px; text-align: center; font: 600 12px/1.6 var(--mono); }
.conf.hi { background: var(--green-soft); color: var(--green); }
.conf.mid { background: var(--amber-soft); color: var(--amber); }
.conf.lo { background: var(--red-soft); color: var(--red); }
.meter { position: relative; display: block; height: 8px; border-radius: 99px; background: var(--card-2); border: 1px solid var(--line); margin: 8px 0 2px; }
.meter i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; }
.meter.hi i { background: var(--green); }
.meter.mid i { background: #d8951c; }
.meter.lo i { background: var(--red); }
.meter b { position: absolute; top: -5px; bottom: -5px; width: 2px; background: var(--ink); border-radius: 2px; }
.empty { padding: 34px 20px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); }
.empty b { color: var(--ink); font-size: 15px; }
.big-check { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--green-soft); color: var(--green); }
.big-check svg { width: 24px; height: 24px; }
.empty-detail { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 48px 24px; }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 60; transform: translate(-50%, 16px); width: max-content; max-width: min(520px, calc(100vw - 32px)); background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; font-size: 13.5px; box-shadow: 0 16px 40px rgba(0, 0, 0, .25); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast small { display: block; font-weight: 400; color: #c8d2d6; margin-top: 2px; font-size: 12.5px; }
.foot { margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--line-2); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; color: var(--dim); font-size: 12.5px; }
.foot span:last-child { max-width: 70ch; }

/* ── Dashboard ── */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi b { font: 600 30px/1.15 var(--serif); }
.kpi b em { font-style: normal; color: var(--dim); font-size: 20px; }
.kpi small { color: var(--dim); font-size: 12px; }
.kbar { display: block; height: 6px; border-radius: 99px; background: var(--card-2); border: 1px solid var(--line); margin: 4px 0 4px; overflow: hidden; }
.kbar i { display: block; height: 100%; background: var(--teal-2); }
.dash { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.seg { display: flex; flex-wrap: wrap; gap: 4px; }
.seg button { min-height: 36px; border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 5px 12px; font-size: 13px; font-weight: 600; color: var(--muted); }
.seg button:hover { color: var(--ink); border-color: var(--line-2); }
.seg button[aria-pressed="true"] { background: var(--teal); border-color: var(--teal); color: #fff; }
.crow { display: grid; grid-template-columns: minmax(180px, 1.4fr) minmax(170px, 1fr) minmax(170px, 1fr) 64px 130px; gap: 14px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.crow:last-child { border-bottom: 0; }
.crow:not(.chead):hover { background: var(--card-2); }
.chead { padding-top: 10px; padding-bottom: 10px; font: 600 11px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--dim); background: var(--card-2); }
.cname { display: flex; flex-direction: column; min-width: 0; }
.cname b { font-size: 14.5px; }
.cname small, .cprog small { color: var(--muted); font-size: 12px; }
.cprog { display: flex; flex-direction: column; gap: 6px; }
.stages { display: grid; grid-template-columns: repeat(6, 1fr); gap: 3px; max-width: 220px; }
.stages i { height: 8px; border-radius: 3px; background: var(--line); }
.stages i.on { background: var(--teal-2); }
.cdue { font-size: 13px; color: var(--ink-2); }
.cact { text-align: right; }
.cact .btn svg { width: 14px; height: 14px; }
.act .h-card { margin-bottom: 10px; }
.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.log li { display: grid; grid-template-columns: 12px 1fr; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.log li:last-child { border-bottom: 0; }
.log li > i { width: 9px; height: 9px; border-radius: 50%; margin-top: 6px; background: var(--teal-2); }
.log .w-staff > i { background: var(--amber); }
.log .w-client > i { background: var(--violet); }
.log small { display: block; color: var(--muted); font-size: 12px; margin-top: 2px; }

/* ── Queue ── */
.qtabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin-bottom: 14px; }
.qtabs::-webkit-scrollbar { display: none; }
.qtabs button { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); font-weight: 600; font-size: 13.5px; color: var(--muted); }
.qtabs button span { font: 600 12px/1 var(--mono); padding: 4px 7px; border-radius: 6px; background: var(--card-2); color: var(--ink-2); }
.qtabs button[aria-selected="true"] { border-color: var(--teal); color: var(--ink); box-shadow: inset 0 0 0 1px var(--teal); }
.qtabs button[aria-selected="true"] span { background: var(--teal); color: #fff; }
.qlayout { display: grid; grid-template-columns: minmax(340px, 420px) minmax(0, 1fr); gap: 18px; align-items: start; }
.qside { overflow: hidden; }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 14px 0; }
.fchips button { min-height: 34px; border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 4px 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.fchips button b { font-family: var(--mono); font-weight: 600; margin-left: 2px; color: var(--ink-2); }
.fchips button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.fchips button[aria-pressed="true"] b { color: #fff; }
.qtools { display: flex; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.search { flex: 1; min-width: 0; position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 11px; width: 16px; height: 16px; color: var(--dim); pointer-events: none; }
.search input { width: 100%; padding-left: 34px; }
.qlist { display: flex; flex-direction: column; }
.qrow { display: flex; justify-content: space-between; gap: 12px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--line); background: var(--card); padding: 12px 14px; border-left: 3px solid transparent; min-height: 64px; }
.qrow:not(.static):hover { background: var(--card-2); }
.qrow.sel { background: var(--teal-soft); border-left-color: var(--teal); }
.qr-l { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.qr-l b { font-size: 14px; overflow-wrap: anywhere; }
.qr-l small { font-size: 11.5px; color: var(--muted); }
.qr-r { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; text-align: right; flex: none; max-width: 48%; }
.amt { font-weight: 600; font-size: 14px; }
.amt.in, .d-amt.in { color: var(--green); }
.sugg, .done-cat { font-size: 12.5px; color: var(--ink-2); }
.qr-r small { font-size: 11.5px; color: var(--muted); }
.auto-note { display: flex; gap: 8px; padding: 12px 14px; background: var(--teal-soft); color: var(--teal); font-size: 12.5px; border-bottom: 1px solid var(--line); }
.auto-note svg { width: 14px; height: 14px; margin-top: 3px; }
.more { padding: 12px 14px; color: var(--dim); font-size: 12.5px; text-align: center; }
.mini { list-style: none; padding: 0; margin: 12px 0 16px; }
.mini li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.mini li span { color: var(--muted); text-align: right; }
.empty.ok .big-check { margin-bottom: 4px; }

.detail { overflow: hidden; }
.d-top { padding: 18px 20px 14px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 12px; }
.backbtn { align-self: flex-start; margin-left: -8px; }
.backbtn svg { width: 16px; height: 16px; }
.d-title { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; }
.d-title > div { min-width: 0; }
.raw { font-size: 12px; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.d-amt { font: 600 26px/1.1 var(--mono); text-align: right; white-space: nowrap; }
.d-amt small { display: block; font: 500 10.5px/1.6 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.state-bar { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 12px; border-radius: 10px; font-size: 13px; }
.state-bar > svg { width: 16px; height: 16px; }
.state-bar > span { flex: 1; min-width: 0; }
.state-bar.ok { background: var(--green-soft); color: var(--green); }
.state-bar.wait { background: var(--violet-soft); color: var(--violet); }
.state-bar .btn { color: inherit; }
.d-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(260px, .85fr); }
.d-main { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.d-side { padding: 18px 20px 20px; background: var(--card-2); border-left: 1px solid var(--line); min-width: 0; }
.why ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.why li { display: flex; gap: 10px; align-items: baseline; font-size: 13.5px; }
.why li .chip { flex: none; }
.sug { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: linear-gradient(180deg, #fbfdfc, #fff); }
.sug-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ai-tag { display: inline-flex; align-items: center; gap: 6px; font: 600 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--teal); }
.ai-tag svg { width: 13px; height: 13px; }
.sug-cat { font: 600 20px/1.3 var(--serif); margin-top: 8px; }
.sug-why { margin-top: 10px; font-size: 13.5px; color: var(--ink-2); }
.alts { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; font-size: 12.5px; }
.alts > span:first-child { color: var(--dim); margin-right: 2px; }
.alt { padding: 2px 8px; border-radius: 6px; background: var(--card-2); border: 1px solid var(--line); }
.alt b { font-weight: 500; color: var(--muted); }
.taxnote { margin-top: 10px; padding: 8px 10px; border-radius: 8px; background: #f4f7e6; color: #4c5c0a; font-size: 12.5px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.change { border: 1px dashed var(--line-2); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--card-2); }
.change > label:first-child { font-weight: 600; font-size: 13px; }
.cb { display: flex; gap: 8px; align-items: flex-start; font-size: 13px; color: var(--ink-2); min-height: 32px; }
.cb input { width: 18px; height: 18px; margin-top: 1px; accent-color: var(--teal); flex: none; }
.change .row { display: flex; gap: 8px; flex-wrap: wrap; }
.mini-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.mini-t td { padding: 7px 0; border-bottom: 1px solid var(--line); }
.mini-t td:first-child { width: 70px; color: var(--muted); font-size: 12px; }
.num { text-align: right; white-space: nowrap; }
.rcpt { position: relative; background: #fffef9; border: 1px solid var(--line); border-radius: 4px; padding: 16px 16px 20px; box-shadow: 0 2px 10px rgba(0,0,0,.05); font-size: 12.5px; border-top: 3px solid var(--teal); }
.r-v { font: 600 15px/1.3 var(--serif); text-align: center; }
.r-d { text-align: center; color: var(--muted); font-size: 11px; margin: 2px 0 10px; overflow-wrap: anywhere; }
.rcpt table { width: 100%; border-collapse: collapse; }
.rcpt td { padding: 4px 0; vertical-align: top; }
.rcpt td:first-child { padding-right: 10px; }
.rcpt tr.sub td { border-top: 1px dashed var(--line-2); padding-top: 8px; }
.rcpt tr.tot td { border-top: 1px solid var(--ink-2); font-weight: 700; padding-top: 6px; font-size: 13.5px; }
.warn { color: #9a4a06; font-family: var(--sans); font-weight: 600; }
.checks { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-direction: column; gap: 6px; }
.checks li { display: grid; grid-template-columns: 18px 64px 1fr; grid-template-rows: auto auto; column-gap: 6px; align-items: center; font-size: 12.5px; }
.checks li svg { width: 15px; height: 15px; color: var(--green); grid-row: span 2; }
.checks li.near svg { color: var(--amber); }
.checks li span { color: var(--muted); }
.checks li b { font-weight: 600; }
.checks li small { grid-column: 2 / 4; color: var(--dim); font-size: 11.5px; overflow-wrap: anywhere; }
.norcpt { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 16px; border: 1px dashed var(--line-2); border-radius: 12px; font-size: 13px; color: var(--muted); }
.norcpt svg { width: 22px; height: 22px; color: var(--dim); }
.norcpt b { color: var(--ink); }

/* ── Ask the client ── */
.asklayout { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; }
.msglist { padding: 8px 0; }
.mgroup { padding: 10px 14px; }
.mgroup .eyebrow { margin-bottom: 6px; }
.mrow { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; width: 100%; text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 10px; padding: 10px 12px; margin-bottom: 6px; }
.mrow:hover { border-color: var(--line-2); background: var(--card-2); }
.mrow.sel { border-color: var(--teal); box-shadow: inset 0 0 0 1px var(--teal); }
.mrow small { color: var(--muted); font-size: 12px; }
.mrow .pill { margin-top: 4px; }
.composer { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.cmp-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.mhead { margin: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.mhead div { display: grid; grid-template-columns: 72px 1fr; gap: 10px; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13px; }
.mhead div:last-child { border-bottom: 0; }
.mhead dt { color: var(--dim); font-weight: 600; }
.mhead dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.mitems { display: flex; flex-direction: column; gap: 6px; }
.mitem { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--card-2); }
.mitem > span:first-child { display: flex; flex-direction: column; flex: 1; min-width: 160px; }
.mitem small { color: var(--muted); font-size: 12px; }
.mitem .btn svg { width: 14px; height: 14px; }
textarea { width: 100%; resize: vertical; line-height: 1.55; padding: 12px 14px; font-size: 14px; }
.mread { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--card-2); font-size: 14px; overflow-wrap: anywhere; }
.reply { padding: 14px; border-radius: 10px; background: var(--violet-soft); border: 1px solid #d9cff0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.reply .h-sub { color: var(--violet); margin-bottom: 2px; }
.sendnote { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--muted); }
.sendnote svg { width: 14px; height: 14px; margin-top: 2px; }

/* ── Close ── */
.banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; margin-bottom: 16px; font-size: 13.5px; }
.banner > svg { width: 18px; height: 18px; }
.banner > span { flex: 1; }
.banner.ok { background: var(--green-soft); color: var(--green); border: 1px solid #c4e3cd; }
.closegrid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.prog-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.pbar { height: 8px; border-radius: 99px; background: var(--card-2); border: 1px solid var(--line); margin: 10px 0 6px; overflow: hidden; }
.pbar i { display: block; height: 100%; background: var(--teal-2); transition: width .3s; }
.cl { list-style: none; padding: 0; margin: 0; }
.cl li { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cl li:last-child { border-bottom: 0; }
.cl li > div { display: flex; flex-direction: column; min-width: 0; }
.cl li b { font-size: 14px; }
.cl li small { color: var(--muted); font-size: 12.5px; }
.tick { width: 24px; height: 24px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; color: #fff; }
.tick svg { width: 14px; height: 14px; }
.cl li.done .tick { background: var(--green); border-color: var(--green); }
.cl li.done b { color: var(--ink-2); }
.by { font: 500 11px/1.3 var(--mono); color: var(--dim); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
.recon { display: flex; flex-direction: column; gap: 12px; margin-top: 14px; }
.racct { border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.racct.ok { background: #f6fbf7; border-color: #cfe7d6; }
.ra-h { display: flex; justify-content: space-between; gap: 10px; align-items: center; flex-wrap: wrap; }
.racct dl { margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.racct dt { font-size: 11.5px; color: var(--dim); font-weight: 600; }
.racct dd { margin: 0; font-size: 14px; font-weight: 600; white-space: nowrap; }
.racct dd.bad { color: var(--red); }
.racct .btn { align-self: flex-start; }
.closebox { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.closebox .btn svg { width: 16px; height: 16px; }

/* ── Rules ── */
.rulesgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.span2 { grid-column: span 2; }
.linev { font-size: 26px; font-weight: 600; color: var(--teal); }
.linewrap { margin: 18px 0 8px; position: relative; }
.linewrap input[type="range"] { width: 100%; margin: 0; height: 44px; accent-color: var(--teal); position: relative; z-index: 2; background: transparent;
  /* The range covers 0.70 to 0.98 of a 0.50 to 1.00 axis */
  margin-left: 40%; width: 56%; }
.dots { position: relative; height: 34px; border-radius: 8px; background: var(--card-2); border: 1px solid var(--line); margin-top: 2px; }
.dots i { position: absolute; top: 50%; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--teal-2); opacity: .75; }
.dots i.u { background: var(--amber-2); opacity: 1; }
.dots i.h { background: #e0712c; opacity: 1; }
.dots b { position: absolute; top: -6px; bottom: -6px; width: 2px; background: var(--ink); }
.axis { display: flex; justify-content: space-between; font-size: 11px; color: var(--dim); margin-top: 4px; }
.line-stats { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.line-stats b { font: 600 20px/1 var(--serif); }
.setting { display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.setting:last-of-type { border-bottom: 0; }
.lbl { display: flex; flex-direction: column; min-width: 0; }
.lbl b { font-size: 14px; }
.lbl span { font-size: 12.5px; color: var(--muted); }
.lbl .aff { color: var(--teal-2); font-weight: 600; margin-top: 2px; }
.locked { display: inline-flex; align-items: center; gap: 6px; font: 600 12px/1 var(--sans); color: var(--muted); white-space: nowrap; padding: 6px 10px; border-radius: 99px; background: var(--card-2); border: 1px solid var(--line); }
.locked svg { width: 13px; height: 13px; }
.switch { display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; padding: 0; min-width: 52px; min-height: 44px; flex: none; }
.switch .track { position: relative; width: 44px; height: 24px; border-radius: 99px; background: var(--line-2); transition: background .2s; }
.switch .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch[aria-checked="true"] .track { background: var(--teal-2); }
.switch[aria-checked="true"] .track::after { transform: translateX(20px); }
.vtable { margin: 12px 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.vrow { display: grid; grid-template-columns: minmax(160px, 1.3fr) minmax(140px, 1fr) minmax(130px, 1fr) 60px 110px; gap: 12px; align-items: center; padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.vrow:last-child { border-bottom: 0; }
.vrow > span { min-width: 0; }
.vrow b { display: block; }
.vrow small { color: var(--muted); font-size: 11.5px; }
.vhead { background: var(--card-2); font: 600 11px/1.3 var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--dim); padding: 10px 12px; }
.vrow .btn svg { width: 14px; height: 14px; }
.vadd { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr) minmax(0, 1fr) auto; gap: 10px; align-items: end; margin-bottom: 8px; }
.vadd label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--muted); min-width: 0; }
.vadd input, .vadd select { width: 100%; }

/* ── Responsive ── */
@media (min-width: 1700px) { .wrap { max-width: 1640px; } .dash { grid-template-columns: minmax(0, 1fr) 400px; } .qlayout { grid-template-columns: 460px minmax(0, 1fr); } }
@media (max-width: 1280px) {
  .crow { grid-template-columns: minmax(170px, 1.3fr) minmax(150px, 1fr) minmax(160px, 1fr) 56px 120px; }
  .d-grid { grid-template-columns: 1fr; }
  .d-side { border-left: 0; border-top: 1px solid var(--line); }
}
@media (max-width: 1100px) {
  .dash { grid-template-columns: 1fr; }
  .closegrid { grid-template-columns: 1fr; }
  .asklayout { grid-template-columns: 280px minmax(0, 1fr); }
}
@media (max-width: 1020px) {
  .qlayout { grid-template-columns: 1fr; }
  .qlayout.has-sel .qside { display: none; }
  .qlayout:not(.has-sel) .qdetail { display: none; }
  .d-grid { grid-template-columns: minmax(0, 1.1fr) minmax(240px, .9fr); }
  .d-side { border-left: 1px solid var(--line); border-top: 0; }
}
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chead { display: none; }
  .crow { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name act" "prog prog" "next due"; gap: 10px 12px; padding: 14px 16px; }
  .cname { grid-area: name; } .cprog { grid-area: prog; } .cnext { grid-area: next; } .cdue { grid-area: due; text-align: right; } .cact { grid-area: act; }
  .stages { max-width: none; }
  .rulesgrid { grid-template-columns: 1fr; }
  .span2 { grid-column: auto; }
  .vhead { display: none; }
  .vrow { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "v x" "c c" "f u"; gap: 4px 12px; padding: 12px; }
  .vrow > span:nth-child(1) { grid-area: v; } .vrow > span:nth-child(2) { grid-area: c; } .vrow > span:nth-child(3) { grid-area: f; color: var(--muted); font-size: 12.5px; } .vrow > span:nth-child(4) { grid-area: u; text-align: right; color: var(--muted); font-size: 12.5px; } .vrow > span:nth-child(5) { grid-area: x; }
  .vrow > span:nth-child(2)::before { content: "→ "; color: var(--dim); }
  .vadd { grid-template-columns: 1fr 1fr; }
  .vadd label:first-child { grid-column: span 2; }
  .asklayout { grid-template-columns: 1fr; }
  .msglist { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .wrap { padding: 0 16px; }
  .me-txt { display: none; }
  .h-view { font-size: 26px; }
  .main { padding-top: 20px; }
  .view-head { margin-bottom: 16px; }
  .vh-tools, .picker, .picker select { width: 100%; }
  .picker select { min-width: 0; }
  .d-grid { grid-template-columns: 1fr; }
  .d-side { border-left: 0; border-top: 1px solid var(--line); }
  .msglist { display: block; }
  .cl li { grid-template-columns: 26px minmax(0, 1fr) auto; }
  .cl li .by { display: none; }
  .cl li .btn { grid-column: 2 / 4; justify-self: start; }
  .cl li:has(.btn) { grid-template-columns: 26px minmax(0, 1fr); }
}
@media (max-width: 560px) {
  .kpis { gap: 10px; }
  .kpi { padding: 12px 14px; }
  .kpi b { font-size: 24px; }
  .brand-sub { font-size: 11.5px; }
  .d-top, .d-main, .d-side { padding-left: 16px; padding-right: 16px; }
  .d-title { flex-direction: column; gap: 6px; }
  .d-amt { text-align: left; }
  .actions .btn { flex: 1 1 100%; }
  .composer { padding: 16px; }
  .racct dl { grid-template-columns: 1fr 1fr; }
  .racct dl div:last-child { grid-column: span 2; }
  .vadd { grid-template-columns: 1fr; }
  .vadd label:first-child { grid-column: auto; }
  .qr-r { max-width: 46%; }
  .card-head { padding: 12px; }
  .crow .cact .btn { padding: 6px 10px; }
  .mhead div { grid-template-columns: 1fr; gap: 0; }
  .banner { flex-wrap: wrap; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
/* The shared routing drawer sets display:flex, which overrides [hidden]; keep its shadow off-screen while closed */
.lr-panel[hidden], .lr-scrim[hidden] { display: none; }
