/* Kio WAF Scorecard — App visual (Stitch-style Material 3)
   Tokens: light surface + dark sidebar, generous whitespace, soft shadows. */

:root {
  --font-sans: "Google Sans Text", "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-display: "Google Sans", "Inter", system-ui, sans-serif;

  --app-bg: radial-gradient(circle at top left, rgba(56, 189, 248, 0.16), transparent 28%), linear-gradient(180deg, #050A13 0%, #091321 100%);
  --bg: #091321;
  --surface: #0F1B2D;
  --surface-2: #152338;
  --surface-3: #1A2B43;
  --border: #243551;
  --border-strong: #35506F;

  --text: #E5EDF8;
  --text-muted: #9DB0C7;
  --text-soft: #7286A5;

  --primary: #38BDF8;
  --primary-600: #0EA5E9;
  --primary-50: rgba(56, 189, 248, 0.12);

  --ok: #4ADE80;
  --ok-bg: rgba(34, 197, 94, 0.16);
  --warn: #F59E0B;
  --warn-bg: rgba(245, 158, 11, 0.16);
  --risk: #FB923C;
  --risk-bg: rgba(251, 146, 60, 0.16);
  --bad: #F87171;
  --bad-bg: rgba(248, 113, 113, 0.16);
  --info: #60A5FA;
  --info-bg: rgba(96, 165, 250, 0.16);

  --nav-bg: #050B14;
  --nav-text: #B6C7DA;
  --nav-text-active: #F8FAFC;
  --nav-accent: #38BDF8;
  --topbar-bg: rgba(7, 13, 23, 0.88);
  --ring-track: #243551;
  --code-bg: rgba(148, 163, 184, 0.14);
  --table-hover: rgba(148, 163, 184, 0.10);
  --alert-ok-text: #BBF7D0;
  --alert-err-text: #FECACA;
  --alert-info-text: #BFDBFE;
  --fail-tile-bg: rgba(239, 68, 68, 0.14);
  --fail-tile-border: rgba(248, 113, 113, 0.28);
  --fail-tile-text: #FCA5A5;
  --critical-tile-bg: rgba(220, 38, 38, 0.18);
  --critical-tile-border: rgba(248, 113, 113, 0.34);
  --critical-tile-text: #FECACA;
  --high-tile-bg: rgba(249, 115, 22, 0.18);
  --high-tile-border: rgba(251, 146, 60, 0.34);
  --high-tile-text: #FDBA74;

  --shadow-sm: 0 1px 2px rgba(2, 8, 23, 0.35), 0 1px 3px rgba(2, 8, 23, 0.24);
  --shadow-md: 0 6px 18px rgba(2, 8, 23, 0.36), 0 18px 36px rgba(2, 8, 23, 0.24);
  --shadow-lg: 0 10px 24px rgba(2, 8, 23, 0.44), 0 24px 48px rgba(2, 8, 23, 0.28);

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 22px;
}

:root[data-theme='light'] {
  --app-bg: #F4F6FB;
  --bg: #F4F6FB;
  --surface: #FFFFFF;
  --surface-2: #F8FAFC;
  --surface-3: #EEF2F7;
  --border: #E2E8F0;
  --border-strong: #CBD5E1;

  --text: #0F172A;
  --text-muted: #64748B;
  --text-soft: #94A3B8;

  --primary: #4F46E5;
  --primary-600: #4338CA;
  --primary-50: #EEF2FF;

  --ok: #16A34A;
  --ok-bg: #DCFCE7;
  --warn: #D97706;
  --warn-bg: #FEF3C7;
  --risk: #EA580C;
  --risk-bg: #FFEDD5;
  --bad: #DC2626;
  --bad-bg: #FEE2E2;
  --info: #2563EB;
  --info-bg: #DBEAFE;

  --nav-bg: #0F172A;
  --nav-text: #CBD5E1;
  --nav-text-active: #FFFFFF;
  --nav-accent: #6366F1;
  --topbar-bg: #FFFFFF;
  --ring-track: #E2E8F0;
  --code-bg: rgba(0, 0, 0, 0.06);
  --table-hover: #F8FAFC;
  --alert-ok-text: #166534;
  --alert-err-text: #991B1B;
  --alert-info-text: #1E40AF;
  --fail-tile-bg: #FEF2F2;
  --fail-tile-border: #FECACA;
  --fail-tile-text: #B91C1C;
  --critical-tile-bg: #FEE2E2;
  --critical-tile-border: #FCA5A5;
  --critical-tile-text: #991B1B;
  --high-tile-bg: #FFEDD5;
  --high-tile-border: #FED7AA;
  --high-tile-text: #C2410C;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 2px 4px rgba(15, 23, 42, 0.06), 0 8px 24px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 4px 6px rgba(15, 23, 42, 0.05), 0 16px 32px rgba(15, 23, 42, 0.1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--app-bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============== Layout ============== */

.app {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--nav-bg);
  color: var(--nav-text);
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 16px;
}
.brand-mark {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(135deg, #6366F1, #8B5CF6);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  color: #fff;
}
.brand-title { font-family: var(--font-display); font-weight: 700; font-size: 16px; color: #fff; line-height: 1.1; }
.brand-sub { font-size: 11px; color: var(--text-soft); }

.nav-section { font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; color: #64748B; padding: 12px 12px 6px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius);
  color: var(--nav-text);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.18s ease;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.06); text-decoration: none; }
.nav-item.is-active {
  background: rgba(99, 102, 241, 0.18);
  color: var(--nav-text-active);
  position: relative;
}
.nav-item.is-active::before {
  content: "";
  position: absolute; left: -16px; top: 8px; bottom: 8px;
  width: 3px; background: var(--nav-accent); border-radius: 3px;
}
.nav-icon { width: 18px; height: 18px; flex: 0 0 18px; opacity: 0.9; }

.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 11px;
  color: var(--text-soft);
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--border);
  gap: 16px;
  backdrop-filter: blur(18px);
}
.topbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
}
.topbar-sub { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }

.content {
  padding: 28px 32px 64px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: background .2s, color .2s;
}
.theme-toggle:hover {
  background: var(--border);
  color: var(--text);
}

/* Mostrar sol en dark mode, luna en light mode */
:root .icon-sun  { display: block; }
:root .icon-moon { display: none;  }
:root[data-theme='light'] .icon-sun  { display: none;  }
:root[data-theme='light'] .icon-moon { display: block; }

/* ============== Buttons ============== */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.15s ease;
  background: transparent;
  color: var(--text);
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.25);
}
.btn-primary:hover { background: var(--primary-600); }
.btn-primary:disabled { background: var(--border-strong); color: var(--text-soft); box-shadow: none; cursor: wait; }

.btn-secondary {
  background: var(--surface);
  border-color: var(--border-strong);
  color: var(--text);
}
.btn-secondary:hover { background: var(--surface-2); }

.btn-ghost { color: var(--primary); background: var(--primary-50); }
.btn-ghost:hover { background: #E0E7FF; }

.btn-danger { color: var(--bad); border-color: var(--bad-bg); background: var(--surface); }
.btn-danger:hover { background: var(--bad-bg); }

/* ============== Cards ============== */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
}
.card.is-elevated { box-shadow: var(--shadow-md); }
.card h2 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 15px;
}
.card .hint { color: var(--text-muted); font-size: 12px; margin-top: -6px; margin-bottom: 14px; }

.section-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
}
.section-desc { color: var(--text-muted); font-size: 13px; margin-top: 4px; }

/* ============== Stat tiles (Dashboard) ============== */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
}
.stat .label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.stat .value { font-family: var(--font-display); font-weight: 700; font-size: 32px; line-height: 1.1; margin-top: 6px; }
.stat .delta { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.stat.is-primary .value { color: var(--primary); }

/* ============== Score badge ============== */

.score-ring {
  width: 96px; height: 96px;
  border-radius: 50%;
  background:
    conic-gradient(var(--ring-color, var(--primary)) calc(var(--ring-value, 0) * 1%), var(--ring-track) 0);
  display: grid; place-items: center;
  position: relative;
}
.score-ring::after {
  content: "";
  position: absolute; inset: 8px;
  background: var(--surface);
  border-radius: 50%;
}
.score-ring .num {
  position: relative;
  z-index: 1;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
}

/* ============== Pillar cards ============== */

.pillar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
}
.pillar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-sm);
}
.pillar h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 14px;
  text-transform: capitalize;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px;
}
.pillar .score-num { font-family: var(--font-display); font-size: 30px; font-weight: 700; line-height: 1; }
.pillar .bar { height: 8px; background: #EEF2F7; border-radius: 6px; overflow: hidden; }
.pillar .bar > span { display: block; height: 100%; border-radius: 6px; }
.pillar .meta { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--text-muted); }

/* ============== Forms ============== */

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12.5px; font-weight: 500; color: var(--text); }
.field .hint { font-size: 11.5px; color: var(--text-soft); }
.field input[type="text"],
.field input[type="number"],
.field input[type="password"],
.field input[type="url"],
.field input[type="email"],
.field select,
.field textarea {
  width: 100%;
  font: inherit;
  padding: 10px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.18);
}
.field textarea { min-height: 64px; resize: vertical; }

.toggle {
  display: flex; align-items: center; gap: 10px;
  background: var(--primary-50);
  border: 1px solid #E0E7FF;
  border-radius: var(--radius);
  padding: 10px 14px;
}
.toggle input { transform: translateY(1px); }
.toggle strong { color: var(--primary-600); }

.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
  cursor: pointer;
  user-select: none;
  transition: all 0.12s ease;
}
.chip input { display: none; }
.chip:has(input:checked), .chip.is-on {
  background: var(--primary-50);
  border-color: var(--primary);
  color: var(--primary-600);
  font-weight: 600;
}

/* ============== Tables ============== */

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.table-toolbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.table-toolbar input[type="search"] {
  flex: 1; min-width: 200px;
  padding: 8px 12px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); font: inherit;
}
.consolidated-panel {
  margin-bottom: 16px;
}
.consolidated-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.consolidated-input {
  min-width: 180px;
  padding: 9px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
}
.consolidated-input::placeholder {
  color: var(--text-soft);
}
.check-inline {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  color: var(--text-muted);
  font-size: 13px;
}
.select-cell {
  width: 44px;
}
.consolidated-summary-box {
  margin: 0;
  padding: 14px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  font: inherit;
  line-height: 1.6;
}
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
table.data th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
}
table.data td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.data tr:last-child td { border-bottom: 0; }
table.data tr:hover td { background: var(--table-hover); }

/* ============== Pills / Badges ============== */

.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
  text-transform: capitalize;
}
.pill-pass   { background: var(--ok-bg); color: var(--ok); }
.pill-fail   { background: var(--bad-bg); color: var(--bad); }
.pill-manual { background: #EDE9FE; color: #6D28D9; }
.pill-info   { background: var(--info-bg); color: var(--info); }

.sev-critical      { color: var(--bad); font-weight: 700; }
.sev-high          { color: var(--risk); font-weight: 600; }
.sev-medium        { color: var(--warn); font-weight: 600; }
.sev-low           { color: var(--info); }
.sev-informational { color: var(--text-muted); }

/* ============== States ============== */

.empty {
  text-align: center;
  color: var(--text-muted);
  padding: 48px 16px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
}
.alert {
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.55;
  display: block;
}
.alert > * + * { margin-top: 6px; }
.alert code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.alert-ok   { background: var(--ok-bg); color: var(--alert-ok-text); border: 1px solid color-mix(in srgb, var(--ok) 35%, transparent); }
.alert-err  { background: var(--bad-bg); color: var(--alert-err-text); border: 1px solid color-mix(in srgb, var(--bad) 35%, transparent); }
.alert-info { background: var(--info-bg); color: var(--alert-info-text); border: 1px solid color-mix(in srgb, var(--info) 35%, transparent); }

.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,0.5);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============== Responsive ============== */

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    overflow-x: auto;
    padding: 12px 16px;
    align-items: center;
    gap: 12px;
  }
  .brand { padding: 0 8px 0 0; border-bottom: 0; border-right: 1px solid rgba(255,255,255,0.08); margin: 0 8px 0 0; }
  .nav-section { display: none; }
  .nav-item { flex: 0 0 auto; padding: 8px 12px; }
  .nav-item.is-active::before { display: none; }
  .sidebar-footer { display: none; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
}

@media (max-width: 640px) {
  .stats { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
}

/* ================== Estado del sistema ================== */
.status-dot { display:inline-block; width:10px; height:10px; border-radius:50%; margin-right:8px; vertical-align:middle; }
.status-dot.ok  { background: var(--ok); box-shadow: 0 0 0 4px rgba(22,163,74,.12); }
.status-dot.bad { background: var(--bad); box-shadow: 0 0 0 4px rgba(220,38,38,.12); }

/* ================== Proveedores cloud ================== */
.provider-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap:14px; margin-top:14px; }
.provider-card {
  background: var(--surface);
  border: 1px solid var(--border, #E5E7EB);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.provider-card.is-soon { opacity: .82; background: var(--surface-2); }
.provider-card.is-ok { border-color: var(--primary); }
.provider-head { display:flex; justify-content: space-between; align-items: center; gap: 10px; }
.provider-name { font-weight: 600; color: var(--text); font-size: 14px; }

.provider-picker { display:grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap:12px; margin-top: 12px; }
.provider-option { cursor: pointer; }
.provider-option.is-disabled { cursor: not-allowed; }
.provider-option input { display:none; }
.provider-option .provider-card { transition: border-color .15s, box-shadow .15s, transform .1s; }
.provider-option:hover:not(.is-disabled) .provider-card { border-color: var(--primary); }
.provider-option input:checked + .provider-card {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(79,70,229,.15);
}

/* ================== Historico (tarjetas visuales) ================== */
.history-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
}
.history-card {
  display: flex; flex-direction: column; gap: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border, #E5E7EB);
  border-radius: var(--radius-lg);
  text-decoration: none; color: inherit;
  transition: transform .12s ease, box-shadow .15s ease, border-color .15s ease;
}
.history-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(15,23,42,.08); border-color: var(--primary); }
.history-head { display:flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.history-date { font-size: 12px; color: var(--text-muted); }
.history-client { font-size: 12px; color: var(--primary); font-weight: 600; margin-top: 4px; }
.history-account { font-weight: 600; font-size: 15px; margin-top: 2px; word-break: break-all; }
.history-score { text-align: center; min-width: 64px; padding: 8px 10px; border-radius: 12px; }
.history-score .score-num { font-family: var(--font-display); font-size: 24px; font-weight: 700; line-height: 1; }
.history-score .score-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; opacity: .8; margin-top: 2px; }
.history-score.is-ok   { background: var(--ok-bg);   color: var(--ok); }
.history-score.is-warn { background: var(--warn-bg); color: var(--warn); }
.history-score.is-risk { background: #FFEDD5;        color: var(--risk); }
.history-score.is-bad  { background: var(--bad-bg);  color: var(--bad); }

.history-pillars { display:flex; flex-wrap:wrap; gap:6px; }
.history-meta, .history-footer {
  display:flex; flex-wrap: wrap; gap: 10px 16px;
  font-size: 12px; color: var(--text-muted);
  padding-top: 10px; border-top: 1px dashed #E2E8F0;
}
.meta-item { display:inline-flex; align-items:center; gap:6px; }
.meta-label { text-transform: uppercase; font-size: 10px; letter-spacing: .08em; color: var(--text-muted); }

/* ================== Pillar tags (badges por pilar) ================== */
.pillar-tag {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  padding: 4px 8px; border-radius: 999px; line-height: 1;
}
.pillar-tag.pt-sec  { background: #FEE2E2; color: #B91C1C; }
.pillar-tag.pt-rel  { background: #DBEAFE; color: #1D4ED8; }
.pillar-tag.pt-perf { background: #E0E7FF; color: #4338CA; }
.pillar-tag.pt-cost { background: #DCFCE7; color: #15803D; }
.pillar-tag.pt-ops  { background: #FEF3C7; color: #A16207; }
.pillar-tag.pt-sus  { background: #CCFBF1; color: #0F766E; }
.pillar-tag.pt-info { background: #E2E8F0; color: #334155; }

@media (max-width: 640px) {
  .history-grid { grid-template-columns: 1fr; }
  .provider-grid, .provider-picker { grid-template-columns: 1fr; }
}

/* ================== Filtros de assessments ================== */
.filter-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 10px 14px; margin-bottom: 18px;
}
.filter-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .06em; margin-right: 4px; }
.filter-spacer { flex: 1; }
.filter-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: #F1F5F9; color: var(--text); font-size: 13px; font-weight: 500;
  text-decoration: none; border: 1px solid transparent; transition: background .12s, color .12s, border-color .12s;
}
.filter-pill:hover { background: var(--primary-50); color: var(--primary); }
.filter-pill.is-active { background: var(--primary); color: #fff; }
.filter-pill .badge {
  background: rgba(255,255,255,.25); color: inherit;
  padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.filter-pill:not(.is-active) .badge { background: #E2E8F0; color: var(--text-muted); }

.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 10px; }

.history-delete { margin-left: auto; }
.history-card .history-delete button { pointer-events: auto; }

/* === IA summary markdown === */
.ai-markdown { white-space: pre-wrap; font-size: 13.5px; line-height: 1.6; color: var(--text); }

/* ================== Results hero (Refinado) ================== */
.results-hero { padding: 22px 24px; margin-bottom: 18px; }
.hero-grid { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; gap: 18px 28px; align-items: center; }
.hero-score { display: flex; align-items: center; gap: 18px; grid-row: 1 / span 2; }
.score-ring-xl { width: 132px; height: 132px; }
.score-ring-xl .num { font-size: 38px; }
.score-caption .caption-title { font-weight: 600; color: var(--text); font-size: 14px; }
.score-caption .caption-sub { color: var(--text-muted); font-size: 12.5px; margin-top: 4px; }

.hero-stats {
  display: grid; grid-template-columns: repeat(6, minmax(0,1fr)); gap: 10px;
}
.stat-tile {
  background: var(--surface-2); border: 1px solid var(--border, #E5E7EB);
  border-radius: 12px; padding: 12px 10px; text-align: center;
}
.stat-tile .stat-num { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-tile .stat-lbl { color: var(--text-muted); font-size: 11px; margin-top: 4px; text-transform: uppercase; letter-spacing: .04em; }
.stat-fail     { background: var(--fail-tile-bg); border-color: var(--fail-tile-border); }
.stat-fail .stat-num     { color: var(--fail-tile-text); }
.stat-critical { background: var(--critical-tile-bg); border-color: var(--critical-tile-border); }
.stat-critical .stat-num { color: var(--critical-tile-text); }
.stat-high     { background: var(--high-tile-bg); border-color: var(--high-tile-border); }
.stat-high .stat-num     { color: var(--high-tile-text); }

.hero-actions { grid-column: 1 / -1; display: flex; gap: 8px; flex-wrap: wrap; padding-top: 6px; border-top: 1px dashed var(--border, #E5E7EB); }

.btn-ghost {
  background: transparent; color: var(--text-muted); border: 1px solid var(--border, #E5E7EB);
  padding: 8px 14px; border-radius: 12px; font-weight: 500; font-size: 13px;
  text-decoration: none; transition: background .12s, color .12s;
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.scan-log-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.scan-log-output {
  margin: 0;
  min-height: 220px;
  max-height: 340px;
  overflow: auto;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font: 12px/1.6 Consolas, "SFMono-Regular", Menlo, Monaco, monospace;
  white-space: pre-wrap;
}

.health-hero {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(56, 189, 248, 0.18), transparent 28%),
    linear-gradient(135deg, var(--surface) 0%, var(--surface-2) 100%);
}

.health-hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 24px;
  align-items: stretch;
}

.health-title {
  font-size: 32px;
  line-height: 1.1;
  margin-top: 14px;
}

.health-subtitle {
  max-width: 62ch;
  margin-top: 10px;
}

.health-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.health-kpis {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.health-kpi {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface-2) 82%, transparent), color-mix(in srgb, var(--surface-3) 78%, transparent));
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow-sm);
}

.health-kpi-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.health-kpi-value {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  color: var(--text);
  margin-top: 8px;
}

.health-kpi-note {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.health-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, 0.95fr);
  gap: 18px;
  align-items: start;
}

.health-layout-bottom {
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
}

.health-panel {
  min-height: 100%;
}

.health-status-list {
  display: grid;
  gap: 12px;
}

.health-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}

.health-status-copy {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.health-status-copy strong {
  font-size: 14px;
  color: var(--text);
}

.health-mini-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}

.health-mini-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-2);
  padding: 14px;
}

.health-mini-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.health-mini-value {
  font-size: 13px;
  color: var(--text);
  margin-top: 8px;
  line-height: 1.5;
  word-break: break-word;
}

.health-form-note {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 12.5px;
}

.health-route-grid {
  display: grid;
  gap: 12px;
}

.health-route {
  display: block;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}

.health-route:hover {
  text-decoration: none;
  border-color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.health-route-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.health-route strong {
  display: block;
  font-size: 14px;
  color: var(--text);
  line-height: 1.5;
  word-break: break-word;
}

/* ================== Charts ================== */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.chart-wrap { position: relative; width: 100%; }
.chart-donut  { height: 260px; }
.chart-bars   { height: 280px; }
.chart-radar  { height: 320px; }

/* ================== Modal Save to Drive ================== */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15,23,42,.55);
  z-index: 80; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.modal-card {
  background: var(--surface); border-radius: var(--radius-lg); width: min(520px, 100%);
  box-shadow: 0 20px 60px rgba(15,23,42,.25); overflow: hidden;
}
.modal-head { display:flex; align-items:center; justify-content:space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-head h3 { margin: 0; font-family: var(--font-display); font-size: 17px; }
.modal-close { border: none; background: transparent; font-size: 24px; cursor: pointer; color: var(--text-muted); line-height: 1; }
.modal-body { padding: 18px 20px; color: var(--text); font-size: 13.5px; line-height: 1.55; }
.modal-body ol, .modal-body ul { padding-left: 20px; margin: 8px 0; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; }

/* ================ AWS Brand Pill ================ */
.pill-aws { background: rgba(255, 153, 0, 0.18); color: #FF9900; }

/* ================ Log line coloring ================ */
.log-error { color: var(--bad); font-weight: 600; }
.log-warn  { color: var(--warn); }
.log-ok    { color: var(--ok); font-weight: 600; }

/* ================ Findings fail rows ================ */
.data tr.row-fail td { background: var(--fail-tile-bg); }
.data tr.row-fail td:first-child { border-left: 3px solid var(--bad); }
.data tr.row-fail:hover td { background: rgba(239, 68, 68, 0.22); }
.data tr.row-critical td { background: var(--critical-tile-bg); }
.data tr.row-critical td:first-child { border-left: 3px solid #DC2626; }
.data tr.row-critical:hover td { background: rgba(220, 38, 38, 0.28); }

/* ================ Jobs list table ================ */
.jobs-table { width: 100%; font-size: 13px; }
.jobs-table th { text-align: left; font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--border); color: var(--text-muted); }
.jobs-table td { padding: 8px 10px; border-bottom: 1px solid var(--border); }
.jobs-table .job-status { font-weight: 600; text-transform: capitalize; }
.jobs-table .job-status.running { color: var(--primary); }
.jobs-table .job-status.completed { color: var(--ok); }
.jobs-table .job-status.error { color: var(--bad); }
.jobs-table .job-status.queued { color: var(--text-muted); }

/* ================== Print (PDF nativo) ================== */
@media print {
  .sidebar, .topbar, .no-print, .no-print-shadow { display: none !important; }
  body { background: white; }
  .main { margin-left: 0 !important; padding: 0 !important; }
  .card, .results-hero { box-shadow: none !important; border: 1px solid #E5E7EB !important; break-inside: avoid; }
  .charts-grid { page-break-inside: avoid; }
  .data { font-size: 11px; }
  .no-print-pagebreak { page-break-before: always; }
}

@media (max-width: 980px) {
  .charts-grid { grid-template-columns: 1fr; }
  .hero-grid { grid-template-columns: 1fr; }
  .hero-score { grid-row: auto; justify-content: center; }
  .hero-stats { grid-template-columns: repeat(3, 1fr); }
  .health-hero-grid, .health-layout, .health-layout-bottom { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .topbar-actions { width: 100%; justify-content: flex-start; }
  .health-kpis { grid-template-columns: 1fr; }
  .health-status-row { flex-direction: column; align-items: flex-start; }
}

/* ================== Premium UI Refresh ================== */

:root {
  --font-sans: "Manrope", "Segoe UI", system-ui, sans-serif;
  --font-display: "Space Grotesk", "Manrope", system-ui, sans-serif;

  --app-bg:
    radial-gradient(circle at top left, rgba(124, 140, 255, 0.14), transparent 28%),
    radial-gradient(circle at top right, rgba(103, 232, 249, 0.10), transparent 24%),
    linear-gradient(180deg, #090B10 0%, #0D1118 100%);
  --bg: #0B0D12;
  --surface: rgba(18, 23, 34, 0.88);
  --surface-2: rgba(24, 30, 43, 0.92);
  --surface-3: rgba(31, 38, 55, 0.96);
  --border: rgba(116, 129, 160, 0.18);
  --border-strong: rgba(128, 143, 180, 0.32);

  --text: #F5F7FB;
  --text-muted: #97A3B6;
  --text-soft: #6F7C92;

  --primary: #7C8CFF;
  --primary-600: #697BFF;
  --primary-50: rgba(124, 140, 255, 0.14);
  --info: #67E8F9;
  --info-bg: rgba(103, 232, 249, 0.12);
  --ok: #5DD39E;
  --ok-bg: rgba(93, 211, 158, 0.14);
  --warn: #F4B860;
  --warn-bg: rgba(244, 184, 96, 0.14);
  --risk: #FF9F68;
  --risk-bg: rgba(255, 159, 104, 0.14);
  --bad: #FF8A8A;
  --bad-bg: rgba(255, 138, 138, 0.14);

  --nav-bg: rgba(11, 14, 20, 0.92);
  --nav-text: #A9B4C8;
  --nav-text-active: #F6F8FD;
  --nav-accent: #7C8CFF;
  --topbar-bg: rgba(9, 12, 18, 0.72);
  --ring-track: rgba(91, 105, 136, 0.22);
  --code-bg: rgba(151, 163, 182, 0.12);
  --table-hover: rgba(124, 140, 255, 0.07);

  --shadow-sm: 0 10px 30px rgba(4, 8, 15, 0.18);
  --shadow-md: 0 22px 60px rgba(3, 7, 14, 0.28);
  --shadow-lg: 0 30px 80px rgba(2, 5, 12, 0.34);

  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --radius-xl: 30px;
}

:root[data-theme='light'] {
  --app-bg:
    radial-gradient(circle at top left, rgba(124, 140, 255, 0.10), transparent 28%),
    linear-gradient(180deg, #F5F7FC 0%, #EEF2F8 100%);
  --bg: #F3F6FC;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-2: rgba(248, 250, 255, 0.96);
  --surface-3: #EEF2FA;
  --border: rgba(116, 129, 160, 0.16);
  --border-strong: rgba(100, 114, 145, 0.24);

  --text: #0F1625;
  --text-muted: #5F6D84;
  --text-soft: #8A96AA;

  --primary: #5468FF;
  --primary-600: #4257FF;
  --primary-50: rgba(84, 104, 255, 0.10);
  --info: #0891B2;
  --info-bg: rgba(8, 145, 178, 0.10);
  --ok: #179B68;
  --ok-bg: rgba(23, 155, 104, 0.10);
  --warn: #D99024;
  --warn-bg: rgba(217, 144, 36, 0.12);
  --risk: #EA6E2D;
  --risk-bg: rgba(234, 110, 45, 0.12);
  --bad: #D9415F;
  --bad-bg: rgba(217, 65, 95, 0.10);

  --nav-bg: rgba(16, 22, 35, 0.96);
  --nav-text: #C4CDDB;
  --nav-text-active: #FFFFFF;
  --topbar-bg: rgba(255, 255, 255, 0.74);
  --ring-track: rgba(89, 106, 153, 0.16);
  --code-bg: rgba(15, 23, 42, 0.06);
  --table-hover: rgba(84, 104, 255, 0.05);

  --shadow-sm: 0 12px 26px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 18px 38px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 24px 56px rgba(15, 23, 42, 0.12);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--border-strong) 70%, transparent);
  border-radius: 999px;
}

*::-webkit-scrollbar-track {
  background: transparent;
}

body {
  background: var(--app-bg);
  color: var(--text);
}

a {
  transition: color 180ms ease, opacity 180ms ease;
}

code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 2px 6px;
  border-radius: 8px;
}

.shell-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 14, 0.62);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
  z-index: 35;
}

.app-shell {
  grid-template-columns: 300px minmax(0, 1fr);
  position: relative;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 26%),
    var(--nav-bg);
  border-right: 1px solid rgba(255, 255, 255, 0.05);
  padding: 28px 20px 24px;
  gap: 18px;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.02);
  z-index: 40;
}

.brand {
  align-items: flex-start;
  gap: 14px;
  padding: 0 4px 0;
  margin-bottom: 0;
  border-bottom: 0;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--info));
  box-shadow: 0 18px 40px rgba(124, 140, 255, 0.25);
}

.brand-title {
  font-size: 17px;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.sidebar-intro,
.sidebar-panel {
  border: 1px solid rgba(255, 255, 255, 0.05);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.01));
  border-radius: 20px;
  padding: 16px;
}

.sidebar-intro p,
.sidebar-summary {
  margin: 8px 0 0;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.sidebar-badge,
.page-kicker,
.topbar-kicker,
.sidebar-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.nav-section {
  padding: 0 6px;
  color: var(--text-soft);
}

.nav-list,
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.nav-item {
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 16px;
  color: var(--nav-text);
  border: 1px solid transparent;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.06);
  transform: translateX(2px);
}

.nav-item.is-active {
  background: linear-gradient(180deg, rgba(124, 140, 255, 0.16), rgba(124, 140, 255, 0.08));
  border-color: rgba(124, 140, 255, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.nav-item.is-active::before {
  left: -20px;
  top: 10px;
  bottom: 10px;
  width: 4px;
  background: linear-gradient(180deg, var(--primary), var(--info));
}

.nav-icon {
  opacity: 0.9;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 6px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 11.5px;
  line-height: 1.7;
}

.sidebar-close,
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 84%, transparent);
  color: var(--text);
  cursor: pointer;
  transition: background 160ms ease, border-color 160ms ease, transform 160ms ease;
}

.sidebar-close:hover,
.nav-toggle:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.sidebar-close svg,
.nav-toggle svg {
  width: 18px;
  height: 18px;
}

.main {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  padding: 24px 32px 20px;
  background: color-mix(in srgb, var(--topbar-bg) 92%, transparent);
  backdrop-filter: blur(22px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}

.page-intro h1 {
  font-size: clamp(28px, 3vw, 42px);
  letter-spacing: -0.04em;
}

.topbar-sub {
  max-width: 64ch;
  font-size: 14px;
  line-height: 1.7;
}

.topbar-actions {
  gap: 10px;
}

.page-actions-wrap,
.topbar-auth {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 82%, transparent);
}

.content {
  padding: 28px 32px 80px;
}

.content-inner {
  width: min(100%, 1480px);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

@media (prefers-reduced-motion: no-preference) {
  .content-inner > * {
    animation: premium-rise 420ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
  }
  .content-inner > *:nth-child(2) { animation-delay: 40ms; }
  .content-inner > *:nth-child(3) { animation-delay: 70ms; }
  .content-inner > *:nth-child(4) { animation-delay: 100ms; }
}

@keyframes premium-rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.theme-toggle {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 84%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.theme-toggle:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.btn {
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 14px;
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: transform 160ms ease, background 160ms ease, box-shadow 160ms ease, border-color 160ms ease, color 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0) scale(0.985);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 74%, var(--info)));
  box-shadow: 0 18px 34px rgba(124, 140, 255, 0.22);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--primary-600), color-mix(in srgb, var(--primary-600) 74%, var(--info)));
}

.btn-secondary {
  background: color-mix(in srgb, var(--surface-2) 80%, transparent);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--surface-2);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.02);
  border-color: var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: var(--surface-2);
  color: var(--text);
}

.btn-danger {
  background: color-mix(in srgb, var(--bad-bg) 60%, transparent);
  border-color: color-mix(in srgb, var(--bad) 25%, var(--border));
}

.btn-sm {
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 12px;
}

.card,
.stat,
.pillar,
.table-wrap,
.history-card,
.provider-card,
.health-kpi,
.health-mini-card,
.health-route,
.health-status-row,
.health-form-note,
.modal-card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface-2) 98%, transparent));
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(18px);
}

.card,
.stat,
.pillar,
.history-card,
.provider-card,
.health-route {
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease, background 180ms ease;
}

.history-card:hover,
.provider-card:hover,
.health-route:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.card {
  padding: 24px;
}

.card h2 {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.section-title {
  font-size: clamp(18px, 2vw, 24px);
  letter-spacing: -0.03em;
}

.section-desc,
.card .hint,
.hint {
  line-height: 1.7;
}

.stats {
  gap: 18px;
}

.stat {
  position: relative;
  overflow: hidden;
  padding: 22px;
}

.stat::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
}

.stat .label {
  color: var(--text-soft);
  letter-spacing: 0.14em;
}

.stat .value {
  font-size: clamp(30px, 3vw, 40px);
  letter-spacing: -0.06em;
}

.stat.is-primary {
  background:
    radial-gradient(circle at top right, rgba(124, 140, 255, 0.18), transparent 34%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface-2) 98%, transparent));
}

.dashboard-spotlight,
.dashboard-latest {
  overflow: hidden;
  position: relative;
  background:
    radial-gradient(circle at top right, rgba(124, 140, 255, 0.14), transparent 32%),
    radial-gradient(circle at bottom left, rgba(103, 232, 249, 0.08), transparent 28%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface-2) 98%, transparent));
}

.dashboard-spotlight-layout,
.dashboard-latest-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
}

.dashboard-spotlight-main,
.dashboard-latest-copy {
  min-width: 0;
}

.dashboard-spotlight-meta,
.dashboard-latest-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}

.dashboard-spotlight-actions,
.dashboard-latest-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 180px;
}

.dashboard-pillar-stack,
.dashboard-pillars-block {
  margin-top: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.dashboard-pillars-label {
  margin-bottom: 0;
}

.score-ring,
.score-ring-xl {
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04), 0 16px 34px rgba(124, 140, 255, 0.16);
}

.score-ring::after {
  background: color-mix(in srgb, var(--surface) 90%, transparent);
}

.pillar {
  padding: 20px;
}

.pillar .score-num {
  font-size: 32px;
  letter-spacing: -0.04em;
}

.pillar .bar {
  height: 10px;
  background: color-mix(in srgb, var(--surface-3) 85%, transparent);
}

.page-grid.page-grid-aside {
  display: grid;
  grid-template-columns: minmax(0, 1.14fr) minmax(300px, 0.86fr);
  gap: 24px;
  align-items: start;
}

.page-stack,
.side-stack {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.button-row,
.cta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.button-row-center,
.cta-row-center {
  justify-content: center;
}

.button-row-compact {
  gap: 8px;
  margin-bottom: 12px;
}

.button-row-compact .btn {
  min-height: 36px;
  padding: 7px 12px;
  font-size: 12px;
}

.list-block {
  margin: 8px 0 0 18px;
  padding: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.85;
}

.list-block-tight {
  margin-bottom: 12px;
}

.hint-tight {
  margin-top: 0 !important;
}

.hint-top-gap {
  margin: 12px 0 0 !important;
}

.readable-copy {
  line-height: 1.75 !important;
}

.code-panel {
  margin: 10px 0 0;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: #0C1017;
  color: #EAF0FF;
  font: 12px/1.65 Consolas, "SFMono-Regular", Menlo, Monaco, monospace;
  overflow: auto;
  max-height: 260px;
}

.field label {
  font-size: 12px;
  letter-spacing: 0.02em;
}

.field input[type="text"],
.field input[type="number"],
.field input[type="password"],
.field input[type="url"],
.field input[type="email"],
.field select,
.field textarea,
.consolidated-input,
.table-toolbar input[type="search"],
.table-toolbar select {
  min-height: 46px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.field input[type="file"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px dashed var(--border-strong);
  background: color-mix(in srgb, var(--surface-2) 82%, transparent);
  color: var(--text-muted);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.consolidated-input:focus,
.table-toolbar input[type="search"]:focus,
.table-toolbar select:focus {
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent);
}

.chip-row {
  gap: 10px;
}

.chip {
  min-height: 40px;
  padding: 9px 14px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-2) 86%, transparent);
}

.chip:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
}

.chip:has(input:checked),
.chip.is-on {
  background: linear-gradient(180deg, color-mix(in srgb, var(--primary) 18%, transparent), color-mix(in srgb, var(--primary) 10%, transparent));
  color: #EFF2FF;
}

.table-wrap {
  overflow: hidden;
}

.table-toolbar {
  padding: 16px 18px;
  background: rgba(255, 255, 255, 0.01);
}

table.data {
  font-size: 13px;
}

table.data th {
  padding: 12px 14px;
  background: color-mix(in srgb, var(--surface-2) 92%, transparent);
  color: var(--text-soft);
}

table.data td {
  padding: 14px;
}

table.data tr:hover td {
  background: var(--table-hover);
}

.consolidated-panel {
  padding: 22px;
}

.consolidated-controls {
  gap: 12px;
  margin-top: 14px;
}

.consolidated-summary-box {
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-2) 88%, transparent);
  line-height: 1.8;
}

.check-inline {
  min-height: 44px;
  padding: 0 12px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 80%, transparent);
}

.pill {
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  letter-spacing: 0.03em;
}

.pill-manual {
  background: rgba(183, 148, 246, 0.14);
  color: #D6BCFA;
}

.empty {
  padding: 52px 22px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface-2) 96%, transparent));
}

.empty h2,
.empty-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(26px, 4vw, 34px);
  letter-spacing: -0.04em;
  color: var(--text);
}

.empty p,
.empty-copy {
  max-width: 64ch;
  margin: 0 auto 18px;
  line-height: 1.8;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
}

.section-head-tight {
  margin-bottom: 14px;
}

.history-grid {
  gap: 18px;
}

.history-card {
  padding: 20px;
  border-radius: 22px;
}

.history-card:hover {
  border-color: color-mix(in srgb, var(--primary) 36%, var(--border));
}

.history-meta,
.history-footer {
  border-top-color: var(--border);
}

.filter-bar {
  background: color-mix(in srgb, var(--surface) 95%, transparent);
  padding: 12px 14px;
}

.filter-pill {
  background: color-mix(in srgb, var(--surface-2) 85%, transparent);
  border-color: var(--border);
}

.filter-pill.is-active {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 72%, var(--info)));
}

.results-hero {
  padding: 24px 26px;
  border-radius: 24px;
}

.hero-grid {
  gap: 22px 30px;
}

.hero-stats {
  gap: 12px;
}

.stat-tile {
  padding: 14px 12px;
  border-radius: 16px;
}

.stat-tile .stat-num {
  letter-spacing: -0.05em;
}

.charts-grid {
  gap: 18px;
}

.chart-wrap {
  border-radius: 18px;
}

.scan-log-output {
  border-radius: 18px;
  background: color-mix(in srgb, var(--surface-2) 92%, transparent);
}

.health-hero {
  border-radius: 26px;
}

.health-title {
  letter-spacing: -0.04em;
}

.health-status-row,
.health-mini-card,
.health-route,
.health-form-note,
.health-kpi {
  border-radius: 18px;
}

.provider-card.is-ok {
  border-color: color-mix(in srgb, var(--primary) 36%, var(--border));
  background:
    radial-gradient(circle at top right, rgba(124, 140, 255, 0.10), transparent 32%),
    linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface-2) 98%, transparent));
}

.provider-option input:checked + .provider-card {
  border-color: color-mix(in srgb, var(--primary) 44%, var(--border));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 12%, transparent), var(--shadow-sm);
}

.modal-backdrop {
  backdrop-filter: blur(12px);
}

.modal-card {
  border-radius: 24px;
}

.modal-head,
.modal-foot {
  border-color: var(--border);
}

.ai-markdown {
  line-height: 1.85;
}

@media (max-width: 1200px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: min(88vw, 320px);
    height: 100vh;
    transform: translateX(-104%);
    transition: transform 220ms ease;
    overflow-y: auto;
  }

  body[data-shell-nav='open'] .shell-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  body[data-shell-nav='open'] .sidebar {
    transform: translateX(0);
  }

  .sidebar-close,
  .nav-toggle {
    display: inline-flex;
  }

  .brand {
    justify-content: space-between;
    width: 100%;
  }

  .nav-item.is-active::before {
    display: none;
  }

  .topbar,
  .content {
    padding-left: 20px;
    padding-right: 20px;
  }

  .topbar {
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .page-grid.page-grid-aside,
  .health-hero-grid,
  .health-layout,
  .health-layout-bottom,
  .dashboard-spotlight-layout,
  .dashboard-latest-body {
    grid-template-columns: 1fr;
  }

  .dashboard-spotlight-actions,
  .dashboard-latest-actions {
    flex-direction: row;
    flex-wrap: wrap;
    min-width: 0;
  }

  .hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-score {
    grid-row: auto;
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .topbar,
  .content {
    padding-left: 16px;
    padding-right: 16px;
  }

  .content-inner {
    gap: 24px;
  }

  .stats,
  .hero-stats,
  .health-kpis {
    grid-template-columns: 1fr;
  }

  .section-head,
  .topbar-actions,
  .topbar-auth,
  .button-row,
  .cta-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .button-row .btn,
  .cta-row .btn,
  .dashboard-spotlight-actions .btn,
  .dashboard-latest-actions .btn,
  .topbar-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .history-grid,
  .provider-grid,
  .provider-picker {
    grid-template-columns: 1fr;
  }
}

/* ================== Premium Refresh 2026 ================== */

:root {
  --font-sans: "Manrope", "Segoe UI", sans-serif;
  --font-display: "Space Grotesk", "Manrope", sans-serif;

  --app-bg:
    radial-gradient(circle at 12% 12%, rgba(124, 140, 255, 0.14), transparent 24%),
    radial-gradient(circle at 88% 18%, rgba(103, 232, 249, 0.08), transparent 26%),
    radial-gradient(circle at 50% 100%, rgba(93, 211, 158, 0.06), transparent 34%),
    linear-gradient(180deg, #080A0F 0%, #0C1017 100%);
  --bg: #0C1017;
  --surface: rgba(18, 23, 34, 0.82);
  --surface-2: rgba(24, 30, 44, 0.92);
  --surface-3: rgba(30, 37, 53, 0.98);
  --border: rgba(128, 144, 180, 0.18);
  --border-strong: rgba(140, 160, 197, 0.28);

  --text: #F3F6FB;
  --text-muted: #9AA6BC;
  --text-soft: #77839A;

  --primary: #7C8CFF;
  --primary-600: #6C7BEB;
  --primary-50: rgba(124, 140, 255, 0.14);
  --info: #67E8F9;
  --info-bg: rgba(103, 232, 249, 0.13);
  --ok: #5DD39E;
  --ok-bg: rgba(93, 211, 158, 0.13);
  --warn: #F4B860;
  --warn-bg: rgba(244, 184, 96, 0.14);
  --risk: #FFB26B;
  --risk-bg: rgba(255, 178, 107, 0.14);
  --bad: #FF8A8A;
  --bad-bg: rgba(255, 138, 138, 0.14);

  --nav-bg: rgba(14, 18, 27, 0.9);
  --nav-text: #B0BCD2;
  --nav-text-active: #FFFFFF;
  --nav-accent: #7C8CFF;
  --topbar-bg: rgba(14, 18, 27, 0.78);
  --ring-track: rgba(124, 140, 255, 0.14);
  --code-bg: rgba(255, 255, 255, 0.06);
  --table-hover: rgba(124, 140, 255, 0.08);

  --alert-ok-text: #BDF4D8;
  --alert-err-text: #FFD2D2;
  --alert-info-text: #CEF8FE;
  --fail-tile-bg: rgba(255, 138, 138, 0.12);
  --fail-tile-border: rgba(255, 138, 138, 0.24);
  --fail-tile-text: #FFB4B4;
  --critical-tile-bg: rgba(255, 116, 116, 0.14);
  --critical-tile-border: rgba(255, 116, 116, 0.28);
  --critical-tile-text: #FFD3D3;
  --high-tile-bg: rgba(255, 178, 107, 0.14);
  --high-tile-border: rgba(255, 178, 107, 0.26);
  --high-tile-text: #FFD09E;

  --shadow-sm: 0 12px 30px rgba(0, 0, 0, 0.18);
  --shadow-md: 0 22px 54px rgba(0, 0, 0, 0.24);
  --shadow-lg: 0 34px 80px rgba(0, 0, 0, 0.32);

  --radius-sm: 10px;
  --radius: 14px;
  --radius-lg: 22px;
  --radius-xl: 30px;
}

:root[data-theme='light'] {
  --app-bg:
    radial-gradient(circle at top left, rgba(124, 140, 255, 0.14), transparent 24%),
    radial-gradient(circle at top right, rgba(103, 232, 249, 0.08), transparent 28%),
    linear-gradient(180deg, #F4F7FC 0%, #EEF3FA 100%);
  --bg: #EEF3FA;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-2: rgba(247, 249, 253, 0.96);
  --surface-3: #FFFFFF;
  --border: rgba(122, 136, 166, 0.15);
  --border-strong: rgba(122, 136, 166, 0.28);
  --text: #111827;
  --text-muted: #667085;
  --text-soft: #8B97AB;
  --primary: #5B6CFF;
  --primary-600: #4B5BE2;
  --primary-50: rgba(91, 108, 255, 0.12);
  --info: #0891B2;
  --info-bg: rgba(8, 145, 178, 0.1);
  --ok: #0E9F6E;
  --ok-bg: rgba(14, 159, 110, 0.1);
  --warn: #C98512;
  --warn-bg: rgba(201, 133, 18, 0.12);
  --risk: #D97706;
  --risk-bg: rgba(217, 119, 6, 0.12);
  --bad: #DC5C5C;
  --bad-bg: rgba(220, 92, 92, 0.12);
  --nav-bg: rgba(255, 255, 255, 0.86);
  --nav-text: #5C6780;
  --nav-text-active: #141826;
  --nav-accent: #5B6CFF;
  --topbar-bg: rgba(255, 255, 255, 0.8);
  --ring-track: rgba(91, 108, 255, 0.12);
  --code-bg: rgba(17, 24, 39, 0.06);
  --table-hover: rgba(91, 108, 255, 0.06);
  --alert-ok-text: #0A5F43;
  --alert-err-text: #8F2323;
  --alert-info-text: #0D5872;
  --shadow-sm: 0 14px 34px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 24px 58px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 36px 84px rgba(15, 23, 42, 0.12);
}

html {
  scroll-behavior: smooth;
}

body {
  position: relative;
  min-height: 100vh;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent 28%),
    repeating-linear-gradient(90deg, transparent 0 79px, rgba(255,255,255,0.018) 79px 80px);
  opacity: 0.22;
  pointer-events: none;
  z-index: -1;
}

a {
  transition: color 180ms ease, opacity 180ms ease;
}

code,
pre,
kbd {
  font-family: "SFMono-Regular", Consolas, Menlo, monospace;
}

.shell-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 7, 11, 0.54);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
  z-index: 30;
}

.app-shell {
  grid-template-columns: 296px minmax(0, 1fr);
  gap: 24px;
  max-width: 1680px;
  margin: 0 auto;
  padding: 24px;
}

.sidebar {
  background: linear-gradient(180deg, rgba(16, 20, 30, 0.92), rgba(12, 16, 24, 0.88));
  border: 1px solid var(--border);
  border-radius: 28px;
  padding: 22px 18px 18px;
  gap: 16px;
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(18px);
  height: calc(100vh - 48px);
  top: 24px;
}

.brand {
  align-items: center;
  padding: 0 4px 18px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
}

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  background: linear-gradient(135deg, #7C8CFF, #67E8F9);
  box-shadow: 0 18px 36px rgba(124, 140, 255, 0.28);
}

.brand-title {
  font-size: 17px;
  letter-spacing: -0.02em;
}

.brand-sub {
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-soft);
  margin-top: 2px;
}

.sidebar-close,
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  cursor: pointer;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease;
}

.sidebar-close:hover,
.nav-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.sidebar-close svg,
.nav-toggle svg {
  width: 18px;
  height: 18px;
}

.sidebar-intro {
  padding: 14px 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(124, 140, 255, 0.12), rgba(103, 232, 249, 0.06));
  border: 1px solid rgba(124, 140, 255, 0.18);
}

.sidebar-intro p {
  margin: 10px 0 0;
  color: var(--text-muted);
  font-size: 12.5px;
  line-height: 1.7;
}

.sidebar-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-section {
  color: var(--text-soft);
  padding: 4px 10px 0;
}

.nav-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-item {
  border: 1px solid transparent;
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--nav-text);
  background: transparent;
  transition: transform 180ms ease, background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
  color: var(--text);
  transform: translateX(2px);
}

.nav-item.is-active {
  background: linear-gradient(180deg, rgba(124, 140, 255, 0.22), rgba(124, 140, 255, 0.1));
  border-color: rgba(124, 140, 255, 0.26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.nav-item.is-active::before {
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 999px;
}

.nav-icon {
  opacity: 0.92;
}

.sidebar-footer {
  margin-top: auto;
  padding: 16px 10px 0;
  border-top: 1px solid var(--border);
  line-height: 1.7;
}

.main {
  gap: 18px;
}

.topbar {
  position: sticky;
  top: 24px;
  z-index: 20;
  padding: 22px 24px;
  background: var(--topbar-bg);
  border: 1px solid var(--border);
  border-radius: 26px;
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(22px);
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}

.page-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--primary-50);
  color: var(--primary);
  font-size: 11px;
  letter-spacing: 0.08em;
  font-weight: 700;
  text-transform: uppercase;
}

.topbar h1 {
  font-size: clamp(1.9rem, 2.8vw, 2.75rem);
  line-height: 1;
  letter-spacing: -0.045em;
}

.topbar-sub {
  font-size: 14px;
  line-height: 1.65;
  max-width: 70ch;
}

.topbar-actions {
  gap: 10px;
}

.page-actions-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.topbar-auth {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.auth-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.content {
  padding: 0 0 64px;
}

.content-inner {
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.theme-toggle {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-muted);
}

.theme-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.btn {
  min-height: 44px;
  padding: 11px 18px;
  border-radius: 14px;
  border-color: var(--border);
  font-family: var(--font-sans);
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, border-color 180ms ease, color 180ms ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible,
.theme-toggle:focus-visible,
.nav-toggle:focus-visible,
.sidebar-close:focus-visible,
.nav-item:focus-visible,
.chip:focus-visible,
.health-route:focus-visible {
  outline: none;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 22%, transparent);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 72%, #ffffff 28%));
  border-color: color-mix(in srgb, var(--primary) 68%, transparent);
  color: #fff;
  box-shadow: 0 16px 34px rgba(124, 140, 255, 0.26);
}

.btn-primary:hover {
  background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 92%, #ffffff 8%), color-mix(in srgb, var(--primary) 72%, #ffffff 28%));
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
  color: var(--text);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--border-strong);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.btn-danger {
  background: rgba(255, 138, 138, 0.06);
  border-color: rgba(255, 138, 138, 0.18);
}

.card,
.table-wrap,
.stat,
.history-card,
.provider-card,
.health-route,
.health-kpi,
.health-mini-card,
.health-form-note,
.health-status-row,
.filter-bar {
  backdrop-filter: blur(18px);
}

.card {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface-2) 98%, transparent));
  border-radius: 24px;
  border-color: var(--border);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.card.is-elevated {
  box-shadow: var(--shadow-md);
}

.card h2,
.section-title {
  letter-spacing: -0.03em;
}

.section-title {
  font-size: 20px;
}

.section-desc,
.hint,
.field .hint,
.meta-label,
.delta,
.stat .label,
.health-route-label,
.health-kpi-label,
.health-mini-label {
  color: var(--text-muted);
}

.card-head,
.section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-head-tight {
  margin-bottom: 12px;
}

.stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
}

.stat {
  padding: 22px;
  border-radius: 24px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface-2) 100%, transparent));
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease;
}

.stat:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.stat .label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.stat .value {
  margin-top: 12px;
  font-size: clamp(2rem, 3vw, 2.8rem);
  letter-spacing: -0.05em;
}

.stat .delta {
  margin-top: 10px;
  line-height: 1.6;
}

.dashboard-spotlight,
.dashboard-latest {
  position: relative;
  overflow: hidden;
}

.dashboard-spotlight::before,
.dashboard-latest::before,
.results-hero::before,
.health-hero::before {
  content: "";
  position: absolute;
  inset: auto -60px -60px auto;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(124, 140, 255, 0.16), transparent 70%);
  pointer-events: none;
}

.dashboard-spotlight-layout,
.dashboard-latest-body {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 24px;
  align-items: center;
}

.dashboard-spotlight-main,
.dashboard-latest-copy {
  min-width: 0;
}

.dashboard-spotlight-meta,
.dashboard-latest-pills,
.cta-row,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dashboard-spotlight-actions,
.dashboard-latest-actions,
.side-stack,
.page-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.dashboard-pillar-stack,
.dashboard-pillars-block {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}

.dashboard-pillars-label {
  margin-bottom: 10px;
}

.score-ring {
  width: 112px;
  height: 112px;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03), 0 18px 36px rgba(0, 0, 0, 0.24);
}

.score-ring::after {
  inset: 10px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.03);
}

.score-ring .num,
.score-ring-xl .num,
.stat-tile .stat-num,
.history-score .score-num,
.health-kpi-value {
  letter-spacing: -0.06em;
}

.pillar {
  border-radius: 20px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface-2) 100%, transparent));
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.pillar:hover,
.provider-card:hover,
.health-route:hover,
.history-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
}

.pillar .bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.empty {
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 92%, transparent), color-mix(in srgb, var(--surface-2) 98%, transparent));
  border: 1px dashed var(--border-strong);
  border-radius: 28px;
  padding: 56px 24px;
}

.empty h2,
.empty-title {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: -0.04em;
}

.empty p,
.empty-copy {
  max-width: 62ch;
  margin: 0 auto 18px;
  color: var(--text-muted);
  line-height: 1.8;
}

.button-row-center,
.cta-row-center {
  justify-content: center;
}

.button-row-compact .btn,
.btn-sm {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 12px;
  font-size: 12px;
}

.page-grid {
  display: grid;
  gap: 24px;
  align-items: start;
}

.page-grid-aside {
  grid-template-columns: minmax(0, 1fr) 340px;
}

.page-stack,
.side-stack {
  gap: 20px;
}

.list-block {
  margin: 8px 0 0 18px;
  padding: 0;
  color: var(--text-muted);
  font-size: 12.75px;
  line-height: 1.8;
}

.list-block-tight {
  margin-top: 6px;
  margin-bottom: 10px;
}

.hint-tight {
  margin-top: 0;
}

.hint-top-gap {
  margin: 12px 0 0;
}

.readable-copy {
  line-height: 1.75;
}

.code-panel {
  max-height: 240px;
  overflow: auto;
  margin: 8px 0;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(9, 12, 19, 0.76);
  color: #EDF2FF;
  font-size: 11.5px;
  line-height: 1.6;
}

.field label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.field input[type="text"],
.field input[type="number"],
.field input[type="password"],
.field input[type="url"],
.field input[type="email"],
.field select,
.field textarea,
.consolidated-input,
.table-toolbar input[type="search"] {
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface-2) 96%, transparent);
  color: var(--text);
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease, transform 180ms ease;
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.consolidated-input:hover,
.table-toolbar input[type="search"]:hover {
  border-color: var(--border-strong);
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.consolidated-input:focus,
.table-toolbar input[type="search"]:focus {
  border-color: color-mix(in srgb, var(--primary) 62%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 18%, transparent);
  background: color-mix(in srgb, var(--surface-3) 96%, transparent);
}

.chip {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
}

.chip:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.chip:has(input:checked),
.chip.is-on {
  background: color-mix(in srgb, var(--primary) 18%, transparent);
  color: var(--text);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--primary) 38%, transparent);
}

.provider-picker,
.provider-grid,
.history-grid,
.pillar-grid,
.form-grid,
.health-mini-grid,
.health-route-grid,
.health-kpis,
.charts-grid {
  gap: 16px;
}

.provider-card,
.history-card,
.health-route,
.health-kpi,
.health-mini-card,
.health-status-row,
.health-form-note,
.filter-bar,
.table-wrap {
  border-radius: 22px;
  border-color: var(--border);
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 94%, transparent), color-mix(in srgb, var(--surface-2) 98%, transparent));
}

.provider-card.is-ok {
  border-color: color-mix(in srgb, var(--primary) 34%, transparent);
}

.provider-option input:checked + .provider-card {
  border-color: color-mix(in srgb, var(--primary) 42%, transparent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent), var(--shadow-sm);
}

.history-card {
  padding: 20px;
}

.history-meta,
.history-footer {
  padding-top: 12px;
  border-top-color: var(--border);
}

.history-score {
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 18px;
}

.table-wrap {
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.table-toolbar {
  padding: 16px 18px;
  border-bottom-color: var(--border);
  background: rgba(255, 255, 255, 0.02);
}

table.data {
  font-size: 13px;
}

table.data th {
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom-color: var(--border);
  font-weight: 700;
}

table.data td {
  padding: 15px 16px;
  border-bottom-color: var(--border);
}

table.data tr:hover td {
  background: var(--table-hover);
}

.filter-pill {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border);
}

.filter-pill.is-active {
  background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 72%, #ffffff 28%));
}

.results-hero {
  padding: 26px;
  border-radius: 28px;
}

.hero-grid {
  gap: 22px 30px;
}

.hero-stats {
  gap: 12px;
}

.stat-tile {
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.hero-actions {
  padding-top: 14px;
  border-top-color: var(--border);
}

.chart-wrap {
  padding: 8px;
}

.scan-log-output {
  border-radius: 18px;
  background: rgba(9, 12, 19, 0.74);
}

.modal-backdrop {
  background: rgba(7, 10, 16, 0.68);
  backdrop-filter: blur(10px);
}

.modal-card {
  border: 1px solid var(--border);
  border-radius: 24px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--surface) 96%, transparent), color-mix(in srgb, var(--surface-2) 98%, transparent));
}

.health-hero-grid,
.health-layout,
.health-layout-bottom {
  gap: 18px;
}

.health-title {
  font-size: clamp(2rem, 3vw, 2.8rem);
  letter-spacing: -0.05em;
}

.health-status-copy strong,
.provider-name,
.history-account {
  letter-spacing: -0.02em;
}

.pill {
  padding: 5px 10px;
  border-radius: 999px;
}

.pill-manual {
  background: rgba(192, 132, 252, 0.16);
  color: #D8B4FE;
}

.pill-aws {
  background: rgba(255, 153, 0, 0.16);
  color: #FFB54A;
}

.alert {
  border-radius: 18px;
  padding: 14px 16px;
}

.login-shell {
  position: relative;
}

@media (max-width: 1280px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .page-grid-aside,
  .health-layout,
  .health-layout-bottom,
  .health-hero-grid {
    grid-template-columns: 1fr;
  }

  .hero-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 16px;
  }

  .sidebar {
    position: fixed;
    inset: 16px auto 16px 16px;
    width: min(88vw, 340px);
    height: auto;
    transform: translateX(calc(-100% - 24px));
    transition: transform 220ms ease;
    z-index: 40;
    top: 16px;
  }

  body[data-shell-nav='open'] .sidebar {
    transform: translateX(0);
  }

  body[data-shell-nav='open'] .shell-overlay {
    opacity: 1;
    pointer-events: auto;
  }

  .sidebar-close,
  .nav-toggle {
    display: inline-flex;
  }

  .brand {
    gap: 12px;
    justify-content: space-between;
  }

  .topbar {
    top: 16px;
    padding: 18px;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .page-actions-wrap {
    width: 100%;
  }

  .dashboard-spotlight-layout,
  .dashboard-latest-body,
  .hero-grid {
    grid-template-columns: 1fr;
  }

  .dashboard-spotlight-actions,
  .dashboard-latest-actions {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .hero-score {
    justify-content: flex-start;
  }
}

@media (max-width: 640px) {
  .content-inner {
    gap: 20px;
  }

  .stats,
  .hero-stats,
  .health-kpis,
  .form-grid,
  .provider-grid,
  .provider-picker,
  .history-grid,
  .pillar-grid,
  .charts-grid {
    grid-template-columns: 1fr;
  }

  .topbar h1,
  .health-title {
    font-size: 1.8rem;
  }

  .topbar,
  .card,
  .table-wrap,
  .stat,
  .history-card,
  .provider-card,
  .health-route,
  .health-kpi,
  .health-mini-card,
  .health-status-row,
  .filter-bar {
    border-radius: 20px;
  }

  .button-row,
  .cta-row {
    width: 100%;
  }

  .button-row .btn,
  .cta-row .btn,
  .page-actions-wrap .btn {
    width: 100%;
    justify-content: center;
  }

  .topbar-auth {
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .auth-chip {
    justify-content: center;
  }

  .table-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  table.data {
    font-size: 12px;
  }

  table.data th,
  table.data td {
    padding: 12px 13px;
  }
}

/* ================== Shell + Results Stabilization ================== */

.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  overflow: visible;
  isolation: isolate;
  padding: 6px;
  background:
    radial-gradient(circle at 50% 38%, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.03) 58%, transparent 100%),
    linear-gradient(180deg, rgba(14, 18, 27, 0.94), rgba(10, 13, 20, 0.98));
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 1px rgba(255, 255, 255, 0.08),
    0 0 10px rgba(255, 255, 255, 0.18),
    0 14px 28px rgba(124, 140, 255, 0.16);
}

.brand-mark::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  filter: blur(2px);
  opacity: 0.55;
  z-index: -1;
}

.brand-mark-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, 0.46)) drop-shadow(0 0 10px rgba(124, 140, 255, 0.16));
}

.sidebar {
  overflow-y: auto;
  overscroll-behavior: contain;
}

.page-results .topbar {
  position: static;
}

.page-results .table-wrap {
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
}

.page-results .results-table {
  min-width: 1080px;
  table-layout: fixed;
}

.page-results .results-table .col-pillar {
  width: 12%;
}

.page-results .results-table .col-severity,
.page-results .results-table .col-status {
  width: 9%;
}

.page-results .results-table .col-check {
  width: 30%;
}

.page-results .results-table .col-resource {
  width: 20%;
}

.page-results .results-table .col-detail {
  width: 20%;
}

.page-results .results-table .finding-check,
.page-results .results-table .finding-resource,
.page-results .results-table .finding-detail,
.page-results .results-table .resource-code {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
}

.page-results .results-table .resource-code {
  display: inline-block;
  max-width: 100%;
  font-size: 11.5px;
}

@media (max-width: 980px) {
  .page-results .topbar {
    position: static;
  }
}

@media (max-width: 640px) {
  .page-results .results-table {
    min-width: 860px;
  }
}

@media print {
  .page-results .content,
  .page-results .content-inner {
    padding: 0 !important;
    gap: 14px !important;
  }

  .page-results .card,
  .page-results .results-hero,
  .page-results .table-wrap,
  .page-results .pillar,
  .page-results .stat-tile {
    background: #ffffff !important;
    color: #111827 !important;
    border: 1px solid #d1d5db !important;
    box-shadow: none !important;
  }

  .page-results .hint,
  .page-results .stat-lbl,
  .page-results .finding-check .hint,
  .page-results .finding-detail {
    color: #4b5563 !important;
  }

  .page-results .hero-actions,
  .page-results .table-toolbar {
    display: none !important;
  }

  .page-results .table-wrap {
    overflow: visible !important;
  }

  .page-results .results-table {
    min-width: 0 !important;
    width: 100% !important;
    table-layout: fixed;
    font-size: 10.5px;
  }

  .page-results .results-table .col-detail,
  .page-results .results-table .finding-detail {
    display: none !important;
  }

  .page-results .results-table .col-pillar {
    width: 15%;
  }

  .page-results .results-table .col-severity,
  .page-results .results-table .col-status {
    width: 11%;
  }

  .page-results .results-table .col-check {
    width: 39%;
  }

  .page-results .results-table .col-resource {
    width: 24%;
  }

  .page-results .results-table th,
  .page-results .results-table td {
    padding: 8px 9px !important;
    color: #111827 !important;
    background: #ffffff !important;
  }

  .page-results .results-table .resource-code {
    color: #1f2937 !important;
    background: #f3f4f6 !important;
    border: 1px solid #e5e7eb !important;
  }

  .page-results .hero-grid,
  .page-results .charts-grid,
  .page-results .pillar-grid {
    grid-template-columns: 1fr !important;
  }
}
