/* Quote-to-Book Follow-up · paper and ink. Warm cream, forest green, highlighter yellow, coral for hot leads. */
:root {
  color-scheme: light;
  --bg: #f4eee2;
  --bg2: #ece4d3;
  --paper: #fffdf8;
  --ink: #1b2620;
  --ink2: #3a4840;
  --muted: #6c776f;
  --line: #ddd2bf;
  --line2: #cdbfa7;
  --forest: #1f6b4f;
  --forest2: #17573f;
  --forest-d: #e1eee6;
  --hl: #ffe36e;
  --hl-soft: #fff3b8;
  --coral: #e2573b;
  --coral-d: #fbe3db;
  --amber: #a86a12;
  --amber-d: #fbefd6;
  --blue: #2f5d8a;
  --blue-d: #e2ebf4;
  --serif: 'Fraunces', ui-serif, Georgia, serif;
  --sans: 'DM Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --top-h: 112px;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); }
body { color: var(--ink); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { display: block; }
.muted { color: var(--muted); }
h1, h2, h3, h4 { margin: 0; }
h1 { font: 600 30px/1.15 var(--serif); letter-spacing: -.01em; }
h2 { font: 600 17px/1.25 var(--serif); letter-spacing: -.005em; }
h2 .muted { font-weight: 400; }
.qtb { min-height: 100vh; background: radial-gradient(1000px 500px at 100% -200px, rgba(31, 107, 79, .08), transparent 70%), var(--bg); }

/* ---------- header ---------- */
.top { background: rgba(255, 253, 248, .75); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px); }
.top-row { max-width: 1680px; margin: 0 auto; padding: 12px 24px 6px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand .mark { width: 40px; height: 40px; border-radius: 11px; background: var(--forest); color: #fffdf8; display: grid; place-items: center; flex: none; box-shadow: 0 6px 16px -8px rgba(31, 107, 79, .7); }
.brand .mark svg { width: 26px; height: 26px; }
.brand b { display: block; font: 700 20px/1.1 var(--serif); letter-spacing: -.01em; }
.brand small { display: block; color: var(--muted); font-size: 12.5px; }
.brand small span { color: var(--ink2); font-weight: 600; }
.top-right { display: flex; align-items: center; gap: 14px; flex: none; }
.who { display: flex; align-items: center; gap: 9px; }
.who .av { width: 32px; height: 32px; border-radius: 50%; background: var(--bg2); border: 1px solid var(--line2); display: grid; place-items: center; font-size: 11.5px; font-weight: 700; color: var(--ink2); }
.who b { display: block; font-size: 13px; }
.who small { color: var(--muted); font-size: 11.5px; }
.switch { display: inline-flex; align-items: center; gap: 10px; padding: 5px 14px 5px 5px; border-radius: 999px; border: 1px solid var(--line2); background: var(--paper); font-weight: 600; font-size: 13px; }
.switch .knob { width: 38px; height: 22px; border-radius: 999px; background: var(--forest); position: relative; transition: background .2s; }
.switch .knob::after { content: ''; position: absolute; top: 3px; left: 19px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.switch.off .knob { background: #c7b99f; }
.switch.off .knob::after { left: 3px; }
.switch.off { color: var(--amber); }
.tabs { max-width: 1680px; margin: 0 auto; padding: 0 16px; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { position: relative; padding: 12px 12px; border: 0; background: none; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tabs button.on { color: var(--ink); }
.tabs button.on::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 3px; border-radius: 3px 3px 0 0; background: var(--forest); }
.count { display: inline-grid; place-items: center; min-width: 19px; height: 19px; padding: 0 5px; margin-left: 6px; border-radius: 999px; background: var(--bg2); color: var(--ink2); font-size: 11px; font-weight: 700; }
.count.hotc { background: var(--coral); color: #fff; }

.wrap { max-width: 1680px; margin: 0 auto; padding: 16px 24px 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line2); background: var(--paper); color: var(--ink); font-weight: 600; font-size: 13px; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { border-color: #b6a688; background: #fff; }
.btn svg { width: 15px; height: 15px; }
.btn.primary { background: var(--forest); border-color: var(--forest); color: #fff; }
.btn.primary:hover { background: var(--forest2); }
.btn.primary .sim { font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 999px; background: rgba(255, 255, 255, .18); }
.btn.coral { background: var(--coral); border-color: var(--coral); color: #fff; }
.btn.danger { color: var(--coral); border-color: rgba(226, 87, 59, .45); background: var(--coral-d); }
.btn.ghost { background: none; border-color: transparent; color: var(--ink2); }
.btn.ghost:hover { background: var(--bg2); }
.btn.sm { padding: 5px 10px; font-size: 12px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--forest); outline-offset: 2px; }
.link { border: 0; background: none; padding: 0; color: var(--forest); font-weight: 600; }
.tag { display: inline-flex; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line2); color: var(--ink2); font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--paper); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line2); background: var(--paper); border-radius: 999px; padding: 6px 12px; font-size: 12.5px; color: var(--ink2); text-align: left; }
.chip:hover { border-color: var(--forest); color: var(--forest); }
.chip:disabled { opacity: .45; cursor: wait; }

.ribbon { display: flex; align-items: center; gap: 12px; padding: 11px 16px; margin-bottom: 14px; border-radius: 12px; border: 1px solid #e5c98f; background: repeating-linear-gradient(135deg, rgba(168, 106, 18, .06) 0 10px, transparent 10px 20px), var(--amber-d); color: #6b4510; }
.ribbon > span { color: var(--amber); flex: none; }
.ribbon > span svg { width: 18px; height: 18px; }
.ribbon > div { flex: 1; min-width: 0; }

/* ---------- workspace ---------- */
.work { display: grid; grid-template-columns: 272px minmax(0, 1fr) minmax(0, 480px); gap: 16px; height: calc(100vh - var(--lab-bar-h, 0px) - var(--top-h) - 22px); min-height: 600px; }
.work > * { min-width: 0; min-height: 0; }
.pane-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.pane-h small { color: var(--muted); font-size: 12px; }
.pane-h h2 { display: flex; align-items: center; gap: 7px; }
.pane-h h2 svg { width: 17px; height: 17px; color: var(--forest); }
.panes-toggle { display: none; }

.elist { overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.ecards { display: flex; flex-direction: column; gap: 8px; }
.ecard { display: flex; flex-direction: column; gap: 3px; text-align: left; padding: 12px 13px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 253, 248, .6); transition: border-color .15s, background .15s, box-shadow .15s; min-width: 0; }
.ecard:hover { background: var(--paper); border-color: var(--line2); }
.ecard.on { background: var(--paper); border-color: var(--forest); box-shadow: 0 0 0 1px var(--forest), 0 8px 20px -14px rgba(31, 107, 79, .6); }
.ec-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ec-top b { font-size: 14px; }
.ec-mid { font: 500 14px var(--serif); color: var(--ink2); }
.ec-bot { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 11.5px; }
.ec-bot .ch svg { width: 14px; height: 14px; }
.nd { margin-left: auto; color: var(--forest); font-weight: 700; }
.spill { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.s-sent { background: var(--bg2); color: var(--ink2); }
.s-viewed { background: var(--blue-d); color: var(--blue); }
.s-q { background: var(--amber-d); color: var(--amber); border-color: #ecd29f; }
.s-hot { background: var(--coral); color: #fff; }
.s-ans { background: var(--forest-d); color: var(--forest); }
.s-book { background: var(--forest); color: #fff; }
.s-exp { background: var(--paper); color: var(--amber); border-color: #e4c27e; }
.s-off { background: var(--bg2); color: var(--amber); }

.thread { overflow-y: auto; padding: 16px 18px; border-radius: 16px; background: rgba(255, 253, 248, .7); border: 1px solid var(--line); scrollbar-width: thin; }
.th-h { position: sticky; top: -16px; margin: -16px -18px 12px; padding: 14px 18px 12px; background: rgba(250, 247, 240, .95); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); z-index: 2; align-items: center; }
.th-h small { display: block; }
.hotbar { display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 12px; border-radius: 12px; background: var(--coral-d); border: 1px solid #f1b6a6; }
.hotbar > span { color: var(--coral); }
.hotbar > span svg { width: 18px; height: 18px; }
.hotbar > div { flex: 1; min-width: 0; }
.hotbar b { display: block; color: #8f2f1b; font-size: 13px; }
.hotbar small { color: #9b4a37; font-size: 12px; }
.msgs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.sys { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 8px; text-align: center; color: var(--muted); font-size: 12px; padding: 2px 10px; }
.sys small { color: #9aa29b; }
.sys.hot { color: var(--coral); font-weight: 600; }
.sys .fl svg { width: 13px; height: 13px; }
.msg { max-width: 88%; display: flex; flex-direction: column; gap: 4px; }
.msg.customer { align-self: flex-start; }
.msg.ai, .msg.closer { align-self: flex-end; align-items: flex-end; }
.m-h { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.m-h b { color: var(--ink); font-size: 12.5px; }
.chn { display: inline-flex; align-items: center; gap: 3px; }
.chn svg { width: 13px; height: 13px; }
.bubble { padding: 10px 14px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); line-height: 1.55; font-size: 14px; }
.msg.customer .bubble { border-bottom-left-radius: 5px; }
.msg.ai .bubble { background: var(--forest); color: #f2f8f4; border-color: var(--forest); border-bottom-right-radius: 5px; }
.msg.closer .bubble { background: #2b3a32; color: #f2f5f3; border-color: #2b3a32; border-bottom-right-radius: 5px; }
.cite-i { display: inline-flex; align-items: center; vertical-align: 1px; margin: 0 1px; padding: 0 5px; height: 17px; border-radius: 5px; border: 0; background: var(--hl); color: #3d3200; font: 700 10.5px var(--sans); letter-spacing: .02em; }
.cite-i:hover { background: #ffd83a; }
.sources { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; justify-content: flex-end; }
.sources small { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; margin-right: 2px; }
.cite { border: 1px solid #ecd36a; background: var(--hl-soft); color: #4a3d00; border-radius: 7px; padding: 3px 8px; font-size: 11.5px; font-weight: 600; }
.cite:hover { background: var(--hl); }
.m-f { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11.5px; text-align: right; }
.m-f svg { width: 13px; height: 13px; color: var(--forest); flex: none; }

.drafting { display: flex; align-items: center; gap: 10px; justify-content: flex-end; margin: 12px 0; color: var(--forest); font-size: 13px; font-weight: 600; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--forest); animation: dot 1s infinite; }
.dots i:nth-child(2) { animation-delay: .15s; }
.dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dot { 0%, 100% { opacity: .25; } 50% { opacity: 1; } }

.draft { margin-top: 14px; padding: 14px; border-radius: 14px; border: 1.5px dashed #9cc2b1; background: linear-gradient(180deg, #f6fbf8, #eef6f1); display: flex; flex-direction: column; gap: 9px; animation: rise .35s ease-out; }
.draft.is-hot { border-color: #eeab98; background: linear-gradient(180deg, #fff8f5, #fdeee8); }
.draft.lit { box-shadow: 0 0 0 3px rgba(255, 227, 110, .55); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.d-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.d-h small { color: var(--muted); font-size: 12px; }
.d-h b { font-size: 14px; }
.dk { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px; background: var(--forest); color: #fff; font-size: 11.5px; font-weight: 700; }
.draft.is-hot .dk { background: var(--coral); }
.dk svg { width: 12px; height: 12px; }
.conf { margin-left: auto; font: 700 12px var(--sans); color: var(--forest); padding: 2px 8px; border-radius: 6px; background: var(--forest-d); font-variant-numeric: tabular-nums; }
.draft-b { background: var(--paper); border-style: solid; border-color: #c9dfd3; }
.answers { margin: 0; color: var(--ink2); font-size: 13px; font-style: italic; }
.answers small { font-style: normal; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; margin-right: 4px; }
.d-rule { margin: 0; display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.d-rule span svg { width: 12px; height: 12px; }
.d-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.draft .sources { justify-content: flex-start; }
.edit { width: 100%; min-height: 120px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line2); background: #fff; line-height: 1.5; resize: vertical; }
.hint { margin: -4px 0 0; color: var(--muted); font-size: 12px; }
.rej { padding: 10px; border-radius: 10px; background: var(--paper); border: 1px solid var(--line); }
.rej small { display: block; color: var(--muted); margin-bottom: 6px; }

.sim-box { margin-top: 18px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--bg); }
.sb-h { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 6px; margin-bottom: 8px; }
.sb-h small { font-weight: 700; color: var(--ink2); font-size: 12px; }
.sb-h .muted { font-size: 11.5px; }

/* ---------- estimate paper ---------- */
.docwrap { overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.paper { position: relative; background: var(--paper); border-radius: 6px; padding: 26px 26px 22px; box-shadow: 0 1px 0 var(--line), 0 18px 40px -26px rgba(60, 45, 20, .45), 0 2px 6px rgba(60, 45, 20, .06); font-size: 13px; }
.paper::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 5px; border-radius: 6px 6px 0 0; background: var(--forest); }
.p-head { display: flex; justify-content: space-between; gap: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.co { display: block; font: 700 17px var(--serif); color: var(--forest); }
.p-head small { color: var(--muted); font-size: 11.5px; line-height: 1.4; display: block; }
.p-meta { text-align: right; }
.p-meta b { display: block; font: 600 11px var(--sans); text-transform: uppercase; letter-spacing: .12em; color: var(--muted); }
.p-meta span { display: block; font: 600 16px var(--serif); }
.p-to { margin: 14px 0 6px; }
.p-to small { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.p-to b { display: block; font-size: 14px; }
.p-to span { color: var(--ink2); }
.p-title { font: 600 20px var(--serif); margin: 12px 0 4px; }
.p-scope { margin: 0 0 14px; color: var(--ink2); line-height: 1.55; }
.p-lines { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.p-lines th { text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 700; padding: 6px 6px; border-bottom: 1.5px solid var(--ink); }
.p-lines td { padding: 7px 6px; border-bottom: 1px solid var(--line); vertical-align: top; transition: background .2s; }
.p-lines td:first-child { width: 22px; color: var(--muted); font-weight: 700; }
.p-lines td:nth-child(3) { white-space: nowrap; color: var(--ink2); }
.p-lines .amt { text-align: right; width: 64px; color: #a59a86; }
.p-lines tfoot td { border-bottom: 0; font-weight: 700; padding-top: 9px; }
.p-note { margin: 6px 0 0; text-align: right; color: #a59a86; font-size: 11px; font-style: italic; }
.p-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-top: 14px; }
.p-cols h4 { font: 700 10.5px var(--sans); text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 6px; }
.p-terms { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.p-terms li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 4px; padding: 3px 4px; border-radius: 4px; line-height: 1.45; transition: background .2s; }
.p-terms li span { font-weight: 700; color: var(--muted); font-size: 11px; padding-top: 1px; }
.p-excl { margin: 0; padding: 3px 4px 3px 20px; border-radius: 4px; line-height: 1.5; transition: background .2s; }
.p-sign { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-top: 18px; color: #a59a86; font: italic 12px var(--serif); }
/* the highlighter */
.paper tr.hl td, .paper li.hl, .paper ul.hl { background: #ffe57a; }
.paper tr.hover td, .paper li.hover, .paper ul.hover { background: #fff0a8; }
.paper tr.hl td:first-child, .paper tr.hover td:first-child { color: #6b5300; box-shadow: inset 3px 0 0 #e9be1f; }
.paper li.hl, .paper ul.hl { box-shadow: inset 3px 0 0 #e9be1f; }
.flash { animation: flash .9s ease-out; }
@keyframes flash { 0% { box-shadow: 0 0 0 0 rgba(255, 210, 60, .9); } 100% { box-shadow: 0 0 0 10px rgba(255, 210, 60, 0); } }

.calendar { margin-top: 14px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); transition: background .2s, border-color .2s; }
.calendar.hl, .calendar.hover { border-color: #e8c84a; background: #fff6cc; box-shadow: inset 4px 0 0 var(--hl); }
.cal-h { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.cal-h b { font: 600 14px var(--serif); }
.cal-h small { color: var(--muted); font-size: 11.5px; }
.calendar ul { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.calendar li { padding: 8px 10px; border-radius: 9px; border: 1px solid var(--line); display: flex; flex-direction: column; }
.calendar li b { font-size: 13px; }
.calendar li span { font-size: 11px; color: var(--muted); }
.calendar li.op { background: var(--forest-d); border-color: #bcd8c9; }
.calendar li.op span { color: var(--forest); }
.calendar li.bk { background: repeating-linear-gradient(135deg, rgba(0, 0, 0, .03) 0 6px, transparent 6px 12px); }

/* ---------- other views ---------- */
.single { max-width: 1180px; margin: 0 auto; }
.single.narrow { max-width: 900px; }
.v-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 6px 0 18px; }
.v-head p { margin: 6px 0 0; max-width: 680px; }
.dgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.dgrid .draft { margin-top: 0; background: var(--paper); }
.dgrid .draft.is-hot { background: linear-gradient(180deg, #fffaf7, #fdf0ea); }
.empty { padding: 40px 24px; text-align: center; border: 1.5px dashed var(--line2); border-radius: 16px; background: rgba(255, 253, 248, .6); }
.empty b { font: 600 20px var(--serif); }
.hgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.hcard { padding: 18px; border-radius: 16px; background: var(--paper); border: 1px solid #f0c0b2; box-shadow: inset 4px 0 0 var(--coral); display: flex; flex-direction: column; gap: 10px; }
.hcard.claimed { box-shadow: inset 4px 0 0 var(--amber); border-color: #ecd29f; }
.hcard.booked { box-shadow: inset 4px 0 0 var(--forest); border-color: var(--line); opacity: .85; }
.h-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.h-top small { color: var(--muted); font-size: 12px; }
.hl-tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; background: var(--coral); color: #fff; font-size: 11.5px; font-weight: 700; }
.hl-tag svg { width: 12px; height: 12px; }
.claimed .hl-tag { background: var(--amber); }
.booked .hl-tag { background: var(--forest); }
.trig { display: flex; flex-wrap: wrap; gap: 6px; }
.trig span { padding: 3px 9px; border-radius: 7px; background: var(--coral-d); color: #8f2f1b; font-size: 12px; font-weight: 600; }
.booked .trig span { background: var(--bg2); color: var(--ink2); }
blockquote { margin: 0; padding: 10px 14px; border-left: 3px solid var(--line2); font: italic 400 15px/1.5 var(--serif); color: var(--ink2); background: var(--bg); border-radius: 0 10px 10px 0; }
.handoff { padding: 12px 14px; border-radius: 12px; background: var(--bg); }
.handoff small { font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; }
.handoff p { margin: 4px 0 0; }
.h-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.done { display: inline-flex; align-items: center; gap: 6px; color: var(--forest); font-weight: 700; font-size: 13px; }
.done svg { width: 16px; height: 16px; }

.rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rule { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--paper); }
.rule.off { opacity: .55; }
.rid { font: 700 12px var(--sans); color: var(--forest); }
.lock { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12px; font-weight: 600; }
.lock svg { width: 13px; height: 13px; }
.toggle { width: 42px; height: 24px; border-radius: 999px; border: 0; background: #cfc4ae; position: relative; padding: 0; }
.toggle span { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); }
.toggle.on { background: var(--forest); }
.toggle.on span { left: 21px; }
.offswitch { margin-top: 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px; border-radius: 14px; border: 1px solid #f0c0b2; background: linear-gradient(90deg, var(--coral-d), var(--paper)); }
.offswitch b { display: block; font: 600 16px var(--serif); }
.offswitch small { color: var(--ink2); }

.audit { list-style: none; margin: 0; padding: 4px 18px; border-radius: 16px; background: var(--paper); border: 1px solid var(--line); }
.audit li { display: grid; grid-template-columns: 150px 88px minmax(0, 1fr); gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: start; }
.audit li:last-child { border-bottom: 0; }
.audit .t { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; padding-top: 2px; }
.audit li > div b { display: block; font-size: 13px; }
.audit li > div span { color: var(--ink2); font-size: 13px; }
.ak { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; text-align: center; padding: 3px 0; border-radius: 6px; }
.ak.agent { background: var(--blue-d); color: var(--blue); }
.ak.human { background: var(--forest-d); color: var(--forest); }
.ak.override { background: var(--amber-d); color: var(--amber); }
.ak.closer { background: var(--coral-d); color: #a6391f; }
.ak.rule { background: #ede6fb; color: #5a3fa3; }
.ak.system { background: var(--bg2); color: var(--muted); }

.foot { max-width: 1680px; margin: 0 auto; padding: 14px 24px 30px; display: flex; align-items: center; justify-content: space-between; gap: 16px; color: var(--muted); font-size: 12px; }
.foot p { margin: 0; max-width: 820px; }

/* ---------- responsive ---------- */
@media (max-width: 1199px) {
  .work { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); height: auto; min-height: 0; }
  .elist { grid-column: 1 / -1; overflow: visible; padding: 0; }
  .ecards { flex-direction: row; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: thin; }
  .ecard { flex: 0 0 228px; }
  .thread, .docwrap { overflow: visible; }
  .th-h { position: static; }
}
@media (max-width: 899px) {
  :root { --top-h: 0px; }
  .work { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .panes-toggle { display: flex; padding: 4px; gap: 4px; border-radius: 12px; background: var(--bg2); border: 1px solid var(--line); }
  .panes-toggle button { flex: 1; border: 0; background: none; padding: 9px; border-radius: 9px; font-weight: 700; color: var(--muted); }
  .panes-toggle button.on { background: var(--paper); color: var(--ink); box-shadow: 0 1px 3px rgba(60, 45, 20, .12); }
  .panes-toggle .count { background: var(--hl); color: #4a3d00; }
  .work.pane-thread .docwrap, .work.pane-doc .thread { display: none; }
  .dgrid, .hgrid { grid-template-columns: minmax(0, 1fr); }
  .who { display: none; }
}
@media (max-width: 560px) {
  .top-row { padding: 12px 16px 4px; }
  .tabs { padding: 0 8px; }
  .wrap { padding: 12px 16px 6px; }
  .foot { padding: 12px 16px 28px; flex-direction: column; align-items: flex-start; }
  .brand .mark { width: 36px; height: 36px; }
  .brand b { font-size: 18px; }
  .switch { padding: 4px; }
  .switch .sw-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  h1 { font-size: 25px; }
  .v-head { flex-direction: column; align-items: flex-start; }
  .thread { padding: 14px 12px; }
  .msg { max-width: 94%; }
  .paper { padding: 22px 16px 18px; }
  .p-head { flex-direction: column; }
  .p-meta { text-align: left; }
  .p-cols { grid-template-columns: minmax(0, 1fr); }
  .p-lines td:nth-child(3) { white-space: normal; }
  .p-lines .amt { width: 34px; }
  .calendar ul { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .rule { grid-template-columns: 30px minmax(0, 1fr); }
  .rule .toggle, .rule .lock { grid-column: 2; justify-self: start; }
  .audit { padding: 4px 14px; }
  .audit li { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; }
  .audit .t { grid-column: 1; }
  .audit .ak { grid-column: 2; grid-row: 1; padding: 2px 8px; }
  .audit li > div { grid-column: 1 / -1; }
  .offswitch { flex-direction: column; align-items: stretch; }
  .ribbon { flex-wrap: wrap; }
  .d-actions .btn { flex: 1 1 auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}

.th-h h2 { display: block; }

/* ---------- list tools, toast, touch ---------- */
.etools { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.search { display: flex; align-items: center; gap: 8px; padding: 0 12px; height: 40px; border-radius: 11px; border: 1px solid var(--line2); background: var(--paper); color: var(--muted); }
.search:focus-within { border-color: var(--forest); box-shadow: 0 0 0 3px rgba(31, 107, 79, .15); }
.search svg { width: 16px; height: 16px; flex: none; }
.search input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--ink); font-size: 13.5px; }
.efilt { display: flex; flex-wrap: wrap; gap: 4px; }
.efilt button { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 253, 248, .6); font-size: 12px; font-weight: 600; color: var(--ink2); }
.efilt button i { font-style: normal; font-size: 10.5px; color: var(--muted); font-weight: 700; }
.efilt button.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.efilt button.on i { color: #c9d3cd; }
.e-empty { padding: 14px; border: 1.5px dashed var(--line2); border-radius: 12px; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.toast { position: fixed; left: 50%; bottom: 22px; z-index: 60; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; max-width: calc(100vw - 32px); padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #f4efe4; font: 500 13.5px/1.4 var(--sans); box-shadow: 0 18px 40px -14px rgba(27, 38, 32, .6); transition: opacity .2s, transform .2s; }
.toast.on { opacity: 1; transform: translate(-50%, 0); }
html.lab-capture .toast { display: none; }
@media (min-width: 1700px) { .work { grid-template-columns: 300px minmax(0, 1fr) minmax(0, 560px); } }
@media (max-width: 1199px) { .etools { flex-direction: row; flex-wrap: wrap; align-items: center; } .search { flex: 1 1 240px; } }
@media (pointer: coarse), (max-width: 640px) {
  .btn, .btn.sm, .chip, .tabs button, .panes-toggle button, .efilt button, .switch, .link, .cite { min-height: 44px; }
  .link, .cite { display: inline-flex; align-items: center; }
  .search { height: 44px; }
  .cite-i { position: relative; }
  .cite-i::after { content: ''; position: absolute; inset: -13px -4px; }
  .toggle { position: relative; }
  .toggle::before { content: ''; position: absolute; inset: -10px -6px; }
  .ecard { min-height: 44px; }
}

/* phones: fade the right edge of the scrolling nav so it reads as scrollable */
@media (max-width: 560px) { .tabs { -webkit-mask-image: linear-gradient(90deg, #000 86%, transparent); mask-image: linear-gradient(90deg, #000 86%, transparent); padding-right: 28px; } }
