:root {
  --bg: #0b0e14;
  --surface: #13171f;
  --surface2: #1c2130;
  --border: #252d3d;
  --accent: #4f8ef7;
  --accent2: #7c5cbf;
  --success: #2dd4a0;
  --danger: #f75a5a;
  --text: #e8ecf4;
  --muted: #6b7a99;
  --radius: 12px;
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(79,142,247,0.07) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 100%, rgba(124,92,191,0.07) 0%, transparent 60%);
}

/* ══ LOGIN ══ */
#login-view {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  width: 100%;
  max-width: 420px;
  padding: 40px 36px 36px;
  box-shadow: 0 40px 100px rgba(0,0,0,0.55), 0 0 0 1px rgba(79,142,247,0.06);
  animation: fadeUp 0.4s ease both;
}

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

.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 32px; }
.login-logo-icon {
  width: 40px; height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Syne', sans-serif; font-size: 1.1rem; font-weight: 800; color: #fff;
  box-shadow: 0 8px 24px rgba(79,142,247,0.35);
}
.login-logo-text { font-family: 'Syne', sans-serif; font-size: 1.5rem; font-weight: 800; letter-spacing: -0.5px; }
.login-logo-text span { color: var(--accent); }

.login-heading h2 { font-family: 'Syne', sans-serif; font-size: 1.25rem; font-weight: 700; }
.login-heading p  { color: var(--muted); font-size: 0.85rem; margin-top: 4px; }

.login-fields { margin-top: 28px; display: flex; flex-direction: column; gap: 16px; }
.field-group  { display: flex; flex-direction: column; gap: 6px; }
.field-group label { font-size: 0.75rem; font-weight: 500; color: var(--muted); letter-spacing: 0.4px; text-transform: uppercase; }

.field-wrap input {
  width: 100%; background: var(--surface2); border: 1px solid var(--border);
  border-radius: 9px; color: var(--text); font-family: 'DM Sans', sans-serif;
  font-size: 0.9rem; padding: 11px 14px; transition: border-color 0.15s, box-shadow 0.15s;
}
.field-wrap input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,142,247,0.12); }
.field-wrap input.error-field { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(247,90,90,0.1); }

.login-error {
  display: none;
  background: rgba(247,90,90,0.1); border: 1px solid rgba(247,90,90,0.25);
  color: var(--danger); font-size: 0.82rem; padding: 10px 14px; border-radius: 8px; margin-top: 4px;
}
.login-error.show { display: block; animation: fadeUp 0.2s ease; }

.btn-login {
  margin-top: 8px; width: 100%; padding: 12px; border-radius: 10px; border: none;
  background: linear-gradient(135deg, var(--accent), #3a6fd8); color: #fff;
  font-family: 'Syne', sans-serif; font-size: 0.95rem; font-weight: 700; cursor: pointer;
  letter-spacing: 0.3px; transition: all 0.18s ease;
  box-shadow: 0 6px 20px rgba(79,142,247,0.35);
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn-login:hover:not(:disabled) { transform: translateY(-1px); box-shadow: 0 10px 28px rgba(79,142,247,0.5); }
.btn-login:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }
.spinner-sm {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite; display: none;
}

/* ══ APP: NAVBAR ══ */
nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px; height: 62px;
  background: rgba(19,23,31,0.85); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
}
.nav-left { display: flex; align-items: center; gap: 24px; }
.logo {
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 1.35rem;
  letter-spacing: -0.5px; display: flex; align-items: center; gap: 8px;
}
.logo-icon {
  width: 30px; height: 30px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; font-weight: 800; color: #fff;
}
.logo-text span { color: var(--accent); }

.nav-tabs { display: flex; gap: 4px; }
.nav-tab {
  padding: 6px 14px; border-radius: 8px; font-size: 0.82rem; font-weight: 500;
  cursor: pointer; border: none; background: transparent; color: var(--muted);
  font-family: 'DM Sans', sans-serif; transition: all 0.15s;
  display: flex; align-items: center; gap: 6px;
}
.nav-tab:hover  { color: var(--text); background: var(--surface2); }
.nav-tab.active { color: var(--accent); background: rgba(79,142,247,0.1); }

.nav-right { display: flex; align-items: center; gap: 14px; }
.nav-user {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 99px; padding: 4px 14px 4px 8px;
  font-size: 0.8rem; color: var(--muted);
}
.nav-user-avatar {
  width: 24px; height: 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 0.65rem; font-weight: 700; color: #fff; text-transform: uppercase;
}
.btn-logout {
  background: transparent; border: 1px solid var(--border); color: var(--muted);
  border-radius: 8px; padding: 5px 12px; font-size: 0.78rem; cursor: pointer;
  font-family: 'DM Sans', sans-serif; display: flex; align-items: center; gap: 6px;
  transition: all 0.15s;
}
.btn-logout:hover { border-color: var(--danger); color: var(--danger); background: rgba(247,90,90,0.07); }

main { max-width: 1100px; margin: 0 auto; padding: 36px 24px 80px; }

/* ══ PAGE SECTIONS ══ */
.page-section { display: none; }
.page-section.active { display: block; animation: fadeUp 0.25s ease both; }

/* ══ HOME ══ */
.home-hero { text-align: center; padding: 48px 0 40px; }
.home-hero h1 {
  font-family: 'Syne', sans-serif;
  font-size: 2.4rem; font-weight: 800; letter-spacing: -1px;
  background: linear-gradient(135deg, var(--text) 40%, var(--accent));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 10px;
}
.home-hero p { color: var(--muted); font-size: 0.95rem; }

/* FILTER CARD */
.filter-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 16px; padding: 28px; margin-bottom: 28px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.2);
}
.filter-card-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px;
}
.filter-card-header h2 {
  font-family: 'Syne', sans-serif; font-size: 0.95rem; font-weight: 700;
  display: flex; align-items: center; gap: 8px;
}
.filter-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 14px; margin-bottom: 20px;
}
.filter-group { display: flex; flex-direction: column; gap: 5px; }
.filter-group label {
  font-size: 0.72rem; font-weight: 500; color: var(--muted);
  letter-spacing: 0.4px; text-transform: uppercase;
}
.filter-group input, .filter-group select {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem; padding: 9px 12px; transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
}
.filter-group input:focus, .filter-group select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,142,247,0.12);
}
select option { background: var(--surface); }

.filter-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; }
.filter-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; min-height: 0; }
.filter-tag {
  display: inline-flex; align-items: center; gap: 5px;
  background: rgba(79,142,247,0.12); border: 1px solid rgba(79,142,247,0.25);
  color: var(--accent); font-size: 0.75rem; padding: 3px 10px; border-radius: 99px;
}
.filter-tag button {
  background: none; border: none; cursor: pointer; color: var(--accent);
  font-size: 0.85rem; line-height: 1; padding: 0; opacity: 0.7;
}
.filter-tag button:hover { opacity: 1; }

/* RESULTS */
.results-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px;
}
.results-header h2 { font-family: 'Syne', sans-serif; font-size: 1.1rem; font-weight: 700; }
.results-count { color: var(--muted); font-size: 0.82rem; }

/* QUESTION CARDS */
.questions-list { display: flex; flex-direction: column; gap: 10px; }
.q-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 18px 20px;
  transition: border-color 0.15s, box-shadow 0.15s; cursor: default;
}
.q-card:hover { border-color: rgba(79,142,247,0.3); box-shadow: 0 4px 20px rgba(79,142,247,0.06); }
.q-card-top {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 12px; margin-bottom: 10px;
}
.q-card-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.q-card-body { color: var(--text); font-size: 0.875rem; line-height: 1.55; }
.q-card-body-clamp {
  display: -webkit-box; -webkit-line-clamp: 3;
  -webkit-box-orient: vertical; overflow: hidden;
}
.q-card-footer { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }
.q-card-gabarito { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--muted); }
.gabarito-pill {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 6px;
  background: linear-gradient(135deg, var(--success), #1aaa7a);
  color: #fff; font-weight: 700; font-size: 0.78rem;
}

/* HOME PAGINATION */
.home-pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 0 0; font-size: 0.82rem; color: var(--muted); flex-wrap: wrap; gap: 10px;
}

/* ══ ADMIN ══ */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 28px; flex-wrap: wrap; gap: 12px;
}
.toolbar-left h1 { font-family: 'Syne', sans-serif; font-size: 1.5rem; font-weight: 700; }
.toolbar-left p  { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }

/* BUTTONS */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 9px 20px; border-radius: 9px; font-size: 0.875rem;
  font-weight: 500; cursor: pointer; border: none;
  transition: all 0.18s ease; font-family: 'DM Sans', sans-serif;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), #3a6fd8);
  color: #fff; box-shadow: 0 4px 18px rgba(79,142,247,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 6px 24px rgba(79,142,247,0.45); }
.btn-ghost  { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--border); }
.btn-danger { background: rgba(247,90,90,0.15); color: var(--danger); border: 1px solid rgba(247,90,90,0.25); }
.btn-danger:hover { background: rgba(247,90,90,0.25); }
.btn-sm  { padding: 6px 14px; font-size: 0.8rem; }
.btn-xs  { padding: 4px 10px; font-size: 0.75rem; border-radius: 7px; }

/* TABLE */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead tr { background: var(--surface2); }
th {
  text-align: left; padding: 13px 16px;
  font-family: 'Syne', sans-serif; font-size: 0.72rem; font-weight: 600;
  letter-spacing: 0.8px; text-transform: uppercase; color: var(--muted);
  border-bottom: 1px solid var(--border);
}
tbody tr { border-bottom: 1px solid rgba(37,45,61,0.6); transition: background 0.13s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: rgba(79,142,247,0.04); }
td { padding: 13px 16px; color: var(--text); vertical-align: middle; }
td.muted { color: var(--muted); font-size: 0.8rem; }

/* BADGES */
.badge { display: inline-block; padding: 3px 9px; border-radius: 6px; font-size: 0.72rem; font-weight: 600; letter-spacing: 0.3px; }
.badge-blue   { background: rgba(79,142,247,0.15); color: var(--accent); }
.badge-purple { background: rgba(124,92,191,0.15); color: #9d7de8; }
.badge-green  { background: rgba(45,212,160,0.15); color: var(--success); }
.badge-gray   { background: rgba(107,122,153,0.15); color: var(--muted); }

.enunciado-cell { max-width: 320px; }
.enunciado-text {
  display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; overflow: hidden; line-height: 1.45;
}

/* PAGINATION */
.pagination {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-top: 1px solid var(--border);
  font-size: 0.82rem; color: var(--muted); flex-wrap: wrap; gap: 10px;
}
.page-btns { display: flex; gap: 6px; align-items: center; }
.page-btn {
  width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface2); color: var(--text); cursor: pointer; font-size: 0.82rem;
  display: flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.page-btn:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn.active  { background: var(--accent); border-color: var(--accent); color: #fff; }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* LOADING / EMPTY */
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 50px; color: var(--muted); }
.spinner {
  width: 20px; height: 20px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); }
.empty-state .icon { font-size: 2.5rem; margin-bottom: 12px; }
.empty-state p { font-size: 0.9rem; }
.empty-state p.sub { font-size: 0.8rem; margin-top: 4px; opacity: 0.7; }

/* ══ MODALS ══ */
.overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(7,9,14,0.75); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.overlay.open { opacity: 1; pointer-events: all; }
.modal {
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  width: 100%; max-width: 720px; max-height: 90vh;
  display: flex; flex-direction: column;
  transform: translateY(16px) scale(0.98); transition: transform 0.22s ease;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6);
}
.overlay.open .modal { transform: translateY(0) scale(1); }
.modal-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-family: 'Syne', sans-serif; font-size: 1.1rem; font-weight: 700; }
.close-btn {
  width: 32px; height: 32px; border-radius: 8px; background: var(--surface2);
  border: 1px solid var(--border); color: var(--muted); cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center; transition: all 0.15s;
}
.close-btn:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.modal-body { padding: 24px; overflow-y: auto; flex: 1; }
.modal-footer {
  padding: 16px 24px; border-top: 1px solid var(--border);
  display: flex; gap: 10px; justify-content: flex-end;
}

/* FORM */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid .full { grid-column: 1 / -1; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
label { font-size: 0.78rem; font-weight: 500; color: var(--muted); letter-spacing: 0.3px; text-transform: uppercase; }
input, textarea, select {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font-family: 'DM Sans', sans-serif;
  font-size: 0.875rem; padding: 9px 12px; transition: border-color 0.15s; width: 100%;
}
input:focus, textarea:focus, select:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,142,247,0.12);
}
textarea { resize: vertical; min-height: 72px; }
select option { background: var(--surface); }

.section-label {
  font-family: 'Syne', sans-serif; font-size: 0.7rem; font-weight: 600;
  color: var(--accent); text-transform: uppercase; letter-spacing: 1px;
  margin: 20px 0 12px; border-bottom: 1px solid var(--border); padding-bottom: 8px;
}

/* ══ DETAIL MODAL ══ */
.detail-modal { max-width: 800px; }
.detail-meta-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 20px; }
.detail-meta-item {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px;
}
.detail-meta-item .meta-label { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 3px; }
.detail-meta-item .meta-value { font-size: 0.875rem; font-weight: 500; color: var(--text); }

.detail-section { margin-bottom: 20px; }
.detail-section-title {
  font-family: 'Syne', sans-serif; font-size: 0.7rem; font-weight: 600;
  color: var(--accent); text-transform: uppercase; letter-spacing: 1px;
  margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--border);
}
.detail-text {
  font-size: 0.9rem; line-height: 1.65; color: var(--text);
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px 16px;
}
.detail-apoio {
  font-size: 0.85rem; line-height: 1.6; color: var(--muted);
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px 16px; border-left: 3px solid var(--accent2);
}
.alternativas-list { display: flex; flex-direction: column; gap: 8px; }
.alternativa-item {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 14px; font-size: 0.875rem; transition: border-color 0.15s;
}
.alternativa-item.correct { border-color: rgba(45,212,160,0.4); background: rgba(45,212,160,0.05); }
.alt-letter {
  font-family: 'Syne', sans-serif; font-weight: 700; font-size: 0.8rem;
  width: 22px; height: 22px; min-width: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px; background: var(--border); color: var(--muted);
}
.alternativa-item.correct .alt-letter { background: linear-gradient(135deg, var(--success), #1aaa7a); color: #fff; }
.alt-text { line-height: 1.5; color: var(--text); }
.detail-comentario {
  font-size: 0.875rem; line-height: 1.65; color: var(--text);
  background: rgba(79,142,247,0.05); border: 1px solid rgba(79,142,247,0.15);
  border-radius: 8px; padding: 14px 16px; border-left: 3px solid var(--accent);
}
.detail-figura img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); }

/* ══ TOAST ══ */
.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 400;
  padding: 12px 20px; border-radius: 10px; font-size: 0.875rem; font-weight: 500;
  display: flex; align-items: center; gap: 8px;
  transform: translateY(80px); opacity: 0;
  transition: all 0.3s cubic-bezier(0.34,1.56,0.64,1); pointer-events: none;
}
.toast.show { transform: translateY(0); opacity: 1; }
.toast.success { background: rgba(45,212,160,0.15); border: 1px solid rgba(45,212,160,0.3); color: var(--success); }
.toast.error   { background: rgba(247,90,90,0.15);  border: 1px solid rgba(247,90,90,0.3);  color: var(--danger); }

/* ══ RESPONSIVE ══ */
@media (max-width: 768px) {
  .filter-grid      { grid-template-columns: 1fr 1fr; }
  .detail-meta-grid { grid-template-columns: 1fr 1fr; }
  .form-grid        { grid-template-columns: 1fr; }
  nav               { padding: 0 16px; }
  .nav-tabs         { display: none; }
  main              { padding: 20px 12px 60px; }
  .login-card       { padding: 28px 20px 24px; }
  .home-hero h1     { font-size: 1.8rem; }
}
@media (max-width: 480px) {
  .filter-grid      { grid-template-columns: 1fr; }
  .detail-meta-grid { grid-template-columns: 1fr; }
}

/* Firefox */
* {
  scrollbar-width: thin; /* auto | thin | none */
  scrollbar-color: #7c6cff #111118; /* thumb | track */
}

/* Chrome, Edge, Safari */
*::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

*::-webkit-scrollbar-track {
  background: #111118;
}

*::-webkit-scrollbar-thumb {
  background: #7c6cff;
  border-radius: 10px;
}

*::-webkit-scrollbar-thumb:hover {
  background: #9b8cff;
}

/* ---------- STATS CARDS GRID ---------- */
.stats-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.stats-card {
  background: var(--card, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 20px 18px 16px;
  position: relative;
  overflow: hidden;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: default;
  animation: fadeUpCard 0.35s ease both;
}

.stats-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}

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

.stats-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-color, #6366f1);
  border-radius: 12px 12px 0 0;
}

.stats-card-icon {
  font-size: 22px;
  margin-bottom: 10px;
  display: block;
  opacity: 0.85;
}

.stats-card-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted, #6b7280);
  margin-bottom: 6px;
  font-weight: 600;
}

.stats-card-value {
  font-size: 2rem;
  font-weight: 700;
  color: #6b6b80;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.stats-card-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  margin-top: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 20px;
}

.stats-card-delta.up {
  background: rgba(16, 185, 129, 0.1);
  color: #059669;
}

.stats-card-delta.down {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.stats-card-delta.neutral {
  background: rgba(107, 114, 128, 0.1);
  color: var(--muted, #6b7280);
}

/* Skeleton */
.stats-card-skeleton {
  background: var(--card, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  height: 120px;
  position: relative;
  overflow: hidden;
}

.stats-card-skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(0,0,0,0.04) 50%, transparent 100%);
  background-size: 200% 100%;
  animation: shimmerSkeleton 1.4s ease infinite;
}

@keyframes shimmerSkeleton {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* ---------- CHART ---------- */
.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border, #e5e7eb);
  flex-wrap: wrap;
  gap: 12px;
}

.chart-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text, #111827);
  margin: 0 0 3px;
}

.chart-sub {
  font-size: 0.75rem;
  color: var(--muted, #6b7280);
  margin: 0;
}

.chart-toggles {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.chart-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid transparent;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  background: var(--bg, #f9fafb);
  color: var(--muted, #6b7280);
}

.chart-toggle-btn.active {
  color: var(--btn-color);
  border-color: var(--btn-color);
  background: var(--btn-bg);
}

.chart-toggle-btn .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
}

.chart-area {
  padding: 20px 16px 16px;
  position: relative;
  min-height: 300px;
}

.chart-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-size: 0.8rem;
  color: var(--muted, #6b7280);
  background: var(--card, #fff);
  z-index: 2;
  border-radius: 0 0 8px 8px;
}

.chart-loading.hidden { display: none; }

#stats-canvas {
  width: 100% !important;
  display: block;
}

/* ---------- EMPTY STATE ---------- */
.stats-empty {
  text-align: center;
  padding: 60px 24px;
  color: var(--muted, #6b7280);
}

.stats-empty svg { opacity: 0.3; margin-bottom: 12px; }
.stats-empty p { font-size: 0.85rem; }
