:root {
  /* light chrome ramp */
  --bg: #d9dde2;
  --chrome: #eceef1;
  --chrome-hi: #f5f6f8;
  --panel: #f1f2f4;
  --surface: #ffffff;
  --surface-2: #f3f4f6;
  --hover: #e1e5ea;
  --press: #d4d9e0;
  /* lines */
  --line: #d3d8de;
  --line-2: #c2c8d0;
  /* text */
  --text: #232a33;
  --text-dim: #5b6470;
  --text-faint: #8b93a0;
  /* canvas */
  --canvas: #6c7480;
  /* brand / accents */
  --accent: #1f6fd6;
  --accent-hi: #2b7ee8;
  --accent-press: #195cb4;
  --brand-a: #2f7bff;
  --brand-b: #10a87a;
  --ok: #0e9384;
  --warn: #d97706;
  --danger: #dc2626;
  --shadow: 0 2px 8px rgba(40, 50, 70, .14);
  --shadow-page: 0 10px 34px rgba(20, 30, 50, .35);
  --shadow-lg: 0 18px 50px rgba(20, 30, 50, .3);
}

* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg); color: var(--text);
  font-size: 13px; user-select: none;
  -webkit-font-smoothing: antialiased;
}
#app { display: flex; flex-direction: column; height: 100vh; }
button { font-family: inherit; }

/* ---- Brand ---- */
.brand { display: flex; align-items: center; gap: 9px; padding: 0 6px 0 2px; }
.brand-mark { width: 26px; height: 26px; border-radius: 7px; flex: 0 0 auto; box-shadow: 0 1px 4px rgba(0,0,0,.25); }
.brand-name {
  font-size: 15px; font-weight: 700; letter-spacing: -.01em;
  background: linear-gradient(95deg, var(--brand-a), var(--brand-b));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* ---- Toolbar ---- */
#toolbar {
  display: flex; align-items: center; gap: 3px;
  padding: 6px 12px; min-height: 46px; flex: 0 0 auto;
  background: linear-gradient(180deg, var(--chrome-hi), var(--chrome));
  border-bottom: 1px solid var(--line-2);
}
.tb-group { display: flex; align-items: center; gap: 3px; }
.tb-sep { width: 1px; height: 22px; background: var(--line-2); margin: 0 8px; }
.tb-spacer { flex: 1; }
.ic { width: 15px; height: 15px; display: block; }
.tb-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: transparent; color: var(--text); border: 1px solid transparent;
  border-radius: 7px; padding: 6px 11px; cursor: pointer; font-size: 12.5px; font-weight: 500;
  transition: background .12s, border-color .12s, color .12s, transform .06s;
}
.tb-btn .ic { color: var(--text-dim); transition: color .12s; }
.tb-btn:hover { background: var(--hover); }
.tb-btn:hover .ic { color: var(--accent); }
.tb-btn:active { background: var(--press); transform: translateY(.5px); }
.tb-btn.icon { padding: 7px; min-width: 32px; justify-content: center; }
.readout {
  font-variant-numeric: tabular-nums; color: var(--text-dim);
  padding: 0 8px; min-width: 46px; text-align: center; font-size: 12px; font-weight: 500;
}

/* ---- Property toolbar ---- */
#propbar {
  display: flex; align-items: center; gap: 10px; flex: 0 0 auto;
  padding: 6px 12px; min-height: 40px; overflow-x: auto; white-space: nowrap;
  background: var(--chrome); border-bottom: 1px solid var(--line-2);
}
#propbar::-webkit-scrollbar { height: 0; }
.pb-group { display: inline-flex; align-items: center; gap: 7px; flex: 0 0 auto; }
.pb-label { font-size: 11px; color: var(--text-faint); font-weight: 600; }
.pb-sep { width: 1px; height: 20px; background: var(--line-2); flex: 0 0 auto; }
#propbar input[type=range] { width: 78px; }
#propbar select, #propbar input[type=text] {
  background: var(--surface); color: var(--text); border: 1px solid var(--line-2);
  border-radius: 6px; padding: 4px 7px; font-size: 12px;
}
#propbar input[type=text] { width: 130px; }
#propbar .swatches { flex-wrap: nowrap; gap: 4px; }
#propbar .swatch { width: 16px; height: 16px; }
#propbar .swatches.small .swatch { width: 14px; height: 14px; }
.prop-val { width: 36px; text-align: right; color: var(--text-dim); font-variant-numeric: tabular-nums; font-size: 12px; }
.pb-btns { display: inline-flex; gap: 2px; }
.pb-btn { min-width: 22px; height: 22px; padding: 0 5px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text-dim); border-radius: 5px; cursor: pointer; font-size: 12px; line-height: 20px; }
.pb-btn:hover { background: var(--surface-2); color: var(--accent); }
.pb-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.swatches { display: flex; flex-wrap: wrap; gap: 5px; }
.swatch {
  width: 18px; height: 18px; border-radius: 5px; cursor: pointer;
  border: 1px solid rgba(0,0,0,.18); box-shadow: inset 0 0 0 2px transparent; transition: transform .08s;
}
.swatch:hover { transform: scale(1.14); }
.swatch.active { box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px var(--accent); }

/* ---- Document tabs ---- */
#doctabs {
  display: flex; align-items: flex-end; gap: 4px; flex: 0 0 auto;
  padding: 0 10px; height: 31px; background: var(--bg); border-bottom: 1px solid var(--line-2);
}
.doc-tab {
  display: inline-flex; align-items: center; gap: 8px; position: relative; top: 1px;
  background: var(--panel); color: var(--text-dim); border: 1px solid var(--line-2); border-bottom: none;
  border-radius: 7px 7px 0 0; padding: 6px 8px 6px 13px; font-size: 12px; font-weight: 500;
  max-width: 240px; cursor: pointer; transition: background .12s, color .12s;
}
.doc-tab:hover { background: var(--surface-2); color: var(--text); }
.doc-tab.active { background: var(--canvas); color: #fff; }
.doc-tab .doc-tab-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--brand-b); flex: 0 0 auto; }
.doc-tab-close {
  flex: 0 0 auto; width: 17px; height: 17px; border: none; border-radius: 4px; padding: 0;
  background: transparent; color: inherit; opacity: .6; cursor: pointer; font-size: 12px;
  line-height: 1; display: inline-flex; align-items: center; justify-content: center;
}
.doc-tab-close:hover { background: rgba(255,255,255,.18); opacity: 1; }
.doc-tab-add {
  flex: 0 0 auto; align-self: center; width: 24px; height: 22px; margin-left: 2px;
  border: 1px solid transparent; border-radius: 6px; background: transparent; color: var(--text-dim);
  font-size: 17px; line-height: 1; cursor: pointer;
}
.doc-tab-add:hover { background: var(--surface-2); color: var(--text); border-color: var(--line-2); }

/* ---- Body layout ---- */
#body { flex: 1; display: flex; min-height: 0; }
#leftrail {
  width: 168px; flex: 0 0 auto; background: var(--panel);
  border-right: 1px solid var(--line-2); overflow-y: auto; padding: 12px 10px;
}
#leftrail.collapsed { display: none; }
#btn-tools-toggle.active { background: var(--press); }
#btn-tools-toggle.active .ic { color: var(--accent); }
#btn-excel-live.live-on { background: rgba(14, 147, 132, .14); color: var(--ok); }
#btn-excel-live.live-on .ic { color: var(--ok); }
#rightpanel {
  width: 320px; flex: 0 0 auto; background: var(--panel);
  border-left: 1px solid var(--line-2); display: flex; flex-direction: column; min-height: 0;
}
#viewer {
  flex: 1; overflow: auto; position: relative; background: var(--canvas);
}

/* ---- Sub-bars (compare / OCR / visual search) ---- */
.subbar {
  display: flex; align-items: center; gap: 13px; flex: 0 0 auto;
  padding: 8px 14px; font-size: 12px;
  background: #e6f0fb; border-bottom: 1px solid #bcd6f3;
}
.subbar-title { font-weight: 700; letter-spacing: .02em; color: var(--accent-press); padding-right: 13px; border-right: 1px solid #bcd6f3; }
.subbar-info { color: var(--text-dim); font-variant-numeric: tabular-nums; }
.subbar label { display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); }
.subbar select, .subbar input[type=text] {
  background: var(--surface); color: var(--text); border: 1px solid var(--line-2);
  border-radius: 6px; padding: 5px 8px; font-size: 12px;
}
.subbar input[type=text] { width: 200px; }
.subbar .chk { cursor: pointer; }
.subbar .dot { width: 11px; height: 11px; border-radius: 3px; display: inline-block; }
.subbar .dot.red { background: #e23b3b; }
.subbar .dot.cyan { background: #16b8c4; }

/* ---- Tool palette ---- */
.tool-label { font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-faint); font-weight: 700; margin: 14px 4px 7px; }
.tool-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.tool-btn {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px;
  cursor: pointer; color: var(--text-dim); padding: 0;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
}
.tool-btn:hover { background: var(--surface-2); border-color: var(--accent); color: var(--accent); }
.tool-btn.active {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent));
  border-color: var(--accent-press); color: #fff;
  box-shadow: 0 2px 8px rgba(31, 111, 214, .4), inset 0 1px 0 rgba(255,255,255,.25);
}
.tool-btn svg { width: 19px; height: 19px; pointer-events: none; }

input[type=range] {
  -webkit-appearance: none; appearance: none; height: 4px; border-radius: 3px;
  background: var(--line-2); cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 2px solid var(--accent); box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
input[type=checkbox] { accent-color: var(--accent); width: 14px; height: 14px; }

/* ---- Viewer / pages (continuous-scroll stack) ---- */
/* width:max-content + min-width:100% lets pages center when narrower than the
   viewport, yet still scroll cleanly to the left edge when zoomed wider than it
   (avoids the centered-flex-child overflow-clipping bug). */
#pagestack {
  display: flex; flex-direction: column; align-items: center;
  gap: 18px; padding: 26px 26px 64px; box-sizing: border-box;
  width: max-content; min-width: 100%; min-height: 100%; margin: 0 auto;
}
#pagestack.is-solo { justify-content: center; }
.pageview {
  position: relative; flex: 0 0 auto; background: #fff;
  box-shadow: var(--shadow-page);
}
.pageview.solo-hidden { display: none; }
.pageview > .pdf-canvas { display: block; background: #fff; }
.pageview > .overlay { position: absolute; left: 0; top: 0; touch-action: none; }
.pageview > .form-layer { position: absolute; left: 0; top: 0; right: 0; bottom: 0; pointer-events: none; }
.pageview-badge {
  position: absolute; top: 6px; left: 8px; pointer-events: none;
  font-size: 10px; font-weight: 700; line-height: 1; padding: 3px 6px;
  color: #fff; background: rgba(20, 22, 26, .55); border-radius: 5px;
  letter-spacing: .03em; opacity: 0; transition: opacity .15s;
}
#viewer:hover .pageview-badge { opacity: 1; }
.form-field {
  position: absolute; box-sizing: border-box; font-family: inherit; font-size: 12px;
  border: 1px solid var(--accent); background: rgba(31, 111, 214, .07); color: #111;
  border-radius: 2px; padding: 1px 4px; margin: 0;
}
.form-field:focus { outline: 2px solid var(--accent); outline-offset: -1px; background: #fff; }
input.form-field.is-check { padding: 0; accent-color: var(--accent); cursor: pointer; }
input.form-field.is-radio { padding: 0; accent-color: var(--accent); cursor: pointer; border: none; background: transparent; }
select.form-field { padding: 0 2px; }
select.form-field.is-list { padding: 2px; overflow-y: auto; }
button.form-field.is-btn {
  background: linear-gradient(to bottom, #fff, #edf2f8);
  border: 1px solid #b7c0cc; color: #223; cursor: pointer; font-weight: 500;
}
button.form-field.is-btn:hover { background: #e6ecf5; }
.form-field.is-sig {
  display: flex; align-items: center; justify-content: center;
  background: rgba(31, 111, 214, .10); color: #1a4a8c; font-size: 11px;
  font-style: italic; border-style: dashed; cursor: default;
}
.hidden { display: none !important; }

#empty-state { display: flex; align-items: center; justify-content: center; width: 100%; height: 100%; background: var(--chrome); }
.empty-card { text-align: center; max-width: 560px; padding: 30px; }
.empty-hero { width: 100%; max-width: 520px; height: auto; display: block; margin: 0 auto 22px; border-radius: 16px; }
.empty-mark { width: 92px; height: 92px; border-radius: 22px; box-shadow: var(--shadow-lg); margin-bottom: 20px; }
.empty-logo {
  font-size: 38px; font-weight: 800; letter-spacing: -.02em; line-height: 1;
  background: linear-gradient(95deg, var(--brand-a), var(--brand-b));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.empty-card p { color: var(--text-dim); margin: 12px 0 24px; font-size: 14px; }
.empty-tips { list-style: none; text-align: left; color: var(--text-dim); font-size: 12.5px; line-height: 1.5; margin: 28px auto 0; padding: 0; max-width: 360px; }
.empty-tips li { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 11px; }
.empty-tips b { color: var(--text); font-weight: 600; }
.tip-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--brand-b); margin-top: 6px; flex: 0 0 auto; }
.primary-btn {
  background: linear-gradient(180deg, var(--accent-hi), var(--accent)); color: #fff; border: none;
  border-radius: 9px; padding: 11px 22px; cursor: pointer; font-size: 13.5px; font-weight: 600;
  box-shadow: 0 4px 12px rgba(31,111,214,.32), inset 0 1px 0 rgba(255,255,255,.25);
  transition: filter .12s, transform .06s;
}
.primary-btn:hover { filter: brightness(1.06); }
.primary-btn:active { transform: translateY(1px); }

/* ---- Right panel ---- */
.panel-tabs { display: flex; border-bottom: 1px solid var(--line-2); flex: 0 0 auto; padding: 0 6px; background: var(--chrome); }
.ptab {
  flex: 1; background: transparent; color: var(--text-dim); border: none;
  padding: 11px 0 10px; cursor: pointer; font-size: 12px; font-weight: 500;
  border-bottom: 2px solid transparent; transition: color .12s;
}
.ptab:hover { color: var(--text); }
.ptab.active { color: var(--accent); border-bottom-color: var(--accent); }
.panel-body { flex: 1; overflow-y: auto; min-height: 0; background: var(--panel); }
.tabpane { display: none; padding: 12px; }
.tabpane.active { display: block; }

.totals-table, .markups-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.totals-table th, .markups-table th {
  text-align: left; color: var(--text-faint); font-weight: 700; font-size: 10px;
  text-transform: uppercase; letter-spacing: .06em; padding: 6px 7px; border-bottom: 1px solid var(--line-2);
}
.totals-table td, .markups-table td { padding: 8px 7px; border-bottom: 1px solid var(--line); vertical-align: top; }
.totals-table td.num, .markups-table td.num { text-align: right; font-variant-numeric: tabular-nums; }
.totals-table tr:hover td { background: rgba(31,111,214,.05); }
.grand { font-size: 13px; }
.grand .big { font-weight: 700; color: var(--ok); }
.row-color { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 7px; vertical-align: middle; }
.markup-row { cursor: pointer; }
.markup-row:hover td { background: rgba(31,111,214,.06); }
.markup-row.sel td { background: rgba(31, 111, 214, .14); }
.empty-hint { color: var(--text-dim); padding: 26px 14px; text-align: center; font-size: 12.5px; line-height: 1.65; }
.del-btn { background: none; border: none; color: var(--text-faint); cursor: pointer; font-size: 13px; }
.del-btn:hover { color: var(--danger); }
.section-head { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-faint); margin: 14px 4px 6px; }

/* ---- Takeoff group toggle + Spaces ---- */
.tk-toggle { display: inline-flex; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 2px; margin-bottom: 12px; }
.tk-tab { background: transparent; border: none; color: var(--text-dim); font-size: 12px; font-weight: 500; padding: 5px 14px; border-radius: 6px; cursor: pointer; }
.tk-tab:hover { color: var(--text); }
.tk-tab.on { background: var(--surface); color: var(--accent); box-shadow: var(--shadow); }
.space-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.space-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid #7c3aed; border-radius: 7px;
}
.space-name { flex: 1; min-width: 0; background: transparent; border: none; color: var(--text); font-size: 12.5px; font-weight: 500; }
.space-name:focus { outline: none; }
.space-pg { font-size: 10px; color: var(--text-faint); white-space: nowrap; }
.space-rollup { margin-bottom: 10px; }
.space-rollup-head { font-size: 12px; font-weight: 700; color: var(--text); padding: 6px 2px 4px; border-bottom: 1px solid var(--line-2); }
.space-rollup .totals-table td { padding: 6px 7px; }

/* ---- Markups manager ---- */
#tab-markups select, #tab-markups input[type=text] {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px;
  padding: 5px 7px; font-size: 12px; color: var(--text);
}
#tab-markups select:focus, #tab-markups input:focus { outline: none; border-color: var(--accent); }
.mk-toolbar { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.mk-author { display: flex; align-items: center; gap: 7px; }
.mk-author input { flex: 1; min-width: 0; }
.mk-filters { display: flex; align-items: center; gap: 6px; }
.mk-filters select { flex: 1; min-width: 0; }
.mk-pageonly { display: flex; align-items: center; gap: 4px; font-size: 11px; color: var(--text-dim); white-space: nowrap; }
.mk-search { width: 100%; }

.mk-list { display: flex; flex-direction: column; gap: 5px; }
.mk-row { background: var(--surface); border: 1px solid var(--line); border-left: 3px solid #9aa1ac; border-radius: 8px; overflow: hidden; transition: box-shadow .12s; }
.mk-row.sel { box-shadow: 0 0 0 2px var(--accent); }
.mk-main { display: flex; align-items: center; gap: 9px; padding: 9px 10px; cursor: pointer; }
.mk-main:hover { background: var(--surface-2); }
.mk-text { flex: 1; min-width: 0; }
.mk-line1 { font-size: 12.5px; color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mk-note { color: var(--text-dim); font-weight: 400; }
.mk-line2 { font-size: 10.5px; color: var(--text-faint); margin-top: 3px; }
.mk-line3 { margin-top: 4px; display: flex; flex-wrap: wrap; gap: 4px; }
.mk-cchip {
  font-size: 10.5px; padding: 1px 6px; border-radius: 10px;
  background: rgba(45, 108, 223, 0.12); color: #2d6cdf; border: 1px solid rgba(45, 108, 223, 0.25);
  white-space: nowrap;
}
.mk-badge { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 11px; border: 1px solid; white-space: nowrap; flex: 0 0 auto; }

.mk-detail { border-top: 1px solid var(--line); padding: 10px; background: var(--surface-2); }
.mk-status-pills { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.mk-pill {
  font-size: 10.5px; padding: 3px 10px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--text-dim); cursor: pointer; transition: all .12s;
}
.mk-pill:hover { border-color: var(--c); color: var(--c); }
.mk-pill.on { background: var(--c); color: #fff; border-color: var(--c); font-weight: 600; }
.mk-comments { display: flex; flex-direction: column; gap: 6px; margin-bottom: 9px; }
.mk-comment { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; }
.mk-cmeta { font-size: 10px; color: var(--text-faint); margin-bottom: 3px; }
.mk-ctext { font-size: 12px; color: var(--text); line-height: 1.4; }
.mk-nocomment { font-size: 11px; color: var(--text-faint); font-style: italic; padding: 2px 0 8px; }
.mk-addcomment { display: flex; gap: 6px; }
.mk-cinput { flex: 1; min-width: 0; }
.mk-cadd {
  background: var(--accent); color: #fff; border: none; border-radius: 6px;
  padding: 5px 12px; font-size: 11.5px; font-weight: 600; cursor: pointer;
}
.mk-cadd:hover { background: var(--accent-hi); }

/* ---- Pages panel ---- */
.pages-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pages-actions .tb-btn { font-size: 11.5px; padding: 6px 10px; background: var(--surface); border: 1px solid var(--line-2); }
.pages-actions .tb-btn:hover { background: var(--surface-2); }
.page-row {
  display: flex; align-items: center; gap: 11px; padding: 9px 7px;
  border-radius: 8px; border: 1px solid transparent; cursor: pointer; margin-bottom: 3px;
  transition: background .12s, border-color .12s;
}
.page-row:hover { background: var(--surface-2); }
.page-row.current { background: rgba(31, 111, 214, .12); border-color: rgba(31,111,214,.4); }
.page-thumb {
  width: 54px; height: 70px; flex: 0 0 auto; background: #fff;
  border: 1px solid var(--line-2); border-radius: 3px; display: block; overflow: hidden;
  box-shadow: var(--shadow);
}
.page-thumb canvas { display: block; width: 100%; height: 100%; object-fit: contain; }
.page-meta { flex: 1; min-width: 0; }
.page-meta .pnum { font-size: 12.5px; color: var(--text); font-weight: 600; }
.page-meta .pinfo { font-size: 10px; color: var(--text-dim); margin-top: 2px; font-variant-numeric: tabular-nums; }
.page-ctrls { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; }
.page-ctrls button {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 5px;
  color: var(--text-dim); cursor: pointer; font-size: 12px; width: 25px; height: 23px; padding: 0;
  transition: background .12s, color .12s, border-color .12s;
}
.page-ctrls button:hover { background: var(--surface-2); color: var(--accent); border-color: var(--accent); }
.page-ctrls button.danger:hover { color: var(--danger); border-color: var(--danger); }
.sheet-tag { display: inline-block; font-size: 10px; font-weight: 600; color: var(--accent); background: rgba(31,111,214,.12); border-radius: 4px; padding: 1px 6px; margin-left: 5px; vertical-align: 1px; }

/* ---- Set (sheet index) ---- */
.set-head { font-size: 12px; color: var(--text-dim); margin: 2px 0 10px; }
.set-head b { color: var(--text); }
.sheet-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 7px;
  border-radius: 8px; border: 1px solid transparent; cursor: pointer; margin-bottom: 3px;
  transition: background .12s, border-color .12s;
}
.sheet-row:hover { background: var(--surface-2); }
.sheet-row.current { background: rgba(31,111,214,.12); border-color: rgba(31,111,214,.4); }
.sheet-idx {
  flex: 0 0 22px; height: 22px; border-radius: 5px; background: var(--surface);
  border: 1px solid var(--line-2); color: var(--text-dim); font-size: 11px;
  display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums;
}
.sheet-meta { flex: 1; min-width: 0; }
.sheet-label {
  width: 100%; background: transparent; border: 1px solid transparent; border-radius: 5px;
  color: var(--text); font-size: 12.5px; font-weight: 600; padding: 2px 5px;
}
.sheet-label:hover { border-color: var(--line-2); }
.sheet-label:focus { border-color: var(--accent); background: var(--surface); outline: none; }
.sheet-src { font-size: 10px; color: var(--text-dim); margin-top: 1px; padding: 0 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---- Split view ---- */
#splitpane { display: flex; flex-direction: column; flex: 0 0 42%; min-width: 260px; border-left: 1px solid var(--line-2); background: var(--surface-0); }
#splitpane.hidden { display: none; }
.split-bar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--surface); flex: 0 0 auto; }
.split-info { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; min-width: 42px; text-align: center; }
#split-scroll { flex: 1; overflow: auto; display: flex; justify-content: center; align-items: flex-start; padding: 14px; }
#split-canvas { background: #fff; box-shadow: var(--shadow); display: block; height: auto; }

/* ---- Bookmarks ---- */
.bm-row { display: flex; align-items: center; gap: 6px; padding: 5px 6px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; margin-bottom: 2px; }
.bm-row:hover { background: var(--surface-2); }
.bm-row.current { background: rgba(31,111,214,.12); border-color: rgba(31,111,214,.4); }
.bm-title { flex: 1; min-width: 0; background: transparent; border: 1px solid transparent; border-radius: 5px; color: var(--text); font-size: 12.5px; padding: 2px 5px; }
.bm-title:hover { border-color: var(--line-2); }
.bm-title:focus { border-color: var(--accent); background: var(--surface); outline: none; }
.bm-page { font-size: 10px; color: var(--text-dim); font-variant-numeric: tabular-nums; flex: 0 0 auto; }
.bm-ctrls { display: flex; gap: 1px; flex: 0 0 auto; }
.bm-ctrls button { background: transparent; border: none; color: var(--text-dim); cursor: pointer; font-size: 12px; width: 18px; height: 20px; padding: 0; border-radius: 4px; }
.bm-ctrls button:hover { background: var(--surface); color: var(--accent); }
.bm-ctrls button.danger:hover { color: var(--danger); }

/* ---- Layers ---- */
.layer-row { display: flex; align-items: center; gap: 7px; padding: 7px 6px; border-bottom: 1px solid var(--line); border-radius: 6px; }
.layer-row.active { background: var(--surface-2); }
.layer-row input[type=text] { flex: 1; min-width: 0; background: transparent; border: none; color: var(--text); font-size: 12.5px; }
.layer-row input[type=text]:focus { outline: none; }
.layer-active { flex: 0 0 auto; accent-color: var(--accent); }
.layer-vis { flex: 0 0 auto; }
.layer-color { flex: 0 0 auto; width: 20px; height: 20px; padding: 0; border: 1px solid var(--line-2); border-radius: 5px; background: none; cursor: pointer; }
.layer-count { flex: 0 0 auto; min-width: 20px; text-align: center; font-size: 10.5px; color: var(--text-faint); background: var(--surface-2); border-radius: 9px; padding: 1px 6px; font-variant-numeric: tabular-nums; }
.layer-del { flex: 0 0 auto; width: 20px; height: 20px; border: none; background: transparent; color: var(--text-faint); border-radius: 5px; cursor: pointer; font-size: 12px; line-height: 1; }
.layer-del:hover:not(:disabled) { background: rgba(220,60,60,.15); color: #e23b3b; }
.layer-del:disabled { opacity: .3; cursor: default; }
.layer-assign { display: flex; align-items: center; gap: 6px; margin: 10px 6px; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 8px; font-size: 12px; color: var(--text-dim); }
.layer-assign select { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px; padding: 4px 6px; font-size: 12px; color: var(--text); }
.section-hint { text-transform: none; letter-spacing: 0; color: var(--text-faint); font-weight: 400; }
.add-layer { margin: 12px 6px; }
.add-layer .tb-btn { background: var(--surface); border: 1px solid var(--line-2); }
.pdflayer-row { display: flex; align-items: center; gap: 9px; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.pdflayer-name { flex: 1; min-width: 0; font-size: 12.5px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Status bar ---- */
#statusbar {
  flex: 0 0 auto; display: flex; align-items: center; gap: 18px; padding: 4px 14px;
  background: linear-gradient(180deg, var(--chrome), var(--chrome-hi));
  border-top: 1px solid var(--line-2);
  font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums;
}
.status-spacer { flex: 1; }
#status-msg { color: var(--accent); font-weight: 600; }
#status-dims { color: var(--text-dim); }
.scale-readout {
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 6px;
  padding: 3px 10px; color: var(--text-dim); font-weight: 600;
}
.scale-readout.is-set { background: rgba(14, 147, 132, .12); border-color: rgba(14, 147, 132, .4); color: var(--ok); }

/* ---- Inputs focus ---- */
.prop-val, .pb-group input:focus, .pb-group select:focus,
.subbar input:focus, .subbar select:focus { outline: none; }
.pb-group input:focus, .pb-group select:focus,
.subbar input:focus, .subbar select:focus { border-color: var(--accent); }

/* ---- Modal ---- */
#modal-backdrop {
  position: fixed; inset: 0; background: rgba(30, 40, 55, .35); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
#modal { background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; padding: 18px; width: 372px; box-shadow: var(--shadow-lg); }
#modal-title { font-weight: 600; margin-bottom: 12px; font-size: 13.5px; }
#modal textarea, #modal input[type=number] {
  width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--line-2);
  border-radius: 8px; padding: 9px; font-size: 13px; font-family: inherit; resize: vertical;
}
#modal textarea:focus, #modal input:focus { outline: none; border-color: var(--accent); }
#modal-extra { margin-top: 12px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
#modal-extra label { color: var(--text-dim); }
#modal-extra input[type=number] { width: 120px; }
#modal-extra select { background: var(--surface-2); color: var(--text); border: 1px solid var(--line-2); border-radius: 8px; padding: 7px; }
.apply-all { width: 100%; display: flex; align-items: center; gap: 7px; margin-top: 4px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.modal-actions .tb-btn { background: var(--surface-2); border: 1px solid var(--line-2); }
.modal-actions .tb-btn:hover { background: var(--hover); }

/* ---- Dropbox modal ---- */
#dropbox-modal, #sign-modal, #session-modal {
  position: fixed; inset: 0; background: rgba(30, 40, 55, .4); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center; z-index: 50;
}
#dropbox-card, #sign-card, #session-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; width: 460px; box-shadow: var(--shadow-lg); overflow: hidden; }
#sign-card { width: 480px; }
#sign-body, #session-body { padding: 16px; }
.sess-tab { background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 7px 12px; font-size: 12.5px; color: var(--text-dim); cursor: pointer; border-radius: 6px 6px 0 0; }
.sess-tab:hover { background: var(--surface-2); color: var(--text); }
.sess-tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
#session-body .dbx-row input { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 7px; padding: 8px 10px; font-size: 12.5px; color: var(--text); }
#session-body .dbx-row input:focus { outline: none; border-color: var(--accent); }
/* ---- Encrypt / passwords / permissions modal (Phase 5) ---- */
#encrypt-modal { position: fixed; inset: 0; background: rgba(30,40,55,.4); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 58; }
#encrypt-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; width: 500px; max-width: 94vw; box-shadow: var(--shadow-lg); overflow: hidden; }
#encrypt-body { padding: 16px; }
#encrypt-body .encrypt-grid { display: grid; grid-template-columns: 1fr; gap: 8px; }
#encrypt-body .encrypt-grid label { display: grid; grid-template-columns: 140px 1fr; align-items: center; font-size: 12px; }
#encrypt-body .encrypt-grid input { font-size: 12.5px; padding: 5px 7px; border: 1px solid var(--line-2); border-radius: 4px; }
#encrypt-body .encrypt-perms { display: flex; flex-direction: column; gap: 5px; margin-top: 4px; font-size: 12px; }
#encrypt-body .encrypt-perms label { display: flex; align-items: center; gap: 6px; }
.encrypt-actions { margin-top: 12px; display: flex; align-items: center; gap: 8px; }

/* ---- Batch progress modal (Phase 4) ---- */
#batch-modal { position: fixed; inset: 0; background: rgba(30,40,55,.4); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 60; }
#batch-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; width: 560px; max-width: 94vw; box-shadow: var(--shadow-lg); overflow: hidden; }
#batch-body { padding: 16px; }
.batch-status { font-size: 12.5px; color: var(--text); margin-bottom: 10px; font-weight: 500; }
.batch-progress { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.batch-bar { flex: 1; height: 10px; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 6px; overflow: hidden; }
.batch-fill { height: 100%; background: linear-gradient(90deg, #2d8cff, #22c55e); transition: width .2s ease; width: 0%; }
.batch-count { font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; min-width: 60px; text-align: right; }
.batch-sub { margin-top: 6px; }
.batch-subfill { height: 100%; background: #f59e0b; transition: width .1s ease; width: 0%; }
.batch-submsg { font-size: 10.5px; color: var(--text-dim); margin-top: 3px; display: block; }
.batch-log { margin-top: 12px; max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); padding: 8px; font-family: monospace; font-size: 11px; line-height: 1.5; }
.batch-log .b-ok { color: #059669; }
.batch-log .b-err { color: #dc2626; }
.batch-log .b-skip { color: var(--text-dim); }
.batch-log .b-running { color: #2d6cdf; }
.batch-actions { margin-top: 12px; display: flex; align-items: center; gap: 8px; }
/* Batch search-and-redact modal */
#bredact-modal { position: fixed; inset: 0; background: rgba(30,40,55,.4); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 58; }
#bredact-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; width: 500px; max-width: 94vw; box-shadow: var(--shadow-lg); overflow: hidden; }
#bredact-body { padding: 16px; }
#bredact-body textarea { width: 100%; min-height: 100px; font-family: monospace; font-size: 12px; padding: 8px; border: 1px solid var(--line-2); border-radius: 6px; resize: vertical; margin-bottom: 10px; }
.bredact-actions { margin-top: 10px; }

/* ---- Headers / footers / Bates modal ---- */
#hf-modal { position: fixed; inset: 0; background: rgba(30,40,55,.4); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 56; }
#hf-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; width: 560px; max-width: 94vw; box-shadow: var(--shadow-lg); overflow: hidden; }
#hf-body { padding: 16px; }
.hf-hint { font-size: 11.5px; color: var(--text-dim); margin-bottom: 12px; }
.hf-hint code { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 5px; font-size: 11px; }
.hf-grid { display: grid; grid-template-columns: 58px 1fr 1fr 1fr; gap: 7px; align-items: center; }
.hf-rowlabel { font-size: 12px; font-weight: 600; color: var(--text-dim); }
.hf-grid input, .hf-bates input, .hf-bates select, .hf-opts input, .hf-opts select {
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 6px 8px; font-size: 12.5px; color: var(--text); width: 100%; box-sizing: border-box;
}
.hf-check { display: flex; align-items: center; gap: 7px; font-size: 13px; margin: 12px 0 8px; cursor: pointer; }
.hf-bates, .hf-opts { display: flex; flex-wrap: wrap; gap: 9px; }
.hf-bates label, .hf-opts label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--text-dim); font-weight: 600; }
.hf-bates label input, .hf-bates label select { min-width: 74px; }
.hf-opts label input[type=color] { width: 42px; height: 30px; padding: 2px; }
.hf-pl-head { font-size: 12.5px; color: var(--text); margin-bottom: 8px; }
.hf-sub { color: var(--text-faint); font-weight: 400; font-size: 11px; }
#hf-pl-list { display: flex; flex-direction: column; gap: 6px; }
.hf-pl-row { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--text-dim); }
.hf-pl-row input, .hf-pl-row select { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 5px 7px; font-size: 12px; color: var(--text); }
.hf-pl-row .pl-from, .hf-pl-row .pl-start { width: 48px; }
.hf-pl-row .pl-prefix { width: 60px; }
.hf-pl-row .pl-del { background: transparent; border: none; color: var(--text-faint); cursor: pointer; padding: 2px 5px; border-radius: 5px; }
.hf-pl-row .pl-del:hover { background: rgba(220,60,60,.15); color: #e23b3b; }
.hf-pl-add { margin-top: 8px; font-size: 12px; }
.hf-actions { margin-top: 14px; align-items: center; }
/* ---- Tool Chest (custom tool sets) ---- */
#tab-tools { padding: 4px 2px; }
.tc-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; }
.tc-set { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 7px; padding: 6px 8px; font-size: 12.5px; color: var(--text); }
.tc-iconbtn { flex: 0 0 auto; width: 28px; height: 28px; border: 1px solid var(--line-2); background: var(--surface); border-radius: 7px; color: var(--text-dim); cursor: pointer; font-size: 14px; line-height: 1; }
.tc-iconbtn:hover { background: var(--surface-2); color: var(--text); border-color: var(--accent); }
.tc-save { width: 100%; margin-bottom: 10px; }
.tc-list { display: flex; flex-direction: column; gap: 4px; }
.tc-tool {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 8px;
  padding: 7px 8px; cursor: pointer; color: var(--text); transition: background .12s, border-color .12s;
}
.tc-tool:hover { background: var(--surface-2); border-color: var(--accent); }
.tc-swatch { width: 13px; height: 13px; border-radius: 4px; flex: 0 0 auto; border: 1px solid rgba(0,0,0,.25); }
.tc-icon { flex: 0 0 auto; width: 18px; height: 18px; color: var(--text-dim); display: inline-flex; }
.tc-icon svg { width: 18px; height: 18px; }
.tc-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.tc-sub { color: var(--text-faint); font-size: 11px; }
.tc-del { flex: 0 0 auto; width: 20px; height: 20px; border: none; background: transparent; color: var(--text-faint); border-radius: 5px; cursor: pointer; font-size: 12px; line-height: 1; }
.tc-del:hover { background: rgba(220,60,60,.15); color: #e23b3b; }
.tc-empty { color: var(--text-faint); font-size: 12px; text-align: center; padding: 20px 8px; line-height: 1.5; }
/* Print dialog */
#print-modal { position: fixed; inset: 0; background: rgba(30, 40, 55, .4); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 56; }
#print-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; width: 900px; max-width: 95vw; height: 82vh; max-height: 880px; box-shadow: var(--shadow-lg); overflow: hidden; display: flex; flex-direction: column; }
#print-main { flex: 1; min-height: 0; display: flex; }
#print-controls { width: 272px; flex: 0 0 auto; border-right: 1px solid var(--line); padding: 16px; display: flex; flex-direction: column; gap: 13px; overflow: auto; }
.pctl { display: flex; flex-direction: column; gap: 5px; font-size: 11.5px; color: var(--text-dim); font-weight: 600; }
.pctl select, .pctl input[type=text], .pctl input[type=number] {
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 7px;
  padding: 7px 9px; font-size: 12.5px; color: var(--text); font-weight: 400;
}
.pctl select:focus, .pctl input:focus { outline: none; border-color: var(--accent); }
.pctl-check { flex-direction: row; align-items: center; gap: 7px; font-weight: 400; color: var(--text); font-size: 12.5px; cursor: pointer; }
.pctl-custom { flex-direction: row; align-items: center; gap: 7px; font-weight: 400; color: var(--text-dim); font-size: 12px; }
.pctl-custom input { width: 66px; }
.tb-link { background: none; border: none; color: var(--accent); font-size: 11.5px; cursor: pointer; padding: 2px 0; text-align: left; text-decoration: underline; }
.tb-link:hover { color: var(--accent-press); }
#print-preview-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--canvas); }
#print-preview-info { padding: 8px 14px; font-size: 11.5px; color: var(--text-dim); border-bottom: 1px solid var(--line); background: var(--surface); }
#print-body { flex: 1; min-height: 0; overflow: auto; padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.pv-item { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.print-sheet { background: #fff; box-shadow: var(--shadow-page); display: flex; align-items: center; justify-content: center; overflow: hidden; }
.print-sheet img { display: block; }
.print-sheet-num { font-size: 10px; color: var(--text-faint); text-align: center; padding: 4px 0 0; }
#print-foot { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); }
.print-hint { font-size: 11.5px; color: var(--text-faint); }
/* Scripting / automation modal */
#script-modal { position: fixed; inset: 0; background: rgba(30, 40, 55, .4); backdrop-filter: blur(2px); display: flex; align-items: center; justify-content: center; z-index: 55; }
#script-card { background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; width: 620px; max-width: 92vw; box-shadow: var(--shadow-lg); overflow: hidden; }
#script-body { padding: 14px 16px; }
.script-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.script-presets { font-size: 11.5px; color: var(--text-dim); display: flex; align-items: center; gap: 6px; }
.script-presets select { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 7px; padding: 6px 8px; font-size: 12px; color: var(--text); }
#script-code { width: 100%; height: 200px; resize: vertical; box-sizing: border-box; background: #1b1f26; color: #e7ebf0; border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; font-family: 'Cascadia Code', Consolas, 'Courier New', monospace; font-size: 12.5px; line-height: 1.5; tab-size: 2; }
#script-code:focus { outline: none; border-color: var(--accent); }
.script-help { font-size: 11px; color: var(--text-dim); margin: 8px 0; line-height: 1.5; }
.script-help code { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 4px; }
.script-log { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font-family: 'Cascadia Code', Consolas, monospace; font-size: 12px; line-height: 1.45; color: var(--text); max-height: 160px; overflow: auto; white-space: pre-wrap; margin: 0; min-height: 22px; }

/* 3D model viewer (full-screen overlay) */
#viewer3d { position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; background: #21262e; }
.v3d-bar { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--surface); }
.v3d-title { font-weight: 600; font-size: 13px; margin-right: 8px; }
.v3d-sep { width: 1px; height: 20px; background: var(--line-2); margin: 0 4px; }
.v3d-info { font-size: 12px; color: var(--text-dim); margin-left: 10px; }
.v3d-bar .tb-btn.active { background: var(--accent); color: #fff; }
.v3d-bar .tb-btn.active .ic { color: #fff; }
#v3d-stage { position: relative; flex: 1; min-height: 0; }
#v3d-canvas { width: 100%; height: 100%; display: block; }
.v3d-empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: #aeb6c2; pointer-events: none; text-align: center; }
.v3d-empty-title { font-size: 17px; font-weight: 600; color: #d3d9e2; }
.v3d-empty-hint { font-size: 12px; opacity: 0.7; margin-top: 6px; }

/* Docked collaboration panel */
#collab-panel {
  position: fixed; right: 16px; bottom: 40px; width: 250px; max-height: 60vh; z-index: 45;
  background: var(--surface); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
}
.collab-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; font-weight: 600; }
.collab-head code { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 5px; font-size: 11px; font-weight: 500; }
.collab-section { padding: 10px 12px; border-bottom: 1px solid var(--line); }
.collab-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-dim); margin-bottom: 6px; }
.collab-atts { display: flex; flex-wrap: wrap; gap: 5px; }
.collab-att { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 2px 9px; font-size: 11.5px; }
.collab-att.me { background: var(--accent); color: #fff; border-color: var(--accent); }
.collab-chat { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.collab-chat-log { flex: 1; overflow-y: auto; font-size: 12px; line-height: 1.5; min-height: 80px; max-height: 28vh; margin-bottom: 8px; }
.collab-msg { margin-bottom: 3px; color: var(--text); }
.collab-msg b { color: var(--accent); margin-right: 4px; }
.collab-chat-row { display: flex; gap: 6px; }
.collab-chat-row input { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 7px; padding: 6px 9px; font-size: 12px; color: var(--text); }
.collab-chat-row input:focus { outline: none; border-color: var(--accent); }
.sign-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; }
.sign-grid label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--text-dim); }
.sign-grid input, .sign-grid select { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 7px; padding: 7px 9px; font-size: 12.5px; color: var(--text); }
.sign-grid input:focus, .sign-grid select:focus { outline: none; border-color: var(--accent); }
.sign-tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--line); }
.sign-tab { background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 7px 12px; font-size: 12.5px; color: var(--text-dim); cursor: pointer; border-radius: 6px 6px 0 0; }
.sign-tab:hover { background: var(--surface-2); color: var(--text); }
.sign-tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.sign-cert-info { font-size: 12px; color: var(--text-dim); margin-bottom: 8px; }
.sign-cert-info b { color: var(--text); }
#sign-cert .dbx-row input { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 7px; padding: 8px 10px; font-size: 12.5px; color: var(--text); }
.sign-actions { justify-content: flex-start; }
.dbx-feedback.sign-ok { color: #15803d; }
.dbx-feedback.sign-err { color: #dc2626; }
.dbx-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.dbx-title { font-weight: 600; font-size: 14px; }
.dbx-head .tb-btn.icon { padding: 4px 8px; }
#dbx-body { padding: 16px; }
.dbx-msg { color: var(--text-dim); font-size: 12.5px; line-height: 1.5; margin-bottom: 10px; }
.dbx-msg b { color: var(--text); }
.dbx-steps { margin: 0 0 12px; padding-left: 18px; color: var(--text-dim); font-size: 12px; line-height: 1.7; }
.dbx-steps a { color: var(--accent); cursor: pointer; }
.dbx-steps code { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 5px; color: var(--text); font-size: 11.5px; }
.dbx-row { display: flex; gap: 8px; align-items: center; }
.dbx-row input[type=text] { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 7px; padding: 8px 10px; font-size: 12.5px; color: var(--text); }
.dbx-row input:focus { outline: none; border-color: var(--accent); }
.dbx-result { display: flex; gap: 8px; margin-top: 12px; }
.dbx-result input { flex: 1; min-width: 0; background: var(--surface-2); border: 1px solid var(--accent); border-radius: 7px; padding: 8px 10px; font-size: 12px; color: var(--text); }
.dbx-folder { margin-top: 4px; }
.dbx-sep2 { height: 1px; background: var(--line); margin: 14px 0 12px; }
.dbx-feedback { margin-top: 12px; font-size: 12px; color: var(--accent); min-height: 16px; }
.lk-tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.lk-tab { background: none; border: none; border-bottom: 2px solid transparent; margin-bottom: -1px; padding: 7px 12px; font-size: 12.5px; color: var(--text-dim); cursor: pointer; border-radius: 6px 6px 0 0; }
.lk-tab:hover { background: var(--surface-2); color: var(--text); }
.lk-tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.lk-panel { margin-bottom: 2px; }
.lk-actions { justify-content: flex-end; }
.dbx-clouds { flex-wrap: wrap; }
.dbx-cloud-btn { flex: 0 0 auto; }
.dbx-dim { color: var(--text-dim); }
.dbx-saved { color: var(--text-dim); margin-bottom: 4px; }
.dbx-savedpath { margin-bottom: 8px; }
.dbx-savedpath code { display: block; word-break: break-all; background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 6px; padding: 6px 8px; font-size: 11.5px; color: var(--text); }

/* ---- Scrollbars ---- */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-thumb { background: #b6bdc6; border-radius: 6px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: #9aa3ae; background-clip: padding-box; border: 3px solid transparent; }
::-webkit-scrollbar-track { background: transparent; }
