/* ─── Variables ──────────────────────────────────────────── */
:root {
  --color-bg: #FFFFFF;
  --color-bg-alt: #F0F4F8;
  --color-text: #1A1A1A;
  --color-text-muted: #6C757D;
  --color-border: #CED4DA;
  --color-border-light: #E2E8F0;

  /* Primary */
  --color-primary: #1B3A6B;
  --color-primary-dark: #122952;
  --color-primary-light: #E8EEF8;

  /* Card accents */
  --color-blue:    #3B82F6;
  --color-green:   #10B981;
  --color-amber:   #F59E0B;
  --color-purple:  #8B5CF6;

  /* Sidebar */
  --color-sidebar-bg: #0D2137;
  --color-sidebar-link: rgba(255,255,255,.68);
  --color-sidebar-hover-bg: rgba(255,255,255,.08);
  --color-sidebar-active-bg: rgba(59,130,246,.18);
  --color-sidebar-active-text: #fff;
  --color-sidebar-active-border: #3B82F6;

  /* Status */
  --color-success-bg: #D1FAE5;
  --color-success-text: #065F46;
  --color-success-border: #6EE7B7;
  --color-error-bg: #FEE2E2;
  --color-error-text: #991B1B;
  --color-error-border: #FCA5A5;
  --color-alert-high: #DC2626;
  --color-alert-medium: #D97706;
  --color-alert-low: #5D7A8A;

  /* Layout */
  --header-height: 64px;
  --sidebar-width: 240px;
  --radius: 8px;
  --radius-sm: 4px;
  --shadow: 0 1px 4px rgba(0,0,0,.08), 0 2px 6px rgba(0,0,0,.05);
  --shadow-lg: 0 8px 30px rgba(0,0,0,.14);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, Arial, sans-serif;
  --font-size-xs: 12px;
  --font-size-sm: 14px;
  --font-size-base: 16px;
  --font-size-lg: 20px;
  --font-size-xl: 24px;
  --font-size-xxl: 36px;
}

/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { height: 100%; font-size: var(--font-size-base); }
body {
  height: 100%;
  font-family: var(--font);
  color: var(--color-text);
  background: var(--color-bg-alt);
  line-height: 1.6;
  overflow: hidden;
}
a { color: var(--color-primary); }
ul, ol { list-style: none; }
table { border-collapse: collapse; width: 100%; }
button { font-family: inherit; }
input, select { font-family: inherit; }

:focus-visible {
  outline: 3px solid var(--color-blue);
  outline-offset: 2px;
}

/* ─── App layout ─────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-areas: "header header" "sidebar main";
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) 1fr;
  height: 100vh;
  overflow: hidden;
}

/* ─── Header ─────────────────────────────────────────────── */
.header {
  grid-area: header;
  background: linear-gradient(90deg, #0D2137 0%, #1B3A6B 45%, #1e4080 100%);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 28px;
  z-index: 10;
  box-shadow: 0 2px 12px rgba(0,0,0,.3);
  position: relative;
  overflow: hidden;
}
.header::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg,
    rgba(59,130,246,.08) 0%,
    transparent 50%,
    rgba(139,92,246,.06) 100%);
  pointer-events: none;
}
.header__brand { display: flex; align-items: center; gap: 14px; flex: 1; position: relative; z-index: 1; }
.header__logout {
  display: flex; align-items: center; gap: 8px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.22);
  color: rgba(255,255,255,.9);
  border-radius: var(--radius);
  padding: 8px 16px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background .18s, border-color .18s;
  position: relative; z-index: 1;
}
.header__logout:hover {
  background: rgba(255,255,255,.2);
  border-color: rgba(255,255,255,.4);
}
.header__logout svg { width: 18px; height: 18px; }
.header__logo {
  width: 30px; height: 30px;
  stroke: rgba(255,255,255,.9);
  flex-shrink: 0;
  filter: drop-shadow(0 0 6px rgba(59,130,246,.6));
}
.header__name {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -.2px;
  line-height: 1.2;
}
.header__tagline {
  display: block;
  font-size: 12px;
  color: rgba(255,255,255,.6);
  letter-spacing: .4px;
}

/* Live indicator in header */
.header__live {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,.6);
  letter-spacing: .8px;
  text-transform: uppercase;
  margin-right: 20px;
  position: relative; z-index: 1;
}
.header__live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #10B981;
  box-shadow: 0 0 0 0 rgba(16,185,129,.6);
  animation: livePulse 2s infinite;
}
@keyframes livePulse {
  0%   { box-shadow: 0 0 0 0 rgba(16,185,129,.6); }
  70%  { box-shadow: 0 0 0 8px rgba(16,185,129,0); }
  100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  background: var(--color-sidebar-bg);
  border-right: none;
  padding: 20px 0;
  overflow-y: auto;
}
.sidebar__list { display: flex; flex-direction: column; gap: 2px; padding: 0 10px; }
.sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 16px;
  border-radius: var(--radius);
  color: var(--color-sidebar-link);
  text-decoration: none;
  font-size: var(--font-size-base);
  font-weight: 500;
  transition: background .15s, color .15s;
  border-left: 3px solid transparent;
}
.sidebar__link:hover {
  background: var(--color-sidebar-hover-bg);
  color: rgba(255,255,255,.95);
}
.sidebar__link--active {
  background: var(--color-sidebar-active-bg);
  color: var(--color-sidebar-active-text);
  font-weight: 600;
  border-left-color: var(--color-sidebar-active-border);
}
.sidebar__icon { width: 22px; height: 22px; flex-shrink: 0; stroke-width: 2; }
.sidebar__label { flex: 1; }

/* ─── Main ───────────────────────────────────────────────── */
.main {
  grid-area: main;
  padding: 32px 36px;
  overflow-y: auto;
  background: var(--color-bg-alt);
}

/* ─── Page header ────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.page-title { font-size: var(--font-size-xl); font-weight: 700; color: var(--color-text); }

/* ─── Notification ───────────────────────────────────────── */
.notification {
  position: fixed;
  top: calc(var(--header-height) + 16px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 320px;
  max-width: 600px;
  padding: 16px 24px;
  border-radius: var(--radius);
  font-size: var(--font-size-base);
  font-weight: 500;
  z-index: 500;
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: fadeInDown .25s ease;
}
@keyframes fadeInDown {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
.notification--success {
  background: var(--color-success-bg);
  color: var(--color-success-text);
  border: 1px solid var(--color-success-border);
}
.notification--error {
  background: var(--color-error-bg);
  color: var(--color-error-text);
  border: 1px solid var(--color-error-border);
}

/* ─── Summary cards ──────────────────────────────────────── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  margin-bottom: 32px;
}
.card {
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius);
  padding: 24px 28px 22px;
  box-shadow: var(--shadow);
  border-left: 4px solid var(--color-border-light);
  position: relative;
  overflow: hidden;
  animation: fadeInUp .35s ease both;
  transition: transform .18s, box-shadow .18s;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0,0,0,.1);
}
.card:nth-child(1) { animation-delay: .00s; border-left-color: var(--color-blue); }
.card:nth-child(2) { animation-delay: .06s; border-left-color: var(--color-green); }
.card:nth-child(3) { animation-delay: .12s; border-left-color: var(--color-amber); }
.card:nth-child(4) { animation-delay: .18s; border-left-color: var(--color-purple); }

.card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 80px; height: 80px;
  border-radius: 50%;
  opacity: .05;
  transform: translate(20px, -20px);
}
.card:nth-child(1)::before { background: var(--color-blue); }
.card:nth-child(2)::before { background: var(--color-green); }
.card:nth-child(3)::before { background: var(--color-amber); }
.card:nth-child(4)::before { background: var(--color-purple); }

.card--skeleton {
  min-height: 108px;
  background: linear-gradient(90deg, #E8EFF6 25%, #D4E0EE 50%, #E8EFF6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border: 1px solid var(--color-border-light);
  border-left: 4px solid var(--color-border-light);
}
@keyframes shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.card__label {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 10px;
}
.card__value {
  font-size: var(--font-size-xxl);
  font-weight: 700;
  color: var(--color-text);
  line-height: 1;
}
.card:nth-child(1) .card__value { color: var(--color-blue); }
.card:nth-child(2) .card__value { color: var(--color-green); }
.card:nth-child(3) .card__value { color: var(--color-amber); }
.card:nth-child(4) .card__value { color: var(--color-purple); }

.card--alert-active .card__value { animation: alertPulse 2s ease-in-out infinite; }
@keyframes alertPulse {
  0%, 100% { color: var(--color-amber); }
  50%       { color: var(--color-alert-high); }
}

.card__value--small { font-size: var(--font-size-lg); line-height: 1.3; }
.card__sub { font-size: var(--font-size-xl); font-weight: 400; color: var(--color-text-muted); }

/* Card action button (e.g. "Agregar fuente" inside a summary card) */
.card--clickable { position: relative; }
.card__action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  padding: 4px 10px;
  font-size: var(--font-size-sm);
  font-weight: 500;
  color: var(--color-green);
  background: rgba(16,185,129,.1);
  border: 1px solid rgba(16,185,129,.3);
  border-radius: 20px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.card__action-btn svg { width: 13px; height: 13px; stroke: currentColor; }
.card__action-btn:hover { background: rgba(16,185,129,.2); border-color: rgba(16,185,129,.5); }

/* Tooltip */
.tooltip-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.tooltip-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--color-border);
  color: var(--color-text-muted);
  font-size: 10px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: help;
  flex-shrink: 0;
  line-height: 1;
}
.tooltip-text {
  position: absolute;
  top: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: rgba(13, 22, 40, 0.82);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #f1f5f9;
  font-size: 12px;
  line-height: 1.5;
  padding: 12px 14px;
  border-radius: 10px;
  width: 300px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s;
  z-index: 200;
  box-shadow: 0 8px 24px rgba(0,0,0,.4), inset 0 0 0 1px rgba(255,255,255,.08);
  text-align: left;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
}
.tooltip-text::after {
  content: '';
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: rgba(13, 22, 40, 0.82);
}
.tooltip-wrap:hover .tooltip-text,
.tooltip-wrap:focus-within .tooltip-text { opacity: 1; }

.tooltip-level {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
  font-size: 12px;
  line-height: 1.4;
}

/* Fixed tooltip — escapes any overflow container */
.tt-fixed {
  position: fixed;
  z-index: 9999;
  background: rgba(13, 22, 40, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #f1f5f9;
  padding: 12px 14px;
  border-radius: 10px;
  width: 300px;
  box-shadow: 0 8px 24px rgba(0,0,0,.4), inset 0 0 0 1px rgba(255,255,255,.08);
  font-size: 12px;
  line-height: 1.5;
  pointer-events: none;
  text-transform: none;
  letter-spacing: normal;
  font-weight: 400;
}

/* ─── Análisis ───────────────────────────────────────────── */
.analisis-loading {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--color-text-muted);
  font-size: var(--font-size-base);
  padding: 60px 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.spinner { animation: spin 1s linear infinite; flex-shrink: 0; }

/* Hero banner */
.analisis-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 22px 26px;
  border-radius: var(--radius-card);
  margin-bottom: 24px;
  flex-wrap: wrap;
  box-shadow: var(--shadow-card);
}
.analisis-hero__left { display: flex; align-items: center; gap: 18px; }
.analisis-hero__icon { font-size: 36px; line-height: 1; flex-shrink: 0; }
.analisis-hero__level {
  font-size: 18px;
  font-weight: 700;
  color: var(--color-text);
  margin-bottom: 5px;
}
.analisis-hero__desc {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  max-width: 400px;
  line-height: 1.5;
}
.analisis-hero__badges { display: flex; gap: 12px; flex-shrink: 0; }
.analisis-hero__badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 20px;
  border-radius: 14px;
  color: #fff;
  min-width: 70px;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
}
.analisis-hero__badge-num { font-size: 28px; font-weight: 700; line-height: 1; }
.analisis-hero__badge-lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .7px;
  margin-top: 4px;
  opacity: .9;
}

/* Section title */
.analisis-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text);
  margin: 8px 0 14px;
}
.analisis-section-title__sub {
  font-weight: 400;
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
  margin-left: 2px;
}

/* Topic tiles */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
  gap: 14px;
  margin-bottom: 4px;
}
.topic-card {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-card);
  padding: 18px 16px;
  box-shadow: var(--shadow-card);
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform .15s, box-shadow .15s;
  cursor: default;
}
.topic-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,.1);
}
.topic-card__count {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(0,0,0,.2);
}
.topic-card__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.3;
}
.topic-card__meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.topic-card__cat { font-size: 11px; color: var(--color-text-muted); }

/* Charts grid */
.analisis-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 860px) { .analisis-grid { grid-template-columns: 1fr; } }

/* Chart panel */
.chart-panel {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-card);
  padding: 22px 26px;
  box-shadow: var(--shadow-card);
}
.chart-panel__title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: var(--font-size-base);
  font-weight: 600;
  color: var(--color-text);
  margin-bottom: 6px;
}
.chart-panel__sub {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: 18px;
  line-height: 1.5;
}

/* Bar rows */
.chart-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 11px;
}
.chart-row:last-child { margin-bottom: 0; }
.chart-label {
  width: 150px;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-bar-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.chart-bar {
  height: 24px;
  border-radius: 6px;
  min-width: 4px;
  transition: width 0.6s cubic-bezier(.4,0,.2,1);
}
.chart-count {
  font-size: 13px;
  font-weight: 700;
  color: var(--color-text-muted);
  flex-shrink: 0;
  min-width: 24px;
  text-align: right;
}

/* Source bars 2-col layout */
.source-bars-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 32px;
}
@media (max-width: 700px) { .source-bars-grid { grid-template-columns: 1fr; } }

/* Donut chart */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 28px;
  padding: 6px 0;
  flex-wrap: wrap;
}
.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
  min-width: 130px;
}
.donut-legend__row { display: flex; align-items: center; gap: 12px; }
.donut-legend__dot { width: 14px; height: 14px; border-radius: 4px; flex-shrink: 0; }
.donut-legend__info { display: flex; flex-direction: column; gap: 2px; }
.donut-legend__label { font-size: 14px; font-weight: 600; color: var(--color-text); }
.donut-legend__count { font-size: 12px; color: var(--color-text-muted); }

.analisis-empty {
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  padding: 20px 0;
}

/* ─── Section ────────────────────────────────────────────── */
.section { margin-top: 8px; }
.section__title {
  font-size: var(--font-size-lg);
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--color-text);
  display: flex;
  align-items: center;
  gap: 10px;
}
.section__title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 20px;
  background: var(--color-blue);
  border-radius: 2px;
}

/* ─── Table ──────────────────────────────────────────────── */
.table-wrap {
  background: var(--color-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius);
  overflow: visible;
  box-shadow: var(--shadow);
  animation: fadeInUp .4s ease .1s both;
}
.table-scroll { overflow-x: auto; border-radius: inherit; }
.table { min-width: 640px; }
.table__th {
  padding: 14px 20px;
  text-align: left;
  font-size: var(--font-size-sm);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--color-text-muted);
  background: var(--color-bg-alt);
  border-bottom: 2px solid var(--color-border-light);
  white-space: nowrap;
}
.table__row {
  border-bottom: 1px solid var(--color-border-light);
  animation: fadeInUp .22s ease both;
}
.table__row:nth-child(1)  { animation-delay: .04s; }
.table__row:nth-child(2)  { animation-delay: .07s; }
.table__row:nth-child(3)  { animation-delay: .10s; }
.table__row:nth-child(4)  { animation-delay: .13s; }
.table__row:nth-child(5)  { animation-delay: .16s; }
.table__row:nth-child(6)  { animation-delay: .19s; }
.table__row:nth-child(7)  { animation-delay: .22s; }
.table__row:nth-child(8)  { animation-delay: .25s; }
.table__row:nth-child(9)  { animation-delay: .28s; }
.table__row:nth-child(10) { animation-delay: .31s; }
.table__row:nth-child(n+11) { animation-delay: .34s; }
.table__row:hover { background: #F0F6FF; }
.table__row:last-child { border-bottom: none; }
.table__td {
  padding: 0 20px;
  height: 58px;
  vertical-align: middle;
  font-size: var(--font-size-base);
  color: var(--color-text);
}
.table__td--title { font-weight: 500; min-width: 200px; }
.table__td--title .article-link {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 600;
  transition: color .15s;
}
.table__td--title .article-link:hover { color: var(--color-blue); text-decoration: underline; }
.table__td--date { white-space: nowrap; color: var(--color-text-muted); font-size: var(--font-size-sm); }
.table__td--url { max-width: 220px; }
.table__td--url a { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.table__td--actions { white-space: nowrap; }

/* ─── Source chips ────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: var(--font-size-sm);
  font-weight: 600;
  white-space: nowrap;
}
.chip--nacional { background: rgba(59,130,246,.12);  color: #1D4ED8; }
.chip--opinion  { background: rgba(139,92,246,.12);  color: #6D28D9; }
.chip--local    { background: rgba(16,185,129,.12);  color: #047857; }
.chip--default  { background: var(--color-primary-light); color: var(--color-primary); }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 22px;
  border-radius: var(--radius);
  border: 2px solid transparent;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, color .15s, transform .1s, box-shadow .15s;
  white-space: nowrap;
  line-height: 1;
}
.btn:disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn--primary {
  background: var(--color-blue);
  color: #fff;
  border-color: var(--color-blue);
  box-shadow: 0 2px 8px rgba(59,130,246,.35);
}
.btn--primary:hover {
  background: #2563EB;
  border-color: #2563EB;
  box-shadow: 0 4px 14px rgba(59,130,246,.45);
}
.btn--secondary {
  background: transparent;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.btn--secondary:hover { background: var(--color-primary-light); }
.btn--ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
}
.btn--ghost:hover { background: var(--color-bg-alt); color: var(--color-text); }
.btn--danger {
  background: transparent;
  color: var(--color-alert-high);
  border-color: var(--color-alert-high);
}
.btn--danger:hover { background: #FEF2F2; }
.btn--full { width: 100%; }
.btn--sm { min-height: 36px; padding: 6px 14px; font-size: var(--font-size-sm); }

/* ─── Fields ─────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 20px; }
.field__label { font-size: var(--font-size-base); font-weight: 600; color: var(--color-text); }
.field__required { color: var(--color-alert-high); }
.field__hint { font-size: var(--font-size-sm); color: var(--color-text-muted); }
.field__input {
  height: 48px;
  padding: 10px 14px;
  border: 2px solid var(--color-border);
  border-radius: var(--radius);
  font-size: var(--font-size-base);
  color: var(--color-text);
  background: var(--color-bg);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.field__input:focus {
  border-color: var(--color-blue);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
  outline: none;
}
.field__input::placeholder { color: #ADB5BD; }
select.field__input { cursor: pointer; }

/* ─── Toggle ─────────────────────────────────────────────── */
.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; }
.toggle__input { position: absolute; opacity: 0; width: 1px; height: 1px; overflow: hidden; }
.toggle__track {
  position: relative;
  width: 52px; height: 28px;
  background: var(--color-border);
  border-radius: 14px;
  transition: background .2s;
  flex-shrink: 0;
}
.toggle__input:checked + .toggle__track { background: var(--color-blue); }
.toggle__input:focus-visible + .toggle__track { outline: 3px solid var(--color-blue); outline-offset: 2px; }
.toggle__thumb {
  position: absolute;
  top: 3px; left: 3px;
  width: 22px; height: 22px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
  transition: transform .2s;
}
.toggle__input:checked + .toggle__track .toggle__thumb { transform: translateX(24px); }
.toggle__label { font-size: var(--font-size-base); color: var(--color-text); }

/* ─── Badges ─────────────────────────────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: var(--font-size-sm);
  font-weight: 700;
  color: #fff;
  letter-spacing: .2px;
  white-space: nowrap;
}

/* ─── Banners ────────────────────────────────────────────── */
.banner {
  padding: 16px 20px;
  border-radius: var(--radius);
  font-size: var(--font-size-base);
  line-height: 1.5;
}
.banner--success { background: var(--color-success-bg); color: var(--color-success-text); border: 1px solid var(--color-success-border); }
.banner--error   { background: var(--color-error-bg);   color: var(--color-error-text);   border: 1px solid var(--color-error-border); }

/* ─── Modal ──────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 400;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--color-bg);
  border-radius: var(--radius);
  box-shadow: 0 24px 64px rgba(0,0,0,.28);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  animation: scaleIn .22s ease;
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.96) translateY(8px); }
  to   { opacity: 1; transform: scale(1)   translateY(0); }
}
.modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 28px 20px;
  border-bottom: 1px solid var(--color-border-light);
  gap: 16px;
  position: sticky; top: 0;
  background: var(--color-bg);
  z-index: 1;
}
.modal__title { font-size: var(--font-size-lg); font-weight: 700; color: var(--color-text); }
.modal__close {
  display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px;
  border: none; background: transparent; cursor: pointer;
  border-radius: var(--radius-sm); color: var(--color-text-muted); flex-shrink: 0;
  transition: background .15s, color .15s;
}
.modal__close:hover { background: var(--color-bg-alt); color: var(--color-text); }
.modal__close svg { width: 22px; height: 22px; }
.modal__body { padding: 28px; }
.modal-form__actions {
  display: flex; gap: 12px; justify-content: flex-end;
  margin-top: 8px; padding-top: 20px;
  border-top: 1px solid var(--color-border-light);
}

/* ─── Login ──────────────────────────────────────────────── */
.login-overlay {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #0D2137 0%, #1B3A6B 60%, #1e4485 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px; z-index: 600;
}
.login-card {
  background: rgba(255,255,255,.97);
  border-radius: 12px;
  box-shadow: 0 24px 64px rgba(0,0,0,.4);
  padding: 48px 44px;
  width: 100%;
  max-width: 400px;
  animation: scaleIn .3s ease;
}
.login-title {
  font-size: 28px; font-weight: 800;
  color: var(--color-primary);
  text-align: center; margin-bottom: 6px;
}
.login-subtitle { font-size: var(--font-size-sm); color: var(--color-text-muted); text-align: center; margin-bottom: 36px; }
.login-form { display: flex; flex-direction: column; }

/* ─── Utilities ──────────────────────────────────────────── */
.link { color: var(--color-blue); text-decoration: underline; }
.loading-text {
  padding: 56px 24px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--font-size-lg);
  background: var(--color-bg);
  border-radius: var(--radius);
  border: 1px solid var(--color-border-light);
}
.empty-state {
  padding: 56px 24px;
  text-align: center;
  color: var(--color-text-muted);
  font-size: var(--font-size-base);
  background: var(--color-bg);
  border-radius: var(--radius);
  border: 2px dashed var(--color-border);
  line-height: 1.7;
}

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  :root { --sidebar-width: 64px; }
  .sidebar__label { display: none; }
  .sidebar__link { justify-content: center; padding: 14px; border-left: none; border-bottom: 3px solid transparent; }
  .sidebar__link--active { border-bottom-color: var(--color-sidebar-active-border); border-left: none; }
  .main { padding: 20px 16px; }
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .page-header { flex-direction: column; align-items: flex-start; }
  .header__live { display: none; }
}
