/* ============================================================
   SECUREVOTE — UNIVERSAL RESPONSIVE STYLESHEET
   Mobile-first: 320px → 4K
   ============================================================ */

@keyframes slideDown {
  from { transform: translate(-50%, -100px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}
@keyframes slideUp {
  from { transform: translate(-50%, 0); opacity: 1; }
  to { transform: translate(-50%, -100px); opacity: 0; }
}

:root {
  --bg-dark: #0f172a;
  --bg-surface: #1e293b;
  --bg-surface-variant: #334155;
  --primary: #3b82f6;
  --primary-glow: rgba(59,130,246,0.4);
  --primary-soft: rgba(59,130,246,0.1);
  --accent: #f59e0b;
  --accent-soft: rgba(245,158,11,0.1);
  --success: #22c55e;
  --success-soft: rgba(34,197,94,0.1);
  --error: #ef4444;
  --text-main: #ffffff;
  --text-secondary: #cbd5e1;
  --border: #475569;
}

/* Responsive two-column grid utility */
.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}
.team-reg-grid { grid-template-columns: 2fr 1fr; }

@media (max-width: 479px) {
  .two-col-grid { grid-template-columns: 1fr; }
  .team-reg-grid { grid-template-columns: 1fr; }
}


/* ── RESET ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; font-family: 'Outfit', sans-serif; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }
html, body { width: 100%; min-height: 100%; }
body { background: #020617; color: var(--text-main); line-height: 1.6; overflow-x: hidden; }

/* Prevent ANY element from causing horizontal scroll */
.view-section, .dashboard-grid, .glass-panel, .app-header { max-width: 100vw; overflow-x: hidden; }

img { max-width: 100%; display: block; }
button { cursor: pointer; }
select, input, textarea { font-family: inherit; }

/* Role cards always have relative positioning */
.role-card { position: relative; }

/* Buttons inside cards never overflow */
.role-card .btn { white-space: normal; word-break: break-word; }


/* ── SCROLLBAR ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: rgba(15,23,42,0.5); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
* { scrollbar-width: thin; scrollbar-color: var(--border) transparent; }
.custom-scrollbar::-webkit-scrollbar { width: 4px; }
.custom-scrollbar::-webkit-scrollbar-thumb { background: var(--primary); border-radius: 10px; }

/* ── MARQUEE ───────────────────────────────────────────────── */
.marquee-container {
  background: #1e3a8a; color: white; padding: 0.5rem 0;
  overflow: hidden; white-space: nowrap; font-weight: 800;
  font-size: 0.65rem; letter-spacing: 2px; text-transform: uppercase;
  border-bottom: 1px solid rgba(255,255,255,0.1); width: 100%; position: relative; z-index: 5000;
}
.marquee-content { display: inline-block; padding-left: 100%; animation: marquee-std 20s linear infinite; }
@keyframes marquee-std { 0% { transform: translateX(0); } 100% { transform: translateX(-100%); } }

/* ── SECTION MANAGEMENT ────────────────────────────────────── */
.view-section { display: none; width: 100%; min-height: 100vh; position: relative; z-index: 10; }
.view-section.active { display: block; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.view-section.active.flex-center { display: flex; align-items: center; justify-content: center; flex-direction: column; padding: 1.5rem; }

/* ── APP HEADER ────────────────────────────────────────────── */
.app-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.75rem 1rem; background: #020617;
  border-bottom: 1px solid var(--border); z-index: 100;
  position: sticky; top: 0; width: 100%; flex-shrink: 0; flex-wrap: wrap; gap: 0.5rem;
}
.app-header .logo { font-weight: 800; font-size: 1rem; display: flex; align-items: center; gap: 0.5rem; }

/* ── GLASS PANEL ───────────────────────────────────────────── */
.glass-panel {
  background: var(--bg-surface); border: 2px solid var(--border);
  border-radius: 16px; padding: 1.25rem;
}
.p-1 { padding: 1.25rem !important; }

/* ── BUTTONS ───────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 0.5rem; padding: 0.85rem 1.5rem; border-radius: 10px;
  font-weight: 800; cursor: pointer; transition: all 0.2s; border: none;
  font-size: 0.9rem; text-transform: uppercase; letter-spacing: 1px; white-space: nowrap;
}
.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { filter: brightness(1.15); transform: translateY(-2px); }
.btn-secondary { background: #334155; color: white; border: 2px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); }
.btn-accent { background: var(--accent); color: #020617; }
.btn-sm { padding: 0.5rem 1rem !important; font-size: 0.75rem !important; }
.w-100 { width: 100%; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }

/* ── FORMS ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.25rem; }
.form-group label { font-size: 0.75rem; color: #94a3b8; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.5rem; display: block; }
.form-input { padding: 0.85rem 1rem; border-radius: 10px; background: #0f172a; border: 2px solid var(--border); color: #fff; outline: none; transition: all 0.2s; width: 100%; font-size: 0.95rem; }
.form-input:focus { border-color: var(--primary); }
select.form-input { -webkit-appearance: none; appearance: none; }
.input-with-icon { position: relative; display: flex; align-items: center; width: 100%; }
.input-with-icon .form-input { padding-right: 3rem; }
.input-toggle { position: absolute; right: 1rem; color: var(--text-secondary); cursor: pointer; display: flex; align-items: center; z-index: 5; }

/* ── STEP HEADER ───────────────────────────────────────────── */
.step-header {
  margin-bottom: 1.25rem; color: var(--primary); display: flex; align-items: center;
  gap: 0.5rem; border-bottom: 2px solid var(--primary-soft); padding-bottom: 0.75rem;
  font-size: 1rem; text-transform: uppercase; letter-spacing: 1.5px; font-weight: 900;
}

/* ── ROLE SCREEN ───────────────────────────────────────────── */
.role-card {
  position: relative; cursor: default; transition: border-color 0.3s;
  display: flex; flex-direction: column; align-items: flex-start;
}
.icon-wrap { width: 50px; height: 50px; border-radius: 14px; display: flex; align-items: center; justify-content: center; margin-bottom: 1rem; }
.icon-wrap i { width: 24px; height: 24px; }
.bg-primary-soft { background: var(--primary-soft); }
.bg-accent-soft { background: var(--accent-soft); }
.icon-primary { color: #60a5fa !important; }
.icon-accent { color: #fbbf24 !important; }
.icon-success { color: #4ade80 !important; }
.icon-error { color: #f87171 !important; }
.text-gradient { background: linear-gradient(135deg, var(--primary), var(--accent)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.text-primary { color: var(--primary) !important; }
.text-accent { color: var(--accent) !important; }
.text-error { color: var(--error) !important; }
.divider { display: flex; align-items: center; gap: 1rem; margin: 1rem 0; color: var(--text-secondary); font-size: 0.7rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; }
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.label-with-icon { display: flex; align-items: center; gap: 0.4rem; font-size: 0.75rem; color: #94a3b8; font-weight: 800; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 0.5rem; }

/* ── ORGANIZER DASHBOARD GRID ──────────────────────────────── */
.dashboard-grid {
  display: grid; grid-template-columns: 1fr;
  gap: 1.5rem; max-width: 1600px; margin: 0 auto; padding: 1rem;
}

/* Organizer-specific 3-panel layout */
.org-grid {
  display: grid; grid-template-columns: 1fr;
  gap: 1.25rem; padding: 1rem;
}
.org-right-col { display: flex; flex-direction: column; gap: 1.25rem; }

/* Tablet: 2 columns — setup panel | teams+actions panels */
@media (min-width: 768px) {
  .org-grid { grid-template-columns: 1fr 1fr; gap: 1.25rem; }
  .org-grid > .glass-panel:first-child { grid-column: 1; }
  .org-grid > div:nth-child(2) { grid-column: 2; }
  .org-grid > .org-right-col { grid-column: 1 / -1; grid-row: 2; display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
}

/* Desktop 3 columns: each panel gets its own column */
@media (min-width: 1400px) {
  .org-grid { grid-template-columns: 1.1fr 1fr 1fr; gap: 1.5rem; }
  .org-grid > .glass-panel:first-child { grid-column: 1; }
  .org-grid > div:nth-child(2) { grid-column: 2; }
  .org-grid > .org-right-col { grid-column: 3; grid-row: 1; display: flex; flex-direction: column; gap: 1.5rem; }
}

/* Organizer button text: allow wrapping on small screens */
#organizer-screen .btn { white-space: normal; text-align: center; line-height: 1.3; }


/* ── VOTER LAYOUT ──────────────────────────────────────────── */
.voter-layout {
  display: flex; flex-direction: column;
  width: 100%; position: relative; left: 0;
  background: var(--bg-surface);
}

/* ── VOTER SIDEBAR & MAIN ──────────────────────────────────── */
.voter-sidebar {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  background: var(--bg-dark); z-index: 1500; display: none;
  flex-direction: column; padding: 0 !important;
}
.voter-sidebar.active { display: flex; animation: slideInUp 0.3s ease-out; }
.voter-main { width: 100%; padding: clamp(1rem, 3vw, 3.5rem); background: #020617; overflow-y: auto; }

/* ── SIDEBAR PANELS ────────────────────────────────────────── */
.window-header {
  display: flex; align-items: center; gap: 1rem; padding: 1rem 1.5rem;
  background: #020617; border-bottom: 2px solid var(--primary);
  position: sticky; top: 0; z-index: 100;
}
.tab-window-content { padding: 1.5rem; overflow-y: auto; flex: 1; display: flex; flex-direction: column; }
.tab-content { height: 100%; display: none; flex-direction: column; }
.tab-content.active { display: flex; animation: fadeIn 0.3s ease-out; }

/* ── BALLOT CARDS ──────────────────────────────────────────── */
#ballot-teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 1rem; }
.ballot-item { background: var(--bg-surface); border: 2px solid var(--border); border-radius: 14px; padding: 1.25rem; text-align: center; transition: all 0.3s; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.ballot-item:hover { transform: translateY(-4px); border-color: var(--primary); }
.ballot-item.voted { border-color: var(--success); background: rgba(34,197,94,0.05); }
.ballot-team-info { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 0.75rem; }
.team-logo { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; background: white; padding: 3px; border: 3px solid var(--border); }
.team-name { font-weight: 900; font-size: 1rem; color: white; letter-spacing: 1px; text-transform: uppercase; }
.ballot-btn { width: 100%; padding: 0.9rem !important; font-size: 0.85rem !important; letter-spacing: 1px !important; }
.ballot-btn:disabled { opacity: 0.5; cursor: not-allowed; background: #334155 !important; border: 1px solid var(--border) !important; color: #94a3b8 !important; }

/* ── MANUAL STEPS ──────────────────────────────────────────── */
.step-num, .step-num-voter { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 900; font-size: 1rem; flex-shrink: 0; }
.step-num { background: var(--primary-soft); color: var(--primary); border: 2px solid var(--primary); }
.step-num-voter { background: var(--accent-soft); color: var(--accent); border: 2px solid var(--accent); }
.manual-step { padding: 0.75rem; border-radius: 10px; transition: background 0.3s; }
.manual-step:hover { background: rgba(255,255,255,0.02); }

/* ── BACK BUTTONS ──────────────────────────────────────────── */
.btn-back { border-radius: 50% !important; width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; color: white !important; }
.btn-nav-toggle { color: white !important; }
[data-lucide="arrow-left"], [data-lucide="menu"] { color: white !important; }

/* ── ANIMATIONS ────────────────────────────────────────────── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInUp { from { transform: translateY(100%); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bounceX { 0%,100% { transform: translate(0,-50%); } 50% { transform: translate(5px,-50%); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.spin { animation: spin 1s linear infinite; }

/* ── AMBIENT GLOW ──────────────────────────────────────────── */
.ambient-glow { position: fixed; border-radius: 50%; filter: blur(80px); opacity: 0.08; pointer-events: none; z-index: 0; }
.glow-1 { width: 400px; height: 400px; background: var(--primary); top: -100px; right: -100px; }
.glow-2 { width: 350px; height: 350px; background: var(--accent); bottom: -100px; left: -100px; }

/* ============================================================
   RESPONSIVE BREAKPOINTS — MOBILE FIRST
   ============================================================ */

/* ── PHONE: 320px–479px ─────────────────────────────────────── */
@media (max-width: 479px) {
  html { font-size: 14px; }

  .view-section.active.flex-center { padding: 1rem; }
  .app-header { padding: 0.65rem 0.75rem; }
  .app-header .logo { font-size: 0.85rem; }

  h1 { font-size: 1.6rem !important; letter-spacing: 3px !important; }
  h2 { font-size: 1.2rem !important; }
  h3 { font-size: 1rem !important; }

  .glass-panel { padding: 1rem !important; border-radius: 12px; }
  .dashboard-grid { padding: 0.75rem; gap: 1rem; }

  .btn { padding: 0.75rem 1rem !important; font-size: 0.8rem !important; gap: 0.4rem !important; }
  .btn i { width: 14px !important; height: 14px !important; }
  .step-header { font-size: 0.8rem !important; letter-spacing: 1px !important; }
  .form-input { padding: 0.75rem 0.9rem; font-size: 0.9rem; }

  /* Organizer: stack form fields */
  #organizer-screen [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
  #organizer-screen [style*="display:flex; gap:0.75rem"] { flex-direction: column !important; }
  #organizer-screen [style*="display:flex; gap:1rem"] { flex-direction: column !important; }

  /* Voter main */
  .voter-main { padding: 1rem; }
  .window-header { padding: 0.75rem 1rem; gap: 0.75rem; }
  .tab-window-content { padding: 1rem; }

  /* Ballot cards: 2 columns on phone */
  #ballot-teams { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .ballot-item { padding: 0.75rem !important; gap: 0.5rem; }
  .team-logo { width: 55px; height: 55px; }
  .team-name { font-size: 0.75rem; }
  .ballot-btn { padding: 0.65rem !important; font-size: 0.7rem !important; }

  /* Manual steps */
  .manual-step h3 { font-size: 0.95rem; }
  .manual-step p { margin-left: 0 !important; margin-top: 0.75rem; font-size: 0.85rem; }
  .step-num, .step-num-voter { width: 32px; height: 32px; font-size: 0.85rem; }

  /* Role cards */
  .role-card { padding: 1rem !important; }
  .icon-wrap { width: 42px; height: 42px; }

  /* Nav items: icons only */
  .nav-item { padding: 0.85rem 1rem; font-size: 0.75rem; gap: 0.5rem; }
}

/* Ultra-narrow (320px) */
@media (max-width: 359px) {
  .nav-item span { display: none; }
  .nav-item { justify-content: center; padding: 0.9rem !important; }
  #ballot-teams { grid-template-columns: 1fr !important; }
}

/* ── SMALL PHONE: 480px–639px ───────────────────────────────── */
@media (min-width: 480px) and (max-width: 639px) {
  html { font-size: 15px; }
  .view-section.active.flex-center { padding: 1.25rem; }
  .glass-panel { padding: 1.25rem !important; }
  .dashboard-grid { padding: 1rem; gap: 1.25rem; }
  #ballot-teams { grid-template-columns: repeat(2, 1fr); gap: 1rem; }
  .team-logo { width: 65px; height: 65px; }
  #organizer-screen [style*="grid-template-columns: 1fr 1fr"] { grid-template-columns: 1fr !important; }
}

/* ── LARGE PHONE / SMALL TABLET: 640px–767px ───────────────── */
@media (min-width: 640px) and (max-width: 767px) {
  .dashboard-grid { padding: 1.25rem; }
  #ballot-teams { grid-template-columns: repeat(3, 1fr); }
  .team-logo { width: 70px; height: 70px; }
  .voter-main { padding: 2rem; }
  .tab-window-content { padding: 2rem; }
}

/* ── TABLET: 768px–1023px ───────────────────────────────────── */
@media (min-width: 768px) and (max-width: 1023px) {
  .app-header { padding: 1rem 1.5rem; }
  .dashboard-grid { grid-template-columns: 1fr 1fr; gap: 1.5rem; padding: 1.5rem; }
  .glass-panel { padding: 1.5rem !important; }
  #ballot-teams { grid-template-columns: repeat(3, 1fr); gap: 1.25rem; }
  .team-logo { width: 80px; height: 80px; }
  .voter-main { padding: 2.5rem; }
  .tab-window-content { padding: 2.5rem; }
  .window-header { padding: 1.25rem 2rem; }
  .btn { padding: 0.9rem 1.6rem !important; }
}

/* ── LAPTOP: 1024px–1279px ──────────────────────────────────── */
@media (min-width: 1024px) and (max-width: 1279px) {
  .app-header { padding: 1rem 2.5rem; }
  .dashboard-grid { grid-template-columns: 1.2fr 1fr 1fr; gap: 2rem; padding: 2rem; }
  .glass-panel { padding: 2rem !important; }
  .voter-main { padding: 3rem; }
  .tab-window-content { padding: 3rem; }
  .window-header { padding: 1.5rem 3rem; }
  #ballot-teams { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 1.5rem; }
  .team-logo { width: 90px; height: 90px; }
  .view-section.active.flex-center { padding: 3rem 4rem; }
}

/* ── DESKTOP: 1280px–1599px ─────────────────────────────────── */
@media (min-width: 1280px) and (max-width: 1599px) {
  .app-header { padding: 1rem 3rem; }
  .dashboard-grid { grid-template-columns: 1.2fr 1fr 1fr; gap: 2.5rem; padding: 2.5rem; }
  .glass-panel { padding: 2.5rem !important; }
  .voter-main { padding: 3.5rem; }
  .tab-window-content { padding: 3.5rem; }
  .window-header { padding: 1.5rem 3.5rem; }
  #ballot-teams { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.75rem; }
  .team-logo { width: 100px; height: 100px; }
  .view-section.active.flex-center { padding: 4rem 6rem; }
}

/* ── LARGE DESKTOP / TV: 1600px+ ────────────────────────────── */
@media (min-width: 1600px) {
  html { font-size: 18px; }
  .app-header { padding: 1.25rem 4rem; }
  .dashboard-grid { grid-template-columns: 1.2fr 1fr 1fr; gap: 3rem; padding: 3rem; }
  .glass-panel { padding: 3rem !important; }
  .voter-main { padding: 4rem; }
  .tab-window-content { padding: 4rem; }
  .window-header { padding: 2rem 4rem; }
  #ballot-teams { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 2rem; }
  .team-logo { width: 110px; height: 110px; }
  .view-section.active.flex-center { padding: 5rem 8rem; }
}

/* ── LOW HEIGHT DEVICES (landscape phones) ──────────────────── */
@media (max-height: 600px) {
  .voter-layout { min-height: auto; }
  .glass-panel { padding: 1rem !important; }
  .step-header { margin-bottom: 0.75rem; padding-bottom: 0.5rem; }
  .form-group { margin-bottom: 0.75rem; }
  .voter-main { padding: 1rem; }
  .ballot-item { padding: 0.75rem !important; }
}

/* Guideline 3-col responsive grid (Image 3 style) */
.guideline-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
}
.guideline-card {
  padding: 1rem !important;
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.6;
  min-height: 80px;
  display: flex;
  align-items: center;
}
.guideline-card p { margin: 0; }
@media (max-width: 600px) {
  .guideline-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 380px) {
  .guideline-grid { grid-template-columns: 1fr; }
}

/* ── ORGANIZER CODE MODAL ───────────────────────────────────── */
#org-code-modal {
  position: fixed; inset: 0; z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.org-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(2, 6, 23, 0.85);
  backdrop-filter: blur(8px);
}
.org-modal-box {
  position: relative; z-index: 1;
  width: 100%; max-width: 420px;
  padding: 2rem !important;
  border: 1px solid rgba(59,130,246,0.4);
  box-shadow: 0 0 60px rgba(59,130,246,0.2);
}
@keyframes shake {
  0%,100% { transform: translateX(0); }
  20% { transform: translateX(-10px); }
  40% { transform: translateX(10px); }
  60% { transform: translateX(-8px); }
  80% { transform: translateX(8px); }
}


/* ── PERSONAL ASSISTANT CHAT ────────────────────────────────── */
.chat-msg {
  max-width: 90%; padding: 0.85rem 1rem; border-radius: 14px;
  font-size: 0.85rem; line-height: 1.6; animation: fadeIn 0.25s ease-out;
  word-break: break-word;
}
.chat-msg.user {
  background: var(--primary); color: white;
  border-bottom-right-radius: 4px; align-self: flex-end; margin-left: auto;
}
.chat-msg.ai {
  background: var(--bg-surface-variant); color: var(--text-main);
  border: 1px solid var(--border); border-bottom-left-radius: 4px;
}
.chat-msg strong { color: white; }
.chat-msg.user strong { color: #e0f2fe; }

/* Typing indicator */
.typing-indicator { display: flex; gap: 5px; align-items: center; padding: 0.75rem 1rem !important; }
.typing-indicator span {
  width: 8px; height: 8px; border-radius: 50%; background: var(--border);
  animation: typingBounce 1.2s infinite ease-in-out;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-6px); background: var(--primary); } }

/* Quick-action chips */
.ai-chip {
  background: var(--bg-surface-variant); color: var(--text-secondary);
  border: 1px solid var(--border); border-radius: 20px;
  padding: 0.4rem 0.85rem; font-size: 0.75rem; font-weight: 700;
  cursor: pointer; transition: all 0.2s; white-space: nowrap; font-family: inherit;
}
.ai-chip:hover { background: var(--primary-soft); color: var(--primary); border-color: var(--primary); }




/* ── BOOTH 2-COL LAYOUT ──────────────────────────────────────── */
.booth-layout {
  display: none; /* JS controls visibility via switchTab('booth') */
  grid-template-columns: 1fr 280px;
  gap: 1.25rem;
  align-items: start;
  width: 100%;
}
.booth-ballot-col { min-width: 0; }
.booth-ballot-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.25rem; flex-wrap: wrap; gap: 0.5rem;
}
.ballot-grid {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.booth-info-col {
  display: flex; flex-direction: column; gap: 0.85rem;
  position: sticky; top: 1rem;
}
.booth-info-card {
  padding: 1.25rem !important; display: flex; flex-direction: column; gap: 0;
}
.booth-info-row {
  display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.65rem 0;
}
.booth-info-divider {
  height: 1px; background: var(--border); margin: 0 0 0 2rem; opacity: 0.5;
}
.booth-info-label {
  font-size: 0.62rem; color: var(--text-secondary); font-weight: 800;
  letter-spacing: 1.5px; text-transform: uppercase; margin-bottom: 0.2rem;
}
.booth-info-value { font-weight: 900; font-size: 0.9rem; color: white; }
.booth-info-value.success { color: var(--success); }
.booth-info-value.accent { color: var(--accent); }
.booth-info-value.primary { color: var(--primary); }

/* Data Integrity Panel */
.booth-integrity-card { padding: 1.25rem !important; }
.integrity-item {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.55rem 0; border-bottom: 1px solid rgba(255,255,255,0.04);
}
.integrity-item:last-of-type { border-bottom: none; }
.integrity-label { font-size: 0.6rem; color: var(--text-secondary); font-weight: 800; letter-spacing: 1px; text-transform: uppercase; }
.integrity-value { font-weight: 900; font-size: 0.8rem; color: white; }
.integrity-value.success { color: var(--success); }
.integrity-value.primary { color: var(--primary); }
.integrity-value.accent  { color: var(--accent); }

/* Status Badge */
.status-badge {
  display: inline-flex; align-items: center; gap: 0.35rem;
  padding: 0.3rem 0.7rem; border-radius: 20px;
  font-size: 0.7rem; font-weight: 900; letter-spacing: 1.5px;
  text-transform: uppercase; flex-shrink: 0;
}
.status-badge.secure {
  background: rgba(34,197,94,0.12); color: var(--success);
  border: 1px solid rgba(34,197,94,0.35);
}
.status-badge .status-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success); animation: pulse 2s infinite; flex-shrink:0;
}

/* ── QR SCANNER ENHANCEMENT ──────────────────────────────────── */
#qr-reader {
  border: 2px dashed var(--primary) !important;
  border-radius: 16px !important;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.8);
  position: relative;
}
#qr-reader::before {
  content: "ALIGN QR CODE WITHIN FRAME";
  position: absolute; top: 0.5rem; left: 50%; transform: translateX(-50%);
  font-size: 0.65rem; font-weight: 900; letter-spacing: 1.5px;
  color: var(--primary); background: rgba(2,6,23,0.85);
  padding: 0.25rem 0.6rem; border-radius: 6px; z-index: 10; white-space: nowrap;
}
#qr-reader video { border-radius: 14px; }

/* QR Scanner corner guides */
.qr-corner {
  position: absolute; width: 28px; height: 28px;
  border-color: var(--primary); border-style: solid; z-index: 20;
}

/* Upload zone hover feedback */
label[for="qr-upload"]:hover { background: var(--primary-soft) !important; border-color: var(--primary) !important; }

/* ── DASHBOARD HUB CARDS ─────────────────────────────────────── */
.dashboard-hub {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.hub-card {
  padding: 1.5rem !important;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}
.hub-card:hover {
  transform: translateY(-5px);
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.05);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}
.hub-card i.main-icon {
  width: 32px; height: 32px;
  padding: 8px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
  color: var(--primary);
  transition: all 0.3s;
}
.hub-card:hover i.main-icon {
  background: var(--primary);
  color: white;
  transform: scale(1.1);
}
.hub-card-title {
  font-weight: 900;
  font-size: 1rem;
  letter-spacing: 1px;
  color: white;
}
.hub-card-desc {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}
.hub-card-arrow {
  position: absolute;
  bottom: 1.25rem; right: 1.25rem;
  opacity: 0;
  transform: translateX(-10px);
  transition: all 0.3s;
  color: var(--primary);
}
.hub-card:hover .hub-card-arrow {
  opacity: 1;
  transform: translateX(0);
}

/* ── VOTER NAVIGATION (REMOVED LEGACY SIDEBAR) ──────────────── */

/* ── BOTTOM NAV (Mobile Only) ────────────────────────────────── */
.voter-bottom-nav {
  display: none;
  position: fixed; bottom: 0; left: 0; right: 0;
  height: 64px; background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255,255,255,0.08);
  z-index: 900;
  padding: 0 1rem;
  justify-content: space-around; align-items: center;
}

@media (max-width: 1024px) {
  .voter-bottom-nav { display: flex; }
  .voter-main { padding-bottom: calc(64px + 2rem) !important; }
}

.bottom-nav-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  color: var(--text-secondary); cursor: pointer; transition: all 0.2s;
  flex: 1;
}
.bottom-nav-item i { width: 20px; height: 20px; transition: transform 0.2s; }
.bottom-nav-item span { font-size: 0.65rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; }
.bottom-nav-item.active { color: var(--primary); }
.bottom-nav-item.active i { transform: translateY(-2px); }

/* ── COMPREHENSIVE RESPONSIVE BREAKPOINTS ────────────────────── */

/* Phone (≤ 480px) */
@media (max-width: 480px) {
  .booth-layout { grid-template-columns: 1fr; }
  .booth-info-col { position: static; flex-direction: row; flex-wrap: wrap; }
  .booth-info-card, .booth-integrity-card { flex: 1 1 calc(50% - 0.5rem); min-width: 0; }
  .booth-voter-card { flex: 1 1 100%; }
  .ballot-grid { grid-template-columns: 1fr; gap: 0.75rem; }
  .voter-main { padding: 0.75rem !important; padding-bottom: 100px !important; }
  .window-header h2 { font-size: 0.85rem !important; }
  .guideline-grid { grid-template-columns: 1fr !important; }
}

/* Tablet (481–768px) */
@media (min-width: 481px) and (max-width: 768px) {
  .booth-layout { grid-template-columns: 1fr; }
  .booth-info-col { flex-direction: row; flex-wrap: wrap; }
  .booth-info-card, .booth-integrity-card { flex: 1 1 calc(50% - 0.5rem); min-width: 0; }
  .booth-voter-card { flex: 1 1 100%; }
  .ballot-grid { grid-template-columns: repeat(3, 1fr); }
  .guideline-grid { grid-template-columns: 1fr 1fr !important; }
  .voter-main { padding-bottom: 100px !important; }
}

/* Small laptop (769–1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .booth-layout { grid-template-columns: 1fr 240px; }
  .ballot-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
}

/* Large (1025–1440px) */
@media (min-width: 1025px) and (max-width: 1440px) {
  .booth-layout { grid-template-columns: 1fr 280px; }
  .ballot-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
}

/* 4K / Ultra-wide (≥ 1800px) */
@media (min-width: 1800px) {
  .booth-layout { grid-template-columns: 1fr 320px; max-width: 1800px; margin: 0 auto; }
  .ballot-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* ── RESULTS SCREEN ──────────────────────────────────────────── */
.results-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1rem 4rem;
  width: 100%;
}

/* Winner Hero */
.results-hero {
  text-align: center;
  padding: clamp(2rem, 6vw, 4rem) clamp(1rem, 4vw, 2rem) !important;
  border: 2px solid var(--primary);
  position: relative;
  overflow: hidden;
}
.results-hero-glow {
  position: absolute; top:-10%; left:-10%; width:120%; height:120%;
  background: radial-gradient(circle, var(--primary-soft) 0%, transparent 60%);
  z-index: 0; pointer-events: none;
}
.results-hero > * { position: relative; z-index: 1; }
.results-hero-label {
  font-size: clamp(0.75rem, 2vw, 1.1rem);
  text-transform: uppercase; letter-spacing: 4px;
  font-weight: 800; color: var(--primary); margin-bottom: 1rem;
}
.results-winner-logo {
  width: clamp(80px, 20vw, 150px);
  height: clamp(80px, 20vw, 150px);
  margin: 0.75rem auto 1.25rem;
  border-radius: 50%; overflow: hidden;
  border: 4px solid var(--accent);
  box-shadow: 0 0 30px var(--primary-glow);
}
.results-winner-name {
  font-size: clamp(1.5rem, 7vw, 3.5rem);
  line-height: 1; font-weight: 900;
}

/* Results 2-col Grid */
.results-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

/* Download Action Bar */
.results-action-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: stretch;
}
.results-action-btn {
  flex: 1 1 220px;
  min-width: 0;
  padding: 1rem 1.25rem !important;
  font-weight: 900 !important;
  font-size: clamp(0.75rem, 2vw, 0.9rem) !important;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Responsive Results */
@media (max-width: 640px) {
  .results-grid { grid-template-columns: 1fr; }
  .results-action-btn { flex: 1 1 100%; }
  .results-hero { padding: 1.5rem 1rem !important; }
  .results-winner-logo { width: 80px; height: 80px; }
}

@media (min-width: 641px) and (max-width: 900px) {
  .results-grid { grid-template-columns: 1fr; }
  .results-action-btn { flex: 1 1 calc(50% - 0.375rem); }
}


.ballot-item {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.ballot-item:hover { transform: translateY(-3px); box-shadow: 0 8px 32px rgba(59,130,246,0.2); }

@media print {
  .app-header, .dashboard-overlay, #global-overlay,
  .marquee-container, .ambient-glow { display: none !important; }
  body { background: white; color: black; }
  .glass-panel { border: 1px solid #ccc; }
}
