/* ============================================================
   UNIMA Elections — Mobile-first Design System
   ============================================================ */

:root {
  /* Surfaces */
  --bg:          #f6f8fc;
  --surface:     #ffffff;
  --surface-2:   #f8fafc;
  --surface-3:   #f1f5f9;
  --line:        #e4e8f0;
  --line-strong: #cbd5e1;

  /* Ink */
  --ink:         #0b1220;
  --ink-2:       #1e293b;
  --muted:       #64748b;
  --muted-2:     #94a3b8;

  /* Brand */
  --primary:        #4f46e5;
  --primary-hover:  #4338ca;
  --primary-soft:   #eef2ff;
  --primary-ring:   rgba(79, 70, 229, .18);
  --accent:         #7c3aed;

  /* Semantic */
  --success:      #10b981;
  --success-soft: #ecfdf5;
  --success-line: #a7f3d0;
  --danger:       #ef4444;
  --danger-soft:  #fef2f2;
  --danger-line:  #fecaca;
  --warning-soft: #fffbeb;

  /* Gradients */
  --grad-primary: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  --grad-success: linear-gradient(135deg, #059669 0%, #10b981 100%);

  /* Radii */
  --r-xs: 8px;
  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;

  /* Shadows */
  --sh-xs: 0 1px 2px rgba(15, 23, 42, .04);
  --sh-sm: 0 1px 2px rgba(15, 23, 42, .04), 0 2px 6px rgba(15, 23, 42, .04);
  --sh-md: 0 2px 4px rgba(15, 23, 42, .04), 0 8px 24px rgba(15, 23, 42, .06);
  --sh-lg: 0 4px 8px rgba(15, 23, 42, .05), 0 20px 48px rgba(15, 23, 42, .12);
  --sh-focus: 0 0 0 4px var(--primary-ring);

  /* Type */
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Layout */
  --header-h: 56px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.55;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  overscroll-behavior-y: none;
}

h1, h2, h3, h4 { margin: 0 0 .35em; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
h1 { font-size: 1.75rem; font-weight: 800; letter-spacing: -.03em; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
h4 { font-size: .95rem; }
p  { margin: 0 0 .75em; }

code, .mono { font-family: var(--mono); font-size: .85em; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { width: 100%; max-width: 1200px; margin-inline: auto; padding-inline: 1rem; }
.main { flex: 1; padding: 1.25rem 0 3rem; position: relative; z-index: 1; }

.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- App background ---------- */

.app-body { position: relative; overflow-x: hidden; }

.app-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.app-bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .3;
}
.app-bg-orb-1 {
  width: 380px; height: 380px;
  top: -140px; right: -120px;
  background: radial-gradient(circle, #a5b4fc 0%, transparent 70%);
}
.app-bg-orb-2 {
  width: 320px; height: 320px;
  bottom: -140px; left: -100px;
  background: radial-gradient(circle, #c4b5fd 0%, transparent 70%);
  opacity: .25;
}

/* ---------- Header (mobile-optimized) ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid rgba(228, 232, 240, .8);
  padding-top: env(safe-area-inset-top);
}

.header-inner {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem 0;
  flex-wrap: nowrap;
  min-height: var(--header-h);
}

.brand { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: inherit; flex-shrink: 0; }
.brand:hover { text-decoration: none; }

.brand-mark {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border-radius: 10px;
  background: var(--grad-primary);
  color: #fff;
  box-shadow: 0 4px 12px rgba(79, 70, 229, .28), inset 0 1px 0 rgba(255,255,255,.2);
  flex-shrink: 0;
}
.brand-mark svg { width: 18px; height: 18px; }
.brand-mark-sm { width: 30px; height: 30px; font-size: .7rem; font-weight: 800; letter-spacing: .04em; }

.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text strong { font-size: .85rem; font-weight: 700; white-space: nowrap; }
.brand-text small { color: var(--muted); font-size: .65rem; font-weight: 500; white-space: nowrap; }

/* Nav — icon-only on mobile, labels on tablet+ */
.nav {
  display: flex;
  gap: .15rem;
  margin-left: auto;
  background: var(--surface-3);
  padding: .2rem;
  border-radius: 11px;
  flex-shrink: 0;
}

.nav-link {
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 600;
  font-size: .8rem;
  color: var(--muted);
  padding: .5rem .65rem;
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  transition: background .16s, color .16s, box-shadow .16s;
  min-height: 38px;
}
.nav-link span { display: none; }
.nav-link svg { width: 18px; height: 18px; }
.nav-link:hover { background: rgba(255,255,255,.6); color: var(--ink); text-decoration: none; }
.nav-link.active { background: var(--surface); color: var(--primary); box-shadow: var(--sh-sm); }

.user-box { display: flex; align-items: center; flex-shrink: 0; }

.user-chip {
  display: flex;
  align-items: center;
  gap: .4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: .2rem;
  border-radius: 999px;
  box-shadow: var(--sh-xs);
}
.user-chip img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; }

.avatar-fallback {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--grad-primary);
  color: #fff;
  font-weight: 700;
  font-size: .72rem;
  flex-shrink: 0;
}

.user-meta { display: none; }
.user-chip .btn { display: none; }

/* ---------- Buttons (touch-friendly) ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  font-size: .9rem;
  padding: .7rem 1.1rem;
  min-height: 44px;
  border-radius: var(--r-sm);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: transform .1s, background .16s, box-shadow .16s, color .16s, border-color .16s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: none; box-shadow: var(--sh-focus); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 1px 2px rgba(15,23,42,.08), 0 6px 16px rgba(79, 70, 229, .25);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); }

.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line);
  box-shadow: var(--sh-xs);
}
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: var(--line-strong); }

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
  border-color: var(--danger-line);
}
.btn-danger:hover:not(:disabled) { background: #fee2e2; }

.btn-sm { padding: .45rem .75rem; font-size: .8rem; border-radius: var(--r-xs); min-height: 36px; }
.btn-lg { padding: .9rem 1.5rem; font-size: 1rem; border-radius: var(--r-md); min-height: 52px; }
.btn-block { width: 100%; }

/* ---------- Surfaces ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--sh-sm);
  padding: 1.1rem;
  margin-bottom: 1rem;
  position: relative;
}

.page-head { margin-bottom: 1.25rem; }
.page-head h2 { margin-bottom: .15rem; }

/* ---------- Skeleton loaders ---------- */

.skeleton-stack { display: grid; gap: 1rem; padding-top: 1rem; }
.skeleton {
  background: linear-gradient(90deg, #eef2f7 0%, #f8fafc 50%, #eef2f7 100%);
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
  border-radius: var(--r-md);
}
.skeleton-hero { height: 180px; }
.skeleton-line { height: 56px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.loader { text-align: center; color: var(--muted); padding: 3rem 0; font-size: .92rem; }

/* ---------- Landing / hero ---------- */

.hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: start;
}

.hero-content { padding-top: .25rem; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--primary);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  padding: .35rem .75rem;
  border-radius: 999px;
  margin-bottom: .9rem;
  box-shadow: var(--sh-xs);
}
.pill::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, .18);
}

.hero h1 {
  margin-bottom: .5rem;
  background: linear-gradient(180deg, #0b1220 0%, #334155 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead { font-size: .95rem; color: var(--muted); max-width: 52ch; line-height: 1.55; }

.eligibility {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1rem;
  margin: 1.1rem 0;
  box-shadow: var(--sh-xs);
}
.eligibility h4 {
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  margin-bottom: .6rem;
  font-weight: 700;
}
.eligibility ul { margin: 0; padding: 0; list-style: none; display: grid; gap: .45rem; }
.eligibility li {
  font-size: .88rem;
  display: flex;
  align-items: flex-start;
  gap: .5rem;
}
.eligibility li::before {
  content: '';
  flex: 0 0 18px; height: 18px;
  margin-top: 1px;
  background: var(--success-soft);
  border-radius: 50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2310b981' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 12px;
}

.hero .btn-lg { width: 100%; }

.hero-side { padding: 1.1rem; }
.hero-side h3 { margin-bottom: .75rem; }

.steps { list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li {
  display: flex;
  gap: .75rem;
  align-items: flex-start;
  padding: .6rem 0;
  font-size: .88rem;
  border-bottom: 1px solid var(--line);
}
.steps li:last-child { border-bottom: 0; padding-bottom: 0; }
.steps li span {
  flex: 0 0 26px;
  height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: .72rem;
  border: 1px solid rgba(79, 70, 229, .12);
}

/* ---------- Ballot ---------- */

.position-card { padding: 1.1rem; }
.position-card.answered {
  border-color: rgba(79, 70, 229, .3);
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 0 0 3px rgba(79, 70, 229, .06);
}

.position-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: .5rem; margin-bottom: .85rem; }
.position-head h3 { margin: 0; font-size: 1.05rem; }
.position-head p { margin: 0; width: 100%; font-size: .85rem; }

.candidates { display: grid; gap: .5rem; }

.candidate {
  display: flex;
  align-items: flex-start;
  gap: .8rem;
  border: 1.5px solid var(--line);
  border-radius: var(--r-md);
  padding: .9rem 1rem;
  min-height: 60px;
  cursor: pointer;
  transition: border-color .16s, background .16s, box-shadow .16s;
  position: relative;
  background: var(--surface);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}
.candidate:hover { border-color: var(--line-strong); background: #fafbff; }
.candidate:active { transform: scale(.995); }
.candidate input { position: absolute; opacity: 0; pointer-events: none; }

.candidate-body { display: flex; flex-direction: column; gap: .15rem; flex: 1; min-width: 0; }
.candidate-name { font-weight: 600; font-size: .95rem; line-height: 1.35; }
.candidate-manifesto { font-size: .82rem; color: var(--muted); line-height: 1.45; }

.tick {
  flex: 0 0 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  display: grid; place-items: center;
  margin-top: .1rem;
  transition: .16s;
  background: #fff;
}
.tick::after {
  content: '';
  width: 10px; height: 10px;
  border-radius: 50%;
  background: #fff;
  transform: scale(0);
  transition: transform .18s cubic-bezier(.34,1.5,.64,1);
}
.candidate input:checked ~ .tick { border-color: var(--primary); background: var(--primary); }
.candidate input:checked ~ .tick::after { transform: scale(1); }
.candidate:has(input:checked) {
  border-color: var(--primary);
  background: linear-gradient(180deg, #f5f3ff 0%, #fff 100%);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .08);
}
.candidate input:focus-visible ~ .tick { box-shadow: var(--sh-focus); }

/* Submit bar — sticky at bottom on mobile, respects safe area */
.submit-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 1rem;
  box-shadow: 0 -4px 20px rgba(15, 23, 42, .06), var(--sh-md);
  position: sticky;
  bottom: calc(.75rem + env(safe-area-inset-bottom));
  z-index: 10;
  margin-top: 1rem;
}
.submit-bar > div { width: 100%; }
.submit-bar p { margin: 0; }
.submit-bar strong { font-size: .98rem; }
.submit-bar .btn { width: 100%; }

/* ---------- Empty / success states ---------- */

.empty-state { text-align: center; padding: 2.25rem 1.25rem; }
.empty-state h2 { margin-bottom: .4rem; }
.empty-state p { color: var(--muted); max-width: 55ch; margin-inline: auto; font-size: .92rem; }
.big-icon { font-size: 2.5rem; margin-bottom: .4rem; line-height: 1; }

.actions { margin-top: 1.25rem; display: flex; gap: .6rem; justify-content: center; flex-wrap: wrap; }
.actions .btn { flex: 1 1 auto; }

.success-state {
  background: linear-gradient(180deg, #f0fdf9 0%, #fff 60%);
  border-color: var(--success-line);
}
.success-check svg { width: 72px; height: 72px; margin-bottom: .75rem; }
.success-check circle { stroke: var(--success); stroke-width: 2; stroke-dasharray: 166; stroke-dashoffset: 166; animation: stroke .7s cubic-bezier(.65,0,.45,1) forwards; }
.success-check path { stroke: var(--success); stroke-width: 3.5; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 48; stroke-dashoffset: 48; animation: stroke .45s cubic-bezier(.65,0,.45,1) .55s forwards; }
@keyframes stroke { to { stroke-dashoffset: 0; } }

/* ---------- Results ---------- */

.result-card { padding: 1.1rem; }
.result-list { display: grid; gap: .9rem; }
.result-row { display: grid; gap: .4rem; }
.result-top { display: flex; justify-content: space-between; align-items: baseline; gap: .75rem; font-size: .9rem; }
.result-name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.result-count { color: var(--muted); font-variant-numeric: tabular-nums; font-weight: 600; flex-shrink: 0; }
.result-count small { font-size: .8em; font-weight: 500; }

.bar { height: 10px; background: var(--surface-3); border-radius: 999px; overflow: hidden; }
.bar span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--grad-primary);
  transition: width .9s cubic-bezier(.4,0,.2,1);
}
.result-row.winner .bar span { background: var(--grad-success); }
.result-row.winner .result-name { color: var(--success); }
.crown { font-size: .9em; }

.badge {
  background: var(--primary-soft);
  color: var(--primary);
  font-size: .72rem;
  font-weight: 700;
  padding: .22rem .6rem;
  border-radius: 999px;
  border: 1px solid rgba(79,70,229,.1);
  flex-shrink: 0;
}

.tie-note {
  margin-top: 1rem;
  font-size: .84rem;
  color: #92400e;
  background: var(--warning-soft);
  border: 1px solid #fde68a;
  padding: .6rem .8rem;
  border-radius: var(--r-sm);
}

.countdown { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; margin-top: 1.5rem; }
.cd-unit {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: .7rem .4rem;
  display: grid;
  gap: .1rem;
  box-shadow: var(--sh-xs);
  text-align: center;
}
.cd-unit strong { font-size: 1.35rem; font-variant-numeric: tabular-nums; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.cd-unit span { font-size: .6rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }

/* ---------- Admin layout (mobile-first) ---------- */

.admin-body { background: var(--bg); }

.admin-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.admin-sidebar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: .75rem 1rem;
  position: sticky;
  top: 0;
  z-index: 30;
  padding-top: calc(.75rem + env(safe-area-inset-top));
  display: flex;
  flex-direction: column;
  gap: .6rem;
}

.admin-sidebar-head {
  display: flex;
  align-items: center;
  gap: .55rem;
}

.admin-nav {
  display: flex;
  gap: .25rem;
  overflow-x: auto;
  padding-bottom: .25rem;
  margin: 0 -.25rem;
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.admin-nav::-webkit-scrollbar { display: none; }

.admin-nav-item {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  padding: .55rem .8rem;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--surface-3);
  color: var(--ink-2);
  font: inherit;
  font-weight: 600;
  font-size: .8rem;
  text-align: left;
  cursor: pointer;
  transition: background .14s, color .14s, border-color .14s;
  white-space: nowrap;
  flex-shrink: 0;
  min-height: 38px;
  text-decoration: none;
}
.admin-nav-item:hover { background: var(--surface-2); text-decoration: none; }
.admin-nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
  border-color: rgba(79, 70, 229, .15);
}
.admin-nav-item svg { flex: 0 0 16px; width: 16px; height: 16px; }

.admin-nav-section { display: none; }

.admin-sidebar-foot { display: none; }

.admin-main {
  padding: 1.25rem 1rem 3rem;
  width: 100%;
  max-width: 1200px;
  margin-inline: auto;
}

.admin-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  margin-bottom: 1.25rem;
  flex-wrap: nowrap;
}

.admin-topbar h1 { font-size: 1.35rem; margin: 0; }

.admin-view { display: none; }
.admin-view.active { display: block; animation: fadeUp .25s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } }

/* ---------- Stats ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: .65rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: .85rem .9rem;
  box-shadow: var(--sh-xs);
  display: grid;
  gap: .15rem;
  position: relative;
  overflow: hidden;
  min-height: 84px;
}
.stat-card::after {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 3px; height: 100%;
  background: var(--grad-primary);
  opacity: .85;
}
.stat-card.wide { grid-column: 1 / -1; }
.stat-value { font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.stat-value.small-value { font-size: .95rem; font-weight: 700; letter-spacing: -.01em; }
.stat-label { font-size: .66rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }

/* ---------- Forms (16px font to avoid iOS zoom) ---------- */

.form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  align-items: end;
}

.field { display: grid; gap: .35rem; }
.field > span { font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.field-actions { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.field-actions .btn { flex: 1 1 auto; }

input[type="text"],
input[type="search"],
input[type="email"],
input[type="password"],
input[type="datetime-local"],
select,
textarea {
  font: inherit;
  font-size: 16px;
  padding: .7rem .85rem;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink);
  width: 100%;
  transition: border-color .14s, box-shadow .14s, background .14s;
  font-family: var(--font);
  -webkit-appearance: none;
  appearance: none;
}
input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: var(--sh-focus);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .7rem center;
  background-size: 16px;
  padding-right: 2.4rem;
}

.inline-form { display: grid; gap: .6rem; margin-bottom: 1.25rem; }
.inline-form input { flex: 1 1 200px; }
.inline-form .btn { width: 100%; }

/* ---------- Positions admin ---------- */

.positions-admin { display: grid; gap: .85rem; }
.admin-position { border: 1px solid var(--line); border-radius: var(--r-md); padding: .9rem 1rem; background: var(--surface-2); }
.admin-position-head {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin-bottom: .85rem;
}
.admin-position-head .btn { align-self: flex-start; }

.admin-candidates { list-style: none; margin: 0 0 .8rem; padding: 0; display: grid; gap: .35rem; }
.admin-candidates li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xs);
  padding: .55rem .75rem;
  font-size: .88rem;
  min-height: 44px;
}

/* ---------- Users bulk ---------- */

.bulk-details {
  margin-top: 1rem;
  border-top: 1px dashed var(--line);
  padding-top: 1rem;
}
.bulk-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: .92rem;
  margin-bottom: .6rem;
  user-select: none;
  color: var(--ink-2);
  list-style: none;
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 36px;
}
.bulk-details summary::-webkit-details-marker { display: none; }
.bulk-details summary::before {
  content: '';
  width: 0; height: 0;
  border-left: 5px solid var(--muted);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  transition: transform .16s;
}
.bulk-details[open] summary::before { transform: rotate(90deg); }
.bulk-details summary:hover { color: var(--primary); }

.bulk-details textarea {
  min-height: 160px;
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.6;
  resize: vertical;
}

.bulk-actions {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: .8rem;
  flex-wrap: wrap;
}
.bulk-actions .btn { width: 100%; }

/* ---------- Tables (scroll horizontally on mobile) ---------- */

.table-tools { display: grid; gap: .5rem; margin-bottom: 1rem; grid-template-columns: 1fr; }
.table-tools input { width: 100%; }

.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface);
}

.data-table { width: 100%; border-collapse: collapse; font-size: .84rem; min-width: 560px; }
.data-table th,
.data-table td {
  padding: .7rem .8rem;
  text-align: left;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
}
.data-table th {
  background: var(--surface-2);
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--muted);
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-table tbody tr:last-child td { border-bottom: 0; }

.data-table code {
  background: var(--surface-3);
  padding: .15rem .4rem;
  border-radius: 5px;
  font-size: .8rem;
  word-break: break-all;
}

.selection-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .2rem; }
.selection-list .pos { color: var(--muted); font-weight: 600; font-size: .85em; }

/* ---------- Admin results ---------- */

.admin-result-block { padding: .85rem 0; border-bottom: 1px dashed var(--line); }
.admin-result-block:last-child { border-bottom: 0; padding-bottom: 0; }
.admin-result-block h4 {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .95rem;
  margin-bottom: .75rem;
  flex-wrap: wrap;
}

/* ---------- Modal (bottom sheet on mobile) ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: grid;
  place-items: end center;
  z-index: 200;
  animation: fadeIn .18s ease;
  padding: 0;
}
.modal-backdrop[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } }

.modal {
  background: var(--surface);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  padding: 1.5rem 1.25rem calc(1.25rem + env(safe-area-inset-bottom));
  width: 100%;
  box-shadow: var(--sh-lg);
  animation: slideUp .28s cubic-bezier(.34,1.2,.64,1);
  border: 1px solid var(--line);
  border-bottom: 0;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;
}
@keyframes slideUp { from { transform: translateY(100%); } }

.modal-grabber {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--line-strong);
  margin: 0 auto .85rem;
}

.modal-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  display: grid; place-items: center;
  margin-bottom: .85rem;
}
.modal h3 { margin-bottom: .3rem; font-size: 1.15rem; }
.modal p { color: var(--muted); font-size: .9rem; }
.modal-actions { display: grid; gap: .5rem; margin-top: 1.25rem; grid-template-columns: 1fr 1fr; }
.modal-actions .btn { width: 100%; }

/* ---------- Toasts (full-width bottom on mobile) ---------- */

.toast-wrap {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: .75rem .75rem calc(.75rem + env(safe-area-inset-bottom));
  display: grid;
  gap: .5rem;
  z-index: 300;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: .65rem;
  background: #0b1220;
  color: #f1f5f9;
  padding: .9rem 1rem;
  border-radius: var(--r-md);
  box-shadow: var(--sh-lg);
  font-size: .88rem;
  font-weight: 500;
  width: 100%;
  max-width: 480px;
  margin-inline: auto;
  opacity: 0;
  transform: translateY(20px) scale(.98);
  transition: .3s cubic-bezier(.34,1.3,.64,1);
  pointer-events: auto;
  border: 1px solid rgba(255,255,255,.06);
}
.toast.show { opacity: 1; transform: translateY(0) scale(1); }
.toast.success { background: #064e3b; }
.toast.error { background: #7f1d1d; }
.toast-icon {
  flex: 0 0 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .15);
  display: grid; place-items: center;
  font-size: .72rem;
  font-weight: 800;
  margin-top: 1px;
}

/* ---------- Footer ---------- */

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
  padding: 1.25rem 0 calc(1.25rem + env(safe-area-inset-bottom));
  margin-top: auto;
  position: relative;
  z-index: 1;
}
.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .75rem;
}
.footer-brand { display: flex; align-items: center; gap: .6rem; }
.footer-brand strong { font-size: .85rem; display: block; }
.footer-brand p { margin: 0; font-size: .75rem; color: var(--muted); }
.footer-copy { margin: 0; font-size: .75rem; color: var(--muted); }

/* ============================================================
   Tablet (≥ 640px)
   ============================================================ */

@media (min-width: 640px) {
  .container { padding-inline: 1.5rem; }
  .main { padding: 2rem 0 3rem; }

  .nav-link { padding: .5rem .85rem; }
  .nav-link span { display: inline; }

  .user-meta { display: flex; flex-direction: column; line-height: 1.15; padding-right: .35rem; }
  .user-meta strong { font-size: .78rem; font-weight: 600; }
  .user-meta small { font-size: .68rem; color: var(--muted); }
  .user-chip { padding: .3rem .35rem .3rem .3rem; gap: .5rem; }
  .user-chip .btn { display: inline-flex; }

  .card { padding: 1.4rem; border-radius: var(--r-lg); }
  .position-card { padding: 1.3rem 1.4rem; }

  .hero { gap: 1.5rem; }
  .hero .btn-lg { width: auto; }
  .hero-side { padding: 1.4rem; }

  .stat-grid { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
  .stat-card { padding: 1rem 1.1rem; min-height: 96px; }
  .stat-value { font-size: 1.7rem; }

  .form-grid { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.1rem; }
  .field-actions .btn { flex: 0 0 auto; }

  .inline-form { display: flex; flex-wrap: wrap; gap: .6rem; }
  .inline-form input { flex: 1 1 220px; }
  .inline-form .btn { width: auto; }

  .admin-position-head {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
  }

  .bulk-actions .btn { width: auto; }

  .table-tools { display: flex; flex-wrap: wrap; gap: .6rem; }
  .table-tools input { flex: 1 1 220px; }

  .countdown { gap: .6rem; }
  .cd-unit { padding: .75rem 1rem; }
  .cd-unit strong { font-size: 1.5rem; }
  .cd-unit span { font-size: .68rem; }

  .submit-bar { flex-wrap: nowrap; padding: 1.15rem 1.35rem; }
  .submit-bar > div { width: auto; }
  .submit-bar .btn { width: auto; }

  .modal-backdrop { place-items: center; padding: 1.5rem; }
  .modal { border-radius: var(--r-lg); border-bottom: 1px solid var(--line); padding: 1.75rem; width: min(460px, 100%); }
  .modal-grabber { display: none; }
  .modal-actions { display: flex; justify-content: flex-end; gap: .6rem; }
  .modal-actions .btn { width: auto; }

  .toast-wrap { left: auto; right: 1.5rem; bottom: 1.5rem; padding: 0; width: auto; }
  .toast { width: auto; max-width: 400px; margin: 0; }

  .footer-inner { flex-direction: row; align-items: center; justify-content: space-between; }
  .footer-copy { font-size: .78rem; }
}

/* ============================================================
   Desktop (≥ 1024px) — admin gets full sidebar
   ============================================================ */

@media (min-width: 1024px) {
  .main { padding: 2.5rem 0 5rem; }

  .hero { grid-template-columns: 1.35fr .9fr; gap: 1.75rem; }
  .hero h1 { font-size: 2.75rem; }
  .lead { font-size: 1.05rem; }

  .admin-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
    min-height: 100dvh;
  }

  .admin-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    border-bottom: 0;
    border-right: 1px solid var(--line);
    padding: 1.5rem 1rem;
    overflow-y: auto;
    flex-direction: column;
    gap: 1.5rem;
    padding-top: 1.5rem;
  }

  .admin-sidebar-head { padding: 0 .5rem; margin-bottom: .5rem; }

  .admin-nav { display: grid; gap: .15rem; overflow: visible; padding: 0; margin: 0; }

  .admin-nav-item {
    border-radius: var(--r-sm);
    background: transparent;
    padding: .55rem .75rem;
    min-height: 40px;
    font-weight: 500;
  }
  .admin-nav-item:hover { background: var(--surface-2); }
  .admin-nav-item.active {
    background: var(--primary-soft);
    color: var(--primary);
    border-color: transparent;
    font-weight: 600;
  }

  .admin-nav-section {
    display: block;
    padding: .75rem .75rem .35rem;
    font-size: .66rem;
    font-weight: 700;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--muted-2);
  }

  .admin-sidebar-foot {
    display: block;
    margin-top: auto;
    padding: .75rem .5rem 0;
    border-top: 1px solid var(--line);
  }

  .admin-main { padding: 2rem 2.5rem 4rem; }
  .admin-topbar h1 { font-size: 1.65rem; }
}

/* ============================================================
   Reduced motion
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* ============================================================
   Print
   ============================================================ */

@media print {
  .site-header, .site-footer, .submit-bar, .toast-wrap, .modal-backdrop, .nav { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ddd; }
}
/* ============================================================
   Candidate photo + meta (ballot & results)
   ============================================================ */

.candidate-photo {
  flex: 0 0 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.candidate-photo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.candidate-photo-fallback {
  font-weight: 700;
  font-size: .95rem;
  color: var(--primary);
  background: var(--primary-soft);
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  letter-spacing: .03em;
}

.candidate-body { gap: .25rem !important; }

.candidate-meta {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
  font-size: .78rem;
  color: var(--muted);
  margin-top: .05rem;
}
.candidate-reg {
  font-family: var(--mono);
  font-size: .76rem;
  background: var(--surface-3);
  padding: .12rem .45rem;
  border-radius: 5px;
  letter-spacing: -.01em;
}
.candidate-sep { opacity: .5; }
.candidate-year { font-weight: 500; }

/* Larger photo on tablets/desktop */
@media (min-width: 640px) {
  .candidate-photo { flex: 0 0 68px; height: 68px; border-radius: 16px; }
  .candidate-photo-fallback { font-size: 1.05rem; }
}

/* ============================================================
   Admin candidate list
   ============================================================ */

.admin-candidate-info {
  display: flex;
  align-items: center;
  gap: .7rem;
  min-width: 0;
  flex: 1;
}
.admin-candidate-photo {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--surface-3);
  border: 1px solid var(--line);
}
.admin-candidate-photo-fallback {
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .78rem;
  color: var(--primary);
  background: var(--primary-soft);
}
.admin-candidate-text {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  min-width: 0;
}
.admin-candidate-text strong {
  font-size: .9rem;
  overflow-wrap: anywhere;
}
.admin-candidate-actions {
  display: flex;
  gap: .35rem;
  flex-shrink: 0;
}

/* ============================================================
   Candidate form (add / edit)
   ============================================================ */

.candidate-form-details {
  margin-top: .5rem;
  border-top: 1px dashed var(--line);
  padding-top: .85rem;
}
.candidate-form-details summary {
  cursor: pointer;
  font-weight: 600;
  font-size: .88rem;
  color: var(--primary);
  list-style: none;
  display: flex;
  align-items: center;
  gap: .5rem;
  min-height: 36px;
}
.candidate-form-details summary::-webkit-details-marker { display: none; }
.candidate-form-details summary::before {
  content: '+';
  display: grid;
  place-items: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 700;
  font-size: .9rem;
  line-height: 1;
  transition: transform .16s;
}
.candidate-form-details[open] summary::before { transform: rotate(45deg); }

.candidate-form {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  margin-top: 1rem;
}

.candidate-form-photo {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .5rem;
}

.candidate-photo-preview {
  width: 96px;
  height: 96px;
  border-radius: 18px;
  overflow: hidden;
  background: var(--surface-3);
  border: 2px dashed var(--line-strong);
  display: grid;
  place-items: center;
  transition: border-color .16s, background .16s;
}
.candidate-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.candidate-photo-preview .candidate-photo-fallback {
  border-radius: 0;
  font-size: .8rem;
  color: var(--muted);
  background: transparent;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.candidate-form-fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: .8rem;
}
.candidate-form-fields .field.full { grid-column: 1 / -1; }

.candidate-form-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}
.candidate-form-actions .btn { width: 100%; }

@media (min-width: 640px) {
  .candidate-form {
    grid-template-columns: 140px 1fr;
    gap: 1.25rem;
    align-items: start;
  }
  .candidate-form-fields {
    grid-template-columns: 1fr 1fr;
    gap: .85rem 1rem;
  }
  .candidate-form-photo { grid-row: 1 / 3; }
  .candidate-form-actions { justify-content: flex-end; }
  .candidate-form-actions .btn { width: auto; }
}
/* ============================================================
   Trust logos (header, footer, sidebar)
   ============================================================ */

.trust-logos {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  flex-shrink: 0;
}

.trust-logo {
  height: 30px;
  width: auto;
  max-width: 60px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}
.trust-logo-sm { height: 26px; max-width: 44px; }

/* Brand text collapses under both logos on mobile */
.brand { gap: .55rem; }
.brand-text { min-width: 0; }
.brand-text strong,
.brand-text small {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile: hide brand text, keep only logos */
@media (max-width: 479px) {
  .brand-text { display: none; }
}

/* Tablet+: brand text returns and logos grow slightly */
@media (min-width: 640px) {
  .trust-logos { gap: .55rem; }
  .trust-logo { height: 38px; max-width: 80px; }
}

/* ---------- Footer logos ---------- */

.footer-logos {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.footer-logo-item {
  display: flex;
  align-items: center;
  gap: .65rem;
}

.footer-logo-item img {
  height: 40px;
  width: auto;
  max-width: 80px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
}

.footer-logo-item span {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}
.footer-logo-item strong { font-size: .85rem; font-weight: 700; }
.footer-logo-item small { font-size: .72rem; color: var(--muted); }

@media (min-width: 640px) {
  .footer-logo-item img { height: 48px; max-width: 96px; }
  .footer-logo-item strong { font-size: .9rem; }
  .footer-logo-item small { font-size: .76rem; }
}

/* Admin sidebar logo row */
.admin-sidebar-head { align-items: center; }

@media (min-width: 1024px) {
  .admin-sidebar-head {
    flex-direction: column;
    align-items: flex-start;
    gap: .55rem;
  }
  .admin-sidebar-head .trust-logos {
    width: 100%;
    justify-content: flex-start;
  }
  .admin-sidebar-head .trust-logo {
    height: 36px;
    max-width: 72px;
  }
}
/* ============================================================
   Mobile fixes: sign-out icon + back-to-site pill
   ============================================================ */

/* --- Sign-out becomes a compact icon on mobile --- */
.user-chip .btn,
.user-chip .btn.btn-ghost,
.user-chip .btn.btn-sm {
  display: inline-flex !important;
  padding: 0;
  width: 34px;
  height: 34px;
  min-height: 34px;
  border-radius: 50%;
  align-items: center;
  justify-content: center;
}
.user-chip .btn-signout span { display: none; }
.user-chip .btn-signout svg { width: 16px; height: 16px; }

@media (min-width: 640px) {
  .user-chip .btn,
  .user-chip .btn.btn-ghost,
  .user-chip .btn.btn-sm {
    padding: .4rem .75rem;
    width: auto;
    height: auto;
    min-height: 36px;
    border-radius: var(--r-xs);
    gap: .4rem;
  }
  .user-chip .btn-signout span { display: inline; }
}

/* --- Back-to-site is now part of the nav --- */

/* Mobile: styled like the other nav pills, sits at the end of the strip */
.admin-nav-back {
  opacity: .9;
  margin-left: .35rem;
}

/* Desktop: nav becomes a vertical column and back-to-site anchors to the bottom */
@media (min-width: 1024px) {
  .admin-nav {
    display: flex;
    flex-direction: column;
    gap: .15rem;
    overflow: visible;
    padding: 0;
    margin: 0;
    flex: 1;
  }
  .admin-nav-back {
    margin-left: 0;
    margin-top: auto;
    border-top: 1px solid var(--line);
    padding-top: .85rem;
    margin-top: 1.5rem;
    border-radius: var(--r-sm);
  }
}
/* ============================================================
   Danger zone + Voted pill
   ============================================================ */

.danger-zone {
  border-color: var(--danger-line);
  background: linear-gradient(180deg, #fff 0%, #fef2f2 100%);
}
.danger-zone .position-head h3 { color: var(--danger); }

.danger-actions { display: grid; gap: .85rem; }

.danger-action {
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: .9rem 1rem;
  border: 1px solid var(--danger-line);
  border-radius: var(--r-md);
  background: #fff;
}
.danger-action strong { font-size: .92rem; }
.danger-action .btn { width: 100%; }

@media (min-width: 640px) {
  .danger-action {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 1.25rem;
  }
  .danger-action > div { flex: 1; }
  .danger-action .btn { width: auto; flex-shrink: 0; }
}

/* Small "Voted" indicator pill inside the users table */
.pill {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: .2rem .55rem;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted);
  border: 1px solid var(--line);
}
.pill-success {
  background: var(--success-soft);
  color: var(--success);
  border-color: var(--success-line);
}
/* ============================================================
   Winner card + Declaration sheet
   ============================================================ */

/* ---------- Winner card (per position) ---------- */

.winner-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: .85rem;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border: 1.5px solid #fcd34d;
  border-radius: var(--r-md);
  padding: .95rem 1rem .95rem 1.1rem;
  margin: 0 0 1rem;
  position: relative;
  overflow: hidden;
}
.winner-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0;
  width: 4px; height: 100%;
  background: linear-gradient(180deg, #f59e0b, #d97706);
}

.winner-photo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1.5px solid #fcd34d;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.winner-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.winner-photo .candidate-photo-fallback {
  background: #fef3c7;
  color: #92400e;
  font-size: 1rem;
}

.winner-trophy {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: #fff;
  border: 1.5px solid #fcd34d;
  display: grid;
  place-items: center;
  font-size: 1.6rem;
  flex-shrink: 0;
  color: #b45309;
}

.winner-body {
  display: flex;
  flex-direction: column;
  gap: .15rem;
  min-width: 0;
}

.winner-label {
  font-size: .65rem;
  font-weight: 800;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: #92400e;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
}

.winner-name {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.winner-meta {
  font-size: .78rem;
  color: #92400e;
  opacity: .85;
  display: flex;
  align-items: center;
  gap: .4rem;
  flex-wrap: wrap;
}

.winner-stats {
  grid-column: 2;
  display: flex;
  align-items: baseline;
  gap: .5rem;
  font-variant-numeric: tabular-nums;
  color: #92400e;
  padding-top: .35rem;
  border-top: 1px dashed rgba(252, 211, 77, .6);
  margin-top: .35rem;
}
.winner-stats strong {
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: -.02em;
}
.winner-stats span {
  font-size: .85rem;
  font-weight: 600;
  opacity: .85;
}

@media (min-width: 640px) {
  .winner-card {
    grid-template-columns: auto 1fr auto;
    padding: 1rem 1.25rem;
    gap: 1rem;
  }
  .winner-photo,
  .winner-trophy { width: 64px; height: 64px; border-radius: 16px; }
  .winner-trophy { font-size: 1.9rem; }
  .winner-name { font-size: 1.1rem; }
  .winner-stats {
    grid-column: 3;
    display: grid;
    grid-template-columns: 1fr;
    text-align: right;
    gap: 0;
    padding: 0;
    border: 0;
    margin: 0;
  }
  .winner-stats strong { font-size: 1.35rem; line-height: 1.1; }
  .winner-stats span { font-size: .8rem; }
}

/* No-winner variant */
.winner-card.winner-none {
  background: var(--surface-2);
  border-color: var(--line);
}
.winner-card.winner-none::before { background: var(--line-strong); }
.winner-none .winner-trophy {
  background: var(--surface-3);
  border-color: var(--line);
  color: var(--muted);
}
.winner-none .winner-label { color: var(--muted); }
.winner-none .winner-name {
  color: var(--muted);
  font-weight: 600;
  font-size: .9rem;
}

/* Tie variant */
.winner-card.winner-tie {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}
.winner-tie .winner-name {
  font-size: .95rem;
  font-weight: 600;
}
.winner-tie .winner-meta {
  font-size: .82rem;
  color: #92400e;
  opacity: 1;
  font-weight: 500;
}

/* ---------- Declaration sheet ---------- */

.declaration-card {
  background: linear-gradient(180deg, #fffbeb 0%, #fff 100%);
  border: 1.5px solid #fcd34d;
  padding: 1.25rem 1.35rem;
  margin-bottom: 1.25rem;
}

.declaration-head {
  display: flex;
  align-items: flex-start;
  gap: .75rem;
  margin-bottom: 1rem;
  padding-bottom: .9rem;
  border-bottom: 1px dashed #fcd34d;
}
.declaration-head h3 {
  margin: 0;
  font-size: 1rem;
  color: #92400e;
  font-weight: 800;
  letter-spacing: -.01em;
}

.declaration-icon {
  flex: 0 0 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  font-size: 1.2rem;
  box-shadow: 0 4px 12px rgba(245, 158, 11, .3);
}

.declaration-list {
  display: grid;
  gap: .5rem;
}

.declaration-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: .2rem;
  padding: .7rem .85rem;
  border-radius: 10px;
  background: rgba(255, 255, 255, .7);
  border: 1px solid rgba(252, 211, 77, .5);
  transition: background .14s;
}
.declaration-row:hover { background: #fff; }

@media (min-width: 640px) {
  .declaration-row {
    grid-template-columns: 200px 1fr;
    align-items: baseline;
    gap: .85rem;
  }
}

.declaration-position {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: #92400e;
}

.declaration-winner {
  display: flex;
  align-items: baseline;
  gap: .5rem;
  flex-wrap: wrap;
  font-size: .92rem;
  color: var(--ink);
}
.declaration-winner strong {
  font-weight: 700;
}
.declaration-winner .count {
  color: var(--muted);
  font-weight: 500;
  font-size: .82rem;
  font-variant-numeric: tabular-nums;
}

.declaration-empty {
  color: var(--muted);
  font-style: italic;
  font-size: .88rem;
}

/* Shared tie badge */
.tie-badge {
  display: inline-block;
  font-size: .6rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  padding: .18rem .5rem;
  border-radius: 999px;
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  vertical-align: middle;
}