/* ══════════════════════════════════════════════════
   VotoLive — Clean White Mode Design System v3
   Ispirato a design editoriali e dashboard moderne
   ══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&display=swap');

:root {
  /* Palette base (Light Theme) */
  --bg:           #f4f6f8;
  --bg-subtle:    #ffffff;
  --bg-muted:     #f8f9fa;
  --surface:      #ffffff;
  --surface2:     #f1f3f5;
  --surface3:     #e9ecef;
  --border:       #dee2e6;
  --border-muted: #e9ecef;
  --border-strong: #ced4da;

  /* Text */
  --text-primary: #212529;
  --text-secondary: #495057;
  --text-tertiary: #868e96;
  --text-accent: #111827;

  /* Brand accent — Elegant Red */
  --accent:       #d92b27;
  --accent-light: #e65c59;
  --accent-dim:   rgba(217, 43, 39, 0.08);
  --accent-glow:  rgba(217, 43, 39, 0.15);

  /* Semantic colors */
  --success:      #198754;
  --success-dim:  rgba(25, 135, 84, 0.1);
  --warning:      #ffc107;
  --warning-dim:  rgba(255, 193, 7, 0.15);
  --info:         #0d6efd;
  --info-dim:     rgba(13, 110, 253, 0.1);
  --danger:       #dc3545;
  --danger-dim:   rgba(220, 53, 69, 0.1);

  /* Layout */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.02), 0 4px 12px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 6px rgba(0,0,0,0.04), 0 10px 24px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px rgba(0,0,0,0.05), 0 20px 40px rgba(0,0,0,0.08);

  --transition: 150ms ease;
  --transition-slow: 280ms cubic-bezier(0.4, 0, 0.2, 1);
}

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

html {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  color: var(--text-primary);
  background: var(--bg);
}

body {
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ══════════════ CARD ══════════════ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-md);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-muted);
}
.card-title {
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-secondary);
}
.card-badge {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--bg-muted);
  padding: 4px 10px;
  border-radius: 99px;
  border: 1px solid var(--border);
}

/* ══════════════ LIVE BADGE ══════════════ */
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-dim);
  border: 1px solid rgba(217, 43, 39, 0.2);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 4px 12px;
  border-radius: 99px;
}
.live-dot {
  width: 8px; height: 8px;
  background: var(--accent);
  border-radius: 50%;
  animation: blink 1.5s ease-in-out infinite;
}
@keyframes blink {
  0%,100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

/* ══════════════ STATUS BADGES ══════════════ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 700;
  padding: 4px 12px; border-radius: 99px;
}
.badge-green  { background: var(--success-dim); color: var(--success); }
.badge-orange { background: var(--warning-dim); color: #b87a00; } /* Darker warning for light mode */
.badge-red    { background: var(--danger-dim); color: var(--danger); }
.badge-blue   { background: var(--info-dim); color: var(--info); }
.badge-muted  { background: var(--surface2); color: var(--text-secondary); border: 1px solid var(--border); }

/* ══════════════ VERTICAL BAR CHART (SINDACI) ══════════════ */
.vbar-container {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  height: 300px;
  padding: 20px 0 0;
  gap: 16px;
}
.vbar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  flex: 1;
  max-width: 120px;
}
.vbar-pct {
  font-size: 22px;
  font-weight: 900;
  color: var(--text-accent);
  margin-bottom: 4px;
}
.vbar-votes {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
}
.vbar-track {
  width: 48px;
  flex: 1;
  background: var(--surface2);
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border-muted);
  border-bottom: none;
}
.vbar-fill {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: height 1s cubic-bezier(0.22, 0.61, 0.36, 1);
  min-height: 4px;
}
.vbar-label {
  margin-top: 12px;
  font-size: 14px;
  font-weight: 800;
  text-align: center;
  color: var(--text-primary);
  line-height: 1.2;
  height: 40px;
}
.vbar-label.winner { color: var(--success); }

/* ══════════════ LIST COALITIONS ══════════════ */
.coal-group {
  margin-bottom: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.coal-group-header {
  background: var(--surface2);
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-muted);
}
.coal-group-title {
  font-size: 15px;
  font-weight: 900;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}
.coal-group-pct {
  font-size: 16px;
  font-weight: 900;
  color: var(--text-accent);
}
.coal-group-body {
  padding: 12px 16px;
  background: var(--surface);
}

.liste-grid {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
}
.liste-grid > .coal-group {
  flex: 1;
}

/* ══════════════ HORIZONTAL BAR CHART (LISTE) ══════════════ */
.bar-item { margin-bottom: 12px; }
.bar-item:last-child { margin-bottom: 0; }
.bar-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  gap: 12px;
}
.bar-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
}
.bar-label.below-threshold { color: var(--text-tertiary); font-weight: 500; }
.bar-right { display: flex; align-items: baseline; gap: 12px; flex-shrink: 0; }
.bar-pct { font-size: 16px; font-weight: 900; min-width: 50px; text-align: right; color: var(--text-accent); }
.bar-pct.unknown { color: var(--text-tertiary); font-size: 14px; font-weight: 500; }
.bar-votes { font-size: 12px; font-weight: 600; color: var(--text-secondary); background: var(--surface2); padding: 2px 6px; border-radius: 4px; }
.bar-track { height: 6px; background: var(--surface2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; transition: width 1s ease; }

/* ══════════════ PREFERENCES SCROLL ══════════════ */
.pref-scroll-wrapper {
  flex: 1;
  overflow-y: auto;
  position: relative;
  scrollbar-width: thin; /* allows manual scroll */
  mask-image: linear-gradient(to bottom, transparent, black 5%, black 95%, transparent);
  -webkit-mask-image: linear-gradient(to bottom, transparent, black 5%, black 95%, transparent);
}
.pref-scroll-content {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  padding: 20px 0;
}
.pref-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  break-inside: avoid;
}
.pref-card-header {
  font-size: 20px;
  font-weight: 900;
  margin-bottom: 16px;
  border-bottom: 2px solid var(--border-muted);
  padding-bottom: 12px;
  display: flex;
  justify-content: space-between;
}
.pref-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--surface2);
}
.pref-row:last-child { border-bottom: none; }
.pref-name {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  flex: 1;
}
.pref-val {
  font-size: 24px;
  font-weight: 900;
  color: var(--text-accent);
  background: var(--surface2);
  padding: 4px 12px;
  border-radius: 8px;
}

/* ══════════════ STATUS GRID (SLIDE 4) ══════════════ */
.status-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  max-width: 1600px;
  margin: 0 auto;
  align-content: center;
  height: 100%;
}
.status-card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: var(--shadow-sm);
  transition: all var(--transition);
}
.status-card.confirmed { border-color: var(--success); background: var(--success-dim); }
.status-card.partial { border-color: var(--warning); background: var(--warning-dim); }
.status-card.waiting { border-color: var(--border-strong); background: var(--surface2); opacity: 0.7; }

.status-num {
  font-size: 32px;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
}
.status-icon { font-size: 36px; }

/* ══════════════ PARLIAMENT ══════════════ */
.parliament {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 20px 0 30px;
}
.parl-seat {
  width: 24px; height: 24px;
  border-radius: var(--radius-sm);
  cursor: default;
  transition: transform 150ms, box-shadow 150ms;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.1);
}
.parl-seat:hover {
  transform: scale(1.3) translateY(-2px);
  z-index: 10;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.parl-seat.empty {
  background: var(--surface2);
  box-shadow: none;
  border: 1px dashed var(--border-strong);
}
.parl-seat.mayor-seat {
  box-shadow: inset 0 0 0 2px #fff, 0 0 0 2px var(--accent);
}

.coalition-block {
  margin-bottom: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-sm);
}
.coalition-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-muted);
  margin-bottom: 8px;
}
.coal-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.coal-name { font-size: 15px; font-weight: 800; flex: 1; color: var(--text-primary); }
.coal-seats { font-size: 20px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--text-accent); }

.list-sub {
  padding-left: 24px;
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.elected-names {
  padding-left: 24px;
  margin: 4px 0 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.elected-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--surface2);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.elected-chip.mayor-chip {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(217, 43, 39, 0.2);
  font-weight: 800;
}

/* ══════════════ TURNOUT ══════════════ */
.turnout-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  text-align: center;
}

.turnout-item {
  background: var(--surface2);
  padding: 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-muted);
}
.turnout-item.hero-item {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-sm);
  grid-column: span 2;
}
.turnout-value {
  font-size: 28px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  letter-spacing: -1px;
  line-height: 1;
  color: var(--text-primary);
}
.turnout-value.hero {
  font-size: 48px;
  font-weight: 900;
  letter-spacing: -2px;
  color: var(--accent);
}
.turnout-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-top: 8px;
}

/* ══════════════ BUTTONS ══════════════ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  transition: all var(--transition);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1;
}
.btn-primary {
  background: var(--text-accent);
  color: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
.btn-primary:hover { background: #000; transform: translateY(-1px); box-shadow: 0 4px 6px rgba(0,0,0,0.15); }
.btn-primary:active { transform: translateY(0); box-shadow: 0 1px 2px rgba(0,0,0,0.1); }
.btn-primary:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}
.btn-secondary:hover { background: var(--surface2); border-color: var(--text-tertiary); }

.btn-success { background: var(--success); color: #fff; box-shadow: 0 2px 4px rgba(25, 135, 84, 0.2); }
.btn-success:hover { background: #146c43; transform: translateY(-1px); }
.btn-danger { background: var(--danger); color: #fff; box-shadow: 0 2px 4px rgba(220, 53, 69, 0.2); }
.btn-danger:hover { background: #b02a37; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text-secondary); border-color: transparent; }
.btn-ghost:hover { color: var(--text-primary); background: var(--surface2); }

.btn-sm { padding: 6px 12px; font-size: 12px; }

/* ══════════════ FORM ══════════════ */
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}
.form-input {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: inherit;
  transition: all var(--transition);
  -webkit-appearance: none;
  outline: none;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.02);
}
.form-input:focus {
  border-color: var(--text-accent);
  box-shadow: 0 0 0 3px rgba(17, 24, 39, 0.1);
}
.form-input[type="number"] {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* ══════════════ PREFERENCES ══════════════ */
.pref-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
}
.pref-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  width: 160px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pref-track {
  flex: 1;
  height: 6px;
  background: var(--surface3);
  border-radius: 99px;
  overflow: hidden;
}
.pref-fill {
  height: 100%;
  border-radius: 99px;
  min-width: 4px;
  transition: width 0.7s ease;
}
.pref-val {
  font-size: 14px;
  font-weight: 800;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  min-width: 40px;
  text-align: right;
  background: var(--surface2);
  padding: 2px 6px;
  border-radius: 4px;
}

.list-section details summary {
  font-size: 13px;
  font-weight: 800;
  color: var(--text-primary);
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface2);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  transition: background var(--transition);
}
.list-section details summary:hover { background: var(--surface3); }
.list-section details summary::before { content: '▸ '; color: var(--text-tertiary); }
.list-section details[open] summary::before { content: '▾ '; }
.list-section details summary::-webkit-details-marker { display: none; }

/* ══════════════ TV ROTATION CONTROLS ══════════════ */
.slide-indicators {
  display: flex;
  gap: 8px;
  align-items: center;
}
.slide-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border-strong);
  cursor: pointer;
  transition: all var(--transition-slow);
}
.slide-dot.active { width: 24px; border-radius: 4px; background: var(--accent); }
.slide-dot:hover:not(.active) { background: var(--text-tertiary); }

/* ══════════════ PROGRESS ══════════════ */
.progress-row {
  display: flex;
  gap: 4px;
  margin: 0 0 20px;
}
.prog-dot {
  flex: 1;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface3);
  transition: all var(--transition-slow);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: var(--text-secondary);
  border: 1px solid transparent;
  user-select: none;
}
.prog-dot.done { background: var(--success-dim); color: var(--success); border-color: rgba(25,135,84,0.2); }
.prog-dot.active { background: var(--accent); color: #fff; box-shadow: 0 2px 4px rgba(0,0,0,0.2); }
.prog-dot:hover:not(.active) { background: var(--surface2); }

/* ══════════════ VOTE INPUT ROW (mobile) ══════════════ */
.vote-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  transition: border-color var(--transition), box-shadow var(--transition);
  box-shadow: var(--shadow-sm);
}
.vote-row:focus-within { border-color: var(--text-accent); box-shadow: 0 0 0 2px rgba(17,24,39,0.1); }
.vote-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.vote-info { flex: 1; min-width: 0; }
.vote-name { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.vote-sub { font-size: 12px; font-weight: 500; color: var(--text-secondary); margin-top: 2px; }
.vote-input {
  width: 70px;
  padding: 10px 8px;
  text-align: center;
  font-size: 18px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  background: var(--bg);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: 0; /* flat for stepper */
  font-family: inherit;
  outline: none;
  -webkit-appearance: none;
  transition: all var(--transition);
  margin: 0;
}
.vote-input:focus { border-color: var(--text-accent); box-shadow: 0 0 0 2px rgba(17,24,39,0.1); background: var(--surface); z-index: 2; position: relative; }

.stepper-wrap {
  display: flex;
  align-items: stretch;
}
.stepper-wrap input {
  border-radius: 0 !important;
  margin: 0 !important;
  border-left: 1px solid var(--border-strong);
  border-right: 1px solid var(--border-strong);
}
.stepper-wrap input:focus {
  border-color: var(--text-accent);
  z-index: 2;
}
.step-btn {
  background: var(--surface2);
  border: 1px solid var(--border-strong);
  color: var(--text-primary);
  width: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  user-select: none;
  padding: 0;
  margin: 0;
  z-index: 1;
}
.step-btn:active { background: var(--surface3); }
.step-btn.left { border-radius: var(--radius-sm) 0 0 var(--radius-sm); border-right: none; }
.step-btn.right { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; border-left: none; }

.section-divider {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--text-secondary);
  padding: 24px 0 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.section-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border-muted);
}
.section-divider .cdot {
  width: 8px; height: 8px; border-radius: 2px;
}

/* ══════════════ PREF ITEM (mobile) ══════════════ */
.pref-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: all var(--transition);
}
.pref-item:focus-within { border-color: var(--text-accent); box-shadow: 0 0 0 2px rgba(17,24,39,0.1); }
.pref-item .pname {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}
.pref-item .pinput {
  width: 70px;
  padding: 8px;
  text-align: center;
  font-size: 16px;
  font-weight: 800;
  background: var(--bg);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xs);
  font-family: inherit;
  outline: none;
  transition: all var(--transition);
}
.pref-item .pinput:focus { border-color: var(--text-accent); background: var(--surface); }
.pref-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
@media (max-width: 500px) { .pref-grid { grid-template-columns: 1fr; } }

/* ══════════════ ADMIN TABLE ══════════════ */
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}
.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-secondary);
  border-bottom: 2px solid var(--border-muted);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 10;
}
.data-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-muted);
  vertical-align: middle;
  background: var(--surface);
  transition: background var(--transition);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface2); }
.mono { font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace; letter-spacing: 1.5px; }
.code-cell { color: var(--text-accent); font-weight: 800; font-size: 15px; background: var(--surface2); padding: 4px 8px; border-radius: 4px; border: 1px solid var(--border); }
.pin-cell { color: var(--info); font-weight: 800; font-size: 15px; background: var(--info-dim); padding: 4px 8px; border-radius: 4px; border: 1px solid rgba(13,110,253,0.2); }
.pin-cell.unset { color: var(--text-tertiary); font-style: italic; font-weight: 500; background: transparent; border: none; letter-spacing: normal; font-size: 13px; padding: 0; }

/* ══════════════ SAVE STATUS ══════════════ */
.save-status {
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 99px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.save-status.saving { color: var(--warning); border-color: rgba(255, 193, 7, 0.3); }
.save-status.saved  { color: var(--success); border-color: rgba(25, 135, 84, 0.3); }
.save-status.error  { color: var(--danger); border-color: rgba(220, 53, 69, 0.3); }

/* ══════════════ WS STATUS ══════════════ */
.ws-status {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.8px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  padding: 6px 12px;
  border-radius: 99px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  text-transform: uppercase;
}
.ws-dot-icon {
  width: 8px; height: 8px;
  border-radius: 50%;
  transition: background 0.3s;
}
.ws-status.connected { color: var(--success); }
.ws-status.connected .ws-dot-icon { background: var(--success); box-shadow: 0 0 0 3px var(--success-dim); }
.ws-status.disconnected { color: var(--text-tertiary); }
.ws-status.disconnected .ws-dot-icon { background: var(--text-tertiary); }

/* ══════════════ ANIMATIONS ══════════════ */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.3s ease-out; }

/* ══════════════ UTILS ══════════════ */
.text-muted { color: var(--text-secondary); }
.text-dim   { color: var(--text-tertiary); }
.text-sm    { font-size: 13px; }
.text-xs    { font-size: 12px; }
.font-bold  { font-weight: 700; }
.font-black { font-weight: 900; }
.monospace  { font-variant-numeric: tabular-nums; }

.disclaimer {
  text-align: center;
  padding: 16px;
  font-size: 11px;
  color: var(--text-tertiary);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

a { color: var(--info); text-decoration: none; font-weight: 600; }
a:hover { text-decoration: underline; color: #0a58ca; }

/* Modal overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition);
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: all;
}
.modal-content {
  background: var(--surface);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
  transform: translateY(20px) scale(0.95);
  transition: transform var(--transition-slow);
}
.modal-overlay.active .modal-content {
  transform: translateY(0) scale(1);
}
