/* Security Command Center - premium B2B SaaS design system
   White-label ready. Brand tokens at :root, swap per client. */

:root {
  /* Brand (white-label: override these per tenant) */
  --brand: #1e4fd6;
  --brand-600: #1a44bb;
  --brand-700: #163a9e;
  --brand-tint: #eef2fe;
  --brand-tint-2: #dde6fd;

  /* Neutrals */
  --ink: #0d1424;
  --ink-2: #3a4356;
  --muted: #6b7488;
  --line: #e6e9f0;
  --line-2: #eef0f5;
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-2: #fafbff;

  /* Status */
  --ok: #12855f;
  --ok-tint: #e4f5ee;
  --warn: #b7791f;
  --warn-tint: #fbf1de;
  --risk: #c0392b;
  --risk-tint: #fbe9e6;
  --info: #1e4fd6;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(13,20,36,.04), 0 8px 24px rgba(13,20,36,.06);
  --shadow-lg: 0 2px 6px rgba(13,20,36,.06), 0 24px 60px rgba(13,20,36,.12);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  font-size: 15px;
}
a { color: inherit; text-decoration: none; }
h1,h2,h3,h4 { line-height: 1.2; letter-spacing: -0.01em; color: var(--ink); }

/* Layout shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--ink);
  color: #c8cfdd;
  padding: 22px 16px;
  display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.brand-row { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #4d7bff);
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 15px;
  box-shadow: 0 4px 12px rgba(30,79,214,.4);
}
.brand-name { color: #fff; font-weight: 650; font-size: 15px; letter-spacing: -.02em; }
.brand-sub { color: #8b93a7; font-size: 11px; }
.nav-group-label { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #767f95; padding: 14px 8px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 10px; border-radius: 9px; font-size: 13.5px; color: #c8cfdd;
  transition: background .15s, color .15s; cursor: pointer;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; font-weight: 550; }
.nav-item .ico { width: 17px; height: 17px; opacity: .9; flex: none; }
.sidebar-foot { margin-top: auto; border-top: 1px solid rgba(255,255,255,.08); padding-top: 14px; }
.tenant-chip {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px;
  background: rgba(255,255,255,.05); border-radius: 10px; font-size: 12.5px;
}
.tenant-chip .av { width: 28px; height: 28px; border-radius: 7px; background: var(--brand-700); display:grid; place-items:center; color:#fff; font-weight:600; font-size:12px; }

/* Main */
.main { padding: 26px 34px 60px; max-width: 1180px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.page-title { font-size: 22px; font-weight: 680; }
.page-sub { color: var(--muted); font-size: 13.5px; margin-top: 3px; }
.topbar-actions { display: flex; gap: 10px; align-items: center; }

.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 9px 15px; border-radius: 10px; font-size: 13.5px; font-weight: 550;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  cursor: pointer; transition: all .15s;
}
.btn:hover { border-color: #cdd3df; box-shadow: var(--shadow); }
.btn-primary { background: var(--brand); color: #fff; border-color: var(--brand); }
.btn-primary:hover { background: var(--brand-600); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--ink-2); }

/* Cards + grid */
.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-title { font-size: 14.5px; font-weight: 620; }
.card-note { font-size: 12.5px; color: var(--muted); }

/* Score ring */
.score-wrap { display: flex; align-items: center; gap: 22px; }
.ring { --p: 82; --c: var(--ok); width: 132px; height: 132px; flex: none; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.ring .val b { font-size: 34px; font-weight: 720; letter-spacing: -.02em; }
.ring .val span { font-size: 11px; color: var(--muted); display: block; }
.score-legend { display: flex; flex-direction: column; gap: 9px; }
.score-legend .row { display: flex; align-items: center; gap: 9px; font-size: 13px; color: var(--ink-2); }

/* Stat tiles */
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .k { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.stat .v { font-size: 27px; font-weight: 700; letter-spacing: -.02em; }
.stat .d { font-size: 12px; display: inline-flex; align-items: center; gap: 5px; }
.stat .d.up { color: var(--ok); } .stat .d.down { color: var(--risk); }
.tile-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 4px; }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 99px; font-size: 12px; font-weight: 560; }
.badge.ok { background: var(--ok-tint); color: var(--ok); }
.badge.warn { background: var(--warn-tint); color: var(--warn); }
.badge.risk { background: var(--risk-tint); color: var(--risk); }
.badge.info { background: var(--brand-tint); color: var(--brand-700); }
.dot { width: 8px; height: 8px; border-radius: 99px; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); } .dot.risk { background: var(--risk); }

/* Checklist (compliance module) */
.checklist { display: flex; flex-direction: column; }
.check-item { display: flex; align-items: flex-start; gap: 13px; padding: 13px 0; border-bottom: 1px solid var(--line-2); }
.check-item:last-child { border-bottom: none; }
.check-box { width: 22px; height: 22px; border-radius: 7px; flex: none; display: grid; place-items: center; margin-top: 1px; }
.check-box.done { background: var(--ok); color: #fff; }
.check-box.todo { background: #fff; border: 2px solid var(--warn); color: var(--warn); }
.check-box.na { background: var(--line); color: var(--muted); }
.check-body { flex: 1; }
.check-body .t { font-size: 13.5px; font-weight: 550; }
.check-body .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.check-meta { font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* Progress bars */
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.progress.ok > i { background: var(--ok); }
.progress.warn > i { background: var(--warn); }

/* Timeline (threat activity) */
.timeline { display: flex; flex-direction: column; }
.tl-item { display: flex; gap: 13px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.tl-item:last-child { border-bottom: none; }
.tl-ico { width: 32px; height: 32px; border-radius: 9px; flex: none; display: grid; place-items: center; }
.tl-body .t { font-size: 13.5px; font-weight: 550; }
.tl-body .s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tl-time { margin-left: auto; font-size: 11.5px; color: var(--muted); white-space: nowrap; }

/* Table (MSP view) */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.table td { padding: 13px 12px; border-bottom: 1px solid var(--line-2); font-size: 13.5px; }
.table tr:hover td { background: var(--surface-2); }
.client-cell { display: flex; align-items: center; gap: 11px; }
.client-cell .av { width: 32px; height: 32px; border-radius: 8px; background: var(--brand-tint-2); color: var(--brand-700); display: grid; place-items: center; font-weight: 650; font-size: 12.5px; }

/* Mini score pill */
.scorepill { display: inline-flex; align-items: center; gap: 7px; font-weight: 650; }
.scorepill .num { font-size: 15px; }

/* Callout */
.callout { display: flex; gap: 13px; padding: 15px 17px; border-radius: var(--radius-sm); background: var(--brand-tint); border: 1px solid var(--brand-tint-2); }
.callout.warn { background: var(--warn-tint); border-color: #f2e2c2; }
.callout .c-ico { flex: none; }
.callout .c-body .t { font-weight: 600; font-size: 13.5px; }
.callout .c-body .s { font-size: 12.5px; color: var(--ink-2); margin-top: 3px; }

/* Section spacing */
.section { margin-top: 24px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; margin-bottom: 12px; }

/* Plain-language box */
.plain { background: linear-gradient(180deg, var(--surface), var(--surface-2)); }
.plain p { font-size: 14px; color: var(--ink-2); line-height: 1.65; }
.plain p + p { margin-top: 10px; }
.plain b { color: var(--ink); }

/* Report page (print) */
.report-page { max-width: 820px; margin: 0 auto; background: #fff; }
@media print {
  .sidebar, .topbar-actions, .no-print { display: none !important; }
  .shell { display: block; }
  .main { padding: 0; max-width: none; }
  body { background: #fff; }
  .card { box-shadow: none; border-color: #d8dce6; break-inside: avoid; }
}

@media (max-width: 940px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; }
  .grid-4 { grid-template-columns: repeat(2,1fr); }
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
}
