:root {
  --bg-main: #0b0f17;
  --bg-sidebar: #080c14;
  --bg-secondary: #111827;
  --bg-panel: #151b26;
  --bg-panel-hover: #1d2635;
  --border-soft: #263244;
  --text-main: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --text-disabled: #475569;
  --accent-primary: #8b5cf6;
  --accent-secondary: #22d3ee;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --sidebar-width: 260px;
  --shadow: 0 20px 60px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
html { background: var(--bg-main); }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--text-main);
  background:
    radial-gradient(circle at 70% -10%, rgba(139,92,246,.08), transparent 28rem),
    var(--bg-main);
  font: 14px/1.5 Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
code { color: var(--accent-secondary); }

#app { min-height: 100vh; }
#sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  z-index: 20;
  display: flex;
  flex-direction: column;
  padding: 22px 16px 16px;
  background: rgba(8, 12, 20, .94);
  border-right: 1px solid var(--border-soft);
  backdrop-filter: blur(18px);
}
.main-content { margin-left: var(--sidebar-width); padding: 34px 38px 60px; min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: -.02em; }
.brand-mark {
  display: grid; place-items: center; width: 34px; height: 34px;
  overflow: hidden; border: 1px solid rgba(101, 255, 40, .28); border-radius: 9px;
  background: #090d11; box-shadow: 0 0 24px rgba(80, 255, 20, .12);
}
.brand-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }
.nav-label { margin: 28px 8px 8px; color: var(--text-muted); font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.nav-list { display: grid; gap: 3px; }
.nav-link {
  position: relative; display: flex; align-items: center; gap: 11px;
  min-height: 39px; padding: 0 11px; border-radius: 9px;
  color: #94a3b8; font-size: 13px; transition: .18s ease;
}
.nav-link:hover { color: var(--text-main); background: rgba(255,255,255,.035); }
.nav-link.active { color: #ddd6fe; background: var(--bg-panel-hover); }
.nav-link.active::before { content: ""; position: absolute; left: -16px; width: 3px; height: 22px; border-radius: 0 4px 4px 0; background: var(--accent-primary); }
.nav-icon { width: 18px; color: currentColor; text-align: center; font-size: 12px; }
.sidebar-user { margin-top: auto; padding: 12px; display: flex; gap: 10px; align-items: center; border-top: 1px solid rgba(38,50,68,.7); }
.avatar {
  flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%;
  color: #fff; font-weight: 700; background: linear-gradient(145deg, #475569, #1e293b); border: 1px solid #64748b;
}
.avatar.large { width: 72px; height: 72px; font-size: 22px; }
.user-meta { min-width: 0; flex: 1; }
.user-meta strong, .user-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { color: var(--text-muted); font-size: 11px; }
.logout { border: 0; color: var(--text-muted); background: none; cursor: pointer; }

.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 26px; }
.page-header h1 { margin: 0 0 5px; font-size: 24px; line-height: 1.2; letter-spacing: -.035em; }
.page-header p { margin: 0; color: var(--text-muted); }
.header-actions { display: flex; gap: 9px; flex-wrap: wrap; }
.eyebrow { color: var(--accent-primary); font-size: 10px; font-weight: 800; letter-spacing: .12em; }
.muted { color: var(--text-muted); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 38px; padding: 0 13px; border: 1px solid transparent; border-radius: 9px;
  color: var(--text-main); cursor: pointer; transition: .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled, .tab:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-primary { background: var(--accent-primary); box-shadow: 0 8px 25px rgba(139,92,246,.2); }
.btn-secondary { background: transparent; border-color: var(--border-soft); }
.btn-danger { color: #fecaca; background: rgba(239,68,68,.12); border-color: rgba(239,68,68,.25); }
.btn-ghost { background: rgba(255,255,255,.025); color: var(--text-secondary); }
.btn-small { min-height: 31px; padding: 0 10px; font-size: 12px; }
.btn-block { width: 100%; }

.metrics-grid { display: grid; grid-template-columns: repeat(6, minmax(150px, 1fr)); gap: 14px; }
.card {
  background: linear-gradient(145deg, rgba(21,27,38,.98), rgba(17,24,39,.9));
  border: 1px solid var(--border-soft); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow);
}
.metric-card { min-height: 140px; position: relative; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; right: -35px; top: -35px; width: 100px; height: 100px; border-radius: 50%; background: var(--metric-color, var(--accent-primary)); opacity: .055; }
.metric-icon { display: grid; place-items: center; width: 34px; height: 34px; margin-bottom: 18px; border-radius: 10px; background: color-mix(in srgb, var(--metric-color) 17%, transparent); color: var(--metric-color); }
.metric-label { color: var(--text-secondary); font-size: 12px; }
.metric-value { margin: 2px 0 4px; font-size: 25px; font-weight: 750; letter-spacing: -.03em; }
.metric-trend { color: var(--success); font-size: 10px; }
.metric-trend.down { color: var(--warning); }

.dashboard-grid { display: grid; grid-template-columns: 1.35fr 1fr; gap: 14px; margin-top: 14px; }
.dashboard-bottom { display: grid; grid-template-columns: .9fr .8fr 1fr; gap: 14px; margin-top: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.card-head h2 { margin: 0; font-size: 15px; }
.card-head a { color: #a78bfa; font-size: 11px; }
.chart { position: relative; height: 240px; padding: 12px 0 24px 42px; border-bottom: 1px solid var(--border-soft); }
.chart::before { content: ""; position: absolute; inset: 12px 0 24px 42px; background: repeating-linear-gradient(to bottom, transparent 0 48px, rgba(100,116,139,.14) 49px 50px); }
.chart svg { position: relative; width: 100%; height: 100%; overflow: visible; }
.chart-labels { position: absolute; inset: auto 0 0 42px; display: flex; justify-content: space-between; color: var(--text-muted); font-size: 10px; }
.activity-list, .stack-list { display: grid; }
.activity {
  display: grid; grid-template-columns: 28px 1fr auto; align-items: center; gap: 10px;
  padding: 11px 0; border-bottom: 1px solid rgba(38,50,68,.72);
}
.activity:last-child { border: 0; }
.activity-dot { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: rgba(139,92,246,.12); color: #a78bfa; font-size: 11px; }
.activity strong { display: block; font-size: 12px; }
.activity span, .activity time { color: var(--text-muted); font-size: 10px; }
.money { color: #4ade80 !important; font-variant-numeric: tabular-nums; }
.product-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 9px 0; }
.progress { grid-column: 1 / -1; height: 4px; overflow: hidden; border-radius: 99px; background: #263244; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary)); }
.donut-wrap { display: flex; align-items: center; gap: 22px; }
.donut { width: 112px; aspect-ratio: 1; border-radius: 50%; background: conic-gradient(#22c55e 0 63%, #22d3ee 63% 85%, #f59e0b 85% 100%); position: relative; }
.donut::after { content: ""; position: absolute; inset: 22px; border-radius: 50%; background: var(--bg-panel); }
.legend { display: grid; gap: 9px; color: var(--text-secondary); font-size: 12px; }
.legend i { display: inline-block; width: 7px; height: 7px; margin-right: 7px; border-radius: 50%; background: var(--dot); }

.toolbar { display: flex; gap: 9px; margin-bottom: 14px; flex-wrap: wrap; }
.input, .select, textarea {
  min-height: 40px; padding: 9px 12px; border: 1px solid var(--border-soft); border-radius: 10px;
  color: var(--text-main); background: #0f172a; outline: none;
}
.input:focus, .select:focus, textarea:focus { border-color: var(--accent-primary); box-shadow: 0 0 0 3px rgba(139,92,246,.18); }
.toolbar .input { min-width: 260px; }
.table-card { padding: 0; overflow: hidden; }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 13px 16px; color: var(--text-muted); background: rgba(255,255,255,.018); font-size: 10px; letter-spacing: .035em; text-align: left; font-weight: 650; white-space: nowrap; }
td { padding: 14px 16px; border-top: 1px solid rgba(38,50,68,.72); color: var(--text-secondary); white-space: nowrap; }
tbody tr { cursor: default; transition: .15s ease; }
tbody tr:hover { background: var(--bg-panel-hover); }
.cell-main { color: var(--text-main); font-weight: 600; }
.person { display: flex; align-items: center; gap: 9px; }
.person .avatar { width: 30px; height: 30px; font-size: 10px; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 8px; font-size: 10px; font-weight: 700; text-transform: capitalize; }
.badge-success { color: #86efac; background: rgba(34,197,94,.12); }
.badge-warning { color: #fcd34d; background: rgba(245,158,11,.13); }
.badge-danger { color: #fca5a5; background: rgba(239,68,68,.13); }
.badge-info { color: #93c5fd; background: rgba(59,130,246,.13); }
.badge-neutral { color: #cbd5e1; background: rgba(100,116,139,.15); }
.empty, .error-state { padding: 54px 24px; text-align: center; color: var(--text-muted); }
.skeleton { min-height: 200px; background: linear-gradient(90deg, rgba(255,255,255,.02), rgba(255,255,255,.055), rgba(255,255,255,.02)); background-size: 200% 100%; animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.profile-header { display: flex; align-items: center; gap: 18px; margin-bottom: 24px; }
.profile-header h1 { margin: 0 0 5px; font-size: 24px; }
.profile-meta { display: flex; gap: 18px; flex-wrap: wrap; color: var(--text-muted); font-size: 12px; }
.profile-actions { margin-left: auto; }
.tabs { display: flex; gap: 30px; border-bottom: 1px solid var(--border-soft); margin-bottom: 18px; overflow-x: auto; }
.tab { padding: 12px 0; color: var(--text-muted); background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tab.active { color: #ddd6fe; border-color: var(--accent-primary); }
.detail-grid { display: grid; grid-template-columns: .8fr 1.2fr .7fr; gap: 14px; }
.detail-wide { grid-column: 1 / -1; }
.summary-list { display: grid; gap: 18px; }
.summary-row { display: flex; justify-content: space-between; gap: 14px; color: var(--text-muted); font-size: 12px; }
.summary-row strong { color: var(--text-secondary); }
.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ""; position: absolute; left: 4px; top: 8px; bottom: 8px; width: 1px; background: var(--border-soft); }
.timeline-item { position: relative; display: grid; grid-template-columns: 90px 1fr auto; gap: 20px; padding: 11px 0; border-bottom: 1px solid rgba(38,50,68,.6); }
.timeline-item::before { content: ""; position: absolute; left: -20px; top: 17px; width: 7px; height: 7px; border: 2px solid var(--bg-panel); border-radius: 50%; background: var(--info); box-shadow: 0 0 0 1px var(--border-soft); }
.timeline-item time { color: var(--text-muted); font-size: 10px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(3,7,18,.78); backdrop-filter: blur(8px); }
.modal { width: min(620px, 100%); max-height: 90vh; overflow: auto; background: var(--bg-panel); border: 1px solid var(--border-soft); border-radius: var(--radius-lg); box-shadow: 0 30px 100px #000; }
.modal-head, .modal-foot { display: flex; justify-content: space-between; align-items: center; padding: 18px 20px; border-bottom: 1px solid var(--border-soft); }
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-body { padding: 20px; }
.modal-foot { justify-content: flex-end; border-top: 1px solid var(--border-soft); border-bottom: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.form-stack { display: grid; gap: 16px; }
.form-grid label, .form-stack label { display: grid; gap: 6px; color: var(--text-secondary); font-size: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-error { margin: 0; color: #fca5a5; }
.toast { position: fixed; right: 22px; top: 22px; z-index: 120; padding: 13px 16px; color: var(--text-main); background: #182131; border: 1px solid var(--border-soft); border-left: 3px solid var(--success); border-radius: 10px; box-shadow: var(--shadow); }

.login-page { display: grid; place-items: center; padding: 24px; overflow: hidden; }
.login-card { position: relative; z-index: 2; width: min(430px, 100%); padding: 34px; background: rgba(21,27,38,.88); border: 1px solid var(--border-soft); border-radius: 20px; box-shadow: 0 30px 100px rgba(0,0,0,.5); backdrop-filter: blur(20px); }
.brand-login { margin-bottom: 38px; }
.login-card h1 { margin: 7px 0; font-size: 29px; letter-spacing: -.04em; }
.login-card > .muted { margin: 0 0 28px; }
.login-hint { margin: 22px 0 0; color: var(--text-muted); font-size: 11px; text-align: center; }
.login-glow { position: fixed; width: 420px; height: 420px; border-radius: 50%; filter: blur(100px); opacity: .15; }
.login-glow-one { left: 8%; top: -10%; background: var(--accent-primary); }
.login-glow-two { right: 5%; bottom: -15%; background: var(--accent-secondary); }

.docs-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 18px; align-items: start; }
.docs-toc { position: sticky; top: 24px; display: grid; gap: 4px; padding: 15px; }
.docs-toc strong { padding: 8px 10px; }
.docs-toc a { padding: 8px 10px; color: var(--text-muted); border-radius: 8px; }
.docs-toc a:hover { color: var(--text-main); background: var(--bg-panel-hover); }
.docs-content { display: grid; gap: 18px; min-width: 0; }
.docs-section { scroll-margin-top: 24px; }
.docs-section h2 { margin: 0 0 12px; font-size: 20px; }
.docs-section h3 { margin: 24px 0 10px; font-size: 14px; }
.docs-section p { color: var(--text-secondary); }
.docs-section a { color: #a78bfa; }
.code-block { margin: 12px 0; padding: 16px; overflow-x: auto; color: #dbeafe; background: #080d16; border: 1px solid #1e293b; border-radius: 11px; font: 12px/1.65 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.copy-line { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 14px; background: #0f172a; border: 1px solid var(--border-soft); border-radius: 10px; }
.copy-line code { overflow: hidden; text-overflow: ellipsis; }
.endpoint-stack { display: grid; gap: 7px; }
.endpoint-line { display: grid; grid-template-columns: 62px minmax(190px, auto) 1fr; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid rgba(38,50,68,.75); border-radius: 9px; color: var(--text-muted); }
.method { display: inline-flex; justify-content: center; padding: 3px 6px; border-radius: 6px; font-size: 10px; font-weight: 800; }
.method-get { color: #93c5fd; background: rgba(59,130,246,.14); }
.method-post { color: #86efac; background: rgba(34,197,94,.14); }
.method-patch { color: #fde68a; background: rgba(245,158,11,.14); }
.method-delete { color: #fca5a5; background: rgba(239,68,68,.14); }
.docs-callout { margin: 14px 0; padding: 13px 15px; border-radius: 10px; border: 1px solid var(--border-soft); }
.docs-callout.warning { color: #fde68a; background: rgba(245,158,11,.08); border-color: rgba(245,158,11,.2); }
.docs-table-wrap { overflow-x: auto; border: 1px solid var(--border-soft); border-radius: 10px; }
.docs-table-wrap table { min-width: 620px; }
.docs-list { display: grid; gap: 9px; padding-left: 20px; color: var(--text-secondary); }

@media (max-width: 1500px) {
  .metrics-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 1050px) {
  :root { --sidebar-width: 82px; }
  #sidebar { padding-inline: 12px; }
  .brand span:last-child, .nav-label, .nav-link span:last-child, .sidebar-user .user-meta, .logout { display: none; }
  .brand, .nav-link { justify-content: center; }
  .nav-link.active::before { left: -12px; }
  .main-content { padding: 28px 24px 50px; }
  .dashboard-grid, .dashboard-bottom, .detail-grid { grid-template-columns: 1fr; }
  .docs-layout { grid-template-columns: 1fr; }
  .docs-toc { position: static; grid-template-columns: repeat(3, 1fr); }
  .detail-wide { grid-column: auto; }
}
@media (max-width: 720px) {
  :root { --sidebar-width: 0px; }
  #sidebar { display: none; }
  .main-content { margin: 0; padding: 22px 15px 40px; }
  .metrics-grid { grid-template-columns: 1fr 1fr; }
  .page-header { display: grid; }
  .form-grid { grid-template-columns: 1fr; }
  .docs-toc { grid-template-columns: 1fr 1fr; }
  .endpoint-line { grid-template-columns: 58px 1fr; }
  .endpoint-line span:last-child { grid-column: 1 / -1; }
  .form-grid .full { grid-column: auto; }
}
@media (max-width: 440px) {
  .metrics-grid { grid-template-columns: 1fr; }
  .login-card { padding: 25px; }
}
