/**
 * Security Center styling.  Single-file, scoped under .sec-* so
 * it never bleeds into other surfaces.  Uses the same brand
 * tokens as the rest of the app (--bg-ink, --brand-primary, etc).
 */

.sec-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
  margin: 0 0 1.5rem 0;
  padding: 1.5rem 1.75rem;
  background:
    linear-gradient(
      180deg,
      rgba(37, 99, 235, 0.10) 0%,
      rgba(37, 99, 235, 0.02) 100%
    );
  border: 1px solid rgba(96, 165, 250, 0.16);
  border-radius: 18px;
}

.sec-h {
  margin: 0 0 0.35rem 0;
  font-size: clamp(1.4rem, 3vw, 1.85rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text-strong, #e6efff);
}

.sec-sub {
  margin: 0;
  color: var(--text-muted, rgba(230, 239, 255, 0.65));
  font-size: 0.95rem;
}

.sec-score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  min-width: 88px;
}

.sec-score-num {
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-strong, #e6efff);
  font-variant-numeric: tabular-nums;
}

.sec-score-lbl {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted, rgba(230, 239, 255, 0.55));
  margin-top: 2px;
}

/* Quick toggles row - 3-up grid that collapses to 1 col on mobile */
.sec-quick {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  margin: 0 0 1.5rem 0;
}

.sec-toggle {
  padding: 1.1rem 1.25rem;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sec-toggle header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.sec-toggle h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-strong, #e6efff);
}

.sec-toggle-state {
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.sec-toggle-state[data-state="on"]  {
  background: rgba(34, 197, 94, 0.14);
  color: rgb(134, 239, 172);
}
.sec-toggle-state[data-state="off"] {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted, rgba(230, 239, 255, 0.55));
}
.sec-toggle-state[data-state="warn"] {
  background: rgba(234, 179, 8, 0.14);
  color: rgb(253, 224, 71);
}

.sec-toggle-body {
  margin: 0 0 0.5rem 0;
  font-size: 0.85rem;
  line-height: 1.55;
  color: var(--text-muted, rgba(230, 239, 255, 0.65));
  flex: 1;
}

/* Cards: sessions / devices / events / danger */
.sec-card {
  padding: 1.25rem 1.5rem;
  margin: 0 0 1.25rem 0;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
}

.sec-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin: 0 0 0.4rem 0;
}

.sec-card-h {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-strong, #e6efff);
}

.sec-card-sub {
  font-size: 0.85rem;
  color: var(--text-muted, rgba(230, 239, 255, 0.55));
  margin: 0 0 0.85rem 0;
}

/* Lists - sessions + devices */
.sec-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.sec-list-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.9rem;
  align-items: center;
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 11px;
}

.sec-list-item[data-current="true"] {
  border-color: rgba(96, 165, 250, 0.36);
  background: rgba(37, 99, 235, 0.08);
}

.sec-list-icon {
  width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(96, 165, 250, 0.12);
  border-radius: 10px;
  font-size: 1.2rem;
}

.sec-list-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sec-list-title {
  font-weight: 600;
  color: var(--text-strong, #e6efff);
  font-size: 0.92rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.sec-list-current-pill {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px;
  background: rgba(96, 165, 250, 0.2);
  color: rgb(147, 197, 253);
  border-radius: 999px;
}

.sec-list-foot {
  font-size: 0.78rem;
  color: var(--text-muted, rgba(230, 239, 255, 0.55));
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.sec-list-foot > span::after {
  content: "·";
  margin-left: 0.7rem;
  color: rgba(230, 239, 255, 0.3);
}
.sec-list-foot > span:last-child::after { content: ""; }

.sec-list-skel {
  padding: 0.85rem 1rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 11px;
}

/* Events feed - denser */
.sec-events {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}

.sec-event {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.75rem;
  align-items: center;
  padding: 0.55rem 0.85rem;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 9px;
  font-size: 0.86rem;
}

.sec-event[data-severity="high"]     { border-left: 3px solid rgb(234, 179, 8); }
.sec-event[data-severity="critical"] { border-left: 3px solid rgb(248, 113, 113); }

.sec-event-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(96, 165, 250, 0.5);
}
.sec-event[data-severity="high"]     .sec-event-dot { background: rgb(234, 179, 8); }
.sec-event[data-severity="critical"] .sec-event-dot { background: rgb(248, 113, 113); }

.sec-event-text {
  color: var(--text-strong, #e6efff);
}

.sec-event-time {
  font-size: 0.76rem;
  color: var(--text-muted, rgba(230, 239, 255, 0.5));
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Buttons */
.sec-btn {
  appearance: none;
  border: 1px solid rgba(96, 165, 250, 0.3);
  background: rgba(96, 165, 250, 0.12);
  color: var(--text-strong, #e6efff);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.5rem 0.9rem;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 120ms ease, background 120ms ease, border-color 120ms ease;
}
.sec-btn:hover:not(:disabled) {
  background: rgba(96, 165, 250, 0.2);
  border-color: rgba(96, 165, 250, 0.5);
}
.sec-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sec-btn-quiet {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.sec-btn-danger {
  background: rgba(248, 113, 113, 0.1);
  border-color: rgba(248, 113, 113, 0.32);
  color: rgb(252, 165, 165);
}
.sec-btn-danger:hover:not(:disabled) {
  background: rgba(248, 113, 113, 0.18);
  border-color: rgba(248, 113, 113, 0.55);
}

/* Danger zone */
.sec-card-danger {
  border-color: rgba(248, 113, 113, 0.18);
}

.sec-danger-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.sec-danger-item h4 {
  margin: 0 0 0.35rem 0;
  font-size: 0.95rem;
  color: var(--text-strong, #e6efff);
}
.sec-danger-item p {
  margin: 0 0 0.7rem 0;
  font-size: 0.85rem;
  color: var(--text-muted, rgba(230, 239, 255, 0.6));
}

.sec-status {
  margin: 0.75rem 0 0 0;
  min-height: 1.4em;
  font-size: 0.85rem;
  color: var(--text-muted, rgba(230, 239, 255, 0.55));
}
.sec-status[data-tone="error"]   { color: rgb(252, 165, 165); }
.sec-status[data-tone="success"] { color: rgb(134, 239, 172); }

/* Mobile collapse */
@media (max-width: 640px) {
  .sec-hero {
    flex-direction: column;
    align-items: flex-start;
  }
  .sec-list-item { grid-template-columns: auto 1fr; }
  .sec-list-item .sec-btn { grid-column: 1 / -1; justify-self: start; }
}

/* ── Pass-157 - risk banner ───────────────────────────────────── */
.sec-risk-banner-host:empty { display: none; }
.sec-risk {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  margin: 18px 0;
  border-radius: 12px;
  border: 1px solid rgba(234, 179, 8, 0.42);
  background: linear-gradient(180deg, rgba(234,179,8,0.10), rgba(234,179,8,0.05));
  color: #fef3c7;
  flex-wrap: wrap;
}
.sec-risk[data-kind="sign_in_impossible_travel"],
.sec-risk[data-kind="sign_in_anomaly_blocked"] {
  border-color: rgba(239, 68, 68, 0.50);
  background: linear-gradient(180deg, rgba(239,68,68,0.10), rgba(239,68,68,0.05));
  color: #fee2e2;
}
.sec-risk strong { font-size: 14px; }
.sec-risk-meta {
  font-size: 12px;
  opacity: 0.7;
  margin-inline-end: auto;
}
.sec-risk-action {
  appearance: none;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  padding: 6px 14px;
  border-radius: 8px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
}
.sec-risk-action:hover { background: rgba(255,255,255,0.06); }
