@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Manrope:wght@600;700;800&display=swap');

:root {
  --primary: #6366f1;
  --primary-dark: #4338ca;
  --accent: #22d3ee;
  --accent-dark: #0891b2;
  --bg-1: #0b1020;
  --bg-2: #161233;
  --bg-3: #0e1b3a;
  --glass: rgba(255, 255, 255, 0.07);
  --glass-strong: rgba(255, 255, 255, 0.11);
  --glass-border: rgba(255, 255, 255, 0.13);
  --text: #f1f5f9;
  --text-dim: #94a3b8;
  --text-faint: #64748b;
  --ok: #34d399;
  --warn: #fbbf24;
  --danger: #f87171;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow-soft: 0 8px 32px rgba(0,0,0,0.28);
  --shadow-lift: 0 16px 48px rgba(0,0,0,0.38);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Inter', -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  background: var(--bg-1);
  position: relative;
}

/* Layered animated gradient "aurora" background - subtle, slow-moving glow blobs */
body::before, body::after {
  content: '';
  position: fixed;
  z-index: -1;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.55;
  pointer-events: none;
}
body::before {
  width: 640px; height: 640px;
  top: -180px; left: -120px;
  background: radial-gradient(circle, rgba(99,102,241,0.55), transparent 70%);
  animation: float1 22s ease-in-out infinite;
}
body::after {
  width: 560px; height: 560px;
  bottom: -160px; right: -100px;
  background: radial-gradient(circle, rgba(34,211,238,0.4), transparent 70%);
  animation: float2 26s ease-in-out infinite;
}
@keyframes float1 {
  0%, 100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(60px, 40px) scale(1.08); }
}
@keyframes float2 {
  0%, 100% { transform: translate(0,0) scale(1); }
  50% { transform: translate(-50px, -30px) scale(1.06); }
}
html {
  background:
    radial-gradient(1400px 700px at 15% -10%, rgba(99,102,241,.16), transparent),
    radial-gradient(1100px 600px at 105% 15%, rgba(34,211,238,.12), transparent),
    linear-gradient(165deg, var(--bg-1), var(--bg-2) 55%, var(--bg-3));
  background-attachment: fixed;
}

a { color: inherit; }
h1, h2, h3 { font-family: 'Manrope', 'Inter', sans-serif; letter-spacing: -0.01em; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  flex-shrink: 0;
  padding: 22px 14px;
  background: rgba(12, 14, 28, 0.55);
  border-right: 1px solid var(--glass-border);
  backdrop-filter: blur(22px) saturate(140%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 6px 10px 24px 10px;
  font-family: 'Manrope', sans-serif;
  font-weight: 800;
  font-size: 17.5px;
  letter-spacing: -0.01em;
}
.brand img.brand-logo {
  width: 32px; height: 32px;
  filter: drop-shadow(0 0 10px rgba(99,102,241,.6));
}
.brand .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  box-shadow: 0 0 14px var(--accent);
}

.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 14px; border-radius: 11px;
  color: var(--text-dim); text-decoration: none; font-size: 14px; font-weight: 500;
  transition: background .18s, color .18s, transform .15s;
  position: relative;
}
.nav-link .ico { width: 18px; display: inline-flex; justify-content: center; opacity: .85; }
.nav-link:hover { background: var(--glass); color: var(--text); transform: translateX(2px); }
.nav-link.active {
  background: linear-gradient(135deg, rgba(99,102,241,.4), rgba(34,211,238,.22));
  color: #fff;
  box-shadow: 0 4px 18px rgba(99,102,241,.25), inset 0 0 0 1px rgba(255,255,255,0.08);
}

.nav-spacer { flex: 1; }

.main {
  flex: 1;
  padding: 34px 42px 60px 42px;
  max-width: 1440px;
}

.topbar {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 30px;
  animation: fadeInUp .4s ease-out;
}
.topbar h1 {
  font-size: 25px; margin: 0; font-weight: 800;
  background: linear-gradient(135deg, #fff, #cbd5e1);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.topbar .sub { color: var(--text-dim); font-size: 13.5px; margin-top: 5px; }

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

.card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(130%);
  box-shadow: var(--shadow-soft);
  padding: 22px;
  transition: box-shadow .22s ease, transform .22s ease, border-color .22s ease;
  animation: fadeInUp .35s ease-out;
}
.card:hover {
  box-shadow: var(--shadow-lift);
  border-color: rgba(255,255,255,0.22);
}

.grid { display: grid; gap: 18px; }
.grid.cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid.cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid.cols-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 1100px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 700px) {
  .grid.cols-2, .grid.cols-3, .grid.cols-4 { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 20px; }
}

.stat-label { color: var(--text-dim); font-size: 12px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; }
.stat-value { font-size: 28px; font-weight: 800; margin-top: 6px; font-family: 'Manrope', sans-serif; }
.stat-icon {
  width: 38px; height: 38px; border-radius: 11px; display: flex; align-items: center; justify-content: center;
  font-size: 18px; background: linear-gradient(135deg, rgba(99,102,241,.3), rgba(34,211,238,.18));
  margin-bottom: 10px;
}

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4.5px 12px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  letter-spacing: .02em;
}
.pill.ok { background: rgba(52,211,153,.14); color: var(--ok); box-shadow: inset 0 0 0 1px rgba(52,211,153,.25); }
.pill.warn { background: rgba(251,191,36,.14); color: var(--warn); box-shadow: inset 0 0 0 1px rgba(251,191,36,.25); }
.pill.danger { background: rgba(248,113,113,.14); color: var(--danger); box-shadow: inset 0 0 0 1px rgba(248,113,113,.25); }
.pill.neutral { background: rgba(148,163,184,.14); color: var(--text-dim); box-shadow: inset 0 0 0 1px rgba(148,163,184,.2); }
.pill .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 6px currentColor; }
.pill.pulse .dot { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11.5px 21px; border-radius: 11px; border: none; cursor: pointer;
  font-weight: 650; font-size: 14px; transition: transform .12s, filter .18s, box-shadow .18s;
  text-decoration: none; font-family: inherit;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; box-shadow: 0 6px 20px rgba(99,102,241,.35); }
.btn-primary:hover { filter: brightness(1.12); box-shadow: 0 8px 26px rgba(99,102,241,.5); }
.btn-accent { background: linear-gradient(135deg, var(--accent), var(--accent-dark)); color: #06222a; box-shadow: 0 6px 20px rgba(34,211,238,.3); }
.btn-accent:hover { filter: brightness(1.08); }
.btn-danger { background: linear-gradient(135deg, #ef4444, #b91c1c); color: #fff; box-shadow: 0 6px 20px rgba(239,68,68,.3); }
.btn-danger:hover { filter: brightness(1.1); }
.btn-ghost { background: var(--glass); border: 1px solid var(--glass-border); color: var(--text); }
.btn-ghost:hover { background: var(--glass-strong); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; box-shadow: none; }
.btn.sm { padding: 8px 14px; font-size: 12.5px; border-radius: 9px; }

label { font-size: 12.5px; color: var(--text-dim); display: block; margin-bottom: 7px; font-weight: 600; letter-spacing: .01em; }
input, select, textarea {
  width: 100%; padding: 11.5px 14px; border-radius: 11px;
  border: 1px solid var(--glass-border); background: rgba(255,255,255,0.045);
  color: var(--text); font-size: 14px; outline: none; transition: border-color .18s, box-shadow .18s, background .18s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); background: rgba(255,255,255,0.07); box-shadow: 0 0 0 3px rgba(34,211,238,.14); }
input::placeholder { color: #5b6b85; }
input[type=color] { padding: 4px; height: 44px; cursor: pointer; }
textarea { font-family: 'SF Mono', Consolas, monospace; font-size: 12.5px; resize: vertical; min-height: 60px; }
.field { margin-bottom: 17px; }
.checkbox-row { display: flex; align-items: center; gap: 10px; }
.checkbox-row input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; }

/* Dropdowns: forced to a light background with solid BLACK text, for both
   the closed box and every <option> in the popup list. An earlier
   dark-background approach still rendered as low-contrast/faint in some
   browsers, because the native option-list popup is a separate OS-rendered
   layer that doesn't reliably respect custom dark styling. A light
   background + explicit black text is the one combination every browser
   renders consistently and legibly, so we use that here rather than
   fighting browser quirks further. */
select {
  background-color: #f1f5f9;
  color: #0f172a;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  font-weight: 600;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='none' stroke='%23334155' stroke-width='2'%3E%3Cpath d='M6 8l4 4 4-4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
  border-color: rgba(255,255,255,0.3);
}
select:focus { background-color: #ffffff; }
select option {
  background-color: #ffffff;
  color: #0f172a;
  font-weight: 600;
  padding: 10px;
}
select option:checked, select option:hover {
  background-color: var(--primary);
  color: #ffffff;
}

table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; color: var(--text-dim); font-weight: 700; padding: 11px 14px; border-bottom: 1px solid var(--glass-border); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
td { padding: 13px 14px; border-bottom: 1px solid rgba(255,255,255,0.055); }
tr { transition: background .15s; }
tbody tr:hover { background: rgba(255,255,255,0.03); }
tr:last-child td { border-bottom: none; }

.toast-wrap { position: fixed; top: 20px; right: 20px; z-index: 999; display: flex; flex-direction: column; gap: 10px; }
.toast {
  padding: 14px 20px; border-radius: 13px; font-size: 14px; font-weight: 500;
  background: rgba(15,18,32,0.92); border: 1px solid var(--glass-border);
  box-shadow: 0 10px 30px rgba(0,0,0,.45); min-width: 270px;
  backdrop-filter: blur(14px);
  animation: slidein .25s cubic-bezier(.16,1,.3,1);
}
.toast.success { border-left: 3px solid var(--ok); }
.toast.error { border-left: 3px solid var(--danger); }
@keyframes slidein { from { opacity:0; transform: translateX(24px) scale(.97);} to {opacity:1; transform:translateX(0) scale(1);} }

.center-screen {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.auth-card { width: 400px; max-width: 100%; padding: 40px 34px; animation: fadeInUp .5s cubic-bezier(.16,1,.3,1); }
.auth-card .brand { justify-content: center; margin-bottom: 24px; padding: 0; font-size: 21px; }
.auth-card h2 { text-align: center; margin: 0 0 5px 0; font-size: 21px; }
.auth-card p.sub { text-align: center; color: var(--text-dim); font-size: 13.5px; margin: 0 0 26px 0; }

.progress-bar { height: 8px; border-radius: 99px; background: rgba(255,255,255,0.07); overflow: hidden; box-shadow: inset 0 1px 3px rgba(0,0,0,.3); }
.progress-bar > div { height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--primary)); transition: width .5s ease; }

.helper-text { color: var(--text-dim); font-size: 12.5px; margin-top: 6px; line-height: 1.5; }
.section-title { font-size: 15.5px; font-weight: 700; margin: 0 0 16px 0; display: flex; align-items: center; gap: 9px; font-family: 'Manrope', sans-serif; }
.divider { height: 1px; background: linear-gradient(90deg, transparent, var(--glass-border), transparent); margin: 24px 0; }

.tabs { display: flex; gap: 7px; margin-bottom: 22px; flex-wrap: wrap; }
.tab-btn {
  padding: 9.5px 17px; border-radius: 11px; border: 1px solid var(--glass-border);
  background: rgba(255,255,255,0.03); color: var(--text-dim); cursor: pointer; font-size: 13.5px; font-weight: 650;
  transition: all .18s; font-family: inherit;
}
.tab-btn:hover { background: rgba(255,255,255,0.07); color: var(--text); }
.tab-btn.active { background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; border-color: transparent; box-shadow: 0 4px 16px rgba(99,102,241,.35); }

.empty-state { text-align: center; padding: 54px 20px; color: var(--text-dim); }
.empty-state .emoji { font-size: 34px; display: block; margin-bottom: 10px; opacity: .7; }
.badge-ap { display: inline-flex; align-items:center; gap:5px; font-size:11.5px; padding: 4px 10px; border-radius: 8px; background: rgba(255,255,255,0.055); margin: 2px; font-weight: 500; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(5,7,15,0.65); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal { width: 460px; max-width: 92vw; }

.link-btn { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 13px; font-weight: 650; padding: 0; }
.link-btn:hover { text-decoration: underline; }

.unit-card { position: relative; overflow: hidden; cursor: pointer; }
.unit-card::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: linear-gradient(90deg, var(--accent), var(--primary));
  opacity: 0; transition: opacity .2s;
}
.unit-card:hover::before { opacity: 1; }
.unit-card:hover { transform: translateY(-2px); }

.sparkline { display: block; width: 100%; height: 34px; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.12); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 37%, rgba(255,255,255,0.05) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
  border-radius: 8px;
}
@keyframes shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

.warn-banner {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; border-radius: 9px; font-size: 11.5px; font-weight: 600;
  background: rgba(251,191,36,.12); color: var(--warn); box-shadow: inset 0 0 0 1px rgba(251,191,36,.25);
  margin-top: 10px;
}

.issue-banner {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 10px 13px; border-radius: 10px; font-size: 12.5px; font-weight: 500;
  background: rgba(248,113,113,.1); color: #fca5a5; box-shadow: inset 0 0 0 1px rgba(248,113,113,.2);
  margin-top: 8px; line-height: 1.5;
}

.back-link {
  display: inline-flex; align-items: center; gap: 6px; color: var(--text-dim); font-size: 13px;
  text-decoration: none; margin-bottom: 14px; font-weight: 600; transition: color .15s;
}
.back-link:hover { color: var(--text); }

.radio-chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 10px;
  background: rgba(255,255,255,0.05); font-size: 12px; margin: 3px 6px 3px 0; border: 1px solid var(--glass-border);
}

.transcript-box {
  background: rgba(0,0,0,0.4); color: #d1d5db; font-family: 'SF Mono', Consolas, monospace;
  font-size: 11.5px; padding: 14px; border-radius: 10px; overflow-x: auto; white-space: pre-wrap;
  max-height: 420px; overflow-y: auto; line-height: 1.5;
}


.summary-filter-active{
  border-color:var(--accent)!important;
  box-shadow:0 0 0 2px rgba(34,211,238,.18);
}

input[type="date"]{
  color-scheme: dark;
}
