/* ===================================================================
   LLAMABUZZ — STYLE.CSS
   Design system: editorial serif + mono data · ink & gold · professional
   =================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

/* ── CSS Variables ── */
:root {
  /* Ink surfaces (sidebar, dark UI) */
  --ink:            #12141a;
  --ink-2:          #1b1e26;
  --ink-3:          #262a34;
  --ink-border:     rgba(255,255,255,0.08);
  --ink-text:       #e9e9ec;
  --ink-text-dim:   #8d909c;

  /* Gold accent */
  --gold:           #b6883f;
  --gold-bright:    #dcaa63;
  --gold-deep:      #8a6428;
  --gold-tint:      #f6efe0;

  /* legacy aliases used across the file */
  --primary:        var(--gold);
  --primary-dark:   var(--gold-deep);
  --primary-soft:   var(--gold-tint);
  --primary-glow:   rgba(182,136,63,0.22);

  --bg:             #f2f1ee;
  --bg-alt:         #eae8e3;
  --card:           #ffffff;
  --border:         #e3e1da;
  --border-strong:  #cfccc2;

  --text:           #15161a;
  --text-muted:     #6c6e75;
  --text-light:     #9c9ea4;

  --success:        #1f8a5b;
  --success-bg:     #e8f4ee;
  --warning:        #a97210;
  --warning-bg:     #faf1de;
  --danger:         #b23b30;
  --danger-bg:      #fae9e7;

  --sidebar-w:      264px;
  --header-h:       66px;
  --radius:         8px;
  --radius-lg:      12px;
  --radius-xl:      16px;

  --shadow-sm:      0 1px 3px rgba(15,15,20,0.06);
  --shadow-md:      0 8px 24px rgba(15,15,20,0.09);
  --shadow-orange:  0 6px 18px -4px rgba(138,100,40,0.30);
  --shadow-card:    0 1px 2px rgba(15,15,20,0.05), 0 1px 0 rgba(15,15,20,0.03);

  --transition:     0.16s ease;
  --font-sans:      'Inter', system-ui, sans-serif;
  --font-display:   'Fraunces', Georgia, serif;
  --font-mono:      'IBM Plex Mono', ui-monospace, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { cursor: pointer; font-family: inherit; }
input, select, textarea { font-family: inherit; }
ul { list-style: none; }

/* ── Layout ── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed;
  left: 0; top: 0; bottom: 0;
  width: var(--sidebar-w);
  background: var(--ink);
  border-right: 1px solid var(--ink-border);
  display: flex;
  flex-direction: column;
  z-index: 50;
  transform: translateX(0);
  transition: transform var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}
.sidebar::-webkit-scrollbar { width: 6px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 10px; }

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 24px 20px 20px;
  border-bottom: 1px solid var(--ink-border);
}

.sidebar-brand-icon {
  width: 36px; height: 36px;
  background: var(--gold);
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.sidebar-brand-icon svg { width: 18px; height: 18px; fill: none; stroke: var(--ink); stroke-width: 2.5; }

.sidebar-brand-text { display: flex; flex-direction: column; }
.sidebar-brand-name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 17px;
  line-height: 1;
  letter-spacing: -0.2px;
  color: #fff;
}
.sidebar-brand-sub {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--gold-bright);
  margin-top: 4px;
}

.sidebar-nav { flex: 1; padding: 16px 12px; }

.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--ink-text-dim);
  padding: 0 10px;
  margin: 14px 0 8px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-text-dim);
  transition: all var(--transition);
  cursor: pointer;
  border: none;
  border-left: 2px solid transparent;
  background: none;
  width: 100%;
  text-align: left;
}

.sidebar-link svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.85; }
.sidebar-link:hover { background: var(--ink-2); color: var(--ink-text); }
.sidebar-link.active {
  background: var(--ink-2);
  color: #fff;
  font-weight: 600;
  border-left-color: var(--gold);
}
.sidebar-link.active svg { opacity: 1; stroke: var(--gold-bright); }

.sidebar-footer {
  padding: 16px 20px;
  border-top: 1px solid var(--ink-border);
}
.sidebar-footer-text {
  font-size: 11px;
  color: var(--ink-text-dim);
  text-align: center;
  letter-spacing: 0.2px;
}

/* ── Main content ── */
.main {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--header-h);
  background: rgba(242,241,238,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar-title {
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.2px;
}

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

.hamburger {
  display: none;
  background: none;
  border: none;
  width: 36px; height: 36px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  cursor: pointer;
}

.hamburger:hover { background: var(--bg-alt); }
.hamburger svg { width: 20px; height: 20px; }

.content { padding: 32px 30px; max-width: 1120px; }

/* ── Page header ── */
.page-header { margin-bottom: 28px; }
.page-title {
  font-family: var(--font-display);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.4px;
}
.page-sub { color: var(--text-muted); font-size: 14px; margin-top: 5px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all var(--transition);
  cursor: pointer;
  white-space: nowrap;
  font-family: inherit;
}

.btn svg { width: 15px; height: 15px; flex-shrink: 0; }

.btn-primary {
  background: var(--ink);
  color: var(--gold-bright);
  border-color: var(--ink);
}
.btn-primary:hover { background: var(--ink-2); color: #fff; transform: translateY(-1px); box-shadow: var(--shadow-md); }
.btn-primary:active { transform: none; }

.btn-outline {
  background: transparent;
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-outline:hover { background: var(--bg-alt); border-color: var(--ink); color: var(--ink); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-alt); color: var(--text); }

.btn-danger {
  background: var(--danger-bg);
  color: var(--danger);
  border-color: transparent;
}
.btn-danger:hover { background: var(--danger); color: #fff; }

.btn-sm { padding: 6px 13px; font-size: 13px; border-radius: 6px; }
.btn-lg { padding: 13px 26px; font-size: 15px; border-radius: 8px; }
.btn-full { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; box-shadow: none !important; }

/* ── Cards ── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-card);
}

.card-body { padding: 22px 24px; }
.card-header { padding: 17px 24px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; }
.card-header-title { font-family: var(--font-display); font-weight: 600; font-size: 17px; }

/* ── Stat cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 28px; }

.stat-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition), transform var(--transition);
}
.stat-card:hover { box-shadow: var(--shadow-md); }

.stat-card-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.stat-card-label svg { width: 15px; height: 15px; }

.stat-card-value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 25px;
  font-weight: 600;
  margin-top: 9px;
  line-height: 1.1;
}

.stat-card.primary {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.stat-card.primary .stat-card-label { color: var(--ink-text-dim); }
.stat-card.primary .stat-card-value { color: var(--gold-bright); }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
.form-label { display: block; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.form-label.required::after { content: ' *'; color: var(--danger); }

.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 10px 13px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--card);
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
  line-height: 1.5;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.form-input::placeholder { color: var(--text-light); }
.form-textarea { resize: vertical; min-height: 90px; }
.form-select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236c6e75' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 36px; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 5px; }
.form-hint { font-size: 12px; color: var(--text-muted); margin-top: 5px; }

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
}

.badge-active, .badge-validated, .badge-completed, .badge-paid {
  background: var(--success-bg);
  color: var(--success);
}
.badge-pending { background: var(--warning-bg); color: var(--warning); }
.badge-draft, .badge-rejected, .badge-cancelled { background: var(--bg-alt); color: var(--text-muted); }
.badge-suspended, .badge-failed { background: var(--danger-bg); color: var(--danger); }
.badge-approved { background: var(--gold-tint); color: var(--gold-deep); }

.badge-dot::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Tables ── */
.table-wrap { overflow-x: auto; border-radius: var(--radius-xl); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { background: var(--bg-alt); padding: 12px 16px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.7px; color: var(--text-muted); text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); vertical-align: middle; font-variant-numeric: tabular-nums; }
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background var(--transition); }
tbody tr:hover { background: var(--bg-alt); }

/* ── Candidate cards ── */
.candidates-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.candidate-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  cursor: pointer;
  animation: cardIn 0.3s ease both;
}

.candidate-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.candidate-card:hover .candidate-card-photo { transform: scale(1.03); }

.candidate-card-photo {
  width: 100%;
  aspect-ratio: 4/3;
  object-fit: cover;
  background: var(--bg-alt);
  transition: transform 0.4s ease;
}

@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.candidate-avatar-placeholder {
  width: 100%;
  aspect-ratio: 4/3;
  background: var(--ink);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 46px;
  font-weight: 600;
  color: var(--gold-bright);
}

.candidate-card-body { padding: 16px; }
.candidate-rank {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.rank-1 { color: var(--gold-deep); }
.rank-2 { color: #6b6b6b; }
.rank-3 { color: #92572c; }

.candidate-name {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
}
.candidate-pseudo { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

.candidate-votes {
  display: flex;
  align-items: baseline;
  gap: 4px;
  margin-top: 12px;
}
.candidate-votes-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 21px;
  font-weight: 600;
  color: var(--text);
}
.candidate-votes-label { font-size: 12px; color: var(--text-muted); }

.candidate-bar {
  height: 3px;
  background: var(--bg-alt);
  border-radius: 3px;
  margin-top: 10px;
  overflow: hidden;
}
.candidate-bar-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 3px;
  transition: width 0.6s ease;
}

/* ── Leaderboard ── */
.leaderboard-list { display: flex; flex-direction: column; gap: 10px; }

.lb-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: all var(--transition);
  cursor: pointer;
}

.lb-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }

.lb-rank {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
  flex-shrink: 0;
  background: var(--bg-alt);
  color: var(--text-muted);
}
.lb-rank.gold { background: linear-gradient(160deg, #e7c069, var(--gold-deep)); color: #241a08; }
.lb-rank.silver { background: linear-gradient(160deg, #d8d8d8, #a3a3a3); color: #232323; }
.lb-rank.bronze { background: linear-gradient(160deg, #d3986a, #96602f); color: #2a1a0c; }

.lb-photo {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  object-fit: cover;
  flex-shrink: 0;
}

.lb-avatar {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  background: var(--ink);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--gold-bright);
  flex-shrink: 0;
}

.lb-info { flex: 1; min-width: 0; }
.lb-name { font-weight: 600; font-size: 15px; truncate: ellipsis; white-space: nowrap; overflow: hidden; }
.lb-pct { font-size: 12px; color: var(--text-muted); margin-top: 1px; font-family: var(--font-mono); }

.lb-votes { text-align: right; flex-shrink: 0; }
.lb-votes-num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 19px; font-weight: 600; color: var(--text); }
.lb-votes-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.6px; color: var(--text-light); }

/* ── Hero section ── */
.hero {
  background: var(--ink);
  border-radius: var(--radius-xl);
  padding: 48px 44px;
  margin-bottom: 32px;
  position: relative;
  overflow: hidden;
  border: 1px solid var(--ink);
}

.hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 700px 400px at 75% 30%, #000 0%, transparent 75%);
}

.hero::after {
  content: '';
  position: absolute;
  right: -80px; top: -80px;
  width: 300px; height: 300px;
  background: radial-gradient(circle, rgba(182,136,63,0.20) 0%, transparent 70%);
  border-radius: 50%;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--ink-border);
  color: var(--gold-bright);
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 20px;
  position: relative;
  z-index: 1;
}

.hero-badge .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold-bright);
  animation: pulse 1.6s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.8); }
}

.hero-title {
  font-family: var(--font-display);
  font-size: clamp(28px, 4vw, 44px);
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.6px;
  max-width: 560px;
  position: relative;
  z-index: 1;
  color: #fff;
}

.hero-title span { color: var(--gold-bright); }
.hero-desc { color: var(--ink-text-dim); font-size: 15.5px; max-width: 480px; margin-top: 14px; position: relative; z-index: 1; }
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; position: relative; z-index: 1; }
.hero .btn-outline { border-color: var(--ink-border); color: #fff; }
.hero .btn-outline:hover { background: rgba(255,255,255,0.08); border-color: var(--gold); color: var(--gold-bright); }
.hero .btn-primary { background: var(--gold); color: var(--ink); }
.hero .btn-primary:hover { background: var(--gold-bright); color: var(--ink); }

/* ── Contest card in hero ── */
.contest-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-md);
}

.contest-title {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 600;
  margin-bottom: 4px;
}

.contest-meta { font-size: 13px; color: var(--text-muted); margin-bottom: 18px; }

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

.reward-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  text-align: center;
  transition: all var(--transition);
}

.reward-card:hover { box-shadow: var(--shadow-md); }
.reward-card.first { border-color: var(--gold); background: var(--gold-tint); }
.reward-card.second { border-color: #c3c3c3; }
.reward-card.third { border-color: #c08a5a; background: #fbf1e7; }

.reward-icon { font-size: 30px; margin-bottom: 10px; }
.reward-name { font-family: var(--font-display); font-weight: 600; font-size: 16px; }
.reward-amount { font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 22px; font-weight: 600; color: var(--gold-deep); margin-top: 8px; }
.reward-pct { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12,13,17,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }

.modal {
  background: var(--card);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(0,0,0,0.3);
  animation: slideUp 0.2s ease;
}

.modal-header {
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-title { font-family: var(--font-display); font-size: 20px; font-weight: 600; }
.modal-close {
  width: 32px; height: 32px;
  border-radius: var(--radius);
  border: none;
  background: var(--bg-alt);
  cursor: pointer;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  flex-shrink: 0;
  font-size: 18px;
  line-height: 1;
  transition: all var(--transition);
}
.modal-close:hover { background: var(--border); color: var(--text); }
.modal-body { padding: 22px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Overlay + toast ── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink-border);
  border-radius: var(--radius);
  padding: 13px 18px;
  box-shadow: var(--shadow-md);
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  pointer-events: all;
  animation: slideUp 0.2s ease;
  max-width: 340px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--danger); }
.toast.info { border-left: 3px solid var(--gold); }

/* ── Skeleton loader ── */
.skeleton {
  background: linear-gradient(90deg, var(--bg-alt) 25%, var(--border) 50%, var(--bg-alt) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: 6px;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

.skeleton-card { height: 200px; border-radius: var(--radius-xl); }
.skeleton-line { height: 16px; margin-bottom: 10px; }
.skeleton-line.short { width: 60%; }
.skeleton-line.medium { width: 80%; }

/* ── Empty state ── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  color: var(--text-muted);
}
.empty-state-icon { font-size: 38px; margin-bottom: 14px; opacity: 0.5; }
.empty-state h3 { font-family: var(--font-display); font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-state p { font-size: 14px; max-width: 320px; margin: 0 auto; }

/* ── Payment status ── */
.payment-status-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 32px;
  text-align: center;
  max-width: 440px;
  margin: 0 auto;
  box-shadow: var(--shadow-md);
}

.payment-icon {
  width: 78px; height: 78px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  font-size: 34px;
}
.payment-icon.pending { background: var(--warning-bg); }
.payment-icon.success { background: var(--success-bg); }
.payment-icon.failed { background: var(--danger-bg); }

/* ── Separator ── */
.sep { height: 1px; background: var(--border); margin: 20px 0; }

/* ── Tabs ── */
.tabs { display: flex; gap: 4px; background: var(--bg-alt); border-radius: var(--radius); padding: 4px; margin-bottom: 22px; }
.tab-btn {
  flex: 1;
  padding: 8px 14px;
  border-radius: 6px;
  border: none;
  background: none;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.tab-btn.active { background: var(--card); color: var(--text); box-shadow: var(--shadow-sm); }

/* ── Search bar ── */
.search-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 9px 14px;
  transition: border-color var(--transition);
}
.search-bar:focus-within { border-color: var(--gold); box-shadow: 0 0 0 3px var(--primary-glow); }
.search-bar svg { width: 16px; height: 16px; color: var(--text-muted); flex-shrink: 0; }
.search-input { border: none; outline: none; flex: 1; font-size: 14px; background: none; color: var(--text); }
.search-input::placeholder { color: var(--text-light); }

/* ── Vote quantity ── */
.qty-control { display: flex; align-items: center; gap: 12px; }
.qty-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--card);
  font-size: 20px;
  font-weight: 500;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all var(--transition);
  color: var(--text);
}
.qty-btn:hover { border-color: var(--gold); color: var(--gold-deep); background: var(--gold-tint); }
.qty-display { font-family: var(--font-mono); font-size: 22px; font-weight: 600; min-width: 40px; text-align: center; }

/* ── Overlay sidebar backdrop ── */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,10,14,0.5);
  z-index: 40;
}

/* ── Progress bar ── */
.progress {
  height: 7px;
  background: var(--bg-alt);
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--gold);
  border-radius: 4px;
  transition: width 0.6s ease;
}

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 24px;
}

.page-btn {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-mono);
  cursor: pointer;
  transition: all var(--transition);
  display: grid;
  place-items: center;
}
.page-btn:hover { border-color: var(--gold); color: var(--gold-deep); }
.page-btn.active { background: var(--ink); border-color: var(--ink); color: var(--gold-bright); }
.page-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Spinner ── */
.spinner {
  width: 20px; height: 20px;
  border: 2.5px solid var(--border);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── Helper utilities ── */
.flex { display: flex; }
.flex-center { display: flex; align-items: center; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-4 { gap: 4px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.text-sm { font-size: 13px; }
.text-muted { color: var(--text-muted); }
.text-primary { color: var(--gold-deep); }
.font-bold { font-weight: 700; }
.font-display { font-family: var(--font-display); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.w-full { width: 100%; }

/* ── Responsive ── */
@media (max-width: 900px) {
  :root { --sidebar-w: 0px; }

  .sidebar {
    transform: translateX(-264px);
    width: 264px;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-md);
  }

  .sidebar-overlay.visible { display: block; }

  .main { margin-left: 0; }
  .hamburger { display: flex; }
  .topbar { padding: 0 18px; }
  .content { padding: 20px 18px; }
  .hero { padding: 24px 20px; }
  .hero-title { font-size: 26px; }
  .form-grid-2 { grid-template-columns: 1fr; }
  .rewards-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 580px) {
  .candidates-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .hero-actions { flex-direction: column; }
  .modal { max-height: 85vh; }
}

@media (max-width: 380px) {
  .candidates-grid { grid-template-columns: 1fr; }
}

/* ===================================================================
   ACCOUNT WIDGET · LOGIN · ACCESSIBILITY · MICRO-INTERACTIONS
   =================================================================== */

/* ── Account widget (topbar) ── */
.account-widget { position: relative; }

.account-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  padding: 4px 10px 4px 4px;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}
.account-trigger:hover { border-color: var(--gold); box-shadow: 0 0 0 3px var(--primary-glow); }
.account-trigger svg { width: 14px; height: 14px; color: var(--text-muted); flex-shrink: 0; }
.account-name {
  font-size: 13px;
  font-weight: 600;
  max-width: 90px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 220px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
  z-index: 60;
}
.account-dropdown.open { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }

.account-dropdown-header {
  padding: 8px 10px 10px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 6px;
}

.account-dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition);
}
.account-dropdown-item svg { width: 15px; height: 15px; color: var(--text-muted); flex-shrink: 0; }
.account-dropdown-item:hover { background: var(--bg-alt); }
.account-dropdown-item.danger { color: var(--danger); }
.account-dropdown-item.danger svg { color: var(--danger); }
.account-dropdown-item.danger:hover { background: var(--danger-bg); }

/* ── Login modal / account page ── */
.login-modal-icon {
  width: 56px; height: 56px;
  background: var(--ink);
  border-radius: var(--radius-lg);
  display: grid;
  place-items: center;
  margin: 0 auto 6px;
}
.login-modal-icon svg { width: 26px; height: 26px; stroke: var(--gold-bright); }

.logged-as-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--success-bg);
  color: var(--success);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 16px;
}
.logged-as-banner svg { width: 15px; height: 15px; flex-shrink: 0; }
.logged-as-banner strong { color: var(--text); }

/* ── Stat card as link (account quick-access tiles) ── */
a.stat-card { transition: all var(--transition); }
a.stat-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); transform: translateY(-2px); }

/* ── Content fade-in on load ── */
.content { animation: contentFadeIn 0.3s ease both; }
@keyframes contentFadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ── Inline code in hints ── */
.form-hint code {
  background: var(--bg-alt);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: 11.5px;
  font-family: var(--font-mono);
}

/* ── Accessibility: visible focus rings ── */
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible, .sidebar-link:focus-visible,
.candidate-card:focus-visible, .lb-item:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}

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

/* ── Account widget responsive ── */
@media (max-width: 480px) {
  .account-name { display: none; }
  .account-trigger { padding: 4px; }
}

/* ===================================================================
   TOMBOLA
   =================================================================== */
.tombola-card { cursor: pointer; }

.tombola-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--ink);
  padding: 22px 16px;
}

.tombola-card-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.08);
  display: grid;
  place-items: center;
  color: var(--gold-bright);
}
.tombola-card-icon svg { width: 20px; height: 20px; }

.tombola-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ===================================================================
   SUPPORT / CHAT
   =================================================================== */
.support-layout {
  display: grid;
  grid-template-columns: 300px 1fr;
  gap: 18px;
  align-items: stretch;
  height: 640px;
  max-height: 75vh;
}

.support-conv-list {
  overflow-y: auto;
  padding: 8px;
}

.support-conv-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: background var(--transition);
  margin-bottom: 4px;
}
.support-conv-item:hover { background: var(--bg-alt); }
.support-conv-item.active { background: var(--gold-tint); }

.support-chat {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.support-chat-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.support-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.support-msg { display: flex; flex-direction: column; max-width: 72%; }
.support-msg.mine { align-self: flex-end; align-items: flex-end; }
.support-msg.theirs { align-self: flex-start; align-items: flex-start; }

.support-msg-bubble {
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.support-msg.mine .support-msg-bubble { background: var(--ink); color: #fff; border-bottom-right-radius: 4px; }
.support-msg.theirs .support-msg-bubble { background: var(--bg-alt); color: var(--text); border-bottom-left-radius: 4px; }

.support-msg-image {
  max-width: 220px;
  border-radius: var(--radius-lg);
  margin-bottom: 4px;
}

.support-msg-time {
  font-size: 10.5px;
  color: var(--text-light);
  margin-top: 3px;
  padding: 0 4px;
}

.support-chat-input {
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.support-chat-input .form-input { flex: 1; }

@media (max-width: 900px) {
  .support-layout { grid-template-columns: 1fr; height: auto; max-height: none; }
  .support-conv-list { max-height: 220px; }
  .support-chat { height: 480px; }
}
