/* ─────────────────────────────────────────────────────────
   Datalicit app shell styles
   ───────────────────────────────────────────────────────── */

/* Reset */
*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  background: var(--bg);
  overflow-x: hidden;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(circle at 84% 12%, oklch(67% 0.135 215 / 0.09) 0%, transparent 28%),
    radial-gradient(circle at 10% 88%, oklch(72% 0.160 157 / 0.08) 0%, transparent 24%),
    radial-gradient(circle at 48% 38%, oklch(65% 0.118 62 / 0.05) 0%, transparent 20%);
}
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .38;
  background-image:
    linear-gradient(to right, oklch(14% 0.022 250 / 0.03) 1px, transparent 1px),
    linear-gradient(to bottom, oklch(14% 0.022 250 / 0.03) 1px, transparent 1px);
  background-size: 240px 240px;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
img { max-width: 100%; display: block; }

/* ── SHELL LAYOUT ── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── SIDEBAR ── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: oklch(100% 0 0 / 0.82);
  backdrop-filter: blur(18px) saturate(145%);
  -webkit-backdrop-filter: blur(18px) saturate(145%);
  border-right: 1px solid oklch(14% 0.022 250 / 0.08);
  box-shadow: 12px 0 36px oklch(14% 0.022 250 / 0.04);
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  z-index: 1002;
  padding: 20px 16px 24px;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 20px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 12px;
}
.sidebar-brand-name {
  display: inline-flex;
  align-items: baseline;
  gap: 0;
  font-size: 24px;
  line-height: 1;
  color: var(--text);
}
.sidebar-brand-data {
  font-family: var(--font-sans);
  font-style: normal;
  font-weight: 620;
  letter-spacing: -.05em;
}
.sidebar-brand-licit {
  font-family: var(--font-sans);
  font-style: normal;
  font-weight: 300;
  letter-spacing: -.04em;
}

.sidebar-section-label {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 8px 8px 4px;
  margin-top: 8px;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: color 0.15s, background 0.15s;
}
.nav-item:hover { color: var(--text); background: oklch(14% 0.02 250 / 0.04); }
.nav-item.active { color: var(--text); background: var(--cyan-soft); }
.nav-item.active .nav-icon { color: var(--cyan); }

/* Locked nav items (Pro-only features visible to Free users) */
.nav-item--locked {
  opacity: 0.45;
  pointer-events: auto;
  cursor: pointer;
}
.nav-item--locked:hover {
  opacity: 0.7;
  color: var(--muted);
}
.nav-pro-badge {
  display: inline-flex;
  align-items: center;
  margin-left: auto;
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 7px;
  border-radius: 6px;
  background: var(--cyan-soft);
  color: var(--cyan);
  line-height: 1;
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}
.nav-item.active .nav-icon { opacity: 1; }

/* Sidebar bottom user section */
.sidebar-user {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 10px;
}
.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #fff;
}
.user-info { flex: 1; min-width: 0; }
.user-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-role {
  font-size: 11px;
  color: var(--muted-2);
  font-family: var(--font-mono);
}
.btn-logout {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--muted-2);
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.btn-logout:hover { color: var(--red); background: var(--red-soft); }

/* ── MAIN AREA ── */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* ── APP TOPBAR ── */
.app-topbar {
  height: 72px;
  position: sticky;
  top: 0;
  z-index: 30;
  background: oklch(97.8% 0.005 240 / 0.72);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border-bottom: 1px solid oklch(14% 0.022 250 / 0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  gap: 16px;
}

.topbar-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}

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

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.04em;
}
.badge-cyan  { background: var(--cyan-soft);  color: var(--cyan);  }
.badge-green { background: var(--green-soft); color: oklch(55% 0.16 157); }
.badge-amber { background: var(--amber-soft); color: oklch(50% 0.12 62); }
.badge-red   { background: var(--red-soft);   color: var(--red); }

/* ── CONTENT AREA ── */
.app-content {
  flex: 1;
  padding: 36px 30px 72px;
  max-width: 1240px;
}

/* ── SECTION HEADER ── */
.section-header {
  margin-bottom: 30px;
}
.section-kicker {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 8px;
}
.section-title {
  font-size: clamp(28px, 3.1vw, 42px);
  font-weight: 700;
  letter-spacing: -0.06em;
  margin: 0 0 6px;
  color: var(--text);
}
.section-desc {
  font-size: 15px;
  color: var(--muted);
  line-height: 1.6;
  margin: 0;
}

/* ── STAT CARDS ── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}
.stat-card {
  background: var(--bg-panel);
  border: 1px solid var(--line-2);
  border-radius: 24px;
  padding: 22px 24px;
  box-shadow: var(--shadow);
}
.stat-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 8px;
}
.stat-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
  line-height: 1;
  margin-bottom: 4px;
}
.stat-sub {
  font-size: 12px;
  color: var(--muted);
}

/* ── MARKET SCOPE ── */
.market-scope {
  margin-bottom: 18px;
}
.market-switcher {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.market-pill {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 74px;
  padding: 14px 16px;
  border-radius: 22px;
  border: 1px solid var(--line-2);
  background: var(--bg-panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s, background 0.18s;
}
.market-pill span {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.04em;
}
.market-pill small {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.market-pill:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
  border-color: var(--cyan);
}
.market-pill.active {
  background: var(--cyan-soft);
  border-color: oklch(67% 0.135 215 / 0.22);
}
.market-pill.locked {
  cursor: not-allowed;
  opacity: .55;
}
.market-scope-note {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

/* ── DASHBOARD HERO / CHARTS ── */
.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 20px;
  align-items: stretch;
  margin-bottom: 18px;
}
.dashboard-hero.card {
  padding: 30px;
  border-radius: 32px;
  background: linear-gradient(180deg, oklch(100% 0 0 / 0.94), oklch(98% 0.006 240 / 0.90));
}
.dashboard-hero-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-right: 12px;
}
.dashboard-hero-title {
  font-size: clamp(46px, 5.2vw, 72px);
  line-height: .94;
  letter-spacing: -0.075em;
  margin: 0 0 10px;
  max-width: 9ch;
}
.dashboard-hero-desc {
  margin: 0;
  color: var(--muted);
  font-size: clamp(16px, 1.5vw, 19px);
  line-height: 1.72;
  max-width: 42ch;
}
.dashboard-cta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}
.dashboard-cta .btn {
  height: 46px;
  padding: 0 20px;
}
.dashboard-note {
  margin: 16px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.dashboard-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}
.dashboard-pulse {
  border-radius: var(--radius-md);
  border: 1px solid var(--line-2);
  background: linear-gradient(180deg, oklch(100% 0 0), oklch(97.8% 0.005 240));
  padding: 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100%;
}
.dashboard-pulse-label {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 12px;
}
.dashboard-pulse-value {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.04em;
  line-height: 1.1;
  margin-bottom: 8px;
  color: var(--text);
}
.dashboard-pulse-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.dashboard-support {
  border: 1px solid var(--line-2);
  border-radius: 28px;
  background: linear-gradient(180deg, oklch(100% 0 0 / 0.96), oklch(97.8% 0.005 240 / 0.88));
  padding: 22px;
  min-height: 100%;
}
.dashboard-support-title {
  font-size: clamp(22px, 2.4vw, 30px);
  font-weight: 700;
  letter-spacing: -0.06em;
  line-height: 1.1;
  margin-bottom: 8px;
  color: var(--text);
}
.dashboard-support-meta {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  margin-bottom: 16px;
}
.dashboard-support-bars {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.dashboard-support-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(120px, 1fr);
  gap: 12px;
  align-items: center;
}
.dashboard-support-row-copy { min-width: 0; }
.dashboard-support-row-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.dashboard-support-row-sub {
  margin-top: 3px;
  font-size: 10px;
  font-family: var(--font-mono);
  color: var(--muted-2);
}
.dashboard-support-track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: oklch(14% 0.02 250 / 0.06);
  overflow: hidden;
}
.dashboard-support-fill {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  opacity: 0.8;
}
.dashboard-data-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  grid-column: 1 / -1;
  margin-top: 6px;
}
.dashboard-data-box {
  border: 1px solid var(--line-2);
  border-radius: 22px;
  padding: 18px;
  background: var(--bg-panel);
  box-shadow: inset 0 1px 0 oklch(100% 0 0 / 0.8);
}
.dashboard-data-box--ghost {
  background: linear-gradient(180deg, var(--surface-2), var(--surface));
}
.dashboard-data-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 10px;
}
.dashboard-data-box strong {
  display: block;
  font-size: 20px;
  line-height: 1.05;
  letter-spacing: -0.04em;
  color: var(--text);
}
.dashboard-data-box small {
  display: block;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
}
.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  gap: 20px;
  align-items: stretch;
  margin-bottom: 18px;
}
.quick-action-grid-compact {
  grid-template-columns: 1fr;
  margin-top: 0;
}
.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.95fr);
  gap: 16px;
  margin-bottom: 32px;
}
.dashboard-panel {
  padding: 22px;
}
.panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-kicker {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 4px;
}
.panel-title {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--text);
}
.panel-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--cyan-soft);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.quick-action-grid-compact {
  grid-template-columns: 1fr;
  margin-top: 0;
}
.range-chart {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.range-row {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(180px, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}
.range-row:first-child { border-top: none; padding-top: 0; }
.range-row-copy { min-width: 0; }
.range-row-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
}
.range-row-sub {
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted-2);
  font-family: var(--font-mono);
}
.range-track {
  position: relative;
  height: 10px;
  border-radius: 999px;
  background: oklch(14% 0.02 250 / 0.06);
  overflow: hidden;
}
.range-fill {
  position: absolute;
  inset: 0 auto 0 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--green));
  opacity: 0.8;
}
.range-marker {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  transform: translateX(-50%);
  border-radius: 50%;
  border: 2px solid #fff;
  background: var(--text);
  box-shadow: 0 1px 8px oklch(14% 0.022 250 / 0.16);
}
.range-values {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.range-spread {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  white-space: nowrap;
}

/* ── TABLE ── */
.table-card {
  background: var(--bg-panel);
  border: 1px solid var(--line-2);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.table-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  gap: 12px;
  flex-wrap: wrap;
}
.table-toolbar-title {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.search-input {
  height: 34px;
  padding: 0 12px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
  width: 200px;
  outline: none;
  transition: border-color 0.15s;
}
.search-input:focus { border-color: var(--cyan); }
.search-input::placeholder { color: var(--muted-2); }

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted-2);
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.data-table th.right, .data-table td.right { text-align: right; }
.data-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--text);
  vertical-align: middle;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: oklch(14% 0.02 250 / 0.025); }
.data-table .mono {
  font-family: var(--font-mono);
  font-size: 12px;
}
.data-table .item-name {
  font-weight: 500;
  max-width: 260px;
}
.data-table .item-sub {
  font-size: 11px;
  color: var(--muted-2);
  font-family: var(--font-mono);
  margin-top: 2px;
}

.sim-price-btn {
  appearance: none;
  border: none;
  background: none;
  color: var(--cyan);
  padding: 0;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.15s, opacity 0.15s, text-decoration-color 0.15s;
}
.sim-price-btn:hover,
.sim-price-btn:focus-visible {
  color: color-mix(in oklch, var(--cyan) 80%, #000 20%);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  outline: none;
}
.sim-price-btn.is-zero {
  color: var(--muted-2);
}

.sim-ref-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.sim-ref-modal {
  width: min(920px, calc(100vw - 32px));
  max-height: min(82vh, 760px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 22px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.sim-ref-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.sim-ref-title {
  margin: 6px 0 0;
  font-size: 22px;
  letter-spacing: -.03em;
}
.sim-ref-copy {
  margin: 8px 0 0;
  max-width: 60ch;
  font-size: 13px;
  color: var(--muted);
}
.sim-ref-close {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
}
.sim-ref-close:hover { color: var(--text); border-color: var(--cyan); }
.sim-ref-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.sim-ref-search-wrap {
  display: flex;
  gap: 10px;
  align-items: center;
}
.sim-ref-search {
  flex: 1;
  min-width: 0;
  width: auto;
}
.sim-ref-zero-btn {
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid oklch(65% 0.118 62 / 0.22);
  background: var(--red-soft);
  color: var(--red);
  font-weight: 600;
  cursor: pointer;
}
.sim-ref-zero-btn:hover { border-color: var(--red); }
.sim-ref-list {
  display: grid;
  gap: 10px;
  overflow: auto;
  padding-right: 4px;
}
.sim-ref-list-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 2px 2px 0;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted-2);
}
.sim-ref-option {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line-2);
  border-radius: 18px;
  background: var(--bg-panel);
  padding: 14px 16px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s, background 0.15s;
}
.sim-ref-option:hover,
.sim-ref-option:focus-visible {
  border-color: var(--cyan);
  background: var(--cyan-soft);
  transform: translateY(-1px);
  outline: none;
}
.sim-ref-option.is-current {
  border-color: var(--cyan);
  box-shadow: 0 0 0 1px var(--cyan-soft) inset;
}
.sim-ref-option-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}
.sim-ref-option-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}
.sim-ref-option-meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted-2);
}
.sim-ref-empty {
  padding: 24px;
  border: 1px dashed var(--line-2);
  border-radius: 18px;
  background: var(--bg);
  display: grid;
  gap: 8px;
}
.sim-ref-empty p {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

/* ── UPLOAD ZONE ── */
.upload-zone {
  border: 1.5px dashed var(--line-2);
  border-radius: 28px;
  padding: 52px 24px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--bg-panel);
}
.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--cyan);
  background: var(--cyan-soft);
}
.upload-icon {
  width: 40px;
  height: 40px;
  margin: 0 auto 14px;
  color: var(--muted-2);
}
.upload-zone:hover .upload-icon { color: var(--cyan); }
.upload-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 4px;
}
.upload-sub {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 16px;
}
.upload-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 16px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
  transition: border-color 0.15s, background 0.15s;
}
.upload-btn:hover { border-color: var(--cyan); background: var(--cyan-soft); color: var(--cyan); }

/* ── SLIDER ── */
.slider-group {
  margin: 24px 0;
}
.slider-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.slider-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.slider-value-display {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--cyan);
  min-width: 60px;
  text-align: right;
}
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 2px;
  background: var(--line-2);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cyan);
  cursor: pointer;
  box-shadow: 0 2px 8px oklch(67% 0.135 215 / 0.32);
}
input[type="range"]::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--cyan);
  cursor: pointer;
  border: none;
}

/* ── BUTTONS ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 18px;
  border-radius: 999px;
  font-size: 13.5px;
  font-weight: 620;
  letter-spacing: -0.01em;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  transition: transform 0.18s, box-shadow 0.18s;
  text-decoration: none;
}
.btn:hover { transform: translateY(-1px); }
.btn-primary {
  color: #fff;
  background: linear-gradient(128deg, var(--cyan) 0%, var(--cyan) 40%, var(--green) 100%);
  box-shadow: 0 3px 18px oklch(67% 0.135 215 / 0.24);
}
.btn-primary:hover { box-shadow: 0 6px 24px oklch(67% 0.135 215 / 0.32); }
.btn-secondary {
  color: var(--text);
  background: var(--bg-panel);
  border: 1px solid var(--line-2);
  box-shadow: var(--shadow);
}
.btn-ghost {
  color: var(--muted);
  background: transparent;
  border: 1px solid var(--line-2);
}
.btn-ghost:hover { color: var(--text); background: oklch(14% 0.02 250 / 0.04); }

/* ── WARNING BANNER ── */
.warning-banner {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--amber-soft);
  border: 1px solid oklch(65% 0.118 62 / 0.22);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin: 16px 0;
  font-size: 13px;
  color: oklch(40% 0.10 62);
}
.warning-banner svg { flex-shrink: 0; margin-top: 1px; }

/* ── STATUS PILLS ── */
.status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.status-ok       { background: var(--green-soft);  color: oklch(50% 0.16 157); }
.status-low      { background: var(--amber-soft);  color: oklch(48% 0.12 62); }
.status-high     { background: var(--red-soft);    color: var(--red); }
.status-missing  { background: var(--line);        color: var(--muted); }

/* ── PANELS / CARD ── */
.card {
  background: var(--bg-panel);
  border: 1px solid var(--line-2);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 26px;
}
.card + .card { margin-top: 16px; }

/* ── GRID HELPERS ── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }

/* ── QUICK ACTIONS ── */
.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 28px;
}
.quick-action-card {
  background: var(--bg-panel);
  border: 1px solid var(--line-2);
  border-radius: 26px;
  padding: 22px;
  cursor: pointer;
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.quick-action-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--cyan);
}
.qa-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.qa-icon-cyan  { background: var(--cyan-soft);  color: var(--cyan); }
.qa-icon-green { background: var(--green-soft); color: oklch(52% 0.16 157); }
.qa-icon-amber { background: var(--amber-soft); color: oklch(48% 0.12 62); }
.qa-title { font-size: 13.5px; font-weight: 600; color: var(--text); margin: 0; }
.qa-desc  { font-size: 12px; color: var(--muted); margin: 0; line-height: 1.5; }

/* ── ALERTS ── */
.alerts-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 20px;
  align-items: stretch;
  margin-bottom: 16px;
  padding: 30px;
  border-radius: 32px;
  background: linear-gradient(180deg, oklch(100% 0 0 / 0.94), oklch(98% 0.006 240 / 0.90));
}
.alerts-hero-title {
  font-size: clamp(36px, 4.7vw, 62px);
  line-height: .95;
  letter-spacing: -0.07em;
  margin: 0 0 10px;
  max-width: 10ch;
}
.alerts-hero-desc {
  margin: 0;
  color: var(--muted);
  font-size: clamp(15px, 1.45vw, 18px);
  line-height: 1.7;
  max-width: 46ch;
}
.alerts-channel-stack {
  border: 1px solid var(--line-2);
  border-radius: 28px;
  background: linear-gradient(180deg, oklch(100% 0 0 / 0.96), oklch(97.8% 0.005 240 / 0.88));
  padding: 22px;
}
.alerts-channel-list {
  display: grid;
  gap: 12px;
}
.alert-channel-card {
  border: 1px solid var(--line-2);
  border-radius: 24px;
  padding: 16px;
  background: var(--bg-panel);
}
.alert-channel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.alert-channel-name {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: -0.04em;
  color: var(--text);
}
.alert-channel-status {
  margin-top: 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.alert-channel-desc {
  margin: 10px 0 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
}
.alerts-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--cyan-soft);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.alerts-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.alerts-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.alerts-field span {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}
.alerts-field small {
  font-size: 11px;
  color: var(--muted-2);
}
.alerts-input {
  height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 16px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}
.alerts-input:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 4px var(--cyan-soft);
}
.alerts-range {
  width: 100%;
}
.alerts-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.alerts-footnote {
  margin: 14px 0 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted-2);
}
.alerts-history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.alerts-history-item {
  border: 1px solid var(--line-2);
  border-radius: 24px;
  padding: 16px;
  background: var(--bg-panel);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.alerts-history-main {
  min-width: 0;
}
.alerts-history-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.alerts-history-title-row h3 {
  margin: 0;
  font-size: 15px;
  line-height: 1.25;
  letter-spacing: -0.04em;
  color: var(--text);
}
.alerts-history-main p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}
.alerts-history-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted-2);
  white-space: nowrap;
}

/* ── EMPTY STATE ── */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--muted);
}
.empty-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  opacity: 0.4;
}
.empty-title { font-size: 15px; font-weight: 600; color: var(--text); margin: 0 0 6px; }
.empty-sub   { font-size: 13px; margin: 0; }

/* ── SEPARATOR ── */
.sep {
  height: 1px;
  background: var(--line);
  margin: 24px 0;
}

/* ── ANIMATIONS ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.28s ease both; }


/* ── Mobile menu toggle ── */
/* ============================================================
   MOBILE-FIRST RESPONSIVE STYLES
   ============================================================ */

/* -- Hamburger Menu Toggle -- */
.menu-toggle {
  display: none;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1000;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: oklch(100% 0 0 / 0.85);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  color: var(--text);
  font-size: 1.4rem;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.menu-toggle:active { transform: scale(0.94); background: var(--surface-2); }

/* ============================================================
   max-width: 900px - Tablet / Compact
   ============================================================ */
@media (max-width: 900px) {
  .sidebar {
    width: 56px;
    padding: 16px 8px;
  }
  .sidebar-brand-name,
  .sidebar-section-label,
  .nav-item span,
  .user-info { display: none; }
  .nav-item { justify-content: center; padding: 12px 10px; min-height: 44px; }
  .sidebar-user { justify-content: center; }
  .app-main { margin-left: 56px; }

  /* Layouts */
  .grid-2 { grid-template-columns: 1fr; }
  .dashboard-hero,
  .dashboard-grid { grid-template-columns: 1fr; }
  .alerts-hero { grid-template-columns: 1fr; }
  .market-switcher { grid-template-columns: 1fr; }
  .dashboard-data-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-action-grid-compact { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
  .alerts-form-grid { grid-template-columns: 1fr; }

  /* Content */
  .app-topbar { padding: 0 20px; height: 64px; }
  .app-content { padding: 28px 22px 72px; }
  .market-results-shell { padding: 0 6px 8px !important; }

  /* Typography */
  .section-title { font-size: clamp(24px, 4vw, 36px); }
  .section-kicker { font-size: 10px; }
  .section-desc { font-size: 14px; }

  .sub-hero { grid-template-columns: 1fr; }
  .sub-compare-grid { grid-template-columns: 1fr; }
  .sub-stats { grid-template-columns: repeat(2, 1fr); }
  .badge--pro { width: auto; }
}

/* ============================================================
   max-width: 600px - Mobile Phone
   ============================================================ */
@media (max-width: 600px) {
  /* -- Shell -- */
  body { overflow-x: hidden; max-width: 100vw; }
  .app-shell { flex-direction: column; overflow-x: hidden; max-width: 100vw; }

  /* -- Topbar -- */
  .app-topbar {
    height: 56px;
    padding: 0 12px 0 56px;
    gap: 6px;
    position: sticky;
    z-index: 40;
  }
  .topbar-title { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
  .topbar-right { gap: 6px; }
  .badge { font-size: 9px; padding: 2px 7px; letter-spacing: 0.02em; }

  /* -- Hamburger Menu -- */
  .menu-toggle { display: flex; }
  .sidebar {
    display: flex !important;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 1001;
    width: 280px !important;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 20px 16px 24px !important;
    overflow-y: auto;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 0 0 9999px rgba(0,0,0,0.45);
  }
  .sidebar-brand-name,
  .sidebar-section-label,
  .nav-item span,
  .user-info { display: block !important; }
  .nav-item {
    justify-content: flex-start !important;
    padding: 12px 14px !important;
    min-height: 48px;
    font-size: 15px;
    border-radius: 14px;
  }
  .sidebar-user { justify-content: flex-start !important; gap: 10px; }
  .app-main { margin-left: 0 !important; }

  /* -- Content Area -- */
  .app-content { padding: 20px 12px 88px; }
  .section-header { margin-bottom: 22px; }
  .section-title { font-size: clamp(20px, 6vw, 28px); }
  .section-desc { font-size: 13.5px; line-height: 1.5; }
  .section-kicker { font-size: 9.5px; }

  /* -- Dashboard -- */
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 16px 14px; border-radius: 18px; }
  .stat-value { font-size: 22px; }
  .stat-label { font-size: 9px; }
  .stat-sub { font-size: 11px; }

  .market-scope { margin-bottom: 12px; }
  .market-pill { min-height: 60px; padding: 10px 14px; border-radius: 16px; }
  .market-pill span { font-size: 14px; }
  .market-pill small { font-size: 9px; }

  .dashboard-hero { gap: 14px; }
  .dashboard-hero.card { padding: 20px; border-radius: 24px; }
  .dashboard-hero-title { font-size: clamp(22px, 7vw, 32px); letter-spacing: -0.05em; max-width: none; }
  .dashboard-hero-desc { font-size: 13px; }
  .dashboard-panel { padding: 16px; }
  .panel-header { flex-direction: column; align-items: flex-start; gap: 6px; }
  .dashboard-data-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .dashboard-support-row { grid-template-columns: 1fr; gap: 6px; }
  .dashboard-support-track { width: 100%; }

  /* -- Tables -- */
  .data-table th, .data-table td { padding: 9px 10px; font-size: 12px; }

  /* -- Market Section -- */
  .market-results-shell {
    gap: 14px !important;
    padding: 0 0 6px !important;
    max-width: 100%;
  }
  .market-results-shell > *,
  .market-feature-grid > *,
  .market-feature-card > * { max-width: 100%; min-width: 0; box-sizing: border-box; }
  .market-results-head {
    padding: 0 2px 0 !important;
    margin-bottom: 2px !important;
  }
  .market-search-form {
    width: 100%;
    flex-direction: column !important;
    align-items: stretch !important;
  }
  .market-search-form .search-input {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
    font-size: 16px !important;
  }
  .market-search-enter { width: 100%; justify-content: center; }
  .market-feature-grid { margin: 0 !important; gap: 12px !important; }
  .market-feature-card {
    padding: 14px 14px 16px !important;
    border-radius: 22px !important;
    overflow: hidden !important;
    gap: 12px !important;
  }
  .market-feature-card .item-name { font-size: 18px !important; line-height: 1.15 !important; word-break: break-word; }
  .market-feature-card .item-sub { font-size: 12px !important; white-space: normal !important; word-break: break-word; }
  /* Fix item name + badge row (2nd div, 1st is gradient bar) */
  .market-feature-card > div:nth-of-type(2) {
    flex-direction: column !important;
    gap: 8px !important;
    align-items: stretch !important;
  }
  .market-feature-card > div:nth-of-type(2) > div:last-child {
    min-width: 0 !important;
    text-align: left !important;
    align-self: flex-start !important;
  }
  .market-feature-card > div:nth-of-type(2) > div:last-child > div {
    font-size: 11px !important;
    padding: 6px 10px !important;
    display: inline-flex !important;
  }
  .market-feature-card .mono { word-break: break-word; overflow-wrap: break-word; }
  .market-feature-card svg { max-width: 100% !important; }
  .market-feature-card .panel-chip { white-space: normal; max-width: 100%; font-size: 11px; padding: 5px 10px; }
  .market-feature-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; gap: 6px !important; }
  .market-unit-box {
    grid-column: 1 / -1;
    width: 100%;
    aspect-ratio: auto !important;
    min-height: 54px !important;
    padding: 10px !important;
    flex-direction: row !important;
    gap: 8px !important;
    justify-content: flex-start !important;
  }
  .market-unit-box > div:first-child { margin-bottom: 0 !important; margin-right: 4px; }
  .market-unit-box .mono { font-size: 18px !important; }
  .market-feature-metrics > div:not(.market-unit-box) {
    min-height: 58px !important;
    padding: 8px 10px !important;
  }
  .market-feature-metrics > div:not(.market-unit-box) .mono {
    font-size: 14px !important;
    line-height: 1.05;
  }
  .market-feature-metrics > div:not(.market-unit-box) > div:first-child {
    font-size: 9px !important;
    margin-bottom: 3px !important;
  }
  .market-simple-table {
    margin: 0 !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .market-simple-table table { min-width: 760px; }

  /* -- Alerts -- */
  .alerts-hero { grid-template-columns: 1fr; }
  .alerts-channel-stack { padding: 18px; }
  .alerts-history-item { flex-direction: column; }
  .alerts-history-meta { white-space: normal; }

  /* -- Range / Price -- */
  .range-row { grid-template-columns: 1fr; gap: 8px; padding: 12px 0; width: 100%; }
  .range-row > * { max-width: 100%; min-width: 0; box-sizing: border-box; }
  .range-row-copy { width: 100%; overflow: hidden; }
  .range-row-title { white-space: normal; word-break: break-word; line-height: 1.3; }
  .range-row-sub { white-space: normal; word-break: break-word; max-width: 100%; }
  .range-track { width: 100%; min-width: 0; }
  .range-fill { max-width: 100%; }
  .range-values { justify-content: flex-start; flex-wrap: wrap; font-size: 11px; max-width: 100%; }
  .range-values span { white-space: nowrap; }
  .range-spread { text-align: left; }
  .dashboard-support-row { grid-template-columns: 1fr; gap: 4px; }
  .dashboard-support-row-copy { max-width: 100%; overflow: hidden; }
  .dashboard-support-row-title { white-space: normal; word-break: break-word; }
  .dashboard-support-row-sub { white-space: normal; word-break: break-word; }

  .search-input { width: 140px; }

  /* -- Cards / Panels (global) -- */
  .card { border-radius: 20px; padding: 18px; }

  /* -- Overflow prevention -- */
  .app-content { max-width: 100vw; }
  .card,
  .dashboard-hero,
  .dashboard-panel,
  .dashboard-grid,
  .dashboard-data-grid,
  .range-chart,
  .market-results-shell { overflow-x: hidden; }
  .dashboard-badges { flex-wrap: wrap; max-width: 100%; }
  .dashboard-badges .badge { white-space: normal; word-break: break-word; }
  .range-values { white-space: normal; flex-wrap: wrap; gap: 6px; }
  .panel-chip { white-space: normal; word-break: break-word; max-width: 100%; }
  svg, canvas, img { max-width: 100%; height: auto; }
  .range-track { max-width: 100%; min-width: 0; }
  .dashboard-support-track { max-width: 100%; min-width: 0; }
  .market-switcher { max-width: 100%; }
  .market-pill { max-width: 100%; overflow: hidden; }
  .market-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .dashboard-hero-title { word-break: break-word; }
  .dashboard-hero-desc { word-break: break-word; }
  .dashboard-data-box { overflow: hidden; }
  .dashboard-data-box strong { word-break: break-word; overflow-wrap: break-word; }

  /* Table overflow */
  .data-table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
  .data-table table { min-width: 600px; }
}

/* ============================================================
   max-width: 420px - Small Phone
   ============================================================ */
@media (max-width: 420px) {
  .app-topbar { height: 52px; padding: 0 8px 0 50px; }
  .topbar-title { font-size: 12px; max-width: 110px; }
  .badge { font-size: 8px; padding: 1px 6px; }

  .app-content { padding: 16px 10px 80px; }

  .stat-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat-card { padding: 14px 12px; border-radius: 16px; }
  .stat-value { font-size: 20px; }

  .market-feature-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
  .market-unit-box { grid-column: 1 / -1; }
  .market-search-enter { justify-content: center; }
  .market-results-head .panel-chip { width: 100%; justify-content: center; }

  .dashboard-hero-title { font-size: clamp(20px, 7vw, 26px); }
  .section-title { font-size: clamp(18px, 6vw, 24px); }

  .card { border-radius: 16px; padding: 14px; }
  .nav-item { min-height: 44px; font-size: 14px; }
  .range-values { gap: 4px; }
  .dashboard-data-box strong { font-size: 16px; }
  .dashboard-data-box { padding: 12px; border-radius: 14px; }
  .panel-chip { font-size: 10px; padding: 3px 8px; }
}

.sidebar-subscription {
  padding: 0 12px;
  margin-bottom: 8px;
}

/* ── SUBSCRIPTION BADGE (sidebar) ── */
#sub-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  cursor: pointer;
  transition: opacity .2s, transform .2s, box-shadow .2s;
  border: none;
  white-space: nowrap;
}
#sub-badge:hover {
  opacity: .9;
  transform: translateY(-1px);
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

.badge--loading {
  background: var(--line);
  color: var(--muted-2);
  animation: pulse-badge 1.6s ease-in-out infinite;
}
@keyframes pulse-badge {
  0%, 100% { opacity: .6; }
  50% { opacity: 1; }
}

.badge--pro {
  background: linear-gradient(135deg, oklch(67% 0.135 215 / 0.12), oklch(72% 0.160 157 / 0.10));
  border: 1px solid oklch(67% 0.135 215 / 0.18);
  color: var(--cyan);
}
.badge--pro svg {
  flex-shrink: 0;
}

.badge--free {
  background: var(--amber-soft);
  border: 1px solid oklch(65% 0.118 62 / 0.18);
  color: oklch(48% 0.12 62);
  position: relative;
  overflow: hidden;
}
.badge--free-low {
  background: var(--red-soft);
  border-color: oklch(62% 0.180 24 / 0.18);
  color: var(--red);
}
.badge--free-meter {
  position: absolute;
  bottom: 2px;
  left: 2px;
  height: 3px;
  border-radius: 3px;
  background: currentColor;
  opacity: .3;
  max-width: calc(100% - 4px);
}

.badge--pro-tag {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--cyan-soft);
  color: var(--cyan);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  line-height: 1.3;
}

/* ── SUBSCRIPTION PAGE ── */
.sub-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(280px, 0.7fr);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 28px;
}
.sub-usage-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  background: var(--bg-panel);
  border: 1px solid var(--line-2);
  border-radius: 28px;
  padding: 24px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.8);
}
.sub-usage-icon {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sub-usage-icon--pro {
  background: linear-gradient(135deg, var(--cyan-soft), var(--green-soft));
  color: var(--cyan);
}
.sub-usage-icon--free {
  background: var(--amber-soft);
  color: oklch(50% 0.12 62);
}
.sub-usage-label {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 4px;
}
.sub-usage-value {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -.04em;
  color: var(--text);
  line-height: 1.1;
  margin-bottom: 4px;
}
.sub-usage-sub {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  line-height: 1.5;
}
.sub-usage-bar {
  margin-top: 10px;
  height: 6px;
  border-radius: 999px;
  background: oklch(14% 0.02 250 / 0.06);
  overflow: hidden;
}
.sub-usage-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--amber), oklch(60% 0.14 52));
  transition: width .3s;
}
.sub-usage-bar-fill--danger {
  background: linear-gradient(90deg, var(--red), oklch(58% 0.18 24));
}

.sub-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.sub-stat {
  background: var(--bg-panel);
  border: 1px solid var(--line-2);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.sub-stat-kicker {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 6px;
}
.sub-stat strong {
  display: block;
  font-size: 15px;
  letter-spacing: -.03em;
  color: var(--text);
}

/* Plan comparison */
.sub-compare {
  margin-bottom: 18px;
}
.sub-compare-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -.04em;
  color: var(--text);
  margin: 0 0 16px;
}
.sub-compare-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}
.sub-plan-card {
  border: 1px solid var(--line-2);
  border-radius: 28px;
  padding: 20px 24px;
  background: var(--bg-panel);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
  position: relative;
}
.sub-plan-card--featured {
  border-color: var(--cyan);
  background: linear-gradient(135deg, var(--bg-panel), oklch(67% 0.135 215 / 0.03));
  box-shadow: 0 4px 24px oklch(67% 0.135 215 / 0.10), var(--shadow);
}
.sub-plan-featured-tag {
  position: absolute;
  top: -9px;
  right: 16px;
  background: linear-gradient(135deg, var(--cyan), var(--green));
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .1em;
  padding: 4px 12px;
  border-radius: 999px;
}
.sub-plan-current-tag {
  position: absolute;
  top: 12px;
  left: 24px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--cyan-soft);
  color: var(--cyan);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  padding: 3px 10px;
  border-radius: 999px;
}
.sub-plan-card--featured .sub-plan-current-tag {
  top: 12px;
}
.sub-plan-header {
  padding-top: 12px;
}
.sub-plan-card--featured .sub-plan-header {
  padding-top: 0;
}
.sub-plan-name {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted-2);
  margin-bottom: 6px;
}
.sub-plan-price {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -.05em;
  color: var(--text);
  line-height: 1;
}
.sub-plan-trial {
  margin-top: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--cyan);
}
.sub-plan-features {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sub-plan-feature {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.sub-plan-feature--locked {
  color: var(--muted-2);
}
.sub-plan-feature-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
  background: var(--green-soft);
  color: oklch(52% 0.16 157);
}
.sub-plan-feature--locked .sub-plan-feature-icon {
  background: var(--line);
  color: var(--muted-2);
}
.sub-plan-cta {
  width: 100%;
  justify-content: center;
  margin-top: auto;
}
.btn-danger {
  width:100%;justify-content:center;margin-top:auto;
  color:var(--red);
  border:1.5px solid var(--red);
  background:oklch(50% 0.15 25 / 0.08);
  transition:all .2s;
}
.btn-danger:hover {
  color:#fff;
  background:var(--red);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* ── FOOTER ── */
.app-footer {
  text-align: center;
  padding: 24px 16px 32px;
  font-size: 13px;
  color: var(--text-secondary, #888);
  border-top: 1px solid var(--border, #2a2a2e);
  margin-top: 12px;
}
.app-footer div {
  max-width: 480px;
  margin: 0 auto;
  line-height: 1.5;
}
