/* ==========================================================================
   Zointy Design System v2
   Tokens → base → layout (app shell) → components → modules → utilities
   ========================================================================== */

:root {
  --brand: #5b4bff;
  --brand-600: #4b3cf0;
  --brand-700: #3d2fd6;
  --brand-50: #f3f1ff;
  --brand-100: #e7e3ff;
  --violet: #7c3aed;
  --cyan: #14b8ff;
  --navy: #10152f;
  --grad: linear-gradient(135deg, #7c3aed 0%, #5b4bff 50%, #14b8ff 100%);

  --bg: #f6f7fb;
  --surface: #ffffff;
  --surface-2: #f9fafc;
  --surface-3: #f2f4f8;
  --hover: #f3f4f8;
  --border: #e7e9f0;
  --border-strong: #d6d9e3;
  --text: #0f1328;
  --text-2: #464d66;
  --muted: #7b8299;
  --faint: #a3a9bc;

  --green: #12a35f;  --green-bg: #e9f8f0;
  --red: #e5484d;    --red-bg: #fdeeee;
  --amber: #d97706;  --amber-bg: #fff6e5;
  --blue: #2370e8;   --blue-bg: #eaf2fe;
  --violet-c: #6c47ff; --violet-bg: #f1edff;
  --gray-c: #5e6681; --gray-bg: #f0f2f6;

  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 22px;
  --shadow-xs: 0 1px 2px rgba(16, 21, 47, .05);
  --shadow-sm: 0 1px 3px rgba(16, 21, 47, .06), 0 1px 2px rgba(16, 21, 47, .04);
  --shadow: 0 4px 16px rgba(16, 21, 47, .06), 0 1px 3px rgba(16, 21, 47, .05);
  --shadow-lg: 0 18px 50px rgba(16, 21, 47, .14), 0 4px 12px rgba(16, 21, 47, .06);
  --ring: 0 0 0 3px rgba(91, 75, 255, .22);

  --font: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Plus Jakarta Sans", "Inter", ui-sans-serif, system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  --sidebar-w: 256px;
  --topbar-h: 60px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0b0e1a;
  --surface: #121627;
  --surface-2: #161b2e;
  --surface-3: #1c2238;
  --hover: #1d2338;
  --border: #252c45;
  --border-strong: #323a58;
  --text: #eef0f8;
  --text-2: #bcc2d6;
  --muted: #8a92ab;
  --faint: #5f6782;
  --brand-50: #1d1a42;
  --brand-100: #29245c;
  --green-bg: #0f2a1f;  --green: #3ccf8e;
  --red-bg: #33161b;    --red: #ff6b70;
  --amber-bg: #2f2410;  --amber: #f5b43c;
  --blue-bg: #11223f;   --blue: #5d9cff;
  --violet-bg: #221c4a; --violet-c: #a493ff;
  --gray-bg: #1e2438;   --gray-c: #a5acc2;
  --shadow-xs: 0 1px 2px rgba(0,0,0,.3);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.35);
  --shadow: 0 6px 20px rgba(0,0,0,.35);
  --shadow-lg: 0 24px 60px rgba(0,0,0,.55);
  color-scheme: dark;
}

/* ---------------------------------------------------------------- Base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; font-family: var(--font); 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";
}
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
svg.icon { display: inline-block; flex-shrink: 0; vertical-align: middle; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; letter-spacing: -.015em; color: var(--text); }
h1 { font-size: 24px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
h4 { font-size: 13px; font-weight: 650; }
p { margin: 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
code, kbd { font-family: var(--mono); font-size: .9em; }
kbd {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 5px;
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: var(--surface); color: var(--muted); font-size: 11px;
}
::selection { background: rgba(91, 75, 255, .2); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
[hidden] { display: none !important; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }

/* ---------------------------------------------------------------- App shell */
.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; transition: grid-template-columns .2s ease; }
.app.is-collapsed { --sidebar-w: 72px; }

.sidebar {
  position: sticky; top: 0; height: 100vh; overflow: hidden; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--border); z-index: 40;
}
.sidebar-head { display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 16px; flex-shrink: 0; }
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 19px; letter-spacing: -.03em; color: var(--text); }
.logo img { width: 30px; height: 30px; }
.logo-text { white-space: nowrap; }

.org-switch {
  margin: 4px 12px 8px; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--surface-2); width: calc(100% - 24px); text-align: left; transition: background .15s;
}
.org-switch:hover { background: var(--hover); }
.org-logo { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex-shrink: 0; font-weight: 700; font-size: 12px; color: #fff; background: var(--grad); overflow: hidden; }
.org-logo img { width: 100%; height: 100%; object-fit: cover; }
.org-meta { min-width: 0; flex: 1; line-height: 1.25; }
.org-meta b { display: block; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.org-meta span { font-size: 11px; color: var(--muted); }

.side-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 4px 12px 16px; }
.side-group { margin-top: 14px; }
.side-label { font-size: 10.5px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 0 10px 6px; white-space: nowrap; }
.side-link {
  position: relative; display: flex; align-items: center; gap: 11px; height: 36px; padding: 0 10px; border-radius: 9px;
  color: var(--text-2); font-weight: 500; font-size: 13.5px; white-space: nowrap; transition: background .12s, color .12s;
}
.side-link .icon { color: var(--muted); transition: color .12s; }
.side-link:hover { background: var(--hover); color: var(--text); }
.side-link:hover .icon { color: var(--text-2); }
.side-link.active { background: var(--brand-50); color: var(--brand); font-weight: 600; }
.side-link.active .icon { color: var(--brand); }
:root[data-theme="dark"] .side-link.active { color: #b7adff; }
:root[data-theme="dark"] .side-link.active .icon { color: #b7adff; }
.side-link .count { margin-left: auto; font-size: 11px; font-weight: 600; color: var(--muted); background: var(--surface-3); border-radius: 20px; padding: 1px 7px; }
.side-link .soon { margin-left: auto; font-size: 9.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--violet-c); background: var(--violet-bg); border-radius: 20px; padding: 2px 6px; }
.side-foot { padding: 12px; border-top: 1px solid var(--border); }
.upgrade-card { border-radius: var(--r); padding: 14px; background: var(--grad); color: #fff; position: relative; overflow: hidden; }
.upgrade-card::after { content: ""; position: absolute; right: -30px; top: -30px; width: 110px; height: 110px; border-radius: 50%; background: rgba(255,255,255,.12); }
.upgrade-card b { display: block; font-size: 13px; }
.upgrade-card p { font-size: 12px; opacity: .85; margin: 3px 0 10px; }
.upgrade-card .btn { background: #fff; color: var(--brand-700); height: 30px; font-size: 12px; }

.app.is-collapsed .logo-text, .app.is-collapsed .org-meta, .app.is-collapsed .side-label, .app.is-collapsed .side-link span,
.app.is-collapsed .side-link .count, .app.is-collapsed .side-link .soon, .app.is-collapsed .upgrade-card, .app.is-collapsed .org-switch .icon { display: none; }
.app.is-collapsed .side-link { justify-content: center; padding: 0; }
.app.is-collapsed .org-switch { justify-content: center; padding: 6px; }
.app.is-collapsed .side-label { display: block; height: 1px; padding: 0; margin: 8px 10px; background: var(--border); font-size: 0; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 12px; padding: 0 24px;
  background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(180%) blur(14px); -webkit-backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.search-trigger {
  display: flex; align-items: center; gap: 10px; height: 38px; width: min(420px, 100%); padding: 0 8px 0 12px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: 13px; text-align: left; transition: border-color .15s, box-shadow .15s;
}
.search-trigger:hover { border-color: var(--border-strong); }
.search-trigger span { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn {
  position: relative; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; border: 0; background: transparent; color: var(--text-2); transition: background .12s;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn .dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--red); border: 2px solid var(--bg); }
.user-btn { display: flex; align-items: center; gap: 9px; padding: 4px 8px 4px 4px; border-radius: 10px; border: 0; background: transparent; }
.user-btn:hover { background: var(--hover); }
.user-btn .meta { text-align: left; line-height: 1.2; }
.user-btn .meta b { display: block; font-size: 13px; font-weight: 600; }
.user-btn .meta span { font-size: 11px; color: var(--muted); }

.content { padding: 28px 32px 56px; width: 100%; max-width: 1440px; margin: 0 auto; flex: 1; }
.content.wide { max-width: none; }
.announcement { display: flex; align-items: center; gap: 10px; padding: 10px 24px; font-size: 13px; background: var(--brand-50); color: var(--brand-700); border-bottom: 1px solid var(--brand-100); }
:root[data-theme="dark"] .announcement { color: #c8c0ff; }
.announcement b { font-weight: 650; }
.announcement form { margin-left: auto; }

/* ---------------------------------------------------------------- Page header */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; letter-spacing: -.025em; }
.page-head p { color: var(--muted); margin-top: 4px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.breadcrumbs { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); margin-bottom: 8px; }
.breadcrumbs a:hover { color: var(--text); }
.breadcrumbs .icon { color: var(--faint); }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--brand); }

/* ---------------------------------------------------------------- Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px; border-radius: 10px;
  border: 1px solid transparent; font-weight: 600; font-size: 13.5px; line-height: 1; white-space: nowrap; cursor: pointer; user-select: none;
  transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .05s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn.is-disabled { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(16,21,47,.12), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: var(--brand-600); }
.btn-secondary { background: var(--surface); border-color: var(--border); color: var(--text); box-shadow: var(--shadow-xs); }
.btn-secondary:hover { background: var(--hover); border-color: var(--border-strong); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--hover); color: var(--text); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(.95); }
.btn-danger-ghost { background: transparent; color: var(--red); }
.btn-danger-ghost:hover { background: var(--red-bg); }
.btn-success { background: var(--green); color: #fff; }
.btn-dark { background: var(--navy); color: #fff; }
.btn-gradient { background: var(--grad); color: #fff; box-shadow: 0 8px 24px rgba(91,75,255,.32); }
.btn-gradient:hover { filter: brightness(1.06); }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; border-radius: 8px; gap: 6px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 12px; border-radius: 7px; gap: 5px; }
.btn-lg { height: 46px; padding: 0 20px; font-size: 15px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { width: 38px; padding: 0; }
.btn-icon.btn-sm { width: 32px; }
.btn-icon.btn-xs { width: 26px; }
.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; }
.btn-group .btn:first-child { border-radius: 10px 0 0 10px; }
.btn-group .btn:last-child { border-radius: 0 10px 10px 0; }
.btn-group .btn + .btn { margin-left: -1px; }

/* ---------------------------------------------------------------- Cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-head h2, .card-head h3 { font-size: 15px; font-weight: 650; }
.card-head p { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.card-head.plain { border-bottom: 0; padding-bottom: 4px; }
.card-body { padding: 20px; }
.card-body.tight { padding: 12px; }
.card-foot { padding: 14px 20px; border-top: 1px solid var(--border); background: var(--surface-2); border-radius: 0 0 var(--r-lg) var(--r-lg); display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.card-link { transition: border-color .15s, box-shadow .15s, transform .15s; }
.card-link:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); }

/* Stat / KPI */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 18px 20px; box-shadow: var(--shadow-xs); position: relative; overflow: hidden; }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.stat-label { font-size: 12.5px; font-weight: 550; color: var(--muted); }
.stat-icon { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.stat-icon.green { background: var(--green-bg); color: var(--green); }
.stat-icon.red { background: var(--red-bg); color: var(--red); }
.stat-icon.amber { background: var(--amber-bg); color: var(--amber); }
.stat-icon.blue { background: var(--blue-bg); color: var(--blue); }
.stat-value { font-size: 26px; font-weight: 700; letter-spacing: -.03em; margin-top: 8px; font-variant-numeric: tabular-nums; }
.stat-foot { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12px; color: var(--muted); }
.trend { display: inline-flex; align-items: center; gap: 3px; font-weight: 650; font-size: 12px; padding: 1px 6px; border-radius: 20px; }
.trend.up { color: var(--green); background: var(--green-bg); }
.trend.down { color: var(--red); background: var(--red-bg); }
.trend.flat { color: var(--muted); background: var(--gray-bg); }

/* ---------------------------------------------------------------- Grids */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); }
.grid-side { grid-template-columns: minmax(260px, 340px) minmax(0, 1fr); }
.stack { display: flex; flex-direction: column; gap: 20px; }
.stack-sm { display: flex; flex-direction: column; gap: 10px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.mt-0 { margin-top: 0 !important; } .mt-1 { margin-top: 6px; } .mt-2 { margin-top: 12px; } .mt-3 { margin-top: 20px; } .mt-4 { margin-top: 28px; }
.mb-1 { margin-bottom: 6px; } .mb-2 { margin-bottom: 12px; } .mb-3 { margin-bottom: 20px; }
.ml-auto { margin-left: auto; }
.w-full { width: 100%; }
.flex-1 { flex: 1; min-width: 0; }

/* ---------------------------------------------------------------- Tables */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
.table th {
  text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .02em; color: var(--muted); padding: 10px 16px;
  background: var(--surface-2); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0;
}
.table td { padding: 12px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num, .table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.table .cell-main { font-weight: 600; color: var(--text); }
.table .cell-sub { font-size: 12px; color: var(--muted); margin-top: 1px; }
.table tr.is-link { cursor: pointer; }
.card > .table-wrap:first-child .table th:first-child { border-top-left-radius: var(--r-lg); }
.card > .table-wrap:first-child .table th:last-child { border-top-right-radius: var(--r-lg); }
.person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.person > div { min-width: 0; }

/* ---------------------------------------------------------------- Forms */
.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 .full, .form-grid .span-2 { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12.5px; font-weight: 600; color: var(--text-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .error-text { font-size: 12px; color: var(--red); }
.req::after { content: " *"; color: var(--red); }
.input, .select, .textarea {
  width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-size: 14px; transition: border-color .15s, box-shadow .15s; outline: none;
}
.textarea { height: auto; min-height: 96px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  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='%237b8299' 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;
}
.input:hover, .select:hover, .textarea:hover { border-color: var(--faint); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand); box-shadow: var(--ring); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.input-sm, .select.input-sm { height: 32px; font-size: 13px; border-radius: 8px; }
.input[readonly], .input:disabled { background: var(--surface-2); color: var(--muted); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group > .icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.input-group > .icon + .input { padding-left: 38px; }
.input-group > .input-addon { position: absolute; right: 6px; }
.input-prefix { display: flex; }
.input-prefix span { display: grid; place-items: center; padding: 0 12px; border: 1px solid var(--border-strong); border-right: 0; border-radius: 10px 0 0 10px; background: var(--surface-2); color: var(--muted); font-size: 13px; }
.input-prefix .input { border-radius: 0 10px 10px 0; }
.check { display: inline-flex; align-items: center; gap: 9px; font-size: 13.5px; cursor: pointer; user-select: none; }
.check input { width: 17px; height: 17px; accent-color: var(--brand); margin: 0; cursor: pointer; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; }
.switch input { appearance: none; -webkit-appearance: none; width: 36px; height: 20px; border-radius: 20px; background: var(--border-strong); position: relative; cursor: pointer; transition: background .2s; margin: 0; flex-shrink: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .2s; }
.switch input:checked { background: var(--brand); }
.switch input:checked::after { transform: translateX(16px); }
.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: 14px; font-weight: 650; margin-bottom: 4px; }
.form-section-desc { font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }

/* Segmented control / tabs */
.segmented { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface-3); border: 1px solid var(--border); gap: 2px; }
.segmented a, .segmented button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 7px; border: 0; background: transparent; font-size: 13px; font-weight: 550; color: var(--muted); }
.segmented a:hover, .segmented button:hover { color: var(--text); }
.segmented .active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs a, .tabs button { display: inline-flex; align-items: center; gap: 7px; padding: 10px 12px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font-weight: 550; font-size: 13.5px; white-space: nowrap; }
.tabs a:hover, .tabs button:hover { color: var(--text); }
.tabs .active { color: var(--text); border-bottom-color: var(--brand); }
.tabs .count { font-size: 11px; background: var(--surface-3); color: var(--muted); border-radius: 20px; padding: 0 6px; }

/* Toolbar */
.toolbar { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.toolbar .input-group { flex: 1; min-width: 200px; max-width: 360px; }
.toolbar .select { width: auto; min-width: 140px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------------------------------------------------------------- Badges, chips, avatars */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; white-space: nowrap; line-height: 1; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.no-dot::before { display: none; }
.badge-green { color: var(--green); background: var(--green-bg); }
.badge-red { color: var(--red); background: var(--red-bg); }
.badge-amber { color: var(--amber); background: var(--amber-bg); }
.badge-blue { color: var(--blue); background: var(--blue-bg); }
.badge-violet { color: var(--violet-c); background: var(--violet-bg); }
.badge-gray { color: var(--gray-c); background: var(--gray-bg); }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 7px; font-size: 12px; font-weight: 550; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }
.avatar {
  --h: 250; display: inline-grid; place-items: center; flex-shrink: 0; border-radius: 50%; font-weight: 650; letter-spacing: .01em;
  color: hsl(var(--h) 55% 35%); background: hsl(var(--h) 80% 93%);
}
:root[data-theme="dark"] .avatar { color: hsl(var(--h) 80% 82%); background: hsl(var(--h) 35% 24%); }
.avatar-xs { width: 22px; height: 22px; font-size: 9.5px; }
.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-md { width: 34px; height: 34px; font-size: 12.5px; }
.avatar-lg { width: 48px; height: 48px; font-size: 16px; }
.avatar-xl { width: 72px; height: 72px; font-size: 24px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.dot-status { width: 8px; height: 8px; border-radius: 50%; display: inline-block; background: var(--faint); }
.dot-status.green { background: var(--green); } .dot-status.red { background: var(--red); } .dot-status.amber { background: var(--amber); } .dot-status.blue { background: var(--blue); }
.icon-tile { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; flex-shrink: 0; background: var(--brand-50); color: var(--brand); }
.icon-tile.lg { width: 48px; height: 48px; border-radius: 14px; }
.icon-tile.green { background: var(--green-bg); color: var(--green); }
.icon-tile.red { background: var(--red-bg); color: var(--red); }
.icon-tile.amber { background: var(--amber-bg); color: var(--amber); }
.icon-tile.blue { background: var(--blue-bg); color: var(--blue); }
.icon-tile.gray { background: var(--gray-bg); color: var(--gray-c); }
.icon-tile.grad { background: var(--grad); color: #fff; }

/* ---------------------------------------------------------------- Alerts & toasts */
.alert { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--r); font-size: 13.5px; border: 1px solid transparent; margin-bottom: 16px; }
.alert .icon { margin-top: 1px; }
.alert-success { background: var(--green-bg); color: var(--green); border-color: color-mix(in srgb, var(--green) 20%, transparent); }
.alert-danger, .alert-error { background: var(--red-bg); color: var(--red); border-color: color-mix(in srgb, var(--red) 20%, transparent); }
.alert-warning { background: var(--amber-bg); color: var(--amber); border-color: color-mix(in srgb, var(--amber) 20%, transparent); }
.alert-info { background: var(--blue-bg); color: var(--blue); border-color: color-mix(in srgb, var(--blue) 20%, transparent); }
.alert b { font-weight: 650; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 10px; pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; min-width: 260px; max-width: 420px; padding: 12px 14px; border-radius: 12px;
  background: var(--navy); color: #fff; box-shadow: var(--shadow-lg); font-size: 13.5px; animation: toast-in .25s cubic-bezier(.2,.9,.3,1.2);
}
:root[data-theme="dark"] .toast { background: #262d4a; }
.toast .icon { flex-shrink: 0; }
.toast.success .icon { color: #4ade80; } .toast.danger .icon, .toast.error .icon { color: #ff8a8f; } .toast.warning .icon { color: #fbbf24; } .toast.info .icon { color: #93c5fd; }
.toast.is-leaving { animation: toast-out .2s ease forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------------------------------------------------------------- Empty states */
.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty-icon { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px; display: grid; place-items: center; background: var(--brand-50); color: var(--brand); }
.empty h3 { color: var(--text); font-size: 15px; margin-bottom: 4px; }
.empty p { max-width: 380px; margin: 0 auto; font-size: 13.5px; }
.empty .btn { margin-top: 16px; }
.empty.sm { padding: 28px 16px; }
.empty.sm .empty-icon { width: 44px; height: 44px; border-radius: 12px; }

/* ---------------------------------------------------------------- Modal & drawer (native <dialog>) */
dialog.modal {
  border: 0; padding: 0; border-radius: var(--r-xl); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden;
}
dialog.modal.lg { width: min(760px, calc(100vw - 32px)); }
dialog.modal.sm { width: min(420px, calc(100vw - 32px)); }
dialog.modal[open] { display: flex; flex-direction: column; animation: modal-in .22s cubic-bezier(.2,.9,.3,1.1); }
dialog::backdrop { background: rgba(10, 13, 30, .45); backdrop-filter: blur(3px); }
dialog.modal > form, dialog.modal > .modal-inner { display: flex; flex-direction: column; min-height: 0; max-height: inherit; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 20px 22px 6px; }
.modal-head h2 { font-size: 17px; }
.modal-head p { color: var(--muted); font-size: 13px; margin-top: 3px; }
.modal-body { padding: 16px 22px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }

dialog.drawer {
  margin: 0 0 0 auto; height: 100vh; max-height: 100vh; width: min(520px, 100vw); border: 0; padding: 0; background: var(--surface); color: var(--text);
  box-shadow: var(--shadow-lg); border-left: 1px solid var(--border);
}
dialog.drawer[open] { display: flex; flex-direction: column; animation: drawer-in .25s cubic-bezier(.2,.9,.3,1); }
dialog.drawer > form, dialog.drawer > .modal-inner { display: flex; flex-direction: column; height: 100%; }
dialog.drawer .modal-body { flex: 1; }
@keyframes drawer-in { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------------------------------------------------------- Dropdown */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; top: calc(100% + 6px); right: 0; z-index: 60; min-width: 220px; padding: 6px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-lg); display: none; animation: pop .14s ease;
}
.dropdown-menu.left { left: 0; right: auto; }
.dropdown.open > .dropdown-menu { display: block; }
.dropdown-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; border: 0; background: none; font-size: 13.5px; color: var(--text-2); text-align: left; }
.dropdown-item:hover { background: var(--hover); color: var(--text); }
.dropdown-item .icon { color: var(--muted); }
.dropdown-item.danger { color: var(--red); }
.dropdown-item.danger .icon { color: var(--red); }
.dropdown-item.active { color: var(--brand); font-weight: 600; }
.dropdown-sep { height: 1px; background: var(--border); margin: 6px 0; }
.dropdown-label { padding: 6px 10px 4px; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.dropdown-head { padding: 10px; display: flex; align-items: center; gap: 10px; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* Notifications panel */
.notif-menu { width: 360px; padding: 0; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.notif-list { max-height: 400px; overflow-y: auto; }
.notif { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border); font-size: 13px; }
.notif:hover { background: var(--hover); }
.notif.unread { background: color-mix(in srgb, var(--brand-50) 60%, transparent); }
.notif b { display: block; font-weight: 600; }
.notif p { color: var(--muted); font-size: 12.5px; }
.notif time { font-size: 11.5px; color: var(--faint); }

/* ---------------------------------------------------------------- Command palette */
.cmdk { width: min(640px, calc(100vw - 32px)); margin-top: 12vh; margin-bottom: auto; }
.cmdk-input { display: flex; align-items: center; gap: 12px; padding: 0 18px; border-bottom: 1px solid var(--border); }
.cmdk-input input { flex: 1; height: 56px; border: 0; outline: none; background: transparent; font-size: 16px; }
.cmdk-list { max-height: 420px; overflow-y: auto; padding: 8px; }
.cmdk-group { padding: 8px 10px 4px; font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--faint); }
.cmdk-item { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 9px; cursor: pointer; font-size: 14px; color: var(--text-2); }
.cmdk-item .icon-tile { width: 30px; height: 30px; border-radius: 8px; }
.cmdk-item small { display: block; color: var(--muted); font-size: 12px; }
.cmdk-item.active { background: var(--brand-50); color: var(--text); }
.cmdk-item .hint { margin-left: auto; color: var(--faint); font-size: 12px; }
.cmdk-foot { display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 12px; color: var(--muted); background: var(--surface-2); }
.cmdk-empty { padding: 30px; text-align: center; color: var(--muted); }

/* ---------------------------------------------------------------- Kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(272px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 8px; align-items: start; }
.kanban-col { background: var(--surface-3); border: 1px solid var(--border); border-radius: var(--r-lg); display: flex; flex-direction: column; max-height: calc(100vh - 230px); min-height: 160px; }
.kanban-head { display: flex; align-items: center; gap: 8px; padding: 12px 14px 8px; font-weight: 650; font-size: 13px; }
.kanban-head .count { color: var(--muted); font-weight: 600; font-size: 12px; background: var(--surface); border-radius: 20px; padding: 0 7px; border: 1px solid var(--border); }
.kanban-head .total { margin-left: auto; font-size: 12px; color: var(--muted); font-weight: 550; }
.kanban-list { padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; min-height: 60px; border-radius: 0 0 var(--r-lg) var(--r-lg); transition: background .15s; }
.kanban-list.is-over { background: color-mix(in srgb, var(--brand) 7%, transparent); }
.kanban-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; box-shadow: var(--shadow-xs); cursor: grab;
  transition: box-shadow .15s, border-color .15s, transform .15s;
}
.kanban-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.kanban-card.is-dragging { opacity: .5; transform: rotate(1.5deg); }
.kanban-card h4 { font-size: 13.5px; font-weight: 600; margin-bottom: 4px; line-height: 1.35; }
.kanban-card .meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); flex-wrap: wrap; }
.kanban-card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 8px; }
.kanban-add { display: flex; align-items: center; gap: 6px; margin: 0 10px 10px; padding: 8px; border-radius: 9px; border: 1px dashed var(--border-strong); background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 550; justify-content: center; }
.kanban-add:hover { color: var(--brand); border-color: var(--brand); background: var(--surface); }
.col-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }

/* ---------------------------------------------------------------- Timeline / activity */
.timeline { position: relative; display: flex; flex-direction: column; }
.tl-item { position: relative; display: flex; gap: 12px; padding-bottom: 18px; }
.tl-item:not(:last-child)::before { content: ""; position: absolute; left: 15px; top: 34px; bottom: 2px; width: 1px; background: var(--border); }
.tl-icon { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border); }
.tl-body { flex: 1; min-width: 0; padding-top: 5px; }
.tl-body .who { font-size: 13px; }
.tl-body .who b { font-weight: 600; }
.tl-body time { font-size: 12px; color: var(--faint); margin-left: 6px; }
.tl-text { margin-top: 6px; font-size: 13.5px; color: var(--text-2); background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; white-space: pre-wrap; word-break: break-word; }
.feed-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.feed-item:last-child { border-bottom: 0; }
.feed-item p { color: var(--text-2); }
.feed-item time { color: var(--faint); font-size: 12px; }

/* List rows */
.list { display: flex; flex-direction: column; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--border); transition: background .1s; }
.list-row:last-child { border-bottom: 0; }
a.list-row:hover { background: var(--surface-2); }
.list-row .title { font-weight: 600; font-size: 13.5px; }
.list-row .sub { font-size: 12px; color: var(--muted); }

/* Description list */
.dl { display: grid; grid-template-columns: 130px 1fr; gap: 10px 14px; font-size: 13.5px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; font-weight: 500; word-break: break-word; }

/* Progress */
.progress { height: 6px; border-radius: 10px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: var(--brand); transition: width .4s ease; }
.progress.green > span { background: var(--green); }
.progress.lg { height: 10px; }

/* Checklist (onboarding) */
.checklist-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.checklist-item .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; flex-shrink: 0; color: transparent; }
.checklist-item.done .tick { background: var(--green); border-color: var(--green); color: #fff; }
.checklist-item.done .label-text { color: var(--muted); text-decoration: line-through; }

/* ---------------------------------------------------------------- Charts */
.chart { position: relative; width: 100%; min-height: 220px; }
.chart svg { width: 100%; height: 100%; overflow: visible; }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 4; }
.chart .axis-label { fill: var(--faint); font-size: 11px; }
.chart-tooltip {
  position: absolute; pointer-events: none; z-index: 5; padding: 8px 10px; border-radius: 10px; background: var(--navy); color: #fff; font-size: 12px;
  box-shadow: var(--shadow-lg); white-space: nowrap; transform: translate(-50%, calc(-100% - 12px)); opacity: 0; transition: opacity .1s;
}
.chart-tooltip b { display: block; margin-bottom: 3px; font-weight: 600; }
.chart-tooltip .sw { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }
.legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.donut-wrap { display: flex; align-items: center; gap: 24px; }
.donut-wrap .chart { width: 170px; min-height: 170px; flex-shrink: 0; }
.donut-legend { flex: 1; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.donut-legend div { display: flex; align-items: center; gap: 8px; }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; }
.donut-legend b { margin-left: auto; font-variant-numeric: tabular-nums; }
.bar-list { display: flex; flex-direction: column; gap: 12px; }
.bar-list-row { font-size: 13px; }
.bar-list-row .row { justify-content: space-between; margin-bottom: 5px; }

/* ---------------------------------------------------------------- Calendar */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); }
.cal-dow { padding: 8px 10px; font-size: 11.5px; font-weight: 650; color: var(--muted); 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: 112px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.cal-day.muted-day { background: var(--surface-2); }
.cal-day.muted-day .cal-num { color: var(--faint); }
.cal-num { font-size: 12px; font-weight: 600; color: var(--text-2); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.today .cal-num { background: var(--brand); color: #fff; }
.cal-event { display: block; font-size: 11.5px; padding: 3px 7px; border-radius: 6px; background: var(--brand-50); color: var(--brand-700); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 550; }
:root[data-theme="dark"] .cal-event { color: #c8c0ff; }

/* ---------------------------------------------------------------- Chat */
.chat-layout { display: grid; grid-template-columns: 260px minmax(0, 1fr); height: calc(100vh - var(--topbar-h) - 140px); min-height: 460px; overflow: hidden; }
.chat-sidebar { border-right: 1px solid var(--border); overflow-y: auto; padding: 10px; background: var(--surface-2); }
.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.msg { display: flex; gap: 10px; max-width: 80%; }
.msg .bubble { background: var(--surface-3); border-radius: 4px 14px 14px 14px; padding: 9px 12px; font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.msg.mine { margin-left: auto; flex-direction: row-reverse; }
.msg.mine .bubble { background: var(--brand); color: #fff; border-radius: 14px 4px 14px 14px; }
.msg .meta { font-size: 11.5px; color: var(--faint); margin-bottom: 3px; }
.msg.mine .meta { text-align: right; }
.chat-compose { display: flex; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); align-items: flex-end; }
.chat-compose textarea { min-height: 42px; max-height: 160px; height: 42px; resize: none; }

/* ---------------------------------------------------------------- Misc */
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.text-lg { font-size: 16px; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-green { color: var(--green); } .text-red { color: var(--red); } .text-amber { color: var(--amber); } .text-brand { color: var(--brand); }
.fw-600 { font-weight: 600; } .fw-700 { font-weight: 700; }
.nowrap { white-space: nowrap; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tabular { font-variant-numeric: tabular-nums; }
.link { color: var(--brand); font-weight: 550; }
.link:hover { text-decoration: underline; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.code-box { font-family: var(--mono); font-size: 12.5px; background: var(--surface-3); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; word-break: break-all; }
.copy-field { display: flex; gap: 8px; }
.copy-field .input { font-family: var(--mono); font-size: 12.5px; }
.pager { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--border); font-size: 12.5px; }
.pager-btns { display: flex; gap: 6px; }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--hover), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 8px; }
@keyframes shimmer { to { background-position: -200% 0; } }
.welcome-banner {
  position: relative; overflow: hidden; border-radius: var(--r-xl); padding: 26px 28px; margin-bottom: 20px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0%, #14b8ff 0%, transparent 45%), radial-gradient(80% 120% at 0% 100%, #7c3aed 0%, transparent 55%), #4a3bf0;
}
.welcome-banner h1 { color: #fff; font-size: 24px; }
.welcome-banner p { color: rgba(255,255,255,.85); margin-top: 6px; max-width: 560px; }
.welcome-banner .btn-secondary { background: rgba(255,255,255,.14); color: #fff; border-color: rgba(255,255,255,.25); box-shadow: none; }
.welcome-banner .btn-secondary:hover { background: rgba(255,255,255,.22); }
.welcome-banner .btn-white { background: #fff; color: var(--brand-700); }
.welcome-banner::after { content: ""; position: absolute; right: -60px; bottom: -90px; width: 280px; height: 280px; border-radius: 50%; border: 40px solid rgba(255,255,255,.07); }
.quick-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.quick-action { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: var(--r); border: 1px solid var(--border); background: var(--surface); transition: border-color .15s, box-shadow .15s, transform .15s; }
.quick-action:hover { border-color: var(--brand-100); box-shadow: var(--shadow); transform: translateY(-1px); }
.quick-action b { font-size: 13.5px; display: block; }
.quick-action span { font-size: 12px; color: var(--muted); }
.app-tile { display: flex; flex-direction: column; gap: 12px; padding: 18px; border-radius: var(--r-lg); border: 1px solid var(--border); background: var(--surface); transition: border-color .15s, box-shadow .15s, transform .15s; }
.app-tile:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-2px); }
.app-tile p { font-size: 12.5px; color: var(--muted); }

/* Print */
@media print {
  .sidebar, .topbar, .no-print, .toasts, .announcement { display: none !important; }
  .app { display: block; }
  .content { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { box-shadow: none; border: 0; }
}

/* ---------------------------------------------------------------- Auth pages */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); background: var(--surface); }
.auth-panel { display: flex; flex-direction: column; padding: 32px 48px; }
.auth-form-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; padding: 32px 0; }
.auth-form-wrap > .auth-form { margin: auto 0; }
.auth-form { width: min(400px, 100%); }
.auth-form h1 { font-size: 28px; font-weight: 750; letter-spacing: -.03em; }
.auth-form .sub { color: var(--muted); margin: 8px 0 26px; font-size: 14.5px; }
.auth-form .field { margin-bottom: 16px; }
.auth-form .input { height: 44px; }
.auth-form .btn-lg { width: 100%; margin-top: 6px; }
.auth-foot { font-size: 13.5px; color: var(--muted); text-align: center; margin-top: 22px; }
.auth-foot a { color: var(--brand); font-weight: 600; }
.auth-aside {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 48px; color: #fff;
  background: radial-gradient(90% 70% at 100% 0%, rgba(20,184,255,.55) 0%, transparent 60%), radial-gradient(70% 70% at 0% 100%, rgba(124,58,237,.8) 0%, transparent 60%), #1a1546;
}
.auth-aside h2 { color: #fff; font-weight: 750; font-size: 34px; line-height: 1.15; letter-spacing: -.03em; max-width: 460px; }
.auth-aside p { color: rgba(255,255,255,.75); margin-top: 14px; font-size: 15px; max-width: 440px; }
.auth-aside .glass { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.14); border-radius: 18px; padding: 18px; backdrop-filter: blur(10px); }
.auth-feature { display: flex; gap: 12px; align-items: flex-start; font-size: 14px; color: rgba(255,255,255,.9); }
.auth-feature + .auth-feature { margin-top: 14px; }
.auth-feature .icon-tile { background: rgba(255,255,255,.12); color: #fff; width: 34px; height: 34px; border-radius: 10px; }
.pw-meter { height: 4px; border-radius: 4px; background: var(--surface-3); margin-top: 8px; overflow: hidden; }
.pw-meter span { display: block; height: 100%; width: 0; transition: width .2s, background .2s; }
.or-sep { display: flex; align-items: center; gap: 12px; color: var(--faint); font-size: 12px; margin: 18px 0; }
.or-sep::before, .or-sep::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* Error page */
.error-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; text-align: center; background: var(--bg); }
.error-code { font-family: var(--font-display); font-size: 88px; font-weight: 800; letter-spacing: -.05em; line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* ---------------------------------------------------------------- Responsive */
.mobile-only { display: none; }
@media (max-width: 1200px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .grid-main, .grid-side, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .auth { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
}
@media (max-width: 860px) {
  .app, .app.is-collapsed { grid-template-columns: minmax(0, 1fr); --sidebar-w: 280px; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 280px; transform: translateX(-100%); transition: transform .25s ease; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(10,13,30,.4); z-index: 35; }
  .app.is-collapsed .logo-text, .app.is-collapsed .org-meta, .app.is-collapsed .side-label, .app.is-collapsed .side-link span { display: initial; }
  .mobile-only { display: inline-grid; }
  .desktop-only { display: none !important; }
  .topbar { padding: 0 14px; }
  .content { padding: 20px 16px 48px; }
  .search-trigger kbd, .user-btn .meta { display: none; }
  .grid-2, .form-grid, .form-grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
  .page-head h1 { font-size: 21px; }
  .auth-panel { padding: 24px 20px; }
  .chat-layout { grid-template-columns: 1fr; }
  .chat-sidebar { display: none; }
  .dl { grid-template-columns: 1fr; gap: 2px 0; }
  .dl dd { margin-bottom: 10px; }
  .notif-menu { width: calc(100vw - 32px); right: -60px; }
}
@media (max-width: 520px) {
  .grid-4, .quick-actions { grid-template-columns: minmax(0, 1fr); }
  .stats { gap: 10px; }
  .stat { padding: 14px; }
  .stat-icon { width: 28px; height: 28px; border-radius: 8px; }
  .stat-label { font-size: 12px; }
  .stat-value { font-size: 20px; }
  .stat-foot span:not(.trend) { display: none; }
  .announcement { padding: 8px 14px; font-size: 12.5px; }
  .welcome-banner { padding: 20px; }
  .donut-wrap { flex-direction: column; align-items: stretch; }
  .donut-wrap .chart { margin: 0 auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.spinner { width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; display: inline-block; animation: spin .6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.side-link em { font-style: normal; }
.announcement.ann-success { background: var(--green-bg); color: var(--green); border-bottom-color: color-mix(in srgb, var(--green) 20%, transparent); }
.announcement.ann-warning { background: var(--amber-bg); color: var(--amber); border-bottom-color: color-mix(in srgb, var(--amber) 20%, transparent); }
.cmdk-input input:focus, .cmdk-input input:focus-visible { box-shadow: none; outline: none; }
