/* ── TekSwipe Client Files — design system ─────────────────────────────── */
:root {
  --bg: #f2f4f8;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #10192b;
  --muted: #5b6b83;
  --faint: #8b99ad;
  --line: #e3e8f0;
  --line-strong: #cfd8e3;
  --amber: #f59e0b;
  --amber-deep: #b45309;
  --amber-soft: #fef3c7;
  --amber-ghost: #fffbeb;
  --navy: #0f1a2e;
  --navy-2: #16233d;
  --navy-3: #1e2f52;
  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --blue: #2563eb;
  --blue-soft: #dbeafe;
  --violet: #7c3aed;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 25, 43, .05), 0 4px 18px rgba(16, 25, 43, .07);
  --shadow-lg: 0 8px 40px rgba(16, 25, 43, .18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5;
  background: var(--bg); color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
input, select, textarea { font-family: inherit; font-size: 14px; }
a { color: var(--amber-deep); text-decoration: none; }
a:hover { text-decoration: underline; }
::selection { background: var(--amber-soft); }

/* ── buttons ── */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: background .12s, border-color .12s, box-shadow .12s, transform .05s;
  white-space: nowrap; text-decoration: none !important;
}
.btn:hover { background: var(--surface-2); border-color: var(--faint); }
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; flex: none; }
.btn.primary { background: var(--amber); border-color: var(--amber); color: #241a02; }
.btn.primary:hover { background: #e8930a; border-color: #e8930a; }
.btn.dark { background: var(--navy-2); border-color: var(--navy-2); color: #fff; }
.btn.dark:hover { background: var(--navy-3); border-color: var(--navy-3); }
.btn.danger { color: var(--danger); border-color: #f3c1c1; }
.btn.danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: rgba(16,25,43,.06); color: var(--ink); }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 7px; border: none; background: transparent;
  color: var(--muted); cursor: pointer; flex: none;
}
.iconbtn:hover { background: rgba(16,25,43,.07); color: var(--ink); }
.iconbtn svg { width: 16px; height: 16px; }

/* ── inputs ── */
.input {
  width: 100%; padding: 9px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  outline: none; transition: border-color .12s, box-shadow .12s;
}
.input:focus { border-color: var(--amber); box-shadow: 0 0 0 3px rgba(245, 158, 11, .18); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.hint { font-size: 12px; color: var(--faint); margin-top: 5px; }

.checkrow { display: flex; align-items: flex-start; gap: 9px; padding: 9px 0; cursor: pointer; }
.checkrow input { margin: 2px 0 0; accent-color: var(--amber); width: 15px; height: 15px; cursor: pointer; }
.checkrow b { font-weight: 600; display: block; }
.checkrow small { color: var(--muted); }

/* ── layout: admin shell ── */
.shell { display: flex; height: 100vh; overflow: hidden; }
.sidebar {
  width: 300px; flex: none; background: var(--navy); color: #cdd7e5;
  display: flex; flex-direction: column; overflow: hidden;
}
.side-head { padding: 18px 16px 12px; display: flex; align-items: center; gap: 11px; }
.side-head .logo { width: 38px; height: 38px; flex: none; }
.side-head .t1 { font-weight: 800; font-size: 15.5px; color: #fff; letter-spacing: .2px; }
.side-head .t2 { font-size: 11.5px; color: #94a6c0; margin-top: -2px; }
.side-search { padding: 4px 12px 10px; }
.side-search .input {
  background: rgba(255,255,255,.07); border-color: rgba(255,255,255,.12); color: #e8eef7;
  padding: 7px 11px; font-size: 13px;
}
.side-search .input::placeholder { color: #7d8fa9; }
.side-search .input:focus { border-color: var(--amber); box-shadow: none; }
.tree { flex: 1; overflow-y: auto; padding: 2px 8px 12px; }
.tree::-webkit-scrollbar { width: 8px; }
.tree::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 4px; }
.side-foot { padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.side-foot .btn { width: 100%; justify-content: center; background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.14); color: #e8eef7; }
.side-foot .btn:hover { background: rgba(255,255,255,.12); }

.node { user-select: none; }
.node-row {
  display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px;
  cursor: pointer; color: #c3d0e2; font-size: 13.5px; position: relative;
}
.node-row:hover { background: rgba(255,255,255,.06); color: #fff; }
.node-row.active { background: var(--amber); color: #241a02; font-weight: 700; }
.node-row.active .badge-count { background: rgba(0,0,0,.15); color: #241a02; }
.node-row .chev { width: 14px; height: 14px; flex: none; transition: transform .15s; opacity: .7; }
.node-row .chev.open { transform: rotate(90deg); }
.node-row .nlabel { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node-row .add-sub { opacity: 0; }
.node-row:hover .add-sub { opacity: 1; }
.node-row .add-sub:hover { background: rgba(255,255,255,.15); color: #fff; }
.node-row.active .add-sub { color: #241a02; }
.node-kids { margin-left: 15px; border-left: 1px solid rgba(255,255,255,.09); padding-left: 5px; }
.badge-count {
  font-size: 10.5px; background: rgba(255,255,255,.1); color: #9fb1ca;
  border-radius: 999px; padding: 1px 7px; flex: none;
}
.share-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); flex: none; }
.tree-empty { color: #7d8fa9; font-size: 13px; text-align: center; padding: 26px 14px; }

.main { flex: 1; overflow-y: auto; position: relative; }
.main-inner { max-width: 1060px; margin: 0 auto; padding: 26px 30px 80px; }

/* ── page header ── */
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--amber-deep); }
.crumbs .sep { color: var(--line-strong); }
.page-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; font-size: 23px; letter-spacing: -.2px; flex: 1; min-width: 200px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── cards & panels ── */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font-size: 14.5px; flex: 1; }
.panel-body { padding: 18px; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .08s;
  position: relative;
}
.card:hover { border-color: var(--amber); box-shadow: var(--shadow); transform: translateY(-1px); }
/* titles wrap naturally; inline chips flow after the text instead of
   squeezing it into a narrow column */
.card h3 { margin: 0 0 4px; font-size: 14.5px; line-height: 1.4; overflow-wrap: anywhere; }
.card h3 .chip { margin-left: 6px; vertical-align: 2px; }
.card .meta { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.card .card-status { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }
.card .cardmenu { position: absolute; top: 9px; right: 9px; opacity: 0; }
.card:hover .cardmenu { opacity: 1; }

/* ── chips / badges ── */
.chip {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px;
  font-size: 11.5px; font-weight: 700; border-radius: 999px; white-space: nowrap;
}
.chip.ok { background: var(--ok-soft); color: #14532d; }
.chip.off { background: #eef1f6; color: var(--muted); }
.chip.amber { background: var(--amber-soft); color: #713f12; }
.chip.blue { background: var(--blue-soft); color: #1e3a8a; }
.chip svg { width: 11px; height: 11px; }

/* ── folder grid ── */
.folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.folder-card {
  display: flex; align-items: center; gap: 11px; padding: 12px 13px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  cursor: pointer; transition: border-color .12s, background .12s; position: relative;
}
.folder-card:hover { border-color: var(--amber); background: var(--amber-ghost); }
.folder-card .ficon { width: 34px; height: 34px; flex: none; }
.folder-card .fname { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.folder-card .fmeta { font-size: 11.5px; color: var(--muted); }
.folder-card .fmenu { position: absolute; top: 8px; right: 8px; opacity: 0; }
.folder-card:hover .fmenu { opacity: 1; }
.folder-card .fbody { min-width: 0; flex: 1; }

/* ── file list ── */
.filelist { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.file-row {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-bottom: 1px solid var(--line); transition: background .1s; cursor: pointer;
}
.file-row:last-child { border-bottom: none; }
.file-row:hover { background: var(--surface-2); }
.file-row .icon { width: 34px; height: 34px; flex: none; }
.file-row .fmain { flex: 1; min-width: 0; }
.file-row .fname { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.file-row .fsub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .fsize, .file-row .fdate { font-size: 12.5px; color: var(--muted); flex: none; }
.file-row .fsize { width: 74px; text-align: right; }
.file-row .fdate { width: 92px; }
.file-row .factions { display: flex; gap: 2px; flex: none; opacity: 0; transition: opacity .1s; }
.file-row:hover .factions { opacity: 1; }
.inv-flags { display: flex; gap: 12px; flex: none; padding: 4px 10px; background: var(--amber-ghost); border: 1px solid #fde8b8; border-radius: 8px; }
.inv-flags label { display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: #713f12; cursor: pointer; white-space: nowrap; }
.inv-flags input { accent-color: var(--amber-deep); margin: 0; cursor: pointer; }

/* ── empty state ── */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty svg { width: 46px; height: 46px; color: var(--line-strong); margin-bottom: 10px; }
.empty h3 { margin: 0 0 5px; color: var(--ink); font-size: 15px; }
.empty p { margin: 0 0 16px; font-size: 13px; }

/* ── login / gate screens ── */
.gate { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(1200px 600px at 20% -10%, #1e2f52 0%, var(--navy) 55%); }
.gate-card {
  width: 100%; max-width: 400px; background: var(--surface); border-radius: 16px;
  box-shadow: var(--shadow-lg); padding: 34px 34px 30px; text-align: center;
}
.gate-card .logo { width: 58px; height: 58px; margin: 0 auto 14px; }
.gate-card h1 { margin: 0 0 4px; font-size: 20px; }
.gate-card .sub { color: var(--muted); font-size: 13.5px; margin-bottom: 22px; }
.gate-card .btn { width: 100%; justify-content: center; padding: 11px; font-size: 14.5px; margin-top: 4px; }
.gate-err { color: var(--danger); font-size: 13px; margin-top: 12px; min-height: 18px; }
.gate-foot { margin-top: 20px; color: var(--faint); font-size: 12px; }

/* ── share page ── */
.share-top {
  background: var(--navy); color: #fff; padding: 0 22px;
  display: flex; align-items: center; gap: 14px; height: 62px; position: sticky; top: 0; z-index: 30;
}
.share-top .logo { width: 34px; height: 34px; }
.share-top .t1 { font-weight: 800; font-size: 15px; }
.share-top .t2 { font-size: 11.5px; color: #94a6c0; margin-top: -2px; }
.share-wrap { max-width: 1020px; margin: 0 auto; padding: 26px 22px 80px; }
.share-hero { margin-bottom: 22px; }
.share-hero h1 { margin: 0 0 4px; font-size: 24px; letter-spacing: -.2px; }
.share-hero .sub { color: var(--muted); font-size: 13.5px; max-width: 640px; }
.share-hero.hero-flex { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.share-hero .hero-stats { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.hero-stats .stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px;
  padding: 4px 12px; font-size: 12px; color: var(--muted);
}
.hero-stats .stat b { color: var(--ink); font-weight: 800; margin-right: 4px; }
.share-section {
  margin: 28px 0 12px; padding-top: 20px; border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.share-section h2 { margin: 0; font-size: 15.5px; display: flex; align-items: center; gap: 9px; }
.share-section .cnt {
  color: var(--muted); font-size: 11.5px; font-weight: 700;
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px;
}
.client-dot {
  width: 26px; height: 26px; border-radius: 8px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--navy); color: #fff; font-size: 12px; font-weight: 800;
}
.share-foot { text-align: center; color: var(--faint); font-size: 12px; padding: 30px 0 10px; }
.share-foot b { color: var(--muted); }

/* ── modal ── */
.overlay {
  position: fixed; inset: 0; background: rgba(10, 16, 28, .55); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 18px;
  animation: fadein .13s ease;
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg);
  width: 100%; max-width: 460px; max-height: 90vh; overflow-y: auto;
  animation: pop .14s ease;
}
@keyframes pop { from { transform: scale(.97); opacity: .6; } to { transform: scale(1); opacity: 1; } }
.modal-head { display: flex; align-items: center; padding: 16px 20px 0; }
.modal-head h2 { margin: 0; font-size: 16.5px; flex: 1; }
.modal-body { padding: 14px 20px 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; }

/* ── viewer ── */
.viewer {
  position: fixed; inset: 0; background: rgba(8, 12, 22, .93); z-index: 200;
  display: flex; flex-direction: column; animation: fadein .12s ease;
}
.viewer-top { display: flex; align-items: center; gap: 10px; padding: 12px 16px; color: #dbe4f0; }
.viewer-top .vicon { width: 26px; height: 26px; flex: none; }
.viewer-top .vname { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-top .vmeta { color: #8fa0b8; font-size: 12px; flex: none; }
.viewer-top .spacer { flex: 1; }
.viewer-top .iconbtn { color: #b9c6d8; width: 36px; height: 36px; }
.viewer-top .iconbtn:hover { background: rgba(255,255,255,.12); color: #fff; }
.viewer-top .iconbtn svg { width: 18px; height: 18px; }
.viewer-stage { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 0 62px 18px; position: relative; }
.viewer-stage img { max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: 0 10px 60px rgba(0,0,0,.5); }
.viewer-stage video { max-width: 100%; max-height: 100%; border-radius: 6px; outline: none; }
.viewer-stage iframe.docframe { width: 100%; height: 100%; border: none; border-radius: 8px; background: #fff; }
.viewer-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 44px; height: 44px; border-radius: 50%; border: none; cursor: pointer;
  background: rgba(255,255,255,.12); color: #fff; display: flex; align-items: center; justify-content: center;
  transition: background .12s;
}
.viewer-nav:hover { background: rgba(255,255,255,.25); }
.viewer-nav.prev { left: 12px; }
.viewer-nav.next { right: 12px; }
.viewer-nav svg { width: 20px; height: 20px; }
.viewer-count { color: #8fa0b8; font-size: 12px; }
.viewer-fallback { text-align: center; color: #c6d2e2; }
.viewer-fallback .bigicon { width: 74px; height: 74px; margin: 0 auto 16px; }
.viewer-fallback h3 { margin: 0 0 4px; font-size: 16px; color: #fff; }
.viewer-fallback p { margin: 0 0 18px; color: #8fa0b8; font-size: 13px; }
.viewer-spin { color: #8fa0b8; font-size: 13px; }

/* email viewer */
.email-pane {
  width: min(860px, 100%); height: 100%; background: #fff; border-radius: 10px;
  display: flex; flex-direction: column; overflow: hidden;
}
.email-head { padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.email-head h3 { margin: 0 0 8px; font-size: 16px; }
.email-head .erow { font-size: 12.5px; color: var(--muted); margin: 2px 0; display: flex; gap: 6px; }
.email-head .erow b { color: var(--ink); font-weight: 600; flex: none; width: 42px; }
.email-atts { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.email-att {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border: 1px solid var(--line-strong); border-radius: 999px; font-size: 12px; font-weight: 600;
  color: var(--ink); cursor: pointer; background: var(--surface-2);
}
.email-att:hover { border-color: var(--amber); background: var(--amber-ghost); text-decoration: none; }
.email-att svg { width: 12px; height: 12px; color: var(--muted); }
.email-body { flex: 1; border: none; width: 100%; background: #fff; }

/* ── spinner ── */
.spin { width: 22px; height: 22px; border: 2.5px solid var(--line-strong); border-top-color: var(--amber); border-radius: 50%; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.loading-page { display: flex; align-items: center; justify-content: center; min-height: 60vh; }

/* ── toast ── */
/* toasts sit above every stacked surface (markup 220, TGS editor 1200,
   modals stack +10 above whichever surface opened them) */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 5000; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--navy-2); color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; box-shadow: var(--shadow-lg);
  animation: toastin .18s ease; display: flex; align-items: center; gap: 9px; max-width: 90vw;
}
.toast.err { background: #7f1d1d; }
.toast svg { width: 15px; height: 15px; flex: none; }
@keyframes toastin { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ── popover menu ── */
.pop {
  position: fixed; z-index: 300; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow-lg); padding: 5px; min-width: 190px;
  animation: pop .1s ease;
}
.pop button {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 8px 11px; border: none; background: none; border-radius: 7px;
  font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer;
}
.pop button:hover { background: var(--surface-2); }
.pop button.danger { color: var(--danger); }
.pop button.danger:hover { background: var(--danger-soft); }
.pop button svg { width: 14px; height: 14px; color: var(--muted); flex: none; }
.pop button.danger svg { color: var(--danger); }
.pop hr { border: none; border-top: 1px solid var(--line); margin: 4px 6px; }

/* ── upload progress panel ── */
.upl-panel {
  position: fixed; right: 18px; bottom: 18px; width: 330px; z-index: 90;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow-lg); overflow: hidden;
}
.upl-head { display: flex; align-items: center; padding: 11px 14px; background: var(--navy-2); color: #fff; font-size: 13px; font-weight: 700; }
.upl-head span { flex: 1; }
.upl-list { max-height: 230px; overflow-y: auto; }
.upl-item { padding: 9px 14px; border-bottom: 1px solid var(--line); }
.upl-item:last-child { border-bottom: none; }
.upl-item .n { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; justify-content: space-between; gap: 8px; }
.upl-item .n small { color: var(--muted); font-weight: 500; flex: none; }
.upl-bar { height: 4px; background: var(--line); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.upl-bar i { display: block; height: 100%; background: var(--amber); border-radius: 2px; transition: width .15s; }
.upl-item.done .upl-bar i { background: var(--ok); }
.upl-item.err .n, .upl-item.err small { color: var(--danger); }
.upl-item.err .upl-bar i { background: var(--danger); }

/* ── dropzone ── */
.dropzone {
  position: absolute; inset: 0; z-index: 80; display: none;
  align-items: center; justify-content: center;
  background: rgba(245, 158, 11, .13); backdrop-filter: blur(2px);
  border: 3px dashed var(--amber); border-radius: 0;
}
.dropzone.on { display: flex; }
.dropzone .dz-card {
  background: var(--surface); padding: 26px 40px; border-radius: 14px; box-shadow: var(--shadow-lg);
  text-align: center; font-weight: 700; font-size: 16px; pointer-events: none;
}
.dropzone .dz-card small { display: block; font-weight: 500; color: var(--muted); margin-top: 3px; }

/* ── share link box ── */
.linkbox { display: flex; gap: 8px; align-items: center; }
.linkbox .input { flex: 1; font-size: 12.5px; color: var(--muted); background: var(--surface-2); }
.share-banner {
  display: flex; align-items: center; gap: 10px; padding: 11px 15px;
  background: var(--ok-soft); border: 1px solid #bbe7c8; border-radius: var(--radius-sm);
  font-size: 13px; margin-bottom: 18px; flex-wrap: wrap;
}
.share-banner svg { width: 15px; height: 15px; color: var(--ok); flex: none; }
.share-banner .lnk { flex: 1; min-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #14532d; font-weight: 600; }

/* ── invoice sections ── */
.sections-row { display: flex; gap: 9px; flex-wrap: wrap; margin: 0 0 16px; }
.sec-card {
  display: flex; align-items: center; gap: 9px; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  cursor: pointer; transition: border-color .12s, background .12s; font-size: 13px;
  position: relative;
}
.sec-card:hover { border-color: var(--violet); background: #f6f2fd; }
.sec-card.active { border-color: var(--violet); background: #f1eafc; box-shadow: 0 0 0 2px rgba(124,58,237,.15); }
.sec-card .sicon { width: 26px; height: 26px; flex: none; display: inline-flex; align-items: center; justify-content: center; background: #ede6fb; color: var(--violet); border-radius: 7px; }
.sec-card .sicon svg { width: 14px; height: 14px; }
.sec-card b { font-weight: 700; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-card small { color: var(--muted); }
.sec-card .share-dot { margin-left: 2px; }
.sec-new { border-style: dashed; color: var(--muted); }
.sec-new:hover { color: var(--ink); }

.chip.violet { background: #ede6fb; color: #4c1d95; }
.filter-banner {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; margin-bottom: 14px;
  background: #f6f2fd; border: 1px solid #ddd0f5; border-radius: var(--radius-sm); font-size: 13px; flex-wrap: wrap;
}
.filter-banner .ficon { color: var(--violet); display: inline-flex; }
.filter-banner .ficon svg { width: 15px; height: 15px; }
.filter-banner b { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-banner .note { color: var(--muted); }
.filter-banner .grow { flex: 1; }

.picker-list { max-height: 320px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.picker-group { padding: 7px 12px 4px; font-size: 11px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--faint); background: var(--surface-2); border-top: 1px solid var(--line); }
.picker-group:first-child { border-top: none; }
.picker-item { display: flex; align-items: center; gap: 9px; padding: 7px 12px; cursor: pointer; border-top: 1px solid var(--line); font-size: 13px; }
.picker-item:hover { background: var(--amber-ghost); }
.picker-item input { accent-color: var(--violet); margin: 0; flex: none; }
.picker-item .pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.picker-item small { color: var(--muted); flex: none; }

/* ── search results label ── */
.results-note { font-size: 12.5px; color: var(--muted); margin: 0 0 10px; }

/* ── toolbar row ── */
.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.toolbar .input { max-width: 240px; padding: 7px 11px; font-size: 13px; }
.pathbar { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; flex-wrap: wrap; }
.pathbar a { color: var(--muted); padding: 3px 7px; border-radius: 6px; }
.pathbar a:hover { background: rgba(16,25,43,.06); text-decoration: none; color: var(--ink); }
.pathbar .cur { color: var(--ink); padding: 3px 7px; }
.pathbar .sep { color: var(--line-strong); }
.pathbar .pathback { margin-right: 8px; display: inline-flex; align-items: center; gap: 5px; }
.pathbar .pathback svg { width: 14px; height: 14px; }

/* ── project tabs (Files / Map / Notes) + the notes editor ── */
.proj-tabs { margin: 4px 0 12px; }
.nt-wrap { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 14px; min-height: 560px; }
.nt-list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; overflow: hidden; max-height: 78vh; }
.nt-list-head { display: flex; gap: 6px; padding: 8px; border-bottom: 1px solid var(--line); }
.nt-items { overflow-y: auto; flex: 1; }
.nt-item { padding: 9px 10px 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; display: flex; gap: 6px; align-items: flex-start; }
.nt-item:hover { background: var(--surface-2); }
.nt-item.on { background: var(--amber-ghost); box-shadow: inset 3px 0 0 var(--amber); }
.nt-item b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nt-item small { color: var(--faint); font-size: 11.5px; }
.nt-item .iconbtn { opacity: 0; flex: none; }
.nt-item:hover .iconbtn { opacity: 1; }
.nt-editor { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; min-width: 0; }
.nt-title { flex: 1; border: 0; font-size: 21px; font-weight: 800; padding: 14px 18px 4px; background: transparent; outline: none; font-family: inherit; color: var(--ink); min-width: 0; }
.nt-meta { padding: 0 18px 8px; font-size: 11.5px; color: var(--faint); display: flex; gap: 8px; }
.nt-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 6px 10px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); background: var(--surface-2); position: sticky; top: var(--wtabs-h, 0px); z-index: 2; }
.nt-toolbar button { border: 0; background: transparent; padding: 5px 8px; border-radius: 6px; font: inherit; font-size: 12.5px; font-weight: 700; color: var(--muted); cursor: pointer; min-width: 28px; line-height: 1; display: inline-flex; align-items: center; justify-content: center; }
.nt-toolbar button svg { width: 14px; height: 14px; }
.nt-toolbar button:hover { background: rgba(16,25,43,.07); color: var(--ink); }
.nt-toolbar button.on { background: var(--navy); color: #fff; }
.nt-toolbar .sep { width: 1px; height: 18px; background: var(--line-strong); margin: 0 5px; }
.nt-status { margin-left: auto; font-size: 11.5px; color: var(--faint); padding-left: 10px; }
.nt-body { padding: 16px 18px 48px; min-height: 420px; outline: none; font-size: 14.5px; line-height: 1.55; overflow-wrap: anywhere; color: var(--ink); }
.nt-body h1 { font-size: 24px; margin: 18px 0 8px; line-height: 1.25; }
.nt-body h2 { font-size: 19px; margin: 16px 0 6px; line-height: 1.3; }
.nt-body h3 { font-size: 16px; margin: 14px 0 4px; }
.nt-body h4 { font-size: 14.5px; margin: 12px 0 4px; }
.nt-body p, .nt-body div { margin: 0 0 6px; }
.nt-body a { color: var(--amber-deep); text-decoration: underline; cursor: pointer; }
.nt-body a.nt-file { background: var(--amber-soft); padding: 1px 7px; border-radius: 6px; text-decoration: none; font-weight: 600; color: var(--ink); }
.nt-body img { max-width: 100%; border-radius: 8px; display: block; margin: 8px 0; }
.nt-body blockquote { border-left: 3px solid var(--line-strong); margin: 8px 0; padding: 4px 12px; color: var(--muted); }
.nt-body pre { background: var(--surface-2); border: 1px solid var(--line); padding: 10px 12px; border-radius: 8px; font-size: 12.5px; overflow-x: auto; white-space: pre-wrap; }
.nt-body ul, .nt-body ol { padding-left: 24px; margin: 4px 0 8px; }
.nt-body hr { border: 0; border-top: 1px solid var(--line-strong); margin: 14px 0; }
.nt-body table { border-collapse: collapse; margin: 8px 0; }
.nt-body td, .nt-body th { border: 1px solid var(--line); padding: 4px 8px; }
.nt-map { height: 320px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); margin: 10px 0; position: relative; background: var(--surface-2); }
.nt-map-inner { position: absolute; inset: 0; }
.nt-map-cap { position: absolute; left: 8px; top: 8px; z-index: 1; background: rgba(255,255,255,.94); border-radius: 6px; padding: 3px 8px; font-size: 11.5px; font-weight: 700; color: var(--ink); cursor: pointer; box-shadow: var(--shadow); }
.nt-bubble { position: fixed; z-index: 90; background: var(--navy); color: #fff; border-radius: 8px; padding: 3px; display: flex; gap: 2px; box-shadow: var(--shadow-lg); }
.nt-bubble button { border: 0; background: transparent; color: #fff; font: inherit; font-size: 12px; font-weight: 600; padding: 4px 9px; border-radius: 5px; cursor: pointer; }
.nt-bubble button:hover { background: rgba(255,255,255,.16); }
.nt-empty { padding: 70px 24px; text-align: center; color: var(--muted); }
.nt-empty h3 { margin: 0 0 6px; color: var(--ink); }
.nt-empty p { max-width: 420px; margin: 0 auto 14px; }
.map-tab-empty { padding: 50px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
@media (max-width: 860px) { .nt-wrap { grid-template-columns: 1fr; } .nt-list { max-height: 260px; } }

/* share-link QR block (share dialogs) */
.share-qr { display: flex; align-items: center; gap: 14px; }
.share-qr-img { border: 1px solid var(--line); border-radius: 10px; background: #fff; padding: 6px; flex: 0 0 auto; }
.share-qr-btns { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.share-qr-btns .hint { font-size: 11.5px; }

.section-label { font-size: 11.5px; font-weight: 800; letter-spacing: .8px; text-transform: uppercase; color: var(--faint); margin: 20px 0 9px; }

/* ── responsive ── */
@media (max-width: 860px) {
  .sidebar { position: fixed; z-index: 60; height: 100vh; left: 0; top: 0; transform: translateX(-100%); transition: transform .18s ease; box-shadow: var(--shadow-lg); }
  .sidebar.open { transform: none; }
  .main-inner { padding: 18px 16px 70px; }
  .menu-toggle { display: inline-flex !important; }
  .file-row .fdate { display: none; }
  .viewer-stage { padding: 0 10px 12px; }
  .viewer-nav.prev { left: 4px; } .viewer-nav.next { right: 4px; }
}
.menu-toggle { display: none; position: fixed; top: 14px; left: 14px; z-index: 50; background: var(--navy); color: #fff; border: none; box-shadow: var(--shadow); }
.scrim { position: fixed; inset: 0; background: rgba(10,16,28,.4); z-index: 55; display: none; }
.scrim.on { display: block; }

/* ── document versioning ── */
.ver-drop {
  border: 2px dashed var(--line-strong); border-radius: 12px; padding: 30px 16px;
  text-align: center; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; gap: 4px; transition: border-color .12s, background .12s;
}
.ver-drop:hover, .ver-drop.on { border-color: var(--amber); background: var(--amber-ghost); }
.ver-drop.busy { pointer-events: none; opacity: .65; }
.ver-drop .vd-ic { width: 34px; height: 34px; color: var(--faint); margin-bottom: 4px; }
.ver-drop .vd-ic svg { width: 100%; height: 100%; }
.ver-drop b { font-size: 14px; }
.ver-drop small { color: var(--muted); font-size: 12.5px; }
.ver-list { border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden; }
.ver-row {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-top: 1px solid var(--line); font-size: 13px;
}
.ver-row:first-child { border-top: none; }
.ver-row.current { background: var(--surface-2); }
.ver-row .vmain { flex: 1; min-width: 0; }
.ver-row .vname {
  font-weight: 700; display: flex; align-items: center; gap: 7px;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.ver-row .vsub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.ver-row .vshare {
  display: flex; align-items: center; gap: 6px; flex: none; cursor: pointer;
  font-size: 12px; font-weight: 700; color: #713f12;
  padding: 4px 9px; background: var(--amber-ghost); border: 1px solid #fde8b8; border-radius: 8px;
}
.ver-row .vshare input { accent-color: var(--amber); margin: 0; }
.ver-row .factions { display: flex; gap: 2px; flex: none; }
@media (max-width: 640px) {
  .ver-row { flex-wrap: wrap; }
  .ver-row .vmain { flex-basis: calc(100% - 44px); }
}

/* ── accounts & review ── */
.chip.warn { background: #fee2e2; color: #7f1d1d; }
.gate-info { display: none; font-size: 13px; color: #14532d; background: var(--ok-soft); border: 1px solid #bbe7c8; border-radius: 8px; padding: 9px 12px; margin-bottom: 14px; text-align: left; }
.gate-info.on { display: block; }
.gate-card .field label { text-align: left; }
.side-foot-row { display: flex; gap: 8px; margin-top: 8px; }
.side-foot-row .btn { flex: 1; justify-content: center; background: transparent; border-color: rgba(255,255,255,.14); color: #cdd7e5; }
.side-foot-row .btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.folder-card.private { border-style: dashed; background: var(--surface-2); }
.folder-card.private:hover { border-color: var(--faint); background: var(--surface-2); }
.folder-card .fname .chip { margin-left: 6px; vertical-align: 1px; }
textarea.input { resize: vertical; min-height: 64px; }

/* ── dashboard nav + notification badge ── */
.side-nav { padding: 2px 12px 6px; }
.nav-dash {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px;
  cursor: pointer; color: #c3d0e2; font-size: 13.5px; font-weight: 600; user-select: none;
}
.nav-dash:hover { background: rgba(255,255,255,.08); color: #fff; }
.nav-dash.active {
  background: rgba(255,255,255,.14); color: #fff;
  box-shadow: inset 3px 0 0 var(--amber);
}
.nav-dash svg { width: 15px; height: 15px; flex: none; }
.nav-dash .grow { flex: 1; }
.nav-badge {
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 800;
  border-radius: 999px; padding: 1px 7px; min-width: 20px; text-align: center; flex: none;
}
.menu-toggle { overflow: visible; }
.burger-badge { position: absolute; top: -6px; right: -6px; }

/* ── todos ── */
.todo-row .todo-tick { width: 17px; height: 17px; accent-color: var(--ok); margin: 0; cursor: pointer; flex: none; }
.todo-row.done .fname, .todo-row.done .fsub { text-decoration: line-through; opacity: .55; }

/* ── markup (request edits) ── */
.mk { position: fixed; inset: 0; z-index: 220; background: rgba(8,12,22,.95); display: flex; flex-direction: column; animation: fadein .12s ease; }
.mk-top { display: flex; align-items: center; gap: 9px; padding: 10px 14px; color: #dbe4f0; flex-wrap: wrap; }
.mk-top .mkname { font-weight: 700; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }
.mk-top .spacer { flex: 1; }
.mk-top .iconbtn { color: #b9c6d8; }
.mk-top .iconbtn:hover { background: rgba(255,255,255,.12); color: #fff; }
.mk-pages { display: inline-flex; align-items: center; gap: 4px; }
.mk-pageno { font-size: 12.5px; color: #8fa0b8; min-width: 84px; text-align: center; }
.mk-draft {
  display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700;
  color: #6ee7b7; padding: 3px 10px; border-radius: 999px; background: rgba(16,185,129,.14);
}
.mk-draft svg { width: 12px; height: 12px; }
.mk-draft.tick { animation: mkdraftin .35s ease; }
@keyframes mkdraftin { from { transform: scale(.82); opacity: .3; } to { transform: none; opacity: 1; } }
.mk-hintbar {
  padding: 7px 16px; text-align: center; font-size: 12.5px; color: #e8eef7;
  background: rgba(47,111,228,.28); border-top: 1px solid rgba(255,255,255,.08); border-bottom: 1px solid rgba(255,255,255,.08);
}
.mk-hintbar .tag {
  display: inline-flex; align-items: center; justify-content: center; width: 19px; height: 19px;
  border-radius: 50%; color: #fff; font-size: 11px; font-weight: 800; vertical-align: -4px; margin: 0 2px;
}
.mk-body { flex: 1; display: flex; min-height: 0; }
.mk-stage { flex: 1; overflow: auto; padding: 18px 24px 30px; display: flex; align-items: flex-start; justify-content: center; }
.mk-wrap { position: relative; flex: none; box-shadow: 0 10px 60px rgba(0,0,0,.5); border-radius: 4px; background: #fff; }
.mk-wrap canvas, .mk-wrap img { display: block; max-width: none; border-radius: 4px; }
.mk-wrap img { max-width: 100%; }
.mk-loading { padding: 80px 120px; display: flex; justify-content: center; }
.mk-shape {
  --mkc: #ef4444;
  position: absolute; border: 2.5px solid var(--mkc); border-radius: 3px;
  box-shadow: 0 0 0 1.5px rgba(255,255,255,.85), inset 0 0 0 1.5px rgba(255,255,255,.85);
  cursor: pointer; transition: box-shadow .12s ease;
}
.mk-shape.ellipse { border-radius: 50%; }
.mk-shape.ghost { pointer-events: none; border-style: dashed; }
.mk-shape.flash, .mk-shape.hot { box-shadow: 0 0 0 3px color-mix(in srgb, var(--mkc) 45%, transparent), inset 0 0 0 1.5px rgba(255,255,255,.85); }
.mk-shape .tag {
  position: absolute; top: -11px; left: -11px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--mkc); color: #fff; font-size: 12px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 4px rgba(0,0,0,.4); pointer-events: none;
}
.mk-shape.ellipse .tag { top: -8px; left: -8px; }
.mk-panel { width: 330px; flex: none; background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.mk-panel-head { display: flex; align-items: center; gap: 8px; padding: 13px 16px 2px; }
.mk-panel-title { font-size: 13.5px; font-weight: 800; letter-spacing: -.1px; }
.mk-panel-head .chip { font-size: 11px; }
.mk-panel-sub { padding: 4px 16px 11px; font-size: 12px; color: var(--muted); line-height: 1.45; border-bottom: 1px solid var(--line); }
.mk-restored {
  display: flex; align-items: center; gap: 8px; margin: 10px 12px 0; padding: 8px 8px 8px 12px;
  background: var(--amber-ghost, #fff8e6); border: 1px solid var(--amber); border-radius: 10px;
}
.mk-restored-txt { flex: 1; font-size: 12px; font-weight: 600; color: var(--ink); }
.mk-notes { flex: 1; overflow-y: auto; padding: 10px 12px 20px; }
.mk-note {
  --mkc: #ef4444;
  position: relative; border: 1px solid var(--line); border-left: 3px solid var(--mkc);
  border-radius: 10px; padding: 9px 11px 10px; margin-bottom: 9px; cursor: pointer;
  background: var(--surface); transition: border-color .12s ease, box-shadow .12s ease;
}
.mk-note:hover, .mk-note.hot, .mk-note.flash {
  border-color: color-mix(in srgb, var(--mkc) 55%, var(--line));
  border-left-color: var(--mkc);
  box-shadow: 0 1px 8px color-mix(in srgb, var(--mkc) 16%, transparent);
}
.mk-note-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.mk-note-head .tag {
  width: 21px; height: 21px; border-radius: 50%; background: var(--mkc); color: #fff;
  font-size: 11.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.mk-note-head .tag.plain { background: var(--muted); }
.mk-note-head small { color: var(--faint); font-size: 11px; text-transform: uppercase; letter-spacing: .4px; font-weight: 700; }
.mk-note-head .grow { flex: 1; }
.mk-note-rm { opacity: 0; transition: opacity .12s ease; width: 26px; height: 26px; }
.mk-note:hover .mk-note-rm, .mk-note:focus-within .mk-note-rm { opacity: 1; }
.mk-areas { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 7px; }
.mk-area {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 999px;
  font-size: 11px; font-weight: 700; color: var(--mkc);
  background: color-mix(in srgb, var(--mkc) 10%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--mkc) 35%, transparent); cursor: pointer;
}
.mk-area:hover { background: color-mix(in srgb, var(--mkc) 18%, var(--surface)); }
.mk-area-x {
  border: none; background: none; color: inherit; font-size: 13px; line-height: 1;
  padding: 0 0 0 2px; cursor: pointer; opacity: .6; font-weight: 800;
}
.mk-area-x:hover { opacity: 1; }
.mk-area.add {
  color: var(--muted); background: var(--surface-2); border: 1px dashed var(--line-strong);
  font-weight: 700; cursor: pointer;
}
.mk-area.add:hover { color: var(--ink); border-color: var(--muted); }
.mk-area.add.arming { color: #fff; background: var(--mkc); border-style: solid; border-color: var(--mkc); animation: mkpulse 1.2s ease infinite; }
@keyframes mkpulse { 50% { opacity: .65; } }
.mk-note textarea { font-size: 13px; resize: none; overflow: hidden; }
.mk-note-text { font-size: 13px; white-space: pre-wrap; }
.mk-empty { color: var(--muted); font-size: 13px; padding: 22px 14px; text-align: center; line-height: 1.5; }
.mk-empty b { color: var(--ink); }
.mk-empty p { margin: 6px 0 0; }
.mk-empty-glyph { font-size: 26px; letter-spacing: 6px; color: var(--faint); margin-bottom: 8px; }
@media (max-width: 760px) {
  .mk-body { flex-direction: column; }
  .mk-panel { width: 100%; max-height: 42%; border-top: 1px solid var(--line); }
  .mk-note-rm { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .mk-area.add.arming, .mk-draft.tick { animation: none; }
}

/* ── team chat ── */
.chat-layout { display: flex; gap: 14px; align-items: stretch; }
.chat-channels {
  width: 210px; flex: none; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 8px; align-self: flex-start;
}
.chan-row {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px; border-radius: 8px;
  cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--muted);
}
.chan-row:hover { background: var(--surface-2); color: var(--ink); }
.chan-row.active { background: var(--amber-soft); color: #713f12; }
.chan-row svg { width: 15px; height: 15px; flex: none; }
.chan-row .grow { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.chat-summary {
  background: var(--amber-ghost); border: 1px solid #fde8b8; border-radius: 10px;
  padding: 10px 14px; font-size: 13px; margin-bottom: 6px;
}
.chat-summary b { display: block; font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: #92400e; margin-bottom: 4px; }
.chat-msg.ai .chat-text { background: #eef4ff; border-color: #d6e4ff; }
.ai-link { font-weight: 700; color: var(--amber-deep); text-decoration: underline; }
@media (max-width: 860px) {
  .chat-layout { flex-direction: column; }
  .chat-channels { width: 100%; display: flex; overflow-x: auto; gap: 4px; }
  .chan-row { flex: none; }
}
.chat-wrap {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); display: flex; flex-direction: column;
  height: calc(100vh - 260px); min-height: 320px;
}
.chat-msgs { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.chat-msg { max-width: 72%; align-self: flex-start; }
.chat-msg.mine { align-self: flex-end; text-align: right; }
.chat-meta { font-size: 11px; color: var(--faint); margin: 0 6px 2px; }
.chat-text {
  display: inline-block; text-align: left; padding: 8px 13px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.chat-msg.mine .chat-text { background: var(--amber-soft); border-color: #fde8b8; }
.chat-input { display: flex; gap: 8px; margin-top: 12px; align-items: flex-end; }
.chat-input textarea { min-height: 42px; max-height: 140px; }
.chat-input .btn { padding: 10px 16px; }
.chat-input .btn:first-child:not(.primary) { padding: 10px 12px; }

/* message corrections & attachments */
.chat-msg { position: relative; }
.chat-acts { position: absolute; top: 14px; display: none; gap: 2px; }
.chat-msg.mine .chat-acts { left: -66px; }
.chat-msg:not(.mine) .chat-acts { right: -66px; }
.chat-msg:hover .chat-acts { display: flex; }
.chat-text.tomb { font-style: italic; color: var(--faint); background: transparent; border-style: dashed; }
.chat-msg.del .chat-text:not(.tomb) { opacity: .65; text-decoration: line-through; }
.chat-tomb-note { font-size: 11px; color: var(--danger); font-weight: 700; margin: 0 6px 2px; }
.chat-prev { margin-top: 4px; font-size: 12px; text-align: left; }
.chat-prev summary { cursor: pointer; color: var(--faint); }
.chat-prev-text { padding: 5px 9px; margin-top: 4px; background: var(--surface-2); border: 1px dashed var(--line-strong); border-radius: 8px; color: var(--muted); white-space: pre-wrap; }
.chat-att {
  display: inline-flex; align-items: center; gap: 8px; margin-top: 5px; padding: 7px 11px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px;
  cursor: pointer; font-size: 13px; font-weight: 600; max-width: 100%;
}
.chat-att:hover { border-color: var(--amber); background: var(--amber-ghost); }
.chat-att .an { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-att small { color: var(--faint); flex: none; }

/* subtasks */
.subs-edit-row { display: flex; gap: 6px; margin-bottom: 6px; align-items: center; }
.sub-list { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.sub-item { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink); cursor: pointer; }
.sub-item input { accent-color: var(--ok); margin: 0; }
.sub-item.done { color: var(--faint); text-decoration: line-through; }

/* ── upload precheck popup ── */
.pc-list { display: flex; flex-direction: column; gap: 10px; max-height: 55vh; overflow-y: auto; }
.pc-row { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.pc-row.skip { opacity: .55; background: var(--surface-2); }
.pc-head { display: flex; align-items: center; gap: 10px; }
.pc-name { min-width: 0; overflow: hidden; }
.pc-name b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-name small { color: var(--muted); font-size: 11.5px; }
.pc-row textarea { margin-top: 8px; font-size: 13px; }
.pc-ai { display: flex; align-items: center; gap: 7px; margin-top: 7px; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.pc-ai input { accent-color: var(--blue); margin: 0; }

/* upload / version notes */
.file-row .fnote, .vnote { font-size: 12px; color: var(--muted); font-style: italic; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vnote { white-space: normal; }

/* past approvals */
.appr-arrow svg { transition: transform .15s; transform: rotate(90deg); width: 15px; height: 15px; }
.appr-arrow.open svg { transform: rotate(-90deg); }
.appr-notes { margin-top: 4px; font-size: 12.5px; }
.appr-notes summary { cursor: pointer; color: var(--blue); font-size: 12px; }
.appr-note { padding: 3px 0 3px 14px; border-left: 2px solid var(--line); margin: 4px 0 0 2px; color: var(--muted); white-space: normal; }
.file-row.gone { opacity: .7; cursor: default; }

/* chat: reading a past day */
.chat-pastbar { display: flex; align-items: center; gap: 10px; padding: 8px 14px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 13px; color: var(--muted); }

/* ── upload checklists ── */
.ckl-meta { display: flex; align-items: center; gap: 9px; font-size: 13.5px; font-weight: 700; margin-bottom: 4px; flex-wrap: wrap; }
.ckl-meta .grow { flex: 1; }
.ckl-byline { font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.ckl-sec-h { margin: 16px 0 8px; display: flex; flex-direction: column; gap: 2px; }
.ckl-sec-h b { font-size: 13.5px; }
.ckl-sec-h small { color: var(--muted); font-size: 12px; }
.ckl-list { display: flex; flex-direction: column; gap: 7px; }
.ckl-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.ckl-row.done { background: var(--surface-2); }
.ckl-row.done .ckl-row-text { text-decoration: line-through; color: var(--muted); }
.ckl-row input[type="checkbox"] { width: 17px; height: 17px; margin-top: 1px; accent-color: var(--ok); flex: none; cursor: pointer; }
.ckl-row-main { flex: 1; min-width: 0; }
.ckl-row-text { font-size: 13px; line-height: 1.45; display: block; }
.ckl-when { display: block; color: var(--faint); font-size: 11px; margin-top: 2px; }
.ckl-notebtn { border: none; background: none; color: var(--faint); cursor: pointer; padding: 2px; border-radius: 6px; flex: none; }
.ckl-notebtn svg { width: 14px; height: 14px; }
.ckl-notebtn:hover { color: var(--ink); background: var(--surface-2); }
.ckl-notebtn.has { color: var(--amber-deep, #92610a); }
.ckl-note { margin-top: 7px; }
.ckl-note textarea { font-size: 12.5px; resize: none; overflow: hidden; }
.ckl-note-ro { font-size: 12.5px; color: var(--muted); font-style: italic; }
.ckl-q { border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; }
.ckl-q-text { font-size: 13px; font-weight: 700; margin-bottom: 8px; }
.ckl-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.ckl-opt {
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px;
  padding: 5px 13px; font-size: 12.5px; font-weight: 700; cursor: pointer; color: var(--muted);
}
.ckl-opt:hover:not(:disabled) { border-color: var(--muted); color: var(--ink); }
.ckl-opt.sel { background: var(--navy); border-color: var(--navy); color: #fff; }
.ckl-opt.ro { cursor: default; }
.ckl-opt:disabled { cursor: default; opacity: .85; }
.ckl-sub { display: flex; flex-direction: column; gap: 6px; margin-top: 9px; }
.ckl-sub:empty { display: none; }
.ckl-sub .ckl-row { background: var(--surface-2); border-style: dashed; }
.ckl-sub .ckl-row.done { background: var(--surface-2); }
.ckl-empty { color: var(--muted); font-size: 13px; padding: 16px 8px; text-align: center; }
.ckl-saved { margin-top: 12px; font-size: 12px; font-weight: 700; color: var(--ok); display: flex; align-items: center; gap: 5px; }
.ckl-saved.busy { color: var(--muted); }
.ckl-saved svg { width: 12px; height: 12px; }
.ckl-chip { margin-left: 8px; border: none; cursor: pointer; }
.ckl-chip svg { width: 11px; height: 11px; }

/* template editor */
.ckl-ed-list { display: flex; flex-direction: column; gap: 10px; }
.ckl-ed-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.ckl-ed-head { display: flex; align-items: center; gap: 7px; margin-bottom: 8px; }
.ckl-ed-head .grow { flex: 1; }
.ckl-ed-head .input { flex: 1; }
.ckl-ed-opts { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.ckl-ed-opt { border: 1px dashed var(--line-strong); border-radius: 10px; padding: 9px 11px; }
.ckl-ed-opt .ckl-ed-head { margin-bottom: 0; }
.ckl-ed-subs { display: flex; flex-direction: column; gap: 6px; margin: 8px 0 6px 18px; }
.ckl-ed-sub { display: flex; align-items: center; gap: 6px; }
.ckl-ed-sub .input { flex: 1; font-size: 12.5px; }
.ckl-ed-add { display: flex; gap: 8px; margin-top: 12px; }
.ckl-ed-addrow { display: flex; gap: 6px; flex-wrap: wrap; }
.ckl-ed-nested {
  border: 1px solid var(--line); border-left: 3px solid #8b5cf6; border-radius: 10px;
  padding: 9px 11px; background: var(--surface);
}
/* nested sub-questions in the fill dialog sit inside the revealed area */
.ckl-sub .ckl-q { background: var(--surface); }

/* dump popup warnings */
.pc-warn { margin-top: 8px; padding: 8px 10px; border-radius: 8px; background: var(--amber-ghost); border: 1px solid var(--amber-soft); color: var(--amber-deep); font-size: 12.5px; line-height: 1.45; }

/* multi-select + drag reorder */
.fsel { opacity: .25; margin: 0 2px 0 0; accent-color: var(--blue); cursor: pointer; flex-shrink: 0; }
.file-row:hover .fsel, .fsel.on, .fsel:checked { opacity: 1; }
.file-row.dragging { opacity: .4; }
.file-row.drop-above { box-shadow: 0 -2px 0 0 var(--blue); }
.file-row.drop-below { box-shadow: 0 2px 0 0 var(--blue); }
.selbar { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 60;
  display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 12px;
  background: var(--navy); color: #fff; box-shadow: 0 8px 30px rgba(0,0,0,.35); }
.selbar .selcount { font-size: 13px; font-weight: 600; margin-right: 4px; white-space: nowrap; }
.selbar .btn { background: var(--navy-3); color: #fff; border-color: transparent; }
.selbar .btn:hover { background: var(--navy-2); }
.selbar .btn.danger { background: var(--danger); }

/* ── billing (admin) ── */
.rates-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.bill-edit { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.bill-group { background: var(--surface-2); padding: 8px 12px; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .4px; color: var(--muted); border-bottom: 1px solid var(--line); }
.bill-line { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.bill-line:last-child { border-bottom: none; }
.bill-line.footer { background: var(--surface-2); font-size: 15px; }
.bill-name { flex: 1 1 180px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13.5px; }
.bill-edit .sm-in { padding: 5px 8px; font-size: 13px; width: auto; }
.bill-edit select.sm-in { max-width: 130px; }
.bill-edit input.num { max-width: 74px; text-align: right; }
.bill-line-total { min-width: 74px; text-align: right; font-weight: 600; font-size: 13.5px; }

/* ── billing (public /b/ pages) ── */
.bill-page { max-width: 860px; margin: 0 auto; padding: 34px 22px 60px; }
.bill-head { display: flex; align-items: flex-start; gap: 16px; justify-content: space-between; margin-bottom: 26px; }
.bill-brand { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; color: var(--amber-deep); margin-bottom: 6px; }
.bill-head h1 { margin: 0 0 6px; font-size: 26px; }
.bill-sub { color: var(--muted); font-size: 14px; }
.bill-client { margin-bottom: 26px; }
.bill-client h2 { font-size: 17px; margin: 0 0 10px; }
.bill-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; overflow: hidden; margin-bottom: 14px; font-size: 14px; }
.bill-table th, .bill-table td { padding: 9px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.bill-table thead th { background: var(--surface-2); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); }
.bill-table th.bill-proj { background: var(--navy); color: #fff; font-size: 13px; text-transform: none; letter-spacing: 0; }
.bill-table .num { text-align: right; white-space: nowrap; }
.bill-table tbody tr:last-child td { border-bottom: none; }
.bill-note { font-size: 12px; color: var(--muted); font-style: italic; }
.bill-subtotal { text-align: right; font-weight: 600; margin: -6px 0 4px; font-size: 14px; }
.bill-total { text-align: right; font-size: 19px; font-weight: 700; padding-top: 8px; border-top: 2px solid var(--ink); }
.bill-foot { margin-top: 8px; }
@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .bill-page { padding: 0; max-width: none; }
}

/* retainer discount + restorable bill lines */
.bill-subline { text-align: right; font-size: 14px; color: var(--muted); padding: 2px 0; }
.bill-subline.discount { color: var(--ok); font-weight: 600; }
.bill-line.removed { opacity: .55; }
.bill-line.removed .bill-name { text-decoration: line-through; }
.bill-note-in { width: 100%; font-size: 12.5px; padding: 5px 8px; margin-top: 2px; }

/* onward links on bill pages */
.bill-clientlink { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0 0 12px;
  padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 13px; color: var(--muted); }
.bill-proj { position: relative; }
.bill-files-link { float: right; color: var(--amber); font-weight: 600; font-size: 12.5px; text-decoration: none; }
.bill-files-link:hover { text-decoration: underline; }

.bill-group-add { text-transform: none; letter-spacing: 0; font-size: 12px; padding: 3px 10px; }

/* ── Generic TGS library ── */
.tgs-head h1 { margin: 0 0 4px; }
.tgs-toolbar { display: flex; gap: 8px; align-items: center; margin: 14px 0 10px; flex-wrap: wrap; }
.tgs-list { display: flex; flex-direction: column; gap: 8px; }
.tgs-none { padding: 26px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--line); border-radius: 12px; }
.tgs-row { display: flex; gap: 10px; align-items: center; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; flex-wrap: wrap; }
.tgs-row-main { flex: 1; min-width: 240px; }
.tgs-row-title { font-weight: 600; margin-bottom: 4px; }
.tgs-row-meta { display: flex; gap: 5px; flex-wrap: wrap; }
.tgs-chip { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--bg); border: 1px solid var(--line); color: var(--muted); }
.tgs-chip.dark { background: #0f1a2e; border-color: #0f1a2e; color: #fff; }
.tgs-chip.warn { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.tgs-chip.cat { background: #e0e7ff; border-color: #c7d2fe; color: #3730a3; }
.tgs-row-acts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.tgs-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tgs-tedit { display: flex; flex-direction: column; gap: 6px; }
.tgs-tedit-row { display: flex; gap: 6px; align-items: center; }
.tgs-tedit-row .input:first-child { flex: 0 0 34%; }
.tgs-tedit-row .input:nth-child(2) { flex: 1; }
.tgs-prog { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 16px 0; }

/* ── Generic TGS editor, designer & preview ──
   One coherent system, native to the app's light design language:
   white chrome, hairline dividers, blue selection, amber Save.
   (Replaces the earlier dark-chrome experiment and its patch layers.) */

/* shell */
.tgs-ed { position: fixed; inset: 0; z-index: 1200; background: var(--bg); display: flex; flex-direction: column; }
.tgs-ed-top { display: flex; align-items: center; gap: 16px; padding: 8px 16px; min-height: 56px; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tgs-ed-lead { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tgs-ed-titles { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.tgs-ed-name { font-weight: 650; font-size: 14px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.tgs-ed-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 32vw; }
.tgs-ed-pager { display: flex; align-items: center; gap: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 2px; }
.tgs-ed-pager .iconbtn { width: 26px; height: 26px; border-radius: 6px; }
.tgs-pageno { font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 0 10px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tgs-ed-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; flex-wrap: wrap; }
.tgs-ed-actions .tgs-addsel { width: auto; padding: 6px 9px; font-size: 12.5px; }
.tgs-ed-body { flex: 1; display: flex; min-height: 0; }
.tgs-ed-hints { padding: 6px 14px; text-align: center; font-size: 11.5px; color: var(--faint); background: var(--surface); border-top: 1px solid var(--line); }
.tgs-save.dirty::after { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #241a02; margin-left: 2px; }

/* stage & page */
.tgs-stage, .tgs-ds-stage {
  flex: 1; overflow: auto; padding: 28px;
  display: flex; align-items: flex-start; justify-content: center;
  background-color: #e7ebf3;
  background-image: radial-gradient(rgba(16,25,43,.075) 1px, transparent 1px);
  background-size: 20px 20px;
}
.tgs-ds-stage { align-items: center; }
.tgs-wrap, .tgs-ds-board { position: relative; background: #fff; line-height: 1.25; box-shadow: 0 1px 3px rgba(16,25,43,.14), 0 10px 34px rgba(16,25,43,.16); }
/* mobile font boosting must NEVER touch TGS content: it inflates text during
   the fit measurement but not in the PDF rasterization, so the fit loop
   over-shrinks ~3x. The property is not inherited — hit every element. */
.tgs-wrap, .tgs-wrap *, .tgs-ds-board, .tgs-ds-board * { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.tgs-wrap canvas { display: block; }
.tgs-loading { display: flex; align-items: center; justify-content: center; padding: 60px; color: var(--muted); }
.tgs-pv-scroll { flex: 1; overflow: auto; padding: 28px; display: flex; flex-direction: column; align-items: center; gap: 26px; background-color: #e7ebf3; }
.tgs-stage::-webkit-scrollbar, .tgs-ds-stage::-webkit-scrollbar, .tgs-pv-scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.tgs-stage::-webkit-scrollbar-thumb, .tgs-ds-stage::-webkit-scrollbar-thumb, .tgs-pv-scroll::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 5px; }

/* inspector */
.tgs-side { width: 320px; flex: none; background: var(--surface); border-left: 1px solid var(--line); overflow-y: auto; display: flex; flex-direction: column; }
.tgs-side::-webkit-scrollbar { width: 8px; }
.tgs-side::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 4px; }
.tgs-sec { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.tgs-side-h { display: flex; align-items: center; gap: 7px; padding: 14px 16px 8px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.tgs-plist { max-height: 34vh; overflow-y: auto; }
.tgs-plist .hint { padding: 4px 16px 8px; }
.tgs-pitem { display: flex; align-items: center; gap: 9px; padding: 7px 16px; font-size: 13px; color: var(--ink); cursor: pointer; border-left: 2px solid transparent; }
.tgs-pitem:hover { background: var(--surface-2); }
.tgs-pitem.sel { background: var(--blue-soft); border-left-color: var(--blue); font-weight: 600; }
.tgs-pitem > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tgs-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tgs-count { margin-left: auto; background: var(--bg); border: 1px solid var(--line); color: var(--muted); border-radius: 999px; padding: 0 8px; font-size: 10.5px; letter-spacing: 0; text-transform: none; font-variant-numeric: tabular-nums; }

/* properties: aligned label + control rows */
.tgs-props { padding-bottom: 16px; }
.tgs-prop { display: grid; grid-template-columns: 88px 1fr; align-items: center; gap: 10px; padding: 5px 16px; font-size: 12.5px; color: var(--ink); }
.tgs-prop.stack { grid-template-columns: 1fr; gap: 5px; }
.tgs-prop-l { color: var(--muted); font-weight: 600; font-size: 12px; line-height: 1.35; }
.tgs-prop .input, .tgs-prop select.input, .tgs-prop textarea.input { padding: 6px 9px; font-size: 12.5px; }
.tgs-prop input[type=color] { width: 32px; height: 28px; padding: 1px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); flex: none; cursor: pointer; }
.tgs-prop input[type=number] { max-width: 90px; }
.tgs-slider { display: flex; align-items: center; gap: 8px; min-width: 0; }
.tgs-slider input[type=range] { flex: 1; min-width: 0; accent-color: var(--blue); }
.tgs-slider-v { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; min-width: 38px; text-align: right; flex: none; }
.tgs-prop-acts { display: flex; gap: 8px; padding: 14px 16px 0; flex-wrap: wrap; }
.tgs-prop-acts .btn.danger { margin-left: auto; }
.tgs-noselect { padding: 24px 18px; text-align: center; color: var(--faint); font-size: 12.5px; line-height: 1.55; }
.tgs-noselect-icon { font-size: 24px; line-height: 1; margin-bottom: 8px; color: var(--line-strong); }
.tgs-side input[type=checkbox] { accent-color: var(--blue); }

/* selection chrome on the page */
.tgs-panel.tgs-editable { cursor: move; outline: 1px dashed rgba(37,99,235,.5); }
.tgs-panel.tgs-editable:hover { outline: 1.5px solid rgba(37,99,235,.8); }
.tgs-panel.tgs-editable.sel { outline: 2px solid var(--blue); z-index: 5; }
.tgs-badge { position: absolute; top: -1.9em; left: -2px; font-size: 10.5px; font-weight: 600; background: var(--blue); color: #fff; padding: 2px 7px; border-radius: 5px; white-space: nowrap; opacity: 0; pointer-events: none; letter-spacing: .02em; box-shadow: 0 2px 8px rgba(37,99,235,.35); }
.tgs-panel.tgs-editable:hover .tgs-badge, .tgs-panel.tgs-editable.sel .tgs-badge, .tgs-ds-el:hover .tgs-badge { opacity: 1; }
.tgs-hdl { position: absolute; width: 9px; height: 9px; background: #fff; border: 1.5px solid var(--blue); border-radius: 2px; z-index: 6; box-shadow: 0 1px 3px rgba(16,25,43,.25); }
.tgs-hdl-nw { top: -5px; left: -5px; cursor: nwse-resize; }
.tgs-hdl-n  { top: -5px; left: calc(50% - 5px); cursor: ns-resize; }
.tgs-hdl-ne { top: -5px; right: -5px; cursor: nesw-resize; }
.tgs-hdl-e  { top: calc(50% - 5px); right: -5px; cursor: ew-resize; }
.tgs-hdl-se { bottom: -5px; right: -5px; cursor: nwse-resize; }
.tgs-hdl-s  { bottom: -5px; left: calc(50% - 5px); cursor: ns-resize; }
.tgs-hdl-sw { bottom: -5px; left: -5px; cursor: nesw-resize; }
.tgs-hdl-w  { top: calc(50% - 5px); left: -5px; cursor: ew-resize; }
/* snap alignment guides */
.tgs-guide { position: absolute; z-index: 7; pointer-events: none; background: #e0447d; }
.tgs-guide.v { top: 0; bottom: 0; width: 1px; }
.tgs-guide.h { left: 0; right: 0; height: 1px; }

/* ── the panels themselves (print fidelity — matches the finished TGS) ── */
.tgs-panel { position: absolute; background: #fff; overflow: hidden; box-sizing: border-box; color: #111; padding: 0.25em 0.35em; }
.tgs-panel, .tgs-design { font-family: Arial, "Helvetica Neue", Helvetica, sans-serif; }
/* over an erased canvas the panel itself is transparent — the canvas
   whiteout carries the white, so panel edges can never cover linework */
.tgs-panel.tgs-onwhite:not(.tgs-empty) { background: transparent; }
.tgs-panel.tgs-mid { display: flex; align-items: center; }
.tgs-panel.tgs-mid > div { width: 100%; }
.tgs-pre { white-space: pre-wrap; }
.tgs-h { font-weight: 400; text-align: center; font-size: 1.4em; margin-bottom: 0.35em; }
.tgs-h.tgs-h-sm { font-weight: 700; text-align: left; font-size: 1em; margin-bottom: 0.2em; }
/* the notes box heading: big bold red "TGS NOTES", as in the reference */
.tgs-h.tgs-h-notes { color: #f00; font-weight: 700; text-align: left; font-size: 2.4em; line-height: 1.15; margin: 0 0 0.12em 0.02em; }
.tgs-req { color: #d21; font-weight: 700; margin: 0 0.15em; }
.tgs-tbl { border-collapse: collapse; width: 100%; }
.tgs-tbl th, .tgs-tbl td { border: 1px solid #333; padding: 0.14em 0.3em; text-align: left; font-size: 1em; }
.tgs-tbl th { font-weight: 700; white-space: nowrap; }
.tgs-tbl.tgs-fill { height: 100%; }
.tgs-tbl.tgs-fill th { width: 34%; }
.tgs-tbl.tgs-fill td { overflow-wrap: anywhere; }
/* tight fit (tiny renders): labels may wrap, padding shrinks */
.tgs-fit-tight .tgs-tbl th { white-space: normal; }
.tgs-fit-tight .tgs-tbl th, .tgs-fit-tight .tgs-tbl td { padding: 0.1em 0.15em; }
.tgs-col { display: flex; flex-direction: column; }
.tgs-col .tgs-h { flex: 0 0 auto; }
.tgs-col .tgs-tbl.tgs-fill, .tgs-col .tgs-checks { flex: 1 1 auto; }
/* the table fills the space UNDER the heading — height:100% would count the
   heading twice, leaving every panel "overflowed" before fitting even starts */
.tgs-col .tgs-tbl.tgs-fill { height: auto; flex: 1 1 0%; }
/* details table: label cells size to content, short rows span the grid */
.tgs-p-detailstable th { width: auto; white-space: nowrap; }
.tgs-p-detailstable td { width: auto; }
/* checklist rows: bordered strips with a square check box */
.tgs-checks { display: flex; flex-direction: column; gap: 0; }
.tgs-check { display: flex; gap: 0.5em; align-items: center; flex: 1; border: 1px solid #333; padding: 0.35em 0.45em; margin-top: -1px; }
.tgs-check:first-child { margin-top: 0; }
.tgs-cbx { flex: 0 0 auto; width: 1em; height: 1em; border: 1.5px solid #333; background: #fff; }
/* side streets: slim numbers column, centred headers (reference layout) */
.tgs-tbl.tgs-ss { table-layout: fixed; }
.tgs-tbl.tgs-ss th { width: auto; }
.tgs-tbl.tgs-ss th.num { text-align: center; padding: 0.14em 0.05em; }
.tgs-tbl.tgs-ss th.mid { text-align: center; }
/* queue calculator: table + QR block side by side (reference layout) */
.tgs-qrow { display: flex; align-items: stretch; height: 100%; }
.tgs-qrow .tgs-tbl.tgs-qc { flex: 1 1 auto; width: auto; height: 100%; }
.tgs-tbl.tgs-qc th { width: 62%; }
.tgs-tbl.tgs-qc td { font-variant-numeric: tabular-nums; }
.tgs-qv { font-size: 1.35em; }
.tgs-qm { float: right; }
.tgs-qcqr { flex: 0 0 30%; margin-left: -1px; border: 1px solid #333; display: flex; flex-direction: column; align-items: center; padding: 0.2em 0.2em 0.25em; min-width: 0; }
.tgs-qcqr-cap { font-size: 0.69em; line-height: 1.15; text-align: center; white-space: nowrap; overflow: hidden; max-width: 100%; }
.tgs-qcqr .tgs-img { flex: 1 1 auto; min-height: 0; width: 100%; }
.tgs-qcqr-ph { flex: 1 1 auto; align-self: stretch; margin: 0.2em 0.6em 0.1em; border: 1px dashed #9aa3b5; color: #8a93a5; display: flex; align-items: center; justify-content: center; font-size: 0.8em; }
.tgs-p-pageno { white-space: nowrap; padding: 0.1em 0.2em; }
.tgs-p-notes .tgs-pre { line-height: 1.17; }
.tgs-img { width: 100%; height: 100%; object-fit: contain; display: block; }
.tgs-panel.tgs-empty { border: 1.5px dashed #b6bdca; background: repeating-linear-gradient(45deg, #fff, #fff 8px, #f4f6fa 8px, #f4f6fa 16px); }
.tgs-ph { color: #8a93a5; font-size: 0.9em; display: flex; align-items: center; justify-content: center; height: 100%; text-align: center; }

/* ── panel designer ── */
.tgs-ds-add { display: flex; gap: 6px; flex-wrap: wrap; }
.tgs-ds-side { width: 320px; }
.tgs-ds-list { max-height: 30vh; overflow-y: auto; }
.tgs-ds-cb { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 5px; }
.tgs-ds-cells { display: grid; gap: 4px; }

/* design elements (shared renderer) */
.tgs-design { position: absolute; inset: 0; overflow: hidden; }
.tgs-de { position: absolute; overflow: hidden; box-sizing: border-box; color: #111; line-height: 1.25; }
.tgs-de.tgs-mid { display: flex; align-items: center; }
.tgs-dtbl { border-collapse: collapse; width: 100%; height: 100%; table-layout: fixed; }
.tgs-dtbl th, .tgs-dtbl td { border: var(--dtb, 1px solid #111); padding: 0.12em 0.3em; text-align: left; font-weight: 400; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.tgs-dtbl th { font-weight: 700; }
.tgs-de-fieldbox { padding: 0.15em 0.3em; }
.tgs-de-flabel { font-weight: 700; font-size: 0.85em; display: block; }
.tgs-de-fval { display: block; }

/* designer chrome */
.tgs-ds-el { cursor: move; outline: 1px dashed rgba(37,99,235,.45); }
.tgs-ds-el:hover { outline: 1.5px solid rgba(37,99,235,.75); }
.tgs-ds-el.sel { outline: 2px solid var(--blue); z-index: 5; }

/* library rows, picker & sidebar entry */
.tgs-row { box-shadow: 0 1px 2px rgba(15,26,46,.05); transition: border-color .15s, box-shadow .15s; }
.tgs-row:hover { box-shadow: 0 3px 10px rgba(15,26,46,.08); }
.nav-dash.sub { margin-left: 24px; font-size: 13px; padding-top: 6px; padding-bottom: 6px; }
.tgs-pick { cursor: pointer; }
.tgs-pick:hover { border-color: var(--blue); box-shadow: 0 4px 14px rgba(37,99,235,.15); }

/* values dialog: details-table rows (two label/value pairs per row) */
.tgs-tedit-row.four .input { flex: 1 1 0; min-width: 0; }
.tgs-tedit-row.four .input:nth-child(odd) { flex: 0 0 22%; }

@media (max-width: 760px) {
  .tgs-side { display: none; }
  .tgs-cols { grid-template-columns: 1fr; }
  .tgs-ed-name, .tgs-ed-sub { max-width: 60vw; }
}

/* ── generics: tabs, projects & templates admin ── */
.tgs-tabs { display: inline-flex; gap: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 3px; margin: 10px 0 2px; }
.tgs-tab { border: none; background: transparent; padding: 6px 14px; border-radius: 7px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tgs-tab:hover { color: var(--ink); }
.tgs-tab.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(16,25,43,.12); }
.tgs-proj { display: flex; flex-direction: column; gap: 14px; align-items: flex-start; }
.tgs-proj > .card { width: 100%; }
.tgs-proj-title { display: flex; align-items: center; gap: 10px; }
.tgs-proj-title h1 { margin: 0; }
.tgs-proj-link { font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
.tgs-proj-card { padding: 14px 16px; }
.tgs-proj-card-h { display: flex; align-items: center; gap: 8px; font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); margin-bottom: 10px; }
.tgs-proj-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.tgs-row-off { opacity: .65; }
.tgs-libpick { display: flex; flex-direction: column; gap: 4px; max-height: 50vh; overflow-y: auto; }
.tgs-libpick-row { display: flex; align-items: center; gap: 9px; padding: 7px 6px; border-radius: 7px; cursor: pointer; }
.tgs-libpick-row:hover { background: var(--surface-2); }
.tgs-libpick-row input { accent-color: var(--blue); width: 15px; height: 15px; }
.tgs-logo-row { display: flex; gap: 24px; flex-wrap: wrap; }
.tgs-logo-slot { display: flex; flex-direction: column; gap: 8px; }
.tgs-logo-img { height: 64px; max-width: 220px; object-fit: contain; border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; }
.tgs-logo-empty { height: 64px; width: 190px; border: 1.5px dashed var(--line-strong); border-radius: 8px; display: flex; align-items: center; justify-content: center; color: var(--faint); font-size: 12px; }
.tgs-sel-list { display: flex; flex-direction: column; gap: 2px; }
.tgs-sel-row { border-top: 1px solid var(--line); padding: 8px 2px; }
.tgs-sel-row:first-child { border-top: none; }
.tgs-sel-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tgs-sel-details { padding: 6px 0 2px 12px; display: flex; flex-direction: column; gap: 3px; font-size: 13px; }

/* flow builder */
.tgs-fb-scroll { flex: 1; overflow-y: auto; background-color: #e7ebf3; background-image: radial-gradient(rgba(16,25,43,.075) 1px, transparent 1px); background-size: 20px 20px; }
.tgs-fb-col { max-width: 760px; margin: 26px auto; padding: 0 18px; display: flex; flex-direction: column; gap: 14px; }
.tgs-fb-start { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--muted); }
.tgs-fb-start select { max-width: 340px; }
.tgs-fb-q { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(16,25,43,.07); }
.tgs-fb-q.start { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue), 0 1px 3px rgba(16,25,43,.07); }
.tgs-fb-q-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.tgs-fb-q-n { width: 22px; height: 22px; border-radius: 50%; background: var(--navy); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.tgs-fb-opts { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.tgs-fb-opt { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tgs-fb-opt > input.input { flex: 1 1 180px; }
.tgs-fb-opt select { flex: 0 1 240px; }

/* ── public generic-project page (/g/…) ── */
.tgp { max-width: 1060px; margin: 0 auto; padding: 22px 18px 40px; }
.tgp-head { display: flex; align-items: center; gap: 18px; padding: 16px 0 18px; border-bottom: 2px solid var(--navy); }
.tgp-brand { display: flex; align-items: center; gap: 16px; flex: 1; min-width: 0; }
.tgp-logo { height: 58px; max-width: 190px; object-fit: contain; }
.tgp-titles h1 { margin: 0; font-size: 22px; line-height: 1.25; }
.tgp-sub { color: var(--muted); font-size: 13.5px; margin-top: 2px; }
.tgp-bar { display: flex; gap: 10px; align-items: center; margin: 18px 0 6px; flex-wrap: wrap; }
.tgp-search { max-width: 320px; }
.tgp-varnote { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 13px; color: var(--muted); background: var(--amber-ghost); border: 1px solid var(--amber-soft); border-radius: 10px; padding: 8px 12px; margin: 8px 0; }
.tgp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; margin-top: 12px; }
.tgp-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 1px 2px rgba(15,26,46,.05); }
.tgp-card.chosen { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok), 0 1px 2px rgba(15,26,46,.05); }
.tgp-card-title { font-weight: 650; line-height: 1.35; }
.tgp-chosen-tag { color: var(--ok); font-size: 12.5px; font-weight: 700; }
.tgp-card-foot { margin-top: auto; display: flex; justify-content: flex-end; }
.tgp-foot { margin-top: 34px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--faint); font-size: 12.5px; }
/* flow runner */
.tgp-flow-body { flex: 1; overflow-y: auto; display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; background-color: #e7ebf3; background-image: radial-gradient(rgba(16,25,43,.075) 1px, transparent 1px); background-size: 20px 20px; }
.tgp-flow-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 26px 28px 22px; width: 560px; max-width: 96vw; }
.tgp-q-step { font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); margin-bottom: 6px; }
.tgp-q { margin: 0 0 16px; font-size: 19px; line-height: 1.35; }
.tgp-opts { display: flex; flex-direction: column; gap: 8px; }
.tgp-opt { text-align: left; padding: 12px 16px; border-radius: 10px; border: 1.5px solid var(--line-strong); background: var(--surface); font-size: 14.5px; font-weight: 600; color: var(--ink); cursor: pointer; transition: border-color .12s, background .12s; }
.tgp-opt:hover { border-color: var(--blue); background: var(--blue-soft); }
.tgp-q-in { font-size: 15px; padding: 11px 13px; }
.tgp-q-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.tgp-q-back { margin-top: 12px; }
.tgp-vars { display: flex; flex-direction: column; gap: 3px; font-size: 13.5px; margin-bottom: 12px; }
.tgp-result-list { display: flex; flex-direction: column; gap: 8px; }
.tgp-result { display: flex; align-items: center; justify-content: space-between; gap: 12px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }

/* printing an open TGS: only its pages, one per sheet */
@media print {
  body:has(.tgp-view) > *:not(.tgp-view) { display: none !important; }
  .tgp-view { position: static !important; }
  .tgp-view .tgs-ed-top { display: none !important; }
  .tgp-view .tgs-pv-scroll { overflow: visible !important; padding: 0 !important; background: #fff !important; display: block !important; }
  .tgp-view .tgp-page { box-shadow: none !important; margin: 0 auto !important; break-after: page; width: 100% !important; }
  .tgp-view .tgp-page canvas { width: 100% !important; height: auto !important; }
  @page { size: A4 landscape; margin: 6mm; }
}

/* ── generics grouped lists (library / project / pickers) ── */
.tgs-grouped { display: flex; flex-direction: column; gap: 8px; }
.tgs-group { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.tgs-group-h { display: flex; align-items: center; gap: 9px; width: 100%; padding: 11px 14px; border: none; background: transparent; cursor: pointer; font-size: 13.5px; font-weight: 650; color: var(--ink); text-align: left; }
.tgs-group-h:hover { background: var(--surface-2); }
.tgs-group-chev { display: inline-flex; transition: transform .15s; color: var(--faint); }
.tgs-group-chev svg { width: 15px; height: 15px; }
.tgs-group.open .tgs-group-chev { transform: rotate(90deg); }
.tgs-group-body { display: none; padding: 0 10px 10px; }
.tgs-group.open .tgs-group-body { display: block; }
.tgs-group-body .tgs-row { border-radius: 9px; }
.tgs-libpick-wrap { display: flex; flex-direction: column; gap: 8px; }
.tgs-libpick-row.tgs-libpick-group { font-weight: 700; background: var(--surface-2); position: sticky; top: 0; }
.tgs-libpick-row.sub { padding-left: 26px; }

/* ── flow-chart builder ── */
.tgs-fc-stage { flex: 1; overflow: auto; background-color: #e7ebf3; background-image: radial-gradient(rgba(16,25,43,.075) 1px, transparent 1px); background-size: 20px 20px; }
.tgs-fc-canvas { position: relative; min-width: 100%; min-height: 100%; }
.tgs-fc-svg { position: absolute; inset: 0; pointer-events: none; }
.tgs-fc-edge { fill: none; stroke: #64748b; stroke-width: 1.8; }
.tgs-fc-cut { pointer-events: auto; cursor: pointer; opacity: 0; }
.tgs-fc-svg:hover .tgs-fc-cut, .tgs-fc-cut:hover { opacity: 1; }
.tgs-fc-cut circle { fill: #fff; stroke: #b42318; stroke-width: 1.5; }
.tgs-fc-cut path { stroke: #b42318; stroke-width: 1.6; }
.tgs-fc-node { position: absolute; width: 280px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; padding: 10px 12px 12px; box-shadow: 0 2px 8px rgba(16,25,43,.1); cursor: grab; }
.tgs-fc-node:active { cursor: grabbing; }
.tgs-fc-node.isstart { border-color: var(--ok); box-shadow: 0 0 0 1px var(--ok), 0 2px 8px rgba(16,25,43,.1); }
.tgs-fc-node-h { display: flex; align-items: center; gap: 7px; margin-bottom: 7px; }
.tgs-fc-in { width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 2px solid #64748b; flex: none; margin-left: -18px; }
.tgs-fc-startflag { font-size: 10px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--ok); }
.tgs-fc-text { margin-bottom: 6px; font-weight: 600; }
.tgs-fc-var { margin-bottom: 8px; font-size: 11.5px !important; }
.tgs-fc-opts { display: flex; flex-direction: column; gap: 5px; }
.tgs-fc-opt { display: flex; align-items: center; gap: 5px; }
.tgs-fc-opt > input.input { flex: 1; min-width: 0; }
.tgs-fc-gen { flex: none; padding: 4px 7px; font-size: 11px; }
.tgs-fc-addopt { align-self: flex-start; margin-top: 2px; }
.tgs-fc-portwrap { display: inline-flex; align-items: center; gap: 4px; flex: none; margin-right: -21px; }
.tgs-fc-fin { font-size: 9.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--faint); }
.tgs-fc-port { width: 13px; height: 13px; border-radius: 50%; background: #fff; border: 2px solid var(--blue); cursor: crosshair; flex: none; }
.tgs-fc-port:hover { background: var(--blue-soft); transform: scale(1.25); }
.tgs-fc-port.linked { background: var(--blue); }
.tgs-fc-then { font-size: 11.5px; color: var(--muted); flex: 1; text-align: right; }
.tgs-fc-node.tgs-fc-start { width: auto; display: flex; align-items: center; gap: 8px; padding: 8px 10px 8px 14px; background: var(--ok-soft); border-color: var(--ok); font-size: 11.5px; font-weight: 800; letter-spacing: .08em; color: #14532d; cursor: default; }
.tgs-fc-start .tgs-fc-portwrap { margin-right: -18px; }
.tgs-fc-start .tgs-fc-port { border-color: var(--ok); }
.tgs-fc-start .tgs-fc-port.linked { background: var(--ok); }
.tgs-fc-empty { position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%); max-width: 420px; text-align: center; color: var(--muted); font-size: 14px; line-height: 1.6; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 12px; padding: 18px 22px; }
.tgs-fc-node .iconbtn.sm { width: 22px; height: 22px; }
.tgs-fc-node .iconbtn svg { width: 13px; height: 13px; }

/* ── public page groups ── */
.tgp-groups { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.tgp-group { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); overflow: hidden; }
.tgp-group-h { display: flex; align-items: center; gap: 10px; width: 100%; padding: 13px 16px; border: none; background: transparent; cursor: pointer; font-size: 15px; font-weight: 650; color: var(--ink); text-align: left; }
.tgp-group-h:hover { background: var(--surface-2); }
.tgp-group-chev { font-size: 18px; line-height: 1; color: var(--faint); transition: transform .15s; }
.tgp-group.open .tgp-group-chev { transform: rotate(90deg); }
.tgp-group > .tgp-grid { display: none; padding: 0 14px 14px; margin-top: 0; }
.tgp-group.open > .tgp-grid { display: grid; }

/* public page hero: the questions are the front door */
.tgp-hero { margin: 26px 0 10px; padding: 30px 32px 28px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 1px 2px rgba(15,26,46,.05); text-align: center; }
.tgp-hero h2 { margin: 0 0 8px; font-size: 24px; }
.tgp-hero p { margin: 0 auto 18px; max-width: 560px; color: var(--muted); font-size: 14.5px; line-height: 1.6; }
.tgp-hero-acts { display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap; }
.tgp-hero-start { font-size: 16px; padding: 12px 26px; border-radius: 12px; }
.tgp-listwrap { margin-top: 8px; }

/* generated-TGSs list: search + daily/weekly/monthly switch + group headers */
.tgp-gen-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 0 0 16px; }
.tgp-gen-search { flex: 1; min-width: 200px; }
.tgs-seg { display: flex; border: 1px solid var(--line-strong, var(--line)); border-radius: 9px; overflow: hidden; flex: none; }
.tgs-seg button { padding: 7px 14px; background: #fff; border: 0; border-left: 1px solid var(--line); font: inherit; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.tgs-seg button:first-child { border-left: 0; }
.tgs-seg button.on { background: #0f1a2e; color: #fff; }
.tgp-gen-h { display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; font-size: 13px; font-weight: 700; color: var(--ink); }
.tgp-gen-h:first-child { margin-top: 0; }

/* site-location map picker + generated-TGSs map view */
.tgp-map-card { width: 760px; max-width: 96vw; }
.tgp-map-controls { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.tgp-map-search { flex: 1; min-width: 220px; }
.tgp-map { height: 420px; max-height: 55vh; border-radius: 10px; border: 1px solid var(--line); }
.tgp-map-addr { margin: 10px 2px 0; min-height: 1.2em; }
.tgp-genmap { height: 480px; border-radius: 10px; border: 1px solid var(--line); }
.tgp-f-mapbtns { display: flex; gap: 8px; margin: -4px 0 12px; }
.pac-container { z-index: 100000; } /* Places dropdown above the overlay */
.tgs-fill-del { margin-left: auto; flex: none; }
.tgs-fill-del:hover { color: #b91c1c; }

/* fill-out form + signature + generated list */
.tgp-f-label { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.tgp-f-check { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--ink); margin: 4px 0; cursor: pointer; }
.tgp-q-browse { display: inline-block; margin-top: 14px; font-size: 13px; color: var(--muted); text-decoration: underline; cursor: pointer; }
.tgp-q-browse:hover { color: var(--ink); }
.tgp-result-acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tgs-chip.warn { background: #fef3c7; border-color: #f59e0b; color: #92400e; }
.tgs-chip.edits { background: #fee2e2; border-color: #ef4444; color: #991b1b; }
.tgs-chip.ok { background: #dcfce7; border-color: #22c55e; color: #166534; }
.tgs-fb { margin-top: 4px; color: #991b1b; }
.tgs-hist .tgs-sel-row .tgs-row-meta { margin-top: 3px; }

/* project site maps */
.proj-map { height: 300px; border-radius: 12px; border: 1px solid var(--line); margin-bottom: 14px; }
.proj-map-link { font-size: 12.5px; text-decoration: underline; color: var(--muted); font-weight: 400; text-transform: none; letter-spacing: 0; }
.proj-map-link:hover { color: var(--ink); }
.tgs-mapedit .tgs-me-map { position: absolute; inset: 58px 0 0 0; }
.tgs-me-search { width: 220px; max-width: 30vw; min-width: 130px; }
.tgs-me-mtype { width: auto; padding: 6px 9px; font-size: 12.5px; }
.bill-map-wrap { margin: 10px 0 18px; }
.bill-map-head { display: flex; align-items: center; gap: 12px; font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.bill-map-head a { color: #667; font-weight: 400; }
.bill-map { height: 260px; border-radius: 10px; border: 1px solid #ddd; }
@media print { .bill-map { break-inside: avoid; } }
.tgp-sig { width: 100%; max-width: 520px; height: 160px; border: 1.5px dashed var(--line-strong); border-radius: 10px; touch-action: none; cursor: crosshair; background: #fff; }
.tgp-fill-card { width: 620px; }
.tgs-sigimg { max-height: 90%; max-width: 60%; vertical-align: middle; margin-left: 0.4em; }
/* site-details panel: flush to the panel edges, roomy location row */
.tgs-panel.tgs-p-flush { padding: 0; }
.tgs-panel.tgs-p-flush .tgs-h { margin: 0.15em 0 0.2em; }
.tgs-tbl tr.tgs-row-tall { height: 2.4em; }
.tgs-tbl.tgs-fill tr.tgs-row-tall { height: 21%; }
/* the signature row stays compact so LOCATION gets the room */
.tgs-tbl.tgs-fill tr.tgs-row-sig { height: 8%; }
.tgs-row-sig .tgs-sigimg { max-height: 1.6em; }

/* ── client requests & file notes (crq) ─────────────────────────────────── */
.crq-chip { cursor: pointer; }
.crq-chip svg { width: 12px; height: 12px; }
.crq-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.crq-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; transition: border-color .12s, box-shadow .12s;
}
.crq-row:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.crq-row-ic {
  width: 32px; height: 32px; flex: none; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--amber-ghost); color: var(--amber-deep);
}
.crq-row-ic svg { width: 16px; height: 16px; }
.crq-row-ic.violet { background: #f3ecfe; color: var(--violet); }
.crq-row-main { flex: 1; min-width: 0; }
.crq-row-title { font-size: 13.5px; display: flex; gap: 5px; min-width: 0; }
.crq-row-title b { flex: none; }
.crq-row-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); }
.crq-row-sub { font-size: 12px; color: var(--faint); margin-top: 1px; }
.sm-chip { font-size: 10.5px; padding: 1px 7px; }

/* notes thread */
.crq-thread { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; padding: 2px; }
.crq-note { background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 9px 12px; }
.crq-note.staff { background: var(--amber-ghost); border-color: #f5e2b8; }
.crq-note-head { display: flex; align-items: center; gap: 8px; margin-bottom: 3px; }
.crq-who { font-weight: 700; font-size: 12.5px; }
.crq-when { font-size: 11.5px; color: var(--faint); margin-left: auto; }
.crq-note-text { font-size: 13px; white-space: pre-wrap; word-break: break-word; }
.crq-empty { text-align: center; padding: 22px 10px; color: var(--muted); font-size: 13px; }
.crq-empty b { display: block; margin-bottom: 3px; color: var(--ink); }
.crq-compose { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.crq-namewrap { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.crq-namewrap label { font-size: 12px; color: var(--muted); white-space: nowrap; }
.crq-namewrap .input { max-width: 220px; }

/* request detail */
.crq-view-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.crq-view-sub { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.crq-view-text { white-space: pre-wrap; word-break: break-word; font-size: 13.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }
.crq-map { height: 240px; border-radius: 10px; overflow: hidden; border: 1px solid var(--line); }
.crq-warn {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--amber-ghost); border: 1px solid #f5e2b8; border-radius: 10px;
  padding: 9px 12px; font-size: 12.5px; color: var(--amber-deep); margin-top: 8px;
}
.crq-recips { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.crq-recips .checkrow { padding: 7px 10px; border-bottom: 1px solid var(--line); margin: 0; }
.crq-recips .checkrow:last-child { border-bottom: none; }
.crq-recips small { display: block; color: var(--faint); }

/* ── intake form renderer (ikf) — public page + admin preview ───────────── */
.ikf-heading { font-size: 16px; font-weight: 800; letter-spacing: -.2px; margin: 18px 0 2px; }
.ikf-heading:first-child { margin-top: 0; }
.ikf-field { margin: 14px 0 0; }
.ikf-field .input { width: 100%; }
.ikf-sub { margin-top: 12px; }
.ikf-label { font-weight: 600; font-size: 13.5px; margin-bottom: 4px; }
.ikf-req { color: var(--danger); font-weight: 700; margin-left: 3px; }
.ikf-help { font-size: 12.5px; color: var(--muted); margin: -2px 0 6px; }
.ikf-missing { animation: ikfShake .3s; border-radius: 10px; outline: 2px solid var(--danger); outline-offset: 6px; }
@keyframes ikfShake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@media (prefers-reduced-motion: reduce) { .ikf-missing { animation: none; } }

.ikf-options { display: flex; flex-direction: column; gap: 6px; }
.ikf-option {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border: 1px solid var(--line-strong); border-radius: 10px; cursor: pointer;
  background: var(--surface); transition: border-color .12s, background .12s;
}
.ikf-option:hover { border-color: var(--faint); }
.ikf-option.on { border-color: var(--amber); background: var(--amber-ghost); }
.ikf-option input { accent-color: var(--amber); width: 15px; height: 15px; flex: none; cursor: pointer; }
.ikf-option span { font-size: 13.5px; }

.ikf-check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.ikf-check input { accent-color: var(--amber); width: 16px; height: 16px; margin-top: 1px; flex: none; cursor: pointer; }
.ikf-check-label { font-weight: 600; font-size: 13.5px; }
.ikf-check-main { display: flex; flex-direction: column; }
.ikf-subbox { margin: 10px 0 2px 12px; padding-left: 14px; border-left: 3px solid var(--amber-soft); }

.ikf-maprow { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ikf-map-summary { font-size: 12.5px; color: var(--faint); }
.ikf-map-summary.on { color: var(--ok); font-weight: 600; }

.ikf-drop {
  border: 1.6px dashed var(--line-strong); border-radius: 10px; background: var(--surface-2);
  padding: 16px 12px; text-align: center; cursor: pointer; display: flex; flex-direction: column; gap: 1px;
  transition: border-color .12s, background .12s; color: var(--muted); font-size: 12.5px;
}
.ikf-drop b { color: var(--ink); font-size: 13px; }
.ikf-drop.on, .ikf-drop:hover { border-color: var(--amber); background: var(--amber-ghost); }
.ikf-drop-ic svg { width: 20px; height: 20px; color: var(--faint); }
.ikf-filelist { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.ikf-file { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px; }
.ikf-file-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.ikf-file-size { color: var(--faint); flex: none; }

/* ── public intake page (ip) ────────────────────────────────────────────── */
.ip-wrap { max-width: 680px; margin: 0 auto; padding: 26px 18px 60px; }
.ip-hero { margin-bottom: 18px; }
.ip-hero h1 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.3px; }
.ip-hero .sub { color: var(--muted); font-size: 14px; max-width: 560px; }
.ip-hint { margin-top: 8px; font-size: 12.5px; color: var(--faint); }
.ip-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px 22px 22px; margin-bottom: 14px;
}
.ip-card .ikf-field:first-child { margin-top: 0; }
.ip-foot { display: flex; flex-direction: column; align-items: stretch; gap: 10px; margin-top: 4px; }
.ip-submit { justify-content: center; padding: 13px 18px; font-size: 15px; border-radius: 11px; }
.ip-progress small { color: var(--muted); font-size: 12px; }
.ip-done-ic { width: 52px; height: 52px; margin: 6px auto 12px; border-radius: 50%; background: var(--ok-soft); color: var(--ok); display: flex; align-items: center; justify-content: center; }
.ip-done-ic svg { width: 26px; height: 26px; }
@media (max-width: 560px) { .ip-card { padding: 16px 14px 18px; } }

/* ── settings tab (stg) ─────────────────────────────────────────────────── */
.stg-panel { padding: 18px 20px; margin-bottom: 16px; }
.stg-panel-head { display: flex; align-items: flex-start; gap: 14px; justify-content: space-between; flex-wrap: wrap; margin-bottom: 10px; }
.stg-panel-head h2 { margin: 0 0 3px; font-size: 16.5px; letter-spacing: -.2px; }
.stg-panel-head .sub { color: var(--muted); font-size: 13px; max-width: 620px; }
.stg-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.stg-types { display: flex; flex-direction: column; gap: 6px; max-width: 460px; }
.stg-type-row { display: flex; align-items: center; gap: 6px; }
.stg-type-row .input { flex: 1; }
.stg-companies { display: flex; flex-direction: column; gap: 8px; }
.stg-co { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.stg-co-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px; cursor: pointer; flex-wrap: wrap; }
.stg-co-head:hover { background: var(--surface-2); border-radius: 10px; }
.stg-co-meta { font-size: 12.5px; color: var(--faint); }
.stg-co-body { padding: 4px 16px 16px; border-top: 1px solid var(--line); }
.stg-people { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.stg-person { display: grid; grid-template-columns: 1fr 1.2fr 1fr auto; gap: 6px; align-items: center; }
.stg-optins { margin-top: 14px; border-top: 1px solid var(--line); padding-top: 6px; }
.stg-optins small { display: block; color: var(--muted); font-weight: 400; }
@media (max-width: 640px) { .stg-person { grid-template-columns: 1fr 1fr; } }

/* ── intake admin: builder, links, submissions (ik) ─────────────────────── */
.ik-name { font-size: 17px; font-weight: 700; max-width: 420px; }
.ik-hintbar {
  background: var(--blue-soft); border: 1px solid #c6dbfb; color: #1e3a8a;
  border-radius: 10px; padding: 9px 14px; font-size: 12.5px; margin-bottom: 14px;
}
.ik-fields { display: flex; flex-direction: column; gap: 10px; }
.ik-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); }
.ik-card .input { width: 100%; margin-top: 8px; }
.ik-card-head { display: flex; align-items: center; gap: 6px; }
.ik-card-head .iconbtn { width: 26px; height: 26px; }
.ik-card-head .iconbtn svg { width: 13px; height: 13px; }
.ik-type { max-width: 220px; margin: 0 !important; width: auto !important; }
.ik-req-tog { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.ik-req-tog input { accent-color: var(--amber); cursor: pointer; }
.ik-help-in { font-size: 12.5px !important; color: var(--muted); }
.ik-options { margin-top: 8px; display: flex; flex-direction: column; gap: 5px; align-items: flex-start; }
.ik-option-row { display: flex; align-items: center; gap: 8px; width: 100%; }
.ik-option-row .input { margin-top: 0; }
.ik-radio-dot { width: 13px; height: 13px; border: 2px solid var(--line-strong); border-radius: 50%; flex: none; }
.ik-subq { margin: 12px 0 2px 10px; padding: 2px 0 2px 14px; border-left: 3px solid var(--amber-soft); }
.ik-subq-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--amber-deep); margin: 4px 0 8px; }
.ik-nested { box-shadow: none; background: var(--surface-2); margin-bottom: 8px; }
.ik-addrow { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 14px; }
.ik-addrow.sub { margin-top: 8px; }
.ik-addrow-label { font-size: 12.5px; color: var(--faint); font-weight: 600; margin-right: 2px; }
.ik-url { max-width: 210px; font-size: 12px !important; color: var(--muted); }
.ik-linkacts { flex-wrap: wrap; }
.ik-sub-contact { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 10px 0 4px; font-size: 13.5px; }
.ik-sub-contact span { color: var(--muted); }
.ik-answer { border-top: 1px solid var(--line); padding: 10px 0 2px; margin-top: 10px; }
.ik-answer-q { font-weight: 700; font-size: 12.5px; color: var(--muted); margin-bottom: 3px; }
.ik-answer-v { font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.ik-answer .crq-map { margin-top: 6px; height: 200px; }
.ik-answer .filelist { margin-top: 6px; }

/* ── task manager (tk) ──────────────────────────────────────────────────── */
.tk-pills { display: flex; gap: 8px; margin: 2px 0 16px; flex-wrap: wrap; }
.tk-pill {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 999px; border: 1px solid var(--line-strong);
  background: var(--surface); font-size: 13.5px; font-weight: 700; cursor: pointer;
  color: var(--muted);
}
.tk-pill:hover { border-color: var(--faint); color: var(--ink); }
.tk-pill.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.tk-pill-badge {
  background: var(--amber); color: #241a02; border-radius: 999px;
  font-size: 11px; font-weight: 800; padding: 1px 8px;
}

.tk-people { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tk-person {
  min-width: 150px; max-width: 230px; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  cursor: pointer; transition: border-color .12s, box-shadow .12s;
}
.tk-person:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.tk-person.active { border-color: var(--navy); box-shadow: 0 0 0 1.5px var(--navy) inset; }
.tk-person b { display: block; font-size: 13.5px; }
.tk-person-sub {
  display: block; font-size: 11.5px; color: var(--faint); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tk-person.tk-working .tk-person-sub { color: var(--ok); font-weight: 600; }
.tk-person.tk-pool-hot .tk-person-sub { color: var(--amber-deep); font-weight: 600; }

.tk-now {
  background: var(--surface); border: 1.5px solid var(--ok);
  border-radius: var(--radius); padding: 12px 14px 8px; margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.tk-now.idle { border-color: var(--line); padding-bottom: 12px; }
.tk-now-label { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--ok); display: flex; align-items: center; gap: 10px; }
.tk-now-label.idle, .tk-now.idle .tk-now-label { color: var(--faint); text-transform: none; font-weight: 500; font-size: 13px; letter-spacing: 0; }
.tk-now-since { font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--muted); font-size: 11.5px; }
.tk-now .tk-row { border: none; box-shadow: none; padding-left: 0; padding-right: 0; }
.tk-now .tk-row:hover { box-shadow: none; }

.tk-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.tk-row {
  display: flex; align-items: flex-start; gap: 10px; padding: 11px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  position: relative;
}
.tk-row:hover { box-shadow: var(--shadow); }
.tk-row.done { opacity: .75; }
.tk-row.done .tk-title-text { text-decoration: line-through; color: var(--muted); }
.tk-row.working { border-color: var(--ok); }
.tk-row.dragging { opacity: .4; }
.tk-row.drop-above::before, .tk-row.drop-below::after {
  content: ''; position: absolute; left: 8px; right: 8px; height: 3px;
  background: var(--amber); border-radius: 2px;
}
.tk-row.drop-above::before { top: -6px; }
.tk-row.drop-below::after { bottom: -6px; }
.tk-drag { color: var(--faint); cursor: grab; padding-top: 3px; flex: none; }
.tk-drag svg { width: 14px; height: 14px; }
.tk-row .todo-tick { margin-top: 3px; }
.tk-main { flex: 1; min-width: 0; }
.tk-title { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; font-size: 13.5px; }
.tk-title-text { font-weight: 700; }
.tk-sub { font-size: 12px; color: var(--faint); margin-top: 2px; }
.tk-note { font-size: 12.5px; color: var(--muted); margin-top: 4px; white-space: pre-wrap; word-break: break-word; max-height: 70px; overflow: hidden; }
.tk-note.open { max-height: none; }
.tk-note-more {
  background: none; border: 0; padding: 0; margin-top: 3px; cursor: pointer;
  font-size: 12px; font-weight: 700; color: var(--blue); text-align: left;
}
.tk-note-more:hover { text-decoration: underline; }
.tk-acts { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.tk-assign { width: auto !important; padding: 5px 8px; font-size: 12.5px; }

.tk-pri {
  font-size: 10.5px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase;
  border-radius: 6px; padding: 2px 7px; flex: none;
}
.tk-pri-high { background: var(--danger-soft); color: var(--danger); }
.tk-pri-med { background: var(--blue-soft); color: var(--blue); }
.tk-pri-low { background: var(--line); color: var(--muted); }
.chip.tk-live { background: var(--ok-soft); color: var(--ok); font-weight: 800; }

.tk-hint { font-size: 11.5px; color: var(--faint); font-weight: 500; text-transform: none; letter-spacing: 0; margin-left: 10px; }
.tk-seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 9px; overflow: hidden; background: var(--surface); }
.tk-seg-btn {
  border: none; background: none; padding: 5px 12px; font-size: 12.5px; font-weight: 700;
  color: var(--muted); cursor: pointer; border-right: 1px solid var(--line);
}
.tk-seg-btn:last-child { border-right: none; }
.tk-seg-btn.active { background: var(--navy); color: #fff; }
.tk-done-head { display: flex; align-items: center; gap: 8px; }
.tk-range { font-size: 12.5px; font-weight: 700; min-width: 86px; text-align: center; }
.tk-dialog-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .tk-dialog-grid { grid-template-columns: 1fr; } }

.ik-projpick { max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; margin-top: 4px; }
.ik-projpick-row { padding: 8px 12px; cursor: pointer; border-bottom: 1px solid var(--line); }
.ik-projpick-row:last-child { border-bottom: none; }
.ik-projpick-row:hover { background: var(--surface-2); }
.ik-projpick-row.on { background: var(--amber-ghost); box-shadow: 0 0 0 1.5px var(--amber) inset; }
.ik-projpick-row b { display: block; font-size: 13px; }
.ik-projpick-row span { font-size: 11.5px; color: var(--faint); }

/* ── intake extras: date picker, multi select, tables ───────────────────── */
.ikf-date { max-width: 220px; display: block; }
.ikf-tablewrap { overflow-x: auto; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); }
.ikf-table { width: 100%; border-collapse: collapse; min-width: 340px; }
.ikf-table th {
  text-align: left; font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); padding: 8px 10px 6px;
  border-bottom: 1px solid var(--line-strong); background: var(--surface-2);
}
.ikf-table td { border-bottom: 1px solid var(--line); padding: 0; }
.ikf-table td + td { border-left: 1px solid var(--line); }
.ikf-table tr:last-child td { border-bottom: none; }
.ikf-table .ikf-rmcell { border-left: none; }
.ikf-cell {
  width: 100%; min-width: 100px; border: none; background: none; padding: 9px 10px;
  font: inherit; font-size: 13.5px; color: var(--ink); outline: none;
}
.ikf-cell:focus { background: var(--amber-ghost); }
.ikf-rmcell { width: 34px; text-align: center; }
.ikf-rowrm { width: 24px; height: 24px; margin: 0 5px; }

.ik-check-sq { width: 12px; height: 12px; border: 2px solid var(--line-strong); border-radius: 3px; flex: none; }
.ik-col-tag {
  width: 18px; height: 18px; border-radius: 5px; background: var(--line);
  color: var(--muted); font-size: 10.5px; font-weight: 800; display: inline-flex;
  align-items: center; justify-content: center; flex: none;
}
.ik-row-dash { width: 13px; height: 0; border-top: 2px solid var(--line-strong); flex: none; }

.ik-anstable-wrap { overflow-x: auto; margin-top: 6px; border: 1px solid var(--line); border-radius: 8px; }
.ik-anstable { width: 100%; border-collapse: collapse; font-size: 13px; }
.ik-anstable th {
  text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); background: var(--surface-2);
  padding: 6px 10px; border-bottom: 1px solid var(--line-strong);
}
.ik-anstable td { padding: 6px 10px; border-bottom: 1px solid var(--line); }
.ik-anstable tr:last-child td { border-bottom: none; }

/* ── approvals in the task manager + admin-only flags ───────────────────── */
.chip.tk-adminonly { background: var(--danger-soft); color: var(--danger); font-weight: 700; }
.tk-appr-label { margin-top: 2px; display: flex; align-items: center; gap: 10px; }
.tk-appr-label + .filelist, .tk-appr-label + .tk-list { margin-bottom: 20px; }
.ckl-flag { margin-right: auto; }

/* ── checklist review workspace: PDF pane(s) + checklist side by side ───── */
.cklw {
  position: fixed; inset: 0; z-index: 240; display: flex; flex-direction: column;
  background: var(--bg);
}
.cklw-top {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line-strong); flex: none;
}
.cklw-name { font-weight: 800; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cklw-top .spacer { flex: 1; }
.cklw-body { flex: 1; display: flex; min-height: 0; }
.cklw-panes { flex: 1; display: flex; min-width: 0; }
.cklw-pane {
  flex: 1; min-width: 0; display: flex; flex-direction: column;
  border-right: 1px solid var(--line-strong);
}
.cklw-pane-h {
  padding: 8px 14px; font-size: 11.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--muted); background: var(--surface-2);
  border-bottom: 1px solid var(--line); flex: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cklw-stack { flex: 1; overflow: auto; padding: 14px; }
.cklw-page { position: relative; margin: 0 auto 14px; max-width: 100%; box-shadow: var(--shadow); }
.cklw-page canvas { display: block; width: 100%; height: auto; }
.cklw-mark { position: absolute; border: 2.5px solid; border-radius: 3px; pointer-events: none; }
.cklw-mark.round { border-radius: 50%; }
.cklw-mark-n {
  position: absolute; top: -10px; left: -10px; min-width: 20px; height: 20px;
  border-radius: 999px; color: #fff; font-size: 11.5px; font-weight: 800;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 5px;
}
.cklw-panel {
  width: 400px; flex: none; display: flex; flex-direction: column;
  background: var(--surface); overflow: hidden;
}
.cklw-panel .ckl { flex: 1; overflow-y: auto; padding: 14px 16px; }
.cklw-panel .ckl-saved { flex: none; padding: 6px 16px; border-top: 1px solid var(--line); }
.cklw-foot {
  flex: none; display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-top: 1px solid var(--line-strong); background: var(--surface);
}
.ckl-num {
  min-width: 20px; height: 20px; border-radius: 999px; color: #fff; flex: none;
  font-size: 11.5px; font-weight: 800; display: inline-flex; align-items: center;
  justify-content: center; padding: 0 5px; margin-top: 1px;
}

/* previous-round reference notes inside the markup editor */
.mk-refs {
  margin: 10px 12px 0; border: 1px solid var(--line-strong); border-radius: 10px;
  background: var(--surface-2); font-size: 12.5px;
}
.mk-refs summary { padding: 8px 12px; font-weight: 700; cursor: pointer; color: var(--muted); }
.mk-ref { display: flex; gap: 8px; align-items: flex-start; padding: 6px 12px; border-top: 1px solid var(--line); }
.mk-ref.done { opacity: .65; }
.mk-ref.done .mk-ref-text { text-decoration: line-through; }
.mk-ref-n {
  min-width: 18px; height: 18px; border-radius: 999px; color: #fff; flex: none;
  font-size: 10.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center;
}

/* ── task reference documents + the job builder ─────────────────────────── */
.td-reflist { display: flex; flex-direction: column; gap: 4px; }
.td-ref {
  display: flex; align-items: center; gap: 8px; padding: 6px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2);
  font-size: 12.5px;
}
.td-ref-name { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.td-ref small { color: var(--faint); flex: none; }
.td-ref .iconbtn { width: 24px; height: 24px; flex: none; }
.td-ref.new { border-style: dashed; }
.td-items { display: flex; flex-direction: column; gap: 8px; }
.td-item { border: 1px solid var(--line-strong); border-radius: 10px; padding: 10px 12px; background: var(--surface); }
.td-item-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.td-item-head .input { flex: 1; margin: 0; }
.td-item-head .chip { flex: none; }
.chip.tk-locchip { background: var(--ok-soft); color: var(--ok); font-weight: 700; }

/* two-zone document update: output + source */
.vd-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 6px; }
.ver-drop-src { padding: 14px; }
.ver-drop.done { border-color: var(--ok); background: var(--ok-soft); cursor: default; }
.ver-drop.done b { color: var(--ok); }

/* ── folder tasks: placeholder rows + the TGS question ───────────────────── */
.file-row.ghost {
  /* explicit border: the base row keeps 3px transparent drag-indicator
     borders that a bare border-style would expose */
  border: 1.5px dashed var(--line-strong); border-radius: 10px;
  background: var(--surface-2); cursor: pointer;
}
.file-row.ghost .fname { color: var(--muted); }
.ghost-ic {
  width: 34px; height: 34px; flex: none; border: 1.5px dashed var(--line-strong);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  color: var(--faint);
}
.ghost-ic svg { width: 16px; height: 16px; }
.chip.tk-ghostchip { border: 1px dashed var(--line-strong); background: transparent; color: var(--muted); }
.chip.tk-foldchip { font-weight: 600; }
.tgsask-name { font-weight: 700; margin-bottom: 8px; word-break: break-word; }
.tgsask-list { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; max-height: 260px; overflow-y: auto; }

/* ── live chat dock (bottom right, Messenger style) ─────────────────────── */
.dk-wrap {
  position: fixed; right: 14px; bottom: 0; z-index: 45;
  display: flex; align-items: flex-end; gap: 10px; flex-direction: row;
}
.dk-fab {
  width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer;
  background: var(--navy); color: #fff; margin-bottom: 14px; position: relative;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(15, 26, 46, .35);
}
.dk-fab svg { width: 21px; height: 21px; }
.dk-fab:hover { background: var(--navy-3); }
.dk-fab.has-unread::after {
  content: ''; position: absolute; top: 2px; right: 2px; width: 11px; height: 11px;
  border-radius: 50%; background: var(--amber); border: 2px solid #fff;
}
.dk-pop {
  width: 300px; height: 400px; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-strong); border-bottom: none;
  border-radius: 12px 12px 0 0; box-shadow: 0 -2px 24px rgba(15, 26, 46, .18);
  overflow: hidden;
}
.dk-pop.min { height: auto; }
.dk-pop.min .dk-msgs, .dk-pop.min .dk-inrow, .dk-pop.min .dk-staged { display: none !important; }
.dk-head {
  display: flex; align-items: center; gap: 8px; padding: 9px 10px;
  background: var(--navy); color: #fff; cursor: pointer; flex: none;
}
.dk-hicon { display: inline-flex; }
.dk-hicon svg { width: 15px; height: 15px; }
.dk-title { font-weight: 700; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.dk-dot {
  background: var(--amber); color: #10192b; font-size: 10.5px; font-weight: 800;
  min-width: 17px; height: 17px; border-radius: 999px; padding: 0 4px;
  display: inline-flex; align-items: center; justify-content: center;
}
.dk-hbtn {
  background: none; border: none; color: inherit; cursor: pointer; padding: 3px;
  border-radius: 6px; display: inline-flex; opacity: .8;
}
.dk-hbtn:hover { opacity: 1; background: rgba(255, 255, 255, .12); }
.dk-hbtn svg { width: 14px; height: 14px; }
.dk-msgs { flex: 1; overflow-y: auto; padding: 10px 10px 6px; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2); }
.dk-empty { color: var(--faint); font-size: 12px; text-align: center; margin: auto 8px; }
.dk-m { max-width: 85%; align-self: flex-start; }
.dk-m.mine { align-self: flex-end; text-align: right; }
.dk-meta { font-size: 10.5px; color: var(--faint); margin-bottom: 2px; }
.dk-text {
  display: inline-block; text-align: left; background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px;
  font-size: 12.5px; white-space: pre-wrap; word-break: break-word;
}
.dk-m.mine .dk-text { background: var(--navy); color: #fff; border-color: var(--navy); }
.dk-text.tomb { color: var(--faint); font-style: italic; }
.dk-refchip {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 3px; cursor: pointer;
  border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px;
  padding: 3px 9px; font-size: 11.5px; font-weight: 600; color: var(--ink); max-width: 100%;
}
.dk-refchip svg { width: 12px; height: 12px; flex: none; }
.dk-refchip:hover { border-color: var(--navy); }
.dk-refchip.todo { color: var(--blue); }
.dk-staged {
  display: flex; align-items: center; gap: 4px; padding: 5px 10px; flex: none;
  border-top: 1px solid var(--line); background: var(--surface);
}
.dk-staged .dk-hbtn { color: var(--muted); }
.dk-refchip.stage { margin-top: 0; overflow: hidden; }
.dk-inrow {
  display: flex; align-items: flex-end; gap: 4px; padding: 7px 8px; flex: none;
  border-top: 1px solid var(--line); background: var(--surface);
}
.dk-inrow .dk-attach { color: var(--muted); padding: 6px; }
.dk-inrow .dk-attach:hover { background: var(--surface-2); }
.dk-in {
  flex: 1; border: none; outline: none; resize: none; background: none;
  font: inherit; font-size: 13px; padding: 6px 2px; max-height: 90px; color: var(--ink);
}
.dk-send {
  background: var(--navy); color: #fff; border: none; border-radius: 8px;
  width: 32px; height: 32px; cursor: pointer; display: inline-flex;
  align-items: center; justify-content: center; flex: none;
}
.dk-send:hover { background: var(--navy-3); }
.dk-send svg { width: 15px; height: 15px; }
.dk-send:disabled { opacity: .5; }
@media (max-width: 760px) {
  .dk-wrap { right: 8px; }
  .dk-pop { width: 260px; height: 340px; }
  .dk-pop:nth-child(n+3) { display: none; } /* phones: one popup + the fab */
}

/* ── time tracker ───────────────────────────────────────────────────────── */
.tt-weeknav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 2px 0 14px; }
.tt-range { font-weight: 700; font-size: 13.5px; margin-left: 6px; }
.tt-days { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.tt-day { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.tt-day.today { border-color: var(--navy); box-shadow: 0 0 0 1px var(--navy); }
.tt-day-head { display: flex; align-items: center; gap: 7px; font-size: 13px; }
.tt-day-total { font-weight: 800; font-size: 13px; }
.tt-day-total.zero { color: var(--faint); font-weight: 600; }
.tt-entry {
  display: flex; align-items: center; gap: 8px; padding: 6px 9px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; font-size: 12.5px;
}
.tt-entry b { flex: none; }
.tt-entry .tt-note { flex: 1; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-entry .iconbtn { width: 24px; height: 24px; flex: none; }
.tt-teamwrap { padding: 6px 0 2px; overflow-x: auto; }
.tt-table { width: 100%; border-collapse: collapse; font-size: 12.5px; min-width: 640px; }
.tt-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 7px 10px; border-bottom: 1px solid var(--line); }
.tt-table td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: center; }
.tt-table tr:last-child td { border-bottom: none; }
.tt-who { text-align: left !important; font-weight: 700; white-space: nowrap; }
.tt-cell { color: var(--faint); font-variant-numeric: tabular-nums; }
.tt-cell.has { color: var(--ink); font-weight: 700; cursor: pointer; }
.tt-cell.has:hover { background: var(--surface-2); }
.tt-cell.today, .tt-table th.today { background: var(--amber-ghost); }
.tt-total { font-weight: 800; white-space: nowrap; }
.tt-total.zero { color: var(--faint); font-weight: 600; }
.tt-act { text-align: right !important; white-space: nowrap; }

/* ── links in messages & notes + preview cards (round 14) ─────────────── */
/* .grow was only ever styled inside scoped rules, so the dock header's
   spacer collapsed and its buttons hugged the title — one global utility */
.grow { flex: 1; }
.msg-link { color: var(--blue); text-decoration: underline; word-break: break-all; }
.msg-link:hover { color: var(--navy-3); }
/* the dock's own bubbles are dark navy — links there go light; the chat
   tab's "mine" bubbles are light amber, so the default blue stays */
.dk-m.mine .msg-link { color: #a8c8ff; }
.dk-m.mine .msg-link:hover { color: #d6e4ff; }
.lk-card {
  display: block; max-width: 320px; margin-top: 6px; text-align: left;
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: var(--surface); color: var(--ink); text-decoration: none;
  box-shadow: 0 1px 2px rgba(16, 25, 43, .06);
}
.lk-card:hover { border-color: var(--line-strong); }
.lk-imgwrap { position: relative; background: var(--navy); }
.lk-img { display: block; width: 100%; max-height: 168px; object-fit: cover; }
.lk-imgwrap.yt::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 46px; height: 32px; border-radius: 9px; background: rgba(15, 26, 46, .78);
}
.lk-imgwrap.yt::before {
  content: ''; position: absolute; inset: 0; margin: auto; z-index: 1;
  width: 0; height: 0; border: 8px solid transparent;
  border-left: 13px solid #fff; transform: translateX(5px);
}
.lk-body { padding: 7px 10px 8px; }
.lk-title {
  font-weight: 700; font-size: 12.5px; line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lk-desc {
  color: var(--muted); font-size: 11.5px; margin-top: 2px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.lk-host { color: var(--faint); font-size: 10.5px; margin-top: 4px; text-transform: uppercase; letter-spacing: .05em; }
.dk-m .lk-card { max-width: 100%; }
.tk-main .lk-card { margin-top: 8px; }

/* ── markup editor round 15: pen & polygon, editing handles, note images ── */
.mk-shape.pen, .mk-shape.poly { border: none; box-shadow: none; border-radius: 0; background: none; }
.mk-shape.pen svg, .mk-shape.poly svg, .mk-ghostsvg svg {
  position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none;
}
.mk-shape.pen polyline, .mk-ghostsvg polyline {
  fill: none; stroke: var(--mkc, #ef4444); stroke-width: 3.5;
  stroke-linecap: round; stroke-linejoin: round;
  filter: drop-shadow(0 0 1.5px rgba(255, 255, 255, .9));
}
.mk-shape.poly polygon {
  fill: color-mix(in srgb, var(--mkc) 16%, transparent);
  stroke: var(--mkc); stroke-width: 2.5; stroke-linejoin: round;
  filter: drop-shadow(0 0 1.5px rgba(255, 255, 255, .9));
}
.mk-shape.pen.flash, .mk-shape.pen.hot, .mk-shape.poly.flash, .mk-shape.poly.hot { box-shadow: none; }
.mk-shape.pen.flash svg, .mk-shape.pen.hot svg, .mk-shape.poly.flash svg, .mk-shape.poly.hot svg {
  filter: drop-shadow(0 0 5px color-mix(in srgb, var(--mkc) 80%, transparent));
}
.mk-shape.sel { outline: 1.5px dashed color-mix(in srgb, var(--mkc) 70%, transparent); outline-offset: 3px; cursor: move; }
.mk-ghostsvg { position: absolute; inset: 0; pointer-events: none; z-index: 4; --mkc: #ef4444; }
.mk-polydot {
  position: absolute; width: 9px; height: 9px; margin: -4.5px; border-radius: 50%;
  background: #fff; border: 2.5px solid var(--mkc, #ef4444);
}
.mk-polydot.first { width: 13px; height: 13px; margin: -6.5px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--mkc, #ef4444) 35%, transparent); }
.mk-h {
  position: absolute; width: 13px; height: 13px; margin: -6.5px; z-index: 6;
  background: #fff; border: 2.5px solid var(--mkc, #ef4444); border-radius: 3px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .35); touch-action: none;
}
.mk-h.vx { border-radius: 50%; cursor: grab; }
.mk-h.mid { width: 10px; height: 10px; margin: -5px; border-radius: 50%; opacity: .55; cursor: copy; }
.mk-h.mid:hover { opacity: 1; }
.mk-erasing .mk-shape { cursor: not-allowed; }
.mk-erasing .mk-shape:hover { outline: 2.5px dashed var(--danger); outline-offset: 2px; }
.mk-erasing .mk-shape.pen:hover polyline { stroke: var(--danger); }
.mk-erasing .mk-shape.poly:hover polygon { stroke: var(--danger); }
.mk-atts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.mk-att {
  position: relative; display: block; width: 74px; height: 56px; border-radius: 8px;
  overflow: hidden; border: 1px solid var(--line-strong); background: var(--surface-2);
}
.mk-att img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mk-att:hover { border-color: var(--mkc, var(--amber)); }
.mk-att-x {
  position: absolute; top: 2px; right: 2px; width: 18px; height: 18px; border: none;
  border-radius: 50%; background: rgba(16, 25, 43, .78); color: #fff; font-size: 13px;
  line-height: 1; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.mk-att-x:hover { background: var(--danger); }
.mk-att-add {
  width: 74px; height: 56px; border: 1.5px dashed var(--line-strong); border-radius: 8px;
  background: none; color: var(--muted); font-size: 11.5px; cursor: pointer;
}
.mk-att-add:hover { border-color: var(--amber); color: var(--ink); }
.cklw-mark.pen, .cklw-mark.poly { border: none !important; background: none; }
.cklw-mark.pen svg, .cklw-mark.poly svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.cklw-mark.pen polyline { fill: none; stroke: var(--mkc, #ef4444); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.cklw-mark.poly polygon { fill: color-mix(in srgb, var(--mkc) 14%, transparent); stroke: var(--mkc); stroke-width: 2.5; }

/* ── round 17: master-detail task board + presence statuses ───────────── */
.tk-split { display: grid; grid-template-columns: minmax(320px, 400px) 1fr; gap: 16px; align-items: start; }
.tk-listpane { min-width: 0; }
.tk-listpane .section-label { margin-top: 14px; }
.tk-detail { position: sticky; top: 14px; min-width: 0; }
.tk-item {
  display: flex; align-items: center; gap: 8px; padding: 8px 10px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  margin-bottom: 6px; cursor: pointer; position: relative;
}
.tk-item:hover { border-color: var(--line-strong); }
.tk-item.active { border-color: var(--amber); box-shadow: inset 3px 0 0 var(--amber), var(--shadow); }
.tk-item.working { background: var(--amber-ghost); }
.tk-item.done .tk-item-title { text-decoration: line-through; color: var(--muted); }
.tk-item .tk-drag { cursor: grab; color: var(--faint); flex: none; display: inline-flex; }
.tk-item.dragging { opacity: .45; }
.tk-item.drop-above { box-shadow: 0 -3px 0 0 var(--amber); }
.tk-item.drop-below { box-shadow: 0 3px 0 0 var(--amber); }
.tk-item .todo-tick { flex: none; }
.tk-pri-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.tk-pri-dot.tk-pri-high { background: var(--danger); }
.tk-pri-dot.tk-pri-med { background: var(--blue); }
.tk-pri-dot.tk-pri-low { background: var(--faint); }
.tk-item-main { flex: 1; min-width: 0; }
.tk-item-title {
  font-weight: 600; font-size: 13px; line-height: 1.3;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tk-item-sub { color: var(--faint); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-item-glyphs { color: var(--amber-deep); font-weight: 700; margin-right: 6px; letter-spacing: .06em; }
.tk-detail-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.tk-detail-card.working { border-color: var(--amber); }
.tk-detail-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.tk-detail-title { margin: 0 0 4px; font-size: 19px; line-height: 1.3; letter-spacing: -.2px; }
.tk-detail-meta { color: var(--muted); font-size: 12.5px; margin-bottom: 10px; }
.tk-detail-note {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px; font-size: 13.5px; white-space: pre-wrap; margin-bottom: 10px;
}
.tk-detail-subs { margin: 10px 0; }
.tk-detail-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.tk-detail-refs { margin-bottom: 4px; }
.tk-detail-doneline { margin: 14px 0 10px; }
.tk-detail-acts { display: flex; flex-wrap: wrap; gap: 8px; border-top: 1px solid var(--line); padding-top: 12px; }
.tk-danger { color: var(--danger); }
.tk-status-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
.tk-status-lbl { font-size: 12px; font-weight: 700; color: var(--muted); }
.tk-person.tk-st-break { background: var(--blue-soft); }
.tk-person.tk-st-done { background: var(--ok-soft); }
.tk-person.tk-st-notyet .tk-person-sub { color: var(--danger); font-weight: 600; }
.tk-now.tk-st-break { border-color: var(--blue); background: var(--blue-soft); }
.tk-now.tk-st-done { border-color: var(--ok); background: var(--ok-soft); }
.tk-now.tk-st-notyet { border-style: dashed; }
@media (max-width: 980px) {
  .tk-split { grid-template-columns: 1fr; }
  .tk-detail { position: static; }
}

/* ── round 18: board polish, bulk bar, edits-across-files ─────────────── */
.tk-split { grid-template-columns: minmax(280px, 340px) 1fr; }
.tk-bulkbar {
  position: sticky; top: var(--wtabs-h, 0px); z-index: 8;
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  background: var(--navy); color: #fff; border-radius: 10px;
  padding: 8px 12px; margin: 10px 0 8px; box-shadow: var(--shadow-lg);
}
.tk-bulkbar b { font-size: 12.5px; white-space: nowrap; }
.tk-bulkbar .btn.ghost { color: #d7e0ee; border-color: rgba(255, 255, 255, .25); }
.tk-bulkbar .btn.ghost:hover { background: rgba(255, 255, 255, .1); color: #fff; }
.tk-bulk-sel { width: auto; padding: 4px 8px; font-size: 12px; background: var(--navy-2); color: #fff; border-color: var(--navy-3); }
.tk-doneflag { color: var(--ok); font-weight: 800; flex: none; }
.tk-done-block {
  display: flex; flex-direction: column; gap: 6px;
  margin: 18px 0 8px; padding-top: 10px; border-top: 1px solid var(--line);
}
.tk-done-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.tk-done-controls .tk-range { font-size: 12px; color: var(--muted); white-space: nowrap; }
.tk-detail-acts { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 12px; }
.tk-acts-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tk-acts-quiet .btn { border-color: transparent; background: var(--surface-2); }
.tk-acts-quiet .btn:hover { background: var(--line); }
.tk-detail-subs .sub-item { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 5px; background: var(--surface); }
.tk-detail-subs .sub-item.done .sub-item-t { text-decoration: line-through; color: var(--muted); }
.tk-detail-subs .sub-item .btn, .tk-detail-subs .sub-item .iconbtn { flex: none; }
.tk-detail-subs .sub-item-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* ── r20: pinned-files bubble, chat images, dock parity, recently viewed ── */
.dk-fabcol { display: flex; flex-direction: column; align-items: center; }
.dk-pinfab { width: 40px; height: 40px; background: var(--amber); color: #10192b; margin-bottom: 4px; }
.dk-pinfab:hover { background: var(--amber); filter: brightness(1.07); }
.dk-pinfab svg { width: 18px; height: 18px; }
.dk-pinpop {
  position: fixed; right: 14px; bottom: 116px; z-index: 46; width: 320px; max-height: 400px;
  overflow-y: auto; background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 14px; box-shadow: 0 10px 34px rgba(15, 26, 46, .28);
}
.dk-pinhead { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 1; }
.dk-pinhead b { font-size: 13px; }
.dk-pinrow { display: flex; align-items: center; gap: 9px; padding: 8px 12px; border-bottom: 1px solid var(--line); }
.dk-pinrow:last-child { border-bottom: none; }
.dk-pinmain { flex: 1; min-width: 0; cursor: pointer; display: flex; flex-direction: column; gap: 1px; }
.dk-pinmain b { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dk-pinmain small { color: var(--faint); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dk-pinmain:hover b { color: var(--blue); }
.dk-pinrow .dk-hbtn { color: var(--muted); }
.dk-pinrow .dk-hbtn:hover { background: var(--surface-2); }

/* chat image attachments: inline thumbnails (tab + dock) */
.chat-att-img { margin-top: 6px; cursor: pointer; }
.chat-att-img img { max-width: 260px; max-height: 200px; border-radius: 10px; border: 1px solid var(--line); display: block; }
.dk-m .chat-att-img img { max-width: 190px; max-height: 150px; }
.dk-m.mine .chat-att-img { display: inline-block; }

/* dock message actions (edit / unsend own messages, like the tab) */
.dk-acts { display: flex; gap: 2px; margin-top: 2px; opacity: 0; transition: opacity .15s; }
.dk-m.mine .dk-acts { justify-content: flex-end; }
.dk-m:hover .dk-acts { opacity: 1; }
.dk-acts .dk-hbtn { color: var(--muted); padding: 2px; }
.dk-acts .dk-hbtn:hover { background: var(--surface-2); }
.dk-acts svg { width: 12px; height: 12px; }

/* viewer + recent-tab pin buttons */
.v-pin.on, .rc-pin.on { color: var(--amber); }
.rc-pin { width: 30px; height: 30px; }

@media (max-width: 760px) {
  .dk-pinpop { right: 8px; width: min(320px, calc(100vw - 16px)); }
}

/* ── r21: workspace tabs (several places open at once) ── */
.wtabs {
  position: sticky; top: 0; z-index: 30; background: var(--bg);
  display: flex; align-items: center; gap: 4px; padding: 8px 18px 0;
  border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: thin;
}
.wtab {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px 7px 12px;
  border: 1px solid var(--line); border-bottom: none; border-radius: 9px 9px 0 0;
  background: var(--surface-2); color: var(--muted); font-size: 12.5px; font-weight: 600;
  cursor: pointer; max-width: 190px; white-space: nowrap; flex: none; margin-bottom: -1px;
}
.wtab.on { background: var(--surface); color: var(--ink); border-color: var(--line-strong); border-bottom: 1px solid var(--surface); }
.wtab:hover:not(.on) { color: var(--ink); }
.wt-label { overflow: hidden; text-overflow: ellipsis; }
.wt-x { border: none; background: none; cursor: pointer; color: inherit; opacity: .55; display: inline-flex; padding: 2px; border-radius: 5px; }
.wt-x:hover { opacity: 1; background: rgba(0, 0, 0, .08); }
.wt-x svg { width: 11px; height: 11px; }
.wt-new {
  border: 1px dashed var(--line-strong); background: none; color: var(--muted);
  border-radius: 8px; width: 26px; height: 26px; margin: 0 0 6px 2px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.wt-new:hover { color: var(--ink); border-color: var(--muted); }
.wt-new svg { width: 13px; height: 13px; }

/* ── r21: map editor extras — measure, coordinates ── */
.tgs-me-measure.primary, .tgs-me-pin.primary, .tgs-me-poly.primary { color: #fff; }
.tgs-meas-panel {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 22px; z-index: 1002;
  background: #0f1a2e; color: #fff; border-radius: 12px; padding: 10px 14px;
  display: flex; align-items: center; gap: 12px; box-shadow: 0 8px 26px rgba(0, 0, 0, .35);
  font-size: 13px; max-width: min(640px, calc(100vw - 30px)); flex-wrap: wrap;
}
.tgs-meas-panel b { font-size: 15px; font-variant-numeric: tabular-nums; }
.tgs-meas-panel .btn.sm { background: rgba(255, 255, 255, .12); border: none; color: #fff; }
.tgs-meas-panel .btn.sm:hover { background: rgba(255, 255, 255, .22); }
.tgs-coordbar {
  position: fixed; left: 14px; bottom: 22px; z-index: 1001;
  background: rgba(15, 26, 46, .88); color: #dbe5f2; border-radius: 9px; padding: 6px 11px;
  font-size: 12px; font-variant-numeric: tabular-nums; cursor: pointer; user-select: none;
}
.tgs-coordbar:hover { background: #0f1a2e; color: #fff; }

/* ── r22: multiple TGSs on one task — the uploaded-so-far list ── */
.tk-updone { display: flex; flex-direction: column; gap: 4px; margin: 0 0 10px; }
.tk-updone-row {
  display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px;
}
.tk-updone-row svg { width: 14px; height: 14px; color: #16a34a; flex: none; }
.tk-updone-row b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── r24: continuous chat — day separators, load-earlier, summaries ── */
.chat-daysep { display: flex; align-items: center; gap: 10px; margin: 6px 0 2px; }
.chat-dayline { flex: 1; height: 1px; background: var(--line); }
.chat-daylbl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--faint); }
.chat-morewrap { display: flex; justify-content: center; padding: 2px 0 6px; }
.chat-summary.slim { padding: 0; margin: 2px 0 4px; }
.chat-summary.slim summary {
  cursor: pointer; padding: 7px 14px; font-size: 11.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px; color: #92400e;
}
.chat-summary.slim > div { padding: 0 14px 10px; }

/* ── r25: "How this app works" explainer tab ── */
.hw-hero { padding: 20px 22px; border-left: 4px solid var(--amber); }
.hw-hero-lbl {
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .8px;
  color: var(--amber-deep); margin-bottom: 8px;
}
.hw-hero p { margin: 0 0 10px; font-size: 15px; line-height: 1.65; color: var(--ink); max-width: 68ch; }
.hw-hero p:last-child { margin-bottom: 0; }

.hw-diagram {
  display: flex; align-items: stretch; gap: 4px; margin: 14px 0; flex-wrap: wrap;
}
.hw-box {
  flex: 1 1 200px; min-width: 180px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 3px; border-top: 3px solid var(--line-strong);
}
.hw-box b { font-size: 14.5px; }
.hw-box small { color: var(--muted); font-size: 12.5px; line-height: 1.45; }
.hw-box-ic { width: 26px; height: 26px; margin-bottom: 4px; color: var(--faint); }
.hw-box-ic svg { width: 22px; height: 22px; }
.hw-box.blue { border-top-color: var(--blue); }
.hw-box.blue .hw-box-ic { color: var(--blue); }
.hw-box.amber { border-top-color: var(--amber); }
.hw-box.amber .hw-box-ic { color: var(--amber-deep); }
.hw-box.navy { border-top-color: var(--navy-3); }
.hw-box.navy .hw-box-ic { color: var(--navy-3); }
.hw-arrow {
  flex: 0 0 74px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 5px; padding: 0 2px;
}
.hw-arrow-line {
  width: 100%; height: 2px; background: var(--line-strong); position: relative; border-radius: 2px;
}
.hw-arrow-line::after {
  content: ''; position: absolute; right: -1px; top: -3px;
  border-left: 7px solid var(--line-strong); border-top: 4px solid transparent; border-bottom: 4px solid transparent;
}
.hw-arrow small { color: var(--faint); font-size: 10.5px; text-align: center; line-height: 1.2; }
@media (max-width: 780px) {
  .hw-arrow { flex-basis: 100%; height: 26px; }
  .hw-arrow-line { width: 2px; height: 100%; }
  .hw-arrow-line::after { right: -3px; top: auto; bottom: -1px; border: none; border-top: 7px solid var(--line-strong); border-left: 4px solid transparent; border-right: 4px solid transparent; }
}

.hw-stats { padding: 14px 18px; }
.hw-stats-lbl {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .7px;
  color: var(--faint); margin-bottom: 10px;
}
.hw-stats-row { display: flex; flex-wrap: wrap; gap: 10px 26px; }
.hw-stat { display: flex; flex-direction: column; }
.hw-stat b { font-size: 22px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.hw-stat span { font-size: 12px; color: var(--muted); }

.hw-sec { padding: 18px 22px 20px; }
.hw-sec-h { display: flex; gap: 13px; align-items: flex-start; margin-bottom: 12px; }
.hw-sec-h h2 { margin: 0; font-size: 17px; }
.hw-sec-h .sub { margin-top: 2px; }
.hw-num {
  flex: none; width: 27px; height: 27px; border-radius: 50%; background: var(--navy);
  color: #fff; font-weight: 800; font-size: 13px; display: flex; align-items: center;
  justify-content: center; margin-top: 1px;
}
.hw-p { margin: 0 0 11px; font-size: 14px; line-height: 1.68; color: var(--ink); max-width: 74ch; }
.hw-p:last-child { margin-bottom: 0; }
.hw-sec code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px;
}

.hw-why {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 12px 16px; margin: 12px 0;
}
.hw-why > b { display: block; font-size: 12.5px; margin-bottom: 6px; }
.hw-why ul { margin: 0; padding-left: 18px; }
.hw-why li { font-size: 13.5px; line-height: 1.6; color: var(--muted); margin-bottom: 3px; }
.hw-why .hw-p { font-size: 13.5px; color: var(--muted); }
.hw-why.hw-warn { background: var(--amber-ghost); border-color: #fde8b8; }
.hw-why.hw-warn > b { color: var(--amber-deep); }

.hw-tech {
  display: flex; gap: 10px; align-items: baseline; margin-top: 12px; padding-top: 11px;
  border-top: 1px dashed var(--line-strong); font-size: 12.5px; color: var(--muted); line-height: 1.6;
}
.hw-tech-tag {
  flex: none; font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .7px;
  color: var(--faint); padding-top: 1px;
}

.hw-rows { display: flex; flex-direction: column; gap: 1px; margin: 4px 0 12px; }
.hw-row {
  display: grid; grid-template-columns: 170px 130px 1fr; gap: 12px; align-items: baseline;
  padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
}
.hw-row b { font-size: 13.5px; }
.hw-row-v { font-size: 13px; color: var(--amber-deep); font-weight: 600; }
.hw-row small { font-size: 12.5px; color: var(--muted); line-height: 1.5; }
@media (max-width: 720px) {
  .hw-row { grid-template-columns: 1fr; gap: 2px; }
}

.hw-steps { margin: 4px 0 12px; padding-left: 20px; }
.hw-steps li { font-size: 13.5px; line-height: 1.65; color: var(--muted); margin-bottom: 7px; max-width: 72ch; }
.hw-steps li b { color: var(--ink); }

.hw-gloss { display: flex; flex-direction: column; gap: 8px; }
.hw-gloss-row { display: grid; grid-template-columns: 130px 1fr; gap: 14px; align-items: baseline; }
.hw-gloss-row b { font-size: 13.5px; }
.hw-gloss-row span { font-size: 13.5px; color: var(--muted); line-height: 1.6; max-width: 70ch; }
@media (max-width: 720px) {
  .hw-gloss-row { grid-template-columns: 1fr; gap: 2px; }
}

.hw-foot { text-align: center; color: var(--faint); font-size: 12.5px; padding: 6px 0 24px; }

/* ── r26: referenced documents on edit notes + mobile markup editor ── */
.mk-docrefs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.mk-docref {
  display: inline-flex; align-items: center; gap: 5px; max-width: 100%;
  padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  color: var(--violet); background: color-mix(in srgb, var(--violet) 8%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--violet) 30%, transparent); cursor: pointer;
}
.mk-docref:hover { background: color-mix(in srgb, var(--violet) 16%, var(--surface)); }
.mk-docref svg { width: 12px; height: 12px; flex: none; }
.mk-docref .mk-area-x { color: inherit; }
.ckl-refdocs { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 5px; align-items: center; }
.ckl-refdocs .mk-att { width: 44px; height: 44px; }
.ckl-refdocs .mk-att img { width: 100%; height: 100%; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }

/* the markup panel header is a toggle only on phones */
.mk-panel-tog { display: none; }
.mk-shape, .mk-h { touch-action: none; }
.mk-wrap.mk-armed { touch-action: none; }
.mk-zoom { display: none; align-items: center; gap: 2px; }
.mk-zoom .iconbtn { color: #b9c6d8; font-size: 17px; font-weight: 700; width: 34px; height: 34px; }

@media (max-width: 760px) {
  /* toolbar: name row first, tools as a full-width thumb row below */
  .mk-top { padding: 8px 10px; gap: 7px; }
  .mk-top .mkname { max-width: 34%; font-size: 13px; }
  .mk-lbl { display: none; }
  .mk-zoom { display: inline-flex; }
  .mk-tools {
    order: 10; flex-basis: 100%; display: flex; gap: 6px;
    overflow-x: auto; -webkit-overflow-scrolling: touch; padding-bottom: 2px;
    scrollbar-width: none;
  }
  .mk-tools::-webkit-scrollbar { display: none; }
  .mk-tools .btn { flex: none; font-size: 15px; padding: 8px 13px; min-height: 38px; }
  .mk-pageno { min-width: 0; }
  .mk-draft { position: fixed; bottom: 10px; left: 10px; z-index: 5; }
  .mk-stage { padding: 8px 8px 20px; }
  /* notes panel: a collapsible bottom sheet with a grabbable header */
  .mk-panel { max-height: 48%; border-radius: 14px 14px 0 0; box-shadow: 0 -6px 30px rgba(8,12,22,.25); }
  .mk-panel-head { cursor: pointer; padding: 11px 16px 6px; }
  .mk-panel-tog { display: inline-flex; transform: rotate(90deg); transition: transform .15s ease; }
  .mk-panel-min .mk-panel-tog { transform: rotate(-90deg); }
  .mk-panel-min .mk-panel { max-height: none; }
  .mk-panel-min .mk-panel-sub, .mk-panel-min .mk-notes, .mk-panel-min .mk-restored,
  .mk-panel-min .mk-refs { display: none; }
  /* bigger touch targets for handles and area chips */
  .mk-h { width: 18px; height: 18px; }
  .mk-area, .mk-docref { padding: 4px 10px; font-size: 12px; }
  .mk-area-x { font-size: 16px; padding: 0 2px; }
  .mk-att-add { min-height: 32px; }
  .mk-note textarea { font-size: 16px; } /* stops iOS zooming the page on focus */
}

/* ── r27: invoicing — accounts overview, payments dialog ── */
.bill-acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.bill-acc {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 3px;
  box-shadow: var(--shadow); transition: border-color .12s ease, transform .05s;
}
.bill-acc:hover { border-color: var(--faint); }
.bill-acc:active { transform: translateY(1px); }
.bill-acc.active { border-color: var(--amber); box-shadow: 0 0 0 2px var(--amber-soft); }
.bill-acc b { font-size: 13.5px; }
.bill-acc-owe { font-size: 15px; font-weight: 800; color: var(--ok); font-variant-numeric: tabular-nums; }
.bill-acc.owes .bill-acc-owe { color: var(--amber-deep); }
.bill-acc small { color: var(--faint); font-size: 11.5px; }
.bill-filterbar {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; margin-bottom: 8px;
  background: var(--amber-ghost); border: 1px solid #fde8b8; border-radius: var(--radius-sm); font-size: 13px;
}
.chip.danger { background: var(--danger-soft); color: var(--danger); }

.bill-pay { max-height: 56vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.bill-pay-sum {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 10px 12px; margin-bottom: 8px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm); font-size: 13px;
  position: sticky; top: var(--wtabs-h, 0px); z-index: 2;
}
.bill-pay-sum b { font-variant-numeric: tabular-nums; }
.bill-pay-owing { font-weight: 800; color: var(--amber-deep); }
.bill-pay-owing.ok { color: var(--ok); }
.bill-pay-group {
  display: flex; align-items: center; gap: 9px; padding: 8px 10px 4px; margin-top: 6px;
  font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--line);
}
.bill-pay-group b { color: var(--ink); }
.bill-pay-line {
  display: flex; align-items: center; gap: 9px; padding: 7px 10px 7px 26px;
  border-radius: 8px; cursor: pointer; font-size: 13px;
}
.bill-pay-line:hover { background: var(--surface-2); }
.bill-pay-line.paid .bill-pay-name { color: var(--faint); text-decoration: line-through; }
.bill-pay-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46%; }
.bill-pay-amt { font-variant-numeric: tabular-nums; font-weight: 600; }
.bill-pay-line.paid .bill-pay-amt { color: var(--ok); }
.bill-pay-ledger { display: flex; align-items: center; gap: 9px; padding: 6px 10px; font-size: 13px; }

/* ── r27: the public page as a proper invoice ── */
.inv-head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 2px solid var(--ink); }
.inv-biz { display: flex; flex-direction: column; gap: 2px; }
.inv-biz small { color: var(--muted); font-size: 12.5px; }
.inv-meta { text-align: right; display: flex; flex-direction: column; gap: 2px; align-items: flex-end; }
.inv-title { font-size: 24px; font-weight: 800; letter-spacing: 3px; }
.inv-no { font-size: 16px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.inv-date { font-size: 12.5px; color: var(--muted); }
.inv-date.overdue { color: var(--danger); font-weight: 800; }
.inv-paidchip, .inv-owechip {
  margin-top: 6px; padding: 3px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 800;
  background: var(--ok-soft); color: var(--ok);
}
.inv-owechip { background: var(--amber-soft); color: var(--amber-deep); }
.bill-paid-chip {
  display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 800; letter-spacing: .5px; background: var(--ok-soft); color: var(--ok);
}
.bill-balance { font-size: 19px; font-weight: 800; margin-top: 6px; }
.bill-balance.overdue { color: var(--danger); }
.bill-balance.paid { color: var(--ok); }
.inv-paybox {
  display: flex; gap: 24px; justify-content: space-between; align-items: flex-start; flex-wrap: wrap;
  margin-top: 22px; padding: 16px 18px; border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--surface-2);
}
.inv-paycol { display: flex; flex-direction: column; gap: 6px; min-width: 240px; }
.inv-paycol b { font-size: 13px; }
.inv-bank {
  margin: 0; font-family: inherit; font-size: 13.5px; line-height: 1.6; white-space: pre-wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px;
}
.inv-note { font-size: 12.5px; color: var(--muted); max-width: 55ch; }
.inv-qr { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.inv-qr img { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 4px; }
.inv-qr small { color: var(--faint); font-size: 11px; max-width: 150px; text-align: center; }
@media print {
  .inv-paybox { break-inside: avoid; }
}

/* ── r28: combine-outstanding dialog ── */
.bill-combo-list { max-height: 34vh; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 6px; }
.bill-combo-list .bill-pay-line { padding-left: 10px; }
.bill-combo-sum { padding: 8px 4px 0; font-size: 13.5px; font-variant-numeric: tabular-nums; }

/* ── r29: the live-page link printed under the invoice QR ── */
.inv-liveurl {
  font-size: 10.5px; color: var(--muted); word-break: break-all; max-width: 160px;
  text-align: center; display: block; text-decoration: none;
}

/* ── r30: the optional shortfall-discount tick in Record a payment ── */
.bill-pay-discrow {
  display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 12px;
  background: var(--amber-ghost); border: 1px solid #fde8b8; border-radius: var(--radius-sm);
  font-size: 13px; cursor: pointer;
}

/* ── r34: single-invoice extras — job facts, TMP/TGS sections, per-file
   links, evidence chains, the invoice-builder panel ── */
.inv-facts {
  margin-top: 16px; padding: 12px 16px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface-2); display: flex; flex-direction: column; gap: 7px;
}
.inv-fact { display: flex; gap: 14px; font-size: 13.5px; line-height: 1.5; }
.inv-fact-l {
  flex: 0 0 110px; font-size: 10.5px; font-weight: 800; letter-spacing: .8px;
  text-transform: uppercase; color: var(--faint); padding-top: 2px;
}
.inv-fact-v { white-space: pre-wrap; }
.inv-retref { margin-top: 10px; font-size: 12.5px; font-style: italic; color: var(--amber-deep); }
.bill-kindrow td {
  padding: 10px 8px 4px !important; font-weight: 800; font-size: 12.5px; color: var(--ink);
  border-bottom: 1.5px solid var(--line-strong); background: transparent !important;
}
.bill-filelink { color: inherit; text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 2px; }
.bill-filelink:hover { text-decoration-color: var(--accent); color: var(--accent); }
.inv-chains {
  margin-top: 20px; padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 10px;
}
.inv-chains > b { font-size: 13px; }
.inv-chain { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }
.inv-chain small { color: var(--faint); }
@media print {
  .inv-facts, .inv-chains { break-inside: avoid; }
}

/* the invoice-builder dialog (admin) */
.ivb-grid { display: grid; grid-template-columns: 110px 1fr; gap: 8px 10px; align-items: start; }
.ivb-grid label { font-size: 11px; font-weight: 700; color: var(--muted); padding-top: 8px; text-transform: uppercase; letter-spacing: .5px; }
.ivb-chat {
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px;
  max-height: 240px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; background: var(--surface-2);
}
.ivb-msg { max-width: 88%; padding: 7px 11px; border-radius: 10px; font-size: 13px; white-space: pre-wrap; }
.ivb-msg.me { align-self: flex-end; background: var(--accent-soft); }
.ivb-msg.ai { align-self: flex-start; background: var(--surface); border: 1px solid var(--line); }
.ivb-msg.note { align-self: stretch; max-width: 100%; background: none; color: var(--faint); font-size: 12px; font-style: italic; padding: 1px 4px; }
.ivb-chainrow.off small { font-style: italic; }
.ivb-q { font-size: 12.5px; color: var(--amber-deep); }
.ivb-chainrow { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 4px 0; flex-wrap: wrap; }
.ivb-chainrow small { color: var(--faint); }
.ivb-split-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); margin-bottom: 6px; font-size: 13.5px; flex-wrap: wrap;
}
.ivb-split-row .grow { flex: 1; min-width: 160px; }
.ivb-split-row .amt { font-variant-numeric: tabular-nums; font-weight: 700; }
.ivb-split-row input[type=radio] { accent-color: var(--accent); }
.ivb-hint { font-size: 12px; color: var(--muted); }

/* ── r37: billing dashboard ── */
.bdash-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; }
.bdash-tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 16px; display: flex; flex-direction: column; gap: 3px;
}
.bdash-tile-l { font-size: 10.5px; font-weight: 800; letter-spacing: .7px; text-transform: uppercase; color: var(--faint); }
.bdash-tile b { font-size: 21px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.bdash-tile small { font-size: 12px; color: var(--muted); }
.bdash-tile.bad b, .bdash-tile.bad small { color: var(--danger); }
.bdash-tile.good small { color: var(--ok); }
.bdash-chartpanel { margin-top: 10px; padding: 14px 16px 8px; }
.bdash-chart-head { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; font-size: 13.5px; }
.bdash-legend { display: flex; gap: 14px; font-size: 12px; color: var(--muted); }
.bdash-legend span, .bdash-tip span { display: inline-flex; align-items: center; gap: 5px; }
.bdash-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.bdash-chartwrap { position: relative; }
.bdash-svg { width: 100%; height: auto; display: block; }
.bdash-axis { font-size: 10px; fill: var(--faint); font-variant-numeric: tabular-nums; }
.bdash-tip {
  position: absolute; top: 6px; transform: translateX(-50%); pointer-events: none;
  display: flex; flex-direction: column; gap: 2px; padding: 7px 11px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 8px;
  box-shadow: 0 4px 14px rgba(16, 25, 43, .12); font-size: 12px; white-space: nowrap; z-index: 5;
}
.bdash-tip b { font-size: 11px; color: var(--muted); }
.bdash-due-head { font-size: 13px; font-weight: 700; padding: 2px 8px 8px; }
.bdash-due { display: flex; flex-direction: column; gap: 2px; }
.bdash-due-row {
  display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 8px;
  font-size: 13px; cursor: pointer;
}
.bdash-due-row:hover { background: var(--surface-2); }
.bdash-due-when {
  flex: 0 0 86px; font-size: 11px; font-weight: 800; letter-spacing: .3px;
  color: var(--muted); text-transform: uppercase;
}
.bdash-due-row.soon .bdash-due-when { color: var(--amber-deep); }
.bdash-due-row.late .bdash-due-when { color: var(--danger); }
.bdash-due-who { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 46%; }
.bdash-due-amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.bdash-due-date { color: var(--faint); font-size: 12px; flex: 0 0 84px; text-align: right; }

/* ── r39: the shared-with-highlight file row (/s/<tok>#f=<id>) ── */
@keyframes rowflash {
  0%, 55% { background: var(--amber-soft); box-shadow: inset 0 0 0 2px var(--amber); }
  100% { background: transparent; box-shadow: none; }
}
.file-row.row-flash { animation: rowflash 6s ease-out 1; border-radius: 10px; }

/* ── AI assistant popup (chat dock) ── */
.dk-aifab { background: linear-gradient(135deg, #7c3aed, #2563eb); }
.dk-aifab:hover { background: linear-gradient(135deg, #6d28d9, #1d4ed8); }
.dk-pop.dk-ai { width: 440px; height: 600px; max-height: 92vh; }
.dk-pop.dk-ai .dk-head { background: linear-gradient(135deg, #4c1d95, #1e3a8a); }
.dk-pop.dk-ai.drop { outline: 3px dashed var(--amber); outline-offset: -6px; }
.dk-pop.dk-ai .dk-m { max-width: 92%; }
.as-welcome { color: var(--muted); font-size: 12.5px; line-height: 1.5; padding: 10px 12px; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: 10px; }
.as-welcome b { display: block; color: var(--ink); margin-bottom: 4px; }
.as-rich ul { margin: 4px 0 4px 18px; padding: 0; }
.as-rich li { margin: 2px 0; }
.as-typing { color: var(--faint); font-style: italic; }
.as-atts { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 10px; border-top: 1px solid var(--line); background: var(--surface); }
.as-attrow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.as-chip { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; padding: 3px 4px 3px 8px; border-radius: 8px; background: var(--amber-ghost); border: 1px solid var(--amber-soft); color: var(--ink); max-width: 100%; }
.as-chip svg { width: 12px; height: 12px; flex: none; }
.as-chip small { color: var(--faint); font-weight: 500; }
.as-chip.sent { background: var(--surface); border-color: var(--line); text-decoration: none; padding-right: 8px; }
.as-chip .dk-hbtn { color: var(--muted); padding: 2px; }
.as-proposal { margin-top: 6px; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface); text-align: left; }
.as-proposal[data-status="pending"] { border-color: var(--amber); box-shadow: 0 0 0 3px var(--amber-ghost); }
.as-prop-h { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.as-prop-list { margin: 4px 0 0 18px; padding: 0; font-size: 12.5px; }
.as-prop-list li { margin: 2px 0; }
.as-done { margin-top: 6px; font-size: 12.5px; display: flex; flex-direction: column; gap: 3px; text-align: left; }
.as-done-row { color: var(--ok); }
.as-done-row.bad { color: var(--danger); }
.as-approve-list { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow-y: auto; }
.as-approve-row { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); cursor: pointer; }
.as-approve-row input { margin-top: 3px; }
.as-approve-det { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
@media (max-width: 860px) { .dk-pop.dk-ai { width: 96vw; } }

/* ── AI conversations in the chat tab + project AI tab ── */
.chan-group { font-size: 10.5px; font-weight: 800; letter-spacing: .6px; text-transform: uppercase; color: var(--faint); padding: 12px 10px 4px; }
.chan-row.ai svg { color: #6d28d9; }
.chan-row.ai.new { color: var(--muted); font-style: italic; }
.chat-main.as-wide { display: flex; flex-direction: column; min-height: 60vh; }
.as-view { display: flex; flex-direction: column; flex: 1; min-height: 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.as-view .dk-msgs { flex: 1; min-height: 380px; max-height: 72vh; }
.as-view.wide .dk-m { max-width: 78%; }
.as-view.wide .dk-text { font-size: 14px; }
.as-host .as-split { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 14px; min-height: 560px; }
.as-list { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); display: flex; flex-direction: column; overflow: hidden; max-height: 78vh; }
.as-list-head { display: flex; gap: 6px; padding: 8px; border-bottom: 1px solid var(--line); align-items: center; }
.as-list-items { overflow-y: auto; flex: 1; }
.as-list-item { padding: 9px 12px; border-bottom: 1px solid var(--line); cursor: pointer; }
.as-list-item:hover { background: var(--surface-2); }
.as-list-item.on { background: #f3eefe; box-shadow: inset 3px 0 0 #7c3aed; }
.as-list-item b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.as-list-item small { color: var(--faint); font-size: 11.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dk-pop.dk-ai .dk-title { max-width: 190px; }
@media (max-width: 860px) { .as-host .as-split { grid-template-columns: 1fr; } }

/* settings: AI usage */
.stg-ai-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; margin-bottom: 6px; }
.stg-ai-stat { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--surface-2); }
.stg-ai-stat b { display: block; font-size: 20px; font-variant-numeric: tabular-nums; }
.stg-ai-stat span { font-size: 11.5px; color: var(--muted); }
.stg-ai-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.stg-ai-table th, .stg-ai-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
.stg-ai-table th { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--faint); }
.stg-ai-table .num { text-align: right; font-variant-numeric: tabular-nums; }
