:root {
  color-scheme: dark;
  --bg: #090b10;
  --bg-elevated: #0d1017;
  --surface: #11151d;
  --surface-2: #151a24;
  --surface-hover: #1a202c;
  --border: rgba(255, 255, 255, 0.075);
  --border-strong: rgba(255, 255, 255, 0.12);
  --text: #f5f7fb;
  --text-2: #a6adbb;
  --text-3: #6f7787;
  --accent: #7c5cff;
  --accent-2: #9a85ff;
  --accent-soft: rgba(124, 92, 255, 0.12);
  --success: #45d483;
  --success-soft: rgba(69, 212, 131, 0.12);
  --warning: #ffb454;
  --warning-soft: rgba(255, 180, 84, 0.12);
  --info: #62a8ff;
  --info-soft: rgba(98, 168, 255, 0.12);
  --danger: #ff6f82;
  --radius-sm: 9px;
  --radius-md: 13px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --sidebar: 244px;
  --topbar: 68px;
  --shadow-lg: 0 24px 70px rgba(0, 0, 0, 0.28);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% -12%, rgba(124, 92, 255, .09), transparent 28rem),
    var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }
svg { display: block; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 50;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  padding: 18px 14px 14px;
  background: rgba(10, 13, 19, .92);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(22px);
}
.brand-row { display: flex; align-items: center; justify-content: space-between; padding: 2px 4px 18px; }
.brand { display: inline-flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 11px; font-weight: 800; letter-spacing: -.04em;
  background: linear-gradient(145deg, #8d73ff, #6244ec);
  box-shadow: 0 8px 24px rgba(124, 92, 255, .28), inset 0 1px rgba(255,255,255,.18);
}
.brand-copy { display: grid; gap: 1px; }
.brand-copy strong { font-size: 14px; letter-spacing: -.01em; }
.brand-copy small { color: var(--text-3); font-size: 11px; }

.workspace-card {
  display: flex; align-items: center; gap: 10px;
  min-height: 58px; padding: 9px 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  box-shadow: inset 0 1px rgba(255,255,255,.02);
}
.workspace-avatar, .profile-avatar {
  display: grid; place-items: center; flex: 0 0 auto;
  border-radius: 10px; font-weight: 700;
  background: linear-gradient(145deg, #232a38, #171c26); border: 1px solid var(--border-strong);
}
.workspace-avatar { width: 34px; height: 34px; font-size: 11px; }
.workspace-meta { display: grid; gap: 2px; min-width: 0; flex: 1; }
.workspace-label { font-size: 10px; color: var(--text-3); }
.workspace-meta strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ghost-icon, .icon-btn {
  border: 0; background: transparent; cursor: pointer; display: grid; place-items: center;
}
.ghost-icon { width: 26px; height: 26px; color: var(--text-3); }
.ghost-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.nav-groups { display: flex; flex: 1; flex-direction: column; gap: 18px; padding-top: 20px; min-height: 0; overflow: auto; }
.nav-group { display: grid; gap: 4px; }
.nav-group-bottom { margin-top: auto; }
.nav-caption { padding: 0 10px 5px; color: #555d6b; font-size: 10px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.nav-link {
  min-height: 38px; display: flex; align-items: center; gap: 10px; padding: 0 10px;
  color: #8e96a5; border-radius: 10px; transition: background .16s ease, color .16s ease, transform .16s ease;
}
.nav-link:hover { color: var(--text); background: rgba(255,255,255,.045); }
.nav-link.active { color: #fff; background: linear-gradient(90deg, rgba(124,92,255,.16), rgba(124,92,255,.07)); box-shadow: inset 0 0 0 1px rgba(124,92,255,.11); }
.nav-link svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; opacity: .92; }
.nav-link span:nth-child(2) { flex: 1; font-size: 12.5px; font-weight: 570; }
.nav-badge { min-width: 20px; height: 20px; display: grid; place-items: center; padding: 0 6px; color: #b9a9ff; background: var(--accent-soft); border-radius: 999px; font-size: 10px !important; }
.sidebar-footer {
  display: flex; gap: 10px; align-items: flex-start; padding: 13px 10px 4px; margin-top: 14px; border-top: 1px solid var(--border);
}
.status-dot { width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 4px rgba(69,212,131,.08); }
.sidebar-footer div:last-child { display: grid; gap: 2px; }
.sidebar-footer strong { font-size: 10.5px; font-weight: 650; color: #b4bac5; }
.sidebar-footer span { font-size: 9.5px; color: #596171; }

.main-column { margin-left: var(--sidebar); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  height: var(--topbar); display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 0 28px;
  background: rgba(9, 11, 16, .76); border-bottom: 1px solid var(--border); backdrop-filter: blur(24px);
}
.topbar-left, .topbar-actions { display: flex; align-items: center; gap: 8px; }
.search-box {
  width: min(360px, 40vw); height: 38px; display: flex; align-items: center; gap: 9px; padding: 0 10px;
  border: 1px solid var(--border); border-radius: 11px; color: var(--text-3); background: rgba(255,255,255,.025); cursor: pointer;
  transition: border-color .16s ease, background .16s ease;
}
.search-box:hover { border-color: var(--border-strong); background: rgba(255,255,255,.04); }
.search-box svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; }
.search-box span { flex: 1; text-align: left; font-size: 12px; }
kbd { padding: 3px 6px; border: 1px solid var(--border); border-bottom-color: rgba(255,255,255,.14); border-radius: 6px; background: var(--surface); color: #687080; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 10px; color: #8d95a4; transition: background .16s ease, color .16s ease; }
.icon-btn:hover { background: rgba(255,255,255,.05); color: var(--text); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.notification-ping { position: absolute; width: 6px; height: 6px; top: 8px; right: 8px; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 0 2px var(--bg); }
.topbar-divider { width: 1px; height: 24px; margin: 0 2px; background: var(--border); }
.profile-button { display: flex; align-items: center; gap: 9px; padding: 4px 5px 4px 6px; border: 0; background: transparent; border-radius: 11px; cursor: pointer; }
.profile-button:hover { background: rgba(255,255,255,.035); }
.profile-avatar { width: 32px; height: 32px; font-size: 10px; background: linear-gradient(145deg, #7c5cff, #5134ca); }
.profile-copy { display: grid; gap: 1px; text-align: left; }
.profile-copy strong { font-size: 11.5px; }
.profile-copy small { color: var(--text-3); font-size: 9.5px; }
.profile-button > svg { width: 14px; height: 14px; fill: none; stroke: #666e7d; stroke-width: 1.7; }
.mobile-menu, .sidebar-close { display: none; }
.sidebar-backdrop { display: none; }

.page-content { width: min(1500px, 100%); margin: 0 auto; padding: 38px 34px 44px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.eyebrow, .panel-kicker { color: var(--accent-2); font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.page-heading h1 { margin: 7px 0 7px; font-size: clamp(27px, 3vw, 35px); line-height: 1.05; letter-spacing: -.045em; }
.page-heading p { margin: 0; color: var(--text-2); font-size: 13px; }
.page-heading p strong { color: #d6dae2; font-weight: 620; }
.heading-actions { display: flex; gap: 8px; }
.btn {
  height: 39px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--border); font-size: 11.5px; font-weight: 650; cursor: pointer; transition: transform .15s ease, background .15s ease, border-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.btn-secondary { background: var(--surface); color: #c5cad4; }
.btn-secondary:hover { background: var(--surface-hover); border-color: var(--border-strong); }
.btn-primary { border-color: rgba(154,133,255,.25); background: linear-gradient(180deg, #8064f8, #6f51e7); box-shadow: 0 8px 24px rgba(124,92,255,.20), inset 0 1px rgba(255,255,255,.15); }
.btn-primary:hover { background: linear-gradient(180deg, #8b70ff, #7658ec); }

.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 12px; }
.metric-card {
  position: relative; min-height: 176px; overflow: hidden; padding: 17px;
  border: 1px solid var(--border); border-radius: var(--radius-lg); background: linear-gradient(155deg, rgba(255,255,255,.018), transparent 42%), var(--surface);
  box-shadow: inset 0 1px rgba(255,255,255,.018); transition: transform .18s ease, border-color .18s ease;
}
.metric-card:hover { transform: translateY(-1px); border-color: var(--border-strong); }
.metric-featured { background: radial-gradient(circle at 100% 0, rgba(124,92,255,.13), transparent 58%), var(--surface); }
.metric-topline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.metric-icon { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 10px; color: #b7a9ff; background: var(--accent-soft); border: 1px solid rgba(124,92,255,.08); }
.metric-icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.trend { display: inline-flex; align-items: center; gap: 3px; height: 23px; padding: 0 8px; border-radius: 999px; font-size: 9.5px; font-weight: 700; }
.trend svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.trend-positive { color: var(--success); background: var(--success-soft); }
.trend-neutral { color: #9aa2b1; background: rgba(255,255,255,.045); }
.metric-label { display: block; color: var(--text-2); font-size: 10.5px; }
.metric-value { display: block; margin: 5px 0 5px; font-size: 27px; line-height: 1; letter-spacing: -.045em; }
.metric-subtext { color: var(--text-3); font-size: 9.5px; }
.metric-sparkline { position: absolute; left: 0; right: 0; bottom: 0; height: 54px; color: var(--accent); opacity: .88; pointer-events: none; }
.metric-sparkline svg { width: 100%; height: 100%; }
.spark-area { fill: url(#sparkFill); }
.spark-line { fill: none; stroke: currentColor; stroke-width: 1.8; vector-effect: non-scaling-stroke; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(300px, .8fr); gap: 12px; margin-bottom: 12px; }
.dashboard-grid-lower { grid-template-columns: 1fr 1fr; }
.panel { border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; box-shadow: inset 0 1px rgba(255,255,255,.018); }
.panel-header { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 15px 17px; border-bottom: 1px solid var(--border); }
.panel-header > div:first-child { display: grid; gap: 5px; }
.panel-header h2 { margin: 0; font-size: 13px; letter-spacing: -.012em; }
.segmented-control { display: flex; padding: 3px; background: #0b0e14; border: 1px solid var(--border); border-radius: 9px; }
.segmented-control button { height: 26px; min-width: 36px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: var(--text-3); font-size: 9.5px; cursor: pointer; }
.segmented-control button.active { background: #202633; color: #e7e9ee; box-shadow: inset 0 0 0 1px rgba(255,255,255,.045); }
.chart-summary { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; padding: 18px 18px 0; }
.chart-summary > div { display: grid; gap: 4px; }
.chart-summary span { color: var(--text-3); font-size: 9.5px; }
.chart-summary strong { font-size: 23px; letter-spacing: -.04em; }
.chart-delta { color: var(--success) !important; }
.chart-wrap { position: relative; height: 265px; margin: 8px 18px 12px; overflow: hidden; }
.chart-wrap > svg { position: absolute; inset: 18px 0 28px; width: 100%; height: calc(100% - 46px); overflow: visible; }
.chart-area { fill: url(#chartFill); }
.chart-line { fill: none; stroke: #8b70ff; stroke-width: 2; vector-effect: non-scaling-stroke; filter: drop-shadow(0 5px 8px rgba(124,92,255,.16)); }
.chart-gridlines { position: absolute; inset: 18px 0 28px; display: grid; grid-template-rows: repeat(4, 1fr); }
.chart-gridlines span { border-top: 1px dashed rgba(255,255,255,.045); }
.chart-labels { position: absolute; left: 0; right: 0; bottom: 3px; display: flex; justify-content: space-between; color: #555e6e; font-size: 8.5px; }

.text-button { border: 0; background: none; color: #8e80dc; font-size: 10px; cursor: pointer; }
.text-button:hover { color: #b2a6f5; }
.activity-list { padding: 4px 16px 8px; }
.activity-item { display: grid; grid-template-columns: auto minmax(0,1fr) auto; align-items: center; gap: 10px; min-height: 68px; border-bottom: 1px solid rgba(255,255,255,.045); }
.activity-item:last-child { border-bottom: 0; }
.activity-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 9px; }
.activity-icon svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.activity-icon.success { color: var(--success); background: var(--success-soft); }
.activity-icon.info { color: var(--info); background: var(--info-soft); }
.activity-icon.violet { color: var(--accent-2); background: var(--accent-soft); }
.activity-icon.warning { color: var(--warning); background: var(--warning-soft); }
.activity-copy { display: grid; gap: 3px; min-width: 0; }
.activity-copy strong { font-size: 10.5px; font-weight: 650; }
.activity-copy span { overflow: hidden; color: var(--text-3); font-size: 9.5px; white-space: nowrap; text-overflow: ellipsis; }
.activity-item time { color: #535b69; font-size: 8.5px; }

.quick-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; padding: 12px; }
.quick-action { min-height: 115px; display: grid; grid-template-columns: auto 1fr auto; align-content: center; align-items: center; gap: 10px; text-align: left; padding: 15px; border: 1px solid var(--border); border-radius: 13px; background: rgba(255,255,255,.018); cursor: pointer; transition: background .16s ease, border-color .16s ease, transform .16s ease; }
.quick-action:hover { transform: translateY(-1px); background: rgba(255,255,255,.035); border-color: var(--border-strong); }
.quick-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: #171d27; color: #a99aff; }
.quick-icon svg, .quick-arrow { fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.quick-icon svg { width: 16px; height: 16px; }
.quick-action > span:nth-child(2) { display: grid; gap: 4px; min-width: 0; }
.quick-action strong { font-size: 10.5px; }
.quick-action small { color: var(--text-3); font-size: 9px; line-height: 1.35; }
.quick-arrow { width: 14px; height: 14px; color: #4e5665; }

.live-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 999px; background: var(--success-soft); color: var(--success); font-size: 8.5px; font-weight: 700; }
.live-badge > span { width: 5px; height: 5px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(69,212,131,.08); }
.health-list { padding: 5px 16px; }
.health-row { min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid rgba(255,255,255,.04); color: var(--text-2); font-size: 10px; }
.health-row:last-child { border-bottom: 0; }
.health-row span { display: flex; align-items: center; gap: 8px; }
.health-row strong { color: #aeb5c1; font-size: 9px; font-weight: 600; }
.service-dot { width: 6px; height: 6px; border-radius: 50%; }
.service-dot.ok { background: var(--success); box-shadow: 0 0 0 3px rgba(69,212,131,.075); }
.health-footer { display: flex; align-items: center; justify-content: space-between; margin: 4px 16px 14px; padding: 12px; border-radius: 11px; background: rgba(255,255,255,.022); color: var(--text-3); font-size: 9px; }
.health-footer strong { color: #e5e8ed; font-size: 11px; }
.prototype-note { margin: 18px 2px 0; color: #49515f; font-size: 9px; text-align: center; }

@media (max-width: 1180px) {
  .metrics-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid, .dashboard-grid-lower { grid-template-columns: 1fr; }
}

@media (max-width: 880px) {
  :root { --topbar: 60px; }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: var(--shadow-lg); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .sidebar-close, .mobile-menu { display: grid; }
  .sidebar-backdrop { position: fixed; inset: 0; z-index: 45; background: rgba(0,0,0,.5); opacity: 0; pointer-events: none; display: block; transition: opacity .2s ease; backdrop-filter: blur(4px); }
  body.sidebar-open .sidebar-backdrop { opacity: 1; pointer-events: auto; }
  .main-column { margin-left: 0; }
  .topbar { padding: 0 16px; }
  .search-box { width: 42px; padding: 0; justify-content: center; border: 0; background: transparent; }
  .search-box:hover { background: rgba(255,255,255,.04); }
  .search-box span, .search-box kbd { display: none; }
  .profile-copy, .profile-button > svg, .topbar-divider { display: none; }
  .page-content { padding: 28px 18px 36px; }
}

@media (max-width: 650px) {
  .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 22px; }
  .heading-actions { width: 100%; }
  .heading-actions .btn { flex: 1; }
  .metrics-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 160px; }
  .quick-actions { grid-template-columns: 1fr; }
  .quick-action { min-height: 82px; }
  .panel-header { min-height: 62px; }
  .chart-summary { align-items: flex-start; flex-direction: column; gap: 7px; }
  .chart-wrap { height: 225px; }
}

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