﻿:root {
  --bg: #060b18;
  --bg-2: #0a1630;
  --surface: rgba(15, 27, 53, 0.76);
  --surface-2: rgba(26, 41, 74, 0.82);
  --text: #ffffff;
  --muted: #f59e0b;
  --line: rgba(147, 197, 253, 0.26);
  --brand: #3b82f6;
  --brand-2: #6366f1;
  --glow: 0 0 0 1px rgba(96,165,250,.25), 0 12px 34px rgba(59,130,246,.22);
}

html[data-theme="light"] {
  --bg: #eaf0ff;
  --bg-2: #dde6fb;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-2: rgba(243, 247, 255, 0.95);
  --text: #122244;
  --muted: #d97706;
  --line: rgba(25, 62, 129, 0.2);
  --brand: #295fbe;
  --brand-2: #5a6ff0;
  --glow: 0 0 0 1px rgba(37,99,235,.2), 0 12px 26px rgba(37,99,235,.18);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  font-family: "Manrope", sans-serif;
  background:
    radial-gradient(circle at 12% 14%, rgba(59,130,246,0.3), transparent 36%),
    radial-gradient(circle at 88% 84%, rgba(99,102,241,0.25), transparent 30%),
    linear-gradient(145deg, var(--bg), var(--bg-2));
}

h1,h2,h3,h4,h5,.card-title { color: #fff; text-shadow: 0 0 18px rgba(96,165,250,.26); }
.brand-title { color: #ffffff !important; text-shadow: 0 0 16px rgba(251, 191, 36, .35), 0 0 26px rgba(59,130,246,.32); }
html[data-theme="light"] h1, html[data-theme="light"] h2, html[data-theme="light"] h3, html[data-theme="light"] h4, html[data-theme="light"] h5, html[data-theme="light"] .card-title { color: #11294d; text-shadow: none; }
html[data-theme="light"] .brand-title { color: #132a4f !important; text-shadow: none; }
.text-muted, small, .small { color: var(--muted) !important; }

.login-shell { min-height: 100vh; display: grid; place-items: center; }
.login-card {
  width: min(430px, 92vw);
  border-radius: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  box-shadow: var(--glow);
}
.logo-mark,.brand-badge {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: #fff;
  background: linear-gradient(140deg, #1e40af, #4f46e5 55%, #06b6d4);
  box-shadow: 0 8px 24px rgba(79,70,229,.45);
}

.btn {
  border-radius: 12px;
  transition: transform .22s ease, box-shadow .28s ease, filter .22s ease, background .2s;
}
.btn:hover { transform: translateY(-1px); }
.btn-brand {
  border: 0;
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #4f46e5 52%, #06b6d4);
  box-shadow: 0 10px 24px rgba(37,99,235,.45);
}
.btn-brand:hover {
  filter: brightness(1.08);
  box-shadow: 0 0 24px rgba(56,189,248,.45), 0 14px 34px rgba(37,99,235,.5);
}
.btn-outline-light, .btn-outline-info, .btn-outline-success, .btn-outline-danger {
  border-color: var(--line);
}

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 280px 1fr; }
.sidebar {
  background: rgba(7, 14, 30, .72);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(14px);
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.sidebar-brand h2 { margin: 0; font-size: 1.1rem; font-weight: 800; }
.sidebar-brand small { color: var(--muted); }
.sidebar-nav .nav-link {
  border: 0;
  text-align: left;
  color: var(--text);
  border-radius: 12px;
  padding: .72rem .85rem;
  display: flex;
  gap: .55rem;
  margin-bottom: .35rem;
}
.sidebar-nav .nav-link.active,
.sidebar-nav .nav-link:hover {
  color: #fff;
  background: linear-gradient(135deg, #1d4ed8, #4338ca);
  box-shadow: 0 10px 24px rgba(29,78,216,.35);
}

.main-content { padding: 1.2rem; }
.topbar, .card, .modal-content, .report-paper {
  background: var(--surface);
  border: 1px solid var(--line) !important;
  border-radius: 16px !important;
  backdrop-filter: blur(16px);
  box-shadow: var(--glow);
}
.topbar { padding: .85rem 1rem; margin-bottom: 1rem; display: flex; gap: .7rem; align-items: center; }

.metric-card {
  color: #fff;
  border-radius: 14px;
  padding: 1rem;
  box-shadow: 0 14px 28px rgba(2, 8, 23, .45);
}
.metric-card h6 { margin-bottom: .45rem; text-transform: uppercase; letter-spacing: .4px; }
.metric-card p { margin: 0; font-size: 2rem; font-weight: 800; }
.metric-admin { background: linear-gradient(135deg, #1d4ed8, #1e3a8a); }
.metric-agency { background: linear-gradient(135deg, #2563eb, #0ea5e9); }
.metric-new { background: linear-gradient(135deg, #059669, #22c55e); }
.metric-report { background: linear-gradient(135deg, #d97706, #f59e0b); }

.ranking-list { display: grid; gap: .82rem; }
.ranking-item { display: grid; grid-template-columns: 160px 1fr 34px; gap: .7rem; align-items: center; font-weight: 700; }
.ranking-bar { height: 12px; background: rgba(148,163,184,.2); border-radius: 999px; overflow: hidden; }
.ranking-bar > span { display: block; height: 100%; background: linear-gradient(90deg, #2563eb, #06b6d4); box-shadow: 0 0 18px rgba(56,189,248,.5); }
.activity-box {
  background: linear-gradient(160deg, rgba(37,99,235,.24), rgba(6,182,212,.15));
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  min-height: 110px;
  box-shadow: inset 0 0 20px rgba(56,189,248,.12);
}
.activity-box:disabled { opacity: .8; cursor: default; }

.form-control, .form-select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--line);
}
.form-label { color: var(--muted); font-weight: 600; }
.form-control::placeholder { color: color-mix(in oklab, var(--muted) 82%, #fff 18%); }
.form-control:focus, .form-select:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 0 .2rem rgba(96,165,250,.24), 0 0 20px rgba(59,130,246,.24);
}

html[data-theme="dark"] .table,
html[data-theme="dark"] .table th,
html[data-theme="dark"] .table td,
html[data-theme="dark"] .form-control,
html[data-theme="dark"] .form-select,
html[data-theme="dark"] .modal-title,
html[data-theme="dark"] .btn-outline-light,
html[data-theme="dark"] .btn-outline-info,
html[data-theme="dark"] .btn-outline-success {
  color: #f5f7ff !important;
}
html[data-theme="dark"] .form-control::placeholder {
  color: #ffb84d;
  opacity: .88;
}
html[data-theme="dark"] .form-control:focus,
html[data-theme="dark"] .form-select:focus,
html[data-theme="dark"] .form-control:active,
html[data-theme="dark"] .form-select:active {
  background: rgba(34, 53, 92, 0.94) !important;
  color: #ffffff !important;
}
html[data-theme="dark"] input:-webkit-autofill,
html[data-theme="dark"] input:-webkit-autofill:hover,
html[data-theme="dark"] input:-webkit-autofill:focus,
html[data-theme="dark"] textarea:-webkit-autofill,
html[data-theme="dark"] select:-webkit-autofill {
  -webkit-text-fill-color: #ffffff !important;
  box-shadow: 0 0 0 1000px rgba(34, 53, 92, 0.94) inset !important;
  transition: background-color 600000s 0s, color 600000s 0s;
}
html[data-theme="dark"] .form-control[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(1.2);
}
html[data-theme="dark"] .table thead th {
  color: #ffd08a !important;
}
html[data-theme="dark"] .topbar small,
html[data-theme="dark"] .sidebar-brand small,
html[data-theme="dark"] .small,
html[data-theme="dark"] .text-muted {
  color: #ffad33 !important;
}
html[data-theme="dark"] .report-doc,
html[data-theme="dark"] .report-doc * {
  color: #0f2a59 !important;
  text-shadow: none !important;
}
html[data-theme="dark"] .report-doc .report-table-wrap thead th {
  color: #ffffff !important;
  background: #173a73 !important;
}
html[data-theme="dark"] .report-doc .r-chip.info { color: #123d7c !important; }
html[data-theme="dark"] .report-doc .r-chip.ok { color: #118050 !important; }
html[data-theme="dark"] .report-doc .r-chip.warn { color: #ad6a09 !important; }

.table { --bs-table-bg: transparent; --bs-table-color: var(--text); --bs-table-border-color: rgba(148,163,184,.22); }
.admin-table tbody tr:hover { background: rgba(56,189,248,.08); }
.badge-new { background: rgba(16,185,129,.22); color: #6ee7b7; border-radius: 999px; padding: .3rem .55rem; }

.section-panel { animation: rise .32s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.reveal-item {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity .58s ease, transform .58s ease;
  transition-delay: var(--reveal-delay, 0ms);
}
.reveal-item.in-view {
  opacity: 1;
  transform: translateY(0);
}

.report-paper { padding: 1.6rem; min-height: 360px; }
.report-doc { background: #ffffff; border: 1px solid #d9e3f4; border-radius: 18px; padding: 1.2rem; color: #0f2a59; }
.report-top { display: flex; justify-content: space-between; gap: .8rem; border-bottom: 3px solid #163a78; padding-bottom: .9rem; margin-bottom: .9rem; }
.report-brand { font-size: 2rem; font-weight: 800; line-height: 1; display: flex; align-items: center; gap: .5rem; text-shadow: none; color: #0f2a59; }
.report-sub { color: #4a658f; font-weight: 600; }
.report-chip-row,.report-mini { display: flex; flex-wrap: wrap; gap: .55rem; margin-bottom: 1rem; }
.r-chip { border-radius: 999px; padding: .4rem .82rem; font-weight: 700; font-size: .94rem; }
.r-chip.info { background: #e4ebf7; color: #123d7c; }
.r-chip.ok { background: #dbeedf; color: #118050; }
.r-chip.warn { background: #f4e8d6; color: #ad6a09; }
.report-admin h5 { font-size: 1.35rem; font-weight: 800; border-left: 4px solid #3874df; padding-left: .55rem; margin-bottom: .6rem; color: #0f2a59; text-shadow: none; }
.report-table-wrap { border-radius: 10px; overflow: hidden; border: 1px solid #d7dfed; }
.report-table-wrap thead th { background: #173a73; color: #fff; }
.report-table-wrap tbody tr:nth-child(even) { background: #eef3fb; }
.report-table-wrap tbody td { color: #112f63; font-weight: 600; }
.report-note { color: #3f5f93; font-weight: 700; margin-top: .55rem; }
.report-foot { border-top: 1px solid #d3ddef; margin-top: 1.1rem; padding-top: .8rem; text-align: center; color: #607aa1; font-weight: 600; }

@media (max-width: 991px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -300px; top: 0; width: 280px; min-height: 100vh; z-index: 1050; transition: .22s ease; }
  .sidebar.open { left: 0; }
  .ranking-item { grid-template-columns: 110px 1fr 26px; font-size: .86rem; }
}
