/* =========================================================================
   WTECH BUSINESS — design system
   Dark-first, thin borders, dense information, indigo brand.
   ========================================================================= */

:root {
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;

  /* brand family */
  --wtech: #8b5cf6;
  --arcade: #f97316;
  --ai: #22d3ee;
  --data: #22c55e;
  --business: #5b6cff;

  --primary: #5b6cff;
  --primary-strong: #4453f0;
  --primary-soft: rgba(91, 108, 255, 0.14);
  --primary-glow: rgba(91, 108, 255, 0.35);

  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.13);
  --warning: #f5a524;
  --warning-soft: rgba(245, 165, 36, 0.14);
  --danger: #f04f5a;
  --danger-soft: rgba(240, 79, 90, 0.14);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.13);
  --violet-soft: rgba(139, 92, 246, 0.15);

  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  --sidebar-w: 248px;
  --topbar-h: 58px;
  --ease: cubic-bezier(.2, .7, .2, 1);
}

:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #05070d;
  --bg-2: #080b14;
  --surface: #0b101d;
  --surface-2: #101729;
  --surface-3: #162036;
  --surface-hover: #131b2f;
  --border: rgba(148, 163, 209, 0.11);
  --border-strong: rgba(148, 163, 209, 0.2);
  --text: #e7ebf6;
  --text-2: #a4adc4;
  --text-3: #6b7592;
  --grid-line: rgba(148, 163, 209, 0.05);
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 12px 40px -12px rgba(0, 0, 0, 0.6);
  --shadow-pop: 0 24px 64px -16px rgba(0, 0, 0, 0.75), 0 0 0 1px var(--border-strong);
}

:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f6fb;
  --bg-2: #eef1f8;
  --surface: #ffffff;
  --surface-2: #f7f8fc;
  --surface-3: #eef1f8;
  --surface-hover: #f2f4fa;
  --border: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #0b1224;
  --text-2: #4a5572;
  --text-3: #8490ab;
  --grid-line: rgba(15, 23, 42, 0.045);
  --primary-soft: rgba(91, 108, 255, 0.1);
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 24px -12px rgba(15, 23, 42, 0.12);
  --shadow-pop: 0 24px 64px -16px rgba(15, 23, 42, 0.25), 0 0 0 1px var(--border-strong);
}

@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    color-scheme: light;
    --bg: #f4f6fb;
    --bg-2: #eef1f8;
    --surface: #ffffff;
    --surface-2: #f7f8fc;
    --surface-3: #eef1f8;
    --surface-hover: #f2f4fa;
    --border: rgba(15, 23, 42, 0.09);
    --border-strong: rgba(15, 23, 42, 0.16);
    --text: #0b1224;
    --text-2: #4a5572;
    --text-3: #8490ab;
    --grid-line: rgba(15, 23, 42, 0.045);
    --primary-soft: rgba(91, 108, 255, 0.1);
    --shadow: 0 1px 2px rgba(15, 23, 42, 0.05), 0 8px 24px -12px rgba(15, 23, 42, 0.12);
    --shadow-pop: 0 24px 64px -16px rgba(15, 23, 42, 0.25), 0 0 0 1px var(--border-strong);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "cv11", "ss01";
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-family: var(--font-display); letter-spacing: -0.015em; font-weight: 600; }
p { margin: 0; }
code, .mono { font-family: var(--font-mono); font-size: 0.92em; }
::selection { background: var(--primary-glow); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-track { background: transparent; }

svg.i { width: 16px; height: 16px; flex: none; vertical-align: -3px; }
.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.small { font-size: 12px; }
.xs { font-size: 11px; }
.caps { text-transform: uppercase; letter-spacing: 0.12em; font-size: 11px; font-weight: 600; }
.nowrap { white-space: nowrap; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.row-top { display: flex; align-items: flex-start; gap: 8px; }
.col { display: flex; flex-direction: column; gap: 8px; }
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.gap-4 { gap: 4px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-4 { margin-top: 4px; } .mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.w-full { width: 100%; }
.hidden { display: none !important; }
.right { text-align: right; }
.center { text-align: center; }

.grid { display: grid; gap: 16px; }
.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-6 { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: span 3; }
.span-4 { grid-column: span 4; }

/* ------------------------------------------------------------------ brand */
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--font-display); }
.brand-mark {
  width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--business), #7c3aed 120%);
  box-shadow: 0 0 0 1px rgba(255,255,255,.12) inset, 0 8px 20px -6px var(--primary-glow);
  color: white; font-weight: 700; font-size: 14px; letter-spacing: -0.04em;
}
.brand-name { font-weight: 700; letter-spacing: 0.08em; font-size: 13px; line-height: 1.1; }
.brand-name small { display: block; font-size: 9.5px; letter-spacing: 0.28em; color: var(--text-3); font-weight: 500; margin-top: 2px; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 34px; padding: 0 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease), transform .1s var(--ease), box-shadow .15s var(--ease);
  user-select: none;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-primary { background: var(--primary); border-color: transparent; color: #fff; box-shadow: 0 8px 24px -10px var(--primary-glow), 0 0 0 1px rgba(255,255,255,.08) inset; }
.btn-primary:hover { background: var(--primary-strong); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-hover); color: var(--text); }
.btn-outline { background: transparent; }
.btn-danger { background: var(--danger-soft); border-color: rgba(240,79,90,.35); color: #ff8a92; }
.btn-danger:hover { background: rgba(240,79,90,.22); }
.btn-success { background: var(--success); border-color: transparent; color: #04120a; font-weight: 600; }
.btn-success:hover { filter: brightness(1.08); }
.btn-warning { background: var(--warning-soft); border-color: rgba(245,165,36,.35); color: #ffc166; }
:root[data-theme="light"] .btn-danger { color: #c62834; }
:root[data-theme="light"] .btn-warning { color: #9a6200; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn-lg { height: 44px; padding: 0 22px; font-size: 14px; border-radius: var(--radius); }
.btn-icon { width: 34px; padding: 0; }
.btn-icon.btn-sm { width: 28px; }
.btn-block { width: 100%; }
.btn-group { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.btn-group .btn { border: 0; border-radius: 0; height: 30px; background: transparent; color: var(--text-2); }
.btn-group .btn + .btn { border-left: 1px solid var(--border); }
.btn-group .btn.active { background: var(--primary-soft); color: var(--text); }

.link { color: var(--primary); cursor: pointer; }
.link:hover { text-decoration: underline; }

/* ------------------------------------------------------------------ inputs */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .label { font-size: 12px; font-weight: 500; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.field .hint { font-size: 11.5px; color: var(--text-3); }
.field .error { font-size: 11.5px; color: var(--danger); }
.req::after { content: "*"; color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  width: 100%; height: 36px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--bg-2); color: var(--text);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease); outline: none;
}
.textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%238a93ad' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.invalid, .select.invalid, .textarea.invalid { border-color: var(--danger); }
.input-sm { height: 30px; font-size: 12.5px; }
.input-group { position: relative; display: flex; align-items: center; }
.input-group > svg { position: absolute; left: 10px; width: 16px; height: 16px; color: var(--text-3); pointer-events: none; }
.input-group > .input { padding-left: 34px; }
.input-prefix { display: flex; align-items: stretch; }
.input-prefix > span { display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--border-strong); border-right: 0; border-radius: var(--radius-sm) 0 0 var(--radius-sm); background: var(--surface-2); color: var(--text-2); font-size: 12px; }
.input-prefix > .input { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.check input { width: 16px; height: 16px; accent-color: var(--primary); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13px; }
.switch input { position: absolute; opacity: 0; }
.switch .track { width: 34px; height: 20px; border-radius: 20px; background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; transition: background .15s; flex: none; }
.switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--text-2); transition: transform .18s var(--ease), background .18s; }
.switch input:checked + .track { background: var(--primary); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(14px); background: #fff; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }

/* ------------------------------------------------------------------ cards */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); min-width: 0; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); min-height: 52px; }
.card-header h3 { font-size: 14px; font-weight: 600; font-family: var(--font-sans); letter-spacing: 0; }
.card-header .caps { color: var(--text-3); }
.card-body { padding: 18px; }
.card-body.tight { padding: 8px; }
.card-footer { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.card.hoverable { transition: border-color .15s var(--ease), transform .15s var(--ease); cursor: pointer; }
.card.hoverable:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.panel { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); }

/* KPI */
.kpi { padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.kpi .kpi-label { display: flex; align-items: center; justify-content: space-between; color: var(--text-2); font-size: 12px; font-weight: 500; }
.kpi .kpi-label svg { width: 16px; height: 16px; color: var(--text-3); }
.kpi .kpi-value { font-family: var(--font-display); font-size: 30px; font-weight: 600; letter-spacing: -0.03em; line-height: 1; }
.kpi .kpi-foot { font-size: 11.5px; color: var(--text-3); }
.kpi::after { content: ""; position: absolute; inset: auto -40% -60% auto; width: 160px; height: 160px; border-radius: 50%; background: radial-gradient(circle, var(--accent, var(--primary-soft)), transparent 70%); opacity: .5; pointer-events: none; }
.kpi.accent-warning { --accent: var(--warning-soft); }
.kpi.accent-danger { --accent: var(--danger-soft); }
.kpi.accent-success { --accent: var(--success-soft); }
.kpi.accent-ai { --accent: rgba(34, 211, 238, .14); }

/* ------------------------------------------------------------------ badges */
.badge {
  display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.01em; white-space: nowrap;
  background: var(--surface-3); color: var(--text-2); border: 1px solid var(--border);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-primary { background: var(--primary-soft); color: #9ea8ff; border-color: rgba(91,108,255,.25); }
.badge-success { background: var(--success-soft); color: #5ee08e; border-color: rgba(34,197,94,.25); }
.badge-warning { background: var(--warning-soft); color: #ffc166; border-color: rgba(245,165,36,.28); }
.badge-danger { background: var(--danger-soft); color: #ff8a92; border-color: rgba(240,79,90,.3); }
.badge-info { background: var(--info-soft); color: #7dd3fc; border-color: rgba(56,189,248,.25); }
.badge-violet { background: var(--violet-soft); color: #c4b5fd; border-color: rgba(139,92,246,.28); }
.badge-ai { background: rgba(34,211,238,.12); color: #67e8f9; border-color: rgba(34,211,238,.3); }
:root[data-theme="light"] .badge-primary { color: #3440c7; }
:root[data-theme="light"] .badge-success { color: #127a39; }
:root[data-theme="light"] .badge-warning { color: #8f5a00; }
:root[data-theme="light"] .badge-danger { color: #b3202b; }
:root[data-theme="light"] .badge-info { color: #0369a1; }
:root[data-theme="light"] .badge-violet { color: #6d28d9; }
:root[data-theme="light"] .badge-ai { color: #0e7490; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; color: var(--text-2); }
.chip button { border: 0; background: none; padding: 0; cursor: pointer; color: var(--text-3); display: grid; place-items: center; }
.chip svg { width: 12px; height: 12px; }
.kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 5px; border: 1px solid var(--border-strong); border-bottom-width: 2px; font-size: 10.5px; font-family: var(--font-mono); color: var(--text-2); background: var(--surface-2); }

/* avatar */
.avatar { width: 28px; height: 28px; border-radius: 50%; display: inline-grid; place-items: center; flex: none; font-size: 11px; font-weight: 600; color: #fff; background: linear-gradient(135deg, #3b4bd8, #7c3aed); border: 1px solid rgba(255,255,255,.1); overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-sm { width: 22px; height: 22px; font-size: 9.5px; }
.avatar-lg { width: 40px; height: 40px; font-size: 14px; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -6px; box-shadow: 0 0 0 2px var(--surface); }
.avatar-stack .avatar:first-child { margin-left: 0; }

/* progress & SLA */
.progress { height: 6px; border-radius: 6px; background: var(--surface-3); overflow: hidden; }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), #8b5cf6); transition: width .5s var(--ease); }
.progress.success > span { background: var(--success); }
.progress.warning > span { background: var(--warning); }
.progress.danger > span { background: var(--danger); }
.sla { display: flex; flex-direction: column; gap: 6px; min-width: 150px; }
.sla-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--text-2); font-family: var(--font-mono); }

/* ------------------------------------------------------------------ table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
.table th { text-align: left; font-weight: 500; font-size: 11.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .08em; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface); position: sticky; top: 0; z-index: 1; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr { transition: background .12s; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-hover); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .num { font-family: var(--font-mono); font-size: 12px; color: var(--text-2); white-space: nowrap; }
.table-compact td { padding: 8px 12px; }

/* ------------------------------------------------------------------ tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { position: relative; height: 40px; padding: 0 14px; display: inline-flex; align-items: center; gap: 8px; background: none; border: 0; color: var(--text-2); cursor: pointer; font-size: 13px; font-weight: 500; white-space: nowrap; }
.tab:hover { color: var(--text); }
.tab.active { color: var(--text); }
.tab.active::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2px; background: var(--primary); border-radius: 2px; box-shadow: 0 0 12px var(--primary-glow); }
.tab .count { font-size: 10.5px; padding: 0 6px; border-radius: 10px; background: var(--surface-3); color: var(--text-2); font-family: var(--font-mono); }
.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: 9px; background: var(--surface-2); border: 1px solid var(--border); }
.segmented button { height: 28px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; color: var(--text-2); cursor: pointer; font-size: 12.5px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.segmented button svg { width: 14px; height: 14px; }
.segmented button.active { background: var(--surface-3); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 0 0 1px var(--border); }

/* ------------------------------------------------------------------ app shell */
.shell { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
  border-right: 1px solid var(--border); background: var(--bg-2); padding: 14px 10px 10px; overflow-y: auto; z-index: 30;
}
.sidebar .brand { padding: 4px 8px 14px; }
.side-section { font-size: 10.5px; text-transform: uppercase; letter-spacing: .16em; color: var(--text-3); padding: 14px 10px 6px; font-weight: 600; }
.nav-link { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px; border-radius: 7px; color: var(--text-2); font-size: 13px; font-weight: 500; position: relative; transition: background .12s, color .12s; }
.nav-link svg { width: 17px; height: 17px; flex: none; opacity: .9; }
.nav-link:hover { background: var(--surface-hover); color: var(--text); }
.nav-link.active { background: var(--primary-soft); color: var(--text); }
.nav-link.active::before { content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--primary); box-shadow: 0 0 12px var(--primary-glow); }
.nav-link .nav-count { margin-left: auto; font-size: 10.5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--primary); color: #fff; display: grid; place-items: center; font-family: var(--font-mono); }
.sidebar-foot { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.tenant-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 9px; background: var(--surface); border: 1px solid var(--border); }
.tenant-logo { width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); font-weight: 700; font-size: 11px; overflow: hidden; flex: none; }
.tenant-logo img { width: 100%; height: 100%; object-fit: cover; }

.main { 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 22px;
  border-bottom: 1px solid var(--border); background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px);
}
.search-trigger { display: flex; align-items: center; gap: 10px; height: 34px; padding: 0 10px 0 12px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface); color: var(--text-3); cursor: pointer; width: min(420px, 100%); font-size: 13px; }
.search-trigger svg { width: 16px; height: 16px; }
.search-trigger .kbd { margin-left: auto; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.icon-btn { position: relative; width: 34px; height: 34px; border-radius: 8px; border: 1px solid transparent; background: transparent; color: var(--text-2); display: grid; place-items: center; cursor: pointer; }
.icon-btn:hover { background: var(--surface-hover); color: var(--text); border-color: var(--border); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn .ping { position: absolute; top: 6px; right: 6px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 9.5px; font-weight: 700; display: grid; place-items: center; box-shadow: 0 0 0 2px var(--bg); }
.content { padding: 24px 26px 60px; max-width: 1600px; width: 100%; margin: 0 auto; }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-header .eyebrow { font-size: 11px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--primary); margin-bottom: 6px; display: flex; align-items: center; gap: 8px; }
.page-header h1 { font-size: 26px; line-height: 1.15; }
.page-header p { color: var(--text-2); margin-top: 6px; max-width: 720px; }
.page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-3); margin-bottom: 10px; }
.breadcrumb a:hover { color: var(--text); }
.menu-toggle { display: none; }
.mobile-nav { display: none; }
.scrim { display: none; }

.dropdown { position: relative; }
.dropdown-menu {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 240px; background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: 12px; box-shadow: var(--shadow-pop); padding: 6px; z-index: 60; animation: pop .14s var(--ease);
}
.dropdown-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 7px; border: 0; background: none; text-align: left; cursor: pointer; font-size: 13px; color: var(--text-2); }
.dropdown-item:hover { background: var(--surface-hover); color: var(--text); }
.dropdown-item svg { width: 16px; height: 16px; }
.dropdown-sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* ------------------------------------------------------------------ overlays */
.overlay { position: fixed; inset: 0; background: rgba(3, 5, 10, .62); backdrop-filter: blur(3px); z-index: 80; display: grid; place-items: center; padding: 20px; animation: fade .15s var(--ease); }
.modal { width: min(560px, 100%); max-height: calc(100vh - 40px); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-xl); box-shadow: var(--shadow-pop); animation: pop .18s var(--ease); }
.modal.modal-lg { width: min(820px, 100%); }
.modal.modal-xl { width: min(1100px, 100%); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 22px 14px; border-bottom: 1px solid var(--border); }
.modal-header h3 { font-size: 17px; }
.modal-header p { font-size: 12.5px; color: var(--text-2); margin-top: 4px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }
.drawer-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(3,5,10,.5); animation: fade .15s; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100%); background: var(--surface); border-left: 1px solid var(--border-strong); z-index: 81; display: flex; flex-direction: column; animation: slide-in .2s var(--ease); box-shadow: var(--shadow-pop); }

.toast-host { position: fixed; right: 18px; bottom: 18px; z-index: 120; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 36px)); }
.toast { display: flex; gap: 12px; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-strong); box-shadow: var(--shadow-pop); animation: toast-in .25s var(--ease); font-size: 13px; }
.toast .toast-icon { width: 20px; height: 20px; flex: none; }
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }
.toast.info .toast-icon { color: var(--info); }
.toast button { margin-left: auto; background: none; border: 0; color: var(--text-3); cursor: pointer; padding: 0; height: 20px; }

/* command palette */
.cmdk { width: min(640px, 100%); background: var(--surface); border: 1px solid var(--border-strong); border-radius: 16px; box-shadow: var(--shadow-pop); overflow: hidden; align-self: start; margin-top: 12vh; animation: pop .16s var(--ease); }
.cmdk-head { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.cmdk-head svg { width: 18px; height: 18px; color: var(--text-3); }
.cmdk-head input { flex: 1; height: 54px; border: 0; background: transparent; outline: none; font-size: 15px; }
.cmdk-title { font-size: 10px; letter-spacing: .24em; color: var(--primary); font-weight: 700; padding: 12px 18px 4px; }
.cmdk-list { max-height: 420px; overflow-y: auto; padding: 6px; }
.cmdk-group { font-size: 10.5px; color: var(--text-3); text-transform: uppercase; letter-spacing: .14em; padding: 10px 12px 4px; font-weight: 600; }
.cmdk-item { display: flex; align-items: center; gap: 12px; width: 100%; padding: 9px 12px; border: 0; background: none; border-radius: 9px; cursor: pointer; text-align: left; color: var(--text-2); font-size: 13.5px; }
.cmdk-item svg { width: 17px; height: 17px; flex: none; }
.cmdk-item .sub { font-size: 11.5px; color: var(--text-3); }
.cmdk-item.active, .cmdk-item:hover { background: var(--primary-soft); color: var(--text); }
.cmdk-foot { display: flex; gap: 14px; padding: 10px 16px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-3); }

/* ------------------------------------------------------------------ empty / error / loading */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 48px 20px; gap: 12px; }
.empty .empty-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); border: 1px solid rgba(91,108,255,.25); box-shadow: 0 0 40px -8px var(--primary-glow); }
.empty .empty-icon svg { width: 26px; height: 26px; }
.empty h3 { font-size: 16px; letter-spacing: .06em; text-transform: uppercase; }
.empty p { color: var(--text-2); max-width: 420px; }
.state-page { min-height: calc(100vh - 140px); display: grid; place-items: center; text-align: center; padding: 30px; }
.state-code { font-family: var(--font-display); font-size: 88px; font-weight: 700; letter-spacing: -0.05em; line-height: 1; background: linear-gradient(180deg, var(--text), var(--text-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.state-tag { font-size: 11px; letter-spacing: .3em; color: var(--primary); font-weight: 700; margin-top: 10px; }

.loading-screen { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 200; }
.loading-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; }
.loading-inner .brand-mark { width: 48px; height: 48px; font-size: 20px; border-radius: 13px; animation: breathe 1.8s ease-in-out infinite; }
.loading-title { font-family: var(--font-display); letter-spacing: .32em; font-weight: 700; font-size: 14px; }
.loading-sub { font-size: 11px; letter-spacing: .34em; color: var(--text-3); font-family: var(--font-mono); }
.loading-bar { width: 220px; height: 2px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.loading-bar::after { content: ""; display: block; width: 40%; height: 100%; background: linear-gradient(90deg, transparent, var(--primary), transparent); animation: scan 1.2s ease-in-out infinite; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--border-strong); border-top-color: var(--primary); animation: spin .7s linear infinite; display: inline-block; }
.skeleton { background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 37%, var(--surface-2) 63%); background-size: 400% 100%; animation: shimmer 1.3s ease infinite; border-radius: 6px; }
.skeleton-line { height: 12px; margin: 8px 0; }
.skeleton-block { height: 88px; }

/* ------------------------------------------------------------------ timeline */
.timeline { position: relative; display: flex; flex-direction: column; }
.tl-item { position: relative; display: grid; grid-template-columns: 26px 1fr; gap: 12px; padding-bottom: 16px; }
.tl-item::before { content: ""; position: absolute; left: 12px; top: 22px; bottom: 0; width: 1px; background: var(--border-strong); }
.tl-item:last-child::before { display: none; }
.tl-dot { width: 25px; height: 25px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-2); z-index: 1; }
.tl-dot svg { width: 13px; height: 13px; }
.tl-dot.success { background: var(--success-soft); color: var(--success); border-color: rgba(34,197,94,.35); }
.tl-dot.danger { background: var(--danger-soft); color: var(--danger); border-color: rgba(240,79,90,.35); }
.tl-dot.warning { background: var(--warning-soft); color: var(--warning); border-color: rgba(245,165,36,.35); }
.tl-dot.primary { background: var(--primary-soft); color: var(--primary); border-color: rgba(91,108,255,.35); }
.tl-title { font-size: 13px; }
.tl-meta { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.tl-comment { margin-top: 8px; padding: 8px 12px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--border); color: var(--text-2); font-size: 12.5px; }

.feed-item { display: grid; grid-template-columns: 56px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.feed-item:last-child { border-bottom: 0; }
.feed-time { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-3); padding-top: 1px; }

/* ------------------------------------------------------------------ charts */
.chart { width: 100%; }
.chart text { fill: var(--text-3); font-size: 10.5px; font-family: var(--font-sans); }
.chart .grid-line { stroke: var(--border); stroke-dasharray: 3 4; }
.bar-row { display: grid; grid-template-columns: minmax(80px, 150px) 1fr 44px; align-items: center; gap: 12px; padding: 6px 0; font-size: 12.5px; }
.bar-row .bar-track { height: 8px; background: var(--surface-3); border-radius: 8px; overflow: hidden; }
.bar-row .bar-fill { height: 100%; border-radius: 8px; background: linear-gradient(90deg, var(--primary), #8b5cf6); transition: width .6s var(--ease); }
.bar-row .bar-value { text-align: right; font-family: var(--font-mono); color: var(--text-2); font-size: 12px; }
.legend { display: flex; flex-wrap: wrap; gap: 10px 16px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.gauge-value { font-family: var(--font-display); font-size: 34px; font-weight: 600; letter-spacing: -0.03em; }

/* ------------------------------------------------------------------ kanban */
.kanban { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(260px, 1fr); gap: 14px; overflow-x: auto; padding-bottom: 12px; align-items: start; }
.kanban-col { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-lg); display: flex; flex-direction: column; max-height: calc(100vh - 230px); min-height: 200px; transition: border-color .15s, background .15s; }
.kanban-col.drag-over { border-color: var(--primary); background: var(--primary-soft); }
.kanban-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.kanban-head .caps { color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.kanban-head .caps i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }
.kanban-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; overflow-y: auto; flex: 1; }
.task-card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; cursor: grab; transition: border-color .12s, transform .12s, box-shadow .12s; display: flex; flex-direction: column; gap: 8px; }
.task-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.task-card.dragging { opacity: .4; }
.task-card .task-title { font-size: 13px; font-weight: 500; line-height: 1.35; }
.task-card .task-meta { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--text-3); flex-wrap: wrap; }
.task-card .task-meta svg { width: 13px; height: 13px; }
.overdue { color: var(--danger) !important; }

/* 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-head { padding: 8px; font-size: 11px; color: var(--text-3); text-transform: uppercase; letter-spacing: .1em; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.cal-day { min-height: 108px; padding: 6px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; }
.cal-day.other { background: var(--bg-2); }
.cal-day.other .cal-num { color: var(--text-3); }
.cal-day.today .cal-num { background: var(--primary); color: #fff; }
.cal-num { font-size: 11.5px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-mono); }
.cal-event { font-size: 11px; padding: 3px 6px; border-radius: 5px; background: var(--primary-soft); color: var(--text); border-left: 2px solid var(--primary); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-event.done { opacity: .55; text-decoration: line-through; }
.cal-event.late { background: var(--danger-soft); border-left-color: var(--danger); }

/* ------------------------------------------------------------------ approvals */
.approval-card { padding: 16px 18px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px; align-items: start; }
.approval-meta { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.approval-meta .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-3); }
.approval-meta .v { font-size: 13px; margin-top: 2px; }
.approval-actions { display: flex; flex-direction: column; gap: 6px; min-width: 170px; }

/* ------------------------------------------------------------------ workflow canvas */
.wf-shell { display: grid; grid-template-columns: 220px minmax(0, 1fr) 320px; gap: 0; height: calc(100vh - var(--topbar-h) - 130px); min-height: 560px; border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.wf-palette, .wf-props { background: var(--surface); overflow-y: auto; }
.wf-palette { border-right: 1px solid var(--border); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.wf-props { border-left: 1px solid var(--border); }
.wf-palette-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; font-size: 12px; font-weight: 600; letter-spacing: .06em; transition: border-color .12s, transform .12s; }
.wf-palette-item:hover { border-color: var(--node, var(--primary)); transform: translateX(2px); }
.wf-palette-item i { width: 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; background: color-mix(in srgb, var(--node) 18%, transparent); color: var(--node); }
.wf-palette-item i svg { width: 14px; height: 14px; }
.wf-canvas-wrap { position: relative; overflow: auto; flex: 1; min-width: 0; height: 100%; background-color: var(--bg-2); background-image: radial-gradient(var(--grid-line) 1.2px, transparent 1.2px); background-size: 22px 22px; }
.wf-canvas { position: relative; width: 2400px; height: 1400px; }
.wf-canvas svg.wf-edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.wf-edge { fill: none; stroke: var(--text-3); stroke-width: 1.6; }
.wf-edge.visited { stroke: var(--primary); stroke-width: 2; filter: drop-shadow(0 0 4px var(--primary-glow)); }
.wf-edge.yes { stroke: var(--success); }
.wf-edge.no { stroke: var(--danger); }
.wf-edge.selected { stroke: var(--warning); stroke-width: 2.4; }
.wf-edge-hit { fill: none; stroke: transparent; stroke-width: 14; pointer-events: stroke; cursor: pointer; }
.wf-edge-label { font-size: 10px; font-weight: 700; letter-spacing: .08em; fill: var(--text-2); }
.wf-node {
  position: absolute; width: 180px; height: 78px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border-strong);
  box-shadow: var(--shadow); cursor: grab; user-select: none; touch-action: none; transition: border-color .12s, box-shadow .12s;
  --node: var(--primary);
}
.wf-node::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--node); }
.wf-node:hover { border-color: color-mix(in srgb, var(--node) 60%, var(--border-strong)); }
.wf-node.selected { border-color: var(--node); box-shadow: 0 0 0 3px color-mix(in srgb, var(--node) 25%, transparent), var(--shadow); }
.wf-node.current { box-shadow: 0 0 0 2px var(--warning), 0 0 30px -4px var(--warning); }
.wf-node.visited { border-color: color-mix(in srgb, var(--node) 50%, var(--border-strong)); }
.wf-node.dimmed { opacity: .55; }
.wf-node.dragging { cursor: grabbing; box-shadow: var(--shadow-pop); z-index: 5; }
.wf-node-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 4px 14px; }
.wf-node-head i { width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; background: color-mix(in srgb, var(--node) 18%, transparent); color: var(--node); flex: none; }
.wf-node-head i svg { width: 13px; height: 13px; }
.wf-node-type { font-size: 9.5px; font-weight: 700; letter-spacing: .14em; color: var(--node); }
.wf-node-name { padding: 0 12px 0 14px; font-size: 12.5px; font-weight: 500; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-node-sub { padding: 2px 12px 0 14px; font-size: 11px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wf-port { position: absolute; width: 14px; height: 14px; border-radius: 50%; background: var(--surface); border: 2px solid var(--text-3); cursor: crosshair; z-index: 2; }
.wf-port:hover, .wf-port.armed { border-color: var(--primary); background: var(--primary); box-shadow: 0 0 10px var(--primary-glow); }
.wf-port.in { left: -8px; top: 50%; transform: translateY(-50%); cursor: pointer; }
.wf-port.out { right: -8px; top: 50%; transform: translateY(-50%); }
.wf-port.yes { right: -8px; top: 30%; border-color: var(--success); }
.wf-port.no { right: -8px; top: 70%; border-color: var(--danger); }
.wf-connecting .wf-port.in { border-color: var(--primary); animation: pulse 1s infinite; }
.wf-toolbar { position: absolute; top: 12px; left: 12px; right: 12px; display: flex; gap: 8px; align-items: center; z-index: 6; pointer-events: none; }
.wf-toolbar > * { pointer-events: auto; }
.wf-hint { font-size: 12px; padding: 6px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border-strong); color: var(--text-2); box-shadow: var(--shadow); }
.wf-view { position: relative; height: 420px; overflow: auto; border-radius: var(--radius); border: 1px solid var(--border); background-color: var(--bg-2); background-image: radial-gradient(var(--grid-line) 1.2px, transparent 1.2px); background-size: 22px 22px; }
.wf-view .wf-node { cursor: default; }
.wf-mobile-note { display: none; }

.node-start { --node: #22c55e; }
.node-form { --node: #38bdf8; }
.node-approval { --node: #5b6cff; }
.node-task { --node: #a78bfa; }
.node-condition { --node: #f5a524; }
.node-assignment { --node: #2dd4bf; }
.node-notification { --node: #f472b6; }
.node-webhook { --node: #22d3ee; }
.node-wait { --node: #94a3b8; }
.node-end { --node: #f04f5a; }

/* ------------------------------------------------------------------ form designer */
.fd-shell { display: grid; grid-template-columns: 230px minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
.fd-toolbox { position: sticky; top: calc(var(--topbar-h) + 16px); display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 12px; }
.fd-tool { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border-radius: 9px; border: 1px solid var(--border); background: var(--surface-2); font-size: 11px; color: var(--text-2); cursor: grab; text-align: center; transition: border-color .12s, color .12s; }
.fd-tool:hover { border-color: var(--primary); color: var(--text); }
.fd-tool svg { width: 17px; height: 17px; }
.fd-canvas { min-height: 520px; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.fd-drop { border: 1.5px dashed var(--border-strong); border-radius: 12px; min-height: 60px; display: grid; place-items: center; color: var(--text-3); font-size: 12px; transition: all .12s; }
.fd-drop.over { border-color: var(--primary); background: var(--primary-soft); color: var(--text); }
.fd-slot { height: 6px; border-radius: 4px; transition: all .12s; }
.fd-slot.over { height: 38px; background: var(--primary-soft); border: 1.5px dashed var(--primary); }
.fd-field { position: relative; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.fd-field:hover { border-color: var(--border-strong); }
.fd-field.selected { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.fd-field .fd-field-actions { position: absolute; top: 8px; right: 8px; display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.fd-field:hover .fd-field-actions, .fd-field.selected .fd-field-actions { opacity: 1; }
.fd-field .fd-handle { cursor: grab; color: var(--text-3); }
.fd-field-top { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }
.fd-field-sub { font-size: 11.5px; color: var(--text-3); margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.fd-props { position: sticky; top: calc(var(--topbar-h) + 16px); max-height: calc(100vh - var(--topbar-h) - 32px); overflow-y: auto; }

/* condition editor */
.cond-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, .9fr) minmax(0, 1fr) 30px; gap: 6px; align-items: center; }
.cond-group { border: 1px dashed var(--border-strong); border-radius: 10px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }

/* dynamic form render */
.dyn-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.dyn-form .full { grid-column: 1 / -1; }
.dyn-heading { grid-column: 1 / -1; font-family: var(--font-display); font-size: 15px; font-weight: 600; margin-top: 6px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.dyn-divider { grid-column: 1 / -1; height: 1px; background: var(--border); margin: 4px 0; }
.options-inline { display: flex; flex-wrap: wrap; gap: 8px 16px; padding-top: 4px; }
.data-list { display: grid; grid-template-columns: minmax(120px, 220px) 1fr; gap: 0; }
.data-list > div { padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.data-list > div:nth-child(odd) { color: var(--text-3); padding-right: 12px; }
.data-list > div:nth-last-child(-n+2) { border-bottom: 0; }

/* comments */
.comment { display: grid; grid-template-columns: 32px 1fr; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.comment:last-child { border-bottom: 0; }
.comment-body { font-size: 13px; white-space: pre-wrap; word-break: break-word; margin-top: 4px; color: var(--text); }
.mention { color: var(--primary); font-weight: 600; background: var(--primary-soft); padding: 0 4px; border-radius: 4px; }
.composer { border: 1px solid var(--border-strong); border-radius: 12px; background: var(--bg-2); padding: 8px; position: relative; }
.composer textarea { border: 0; background: transparent; width: 100%; min-height: 60px; resize: vertical; outline: none; padding: 4px 6px; }
.composer-bar { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.mention-pop { position: absolute; left: 8px; bottom: calc(100% + 4px); width: 260px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 4px; z-index: 30; }
.file-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border); background: var(--surface-2); font-size: 12.5px; }
.file-row svg { width: 16px; height: 16px; color: var(--text-3); flex: none; }
.dropzone { border: 1.5px dashed var(--border-strong); border-radius: 10px; padding: 14px; text-align: center; color: var(--text-3); font-size: 12.5px; position: relative; cursor: pointer; }
.dropzone:hover { border-color: var(--primary); color: var(--text-2); }
.dropzone input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* process catalog */
.catalog-card { padding: 18px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; min-height: 150px; }
.catalog-card .cat-icon { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--c, var(--primary)); background: color-mix(in srgb, var(--c, var(--primary)) 16%, transparent); border: 1px solid color-mix(in srgb, var(--c, var(--primary)) 30%, transparent); }
.catalog-card .cat-icon svg { width: 18px; height: 18px; }
.catalog-card::after { content: ""; position: absolute; right: -40px; top: -40px; width: 120px; height: 120px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--c, var(--primary)) 22%, transparent), transparent 70%); }

/* onboarding */
.onboard-steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; }
.onboard-step { padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); display: flex; flex-direction: column; gap: 8px; }
.onboard-step .num { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; font-family: var(--font-mono); font-size: 12px; background: var(--surface-3); color: var(--text-2); }
.onboard-step.done { border-color: rgba(34,197,94,.35); }
.onboard-step.done .num { background: var(--success); color: #04120a; }
.onboard-step.current { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* ------------------------------------------------------------------ public / landing */
.public { min-height: 100vh; background: var(--bg); position: relative; overflow-x: hidden; }
.grid-bg { position: absolute; inset: 0; pointer-events: none; background-image: linear-gradient(var(--grid-line) 1px, transparent 1px), linear-gradient(90deg, var(--grid-line) 1px, transparent 1px); background-size: 56px 56px; mask-image: radial-gradient(ellipse 80% 70% at 50% 20%, #000 40%, transparent 100%); }
.glow { position: absolute; border-radius: 50%; filter: blur(80px); pointer-events: none; opacity: .55; }
.public-nav { position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; padding: 22px 40px; max-width: 1280px; margin: 0 auto; }
.public-nav nav { display: flex; gap: 26px; font-size: 13px; color: var(--text-2); }
.public-nav nav a:hover { color: var(--text); }
.hero { position: relative; z-index: 1; max-width: 1280px; margin: 0 auto; padding: 56px 40px 40px; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); gap: 56px; align-items: center; }
.hero-tag { display: inline-flex; align-items: center; gap: 10px; padding: 6px 12px 6px 6px; border-radius: 999px; border: 1px solid var(--border-strong); background: color-mix(in srgb, var(--surface) 70%, transparent); font-size: 11px; letter-spacing: .28em; font-weight: 600; color: var(--text-2); }
.hero-tag b { font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--primary); color: #fff; letter-spacing: .12em; }
.hero h1 { font-size: clamp(40px, 6vw, 72px); line-height: .98; letter-spacing: -0.045em; margin-top: 22px; font-weight: 600; }
.hero h1 em { font-style: normal; background: linear-gradient(90deg, #8f9bff, #5b6cff 40%, #a78bfa); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero .lead { font-size: 18px; color: var(--text-2); margin-top: 22px; max-width: 540px; line-height: 1.55; }
.hero-cta { display: flex; gap: 12px; margin-top: 32px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 34px; margin-top: 44px; flex-wrap: wrap; }
.hero-stats div b { display: block; font-family: var(--font-display); font-size: 24px; letter-spacing: -0.03em; }
.hero-stats div span { font-size: 12px; color: var(--text-3); }
.flow { position: relative; padding: 26px; border-radius: 22px; border: 1px solid var(--border-strong); background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, transparent), color-mix(in srgb, var(--bg-2) 92%, transparent)); box-shadow: var(--shadow-pop); }
.flow-head { display: flex; align-items: center; justify-content: space-between; font-size: 11px; letter-spacing: .2em; color: var(--text-3); font-weight: 600; margin-bottom: 18px; }
.flow-head .live { display: inline-flex; align-items: center; gap: 6px; color: var(--success); }
.flow-head .live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--success); box-shadow: 0 0 10px var(--success); animation: pulse 1.6s infinite; }
.flow-step { position: relative; display: grid; grid-template-columns: 38px 1fr auto; gap: 14px; align-items: center; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); animation: rise .6s var(--ease) both; }
.flow-step + .flow-step { margin-top: 26px; }
.flow-step + .flow-step::before { content: ""; position: absolute; left: 32px; top: -27px; height: 26px; width: 2px; background: linear-gradient(var(--border-strong), var(--primary)); }
.flow-step + .flow-step::after { content: ""; position: absolute; left: 29px; top: -24px; width: 8px; height: 8px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 10px var(--primary-glow); animation: travel 2.4s infinite linear; }
.flow-step i { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 32%, transparent); }
.flow-step i svg { width: 18px; height: 18px; }
.flow-step b { font-size: 14px; font-weight: 600; display: block; }
.flow-step small { color: var(--text-3); font-size: 11.5px; }
.flow-step.active { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.flow-step:nth-child(2) { animation-delay: .1s; } .flow-step:nth-child(3) { animation-delay: .2s; } .flow-step:nth-child(4) { animation-delay: .3s; } .flow-step:nth-child(5) { animation-delay: .4s; } .flow-step:nth-child(6) { animation-delay: .5s; }
.section { position: relative; z-index: 1; max-width: 1280px; margin: 0 auto; padding: 70px 40px; }
.section-title { font-size: 11px; letter-spacing: .3em; color: var(--primary); font-weight: 700; }
.section h2 { font-size: clamp(28px, 3.4vw, 40px); letter-spacing: -0.03em; margin-top: 12px; max-width: 700px; }
.feature-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; margin-top: 40px; background: var(--border); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; }
.feature { background: var(--surface); padding: 24px; display: flex; flex-direction: column; gap: 10px; min-height: 180px; }
.feature i { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); }
.feature i svg { width: 18px; height: 18px; }
.feature h4 { font-size: 15px; font-family: var(--font-display); }
.feature p { color: var(--text-2); font-size: 13px; }
.feature-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.step-num { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; font-family: var(--font-display); font-weight: 700; background: linear-gradient(135deg, var(--primary), #8b5cf6); color: #fff; }
.cta-band { display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; padding: 36px; border-radius: 20px; border: 1px solid var(--border-strong); background: linear-gradient(135deg, var(--primary-soft), color-mix(in srgb, var(--surface) 80%, transparent)); }
.cta-band > div:first-child { max-width: 620px; }
.onboard-step .desc { font-size: 11.5px; color: var(--text-3); line-height: 1.4; }
.ecosystem { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-top: 34px; }
.eco { padding: 16px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.eco b { font-family: var(--font-display); letter-spacing: .06em; font-size: 13px; }
.eco span { font-size: 12px; color: var(--text-3); }
.eco i { width: 26px; height: 3px; border-radius: 3px; background: var(--c); box-shadow: 0 0 14px var(--c); }
.public-footer { position: relative; z-index: 1; border-top: 1px solid var(--border); padding: 26px 40px; display: flex; justify-content: space-between; max-width: 1280px; margin: 0 auto; color: var(--text-3); font-size: 12px; flex-wrap: wrap; gap: 12px; }

.auth-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.auth-aside { position: relative; overflow: hidden; border-right: 1px solid var(--border); background: var(--bg-2); padding: 40px; display: flex; flex-direction: column; justify-content: space-between; }
.auth-main { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: min(400px, 100%); display: flex; flex-direction: column; gap: 18px; }
.auth-card h1 { font-size: 26px; }
.divider-text { display: flex; align-items: center; gap: 12px; color: var(--text-3); font-size: 11px; letter-spacing: .2em; }
.divider-text::before, .divider-text::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.demo-box { border: 1px dashed var(--border-strong); border-radius: 12px; padding: 12px; font-size: 12px; color: var(--text-2); background: var(--surface); }
.demo-box button { border: 0; background: var(--surface-2); color: var(--text-2); border-radius: 6px; padding: 4px 8px; font-size: 11.5px; cursor: pointer; margin: 3px 3px 0 0; border: 1px solid var(--border); }
.demo-box button:hover { color: var(--text); border-color: var(--primary); }
.alert { display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; font-size: 13px; border: 1px solid; }
.alert svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alert-danger { background: var(--danger-soft); border-color: rgba(240,79,90,.3); color: #ffadb3; }
.alert-success { background: var(--success-soft); border-color: rgba(34,197,94,.3); color: #86efac; }
.alert-info { background: var(--info-soft); border-color: rgba(56,189,248,.3); color: #bae6fd; }
.alert-warning { background: var(--warning-soft); border-color: rgba(245,165,36,.3); color: #fcd34d; }
:root[data-theme="light"] .alert-danger { color: #9f1c26; }
:root[data-theme="light"] .alert-success { color: #166534; }
:root[data-theme="light"] .alert-info { color: #075985; }
:root[data-theme="light"] .alert-warning { color: #7c4a03; }

/* ------------------------------------------------------------------ animations */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes slide-in { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
@keyframes breathe { 0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 var(--primary-glow); } 50% { transform: scale(1.06); box-shadow: 0 0 40px 4px var(--primary-glow); } }
@keyframes scan { 0% { transform: translateX(-100%); } 100% { transform: translateX(260%); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes travel { 0% { transform: translateY(0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(20px); opacity: 0; } }
.fade-in { animation: rise .35s var(--ease) both; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* ------------------------------------------------------------------ responsive */
@media (max-width: 1280px) {
  .fd-shell { grid-template-columns: 200px minmax(0, 1fr) 300px; }
  .wf-shell { grid-template-columns: 190px minmax(0, 1fr) 290px; }
  .feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-6 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 1024px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 272px; transform: translateX(-100%); transition: transform .22s var(--ease); box-shadow: var(--shadow-pop); }
  .sidebar.open { transform: none; }
  .scrim.open { display: block; position: fixed; inset: 0; background: rgba(3,5,10,.55); z-index: 25; }
  .menu-toggle { display: grid; }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fd-shell { grid-template-columns: minmax(0, 1fr); }
  .fd-toolbox { position: static; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
  .fd-props { position: static; max-height: none; }
  .wf-shell { grid-template-columns: minmax(0, 1fr); height: auto; }
  .wf-palette { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--border); }
  .wf-canvas-wrap { height: 560px; }
  .wf-props { border-left: 0; border-top: 1px solid var(--border); }
  .hero { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .auth-shell { grid-template-columns: minmax(0, 1fr); }
  .auth-aside { display: none; }
  .ecosystem { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .approval-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .onboard-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-2, .span-3, .span-4 { grid-column: auto; }
}
@media (max-width: 720px) {
  body { font-size: 14px; }
  .content { padding: 16px 14px 90px; }
  .topbar { padding: 0 12px; gap: 8px; }
  .search-trigger .label-text, .search-trigger .kbd { display: none; }
  .search-trigger { width: 38px; padding: 0; justify-content: center; }
  .grid-2, .grid-3, .grid-4, .grid-6, .form-grid, .dyn-form { grid-template-columns: minmax(0, 1fr); }
  .page-header h1 { font-size: 22px; }
  .approval-card { grid-template-columns: minmax(0, 1fr); }
  .approval-actions { flex-direction: row; flex-wrap: wrap; min-width: 0; }
  .approval-actions .btn { flex: 1; }
  .table th.hide-sm, .table td.hide-sm { display: none; }
  .mobile-nav { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; height: 62px; border-top: 1px solid var(--border); background: color-mix(in srgb, var(--bg-2) 92%, transparent); backdrop-filter: blur(14px); padding-bottom: env(safe-area-inset-bottom); }
  .mobile-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 10px; color: var(--text-3); position: relative; }
  .mobile-nav a svg { width: 20px; height: 20px; }
  .mobile-nav a.active { color: var(--primary); }
  .mobile-nav .badge-dot { position: absolute; top: 8px; left: 55%; min-width: 15px; height: 15px; border-radius: 8px; background: var(--danger); color: #fff; font-size: 9px; display: grid; place-items: center; padding: 0 3px; }
  .wf-shell, .fd-shell.desktop-only { display: none; }
  .wf-mobile-note { display: flex; }
  .public-nav { padding: 18px 20px; }
  .public-nav nav { display: none; }
  .hero, .section { padding-left: 20px; padding-right: 20px; }
  .feature-grid, .feature-grid.cols-3, .ecosystem { grid-template-columns: minmax(0, 1fr); }
  .cta-band { padding: 24px; }
  .kanban { grid-auto-columns: 86%; }
  .calendar { font-size: 11px; }
  .cal-day { min-height: 72px; }
  .data-list { grid-template-columns: minmax(0, 1fr); }
  .data-list > div:nth-child(odd) { padding-bottom: 0; border-bottom: 0; font-size: 11.5px; }
  .modal { border-radius: 16px; }
  .toast-host { bottom: 76px; }
}
