/* ─────────────────────────────────────────────────────────────────────
   Sorare Bot — admin panel styles
   Design: slight blue-biased neutrals, semantic colors isolated from
   accent, trading-dashboard eyebrow headings, tabular numerics.
   ───────────────────────────────────────────────────────────────────── */

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

:root {
  color-scheme: dark light;

  /* type scale */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'SF Pro Text',
               'Segoe UI', Roboto, system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, 'Menlo', 'Consolas', monospace;

  /* spacing */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;

  /* radii */
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;

  /* elevation (overridden per theme below) */
  --shadow-xs: 0 1px 2px rgba(16, 23, 36, 0.06);
  --shadow-sm: 0 1px 3px rgba(16, 23, 36, 0.08), 0 1px 2px rgba(16, 23, 36, 0.04);
  --shadow-md: 0 4px 12px rgba(16, 23, 36, 0.10), 0 2px 4px rgba(16, 23, 36, 0.06);
  --shadow-lg: 0 12px 32px rgba(16, 23, 36, 0.18), 0 4px 10px rgba(16, 23, 36, 0.08);

  /* motion */
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dur-fast: 120ms;
  --dur-base: 200ms;
}

/* ── dark palette (default; media query path) ─────────────────────── */
@media (prefers-color-scheme: dark) {
  :root {
    --bg:            #0A0D13;
    --bg-elevated:   #0E131C;
    --surface:       #121722;
    --surface-2:     #19202F;
    --surface-3:     #202839;
    --border:        #232B3C;
    --border-strong: #313A4E;
    --text:          #E8ECF4;
    --text-muted:    #9AA3B5;
    --text-dim:      #6A7389;

    --accent:        #4C8DFF;
    --accent-hover:  #679DFF;
    --accent-ink:    #FFFFFF;
    --accent-wash:   rgba(76, 141, 255, 0.14);

    --ok:            #3DDC84;
    --ok-wash:       rgba(61, 220, 132, 0.14);
    --warn:          #F5A524;
    --warn-wash:     rgba(245, 165, 36, 0.14);
    --danger:        #F26B6B;
    --danger-wash:   rgba(242, 107, 107, 0.14);

    --input-bg:      #0C1119;
    --row-hover:     #171E2C;
    --row-stripe:    #121722;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.25);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55), 0 6px 14px rgba(0, 0, 0, 0.3);
  }
}

/* ── light palette (media query path) ─────────────────────────────── */
@media (prefers-color-scheme: light) {
  :root {
    --bg:            #F4F6FA;
    --bg-elevated:   #FFFFFF;
    --surface:       #FFFFFF;
    --surface-2:     #F1F4FA;
    --surface-3:     #E8EDF5;
    --border:        #E1E6EF;
    --border-strong: #CFD6E1;
    --text:          #0F1724;
    --text-muted:    #51607A;
    --text-dim:      #7B8699;

    --accent:        #2360E6;
    --accent-hover:  #1A50C8;
    --accent-ink:    #FFFFFF;
    --accent-wash:   rgba(35, 96, 230, 0.10);

    --ok:            #0F9D58;
    --ok-wash:       rgba(15, 157, 88, 0.10);
    --warn:          #B45309;
    --warn-wash:     rgba(180, 83, 9, 0.10);
    --danger:        #D23B3B;
    --danger-wash:   rgba(210, 59, 59, 0.08);

    --input-bg:      #FFFFFF;
    --row-hover:     #EEF3FB;
    --row-stripe:    #F8FAFD;
  }
}

/* ── explicit toggles always win over media query ─────────────────── */
:root[data-theme="dark"] {
  --bg:            #0A0D13;
  --bg-elevated:   #0E131C;
  --surface:       #121722;
  --surface-2:     #19202F;
  --surface-3:     #202839;
  --border:        #232B3C;
  --border-strong: #313A4E;
  --text:          #E8ECF4;
  --text-muted:    #9AA3B5;
  --text-dim:      #6A7389;

  --accent:        #4C8DFF;
  --accent-hover:  #679DFF;
  --accent-ink:    #FFFFFF;
  --accent-wash:   rgba(76, 141, 255, 0.14);

  --ok:            #3DDC84;
  --ok-wash:       rgba(61, 220, 132, 0.14);
  --warn:          #F5A524;
  --warn-wash:     rgba(245, 165, 36, 0.14);
  --danger:        #F26B6B;
  --danger-wash:   rgba(242, 107, 107, 0.14);

  --input-bg:      #0C1119;
  --row-hover:     #171E2C;
  --row-stripe:    #121722;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.25);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.2);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4), 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55), 0 6px 14px rgba(0, 0, 0, 0.3);
}

:root[data-theme="light"] {
  --bg:            #F4F6FA;
  --bg-elevated:   #FFFFFF;
  --surface:       #FFFFFF;
  --surface-2:     #F1F4FA;
  --surface-3:     #E8EDF5;
  --border:        #E1E6EF;
  --border-strong: #CFD6E1;
  --text:          #0F1724;
  --text-muted:    #51607A;
  --text-dim:      #7B8699;

  --accent:        #2360E6;
  --accent-hover:  #1A50C8;
  --accent-ink:    #FFFFFF;
  --accent-wash:   rgba(35, 96, 230, 0.10);

  --ok:            #0F9D58;
  --ok-wash:       rgba(15, 157, 88, 0.10);
  --warn:          #B45309;
  --warn-wash:     rgba(180, 83, 9, 0.10);
  --danger:        #D23B3B;
  --danger-wash:   rgba(210, 59, 59, 0.08);

  --input-bg:      #FFFFFF;
  --row-hover:     #EEF3FB;
  --row-stripe:    #F8FAFD;

  --shadow-xs: 0 1px 1px rgba(16, 23, 36, 0.04);
  --shadow-sm: 0 1px 2px rgba(16, 23, 36, 0.06), 0 1px 1px rgba(16, 23, 36, 0.03);
  --shadow-md: 0 6px 16px rgba(16, 23, 36, 0.08), 0 2px 4px rgba(16, 23, 36, 0.04);
  --shadow-lg: 0 20px 50px rgba(16, 23, 36, 0.12), 0 6px 14px rgba(16, 23, 36, 0.06);
}

/* ── base ─────────────────────────────────────────────────────────── */
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
  font-feature-settings: 'cv11', 'ss01', 'ss03';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  transition: background var(--dur-base) var(--ease), color var(--dur-base) var(--ease);
}

::selection {
  background: var(--accent-wash);
  color: var(--text);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* ── layout ───────────────────────────────────────────────────────── */
.wrap {
  max-width: none;
  margin: 0 auto;
  padding: var(--space-6) var(--space-8) 80px;
}
@media (min-width: 1600px) { .wrap { padding: 28px 48px 80px; } }
@media (max-width: 640px)  { .wrap { padding: var(--space-4) var(--space-3) 60px; } }

.header-bar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  padding-bottom: var(--space-5);
  margin-bottom: var(--space-5);
  border-bottom: 1px solid var(--border);
}

/* ── typography ───────────────────────────────────────────────────── */
h1 {
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.015em;
  font-weight: 650;
  margin: 0 0 var(--space-2);
  text-wrap: balance;
}

/* h2 as trading-dashboard section eyebrow */
h2 {
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin: var(--space-8) 0 var(--space-3);
  display: flex;
  align-items: center;
  gap: var(--space-3);
}
h2::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, var(--border), transparent);
  min-width: 20px;
}

.subtitle {
  color: var(--text-muted);
  margin: 0;
  font-size: 13px;
}

code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-2);
  color: var(--text);
  padding: 2px 5px;
  border-radius: var(--radius-xs);
  border: 1px solid var(--border);
}

/* ── theme toggle ─────────────────────────────────────────────────── */
.theme-toggle {
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  font-family: inherit;
  transition: color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}
.theme-toggle:hover {
  color: var(--text);
  border-color: var(--border-strong);
  background: var(--surface-2);
}

/* ── stat cards ───────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, var(--accent-wash), transparent 60%);
  opacity: 0;
  transition: opacity var(--dur-base) var(--ease);
}
.stat-card:hover { border-color: var(--border-strong); }
.stat-card:hover::before { opacity: 0.5; }

.stat-label {
  color: var(--text-muted);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
}
.stat-value {
  font-size: 24px;
  font-weight: 650;
  margin-top: 6px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.stat-value.small {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--text-muted);
}

/* ── cards ────────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  box-shadow: var(--shadow-xs);
}

/* ── row ──────────────────────────────────────────────────────────── */
.row { display: flex; gap: var(--space-3); align-items: center; }

/* ── form controls ────────────────────────────────────────────────── */
input[type="text"], input[type="password"], input[type="number"], select {
  flex: 1;
  background: var(--input-bg);
  color: var(--text);
  border: 1px solid var(--border-strong);
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  min-width: 0;
  font-family: inherit;
  line-height: 1.4;
  transition: border-color var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease);
}
input::placeholder { color: var(--text-dim); }
input[type="text"]:hover,
input[type="password"]:hover,
input[type="number"]:hover,
select:hover {
  border-color: var(--text-dim);
}
input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

input[type="number"] { font-variant-numeric: tabular-nums; }

/* ── buttons ──────────────────────────────────────────────────────── */
button {
  background: var(--accent);
  color: var(--accent-ink);
  border: 1px solid var(--accent);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.3;
  white-space: nowrap;
  font-family: inherit;
  letter-spacing: 0.005em;
  transition: background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease),
              box-shadow var(--dur-fast) var(--ease);
  box-shadow: var(--shadow-xs);
}
button:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
button:active { transform: translateY(1px); box-shadow: none; }
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}
button:disabled:hover {
  background: var(--accent);
  border-color: var(--accent);
}

button.ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-strong);
  box-shadow: none;
}
button.ghost:hover {
  background: var(--surface-2);
  color: var(--text);
  border-color: var(--text-dim);
}

button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 5px 10px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  box-shadow: none;
}
button.danger:hover {
  background: var(--danger-wash);
  color: var(--danger);
  border-color: var(--danger);
}

/* ── tables ───────────────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
thead th {
  text-align: left;
  padding: 10px var(--space-3);
  color: var(--text-dim);
  font-weight: 600;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}
tbody td {
  padding: 10px var(--space-3);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--text);
  transition: background var(--dur-fast) var(--ease);
}
tbody tr:nth-child(even) td { background: var(--row-stripe); }
tbody tr:hover td { background: var(--row-hover); }
tbody tr:last-child td { border-bottom: none; }

/* numeric alignment helpers (opt-in via td.num / th.num if ever added) */
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }

.scroll {
  max-height: 440px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}
.scroll table { font-size: 13px; }
.scroll table thead th { background: var(--surface-2); }

/* scrollbars (webkit) */
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-track { background: transparent; }
.scroll::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border: 2px solid var(--surface);
  border-radius: var(--radius-md);
}
.scroll::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ── rarity pills (dot + text pattern) ────────────────────────────── */
.rarity-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: capitalize;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  line-height: 1.5;
}
.rarity-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: 0 0 auto;
}

/* rarity hues — deeper, less neon, work on dark + light */
.rarity-limited {
  color: #C89C14;
  background: rgba(200, 156, 20, 0.10);
  border-color: rgba(200, 156, 20, 0.30);
}
.rarity-rare {
  color: #E85D5D;
  background: rgba(232, 93, 93, 0.10);
  border-color: rgba(232, 93, 93, 0.30);
}
.rarity-super_rare {
  color: #B47A33;
  background: rgba(180, 122, 51, 0.12);
  border-color: rgba(180, 122, 51, 0.32);
}
.rarity-unique {
  color: var(--accent);
  background: var(--accent-wash);
  border-color: color-mix(in oklab, var(--accent) 35%, transparent);
}

:root[data-theme="light"] .rarity-limited { color: #946D08; background: rgba(200, 156, 20, 0.14); }
:root[data-theme="light"] .rarity-rare    { color: #C84343; background: rgba(232, 93, 93, 0.10); }
:root[data-theme="light"] .rarity-super_rare { color: #8C5720; background: rgba(180, 122, 51, 0.12); }

/* ── discounts ────────────────────────────────────────────────────── */
.discount-high {
  color: var(--danger);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.discount-med {
  color: var(--warn);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.discount-low {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ── utilities ────────────────────────────────────────────────────── */
.muted { color: var(--text-dim); font-size: 12px; }
.flash-ok {
  color: var(--ok);
  font-size: 12.5px;
  font-weight: 500;
  margin-left: var(--space-2);
}
.flash-err {
  color: var(--danger);
  font-size: 12.5px;
  font-weight: 500;
  margin-left: var(--space-2);
}

.empty {
  text-align: center;
  padding: 48px var(--space-4);
  color: var(--text-dim);
  font-size: 13px;
}

/* ── clickable player row ─────────────────────────────────────────── */
.player-row td:first-child {
  font-weight: 550;
  cursor: pointer;
  color: var(--text);
  position: relative;
  transition: color var(--dur-fast) var(--ease);
}
.player-row td:first-child:hover { color: var(--accent); }
.player-row td:first-child::after {
  content: '→';
  margin-left: 6px;
  color: var(--text-dim);
  opacity: 0;
  transform: translateX(-4px);
  display: inline-block;
  transition: opacity var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease),
              color var(--dur-fast) var(--ease);
}
.player-row td:first-child:hover::after {
  opacity: 1;
  transform: translateX(0);
  color: var(--accent);
}

/* ── rarity-mini chip (used in watchlist analytics) ───────────────── */
.rarity-mini {
  display: inline-flex;
  align-items: baseline;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-xs);
  padding: 1px 7px;
  margin: 1px 2px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}
.rarity-mini .n {
  color: var(--text);
  margin-left: 4px;
  font-weight: 600;
}

/* ── spinner ──────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: -2px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── digest card (hero summary strip) ─────────────────────────────── */
.digest-card {
  position: relative;
  background:
    linear-gradient(135deg, var(--accent-wash), transparent 70%),
    var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  margin-bottom: var(--space-5);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-3) var(--space-5);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.digest-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}
.digest-item {
  font-size: 13px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
}
.digest-item b {
  font-size: 20px;
  margin-right: 2px;
  color: var(--text);
  font-weight: 650;
  letter-spacing: -0.015em;
  font-variant-numeric: tabular-nums;
}
.digest-best {
  color: var(--danger);
  font-weight: 600;
}
.digest-best b { color: var(--danger); }

/* ── filter bar ───────────────────────────────────────────────────── */
.filter-bar {
  display: flex;
  gap: var(--space-3);
  align-items: center;
  flex-wrap: wrap;
  padding: var(--space-3) var(--space-4);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: var(--space-3);
}
.filter-bar label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}
.filter-bar select,
.filter-bar input {
  padding: 6px 10px;
  font-size: 12.5px;
  background: var(--input-bg);
}
.filter-bar input[type="number"] { width: 76px; }

/* ── chips ────────────────────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 11.5px;
  font-weight: 500;
  margin-right: 4px;
  cursor: pointer;
  user-select: none;
  letter-spacing: 0.01em;
  transition: color var(--dur-fast) var(--ease),
              background var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease);
}
.chip:hover {
  color: var(--text);
  border-color: var(--border-strong);
}
.chip.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

/* ── modals ───────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 14, 0.65);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: var(--space-5);
  animation: fade-in var(--dur-base) var(--ease);
}
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  max-width: 1100px;
  width: 100%;
  max-height: 85vh;
  overflow: auto;
  box-shadow: var(--shadow-lg);
  animation: modal-in 240ms var(--ease);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: var(--space-4);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border);
  gap: var(--space-4);
}
.modal-close {
  cursor: pointer;
  color: var(--text-muted);
  background: transparent;
  border: 1px solid transparent;
  box-shadow: none;
  font-size: 18px;
  line-height: 1;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: var(--radius-sm);
}
.modal-close:hover {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
}

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0)   scale(1); }
}

/* ── chart container ──────────────────────────────────────────────── */
.chart-container {
  position: relative;
  height: 340px;
  margin: var(--space-3) 0;
  padding: var(--space-3);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

/* ── search results dropdown ──────────────────────────────────────── */
.search-results {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  max-height: 280px;
  overflow-y: auto;
  box-shadow: var(--shadow-md);
}
.search-result {
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-3);
  transition: background var(--dur-fast) var(--ease);
}
.search-result:hover { background: var(--row-hover); }
.search-result:last-child { border-bottom: none; }
.search-result b { font-weight: 600; color: var(--text); }

/* ── Telegram status pill ─────────────────────────────────────────── */
.tg-status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12px;
  padding: 5px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  font-weight: 500;
}
.tg-on  { color: var(--ok); }
.tg-off { color: var(--text-muted); }

/* ── responsive ───────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
}
@media (max-width: 640px) {
  .wrap { padding: var(--space-4) var(--space-3) 60px; }
  .header-bar { flex-direction: column; align-items: stretch; gap: var(--space-3); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-2); }
  .stat-card { padding: var(--space-3) var(--space-4); }
  .stat-value { font-size: 20px; }
  thead th, tbody td { padding: 8px 8px; font-size: 12px; }
  h1 { font-size: 20px; }
  h2 { margin-top: var(--space-6); }
  .modal { padding: var(--space-4); border-radius: var(--radius-md); }
  .digest-card { padding: var(--space-3) var(--space-4); }
  .digest-item b { font-size: 17px; }
}

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