/* ── 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 { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 400; 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); }

.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,.1); color: #fff; }
.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-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 {
  position: absolute; border: 2.5px solid #ef4444; 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;
}
.mk-shape.ellipse { border-radius: 50%; }
.mk-shape.ghost { pointer-events: none; border-style: dashed; }
.mk-shape.flash { border-color: var(--amber); }
.mk-shape .tag {
  position: absolute; top: -11px; left: -11px; width: 22px; height: 22px; border-radius: 50%;
  background: #ef4444; 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: 320px; flex: none; background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.mk-panel-head { padding: 14px 16px 10px; font-size: 12.5px; color: var(--muted); border-bottom: 1px solid var(--line); }
.mk-notes { flex: 1; overflow-y: auto; padding: 10px 12px 20px; }
.mk-note { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; margin-bottom: 9px; cursor: pointer; }
.mk-note:hover, .mk-note.flash { border-color: var(--amber); }
.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: #ef4444; color: #fff;
  font-size: 11.5px; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex: none;
}
.mk-note-head small { color: var(--faint); }
.mk-note-head .grow { flex: 1; }
.mk-note textarea { font-size: 13px; }
.mk-note-text { font-size: 13px; white-space: pre-wrap; }
.mk-empty { color: var(--muted); font-size: 13px; padding: 14px 6px; text-align: center; }
@media (max-width: 760px) {
  .mk-body { flex-direction: column; }
  .mk-panel { width: 100%; max-height: 42%; border-top: 1px solid var(--line); }
}

/* ── 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); }

/* markup: general (shape-less) notes */
.mk-note-head .tag.plain { background: var(--muted); }

/* 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); }
.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-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; }
/* 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-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; }
}
