/* ================================================================
   Tabexa v3 — design system
   Identity: print colors (cyan / magenta / yellow / ink) on cool white.
   Each base tints the top bar with its own color.
   ================================================================ */
:root {
  --ink: #1C1745;
  --ink-2: #4B4772;
  --ink-3: #7D7B9B;
  --ink-4: #A9A8C0;
  --line: #E3E4EE;
  --line-2: #EEEFF6;
  --bg: #F5F6FB;
  --surface: #FFFFFF;
  --surface-2: #F9F9FD;
  --hover: #F2F2FA;
  --select: #EDEAFE;
  --brand: #5A3CF0;
  --brand-2: #4527D6;
  --magenta: #E6237E;
  --cyan: #00A3E0;
  --yellow: #FFB800;
  --green: #12B76A;
  --red: #E0383E;
  --base: #5A3CF0;
  --base-ink: #FFFFFF;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(28, 23, 69, .07);
  --shadow: 0 2px 6px rgba(28, 23, 69, .06), 0 12px 32px rgba(28, 23, 69, .12);
  --font: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --display: 'Bricolage Grotesque', 'Rubik', system-ui, sans-serif;
  --row-h: 36px;
  --pill-text-mix: .52;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --ink: #EDECFB;
  --ink-2: #BDBBDA;
  --ink-3: #8F8DB3;
  --ink-4: #66648A;
  --line: #2D2A50;
  --line-2: #25223F;
  --bg: #100E24;
  --surface: #191634;
  --surface-2: #1E1B3D;
  --hover: #24214A;
  --select: #2D2668;
  --brand: #7B63FF;
  --brand-2: #9A88FF;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
  --shadow: 0 2px 6px rgba(0, 0, 0, .35), 0 16px 40px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body, #app { height: 100%; }
body {
  margin: 0;
  font: 400 14px/1.45 var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ic { flex: 0 0 auto; display: block; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- buttons & inputs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid transparent;
  font-weight: 600; font-size: 13.5px; white-space: nowrap; background: none;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); }
.btn.ghost { color: var(--ink-2); }
.btn.ghost:hover { background: var(--hover); }
.btn.outline { border-color: var(--line); background: var(--surface); color: var(--ink); }
.btn.outline:hover { border-color: var(--ink-4); }
.btn.danger { background: var(--red); color: #fff; }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: default; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px;
  border: 0; background: none; color: var(--ink-2);
}
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.input, select.input, textarea.input {
  width: 100%; height: 38px; padding: 0 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  outline: none; transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 22%, transparent); }
.input.sm { height: 32px; font-size: 13px; border-radius: 8px; }
.field-label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 14px; }
.field-label small { font-weight: 400; color: var(--ink-3); }
.muted-text { color: var(--ink-2); margin: 0 0 6px; }
.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }

.switch-row { display: flex; align-items: center; gap: 10px; font-size: 13.5px; cursor: pointer; padding: 6px 0; }
.switch { position: relative; width: 34px; height: 20px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--line); transition: background .15s; }
.switch i::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: var(--shadow-sm); }
.switch input:checked + i { background: var(--brand); }
.switch input:checked + i::after { transform: translateX(14px); }
[dir="rtl"] .switch input:checked + i::after { transform: translateX(-14px); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--hover); }
.segmented button { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 5px 10px; border-radius: 8px; font-size: 13px; color: var(--ink-2); }
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }

.avatar { display: inline-grid; place-items: center; border-radius: 50%; font-weight: 700; flex: 0 0 auto; }
kbd { font: 600 11px var(--font); padding: 2px 6px; border-radius: 6px; background: var(--hover); border: 1px solid var(--line); color: var(--ink-2); }

/* ---------- pills & chips ---------- */
.pill {
  display: inline-flex; align-items: center; max-width: 100%;
  height: 22px; padding: 0 10px; border-radius: 99px;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: rgba(var(--pill-r), var(--pill-g), var(--pill-b), .17);
  color: rgb(calc(var(--pill-r) * var(--pill-text-mix)), calc(var(--pill-g) * var(--pill-text-mix)), calc(var(--pill-b) * var(--pill-text-mix)));
  box-shadow: inset 0 0 0 1px rgba(var(--pill-r), var(--pill-g), var(--pill-b), .28);
}
[data-theme="dark"] .pill {
  background: rgba(var(--pill-r), var(--pill-g), var(--pill-b), .26);
  color: rgb(calc(var(--pill-r) + (255 - var(--pill-r)) * .62), calc(var(--pill-g) + (255 - var(--pill-g)) * .62), calc(var(--pill-b) + (255 - var(--pill-b)) * .62));
}
.pills { display: inline-flex; gap: 4px; flex-wrap: nowrap; overflow: hidden; max-width: 100%; vertical-align: middle; }
.chip {
  display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px;
  background: var(--hover); color: var(--ink); font-size: 12.5px; white-space: nowrap; max-width: 220px; overflow: hidden; text-overflow: ellipsis;
  box-shadow: inset 0 0 0 1px var(--line);
}
.link-chip { background: color-mix(in srgb, var(--cyan) 12%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cyan) 35%, transparent); }
.cb { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; border: 1.6px solid var(--ink-4); color: #fff; }
.cb.on { background: var(--green); border-color: var(--green); }
.stars { display: inline-flex; gap: 1px; font-size: 15px; line-height: 1; color: var(--line); letter-spacing: 0; }
.stars i { font-style: normal; cursor: pointer; }
.stars i.on { color: var(--yellow); }
.num { font-variant-numeric: tabular-nums; }
.long { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.cell-link { color: var(--brand); text-decoration: none; }
.cell-link:hover { text-decoration: underline; }
.formula-err { color: var(--red); font-weight: 600; font-size: 12px; }
.thumbs { display: inline-flex; gap: 4px; }
.thumb { display: inline-grid; place-items: center; border-radius: 5px; object-fit: cover; background: var(--hover); box-shadow: inset 0 0 0 1px var(--line); }
.thumb-sm { width: 24px; height: 24px; }
.thumb-md { width: 64px; height: 64px; }
.thumb-file { font-size: 8.5px; font-weight: 700; color: var(--ink-2); letter-spacing: .02em; }

/* ---------- auth ---------- */
.auth {
  height: 100%; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface);
}
.auth-art { background: var(--ink); position: relative; overflow: hidden; display: grid; place-items: center; }
.auth-art .tiles { display: grid; grid-template-columns: repeat(6, 64px); gap: 12px; transform: rotate(-8deg); }
.auth-art .tiles span { width: 64px; height: 64px; border-radius: 16px; opacity: .92; }
.auth-panel { display: grid; place-items: center; padding: 32px; }
.auth-card { width: min(380px, 100%); }
.auth-card .brand { display: flex; align-items: center; gap: 10px; margin-bottom: 36px; }
.auth-card h1 { font: 800 40px/1.05 var(--display); letter-spacing: -.02em; margin: 0 0 12px; }
.auth-card p { color: var(--ink-2); font-size: 16px; margin: 0 0 28px; }
.google-btn { width: 100%; height: 48px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 10px; box-shadow: var(--shadow-sm); }
.google-btn:hover { border-color: var(--ink-4); }
.auth-note { margin-top: 14px; font-size: 12.5px; color: var(--ink-3); text-align: center; }
.auth-error { margin-top: 16px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--red) 10%, var(--surface)); color: var(--red); font-size: 13px; }
.auth-lang { position: absolute; top: 18px; inset-inline-end: 18px; }
.wordmark { font: 800 21px/1 var(--display); letter-spacing: -.03em; }

/* ---------- app shell ---------- */
.app { height: 100%; display: grid; grid-template-rows: auto auto minmax(0, 1fr); grid-template-columns: minmax(0, 1fr); }
.topbar {
  display: flex; align-items: center; gap: 6px; height: 54px; padding: 0 12px;
  background: var(--base); color: var(--base-ink); position: relative; z-index: 20;
}
.topbar .icon-btn { color: inherit; opacity: .9; }
.topbar .icon-btn:hover { background: rgba(255, 255, 255, .16); opacity: 1; }
.topbar.ink-dark .icon-btn:hover { background: rgba(28, 23, 69, .1); }
.tb-brand { display: flex; align-items: center; gap: 9px; padding: 4px 8px 4px 4px; border-radius: 10px; border: 0; background: none; color: inherit; }
.tb-brand:hover { background: rgba(255, 255, 255, .14); }
.tb-base { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 10px; border: 0; background: none; color: inherit; font: 700 16px var(--display); letter-spacing: -.01em; max-width: 260px; }
.tb-base span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-base:hover { background: rgba(255, 255, 255, .14); }
.tb-sep { width: 1px; height: 22px; background: currentColor; opacity: .25; margin: 0 4px; }
.tabs { display: flex; align-items: flex-end; gap: 2px; align-self: stretch; overflow-x: auto; scrollbar-width: none; flex: 1 1 auto; min-width: 0; padding-top: 10px; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px; border: 0;
  border-radius: 11px 11px 0 0; background: none; color: inherit; opacity: .86; font-weight: 600; font-size: 14px; white-space: nowrap;
}
.tab:hover { background: rgba(255, 255, 255, .13); opacity: 1; }
.tab.on { background: var(--surface); color: var(--ink); opacity: 1; box-shadow: 0 -1px 0 rgba(0, 0, 0, .03); }
.tab .tab-menu { opacity: 0; margin-inline-start: 2px; border-radius: 6px; width: 22px; height: 22px; display: grid; place-items: center; }
.tab.on .tab-menu { opacity: .6; }
.tab.on .tab-menu:hover { opacity: 1; background: var(--hover); }
.tab-add { height: 32px; width: 32px; align-self: center; margin-inline-start: 4px; }
.tb-right { display: flex; align-items: center; gap: 4px; margin-inline-start: auto; flex: 0 0 auto; }
.tb-search { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px; border-radius: 10px; border: 0; background: rgba(255, 255, 255, .16); color: inherit; font-size: 13px; }
.tb-search:hover { background: rgba(255, 255, 255, .24); }
.ink-dark .tb-search { background: rgba(28, 23, 69, .08); }
.tb-search kbd { background: rgba(255, 255, 255, .2); border-color: transparent; color: inherit; }
.tb-avatar { border: 0; background: none; padding: 2px; border-radius: 50%; }

.viewbar {
  display: flex; align-items: center; gap: 4px; min-height: 50px; padding: 6px 10px;
  background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none;
}
.viewbar::-webkit-scrollbar { display: none; }
.vb-view { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border-radius: 10px; border: 0; background: none; font-weight: 700; font-size: 14px; white-space: nowrap; }
.vb-view:hover { background: var(--hover); }
.vb-view .vic { color: var(--brand); }
.vb-div { width: 1px; height: 22px; background: var(--line); margin: 0 6px; flex: 0 0 auto; }
.tool { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; border-radius: 9px; border: 0; background: none; color: var(--ink-2); font-size: 13.5px; white-space: nowrap; }
.tool:hover { background: var(--hover); color: var(--ink); }
.tool.on { color: var(--ink); font-weight: 600; }
.tool.on.t-filter { background: color-mix(in srgb, var(--green) 14%, var(--surface)); }
.tool.on.t-sort { background: color-mix(in srgb, var(--yellow) 18%, var(--surface)); }
.tool.on.t-group { background: color-mix(in srgb, var(--magenta) 12%, var(--surface)); }
.tool.on.t-hide { background: color-mix(in srgb, var(--cyan) 14%, var(--surface)); }
.vb-right { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.vb-search { position: relative; }
.vb-search .input { width: 190px; height: 32px; padding-inline-start: 32px; border-radius: 9px; font-size: 13px; }
.vb-search .ic { position: absolute; inset-inline-start: 10px; top: 8px; color: var(--ink-3); }
.save-state { font-size: 12px; color: var(--ink-3); min-width: 54px; text-align: end; }

.work { display: flex; min-height: 0; min-width: 0; position: relative; overflow: hidden; }
.views-panel {
  width: 248px; flex: 0 0 auto; background: var(--surface); border-inline-end: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; transition: margin .18s;
}
.views-panel.collapsed { margin-inline-start: -248px; }
.vp-search { padding: 12px 12px 6px; }
.vp-list { flex: 1; overflow: auto; padding: 4px 8px; }
.vp-item { display: flex; align-items: center; gap: 9px; width: 100%; height: 36px; padding: 0 10px; border-radius: 9px; border: 0; background: none; text-align: start; font-size: 13.5px; color: var(--ink-2); }
.vp-item:hover { background: var(--hover); color: var(--ink); }
.vp-item.on { background: var(--select); color: var(--ink); font-weight: 600; }
.vp-item .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vp-item .vic { color: var(--brand); }
.vp-item .vic.vt-kanban { color: var(--magenta); }
.vp-item .vic.vt-calendar { color: #E07B00; }
.vp-item .vic.vt-gallery { color: var(--cyan); }
.vp-item .vic.vt-form { color: var(--green); }
.vp-item .dot { font-size: 10.5px; color: var(--ink-3); }
.vp-create { border-top: 1px solid var(--line); padding: 10px 8px 12px; }
.vp-create h4 { margin: 4px 10px 6px; font-size: 12px; font-weight: 600; color: var(--ink-3); }
.vp-new { display: flex; align-items: center; gap: 10px; width: 100%; height: 34px; padding: 0 10px; border-radius: 9px; border: 0; background: none; font-size: 13.5px; color: var(--ink-2); }
.vp-new:hover { background: var(--hover); color: var(--ink); }
.vp-new .plus { margin-inline-start: auto; opacity: 0; }
.vp-new:hover .plus { opacity: .7; }
.view-host { flex: 1; min-width: 0; min-height: 0; position: relative; display: flex; flex-direction: column; background: var(--surface); }
.loading-bar { position: absolute; top: 0; inset-inline: 0; height: 2px; overflow: hidden; z-index: 5; opacity: 0; transition: opacity .2s; }
.loading-bar.on { opacity: 1; }
.loading-bar::after { content: ''; position: absolute; inset-block: 0; width: 30%; background: linear-gradient(90deg, var(--cyan), var(--magenta), var(--yellow)); animation: bar 1s infinite; }
@keyframes bar { from { inset-inline-start: -30%; } to { inset-inline-start: 100%; } }
.partial-note { display: flex; align-items: center; gap: 10px; padding: 8px 14px; font-size: 13px; background: color-mix(in srgb, var(--yellow) 16%, var(--surface)); border-bottom: 1px solid var(--line); }
.partial-note .btn { margin-inline-start: auto; }

/* ---------- grid ---------- */
.grid-wrap { flex: 1; min-height: 0; overflow: auto; position: relative; outline: none; }
.grid { position: relative; min-width: 100%; width: max-content; }
.g-head, .g-row, .g-foot, .g-group { display: grid; grid-template-columns: var(--cols); }
.g-head { position: sticky; top: 0; z-index: 4; background: var(--surface-2); border-bottom: 1px solid var(--line); height: 38px; }
.g-hc {
  position: relative; display: flex; align-items: center; gap: 7px; padding: 0 10px; height: 38px;
  font-size: 13px; font-weight: 600; color: var(--ink-2); border-inline-end: 1px solid var(--line-2); background: var(--surface-2);
  user-select: none; cursor: pointer; min-width: 0;
}
.g-hc:hover { background: var(--hover); }
.g-hc .hname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.g-hc .hic { color: var(--ink-3); }
.g-hc .hmenu { opacity: 0; color: var(--ink-3); }
.g-hc:hover .hmenu { opacity: 1; }
.g-hc.sorted .hic { color: #B07800; }
.g-hc.filtered .hic { color: var(--green); }
.g-hc.drag-over { box-shadow: inset 3px 0 0 var(--brand); }
[dir="rtl"] .g-hc.drag-over { box-shadow: inset -3px 0 0 var(--brand); }
.g-resize { position: absolute; top: 0; inset-inline-end: -4px; width: 8px; height: 100%; cursor: col-resize; z-index: 2; }
.g-resize:hover, .g-resize.on { background: linear-gradient(90deg, transparent 3px, var(--brand) 3px, var(--brand) 5px, transparent 5px); }
.g-hc.idx, .g-c.idx { position: sticky; inset-inline-start: 0; z-index: 3; justify-content: center; padding: 0; color: var(--ink-3); font-weight: 500; font-size: 12px; }
.g-hc.prim, .g-c.prim { position: sticky; inset-inline-start: var(--idx-w, 64px); z-index: 3; border-inline-end: 1px solid var(--line); }
.g-hc.idx, .g-hc.prim { z-index: 5; }
.g-hc.add { color: var(--ink-3); justify-content: center; border-inline-end: 0; }
.g-body { position: relative; }
.g-row { position: absolute; inset-inline: 0; height: var(--row-h); }
.g-c {
  position: relative; display: flex; align-items: center; gap: 6px; padding: 0 10px; min-width: 0; overflow: hidden;
  border-bottom: 1px solid var(--line-2); border-inline-end: 1px solid var(--line-2); background: var(--surface); font-size: 13.5px; white-space: nowrap;
}
.g-row.tall .g-c { align-items: center; align-items: safe center; padding-block: 6px; white-space: normal; } /* in the middle of tall rows too (start only when it doesn't fit) */
.g-row.tall .g-c .long { white-space: normal; display: -webkit-box; -webkit-line-clamp: var(--clamp, 2); -webkit-box-orient: vertical; }
.g-row.tall .pills { flex-wrap: wrap; }
.g-row:hover .g-c { background: color-mix(in srgb, var(--hover) 70%, var(--surface)); }
.g-row.sel .g-c { background: color-mix(in srgb, var(--select) 75%, var(--surface)); }
.g-c.idx { gap: 0; }
.g-c.idx .rn { font-variant-numeric: tabular-nums; }
.g-c.idx .rcheck, .g-c.idx .rexp { display: none; }
.g-row:hover .g-c.idx .rn, .g-row.sel .g-c.idx .rn { display: none; }
.g-row:hover .g-c.idx .rcheck, .g-row.sel .g-c.idx .rcheck, .g-row:hover .g-c.idx .rexp { display: grid; }
.rcheck { width: 26px; height: 26px; place-items: center; border: 0; background: none; color: var(--ink-3); border-radius: 6px; cursor: grab; }
.rcheck input { width: 15px; height: 15px; accent-color: var(--brand); cursor: pointer; margin: 0; }
.rexp { width: 24px; height: 24px; place-items: center; border: 0; background: none; color: var(--brand); border-radius: 6px; }
.rexp:hover { background: var(--select); }
.g-c.active { box-shadow: inset 0 0 0 2px var(--brand); z-index: 2; border-radius: 2px; }
.g-c.in-range { background: color-mix(in srgb, var(--select) 85%, var(--surface)) !important; }
.g-c.computed { color: var(--ink-2); }
.g-c.numc { justify-content: flex-end; }
.g-c.drop-before { box-shadow: inset 0 2px 0 var(--brand); }
.g-addrow { position: absolute; inset-inline: 0; height: 38px; display: flex; align-items: center; }
.g-addrow button { position: sticky; inset-inline-start: 0; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 18px; border: 0; background: none; color: var(--ink-3); font-size: 13.5px; width: 100%; text-align: start; }
.g-addrow button:hover { color: var(--brand); background: var(--hover); }
.g-group { position: absolute; inset-inline: 0; height: 44px; align-items: center; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.g-group .gl { position: sticky; inset-inline-start: 0; display: flex; align-items: center; gap: 10px; padding: 0 12px; font-weight: 600; grid-column: 1 / -1; }
.g-group .gl button { border: 0; background: none; display: grid; place-items: center; color: var(--ink-3); width: 24px; height: 24px; border-radius: 6px; }
.g-group .gl button:hover { background: var(--hover); }
.g-group .gl .cnt { color: var(--ink-3); font-weight: 500; font-size: 12.5px; }
.g-group .gl .gname { font-size: 12px; color: var(--ink-3); font-weight: 500; }
.g-foot { position: sticky; bottom: 0; z-index: 4; background: var(--surface-2); border-top: 1px solid var(--line); height: 34px; }
.g-fc { display: flex; align-items: center; justify-content: flex-end; gap: 6px; padding: 0 10px; font-size: 12px; color: var(--ink-3); border-inline-end: 1px solid var(--line-2); cursor: pointer; background: var(--surface-2); white-space: nowrap; overflow: hidden; }
.g-fc:hover { background: var(--hover); }
.g-fc b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }
.g-fc.idx { position: sticky; inset-inline-start: 0; z-index: 3; justify-content: flex-start; }
.g-fc.prim { position: sticky; inset-inline-start: var(--idx-w, 64px); z-index: 3; justify-content: flex-start; border-inline-end: 1px solid var(--line); }
.g-fc .hint { opacity: 0; }
.g-fc:hover .hint { opacity: 1; }
.g-editor {
  position: absolute; z-index: 30; background: var(--surface); box-shadow: 0 0 0 2px var(--brand), var(--shadow); border-radius: 3px;
  display: flex; align-items: center;
}
.g-editor input, .g-editor textarea { width: 100%; border: 0; outline: none; background: transparent; padding: 0 10px; font-size: 13.5px; }
.g-editor textarea { padding: 8px 10px; min-height: 120px; resize: vertical; line-height: 1.5; }
.viewer-note { padding: 8px 14px; font-size: 13px; color: var(--ink-2); background: var(--surface-2); border-bottom: 1px solid var(--line); }

/* ---------- popovers & menus ---------- */
.popover {
  position: fixed; z-index: 1000; background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); padding: 8px; opacity: 0; transform: translateY(-4px); transition: opacity .12s, transform .12s;
  max-height: min(560px, calc(100vh - 24px)); overflow: auto; min-width: 200px;
}
.popover.in { opacity: 1; transform: none; }
.menu { display: flex; flex-direction: column; min-width: 220px; }
.menu-item { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border: 0; background: none; border-radius: 8px; font-size: 13.5px; text-align: start; color: var(--ink); }
.menu-item:hover { background: var(--hover); }
.menu-item .ic { color: var(--ink-3); }
.menu-item.danger, .menu-item.danger .ic { color: var(--red); }
.menu-item.active { font-weight: 600; }
.menu-item kbd { margin-inline-start: auto; }
.menu-item .menu-check { margin-inline-start: auto; color: var(--brand); }
.menu-item:disabled { opacity: .45; cursor: default; }
.menu-gap { width: 16px; }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-head { padding: 8px 10px 4px; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.pop-title { font-weight: 700; font-size: 14px; padding: 4px 6px 10px; display: flex; align-items: center; gap: 8px; }
.pop-empty { padding: 10px 8px 14px; color: var(--ink-3); font-size: 13px; }
.pop-foot { display: flex; align-items: center; gap: 8px; padding: 8px 4px 2px; border-top: 1px solid var(--line-2); margin-top: 8px; }
.rule { display: grid; grid-template-columns: 54px minmax(120px, 1.2fr) minmax(110px, 1fr) minmax(120px, 1.3fr) 30px; gap: 6px; align-items: center; padding: 4px; }
.rule .lead { font-size: 13px; color: var(--ink-3); text-align: end; }
.rule select.input, .rule .input { height: 32px; font-size: 13px; padding: 0 8px; border-radius: 8px; }
.sort-rule { display: grid; grid-template-columns: minmax(150px, 1fr) 150px 30px; gap: 6px; align-items: center; padding: 4px; }
.fld-row { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 8px; border-radius: 8px; cursor: pointer; font-size: 13.5px; }
.fld-row:hover { background: var(--hover); }
.fld-row .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fld-row .ic { color: var(--ink-3); }
.opt-list { max-height: 280px; overflow: auto; display: flex; flex-direction: column; gap: 2px; padding: 2px; }
.opt { display: flex; align-items: center; gap: 8px; min-height: 34px; padding: 4px 8px; border-radius: 8px; border: 0; background: none; text-align: start; width: 100%; }
.opt:hover, .opt.kb { background: var(--hover); }
.opt .tick { margin-inline-start: auto; color: var(--brand); visibility: hidden; }
.opt.on .tick { visibility: visible; }
.opt .sub { color: var(--ink-3); font-size: 12px; }
.pop-search { margin-bottom: 6px; }

/* ---------- modals ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 900; background: rgba(16, 14, 36, .44); display: grid; place-items: center; padding: 20px;
  opacity: 0; transition: opacity .15s;
}
.modal-backdrop.in { opacity: 1; }
.modal {
  width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 18px; box-shadow: var(--shadow); transform: translateY(8px) scale(.99); transition: transform .15s;
}
.modal-backdrop.in .modal { transform: none; }
.modal-sm { width: min(420px, 100%); }
.modal-lg { width: min(760px, 100%); }
.modal-xl { width: min(1080px, 100%); height: min(860px, calc(100vh - 40px)); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 18px 20px 6px; }
.modal-head h2 { margin: 0; font: 700 19px/1.25 var(--display); letter-spacing: -.01em; flex: 1; }
.modal-body { padding: 12px 20px 20px; overflow: auto; flex: 1; min-height: 0; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 20px 18px; border-top: 1px solid var(--line-2); }

/* ---------- toasts ---------- */
#toasts { position: fixed; bottom: 22px; inset-inline-start: 50%; transform: translateX(-50%); z-index: 2000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
[dir="rtl"] #toasts { transform: translateX(50%); }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 14px; padding: 10px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 13.5px; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px); transition: all .18s; max-width: min(560px, 92vw); }
.toast.in { opacity: 1; transform: none; }
.toast-error { background: var(--red); color: #fff; }
.toast-action { border: 0; background: rgba(255, 255, 255, .16); color: inherit; border-radius: 8px; padding: 4px 10px; font-weight: 700; }

/* ---------- empty states ---------- */
.empty { display: grid; justify-items: center; text-align: center; padding: 64px 20px; gap: 6px; margin: auto; }
.empty-ic { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: var(--select); color: var(--brand); margin-bottom: 8px; }
.empty h3 { margin: 0; font: 700 18px var(--display); }
.empty p { margin: 0 0 12px; color: var(--ink-2); max-width: 360px; }

/* ---------- home ---------- */
.home { overflow: auto; height: 100%; }
.home-inner { max-width: 1080px; margin: 0 auto; padding: 40px 28px 80px; }
.home h1 { font: 800 34px/1.1 var(--display); letter-spacing: -.02em; margin: 0 0 6px; }
.home .sub { color: var(--ink-2); margin: 0 0 30px; font-size: 15px; }
.home-section { display: flex; align-items: center; gap: 10px; margin: 28px 0 14px; }
.home-section h2 { font: 700 16px var(--display); margin: 0; }
.home-section .count { color: var(--ink-3); font-size: 13px; }
.base-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; }
.base-card {
  position: relative; display: flex; flex-direction: column; gap: 12px; padding: 16px; min-height: 132px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--surface); text-align: start; transition: border-color .12s, box-shadow .12s, transform .12s;
}
.base-card:hover { border-color: color-mix(in srgb, var(--bc) 50%, var(--line)); box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.base-card .bc-mark { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; font: 800 20px var(--display); background: var(--bc); color: var(--bc-ink); }
.base-card .bc-name { font: 700 16px var(--display); letter-spacing: -.01em; }
.base-card .bc-meta { color: var(--ink-3); font-size: 12.5px; }
.base-card .bc-menu { position: absolute; top: 10px; inset-inline-end: 10px; opacity: 0; }
.base-card:hover .bc-menu { opacity: 1; }
.base-card.new { border-style: dashed; align-items: center; justify-content: center; color: var(--ink-2); background: none; }
.base-card.new:hover { color: var(--brand); }
.home-tables { display: flex; flex-wrap: wrap; gap: 6px; }
.home-tables span { font-size: 12px; padding: 2px 8px; border-radius: 6px; background: var(--hover); color: var(--ink-2); }

/* ---------- record window ---------- */
.rec { display: grid; grid-template-columns: 1fr 340px; height: 100%; min-height: 0; }
.rec-main { display: flex; flex-direction: column; min-height: 0; border-inline-end: 1px solid var(--line); }
.rec-head { display: flex; align-items: center; gap: 8px; padding: 16px 18px 10px; border-bottom: 1px solid var(--line-2); }
.rec-head .rec-num { font-size: 12.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; padding: 3px 8px; border-radius: 6px; background: var(--hover); }
.rec-head h2 { margin: 0; flex: 1; font: 700 21px/1.25 var(--display); letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rec-body { overflow: auto; padding: 18px 22px 40px; flex: 1; }
.rf { margin-bottom: 18px; }
.rf-label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.rf-label .ic { color: var(--ink-3); }
.rf-label .req { color: var(--magenta); }
.rf-desc { font-size: 12px; color: var(--ink-3); margin: -2px 0 6px; }
.rf-value { min-height: 38px; }
.rf-computed { padding: 8px 12px; border-radius: 10px; background: var(--surface-2); border: 1px dashed var(--line); min-height: 38px; display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.rf-picker { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 6px; min-height: 38px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; }
.rf-picker:hover { border-color: var(--ink-4); }
.rf-picker .chip, .rf-picker .pill { cursor: default; }
.rf-picker .x { border: 0; background: none; color: inherit; opacity: .6; padding: 0; margin-inline-start: 2px; display: inline-grid; }
.rf-picker .add { color: var(--ink-3); font-size: 13px; display: inline-flex; align-items: center; gap: 4px; padding: 0 4px; }
.rf-stars { font-size: 22px; }
.rf-check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; padding: 8px 0; }
.rf-check .cb { width: 22px; height: 22px; }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.att { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface-2); }
.att .preview { height: 92px; display: grid; place-items: center; background: var(--hover); cursor: zoom-in; }
.att .preview img { width: 100%; height: 100%; object-fit: cover; }
.att .preview .ext { font: 800 15px var(--display); color: var(--ink-3); }
.att .meta { padding: 6px 8px; font-size: 12px; }
.att .meta div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att .meta small { color: var(--ink-3); }
.att .acts { position: absolute; top: 6px; inset-inline-end: 6px; display: none; gap: 4px; }
.att:hover .acts { display: flex; }
.att .acts button { width: 26px; height: 26px; border-radius: 7px; border: 0; background: rgba(16, 14, 36, .72); color: #fff; display: grid; place-items: center; }
.dropzone { border: 1.5px dashed var(--line); border-radius: 12px; padding: 16px; text-align: center; color: var(--ink-3); font-size: 13px; cursor: pointer; display: grid; place-items: center; gap: 6px; min-height: 92px; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); color: var(--brand); background: color-mix(in srgb, var(--brand) 5%, transparent); }
.rec-side { display: flex; flex-direction: column; min-height: 0; background: var(--surface-2); border-radius: 0 18px 18px 0; }
[dir="rtl"] .rec-side { border-radius: 18px 0 0 18px; }
.rec-side .segmented { margin: 14px 14px 6px; align-self: flex-start; }
.feed { flex: 1; overflow: auto; padding: 8px 14px; display: flex; flex-direction: column; gap: 12px; }
.feed-item { display: flex; gap: 10px; font-size: 13px; }
.feed-item .body { flex: 1; min-width: 0; }
.feed-item .who { font-weight: 600; }
.feed-item .when { color: var(--ink-3); font-size: 11.5px; margin-inline-start: 6px; }
.feed-item .text { margin-top: 3px; white-space: pre-wrap; word-wrap: break-word; }
.feed-item .bubble { margin-top: 4px; padding: 8px 11px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); white-space: pre-wrap; word-wrap: break-word; }
.feed-item .del { border: 0; background: none; color: var(--ink-3); font-size: 11.5px; padding: 0; margin-top: 2px; }
.chg { margin-top: 4px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; }
.chg .from { text-decoration: line-through; color: var(--ink-3); }
.composer { padding: 10px 14px 14px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1; min-height: 40px; max-height: 140px; resize: none; }

/* ---------- field editor ---------- */
.type-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.type-group { font-size: 12px; font-weight: 600; color: var(--ink-3); margin: 12px 2px 6px; grid-column: 1 / -1; }
.type-opt { display: flex; gap: 10px; align-items: flex-start; padding: 9px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); text-align: start; }
.type-opt:hover { border-color: var(--ink-4); }
.type-opt.on { border-color: var(--brand); background: color-mix(in srgb, var(--brand) 7%, var(--surface)); box-shadow: inset 0 0 0 1px var(--brand); }
.type-opt .tic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--hover); color: var(--ink-2); flex: 0 0 auto; }
.type-opt.on .tic { background: var(--brand); color: #fff; }
.type-opt b { display: block; font-size: 13.5px; font-weight: 600; }
.type-opt small { display: block; font-size: 12px; color: var(--ink-3); line-height: 1.35; }
.type-current { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); width: 100%; text-align: start; }
.type-current b { flex: 1; font-weight: 600; }
.opt-edit { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.opt-edit .swatch { width: 26px; height: 26px; border-radius: 8px; border: 0; flex: 0 0 auto; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); }
.opt-edit .input { height: 34px; }
.swatches { display: grid; grid-template-columns: repeat(6, 28px); gap: 6px; padding: 4px; }
.swatches button { width: 28px; height: 28px; border-radius: 8px; border: 0; }
.swatches button.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.formula-box { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 13px; direction: ltr; text-align: left; }
.formula-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.formula-chips button { border: 1px solid var(--line); background: var(--surface); border-radius: 7px; padding: 3px 8px; font-size: 12px; display: inline-flex; align-items: center; gap: 5px; }
.formula-chips button:hover { border-color: var(--brand); color: var(--brand); }
.formula-result { padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13px; }
.formula-result.err { color: var(--red); background: color-mix(in srgb, var(--red) 6%, var(--surface)); }
.cfg-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* ---------- board ---------- */
.board { flex: 1; min-height: 0; overflow: auto; display: flex; gap: 14px; padding: 16px; align-items: flex-start; background: var(--bg); }
.col { width: 284px; flex: 0 0 auto; display: flex; flex-direction: column; max-height: 100%; border-radius: 16px; background: var(--surface-2); border: 1px solid var(--line-2); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 8px; position: relative; }
.col-head::before { content: ''; position: absolute; top: 0; inset-inline: 12px; height: 4px; border-radius: 0 0 4px 4px; background: var(--colc, var(--ink-4)); }
.col-head .count { color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.col-head .add { margin-inline-start: auto; }
.col-cards { flex: 1; overflow: auto; padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.col.drop .col-cards { background: color-mix(in srgb, var(--brand) 6%, transparent); border-radius: 12px; }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; cursor: pointer;
  box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s; touch-action: none; user-select: none;
}
.card:hover { border-color: var(--ink-4); }
.card.dragging { opacity: .4; }
.card-ghost { position: fixed; z-index: 3000; pointer-events: none; transform: rotate(2deg); box-shadow: var(--shadow); width: 260px; }
.card .cover { margin: -10px -12px 10px; height: 120px; border-radius: 11px 11px 0 0; overflow: hidden; background: var(--hover); }
.card .cover img { width: 100%; height: 100%; object-fit: cover; }
.card .title { font-weight: 600; font-size: 14px; margin-bottom: 6px; overflow-wrap: anywhere; }
.card .crow { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; font-size: 12.5px; }
.card .crow .lbl { font-size: 11px; color: var(--ink-3); }
.card .crow .val { min-height: 18px; overflow: hidden; }
.card .num-badge { font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.col-add-card { border: 0; background: none; color: var(--ink-3); display: flex; align-items: center; gap: 6px; padding: 8px 12px 12px; font-size: 13px; }
.col-add-card:hover { color: var(--brand); }
.drop-line { height: 3px; border-radius: 3px; background: var(--brand); margin: -4px 0; }

/* ---------- calendar ---------- */
.cal { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.cal-head { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line); }
.cal-head h3 { margin: 0 10px 0 4px; font: 700 19px var(--display); letter-spacing: -.01em; min-width: 160px; }
.cal-head .right { margin-inline-start: auto; display: flex; gap: 8px; align-items: center; }
.cal-body { display: flex; flex: 1; min-height: 0; }
.cal-grid { flex: 1; display: grid; grid-template-rows: auto repeat(6, 1fr); min-height: 0; overflow: auto; }
.cal-wd, .cal-week { display: grid; grid-template-columns: repeat(7, minmax(110px, 1fr)); }
.cal-wd div { padding: 8px 10px; font-size: 12px; font-weight: 600; color: var(--ink-3); border-bottom: 1px solid var(--line); }
.cal-day { border-inline-end: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 4px 6px 6px; min-height: 108px; display: flex; flex-direction: column; gap: 3px; position: relative; }
.cal-day.out { background: var(--surface-2); }
.cal-day.out .dn { color: var(--ink-4); }
.cal-day.drop { background: color-mix(in srgb, var(--brand) 8%, var(--surface)); }
.cal-day .dtop { display: flex; align-items: center; }
.cal-day .dn { font-size: 12.5px; font-weight: 600; width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.today .dn { background: var(--magenta); color: #fff; }
.cal-day .dadd { margin-inline-start: auto; opacity: 0; width: 24px; height: 24px; }
.cal-day:hover .dadd { opacity: 1; }
.cal-ev {
  display: flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 7px; font-size: 12.5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: rgba(var(--pill-r), var(--pill-g), var(--pill-b), .16); border-inline-start: 3px solid rgb(var(--pill-r), var(--pill-g), var(--pill-b)); touch-action: none; user-select: none;
}
.cal-ev:hover { filter: brightness(.97); }
.cal-ev .tm { color: var(--ink-3); font-size: 11.5px; }
.cal-more { border: 0; background: none; text-align: start; font-size: 12px; color: var(--ink-2); padding: 2px 6px; border-radius: 6px; }
.cal-more:hover { background: var(--hover); }
.cal-side { width: 260px; border-inline-start: 1px solid var(--line); overflow: auto; padding: 12px; background: var(--surface-2); }
.cal-side h4 { margin: 2px 0 10px; font-size: 13px; }

/* ---------- gallery ---------- */
.gallery { flex: 1; min-height: 0; overflow: auto; padding: 18px; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; align-content: start; background: var(--bg); }
.gcard { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; cursor: pointer; transition: box-shadow .12s, transform .12s; }
.gcard:hover { box-shadow: var(--shadow-sm); transform: translateY(-1px); }
.gcard .gcover { height: 170px; background: var(--hover); display: grid; place-items: center; color: var(--ink-4); }
.gcard .gcover img { width: 100%; height: 100%; object-fit: cover; }
.gcard .gbody { padding: 12px 14px 14px; }
.gcard .gtitle { font-weight: 700; margin-bottom: 8px; }

/* ---------- form builder & public form ---------- */
.fb { flex: 1; min-height: 0; display: grid; grid-template-columns: 1fr 360px; }
.fb-preview { overflow: auto; background: var(--bg); padding: 28px 20px 60px; }
.fb-side { border-inline-start: 1px solid var(--line); overflow: auto; padding: 16px; background: var(--surface); }
.fb-side h4 { margin: 14px 0 8px; font-size: 13px; }
.fb-share { padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); margin-bottom: 16px; }
.fb-share .linkbox { display: flex; gap: 6px; margin-top: 10px; }
.fb-q { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); margin-bottom: 6px; font-size: 13px; }
.fb-q .name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fb-q.off { opacity: .55; border-style: dashed; }
.fb-q .mv { display: flex; flex-direction: column; }
.fb-q .mv button { border: 0; background: none; padding: 0; color: var(--ink-3); height: 12px; display: grid; place-items: center; }
.pf { max-width: 640px; margin: 0 auto; background: var(--surface); border-radius: 20px; border: 1px solid var(--line); overflow: hidden; box-shadow: var(--shadow-sm); }
.pf-band { height: 12px; background: var(--fc, var(--brand)); }
.pf-head { padding: 26px 30px 6px; }
.pf-head .logo { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; color: var(--ink-3); font-size: 12.5px; }
.pf-head h1 { font: 800 28px/1.15 var(--display); margin: 0 0 8px; letter-spacing: -.02em; }
.pf-head p { color: var(--ink-2); margin: 0; white-space: pre-wrap; }
.pf-body { padding: 18px 30px 30px; }
.pf-q { margin-bottom: 20px; }
.pf-q > label { display: block; font-weight: 600; margin-bottom: 4px; }
.pf-q .req { color: var(--magenta); }
.pf-q .help { font-size: 12.5px; color: var(--ink-3); margin-bottom: 8px; }
.pf-q.err .input { border-color: var(--red); }
.pf-q .errmsg { color: var(--red); font-size: 12.5px; margin-top: 4px; }
.pf-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.pf-choice { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 6px 14px; font-size: 13.5px; }
.pf-choice.on { border-color: transparent; background: rgba(var(--pill-r), var(--pill-g), var(--pill-b), .2); box-shadow: inset 0 0 0 1.5px rgb(var(--pill-r), var(--pill-g), var(--pill-b)); font-weight: 600; }
.pf-stars { font-size: 28px; color: var(--line); display: flex; gap: 4px; }
.pf-stars button { border: 0; background: none; padding: 0; color: inherit; font-size: inherit; line-height: 1; }
.pf-stars button.on { color: var(--yellow); }
.pf-files { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.pf-file { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 6px 10px; border-radius: 9px; background: var(--hover); }
.pf-file button { margin-inline-start: auto; border: 0; background: none; color: var(--ink-3); }
.pf-submit { width: 100%; height: 48px; border-radius: 12px; border: 0; background: var(--fc, var(--brand)); color: var(--fc-ink, #fff); font-weight: 700; font-size: 15px; }
.pf-done { text-align: center; padding: 50px 30px; }
.pf-done .ok { width: 64px; height: 64px; border-radius: 50%; background: var(--green); color: #fff; display: grid; place-items: center; margin: 0 auto 16px; }
.pf-foot { text-align: center; padding: 18px; font-size: 12px; color: var(--ink-3); }
.pf-page { height: 100%; overflow: auto; padding: 28px 16px 40px; background: var(--bg); }
.pf .hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ---------- command palette ---------- */
.cmd { padding: 0; }
.cmd .cmd-in { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.cmd .cmd-in input { border: 0; outline: none; background: none; flex: 1; font-size: 16px; }
.cmd-list { max-height: 400px; overflow: auto; padding: 8px; }
.cmd-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 10px; border-radius: 9px; border: 0; background: none; text-align: start; font-size: 14px; }
.cmd-item small { margin-inline-start: auto; color: var(--ink-3); font-size: 12px; }
.cmd-item.kb, .cmd-item:hover { background: var(--hover); }
.cmd-item .ic { color: var(--ink-3); }

/* ---------- settings / members / activity ---------- */
.list-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.list-row .info { flex: 1; min-width: 0; }
.list-row .info b { display: block; font-weight: 600; }
.list-row .info span { color: var(--ink-3); font-size: 12.5px; }
.list-row select { width: auto; height: 32px; }
.section-title { font: 700 14px var(--display); margin: 18px 0 8px; }
.base-checks { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0 12px; }
.base-checks label { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 99px; border: 1px solid var(--line); font-size: 13px; cursor: pointer; }
.color-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.color-picks button { width: 30px; height: 30px; border-radius: 9px; border: 0; }
.color-picks button.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.help-grid div { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); font-size: 13px; }
.help-grid kbd { white-space: nowrap; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .rec { grid-template-columns: 1fr; }
  .rec-side { display: none; }
  .fb { grid-template-columns: 1fr; }
  .fb-side { border-inline-start: 0; border-top: 1px solid var(--line); }
  .cal-side { display: none; }
}
@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .views-panel { position: absolute; inset-block: 0; inset-inline-start: 0; z-index: 30; box-shadow: var(--shadow); }
  .views-panel.collapsed { margin-inline-start: -260px; box-shadow: none; }
  .tb-base span, .tb-search .lbl, .tb-search kbd, .wordmark { display: none; }
  .vb-search .input { width: 130px; }
  .tool .lbl { display: none; }
  .home-inner { padding: 24px 16px 60px; }
  .home h1 { font-size: 26px; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { border-radius: 18px 18px 0 0; max-height: 94vh; width: 100% !important; }
  .modal-xl { height: 94vh; }
  .help-grid { grid-template-columns: 1fr; }
  .rule { grid-template-columns: 1fr 1fr; }
  .rule .lead { display: none; }
  .cal-wd, .cal-week { grid-template-columns: repeat(7, minmax(46px, 1fr)); }
  .cal-day { min-height: 74px; padding: 2px; }
  .cal-ev { padding: 1px 4px; font-size: 11px; }
  .col { width: 260px; }
  .type-grid { grid-template-columns: 1fr; }
}

/* ================================================================
   v4 — solid option pills, attachments viewer, color picker,
   button field, people & permissions, automations, API
   ================================================================ */

/* ---------- solid pills (Airtable-like) ---------- */
.pill {
  background: var(--pill-bg, rgba(var(--pill-r), var(--pill-g), var(--pill-b), .17));
  color: var(--pill-ink, rgb(calc(var(--pill-r) * var(--pill-text-mix)), calc(var(--pill-g) * var(--pill-text-mix)), calc(var(--pill-b) * var(--pill-text-mix))));
  box-shadow: none;
}
[data-theme="dark"] .pill {
  background: var(--pill-bg, rgba(var(--pill-r), var(--pill-g), var(--pill-b), .26));
  color: var(--pill-ink, rgb(calc(var(--pill-r) + (255 - var(--pill-r)) * .62), calc(var(--pill-g) + (255 - var(--pill-g)) * .62), calc(var(--pill-b) + (255 - var(--pill-b)) * .62)));
}
.viewer-note { display: flex; align-items: center; gap: 8px; }
.modal-full { width: 100vw; height: 100vh; max-height: 100vh; border-radius: 0; }
.modal-backdrop:has(.modal-full) { padding: 0; }
.muted-note { display: block; color: var(--ink-3); font-size: 12.5px; line-height: 1.5; }
.sub { color: var(--ink-2); margin: 0 0 14px; }
.count { color: var(--ink-3); font-weight: 500; font-size: 12.5px; margin-inline-start: 4px; }
.mono, .code { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; direction: ltr; text-align: left; }
.code { background: #15122E; color: #E8E6FF; border-radius: 10px; padding: 12px 14px; font-size: 12.5px; line-height: 1.55; overflow: auto; max-height: 340px; white-space: pre; margin: 6px 0; }
.linkbox { display: flex; gap: 6px; align-items: center; }
.linkbox .input { flex: 1; min-width: 0; }

/* ---------- top bar pills ---------- */
.tb-pill { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 12px; border-radius: 10px; border: 0; background: rgba(255, 255, 255, .16); color: inherit; font-weight: 600; font-size: 13px; white-space: nowrap; }
.tb-pill:hover { background: rgba(255, 255, 255, .26); }
.ink-dark .tb-pill { background: rgba(28, 23, 69, .08); }
.tb-pill.share { background: var(--surface); color: var(--ink); }
.tb-pill.share:hover { filter: brightness(.96); }

/* ---------- attachment cells ---------- */
.thumb[data-att] { cursor: zoom-in; transition: transform .08s; }
.thumb[data-att]:hover { transform: scale(1.08); box-shadow: 0 0 0 2px var(--brand); }
.thumb-file { background: var(--ext, var(--brand)); color: #fff; box-shadow: none; }
.thumb-more { font-size: 10.5px; font-weight: 700; color: var(--ink-2); }
.g-row.tall .thumb-sm { width: calc(var(--row-h) - 18px); height: calc(var(--row-h) - 18px); max-width: 96px; max-height: 96px; border-radius: 7px; }
.g-c.attc { gap: 4px; }
.g-c.attc .thumbs { flex: 1; min-width: 0; overflow: hidden; }
.cell-add { display: none; flex: 0 0 auto; width: 22px; height: 22px; border-radius: 6px; border: 0; background: var(--brand); color: #fff; place-items: center; margin-inline-start: auto; }
.g-c.attc.active .cell-add, .g-row:hover .g-c.attc .cell-add { display: grid; }
.g-c.file-over { box-shadow: inset 0 0 0 2px var(--green) !important; background: color-mix(in srgb, var(--green) 10%, var(--surface)) !important; }

/* tiles (cell manager + record window) */
.att-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(132px, 1fr)); gap: 10px; }
.att-tile { position: relative; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--surface); display: flex; flex-direction: column; }
.att-tile:hover { border-color: var(--ink-4); }
.att-prev { position: relative; height: 104px; border: 0; padding: 0; background: var(--hover); display: grid; place-items: center; cursor: zoom-in; overflow: hidden; }
.att-prev img { width: 100%; height: 100%; object-fit: cover; }
.att-ext { display: inline-grid; place-items: center; min-width: 46px; height: 46px; padding: 0 8px; border-radius: 12px; background: var(--ext, var(--brand)); color: #fff; font: 800 13px var(--display); letter-spacing: .02em; }
.att-ext.big { min-width: 96px; height: 96px; border-radius: 22px; font-size: 22px; }
.att-note { position: absolute; bottom: 6px; inset-inline-start: 6px; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: var(--yellow); color: #1C1745; }
.att-info { padding: 6px 8px 8px; display: grid; gap: 2px; min-width: 0; }
.att-name { width: 100%; border: 1px solid transparent; background: none; border-radius: 6px; padding: 2px 4px; margin: 0 -4px; font-size: 12.5px; font-weight: 600; color: var(--ink); text-overflow: ellipsis; outline: none; }
.att-name:hover { border-color: var(--line); }
.att-name:focus { border-color: var(--brand); background: var(--surface); }
.att-name.ro { overflow: hidden; white-space: nowrap; }
.att-cmt { font-size: 11.5px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.att-cmt.muted { color: var(--ink-3); }
.att-acts { position: absolute; top: 6px; inset-inline-end: 6px; display: none; gap: 4px; }
.att-tile:hover .att-acts, .att-tile:focus-within .att-acts { display: flex; }
.att-acts button { width: 26px; height: 26px; border-radius: 7px; border: 0; background: rgba(16, 14, 36, .72); color: #fff; display: grid; place-items: center; }
.att-drop { border: 1.5px dashed var(--line); border-radius: 12px; min-height: 138px; padding: 12px; text-align: center; color: var(--ink-3); font-size: 12.5px; cursor: pointer; display: grid; place-items: center; align-content: center; gap: 6px; }
.att-drop:hover, .att-drop:focus-visible, .drag-files .att-drop { border-color: var(--brand); color: var(--brand); background: color-mix(in srgb, var(--brand) 6%, transparent); }
.att-tiles.drag-files { outline: 2px dashed var(--brand); outline-offset: 4px; border-radius: 12px; }
.att-popover { width: min(560px, 94vw); padding: 10px 12px 12px; }
.att-pop .att-tiles { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); max-height: 420px; overflow: auto; padding: 2px; }
.att-hint { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 12px; color: var(--ink-3); }
.att-count { color: var(--ink-3); font-weight: 500; }

/* ---------- lightbox ---------- */
.lb-modal { background: rgba(8, 7, 20, .97); }
.lb-modal .modal { background: #0E0C1F; box-shadow: none; transform: none; }
.lb-modal .modal-body { padding: 0; overflow: hidden; display: flex; }
.lb { flex: 1; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; grid-template-columns: minmax(0, 1fr); color: #F2F1FF; min-height: 0; min-width: 0; overflow: hidden; }
.lb-top { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: linear-gradient(rgba(0, 0, 0, .35), transparent); }
.lb-title { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.lb-title b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.lb-ext { padding: 3px 8px; border-radius: 7px; background: var(--ext, var(--brand)); color: #fff; font: 800 11px var(--display); }
.lb-count { color: #A9A7CC; font-size: 13px; white-space: nowrap; }
.lb-tools { display: flex; align-items: center; gap: 4px; flex: 0 0 auto; }
.lb-btn { height: 36px; min-width: 36px; padding: 0 8px; border-radius: 10px; border: 0; background: rgba(255, 255, 255, .08); color: #fff; display: inline-grid; place-items: center; font-weight: 600; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.lb-btn:hover { background: rgba(255, 255, 255, .18); }
.lb-zoom { min-width: 58px; }
.lb-sep { width: 1px; height: 22px; background: rgba(255, 255, 255, .16); margin: 0 4px; }
.lb-main { display: flex; min-height: 0; }
.lb-stage { position: relative; flex: 1; min-width: 0; overflow: hidden; touch-action: none; user-select: none; }
.lb-stage.pannable { cursor: grab; }
.lb-stage.pannable:active { cursor: grabbing; }
.lb-media { position: absolute; inset: 0; display: grid; place-items: center; }
.lb-media.loading::after { content: ''; width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .2); border-top-color: #fff; animation: spin .8s linear infinite; position: absolute; }
@keyframes spin { to { transform: rotate(360deg); } }
.lb-img { position: absolute; top: 50%; left: 50%; max-width: none; transform-origin: center; transition: transform .12s ease-out; image-rendering: auto; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); background: repeating-conic-gradient(#2a2840 0 25%, #222036 0 50%) 0 0 / 18px 18px; }
.lb-stage.pannable .lb-img { transition: none; }
.lb-frame { width: calc(100% - 40px); height: calc(100% - 20px); border: 0; border-radius: 10px; background: #fff; }
.lb-video { max-width: calc(100% - 40px); max-height: calc(100% - 20px); border-radius: 10px; background: #000; }
.lb-audio, .lb-none { display: grid; justify-items: center; gap: 16px; text-align: center; color: #CFCDEA; }
.lb-none p { margin: 0; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .12); color: #fff; display: grid; place-items: center; z-index: 2; }
.lb-nav:hover { background: rgba(255, 255, 255, .24); }
.lb-nav.prev { inset-inline-start: 14px; }
.lb-nav.next { inset-inline-end: 14px; }
.lb-side { width: 320px; flex: 0 0 auto; background: rgba(25, 22, 52, .96); border-inline-start: 1px solid rgba(255, 255, 255, .08); padding: 16px; overflow: auto; color: #F2F1FF; }
.lb.no-side .lb-side { display: none; }
.lb-side .field-label { color: #CFCDEA; }
.lb-side .input { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .14); color: #fff; }
.lb-side .input:focus { border-color: #9A88FF; }
.lb-side small { color: #A9A7CC; }
.lb-rec { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; background: rgba(255, 255, 255, .06); margin-bottom: 14px; font-size: 13px; }
.lb-rec span { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-rec small { color: #A9A7CC; }
.lb-ro { padding: 9px 11px; border-radius: 10px; background: rgba(255, 255, 255, .06); font-weight: 400; color: #fff; white-space: pre-wrap; word-wrap: break-word; }
.lb-meta { display: grid; gap: 6px; font-size: 12.5px; margin-top: 6px; }
.lb-meta div { display: flex; justify-content: space-between; gap: 10px; color: #A9A7CC; }
.lb-meta b { color: #F2F1FF; font-weight: 600; text-align: end; overflow-wrap: anywhere; unicode-bidi: plaintext; }
.lb-strip { display: flex; gap: 8px; padding: 10px 14px 14px; overflow-x: auto; justify-content: center; }
.lb-th { flex: 0 0 auto; width: 58px; height: 58px; border-radius: 10px; border: 2px solid transparent; padding: 0; overflow: hidden; background: rgba(255, 255, 255, .08); opacity: .6; display: grid; place-items: center; }
.lb-th img { width: 100%; height: 100%; object-fit: cover; }
.lb-th .att-ext { min-width: 0; width: 100%; height: 100%; border-radius: 0; font-size: 11px; }
.lb-th.on { border-color: #fff; opacity: 1; }
.lb-th:hover { opacity: 1; }

/* ---------- button field ---------- */
.cell-btn { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 7px; background: var(--btn, var(--brand)); color: #fff; font-size: 12.5px; font-weight: 600; text-decoration: none; white-space: nowrap; max-width: 100%; overflow: hidden; }
.cell-btn.wa { background: var(--btn, #12B76A); }
.cell-btn:hover { filter: brightness(1.08); }
.cell-btn.off { background: var(--hover); color: var(--ink-3); cursor: default; }
.btn-preview { display: grid; gap: 6px; padding: 12px; border-radius: 10px; border: 1px dashed var(--line); background: var(--surface-2); justify-items: start; }
.btn-preview-url { color: var(--ink-3); font-weight: 400; direction: ltr; overflow-wrap: anywhere; }

/* ---------- option colors ---------- */
.cp-pop { padding: 12px; }
.cp { width: 360px; max-width: 100%; display: grid; gap: 12px; }
.cp-preview { display: grid; place-items: center; height: 54px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); }
.cp-preview .pill { height: 26px; font-size: 13.5px; padding: 0 14px; max-width: 260px; }
.cp-grid { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; }
.cp-sw { aspect-ratio: 1; border-radius: 7px; border: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .08); transition: transform .08s; }
.cp-sw:hover, .cp-sw:focus-visible { transform: scale(1.18); z-index: 1; position: relative; }
.cp-sw.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ink); }
.cp-custom { display: flex; gap: 6px; align-items: center; }
.cp-native { position: relative; width: 34px; height: 32px; border-radius: 8px; border: 1px solid var(--line); display: grid; place-items: center; cursor: pointer; overflow: hidden; color: var(--ink-2); background: conic-gradient(from 0deg, #E0383E, #FFB800, #12B76A, #00A3E0, #5A3CF0, #E6237E, #E0383E); }
.cp-native .ic { color: #fff; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .4)); }
.cp-native input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.cp-hex { flex: 1; font-family: ui-monospace, Menlo, Consolas, monospace; direction: ltr; text-transform: uppercase; }
.oe { display: grid; gap: 8px; margin-bottom: 14px; }
.oe-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.oe-tools { display: flex; gap: 2px; }
.oe-list { display: grid; gap: 6px; }
.oe-row { display: flex; align-items: center; gap: 8px; padding: 2px; border-radius: 10px; }
.oe-row.dragging { opacity: .4; }
.oe-row.drop-above { box-shadow: 0 -2px 0 var(--brand); }
.oe-drag { color: var(--ink-4); cursor: grab; display: grid; place-items: center; width: 18px; }
.oe-sw { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px; border: 0; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .1); position: relative; }
.oe-sw::after { content: ''; position: absolute; inset-inline-end: -3px; bottom: -3px; width: 12px; height: 12px; border-radius: 50%; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%237D7B9B' stroke-width='3'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") center/9px no-repeat; box-shadow: 0 0 0 1px var(--line); }
input.oe-name.pill { flex: 1; min-width: 0; height: 32px; max-width: none; border: 0; outline: none; padding: 0 14px; font-size: 13.5px; text-overflow: ellipsis; }
input.oe-name.pill:focus { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px color-mix(in srgb, var(--brand) 60%, transparent); }
input.oe-name.pill::placeholder { color: inherit; opacity: .55; }
.oe-add { justify-self: start; }
.oe-hint { font-size: 12px; color: var(--ink-3); }

/* ---------- roles ---------- */
.role-chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--hover); color: var(--ink-2); }
.role-owner { --rc: #B07800; }
.role-creator { --rc: #5A3CF0; }
.role-editor { --rc: #0A7FB5; }
.role-commenter { --rc: #0B8A55; }
.role-read { --rc: #6B7280; }
.role-chip[class*="role-"] { background: color-mix(in srgb, var(--rc) 13%, var(--surface)); color: var(--rc); }
[data-theme="dark"] .role-chip[class*="role-"] { color: color-mix(in srgb, var(--rc) 50%, #fff); }
.role-btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 13px; white-space: nowrap; color: var(--rc, var(--ink)); }
.role-btn:hover { border-color: var(--ink-4); }
.role-btn.compact { height: 28px; font-size: 12.5px; padding: 0 8px; border-radius: 8px; }
.role-btn:disabled { cursor: default; opacity: .8; }
.role-pop { padding: 6px; }
.role-menu { display: grid; gap: 2px; width: 320px; }
.role-opt { display: flex; align-items: flex-start; gap: 10px; padding: 9px 10px; border-radius: 10px; border: 0; background: none; text-align: start; width: 100%; color: var(--ink); }
.role-opt:hover:not(:disabled) { background: var(--hover); }
.role-opt.on { background: var(--select); }
.role-opt:disabled { opacity: .4; cursor: not-allowed; }
.role-opt b { display: block; font-size: 13.5px; }
.role-opt small { display: block; color: var(--ink-3); font-size: 12px; line-height: 1.35; }
.role-opt .menu-check { margin-inline-start: auto; color: var(--brand); }
.ri { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; background: color-mix(in srgb, var(--rc) 14%, var(--surface)); color: var(--rc); }
.caps { margin-top: 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.caps summary { display: flex; align-items: center; gap: 8px; padding: 12px 14px; cursor: pointer; font-weight: 600; font-size: 13.5px; }
.caps-scroll { overflow-x: auto; padding: 0 10px 12px; }
.caps table { border-collapse: collapse; width: 100%; font-size: 12.5px; min-width: 560px; }
.caps th, .caps td { padding: 7px 6px; border-top: 1px solid var(--line-2); text-align: center; }
.caps td:first-child { text-align: start; color: var(--ink-2); }
.cap-yes { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: color-mix(in srgb, var(--green) 16%, var(--surface)); color: var(--green); }
.cap-no { color: var(--ink-4); }

/* ---------- people ---------- */
.modal-head h2 { display: flex; align-items: center; gap: 10px; }
.invite-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: linear-gradient(135deg, color-mix(in srgb, var(--brand) 6%, var(--surface)), var(--surface)); margin-bottom: 8px; }
.invite-card h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font: 700 15px var(--display); }
.inv-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inv-row .input { flex: 1 1 220px; min-width: 0; }
.acc-host { margin: 10px 0 6px; }
.acc-ed { display: grid; gap: 8px; }
.acc-bases { display: grid; gap: 4px; }
.acc-base { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--surface); }
.acc-base.on { border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.acc-base label { display: flex; align-items: center; gap: 8px; flex: 1; cursor: pointer; font-size: 13.5px; min-width: 0; }
.acc-base label span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-base input { accent-color: var(--brand); }
.acc-hint { color: var(--ink-3); font-size: 12px; }
.base-dot { width: 22px; height: 22px; flex: 0 0 auto; border-radius: 6px; display: inline-grid; place-items: center; font: 800 11px var(--display); }
.mlist, .ilist { display: grid; }
.mrow { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-bottom: 1px solid var(--line-2); }
.mrow .info { flex: 1; min-width: 0; }
.mrow .info b { display: block; font-weight: 600; }
.mrow .info > span { color: var(--ink-3); font-size: 12.5px; overflow-wrap: anywhere; }
.mrow .ctl { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.mrow .sum { margin-top: 4px; }
.mrow.pending .info b { color: var(--ink-2); }
.inv-av { width: 36px; height: 36px; background: var(--hover); color: var(--ink-2); }
.you { font-size: 11px; font-weight: 600; color: var(--ink-3); background: var(--hover); padding: 1px 6px; border-radius: 6px; }
.acc-sum { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--ink-2); }
.acc-sum.warn { color: var(--red); }
.acc-bases-sum { display: flex; flex-wrap: wrap; gap: 4px; }
.base-chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px 0 3px; border-radius: 8px; background: var(--hover); font-size: 12px; }
.base-chip em { font-style: normal; color: var(--ink-3); }
.base-chip .base-dot { width: 20px; height: 20px; font-size: 10px; }
.acc-panel { padding: 12px; margin: 4px 0 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); display: grid; gap: 10px; }
.acc-role { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 600; }
.acc-foot { display: flex; justify-content: flex-end; gap: 8px; }
.base-card .bc-role { position: absolute; bottom: 12px; inset-inline-end: 12px; }

/* ---------- automations ---------- */
.auto-modal .modal-body { padding: 0; overflow: hidden; display: flex; }
.au { flex: 1; display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 0; }
.au-side { display: flex; flex-direction: column; min-height: 0; border-inline-end: 1px solid var(--line); background: var(--surface-2); }
.au-side-head { display: flex; align-items: center; gap: 8px; padding: 16px 14px 4px 18px; }
.au-side-head h2 { flex: 1; margin: 0; display: flex; align-items: center; gap: 8px; font: 800 19px var(--display); }
.au-side-head h2 .ic { color: var(--yellow); }
.au-base { padding: 0 18px 12px; color: var(--ink-3); font-size: 12.5px; }
.au-new { margin: 0 14px 10px; }
.au-list { flex: 1; overflow: auto; padding: 0 8px 10px; display: grid; align-content: start; gap: 4px; }
.au-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; border: 1px solid transparent; background: none; text-align: start; width: 100%; }
.au-item:hover { background: var(--hover); }
.au-item.on { background: var(--surface); border-color: var(--line); box-shadow: var(--shadow-sm); }
.au-ic { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 9px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 15%, var(--surface)); color: var(--c); }
.au-ic.big { width: 40px; height: 40px; border-radius: 12px; }
.au-txt { flex: 1; min-width: 0; display: grid; }
.au-txt b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-txt small { color: var(--ink-3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-on { font-size: 10.5px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: var(--hover); color: var(--ink-3); text-transform: uppercase; }
.au-on.yes { background: color-mix(in srgb, var(--green) 16%, var(--surface)); color: var(--green); }
.au-st { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: 0 0 auto; }
.au-st.ok { background: var(--green); }
.au-st.bad { background: var(--red); }
.au-free { display: flex; gap: 8px; padding: 12px 16px 16px; font-size: 11.5px; color: var(--ink-3); border-top: 1px solid var(--line); }
.au-main { position: relative; display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.au-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px 8px; background: var(--surface); }
.au-name { flex: 1; min-width: 0; border: 1px solid transparent; background: none; border-radius: 10px; padding: 6px 8px; font: 800 20px var(--display); color: var(--ink); outline: none; }
.au-name:hover { border-color: var(--line); }
.au-name:focus { border-color: var(--brand); background: var(--surface); }
.au-head-r { display: flex; align-items: center; gap: 8px; }
.au-toggle .switch-row { padding: 0 6px; font-weight: 600; }
.au-tabs { padding: 0 18px 10px; background: var(--surface); border-bottom: 1px solid var(--line); }
.au-scroll { flex: 1; overflow: auto; padding: 24px 18px 110px; }
.au-canvas { max-width: 720px; margin: 0 auto; display: grid; justify-items: stretch; }
.au-line { display: grid; place-items: center; height: 34px; color: var(--ink-4); position: relative; }
.au-line::before { content: ''; position: absolute; top: 0; bottom: 14px; width: 2px; background: var(--line); }
.au-line .ic { position: relative; background: var(--bg); }
.au-card { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); overflow: hidden; transition: border-color .12s, box-shadow .12s; }
.au-card.trig { border-top: 4px solid #F5A623; }
.au-card.open { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 12%, transparent), var(--shadow-sm); }
.au-card-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; cursor: pointer; outline: none; }
.au-card-head:hover { background: var(--surface-2); }
.au-card-t { flex: 1; min-width: 0; display: grid; gap: 1px; }
.au-card-t small { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; color: var(--ink-3); }
.au-card-t b { font-size: 15px; }
.au-sum { font-size: 12.5px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.au-if { display: inline-flex; align-items: center; gap: 3px; font-size: 11.5px; font-weight: 700; padding: 2px 7px; border-radius: 99px; background: color-mix(in srgb, var(--green) 14%, var(--surface)); color: var(--green); }
.au-chev { color: var(--ink-3); }
.au-card-body { display: none; border-top: 1px solid var(--line-2); padding: 16px; }
.au-card.open .au-card-body { display: block; }
.au-form .field-label:last-child { margin-bottom: 0; }
.au-add { justify-self: center; display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 99px; border: 1.5px dashed var(--ink-4); background: var(--surface); color: var(--ink-2); font-weight: 700; }
.au-add:hover { border-color: var(--brand); color: var(--brand); }
.au-actmenu { width: 340px; }
.menu-item.tall { height: auto; padding: 8px 10px; align-items: flex-start; }
.menu-item.tall b { display: block; font-size: 13.5px; }
.menu-item.tall small { display: block; color: var(--ink-3); font-size: 12px; line-height: 1.35; }
.au-savebar { position: absolute; inset-inline: 0; bottom: 0; display: none; align-items: center; gap: 8px; padding: 12px 18px; background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgba(28, 23, 69, .08); z-index: 3; }
.au-savebar.show { display: flex; }
.au-savebar span { flex: 1; display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; }
.au-create { max-width: 900px; margin: 0 auto; padding: 30px 22px 60px; overflow: auto; width: 100%; }
.au-main > .au-create { flex: 1; }
.au-create h2 { margin: 0 0 6px; font: 800 26px var(--display); }
.au-create h4 { margin: 24px 0 10px; font-size: 13px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.au-tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.au-tpl { display: grid; gap: 8px; justify-items: start; padding: 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); text-align: start; transition: border-color .12s, transform .12s, box-shadow .12s; }
.au-tpl:hover { border-color: var(--brand); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.au-tpl b { font-size: 14.5px; }
.au-tpl small { color: var(--ink-3); font-size: 12.5px; line-height: 1.4; }
.au-trigs { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; }
.au-trig { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-align: start; }
.au-trig:hover { border-color: var(--brand); }
.au-trig b { display: block; font-size: 13.5px; }
.au-trig small { display: block; color: var(--ink-3); font-size: 12px; line-height: 1.35; }
.chips-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-pick { display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; color: var(--ink-2); }
.chip-pick.on { border-color: var(--brand); background: var(--select); color: var(--ink); font-weight: 600; }
.au-note, .au-warn { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 11px; margin: 0 0 12px; line-height: 1.45; }
.au-note .ic, .au-warn .ic { margin-top: 2px; }
.au-warn { background: color-mix(in srgb, var(--yellow) 14%, var(--surface)); border-color: color-mix(in srgb, var(--yellow) 40%, var(--line)); }
.hook-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tok-wrap { position: relative; display: block; }
.tok-wrap .input { padding-inline-end: 54px; }
.tok-wrap textarea.input { padding-inline-end: 54px; }
.tok-btn { position: absolute; top: 6px; inset-inline-end: 6px; height: 26px; padding: 0 7px; border-radius: 7px; border: 1px solid var(--line); background: var(--surface-2); color: var(--brand); font: 700 11.5px ui-monospace, Menlo, monospace; display: inline-flex; align-items: center; gap: 2px; }
.tok-btn:hover { border-color: var(--brand); background: var(--select); }
.tok-pop { padding: 8px; }
.tok-menu { width: 320px; }
.tok-list { max-height: 360px; overflow: auto; display: flex; flex-direction: column; }
.tok-item { height: 32px; }
.tok-item small { margin-inline-start: auto; color: var(--ink-3); font-size: 11.5px; max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vals { margin-bottom: 14px; }
.vals-list { display: grid; gap: 6px; margin-bottom: 8px; }
.val-row { display: grid; grid-template-columns: minmax(110px, 180px) 1fr 32px; gap: 8px; align-items: center; }
.val-f { display: flex; align-items: center; gap: 6px; font-size: 13px; min-width: 0; color: var(--ink-2); }
.val-f b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); font-weight: 600; }
.val-row .tok-btn { top: 3px; }
.vals-add { max-width: 280px; }
.au-cond { margin-top: 6px; border: 1px solid var(--line-2); border-radius: 12px; padding: 0 10px; background: var(--surface-2); }
.au-cond summary { display: flex; align-items: center; gap: 6px; padding: 10px 2px; cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.au-cond[open] { padding-bottom: 10px; }
.cond .rule { grid-template-columns: 54px minmax(110px, 1.2fr) minmax(100px, 1fr) minmax(110px, 1.2fr) 30px; }
.cond-rules { margin-bottom: 4px; }
.test-res { border-radius: 14px; padding: 12px 14px; margin-bottom: 18px; border: 1px solid; }
.test-res.success { background: color-mix(in srgb, var(--green) 8%, var(--surface)); border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.test-res.failed { background: color-mix(in srgb, var(--red) 7%, var(--surface)); border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.test-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.test-head b { flex: 1; }
.test-head span { color: var(--ink-3); font-size: 12px; }
.success .test-head > .ic { color: var(--green); }
.failed .test-head > .ic { color: var(--red); }
.steps { display: grid; gap: 8px; }
.step { display: flex; gap: 10px; align-items: flex-start; }
.step-ic { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex: 0 0 auto; background: var(--ink-4); margin-top: 1px; }
.step.success .step-ic { background: var(--green); }
.step.failed .step-ic { background: var(--red); }
.step-b { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: 13px; }
.step-st { color: var(--ink-3); font-size: 12px; }
.step-err { color: var(--red); font-size: 12.5px; background: color-mix(in srgb, var(--red) 7%, var(--surface)); padding: 6px 9px; border-radius: 8px; overflow-wrap: anywhere; margin-top: 2px; }
.step details summary, .run details summary { cursor: pointer; font-size: 12px; color: var(--brand); }
.runs-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.runs-head span { flex: 1; color: var(--ink-3); font-size: 12.5px; }
.run { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; padding: 0 12px; }
.run > summary { display: flex; align-items: center; gap: 10px; padding: 10px 0; cursor: pointer; list-style: none; font-size: 13.5px; }
.run > summary::-webkit-details-marker { display: none; }
.run[open] { padding-bottom: 12px; }
.run-st { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; color: #fff; background: var(--green); flex: 0 0 auto; }
.run.failed .run-st { background: var(--red); }
.run-when { color: var(--ink-3); font-size: 12.5px; margin-inline-start: auto; }
.run-ms { color: var(--ink-4); font-size: 12px; min-width: 56px; text-align: end; }

/* ---------- API ---------- */
.api-modal .modal-body { padding-top: 6px; }
.api-tabs { margin-bottom: 14px; }
.newkey { margin-top: 12px; }
.keybox { padding: 12px; border-radius: 12px; background: color-mix(in srgb, var(--yellow) 16%, var(--surface)); border: 1px solid color-mix(in srgb, var(--yellow) 45%, var(--line)); display: grid; gap: 8px; }
.keybox b { display: flex; align-items: center; gap: 6px; }
.danger-text { color: var(--red); }
.api-top { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; margin-bottom: 14px; }
.kv { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); min-width: 0; font-size: 12.5px; }
.kv > span { color: var(--ink-3); white-space: nowrap; }
.kv code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; direction: ltr; text-align: left; }
.kv .input { flex: 1; }
.kv .icon-btn { width: 26px; height: 26px; }
.api-fields { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 16px; }
.api-fields table { border-collapse: collapse; width: 100%; font-size: 13px; }
.api-fields th, .api-fields td { padding: 8px 10px; border-bottom: 1px solid var(--line-2); text-align: start; vertical-align: top; }
.api-fields th { background: var(--surface-2); font-size: 12px; color: var(--ink-3); }
.api-fields .ft { display: inline-flex; align-items: center; gap: 5px; color: var(--ink-2); white-space: nowrap; }
.api-fields small { display: block; color: var(--ink-3); }
code.ex { display: inline-block; margin-top: 3px; font-size: 11.5px; padding: 1px 6px; border-radius: 5px; background: var(--hover); direction: ltr; }
.api-block { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; background: var(--surface); }
.api-bh { display: flex; align-items: center; gap: 8px; }
.api-bh b { flex: 1; }
.api-block p { margin: 6px 0; color: var(--ink-2); font-size: 13px; }
.meth { font: 800 11px ui-monospace, Menlo, monospace; padding: 3px 7px; border-radius: 6px; color: #fff; background: var(--ink-3); }
.m-get { background: #0F9D9A; } .m-post { background: #12B76A; } .m-patch { background: #F26B1D; } .m-delete { background: #E0383E; } .m-js { background: #A87700; }
.store-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-bottom: 8px; }
.store-card { border: 1px solid var(--line); border-radius: 16px; padding: 16px; background: var(--surface); display: grid; gap: 6px; align-content: start; justify-items: start; }
.store-card h3 { margin: 6px 0 0; font: 700 16px var(--display); }
.store-card p { margin: 0; color: var(--ink-2); font-size: 13px; }
.store-card ol { margin: 4px 0 8px; padding-inline-start: 20px; font-size: 13px; color: var(--ink-2); display: grid; gap: 4px; }
.store-list { display: grid; gap: 6px; }
.store-list div { display: grid; grid-template-columns: 190px 1fr; gap: 10px; padding: 9px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 13px; }
.store-list span { color: var(--ink-2); }

@media (max-width: 900px) {
  .au { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .au-side { border-inline-end: 0; border-bottom: 1px solid var(--line); max-height: 38vh; }
  .au-free { display: none; }
  .lb-side { position: absolute; inset-block: 0; inset-inline-end: 0; width: min(320px, 88vw); z-index: 3; }
  .lb-tools .lb-zoom, .lb-tools [data-a=zoomin], .lb-tools [data-a=zoomout] { display: none; }
}
@media (max-width: 760px) {
  .topbar .icon-btn[data-act=lang], .topbar .icon-btn[data-act=theme], .topbar .tb-search { display: none; }
  .lb-top { padding: 8px 10px; gap: 6px; }
  .lb-count, .lb-sep, .lb-tools [data-a=delete] { display: none; }
  .lb-btn { min-width: 34px; height: 34px; padding: 0 6px; }
  .lb-strip { justify-content: flex-start; }
  .tb-pill .lbl { display: none; }
  .tb-pill { padding: 0 9px; }
  .au-head { flex-wrap: wrap; }
  .au-head-r { width: 100%; justify-content: flex-end; }
  .val-row { grid-template-columns: 1fr 32px; }
  .val-f { grid-column: 1 / -1; }
  .cond .rule { grid-template-columns: 1fr 1fr; }
  .store-list div { grid-template-columns: 1fr; }
  .lb-nav { width: 38px; height: 38px; }
  .att-tiles { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
}
@media (max-width: 760px) {
  .modal.modal-full { max-height: 100vh !important; height: 100vh; border-radius: 0 !important; }
}
.gcard .gcover { position: relative; }
.gcard .gcover.has { cursor: zoom-in; }
.gzoom { position: absolute; top: 10px; inset-inline-end: 10px; width: 30px; height: 30px; border-radius: 9px; background: rgba(16, 14, 36, .6); color: #fff; display: grid; place-items: center; opacity: 0; transition: opacity .12s; }
.gcard:hover .gzoom { opacity: 1; }
.gcount { position: absolute; bottom: 10px; inset-inline-start: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 99px; background: rgba(16, 14, 36, .66); color: #fff; font-size: 11.5px; font-weight: 600; }

/* ================================================================
   v5
   ================================================================ */
/* one-click cells: a small arrow shows the cell opens a picker */
.g-c.pick { padding-inline-end: 24px; }
.g-dd { position: absolute; inset-inline-end: 3px; top: 50%; transform: translateY(-50%); width: 22px; height: 22px; border: 0; border-radius: 6px; padding: 0; background: none; color: var(--ink-3); display: grid; place-items: center; opacity: 0; transition: opacity .1s, background .1s; z-index: 1; }
.g-row:hover .g-c.pick .g-dd, .g-c.pick.active .g-dd { opacity: .9; }
.g-dd:hover { background: var(--hover); color: var(--ink); opacity: 1; }
@media (pointer: coarse) { .g-c.pick.active .g-dd { opacity: 1; width: 30px; height: 30px; } }
.g-c { cursor: default; }
.g-row .g-c:not(.idx):not(.computed) { cursor: pointer; }

/* ---------- templates gallery (new base) ---------- */
.tpl-modal .modal { overflow: hidden; }
.tpl-modal .modal-body { padding: 0; overflow: hidden; display: flex; }
.tpl { flex: 1; display: grid; grid-template-columns: 270px minmax(0, 1fr); min-height: 0; }
.tpl-side { display: flex; flex-direction: column; gap: 6px; padding: 18px 14px; border-inline-end: 1px solid var(--line); background: var(--surface-2); overflow: auto; }
.tpl-side-head { display: flex; align-items: center; gap: 8px; padding: 0 4px 8px; }
.tpl-side-head h2 { flex: 1; margin: 0; font: 700 19px/1.2 var(--display); letter-spacing: -.01em; }
.tpl-start { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-align: start; transition: border-color .12s, box-shadow .12s; }
.tpl-start:hover { border-color: var(--brand); box-shadow: var(--shadow-sm); }
.tpl-start b { display: block; font-size: 13.5px; }
.tpl-start small { display: block; color: var(--ink-3); font-size: 12px; line-height: 1.35; margin-top: 2px; }
.tpl-start-ic { flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--select); color: var(--brand); }
.tpl-start-ic.imp { background: color-mix(in srgb, var(--green) 16%, var(--surface)); color: var(--green); }
.tpl-start-ic.big { width: 56px; height: 56px; border-radius: 16px; }
.tpl-cats-title { margin: 14px 6px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-3); }
.tpl-cats { display: grid; gap: 2px; }
.tpl-cat { display: flex; align-items: center; gap: 10px; height: 38px; padding: 0 10px; border: 0; border-radius: 10px; background: none; color: var(--ink-2); font-size: 13.5px; text-align: start; }
.tpl-cat span { flex: 1; }
.tpl-cat em { font-style: normal; font-size: 12px; color: var(--ink-3); }
.tpl-cat:hover { background: var(--hover); color: var(--ink); }
.tpl-cat.on { background: var(--select); color: var(--ink); font-weight: 600; }
.tpl-main { overflow: auto; padding: 22px 24px 28px; min-width: 0; }
.tpl-head { display: flex; align-items: flex-start; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.tpl-head > div { flex: 1; min-width: 220px; }
.tpl-head h3 { margin: 0 0 4px; font: 700 20px/1.2 var(--display); }
.tpl-head p { margin: 0; font-size: 13px; }
.tpl-search .input { width: 220px; height: 36px; }
.tpl-search .ic { top: 10px; }
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; }
.tpl-card { position: relative; display: grid; grid-template-rows: auto 1fr auto; gap: 10px; padding: 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); text-align: start; overflow: hidden; transition: border-color .12s, transform .12s, box-shadow .12s; }
.tpl-card::before { content: ''; position: absolute; inset: 0 0 auto; height: 4px; background: var(--tc); opacity: .9; }
.tpl-card:hover { border-color: color-mix(in srgb, var(--tc) 55%, var(--line)); transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.tpl-ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: color-mix(in srgb, var(--tc) 14%, var(--surface)); color: var(--tc); }
[data-theme="dark"] .tpl-ic { background: color-mix(in srgb, var(--tc) 26%, var(--surface)); color: color-mix(in srgb, var(--tc) 55%, #fff); }
.tpl-ic.big { width: 64px; height: 64px; border-radius: 18px; background: var(--tc); color: var(--tc-ink); }
.tpl-txt b { display: block; font: 700 15px/1.3 var(--display); }
.tpl-txt small { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; margin-top: 4px; color: var(--ink-2); font-size: 12.5px; line-height: 1.45; }
.tpl-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink-3); font-size: 12px; }
.tpl-meta > span { display: inline-flex; align-items: center; gap: 5px; }
.tpl-views { gap: 6px !important; }
.tpl-detail { display: grid; gap: 16px; max-width: 980px; }
.tpl-detail .tpl-back { justify-self: start; }
.tpl-hero { display: flex; gap: 16px; align-items: center; padding: 18px; border-radius: 18px; background: linear-gradient(135deg, color-mix(in srgb, var(--tc, var(--brand)) 13%, var(--surface)), var(--surface) 70%); border: 1px solid color-mix(in srgb, var(--tc, var(--brand)) 22%, var(--line)); }
.tpl-hero h3 { margin: 0 0 4px; font: 800 22px/1.2 var(--display); letter-spacing: -.01em; }
.tpl-hero p { margin: 0 0 10px; color: var(--ink-2); font-size: 13.5px; max-width: 620px; }
.tpl-facts { display: flex; gap: 8px; flex-wrap: wrap; }
.tpl-facts span { padding: 3px 10px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); font-size: 12px; color: var(--ink-2); }
.tpl-body { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.tpl-tables { display: grid; gap: 12px; }
.tpl-table { border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; background: var(--surface); }
.tpl-table-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.tpl-table-head b { flex: 1; font-size: 14px; }
.tpl-table-head .muted-text { font-size: 12px; }
.tpl-fields { display: flex; flex-wrap: wrap; gap: 6px; }
.tpl-fields .chip { height: 26px; gap: 6px; color: var(--ink-2); }
.tpl-vlist { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); color: var(--ink-3); font-size: 12.5px; }
.tpl-vlist span { display: inline-flex; align-items: center; gap: 5px; }
.tpl-use { position: sticky; top: 0; display: grid; gap: 10px; padding: 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2); }
.tpl-use .field-label { margin-bottom: 4px; }
.tpl-use .segmented { justify-self: start; }
.tpl-go { height: 42px; margin-top: 6px; }
.tpl-go.busy { pointer-events: none; }
.tpl-blank { display: grid; justify-items: start; gap: 8px; max-width: 420px; padding: 24px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); }
.tpl-blank h3 { margin: 6px 0 0; font: 700 20px var(--display); }
.tpl-blank p { margin: 0 0 6px; }
.tpl-blank .field-label { width: 100%; }
.tpl-strip .tpl-card { padding: 14px; }
.spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-inline-end-color: transparent; animation: tbxspin .7s linear infinite; }
@keyframes tbxspin { to { transform: rotate(360deg); } }
@media (max-width: 900px) {
  .tpl { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); }
  .tpl-side { border-inline-end: 0; border-bottom: 1px solid var(--line); padding: 12px; gap: 8px; }
  .tpl-side-head { padding-bottom: 0; }
  .tpl-start { display: none; }
  .tpl-cats-title { display: none; }
  .tpl-cats { display: flex; overflow-x: auto; gap: 6px; scrollbar-width: none; }
  .tpl-cat { flex: 0 0 auto; height: 34px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface); }
  .tpl-cat em { display: none; }
  .tpl-body { grid-template-columns: 1fr; }
  .tpl-use { position: static; order: -1; }
  .tpl-main { padding: 16px; }
}
@media (max-width: 900px) {
  .tpl-side .tpl-start { display: flex; padding: 8px; }
  .tpl-side .tpl-start small { display: none; }
  .tpl-side { display: grid; grid-template-columns: 1fr 1fr; }
  .tpl-side-head, .tpl-cats { grid-column: 1 / -1; }
  .tpl-start-ic { width: 32px; height: 32px; }
}
@media (max-width: 760px) {
  .tpl-search { width: 100%; }
  .tpl-search .input { width: 100%; }
  .tpl-hero { flex-direction: column; align-items: flex-start; }
  .tpl-grid { grid-template-columns: 1fr; }
}

/* ---------- import / export ---------- */
.imp-modal .modal-head h2 { font-size: 18px; }
.imp-modal .modal-body { display: flex; flex-direction: column; }
.imp-pick { display: grid; gap: 14px; max-width: 640px; margin: 10px auto 0; width: 100%; }
.imp-drop { display: grid; justify-items: center; gap: 8px; padding: 42px 20px; border: 2px dashed var(--line); border-radius: 20px; background: var(--surface-2); text-align: center; cursor: pointer; transition: border-color .12s, background .12s; }
.imp-drop:hover, .imp-drop.over, .imp-drop:focus-visible { border-color: var(--brand); background: var(--select); outline: none; }
.imp-drop b { font: 700 17px var(--display); }
.imp-drop small { color: var(--ink-3); }
.imp-drop .btn { margin-top: 8px; pointer-events: none; }
.imp-drop.busy { opacity: .6; pointer-events: none; }
.imp-drop-ic { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; background: color-mix(in srgb, var(--green) 15%, var(--surface)); color: var(--green); }
.imp-paste summary { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.imp-paste textarea { height: auto; padding: 10px 12px; margin: 10px 0 8px; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.imp-err { padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--red) 12%, var(--surface)); color: var(--red); font-size: 13px; }
.imp-map { display: grid; gap: 14px; }
.imp-top { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.imp-top .field-label, .imp-names .field-label { margin: 0; }
.imp-top .field-label { min-width: 180px; }
.imp-file { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 240px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); }
.imp-file > div { flex: 1; min-width: 0; }
.imp-file b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-file small { color: var(--ink-3); }
.imp-names { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.imp-in { display: flex; align-items: center; gap: 6px; padding-bottom: 10px; }
.imp-mode { display: grid; gap: 8px; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); }
.imp-mode .segmented { justify-self: start; flex-wrap: wrap; }
.imp-key { margin: 0; max-width: 320px; }
.imp-cols { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.imp-colhead, .imp-col { display: grid; grid-template-columns: 34px minmax(0, 1fr) 24px minmax(0, 1.25fr); gap: 10px; align-items: center; padding: 8px 12px; }
.imp-colhead { background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 12px; font-weight: 700; color: var(--ink-3); }
.imp-col + .imp-col { border-top: 1px solid var(--line-2); }
.imp-col.off .imp-src, .imp-col.off .imp-dst { opacity: .45; }
.imp-col .cb-wrap { display: grid; place-items: center; }
.imp-col .cb-wrap input { width: 17px; height: 17px; accent-color: var(--brand); }
.imp-src { min-width: 0; }
.imp-src b { display: block; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-src small { display: block; color: var(--ink-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.imp-arrow { color: var(--ink-4); display: grid; place-items: center; }
.imp-dst { display: flex; gap: 8px; align-items: center; min-width: 0; flex-wrap: wrap; }
.imp-dst .input { height: 34px; flex: 1 1 140px; min-width: 0; }
.imp-dst select.input { flex: 0 1 170px; }
.imp-primary { display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 99px; background: var(--select); color: var(--brand); font-size: 11.5px; font-weight: 700; }
.imp-warn { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--yellow) 18%, var(--surface)); font-size: 13px; }
.imp-sum { margin-inline-end: auto; color: var(--ink-3); font-size: 13px; align-self: center; }
.imp-run { display: grid; justify-items: center; gap: 10px; text-align: center; margin: auto; padding: 40px 20px; width: min(460px, 100%); }
.imp-run h3 { margin: 4px 0 0; font: 700 20px var(--display); }
.imp-run-ic { width: 64px; height: 64px; border-radius: 20px; display: grid; place-items: center; background: var(--select); color: var(--brand); }
.imp-run-ic.ok { background: color-mix(in srgb, var(--green) 16%, var(--surface)); color: var(--green); }
.imp-run-ic.bad { background: color-mix(in srgb, var(--red) 14%, var(--surface)); color: var(--red); }
.imp-bar { width: 100%; height: 10px; border-radius: 99px; background: var(--hover); overflow: hidden; }
.imp-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), var(--cyan)); transition: width .25s ease; }
.imp-stats { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.imp-stats span { display: grid; gap: 2px; min-width: 110px; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); font-size: 12.5px; }
.imp-stats b { font: 800 22px var(--display); color: var(--ink); }
.imp-done-acts { display: flex; gap: 8px; margin-top: 8px; }
.empty-acts { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
@media (max-width: 760px) {
  .imp-names { grid-template-columns: 1fr; }
  .imp-colhead { display: none; }
  .imp-col { grid-template-columns: 28px minmax(0, 1fr); row-gap: 6px; }
  .imp-arrow { display: none; }
  .imp-dst { grid-column: 2; }
  .imp-sum { display: none; }
}

/* ---------- live: who's here, rows changed by others ---------- */
.tb-presence { display: flex; align-items: center; padding-inline-end: 6px; margin-inline-end: 2px; }
.tb-presence .pp { display: inline-grid; place-items: center; margin-inline-start: -7px; border-radius: 50%; box-shadow: 0 0 0 2px var(--base); position: relative; }
.tb-presence .pp:first-child { margin-inline-start: 0; }
.tb-presence .pp.here::after { content: ''; position: absolute; bottom: -1px; inset-inline-end: -1px; width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 2px var(--base); }
.tb-presence .pp.more { width: 26px; height: 26px; background: rgba(255, 255, 255, .22); font-size: 11px; font-weight: 700; }
.g-row.flash .g-c:not(.idx) { animation: tbxflash 1.5s ease-out; }
@keyframes tbxflash { 0% { background: color-mix(in srgb, var(--yellow) 30%, var(--surface)); } 100% { background: transparent; } }
@media (max-width: 760px) { .tb-presence .pp:nth-child(n+3):not(.more) { display: none; } }
.imp-dst select.input[data-k=field] { flex: 1 1 230px; max-width: 340px; }
.imp-modal .modal-lg { width: min(760px, 100%); }
.imp-modal .modal-lg .modal-body { min-height: 360px; }

/* ================================================================
   v6 — trash, duplicate, dashboards, job cards & QR, scan screen,
   customer tracking, install, phone polish
   ================================================================ */
a.btn { text-decoration: none; }
.btn.wa { background: #25D366; color: #fff; }
.btn.wa:hover { background: #1EBE5A; }
button, a, .g-c, .rf-picker { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
html { -webkit-text-size-adjust: 100%; }

/* ---------- popovers: room-aware on desktop, bottom sheets on phones ---------- */
.sheet-dim { position: fixed; inset: 0; z-index: 999; background: rgba(16, 14, 36, .38); opacity: 0; transition: opacity .18s; }
.sheet-dim.in { opacity: 1; }
.sheet-dim.out { opacity: 0; }
.popover.sheet {
  left: 0 !important; right: 0; top: auto !important; bottom: 0; width: 100% !important; min-width: 0;
  border-radius: 20px 20px 0 0; border-bottom: 0; padding: 20px 12px calc(14px + env(safe-area-inset-bottom));
  transform: translateY(28px); box-shadow: 0 -10px 40px rgba(16, 14, 36, .25);
}
.popover.sheet.in { transform: none; }
.popover.sheet::before { content: ''; position: absolute; top: 8px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 99px; background: var(--line); }
.popover.sheet > * { width: auto !important; max-width: 100%; }
.popover.sheet .opt-list { max-height: 50vh; }
.popover.sheet .opt, .popover.sheet .menu-item { min-height: 46px; font-size: 15px; }
.popover.sheet .input.sm { height: 42px; font-size: 16px; }
.popover.sheet .menu { min-width: 0; }

/* ---------- phones: no zoom on focus, bigger targets, real screen height ---------- */
@media (max-width: 640px) {
  .input, select.input, textarea.input, .vb-search .input, .g-editor input, .g-editor textarea { font-size: 16px; }
  .rf .input { height: 44px; }
  .rf-picker { min-height: 44px; }
  .modal-head { padding: 14px 16px 4px; }
  .modal-body { padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); }
  .modal-foot { padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); }
  .rec-modal .modal-body { padding: 0 !important; }
}
@supports (height: 100dvh) {
  @media (max-width: 760px) {
    .modal { max-height: 94dvh; }
    .modal-xl { height: 94dvh; }
    .modal.modal-full { height: 100dvh; max-height: 100dvh !important; }
  }
}

/* ---------- record window: room under the last field, comments on small screens ---------- */
.rec-body { padding-bottom: 140px; }
.rec-side-btn, .rec-side-head { display: none; }
@media (max-width: 1000px) {
  .rec-side-btn { display: inline-grid; }
  .rec.side-open .rec-main { display: none; }
  .rec.side-open .rec-side { display: flex; border-radius: 0; height: 100%; }
  .rec-side-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 0; }
  .rec-side-head b { font: 700 16px var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .rec-side .segmented { margin: 10px 12px 6px; }
}
@media (max-width: 760px) {
  .rec-head { padding: 12px 10px 8px; gap: 2px; }
  .rec-head h2 { font-size: 18px; }
  .rec-head .rec-num { display: none; }
  .rec-body { padding: 14px 14px 45vh; }
  .rf { margin-bottom: 16px; }
}

/* ---------- image viewer: the details panel always has a way back ---------- */
.lb-main { position: relative; }
.lb-side-head { display: none; }
@media (max-width: 900px) {
  .lb-side { width: min(360px, 92vw); box-shadow: -12px 0 32px rgba(0, 0, 0, .45); }
  [dir="rtl"] .lb-side { box-shadow: 12px 0 32px rgba(0, 0, 0, .45); }
  .lb-side-head { display: flex; justify-content: space-between; gap: 8px; margin: -4px 0 14px; }
  .lb-side-head .lb-btn { display: inline-flex; align-items: center; gap: 6px; padding: 0 12px; height: 40px; }
  .lb-btn { min-width: 40px; height: 40px; }
}

/* ---------- table loading & history ---------- */
.g-loading { display: inline-flex; align-items: center; gap: 6px; margin-inline-start: 8px; color: var(--ink-3); font-size: 12px; font-weight: 500; }
.g-loading .spin { width: 11px; height: 11px; border-width: 1.6px; }
.vb-count.loading::after { content: ''; display: inline-block; width: 10px; height: 10px; margin-inline-start: 6px; border-radius: 50%; border: 1.6px solid currentColor; border-inline-end-color: transparent; animation: tbxspin .7s linear infinite; vertical-align: -1px; }
.chg-undo { display: inline-flex; align-items: center; gap: 4px; margin-inline-start: 8px; border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 1px 8px; font-size: 11.5px; color: var(--ink-2); }
.chg-undo:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- trash ---------- */
.trash-note { display: flex; align-items: center; gap: 6px; margin: 0 0 12px; }
.trash-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.trash-kinds { flex-wrap: wrap; }
.trash-kinds em { font-style: normal; color: var(--ink-3); font-size: 11.5px; margin-inline-start: 2px; }
.trash-bar .vb-search { margin-inline-start: auto; }
.trash-list { display: grid; gap: 2px; max-height: 56vh; overflow: auto; }
.trash-row { display: flex; align-items: center; gap: 10px; padding: 8px 6px; border-radius: 10px; }
.trash-row:hover { background: var(--hover); }
.trash-row .cb-wrap input { width: 17px; height: 17px; accent-color: var(--brand); }
.trash-ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; flex: 0 0 auto; background: var(--select); color: var(--brand); }
.trash-ic.k-field { background: color-mix(in srgb, var(--cyan) 14%, var(--surface)); color: #0A6E99; }
.trash-ic.k-table { background: color-mix(in srgb, var(--magenta) 12%, var(--surface)); color: #9C1356; }
.trash-ic.k-base { background: color-mix(in srgb, var(--yellow) 20%, var(--surface)); color: #A87700; }
.trash-info { flex: 1; min-width: 0; }
.trash-info b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.trash-info small { color: var(--ink-3); font-size: 12px; }
.trash-info .warn { color: #A84710; }
.trash-acts { display: flex; gap: 4px; align-items: center; }
.trash-empty { display: grid; justify-items: center; gap: 8px; padding: 40px 10px; color: var(--ink-3); text-align: center; }
.trash-empty p { margin: 0; max-width: 420px; }
.trash-sel { position: sticky; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; margin-top: 10px; border-radius: 12px; background: var(--ink); color: var(--bg); }
@media (max-width: 640px) { .trash-acts .lbl { display: none; } .trash-bar .vb-search { width: 100%; } .trash-bar .vb-search .input { width: 100%; } }

/* ---------- duplicate base ---------- */
.dup-opts { display: grid; gap: 8px; margin-bottom: 12px; }
.dup-opt { display: grid; grid-template-columns: auto auto 1fr; gap: 10px; align-items: flex-start; padding: 12px; border: 1.5px solid var(--line); border-radius: 12px; cursor: pointer; }
.dup-opt:has(input:checked) { border-color: var(--brand); background: var(--select); }
.dup-opt input { margin-top: 3px; accent-color: var(--brand); }
.dup-ic { color: var(--brand); margin-top: 1px; }
.dup-opt b { display: block; margin-bottom: 2px; }
.dup-opt small { color: var(--ink-3); }
.dup-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* ---------- checkbox chips (settings) ---------- */
.cs-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.cs-chk { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 99px; font-size: 13px; font-weight: 500; cursor: pointer; color: var(--ink); }
.cs-chk:has(input:checked) { border-color: var(--brand); background: var(--select); }
.cs-chk input { accent-color: var(--brand); margin: 0; }
.cs-chk .ic { color: var(--ink-3); }
.cs-tabs { margin-bottom: 14px; }
.cs-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 14px; }
.cs .segmented, .pr .segmented { flex-wrap: wrap; }
.cs-track.off { opacity: .45; pointer-events: none; }
.cs-steps { display: flex; flex-wrap: wrap; gap: 8px; }
.cs-step { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.cs-step input { accent-color: var(--brand); margin: 0; }
.cs-big, .cs-on, .cs-num { margin-bottom: 10px; }
.cs-on .switch-row { font-weight: 600; }

/* ---------- share tracking link ---------- */
.share-link { display: flex; gap: 8px; margin: 10px 0 14px; }
.share-link .input { flex: 1; min-width: 0; font-size: 12.5px; }
.share-acts { display: flex; gap: 8px; flex-wrap: wrap; }
.share-acts .btn { flex: 1 1 160px; height: 42px; }

/* ---------- job card (screen preview and paper) ---------- */
.jc {
  --jc: #5A3CF0; background: #fff; color: #15132B; font-family: var(--font); font-size: 10pt; line-height: 1.35;
  border: 1px solid #D9D9E6; border-radius: 3mm; overflow: hidden; box-sizing: border-box;
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.jc-a4 { width: 190mm; font-size: 11pt; }
.jc-a5 { width: 132mm; }
.jc-a6 { width: 95mm; font-size: 8.5pt; }
.jc-label { width: 94mm; height: 56mm; font-size: 7.5pt; border-radius: 2mm; }
.jc-head { display: flex; align-items: center; justify-content: space-between; gap: 3mm; padding: 3mm 4mm; background: var(--jc); color: #fff; }
.jc-org { min-width: 0; }
.jc-org b { display: block; font: 800 1.25em/1.2 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.jc-org span { opacity: .85; font-size: .9em; }
.jc-no { font: 800 2.2em/1 var(--display); text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.jc-no small { display: block; font: 700 .36em var(--font); opacity: .85; letter-spacing: .08em; text-transform: uppercase; margin-bottom: .5mm; }
.jc-top { display: flex; gap: 4mm; padding: 4mm; align-items: flex-start; }
.jc-main { flex: 1; min-width: 0; }
.jc-title { font: 800 1.6em/1.2 var(--display); margin: 0 0 2mm; word-break: break-word; color: #15132B; }
.jc-status { display: flex; align-items: center; flex-wrap: wrap; gap: 2mm; font-size: .9em; color: #555; margin-bottom: 1.5mm; }
.jc-pill { display: inline-block; padding: .15em .75em; border-radius: 99px; background: var(--pill-bg); color: var(--pill-ink); font-weight: 700; font-size: .9em; border: 1px solid rgba(0, 0, 0, .12); }
.jc-pill.big { font-size: 1.05em; }
.jc-date { font-size: .82em; color: #666; }
.jc-qr { width: 30mm; flex: 0 0 auto; text-align: center; }
.jc-qr svg { width: 100%; height: auto; display: block; }
.jc-qr small { font-size: .72em; color: #555; font-weight: 600; }
.jc-a4 .jc-qr { width: 40mm; }
.jc-a6 .jc-qr { width: 24mm; }
.jc-label .jc-qr { width: 25mm; }
.jc-img { padding: 0 4mm 3mm; }
.jc-img img { max-width: 100%; max-height: 62mm; border-radius: 2mm; object-fit: contain; display: block; }
.jc-a4 .jc-img img { max-height: 90mm; }
.jc-a6 .jc-img img { max-height: 32mm; }
.jc-fields { width: calc(100% - 8mm); margin: 0 4mm 3mm; border-collapse: collapse; font-size: .95em; }
.jc-fields th { text-align: start; font-weight: 600; color: #555; width: 34%; padding: 1.6mm 2mm 1.6mm 0; vertical-align: top; border-bottom: 1px solid #E6E6EE; }
[dir="rtl"] .jc-fields th { padding: 1.6mm 0 1.6mm 2mm; }
.jc-fields td { padding: 1.6mm 0; border-bottom: 1px solid #E6E6EE; font-weight: 500; word-break: break-word; }
.jc-fields td.long { white-space: pre-wrap; }
.jc-blank { display: inline-block; min-height: 1.1em; }
.jc-steps { display: flex; flex-wrap: wrap; gap: 1.5mm 3.5mm; padding: 1mm 4mm 3mm; font-size: .88em; }
.jc-steps span { display: inline-flex; align-items: center; gap: 1.2mm; color: #444; }
.jc-steps i { width: 3.6mm; height: 3.6mm; border: 1.3px solid #888; border-radius: 1mm; display: inline-grid; place-items: center; font-style: normal; font-size: .75em; font-weight: 800; line-height: 1; }
.jc-steps .done i { background: var(--jc); border-color: var(--jc); color: #fff; }
.jc-steps .cur { font-weight: 800; color: #111; }
.jc-note { margin: 0 4mm 3mm; padding: 2mm 3mm; border-radius: 2mm; background: #F4F4F8; font-size: .9em; border-inline-start: 1mm solid var(--jc); white-space: pre-wrap; }
.jc-sign { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5mm; padding: 7mm 4mm 4mm; font-size: .8em; color: #666; }
.jc-sign span { border-top: 1px solid #999; padding-top: 1mm; }
.jc-label .jc-head { padding: 1.5mm 2.5mm; }
.jc-label .jc-no { font-size: 1.9em; }
.jc-label .jc-top { padding: 2mm 2.5mm 1mm; gap: 2mm; }
.jc-label .jc-title { font-size: 1.4em; margin-bottom: 1mm; }
.jc-label .jc-fields { margin: 0 2.5mm; width: calc(100% - 5mm); }
.jc-label .jc-fields th, .jc-label .jc-fields td { padding: .5mm 0; }

/* print preview */
.print-modal .modal-lg { width: min(860px, 100%); }
.pr { display: grid; gap: 14px; }
.pr-opts { display: flex; flex-wrap: wrap; gap: 12px 22px; }
.pr-opt { display: grid; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.pr-preview { background: var(--hover); border-radius: 14px; padding: 16px; max-height: 58vh; overflow: auto; }
.pr-preview .muted-note { text-align: center; margin-top: 10px; }
.pr-pages { display: grid; gap: 16px; justify-items: center; }
.pr-sheet { overflow: hidden; box-shadow: 0 4px 18px rgba(28, 23, 69, .18); border-radius: 3mm; background: #fff; }
.pr-sheet > .jc { transform-origin: top left; }
[dir="rtl"] .pr-sheet > .jc { transform-origin: top right; }
.pr-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pr-tip { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 180px; }
@media (max-width: 640px) { .pr-foot .lbl { display: none; } .pr-foot .btn.primary { flex: 1 1 100%; height: 46px; } }

#print-root { display: none; }
@media print {
  html.printing body > *:not(#print-root) { display: none !important; }
  html.printing #print-root { display: block !important; }
  html.printing, html.printing body, html.printing #print-root { height: auto !important; overflow: visible !important; background: #fff !important; }
  #print-root .jc { width: auto !important; transform: none !important; break-after: page; page-break-after: always; }
  #print-root .jc:last-child { break-after: auto; page-break-after: auto; }
  #print-root .jc-label { border: 0; border-radius: 0; height: auto; }
  /* dashboards print as they look */
  html:not(.printing) body, html:not(.printing) #app { height: auto !important; overflow: visible !important; }
  html:not(.printing) .app.dash-mode { display: block !important; height: auto !important; }
  html:not(.printing) .app.dash-mode .topbar, html:not(.printing) .dash-right, html:not(.printing) #toasts { display: none !important; }
  html:not(.printing) .app.dash-mode .work, html:not(.printing) .app.dash-mode .view-host, html:not(.printing) .dash, html:not(.printing) .dash-body { display: block !important; height: auto !important; overflow: visible !important; }
  .dw { break-inside: avoid; box-shadow: none !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* ---------- scan screen (what a job card QR opens) ---------- */
.scan-modal .modal-body { padding: 0 !important; }
.scan { display: grid; gap: 16px; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
.scan-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--jc); color: var(--jc-ink, #fff); }
.scan-head .icon-btn { color: inherit; }
.scan-head .icon-btn:hover { background: rgba(255, 255, 255, .16); color: inherit; }
.scan-head div { display: grid; }
.scan-head small { opacity: .85; font-size: 12.5px; }
.scan-head b { font: 800 26px/1 var(--display); font-variant-numeric: tabular-nums; }
.scan-title { margin: 0; padding: 0 18px; font: 800 22px/1.25 var(--display); word-break: break-word; }
.scan-sec { padding: 0 18px; }
.scan-label { font-size: 12px; font-weight: 700; color: var(--ink-3); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .04em; }
.scan-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.scan-step {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 58px; padding: 8px 10px;
  border-radius: 14px; border: 0; text-align: center; font-weight: 700; font-size: 15px;
  background: var(--pill-bg); color: var(--pill-ink); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06);
}
.scan-step.on { background: var(--vivid); color: var(--vivid-ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--vivid) 30%, transparent); }
.scan-step:disabled { opacity: .5; cursor: default; }
.scan-step.on:disabled { opacity: 1; }
.scan-acts { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 18px; }
.scan-acts .btn { flex: 1 1 140px; height: 46px; }
.scan-photo { cursor: pointer; }
.scan-fields { margin: 0 18px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.scan-fields div { display: grid; grid-template-columns: 38% 1fr; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line-2); }
.scan-fields div:last-child { border-bottom: 0; }
.scan-fields dt { color: var(--ink-3); font-size: 13px; }
.scan-fields dd { margin: 0; font-weight: 600; word-break: break-word; }
.scan-note { display: flex; gap: 8px; padding: 0 18px; align-items: flex-end; }
.scan-note textarea { flex: 1; }
.scan-cam { position: relative; border-radius: 16px; overflow: hidden; background: #000; aspect-ratio: 1; }
.scan-cam video { width: 100%; height: 100%; object-fit: cover; display: block; }
.scan-frame { position: absolute; inset: 18%; border: 3px solid rgba(255, 255, 255, .92); border-radius: 18px; box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); }
.scan-help { display: grid; justify-items: center; gap: 10px; text-align: center; color: var(--ink-2); padding: 16px 6px; }
.scan-help p { margin: 0; }
.scan-help .ic { color: var(--brand); }
.scan-manual { display: flex; gap: 8px; margin-top: 12px; }
.scan-manual .input { flex: 1; }
.topbar .tb-scan { display: none; }
@media (max-width: 760px) { .topbar .tb-scan { display: inline-grid; } }

/* ---------- install the app ---------- */
.install-banner { display: flex; align-items: center; gap: 12px; padding: 12px 12px 12px 14px; margin-bottom: 18px; border-radius: 16px; background: linear-gradient(120deg, color-mix(in srgb, var(--brand) 14%, var(--surface)), var(--surface)); border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line)); }
.install-banner > div { flex: 1; min-width: 0; display: grid; }
.install-banner b { font: 700 15px var(--display); }
.install-banner span { font-size: 12.5px; color: var(--ink-2); }
.inst-hero { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.inst-hero div { display: grid; }
.inst-hero b { font: 800 20px var(--display); }
.inst-hero span { color: var(--ink-2); font-size: 13px; }
.inst-steps { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.inst-steps li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line-2); font-size: 14px; }
.inst-n { width: 24px; height: 24px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: 0 0 auto; }
.inst-ic { color: var(--brand); }

/* ---------- dashboards ---------- */
.app.dash-mode { grid-template-rows: auto minmax(0, 1fr); }
.tab-dash .ic { opacity: .95; }
@media (max-width: 760px) { .tab-dash .lbl { display: none; } .tab-dash { padding: 0 12px; } }
.dash-host { background: var(--bg); }
.dash { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.dash-bar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; min-height: 52px; background: var(--surface); border-bottom: 1px solid var(--line); }
.dash-pick { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px; border: 0; border-radius: 10px; background: none; font: 700 16px var(--display); color: var(--ink); min-width: 0; }
.dash-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-pick:hover:not(:disabled) { background: var(--hover); }
.dash-pick .ic:first-child { color: var(--brand); }
.dash-live { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); font-weight: 600; white-space: nowrap; }
.dash-live i { width: 8px; height: 8px; border-radius: 50%; background: var(--green); animation: tbxpulse 2s infinite; }
@keyframes tbxpulse { 0% { box-shadow: 0 0 0 0 rgba(18, 183, 106, .45); } 70% { box-shadow: 0 0 0 7px rgba(18, 183, 106, 0); } 100% { box-shadow: 0 0 0 0 rgba(18, 183, 106, 0); } }
.dash-right { margin-inline-start: auto; display: flex; gap: 6px; align-items: center; }
.dash-body { flex: 1; overflow: auto; padding: 18px; }
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; max-width: 1400px; margin: 0 auto; align-items: start; }
.dw { grid-column: span 3; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 16px 16px; min-width: 0; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-sm); }
.dw-m { grid-column: span 6; }
.dw-l { grid-column: span 12; }
@media (max-width: 1100px) { .dw { grid-column: span 6; } .dw-m, .dw-l { grid-column: span 12; } }
@media (max-width: 640px) {
  .dash-bar { padding: 8px 10px; gap: 6px; }
  .dash-live { display: none; }
  .dash-right .lbl { display: none; }
  .dash-body { padding: 10px; }
  .dash-grid { gap: 10px; }
  .dw { padding: 12px; border-radius: 14px; }
  .dw:not(.dw-number) { grid-column: span 12; }
  .dw-number.dw-m, .dw-number.dw-l { grid-column: span 12; }
}
.dw-head { display: flex; align-items: flex-start; gap: 8px; }
.dw-titles { flex: 1; min-width: 0; }
.dw-head h3 { margin: 0; font: 700 14.5px/1.3 var(--display); color: var(--ink); overflow-wrap: anywhere; }
.dw-head small { display: block; font-size: 12px; color: var(--ink-3); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dw-head small:empty { display: none; }
.dw-menu { margin: -4px; }
.dw-body { min-height: 56px; position: relative; }
.dw-num { display: grid; gap: 6px; border: 0; background: none; padding: 0; text-align: start; width: 100%; color: var(--ink); }
.dw-num b { font: 800 34px/1.05 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.dw-num:hover b { color: var(--brand); }
@media (max-width: 640px) { .dw-num b { font-size: 26px; } }
.dw-delta { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; width: max-content; max-width: 100%; }
.dw-delta small { font-weight: 500; opacity: .8; }
.dw-delta.up { color: #0B7442; background: color-mix(in srgb, var(--green) 14%, var(--surface)); }
.dw-delta.down { color: #9A1F27; background: color-mix(in srgb, var(--red) 12%, var(--surface)); }
.dw-delta.flat { color: var(--ink-3); background: var(--hover); }
[data-theme="dark"] .dw-delta.up { color: #5BE3A2; }
[data-theme="dark"] .dw-delta.down { color: #FF8A8F; }
.dw-sub { color: var(--ink-3); font-size: 12.5px; }
.dw-goal { display: grid; gap: 4px; margin-top: 4px; }
.dw-goal-bar { height: 8px; border-radius: 99px; background: var(--hover); overflow: hidden; }
.dw-goal-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), var(--cyan)); }
[dir="rtl"] .dw-goal-bar i { background: linear-gradient(-90deg, var(--brand), var(--cyan)); }
.dw-goal small { color: var(--ink-3); font-size: 12px; }
.dw-empty { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 13px; padding: 14px 0; }
.dw-partial { display: block; color: var(--ink-3); font-size: 11.5px; margin-top: 6px; }
.bars { display: grid; gap: 4px; }
.bar-row { display: grid; grid-template-columns: minmax(64px, 32%) minmax(0, 1fr) auto; align-items: center; gap: 10px; border: 0; background: none; padding: 4px 6px; border-radius: 8px; text-align: start; width: 100%; font-size: 13px; color: var(--ink); }
.bar-row:hover { background: var(--hover); }
.bar-label { display: flex; align-items: center; gap: 6px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }
.bar-label.muted { color: var(--ink-3); }
.bar-dot { width: 9px; height: 9px; border-radius: 3px; flex: 0 0 auto; }
.bar-track { height: 14px; border-radius: 4px; background: var(--line-2); overflow: hidden; }
.bar-track i { display: block; height: 100%; border-radius: 4px; background: var(--dc, var(--brand)); transition: width .4s ease; }
.bar-val { font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12.5px; color: var(--ink-2); white-space: nowrap; }
.donut { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.dn-svg { width: 150px; height: 150px; flex: 0 0 auto; }
.dn-arc { cursor: pointer; transition: opacity .15s; }
.dn-svg:hover .dn-arc { opacity: .55; }
.dn-svg .dn-arc:hover { opacity: 1; }
.dn-total { font: 800 17px var(--display); fill: var(--ink); }
.dn-cap { font-size: 9px; fill: var(--ink-3); }
.dn-legend { list-style: none; margin: 0; padding: 0; flex: 1 1 170px; display: grid; gap: 2px; min-width: 0; }
.dn-legend li { display: grid; grid-template-columns: 10px minmax(0, 1fr) auto 38px; align-items: center; gap: 8px; font-size: 13px; padding: 4px 6px; border-radius: 7px; cursor: pointer; }
.dn-legend li:hover { background: var(--hover); }
.dn-legend i { width: 10px; height: 10px; border-radius: 3px; }
.dn-legend span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dn-legend b { font-weight: 600; font-variant-numeric: tabular-nums; }
.dn-legend em { font-style: normal; color: var(--ink-3); font-size: 12px; text-align: end; }
.lc { position: relative; overflow: hidden; }
.lc-svg { display: block; max-width: 100%; height: auto; cursor: crosshair; touch-action: pan-y; }
.lc-grid { stroke: var(--line-2); stroke-width: 1; }
.lc-tick { font-size: 10.5px; fill: var(--ink-3); font-family: var(--font); }
.lc-hair { stroke: var(--ink-4); stroke-dasharray: 3 3; }
.lc-tip { position: absolute; top: 4px; padding: 6px 10px; border-radius: 9px; background: var(--ink); color: var(--bg); font-size: 12px; pointer-events: none; display: grid; white-space: nowrap; box-shadow: var(--shadow); }
.lc-tip[hidden] { display: none; }
.lc-tip small { opacity: .75; }
.lc-tip b { font-size: 13.5px; }
.dl { overflow-x: auto; }
.dl table { width: 100%; border-collapse: collapse; font-size: 13px; }
.dl th { text-align: start; font-weight: 600; color: var(--ink-3); font-size: 12px; padding: 4px 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.dl td { padding: 7px 8px; border-bottom: 1px solid var(--line-2); max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl tr[data-rec] { cursor: pointer; }
.dl tr[data-rec]:hover td { background: var(--hover); }
.dl td b { font-weight: 600; }
.dl-num { color: var(--ink-3); font-size: 11.5px; margin-inline-end: 6px; font-variant-numeric: tabular-nums; }
.dw.sk { min-height: 130px; }
.sk-line { height: 14px; width: 50%; border-radius: 6px; background: var(--hover); }
.sk-block { height: 70px; border-radius: 10px; background: linear-gradient(90deg, var(--hover) 0%, var(--line-2) 50%, var(--hover) 100%); background-size: 200% 100%; animation: tbxsk 1.2s infinite linear; }
@keyframes tbxsk { to { background-position: -200% 0; } }
.dash-grid.editing .dw { border-style: dashed; border-color: color-mix(in srgb, var(--brand) 40%, var(--line)); }
.dash-grid.editing .dw[draggable="true"] { cursor: grab; }
.dw.dragging { opacity: .4; }
.dw.drop-before { box-shadow: -4px 0 0 var(--brand); }
[dir="rtl"] .dw.drop-before { box-shadow: 4px 0 0 var(--brand); }
.dash-empty { grid-column: 1 / -1; display: grid; justify-items: center; gap: 10px; text-align: center; color: var(--ink-2); padding: 60px 20px; }
.dash-empty .ic { color: var(--brand); }
.dash-empty h3 { margin: 0; font: 800 22px var(--display); color: var(--ink); }
.dash-empty p { margin: 0; max-width: 440px; }
.dash-opt { display: flex; gap: 10px; align-items: flex-start; padding: 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 14px; cursor: pointer; }
.dash-opt input { margin-top: 3px; accent-color: var(--brand); }
.dash-opt b { display: block; }
.dash-opt small { color: var(--ink-3); }
.drill-list { display: grid; gap: 2px; max-height: 55vh; overflow: auto; }
.drill-row { display: flex; align-items: center; gap: 8px; padding: 10px; border: 0; background: none; border-radius: 9px; text-align: start; width: 100%; color: var(--ink); }
.drill-row:hover { background: var(--hover); }
.drill-row b { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drill-row .ic { color: var(--ink-4); }
/* widget editor */
.we-modal .modal-body { padding: 0; display: flex; overflow: hidden; }
.we { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); flex: 1; min-height: 0; }
.we-form { padding: 16px 20px; overflow: auto; border-inline-end: 1px solid var(--line); }
.we-preview { padding: 16px 20px; background: var(--bg); overflow: auto; }
.we-label { font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 10px; }
.we-grid { display: block; }
.we-types { margin-bottom: 14px; }
.we-typeseg { flex-wrap: wrap; }
.we-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0 12px; }
.we-sec { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 6px; margin: 0 0 14px; min-width: 0; }
.we-sec legend { font-size: 12.5px; font-weight: 700; color: var(--ink-2); padding: 0 6px; }
.we-rule { display: grid; grid-template-columns: 60px minmax(0, 1.2fr) minmax(0, 1fr) minmax(0, 1.2fr) 30px; gap: 6px; align-items: center; margin-bottom: 8px; }
.we-rule .input { height: 34px; font-size: 13px; padding: 0 8px; }
.we-where { font-size: 12.5px; color: var(--ink-3); text-align: end; }
.we-hide, .we-cum, .we-cmp { margin-bottom: 8px; }
@media (max-width: 900px) {
  .we-modal .modal-body { overflow: auto; display: block; }
  .we { display: block; }
  .we-form { border: 0; border-bottom: 1px solid var(--line); overflow: visible; }
  .we-preview { overflow: visible; }
  .we-rule { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 30px; }
  .we-rule > :first-child { grid-column: 1 / -1; text-align: start; }
}

/* ---------- public tracking page ---------- */
body.tk-body { overflow: auto; background: var(--bg); }
.tk { max-width: 560px; margin: 0 auto; padding: 16px 14px calc(30px + env(safe-area-inset-bottom)); display: grid; gap: 12px; }
@media (min-width: 700px) { .tk { padding-top: 40px; } }
.tk-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 4px 2px; }
.tk-co { font: 800 16px var(--display); color: var(--ink); }
.tk-lang { border: 1px solid var(--line); background: var(--surface); border-radius: 99px; padding: 5px 12px; font-size: 13px; color: var(--ink-2); }
.tk-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: var(--shadow-sm); }
.tk-card h2 { margin: 0 0 8px; font: 700 15px var(--display); }
.tk-hero { padding: 0; overflow: hidden; }
.tk-band { height: 8px; background: var(--tk); }
.tk-hero-in { padding: 18px 18px 20px; display: grid; gap: 8px; }
.tk-kicker { font-size: 12.5px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; }
.tk-hero h1 { margin: 0; font: 800 26px/1.2 var(--display); letter-spacing: -.01em; color: var(--ink); word-break: break-word; }
.tk-no { color: var(--ink-3); font-size: 14px; }
.tk-no b { color: var(--ink); font-variant-numeric: tabular-nums; }
.tk-now { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 14px; color: var(--ink-2); margin-top: 4px; }
.tk-now .tk-pill { font-size: 15px; padding: 5px 14px; }
.tk-message { margin: 6px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); color: var(--ink-2); white-space: pre-wrap; }
.tk-pill { display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 99px; font-weight: 700; font-size: 13px; }
.tk-steps { list-style: none; margin: 0; padding: 0; display: grid; }
.tk-steps li { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 9px 0; color: var(--ink-3); }
.tk-steps li::before { content: ''; position: absolute; inset-inline-start: 13px; top: -9px; height: 18px; width: 2px; background: var(--line); }
.tk-steps li:first-child::before { display: none; }
.tk-steps li.done::before, .tk-steps li.cur::before { background: var(--sc); }
.tk-dot { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; background: var(--surface); color: #fff; position: relative; z-index: 1; }
.tk-steps .done .tk-dot { background: var(--sc); border-color: var(--sc); }
.tk-steps .cur .tk-dot { border-color: var(--sc); box-shadow: 0 0 0 5px color-mix(in srgb, var(--sc) 18%, transparent); }
.tk-dot i { width: 12px; height: 12px; border-radius: 50%; background: var(--sc); animation: tbxbeat 1.8s infinite; }
@keyframes tbxbeat { 50% { transform: scale(.7); opacity: .6; } }
.tk-sname { font-weight: 600; }
.tk-steps .done .tk-sname { color: var(--ink-2); }
.tk-steps .cur .tk-sname { color: var(--ink); font-weight: 800; font-size: 16px; }
.tk-steps small { font-size: 12px; font-weight: 700; color: var(--ink); background: color-mix(in srgb, var(--sc) 16%, var(--surface)); padding: 2px 8px; border-radius: 99px; }
.tk-fields { margin: 0; display: grid; }
.tk-fields div { display: grid; grid-template-columns: minmax(0, 40%) 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.tk-fields div:last-child { border-bottom: 0; }
.tk-fields dt { color: var(--ink-3); font-size: 13.5px; }
.tk-fields dd { margin: 0; font-weight: 600; word-break: break-word; white-space: pre-wrap; }
.tk-imgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.tk-imgs img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 12px; display: block; background: var(--hover); }
.tk-contact { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tk-btn { display: flex; align-items: center; justify-content: center; height: 50px; border-radius: 14px; font-weight: 700; font-size: 15px; text-decoration: none; background: var(--surface); border: 1px solid var(--line); color: var(--ink); }
.tk-btn.wa { background: #25D366; border-color: #25D366; color: #fff; }
.tk-upd { display: flex; align-items: center; justify-content: center; gap: 10px; color: var(--ink-3); font-size: 12.5px; }
.tk-refresh { border: 0; background: none; color: var(--brand); font-weight: 600; font-size: 12.5px; }
.tk-upd.flash { animation: tbxflash 1.2s ease-out; border-radius: 99px; }
.tk-foot { display: flex; align-items: center; justify-content: center; gap: 6px; color: var(--ink-4); font-size: 12px; margin-top: 6px; }
.tk-msg { display: grid; justify-items: center; gap: 10px; text-align: center; padding: 40px 20px; margin-top: 10vh; }
.tk-msg h1 { margin: 0; font: 800 22px var(--display); }
.tk-msg p { margin: 0; color: var(--ink-2); }

/* ---------- v6.1: image previews, cell arrow, people of my bases, notifications ---------- */
.lb-ph { position: absolute; inset: 20px; width: calc(100% - 40px); height: calc(100% - 40px); object-fit: contain; opacity: .92; pointer-events: none; }
.lb-media.loading:has(.lb-ph)::after { opacity: .7; }
/* people of my bases */
.bp-bases { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.bp-roles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.bp-role { display: inline-flex; align-items: center; gap: 6px; padding: 3px 4px 3px 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); font-size: 12.5px; }
.bp-role .base-dot { width: 18px; height: 18px; font-size: 10px; border-radius: 5px; }
.bp-name { font-weight: 600; max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bp-via { color: var(--ink-3); font-size: 11.5px; padding-inline-end: 4px; }
.bp-role .icon-btn { width: 24px; height: 24px; }
/* notifications */
.tb-bell { position: relative; }
.bell-n { position: absolute; top: 1px; inset-inline-end: 0; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--magenta); color: #fff; font: 700 10.5px/17px var(--font); text-align: center; box-shadow: 0 0 0 2px var(--base); pointer-events: none; }
.home-shell .bell-n { box-shadow: 0 0 0 2px #1C1745; }
.nt-popover { width: min(420px, calc(100vw - 16px)); padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.nt-popover.sheet { width: 100% !important; }
.nt { display: flex; flex-direction: column; min-height: 0; max-height: min(620px, calc(100vh - 80px)); }
.nt-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px 8px; }
.nt-head b { font: 700 16px var(--display); }
.nt-scope { margin: 0 14px 8px; align-self: flex-start; max-width: calc(100% - 28px); }
.nt-scope button { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; }
.nt-list { overflow: auto; padding: 0 6px 8px; display: grid; gap: 2px; }
.nt-item { display: grid; grid-template-columns: 32px minmax(0, 1fr) 10px; gap: 10px; align-items: start; padding: 10px 8px; border: 0; border-radius: 12px; background: none; text-align: start; width: 100%; color: var(--ink); }
.nt-item:hover { background: var(--hover); }
.nt-item.unread { background: color-mix(in srgb, var(--brand) 6%, transparent); }
.nt-item.unread:hover { background: color-mix(in srgb, var(--brand) 11%, transparent); }
.nt-body { display: grid; gap: 3px; min-width: 0; }
.nt-main { font-size: 13.5px; line-height: 1.4; }
.nt-main b { font-weight: 700; }
.nt-sub { color: var(--ink-2); font-size: 12.5px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.nt-when { display: flex; align-items: center; gap: 5px; color: var(--ink-3); font-size: 11.5px; }
.nt-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand); margin-top: 6px; }
.nt-ic { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--select); color: var(--brand); }
.nt-ic.k-automation { background: color-mix(in srgb, var(--red) 13%, var(--surface)); color: var(--red); }
.nt-ic.k-form { background: color-mix(in srgb, var(--green) 14%, var(--surface)); color: #0B7442; }
.nt-ic.k-bulk_delete { background: color-mix(in srgb, var(--yellow) 22%, var(--surface)); color: #A87700; }
.nt-empty { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 30px 24px 34px; color: var(--ink-3); }
.nt-empty .ic { color: var(--brand); }
.nt-empty p { margin: 0; font-weight: 600; color: var(--ink-2); }
.nt-empty small { max-width: 300px; }
.nt-foot { border-top: 1px solid var(--line-2); padding: 6px 14px; }
.nt-foot .switch-row { font-size: 13px; color: var(--ink-2); }
/* mentions */
.mention-pop { padding: 6px; width: 280px; }
.mention-list { display: grid; gap: 2px; }
.mention-list .opt span { display: grid; text-align: start; min-width: 0; }
.mention-list .opt small { color: var(--ink-3); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; }
/* import: files */
.imp-files { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); text-align: start; width: 100%; }
.imp-files > div { flex: 1; display: grid; gap: 2px; }
.imp-files small { color: var(--ink-2); }
.imp-files.warn { background: color-mix(in srgb, var(--yellow) 14%, var(--surface)); }
.imp-files-note { margin-top: 8px; }

/* ---------- v6.2: base color & icon ---------- */
.base-card .bc-mark svg { width: 24px; height: 24px; }
.bl { display: grid; gap: 14px; }
.bl-preview { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; background: color-mix(in srgb, var(--bc) 8%, var(--surface)); border: 1px solid color-mix(in srgb, var(--bc) 25%, var(--line)); }
.bl-preview .bc-mark { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; font: 800 22px var(--display); background: var(--bc); color: var(--bc-ink); flex: none; }
.bl-preview b { font: 700 17px var(--display); }
.bl .section-title { margin: 4px 0 -4px; }
.bl-colors { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 8px; }
.bl-colors button { width: 100%; height: auto; aspect-ratio: 1; max-width: 40px; }
.bl-icons { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; max-height: 300px; overflow: auto; padding: 2px; }
.bl-ic { aspect-ratio: 1; border-radius: 10px; border: 1px solid transparent; background: none; color: var(--ink-2); display: grid; place-items: center; font: 800 15px var(--display); }
.bl-ic:hover { background: var(--hover); color: var(--ink); }
.bl-ic.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.bl-ic.letter { border-color: var(--line); }
.tb-base span.tb-bicon { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: color-mix(in srgb, var(--base-ink, #fff) 18%, transparent); flex: none; overflow: visible; }
.base-dot svg { width: 11px; height: 11px; }
@media (max-width: 640px) {
  .bl-colors { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .bl-icons { max-height: 42vh; }
}
/* pictures that can't be shown here (e.g. HEIC on Chrome) */
.lb-heic-note { margin: 10px auto 0; max-width: 420px; text-align: center; color: var(--ink-3); font-size: 12.5px; }
.cover-file { display: grid; place-items: center; min-height: 90px; background: var(--hover); }
.cover-file::after { content: attr(data-ext); font: 800 18px var(--display); color: var(--ink-3); letter-spacing: .04em; }

/* ================================================================
   v6.3 — plans, paying, control panel
   ================================================================ */
.plan-pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12.5px; font-weight: 700; white-space: nowrap; background: var(--hover); color: var(--ink-2); box-shadow: inset 0 0 0 1px var(--line); }
.plan-pill.sm { height: 20px; padding: 0 8px; font-size: 11.5px; }
.plan-pill.p-basic { background: color-mix(in srgb, var(--cyan) 14%, var(--surface)); color: color-mix(in srgb, var(--cyan) 70%, var(--ink)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--cyan) 30%, transparent); }
.plan-pill.p-pro { background: color-mix(in srgb, var(--brand) 14%, var(--surface)); color: var(--brand); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--brand) 30%, transparent); }
.plan-pill.p-business { background: var(--ink); color: var(--surface); box-shadow: none; }
.plan-pill.p-internal { background: color-mix(in srgb, var(--green) 14%, var(--surface)); color: color-mix(in srgb, var(--green) 70%, var(--ink)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--green) 30%, transparent); }
.plan-pill.s-trial { background: color-mix(in srgb, var(--yellow) 22%, var(--surface)); color: color-mix(in srgb, var(--yellow) 45%, var(--ink)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--yellow) 45%, transparent); }
.plan-pill.s-grace { background: color-mix(in srgb, #F26B1D 16%, var(--surface)); color: #C2410C; box-shadow: inset 0 0 0 1px color-mix(in srgb, #F26B1D 35%, transparent); }
.plan-pill.s-expired, .plan-pill.s-frozen { background: color-mix(in srgb, var(--red) 12%, var(--surface)); color: var(--red); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--red) 30%, transparent); }
.base-card .bc-plan { position: absolute; top: 18px; inset-inline-end: 46px; }
.plan-banner { display: flex; align-items: center; gap: 10px; padding: 8px 14px; font-size: 13px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--yellow) 16%, var(--surface)); color: var(--ink); }
.plan-banner span { flex: 1; }
.plan-banner.danger { background: color-mix(in srgb, var(--red) 10%, var(--surface)); }
.plan-banner .btn { background: var(--surface); border-color: var(--line); }

/* billing page */
.bill { min-height: 100%; }
.bill-inner { max-width: 1120px; margin: 0 auto; padding: 22px 28px 80px; display: grid; gap: 18px; }
.bill-loading { padding: 60px 0; text-align: center; color: var(--ink-3); }
.bill-back { justify-self: start; margin-inline-start: -8px; }
.bill-hero { display: flex; align-items: center; gap: 16px; padding: 20px; border-radius: 18px; background: linear-gradient(120deg, color-mix(in srgb, var(--bc) 14%, var(--surface)), var(--surface) 70%); border: 1px solid color-mix(in srgb, var(--bc) 25%, var(--line)); flex-wrap: wrap; }
.bill-hero .bc-mark { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; font: 800 24px var(--display); background: var(--bc); color: var(--bc-ink); flex: none; }
.bh-text { flex: 1; min-width: 180px; }
.bh-text h1 { margin: 0; font: 800 26px/1.15 var(--display); letter-spacing: -.02em; }
.bh-text p { margin: 2px 0 0; color: var(--ink-2); }
.bh-plan { display: grid; justify-items: end; gap: 6px; text-align: end; max-width: 380px; }
.bh-plan > span:last-child { font-size: 13px; color: var(--ink-2); }
.bill-alert { display: flex; align-items: flex-start; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font-size: 13.5px; }
.bill-alert > .ic { margin-top: 2px; color: var(--ink-3); }
.bill-alert > div { flex: 1; display: grid; gap: 2px; }
.bill-alert span { color: var(--ink-2); }
.bill-alert.warn { background: color-mix(in srgb, var(--yellow) 13%, var(--surface)); border-color: color-mix(in srgb, var(--yellow) 40%, var(--line)); }
.bill-alert.warn > .ic { color: #B45309; }
.bill-alert.danger { background: color-mix(in srgb, var(--red) 8%, var(--surface)); border-color: color-mix(in srgb, var(--red) 30%, var(--line)); }
.bill-alert.danger > .ic { color: var(--red); }
.bill-alert.info > .ic { color: var(--brand); }
.bill-alert.ok { background: color-mix(in srgb, var(--green) 10%, var(--surface)); border-color: color-mix(in srgb, var(--green) 35%, var(--line)); }
.bill-alert.ok > .ic { color: var(--green); }
.bill-sec { display: grid; gap: 12px; }
.bill-sec-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bill-sec-head h2 { margin: 0; font: 700 18px var(--display); flex: 1; }
.bill-sec-head .muted-text { margin: 0; font-size: 12.5px; }
.bm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.bm { padding: 12px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 6px; }
.bm-top { display: flex; align-items: center; gap: 7px; color: var(--ink-3); font-size: 12.5px; font-weight: 600; }
.bm-num { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.bm-num b { font: 800 20px var(--display); font-variant-numeric: tabular-nums; }
.bm-num span { color: var(--ink-3); font-size: 12.5px; }
.bm-bar { height: 6px; border-radius: 99px; background: var(--hover); overflow: hidden; }
.bm-bar i { display: block; height: 100%; border-radius: inherit; background: var(--brand); }
.bm.high .bm-bar i { background: #F59E0B; }
.bm.full .bm-bar i { background: var(--red); }
.bm.full { border-color: color-mix(in srgb, var(--red) 35%, var(--line)); }
.bm-sub { font-size: 11.5px; color: var(--ink-3); }
.bill-trial { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 14px; background: linear-gradient(110deg, color-mix(in srgb, var(--brand) 14%, var(--surface)), color-mix(in srgb, var(--magenta) 10%, var(--surface))); border: 1px solid color-mix(in srgb, var(--brand) 25%, var(--line)); }
.bill-trial > .ic { color: var(--brand); }
.bill-trial > div { flex: 1; display: grid; gap: 2px; }
.bill-trial span { color: var(--ink-2); font-size: 13px; }
.plan-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: stretch; }
.plan-card { position: relative; display: flex; flex-direction: column; gap: 10px; padding: 18px 16px 16px; border-radius: 18px; background: var(--surface); border: 1px solid var(--line); }
.plan-card.featured { border: 2px solid var(--brand); padding: 17px 15px 15px; box-shadow: 0 10px 30px color-mix(in srgb, var(--brand) 14%, transparent); }
.plan-card.current { background: var(--surface-2); }
.plan-flag { position: absolute; top: -11px; inset-inline-start: 16px; height: 22px; padding: 0 10px; border-radius: 99px; background: var(--brand); color: #fff; font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; }
.pc-name { display: flex; align-items: center; gap: 8px; font: 700 17px var(--display); }
.pc-cur { font: 600 11px var(--font); padding: 2px 8px; border-radius: 99px; background: color-mix(in srgb, var(--green) 14%, var(--surface)); color: color-mix(in srgb, var(--green) 70%, var(--ink)); }
.pc-price { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.pc-price b { font: 800 26px/1.1 var(--display); letter-spacing: -.02em; }
.pc-price span { color: var(--ink-3); font-size: 12.5px; }
.pc-sub { color: var(--ink-3); font-size: 12.5px; margin-top: -6px; }
.pc-feat { list-style: none; margin: 4px 0 0; padding: 0; display: grid; gap: 7px; flex: 1; align-content: start; }
.pc-feat li { display: flex; gap: 7px; font-size: 13px; line-height: 1.35; }
.pc-feat li .ic { margin-top: 2px; color: var(--green); }
.pc-feat li.no { color: var(--ink-3); }
.pc-feat li.no .ic { color: var(--ink-4); }
.pc-cta .btn { width: 100%; }
.bill-note { margin: 0; color: var(--ink-3); font-size: 12.5px; line-height: 1.6; }
.bill-contact { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: 13px; margin: 0; }
.pay-list { display: grid; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); overflow: hidden; }
.pay-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line-2); }
.pay-row:first-child { border-top: 0; }
.pay-row.click { cursor: pointer; }
.pay-row.click:hover { background: var(--hover); }
.pay-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--hover); color: var(--ink-2); flex: none; }
.pay-info { flex: 1; min-width: 0; display: grid; gap: 1px; }
.pay-info > span { color: var(--ink-3); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pay-note { color: var(--red) !important; white-space: normal !important; }
.pay-amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pay-st { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: var(--hover); color: var(--ink-2); white-space: nowrap; }
.pay-st.st-paid { background: color-mix(in srgb, var(--green) 14%, var(--surface)); color: color-mix(in srgb, var(--green) 70%, var(--ink)); }
.pay-st.st-pending { background: color-mix(in srgb, var(--yellow) 22%, var(--surface)); color: #92400E; }
.pay-st.st-rejected, .pay-st.st-failed { background: color-mix(in srgb, var(--red) 12%, var(--surface)); color: var(--red); }
:root[data-theme="dark"] .pay-st.st-pending { color: #FCD34D; }
:root[data-theme="dark"] .plan-pill.s-grace { color: #FDBA74; }

/* "needs a paid plan" + payment sent */
.upsell { display: grid; justify-items: center; text-align: center; gap: 8px; padding: 22px 8px 6px; }
.upsell-ic { width: 60px; height: 60px; border-radius: 18px; display: grid; place-items: center; background: var(--select); color: var(--brand); margin-bottom: 4px; }
.upsell-ic.ok { background: color-mix(in srgb, var(--green) 14%, var(--surface)); color: var(--green); }
.upsell h3 { margin: 0; font: 800 20px var(--display); }
.upsell p { margin: 0; color: var(--ink-2); max-width: 380px; }
.upsell .muted-text { color: var(--ink-3); font-size: 13px; }
.upsell-acts { display: flex; gap: 8px; margin-top: 12px; }
.ref-big { font: 800 24px var(--display); letter-spacing: .06em; padding: 8px 16px; border-radius: 12px; background: var(--hover); margin-top: 6px !important; }

/* checkout */
.co { display: grid; gap: 14px; }
.co-sec { display: grid; gap: 10px; }
.co-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.co-addon { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); }
.co-addon > div:first-child { flex: 1; display: grid; }
.co-addon span { color: var(--ink-3); font-size: 12.5px; }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.stepper button { width: 32px; height: 32px; border: 0; background: var(--surface); font-size: 17px; color: var(--ink-2); }
.stepper button:hover:not(:disabled) { background: var(--hover); }
.stepper button:disabled { opacity: .4; cursor: default; }
.stepper span { min-width: 30px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.co-total { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--select); }
.co-total b { font: 800 22px var(--display); }
.co-label { font-size: 13px; }
.co-methods { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 8px; }
.co-m { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-align: start; font-size: 13px; font-weight: 600; }
.co-m:hover { border-color: var(--ink-4); }
.co-m.on { border: 2px solid var(--brand); padding: 9px 11px; background: color-mix(in srgb, var(--brand) 6%, var(--surface)); }
.co-box { display: grid; gap: 12px; padding: 14px; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); }
.co-box p { margin: 0; color: var(--ink-2); font-size: 13.5px; }
.co-box .field-label { margin-bottom: 0; }
.co-steps { margin: 0; padding-inline-start: 20px; display: grid; gap: 4px; font-size: 13.5px; color: var(--ink-2); }
.co-how { display: grid; gap: 2px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); padding: 4px 12px; }
.co-kv { display: flex; align-items: center; gap: 10px; min-height: 38px; border-top: 1px solid var(--line-2); }
.co-kv:first-child { border-top: 0; }
.co-kv > span { color: var(--ink-3); font-size: 13px; min-width: 110px; }
.co-kv > b { flex: 1; font-weight: 600; overflow-wrap: anywhere; text-align: start; }
.co-form { display: grid; gap: 10px; }
.co-two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.co-file { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.co-file-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px; border-radius: 10px; border: 1px dashed var(--ink-4); background: var(--surface); font-weight: 600; font-size: 13px; }
.co-file.has .co-file-btn { border-style: solid; border-color: var(--green); color: color-mix(in srgb, var(--green) 70%, var(--ink)); }
.co-file-name { color: var(--ink-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.co-err { margin: 0; }
.co-foot { display: flex; justify-content: flex-end; gap: 8px; }

/* control panel */
.adm-inner { max-width: 1240px; margin: 0 auto; padding: 24px 28px 80px; display: grid; gap: 18px; }
.adm-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.adm-head h1 { display: flex; align-items: center; gap: 10px; margin: 0; font: 800 28px/1.1 var(--display); letter-spacing: -.02em; }
.adm-head h1 .ic { color: var(--brand); }
.adm-head p { margin: 4px 0 0; color: var(--ink-2); }
.adm-seg { flex-wrap: wrap; }
.adm-body { display: grid; gap: 16px; }
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.kpi { padding: 14px 16px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 4px; }
.kpi-top { display: flex; align-items: center; gap: 7px; color: var(--ink-3); font-size: 12.5px; font-weight: 600; }
.kpi > b { font: 800 24px/1.15 var(--display); letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi > small { color: var(--ink-3); font-size: 12px; }
.kpi.k-main { background: linear-gradient(130deg, var(--brand), #7B4DFF); border: 0; color: #fff; }
.kpi.k-main .kpi-top, .kpi.k-main small { color: rgba(255,255,255,.8); }
.kpi.k-warn { border-color: color-mix(in srgb, var(--yellow) 60%, var(--line)); background: color-mix(in srgb, var(--yellow) 10%, var(--surface)); }
.adm-cols { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; align-items: start; }
.adm-card { padding: 16px 18px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); display: grid; gap: 10px; }
.adm-card h3 { display: flex; align-items: center; gap: 8px; margin: 0; font: 700 16px var(--display); }
.adm-card h3 > span { margin-inline-start: auto; font: 700 14px var(--font); color: var(--ink-2); }
.adm-card h3 .ic { color: var(--brand); }
.adm-card .muted-text { margin: 0; font-size: 13px; }
.rev-chart { display: grid; grid-template-columns: repeat(12, 1fr); gap: 6px; height: 180px; align-items: end; padding-top: 8px; }
.rev-col { height: 100%; display: grid; grid-template-rows: 1fr auto; gap: 6px; text-align: center; }
.rev-col i { align-self: end; display: block; min-height: 3px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, #7B4DFF, var(--brand)); }
.rev-col span { font-size: 11px; color: var(--ink-3); }
.att-row { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-align: start; font-size: 13px; }
.att-row:hover { background: var(--hover); }
.att-row > span { flex: 1; }
.att-row.warn .ic { color: #B45309; }
.adm-empty { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 18px; color: var(--ink-3); font-size: 13px; }
.adm-foot-note { font-size: 12px; color: var(--ink-3); }
.adm-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.adm-search { position: relative; flex: 1; min-width: 220px; max-width: 380px; }
.adm-search .ic { position: absolute; top: 11px; inset-inline-start: 11px; color: var(--ink-3); }
.adm-search .input { padding-inline-start: 34px; }
.adm-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.fchip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.fchip span { color: var(--ink-3); font-weight: 500; font-variant-numeric: tabular-nums; }
.fchip.on { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.fchip.on span { color: color-mix(in srgb, var(--surface) 70%, transparent); }
.adm-table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.adm-table th { text-align: start; font-size: 12px; color: var(--ink-3); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; position: sticky; top: 0; }
.adm-table td { padding: 10px 12px; border-top: 1px solid var(--line-2); vertical-align: middle; }
.adm-table tbody tr { cursor: pointer; }
.adm-table tbody tr:hover td { background: var(--hover); }
.ab-name { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.ab-dot { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; font: 800 13px var(--display); flex: none; }
.ab-name > div, .ab-owner { display: grid; }
.ab-name small, .ab-owner small, .ab-end small { color: var(--ink-3); font-size: 12px; display: block; }
.ab-owner { min-width: 160px; }
.ab-end { white-space: nowrap; }
.ab-meter { display: grid; gap: 4px; min-width: 120px; font-variant-numeric: tabular-nums; }
.ab-meter i { display: block; height: 5px; border-radius: 99px; background: var(--hover); overflow: hidden; }
.ab-meter i b { display: block; height: 100%; background: var(--brand); }
.ab-meter.high i b { background: #F59E0B; }
.ab-meter.full i b { background: var(--red); }
.adm-count { color: var(--ink-3); font-size: 12px; }
.ab-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.ab-who { display: flex; align-items: center; gap: 10px; }
.ab-who > div { display: grid; }
.ab-who small { color: var(--ink-3); font-size: 12px; }
.ab-now { display: grid; justify-items: end; gap: 4px; text-align: end; font-size: 12.5px; color: var(--ink-2); max-width: 360px; }
.au-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.au-row { padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); display: grid; gap: 1px; }
.au-row span { color: var(--ink-3); font-size: 12px; }
.au-row b { font: 800 17px var(--display); font-variant-numeric: tabular-nums; }
.au-row small { color: var(--ink-3); font-size: 11.5px; }
.ab-form { display: grid; gap: 12px; padding: 16px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); }
.ab-form h3, .ab-sec h3 { margin: 0; font: 700 16px var(--display); }
.abf-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.abf-l { min-width: 110px; color: var(--ink-2); font-size: 13px; font-weight: 600; }
.abf-row .segmented { flex-wrap: wrap; }
.abf-inline { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.abf-inline label { display: grid; gap: 4px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.abf-inline label.grow { flex: 1; min-width: 160px; }
.abf-inline .num { width: 120px; }
.abf-inline.wrap { padding-top: 8px; }
.abf-row input[type=date] { width: 180px; }
.abf-more { border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; }
.abf-more summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.abf-more[open] summary { margin-bottom: 8px; }
.abf-cl { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.abf-cl label { display: grid; gap: 4px; font-size: 12px; color: var(--ink-2); font-weight: 600; }
.abf-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.abf-actions .auth-error { margin: 0; flex: 1; }
.ab-sec { display: grid; gap: 10px; margin-top: 16px; }
.ap { display: grid; gap: 14px; }
.ap-top { display: flex; align-items: center; justify-content: space-between; }
.ap-amt { font: 800 26px var(--display); }
.ap-receipt { border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2); padding: 10px; display: grid; place-items: center; }
.ap-receipt img { max-width: 100%; max-height: 420px; border-radius: 10px; display: block; }
.ap-review { display: grid; gap: 10px; padding-top: 4px; }
.ap-review .field-label { margin: 0; }
.ap-acts { display: flex; justify-content: flex-end; gap: 8px; }
.ap-review .auth-error { margin: 0; }
.btn.danger-text { color: var(--red); }
.set-limits.on { border-color: color-mix(in srgb, var(--green) 45%, var(--line)); }
.set-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.set-row .muted-text { font-size: 12.5px; }
.set-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 14px; }
.set-grid .field-label { margin: 0; }
.set-method { display: grid; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line-2); }
.sm-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.sm-head b { flex: 1; }
.sm-head .switch-row { padding: 0; }
.pm-state { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: color-mix(in srgb, var(--red) 12%, var(--surface)); color: var(--red); }
.pm-state.ok { background: color-mix(in srgb, var(--green) 14%, var(--surface)); color: color-mix(in srgb, var(--green) 70%, var(--ink)); }
.pm-keys { display: flex; gap: 10px; flex-wrap: wrap; font-size: 12px; }
.pm-keys span { display: inline-flex; align-items: center; gap: 4px; color: var(--red); }
.pm-keys span.ok { color: color-mix(in srgb, var(--green) 70%, var(--ink)); }
.set-save { display: flex; align-items: center; justify-content: flex-end; gap: 12px; position: sticky; bottom: 0; padding: 12px 0; background: linear-gradient(transparent, var(--bg) 40%); }
.set-save .auth-error { margin: 0; flex: 1; }
.log-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line-2); font-size: 13px; }
.log-row:first-child { border-top: 0; }
.log-row > div { flex: 1; min-width: 0; }
.log-row small { display: block; color: var(--ink-3); font-size: 12px; margin-top: 2px; }
.log-when { color: var(--ink-3); font-size: 12px; white-space: nowrap; }

/* public form: "Made with Tabexa" on the Free plan */
.pf-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 6px auto 18px; padding: 8px 16px; width: max-content; max-width: 90%; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); color: var(--ink); text-decoration: none; box-shadow: var(--shadow-sm); }
.pf-brand span { display: grid; text-align: start; line-height: 1.25; }
.pf-brand b { font-size: 13px; }
.pf-brand small { font-size: 11.5px; color: var(--brand); font-weight: 600; }
.pf-brand:hover { border-color: var(--brand); }

@media (max-width: 1000px) {
  .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .adm-cols { grid-template-columns: 1fr; }
  .au-grid, .abf-cl { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .set-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 640px) {
  .bill-inner, .adm-inner { padding: 14px 16px 60px; }
  .plan-grid { grid-template-columns: 1fr; }
  .bh-plan { justify-items: start; text-align: start; }
  .co-two, .set-grid { grid-template-columns: 1fr; }
  .pay-row { flex-wrap: wrap; }
  .pay-info { flex-basis: calc(100% - 50px); }
  .pay-amt { margin-inline-start: 46px; }
  .base-card .bc-plan { position: static; align-self: flex-start; }
  .ab-now { justify-items: start; text-align: start; }
}
.co-foot { position: sticky; bottom: -20px; margin: 0 -4px -6px; padding: 12px 4px; background: var(--surface); border-top: 1px solid var(--line-2); }
@media (max-width: 640px) {
  .bm-grid, .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .bm { padding: 10px 12px; }
  .bm-num b { font-size: 18px; }
  .bm-sub { display: none; }
  .kpi { padding: 12px; }
  .kpi > b { font-size: 19px; }
  .kpi.k-main { grid-column: 1 / -1; }
  .bill-hero { padding: 16px; }
  .bh-text h1 { font-size: 22px; }
  .adm-head h1 { font-size: 24px; }
  .au-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .abf-cl { grid-template-columns: 1fr 1fr; }
  .abf-l { min-width: 0; width: 100%; }
}
/* sign-in page: links to the website pages */
.auth-links { position: absolute; bottom: 18px; inset-inline: 24px; display: flex; flex-wrap: wrap; justify-content: center; gap: 4px 16px; font-size: 12.5px; }
.auth-links a { color: var(--ink-3); text-decoration: none; }
.auth-links a:hover { color: var(--brand); }
.co-terms { margin: 0; font-size: 12.5px; color: var(--ink-3); }
@media (max-width: 640px) { .auth-links { position: static; margin-top: 28px; } }

/* ===== v6.4: test payments, invoices, deleting an account ===== */
.test-tag { display: inline-flex; align-items: center; height: 19px; padding: 0 7px; border-radius: 99px; background: #FFF4D6; color: #92400E; font-size: 11px; font-weight: 700; letter-spacing: .02em; vertical-align: middle; }
:root[data-theme="dark"] .test-tag { background: rgba(255, 184, 0, .18); color: #FCD34D; }
.inv-no { font-size: 11.5px; font-weight: 600; color: var(--ink-3); margin-inline-start: 6px; }
.pay-inv { flex: none; }
.co-test { margin-bottom: 10px; }
.set-test { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--line); }
.set-test .sm-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* invoice (same look on screen and on paper; always light) */
.inv-modal .modal { max-width: 860px; }
.inv-sheet { background: #EEEFF6; border-radius: 14px; padding: 18px; overflow: auto; }
.inv-acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.inv { --i-ink: #1C1745; --i-ink-2: #4B4772; --i-ink-3: #7D7B9B; --i-line: #E3E4EE; background: #fff; color: var(--i-ink); font: 400 13.5px/1.55 var(--font); max-width: 780px; margin: 0 auto; padding: 34px 38px; border-radius: 10px; box-shadow: 0 2px 10px rgba(28, 23, 69, .08); }
.inv b { font-weight: 600; }
.inv-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; padding-bottom: 18px; border-bottom: 2px solid var(--i-ink); }
.inv-brand { display: flex; gap: 12px; align-items: flex-start; }
.inv-brand > div { display: grid; gap: 2px; }
.inv-brand b { font: 800 19px/1.2 var(--display); }
.inv-brand span { color: var(--i-ink-2); font-size: 12.5px; }
.inv-title { display: grid; justify-items: end; gap: 8px; }
.inv-title h1 { margin: 0; font: 800 28px/1 var(--display); letter-spacing: -.02em; text-transform: uppercase; }
.inv-paid { display: inline-flex; align-items: center; gap: 5px; border: 2px solid #12B76A; color: #0E8F54; border-radius: 6px; padding: 2px 10px; font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.inv-meta { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 18px 0; }
.inv-meta > div, .inv-parties > div { display: grid; gap: 2px; }
.inv-meta span, .inv-label { color: var(--i-ink-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }
.inv-meta b { font-size: 14.5px; }
.inv-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding: 14px 16px; border-radius: 8px; background: #F7F7FC; }
.inv-parties span:not(.inv-label) { color: var(--i-ink-2); }
.inv-lines { width: 100%; border-collapse: collapse; margin: 20px 0 14px; }
.inv-lines th { text-align: start; font-size: 11.5px; color: var(--i-ink-3); text-transform: uppercase; letter-spacing: .05em; padding: 8px 0; border-bottom: 1px solid var(--i-line); }
.inv-lines td { padding: 12px 0; vertical-align: top; border-bottom: 1px solid var(--i-line); }
.inv-lines td span { display: block; color: var(--i-ink-2); font-size: 12.5px; margin-top: 3px; }
.inv-lines .num { text-align: end; white-space: nowrap; padding-inline-start: 16px; }
.inv-lines tfoot td { border-bottom: 0; font: 800 17px/1.2 var(--display); padding-top: 14px; }
.inv-foot { display: grid; gap: 4px; color: var(--i-ink-2); font-size: 12.5px; }
.inv-foot p { margin: 8px 0 0; color: var(--i-ink); }
html[dir="rtl"] .inv-title h1 { text-transform: none; }
@media (max-width: 640px) {
  .inv { padding: 22px 18px; }
  .inv-top { flex-direction: column; }
  .inv-title { justify-items: start; }
  .inv-meta, .inv-parties { grid-template-columns: 1fr; }
}
@media print {
  #print-root.inv-print .inv { box-shadow: none; padding: 0; max-width: none; border-radius: 0; }
  #print-root.inv-print { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* deleting an account */
.del { display: grid; gap: 12px; }
.del h4 { margin: 4px 0 0; font-size: 14px; }
.del-intro { margin: 0; font-weight: 600; color: var(--red); }
.del-ws { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: grid; gap: 10px; background: var(--surface-2); }
.del-ws-head { display: flex; align-items: center; gap: 8px; }
.del-ws-head .muted-text { margin-inline-start: auto; font-size: 12.5px; }
.del-ws p { margin: 0; font-size: 13px; }
.del-warn { display: flex; gap: 6px; align-items: flex-start; color: #B45309; }
.del-warn .ic { margin-top: 2px; }
.del > p.muted-text { margin: 0; font-size: 13px; }
.del-acts { display: flex; justify-content: flex-end; gap: 8px; }
.inv-meta b, .inv-parties b, .inv-parties span, .inv-brand > div > span { justify-self: start; }
.inv-reach { unicode-bidi: isolate; }

/* ---------- v6.5: when the months paid for start ---------- */
.co-period { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; margin-top: -4px; border-radius: 12px; border: 1px dashed var(--line); font-size: 13px; }
.co-period .ic { flex: none; margin-top: 2px; color: var(--ink-2); }
.co-period > div { display: grid; gap: 3px; min-width: 0; }
.co-period b { font-weight: 650; }
.co-period span { color: var(--ink-2); }
.bill-alert > div > span + span { display: block; margin-top: 4px; }

/* ---------- v6.6: very big views (rows load as you scroll) ---------- */
.g-row.ph .g-ph { grid-column: 2 / -1; display: flex; align-items: center; padding: 0 12px; border-bottom: 1px solid var(--line-2); background: var(--surface); }
.g-row.ph .g-ph i { display: block; height: 10px; width: min(560px, 70%); border-radius: 6px; background: linear-gradient(90deg, var(--line-2) 0%, color-mix(in srgb, var(--line-2) 40%, var(--surface)) 50%, var(--line-2) 100%); background-size: 200% 100%; animation: ph-shimmer 1.2s linear infinite; }
@keyframes ph-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .g-row.ph .g-ph i { animation: none; } }

/* ---------- v6.6: People field, limited access ---------- */
.person-chip { padding-inline-start: 2px; border-radius: 99px; gap: 5px; max-width: 200px; }
.person-chip .av { flex: none; display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--av, var(--brand)); color: #fff; font-size: 10.5px; font-weight: 700; line-height: 1; }
.person-chip .pn { overflow: hidden; text-overflow: ellipsis; }
.person-wrap { display: inline-flex; align-items: center; }
.person-wrap .x { margin-inline-start: -2px; }
.opt .person-chip { box-shadow: none; background: transparent; padding-inline-start: 0; }
.opt .sub { color: var(--ink-3); font-size: 12px; margin: 0; margin-inline-start: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.people-val { display: inline-flex; align-items: center; gap: 4px; flex-wrap: nowrap; overflow: hidden; text-align: start; cursor: pointer; min-width: 0; }
.people-val .pv-empty { color: var(--ink-3); }
.vb-access { color: var(--ink-2); background: color-mix(in srgb, var(--yellow) 14%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--yellow) 40%, transparent); }
.ra-intro { margin: 0 0 12px; color: var(--ink-2); font-size: 13.5px; line-height: 1.55; }
.ra-mode { margin-bottom: 14px; }
.ra-mode .segmented { width: 100%; }
.ra-mode .segmented button { flex: 1; justify-content: center; }
.ra-body { display: grid; gap: 12px; }
.ra-note { margin: 0; color: var(--ink-3); font-size: 13px; }
.ra-empty { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--hover); color: var(--ink-2); font-size: 13px; }
.ra-empty .btn { margin-inline-start: auto; }
.ra-people { display: grid; gap: 2px; max-height: 240px; overflow: auto; margin-top: 6px; border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.ra-person { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; cursor: pointer; font-weight: 400; }
.ra-person:hover { background: var(--hover); }
.ra-person small { color: var(--ink-3); margin-inline-start: auto; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---------- v6.6: printed documents (quotation, invoice, delivery note) ---------- */
.doc {
  --dc: #5A3CF0; background: #fff; color: #17152B; font-family: var(--font); font-size: 10pt; line-height: 1.45;
  box-sizing: border-box; padding: 2mm 1mm 4mm; -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.doc-a4 { width: 190mm; min-height: 268mm; display: flex; flex-direction: column; }
.doc-a5 { width: 134mm; min-height: 186mm; font-size: 8.5pt; display: flex; flex-direction: column; }
.d-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8mm; padding-bottom: 5mm; border-bottom: .8mm solid var(--dc); }
.d-co { display: flex; gap: 4mm; align-items: center; min-width: 0; flex: 1; }
.d-logo { max-width: 42mm; max-height: 22mm; object-fit: contain; flex: none; }
.doc-a5 .d-logo { max-width: 30mm; max-height: 16mm; }
.d-co-t { display: grid; gap: .6mm; min-width: 0; }
.d-co-t b { font: 800 1.45em/1.2 var(--display); color: #17152B; }
.d-co-t span { color: #5B5872; font-size: .86em; }
.d-title { text-align: end; flex: none; }
.d-title h1 { margin: 0 0 2mm; font: 800 2em/1.1 var(--display); color: var(--dc); letter-spacing: -.01em; }
.d-title dl { margin: 0; display: grid; grid-template-columns: auto auto; gap: .8mm 3mm; justify-content: end; font-size: .92em; }
.d-title dt { color: #6B6884; }
.d-title dd { margin: 0; font-weight: 700; text-align: start; font-variant-numeric: tabular-nums; }
.d-to { margin: 6mm 0 5mm; padding: 3mm 4mm; border-radius: 2mm; background: color-mix(in srgb, var(--dc) 7%, #fff); display: grid; gap: .8mm; border-inline-start: 1mm solid var(--dc); }
.d-to small { color: #6B6884; font-weight: 600; font-size: .8em; text-transform: uppercase; letter-spacing: .04em; }
.d-to b { font-size: 1.18em; }
.d-to i { font-style: normal; color: #6B6884; }
.d-items { width: 100%; border-collapse: collapse; font-size: .96em; }
.d-items th { background: var(--dc); color: #fff; font-weight: 700; text-align: start; padding: 2mm 2.5mm; font-size: .9em; }
.d-items th:first-child { border-start-start-radius: 1.5mm; }
.d-items th:last-child { border-start-end-radius: 1.5mm; }
.d-items td { padding: 2.2mm 2.5mm; border-bottom: 1px solid #E5E3EE; vertical-align: top; word-break: break-word; }
.d-items tbody tr:nth-child(even) td { background: #FAFAFD; }
.d-items .d-n { width: 7mm; color: #8A87A0; text-align: center; }
.d-items .d-num { text-align: end; white-space: nowrap; font-variant-numeric: tabular-nums; }
.d-items .d-desc { font-weight: 600; }
.d-items .d-empty { text-align: center; color: #8A87A0; padding: 6mm; }
.d-items tr { break-inside: avoid; }
.d-sums { display: flex; justify-content: flex-end; margin-top: 3mm; }
.d-sums table { border-collapse: collapse; min-width: 70mm; font-variant-numeric: tabular-nums; }
.doc-a5 .d-sums table { min-width: 56mm; }
.d-sums th { text-align: start; font-weight: 500; color: #5B5872; padding: 1.2mm 3mm 1.2mm 0; }
[dir="rtl"] .d-sums th { padding: 1.2mm 0 1.2mm 3mm; }
.d-sums td { text-align: end; padding: 1.2mm 0; font-weight: 600; white-space: nowrap; }
.d-sums tr.grand th, .d-sums tr.grand td { font-size: 1.15em; font-weight: 800; color: #17152B; border-top: .5mm solid var(--dc); padding-top: 2mm; }
.d-sums tr.grand td { color: var(--dc); }
.d-sums tr.due th, .d-sums tr.due td { font-weight: 800; color: #B42318; }
.d-words { margin: 3mm 0 0; padding: 2mm 3mm; border: 1px dashed #CFCBE0; border-radius: 1.5mm; font-size: .92em; }
.d-note { margin-top: 5mm; white-space: pre-wrap; font-size: .92em; color: #3D3A55; }
.d-note b { display: block; color: #17152B; margin-bottom: 1mm; }
.d-sign { display: grid; grid-template-columns: repeat(auto-fit, minmax(50mm, 1fr)); gap: 8mm; margin-top: auto; padding-top: 10mm; }
.doc-a5 .d-sign { grid-template-columns: repeat(auto-fit, minmax(36mm, 1fr)); gap: 5mm; }
.d-sign div { display: grid; gap: 3.5mm; font-size: .9em; }
.d-sign b { color: var(--dc); }
.d-sign span { border-bottom: 1px dotted #9C99B0; padding-bottom: 1mm; color: #6B6884; }
.d-foot { margin-top: 6mm; padding-top: 2mm; border-top: 1px solid #E5E3EE; text-align: center; color: #6B6884; font-size: .82em; }
.d-sign + .d-foot { margin-top: 5mm; }
.doc:not(:has(.d-sign)) .d-foot { margin-top: auto; }
.pr-sheet > .doc { transform-origin: top left; }
[dir="rtl"] .pr-sheet > .doc { transform-origin: top right; }
.doc-modal .pr-sheet { padding: 0; }
.d-hint { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: color-mix(in srgb, var(--yellow) 14%, var(--surface)); color: var(--ink-2); font-size: 13px; }
.d-hint .btn { margin-inline-start: auto; }
@media print {
  #print-root .doc { width: auto !important; min-height: 0; transform: none !important; break-after: page; page-break-after: always; padding: 0; }
  #print-root .doc:last-child { break-after: auto; page-break-after: auto; }
}
/* settings */
.doc-settings .modal-lg { width: min(760px, 100%); }
.ds { display: grid; gap: 14px; }
.ds-tabs .segmented { width: 100%; }
.ds-tabs .segmented button { flex: 1; justify-content: center; }
.ds-body { display: grid; gap: 14px; }
.ds-sec { display: grid; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line-2); }
.ds-sec:last-child { border-bottom: 0; padding-bottom: 0; }
.ds-sec h3 { margin: 0; font-size: 14.5px; }
.ds-hint { margin: 0; color: var(--ink-3); font-size: 12.5px; }
.ds-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 10px 14px; align-items: start; }
.ds-cust, .ds-extra { display: flex; flex-wrap: wrap; gap: 6px; }
.ds-chk { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line); border-radius: 99px; font-size: 13px; font-weight: 500; cursor: pointer; background: var(--surface); }
.ds-chk:has(input:checked) { border-color: var(--brand); background: var(--select); }
.ds-chk input { accent-color: var(--brand); margin: 0; }
.ds-doctype .segmented { width: 100%; }
.ds-doctype .segmented button { flex: 1; justify-content: center; }
.ds-tg { display: grid; gap: 8px; }
.ds-color span { display: flex; align-items: center; gap: 8px; }
.ds-color input[type=color] { width: 44px; height: 34px; border: 1px solid var(--line); border-radius: 8px; padding: 2px; background: var(--surface); }
.ds-logo { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.ds-logo-box { width: 150px; height: 70px; border-radius: 10px; border: 1px dashed var(--line); display: grid; place-items: center; background: #fff; color: var(--ink-4); overflow: hidden; }
.ds-logo-box img { max-width: 92%; max-height: 86%; object-fit: contain; }
.ds-logo-acts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ds-logo-acts small { color: var(--ink-3); flex-basis: 100%; }

/* ---------- v6.6: control panel → backups ---------- */
.bk-steps { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; font-size: 13.5px; color: var(--ink-2); }
.bk-files { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 13px; }
.bk-now .btn { min-width: 180px; }
.bk-prog { display: grid; gap: 6px; }
.bk-prog .bar { height: 8px; border-radius: 99px; background: var(--hover); overflow: hidden; }
.bk-prog .bar i { display: block; height: 100%; background: var(--brand); border-radius: inherit; transition: width .4s ease; }
.bk-prog small { color: var(--ink-3); font-size: 12.5px; }
.bk-list { display: grid; }
.bk-row { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line-2); }
.bk-row:last-child { border-bottom: 0; }
.bk-id { display: grid; gap: 2px; min-width: 0; }
.bk-id small { color: var(--ink-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-meta { color: var(--ink-2); font-size: 13px; white-space: nowrap; }
.pill-run { display: inline-block; padding: 2px 10px; border-radius: 99px; background: color-mix(in srgb, var(--brand) 12%, var(--surface)); color: var(--brand); font-weight: 600; font-size: 12px; }
.bk-bases { display: grid; gap: 4px; margin-top: 10px; max-height: 52vh; overflow: auto; }
.bk-base { display: flex; align-items: center; gap: 10px; padding: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); text-align: start; width: 100%; }
.bk-base:hover { border-color: var(--brand); background: var(--select); }
.bk-base > div { flex: 1; display: grid; gap: 2px; min-width: 0; }
.bk-base small { color: var(--ink-3); font-size: 12px; }
.bk-base > span { color: var(--brand); display: inline-grid; }
[dir="rtl"] .bk-base > .ic:last-child { transform: scaleX(-1); }
.bk-done { display: grid; justify-items: center; gap: 6px; text-align: center; padding: 16px 0; }
.bk-done > .ic { color: var(--green); }
.bk-done h3 { margin: 0; }
@media (max-width: 640px) { .bk-row { grid-template-columns: 1fr auto; } .bk-row .bk-meta { grid-column: 1; grid-row: 2; } .bk-row .btn { grid-row: 1 / 3; grid-column: 2; } }

/* ---------- v6.6: job card with every picture of the record ---------- */
.jc-imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2mm; padding: 0 4mm 3mm; }
.jc-imgs.n2 { grid-template-columns: 1fr 1fr; }
.jc-imgs figure { margin: 0; height: 38mm; border-radius: 1.5mm; background: #F4F4F8; display: grid; place-items: center; overflow: hidden; break-inside: avoid; page-break-inside: avoid; }
.jc-imgs img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.jc-a4 .jc-imgs figure { height: 56mm; }
.jc-a4 .jc-imgs.n2 figure { height: 80mm; }
.jc-a5 .jc-imgs.n2 figure { height: 52mm; }
.jc-a6 .jc-imgs { grid-template-columns: 1fr 1fr; }
.jc-a6 .jc-imgs figure { height: 24mm; }
.d-imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2.5mm; margin-top: 5mm; }
.d-imgs.n1 { grid-template-columns: 1fr; }
.d-imgs.n2 { grid-template-columns: 1fr 1fr; }
.d-imgs figure { margin: 0; height: 52mm; border-radius: 1.5mm; background: #F4F4F8; display: grid; place-items: center; overflow: hidden; break-inside: avoid; page-break-inside: avoid; }
.d-imgs.n1 figure { height: 90mm; }
.doc-a5 .d-imgs figure { height: 36mm; }
.doc-a5 .d-imgs.n1 figure { height: 60mm; }
.d-imgs img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }

/* ---------- v6.6.2: scrolled sideways, the first column folds into the row numbers ---------- */
.g-c.idx .rprim, .g-hc.idx .hprim, .g-fc.idx .fcount { display: none; }
.grid.folded .g-c.idx, .grid.folded .g-hc.idx, .grid.folded .g-fc.idx { width: var(--fold-w, 80px); border-inline-end: 1px solid var(--line); box-shadow: 6px 0 8px -6px rgba(20, 16, 60, .18); }
[dir="rtl"] .grid.folded .g-c.idx, [dir="rtl"] .grid.folded .g-hc.idx, [dir="rtl"] .grid.folded .g-fc.idx { box-shadow: -6px 0 8px -6px rgba(20, 16, 60, .18); }
.grid.folded .g-hc.prim, .grid.folded .g-c.prim, .grid.folded .g-fc.prim { position: relative; inset-inline-start: auto; z-index: auto; }
.grid.folded .g-c.idx { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "n x" "p p"; align-content: center; justify-items: start; align-items: center; padding-inline: 10px 4px; row-gap: 1px; }
.grid.folded .g-c.idx .rn, .grid.folded .g-c.idx .rcheck { grid-area: n; }
.grid.folded .g-c.idx .rn { line-height: 16px; font-size: 11.5px; }
.grid.folded .g-c.idx .rcheck { width: 18px; height: 16px; justify-content: start; }
.grid.folded .g-c.idx .rexp { grid-area: x; width: 22px; height: 16px; }
.grid.folded .g-c.idx .rprim { display: block; grid-area: p; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; line-height: 15px; font-weight: 500; color: var(--ink); }
.grid.folded .g-row.ph .g-c.idx { display: flex; }
.grid.folded .g-hc.idx { justify-content: flex-start; gap: 8px; padding-inline: 10px 8px; }
.grid.folded .g-hc.idx .hprim { display: block; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer; }
.grid.folded .g-fc.idx .fcount { display: block; overflow: hidden; text-overflow: ellipsis; }
