/* ════════════════════════════════════════════════════════════════════
   AlatLabs.App — Blazor Server global styles
   Obsidian Black design tokens + app-shell layout
   ════════════════════════════════════════════════════════════════════ */

:root {
  --ink-0: #07070A; --ink-1: #0A0A0A; --ink-2: #16161B; --ink-3: #1D1D23;
  --canvas: #0A0A0A; --canvas-soft: #16161B; --canvas-deep: #07070A;
  --satin-line: rgba(255,255,255,0.06);
  --cta-fill: #7B61FF; --cta-text: #FFFFFF; --cta-glow: rgba(123,97,255,0.42);
  --violet-signal: #2EB6B9; --violet-bright: #4ED1D4; --violet-deep: #1FA8AB;
  --violet-soft: rgba(46,182,185,0.10); --violet-glow: rgba(46,182,185,0.42);
  --state-ok: #5EEAB5; --state-warn: #FBBF24; --state-crit: #F97066; --state-info: #4F8CFF;
  --white-100: rgba(255,255,255,0.96); --white-80: rgba(255,255,255,0.78);
  --white-60: rgba(255,255,255,0.58);  --white-40: rgba(255,255,255,0.40);
  --white-20: rgba(255,255,255,0.20);  --white-06: rgba(255,255,255,0.06);
  --white-04: rgba(255,255,255,0.04);
  --font-display: 'Inter','Inter Display',-apple-system,BlinkMacSystemFont,system-ui,sans-serif;
  --font-text:    'Inter',-apple-system,BlinkMacSystemFont,system-ui,sans-serif;
  --font-mono:    'JetBrains Mono',ui-monospace,'SF Mono',monospace;
  --radius-card: 16px; --radius-card-lg: 28px; --radius-card-soft: 10px;
  --radius-pill-soft: 12px; --radius-tag: 999px; --radius-input: 10px;
  --shadow-lift: 0 4px 24px -8px rgba(0,0,0,0.55);
  --ease: cubic-bezier(0.22,1,0.36,1);
  --sidebar-w: 220px; --topbar-h: 56px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%; overflow: hidden;
  font-family: var(--font-text);
  font-size: 15px; line-height: 1.5;
  background: var(--ink-1); color: var(--white-80);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--violet-bright); text-decoration: none; }
a:hover { color: var(--violet-signal); }

/* ── App shell ── */
.app-shell { display: flex; flex-direction: row; height: 100%; overflow: hidden; }
.app-main   { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.app-content { flex: 1; overflow-y: auto; padding: 28px 32px; }

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--ink-0); border-right: 1px solid var(--satin-line);
  display: flex; flex-direction: column; overflow: hidden;
  transition: width .22s var(--ease);
}
.sidebar.collapsed { width: 60px; }
.sidebar__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 18px 16px; border-bottom: 1px solid var(--satin-line);
  flex-shrink: 0;
}
.sidebar__brand-mark {
  width: 28px; height: 28px; border-radius: 8px;
  background: var(--violet-signal); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; color: #fff;
}
.sidebar__brand-name {
  font-size: 13px; font-weight: 700; color: var(--white-100);
  letter-spacing: 0.02em; white-space: nowrap; overflow: hidden;
}
.sidebar__body { flex: 1; overflow-y: auto; padding: 12px 0; }
.sidebar__body::-webkit-scrollbar { width: 4px; }
.sidebar__body::-webkit-scrollbar-thumb { background: var(--white-06); border-radius: 2px; }
.sidebar__section-label {
  font-size: 10px; font-weight: 600; letter-spacing: 0.08em;
  color: var(--white-40); text-transform: uppercase;
  padding: 12px 16px 4px;
}
.sidebar__item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px; border-radius: 0;
  color: var(--white-60); font-size: 13px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: background .12s, color .12s;
  position: relative; white-space: nowrap;
}
.sidebar__item:hover { background: var(--white-04); color: var(--white-100); }
.sidebar__item.active {
  background: var(--violet-soft); color: var(--violet-bright);
}
.sidebar__item.active::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--violet-signal); border-radius: 0 2px 2px 0;
}
.sidebar__item i { width: 16px; text-align: center; flex-shrink: 0; font-size: 13px; }
.sidebar__item-label { overflow: hidden; text-overflow: ellipsis; }
.sidebar__footer {
  padding: 12px 16px; border-top: 1px solid var(--satin-line);
  font-size: 12px; color: var(--white-40); flex-shrink: 0;
}

/* ── Topbar ── */
.topbar {
  height: var(--topbar-h); flex-shrink: 0;
  background: var(--ink-0); border-bottom: 1px solid var(--satin-line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px; gap: 16px;
}
.topbar__title { font-size: 15px; font-weight: 600; color: var(--white-100); }
.topbar__actions { display: flex; align-items: center; gap: 10px; }
.topbar__btn {
  width: 34px; height: 34px; border-radius: 8px;
  border: 1px solid var(--white-06); background: var(--white-04);
  color: var(--white-60); cursor: pointer; font-size: 13px;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
}
.topbar__btn:hover { background: var(--white-06); color: var(--white-100); }
.topbar__avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--violet-signal); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600; cursor: pointer;
}

/* ── KPI tiles ── */
.kpi-grid { display: grid; grid-template-columns: repeat(5,1fr); gap: 14px; margin-bottom: 24px; }
@media (max-width: 1200px) { .kpi-grid { grid-template-columns: repeat(3,1fr); } }
@media (max-width: 768px)  { .kpi-grid { grid-template-columns: repeat(2,1fr); } }
.kpi-tile {
  background: var(--ink-2); border: 1px solid var(--satin-line);
  border-radius: var(--radius-card-soft); padding: 18px 20px;
  border-top: 2px solid var(--violet-signal);
}
.kpi-tile__label { font-size: 11px; color: var(--white-40); font-weight: 500; margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.06em; }
.kpi-tile__value { font-size: 26px; font-weight: 700; color: var(--white-100); line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi-tile__sub   { font-size: 11px; color: var(--white-40); margin-top: 4px; }

/* ── Cards ── */
.app-card {
  background: var(--ink-2); border: 1px solid var(--satin-line);
  border-radius: var(--radius-card); padding: 22px;
}
.app-card + .app-card { margin-top: 16px; }
.app-card__title { font-size: 14px; font-weight: 600; color: var(--white-100); margin-bottom: 16px; }

/* ── Tabs ── */
.app-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--white-06); margin-bottom: 24px; overflow-x: auto; }
.app-tabs::-webkit-scrollbar { display: none; }
.app-tab {
  padding: 11px 18px; background: transparent; border: 0;
  border-bottom: 2px solid transparent; color: var(--white-60);
  font-family: var(--font-text); font-size: 14px; font-weight: 500;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: color .15s var(--ease), border-color .15s var(--ease);
}
.app-tab:hover { color: var(--white-100); }
.app-tab.active { color: var(--violet-bright); border-bottom-color: var(--violet-signal); }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: 3px 8px; border-radius: var(--radius-tag); font-size: 11px; font-weight: 600; }
.badge-ok   { background: rgba(94,234,181,0.12); color: var(--state-ok);   }
.badge-warn { background: rgba(251,191,36,0.12);  color: var(--state-warn); }
.badge-crit { background: rgba(249,112,102,0.12); color: var(--state-crit); }
.badge-info { background: rgba(79,140,255,0.12);  color: var(--state-info); }
.badge-muted { background: var(--white-06); color: var(--white-60); }

/* ── Tables ── */
.app-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.app-table th { font-size: 11px; font-weight: 600; color: var(--white-40); text-transform: uppercase; letter-spacing: 0.06em; padding: 10px 14px; border-bottom: 1px solid var(--satin-line); text-align: left; }
.app-table td { padding: 12px 14px; border-bottom: 1px solid var(--satin-line); color: var(--white-80); vertical-align: middle; }
.app-table tr:last-child td { border-bottom: none; }
.app-table tr:hover td { background: var(--white-04); }

/* ── Buttons ── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 20px; border-radius: var(--radius-pill-soft);
  background: var(--violet-signal); color: #fff;
  border: none; font-size: 13px; font-weight: 600; cursor: pointer;
  transition: opacity .15s;
}
.btn-primary:hover { opacity: 0.88; }
.btn-ghost {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: var(--radius-card-soft);
  background: var(--white-04); color: var(--white-60);
  border: 1px solid var(--white-06); font-size: 13px; cursor: pointer;
  transition: background .12s, color .12s;
}
.btn-ghost:hover { background: var(--white-06); color: var(--white-100); }

/* ── Charts placeholder ── */
.chart-wrap { position: relative; height: 220px; }

/* ── Blazor error boundary ── */
.blazor-error-boundary {
  background: var(--ink-2); border: 1px solid var(--state-crit);
  border-radius: var(--radius-card); padding: 20px; color: var(--state-crit);
  margin: 20px;
}
.blazor-error-boundary::after { content: "A render error occurred. Check browser console."; }

/* ── Scrollbars ── */
* { scrollbar-width: thin; scrollbar-color: var(--white-06) transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-thumb { background: var(--white-06); border-radius: 3px; }

/* ── Auth page (no sidebar) ── */
.auth-page { height: 100%; display: flex; align-items: center; justify-content: center; background: var(--ink-1); }
.auth-card {
  width: 400px; max-width: 92vw;
  background: var(--ink-2); border: 1px solid var(--satin-line);
  border-radius: var(--radius-card-lg); padding: 40px 36px;
}
.auth-card__logo { margin-bottom: 28px; }
.auth-card__title { font-size: 22px; font-weight: 700; color: var(--white-100); margin-bottom: 6px; }
.auth-card__sub   { font-size: 14px; color: var(--white-60); margin-bottom: 28px; }

input, select, textarea {
  background: var(--ink-3); border: 1px solid var(--white-06);
  border-radius: var(--radius-input); padding: 10px 14px;
  color: var(--white-100); font-family: var(--font-text); font-size: 14px; width: 100%;
  outline: none; transition: border-color .12s;
}
input:focus, select:focus { border-color: var(--violet-signal); }
label { font-size: 12px; font-weight: 600; color: var(--white-60); margin-bottom: 6px; display: block; }

/* ── Grid helpers ── */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.three-col { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
@media (max-width: 900px) { .two-col, .three-col { grid-template-columns: 1fr; } }
