/* ================================================================
   Hive Earnings — modern dashboard theme
   Built with CSS variables for easy theming + dark mode
   ================================================================ */

/* ── Design tokens: light theme (default) ─────────────────────── */
:root {
  --bg:              #fbf7ed;           /* warm ivory (hint of honey) */
  --bg-surface:      #ffffff;
  --bg-elevated:     #ffffff;
  --bg-subtle:       #fdf8e8;           /* very pale honey */
  --text:            #1a1a2e;
  --text-muted:      #64748b;
  --text-dim:        #94a3b8;
  --border:          #eadfca;           /* warm beige border */
  --border-strong:   #d4c299;

  --primary:         #e31337;           /* Hive red */
  --primary-hover:   #c1102f;
  --primary-soft:    #fee2e7;
  --honey:           #f4c430;           /* honey yellow */
  --honey-hover:     #e0b420;
  --honey-soft:      #fef3c7;
  --accent:          #6366f1;           /* indigo for charts */
  --success:         #10b981;
  --warning:         #f59e0b;
  --danger:          #ef4444;

  --gradient-hive:   linear-gradient(135deg, #e31337 0%, #f4c430 100%);
  --gradient-honey:  linear-gradient(135deg, #f4c430 0%, #fbbf24 100%);

  --shadow-sm:       0 1px 2px rgba(15, 23, 42, 0.04);
  --shadow-md:       0 4px 12px rgba(15, 23, 42, 0.08);
  --shadow-lg:       0 10px 30px rgba(15, 23, 42, 0.12);

  --radius-sm:       6px;
  --radius-md:       10px;
  --radius-lg:       14px;

  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
               "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Monaco, Consolas, monospace;
}

/* ── Design tokens: dark theme ────────────────────────────────── */
[data-theme="dark"] {
  --bg:              #0c1426;
  --bg-surface:      #131b30;
  --bg-elevated:     #1a2440;
  --bg-subtle:       #1d273f;
  --text:            #e2e8f0;
  --text-muted:      #94a3b8;
  --text-dim:        #64748b;
  --border:          #253050;
  --border-strong:   #374467;

  --primary:         #ff4d6a;
  --primary-hover:   #ff6b84;
  --primary-soft:    #3b1420;
  --honey:           #fcd34d;
  --honey-hover:     #fbbf24;
  --honey-soft:      #3a2f0f;
  --accent:          #818cf8;

  --gradient-hive:   linear-gradient(135deg, #ff4d6a 0%, #fcd34d 100%);
  --gradient-honey:  linear-gradient(135deg, #fcd34d 0%, #fbbf24 100%);

  --shadow-sm:       0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md:       0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg:       0 10px 30px rgba(0, 0, 0, 0.5);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.2; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; font-weight: 600; }
h4 { font-size: .95rem; font-weight: 600; color: var(--text-muted); }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
a.btn { color: var(--text); text-decoration: none; }
a.btn:hover { text-decoration: none; }
a.btn-primary { color: white; }

.muted { color: var(--text-muted); font-size: .875rem; }
.dim   { color: var(--text-dim); font-size: .8rem; }

/* ── Layout ───────────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem;
}

/* ── Top bar ──────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 0 1.5rem;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.brand-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--gradient-hive);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: 1.2rem;
  box-shadow: var(--shadow-md);
  letter-spacing: -.5px;
}

.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text .brand-title { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.brand-text .brand-sub   { font-size: .8rem; color: var(--text-muted); }

.topbar-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}

/* ── View-another-account switcher (topbar) ─────────────────── */
.view-switch-wrap {
  position: relative;
  flex: 1 1 220px;
  max-width: 280px;
  margin: 0 .75rem;
}
.view-switch {
  width: 100%;
  padding: .5rem .85rem .5rem 2.1rem;
  border-radius: 999px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: .85rem;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.view-switch:focus {
  outline: none;
  border-color: var(--honey);
  box-shadow: 0 0 0 3px var(--honey-soft);
  background: var(--bg-surface);
}
.view-switch-icon {
  position: absolute;
  left: .7rem; top: 50%;
  transform: translateY(-50%);
  width: 15px; height: 15px;
  color: var(--text-muted);
  pointer-events: none;
}
@media (max-width: 640px) {
  .view-switch-wrap { flex: 1 1 140px; margin: 0 .4rem; max-width: none; }
  .view-switch { font-size: .8rem; padding: .4rem .7rem .4rem 1.9rem; }
}

/* ── Buttons ──────────────────────────────────────────────────── */
.btn, button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .55rem 1rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s ease;
  line-height: 1;
}
.btn:hover    { background: var(--bg-subtle); border-color: var(--border-strong); }
.btn:active   { transform: translateY(1px); }
.btn-primary  { background: var(--primary); color: white; border-color: var(--primary); box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); box-shadow: var(--shadow-md); }
.btn-honey    { background: var(--honey); color: #1a1a2e; border-color: var(--honey); font-weight: 600; }
.btn-honey:hover { background: var(--honey-hover); border-color: var(--honey-hover); }
.btn[disabled], .btn.is-loading { opacity: .6; cursor: not-allowed; }
.btn.is-loading { pointer-events: none; }
.btn .btn-spinner {
  width: 13px; height: 13px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-ghost    { background: transparent; border: none; }
.btn-ghost:hover { background: var(--bg-subtle); }
.btn-icon     { padding: .5rem; width: 38px; height: 38px; }
.btn-icon svg { width: 18px; height: 18px; display: block; flex-shrink: 0; }
.btn-sm       { padding: .35rem .7rem; font-size: .8rem; }

/* ── Form controls ────────────────────────────────────────────── */
input[type="text"], input[type="number"], select {
  padding: .55rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text);
  font-family: inherit;
  font-size: .9rem;
  transition: border-color .15s;
  min-width: 0;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

label {
  display: flex;
  flex-direction: column;
  gap: .3rem;
  font-size: .8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* ── Login card ───────────────────────────────────────────────── */
.login-card {
  max-width: 420px;
  margin: 3rem auto;
  padding: 2rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.login-card h2 { margin-bottom: .5rem; }
.login-card .muted { margin-bottom: 1.25rem; }
.login-card input { width: 100%; text-align: center; font-size: 1rem; padding: .75rem; }
.login-card button { width: 100%; margin-top: .75rem; padding: .75rem; font-size: 1rem; }

/* ── Controls bar ─────────────────────────────────────────────── */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
  align-items: flex-end;
  padding: 1rem;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.controls .grow { flex-grow: 1; }
.controls input, .controls select { width: 100%; }
.controls label { min-width: 110px; flex: 0 0 auto; }
.controls .actions { display: flex; gap: .5rem; align-items: center; margin-left: auto; }

/* ── Cards ────────────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  margin-bottom: 1.25rem;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.card-header h3 { margin: 0; }
.card-toolbar { display: flex; gap: .4rem; flex-wrap: wrap; }

/* ── KPI grid ─────────────────────────────────────────────────── */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.kpi {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.kpi::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0; height: 3px;
  background: var(--gradient-hive);
}
.kpi.highlight { border-color: var(--honey); background: linear-gradient(180deg, var(--honey-soft) 0%, var(--bg-surface) 80%); }
.kpi-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; color: var(--text-muted); margin-bottom: .4rem; font-weight: 600; }
.kpi-value { font-size: 1.6rem; font-weight: 700; color: var(--text); line-height: 1.1; }
.kpi-sub   { font-size: .8rem; color: var(--text-muted); margin-top: .3rem; }

/* ── Summary grid (inside summary card) ───────────────────────── */
.sum-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
}
.sum-item {
  padding: .75rem;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.sum-item .label {
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .3px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: .25rem;
}
.sum-item .value { font-weight: 600; font-size: .95rem; }
.sum-item .value small { color: var(--text-muted); font-weight: 400; }

/* ── Tables ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
th, td {
  text-align: left;
  padding: .6rem .75rem;
  border-bottom: 1px solid var(--border);
}
th {
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  font-size: .7rem;
  letter-spacing: .5px;
  background: var(--bg-subtle);
  position: sticky;
  top: 0;
}
tbody tr:hover { background: var(--bg-subtle); }
tbody tr:last-child td { border-bottom: none; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Badges ──────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  background: var(--bg-subtle);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.badge.warn { background: #fef3c7; color: #92400e; border-color: #fde68a; }
[data-theme="dark"] .badge.warn { background: #3b2c0f; color: #fbbf24; border-color: #5a441a; }

.cmp-up, .cmp-down, .cmp-flat {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 4px;
  vertical-align: middle;
  cursor: help;
  font-variant-numeric: tabular-nums;
}
.cmp-up   { background: #d4f4dd; color: #15803d; }
.cmp-down { background: #fde2e4; color: #b91c1c; }
.cmp-flat { background: var(--bg-subtle); color: var(--text-muted); }
[data-theme="dark"] .cmp-up   { background: #14341f; color: #4ade80; }
[data-theme="dark"] .cmp-down { background: #3d1418; color: #fb7185; }

/* ── Help tooltips ───────────────────────────────────────────── */
.help {
  display: inline-flex; align-items: center; justify-content: center;
  width: 14px; height: 14px; line-height: 1;
  border-radius: 50%;
  background: var(--border);
  color: var(--text-muted);
  font-weight: 700;
  font-size: .7rem;
  cursor: help;
  margin-left: 4px;
}
.tooltip {
  position: fixed; z-index: 9999;
  background: #1e293b; color: white;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: .75rem;
  max-width: 280px;
  box-shadow: var(--shadow-md);
  pointer-events: none;
}

/* ── Alerts / info banner ─────────────────────────────────────── */
.banner {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: .85rem;
  margin-bottom: 1rem;
}
.banner a { color: var(--primary); }

/* Verify-with-Keychain banner */
.verify-banner {
  background: linear-gradient(90deg, var(--honey-soft), var(--bg-surface));
  border: 1px solid var(--honey);
  border-left: 4px solid var(--honey);
  color: var(--text);
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.verify-banner strong { color: var(--primary); }
.verify-banner .grow { flex: 1; min-width: 180px; }

/* ── Loading ──────────────────────────────────────────────────── */
.loading {
  display: flex; align-items: center; gap: .6rem;
  padding: .75rem 1.1rem;
  background: var(--honey-soft);
  border: 1px solid var(--honey);
  border-left: 4px solid var(--honey);
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  font-size: .9rem;
  color: var(--text);
  font-weight: 500;
}
.loading .spinner { border-top-color: var(--primary); }
.spinner {
  width: 14px; height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton {
  background: linear-gradient(90deg, var(--bg-subtle) 25%, var(--border) 50%, var(--bg-subtle) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
  display: block;
}
.skeleton.line   { height: .85rem; margin: .4rem 0; }
.skeleton.line.sm { height: .7rem; width: 50%; }
.skeleton.line.lg { height: 2rem; width: 70%; }
.skeleton.block  { height: 100%; border-radius: var(--radius-sm); }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* When a card is "loading" its content shows skeletons */
.card.is-loading [data-hide-when-loading] { display: none; }
.card:not(.is-loading) [data-show-when-loading] { display: none; }
.kpi.is-loading .kpi-label,
.kpi.is-loading .kpi-value,
.kpi.is-loading .kpi-sub { visibility: hidden; position: relative; }
.kpi.is-loading::after {
  content: "";
  position: absolute;
  top: 50%; left: 1.25rem; right: 1.25rem;
  transform: translateY(-50%);
  height: 2rem;
  background: linear-gradient(90deg, var(--bg-subtle) 25%, var(--border) 50%, var(--bg-subtle) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

/* ── Chart container ──────────────────────────────────────────── */
.chart-wrap {
  position: relative;
  height: 340px;
  width: 100%;
}
.chart-wrap.sm { height: 240px; }

/* ── Tabs ─────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: .25rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  overflow-x: auto;
}
.tab {
  padding: .6rem .9rem;
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-family: inherit;
  font-size: .9rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: all .15s;
  margin-bottom: -1px;
}
.tab:hover   { color: var(--text); }
.tab.active  { color: var(--primary); border-bottom-color: var(--primary); }
.tab-panel   { display: none; }
.tab-panel.active { display: block; }

/* ── Footer ───────────────────────────────────────────────────── */
.footer {
  margin: 3rem 0 1rem;
  padding: 1.5rem 1rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  font-size: .85rem;
  color: var(--text-muted);
}
.footer a { color: var(--primary); }
.footer .cta { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }

/* ── ROI status pills ─────────────────────────────────────────── */
.roi-pill {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.roi-pill.good       { background: #d4f4dd; color: #15803d; border: 1px solid #86efac; }
.roi-pill.break_even { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.roi-pill.losing     { background: #fde2e4; color: #b91c1c; border: 1px solid #fca5a5; }
.roi-pill.unknown    { background: var(--bg-subtle); color: var(--text-muted); border: 1px solid var(--border); }
[data-theme="dark"] .roi-pill.good       { background: #14341f; color: #4ade80; border-color: #22c55e; }
[data-theme="dark"] .roi-pill.break_even { background: #3b2c0f; color: #fbbf24; border-color: #f59e0b; }
[data-theme="dark"] .roi-pill.losing     { background: #3d1418; color: #fb7185; border-color: #ef4444; }

/* Confirm-mapping link */
a.confirm-mapping {
  display: inline-block;
  padding: 1px 6px;
  border: 1px dashed var(--honey);
  border-radius: 4px;
  color: var(--honey-hover);
  font-weight: 600;
  font-size: .75rem;
  margin: 0 2px;
  text-decoration: none;
  cursor: pointer;
  transition: all .15s;
}
a.confirm-mapping:hover {
  background: var(--honey-soft);
  border-style: solid;
  text-decoration: none;
}

/* Row highlight on losing delegations */
tr.row-losing td { background: rgba(239, 68, 68, 0.06); }
tr.row-good td { background: rgba(16, 185, 129, 0.04); }

.opt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: .75rem;
  margin-bottom: 1rem;
}
.opt-stat {
  padding: .75rem;
  background: var(--bg-subtle);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  text-align: center;
}
.opt-stat .label {
  font-size: .7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .3px;
  font-weight: 600;
}
.opt-stat .value {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: .2rem;
}
.opt-stat.good .value { color: var(--success); }
.opt-stat.bad .value { color: var(--danger); }
.opt-stat.neutral .value { color: var(--text); }

.opt-tip {
  padding: .75rem 1rem;
  background: var(--honey-soft);
  border-left: 4px solid var(--honey);
  border-radius: var(--radius-sm);
  margin-top: 1rem;
  font-size: .9rem;
}

/* ── AI analysis output ──────────────────────────────────────── */
.ai-analysis {
  font-size: .9rem;
  line-height: 1.65;
  color: var(--text);
}
.ai-analysis p { margin: .4rem 0; }
.ai-analysis strong { color: var(--primary); }
.ai-analysis li {
  margin-left: 1.25rem;
  margin-bottom: .25rem;
  list-style: disc;
}

/* ── Plan badge + upgrade dialog ─────────────────────────────── */
.plan-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .3rem .75rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: .8rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  cursor: pointer;
  line-height: 1;
}
.plan-badge::before {
  content: "";
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--plan-color, var(--text-muted));
}
.plan-badge.paid { background: linear-gradient(135deg, var(--honey-soft), var(--bg-surface)); border-color: var(--honey); }

.tiers-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .75rem;
  margin-top: 1rem;
}
.tier-card {
  padding: 1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  text-align: center;
  position: relative;
  overflow: hidden;
}
.tier-card::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--tier-color, var(--primary));
}
.tier-card.current {
  border-color: var(--honey);
  background: linear-gradient(180deg, var(--honey-soft), var(--bg-surface));
}
.tier-card h4 { font-size: 1rem; margin-bottom: .25rem; }
.tier-card .tier-hp { font-size: 1.25rem; font-weight: 700; margin: .25rem 0; }
.tier-card .tier-hp small { font-weight: 400; color: var(--text-muted); font-size: .75rem; }
.tier-card ul { list-style: none; padding: 0; margin: .5rem 0; font-size: .8rem; text-align: left; }
.tier-card ul li { padding: 2px 0; color: var(--text-muted); }
.tier-card ul li::before { content: "✓ "; color: var(--success); font-weight: 700; }
.tier-card ul li.off::before { content: "– "; color: var(--text-dim); }

/* ── Embed dialog ─────────────────────────────────────────────── */
.embed-dialog {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.embed-backdrop {
  position: absolute; inset: 0;
  background: rgba(10, 20, 35, .55);
  backdrop-filter: blur(4px);
}
.embed-modal {
  position: relative;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: 1.25rem;
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
}
.embed-modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: .5rem;
}
.embed-modal textarea {
  width: 100%;
  font-family: var(--font-mono);
  font-size: .8rem;
  padding: .6rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
  color: var(--text);
  resize: vertical;
  margin-top: .5rem;
}
.embed-modal iframe {
  max-width: 100%;
  background: var(--bg-subtle);
}

/* ── Toast / copied notification ─────────────────────────────── */
.toast {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg-surface);
  padding: .6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  box-shadow: var(--shadow-lg);
  z-index: 10000;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
}
.toast.show { opacity: 1; }

/* ── Responsive ───────────────────────────────────────────────── */
@media (max-width: 768px) {
  .container { padding: .75rem; }
  h1 { font-size: 1.25rem; }
  .kpi-value { font-size: 1.35rem; }
  .controls { flex-direction: column; align-items: stretch; }
  .controls label { min-width: 0; }
  .controls .actions { margin-left: 0; width: 100%; }
  .controls .actions button { flex: 1; }
  .topbar { padding: .75rem 0 1rem; }
  .topbar-actions { gap: .25rem; }
  .btn { font-size: .85rem; }
  .chart-wrap { height: 260px; }
}

/* ── Empty state ──────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
  font-size: .9rem;
}
