/* ==========================================================================
   KAPI Console (api.kapi.im) — Yuzu-Onsen Developer Dashboard
   Zero-Bloat Static SPA · Warm Obsidian & Hinoki Light · Capybara Steady Craft
   ========================================================================== */

:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg-sidebar: #0a0907;
  --bg-canvas: #0e0c0a;
  --bg-card: #161310;
  --bg-card-alt: #1b1713;
  --bg-card-hover: #221d18;
  --bg-input: #0c0a08;
  --bg-pill: rgba(45, 212, 191, 0.11);
  --bg-pill-strong: rgba(45, 212, 191, 0.19);
  --bg-modal: rgba(8, 7, 6, 0.82);

  --border: rgba(246, 231, 206, 0.095);
  --border-subtle: rgba(246, 231, 206, 0.06);
  --border-cyan: rgba(45, 212, 191, 0.38);
  --border-gold: rgba(245, 158, 11, 0.46);

  --fg: #f6f1e7;
  --fg-sec: #afa596;
  --fg-muted: #736a5e;

  --gold: #f59e0b;
  --gold-bright: #fcd34d;
  --gold-soft: rgba(245, 158, 11, 0.15);
  --cta-grad: linear-gradient(135deg, #fbbf24 0%, #f59e0b 52%, #ea781c 100%);
  --cta-fg: #140f07;

  /* Onsen Jade / Bamboo Teal secondary accent (harmonizes with Yuzu Tangerine) */
  --cyan: #2dd4bf;
  --cyan-bright: #5eead4;
  --cyan-fg: #071917;
  --sky: #38bdf8;
  --mint: #34d399;
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;

  /* 90-Day Onsen-Jade Activity Heatmap Levels on Warm Obsidian */
  --heat-0: #1c1814;
  --heat-1: #13352f;
  --heat-2: #0f5c52;
  --heat-3: #149684;
  --heat-4: #2dd4bf;

  --shadow-elevated: 0 22px 52px -20px rgba(0, 0, 0, 0.84);
  --glow-cyan: 0 0 26px -8px rgba(45, 212, 191, 0.36);
  --glow-gold: 0 8px 28px -8px rgba(245, 158, 11, 0.5);
}

[data-theme="light"] {
  color-scheme: light;
  --bg-sidebar: #f5efe6;
  --bg-canvas: #fcfaf5;
  --bg-card: #ffffff;
  --bg-card-alt: #f8f4ec;
  --bg-card-hover: #f1ebe0;
  --bg-input: #ffffff;
  --bg-pill: rgba(13, 148, 136, 0.095);
  --bg-pill-strong: rgba(13, 148, 136, 0.16);
  --bg-modal: rgba(26, 21, 16, 0.46);

  --border: rgba(42, 31, 18, 0.1);
  --border-subtle: rgba(42, 31, 18, 0.06);
  --border-cyan: rgba(13, 148, 136, 0.36);
  --border-gold: rgba(217, 119, 6, 0.4);

  --fg: #1a1510;
  --fg-sec: #5e5447;
  --fg-muted: #877b6c;

  --gold: #d97706;
  --gold-bright: #b45309;
  --gold-soft: rgba(217, 119, 6, 0.11);
  --cta-grad: linear-gradient(135deg, #f59e0b 0%, #ea580c 100%);
  --cta-fg: #ffffff;

  --cyan: #0d9488;
  --cyan-bright: #0f766e;
  --cyan-fg: #ffffff;
  --sky: #0284c7;
  --mint: #059669;
  --emerald: #059669;
  --amber: #d97706;
  --rose: #e11d48;

  --heat-0: #ebe4d8;
  --heat-1: #ccfbf1;
  --heat-2: #5eead4;
  --heat-3: #14b8a6;
  --heat-4: #0f766e;

  --shadow-elevated: 0 18px 40px -18px rgba(42, 31, 18, 0.14);
  --glow-cyan: 0 8px 24px -8px rgba(13, 148, 136, 0.22);
  --glow-gold: 0 8px 24px -8px rgba(234, 88, 12, 0.34);
}

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

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "SF Pro Text",
    "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg-canvas);
  color: var(--fg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

code,
pre,
.mono {
  font-family: ui-monospace, "SFMono-Regular", "JetBrains Mono", Menlo, Monaco,
    Consolas, monospace;
}

.tabular {
  font-variant-numeric: tabular-nums;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select {
  font-family: inherit;
}

/* ==========================================================================
   1. App Shell (Sidebar + Main Workspace)
   ========================================================================== */
.app-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.app-shell.collapsed {
  grid-template-columns: 70px minmax(0, 1fr);
}

/* --- Sidebar --- */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 30;
}

.sb-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 8px 16px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 14px;
}

.sb-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border-gold);
  box-shadow: var(--glow-gold);
  object-fit: cover;
  flex-shrink: 0;
}

.sb-brand-text {
  min-width: 0;
  overflow: hidden;
}

.sb-brand-name {
  font-weight: 780;
  font-size: 16px;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.sb-brand-tld {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--gold);
}

.sb-brand-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--gold);
  text-transform: uppercase;
}

.app-shell.collapsed .sb-brand-text,
.app-shell.collapsed .sb-group-label,
.app-shell.collapsed .nav-item-label,
.app-shell.collapsed .nav-item-badge,
.app-shell.collapsed .nav-ext-arrow,
.app-shell.collapsed .sb-user-meta {
  display: none;
}

.sb-group {
  margin-bottom: 16px;
}

.sb-group.admin-group {
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}

.sb-group-label {
  padding: 0 10px;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-muted);
}

.sb-group-label.admin {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--cyan);
}

.sb-admin-pill {
  font-size: 9.5px;
  font-weight: 750;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--bg-pill);
  border: 1px solid var(--border-cyan);
  color: var(--cyan);
  letter-spacing: 0.06em;
}

.nav-ext-arrow {
  font-size: 11px;
  color: var(--fg-muted);
  transition: transform 0.15s ease, color 0.15s ease;
}

.nav-item.admin-link:hover .nav-ext-arrow {
  color: var(--cyan);
  transform: translate(1px, -1px);
}

.sb-nav {
  display: grid;
  gap: 3px;
}

.nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 11px;
  border-radius: 11px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--fg-sec);
  font-size: 13.5px;
  font-weight: 550;
  cursor: pointer;
  text-align: left;
  transition: all 0.16s ease;
}

.nav-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.nav-item svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.85;
}

.nav-item:hover {
  background: var(--bg-card);
  color: var(--fg);
}

.nav-item.active {
  background: linear-gradient(90deg, var(--bg-pill-strong) 0%, rgba(96, 165, 250, 0.04) 100%);
  border-color: var(--border-cyan);
  color: var(--cyan-bright);
  box-shadow: var(--glow-cyan);
}

.nav-item.active svg {
  color: var(--cyan);
  opacity: 1;
}

.nav-item-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--bg-pill);
  color: var(--cyan);
}

.sb-bottom {
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
  display: grid;
  gap: 8px;
}

.sb-user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 11px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
}

.sb-avatar {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--cta-grad);
  color: var(--cta-fg);
  font-weight: 800;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sb-user-meta {
  min-width: 0;
  flex: 1;
}

.sb-username {
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sb-user-sub {
  font-size: 11px;
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   2. Top Telemetry Header Bar
   ========================================================================== */
.main-area {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 66px;
  padding: 12px 28px;
  background: rgba(13, 12, 11, 0.84);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

[data-theme="light"] .topbar {
  background: rgba(252, 250, 247, 0.88);
}

.topbar-left h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 740;
  letter-spacing: -0.02em;
}

.topbar-sub {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 1px;
}

.topbar-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.demo-banner-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px dashed rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.1);
  color: var(--amber);
  font-size: 12px;
  font-weight: 600;
}

.ping-pill,
.balance-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 34px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.16s ease;
}

.ping-pill:hover,
.balance-pill:hover {
  border-color: var(--border-cyan);
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--emerald);
  box-shadow: 0 0 8px var(--emerald);
}

.topup-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 15px;
  border-radius: 999px;
  border: none;
  background: var(--cta-grad);
  color: var(--cta-fg);
  font-size: 12.5px;
  font-weight: 720;
  cursor: pointer;
  box-shadow: var(--glow-gold);
  transition: filter 0.16s ease, transform 0.14s ease, box-shadow 0.16s ease;
}

.topup-cta-btn:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 10px 28px -6px rgba(240, 168, 48, 0.62);
}

.icon-pill-btn {
  height: 34px;
  min-width: 34px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--fg-sec);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-pill-btn:hover {
  color: var(--fg);
  border-color: var(--border-cyan);
}

/* ==========================================================================
   3. Workspace Content & OpenLux Quick-Action Banner
   ========================================================================== */
.workspace {
  padding: 22px 28px 42px;
  max-width: 1420px;
  width: 100%;
  margin: 0 auto;
  display: grid;
  gap: 18px;
}

.quick-banner {
  background:
    radial-gradient(58% 120% at 0% 0%, rgba(245, 158, 11, 0.14) 0%, transparent 65%),
    radial-gradient(42% 110% at 100% 100%, rgba(45, 212, 191, 0.08) 0%, transparent 65%),
    var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.qb-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.qb-mascot {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  border: 1px solid var(--border-gold);
  box-shadow: var(--glow-gold);
  object-fit: cover;
  flex-shrink: 0;
}

.qb-title {
  font-size: 16px;
  font-weight: 720;
  margin: 0 0 3px;
}

.qb-desc {
  margin: 0;
  font-size: 12.5px;
  color: var(--fg-sec);
}

.qb-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.qb-tile {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 15px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card-alt);
  color: var(--fg);
  cursor: pointer;
  text-align: left;
  transition: all 0.16s ease;
}

.qb-tile:hover {
  border-color: var(--border-cyan);
  background: var(--bg-card-hover);
  transform: translateY(-1px);
}

.qb-tile-icon {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--bg-pill);
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.qb-tile-icon svg {
  width: 16px;
  height: 16px;
}

.qb-tile-title {
  font-size: 12.5px;
  font-weight: 650;
  display: block;
}

.qb-tile-sub {
  font-size: 11px;
  color: var(--fg-muted);
  display: block;
}

/* ==========================================================================
   4. AiCodeCat-Style 4-Column High-Density Telemetry Cards
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kpi-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 148px;
  overflow: hidden;
  transition: border-color 0.18s ease;
}

.kpi-card:hover {
  border-color: var(--border-cyan);
}

.kpi-card.cache-hero {
  background:
    radial-gradient(80% 90% at 100% 0%, rgba(45, 212, 191, 0.13) 0%, transparent 70%),
    var(--bg-card);
  border-color: rgba(45, 212, 191, 0.28);
}

.kpi-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.kpi-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-sec);
}

.kpi-badge-icon {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--bg-pill);
  color: var(--cyan);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.kpi-value {
  font-size: 27px;
  font-weight: 790;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-bottom: 10px;
}

.kpi-value.mint {
  color: var(--mint);
}

.kpi-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.mini-pill {
  font-size: 11px;
  font-weight: 650;
  padding: 2px 9px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg-card-alt);
  color: var(--fg-sec);
  cursor: pointer;
}

.mini-pill.cyan {
  background: var(--bg-pill-strong);
  border-color: var(--border-cyan);
  color: var(--cyan-bright);
}

.mini-pill.gold {
  background: var(--gold-soft);
  border-color: var(--border-gold);
  color: var(--gold-bright);
}

.mini-pill.mint {
  background: rgba(45, 212, 191, 0.14);
  border-color: rgba(45, 212, 191, 0.35);
  color: var(--mint);
}

.kpi-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 11.5px;
  color: var(--fg-muted);
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

/* Decorative 4x4 Dot Matrix (AiCodeCat signature micro-detail) */
.dot-matrix {
  display: grid;
  grid-template-columns: repeat(4, 4px);
  gap: 3px;
  opacity: 0.65;
}

.dot-matrix span {
  width: 4px;
  height: 4px;
  border-radius: 1px;
  background: var(--border);
}

.dot-matrix span.on {
  background: var(--mint);
}

/* ==========================================================================
   5. Middle Row: Trend Bar Chart (2/3) + Structure Breakdown (1/3)
   ========================================================================== */
.mid-grid {
  display: grid;
  grid-template-columns: 1.65fr 1fr;
  gap: 14px;
}

.panel-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 22px;
}

.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 16px;
}

.panel-title {
  margin: 0;
  font-size: 14.5px;
  font-weight: 700;
}

.panel-sub {
  font-size: 11.5px;
  color: var(--fg-muted);
  margin-top: 2px;
}

.seg-group {
  display: inline-flex;
  padding: 3px;
  border-radius: 9px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  gap: 2px;
}

.seg-btn {
  padding: 4px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--fg-muted);
  font-size: 11.5px;
  font-weight: 650;
  cursor: pointer;
  transition: all 0.14s ease;
}

.seg-btn.active {
  background: var(--cyan);
  color: var(--cyan-fg);
}

.trend-summary-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.trend-big-num {
  font-size: 24px;
  font-weight: 780;
}

.trend-stats-chips {
  display: flex;
  gap: 8px;
  font-size: 11.5px;
  color: var(--fg-sec);
}

.trend-stats-chips span {
  padding: 3px 9px;
  border-radius: 6px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border-subtle);
}

/* Interactive Bar Chart */
.bar-chart-area {
  height: 176px;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  padding-top: 22px;
  border-bottom: 1px solid var(--border-subtle);
}

.bar-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  position: relative;
  cursor: pointer;
}

.bar-stack {
  width: 100%;
  max-width: 28px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--cyan) 0%, rgba(45, 212, 191, 0.26) 100%);
  min-height: 4px;
  transition: height 0.25s ease, filter 0.15s ease;
}

.bar-col:hover .bar-stack {
  filter: brightness(1.2);
  box-shadow: var(--glow-cyan);
}

.bar-tooltip {
  position: absolute;
  bottom: calc(100% - 14px);
  left: 50%;
  transform: translateX(-50%);
  padding: 5px 8px;
  border-radius: 7px;
  background: #141210;
  border: 1px solid var(--border-gold);
  color: #f5f1e8;
  font-size: 10.5px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.14s ease;
  z-index: 10;
}

.bar-col:hover .bar-tooltip {
  opacity: 1;
}

.bar-x-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 7px;
  font-size: 10.5px;
  color: var(--fg-muted);
}

/* Structure Breakdown Stacked Bar */
.stacked-ratio-bar {
  height: 10px;
  border-radius: 999px;
  background: var(--bg-input);
  overflow: hidden;
  display: flex;
  gap: 2px;
  margin: 12px 0 18px;
}

.sr-seg {
  height: 100%;
  transition: width 0.3s ease;
}

.struct-list {
  display: grid;
  gap: 12px;
}

.struct-item {
  display: grid;
  gap: 5px;
}

.struct-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
}

.struct-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 7px;
}

.struct-mini-track {
  height: 4px;
  border-radius: 999px;
  background: var(--bg-input);
  overflow: hidden;
}

/* ==========================================================================
   6. GitHub-Style 90-Day Bioluminescent Activity Heatmap
   ========================================================================== */
.heatmap-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 210px;
  gap: 20px;
  align-items: center;
}

.heatmap-scroll {
  overflow-x: auto;
  padding-bottom: 4px;
}

.heatmap-grid-wrap {
  display: inline-grid;
  grid-template-columns: 28px repeat(13, minmax(36px, 1fr));
  gap: 5px;
  width: 100%;
  min-width: 620px;
}

.hm-dow-col {
  display: grid;
  grid-template-rows: 18px repeat(7, 14px);
  gap: 4px;
  font-size: 10px;
  color: var(--fg-muted);
  align-items: center;
}

.hm-week-col {
  display: grid;
  grid-template-rows: 18px repeat(7, 14px);
  gap: 4px;
}

.hm-month-lbl {
  font-size: 10px;
  color: var(--fg-muted);
  white-space: nowrap;
}

.hm-cell {
  height: 14px;
  border-radius: 3.5px;
  background: var(--heat-0);
  border: 1px solid rgba(255, 255, 255, 0.03);
  transition: transform 0.12s ease, border-color 0.12s ease;
  cursor: pointer;
}

.hm-cell:hover {
  transform: scale(1.18);
  border-color: var(--cyan-bright);
}

.hm-cell.lv-1 { background: var(--heat-1); }
.hm-cell.lv-2 { background: var(--heat-2); }
.hm-cell.lv-3 { background: var(--heat-3); }
.hm-cell.lv-4 {
  background: var(--heat-4);
  box-shadow: 0 0 10px rgba(96, 165, 250, 0.45);
}

.hm-summary-box {
  background: var(--bg-card-alt);
  border: 1px solid var(--border);
  border-radius: 13px;
  padding: 15px 16px;
  display: grid;
  gap: 10px;
}

.hm-peak-val {
  font-size: 21px;
  font-weight: 780;
  color: var(--cyan);
}

.hm-legend {
  display: grid;
  gap: 5px;
  font-size: 11px;
  color: var(--fg-muted);
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.hm-legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.hm-swatch {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2.5px;
  margin-right: 6px;
}

/* ==========================================================================
   7. Bottom Row & Tables (Recent Calls, Tokens, Logs, Wallet)
   ========================================================================== */
.bottom-grid {
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 14px;
}

.call-feed {
  display: grid;
  gap: 8px;
}

.call-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 11px;
  background: var(--bg-card-alt);
  border: 1px solid var(--border-subtle);
  transition: border-color 0.15s ease;
}

.call-row:hover {
  border-color: var(--border-cyan);
}

.call-left {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
}

.call-dot-icon {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  background: var(--bg-pill);
  color: var(--cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 12px;
  flex-shrink: 0;
}

.call-model {
  font-size: 13px;
  font-weight: 650;
}

.call-meta {
  font-size: 11.5px;
  color: var(--fg-muted);
}

.call-right {
  text-align: right;
  flex-shrink: 0;
}

.call-cost {
  font-size: 13px;
  font-weight: 720;
  color: var(--fg);
}

/* --- Device Preset Launcher (Tokens View) --- */
.preset-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.preset-tile {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  cursor: pointer;
  text-align: left;
  transition: all 0.16s ease;
}

.preset-tile:hover {
  border-color: var(--border-cyan);
  background: var(--bg-card-hover);
  transform: translateY(-2px);
  box-shadow: var(--glow-cyan);
}

.preset-tile-tag {
  display: inline-block;
  font-size: 10.5px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-pill);
  color: var(--cyan);
  margin-bottom: 8px;
}

.preset-tile h3 {
  margin: 0 0 4px;
  font-size: 14px;
}

.preset-tile p {
  margin: 0;
  font-size: 12px;
  color: var(--fg-muted);
}

/* --- Data Table --- */
.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  padding: 11px 14px;
  font-size: 11px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.data-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.data-table tr:hover td {
  background: var(--bg-card-alt);
}

.cache-hit-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  background: rgba(45, 212, 191, 0.13);
  color: var(--mint);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
}

.status-chip.on {
  background: rgba(16, 185, 129, 0.13);
  color: var(--emerald);
}

.status-chip.off {
  background: rgba(148, 163, 184, 0.14);
  color: var(--fg-muted);
}

.status-chip.usage {
  background: rgba(34, 211, 238, 0.13);
  color: var(--cyan);
}

.status-chip.error {
  background: rgba(244, 63, 94, 0.14);
  color: var(--rose);
}

.status-chip.topup {
  background: rgba(45, 212, 191, 0.14);
  color: var(--mint);
}

.status-chip.system {
  background: rgba(148, 163, 184, 0.14);
  color: var(--fg-sec);
}

.log-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-subtle);
}

.log-toolbar-left,
.log-toolbar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.log-detail-note {
  display: inline-block;
  max-width: 460px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.45;
  color: var(--fg-sec);
  background: var(--bg-card-alt);
  border: 1px solid var(--border-subtle);
  word-break: break-word;
}

.log-detail-note.is-error {
  color: var(--rose);
  background: rgba(244, 63, 94, 0.07);
  border-color: rgba(244, 63, 94, 0.24);
}

.log-detail-note.is-topup {
  color: var(--mint);
  background: rgba(45, 212, 191, 0.08);
  border-color: rgba(45, 212, 191, 0.24);
}

.table-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  padding-top: 14px;
  margin-top: 12px;
  border-top: 1px solid var(--border-subtle);
  font-size: 12px;
  color: var(--fg-muted);
}

.pagination-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.page-btn {
  min-width: 30px;
  height: 30px;
  padding: 0 9px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card-alt);
  color: var(--fg-sec);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}

.page-btn:hover:not(:disabled) {
  border-color: var(--border-cyan);
  color: var(--cyan);
}

.page-btn.active {
  background: var(--bg-pill-strong);
  border-color: var(--border-cyan);
  color: var(--cyan-bright);
}

.page-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.page-ellipsis {
  padding: 0 4px;
  color: var(--fg-muted);
}

.admin-quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.tbl-btn {
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid var(--border);
  background: var(--bg-card-alt);
  color: var(--fg-sec);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  margin-right: 5px;
  transition: all 0.14s ease;
}

.tbl-btn:hover {
  border-color: var(--border-cyan);
  color: var(--cyan);
}

.tbl-btn.danger:hover {
  border-color: var(--rose);
  color: var(--rose);
}

/* --- Wallet Cyber Card --- */
.wallet-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 18px;
}

.cyber-wallet-card {
  position: relative;
  border-radius: 20px;
  padding: 28px;
  background:
    radial-gradient(90% 100% at 90% 10%, rgba(245, 158, 11, 0.26) 0%, transparent 65%),
    radial-gradient(60% 80% at 10% 90%, rgba(45, 212, 191, 0.16) 0%, transparent 65%),
    linear-gradient(145deg, #1c1711 0%, #0e0c09 100%);
  border: 1px solid var(--border-gold);
  box-shadow: var(--shadow-elevated), var(--glow-gold);
  color: #f6f1e7;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 230px;
  overflow: hidden;
}

.cwc-watermark {
  position: absolute;
  right: -10px;
  bottom: -10px;
  width: 142px;
  height: 142px;
  border-radius: 28px;
  opacity: 0.2;
  pointer-events: none;
}

.cwc-balance {
  font-size: 38px;
  font-weight: 820;
  letter-spacing: -0.03em;
  margin: 12px 0 4px;
}

.redeem-input-row {
  display: flex;
  gap: 10px;
  margin: 14px 0;
}

.text-input {
  width: 100%;
  height: 42px;
  padding: 0 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--fg);
  font-size: 13.5px;
  outline: none;
  transition: border-color 0.15s ease;
}

.text-input:focus {
  border-color: var(--cyan);
}

/* ==========================================================================
   8. Bespoke Split-Screen Login / Register View
   ========================================================================== */
.auth-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  background: var(--bg-canvas);
}

.auth-showcase {
  position: relative;
  padding: 48px 56px;
  background:
    radial-gradient(65% 65% at 24% 24%, rgba(245, 158, 11, 0.18) 0%, transparent 70%),
    radial-gradient(50% 50% at 82% 80%, rgba(45, 212, 191, 0.13) 0%, transparent 70%),
    #0a0908;
  border-right: 1px solid var(--border);
  color: #f6f1e7;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

.auth-mascot-hero {
  width: 112px;
  height: 112px;
  border-radius: 26px;
  border: 1px solid var(--border-gold);
  box-shadow: var(--glow-gold);
  object-fit: cover;
  margin-bottom: 22px;
}

.auth-showcase h2 {
  font-size: clamp(26px, 3vw, 36px);
  line-height: 1.18;
  letter-spacing: -0.025em;
  margin: 0 0 14px;
}

.auth-form-side {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 36px 24px;
}

.auth-box {
  width: 100%;
  max-width: 400px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 34px 32px;
  box-shadow: var(--shadow-elevated);
}

.form-field {
  margin-bottom: 15px;
}

.form-field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg-sec);
  margin-bottom: 6px;
}

/* ==========================================================================
   9. Modal & Toast Notification
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--bg-modal);
  backdrop-filter: blur(6px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  width: 100%;
  max-width: 500px;
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: 18px;
  padding: 24px 26px;
  box-shadow: var(--shadow-elevated), var(--glow-gold);
}

.toast-float {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 100;
  padding: 11px 18px;
  border-radius: 11px;
  background: #181512;
  border: 1px solid var(--border-gold);
  color: var(--gold-bright);
  font-size: 13px;
  font-weight: 600;
  box-shadow: var(--shadow-elevated), var(--glow-gold);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.2s ease;
}

.toast-float.show {
  opacity: 1;
  transform: translateY(0);
}

/* ==========================================================================
   10. Responsive Breakpoints
   ========================================================================== */
@media (max-width: 1160px) {
  .kpi-grid,
  .preset-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .mid-grid,
  .heatmap-layout,
  .bottom-grid,
  .wallet-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .auth-screen {
    grid-template-columns: 1fr;
  }

  .auth-showcase {
    display: none;
  }

  .workspace,
  .topbar {
    padding-left: 16px;
    padding-right: 16px;
  }
}

@media (max-width: 560px) {
  .kpi-grid,
  .preset-cards {
    grid-template-columns: 1fr;
  }
}
