/* Birks CRM — design tokens and components. Light and dark themes are both tuned, not inverted. */
:root {
  color-scheme: light;
  --bg: #f7f7f5; --surface: #ffffff; --surface-2: #fafaf9; --surface-hover: #f2f2f0; --surface-active: #ebebe8;
  --border: #e6e5e1; --border-strong: #d4d3ce;
  --text: #1a1a19; --text-2: #52514e; --text-3: #6f6e69;
  --accent: #8a1c3a; --accent-hover: #741730; --accent-soft: #f8e9ee; --accent-text: #7a1833;
  --danger: #c93534; --danger-soft: #fdeceb; --warn-soft: #fff5e0; --warn-text: #8a5a00; --success: #12805c;
  --series-1: #2a78d6;
  --cat-1: #2a78d6; --cat-2: #eb6834; --cat-3: #1baf7a; --cat-4: #eda100; --cat-5: #e87ba4; --cat-6: #008300; --cat-7: #6250d6; --cat-8: #e34948;
  --shadow: 0 1px 2px rgba(20, 20, 18, .04), 0 4px 16px rgba(20, 20, 18, .08);
  --shadow-lg: 0 10px 44px rgba(20, 20, 18, .2);
  --radius: 8px; --sidebar-w: 240px;
  --tag-gray-bg: #efeeeb; --tag-gray-fg: #4f4e4a; --tag-red-bg: #fde7e6; --tag-red-fg: #a62b2a;
  --tag-orange-bg: #fdeadf; --tag-orange-fg: #a5461d; --tag-yellow-bg: #fbf1d3; --tag-yellow-fg: #7a5600;
  --tag-green-bg: #e1f3e6; --tag-green-fg: #1f6b35; --tag-teal-bg: #dcf3ee; --tag-teal-fg: #136a5a;
  --tag-blue-bg: #e3eefb; --tag-blue-fg: #1d5fb0; --tag-purple-bg: #ece9fb; --tag-purple-fg: #4a3cb0;
  --tag-pink-bg: #fbe7f0; --tag-pink-fg: #a3305e;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141413; --surface: #1b1b1a; --surface-2: #1f1f1e; --surface-hover: #262625; --surface-active: #2e2e2c;
    --border: #2d2d2b; --border-strong: #3c3c39; --text: #f0efec; --text-2: #c3c2b7; --text-3: #9a998f;
    --accent: #c9486a; --accent-hover: #d6607f; --accent-soft: #3a1e27; --accent-text: #f0a3b6;
    --danger: #e66767; --danger-soft: #3a2020; --warn-soft: #3a3119; --warn-text: #ecc760; --success: #3fbf8c; --series-1: #3987e5;
    --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --cat-4: #c98500; --cat-5: #d55181; --cat-6: #008300; --cat-7: #9085e9; --cat-8: #e66767;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.35); --shadow-lg: 0 10px 44px rgba(0,0,0,.6);
    --tag-gray-bg: #2c2c2a; --tag-gray-fg: #cfcec8; --tag-red-bg: #3d2121; --tag-red-fg: #f29a99; --tag-orange-bg: #3d2a1f; --tag-orange-fg: #f2ab83;
    --tag-yellow-bg: #3a3119; --tag-yellow-fg: #ecc760; --tag-green-bg: #1d3325; --tag-green-fg: #86d39d; --tag-teal-bg: #183330; --tag-teal-fg: #7fd4c3;
    --tag-blue-bg: #1d2a3b; --tag-blue-fg: #8cbcf5; --tag-purple-bg: #29253f; --tag-purple-fg: #b5aaf5; --tag-pink-bg: #3a2130; --tag-pink-fg: #f19cc0;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141413; --surface: #1b1b1a; --surface-2: #1f1f1e; --surface-hover: #262625; --surface-active: #2e2e2c;
  --border: #2d2d2b; --border-strong: #3c3c39; --text: #f0efec; --text-2: #c3c2b7; --text-3: #9a998f;
  --accent: #c9486a; --accent-hover: #d6607f; --accent-soft: #3a1e27; --accent-text: #f0a3b6;
  --danger: #e66767; --danger-soft: #3a2020; --warn-soft: #3a3119; --warn-text: #ecc760; --success: #3fbf8c; --series-1: #3987e5;
  --cat-1: #3987e5; --cat-2: #d95926; --cat-3: #199e70; --cat-4: #c98500; --cat-5: #d55181; --cat-6: #008300; --cat-7: #9085e9; --cat-8: #e66767;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.35); --shadow-lg: 0 10px 44px rgba(0,0,0,.6);
  --tag-gray-bg: #2c2c2a; --tag-gray-fg: #cfcec8; --tag-red-bg: #3d2121; --tag-red-fg: #f29a99; --tag-orange-bg: #3d2a1f; --tag-orange-fg: #f2ab83;
  --tag-yellow-bg: #3a3119; --tag-yellow-fg: #ecc760; --tag-green-bg: #1d3325; --tag-green-fg: #86d39d; --tag-teal-bg: #183330; --tag-teal-fg: #7fd4c3;
  --tag-blue-bg: #1d2a3b; --tag-blue-fg: #8cbcf5; --tag-purple-bg: #29253f; --tag-purple-fg: #b5aaf5; --tag-pink-bg: #3a2130; --tag-pink-fg: #f19cc0;
}

/* ------------------------------------------------------------ base */
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 13.5px/1.45 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { margin: 0; }
p { margin: 0 0 8px; }
code { font: 12px ui-monospace, "SF Mono", Menlo, Consolas, monospace; background: var(--surface-hover); padding: 1px 5px; border-radius: 4px; color: var(--text-2); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
svg.i { width: 16px; height: 16px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.muted { color: var(--text-3); }
.small { font-size: 12px; }
.block { display: block; }
.grow { flex: 1; min-width: 0; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.row-gap { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--accent); color: #fff; padding: 8px 12px; border-radius: 6px; }
.skip-link:focus { left: 8px; }
.boot, .loading { display: flex; align-items: center; gap: 10px; padding: 40px; color: var(--text-3); }
.spinner { width: 14px; height: 14px; border: 2px solid var(--border-strong); border-top-color: var(--accent); border-radius: 50%; display: inline-block; animation: spin .7s linear infinite; flex: none; vertical-align: -2px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

#app { display: flex; height: 100vh; }
body.auth-mode #sidebar { display: none; }
body.auth-mode #main { background: var(--bg); overflow-y: auto; }

/* ------------------------------------------------------------ sidebar */
#sidebar { width: var(--sidebar-w); flex: none; display: flex; flex-direction: column; gap: 1px; padding: 10px 8px; border-right: 1px solid var(--border); background: var(--bg); overflow-y: auto; }
.ws-switch { display: flex; align-items: center; gap: 8px; padding: 6px 8px; margin-bottom: 6px; border: 0; background: none; border-radius: 8px; cursor: pointer; text-align: left; font-weight: 650; font-size: 14px; }
.ws-switch:hover { background: var(--surface-hover); }
.ws-name { flex: 1; }
.ws-mark { width: 24px; height: 24px; flex: none; border-radius: 7px; display: grid; place-items: center; font-size: 12px; font-weight: 750; color: #fff; background: var(--accent); }
.ws-mark.c-gray { background: #6f6e69; } .ws-mark.c-red { background: #d23b3a; } .ws-mark.c-orange { background: #d4612b; } .ws-mark.c-yellow { background: #b88400; }
.ws-mark.c-green { background: #1f8a4c; } .ws-mark.c-teal { background: #138a73; } .ws-mark.c-blue { background: #2a78d6; } .ws-mark.c-purple { background: #6250d6; } .ws-mark.c-pink { background: #c4447a; }
.ws-menu-item { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.ws-menu-item .ws-mark { width: 20px; height: 20px; font-size: 11px; }
.search-btn { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding: 6px 8px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--text-3); cursor: pointer; text-align: left; }
.search-btn:hover { border-color: var(--border-strong); }
kbd { font: 11px ui-monospace, monospace; color: var(--text-3); border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: var(--surface); }
.nav-section { font-size: 11px; font-weight: 650; color: var(--text-3); padding: 14px 8px 4px; letter-spacing: .03em; text-transform: uppercase; }
.nav-section.first { padding-top: 2px; }
.nav-item { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 7px; color: var(--text-2); cursor: pointer; border: 0; background: none; width: 100%; text-align: left; min-height: 32px; }
.nav-item:hover { background: var(--surface-hover); color: var(--text); }
.nav-item.active { background: var(--surface-active); color: var(--text); font-weight: 600; }
.nav-item.subtle { color: var(--text-3); }
.nav-item.accent { color: var(--accent-text); }
.nav-item .count, .nav-item .sub { margin-left: auto; font-size: 11px; color: var(--text-3); }
.badge { margin-left: auto; background: var(--accent); color: #fff; font-size: 11px; font-weight: 700; border-radius: 10px; padding: 0 6px; min-width: 18px; text-align: center; line-height: 18px; }
.sidebar-foot { margin-top: auto; padding-top: 10px; display: flex; flex-direction: column; gap: 1px; }
.user-row { margin-top: 4px; border-top: 1px solid var(--border); border-radius: 0 0 7px 7px; padding-top: 10px; }
.role-pill { font-size: 11px; color: var(--text-3); text-transform: capitalize; }

/* ------------------------------------------------------------ main + header */
#main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--surface); outline: none; }
.page-head { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 20px; border-bottom: 1px solid var(--border); }
.page-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.page-title .title-text { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 650; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crumb { display: inline-flex; align-items: center; gap: 6px; color: var(--text-3); font-weight: 500; white-space: nowrap; }
.crumb:hover { color: var(--text); }
.crumb-sep { color: var(--text-3); }
.head-actions { display: flex; align-items: center; gap: 6px; }
.count-pill { font-size: 12px; font-weight: 500; color: var(--text-3); background: var(--surface-hover); border-radius: 10px; padding: 1px 8px; }
.menu-toggle { display: none; }
.page-body { flex: 1; overflow: auto; }
.narrow-page { max-width: 920px; margin: 0 auto; padding: 24px 24px 60px; }

/* ------------------------------------------------------------ buttons & inputs */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 7px; border: 1px solid var(--border); background: var(--surface); color: var(--text-2); cursor: pointer; white-space: nowrap; font-weight: 500; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border-strong); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.primary-soft { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); border-color: transparent; }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.sm { height: 28px; padding: 0 9px; font-size: 12.5px; }
.btn.icon { width: 32px; padding: 0; }
.btn.sm.icon { width: 28px; }
.btn.on { background: var(--accent-soft); color: var(--accent-text); border-color: transparent; }
.btn.block { width: 100%; height: 38px; }
.btn:disabled { opacity: .5; cursor: default; pointer-events: none; }
.link { border: 0; background: none; color: var(--accent-text); cursor: pointer; padding: 0; }
.seg { display: inline-flex; gap: 2px; padding: 2px; border-radius: 8px; background: var(--surface-hover); }
.seg .btn { border-color: transparent; background: transparent; }
.seg .btn.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.seg.small .btn { height: 24px; font-size: 12px; }
.input, select.input, textarea.input { width: 100%; height: 34px; padding: 0 10px; border-radius: 7px; border: 1px solid var(--border-strong); background: var(--surface); outline: none; transition: border-color .12s, box-shadow .12s; }
.input.sm { height: 28px; font-size: 12.5px; padding: 0 8px; }
textarea.input { height: auto; min-height: 80px; padding: 8px 10px; resize: vertical; line-height: 1.5; }
textarea.input.code { font: 13px ui-monospace, Menlo, Consolas, monospace; min-height: 70px; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input:disabled { opacity: .7; background: var(--surface-2); }
.picker-input { display: flex; align-items: center; gap: 6px; text-align: left; cursor: pointer; min-width: 0; overflow: hidden; }
.field-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin: 0 0 5px; }
.req { color: var(--danger); }
.hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.form-row { margin-bottom: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.form-error { display: flex; gap: 8px; align-items: flex-start; color: var(--danger); background: var(--danger-soft); border-radius: 7px; padding: 9px 12px; margin-bottom: 14px; }
.check { width: 16px; height: 16px; accent-color: var(--accent); cursor: pointer; margin: 0; flex: none; }
.check-row { display: flex; align-items: center; gap: 8px; cursor: pointer; min-height: 30px; }
.check-row .block { font-weight: 400; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 40px; }
.pw-toggle { position: absolute; right: 3px; top: 3px; }
details summary { cursor: pointer; color: var(--accent-text); padding: 6px 0; }
.more-fields { margin-top: 4px; }
.more-fields[open] summary { margin-bottom: 10px; }

/* ------------------------------------------------------------ tags, chips, avatars */
.tag { display: inline-flex; align-items: center; gap: 5px; height: 21px; padding: 0 8px; border-radius: 5px; font-size: 12px; font-weight: 550; white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; background: var(--tag-gray-bg); color: var(--tag-gray-fg); }
.tag.c-red { background: var(--tag-red-bg); color: var(--tag-red-fg); } .tag.c-orange { background: var(--tag-orange-bg); color: var(--tag-orange-fg); }
.tag.c-yellow { background: var(--tag-yellow-bg); color: var(--tag-yellow-fg); } .tag.c-green { background: var(--tag-green-bg); color: var(--tag-green-fg); }
.tag.c-teal { background: var(--tag-teal-bg); color: var(--tag-teal-fg); } .tag.c-blue { background: var(--tag-blue-bg); color: var(--tag-blue-fg); }
.tag.c-purple { background: var(--tag-purple-bg); color: var(--tag-purple-fg); } .tag.c-pink { background: var(--tag-pink-bg); color: var(--tag-pink-fg); }
.tag-list, .chip-list { display: inline-flex; gap: 4px; flex-wrap: nowrap; overflow: hidden; max-width: 100%; align-items: center; }
.prop .tag-list, .prop .chip-list, .card .tag-list { flex-wrap: wrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--tag-gray-fg); }
.dot.c-red { background: var(--tag-red-fg); } .dot.c-orange { background: var(--tag-orange-fg); } .dot.c-yellow { background: var(--tag-yellow-fg); }
.dot.c-green { background: var(--tag-green-fg); } .dot.c-teal { background: var(--tag-teal-fg); } .dot.c-blue { background: var(--tag-blue-fg); }
.dot.c-purple { background: var(--tag-purple-fg); } .dot.c-pink { background: var(--tag-pink-fg); }
.chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; height: 23px; padding: 0 8px 0 3px; border-radius: 6px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; }
.chip span:last-child { overflow: hidden; text-overflow: ellipsis; }
a.chip:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.chip.deleted { opacity: .6; text-decoration: line-through; }
.user-chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; max-width: 100%; overflow: hidden; }
.avatar { width: 18px; height: 18px; border-radius: 5px; flex: none; display: inline-grid; place-items: center; font-size: 9px; font-weight: 750; color: #fff; letter-spacing: .02em; }
.avatar.round { border-radius: 50%; }
.avatar.lg { width: 44px; height: 44px; font-size: 17px; border-radius: 11px; }
.avatar.lg.round { border-radius: 50%; }
.ext-link { color: var(--accent-text); overflow: hidden; text-overflow: ellipsis; }
.ext-link:hover { text-decoration: underline; }
.stars { color: var(--border-strong); letter-spacing: 1px; white-space: nowrap; }
.stars .on { color: #e8a200; }
.bool.on { color: var(--success); display: inline-flex; }
.longtext { white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.more { font-size: 12px; }
.mention { color: var(--accent-text); background: var(--accent-soft); border-radius: 4px; padding: 0 3px; font-weight: 550; }

/* ------------------------------------------------------------ view bar & filters */
.viewbar { display: flex; align-items: center; gap: 6px; padding: 8px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.viewbar.flush { padding: 0 0 10px; border: 0; }
.view-tabs { display: flex; align-items: center; gap: 2px; overflow-x: auto; max-width: 100%; scrollbar-width: none; }
.view-tab { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 7px; border: 0; background: none; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.view-tab:hover { background: var(--surface-hover); }
.view-tab.active { background: var(--surface-active); color: var(--text); font-weight: 600; }
.unsaved { display: inline-flex; gap: 4px; align-items: center; padding-right: 6px; border-right: 1px solid var(--border); margin-right: 2px; }
.search-input { position: relative; }
.search-input svg { position: absolute; left: 9px; top: 8px; color: var(--text-3); pointer-events: none; }
.search-input input { height: 30px; width: 220px; padding-left: 30px; }
.filterbar { display: flex; align-items: center; gap: 6px; padding: 7px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; background: var(--surface-2); }
.fb-label { font-size: 12px; }
.filter-chip { display: inline-flex; align-items: center; height: 26px; border-radius: 7px; background: var(--accent-soft); color: var(--accent-text); font-size: 12.5px; max-width: 420px; }
.filter-chip .fc-text { border: 0; background: none; color: inherit; cursor: pointer; padding: 0 4px 0 10px; height: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-chip .x { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; border: 0; background: none; color: inherit; cursor: pointer; margin-right: 2px; }
.filter-chip .x:hover { background: rgba(0,0,0,.08); }
.selection-bar { display: flex; align-items: center; gap: 8px; padding: 7px 20px; background: var(--accent-soft); color: var(--accent-text); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.filter-pop { padding: 10px; max-height: 70vh; overflow: auto; }
.flt-group { display: flex; flex-direction: column; gap: 6px; }
.flt-group.nested { border: 1px solid var(--border); background: var(--surface-2); border-radius: 8px; padding: 8px; }
.flt-head { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 12.5px; }
.flt-head .match { width: auto; }
.flt-row { display: grid; grid-template-columns: minmax(120px, 1.1fr) minmax(120px, 1fr) minmax(140px, 1.4fr) 28px; gap: 6px; align-items: center; }
.flt-row > * { min-width: 0; }
.flt-range, .flt-days, .flt-list { display: flex; align-items: center; gap: 6px; color: var(--text-3); font-size: 12px; min-width: 0; }
.flt-range .input, .flt-days .input { min-width: 0; }
.flt-list .picker-input { flex: 1; }
.flt-empty { font-size: 12.5px; padding: 4px 2px; }
.flt-actions { display: flex; gap: 4px; }
.sort-row { display: grid; grid-template-columns: 1fr 130px 28px; gap: 6px; margin-bottom: 6px; }
.fields-pop { max-height: 420px; overflow-y: auto; }
.field-toggle { cursor: grab; }
.field-toggle .grip { color: var(--text-3); display: inline-flex; }

/* ------------------------------------------------------------ table */
.table-wrap { flex: 1; overflow: auto; position: relative; }
table.grid { border-collapse: separate; border-spacing: 0; min-width: 100%; table-layout: fixed; }
.grid th, .grid td { height: 38px; padding: 0 10px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; vertical-align: middle; background: var(--surface); }
.grid th { position: sticky; top: 0; z-index: 2; height: 36px; padding: 0; font-weight: 550; color: var(--text-2); background: var(--surface-2); }
.grid th .th { display: flex; align-items: center; gap: 6px; width: 100%; height: 100%; padding: 0 10px; border: 0; background: none; color: inherit; cursor: pointer; font-weight: inherit; text-align: left; }
.grid th .th:hover { color: var(--text); background: var(--surface-hover); }
.grid th .th svg { color: var(--text-3); width: 14px; height: 14px; }
.grid th .sort-ind { margin-left: auto; color: var(--accent-text); font-weight: 700; }
.col-resize { position: absolute; right: -3px; top: 0; bottom: 0; width: 7px; cursor: col-resize; z-index: 3; }
.col-resize:hover { background: var(--accent); opacity: .5; }
.grid th.num .th { justify-content: flex-end; }
.grid td.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid .col-chk { width: 44px; padding: 0; text-align: center; position: sticky; left: 0; z-index: 1; }
.grid th.col-chk { z-index: 4; }
.grid .col-name { position: sticky; left: 44px; z-index: 1; font-weight: 600; }
.grid th.col-name { z-index: 4; }
.grid td.col-name { box-shadow: 1px 0 0 var(--border); }
.grid tbody tr:hover td { background: var(--surface-2); }
.grid tr.selected td { background: var(--accent-soft); }
.grid td.editable:hover { box-shadow: inset 0 0 0 1px var(--border-strong); }
.grid td.computed { color: var(--text-2); }
.grid td.editing { padding: 0; box-shadow: inset 0 0 0 2px var(--accent); overflow: visible; }
.grid td.editing input { width: 100%; height: 100%; border: 0; outline: none; padding: 0 10px; background: var(--surface); }
.grid td.editing textarea { position: absolute; z-index: 10; width: 320px; border: 2px solid var(--accent); border-radius: 6px; padding: 8px; background: var(--surface); box-shadow: var(--shadow); }
.name-cell { display: flex; align-items: center; gap: 8px; min-width: 0; }
.name-cell a:not(.btn) { overflow: hidden; text-overflow: ellipsis; }
.name-cell a:not(.btn):hover { text-decoration: underline; }
.name-cell .open { margin-left: auto; opacity: 0; flex: none; }
.grid tr:hover .name-cell .open, .name-cell .open:focus { opacity: 1; }
.grid tfoot td { position: sticky; bottom: 0; background: var(--surface-2); color: var(--text-2); font-size: 12px; z-index: 1; font-variant-numeric: tabular-nums; }
.grid tfoot .col-chk, .grid tfoot .col-name { z-index: 2; }
.add-row { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--text-3); cursor: pointer; padding: 0 2px; height: 100%; }
.add-row:hover { color: var(--text); }
.sentinel td { color: var(--text-3); text-align: left; }
.empty { padding: 56px 20px; text-align: center; color: var(--text-3); display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty-icon { width: 48px; height: 48px; border-radius: 14px; background: var(--surface-hover); display: grid; place-items: center; color: var(--text-3); margin-bottom: 6px; }
.empty-icon svg { width: 22px; height: 22px; }
.empty h3 { color: var(--text); font-size: 15px; }
.empty p { max-width: 420px; }
.empty .btn, .empty .row-gap { margin-top: 8px; }

/* ------------------------------------------------------------ board */
.board { flex: 1; display: flex; gap: 12px; padding: 14px 20px; overflow: auto; align-items: flex-start; background: var(--bg); }
.column { width: 286px; flex: none; display: flex; flex-direction: column; max-height: 100%; }
.column-head { display: flex; align-items: center; gap: 7px; padding: 4px 4px 9px; position: sticky; top: 0; }
.column-head .count { color: var(--text-3); font-size: 12px; }
.column-head .sum { margin-left: auto; font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; font-weight: 600; }
.column-body { display: flex; flex-direction: column; gap: 8px; min-height: 64px; padding: 2px; border-radius: 9px; }
.column-body.drop { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -2px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; cursor: pointer; box-shadow: 0 1px 1px rgba(0,0,0,.03); display: flex; flex-direction: column; gap: 6px; }
.card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.card[draggable="true"] { cursor: grab; }
.card.dragging { opacity: .4; }
.card.drop-before { box-shadow: 0 -3px 0 var(--accent); }
.card-title { font-weight: 600; display: flex; align-items: center; gap: 7px; min-width: 0; }
.card-row { display: flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 12px; min-height: 21px; min-width: 0; }
.card-row .lbl { color: var(--text-3); width: 88px; flex: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-row .val { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; }
.col-add { justify-content: flex-start; color: var(--text-3); margin-top: 4px; }
.load-more { margin-top: 6px; }

/* ------------------------------------------------------------ record page */
.record-body { overflow: hidden; display: flex; }
.record-layout { display: grid; grid-template-columns: 360px minmax(0, 1fr) 320px; flex: 1; min-height: 0; }
.record-side, .record-center, .record-related { overflow-y: auto; min-height: 0; }
.record-side { border-right: 1px solid var(--border); padding: 20px 18px 40px; }
.record-related { border-left: 1px solid var(--border); padding: 18px 16px 40px; background: var(--surface-2); }
.record-center { padding: 20px 28px 60px; background: var(--bg); }
.record-hero { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.hero-text { min-width: 0; flex: 1; }
.record-name { font-size: 20px; font-weight: 700; border-radius: 6px; padding: 1px 6px; margin-left: -6px; cursor: text; word-break: break-word; line-height: 1.3; }
.record-name:hover { background: var(--surface-hover); }
.record-name input { font: inherit; width: 100%; border: 0; outline: 2px solid var(--accent); border-radius: 5px; padding: 0 4px; background: var(--surface); }
.record-meta { display: flex; gap: 8px; align-items: center; color: var(--text-3); font-size: 12.5px; margin-top: 2px; flex-wrap: wrap; }
.consent { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; }
.consent svg { width: 13px; height: 13px; }
.consent.c-subscribed { color: var(--success); }
.consent.c-unsubscribed { color: var(--danger); }
.quick-actions { display: flex; gap: 6px; margin: 4px 0 14px; flex-wrap: wrap; }
.stat-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 8px; }
.stat { background: var(--surface-2); border: 1px solid var(--border); border-radius: 9px; padding: 9px 11px; min-width: 0; }
.stat-v { font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stat-k { font-size: 11.5px; color: var(--text-3); }
.side-title { font-size: 11.5px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; margin: 20px 0 6px; display: flex; align-items: center; gap: 6px; min-height: 26px; }
.side-title.first { margin-top: 0; }
.side-title .btn { margin-left: auto; text-transform: none; letter-spacing: 0; }
.prop-list { display: flex; flex-direction: column; }
.prop { display: grid; grid-template-columns: 128px minmax(0, 1fr); align-items: center; min-height: 34px; gap: 8px; }
.prop .k { color: var(--text-3); display: flex; align-items: center; gap: 7px; overflow: hidden; }
.prop .k svg { width: 14px; height: 14px; }
.prop .v { padding: 4px 7px; border-radius: 6px; min-height: 30px; display: flex; align-items: center; min-width: 0; overflow: hidden; cursor: pointer; }
.prop .v:hover { background: var(--surface-hover); }
.prop .v.computed, .prop .v.static { cursor: default; color: var(--text-2); }
.prop .v.computed:hover, .prop .v.static:hover { background: none; }
.prop .v.editing { padding: 0; background: none; overflow: visible; }
.prop .v input:not(.check), .prop .v textarea { width: 100%; height: 30px; border: 1px solid var(--accent); outline: none; border-radius: 6px; padding: 0 7px; background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.prop .v textarea { height: 90px; padding: 6px; resize: vertical; }
.prop .placeholder { color: var(--text-3); }
.meta-props .v { font-size: 12.5px; }
.banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 9px; margin-bottom: 14px; }
.banner.warn { background: var(--warn-soft); color: var(--warn-text); }
.banner.info { background: var(--accent-soft); color: var(--accent-text); }
.banner .btn { margin-left: auto; }

.composer { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; margin-bottom: 22px; box-shadow: var(--shadow); overflow: hidden; }
.composer-tabs { display: flex; gap: 2px; padding: 6px 8px 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
.composer-tab { flex: none; display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 8px 10px; border-bottom: 2px solid transparent; color: var(--text-2); cursor: pointer; }
.composer-tab.active { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.composer-body textarea { border: 0; width: 100%; min-height: 84px; padding: 12px 14px; resize: vertical; outline: none; background: transparent; line-height: 1.5; display: block; }
.composer-input { border: 0; border-bottom: 1px solid var(--border); width: 100%; height: 42px; padding: 0 14px; outline: none; background: transparent; font-size: 14px; }
.composer-input.sm { height: 34px; font-size: 13px; border: 0; padding: 0 6px; }
.email-row { display: flex; align-items: center; gap: 8px; padding: 0 8px 0 14px; border-bottom: 1px solid var(--border); }
.email-row select { width: auto; max-width: 240px; }
.composer-note { padding: 0 14px; font-size: 12.5px; }
.composer-note:empty { display: none; }
.composer-note > * { display: block; padding: 6px 0; }
.warn-text { color: var(--warn-text); }
.composer-foot { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--border); background: var(--surface-2); }
.composer-foot.wrap { flex-wrap: wrap; }
.composer-foot input[type=date] { width: auto; }
.quick-dates { display: inline-flex; gap: 2px; }
.mention-pop { padding: 2px; }

.tl-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.timeline { display: flex; flex-direction: column; }
.tl-day { font-size: 12px; font-weight: 650; color: var(--text-3); margin: 16px 0 6px; }
.tl-item { display: flex; gap: 12px; padding: 5px 0; position: relative; }
.tl-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); z-index: 1; }
.tl-icon svg { width: 14px; height: 14px; }
.tl-item:not(:last-child)::before { content: ''; position: absolute; left: 13.5px; top: 34px; bottom: -6px; width: 1px; background: var(--border); }
.tl-item.system .tl-content { padding-top: 0; }
.tl-content { flex: 1; min-width: 0; }
.tl-line { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; color: var(--text-2); min-height: 28px; }
.tl-line b { color: var(--text); font-weight: 600; }
.tl-time { margin-left: auto; color: var(--text-3); font-size: 12px; white-space: nowrap; }
.tl-card { margin-top: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 10px 12px; position: relative; word-break: break-word; }
.tl-text { white-space: pre-wrap; }
.tl-actions { position: absolute; top: 4px; right: 4px; display: none; gap: 2px; background: var(--surface); border-radius: 6px; }
.tl-card:hover .tl-actions, .tl-card:focus-within .tl-actions { display: flex; }
.email-subject { font-weight: 650; margin-bottom: 4px; }
.email-body { white-space: pre-wrap; color: var(--text-2); max-height: 220px; overflow: hidden; }
.open-tasks { margin-bottom: 18px; }
.task-line { display: flex; align-items: center; gap: 10px; padding: 7px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; margin-bottom: 6px; min-width: 0; }
.tl-card.task .task-line { border: 0; padding: 0; margin: 0; }
.task-line.done .grow { text-decoration: line-through; color: var(--text-3); }
.due-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-2); white-space: nowrap; }
.due-pill svg { width: 13px; height: 13px; }
.overdue, .due-pill.overdue { color: var(--danger) !important; }
.load-older { margin: 10px 0 0 40px; }

.related-group { margin-bottom: 18px; }
.rg-head { display: flex; align-items: center; gap: 7px; margin: 0 0 6px; font-size: 12.5px; color: var(--text-2); font-weight: 650; }
.rg-head .count { color: var(--text-3); font-weight: 500; }
.rg-empty { padding-left: 2px; }
.related-item { display: flex; align-items: center; gap: 9px; padding: 8px 10px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; margin-bottom: 6px; min-width: 0; }
.related-item:hover { border-color: var(--border-strong); }
.ri-main { min-width: 0; flex: 1; }
.ri-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ri-sub { font-size: 12px; color: var(--text-3); overflow: hidden; white-space: nowrap; display: flex; gap: 8px; align-items: center; margin-top: 2px; }

/* ------------------------------------------------------------ dashboards & charts */
.dash { padding: 20px 24px 60px; max-width: 1360px; margin: 0 auto; }
.dash-hello { margin-bottom: 14px; }
.dash-hello h2 { font-size: 20px; }
.dash-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.widget { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; min-width: 0; display: flex; flex-direction: column; }
.widget.size-sm { grid-column: span 1; }
.widget.size-md { grid-column: span 2; }
.widget.size-lg { grid-column: span 4; }
.widget-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; min-height: 26px; }
.widget-head h3 { font-size: 13px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.widget.kpi .widget-head h3 { font-weight: 550; color: var(--text-2); }
.widget-meta { font-size: 12px; white-space: nowrap; }
.widget-menu { opacity: 0; }
.widget:hover .widget-menu, .widget-menu:focus { opacity: 1; }
.widget-body { flex: 1; min-height: 40px; position: relative; }
.kpi-value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1.15; }
.kpi-foot { display: flex; align-items: center; gap: 4px; margin-top: 8px; border: 0; background: none; color: var(--text-3); font-size: 12px; cursor: pointer; padding: 0; text-align: left; overflow: hidden; }
.kpi-foot:hover { color: var(--accent-text); }
.kpi-foot svg { width: 13px; height: 13px; flex: none; }
.add-widget { border-style: dashed; align-items: center; justify-content: center; gap: 8px; color: var(--text-3); cursor: pointer; flex-direction: row; min-height: 110px; background: transparent; }
.add-widget:hover { color: var(--accent-text); border-color: var(--accent); }
.skeleton { height: 70px; border-radius: 8px; background: linear-gradient(90deg, var(--surface-hover), var(--surface-2), var(--surface-hover)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.chart-empty { color: var(--text-3); font-size: 12.5px; padding: 18px 0; text-align: center; }
.chart-empty.error { color: var(--danger); }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 10px; font-size: 12px; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.hbars { display: flex; flex-direction: column; gap: 3px; }
.hbar-row { display: grid; grid-template-columns: minmax(80px, 30%) minmax(0, 1fr) 76px; align-items: center; gap: 10px; padding: 3px 4px; border-radius: 6px; }
.hbar-row.clickable { cursor: pointer; }
.hbar-row:hover { background: var(--surface-hover); }
.hbar-label { color: var(--text-2); display: flex; align-items: center; gap: 6px; min-width: 0; font-size: 12.5px; }
.hbar-track { height: 16px; display: flex; align-items: center; gap: 2px; }
.hbar-seg { height: 14px; min-width: 2px; }
.hbar-seg:last-child { border-radius: 0 4px 4px 0; }
.hbar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 12.5px; }
.chart-svg { display: block; overflow: visible; }
.chart-svg .grid { stroke: var(--border); stroke-width: 1; }
.chart-svg .axis { stroke: var(--border-strong); stroke-width: 1; }
.chart-svg .tick { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-svg .line { fill: none; stroke: var(--series-1); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .area { fill: var(--series-1); opacity: .08; }
.chart-svg .crosshair { stroke: var(--text-3); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-svg .line-dot { fill: var(--series-1); stroke: var(--surface); stroke-width: 2; }
.ranked { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ranked td { padding: 6px 4px; border-bottom: 1px solid var(--border); }
.ranked tr:last-child td { border-bottom: 0; }
.ranked .rank { color: var(--text-3); width: 22px; font-variant-numeric: tabular-nums; }
.ranked .name { max-width: 0; width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.ranked .name a:hover { text-decoration: underline; }
.ranked .bar-cell { width: 35%; }
.mini-bar { display: block; height: 8px; border-radius: 0 3px 3px 0; background: var(--series-1); min-width: 2px; }
.ranked .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.tooltip { position: fixed; z-index: 100; pointer-events: none; background: var(--text); color: var(--surface); padding: 7px 10px; border-radius: 7px; font-size: 12px; box-shadow: var(--shadow); max-width: 280px; line-height: 1.5; }
.tip-row { display: flex; align-items: center; gap: 6px; }
.tip-total { margin-top: 3px; padding-top: 3px; border-top: 1px solid rgba(127,127,127,.4); font-weight: 600; }
.builder .modal-body { padding: 0; }
.builder-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); min-height: 420px; }
.builder-form { padding: 16px 18px; border-right: 1px solid var(--border); overflow-y: auto; max-height: 68vh; }
.builder-side { padding: 16px 18px; background: var(--surface-2); }
.builder-preview { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px; min-height: 200px; }
.builder-filter { border: 1px solid var(--border); border-radius: 9px; padding: 10px; background: var(--surface-2); }
.chart-types { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.chart-type { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; color: var(--text-2); }
.chart-type.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }

/* ------------------------------------------------------------ tasks & inbox */
.task-new { display: grid; grid-template-columns: minmax(200px, 1fr) 150px auto auto auto; gap: 8px; margin-bottom: 22px; align-items: center; }
.task-new .btn { max-width: 220px; overflow: hidden; }
.task-group h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin: 20px 0 8px; display: flex; gap: 8px; }
.task-group h2 .count { font-weight: 500; }
.task-group h2.overdue { color: var(--danger); }
.task-row { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 9px; margin-bottom: 6px; background: var(--surface); min-width: 0; }
.task-row:hover { border-color: var(--border-strong); }
.task-row.done .task-title { text-decoration: line-through; color: var(--text-3); }
.task-main { flex: 1; min-width: 0; }
.task-title { word-break: break-word; }
.task-sub { display: flex; gap: 8px; align-items: center; margin-top: 4px; }
.task-row .due input { border: 0; background: transparent; color: inherit; font-size: 12.5px; width: 130px; }
.task-del { opacity: 0; }
.task-row:hover .task-del, .task-del:focus { opacity: 1; }
.inbox .tl-day:first-child { margin-top: 0; }
.notif { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 9px; border: 1px solid transparent; position: relative; }
.notif:hover { background: var(--surface-hover); }
.notif.unread { background: var(--accent-soft); }
.notif .avatar { width: 30px; height: 30px; font-size: 12px; }
.notif-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-hover); color: var(--text-2); flex: none; }
.notif-main { flex: 1; min-width: 0; }
.notif-title { font-weight: 550; }
.notif-body { color: var(--text-2); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }

/* ------------------------------------------------------------ workflows */
.wf-list { display: flex; flex-direction: column; gap: 10px; }
.wf-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.wf-card:hover { border-color: var(--border-strong); }
.wf-card.off { opacity: .65; }
.wf-icon { width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft); color: var(--accent-text); display: grid; place-items: center; flex: none; }
.wf-main { flex: 1; min-width: 0; }
.wf-name { font-weight: 650; }
.wf-sub { color: var(--text-2); font-size: 12.5px; margin: 2px 0 6px; }
.wf-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.wf-action-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; color: var(--text-2); background: var(--surface-hover); border-radius: 5px; padding: 2px 7px; }
.wf-action-pill svg { width: 12px; height: 12px; }
.wf-stats { white-space: nowrap; }
.switch { position: relative; display: inline-flex; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch .slider { position: absolute; inset: 0; background: var(--border-strong); border-radius: 20px; transition: background .15s; }
.switch .slider::after { content: ''; position: absolute; width: 16px; height: 16px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::after { transform: translateX(16px); }
.switch input:focus-visible + .slider { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-row { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; font-weight: 550; }
.wf-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 0; min-height: 100%; }
.wf-editor { padding: 22px 28px 60px; max-width: 820px; }
.wf-side { border-left: 1px solid var(--border); padding: 20px; background: var(--surface-2); }
.wf-name-input { font-size: 17px; font-weight: 650; height: 42px; }
.wf-step { display: flex; gap: 14px; margin-bottom: 18px; }
.wf-step-num { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; margin-top: 2px; }
.wf-step-body { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.wf-step-body h2 { font-size: 14px; margin-bottom: 12px; }
.wf-action-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.wf-action { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--surface-2); }
.wf-action-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.option-checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.values-editor { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.value-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; width: 100%; }
.value-field { font-weight: 550; font-size: 12.5px; color: var(--text-2); }
.token-input { display: flex; gap: 6px; align-items: flex-start; }
.token-input .input { flex: 1; }
.disabled-block { pointer-events: none; opacity: .75; }
.run-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.run-error { flex-basis: 100%; color: var(--danger); font-size: 12px; }

/* ------------------------------------------------------------ settings */
.settings { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: 100%; }
.settings-nav { border-right: 1px solid var(--border); padding: 16px 8px; background: var(--surface-2); }
.settings-main { padding: 24px 32px 60px; max-width: 1040px; min-width: 0; }
.sec-head { display: flex; align-items: flex-end; gap: 10px; margin: 26px 0 12px; flex-wrap: wrap; }
.sec-head:first-child { margin-top: 0; }
.sec-head h2 { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.sec-head p { margin: 4px 0 0; max-width: 640px; }
.card-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; overflow: hidden; }
.card-panel.pad { padding: 16px 18px; }
.card-head { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 35%, var(--border)); }
.plain-table { width: 100%; border-collapse: collapse; }
.plain-table th { text-align: left; font-weight: 550; color: var(--text-3); font-size: 12px; padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); }
.plain-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.plain-table tr:last-child td { border-bottom: 0; }
.plain-table tr.clickable { cursor: pointer; }
.plain-table tr.clickable:hover td { background: var(--surface-2); }
.plain-table td.chk { width: 36px; }
.fields-table tr[draggable="true"] { cursor: grab; }
.fields-table tr.dragging { opacity: .4; }
.fields-table tr.drop-before td { box-shadow: inset 0 2px 0 var(--accent); }
.fields-table .grip-cell { width: 28px; color: var(--text-3); }
.details-cell { max-width: 340px; }
.outcome { opacity: .8; }
.model-layout { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 20px; }
.obj-nav { display: flex; flex-direction: column; gap: 1px; }
.model-main { min-width: 0; }
.role-legend { margin-top: 14px; display: grid; gap: 4px; color: var(--text-2); font-size: 12.5px; }
.invite-result { margin-top: 12px; padding: 12px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.invite-result .row-gap { flex-wrap: nowrap; }
.color-picks { display: flex; gap: 8px; flex-wrap: wrap; }
.color-pick { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; background: var(--tag-gray-fg); }
.color-pick.on { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); }
.color-pick.c-red { background: #d23b3a; } .color-pick.c-orange { background: #d4612b; } .color-pick.c-yellow { background: #b88400; } .color-pick.c-green { background: #1f8a4c; }
.color-pick.c-teal { background: #138a73; } .color-pick.c-blue { background: #2a78d6; } .color-pick.c-purple { background: #6250d6; } .color-pick.c-pink { background: #c4447a; } .color-pick.c-gray { background: #6f6e69; }
.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, 38px); gap: 6px; }
.icon-grid button { width: 38px; height: 38px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--text-2); }
.icon-grid button.on { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-text); }
.type-group { margin-bottom: 12px; }
.type-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.type-card { display: flex; gap: 10px; align-items: flex-start; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.type-card:hover { border-color: var(--accent); background: var(--accent-soft); }
.tc-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-hover); color: var(--text-2); flex: none; }
.type-banner { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); margin-bottom: 16px; }
.opt-editor { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.opt-row { display: flex; gap: 6px; align-items: center; width: 100%; }
.opt-row > .input:nth-child(2) { flex: 1; min-width: 120px; }
.opt-row > select { width: 120px; flex: none; }
.token-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.chip-btn { border: 1px solid var(--border); background: var(--surface-2); border-radius: 6px; padding: 2px 8px; font-size: 12px; cursor: pointer; color: var(--text-2); }
.chip-btn:hover { border-color: var(--accent); color: var(--accent-text); }
.provider-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.provider-card { text-align: left; padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; }
.provider-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.provider-card p { margin: 6px 0 0; }
.help-box { background: var(--surface-2); border-radius: 9px; padding: 4px 12px; margin-bottom: 14px; }
.help-box ol { margin: 4px 0 10px; padding-left: 20px; color: var(--text-2); }
.template-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; }
.email-preview .email-body { max-height: none; }
.email-preview .email-subject { margin-top: 8px; font-size: 15px; }
.audit-row { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.audit-row:last-child { border-bottom: 0; }
.dupe-group { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; background: var(--surface); }
.dupe-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.dupe-records { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.merge-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.merge-table th, .merge-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.merge-table thead th { background: var(--surface-2); }
.merge-table tbody th { color: var(--text-2); font-weight: 550; white-space: nowrap; }
.table-scroll { overflow-x: auto; }
.import-map { width: 100%; border-collapse: collapse; }
.import-map th { text-align: left; font-size: 12px; color: var(--text-3); padding: 6px; border-bottom: 1px solid var(--border); }
.import-map td { padding: 6px; border-bottom: 1px solid var(--border); max-width: 220px; }
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 36px 20px; border: 2px dashed var(--border-strong); border-radius: 12px; cursor: pointer; text-align: center; color: var(--text-2); margin-bottom: 10px; }
.dropzone.over, .dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone svg { width: 26px; height: 26px; }
.error-list { margin: 0; padding-left: 18px; max-height: 300px; overflow: auto; }

/* ------------------------------------------------------------ auth */
.auth-wrap { flex: none; min-height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px 16px; gap: 18px; }
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; }
.brand-mark { width: 30px; height: 30px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 800; }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 28px; box-shadow: var(--shadow); }
.auth-card:has(form.wide) { max-width: 760px; }
.auth-card h1 { font-size: 21px; margin-bottom: 6px; }
.auth-card > p, .auth-card form > p { margin-bottom: 18px; }
.auth-links { display: flex; justify-content: space-between; gap: 10px; margin-top: 16px; font-size: 13px; }
.auth-links a { color: var(--accent-text); }
.auth-foot { font-size: 12px; }
.stepper { display: flex; gap: 14px; font-size: 12px; color: var(--text-3); margin-bottom: 14px; }
.stepper .on { color: var(--accent-text); font-weight: 650; }
.template-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.template-card { text-align: left; padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; display: flex; flex-direction: column; gap: 6px; }
.template-card:hover { border-color: var(--border-strong); }
.template-card.on { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.tc-head { display: flex; align-items: center; gap: 8px; }
.tc-check { margin-left: auto; color: var(--accent); }
.template-card p { font-size: 12.5px; color: var(--text-2); margin: 0; }
.template-card ul { margin: 2px 0 0; padding-left: 16px; font-size: 12px; color: var(--text-3); }
.template-card.on .tc-icon { background: var(--accent-soft); color: var(--accent-text); }

/* ------------------------------------------------------------ overlays */
.popover { position: fixed; z-index: 70; min-width: 200px; max-width: min(680px, calc(100vw - 16px)); max-height: min(440px, calc(100vh - 16px)); overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 11px; box-shadow: var(--shadow-lg); padding: 4px; }
.pop-search { display: flex; align-items: center; gap: 6px; padding: 2px 8px; border-bottom: 1px solid var(--border); margin: -4px -4px 4px; color: var(--text-3); position: sticky; top: -4px; background: var(--surface); z-index: 1; }
.pop-search input { border: 0; outline: none; width: 100%; height: 36px; background: transparent; }
.picker-list { display: flex; flex-direction: column; }
.menu-item { display: flex; align-items: center; gap: 9px; width: 100%; padding: 6px 9px; border-radius: 7px; border: 0; background: none; cursor: pointer; text-align: left; color: var(--text); min-height: 32px; min-width: 0; }
.menu-item:hover, .menu-item.hl, .menu-item:focus { background: var(--surface-hover); outline: none; }
.menu-item .sub { margin-left: auto; color: var(--text-3); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 55%; flex: none; }
.menu-item.danger { color: var(--danger); }
.menu-item .tick { margin-left: auto; color: var(--accent-text); display: inline-flex; }
.menu-item:disabled { color: var(--text-3); cursor: default; }
.menu-sep { height: 1px; background: var(--border); margin: 4px 0; }
.menu-label { font-size: 11px; color: var(--text-3); padding: 7px 9px 3px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.menu-empty { color: var(--text-3); padding: 10px; text-align: center; font-size: 12.5px; }
.pop-form { padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.rating-pick { display: flex; align-items: center; gap: 2px; padding: 6px; }
.rating-pick .star { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--border-strong); padding: 0 2px; }
.rating-pick .star.on, .rating-pick .star:hover { color: #e8a200; }

.modal-backdrop { position: fixed; inset: 0; z-index: 60; background: rgba(15, 15, 14, .45); display: grid; place-items: start center; padding: 8vh 16px 16px; overflow-y: auto; animation: fade .12s ease-out; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 540px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--border); animation: pop .14s ease-out; }
@keyframes pop { from { transform: translateY(6px) scale(.99); opacity: 0; } }
.modal.sm { max-width: 440px; }
.modal.lg { max-width: 760px; }
.modal.xl { max-width: 1080px; }
.modal-head { display: flex; align-items: center; gap: 8px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.modal-title { display: flex; align-items: center; gap: 8px; font-weight: 650; font-size: 15px; flex: 1; min-width: 0; }
.modal-body { padding: 18px; max-height: 68vh; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 14px 14px; }
.confirm-text { margin: 0; color: var(--text-2); line-height: 1.55; }

.palette { max-width: 620px; overflow: hidden; }
.palette-bar { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); color: var(--text-3); }
.palette-input { border: 0; outline: none; height: 54px; flex: 1; font-size: 15.5px; background: transparent; color: var(--text); }
.palette-results { max-height: 420px; overflow-y: auto; padding: 6px; }
.palette .menu-item { min-height: 38px; }
.palette-foot { display: flex; gap: 16px; padding: 8px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); background: var(--surface-2); }

#toasts { position: fixed; bottom: 16px; right: 16px; z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { display: flex; align-items: center; gap: 12px; background: var(--text); color: var(--surface); padding: 10px 14px; border-radius: 9px; box-shadow: var(--shadow); max-width: 420px; animation: toast-in .18s ease-out; }
.toast.error { background: var(--danger); color: #fff; }
.toast-action { border: 0; background: rgba(255,255,255,.18); color: inherit; border-radius: 6px; padding: 3px 9px; cursor: pointer; font-weight: 650; }
:root[data-theme="dark"] .toast-action { background: rgba(0,0,0,.12); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1240px) {
  .record-layout { grid-template-columns: 330px minmax(0, 1fr); }
  .record-related { grid-column: 1 / -1; border-left: 0; border-top: 1px solid var(--border); }
  .record-body { overflow: auto; display: block; }
  .record-layout { min-height: auto; }
  .record-side, .record-center, .record-related { overflow: visible; }
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .widget.size-lg { grid-column: span 2; }
}
@media (max-width: 980px) {
  .wf-layout { grid-template-columns: minmax(0, 1fr); }
  .wf-side { border-left: 0; border-top: 1px solid var(--border); }
  .builder-layout { grid-template-columns: minmax(0, 1fr); }
  .builder-form { border-right: 0; border-bottom: 1px solid var(--border); max-height: none; }
  .model-layout { grid-template-columns: minmax(0, 1fr); }
  .obj-nav { flex-direction: row; flex-wrap: wrap; }
  .obj-nav .nav-item { width: auto; }
  .template-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 800px) {
  #sidebar { position: fixed; inset: 0 auto 0 0; z-index: 50; transform: translateX(-100%); transition: transform .18s; box-shadow: var(--shadow-lg); background: var(--surface); }
  body.nav-open #sidebar { transform: none; }
  .menu-toggle { display: inline-flex; }
  .page-head { padding: 8px 16px; gap: 6px; }
  .viewbar, .filterbar, .selection-bar { padding-left: 16px; padding-right: 16px; }
  .search-input { flex: 1 1 100%; order: 5; }
  .search-input input { width: 100%; }
  .record-layout { grid-template-columns: minmax(0, 1fr); }
  .record-side { border-right: 0; border-bottom: 1px solid var(--border); }
  .record-center { padding: 16px; }
  .dash { padding: 16px; }
  .dash-grid { grid-template-columns: minmax(0, 1fr); }
  .widget.size-sm, .widget.size-md, .widget.size-lg { grid-column: span 1; }
  .settings { grid-template-columns: minmax(0, 1fr); }
  .settings-nav { display: flex; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 6px; gap: 2px; }
  .settings-nav .nav-section { display: none; }
  .settings-nav .nav-item { width: auto; flex: none; }
  .settings-main { padding: 16px; }
  .narrow-page { padding: 16px; }
  .form-grid, .template-grid, .provider-grid, .type-grid { grid-template-columns: minmax(0, 1fr); }
  .task-new { grid-template-columns: 1fr 1fr; }
  .task-new .input:first-child { grid-column: 1 / -1; }
  .flt-row { grid-template-columns: 1fr 1fr; }
  .value-row { grid-template-columns: minmax(0, 1fr) auto; }
  .value-row .value-field { grid-column: 1 / -1; }
  .wf-editor { padding: 16px; }
  .wf-card { flex-wrap: wrap; }
  .audit-row { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .hide-sm { display: none !important; }
  .modal-backdrop { padding: 16px 8px; }
  .auth-card { padding: 20px; }
  .head-actions .btn span { display: none; }
  .head-actions .btn.primary span { display: inline; }
}
@media (hover: none) {
  .name-cell .open, .widget-menu, .task-del { opacity: 1; }
  .tl-card .tl-actions { display: flex; position: static; margin-top: 6px; }
}
@media (forced-colors: active) {
  .hbar-seg, .mini-bar, .swatch { forced-color-adjust: none; }
}

/* ------------------------------------------------------------ v2.1: panel, files, snapshot, insights, settings */
.side-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(540px, 100vw); z-index: 55; background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg); animation: slide-in .16s ease-out; display: flex; }
@keyframes slide-in { from { transform: translateX(24px); opacity: 0; } }
.side-panel-inner { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.panel-head { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.panel-scroll { flex: 1; overflow-y: auto; padding: 18px 20px 40px; }
.panel-scroll .composer { margin-top: 4px; }
.grid tr.peek td, .card.peek { background: var(--accent-soft) !important; }
.fav.on { color: #e8a200; }
.fav.on svg, .fav-dot svg { fill: currentColor; }
.fav-dot { color: #e8a200; display: inline-flex; }
.fav-dot svg { width: 12px; height: 12px; }
.fav-item .avatar { width: 16px; height: 16px; font-size: 8px; }
.grid td:focus { outline: 2px solid var(--accent); outline-offset: -2px; }
.drop-files { outline: 2px dashed var(--accent); outline-offset: -6px; background: var(--accent-soft); }
.files-block { margin-bottom: 8px; }
.files-block .side-title { margin-top: 0; }
.file-list { display: flex; flex-direction: column; gap: 6px; }
.file-item { display: flex; align-items: center; gap: 10px; padding: 7px 9px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; min-width: 0; }
.file-thumb { width: 34px; height: 34px; border-radius: 7px; background: var(--surface-hover); display: grid; place-items: center; overflow: hidden; flex: none; color: var(--text-3); }
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-name { display: block; font-weight: 550; }
.file-name:hover { text-decoration: underline; }
.file-empty { padding: 2px 2px 8px; }
.snapshot { margin-bottom: 10px; }
.snap-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.tag.big { height: 26px; font-size: 13px; padding: 0 10px; }
.churn { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); }
.churn .dot { width: 8px; height: 8px; }
.churn.c-low .dot { background: var(--tag-green-fg); } .churn.c-medium .dot { background: var(--tag-yellow-fg); } .churn.c-high .dot { background: var(--tag-red-fg); }
.churn.c-high { color: var(--tag-red-fg); font-weight: 600; }
.snap-help { color: var(--text-2); font-size: 12.5px; margin-bottom: 10px; }
.snap-rows { display: grid; gap: 4px; margin: 4px 0 10px; font-size: 12.5px; }
.snap-rows > div { display: grid; grid-template-columns: 150px auto 1fr; gap: 8px; align-items: baseline; }
.rfm { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 8px; }
.rfm-meter { display: flex; align-items: center; gap: 6px; }
.rfm-k { font-size: 11px; font-weight: 700; color: var(--text-3); width: 10px; }
.pips { display: inline-flex; gap: 2px; }
.pips span { width: 12px; height: 6px; border-radius: 2px; background: var(--border); }
.pips span.on { background: var(--series-1); }
.wf-action.branch { background: var(--surface); }
.wf-action.wait { border-style: dashed; }
.branch-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 10px; }
.branch-col { border-radius: 9px; padding: 8px; background: var(--surface-2); border: 1px solid var(--border); min-width: 0; }
.branch-col.yes { border-left: 3px solid var(--tag-green-fg); }
.branch-col.no { border-left: 3px solid var(--border-strong); }
.branch-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin-bottom: 6px; }
.branch-empty { padding: 4px 2px 8px; }
.wf-action-list.nested { gap: 8px; }
.wf-action-list.nested .wf-action { padding: 10px; }
.wf-action-pill.flow { background: var(--accent-soft); color: var(--accent-text); }
.run-note { flex-basis: 100%; color: var(--accent-text); font-size: 12px; display: flex; align-items: center; gap: 4px; }
.run-note svg { width: 13px; height: 13px; }
.map-row { grid-template-columns: 130px minmax(0, 1fr) 0 auto; }
.mono, .input.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12.5px; }
.copy-field { display: flex; gap: 6px; align-items: center; }
.copy-field .input { flex: 1; min-width: 0; }
.steps { margin: 0 0 14px; padding-left: 20px; color: var(--text-2); line-height: 1.6; }
.conn-list { display: flex; flex-direction: column; gap: 8px; }
.conn-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.conn-logo { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }
.import-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.import-card:last-child { border-bottom: 0; }
.import-card p { margin: 2px 0; }
.success-text { color: var(--success); display: inline-flex; align-items: center; gap: 4px; }
.scoring-summary { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.scoring-summary b { font-size: 16px; }
.events-list { max-height: 260px; overflow-y: auto; }
.provider-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.api-docs p { color: var(--text-2); }
.code-example { border: 1px solid var(--border); border-radius: 9px; margin: 10px 0; overflow: hidden; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 4px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: 12px; font-weight: 600; color: var(--text-2); }
.code-example pre { margin: 0; padding: 10px 12px; overflow-x: auto; font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; }
.endpoint-list { display: grid; gap: 4px; margin-top: 12px; }
.endpoint { display: grid; grid-template-columns: 62px minmax(180px, auto) 1fr; gap: 10px; align-items: center; }
.method { font: 700 10.5px ui-monospace, monospace; border-radius: 4px; padding: 2px 0; text-align: center; background: var(--tag-gray-bg); color: var(--tag-gray-fg); }
.method.m-get { background: var(--tag-blue-bg); color: var(--tag-blue-fg); } .method.m-post { background: var(--tag-green-bg); color: var(--tag-green-fg); }
.method.m-patch { background: var(--tag-yellow-bg); color: var(--tag-yellow-fg); } .method.m-delete { background: var(--tag-red-bg); color: var(--tag-red-fg); }
.access-summary { display: flex; flex-wrap: wrap; gap: 4px; }
.access-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11.5px; border-radius: 5px; padding: 1px 6px; background: var(--tag-gray-bg); color: var(--tag-gray-fg); }
.access-pill svg { width: 12px; height: 12px; }
.access-pill.a-none { opacity: .45; text-decoration: line-through; } .access-pill.a-read { background: var(--tag-blue-bg); color: var(--tag-blue-fg); }
.access-pill.a-edit { background: var(--tag-green-bg); color: var(--tag-green-fg); } .access-pill.a-full { background: var(--tag-purple-bg); color: var(--tag-purple-fg); }
.access-table th.center, .access-table td.center, .cohort .center { text-align: center; }
.tfa { align-items: center; flex-wrap: nowrap; }
.tfa-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-hover); color: var(--text-3); flex: none; }
.tfa-icon.on { background: var(--tag-green-bg); color: var(--tag-green-fg); }
.tfa-setup { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 18px; align-items: start; margin-bottom: 8px; }
.qr-box { background: #fff; border-radius: 10px; padding: 4px; border: 1px solid var(--border); }
.qr { display: block; width: 100%; height: auto; }
.code-input { font: 600 20px ui-monospace, monospace; letter-spacing: .12em; height: 44px; text-align: center; }
.recovery-codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin: 12px 0; }
.recovery-codes code { font-size: 14px; padding: 6px; text-align: center; }
.shortcuts { display: grid; gap: 8px; }
.shortcut { display: grid; grid-template-columns: 110px 1fr; align-items: center; gap: 10px; }
.shortcut kbd { justify-self: start; font-size: 12px; padding: 1px 6px; }
.ins { padding: 20px 24px 60px; max-width: 1360px; margin: 0 auto; display: flex; flex-direction: column; gap: 14px; }
.ins-kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.ins-kpi { text-align: left; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; min-width: 0; font: inherit; color: inherit; }
.ins-kpi.clickable { cursor: pointer; }
.ins-kpi.clickable:hover { border-color: var(--accent); }
.ins-kpi-label { font-size: 12px; color: var(--text-2); font-weight: 550; }
.ins-kpi-value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; display: flex; align-items: baseline; gap: 8px; margin: 2px 0; white-space: nowrap; }
.ins-kpi-sub { font-size: 12px; color: var(--text-3); }
.delta { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; font-weight: 600; }
.delta svg { width: 12px; height: 12px; }
.delta.up { color: var(--success); }
.delta.down { color: var(--danger); }
.ins-panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; min-width: 0; }
.ins-panel-head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 10px; }
.ins-panel-head h2 { font-size: 14px; }
.ins-panel-head p { margin: 2px 0 0; }
.ins-two { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; }
.ins-stack { display: flex; flex-direction: column; gap: 14px; }
.ins-chart { width: 100%; }
.seg-bars .hbar-row { grid-template-columns: minmax(120px, 34%) minmax(0, 1fr) minmax(120px, auto); }
.mini-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(100px, 1fr)); gap: 10px; }
.mini-stats > * { display: flex; flex-direction: column; text-align: left; gap: 2px; }
.mini-stats b { font-size: 18px; font-variant-numeric: tabular-nums; }
.cohort { border-collapse: separate; border-spacing: 2px; font-size: 12px; width: 100%; }
.cohort th { font-weight: 550; color: var(--text-3); padding: 4px 6px; text-align: left; white-space: nowrap; }
.cohort td { padding: 0 6px; height: 28px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cohort td.cell { text-align: center; border-radius: 4px; color: var(--text); min-width: 42px; }
.cohort td.cell.strong { color: #fff; font-weight: 600; }
.cohort td.cell.empty { background: var(--surface-2); }
.ins-help ul { margin: 6px 0 8px; padding-left: 18px; color: var(--text-2); line-height: 1.6; }
@media (max-width: 1240px) { .ins-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); } .ins-two { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 800px) {
  .ins { padding: 16px; }
  .ins-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .branch-cols, .tfa-setup, .scoring-summary { grid-template-columns: minmax(0, 1fr); }
  .endpoint { grid-template-columns: 56px minmax(0, 1fr); }
  .endpoint .muted { grid-column: 1 / -1; }
  .snap-rows > div { grid-template-columns: 1fr auto; }
  .snap-rows > div .small { grid-column: 1 / -1; }
}

/* ---------------------------------------------------------------- The Birks: events calendar */
.cal-page { padding: 20px 28px 60px; }
.cal-title { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.cal-title h2 { margin: 0; font-size: 20px; }
.cal-legend { margin-left: auto; display: inline-flex; gap: 12px; font-size: 12px; color: var(--text-3); }
.cal-key::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; background: var(--accent); }
.cal-key.food::before { background: #c98500; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--border); gap: 1px; }
.cal-head { background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--text-3); padding: 6px 8px; }
.cal-cell { background: var(--surface); min-height: 104px; padding: 6px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-cell.blank { background: var(--surface-2); }
.cal-cell.today .cal-day span:first-child { background: var(--accent); color: #fff; border-radius: 10px; padding: 0 7px; }
.cal-cell.clash { box-shadow: inset 0 0 0 2px var(--danger); }
.cal-day { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 600; color: var(--text-2); }
.cal-warn { color: var(--danger); display: inline-flex; }
.cal-warn svg { width: 14px; height: 14px; }
.cal-event { display: flex; align-items: center; gap: 5px; font-size: 12px; padding: 2px 6px; border-radius: 5px; background: var(--accent-soft); color: var(--accent-text); text-decoration: none; min-width: 0; }
.cal-event.food { background: var(--warn-soft); color: var(--warn-text); }
.cal-event:hover { filter: brightness(.96); }
.cal-event.s-new_enquiry, .cal-event.s-viewing_booked, .cal-event.s-quote_sent { opacity: .75; outline: 1px dashed currentColor; outline-offset: -1px; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.cal-agenda-title { margin: 26px 0 8px; font-size: 15px; }
.cal-agenda { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.cal-row { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-top: 1px solid var(--border); color: var(--text); text-decoration: none; }
.cal-row:first-child { border-top: 0; }
.cal-row:hover { background: var(--surface-hover); }
.cal-row.clash { box-shadow: inset 3px 0 0 var(--danger); }
.cal-row-date { width: 92px; flex: none; font-weight: 600; }
@media (max-width: 800px) {
  .cal-page { padding: 14px 16px 50px; }
  .cal-grid { display: none; }
  .cal-agenda-title { margin-top: 6px; }
  .cal-row { flex-wrap: wrap; gap: 4px 10px; }
  .cal-row-date { width: auto; }
}

/* ---------------------------------------------------------------- The Birks: printable quote */
.print-root { position: fixed; inset: 0; z-index: 200; overflow: auto; background: var(--bg); padding: 24px 16px 60px; }
.print-bar { display: flex; gap: 8px; justify-content: center; margin-bottom: 16px; }
.quote-sheet { max-width: 800px; margin: 0 auto; background: #fff; color: #1d1d1b; padding: 40px 44px; border-radius: 10px; box-shadow: 0 2px 16px rgba(0,0,0,.08); font-size: 13px; }
.quote-sheet .muted { color: #6b6a63; }
.quote-top { display: flex; justify-content: space-between; gap: 20px; border-bottom: 3px solid #8a1c3a; padding-bottom: 16px; margin-bottom: 20px; }
.quote-brand { font-size: 24px; font-weight: 800; color: #8a1c3a; letter-spacing: -.01em; }
.quote-meta { text-align: right; }
.quote-meta h1 { margin: 0 0 4px; font-size: 22px; }
.quote-cols { display: grid; grid-template-columns: 1fr 1.4fr; gap: 24px; margin-bottom: 22px; }
.quote-sheet h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: #8a1c3a; margin: 0 0 6px; }
.quote-facts th { text-align: left; font-weight: 500; color: #6b6a63; padding: 2px 14px 2px 0; vertical-align: top; }
.quote-lines { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.quote-lines th, .quote-lines td { padding: 7px 8px; border-bottom: 1px solid #e6e5e1; text-align: left; }
.quote-lines thead th { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: #6b6a63; }
.quote-lines .num { text-align: right; white-space: nowrap; }
.quote-lines tr.total td { font-weight: 700; font-size: 14px; border-bottom: 2px solid #1d1d1b; }
.quote-sheet .pre { white-space: pre-wrap; }
.quote-foot { margin-top: 24px; font-size: 12px; }
@media (max-width: 640px) { .quote-sheet { padding: 22px 18px; } .quote-cols { grid-template-columns: 1fr; } .quote-top { flex-direction: column; } .quote-meta { text-align: left; } }
@media print {
  body.printing > *:not(.print-root) { display: none !important; }
  body.printing .print-root { position: static; padding: 0; background: #fff; overflow: visible; }
  body.printing .no-print { display: none !important; }
  body.printing .quote-sheet { box-shadow: none; border-radius: 0; max-width: none; padding: 0; }
}
