/* ==========================================================================
   Orbit design system — tokens, primitives, components.
   Original styles. No external CSS frameworks; works under a strict CSP.
   ========================================================================== */

@font-face { font-family: "Inter"; src: url("fonts/Inter-Regular.woff") format("woff"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Medium.woff") format("woff"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-SemiBold.woff") format("woff"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Bold.woff") format("woff"); font-weight: 700; font-display: swap; }

:root {
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f1f1ed;
  --surface-3: #e9e9e4;
  --border: #e4e3dd;
  --border-strong: #d3d1c9;
  --text: #16171a;
  --text-2: #55585e;
  --text-3: #868990;

  --accent: #0d8a66;
  --accent-hover: #0a7556;
  --accent-soft: #e3f3ec;
  --accent-text: #08674c;
  --on-accent: #ffffff;

  --danger: #c2372f;
  --danger-hover: #a72d26;
  --danger-soft: #fbeceb;
  --warn: #9a5b00;
  --warn-soft: #fcf2df;
  --info-soft: #ebf0fb;

  --sidebar-bg: #fbfbf9;
  --scrim: rgba(16, 17, 20, .38);

  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;

  --shadow-sm: 0 1px 2px rgba(16, 17, 20, .05);
  --shadow: 0 1px 2px rgba(16, 17, 20, .04), 0 4px 16px rgba(16, 17, 20, .06);
  --shadow-lg: 0 2px 6px rgba(16, 17, 20, .06), 0 24px 64px rgba(16, 17, 20, .16);
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent);

  --sb-w: 252px;
  --sb-w-collapsed: 64px;
  --topbar-h: 58px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0d0e10;
  --surface: #15161a;
  --surface-2: #1b1d21;
  --surface-3: #23252a;
  --border: #25272c;
  --border-strong: #33363d;
  --text: #ececeb;
  --text-2: #a3a6ac;
  --text-3: #6f7279;
  --accent: #2bb886;
  --accent-hover: #41c896;
  --accent-soft: rgba(43, 184, 134, .13);
  --accent-text: #5cd6a8;
  --on-accent: #06281c;
  --danger: #e5554c;
  --danger-hover: #ef6b62;
  --danger-soft: rgba(229, 85, 76, .14);
  --warn: #e0a54a;
  --warn-soft: rgba(224, 165, 74, .13);
  --info-soft: rgba(110, 140, 220, .13);
  --sidebar-bg: #111215;
  --scrim: rgba(0, 0, 0, .55);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .3);
  --shadow-lg: 0 2px 8px rgba(0, 0, 0, .4), 0 28px 70px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  [data-theme="system"] {
    --bg: #0d0e10;
    --surface: #15161a;
    --surface-2: #1b1d21;
    --surface-3: #23252a;
    --border: #25272c;
    --border-strong: #33363d;
    --text: #ececeb;
    --text-2: #a3a6ac;
    --text-3: #6f7279;
    --accent: #2bb886;
    --accent-hover: #41c896;
    --accent-soft: rgba(43, 184, 134, .13);
    --accent-text: #5cd6a8;
    --on-accent: #06281c;
    --danger: #e5554c;
    --danger-hover: #ef6b62;
    --danger-soft: rgba(229, 85, 76, .14);
    --warn: #e0a54a;
    --warn-soft: rgba(224, 165, 74, .13);
    --info-soft: rgba(110, 140, 220, .13);
    --sidebar-bg: #111215;
    --scrim: rgba(0, 0, 0, .55);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .3);
    --shadow-lg: 0 2px 8px rgba(0, 0, 0, .4), 0 28px 70px rgba(0, 0, 0, .55);
    color-scheme: dark;
  }
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--font); font-size: 14px; line-height: 1.5;
  color: var(--text); background: var(--bg);
  -webkit-font-smoothing: antialiased; font-feature-settings: "cv11", "ss01";
}
h1, h2, h3 { margin: 0; letter-spacing: -.015em; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent-text); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
code { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 5px; padding: 1px 5px; }
kbd { font-family: var(--font); font-size: 11px; font-weight: 500; color: var(--text-3); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 5px; padding: 0 5px; min-width: 18px; display: inline-block; text-align: center; line-height: 17px; background: var(--surface); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-xs); }
::selection { background: color-mix(in srgb, var(--accent) 22%, transparent); }

.icon { width: 18px; height: 18px; flex: none; }
.icon-sm { width: 16px; height: 16px; flex: none; }
.icon-xs { width: 12px; height: 12px; flex: none; }
.muted { color: var(--text-2); }
.sm { font-size: 13px; }
.xs { font-size: 12px; }
.center { text-align: center; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; min-width: 0; }
.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; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--surface); padding: 8px 12px; border-radius: var(--radius-sm); box-shadow: var(--shadow); }
.skip-link:focus { top: 12px; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-text); margin-bottom: 6px; }
.mobile-only { display: none !important; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: var(--radius-sm);
  font: inherit; font-weight: 550; font-size: 14px; line-height: 1;
  border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .08s var(--ease);
  text-decoration: none !important;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .14), var(--shadow-sm); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-2); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: var(--danger-hover); }
.btn-sm { height: 30px; padding: 0 10px; font-size: 13px; gap: 6px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; font-weight: 550; color: var(--accent-text); cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.icon-btn {
  position: relative; display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--radius-sm);
  border: 0; background: transparent; color: var(--text-2); cursor: pointer; list-style: none;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn::-webkit-details-marker { display: none; }

/* ---------- Forms ---------- */
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; min-width: 0; }
.field label, .fieldset legend { font-size: 13px; font-weight: 550; color: var(--text); }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], select, textarea {
  width: 100%; height: 38px; padding: 0 12px; font: inherit; color: var(--text);
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 76px; }
select {
  appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23868990' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m7 10 5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 16px;
}
input:hover, select:hover, textarea:hover { border-color: color-mix(in srgb, var(--text-3) 60%, var(--border-strong)); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--focus); }
input:disabled, select:disabled, textarea:disabled { background: var(--surface-2); color: var(--text-2); cursor: not-allowed; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.has-error input:focus { box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent); }
.hint { font-size: 12.5px; color: var(--text-3); display: flex; align-items: center; gap: 6px; }
.hint.center { justify-content: center; }
.error { font-size: 12.5px; color: var(--danger); font-weight: 500; }
.fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 14px; }
.fieldset legend { padding: 0; margin-bottom: 10px; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; }
.form-row-end { display: flex; justify-content: flex-end; margin-top: -8px; font-size: 13px; }
.form-cols { grid-template-columns: 240px minmax(0, 1fr); gap: 32px; align-items: start; }
.form-side { display: grid; gap: 4px; }
.form-body { display: grid; gap: 16px; }
.inline-form { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) auto; align-items: end; }
.static-value { display: flex; align-items: center; gap: 10px; min-height: 38px; flex-wrap: wrap; }
.meta-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 0; padding: 14px; background: var(--surface-2); border-radius: var(--radius-sm); }
.meta-list dt { font-size: 12px; color: var(--text-3); }
.meta-list dd { margin: 2px 0 0; font-weight: 500; }

/* ---------- Chips, roles, callouts ---------- */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 550; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); white-space: nowrap; }
.chip-lg { height: 28px; padding: 0 12px; font-size: 12.5px; }
.chip-ok { color: var(--accent-text); background: var(--accent-soft); border-color: transparent; }
.chip-warn { color: var(--warn); background: var(--warn-soft); border-color: transparent; }
.chip-soft { height: 18px; font-size: 10.5px; margin-left: 6px; vertical-align: 1px; }
.role { display: inline-flex; height: 24px; align-items: center; padding: 0 9px; border-radius: 6px; font-size: 12px; font-weight: 550; background: var(--surface-2); color: var(--text-2); }
.role-owner { background: var(--accent-soft); color: var(--accent-text); }
.role-admin { background: var(--info-soft); color: color-mix(in srgb, #4a6fd0 80%, var(--text)); }
.callout { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-2); font-size: 13px; }
.callout .icon-sm { margin-top: 2px; }
.callout-warn { background: var(--warn-soft); color: var(--warn); }
.banner { display: flex; align-items: center; gap: 10px; padding: 9px 28px; font-size: 13px; background: var(--warn-soft); color: var(--warn); border-bottom: 1px solid var(--border); }
.banner form { margin-left: auto; }
.banner .link-btn { color: inherit; text-decoration: underline; }

/* ---------- Avatars ---------- */
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #1b3a8a)); color: #fff; font-size: 12px; font-weight: 600; letter-spacing: .02em; flex: none; }
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.avatar.xs { width: 24px; height: 24px; font-size: 10px; }
.avatar-btn { list-style: none; cursor: pointer; border-radius: 50%; display: block; }
.avatar-btn::-webkit-details-marker { display: none; }
.avatar-btn:hover .avatar { box-shadow: 0 0 0 3px var(--surface-3); }

/* ---------- App shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; width: var(--sb-w); flex: none;
  display: flex; flex-direction: column; gap: 8px; padding: 12px 10px;
  background: var(--sidebar-bg); border-right: 1px solid var(--border);
  transition: width .22s var(--ease); z-index: 30;
}
.sb-head { display: flex; align-items: center; height: 34px; padding: 0 6px; }
.brand { display: inline-flex; align-items: center; gap: 9px; color: var(--text); font-weight: 650; font-size: 15px; letter-spacing: -.01em; text-decoration: none !important; }
.logo-mark { width: 26px; height: 26px; color: var(--accent); flex: none; }
.logo-mark .logo-dot { fill: var(--text); }
.brand-lg { font-size: 17px; }
.brand-lg .logo-mark { width: 30px; height: 30px; }

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-panel {
  position: absolute; z-index: 50; top: calc(100% + 6px); left: 0; min-width: 236px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg);
  animation: pop .14s var(--ease);
}
.menu-right .menu-panel { left: auto; right: 0; }
.menu-panel.wide { width: 340px; }
.menu-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 6px 8px 4px; }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border-radius: var(--radius-xs);
  color: var(--text); font: inherit; font-size: 13.5px; background: none; border: 0; cursor: pointer; text-align: left; text-decoration: none !important;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--surface-2); }
.menu-item.is-current { font-weight: 550; }
.menu-item .icon-sm { color: var(--text-2); }
.menu-sep { height: 1px; background: var(--border); margin: 6px 2px; }
.menu-user { display: grid; padding: 8px; }
.menu-user span { font-size: 12.5px; color: var(--text-2); }
.menu-head { display: flex; justify-content: space-between; align-items: center; padding: 6px 8px 8px; font-size: 13px; }
.menu-empty { padding: 18px 8px; text-align: center; color: var(--text-3); font-size: 13px; }
.note small { display: block; color: var(--text-3); font-size: 11.5px; margin-top: 2px; }
.note.is-unread { background: var(--accent-soft); }
.dot-count { position: absolute; top: 3px; right: 2px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }

.ws-switch { margin: 2px 0 6px; }
.ws-current { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface); box-shadow: var(--shadow-sm); }
.ws-current:hover { border-color: var(--border-strong); }
.ws-avatar { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 7px; background: var(--text); color: var(--surface); font-size: 11px; font-weight: 650; flex: none; }
.ws-avatar.sm { width: 22px; height: 22px; font-size: 9.5px; border-radius: 6px; }
.ws-meta { display: grid; min-width: 0; flex: 1; line-height: 1.25; }
.ws-name { font-weight: 600; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-org { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ws-chev { color: var(--text-3); }
.ws-switch .menu-panel { width: 100%; min-width: 228px; }

.sb-nav { display: flex; flex-direction: column; gap: 1px; overflow-y: auto; flex: 1; margin: 0 -4px; padding: 0 4px; scrollbar-width: thin; }
.nav-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); padding: 14px 10px 5px; white-space: nowrap; }
.nav-item {
  position: relative; display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: var(--radius-sm);
  color: var(--text-2); font: inherit; font-size: 13.5px; font-weight: 500; text-decoration: none !important; white-space: nowrap;
  background: none; border: 0; cursor: pointer; width: 100%; text-align: left;
  transition: background-color .12s var(--ease), color .12s var(--ease);
}
.nav-item > span { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.nav-item:hover { background: var(--surface-2); color: var(--text); }
.nav-item.is-active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--border); }
.nav-item.is-active .icon { color: var(--accent); }
.nav-badge { font-style: normal; font-size: 10px; font-weight: 600; color: var(--text-3); border: 1px solid var(--border); border-radius: 5px; padding: 0 4px; line-height: 15px; }
.sb-foot { border-top: 1px solid var(--border); padding-top: 8px; }
.sb-toggle kbd { margin-left: auto; }

/* Collapsed sidebar */
.sb-collapsed .sidebar { width: var(--sb-w-collapsed); }
.sb-collapsed .brand-name, .sb-collapsed .ws-meta, .sb-collapsed .ws-chev, .sb-collapsed .nav-label,
.sb-collapsed .nav-item > span, .sb-collapsed .nav-badge, .sb-collapsed .sb-toggle kbd { display: none; }
.sb-collapsed .ws-current { padding: 6px; justify-content: center; border-color: transparent; box-shadow: none; background: transparent; }
.sb-collapsed .nav-item { justify-content: center; padding: 0; }
.sb-collapsed .sb-nav { gap: 2px; padding-top: 6px; }
.sb-collapsed .sb-toggle .icon { transform: scaleX(-1); }
.sb-collapsed .nav-item[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translateY(-50%);
  background: var(--text); color: var(--surface); font-size: 12px; font-weight: 500; padding: 5px 8px; border-radius: 6px; white-space: nowrap; pointer-events: none; z-index: 60;
}

.main-col { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 28px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--border);
}
.search-trigger {
  display: flex; align-items: center; gap: 10px; height: 34px; width: min(380px, 100%); padding: 0 10px 0 12px;
  font: inherit; font-size: 13px; color: var(--text-3); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer;
}
.search-trigger span { flex: 1; text-align: left; }
.search-trigger:hover { border-color: var(--border-strong); color: var(--text-2); }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.locale-form { display: flex; align-items: center; gap: 6px; color: var(--text-2); margin-right: 4px; }
.locale-form select { height: 32px; width: auto; border-color: transparent; background-color: transparent; padding-left: 4px; font-size: 13px; color: var(--text-2); }
.locale-form select:hover { background-color: var(--surface-2); }
.theme-ico { display: none; }
[data-theme="light"] .theme-ico-dark, [data-theme="dark"] .theme-ico-light { display: grid; }
[data-theme="system"] .theme-ico-dark { display: grid; }
@media (prefers-color-scheme: dark) { [data-theme="system"] .theme-ico-dark { display: none; } [data-theme="system"] .theme-ico-light { display: grid; } }

.content { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 28px 64px; display: grid; gap: 20px; align-content: start; }
.content:focus { outline: none; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 4px; }
.page-head .muted { margin-top: 4px; }
.page-actions { display: flex; gap: 8px; }
.scrim { display: none; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm); }
.card.flush { padding: 0; overflow: hidden; }
.card .pad, .pad { padding: 16px 20px; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.card.flush .card-head { margin-bottom: 0; border-bottom: 1px solid var(--border); }
.card-danger { border-color: color-mix(in srgb, var(--danger) 30%, var(--border)); }
.card-danger h2 { color: var(--danger); }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 20px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat {
  display: grid; gap: 10px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text); text-decoration: none !important; box-shadow: var(--shadow-sm); transition: border-color .15s var(--ease), transform .15s var(--ease);
}
a.stat:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.stat-label { display: flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); font-weight: 500; }
.stat-value { font-size: 26px; font-weight: 650; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat-text { font-size: 18px; line-height: 26px; }

.progress { width: 120px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-top: 8px; flex: none; }
.progress-bar { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s var(--ease); }
.p-0 { width: 0; } .p-10 { width: 10%; } .p-20 { width: 20%; } .p-30 { width: 30%; } .p-40 { width: 40%; } .p-50 { width: 50%; }
.p-60 { width: 60%; } .p-70 { width: 70%; } .p-80 { width: 80%; } .p-90 { width: 90%; } .p-100 { width: 100%; }

.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.check-item { display: flex; align-items: center; gap: 14px; padding: 11px 10px; border-radius: var(--radius-sm); }
.check-item:hover { background: var(--surface-2); }
.check-mark { width: 22px; height: 22px; border-radius: 50%; border: 1.5px dashed var(--border-strong); display: grid; place-items: center; flex: none; }
.is-done .check-mark { border: 0; background: var(--accent); color: var(--on-accent); }
.is-done strong { color: var(--text-2); text-decoration: line-through; text-decoration-color: var(--text-3); }
.is-planned { opacity: .72; }

.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.feed li { display: flex; gap: 10px; align-items: flex-start; }
.feed p { font-size: 13.5px; }
.perm-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.perm-list li { display: flex; gap: 8px; align-items: center; font-size: 13.5px; }
.perm-list .icon-sm, .ok { color: var(--accent); }

.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 10px; }
.module-tile { display: flex; align-items: flex-start; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text); text-decoration: none !important; transition: border-color .15s var(--ease), background-color .15s var(--ease); }
.module-tile:hover { border-color: var(--border-strong); background: var(--surface-2); }
.module-tile strong { display: block; font-size: 13.5px; font-weight: 600; }
.module-tile small { display: -webkit-box; font-size: 12px; line-height: 1.4; margin-top: 2px; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.module-tile .chip { height: 20px; font-size: 10.5px; padding: 0 7px; }
.module-ico { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); flex: none; }

.empty { color: var(--text-3); font-size: 13.5px; padding: 12px 0; }
.empty-state { display: grid; justify-items: center; text-align: center; gap: 10px; padding: 48px 24px; }
.empty-state .muted { max-width: 520px; }
.empty-ico { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); margin-bottom: 6px; }
.empty-ico .icon { width: 24px; height: 24px; }
.scope { width: 100%; max-width: 560px; text-align: left; margin: 14px 0 10px; padding: 16px 18px; background: var(--surface-2); border-radius: var(--radius-sm); }
.scope h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 10px; }
.scope-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.scope-list li { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; }
.scope-list .icon-sm { color: var(--accent); margin-top: 2px; }

.row-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.row-item:last-child { border-bottom: 0; }
.row-item > .icon { color: var(--text-2); }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 550; color: var(--text-3); padding: 10px 20px; background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px 20px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: color-mix(in srgb, var(--surface-2) 55%, transparent); }
.table tbody th { font-weight: 500; color: var(--text); background: none; font-size: 13px; }
.person { display: flex; align-items: center; gap: 10px; }
.person > div { display: grid; }
.role-form select { height: 30px; width: auto; min-width: 130px; font-size: 13px; }
.kv { display: inline-block; margin-right: 10px; }
.perm-table td, .perm-table th { text-align: center; padding: 8px 12px; }
.perm-table th:first-child, .perm-table tbody th { text-align: left; }
.role-help { margin-top: 16px; }
.role-help summary { cursor: pointer; font-size: 13px; color: var(--text-2); font-weight: 500; }
.role-help .table-wrap { margin-top: 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); }
.copy-row { display: grid; gap: 6px; margin-top: 16px; }
.copy-field { display: flex; gap: 8px; }
.copy-field input { font-family: var(--mono); font-size: 12px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; border-top: 1px solid var(--border); }

.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.project { display: grid; gap: 10px; align-content: start; }
.project.is-archived { opacity: .7; }
.project-head { display: flex; gap: 12px; align-items: center; }
.project-head h3 { font-size: 14.5px; }
.project-desc { min-height: 20px; }
.project-actions { display: flex; gap: 4px; margin: 2px -8px -6px; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 90; right: 20px; bottom: 20px; display: grid; gap: 8px; }
.toast {
  display: flex; align-items: center; gap: 10px; min-width: 280px; max-width: 420px; padding: 11px 12px 11px 14px;
  background: var(--text); color: var(--surface); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: 13.5px;
  animation: toast-in .25s var(--ease);
}
.toast span { flex: 1; }
.toast-success .icon-sm { color: var(--accent-hover); }
.toast-error .icon-sm { color: var(--danger-hover); }
.toast-close { background: none; border: 0; color: inherit; opacity: .6; cursor: pointer; padding: 2px; display: grid; }
.toast-close:hover { opacity: 1; }
.toast.is-leaving { animation: toast-out .2s var(--ease) forwards; }

/* ---------- Dialogs ---------- */
dialog { border: 0; padding: 0; color: var(--text); background: var(--surface); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
dialog::backdrop { background: var(--scrim); backdrop-filter: blur(2px); }
dialog[open] { animation: pop .16s var(--ease); }
.palette { width: min(620px, calc(100vw - 32px)); margin-top: 12vh; border: 1px solid var(--border); overflow: hidden; }
.palette-search { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); color: var(--text-3); }
.palette-search input { border: 0; height: 52px; padding: 0; font-size: 15px; background: transparent; box-shadow: none !important; }
.palette-list { list-style: none; margin: 0; padding: 6px; max-height: 380px; overflow-y: auto; }
.palette-group { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 10px 10px 4px; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm); cursor: pointer; font-size: 14px; }
.palette-item[aria-selected="true"] { background: var(--accent-soft); color: var(--accent-text); }
.palette-item .p-hint { margin-left: auto; font-size: 11.5px; color: var(--text-3); }
.palette-empty { padding: 28px; text-align: center; color: var(--text-3); }
.modal { width: min(460px, calc(100vw - 32px)); padding: 22px; }
.modal h2 { font-size: 17px; }
.modal p { color: var(--text-2); margin: 8px 0 20px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.shortcut-list { margin: 0; display: grid; gap: 2px; }
.shortcut-list div { display: flex; justify-content: space-between; align-items: center; padding: 8px 4px; border-bottom: 1px solid var(--border); }
.shortcut-list div:last-child { border-bottom: 0; }
.shortcut-list dd { margin: 0; color: var(--text-2); }

/* ---------- Auth ---------- */
.auth-grid { display: grid; grid-template-columns: minmax(380px, 42%) 1fr; min-height: 100vh; }
.auth-aside {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 36px 44px;
  background: #0c1412; color: #e8efeb;
}
.auth-aside .brand { color: #f4f7f5; }
.auth-aside .logo-mark { color: #34c493; }
.auth-aside .logo-mark .logo-dot { fill: #f4f7f5; }
.aside-copy { position: relative; z-index: 1; max-width: 420px; }
.aside-copy .eyebrow { color: #5fd9ac; }
.aside-copy h2 { font-size: 30px; line-height: 1.18; font-weight: 650; letter-spacing: -.025em; margin: 6px 0 26px; color: #fff; }
.aside-points { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.aside-points li { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: #b9c8c1; }
.aside-points .icon-sm { color: #5fd9ac; margin-top: 2px; }
.aside-foot { position: relative; z-index: 1; font-size: 12px; color: #6f857c; }
.aside-orbit { position: absolute; right: -180px; top: 50%; width: 560px; height: 560px; transform: translateY(-50%); pointer-events: none; }
.aside-orbit span { position: absolute; inset: 0; border: 1px solid rgba(95, 217, 172, .16); border-radius: 50%; animation: spin 60s linear infinite; }
.aside-orbit span:nth-child(2) { inset: 80px; animation-duration: 44s; animation-direction: reverse; }
.aside-orbit span:nth-child(3) { inset: 170px; animation-duration: 30s; border-color: rgba(95, 217, 172, .28); }
.aside-orbit span::after { content: ""; position: absolute; top: -4px; left: 50%; width: 8px; height: 8px; border-radius: 50%; background: #34c493; box-shadow: 0 0 18px #34c493; }
.aside-orbit span:nth-child(2)::after { background: #e8efeb; box-shadow: none; width: 6px; height: 6px; }
.auth-main { display: flex; flex-direction: column; padding: 20px 28px; }
.auth-top { display: flex; justify-content: flex-end; align-items: center; gap: 12px; }
.auth-body { flex: 1; display: grid; place-items: center; padding: 24px 0 48px; }
.auth-card { width: 100%; max-width: 400px; display: grid; gap: 14px; }
.auth-card.wide { max-width: 620px; }
.auth-card h1 { font-size: 26px; }
.auth-card .lede { color: var(--text-2); margin-bottom: 10px; }
.auth-card .form { gap: 18px; }
.auth-switch { text-align: center; font-size: 13.5px; color: var(--text-2); margin-top: 6px; }
.divider { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 12px; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.step-pill { justify-self: start; font-size: 12px; font-weight: 600; color: var(--accent-text); background: var(--accent-soft); padding: 4px 10px; border-radius: 999px; }
.error-card { text-align: center; justify-items: center; }
.error-code { font-size: 64px; font-weight: 700; letter-spacing: -.04em; line-height: 1; color: var(--surface-3); -webkit-text-stroke: 1px var(--border-strong); }

/* ---------- Motion ---------- */
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: 1fr; }
  .form-cols { grid-template-columns: 1fr; gap: 16px; }
}
@media (max-width: 860px) {
  .mobile-only { display: inline-grid !important; }
  .sidebar { position: fixed; left: 0; top: 0; transform: translateX(-100%); transition: transform .22s var(--ease); width: var(--sb-w) !important; box-shadow: var(--shadow-lg); }
  .sb-open .sidebar { transform: none; }
  .sb-open .scrim { display: block; position: fixed; inset: 0; background: var(--scrim); z-index: 25; }
  .sb-collapsed .brand-name, .sb-collapsed .ws-meta, .sb-collapsed .nav-label, .sb-collapsed .nav-item > span, .sb-collapsed .nav-badge { display: revert; }
  .sb-collapsed .nav-item { justify-content: flex-start; padding: 0 10px; }
  .sb-foot { display: none; }
  .topbar { padding: 0 14px; gap: 8px; }
  .search-trigger { width: 34px; flex: none; padding: 0; justify-content: center; border-color: transparent; background: transparent; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .locale-form select { max-width: 112px; }
  .locale-form .icon-sm { display: none; }
  .content { padding: 20px 16px 48px; }
  .banner { padding: 9px 16px; flex-wrap: wrap; }
  .auth-grid { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-top { justify-content: space-between; }
  .auth-top .brand.mobile-only { display: inline-flex !important; }
  .inline-form { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .table th, .table td { padding: 10px 14px; }
  .meta-list { grid-template-columns: 1fr; }
  .page-head { flex-direction: column; align-items: flex-start; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { padding: 14px; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
  .toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { min-width: 0; }
  h1 { font-size: 21px; }
}
