/* ================================================================
   DARK THEME — Chatbot Prototype
   ================================================================ */

:root {
  --bg-primary: #0f0f0f;
  --bg-secondary: #1a1a1a;
  --bg-tertiary: #242424;
  --bg-elevated: #2a2a2a;
  --bg-hover: #2d2d2d;
  --border: #2e2e2e;
  --border-light: #3a3a3a;

  --text-primary: #ececec;
  --text-secondary: #9e9e9e;
  --text-tertiary: #6b6b6b;

  --accent: #4da3ff;
  --accent-hover: #3d8ce8;
  --accent-muted: rgba(77, 163, 255, 0.12);

  --user-bg: #2563eb;
  --user-bg-hover: #1d4ed8;
  --bot-bg: #1e1e1e;
  --bot-border: #2e2e2e;

  --green: #22c55e;
  --green-bg: rgba(34, 197, 94, 0.12);
  --red: #ef4444;
  --red-bg: rgba(239, 68, 68, 0.12);
  --amber: #f59e0b;
  --amber-bg: rgba(245, 158, 11, 0.12);
  --blue: #3b82f6;
  --blue-bg: rgba(59, 130, 246, 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: #3a3a3a; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #4a4a4a; }

/* ─── 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%;
}

/* ─── 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); }
}

.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-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(255,255,255,0.08);
  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(255,255,255,0.1);
}
.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(239,68,68,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);
}

/* ─── 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(255,255,255,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, #1a1a2e, #16213e);
  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; }

/* ─── 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, #1e3a5f, #2563eb); }
.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: #facc15; }
.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: #facc15; }
.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, #1a1a2e, #16213e);
  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;
  }
}
