/* ================================================================
   LIGHT THEME — Chatbot Prototype + Voter Portal

   🎨 2026-09-30 — SKY BLUE, taken from the Ring2Poll logo itself
   (digitalocean-backup/resources/js/assets/logo.png — the same artwork used
   for the app icon and the in-app header):

     sky blue      #0090C8   the "ring 2 poll" wordmark  -> --accent
     sky blue lt   #29A8DC   gradients / hovers
     sky blue deep #0077A6   --accent-hover
     sky tint      #F5FBFE   card / secondary surfaces
     sky tint 2    #EAF6FC   tertiary surfaces
     sky border    #D5EAF5   borders
     slate-900     #0F172B   body text      (a blue-grey, sits with sky blue)
     slate-600     #45556C   secondary text
     slate-500     #62748E   tertiary text

   ⚠️ An earlier pass used the admin's indigo `#4F39F6`; that is gone. This now
   matches the LOGO, not the admin UI.

   Contrast: white text on `#0090C8` is ~3.6:1 — fine for button labels, but use
   `#0077A6` (~4.6:1) for small text that must sit on the accent colour.

   ⚠️ The page is LIGHT. Anything white that used to sit on a dark surface
   must be a dark ink colour instead, and text on `--accent` must stay #fff.

   ⚠️ `:root` is declared TWICE in this file — the "MODERN DASHBOARD" block
   further down wins on the cascade, so keep both blocks in sync.

   Semantic colours stay semantic: amber #d97706 = points, green #16a34a =
   success, red #ef4444 = danger, and the news-category purples/pinks stay
   distinct so the categories remain tellable apart.
   ================================================================ */

:root {
  --bg-primary: #ffffff;
  --bg-secondary: #f5fbfe;
  --bg-tertiary: #eaf6fc;
  --bg-elevated: #ffffff;
  --bg-hover: #eaf6fc;
  --border: #d5eaf5;
  --border-light: #e8f4fa;

  --text-primary: #0f172b;
  --text-secondary: #45556c;
  --text-tertiary: #62748e;

  /*
    Comma-separated RGB channels, so alpha variants can be built at use site:
    `rgba(var(--ink), 0.08)`. This is what lets ~40 hairlines, hovers and
    shadows flip with the theme — a plain `#rrggbb` cannot carry an alpha.
      --ink   : the "ink" colour (borders, hairlines, subtle fills)
      --scrim : translucent bars that float over the page (header, input bar)
  */
  --ink: 15, 23, 43;
  --scrim: 255, 255, 255;

  /* Auth-hero ramp (login + staff login). */
  --hero-1: #e8f7fd;
  --hero-2: #c9e9f7;
  --hero-3: #a3daf1;
  --hero-4: #7fc9ea;

  --accent: #0090c8;
  --accent-hover: #0077a6;
  --accent-muted: rgba(0, 144, 200, 0.12);

  --user-bg: #0090c8;
  --user-bg-hover: #0077a6;
  --bot-bg: #eaf6fc;
  --bot-border: #d5eaf5;

  --green: #16a34a;
  --green-bg: rgba(22, 163, 74, 0.12);
  --red: #ef4444;
  --red-bg: rgba(220, 38, 38, 0.12);
  --amber: #d97706;
  --amber-bg: rgba(217, 119, 6, 0.12);
  --blue: #00b4e0;
  --blue-bg: rgba(0, 180, 224, 0.12);

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --sidebar-width: 280px;

  --font: "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-mono: "JetBrains Mono", "Fira Code", "Cascadia Code", monospace;
}

/* ─── Reset ─── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  width: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
}

button, input, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
}

a {
  color: var(--accent);
  text-decoration: none;
}

ul, ol {
  padding-left: 1.25rem;
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #e8f4fa; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #64748b; }

/* ─── Layout ─── */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
}

.sidebar {
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  height: 100%;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transition: transform 0.25s ease;
  z-index: 20;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
}

/* ─── Sidebar ─── */
.sidebar-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}

.btn-new-chat {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s;
}
.btn-new-chat:hover {
  border-color: var(--accent);
  background: var(--accent-muted);
}

.sidebar-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  padding: 0 10px;
  margin-bottom: 4px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.12s;
}
.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--accent-muted);
  color: var(--accent);
}

.nav-badge {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 10px;
  font-weight: 700;
  background: var(--accent-muted);
  color: var(--accent);
}
.nav-item.active .nav-badge {
  background: var(--accent);
  color: white;
}
.nav-badge.pulse-badge {
  animation: badge-pulse 2s infinite;
}
.nav-badge.hot {
  background: var(--red-bg);
  color: var(--red);
}
@keyframes badge-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(168,85,247,0.4); }
  50% { box-shadow: 0 0 0 6px rgba(168,85,247,0); }
}

/* ─── Role badge (access control) ─── */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.32rem 0.7rem;
  border-radius: 99px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  background: var(--accent-muted);
  color: var(--accent);
  border: 1px solid transparent;
  white-space: nowrap;
  margin-right: 8px;
}
.role-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 144, 200, 0.15);
}
.role-badge.lvl-leadership {
  background: rgba(217, 119, 6, 0.14);
  color: #d97706;
}
.role-badge.lvl-leadership::before { background: #d97706; box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.15); }
.role-badge.lvl-tech {
  background: rgba(220, 38, 38, 0.14);
  color: #dc2626;
}
.role-badge.lvl-tech::before { background: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.15); }
.role-badge.lvl-admin {
  background: rgba(168,85,247,0.14);
  color: #c084fc;
}
.role-badge.lvl-admin::before { background: #c084fc; box-shadow: 0 0 0 3px rgba(168,85,247,0.15); }

/* ─── Role-scoped ops nav (rendered by JS) ─── */
.ops-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 12px;
}
.ops-nav .sidebar-label {
  margin-top: 10px;
}
.ops-nav:empty {
  display: none;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 4px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-tertiary);
  font-size: 12px;
  transition: all 0.12s;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-item:hover {
  background: var(--bg-hover);
  color: var(--text-secondary);
}

.sidebar-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--border);
}
.sidebar-footer-text {
  font-size: 11px;
  color: var(--text-tertiary);
  text-align: center;
}

/* ─── Header ─── */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 52px;
  min-height: 52px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-primary);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ─── Voter portal branding (shared header look) ─── */
.brand-logo {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, #0090c8, #00b4e0);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}
.brand-logo i { width: 18px; height: 18px; }
.brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
}
.points-chip {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #d97706;
  padding: 0.25rem 0.55rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  white-space: nowrap;
}
.points-chip .pts-val { color: #d97706; }
.points-chip .pts-lbl { font-size: 0.65rem; color: var(--text-tertiary); }

/* ─── Voter portal welcome / profile card (shared) ─── */
.wc {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin: 1rem auto 0;
  max-width: 820px;
}
.wca {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: linear-gradient(135deg, #0090c8, #00b4e0);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-weight: 700;
  font-size: 1rem;
  flex-shrink: 0;
}
.wci { flex: 1; min-width: 0; }
.wci h3 { font-size: 0.95rem; font-weight: 600; margin: 0; }
.wci .ww {
  color: #0090c8;
  font-size: 0.78rem;
  font-weight: 500;
  margin-top: 0.15rem;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.wcp {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.35rem 0.65rem;
  flex-shrink: 0;
}
.wcp .v { font-size: 0.9rem; font-weight: 700; color: #d97706; }
.wcp .l { font-size: 0.65rem; color: var(--text-tertiary); }

/* ─── Voter portal action grid (shared) ─── */
.vg {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 0.85rem;
  margin: 1.25rem auto 0;
  max-width: 820px;
  width: 100%;
  padding: 0 16px;
  box-sizing: border-box;
}
.fc {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  text-align: left;
  color: inherit;
  font-family: var(--font);
  width: 100%;
}
.fc:hover { border-color: var(--accent); transform: translateY(-1px); }
.fci {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.fci.s { background: var(--green-bg); color: var(--green); }
.fci.n { background: var(--blue-bg); color: var(--blue); }
.fci.c { background: var(--red-bg); color: var(--red); }
.fci.r { background: var(--amber-bg); color: var(--amber); }
.fci.o { background: var(--accent-muted); color: var(--accent); }
.fcin h4 { font-size: 0.9rem; margin: 0 0 0.15rem; }
.fcin p { font-size: 0.8rem; color: var(--text-secondary); margin: 0; }

/* ─── News (ward / state / world) ─── */
.news-tabs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.9rem;
  flex-wrap: wrap;
}
.news-filter {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.32rem 0.75rem;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  font-family: var(--font);
}
.news-filter:hover { border-color: var(--accent); color: var(--accent); }
.news-filter.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px var(--glow-blue);
}
.news-count {
  margin-left: auto;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-muted);
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
}
.news-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}
.news-loading, .news-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-tertiary);
}
.news-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  cursor: pointer;
  transition: border-color 0.2s;
}
.news-item:hover { border-color: var(--accent); }
.news-cat {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--accent);
}
.news-item h4 { font-size: 0.92rem; margin: 0.2rem 0; }
.news-item p { font-size: 0.8rem; color: var(--text-secondary); }
.news-meta {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-top: 0.4rem;
  font-size: 0.72rem;
  color: var(--text-tertiary);
  flex-wrap: wrap;
}
.news-read {
  margin-left: auto;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.72rem;
  white-space: nowrap;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--accent);
  border-radius: 20px;
}
.news-read:hover { background: var(--accent-muted); }

.header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-title {
  font-size: 15px;
  font-weight: 600;
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  transition: all 0.12s;
}
.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.mobile-only { display: none; }

/* ─── Avatar ─── */
.avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.15s;
}

.btn-profile {
  padding: 2px;
  border-radius: 50%;
}
.btn-profile:hover .avatar {
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.avatar-default {
  width: 32px;
  height: 32px;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.avatar-logged-in {
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: white;
  border: none;
  font-size: 11px;
  font-weight: 700;
}

.avatar-dropdown {
  width: 40px;
  height: 40px;
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 700;
}

/* ─── Messages ─── */
.messages-container {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

.messages-inner {
  max-width: 740px;
  margin: 0 auto;
  padding: 20px 20px 8px;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* ─── Message bubbles ─── */
.msg-row {
  display: flex;
  gap: 10px;
  padding: 6px 0;
  animation: msg-enter 0.2s ease-out;
}

@keyframes msg-enter {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.msg-row.user {
  justify-content: flex-end;
}

.msg-avatar {
  width: 28px;
  height: 28px;
  min-width: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 2px;
}

.msg-avatar.bot {
  background: var(--bg-tertiary);
  color: var(--accent);
  border: 1px solid var(--border);
}

.msg-avatar.user {
  background: var(--user-bg);
  color: white;
}

.msg-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  line-height: 1.6;
}

.msg-row.assistant .msg-bubble {
  background: var(--bot-bg);
  border: 1px solid var(--bot-border);
  border-top-left-radius: 4px;
  color: var(--text-primary);
}

.msg-row.user .msg-bubble {
  background: var(--user-bg);
  border-top-right-radius: 4px;
  color: white;
}

/* ─── Markdown in bot bubbles ─── */
.msg-bubble p {
  margin-bottom: 0.5rem;
}
.msg-bubble p:last-child {
  margin-bottom: 0;
}
.msg-bubble code {
  background: rgba(var(--ink), 0.1);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: var(--font-mono);
}
.msg-bubble pre {
  background: #111;
  padding: 12px 14px;
  border-radius: var(--radius);
  overflow-x: auto;
  margin: 8px 0;
  border: 1px solid var(--border);
}
.msg-bubble pre code {
  background: none;
  padding: 0;
}
.msg-row.user .msg-bubble pre {
  background: rgba(0,0,0,0.2);
  border-color: rgba(var(--ink), 0.12);
}
.msg-bubble blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 10px;
  margin: 6px 0;
  color: var(--text-secondary);
}
.msg-bubble table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.9em;
  margin: 8px 0;
}
.msg-bubble th, .msg-bubble td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
}
.msg-bubble th {
  background: var(--bg-tertiary);
}

/* ─── Typing indicator ─── */
.typing-indicator {
  display: flex;
  gap: 10px;
  padding: 6px 0;
}

.typing-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
}

.typing-bubble {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  border-top-left-radius: 4px;
  background: var(--bot-bg);
  border: 1px solid var(--bot-border);
}

.typing-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: dot-pulse 1.4s infinite ease-in-out;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes dot-pulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.7); }
  40% { opacity: 1; transform: scale(1); }
}

/* ─── Empty State ─── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 20px 32px;
  text-align: center;
}

.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-lg);
  background: var(--accent-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  margin-bottom: 16px;
}

.empty-title {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 6px;
}

.empty-desc {
  font-size: 14px;
  color: var(--text-secondary);
  max-width: 360px;
  line-height: 1.6;
}

/* ─── Quick Actions ─── */
.quick-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 24px;
  width: 100%;
  max-width: 400px;
}

.quick-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  text-align: left;
  transition: all 0.15s;
}
.quick-card:hover {
  border-color: var(--accent);
  background: var(--bg-tertiary);
  transform: translateY(-1px);
}

.quick-card-icon {
  width: 42px;
  height: 42px;
  min-width: 42px;
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
}
.quick-card-icon.surveys { background: var(--blue-bg); color: var(--blue); }
.quick-card-icon.rewards { background: var(--amber-bg); color: var(--amber); }
.quick-card-icon.question { background: var(--green-bg); color: var(--green); }
.quick-card-icon.news { background: rgba(168,85,247,0.15); color: #a855f7; }
.quick-card-icon.complaints { background: rgba(220, 38, 38, 0.12); color: var(--red); }
.quick-card-icon.analytics { background: rgba(20,184,166,0.15); color: #14b8a6; }

.quick-card-text {
  flex: 1;
  min-width: 0;
}
.quick-card-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.quick-card-sub {
  display: block;
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.qc-arrow {
  color: var(--text-tertiary);
  transition: all 0.15s;
}

.survey-completed-label {
  font-size: 11px; color: var(--green); font-weight: 600;
  display: inline-flex; align-items: center; gap: 4px;
}

.history-empty {
  padding: 8px 10px;
}
.history-empty-text {
  font-size: 11px; color: var(--text-tertiary);
  font-style: italic;
}

.quick-card:hover .qc-arrow {
  color: var(--accent);
  transform: translateX(3px);
}

/* ─── Input Bar ─── */
.input-bar {
  padding: 10px 16px 12px;
  background: var(--bg-primary);
}

.input-inner {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  max-width: 740px;
  margin: 0 auto;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 6px 8px;
  transition: border-color 0.15s;
}
.input-inner:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.chat-input {
  flex: 1;
  resize: none;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  padding: 6px 4px;
  max-height: 120px;
  outline: none;
}
.chat-input::placeholder {
  color: var(--text-tertiary);
}

.input-mic {
  min-width: 34px;
  color: var(--text-tertiary);
}

.btn-send {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  transition: all 0.15s;
}
.btn-send:hover:not(:disabled) {
  background: var(--accent-hover);
  transform: scale(1.05);
}
.btn-send:disabled {
  background: var(--bg-tertiary);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

.input-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-top: 8px;
  max-width: 740px;
  margin-left: auto;
  margin-right: auto;
}

/* ─── Modal Overlay ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.15s ease-out;
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 80px rgba(0,0,0,0.5);
  position: relative;
  animation: modal-in 0.2s ease-out;
  max-height: 90vh;
  overflow-y: auto;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.12s;
}
.modal-close:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.modal-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

/* ─── Login Modal ─── */
.login-modal {
  width: 420px;
  max-width: 92vw;
  padding: 32px 28px 24px;
}

.modal-title {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 4px;
}

.modal-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* ─── Google Button ─── */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 11px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  transition: all 0.15s;
}
.btn-google:hover {
  background: var(--bg-hover);
  border-color: var(--border-light);
}

/* ─── Divider ─── */
.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 18px 0;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}
.divider-text {
  font-size: 11px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  font-weight: 600;
}

/* ─── Auth Form ─── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.input-group {
  position: relative;
}

.text-input {
  width: 100%;
  padding: 10px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.text-input::placeholder {
  color: var(--text-tertiary);
}
.text-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-muted);
}

.input-password .text-input {
  padding-right: 40px;
}

.btn-password-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-tertiary);
  transition: all 0.12s;
}
.btn-password-toggle:hover {
  color: var(--text-secondary);
  background: var(--bg-hover);
}

.form-options {
  display: flex;
  justify-content: flex-end;
}

.btn-link {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  transition: color 0.12s;
}
.btn-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.btn-primary-full {
  width: 100%;
  padding: 11px;
  border-radius: var(--radius);
  background: var(--accent);
  color: white;
  font-size: 14px;
  font-weight: 600;
  transition: all 0.15s;
  margin-top: 4px;
}
.btn-primary-full:hover {
  background: var(--accent-hover);
}
.btn-primary-full:active {
  transform: scale(0.98);
}

.auth-toggle {
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-secondary);
}

.auth-footer-text {
  text-align: center;
  margin-top: 14px;
  font-size: 11px;
  color: var(--text-tertiary);
  line-height: 1.6;
}

/* ─── Profile Dropdown ─── */
.dropdown {
  position: fixed;
  top: 52px;
  right: 12px;
  z-index: 90;
  width: 240px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  padding: 8px;
  animation: fade-in 0.12s ease-out;
}

.dropdown-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
}

.dropdown-name {
  font-size: 13px;
  font-weight: 600;
}

.dropdown-email {
  font-size: 12px;
  color: var(--text-secondary);
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 6px 0;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all 0.12s;
}
.dropdown-item:hover {
  background: var(--bg-hover);
}
.dropdown-item.danger:hover {
  background: var(--red-bg);
  color: var(--red);
}

/* ─── Profile dropdown: language setting + logout ─── */
.dropdown {
  width: 260px;
  top: 66px;
}
.dropdown-section {
  padding: 4px 6px;
}
.dropdown-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin: 0 0 6px;
  font-weight: 600;
}
.dropdown-select {
  width: 100%;
  padding: 7px 8px;
  font-size: 13px;
  font-family: var(--font);
  background: var(--bg-primary);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  cursor: pointer;
}
.dropdown-select:focus {
  border-color: var(--accent);
}

/* ─── Wide modal ─── */
.wide-modal {
  width: 620px;
  max-width: 92vw;
  padding: 24px;
}

/* ─── Modal tabs ─── */
.modal-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
  background: var(--bg-tertiary);
  padding: 3px;
  border-radius: var(--radius);
}
.mod-tab {
  flex: 1;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.12s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.mod-tab:hover { color: var(--text-primary); }
.mod-tab.active {
  background: var(--accent);
  color: white;
}
.tab-count {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 99px;
  background: rgba(var(--ink), 0.2);
}

/* ─── Surveys Grid ─── */
.surveys-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.surveys-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.survey-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  transition: border-color 0.15s;
}
.survey-card:hover { border-color: var(--accent); }
.survey-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.survey-cat {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  margin-bottom: 4px;
}
.survey-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 99px;
}
.survey-status.active { background: var(--green-bg); color: var(--green); }
.survey-status.closed { background: var(--bg-hover); color: var(--text-tertiary); }
.survey-reward { font-size: 13px; font-weight: 600; color: var(--amber); }
.survey-card h4 { font-size: 14px; margin-bottom: 4px; }
.survey-card p { font-size: 12px; color: var(--text-secondary); margin-bottom: 10px; line-height: 1.5; }
.btn-primary-sm {
  padding: 7px 16px; border-radius: var(--radius-sm);
  background: var(--accent); color: white;
  font-size: 12px; font-weight: 600;
  transition: all 0.12s;
}
.btn-primary-sm:hover { background: var(--accent-hover); }
.btn-primary-sm:disabled { background: var(--bg-hover); color: var(--text-tertiary); cursor: not-allowed; }

/* ─── Rewards Top ─── */
.rewards-top {
  display: flex;
  gap: 16px;
  margin-bottom: 20px;
}
.rewards-balance-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(135deg, #f5fbfe, #ffffff);
  border: 1px solid var(--border);
  flex: 1;
}
.rbc-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius);
  background: var(--amber-bg);
  display: flex; align-items: center; justify-content: center;
  color: var(--amber);
}
.balance-amount { font-size: 32px; font-weight: 800; color: var(--amber); }
.balance-unit { display: block; font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.rewards-stats {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.rstat {
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  text-align: center;
}
.rstat-val { display: block; font-size: 15px; font-weight: 700; color: var(--text-primary); }
.rstat-lbl { display: block; font-size: 10px; color: var(--text-tertiary); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.04em; }
/* Redeem */
.rewards-redeem { margin-bottom: 16px; }
.rewards-redeem h4 { font-size: 13px; margin-bottom: 8px; color: var(--text-secondary); }
.redeem-options { display: flex; gap: 8px; }
.redeem-card {
  flex: 1; padding: 10px 6px;
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  transition: all 0.15s;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
}
.redeem-card:hover { border-color: var(--accent); color: var(--text-primary); background: var(--bg-hover); }
.rewards-history h4 { font-size: 13px; margin-bottom: 10px; color: var(--text-secondary); }
.tx-row { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.tx-green { color: var(--green); font-weight: 600; }

/* ─── Rewards (dynamic points system) ─── */
.rewards-inner { min-height: 120px; }
.rewards-loading { padding: 40px 20px; text-align: center; color: var(--text-tertiary); font-size: 13px; }
.render-reward-section { margin: 14px 0 4px; }
.render-reward-section .render-label { display: block; margin-bottom: 8px; }
.render-reward-rules { list-style: none; margin: 0; padding: 0; }
.render-reward-rules li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-primary); }
.render-reward-rules li:last-child { border-bottom: none; }
.render-redeem-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.render-redeem-item { flex: none; }
.rr-item-label { font-size: 11px; font-weight: 600; color: var(--text-secondary); }
.rr-item-cost { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--amber); margin-top: 2px; }
.render-pts-pos { color: var(--green); font-weight: 700; white-space: nowrap; }
.render-pts-neg { color: var(--red); font-weight: 700; white-space: nowrap; }
.rr-time { color: var(--text-tertiary); font-size: 11px; margin-left: 6px; }
.render-reward-note { margin-top: 10px; font-size: 11px; font-weight: 600; color: var(--amber); background: var(--amber-bg); border: 1px dashed var(--amber); border-radius: 8px; padding: 6px 10px; display: inline-block; }

/* ─── Redeem confirm dialog ─── */
.small-modal { width: 400px; max-width: 92vw; padding: 24px; text-align: center; }
.redeem-confirm-body { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.redeem-confirm-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--amber-bg); display: flex; align-items: center; justify-content: center; margin-bottom: 4px; }
.redeem-confirm-icon i { color: var(--amber); }
.redeem-confirm-label { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.redeem-confirm-cost { display: inline-flex; align-items: center; gap: 6px; font-size: 16px; font-weight: 800; color: var(--amber); }
.redeem-confirm-note { font-size: 12px; color: var(--text-tertiary); max-width: 280px; }
.redeem-confirm-actions { display: flex; gap: 10px; margin-top: 14px; width: 100%; justify-content: center; }
.btn-primary { background: var(--accent); color: #fff; border: none; padding: 10px 20px; border-radius: var(--radius); font-size: 13px; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-secondary { background: var(--bg-tertiary); color: var(--text-secondary); border: 1px solid var(--border); padding: 10px 20px; border-radius: var(--radius); font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.btn-secondary:hover { background: var(--bg-hover); color: var(--text-primary); }

/* ─── News Grid ─── */
.news-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.news-card {
  display: flex;
  gap: 14px;
  padding: 0;
  border-radius: var(--radius-lg);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color 0.15s;
}
.news-card:hover { border-color: var(--accent); }
.news-card-img {
  width: 120px;
  min-width: 120px;
  background-size: cover;
  background-position: center;
}
.news-card-img.politics { background: linear-gradient(135deg, #a3daf1, #0090c8); }
.news-card-img.elections { background: linear-gradient(135deg, #5f1e3a, #db2777); }
.news-card-img.policy { background: linear-gradient(135deg, #1e5f3a, #16a34a); }
.news-card-body { padding: 12px 12px 12px 0; flex: 1; }
.news-tag {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 1px 6px; border-radius: 99px;
  margin-right: 8px;
}
.news-tag.politics { background: var(--blue-bg); color: var(--blue); }
.news-tag.elections { background: rgba(219,39,119,0.15); color: #db2777; }
.news-tag.policy { background: var(--green-bg); color: var(--green); }
.news-time { font-size: 11px; color: var(--text-tertiary); }
.news-card h4 { font-size: 14px; margin: 6px 0 4px; font-weight: 600; line-height: 1.4; }
.news-card p { font-size: 12px; color: var(--text-secondary); line-height: 1.5; margin-bottom: 6px; }

/* ─── Complaints ─── */
.complaints-filters {
  display: flex; gap: 6px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.comp-filter {
  padding: 5px 12px;
  border-radius: 99px;
  font-size: 11px; font-weight: 600;
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
  transition: all 0.12s;
}
.comp-filter:hover { border-color: var(--accent); color: var(--text-primary); }
.comp-filter.active { background: var(--accent); color: white; border-color: var(--accent); }
.complaints-list {
  display: flex; flex-direction: column; gap: 8px;
}
.complaint-item {
  display: flex; gap: 14px;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  transition: border-color 0.12s;
}
.complaint-item:hover { border-color: var(--border-light); }
.comp-icon {
  width: 40px; height: 40px; min-width: 40px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
}
.comp-icon.roads { background: var(--amber-bg); color: var(--amber); }
.comp-icon.water { background: var(--blue-bg); color: var(--blue); }
.comp-icon.electricity { background: rgba(250,204,21,0.15); color: #ca8a04; }
.comp-icon.sanitation { background: var(--green-bg); color: var(--green); }
.comp-body { flex: 1; min-width: 0; }
.comp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.comp-cat {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  padding: 1px 6px; border-radius: 99px;
}
.comp-cat.roads { background: var(--amber-bg); color: var(--amber); }
.comp-cat.water { background: var(--blue-bg); color: var(--blue); }
.comp-cat.electricity { background: rgba(250,204,21,0.15); color: #ca8a04; }
.comp-cat.sanitation { background: var(--green-bg); color: var(--green); }
.comp-time { font-size: 11px; color: var(--text-tertiary); }
.complaint-item h4 { font-size: 13px; font-weight: 600; margin: 4px 0 3px; }
.comp-loc { font-size: 11px; color: var(--text-tertiary); display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.comp-stats { display: flex; align-items: center; gap: 12px; }
.comp-upvotes { font-size: 11px; color: var(--green); font-weight: 600; }
.comp-status {
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 99px; text-transform: uppercase;
}
.comp-status.pending { background: var(--red-bg); color: var(--red); }
.comp-status.in-progress { background: var(--amber-bg); color: var(--amber); }
.comp-status.resolved { background: var(--green-bg); color: var(--green); }
.comp-id { font-size: 10px; color: var(--text-tertiary); font-family: var(--font-mono); }

/* My Complaints */
.my-comp-actions { margin-bottom: 16px; }
.my-comp-list { display: flex; flex-direction: column; gap: 8px; }

/* ─── Social Analytics ─── */
.analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.analytic-card {
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
}
.analytic-card:last-child { grid-column: span 2; }
.ac-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--text-secondary);
  margin-bottom: 12px;
}
.ac-header i { color: var(--accent); }
/* Trending */
.trend-list { display: flex; flex-direction: column; gap: 2px; }
.trend-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 0; font-size: 13px;
}
.trend-rank {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: var(--bg-hover);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
  color: var(--text-tertiary);
}
.trend-item:nth-child(1) .trend-rank { background: var(--accent-muted); color: var(--accent); }
.trend-item:nth-child(2) .trend-rank { background: var(--accent-muted); color: var(--accent); }
.trend-item:nth-child(3) .trend-rank { background: var(--accent-muted); color: var(--accent); }
.trend-count { margin-left: auto; font-size: 11px; color: var(--text-tertiary); }
/* Sentiment */
.sentiment-bars { display: flex; flex-direction: column; gap: 8px; }
.sent-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
.sent-row > span:first-child { width: 55px; color: var(--text-secondary); }
.sent-row > span:last-child { width: 30px; text-align: right; font-weight: 600; color: var(--text-primary); }
.sent-bar { flex: 1; height: 8px; border-radius: 99px; background: var(--bg-hover); overflow: hidden; }
.sent-fill { height: 100%; border-radius: 99px; }
.sent-fill.pos { background: var(--green); }
.sent-fill.neu { background: var(--amber); }
.sent-fill.neg { background: var(--red); }
/* Platform */
.platform-list { display: flex; flex-direction: column; gap: 8px; }
.plat-row {
  display: flex; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-secondary);
}
.plat-pct { width: 32px; font-weight: 600; color: var(--text-primary); text-align: right; }
.plat-bar { flex: 1; height: 6px; border-radius: 99px; background: var(--bg-hover); overflow: hidden; }
.plat-fill { height: 100%; border-radius: 99px; }
.plat-fill.tw { background: #1d9bf0; }
.plat-fill.fb { background: #1877f2; }
.plat-fill.ig { background: #e4405f; }
.plat-fill.yt { background: #ff0000; }

/* ─── Toast ─── */
.toast-container {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 500;
  color: white;
  animation: slide-left 0.25s ease-out;
  max-width: 360px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
}

@keyframes slide-left {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

.toast-success { background: #16a34a; }
.toast-error { background: #dc2626; }
.toast-info { background: var(--accent); }

/* ─── Hidden ─── */
.hidden { display: none !important; }

/* ─── Render Engine Styles ─── */
.render-card {
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin: 4px 0;
}
.render-survey-header h4 { font-size: 15px; margin-bottom: 2px; }
.render-survey-header p { font-size: 12px; color: var(--text-secondary); margin-bottom: 8px; }
.render-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 2px 10px;
  border-radius: 99px;
  background: var(--accent-muted); color: var(--accent); font-weight: 600;
}
.render-section { margin-top: 10px; }
.render-label { font-size: 11px; color: var(--text-tertiary); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.render-bot-msg {
  background: var(--bot-bg); border: 1px solid var(--bot-border);
  padding: 10px 14px; border-radius: var(--radius); margin-top: 8px;
  font-size: 14px; line-height: 1.6;
}
.render-user-msg {
  background: var(--user-bg); color: white;
  padding: 10px 14px; border-radius: var(--radius); margin-top: 6px;
  font-size: 14px; text-align: right;
}
.render-progress {
  display: flex; align-items: center; gap: 10px; margin: 8px 0;
}
.rp-bar { flex: 1; height: 6px; border-radius: 99px; background: var(--bg-hover); overflow: hidden; }
.rp-fill { height: 100%; border-radius: 99px; transition: width 0.5s; }
.rp-label { font-size: 11px; color: var(--text-tertiary); font-weight: 600; }

/* Survey Grid */
.render-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.render-survey-item {
  padding: 14px; border-radius: var(--radius-lg);
  background: var(--bg-tertiary); border: 1px solid var(--border);
  transition: border-color 0.15s;
}
.render-survey-item:hover { border-color: var(--accent); }
.rsi-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.rsi-cat { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--text-tertiary); }
.rsi-status { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 99px; }
.rsi-status.active { background: var(--green-bg); color: var(--green); }
.rsi-status.closed { background: var(--bg-hover); color: var(--text-tertiary); }
.render-survey-item h5 { font-size: 13px; margin-bottom: 6px; }
.rsi-meta { display: flex; gap: 12px; align-items: center; font-size: 11px; color: var(--text-secondary); margin-bottom: 8px; }
.rsi-meta span { display: flex; align-items: center; gap: 3px; }
.rsi-points { color: var(--amber); font-weight: 700; }

/* Coin icon */
.coin-icon { width: 14px; height: 14px; vertical-align: middle; }
.coin-lg { width: 28px; height: 28px; }

/* Rewards */
.render-reward-balance {
  display: flex; align-items: center; gap: 12px; padding: 16px;
  border-radius: var(--radius); background: linear-gradient(135deg, #f5fbfe, #ffffff);
  border: 1px solid var(--border); margin-bottom: 10px;
}
.rrb-icon { width: 44px; height: 44px; border-radius: var(--radius); background: var(--amber-bg); display: flex; align-items: center; justify-content: center; }
.rrb-amount { font-size: 28px; font-weight: 800; color: var(--amber); }
.rrb-label { display: block; font-size: 12px; color: var(--text-secondary); }
.render-reward-stats {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; margin-bottom: 12px;
}
.rrs-stat {
  padding: 10px; border-radius: var(--radius); background: var(--bg-tertiary);
  border: 1px solid var(--border); text-align: center;
}
.rrs-val { display: block; font-size: 14px; font-weight: 700; color: var(--text-primary); }
.rrs-lbl { display: block; font-size: 10px; color: var(--text-tertiary); margin-top: 2px; text-transform: uppercase; letter-spacing: 0.04em; }

/* Tables */
.render-table-wrap { overflow-x: auto; margin: 8px 0; }
.render-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.render-table th { background: var(--bg-hover); padding: 8px 10px; text-align: left; font-weight: 600; color: var(--text-secondary); text-transform: uppercase; font-size: 10px; letter-spacing: 0.04em; border-bottom: 2px solid var(--border); }
.render-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); }
.render-num { text-align: right; font-family: var(--font-mono); }
.render-pts-cell { color: var(--green); font-weight: 600; white-space: nowrap; }
.render-neg { color: var(--red); font-weight: 600; }
.render-date { color: var(--text-tertiary); font-size: 11px; white-space: nowrap; }

/* News */
.render-news-list { display: flex; flex-direction: column; gap: 10px; }
.render-news-item {
  padding: 14px; border-radius: var(--radius-lg);
  background: var(--bg-tertiary); border: 1px solid var(--border);
}
.rni-header { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.rni-cat { font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 99px; text-transform: uppercase; letter-spacing: 0.04em; }
.rni-cat.politics { background: var(--blue-bg); color: var(--blue); }
.rni-cat.elections { background: rgba(219,39,119,0.15); color: #db2777; }
.rni-cat.policy { background: var(--green-bg); color: var(--green); }
.rni-cat.judiciary { background: rgba(168,85,247,0.15); color: #a855f7; }
.rni-cat.economy { background: var(--amber-bg); color: var(--amber); }
.rni-time { font-size: 11px; color: var(--text-tertiary); margin-left: auto; }
.render-news-item h5 { font-size: 13px; margin-bottom: 4px; line-height: 1.4; }
.render-news-item p { font-size: 12px; color: var(--text-secondary); line-height: 1.5; }

/* Complaints */
.render-complaint-list { display: flex; flex-direction: column; gap: 8px; }
.render-complaint-item {
  display: flex; gap: 12px; padding: 14px;
  border-radius: var(--radius); background: var(--bg-tertiary);
  border: 1px solid var(--border);
}
.rci-icon {
  width: 36px; height: 36px; min-width: 36px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center; font-size: 16px;
}
.rci-icon.roads { background: var(--amber-bg); }
.rci-icon.water { background: var(--blue-bg); }
.rci-icon.electricity { background: rgba(250,204,21,0.15); }
.rci-icon.sanitation { background: var(--green-bg); }
.rci-body { flex: 1; min-width: 0; }
.render-complaint-item h5 { font-size: 13px; margin: 4px 0 3px; }
.rci-loc { font-size: 11px; color: var(--text-tertiary); display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.rci-stats { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rci-upvotes { font-size: 11px; color: var(--green); font-weight: 600; }
.rci-status { font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 99px; text-transform: uppercase; }
.rci-status.pending { background: var(--red-bg); color: var(--red); }
.rci-status.in-progress { background: var(--amber-bg); color: var(--amber); }
.rci-status.resolved { background: var(--green-bg); color: var(--green); }
.rci-id { font-size: 10px; color: var(--text-tertiary); font-family: var(--font-mono); margin-left: auto; }

/* Analytics */
.render-analytics { padding: 16px; }
.ra-section { margin-bottom: 14px; }
.ra-section h5 { font-size: 12px; margin-bottom: 8px; color: var(--text-secondary); }
.ra-trend-row {
  display: flex; align-items: center; gap: 10px; padding: 5px 0; font-size: 12px;
}
.ra-rank {
  width: 22px; height: 22px; border-radius: 6px;
  background: var(--bg-hover); display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: var(--text-tertiary);
}
.ra-rank.top { background: var(--accent-muted); color: var(--accent); }
.ra-topic { flex: 1; }
.ra-count { font-size: 11px; color: var(--text-tertiary); }
.ra-sent-row { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-bottom: 6px; }
.ra-sent-row > span:first-child { width: 80px; }
.ra-sent-row > span:last-child { width: 32px; text-align: right; font-weight: 600; }
.ra-sent-bar { flex: 1; height: 8px; border-radius: 99px; background: var(--bg-hover); overflow: hidden; }
.ra-sent-fill { height: 100%; border-radius: 99px; }
.ra-sent-fill.positive { background: var(--green); }
.ra-sent-fill.neutral { background: var(--amber); }
.ra-sent-fill.negative { background: var(--red); }
.ra-plat-row { display: flex; align-items: center; gap: 8px; font-size: 11px; margin-bottom: 5px; }
.ra-plat-row > span:first-child { width: 80px; }
.ra-plat-pct { width: 32px; text-align: right; font-weight: 600; }
.ra-plat-bar { flex: 1; height: 6px; border-radius: 99px; background: var(--bg-hover); overflow: hidden; }
.ra-plat-fill { height: 100%; border-radius: 99px; background: var(--accent); }

/* JSON render fallback */
.render-json { font-size: 11px; font-family: var(--font-mono); color: var(--text-secondary); white-space: pre-wrap; overflow-x: auto; }

/* ─── Surveys loading ─── */
.surveys-loading {
  grid-column: span 2;
  text-align: center;
  padding: 32px;
  color: var(--text-secondary);
  font-size: 14px;
}
.surveys-loading::after {
  content: "";
  display: block;
  width: 24px; height: 24px;
  margin: 12px auto 0;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Surveys empty ─── */
.surveys-empty {
  grid-column: span 2;
  text-align: center;
  padding: 36px 20px;
}
.surveys-empty-icon {
  width: 48px; height: 48px;
  border-radius: var(--radius-lg);
  background: var(--bg-tertiary);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-tertiary);
  margin: 0 auto 14px;
}
.surveys-empty h4 {
  font-size: 15px; color: var(--text-primary); margin-bottom: 4px;
}
.surveys-empty p {
  font-size: 13px; color: var(--text-secondary); max-width: 340px; margin: 0 auto;
  line-height: 1.5;
}

/* ─── Icon sizes ─── */
.icon-xs { width: 13px; height: 13px; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100%;
    transform: translateX(-100%);
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 8px 0 40px rgba(0,0,0,0.5);
  }

  .mobile-only { display: flex; }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 19;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(2px);
  }

  .messages-inner {
    padding: 12px 12px 4px;
  }

  .msg-bubble {
    max-width: 88%;
  }

  .surveys-grid {
    grid-template-columns: 1fr;
  }

  .analytics-grid {
    grid-template-columns: 1fr;
  }

  .analytics-grid .analytic-card:last-child {
    grid-column: span 1;
  }

  .rewards-top {
    flex-direction: column;
  }

  .redeem-options {
    flex-wrap: wrap;
  }

  .redeem-card {
    min-width: 70px;
  }

  .news-card {
    flex-direction: column;
  }

  .news-card-img {
    width: 100%;
    min-width: 100%;
    height: 120px;
  }

  .news-card-body {
    padding: 12px;
  }

  .complaints-filters {
    gap: 4px;
  }

  .comp-filter {
    font-size: 10px;
    padding: 4px 10px;
  }

  .wide-modal {
    max-width: 94vw;
    padding: 18px;
  }
}

/* ================================================================
   MODERN DASHBOARD — premium glossy dark UI
   ================================================================ */

/* Ring2Poll brand pair — see the palette note on the first `:root` above. */
:root {
  --accent: #0090c8;
  --accent-hover: #0077a6;
  --accent-2: #00b4e0;
  --glow-blue: rgba(0, 144, 200, 0.35);
  --glow-green: rgba(0, 180, 224, 0.4);
}

body {
  /* Clean, subtle vertical gradient — no color blobs */
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
}

/* ─── Sidebar ─── */
.sidebar {
  background: linear-gradient(180deg, var(--bg-elevated), var(--bg-secondary));
  border-right: 1px solid rgba(var(--ink), 0.08);
}

.btn-new-chat {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff;
  border: none;
  box-shadow: 0 6px 20px var(--glow-blue);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.btn-new-chat:hover {
  border: none;
  background: linear-gradient(135deg, #00b4e0, #00b4e0);
  box-shadow: 0 8px 26px var(--glow-blue);
  transform: translateY(-1px);
}

.nav-item {
  border-radius: 10px;
  margin: 2px 6px;
}
.nav-item:hover {
  background: rgba(var(--ink), 0.05);
}
.nav-item.active {
  background: linear-gradient(135deg, rgba(0, 144, 200, 0.18), rgba(0, 180, 224, 0.16));
  color: #0090c8;
  box-shadow: inset 0 0 0 1px rgba(0, 144, 200, 0.28), 0 4px 14px rgba(0, 144, 200, 0.12);
}
.nav-item.active i { color: var(--accent); }

.sidebar-label {
  letter-spacing: 0.09em;
}

/* ─── Header ─── */
.header {
  height: 62px;
  min-height: 62px;
  background: rgba(var(--scrim), 0.78);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(var(--ink), 0.08);
  position: sticky;
  top: 0;
  z-index: 5;
}
.header::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0, 144, 200, 0.7), rgba(0, 180, 224, 0.7), transparent);
  opacity: 0.6;
}

.brand-logo {
  background: linear-gradient(135deg, #0090c8, #00b4e0);
  box-shadow: 0 4px 16px rgba(0, 180, 224, 0.45);
}
.brand-name {
  background: linear-gradient(135deg, #0f172b, #0090c8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* The real Ring2Poll logo, as the admin app renders it in its header.
   It replaces the old gradient tile + "Ring2Poll" text — the logo already
   carries the wordmark, so drawing both duplicated it. `height` only, so the
   width follows the file's own aspect ratio. */
.r2p-logo {
  height: 30px;
  width: auto;
  display: block;
  flex-shrink: 0;
}

.role-badge {
  background: linear-gradient(135deg, rgba(0, 144, 200, 0.22), rgba(0, 180, 224, 0.2));
  border: 1px solid rgba(0, 144, 200, 0.35);
  box-shadow: 0 0 14px rgba(0, 144, 200, 0.18);
}

.points-chip {
  background: linear-gradient(135deg, rgba(217, 119, 6, 0.14), rgba(217, 119, 6, 0.05));
  border: 1px solid rgba(217, 119, 6, 0.35);
  box-shadow: 0 0 14px rgba(217, 119, 6, 0.14);
}

/* ─── Header as dashboard elements ─── */
.header-left { gap: 10px; }
.header-divider {
  width: 1px;
  height: 22px;
  margin: 0 2px;
  background: linear-gradient(180deg, transparent, rgba(var(--ink), 0.22), transparent);
  flex-shrink: 0;
}
.header-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.02em;
  white-space: nowrap;
}
.scope-chip {
  display: none;
  align-items: center;
  padding: 0.28rem 0.65rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #0090c8;
  background: rgba(0, 144, 200, 0.12);
  border: 1px solid rgba(0, 144, 200, 0.28);
  white-space: nowrap;
}
.scope-chip:not(:empty) { display: inline-flex; }
.icon-pill {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 30px;
  padding: 0 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(var(--ink), 0.14);
  background: rgba(var(--ink), 0.05);
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-family: var(--font);
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s;
}
.icon-pill:hover {
  border-color: rgba(0, 144, 200, 0.55);
  color: #0090c8;
  box-shadow: 0 0 14px rgba(0, 144, 200, 0.2);
}
.btn-profile {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 3px;
  border-radius: 999px;
  border: 1px solid rgba(var(--ink), 0.14);
  background: rgba(var(--ink), 0.05);
  transition: all 0.15s;
}
.btn-profile:hover {
  border-color: rgba(0, 144, 200, 0.55);
  box-shadow: 0 0 14px rgba(0, 144, 200, 0.2);
}
.profile-name {
  font-size: 0.8rem;
  color: var(--text-secondary);
  max-width: 96px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.role-badge {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
@media (max-width: 760px) {
  .scope-chip { display: none !important; }
  .profile-name { display: none; }
  .header-title { display: none; }
}

/* ─── Welcome card ─── */
.wc {
  background: linear-gradient(135deg, var(--bg-elevated), var(--bg-secondary));
  border: 1px solid rgba(var(--ink), 0.1);
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(var(--ink), 0.08), inset 0 1px 0 rgba(var(--ink), 0.05);
}
.wca {
  width: 46px;
  height: 46px;
  font-size: 1.15rem;
  background: linear-gradient(135deg, #0090c8, #00b4e0);
  box-shadow: 0 4px 16px rgba(0, 180, 224, 0.5);
}
.wci h3 { font-size: 1rem; }
.wci .ww { font-weight: 600; }

/* ─── Action grid cards ─── */
.fc {
  background: linear-gradient(160deg, rgba(var(--ink), 0.08), rgba(var(--ink), 0.03));
  border: 1px solid rgba(var(--ink), 0.1);
  border-radius: 14px;
  box-shadow: 0 6px 18px rgba(var(--ink), 0.06), inset 0 1px 0 rgba(var(--ink), 0.05);
}
.fc:hover {
  transform: translateY(-3px);
  border-color: rgba(0, 144, 200, 0.55);
  box-shadow: 0 12px 28px rgba(var(--ink), 0.1), 0 0 22px rgba(0, 144, 200, 0.18);
}
.fci { border-radius: 10px; box-shadow: inset 0 0 0 1px rgba(var(--ink), 0.08); }
.fci.n { background: linear-gradient(135deg, rgba(0, 180, 224, 0.28), rgba(0, 180, 224, 0.06)); }
.fci.c { background: linear-gradient(135deg, rgba(220, 38, 38, 0.28), rgba(220, 38, 38, 0.06)); }
.fci.s { background: linear-gradient(135deg, rgba(22, 163, 74, 0.28), rgba(22, 163, 74, 0.06)); }
.fci.r { background: linear-gradient(135deg, rgba(217, 119, 6, 0.28), rgba(217, 119, 6, 0.06)); }
.fci.o { background: linear-gradient(135deg, rgba(0, 144, 200, 0.3), rgba(0, 180, 224, 0.1)); }
.fcin h4 { font-weight: 600; }

/* ─── Empty state ─── */
.empty-icon {
  background: linear-gradient(135deg, rgba(0, 144, 200, 0.2), rgba(0, 180, 224, 0.14));
  border: 1px solid rgba(0, 144, 200, 0.25);
  box-shadow: 0 0 24px rgba(0, 144, 200, 0.18);
}

/* Hide the old chat quick-action cards — replaced by the modern action grid */
.empty-state .quick-actions {
  display: none !important;
}
/* Hide the "How can I help you today?" chat empty-state block too —
   only the modern action grid + chat bar remain on the dashboard */
.empty-state {
  display: none !important;
}
.empty-title { font-size: 18px; }
.empty-desc { font-size: 13px; }

.quick-card {
  background: linear-gradient(160deg, rgba(var(--ink), 0.05), rgba(var(--ink), 0.03));
  border: 1px solid rgba(var(--ink), 0.1);
  border-radius: 14px;
}
.quick-card:hover {
  border-color: rgba(0, 144, 200, 0.5);
  box-shadow: 0 8px 20px rgba(var(--ink), 0.08), 0 0 16px rgba(0, 144, 200, 0.14);
}

/* ─── Chat bubbles ─── */
.msg-row.assistant .msg-bubble {
  background: linear-gradient(160deg, rgba(var(--ink), 0.08), rgba(var(--ink), 0.03));
  border: 1px solid rgba(var(--ink), 0.1);
  box-shadow: 0 2px 8px rgba(var(--ink), 0.05);
}
.msg-row.user .msg-bubble {
  background: linear-gradient(135deg, #0090c8, #00b4e0);
  color: #fff;
  box-shadow: 0 6px 18px rgba(0, 144, 200, 0.3);
}
.msg-avatar.bot {
  background: linear-gradient(135deg, rgba(0, 144, 200, 0.18), rgba(0, 180, 224, 0.14));
  border-color: rgba(0, 144, 200, 0.3);
}
.msg-avatar.user {
  background: linear-gradient(135deg, #0090c8, #00b4e0);
  color: #fff;
}
.typing-indicator .typing-bubble {
  background: linear-gradient(160deg, rgba(var(--ink), 0.08), rgba(var(--ink), 0.03));
  border-color: rgba(var(--ink), 0.1);
}

/* ─── Input bar ─── */
.input-bar {
  background: rgba(var(--scrim), 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(var(--ink), 0.08);
  position: sticky;
  bottom: 0;
  z-index: 5;
}
.input-inner {
  background: rgba(var(--ink), 0.05);
  border: 1px solid rgba(var(--ink), 0.12);
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(var(--ink), 0.06);
}
.input-inner:focus-within {
  border-color: rgba(0, 144, 200, 0.6);
  box-shadow: 0 0 0 3px rgba(0, 144, 200, 0.15), 0 4px 16px rgba(var(--ink), 0.06);
}
.btn-send {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 14px var(--glow-blue);
  width: 34px;
  height: 34px;
  min-width: 34px;
}
.btn-send:hover:not(:disabled) {
  background: linear-gradient(135deg, #00b4e0, #00b4e0);
  transform: scale(1.06);
  box-shadow: 0 6px 18px var(--glow-blue);
}
.btn-send:disabled {
  background: rgba(var(--ink), 0.1);
  color: var(--text-tertiary);
}

/* ─── Cards + chat flow together (single scroll) ─── */
/* The welcome card, action cards and chat messages are all in the same
   scroll flow. As the chat grows the page gets taller and the cards
   scroll up naturally — they move together, never stacked panels. */
.messages-container {
  flex: 1 0 auto;
  min-height: 0;
  overflow: visible;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
}
.messages-inner {
  max-width: none;
  padding: 16px 18px 12px;
}

/* On short or narrow screens the action grid + welcome card get too tall
   and squeeze the chat away. Compact them so the chat keeps its space. */
@media (max-height: 760px), (max-width: 700px) {
  .vg {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.6rem;
    margin-top: 0.75rem;
    padding: 0 12px;
  }
  .fc { padding: 0.75rem; gap: 0.6rem; }
  .fci { width: 34px; height: 34px; }
  .fcin h4 { font-size: 0.76rem; }
  .fcin p { font-size: 0.68rem; }
  .wc { padding: 0.6rem 0.9rem; }
  .wca { width: 36px; height: 36px; font-size: 0.95rem; }
  .input-bar { padding: 8px 12px 10px; }
  .chat-input { max-height: 96px; }
}
@media (max-width: 420px) {
  .vg { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ================================================================
   DARK THEME

   Toggled by `data-theme` on <html> — see `js/theme.js` and the tiny
   pre-paint script in each page's <head> (that one runs before first paint so
   there is no white flash when the saved choice is dark).

   ⚠️ Declared LAST and scoped as `html[data-theme="dark"]` on purpose:
   `style.css` sets `:root` twice, and the "MODERN DASHBOARD" block further up
   wins on the cascade. `:root` and a bare attribute selector have equal
   specificity, so this needs both the extra element in the selector AND to come
   last to beat it.

   Only variables are redefined here. Everything else follows, because the
   rules above were rewritten to use `var(--ink)` / `var(--scrim)` / `--hero-*`
   instead of hardcoded light values.
   ================================================================ */
html[data-theme="dark"] {
  color-scheme: dark;

  --bg-primary: #0f172b;
  --bg-secondary: #141e33;
  --bg-tertiary: #1b2740;
  --bg-elevated: #16213a;
  --bg-hover: #22304d;
  --border: #2a3a55;
  --border-light: #1f2c44;

  --text-primary: #e6eef8;
  --text-secondary: #a3b6cd;
  --text-tertiary: #7488a3;

  --ink: 255, 255, 255;
  --scrim: 15, 23, 43;

  --hero-1: #0f172b;
  --hero-2: #141e33;
  --hero-3: #1b2740;
  --hero-4: #22304d;

  --accent: #29a8dc;
  --accent-hover: #4db8e0;
  --accent-muted: rgba(41, 168, 220, 0.16);
  --accent-2: #7fd0ea;

  --user-bg: #0090c8;
  --user-bg-hover: #29a8dc;
  --bot-bg: #1b2740;
  --bot-border: #2a3a55;

  --green: #4ade80;
  --green-bg: rgba(74, 222, 128, 0.14);
  --red: #f87171;
  --red-bg: rgba(248, 113, 113, 0.14);
  --amber: #fbbf24;
  --amber-bg: rgba(251, 191, 36, 0.14);
  --blue: #29a8dc;
  --blue-bg: rgba(41, 168, 220, 0.16);

  --glow-blue: rgba(41, 168, 220, 0.35);
  --glow-green: rgba(127, 208, 234, 0.4);
}

/* The brand wordmark is a background-clip gradient, so it is two literal
   colours that the variable swap above cannot reach. */
html[data-theme="dark"] .brand-name {
  background: linear-gradient(135deg, #e6eef8, #29a8dc);
  -webkit-background-clip: text;
  background-clip: text;
}

/* Shadows tuned for a light page are far too heavy on navy. */
html[data-theme="dark"] .fc,
html[data-theme="dark"] .wc,
html[data-theme="dark"] .quick-card,
html[data-theme="dark"] .input-inner,
html[data-theme="dark"] .msg-row.assistant .msg-bubble {
  box-shadow: none;
}

/* ─── Theme switch button (lives in both app headers) ─── */
/* Header "Subscribe" call-to-action. Sits in .header-right so it is visible on
   every screen of the prototype. Opens the billing page on the Ring2Poll API,
   which owns the Razorpay subscription flow. */
.btn-subscribe {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  color: #ffffff;
  font-family: var(--font);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-subscribe:hover {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.btn-subscribe:active {
  transform: translateY(0);
}

.btn-subscribe .icon-sm {
  width: 14px;
  height: 14px;
}

/* Collapse to an icon-only chip on narrow screens. */
@media (max-width: 720px) {
  .btn-subscribe {
    padding: 0 9px;
  }

  .btn-subscribe span {
    display: none;
  }
}

.btn-theme {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(var(--ink), 0.14);
  background: rgba(var(--ink), 0.05);
  color: inherit;
  font-size: 0.85rem;
  line-height: 1;
  cursor: pointer;
  font-family: var(--font);
  transition: all 0.15s;
}
.btn-theme:hover {
  border-color: rgba(0, 144, 200, 0.55);
  color: var(--accent);
}

/* The login pages have no header bar, so their switch floats in the corner. */
.btn-theme--float {
  position: fixed;
  top: 1rem;
  right: 1rem;
  z-index: 400;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

/* ─── Shop & Compare ───────────────────────────────────────────────────────── */
/* Everything is themed off the shared variables so the dark-mode swap works with
   no extra rules; the only literal colour is the store accent, which is data. */
.shop-inner { display: flex; flex-direction: column; gap: 12px; padding: 4px 2px 8px; }

.shop-searchbar {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 5px 5px 12px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg-tertiary);
}
.shop-search-ico { flex: 0 0 auto; opacity: .55; }
.shop-input {
  flex: 1; min-width: 0; border: 0; outline: 0; background: transparent;
  color: var(--text); font-size: 14px; font-family: inherit; padding: 8px 0;
}
.shop-input::placeholder { color: var(--text-tertiary); }
.shop-go { padding: 8px 16px; font-size: 13px; flex: 0 0 auto; }

.shop-filterrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.shop-chips { display: flex; gap: 6px; flex-wrap: wrap; flex: 1; min-width: 0; }
.shop-chip {
  border: 1px solid var(--border); background: var(--bg-tertiary); color: var(--text-secondary);
  border-radius: 999px; padding: 5px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit; white-space: nowrap; transition: all .15s;
}
.shop-chip:hover { border-color: var(--accent); color: var(--accent); }
.shop-chip.active { background: var(--accent); border-color: var(--accent); color: #fff; }
.shop-select {
  border: 1px solid var(--border); background: var(--bg-tertiary); color: var(--text);
  border-radius: 8px; padding: 7px 10px; font-size: 12px; font-family: inherit; cursor: pointer;
}
.shop-meta { margin: 0; font-size: 12px; color: var(--text-tertiary); }

.shop-results {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px;
  max-height: 50vh; overflow-y: auto; padding: 2px;
}
.shop-empty { grid-column: 1 / -1; text-align: center; padding: 32px 10px; font-size: 13px; color: var(--text-tertiary); }

.shop-card {
  display: flex; flex-direction: column; gap: 7px;
  border: 1px solid var(--border); border-radius: 14px; padding: 12px;
  background: var(--bg-secondary);
  transition: box-shadow .15s, transform .15s, border-color .15s;
}
.shop-card:hover { transform: translateY(-2px); box-shadow: 0 12px 26px -18px rgba(15, 23, 42, .5); }
.shop-card.picked { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-muted); }

.shop-thumb {
  height: 84px; border-radius: 10px; display: flex; align-items: center; justify-content: center;
  font-size: 25px; font-weight: 800; letter-spacing: .02em; color: #fff;
  /* Holds the product photo over the initials tile; the initials are the fallback. */
  position: relative; overflow: hidden;
}
.shop-thumb img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  /* contain, not cover, so a tall or wide product is never cropped; white because
     merchant product shots are shot on white and look wrong on a dark tile. */
  object-fit: contain; background: #fff;
}
.shop-badges { display: flex; flex-wrap: wrap; gap: 4px; }
.shop-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 3px 7px; border-radius: 999px; background: var(--accent-muted); color: var(--accent);
}
.shop-badge.gold { background: rgba(234, 179, 8, .2); color: #a16207; }
.shop-badge.green { background: rgba(16, 185, 129, .17); color: #047857; }
.shop-badge.red { background: rgba(239, 68, 68, .15); color: #b91c1c; }

.shop-title { font-size: 13px; font-weight: 700; line-height: 1.35; }
.shop-store { font-size: 11px; color: var(--text-tertiary); }
.shop-pricerow { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.shop-price { font-size: 16px; font-weight: 800; }
.shop-mrp { font-size: 11px; color: var(--text-tertiary); text-decoration: line-through; }
.shop-off { font-size: 11px; font-weight: 700; color: #059669; }
.shop-rating { font-size: 11px; color: var(--text-secondary); }
.shop-actions { display: flex; gap: 6px; margin-top: auto; }
.shop-buy {
  flex: 1; text-align: center; text-decoration: none; background: var(--accent); color: #fff;
  border-radius: 9px; padding: 8px 10px; font-size: 12.5px; font-weight: 700; transition: filter .15s;
}
.shop-buy:hover { filter: brightness(1.08); }
.shop-pick {
  border: 1px solid var(--border); background: var(--bg-tertiary); color: var(--text-secondary);
  border-radius: 9px; padding: 8px 10px; font-size: 12px; font-weight: 600;
  cursor: pointer; font-family: inherit; transition: all .15s;
}
.shop-pick.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.shop-warn { font-size: 10.5px; color: #b45309; }
/* A product sold by more than one merchant: the card lists the stores and the saving. */
.shop-multi { color: #2563eb; font-weight: 600; }
.shop-save { font-size: 11px; font-weight: 700; color: #059669; }

.shop-tray {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 12px;
  background: var(--accent-muted); border: 1px solid var(--border);
}
.shop-tray-text { flex: 1; font-size: 12.5px; font-weight: 600; }

/* ─── Compare table ─── */
.compare-inner { padding: 2px; }
.compare-scroll { overflow-x: auto; }
.compare-table { border-collapse: collapse; width: 100%; min-width: 440px; font-size: 12.5px; }
.compare-table th, .compare-table td { border-bottom: 1px solid var(--border); padding: 9px 10px; text-align: left; vertical-align: top; }
.compare-table thead th { position: sticky; top: 0; background: var(--bg-secondary); z-index: 1; }
.compare-spec { font-weight: 700; color: var(--text-secondary); width: 128px; }
.compare-same td { opacity: .5; }
.compare-win { font-weight: 800; color: #059669; }
.compare-head { display: flex; flex-direction: column; gap: 3px; }
.compare-head .shop-title { font-size: 12.5px; }
.compare-buy {
  display: inline-block; margin-top: 6px; text-decoration: none; background: var(--accent); color: #fff;
  border-radius: 7px; padding: 5px 10px; font-size: 11.5px; font-weight: 700; text-align: center;
}
.compare-legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--text-tertiary); margin: 10px 0 0; }
/* Shown when every compared row is the SAME product on a different store, which turns the
   table into a where-to-buy decision instead of a specs comparison. */
.compare-banner {
  display: flex; flex-direction: column; gap: 3px; padding: 10px 12px; margin: 0 0 10px;
  border-radius: 11px; background: var(--accent-muted); border: 1px solid var(--border); font-size: 12.5px;
}
.compare-banner strong { font-size: 13px; }
.compare-banner span { color: var(--text-secondary); }
