:root {
  --brand: #e26436;
  --primary: var(--brand);
  --primary-hover: color-mix(in oklab, var(--primary) 86%, black);
  --primary-active: color-mix(in oklab, var(--primary) 76%, black);
  --primary-subtle: color-mix(in oklab, var(--primary) 8%, white);
  --primary-subtle-2: color-mix(in oklab, var(--primary) 15%, white);
  --primary-border: color-mix(in oklab, var(--primary) 26%, white);
  --primary-text: color-mix(in oklab, var(--primary) 74%, black);
  --on-primary: #ffffff;

  --bg: #f8f6f1;
  --bg-elevated: #ffffff;
  --surface: #ffffff;
  --surface-2: #fbfaf7;
  --surface-sunken: #f4f1ec;
  --surface-hover: #f6f4f0;
  --surface-active: #efebe4;
  --overlay: rgba(28, 24, 20, 0.44);

  --text: #211f1c;
  --text-2: #5f5953;
  --text-3: #8a847d;
  --text-4: #b5afa7;
  --text-inverse: #ffffff;

  --border: #ebe7e0;
  --border-2: #e0dad1;
  --border-strong: #d2cbc0;
  --divider: #f0ece6;

  --green: #2b9d6a;
  --green-bg: #edf8f2;
  --green-text: #1d7a50;
  --green-border: #c3e8d5;
  --red: #e5484d;
  --red-bg: #fdf0f0;
  --red-text: #c4303a;
  --red-border: #f7cfd0;
  --amber: #e59a0c;
  --amber-bg: #fdf6e7;
  --amber-text: #a8680a;
  --amber-border: #f5dfae;
  --blue: #2f7fd6;
  --blue-bg: #eef5fd;
  --blue-text: #1f63ad;
  --blue-border: #c9def6;
  --purple: #9446c4;
  --purple-bg: #f6effb;
  --purple-text: #7a33a6;
  --purple-border: #e3cff2;
  --teal: #11948f;
  --teal-bg: #eaf7f6;
  --teal-text: #0d7470;
  --teal-border: #bfe6e3;
  --pink: #d9457a;
  --pink-bg: #fcf0f4;
  --pink-text: #b3305f;
  --pink-border: #f5cddb;
  --orange: #e2702f;
  --orange-bg: #fdf3ec;
  --orange-text: #b5531c;
  --orange-border: #f7d8c2;
  --gray: #8a847d;
  --gray-bg: #f4f1ec;
  --gray-text: #5f5953;
  --gray-border: #e5e0d8;
  --indigo: #5b5bd6;
  --indigo-bg: #f0f0fc;
  --indigo-text: #4545b3;
  --indigo-border: #d3d3f5;

  --chart-1: var(--primary);
  --chart-2: #2b9d6a;
  --chart-3: #3a7fc8;
  --chart-4: #e5a12a;
  --chart-5: #9446c4;
  --chart-6: #d9577f;
  --chart-7: #11948f;
  --chart-8: #9a9189;
  --chart-grid: #efebe5;

  --avatar-1-bg: #e6eef6; --avatar-1-fg: #2c577f;
  --avatar-2-bg: #e3f1ea; --avatar-2-fg: #2a6348;
  --avatar-3-bg: #f5ede0; --avatar-3-fg: #7a5230;
  --avatar-4-bg: #f0e7f4; --avatar-4-fg: #633a78;
  --avatar-5-bg: #f7e8ee; --avatar-5-fg: #7d3551;
  --avatar-6-bg: #e2f0f3; --avatar-6-fg: #275f69;
  --avatar-7-bg: #ecebf7; --avatar-7-fg: #45407a;
  --avatar-8-bg: #ecf1e2; --avatar-8-fg: #45592a;

  --font-sans: "Inter", "Inter Fallback", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: var(--font-sans);
  --font-serif: "Source Serif 4", "Source Serif Fallback", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --font-mono: "JetBrains Mono", "JetBrains Mono Fallback", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 8px;
  --radius-md: 10px;
  --radius-lg: 12px;
  --radius-xl: 16px;
  --radius-full: 999px;

  --shadow-xs: 0 1px 2px rgba(33, 29, 24, 0.045);
  --shadow-sm: 0 1px 3px rgba(33, 29, 24, 0.07), 0 1px 2px rgba(33, 29, 24, 0.04);
  --shadow-md: 0 4px 10px -2px rgba(33, 29, 24, 0.08), 0 2px 4px -1px rgba(33, 29, 24, 0.05);
  --shadow-lg: 0 12px 28px -8px rgba(33, 29, 24, 0.16), 0 4px 10px -4px rgba(33, 29, 24, 0.08);
  --shadow-xl: 0 28px 64px -18px rgba(33, 29, 24, 0.30), 0 8px 18px -8px rgba(33, 29, 24, 0.10);
  --ring: 0 0 0 3px color-mix(in oklab, var(--primary) 22%, transparent);
  --ring-offset: 0 0 0 2px var(--surface), 0 0 0 4px color-mix(in oklab, var(--primary) 70%, transparent);
  --ring-danger: 0 0 0 3px color-mix(in oklab, var(--red) 20%, transparent);

  --sidebar-w: 240px;
  --sidebar-w-collapsed: 64px;
  --topbar-h: 56px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --dur: 120ms;
  --dur-slow: 200ms;
  color-scheme: light;
}

[data-theme="dark"] {
  --primary: color-mix(in oklab, var(--brand) 88%, white);
  --primary-hover: color-mix(in oklab, var(--primary) 88%, white);
  --primary-active: color-mix(in oklab, var(--primary) 80%, white);
  --primary-subtle: color-mix(in oklab, var(--primary) 15%, #1f1c19);
  --primary-subtle-2: color-mix(in oklab, var(--primary) 24%, #1f1c19);
  --primary-border: color-mix(in oklab, var(--primary) 38%, #1f1c19);
  --primary-text: color-mix(in oklab, var(--primary) 78%, white);

  --bg: #171513;
  --bg-elevated: #23201c;
  --surface: #1f1c19;
  --surface-2: #23201d;
  --surface-sunken: #292623;
  --surface-hover: #2b2825;
  --surface-active: #34302c;
  --overlay: rgba(0, 0, 0, 0.62);

  --text: #f6f3ee;
  --text-2: #bbb5ab;
  --text-3: #8f887f;
  --text-4: #645e57;

  --border: #38332f;
  --border-2: #3b3732;
  --border-strong: #4f4943;
  --divider: #2a2724;

  --green: #3fbf85;
  --green-bg: rgba(63, 191, 133, 0.12);
  --green-text: #5fd39d;
  --green-border: rgba(63, 191, 133, 0.3);
  --red: #f0676b;
  --red-bg: rgba(240, 103, 107, 0.13);
  --red-text: #f58a8d;
  --red-border: rgba(240, 103, 107, 0.32);
  --amber: #f0b03a;
  --amber-bg: rgba(240, 176, 58, 0.12);
  --amber-text: #f5c25e;
  --amber-border: rgba(240, 176, 58, 0.3);
  --blue: #5a9de6;
  --blue-bg: rgba(90, 157, 230, 0.13);
  --blue-text: #85b8f0;
  --blue-border: rgba(90, 157, 230, 0.32);
  --purple: #b07ad8;
  --purple-bg: rgba(176, 122, 216, 0.14);
  --purple-text: #c89de6;
  --purple-border: rgba(176, 122, 216, 0.34);
  --teal: #2fb8b2;
  --teal-bg: rgba(47, 184, 178, 0.12);
  --teal-text: #5fd0cb;
  --teal-border: rgba(47, 184, 178, 0.3);
  --pink: #ea6f9a;
  --pink-bg: rgba(234, 111, 154, 0.12);
  --pink-text: #f296b6;
  --pink-border: rgba(234, 111, 154, 0.3);
  --orange: #f08a52;
  --orange-bg: rgba(240, 138, 82, 0.12);
  --orange-text: #f5a67a;
  --orange-border: rgba(240, 138, 82, 0.3);
  --gray: #8f887f;
  --gray-bg: rgba(175, 166, 155, 0.10);
  --gray-text: #c4bdb3;
  --gray-border: rgba(175, 166, 155, 0.22);
  --indigo: #8385ea;
  --indigo-bg: rgba(131, 133, 234, 0.14);
  --indigo-text: #a9abf2;
  --indigo-border: rgba(131, 133, 234, 0.34);

  --chart-2: #3fbf85;
  --chart-3: #5a9de6;
  --chart-4: #f0b03a;
  --chart-5: #b07ad8;
  --chart-6: #ea6f9a;
  --chart-7: #2fb8b2;
  --chart-8: #9a9189;
  --chart-grid: #2d2a26;

  --avatar-1-bg: #23303d; --avatar-1-fg: #9cc0e2;
  --avatar-2-bg: #213229; --avatar-2-fg: #95d1b2;
  --avatar-3-bg: #362b20; --avatar-3-fg: #e0bb93;
  --avatar-4-bg: #302537; --avatar-4-fg: #caa6dc;
  --avatar-5-bg: #37242c; --avatar-5-fg: #e3a5bd;
  --avatar-6-bg: #1f3135; --avatar-6-fg: #93cdd8;
  --avatar-7-bg: #292839; --avatar-7-fg: #b3afe6;
  --avatar-8-bg: #2b3122; --avatar-8-fg: #bccf96;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.35);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.42);
  --shadow-md: 0 6px 16px -4px rgba(0, 0, 0, 0.5);
  --shadow-lg: 0 16px 36px -10px rgba(0, 0, 0, 0.62), 0 0 0 1px rgba(255, 255, 255, 0.03);
  --shadow-xl: 0 28px 64px -18px rgba(0, 0, 0, 0.72), 0 0 0 1px rgba(255, 255, 255, 0.04);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "cv11", "ss01", "ss03";
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; letter-spacing: -0.015em; color: var(--text); line-height: 1.25; }
h1 { font-size: 26px; font-family: var(--font-serif); font-weight: 600; letter-spacing: -0.012em; line-height: 1.2; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
h4 { font-size: 14px; }
.font-serif, .serif { font-family: var(--font-serif); letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
hr { border: 0; border-top: 1px solid var(--divider); margin: 16px 0; }
::selection { background: color-mix(in oklab, var(--primary) 22%, transparent); }
:focus { outline: none; }
:focus-visible { outline: 2px solid color-mix(in oklab, var(--primary) 75%, transparent); outline-offset: 2px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, [contenteditable]:focus-visible { outline: none; }
table { border-collapse: collapse; width: 100%; }
code, kbd, pre, .mono { font-family: var(--font-mono); font-size: 0.92em; }
[hidden], .hidden { display: none !important; }
[x-cloak] { display: none !important; }

* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-4); background-clip: content-box; border: 2px solid transparent; }

.icon {
  width: 16px; height: 16px; flex: none; display: inline-block; vertical-align: middle;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.icon-xs { width: 12px; height: 12px; }
.icon-sm { width: 14px; height: 14px; }
.icon-md { width: 18px; height: 18px; }
.icon-lg { width: 20px; height: 20px; }
.icon-xl { width: 24px; height: 24px; }
.icon-2xl { width: 32px; height: 32px; stroke-width: 1.6; }
.icon-fill { fill: currentColor; }

.app { display: flex; height: 100vh; overflow: hidden; }
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }
.app-scroll { flex: 1; overflow: auto; scroll-behavior: smooth; }
.page { padding: 24px 24px 32px; max-width: none; margin: 0; width: 100%; }
.page-wide { max-width: none; }
.page-narrow { max-width: none; }
.page-full { padding: 0; max-width: none; height: 100%; display: flex; flex-direction: column; }

.sidebar {
  width: var(--sidebar-w); flex: none; display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  transition: width var(--dur-slow) var(--ease-out); position: relative; z-index: 30;
}
.sidebar-head { padding: 20px; border-bottom: 1px solid var(--border); min-width: 0; }
.sidebar-brand-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; color: var(--text); border-radius: var(--radius-sm); }
.brand:hover { text-decoration: none; }
.brand-logo { height: 36px; width: auto; max-width: 168px; object-fit: contain; object-position: left center; flex: none; display: block; }
[data-theme="dark"] .brand-logo { background: #fff; border-radius: var(--radius); padding: 3px 6px; box-sizing: border-box; }
.brand-mark {
  width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center;
  background: linear-gradient(145deg, color-mix(in oklab, var(--primary) 92%, white), color-mix(in oklab, var(--primary) 78%, #5a1d08));
  color: #fff; font-weight: 700; font-size: 12.5px; letter-spacing: -0.01em; box-shadow: inset 0 -1px 0 rgba(0,0,0,.14), inset 0 1px 0 rgba(255,255,255,.18), var(--shadow-xs);
}
.sidebar .brand-mark { width: 36px; height: 36px; border-radius: 10px; font-size: 13px; }
.brand-name { font-weight: 650; font-size: 15px; line-height: 20px; letter-spacing: -0.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.brand-logo + .brand-name { display: none; }
.brand-portal { margin-top: 8px; font-size: 13px; line-height: 1.5; font-weight: 500; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-icon-btn {
  width: 28px; height: 28px; flex: none; display: grid; place-items: center; border: 0; border-radius: var(--radius);
  background: transparent; color: var(--text-3); transition: background var(--dur), color var(--dur);
}
.sidebar-icon-btn:hover { background: var(--surface-sunken); color: var(--text); }
.sidebar-toggle { margin-left: auto; }
.sidebar-toggle .icon-when-collapsed { display: none; }
.sidebar.collapsed .sidebar-toggle .icon-when-open { display: none; }
.sidebar.collapsed .sidebar-toggle .icon-when-collapsed { display: block; }

.nav { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 16px 12px; overscroll-behavior: contain; }
.nav-section + .nav-section { margin-top: 2px; }
.nav-heading { padding: 16px 12px 8px; font-size: 11px; line-height: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); white-space: nowrap; overflow: hidden; }
.nav-item {
  display: flex; align-items: center; gap: 12px; height: 32px; padding: 0 12px; border-radius: var(--radius-md);
  color: var(--text-2); font-weight: 500; font-size: 13px; line-height: 20px; position: relative; white-space: nowrap;
  transition: background var(--dur), color var(--dur);
}
.nav-item .nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { background: var(--surface-sunken); color: var(--text); text-decoration: none; }
.nav-item > .icon { color: inherit; width: 16px; height: 16px; }
.nav-item.active { background: var(--primary-subtle); color: var(--primary); }
.nav-item.active::before { content: ""; position: absolute; left: 0; top: 6px; bottom: 6px; width: 3px; border-radius: 999px; background: var(--primary); }
.nav-item.active:has(+ .nav-children .nav-child.active) { background: transparent; color: var(--text-2); }
.nav-item.active:has(+ .nav-children .nav-child.active)::before { display: none; }
.nav-item.active:has(+ .nav-children .nav-child.active):hover { background: var(--surface-sunken); color: var(--text); }
.nav-item:focus-visible, .nav-child:focus-visible { outline-offset: -2px; }
.nav-item .nav-caret { width: 13px; height: 13px; color: var(--text-3); transition: transform 160ms var(--ease-out); transform: rotate(-90deg); }
.nav-item.active .nav-caret { transform: none; }
.nav-count {
  font-size: 11px; font-weight: 600; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center;
  background: var(--surface-sunken); color: var(--text); font-variant-numeric: tabular-nums; line-height: 1;
}
.nav-item.active .nav-count { background: var(--surface); color: var(--primary-text); }
.nav-count.alert { background: var(--red); color: #fff; }
.nav-children { margin: 0 0 0 26px; padding: 2px 0 2px 12px; border-left: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; }
.nav-child { display: flex; align-items: center; height: 28px; padding: 0 8px; font-size: 12.5px; color: var(--text-3); border-radius: var(--radius); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background var(--dur), color var(--dur); }
.nav-child:hover { color: var(--text); background: var(--surface-sunken); text-decoration: none; }
.nav-child.active { color: var(--primary); font-weight: 500; background: var(--primary-subtle); }

.sidebar-foot { border-top: 1px solid var(--border); padding: 12px; display: flex; flex-direction: column; gap: 8px; background: var(--surface); }
[data-theme="dark"] .sidebar, [data-theme="dark"] .sidebar-foot { background: var(--bg); }
.clock-chip {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: var(--radius-md); color: var(--green-text);
  background: var(--green-bg); border: 1px solid var(--green-border); transition: filter var(--dur);
}
.clock-chip:hover { text-decoration: none; filter: brightness(0.97); }
.clock-chip.on-break { color: var(--amber-text); background: var(--amber-bg); border-color: var(--amber-border); }
.clock-chip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; color: color-mix(in oklab, var(--green) 55%, transparent); animation: pulse 1.8s infinite; }
.clock-chip.on-break .clock-chip-dot { background: var(--amber); animation: none; }
.clock-chip-text { flex: 1; min-width: 0; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.clock-chip-label { font-weight: 600; white-space: nowrap; }
.clock-chip-time { font-weight: 650; }
.clock-chip-go { opacity: .6; }

.portal-switch { position: relative; }
.portal-switch-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface);
  text-align: left; color: var(--text); transition: border-color var(--dur), background var(--dur);
}
.portal-switch-btn:hover, .portal-switch-btn[aria-expanded="true"] { background: var(--surface-sunken); }
.portal-ico { width: 24px; height: 24px; border-radius: var(--radius); display: grid; place-items: center; flex: none; border: 1px solid var(--border); color: var(--text-2); }
.portal-ico .icon { width: 13px; height: 13px; }
.portal-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.portal-kicker { font-size: 11px; line-height: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-3); }
.portal-name { font-weight: 500; font-size: 13px; line-height: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.portal-caret { color: var(--text-3); }
.menu.portal-menu { min-width: 240px; bottom: calc(100% + 4px); left: 0; top: auto; }
.menu-item.portal-option { align-items: center; gap: 10px; padding: 7px 8px; white-space: nowrap; }
.portal-option .portal-ico { border: 0; width: 18px; height: 18px; }
.portal-option .portal-ico .icon { width: 15px; height: 15px; }
.portal-option.active .portal-ico { color: var(--primary); }
.portal-option-name { display: block; font-weight: 500; font-size: 13px; }
.menu-foot { display: flex; align-items: center; gap: 6px; padding: 6px 9px 4px; font-size: 12px; color: var(--text-3); }

.user-menu-wrap { position: relative; width: 100%; }
.user-chip { display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: var(--radius-md); color: var(--text); width: 100%; border: 0; background: none; text-align: left; transition: background var(--dur); }
.user-chip:hover, .user-chip[aria-expanded="true"] { background: var(--surface-sunken); text-decoration: none; }
.user-chip > .avatar { --size: 28px; }
.user-chip-meta { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.user-chip-name { font-weight: 500; font-size: 13px; line-height: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-role { font-size: 12px; line-height: 16px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip-caret { color: var(--text-3); }
.menu.user-menu { min-width: 252px; bottom: calc(100% + 4px); left: 0; top: auto; }
.user-menu-head { display: flex; align-items: center; gap: 10px; padding: 8px 9px 6px; }
.theme-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; margin: 2px 4px 6px; padding: 2px; border-radius: var(--radius); background: var(--surface-sunken); border: 1px solid var(--border); }
.theme-switch button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; height: 28px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); font-size: 12px; font-weight: 550; transition: background var(--dur), color var(--dur), box-shadow var(--dur); }
.theme-switch button:hover { color: var(--text); }
.theme-switch button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }

@media (min-width: 901px) {
  .sidebar.collapsed { width: var(--sidebar-w-collapsed); }
  .sidebar.collapsed .brand-name,
  .sidebar.collapsed .brand-portal,
  .sidebar.collapsed .portal-meta,
  .sidebar.collapsed .portal-caret,
  .sidebar.collapsed .nav-label,
  .sidebar.collapsed .nav-caret,
  .sidebar.collapsed .nav-children,
  .sidebar.collapsed .user-chip-meta,
  .sidebar.collapsed .user-chip-caret,
  .sidebar.collapsed .clock-chip-text,
  .sidebar.collapsed .clock-chip-go { display: none; }
  .sidebar.collapsed .sidebar-head { padding: 12px; }
  .sidebar.collapsed .sidebar-brand-row { flex-direction: column; align-items: center; gap: 8px; }
  .sidebar.collapsed .brand { justify-content: center; }
  .sidebar.collapsed .brand-logo { width: 28px; height: 28px; max-width: none; object-position: center; }
  [data-theme="dark"] .sidebar.collapsed .brand-logo { padding: 2px; }
  .sidebar.collapsed .brand-mark { width: 28px; height: 28px; border-radius: 8px; font-size: 11px; }
  .sidebar.collapsed .sidebar-toggle { margin-left: 0; }
  .sidebar.collapsed .nav { padding: 16px 8px; }
  .sidebar.collapsed .nav-heading { padding: 0; height: 1px; margin: 8px; background: var(--border); }
  .sidebar.collapsed .nav-heading span { display: none; }
  .sidebar.collapsed .nav-item { justify-content: center; padding: 0; width: 36px; height: 32px; margin-left: auto; margin-right: auto; }
  .sidebar.collapsed .nav-item.active::before { display: none; }
  .sidebar.collapsed .nav-count { position: absolute; top: 4px; right: 4px; min-width: 0; width: 6px; height: 6px; padding: 0; font-size: 0; background: var(--red); }
  .sidebar.collapsed .sidebar-foot { padding: 12px 8px; align-items: center; }
  .sidebar.collapsed .clock-chip { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .sidebar.collapsed .portal-switch-btn { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .sidebar.collapsed .portal-switch-btn .portal-ico { border: 0; }
  .sidebar.collapsed .portal-switch-btn .portal-ico .icon { width: 15px; height: 15px; }
  .sidebar.collapsed .user-chip { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .sidebar.collapsed .user-chip > .avatar { --size: 26px; }
  .sidebar.collapsed .user-menu-wrap, .sidebar.collapsed .portal-switch { width: auto; }
  .sidebar.collapsed .menu.portal-menu, .sidebar.collapsed .menu.user-menu { bottom: 0; left: calc(100% + 10px); }
}
.sidebar:not(.collapsed) .nav-item[data-tip]::after,
.sidebar.mobile-open [data-tip]::after,
.sidebar:not(.collapsed) .nav-child[data-tip]::after,
.sidebar:not(.collapsed) .portal-switch-btn[data-tip]::after,
.sidebar:not(.collapsed) .user-chip[data-tip]::after,
.sidebar:not(.collapsed) .clock-chip[data-tip]::after,
.sidebar [aria-expanded="true"][data-tip]::after { display: none; }

.topbar {
  height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: var(--surface); border-bottom: 1px solid var(--border); position: relative; z-index: 20;
}
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; line-height: 20px; min-width: 0; color: var(--text-3); flex: 0 1 auto; }
.crumbs a { color: var(--text-3); white-space: nowrap; }
.crumbs a:hover { color: var(--text); text-decoration: none; }
.crumbs .icon { width: 13px; height: 13px; color: var(--text-3); }
.crumbs .current { color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-center { flex: 1 1 auto; max-width: 448px; display: flex; justify-content: center; min-width: 220px; padding: 0 16px; }
.topbar-search {
  display: flex; align-items: center; gap: 8px; height: 32px; flex: 1; width: 100%; max-width: 448px; min-width: 0;
  padding: 0 10px; border: 0; border-radius: var(--radius); background: var(--surface-sunken);
  color: var(--text-3); font-size: 13px; text-align: left; transition: color var(--dur), background var(--dur);
}
.topbar-search:hover { color: var(--text-2); }
.topbar-search > .icon { width: 15px; height: 15px; color: var(--text-3); }
.topbar-search .kbd { margin-left: auto; height: auto; min-width: 0; padding: 2px 6px; border: 1px solid var(--border); border-radius: var(--radius-xs); background: var(--surface); font-size: 11px; font-weight: 500; line-height: 16px; color: var(--text-3); white-space: nowrap; flex: none; }
.topbar-actions { display: flex; align-items: center; gap: 4px; flex: none; margin-left: auto; }
.topbar-actions .btn-ghost { color: var(--text-2); border-radius: var(--radius-md); }
.topbar-actions .btn-ghost:hover { color: var(--text); }
.topbar-actions .topbar-btn { width: 33px; height: 33px; }
.topbar-actions .topbar-btn .icon { width: 17px; height: 17px; }
.topbar-actions .topbar-ai.desktop-only { height: 32px; padding: 0 10px; gap: 6px; font-size: 12px; font-weight: 500; }
.topbar-actions .topbar-ai .icon { width: 15px; height: 15px; }
.topbar-btn { position: relative; }
.topbar-btn .ping { position: absolute; top: 6px; right: 6px; width: 6px; height: 6px; min-width: 0; padding: 0; border-radius: 50%; background: var(--red); color: transparent; font-size: 0; line-height: 0; overflow: hidden; }
.topbar-sep { width: 1px; height: 20px; background: var(--border); margin: 0 6px; }
.mobile-only { display: none !important; }

.skip-link { position: fixed; left: 12px; top: -48px; z-index: 500; padding: 8px 14px; border-radius: var(--radius); background: var(--text); color: var(--bg); font-weight: 600; font-size: 13px; transition: top var(--dur); }
.skip-link:focus { top: 12px; text-decoration: none; }

.page-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; min-width: 0;
  position: sticky; top: 0; z-index: 20; margin: 0 -24px 24px; padding: 16px 24px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.page-header:where(.page > :first-child, .page > :first-child > :first-child) { margin-top: -24px; padding-top: 24px; }
.page-header:where(.page-full > *) { margin: 0; }
.page-header-main { min-width: 0; flex: 1 1 320px; }
.page-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.page-title h1 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; font-family: var(--font-sans); font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -0.015em; }
.page-header:not(.show-title) .page-title h1 { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.page-header:not(.show-title) .page-title:not(:has(> :not(h1))) { display: contents; }
.page-subtitle { color: var(--text-2); font-size: 13px; line-height: 20px; max-width: 760px; }
.page-header.show-title .page-subtitle { margin-top: 2px; color: var(--text-3); }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-left: auto; min-width: 0; max-width: 100%; }
[data-portal="billing"] .page-header, [data-portal="sales"] .page-header, .page-header.flat {
  position: static; margin: 0 0 16px; padding: 0; background: none; border-bottom: 0; align-items: flex-end; gap: 16px;
}
[data-portal="billing"] .page-header .page-title h1, [data-portal="sales"] .page-header .page-title h1, .page-header.flat .page-title h1 {
  position: static; width: auto; height: auto; margin: 0; overflow: hidden; clip: auto;
}
[data-portal="billing"] .page-header .page-title, [data-portal="sales"] .page-header .page-title, .page-header.flat .page-title { display: flex; }
[data-portal="billing"] .page-header .page-subtitle, [data-portal="sales"] .page-header .page-subtitle, .page-header.flat .page-subtitle { margin-top: 2px; color: var(--text-3); }
.page-actions > .segmented, .toolbar > .segmented, .card-toolbar > .segmented { min-width: 0; }
.page-eyebrow { font-size: 11.5px; font-weight: 600; color: var(--primary-text); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 6px; }
.back-link { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 500; color: var(--text-3); margin-bottom: 12px; border-radius: var(--radius-sm); transition: color var(--dur); }
.back-link:hover { color: var(--text); text-decoration: none; }
.back-link .icon { transition: transform var(--dur) var(--ease); }
.back-link:hover .icon { transform: translateX(-2px); }
.section-title { font-size: 15px; font-weight: 600; line-height: 22px; color: var(--text); }
.section-desc { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 12px; }

.subnav { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 24px; overflow-x: auto; scrollbar-width: none; }
.subnav::-webkit-scrollbar { display: none; }
.subnav a, .subnav button {
  position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; font-size: 13px; line-height: 20px; font-weight: 500;
  color: var(--text-2); border: 0; background: none; white-space: nowrap; border-radius: var(--radius-xs) var(--radius-xs) 0 0;
  transition: color var(--dur);
}
.subnav a::after, .subnav button::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 999px; background: transparent; transition: background var(--dur); }
.subnav a:hover, .subnav button:hover { color: var(--text); text-decoration: none; }
.subnav a.active, .subnav button.active { color: var(--text); }
.subnav a.active::after, .subnav button.active::after { background: var(--primary); }
.subnav a:focus-visible, .subnav button:focus-visible { outline-offset: -2px; }
.subnav .count { font-size: 12px; font-weight: 400; color: var(--text-3); font-variant-numeric: tabular-nums; }
.subnav .icon { width: 14px; height: 14px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-xs); min-width: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 20px; border-bottom: 1px solid var(--border); min-height: 48px; }
.card-header.plain { border-bottom: 0; padding-bottom: 4px; }
.card-title { font-size: 14px; font-weight: 600; display: flex; align-items: center; gap: 8px; letter-spacing: -0.01em; color: var(--text); min-width: 0; }
.card-title .icon { color: var(--text-3); }
.card-subtitle { font-size: 12px; line-height: 16px; color: var(--text-3); margin-top: 1px; font-weight: 400; }
.card-body { padding: 20px; }
.card-body.tight { padding: 12px 16px; }
.card-body.flush { padding: 0; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; gap: 8px; background: var(--surface-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.card-link { display: block; color: inherit; transition: border-color var(--dur), box-shadow var(--dur), transform var(--dur) var(--ease); }
.card-link:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); text-decoration: none; transform: translateY(-1px); }
.card-section + .card-section { border-top: 1px solid var(--border); }
.card.muted-card { background: var(--surface-2); box-shadow: none; }
.card.dashed { border-style: dashed; box-shadow: none; background: transparent; }
.card.card-alert { border-left: 2px solid var(--red); }
.card > .card-body.flush:first-child .table-wrap, .card > .table-wrap:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }

.btn {
  --btn-h: 36px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: var(--btn-h); padding: 0 14px;
  border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 500; font-size: 13px; line-height: 1; white-space: nowrap; user-select: none; position: relative; text-decoration: none;
  box-shadow: var(--shadow-xs); transition: background var(--dur), border-color var(--dur), box-shadow var(--dur), color var(--dur), transform 80ms;
}
.btn:hover { background: var(--surface-sunken); border-color: var(--border-strong); text-decoration: none; color: var(--text); }
.btn:active { transform: translateY(0.5px); background: var(--surface-active); }
.btn:focus-visible { outline: 2px solid color-mix(in oklab, var(--primary) 75%, transparent); outline-offset: 2px; }
.btn:disabled, .btn.disabled, .btn[aria-disabled="true"] { opacity: 0.5; pointer-events: none; box-shadow: none; }
.btn .icon { width: 15px; height: 15px; }
.btn-primary { background: var(--primary); border-color: transparent; color: var(--on-primary); box-shadow: var(--shadow-xs), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: var(--primary-hover); border-color: transparent; color: var(--on-primary); }
.btn-primary:active { background: var(--primary-active); }
.btn-dark { background: var(--text); border-color: transparent; color: var(--bg); }
.btn-dark:hover { background: color-mix(in oklab, var(--text) 86%, var(--bg)); border-color: transparent; color: var(--bg); }
.btn-danger { background: var(--red); border-color: transparent; color: #fff; }
.btn-danger:hover { background: color-mix(in oklab, var(--red) 88%, black); border-color: transparent; color: #fff; }
.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--red-text); box-shadow: none; }
.btn-danger-ghost:hover { background: var(--red-bg); border-color: transparent; color: var(--red-text); }
.btn-danger-outline { background: var(--surface); border-color: color-mix(in oklab, var(--red) 40%, transparent); color: var(--red-text); }
.btn-danger-outline:hover { background: var(--red-bg); border-color: color-mix(in oklab, var(--red) 55%, transparent); color: var(--red-text); }
.btn-success { background: var(--green); border-color: transparent; color: #fff; }
.btn-success:hover { background: color-mix(in oklab, var(--green) 86%, black); border-color: transparent; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-sunken); border-color: transparent; color: var(--text); }
.btn-ghost[aria-expanded="true"] { background: var(--surface-sunken); color: var(--text); }
.btn-subtle { background: var(--primary-subtle); border-color: var(--primary-border); color: var(--primary-text); box-shadow: none; }
.btn-subtle:hover { background: var(--primary-subtle-2); border-color: var(--primary-border); color: var(--primary-text); }
.btn-link { background: none; border: 0; box-shadow: none; padding: 0; height: auto; color: var(--primary-text); font-weight: 550; }
.btn-link:hover { background: none; text-decoration: underline; text-underline-offset: 2px; color: var(--primary-text); }
.btn-xs { --btn-h: 26px; padding: 0 8px; font-size: 12px; gap: 4px; border-radius: var(--radius-sm); }
.btn-xs .icon { width: 13px; height: 13px; }
.btn-sm { --btn-h: 32px; padding: 0 12px; font-size: 13px; gap: 6px; }
.btn-lg { --btn-h: 42px; padding: 0 20px; font-size: 14px; }
.btn-icon { width: var(--btn-h); padding: 0; }
.btn-block { width: 100%; }
.btn.is-loading { color: transparent !important; pointer-events: none; }
.btn.is-loading > * { visibility: hidden; }
.btn.is-loading::after {
  content: ""; position: absolute; width: 15px; height: 15px; border-radius: 50%; visibility: visible;
  border: 2px solid var(--text-3); border-right-color: transparent; animation: spin 700ms linear infinite;
}
.btn-primary.is-loading::after, .btn-danger.is-loading::after, .btn-success.is-loading::after, .btn-dark.is-loading::after { border-color: #fff; border-right-color: transparent; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--radius) 0 0 var(--radius); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.btn-group .btn.active { background: var(--surface-active); z-index: 1; }
.btn-group .btn:focus-visible { z-index: 2; }

.segmented { display: inline-flex; align-items: center; padding: 2px; gap: 2px; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-md); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segmented::-webkit-scrollbar { display: none; }
.segmented button, .segmented a {
  display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border: 0; border-radius: var(--radius); flex: none;
  background: transparent; color: var(--text-2); font-size: 12px; font-weight: 500; white-space: nowrap;
  transition: background var(--dur), color var(--dur), box-shadow var(--dur);
}
.segmented button:hover, .segmented a:hover { color: var(--text); text-decoration: none; }
.segmented .active, .segmented [aria-selected="true"], .segmented [aria-pressed="true"] { background: var(--text); color: var(--bg); box-shadow: var(--shadow-xs); }
.segmented .active:hover, .segmented [aria-selected="true"]:hover, .segmented [aria-pressed="true"]:hover { color: var(--bg); }
.segmented .active .count, .segmented [aria-selected="true"] .count, .segmented [aria-pressed="true"] .count { color: color-mix(in oklab, var(--bg) 70%, transparent); }
.segmented .active .icon, .segmented [aria-selected="true"] .icon, .segmented [aria-pressed="true"] .icon { color: inherit; }
.segmented button:focus-visible, .segmented a:focus-visible { outline-offset: 0; }
.segmented .icon { width: 14px; height: 14px; }
.segmented .count { font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field + .field { margin-top: 16px; }
.form-grid .field + .field, .form-row .field + .field { margin-top: 0; }
.label { font-size: 12.5px; font-weight: 550; color: var(--text); display: flex; align-items: center; gap: 6px; }
.label .req { color: var(--red); }
.label .optional { font-weight: 400; color: var(--text-3); }
.help { font-size: 12px; color: var(--text-3); line-height: 1.45; }
.field-error { font-size: 12px; color: var(--red-text); display: flex; align-items: center; gap: 4px; }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea, .field.has-error .tag-input { border-color: var(--red); box-shadow: var(--ring-danger); }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); color: var(--text); font-size: 14px; outline: none; box-shadow: var(--shadow-xs);
  transition: border-color var(--dur), box-shadow var(--dur), background var(--dur);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); opacity: 1; }
.input:hover, .select:hover, .textarea:hover { border-color: color-mix(in oklab, var(--border-strong) 70%, var(--text-3)); }
.input:focus, .select:focus, .textarea:focus, .input:focus-visible, .select:focus-visible, .textarea:focus-visible { border-color: var(--primary); box-shadow: var(--ring); outline: none; }
.input:disabled, .select:disabled, .textarea:disabled, .input[readonly] { background: var(--surface-sunken); color: var(--text-2); cursor: not-allowed; box-shadow: none; }
.input[readonly] { cursor: default; }
.input-sm, .select.input-sm { height: 32px; font-size: 13px; padding: 0 10px; }
.select.input-sm { padding-right: 30px; }
.input-lg { height: 42px; font-size: 15px; }
.textarea { height: auto; min-height: 88px; padding: 9px 12px; line-height: 1.55; resize: vertical; }
.select {
  appearance: none; padding-right: 34px; cursor: pointer; text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238a847d' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 14px;
}
select[multiple].select { height: auto; min-height: 90px; padding: 6px; background-image: none; }
input[type="date"].input, input[type="time"].input, input[type="datetime-local"].input, input[type="month"].input, input[type="week"].input { padding-right: 8px; }
[data-theme="dark"] input[type="date"].input::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="time"].input::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="datetime-local"].input::-webkit-calendar-picker-indicator,
[data-theme="dark"] input[type="month"].input::-webkit-calendar-picker-indicator { filter: invert(0.8); }
input[type="color"].input { padding: 3px; width: 44px; cursor: pointer; }
input[type="number"].input { font-variant-numeric: tabular-nums; }
input[type="search"].input::-webkit-search-cancel-button { cursor: pointer; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group > .icon { position: absolute; left: 11px; color: var(--text-3); pointer-events: none; }
.input-group > .input { padding-left: 34px; }
.input-group .input-suffix { position: absolute; right: 11px; color: var(--text-3); font-size: 12.5px; pointer-events: none; }
.input-group .input-prefix { position: absolute; left: 12px; color: var(--text-3); font-size: 13px; pointer-events: none; }
.input-group .input-prefix + .input { padding-left: 26px; }
.input-group > .btn-clear { position: absolute; right: 4px; }
.input-addon { display: flex; }
.input-addon .input { border-radius: var(--radius) 0 0 var(--radius); }
.input-addon .btn { border-radius: 0 var(--radius) var(--radius) 0; margin-left: -1px; height: 36px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid.cols-1 { grid-template-columns: minmax(0, 1fr); }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
.form-grid .span-all { grid-column: 1 / -1; }
.form-row { display: flex; gap: 12px; align-items: flex-end; }
.form-row > * { flex: 1; min-width: 0; }
.form-section { padding: 20px 0; border-top: 1px solid var(--border); }
.form-section:first-child { border-top: 0; padding-top: 0; }
.form-section-title { font-size: 13px; font-weight: 600; margin-bottom: 12px; display: flex; align-items: center; gap: 8px; color: var(--text); }
.form-section-title .icon { color: var(--text-3); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }

.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; color: var(--text); user-select: none; }
.check input[type="checkbox"], .check input[type="radio"], input.cb {
  appearance: none; width: 16px; height: 16px; margin: 0; flex: none; border: 1.5px solid var(--border-strong); border-radius: 4.5px;
  background: var(--surface); display: inline-grid; place-content: center; cursor: pointer; transition: background var(--dur), border-color var(--dur), box-shadow var(--dur);
}
.check input[type="checkbox"]:hover, input.cb:hover, .check input[type="radio"]:hover { border-color: var(--text-3); }
.check input[type="radio"] { border-radius: 50%; }
.check input:checked, input.cb:checked { background: var(--primary); border-color: var(--primary); }
.check input[type="checkbox"]:checked::after, input.cb:checked::after {
  content: ""; width: 9px; height: 5px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px);
}
.check input[type="radio"]:checked::after { content: ""; width: 6px; height: 6px; border-radius: 50%; background: #fff; }
input.cb:indeterminate { background: var(--primary); border-color: var(--primary); }
input.cb:indeterminate::after { content: ""; width: 8px; height: 2px; background: #fff; border-radius: 1px; }
.check input:focus-visible, input.cb:focus-visible { outline: none; box-shadow: var(--ring); border-color: var(--primary); }
.check input:disabled, input.cb:disabled { opacity: .5; cursor: not-allowed; }
.check .check-desc { display: block; font-size: 12px; color: var(--text-3); }

.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; font-size: 13.5px; }
.switch input { appearance: none; width: 34px; height: 20px; border-radius: 10px; background: var(--border-strong); position: relative; margin: 0; cursor: pointer; flex: none; transition: background 160ms var(--ease); }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform 180ms var(--ease-out); }
.switch input:checked { background: var(--primary); }
.switch input:checked::after { transform: translateX(14px); }
.switch input:disabled { opacity: .5; cursor: not-allowed; }
.switch input:focus-visible { outline: none; box-shadow: var(--ring); }

.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 16px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: 0; }
.setting-row .setting-text { min-width: 0; flex: 1; }
.setting-row .setting-title { font-weight: 500; font-size: 14px; line-height: 20px; color: var(--text); }
.setting-row .setting-desc { font-size: 12px; line-height: 16px; color: var(--text-3); margin-top: 2px; }
.setting-row .setting-control { flex: none; min-width: 0; max-width: 100%; }
.setting-row .setting-control .input, .setting-row .setting-control .select { width: 320px; max-width: 100%; }

.badge {
  --tone: var(--text-4);
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: var(--radius-full);
  font-size: 12px; font-weight: 500; line-height: 1; white-space: nowrap; border: 1px solid var(--gray-border);
  background: var(--gray-bg); color: var(--gray-text); letter-spacing: 0; vertical-align: middle; max-width: 100%;
}
.badge .icon { width: 12px; height: 12px; }
.badge-sm { height: 18px; padding: 0 6px; font-size: 11px; gap: 4px; }
.badge-lg { height: 26px; padding: 0 10px; font-size: 12.5px; }
.badge-square { border-radius: var(--radius-xs); }
.badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--tone); flex: none; }
.badge-gray { --tone: var(--text-4); background: var(--gray-bg); color: var(--gray-text); border-color: var(--gray-border); }
.badge-green { --tone: var(--green); background: var(--green-bg); color: var(--green-text); border-color: var(--green-border); }
.badge-red { --tone: var(--red); background: var(--red-bg); color: var(--red-text); border-color: var(--red-border); }
.badge-amber { --tone: var(--amber); background: var(--amber-bg); color: var(--amber-text); border-color: var(--amber-border); }
.badge-blue { --tone: var(--blue); background: var(--blue-bg); color: var(--blue-text); border-color: var(--blue-border); }
.badge-purple { --tone: var(--purple); background: var(--purple-bg); color: var(--purple-text); border-color: var(--purple-border); }
.badge-teal { --tone: var(--teal); background: var(--teal-bg); color: var(--teal-text); border-color: var(--teal-border); }
.badge-pink { --tone: var(--pink); background: var(--pink-bg); color: var(--pink-text); border-color: var(--pink-border); }
.badge-orange { --tone: var(--orange); background: var(--orange-bg); color: var(--orange-text); border-color: var(--orange-border); }
.badge-indigo { --tone: var(--indigo); background: var(--indigo-bg); color: var(--indigo-text); border-color: var(--indigo-border); }
.badge-primary { --tone: var(--primary); background: var(--primary-subtle); color: var(--primary-text); border-color: var(--primary-border); }
.badge-dot:not(.badge-red):not(.badge-green):not(.badge-solid):not(.badge-fill) { background: var(--surface-sunken); color: var(--text-2); border-color: var(--border); }
.card .badge-dot:not(.badge-red):not(.badge-green):not(.badge-solid):not(.badge-fill), .table .badge-dot:not(.badge-red):not(.badge-green):not(.badge-solid):not(.badge-fill) { background: var(--surface-2); }
.board-card .badge-dot:not(.badge-red):not(.badge-green):not(.badge-solid):not(.badge-fill) { background: var(--surface-sunken); }
.badge-solid { background: var(--text); color: var(--bg); border-color: transparent; }
.badge-outline { background: transparent; }
a.badge:hover, button.badge:hover { text-decoration: none; filter: brightness(0.97); }
button.badge { cursor: pointer; font-family: inherit; }

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; background: var(--gray); }
.dot-green { background: var(--green); } .dot-red { background: var(--red); } .dot-amber { background: var(--amber); }
.dot-blue { background: var(--blue); } .dot-purple { background: var(--purple); } .dot-gray { background: var(--text-4); }
.dot-teal { background: var(--teal); } .dot-pink { background: var(--pink); } .dot-orange { background: var(--orange); } .dot-primary { background: var(--primary); }
.dot-pulse { box-shadow: 0 0 0 0 currentColor; animation: pulse 1.8s infinite; color: color-mix(in oklab, var(--green) 55%, transparent); }

.avatar {
  --size: 24px; --av-bg: var(--surface-sunken); --av-fg: var(--text-2);
  width: var(--size); height: var(--size); border-radius: 50%; flex: none; display: inline-grid; place-items: center;
  font-size: max(9px, calc(var(--size) * 0.4)); font-weight: 600; line-height: 1; color: var(--av-fg); background: var(--av-bg);
  overflow: hidden; letter-spacing: 0; user-select: none; vertical-align: middle; position: relative;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--av-fg) 10%, transparent);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: inherit; }
.avatar.has-img { background: var(--surface-sunken); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .06); }
.avatar.has-img img { position: relative; z-index: 0; }
.avatar-tone-1 { --av-bg: var(--avatar-1-bg); --av-fg: var(--avatar-1-fg); }
.avatar-tone-2 { --av-bg: var(--avatar-2-bg); --av-fg: var(--avatar-2-fg); }
.avatar-tone-3 { --av-bg: var(--avatar-3-bg); --av-fg: var(--avatar-3-fg); }
.avatar-tone-4 { --av-bg: var(--avatar-4-bg); --av-fg: var(--avatar-4-fg); }
.avatar-tone-5 { --av-bg: var(--avatar-5-bg); --av-fg: var(--avatar-5-fg); }
.avatar-tone-6 { --av-bg: var(--avatar-6-bg); --av-fg: var(--avatar-6-fg); }
.avatar-tone-7 { --av-bg: var(--avatar-7-bg); --av-fg: var(--avatar-7-fg); }
.avatar-tone-8 { --av-bg: var(--avatar-8-bg); --av-fg: var(--avatar-8-fg); }
.avatar-xs { --size: 20px; } .avatar-sm { --size: 24px; } .avatar-md { --size: 30px; } .avatar-lg { --size: 40px; } .avatar-xl { --size: 56px; } .avatar-2xl { --size: 88px; }
.avatar-xs { font-size: 8.5px; }
.avatar-square { border-radius: 25%; }
.avatar-empty { --av-bg: transparent; --av-fg: var(--text-4); box-shadow: inset 0 0 0 1px var(--border-strong); border: 0; }
.avatar-empty .avatar-empty-icon { width: 58%; height: 58%; }
.avatar-more { --av-bg: var(--surface-sunken); --av-fg: var(--text-2); font-variant-numeric: tabular-nums; }
.avatar-stack { display: inline-flex; align-items: center; }
.avatar-stack .avatar { box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar + .avatar { margin-left: -6px; }
.avatar-ring { box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--primary); }
.person { display: inline-flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; vertical-align: middle; }
.person-text { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.person-name { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person-empty .muted { font-weight: 450; }

.table-wrap { width: 100%; overflow: auto; border-radius: inherit; -webkit-overflow-scrolling: touch; }
.table { width: 100%; font-size: 14px; }
.table th {
  text-align: left; font-weight: 600; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.06em;
  height: 36px; padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--surface-sunken); white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
.table th:first-child, .table td:first-child { padding-left: 16px; }
.table th:last-child, .table td:last-child { padding-right: 16px; }
.table th.sortable, .table th[data-sort] { cursor: pointer; user-select: none; transition: color var(--dur); }
.table th.sortable:hover, .table th[data-sort]:hover { color: var(--text); }
.table th .sort-ind { display: inline-block; margin-left: 4px; opacity: 0.4; }
.table th.sorted { color: var(--text-2); }
.table th.sorted .sort-ind { opacity: 1; color: var(--primary); }
.table td { height: 44px; padding: 8px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background var(--dur); }
.table tbody tr:hover { background: var(--surface-sunken); }
.table tbody tr:last-child td { border-bottom: 0; }
.table tr.row-link { cursor: pointer; }
.table tr.row-link:focus-visible { outline-offset: -2px; }
.table tr.selected, .table tr.selected:hover { background: var(--primary-subtle) !important; }
.table tr.muted-row td { color: var(--text-3); }
.table .col-num, .table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table th.col-num, .table th.num { text-align: right; }
.table .col-check { width: 44px; padding-right: 0; }
.table .col-actions { width: 1%; white-space: nowrap; text-align: right; }
.table .col-actions .btn-ghost { color: var(--text-3); }
.table tr:hover .col-actions .btn-ghost, .table .col-actions .btn-ghost:focus-visible { color: var(--text); }
.table-compact td { padding-top: 7px; padding-bottom: 7px; }
.table-compact th { height: 34px; }
.table .cell-title { font-weight: 550; color: var(--text); }
.table td:first-child:has(> .cell-title), .table td:has(> .cell-title):nth-child(2) { min-width: 180px; }
.table a.cell-title:hover { color: var(--primary-text); }
.table .cell-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.table tfoot td { font-weight: 650; background: var(--surface-2); border-top: 1px solid var(--border); border-bottom: 0; }
.table-group-row td { background: var(--surface-sunken); font-weight: 600; font-size: 12.5px; color: var(--text-2); padding-top: 8px; padding-bottom: 8px; }
.table-empty { padding: 48px 20px; text-align: center; color: var(--text-3); }
.card > .table-wrap .table th:first-child, .card > .card-body.flush > .table-wrap .table th:first-child { border-top-left-radius: calc(var(--radius-lg) - 1px); }
.card > .table-wrap .table th:last-child, .card > .card-body.flush > .table-wrap .table th:last-child { border-top-right-radius: calc(var(--radius-lg) - 1px); }
.card > .card-header + .table-wrap .table th, .card > .card-toolbar + .table-wrap .table th, .card > .card-header + .card-body.flush > .table-wrap .table th { border-radius: 0 !important; }

.bulk-bar {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 60; visibility: hidden;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 16px; border-radius: var(--radius-lg); max-width: calc(100vw - 24px); flex-wrap: wrap;
  background: #211f1c; color: #fff; box-shadow: var(--shadow-xl); transition: transform 220ms var(--ease-out), opacity 220ms var(--ease-out), visibility 0s linear 220ms;
}
[data-theme="dark"] .bulk-bar { background: #34302b; border: 1px solid #45403a; }
.bulk-bar.show { transform: translate(-50%, 0); opacity: 1; pointer-events: auto; visibility: visible; transition-delay: 0s; }
.bulk-bar .btn { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.12); color: #fff; box-shadow: none; }
.bulk-bar .btn:hover { background: rgba(255,255,255,.16); color: #fff; }
.bulk-bar .btn-danger { background: var(--red); border-color: transparent; }
.bulk-bar .select, .bulk-bar .input { background: rgba(255,255,255,.08); border-color: rgba(255,255,255,.16); color: #fff; box-shadow: none; }
.bulk-bar .count { font-weight: 600; font-size: 13px; margin-right: 6px; font-variant-numeric: tabular-nums; }

.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .spacer { flex: 1; }
.toolbar .search { width: 280px; max-width: 100%; }
.card-toolbar { padding: 12px 16px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border-radius: var(--radius);
  border: 1px dashed var(--border-strong); background: transparent; color: var(--text-2); font-size: 13px; font-weight: 500; white-space: nowrap;
  transition: background var(--dur), border-color var(--dur), color var(--dur);
}
.chip:hover { background: var(--surface-sunken); color: var(--text); }
.chip.active { border-style: solid; border-color: var(--primary-border); background: var(--primary-subtle); color: var(--primary-text); }
.chip .chip-value { font-weight: 600; }
.chip .chip-x { margin-left: 2px; opacity: 0.6; }
.chip .chip-x:hover { opacity: 1; }
.tag { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--surface-sunken); color: var(--text-2); font-size: 12px; font-weight: 500; border: 1px solid var(--border); white-space: nowrap; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.tag .tag-x { cursor: pointer; opacity: .6; }
.tag .tag-x:hover { opacity: 1; }
.tag-input { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; min-height: 36px; padding: 4px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); cursor: text; box-shadow: var(--shadow-xs); transition: border-color var(--dur), box-shadow var(--dur); }
.tag-input:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.tag-input input { border: 0; outline: none; flex: 1; min-width: 80px; height: 26px; background: transparent; font-size: 13px; }

.dropdown { position: relative; display: inline-block; }
.menu {
  position: absolute; z-index: 80; min-width: 200px; max-width: min(340px, calc(100vw - 16px)); padding: 4px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  display: none; transform-origin: top;
}
.menu.open { display: block; animation: menu-in 150ms var(--ease-out); }
.menu.up { transform-origin: bottom; }
.menu.up.open { animation-name: menu-up-in; }
.menu.right { right: 0; } .menu.left { left: 0; }
.menu.up { bottom: calc(100% + 6px); }
.menu:not(.up) { top: calc(100% + 6px); }
.menu.fixed-menu { position: fixed; top: auto; }
.menu-item {
  display: flex; align-items: center; gap: 9px; width: 100%; min-height: 32px; padding: 6px 9px; border: 0; background: none; border-radius: var(--radius-sm);
  color: var(--text); font-size: 13px; font-weight: 450; text-align: left; white-space: nowrap; cursor: pointer; transition: background 80ms;
}
.menu-item:hover, .menu-item.focus, .menu-item:focus-visible { background: var(--surface-sunken); text-decoration: none; color: var(--text); outline: none; }
.menu-item .icon { color: var(--text-3); }
.menu-item:hover .icon { color: var(--text-2); }
.menu-item.danger, .menu-item.danger:hover { color: var(--red-text); }
.menu-item.danger .icon { color: var(--red-text); }
.menu-item.danger:hover, .menu-item.danger:focus-visible { background: var(--red-bg); }
.menu-item.selected { font-weight: 600; }
.menu-item .menu-check { margin-left: auto; color: var(--primary); }
.menu-item .menu-hint { margin-left: auto; color: var(--text-3); font-size: 12px; padding-left: 12px; }
.menu-item:disabled { opacity: .45; cursor: not-allowed; }
.menu-sep { height: 1px; background: var(--border); margin: 4px -4px; }
.menu-label { padding: 8px 9px 4px; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.menu-search { padding: 4px 4px 6px; border-bottom: 1px solid var(--border); margin: -1px -1px 4px; }
.menu-search .input { height: 32px; font-size: 13px; box-shadow: none; }
.menu-scroll { max-height: 280px; overflow-y: auto; }
.menu-empty { padding: 14px 10px; text-align: center; color: var(--text-3); font-size: 13px; }

.combo { position: relative; }
.combo-btn { width: 100%; justify-content: space-between; font-weight: 400; font-size: 13.5px; padding: 0 10px 0 12px; }
.combo-btn.btn-sm { font-size: 13px; padding: 0 8px 0 10px; }
.combo-btn:hover, .combo-btn[aria-expanded="true"] { background: var(--surface); border-color: color-mix(in oklab, var(--border-strong) 70%, var(--text-3)); }
.combo-btn:focus-visible { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.combo-btn .combo-value { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; text-align: left; }
.combo-btn .placeholder { color: var(--text-3); }
.setting-row .setting-control .combo { width: 320px; max-width: 100%; }
.combo .menu { left: 0; right: 0; max-width: none; }

dialog.modal {
  padding: 0; border: 0; background: transparent; color: var(--text); max-width: calc(100vw - 32px); max-height: calc(100dvh - 48px);
  width: 560px; overflow: visible; margin: auto;
}
dialog.modal::backdrop { background: var(--overlay); backdrop-filter: blur(3px); animation: fade-in 160ms var(--ease); }
dialog.modal[open] .modal-panel { animation: modal-in 220ms var(--ease-out); }
.modal-sm { width: 420px !important; }
.modal-md { width: 560px !important; }
.modal-lg { width: 760px !important; }
.modal-xl { width: 1040px !important; }
.modal-2xl { width: 1240px !important; }
.modal-panel {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-xl);
  display: flex; flex-direction: column; max-height: calc(100dvh - 48px); overflow: hidden;
}
.modal-header { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px 16px 24px; border-bottom: 1px solid var(--border); }
.modal-header.plain { border-bottom: 0; padding-bottom: 4px; }
.modal-title { font-family: var(--font-sans); font-size: 18px; line-height: 24px; font-weight: 600; letter-spacing: -0.015em; color: var(--text); }
.modal-desc { font-size: 13px; color: var(--text-2); margin-top: 3px; line-height: 1.5; }
.modal-header .modal-close { margin-left: auto; margin-top: -2px; margin-right: -4px; color: var(--text-3); }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; min-height: 0; }
.modal-body.flush { padding: 0; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 14px 24px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.modal-footer .left { margin-right: auto; display: flex; gap: 8px; align-items: center; }
.modal-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.modal-icon.danger { background: var(--red-bg); color: var(--red); }
.modal-icon.warn { background: var(--amber-bg); color: var(--amber); }
.modal-icon.info { background: var(--primary-subtle); color: var(--primary); }

dialog.modal:not(.search-palette):not(:has(.modal-header.plain)) { margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; max-width: 100vw; }
dialog.modal:not(.search-palette):not(:has(.modal-header.plain))::backdrop { backdrop-filter: blur(1px); }
dialog.modal:not(.search-palette):not(:has(.modal-header.plain)) .modal-panel { height: 100%; max-height: none; border: 0; border-left: 1px solid var(--border); border-radius: 0; box-shadow: var(--shadow-lg); }
dialog.modal[open]:not(.search-palette):not(:has(.modal-header.plain)) .modal-panel { animation: drawer-in 260ms var(--ease-out); }
dialog.modal:not(.search-palette):not(:has(.modal-header.plain)) .modal-footer { margin-top: auto; }
dialog.drawer {
  margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: 560px; max-width: 100vw; padding: 0; border: 0;
  background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow-xl); border-left: 1px solid var(--border);
}
dialog.drawer[open] { display: flex; flex-direction: column; animation: drawer-in 260ms var(--ease-out); }
dialog.drawer::backdrop { background: var(--overlay); animation: fade-in 160ms var(--ease); }
.drawer-lg { width: 760px !important; }
.drawer-xl { width: 960px !important; }
.drawer-header { display: flex; align-items: center; gap: 12px; padding: 14px 16px 14px 24px; border-bottom: 1px solid var(--border); min-height: 60px; }
.drawer-body { flex: 1; overflow-y: auto; padding: 20px 24px; min-height: 0; }
.drawer-footer { padding: 12px 24px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); flex-wrap: wrap; }

.toasts {
  position: fixed; right: 24px; bottom: 24px; z-index: 1000; width: 380px; max-width: calc(100vw - 32px);
  display: grid; grid-template-columns: minmax(0, 1fr); align-items: end; pointer-events: none;
}
.toast {
  --toast-tone: var(--text-3); --toast-life: 4s;
  grid-area: 1 / 1; align-self: end; pointer-events: auto; position: relative; overflow: hidden;
  display: flex; align-items: flex-start; gap: 10px; padding: 13px 12px 13px 14px; min-height: 48px;
  background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg);
  font-size: 13px; line-height: 1.45; transform-origin: bottom center;
  transition: transform 300ms var(--ease-out), opacity 300ms var(--ease-out);
  animation: toast-in 380ms var(--ease-out);
}
.toast::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 100%; background: var(--toast-tone); opacity: .5; transform-origin: left; animation: toast-life var(--toast-life) linear forwards; pointer-events: none; }
.toast:hover::after, .toast:focus-within::after { animation-play-state: paused; }
.toast.toast-persistent::after { display: none; }
.toast.success, .toast.toast-success { --toast-tone: var(--green); }
.toast.error, .toast.toast-error { --toast-tone: var(--red); --toast-life: 7s; }
.toast.warning, .toast.toast-warning { --toast-tone: var(--amber); --toast-life: 5.5s; }
.toast.info, .toast.toast-info { --toast-tone: var(--blue); }
.toast .toast-icon { flex: none; width: 20px; height: 20px; display: grid; place-items: center; color: var(--toast-tone); margin-top: -1px; }
.toast .toast-icon .icon { width: 17px; height: 17px; }
.toast .toast-body { flex: 1; min-width: 0; overflow-wrap: anywhere; color: var(--text); font-weight: 500; }
.toast .toast-title { font-weight: 600; color: var(--text); }
.toast .toast-msg { color: var(--text-2); font-weight: 400; margin-top: 1px; }
.toast .toast-detail { color: var(--text-3); font-weight: 400; font-size: 12px; margin-top: 3px; }
.toast .toast-count { flex: none; margin-top: 0; font-variant-numeric: tabular-nums; }
.toast .toast-action, .toast .btn.toast-action {
  flex: none; height: 26px; padding: 0 10px; margin: -3px 0 -3px 4px; border-radius: var(--radius-sm); border: 0;
  background: var(--text); color: var(--bg); font-size: 12px; font-weight: 600; box-shadow: none;
}
.toast .toast-action:hover { background: color-mix(in oklab, var(--text) 85%, var(--bg)); color: var(--bg); }
.toast .toast-close, .toast > .btn-icon:last-child { flex: none; width: 22px; height: 22px; margin: -2px -2px 0 0; color: var(--text-3); border-radius: 6px; opacity: .7; }
.toast .toast-close:hover, .toast > .btn-icon:last-child:hover { opacity: 1; background: var(--surface-sunken); color: var(--text); }
.toast.leaving { animation: toast-out 220ms var(--ease) forwards; pointer-events: none; }
.toasts:not(:hover):not(:focus-within) .toast:nth-last-child(2) { transform: translateY(-14px) scale(0.955); }
.toasts:not(:hover):not(:focus-within) .toast:nth-last-child(3) { transform: translateY(-28px) scale(0.91); }
.toasts:not(:hover):not(:focus-within) .toast:nth-last-child(n+2) > * { opacity: 0; transition: opacity 200ms; }
.toasts:not(:hover):not(:focus-within) .toast:nth-last-child(n+2) { max-height: 50px; }
.toasts:not(:hover):not(:focus-within) .toast:nth-last-child(n+4) { opacity: 0; transform: translateY(-36px) scale(0.87); pointer-events: none; }
.toasts:hover, .toasts:focus-within { display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.toasts:hover .toast, .toasts:focus-within .toast { transform: none; opacity: 1; }

.empty {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 56px 24px; gap: 4px;
}
.empty-icon { display: grid; place-items: center; color: var(--text-3); margin-bottom: 8px; }
.empty-icon .icon { width: 20px; height: 20px; stroke-width: 1.75; }
.empty-title { font-family: var(--font-serif); font-weight: 600; font-size: 17px; line-height: 1.35; color: var(--text); letter-spacing: -0.01em; }
.empty-text { color: var(--text-2); max-width: 384px; font-size: 13px; line-height: 1.625; margin-top: 2px; }
.empty .btn { margin-top: 12px; }
.empty-sm { padding: 40px 16px; }
.empty-sm .empty-icon { margin-bottom: 6px; }
.empty-sm .empty-icon .icon { width: 18px; height: 18px; }
.empty-sm .empty-title { font-size: 15px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; box-shadow: var(--shadow-xs); position: relative; min-width: 0; transition: border-color var(--dur), box-shadow var(--dur); }
.stat:has(a.stretched):hover { border-color: var(--border-strong); }
.stat a.stretched::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.stat a.stretched:focus-visible { outline: none; }
.stat a.stretched:focus-visible::after { outline: 2px solid color-mix(in oklab, var(--primary) 75%, transparent); outline-offset: 2px; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
.stat-top > .stat-icon { display: none; }
.stat-label { font-size: 11px; line-height: 14px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; display: flex; align-items: center; gap: 6px; min-width: 0; }
.stat-icon { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-2); color: var(--text-3); flex: none; border: 1px solid var(--border); }
.stat-icon .icon { width: 15px; height: 15px; }
.stat-icon.primary { color: var(--primary); }
.stat-icon.green { color: var(--green); }
.stat-icon.red { color: var(--red); }
.stat-icon.amber { color: var(--amber); }
.stat-icon.blue { color: var(--blue); }
.stat-icon.purple { color: var(--purple); }
.stat-icon.teal { color: var(--teal); }
.page-title .stat-icon.primary { background: var(--primary-subtle); border-color: var(--primary-border); }
.stat-value { font-size: 22px; font-weight: 600; letter-spacing: -0.01em; margin-top: 8px; font-variant-numeric: tabular-nums; line-height: 28px; font-family: var(--font-sans); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-value small { font-size: 13px; font-weight: 500; color: var(--text-3); letter-spacing: 0; }
.stat-value.tone-danger, .stat.tone-danger .stat-value { color: var(--red-text); }
.stat-value.tone-warning, .stat.tone-warning .stat-value { color: var(--amber-text); }
.stat-foot { display: flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 12px; color: var(--text-3); line-height: 16px; flex-wrap: wrap; }
.delta { display: inline-flex; align-items: center; gap: 2px; font-weight: 600; font-size: 12px; font-variant-numeric: tabular-nums; }
.delta.up { color: var(--green-text); } .delta.down { color: var(--red-text); } .delta.flat { color: var(--text-3); }
.stat-spark { height: 34px; margin-top: 8px; }
.stat-chips { display: flex; flex-wrap: wrap; align-items: stretch; margin: -4px 0; min-width: 0; }
.stat-chip { display: block; padding: 8px 16px; border: 0; border-left: 1px solid var(--border); background: none; text-align: left; color: inherit; min-width: 0; font: inherit; }
.stat-chip:first-child { padding-left: 0; border-left: 0; }
.stat-chip:last-child { padding-right: 0; }
a.stat-chip, button.stat-chip { cursor: pointer; transition: opacity var(--dur); }
a.stat-chip:hover, button.stat-chip:hover { opacity: .7; text-decoration: none; color: inherit; }
.stat-chip-label { display: block; font-size: 12px; line-height: 16px; font-weight: 500; color: var(--text-3); white-space: nowrap; }
.stat-chip-value { display: block; font-size: 15px; line-height: 20px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat-chip-value small { font-size: 12px; font-weight: 500; color: var(--text-3); margin-left: 3px; }
.stat-chip-value.text-red { color: var(--red-text); }
.stat-chip-value.text-amber { color: var(--amber-text); }
.stat-chips.lg .stat-chip-value { font-size: 22px; line-height: 28px; }
.stats-inline { display: flex; flex-wrap: wrap; align-items: stretch; }
.stats-inline > * { padding: 2px 20px; border-left: 1px solid var(--border); }
.stats-inline > *:first-child { padding-left: 0; border-left: 0; }
.stats-inline .mini-stat-value { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.3; }
.stats-inline .mini-stat-label { font-size: 12px; color: var(--text-3); font-weight: 500; }

.progress { height: 6px; border-radius: 3px; background: var(--surface-sunken); overflow: hidden; width: 100%; box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--border) 60%, transparent); }
.progress-bar { height: 100%; border-radius: 3px; background: var(--primary); transition: width 400ms var(--ease-out); }
.progress-bar.green { background: var(--green); } .progress-bar.red { background: var(--red); } .progress-bar.amber { background: var(--amber); } .progress-bar.blue { background: var(--blue); }
.progress-lg { height: 10px; border-radius: 5px; }
.progress-stack { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--surface-sunken); gap: 2px; }
.progress-stack > span { height: 100%; }
.ring { --p: 0; --c: var(--primary); width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--c) calc(var(--p) * 1%), var(--surface-sunken) 0); position: relative; flex: none; }
.ring::before { content: ""; position: absolute; inset: 5px; border-radius: 50%; background: var(--surface); }
.ring > span { position: relative; font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 10px 14px; border: 0;
  background: none; color: var(--text-2); font-size: 13px; line-height: 20px; font-weight: 500; white-space: nowrap; transition: color var(--dur); border-radius: var(--radius-xs) var(--radius-xs) 0 0;
}
.tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 999px; background: transparent; transition: background var(--dur); }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); }
.tab.active::after { background: var(--primary); }
.tab:focus-visible { outline-offset: -2px; }
.tab .count { font-size: 12px; font-weight: 400; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tab .icon { width: 14px; height: 14px; }
.tab .icon { color: var(--text-3); }
.tab.active .icon { color: var(--text-2); }
.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fade-in 180ms var(--ease); }
.tabs-pill { border-bottom: 0; gap: 2px; padding: 2px; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius); display: inline-flex; max-width: 100%; }
.tabs-pill .tab { border-radius: 6px; padding: 0 10px; height: 28px; font-size: 12.5px; }
.tabs-pill .tab::after { display: none; }
.tabs-pill .tab.active { background: var(--surface); box-shadow: var(--shadow-sm), 0 0 0 1px var(--border); }

.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 11px 20px; border-bottom: 1px solid var(--divider); color: inherit; min-width: 0; transition: background var(--dur); }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover, .list-item.clickable:hover { background: var(--surface-hover); text-decoration: none; cursor: pointer; color: inherit; }
a.list-item:focus-visible { outline-offset: -2px; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-title { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); display: block; }
.list-item .li-sub { font-size: 12.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.list-item .li-end { flex: none; display: flex; align-items: center; gap: 8px; color: var(--text-3); font-size: 12.5px; }

.feed { position: relative; }
.feed-item { display: flex; gap: 12px; padding: 10px 0; position: relative; }
.feed-item::before { content: ""; position: absolute; left: 13px; top: 38px; bottom: -8px; width: 1px; background: var(--border); }
.feed-item:last-child::before { display: none; }
.feed-icon { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--surface); color: var(--text-3); border: 1px solid var(--border); position: relative; z-index: 1; }
.feed-icon .icon { width: 13px; height: 13px; }
.feed-item > .avatar { position: relative; z-index: 1; box-shadow: 0 0 0 3px var(--surface); }
.feed-item > .actor-lead { z-index: 1; width: 28px; height: 28px; margin-top: 0; }
.feed-item > .actor-lead .avatar { --size: 28px; box-shadow: 0 0 0 3px var(--surface); }
.feed-item > .actor-lead .actor-lead-icon { width: 16px; height: 16px; right: -5px; bottom: -3px; }
.feed-body { flex: 1; min-width: 0; padding-top: 4px; }
.feed-text { font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.feed-text strong { color: var(--text); font-weight: 600; }
.feed-time { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.feed-detail { margin-top: 6px; padding: 8px 12px; border-radius: var(--radius); background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--text-2); }

.callout { display: flex; gap: 10px; padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--surface-2); font-size: 13px; line-height: 1.55; color: var(--text-2); }
.callout .icon { margin-top: 2px; flex: none; }
.callout > :not(.icon) { min-width: 0; overflow-wrap: anywhere; }
.callout code { word-break: break-all; }
.callout-title { font-weight: 600; color: var(--text); margin-bottom: 2px; }
.callout-info { background: var(--blue-bg); border-color: var(--blue-border); }
.callout-info > .icon { color: var(--blue); }
.callout-success { background: var(--green-bg); border-color: var(--green-border); }
.callout-success > .icon { color: var(--green); }
.callout-warn { background: var(--amber-bg); border-color: var(--amber-border); }
.callout-warn > .icon { color: var(--amber); }
.callout-danger { background: var(--red-bg); border-color: var(--red-border); }
.callout-danger > .icon { color: var(--red); }
.callout-primary { background: var(--primary-subtle); border-color: var(--primary-border); }
.callout-primary > .icon { color: var(--primary); }

.kbd { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; font-family: var(--font-sans); font-size: 11px; font-weight: 600; color: var(--text-3); background: var(--surface); line-height: 1; }

.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-2); border-top-color: var(--primary); animation: spin 700ms linear infinite; display: inline-block; flex: none; }
.spinner-lg { width: 28px; height: 28px; border-width: 3px; }
.loading-block { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 40px; color: var(--text-3); font-size: 13px; }
.skeleton, .skel {
  --skel-base: color-mix(in oklab, var(--text) 7%, transparent); --skel-shine: color-mix(in oklab, var(--text) 3%, transparent);
  display: block; background: linear-gradient(90deg, var(--skel-base) 0%, var(--skel-base) 30%, var(--skel-shine) 50%, var(--skel-base) 70%, var(--skel-base) 100%);
  background-size: 220% 100%; animation: shimmer 1.5s ease-in-out infinite; border-radius: var(--radius-sm); pointer-events: none; user-select: none; color: transparent;
}
[data-theme="dark"] .skeleton, [data-theme="dark"] .skel { --skel-base: color-mix(in oklab, var(--text) 9%, transparent); --skel-shine: color-mix(in oklab, var(--text) 15%, transparent); }
.skeleton { min-height: 12px; }
.skel-line { height: 12px; width: 100%; border-radius: var(--radius-xs); }
.skel-line + .skel-line { margin-top: 8px; }
.skel-line.sm { height: 10px; }
.skel-line.lg { height: 16px; }
.skel-line.w-75 { width: 75%; } .skel-line.w-50 { width: 50%; } .skel-line.w-33 { width: 33%; }
.skel-block { height: 88px; width: 100%; border-radius: var(--radius-md); }
.skel-avatar { width: 32px; height: 32px; border-radius: 50%; flex: none; }
.skel-avatar.sm { width: 24px; height: 24px; }
.skel-avatar.lg { width: 40px; height: 40px; }
@media (prefers-reduced-motion: reduce) { .skeleton, .skel { animation: none; background: var(--skel-base); } }

[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%);
  padding: 5px 8px; border-radius: 6px; background: var(--text); color: var(--bg); font-size: 12px; font-weight: 500; line-height: 1.3; letter-spacing: 0;
  white-space: nowrap; pointer-events: none; z-index: 300; box-shadow: var(--shadow-md); animation: tip-in 140ms var(--ease-out); text-transform: none; font-family: var(--font-sans);
}
[data-tip-pos="bottom"]:hover::after, [data-tip-pos="bottom"]:focus-visible::after { bottom: auto; top: calc(100% + 7px); }
[data-tip-pos="right"]:hover::after, [data-tip-pos="right"]:focus-visible::after { bottom: auto; left: calc(100% + 10px); top: 50%; transform: translateY(-50%); }
[data-tip-pos="left"]:hover::after, [data-tip-pos="left"]:focus-visible::after { bottom: auto; left: auto; right: calc(100% + 10px); top: 50%; transform: translateY(-50%); }
@media (hover: none) { [data-tip]:hover::after { display: none; } }

.kv { display: grid; grid-template-columns: minmax(120px, 38%) 1fr; gap: 0; font-size: 13.5px; }
.kv > dt, .kv > .k { color: var(--text-3); padding: 7px 0; border-bottom: 1px solid var(--divider); }
.kv > dd, .kv > .v { margin: 0; padding: 7px 0; border-bottom: 1px solid var(--divider); color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.kv > dt:last-of-type, .kv > dd:last-of-type { border-bottom: 0; }
.kv-stack { display: flex; flex-direction: column; gap: 12px; }
.kv-stack .k { font-size: 11.5px; color: var(--text-3); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 3px; }

.inline-edit { border-radius: var(--radius-sm); padding: 2px 6px; margin: -2px -6px; cursor: text; transition: background var(--dur); display: block; min-height: 24px; }
.inline-edit:hover { background: var(--surface-hover); }
.inline-edit.empty { color: var(--text-4); }

.board { display: flex; gap: 14px; align-items: flex-start; overflow-x: auto; padding-bottom: 16px; min-height: 60vh; }
.board-col { flex: 0 0 300px; background: var(--surface-sunken); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.board-col-head { display: flex; align-items: center; gap: 8px; padding: 11px 12px 9px; font-weight: 600; font-size: 13px; }
.board-col-head .count { font-size: 11.5px; color: var(--text-3); font-weight: 600; background: var(--surface); border: 1px solid var(--border); padding: 0 7px; border-radius: 9px; }
.board-col-head .col-sum { margin-left: auto; font-size: 12px; color: var(--text-3); font-weight: 550; font-variant-numeric: tabular-nums; }
.board-col-body { flex: 1; overflow-y: auto; padding: 4px 8px 10px; display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.board-col.drag-over { border-color: var(--primary-border); background: var(--primary-subtle); }
.board-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 11px 12px; box-shadow: var(--shadow-xs);
  cursor: grab; transition: box-shadow var(--dur), border-color var(--dur), transform var(--dur); display: block; color: inherit;
}
.board-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); text-decoration: none; }
.board-card.dragging { opacity: 0.45; transform: rotate(1.5deg); }
.board-card-title { font-weight: 550; font-size: 13.5px; line-height: 1.35; }
.board-card-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--text-3); }
.drop-placeholder { height: 4px; border-radius: 2px; background: var(--primary); margin: -2px 0; }

.grid { display: grid; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.grid-auto { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; }
.grid-auto-sm { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.grid-main-side { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.grid-side-main { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 20px; align-items: start; }
.grid-2-1 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-1-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.stack-lg { display: flex; flex-direction: column; gap: 24px; }
.span-2 { grid-column: span 2; }
.span-all { grid-column: 1 / -1; }
.sticky-top { position: sticky; top: 16px; }
@media (min-width: 1560px) {
  .page .settings-flow { display: block; columns: 2; column-gap: 20px; }
  .page .settings-flow > *, .page .settings-flow > .settings-flow > * { break-inside: avoid; margin: 0 0 20px; }
  .page .settings-flow > .settings-flow { display: contents; }
}

.flex { display: flex; } .inline-flex { display: inline-flex; } .flex-col { flex-direction: column; } .flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; } .items-start { align-items: flex-start; } .items-end { align-items: flex-end; } .items-baseline { align-items: baseline; }
.justify-between { justify-content: space-between; } .justify-end { justify-content: flex-end; } .justify-center { justify-content: center; }
.flex-1 { flex: 1; min-width: 0; } .flex-none { flex: none; } .ml-auto { margin-left: auto; } .mr-auto { margin-right: auto; }
.gap-0 { gap: 0; } .gap-1 { gap: 4px; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; } .gap-5 { gap: 20px; } .gap-6 { gap: 24px; }
.mt-0 { margin-top: 0; } .mt-1 { margin-top: 4px; } .mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; } .mt-5 { margin-top: 20px; } .mt-6 { margin-top: 24px; } .mt-8 { margin-top: 32px; }
.mb-0 { margin-bottom: 0; } .mb-1 { margin-bottom: 4px; } .mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 20px; } .mb-6 { margin-bottom: 24px; }
.p-0 { padding: 0; } .p-2 { padding: 8px; } .p-3 { padding: 12px; } .p-4 { padding: 16px; } .px-4 { padding-left: 16px; padding-right: 16px; } .py-2 { padding-top: 8px; padding-bottom: 8px; }
.w-full { width: 100%; } .min-w-0 { min-width: 0; } .h-full { height: 100%; }
.text-xs { font-size: 12px; } .text-sm { font-size: 13px; } .text-base { font-size: 14px; } .text-md { font-size: 15px; } .text-lg { font-size: 17px; } .text-xl { font-size: 20px; } .text-2xl { font-size: 26px; letter-spacing: -0.025em; }
.fw-400 { font-weight: 400; } .fw-500 { font-weight: 500; } .fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.muted { color: var(--text-3); } .muted-2 { color: var(--text-2); } .text-strong { color: var(--text); }
.text-green { color: var(--green-text); } .text-red { color: var(--red-text); } .text-amber { color: var(--amber-text); } .text-blue { color: var(--blue-text); } .text-purple { color: var(--purple-text); } .text-primary { color: var(--primary-text); }
.text-right { text-align: right; } .text-center { text-align: center; } .text-left { text-align: left; }
.uppercase { text-transform: uppercase; letter-spacing: 0.05em; }
.overline { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--text-3); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.line-clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.line-clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.nowrap { white-space: nowrap; } .break { overflow-wrap: anywhere; } .pre-wrap { white-space: pre-wrap; }
.tnum { font-variant-numeric: tabular-nums; }
.strike { text-decoration: line-through; color: var(--text-3); }
.rounded { border-radius: var(--radius); } .rounded-lg { border-radius: var(--radius-lg); }
.border { border: 1px solid var(--border); } .border-t { border-top: 1px solid var(--divider); } .border-b { border-bottom: 1px solid var(--divider); }
.bg-sunken { background: var(--surface-sunken); } .bg-surface { background: var(--surface); } .bg-subtle { background: var(--surface-2); }
.relative { position: relative; } .overflow-hidden { overflow: hidden; } .overflow-auto { overflow: auto; }
.cursor-pointer { cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.divider { height: 1px; background: var(--divider); margin: 16px 0; }
.divider-v { width: 1px; align-self: stretch; background: var(--divider); }
.link { color: var(--primary-text); cursor: pointer; font-weight: 550; }
.link-plain { color: inherit; }
.link-plain:hover { color: var(--primary-text); text-decoration: none; }

.prose { font-size: 14px; line-height: 1.65; color: var(--text); overflow-wrap: anywhere; }
.prose > * + * { margin-top: 0.75em; }
.prose h1 { font-size: 22px; margin-top: 1.3em; } .prose h2 { font-size: 18px; margin-top: 1.2em; } .prose h3 { font-size: 15.5px; margin-top: 1.1em; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0.6em 0; }
.prose li + li { margin-top: 0.25em; }
.prose a { text-decoration: underline; text-underline-offset: 2px; }
.prose blockquote { margin: 0.8em 0; padding: 4px 0 4px 14px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.prose code { background: var(--surface-sunken); padding: 1px 5px; border-radius: 4px; border: 1px solid var(--border); font-size: 0.88em; }
.prose pre { background: #1c1917; color: #f5f5f4; padding: 12px 14px; border-radius: var(--radius); overflow-x: auto; font-size: 12.5px; line-height: 1.55; }
.prose pre code { background: none; border: 0; padding: 0; color: inherit; }
.prose table { border: 1px solid var(--border); border-radius: var(--radius); font-size: 13px; }
.prose th, .prose td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.prose th { background: var(--surface-2); font-weight: 600; }
.prose img { border-radius: var(--radius); border: 1px solid var(--border); }
.prose hr { margin: 1.4em 0; }
.prose-sm { font-size: 13px; }

.editor { border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-xs); transition: border-color var(--dur), box-shadow var(--dur); }
.editor:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.editor-toolbar { display: flex; align-items: center; gap: 2px; padding: 5px 6px; border-bottom: 1px solid var(--divider); flex-wrap: wrap; }
.editor-toolbar button { width: 28px; height: 28px; border: 0; border-radius: 6px; display: grid; place-items: center; background: none; color: var(--text-2); }
.editor-toolbar button:hover { background: var(--surface-hover); color: var(--text); }
.editor-toolbar button.active { background: var(--surface-active); color: var(--text); }
.editor-toolbar .sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.editor-toolbar button.editor-tool-text { width: auto; display: inline-flex; align-items: center; gap: 3px; padding: 0 8px; font-size: 12px; font-weight: 550; margin-left: auto; }
.page-error-banner { display: flex; align-items: center; gap: 12px; margin: 12px 16px 0; padding: 12px 14px; border: 1px solid var(--red-border); border-radius: var(--radius-md); background: var(--red-bg); color: var(--text); }
.page-error-icon { color: var(--red-text); display: grid; place-items: center; }
.phone-field { display: grid; grid-template-columns: minmax(0, 170px) minmax(0, 1fr); gap: 6px; }
.phone-field .ss-wrap, .phone-field .select { min-width: 0; }
@media (max-width: 480px) { .phone-field { grid-template-columns: minmax(0, 1fr); } }
.editor-pop { min-width: 200px; max-width: 264px; z-index: 1000; }
.editor-swatches { display: grid; grid-template-columns: repeat(5, 28px); gap: 6px; padding: 8px; }
.editor-swatch { width: 28px; height: 28px; border-radius: 6px; border: 1px solid var(--border); cursor: pointer; padding: 0; }
.editor-swatch:hover, .editor-swatch:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.editor-style-h1 { font-size: 18px; font-weight: 700; }
.editor-style-h2 { font-size: 16px; font-weight: 650; }
.editor-style-h3 { font-size: 14px; font-weight: 650; }
.editor-content { min-height: 120px; max-height: 480px; overflow-y: auto; padding: 10px 12px; outline: none; }
.editor-content:empty::before { content: attr(data-placeholder); color: var(--text-4); pointer-events: none; }
.editor-sm .editor-content { min-height: 64px; }

.mention { display: inline-flex; padding: 0 4px; border-radius: 4px; background: var(--primary-subtle); color: var(--primary-text); font-weight: 550; }

.note-card { border-radius: var(--radius-md); padding: 14px 14px 12px; border: 1px solid rgba(0,0,0,.06); box-shadow: 0 1px 2px rgba(0,0,0,.05), 0 6px 14px -8px rgba(0,0,0,.14); position: relative; min-height: 130px; display: flex; flex-direction: column; color: #292524; transition: transform var(--dur), box-shadow var(--dur); }
.note-card:hover { transform: translateY(-1px) rotate(-0.2deg); box-shadow: 0 2px 4px rgba(0,0,0,.06), 0 12px 24px -10px rgba(0,0,0,.2); }
.note-yellow { background: #fef7c3; } .note-amber { background: #fde9c4; } .note-green { background: #d9f5e1; } .note-blue { background: #dcebfe; }
.note-pink { background: #fce1ee; } .note-purple { background: #ece4fe; } .note-gray { background: #eeece9; }
[data-theme="dark"] .note-card { color: #1c1917; }

.swatch { width: 22px; height: 22px; border-radius: 6px; border: 2px solid transparent; cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.1); }
.swatch.active { border-color: var(--text); }
.swatches { display: flex; gap: 6px; flex-wrap: wrap; }

.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.cal-dow { padding: 8px 10px; font-size: 11.5px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cal-day { min-height: 118px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 3px; min-width: 0; transition: background 100ms; }
.cal-day.other { background: var(--surface-2); }
.cal-day.other .cal-num { color: var(--text-4); }
.cal-day.today .cal-num { background: var(--primary); color: #fff; }
.cal-day.drag-over { background: var(--primary-subtle); }
.cal-num { font-size: 12px; font-weight: 600; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--text-2); }
.cal-event { display: flex; align-items: center; gap: 5px; padding: 2px 6px; border-radius: 5px; font-size: 12px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; background: var(--surface-sunken); color: var(--text); border-left: 3px solid var(--text-4); }
.cal-event:hover { filter: brightness(0.97); }
.cal-more { font-size: 11.5px; color: var(--text-3); padding: 0 6px; cursor: pointer; font-weight: 550; }

.sheet-wrap { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); max-height: calc(100vh - 260px); }
.sheet { border-collapse: separate; border-spacing: 0; font-size: 13px; min-width: 100%; table-layout: fixed; }
.sheet th { position: sticky; top: 0; z-index: 3; background: var(--surface-2); font-weight: 600; font-size: 12px; color: var(--text-2); text-align: left; padding: 0 8px; height: 34px; border-bottom: 1px solid var(--border); border-right: 1px solid var(--divider); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; user-select: none; }
.sheet th .col-resize { position: absolute; right: -3px; top: 0; bottom: 0; width: 6px; cursor: col-resize; z-index: 4; }
.sheet th .col-resize:hover { background: var(--primary-border); }
.sheet td { height: 34px; padding: 0; border-bottom: 1px solid var(--divider); border-right: 1px solid var(--divider); overflow: hidden; white-space: nowrap; text-overflow: ellipsis; position: relative; }
.sheet td .cell { display: block; padding: 7px 8px; min-height: 33px; overflow: hidden; text-overflow: ellipsis; cursor: cell; outline: none; }
.sheet td .cell:focus, .sheet td.editing { box-shadow: inset 0 0 0 2px var(--primary); background: var(--surface); }
.sheet td input.cell-input, .sheet td select.cell-input { width: 100%; height: 33px; border: 0; padding: 0 8px; background: var(--surface); outline: none; box-shadow: inset 0 0 0 2px var(--primary); font-size: 13px; }
.sheet .row-num { width: 44px; text-align: center; color: var(--text-3); font-size: 11.5px; background: var(--surface-2); position: sticky; left: 0; z-index: 2; cursor: grab; }
.sheet th.row-num { z-index: 5; }
.sheet tr.selected td { background: var(--primary-subtle); }
.sheet tr:hover td .row-actions { opacity: 1; }

.timeline-grid { position: relative; }
.gantt-row { display: flex; align-items: center; height: 36px; border-bottom: 1px solid var(--divider); }
.gantt-label { width: 280px; flex: none; padding: 0 14px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-right: 1px solid var(--border); height: 100%; display: flex; align-items: center; gap: 8px; }
.gantt-track { flex: 1; position: relative; height: 100%; }
.gantt-bar { position: absolute; top: 8px; height: 20px; border-radius: 5px; background: var(--primary); color: #fff; font-size: 11px; font-weight: 600; padding: 0 7px; display: flex; align-items: center; white-space: nowrap; overflow: hidden; box-shadow: var(--shadow-xs); cursor: pointer; }

.chart { position: relative; width: 100%; }
.chart svg { overflow: visible; }
.chart .axis text, .chart text.axis-label { fill: var(--text-3); font-size: 11px; font-family: var(--font-sans); font-variant-numeric: tabular-nums; }
.chart .grid line { stroke: var(--chart-grid); stroke-width: 1; }
.chart .baseline { stroke: var(--border-strong); stroke-width: 1; }
.chart-tooltip {
  position: absolute; pointer-events: none; z-index: 10; min-width: 140px; padding: 8px 10px; background: var(--bg-elevated);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 12px; opacity: 0; transition: opacity 100ms;
  white-space: nowrap;
}
.chart-tooltip.show { opacity: 1; }
.chart-tooltip .tt-title { font-weight: 600; margin-bottom: 4px; color: var(--text); }
.chart-tooltip .tt-row { display: flex; align-items: center; gap: 8px; color: var(--text-2); }
.chart-tooltip .tt-row .tt-val { margin-left: auto; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; padding-left: 12px; }
.chart-tooltip .tt-swatch { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 12px; color: var(--text-2); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-swatch { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.bar-list { display: flex; flex-direction: column; gap: 10px; }
.bar-list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; font-size: 13px; }
.bar-list-row .bl-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text); }
.bar-list-row .bl-value { font-weight: 600; font-variant-numeric: tabular-nums; }
.bar-list-row .bl-track { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--surface-sunken); overflow: hidden; }
.bar-list-row .bl-fill { height: 100%; border-radius: 3px; background: var(--primary); }

.search-palette { width: 640px !important; margin-top: 12vh !important; margin-bottom: auto !important; }
.search-palette .modal-panel { border-radius: var(--radius-xl); max-height: min(560px, 76vh); }
.palette-input { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.palette-input input { border: 0; outline: none; background: none; flex: 1; min-width: 0; font-size: 15px; color: var(--text); }
.palette-input input::placeholder { color: var(--text-4); }
.palette-results { max-height: 420px; overflow-y: auto; padding: 6px; flex: 1; min-height: 0; }
.palette-group { padding: 10px 10px 4px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; min-height: 44px; border-radius: var(--radius); color: var(--text); cursor: pointer; }
.palette-item.active, .palette-item:hover { background: var(--surface-sunken); text-decoration: none; color: var(--text); }
.palette-item .pi-icon { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); color: var(--text-2); flex: none; }
.palette-item.active .pi-icon { color: var(--primary); border-color: var(--primary-border); }
.palette-item .pi-main { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.palette-item .pi-title { font-weight: 550; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item .pi-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.palette-item .pi-enter { color: var(--text-4); opacity: 0; transition: opacity var(--dur); }
.palette-item.active .pi-enter { opacity: 1; }
.palette-item mark { background: color-mix(in oklab, var(--primary) 20%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.palette-foot { display: flex; align-items: center; gap: 14px; padding: 9px 14px; border-top: 1px solid var(--border); font-size: 12px; color: var(--text-3); background: var(--surface-2); flex-wrap: wrap; }

.bell-menu { width: 400px; max-width: calc(100vw - 16px); padding: 0; overflow: hidden; }
.bell-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px 10px 16px; border-bottom: 1px solid var(--border); }
.bell-list { max-height: min(460px, 70vh); }
.bell-item { align-items: flex-start; padding: 11px 16px; gap: 12px; }
.bell-item.unread { background: color-mix(in oklab, var(--primary) 5%, var(--bg-elevated)); }
.bell-item .dot { margin-top: 7px; }
.bell-item .feed-icon { margin-top: 1px; }
.actor-lead { position: relative; flex: none; width: 30px; height: 30px; margin-top: 1px; }
.actor-lead-icon { position: absolute; right: -4px; bottom: -4px; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-elevated); color: var(--text-2); box-shadow: 0 0 0 1px var(--border); }
.actor-lead-icon .icon { width: 10px; height: 10px; }
.bell-title { display: block; font-weight: 550; font-size: 13px; color: var(--text); line-height: 1.4; }
.bell-msg { display: block; font-size: 12.5px; color: var(--text-2); line-height: 1.45; margin-top: 1px; }
.bell-meta { display: block; font-size: 11.5px; color: var(--text-3); margin-top: 3px; }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); background: var(--surface); }
.auth-side {
  position: relative; overflow: hidden; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; color: #fff;
  background: radial-gradient(1200px 600px at -10% -20%, color-mix(in oklab, var(--primary) 70%, #fff) 0%, transparent 55%),
              radial-gradient(900px 700px at 120% 120%, #7c2d12 0%, transparent 60%),
              linear-gradient(150deg, color-mix(in oklab, var(--primary) 92%, #000) 0%, #431407 100%);
}
.auth-side::after { content: ""; position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.06) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.06) 1px, transparent 1px); background-size: 44px 44px; mask-image: radial-gradient(ellipse at 30% 40%, #000 20%, transparent 75%); }
.auth-side > * { position: relative; z-index: 1; }
.auth-quote { font-size: 30px; line-height: 1.2; font-weight: 600; letter-spacing: -0.03em; max-width: 520px; font-family: var(--font-display); }
.auth-points { display: flex; flex-direction: column; gap: 14px; margin-top: 28px; }
.auth-point { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: rgba(255,255,255,.88); }
.auth-point .icon { margin-top: 2px; }
.auth-main { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h1 { font-size: 26px; }
.auth-card .auth-sub { color: var(--text-2); margin-top: 6px; margin-bottom: 26px; }
.auth-divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; margin: 18px 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.otp-inputs { display: flex; gap: 8px; justify-content: space-between; }
.otp-inputs input { width: 48px; height: 54px; text-align: center; font-size: 22px; font-weight: 600; border: 1px solid var(--border-2); border-radius: var(--radius-md); background: var(--surface); outline: none; }
.otp-inputs input:focus { border-color: var(--primary); box-shadow: var(--ring); }

.public-shell { min-height: 100vh; background: var(--bg); }
.public-header { background: var(--surface); border-bottom: 1px solid var(--border); padding: 14px 28px; display: flex; align-items: center; gap: 12px; }
.public-main { max-width: 1100px; margin: 0 auto; padding: 32px 24px 64px; }

.error-shell { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--bg); }
.error-card { width: 100%; max-width: 520px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); box-shadow: var(--shadow-sm); padding: 28px 32px 36px; }
.error-brand { display: flex; justify-content: center; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 14px; margin-bottom: 8px; }
.error-brand:hover { text-decoration: none; }
.error-code { font-size: 72px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; font-family: var(--font-serif); color: var(--primary); font-variant-numeric: lining-nums; }
.error-page { max-width: 520px; margin: 32px auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.error-card .error-page { margin-top: 20px; }
.error-icon { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; border: 1px dashed var(--border-strong); color: var(--text-3); margin-bottom: 4px; }
.error-icon .icon { width: 22px; height: 22px; stroke-width: 1.75; }
.error-icon-danger { color: var(--red); border-color: var(--red-border); background: var(--red-bg); border-style: solid; }
.error-icon-warn { color: var(--amber); border-color: var(--amber-border); background: var(--amber-bg); border-style: solid; }
.error-page .error-title { font-family: var(--font-serif); font-size: 24px; font-weight: 600; letter-spacing: -0.01em; white-space: normal; }
.error-page .error-text { color: var(--text-2); font-size: 14px; line-height: 1.6; max-width: 420px; }
.error-page .error-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; justify-content: center; }

.ai-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 70; width: 48px; height: 48px; border-radius: 16px; border: 0; color: #fff; display: grid; place-items: center;
  background: linear-gradient(145deg, color-mix(in oklab, var(--primary) 92%, white), color-mix(in oklab, var(--primary) 80%, #5a1d08)); box-shadow: 0 10px 28px -8px color-mix(in oklab, var(--primary) 65%, transparent), var(--shadow-md);
  transition: transform 160ms var(--ease-out), box-shadow 160ms var(--ease);
}
.ai-fab:hover { transform: translateY(-2px); }
.timer-pill {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 65; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 24px);
  padding: 6px 6px 6px 14px; border-radius: var(--radius-full); background: #211f1c; color: #fff; box-shadow: var(--shadow-xl); font-size: 13px;
  animation: toast-in 300ms var(--ease-out);
}
[data-theme="dark"] .timer-pill { background: #34302b; box-shadow: var(--shadow-xl), 0 0 0 1px #45403a; }
.timer-pill .timer-task { color: #fff; max-width: 240px; font-weight: 500; }
.timer-pill .timer-task:hover { color: #fff; }
.timer-pill .timer-time { font-variant-numeric: tabular-nums; font-weight: 650; }
.timer-pill .btn { height: 28px; border-radius: 14px; background: rgba(255,255,255,.1); border-color: transparent; color: #fff; box-shadow: none; }
.timer-pill .btn-icon { width: 28px; }
.timer-pill .btn:hover { background: rgba(255,255,255,.2); color: #fff; }

.priority { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 550; }
.priority .pbar { display: inline-flex; gap: 1.5px; align-items: flex-end; height: 11px; }
.priority .pbar i { width: 3px; border-radius: 1px; background: var(--border-strong); display: block; }
.priority .pbar i:nth-child(1) { height: 4px; } .priority .pbar i:nth-child(2) { height: 7px; } .priority .pbar i:nth-child(3) { height: 11px; }
.priority.low .pbar i:nth-child(1) { background: var(--text-3); }
.priority.medium .pbar i:nth-child(-n+2) { background: var(--amber); }
.priority.high .pbar i { background: var(--orange); }
.priority.critical .pbar i { background: var(--red); }
.priority.critical { color: var(--red-text); }

.status-select { appearance: none; border: 0; background: transparent; cursor: pointer; padding: 0; }
.pill-select { display: inline-flex; align-items: center; gap: 4px; cursor: pointer; }

.checklist-item { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius-sm); }
.checklist-item:hover { background: var(--surface-2); }
.checklist-item.done .checklist-text { text-decoration: line-through; color: var(--text-3); }
.checklist-item .checklist-text { flex: 1; min-width: 0; }
.checklist-item .row-actions { opacity: 0; transition: opacity var(--dur); }
.checklist-item:hover .row-actions { opacity: 1; }

.hover-reveal .reveal { opacity: 0; transition: opacity var(--dur); }
.hover-reveal:hover .reveal, .hover-reveal:focus-within .reveal { opacity: 1; }

.file-drop { border: 1.5px dashed var(--border-strong); border-radius: var(--radius-md); padding: 22px; text-align: center; color: var(--text-3); background: var(--surface-2); transition: border-color var(--dur), background var(--dur); cursor: pointer; }
.file-drop:hover, .file-drop.drag { border-color: var(--primary); background: var(--primary-subtle); color: var(--primary-text); }
.file-tile { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); min-width: 0; }
.file-tile .file-ico { width: 32px; height: 32px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-sunken); color: var(--text-2); flex: none; }

.chat { display: flex; flex-direction: column; height: 100%; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 24px 0; }
.chat-inner { max-width: 780px; margin: 0 auto; padding: 0 24px; display: flex; flex-direction: column; gap: 22px; }
.msg { display: flex; gap: 12px; }
.msg-user { justify-content: flex-end; }
.msg-user .msg-bubble { background: var(--surface-sunken); border: 1px solid var(--border); border-radius: 16px 16px 4px 16px; padding: 10px 14px; max-width: 80%; }
.msg-ai .msg-avatar { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; color: #fff; flex: none; background: linear-gradient(140deg, var(--primary), color-mix(in oklab, var(--primary) 60%, #7c3aed)); }
.msg-ai .msg-content { flex: 1; min-width: 0; }
.composer { border: 1px solid var(--border-2); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-md); padding: 10px 10px 8px 14px; transition: border-color var(--dur), box-shadow var(--dur); }
.composer:focus-within { border-color: var(--primary-border); box-shadow: var(--shadow-md), var(--ring); }
.composer textarea { width: 100%; border: 0; outline: none; resize: none; background: transparent; font-size: 14.5px; line-height: 1.5; max-height: 220px; min-height: 24px; }
.thinking { display: inline-flex; gap: 4px; align-items: center; }
.thinking i { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); animation: wave 1.2s ease-in-out infinite; }
.thinking i:nth-child(2) { animation-delay: .15s; } .thinking i:nth-child(3) { animation-delay: .3s; }

.grid-hours { display: grid; grid-template-columns: 56px repeat(24, minmax(22px, 1fr)); gap: 2px; user-select: none; }
.grid-hours .gh-label { font-size: 11px; color: var(--text-3); display: flex; align-items: center; font-weight: 600; }
.grid-hours .gh-head { font-size: 10px; color: var(--text-3); text-align: center; font-variant-numeric: tabular-nums; }
.grid-hours .gh-cell { height: 28px; border-radius: 4px; background: var(--surface-sunken); border: 1px solid var(--border); cursor: pointer; font-size: 10px; display: grid; place-items: center; color: #fff; font-weight: 600; transition: transform 80ms; }
.grid-hours .gh-cell:hover { transform: scale(1.08); z-index: 1; }
.grid-hours .gh-cell.sel { outline: 2px solid var(--text); outline-offset: 1px; }
.grid-hours .gh-cell.now { box-shadow: 0 0 0 2px var(--primary); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes drawer-in { from { transform: translateX(48px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateX(calc(100% + 24px)); } }
@keyframes toast-life { from { transform: scaleX(1); } to { transform: scaleX(0); } }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes menu-up-in { from { opacity: 0; transform: translateY(4px) scale(0.98); } to { opacity: 1; transform: none; } }
@keyframes tip-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 currentColor; } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes wave { 0%, 60%, 100% { transform: translateY(0); opacity: .35; } 30% { transform: translateY(-4px); opacity: 1; } }
@keyframes slide-in-left { from { transform: translateX(-100%); } to { transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; scroll-behavior: auto !important; }
}

@media (min-width: 901px) {
  .stats:has(> :nth-child(4):last-child) { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats:has(> :nth-child(6):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .stats:has(> :nth-child(3):last-child) { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (min-width: 1100px) {
  .stats:has(> :nth-child(4):last-child) { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (min-width: 1500px) {
  .stats:has(> :nth-child(6):last-child) { grid-template-columns: repeat(6, minmax(0, 1fr)); }
}
@media (min-width: 1760px) {
  .grid-main-side { grid-template-columns: minmax(0, 1fr) 400px; }
  .grid-side-main { grid-template-columns: 340px minmax(0, 1fr); }
}
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main-side { grid-template-columns: minmax(0, 1fr) 300px; }
}
@media (max-width: 1080px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main-side, .grid-side-main, .grid-2-1, .grid-1-2 { grid-template-columns: minmax(0, 1fr); }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-side { display: none; }
}
@media (max-width: 900px) {
  .app { height: 100dvh; }
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 90; transform: translateX(-100%); visibility: hidden; transition: transform 260ms var(--ease-out), visibility 0s linear 260ms; width: min(300px, 86vw); box-shadow: var(--shadow-xl); border-right: 0; padding-bottom: env(safe-area-inset-bottom); }
  .sidebar.mobile-open { transform: none; visibility: visible; transition-delay: 0s; }
  .sidebar-scrim { position: fixed; inset: 0; background: var(--overlay); z-index: 85; animation: fade-in 200ms var(--ease); }
  body.nav-locked { overflow: hidden; }
  body.nav-locked .ai-widget, body.nav-locked .timer-pill { visibility: hidden; }
  .nav-item { height: 40px; font-size: 14px; }
  .nav-child { height: 36px; font-size: 13.5px; }
  .mobile-only { display: inline-flex !important; }
  .desktop-only { display: none !important; }
  .page { padding: 20px 16px 72px; }
  .page-header { position: static; margin: 0 -16px 20px; padding: 12px 16px; }
  .page-header:where(.page > :first-child, .page > :first-child > :first-child) { margin-top: -20px; padding-top: 20px; }
  .page-header:where(.page-full > *) { margin: 0; }
  .topbar { padding: 0 8px 0 8px; gap: 6px; }
  .crumbs { flex: 1 1 auto; }
  .crumbs .current { font-size: 14px; }
  .topbar-center { flex: 0 0 auto; padding: 0; max-width: none; min-width: 0; }
  .topbar-search { flex: none; width: 36px; height: 36px; padding: 0; justify-content: center; background: transparent; }
  .topbar-search > .icon { width: 17px; height: 17px; color: var(--text-2); }
  .topbar-actions { gap: 2px; }
  .topbar-search .truncate, .topbar-search .kbd { display: none; }
  .grid-2, .grid-3, .form-grid, .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: minmax(0, 1fr); }
  .form-grid .span-2, .form-grid .span-3 { grid-column: auto; }
  dialog.modal { width: calc(100vw - 20px) !important; max-width: calc(100vw - 20px); }
  .modal-header { padding: 16px 14px 14px 18px; }
  .modal-body { padding: 16px 18px; }
  .modal-footer { padding: 12px 18px; }
  .drawer-header { padding: 12px 12px 12px 18px; }
  .drawer-body { padding: 16px 18px; }
  .drawer-footer { padding: 12px 18px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 14px; }
  .stat-value { font-size: 21px; }
  .page-header, [data-portal="billing"] .page-header, [data-portal="sales"] .page-header, .page-header.flat { flex-direction: column; align-items: stretch; }
  .page-header-main { flex-basis: auto; }
  .page-actions { margin-left: 0; }
  h1 { font-size: 23px; }
  .page-title h1 { white-space: normal; }
  .toolbar .search { width: 100%; }
  .table th:first-child, .table td:first-child { padding-left: 16px; }
  .table th:last-child, .table td:last-child { padding-right: 16px; }
  .card-header { padding: 12px 16px; }
  .card-body { padding: 16px; }
  .setting-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .setting-row .setting-control .input, .setting-row .setting-control .select, .setting-row .setting-control .combo { width: 100%; }
  .list-item { padding: 11px 16px; }
  .bulk-bar { left: 12px; right: 12px; transform: translateY(20px); bottom: 12px; }
  .bulk-bar.show { transform: none; }
  .board-col { flex-basis: 84vw; }
  .kv { grid-template-columns: minmax(96px, 40%) 1fr; }
}
@media (max-width: 560px) {
  .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .toasts { left: 12px; right: 12px; bottom: 12px; width: auto; max-width: none; }
  .page-actions > .btn, .page-actions > .dropdown { flex: 1 1 auto; }
  .page-actions > .dropdown > .btn { width: 100%; }
  .form-actions > .btn, .modal-footer > .btn { flex: 1 1 auto; }
  .empty { padding: 40px 16px; }
  .stat-chips { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 4px 12px; margin: 0; }
  .stat-chips > .stat-chip { padding: 4px 0; border-left: 0; }
  .stat-label { white-space: normal; }
  .menu.open { position: fixed; left: 8px !important; right: 8px !important; top: auto !important; bottom: calc(8px + env(safe-area-inset-bottom)) !important; width: auto !important; min-width: 0 !important; max-width: none; max-height: 72vh; overflow-y: auto; z-index: 400; border-radius: var(--radius-lg); padding: 6px; animation-name: menu-up-in; box-shadow: var(--shadow-xl); }
  .menu.open .menu-item { min-height: 40px; font-size: 14px; }
  .sidebar .menu.open { z-index: 400; }
}

@media print {
  .sidebar, .topbar, .page-actions, .ai-fab, .timer-pill, .toasts, .no-print { display: none !important; }
  .app, .app-main, .app-scroll { display: block; height: auto; overflow: visible; }
  body { background: #fff; }
  .card { box-shadow: none; }
}
