/* ============================================================================
   Imara console — design tokens + base + components
   Two themes (dark default / light).
   ============================================================================ */

:root {
  --font-sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "JetBrains Mono", SFMono-Regular, Menlo, monospace;

  /* accent (teal) */
  --accent: #2dd4bf;
  --accent-ink: #042f2a;        /* text on solid accent */
  --accent-bg: rgba(45, 212, 191, 0.10);
  --accent-border: rgba(45, 212, 191, 0.30);

  /* semantic (shared) */
  --ok: #22c55e;   --ok-bg: rgba(34,197,94,0.12);   --ok-border: rgba(34,197,94,0.28);
  --warn: #f59e0b; --warn-bg: rgba(245,158,11,0.12); --warn-border: rgba(245,158,11,0.28);
  --bad: #ef4444;  --bad-bg: rgba(239,68,68,0.12);  --bad-border: rgba(239,68,68,0.28);
  --info: #818cf8; --info-bg: rgba(129,140,248,0.12);--info-border: rgba(129,140,248,0.28);

  /* radii */
  --r-sm: 5px; --r-md: 7px; --r-lg: 10px; --r-xl: 14px;

  /* spacing */
  --base: 13px;
  --row-pad-y: 9px;
  --pad: 20px;
  --gap: 14px;
}

/* ---- THEME: dark (default) ---- */
:root, :root[data-theme="dark"] {
  --bg-deep: #07080a;
  --bg-canvas: #0a0c0f;
  --bg-elevated: #101317;
  --bg-raised: #151a1f;
  --bg-hover: #1a2027;
  --bg-active: #1f262e;
  --border: #1e242b;
  --border-strong: #2c333c;
  --text: #eef1f4;
  --text-muted: #9aa3ad;
  /* Explanations use subtle and faint text: both at least 4.5:1 on the
     panels, so they stay readable. */
  --text-subtle: #8a939e;
  --text-faint: #7b8490;
  --shadow: 0 1px 2px rgba(0,0,0,0.4), 0 8px 24px rgba(0,0,0,0.35);
  --shadow-lg: 0 24px 60px rgba(0,0,0,0.55);
  --grid-line: rgba(255,255,255,0.025);
  color-scheme: dark;
}

/* ---- THEME: light ---- */
:root[data-theme="light"] {
  --bg-deep: #eef0f3;
  --bg-canvas: #f5f6f8;
  --bg-elevated: #ffffff;
  --bg-raised: #ffffff;
  --bg-hover: #eff1f4;
  --bg-active: #e7eaee;
  --border: #e4e7eb;
  --border-strong: #d3d8de;
  --text: #14181d;
  --text-muted: #586069;
  --text-subtle: #5f6873;
  --text-faint: #636c76;
  --accent: #0d9488;
  --accent-ink: #ffffff;
  --accent-bg: rgba(13, 148, 136, 0.10);
  --accent-border: rgba(13, 148, 136, 0.28);
  --shadow: 0 1px 2px rgba(15,23,42,0.06), 0 8px 24px rgba(15,23,42,0.08);
  --shadow-lg: 0 24px 60px rgba(15,23,42,0.18);
  --grid-line: rgba(15,23,42,0.03);
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg-canvas);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-feature-settings: "cv01", "ss01";
}
#root { height: 100%; }
::selection { background: var(--accent-bg); }
.mono { font-family: var(--font-mono); font-feature-settings: "zero" 1; }
.tnum { font-variant-numeric: tabular-nums; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); background-clip: content-box; }

/* ---------------- layout shell ---------------- */
.app { display: grid; grid-template-columns: 232px 1fr; height: 100%; overflow: hidden; }
.main { display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.scroll { flex: 1; overflow-y: auto; overflow-x: hidden; }

/* topbar */
.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 0 var(--pad); height: 56px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg-canvas) 88%, transparent);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.page-title { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }

/* ---------------- sidebar ---------------- */
.sidebar { display: flex; flex-direction: column; height: 100%; overflow: hidden;
  background: var(--bg-deep); border-right: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 9px; padding: 0 16px; height: 56px; flex-shrink: 0;
  border-bottom: 1px solid var(--border); }
.brand-mark { width: 22px; height: 22px; border-radius: 6px; position: relative; flex-shrink: 0;
  background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 55%, #000)); }
.brand-mark::after { content:""; position:absolute; inset:6px 6px auto 6px; height:3px; border-radius:2px;
  background: var(--bg-deep); box-shadow: 0 5px 0 var(--bg-deep); }
.brand-name { font-weight: 650; letter-spacing: -0.02em; font-size: 14px; flex: 1; }
.nav { flex: 1; overflow-y: auto; padding: 12px 10px; }
.nav-group-label { padding: 14px 8px 5px; font-size: 10px; font-weight: 600; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--text-faint); }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 9px; border-radius: var(--r-md);
  color: var(--text-muted); font-size: 13px; font-weight: 450; cursor: pointer; user-select: none;
  transition: background .12s, color .12s; position: relative; white-space: nowrap; }
.nav-item:hover { background: var(--bg-hover); color: var(--text); }
.nav-item.active { background: var(--accent-bg); color: var(--accent); font-weight: 550; }
.nav-item.active::before { content:""; position:absolute; left:-10px; top:7px; bottom:7px; width:2.5px;
  border-radius: 0 2px 2px 0; background: var(--accent); }
.nav-item .count { margin-left: auto; font-size: 11px; padding: 1px 6px; border-radius: 20px;
  background: var(--bg-active); color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.nav-item.alert .count { background: var(--bad-bg); color: var(--bad); }
.nav-foot { border-top: 1px solid var(--border); padding: 12px 16px; flex-shrink: 0; }

/* ---------------- buttons ---------------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border-radius: var(--r-md); border: 1px solid var(--border-strong); background: var(--bg-elevated);
  color: var(--text); font-size: 12.5px; font-weight: 500; white-space: nowrap;
  transition: background .12s, border-color .12s, transform .04s; }
.btn:hover { background: var(--bg-hover); border-color: var(--text-faint); }
.btn:active { transform: translateY(0.5px); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, #000); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-muted); }
.btn.ghost:hover { background: var(--bg-hover); color: var(--text); }
.btn.danger { color: var(--bad); border-color: var(--bad-border); background: var(--bad-bg); }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px;
  border-radius: var(--r-md); border: 1px solid transparent; background: transparent; color: var(--text-muted);
  transition: background .12s, color .12s; }
.icon-btn:hover { background: var(--bg-hover); color: var(--text); }

.kbd { display: inline-flex; align-items: center; gap: 2px; padding: 2px 5px; border-radius: 5px;
  border: 1px solid var(--border-strong); background: var(--bg-elevated); font-family: var(--font-mono);
  font-size: 10.5px; color: var(--text-subtle); line-height: 1; }

/* ---------------- cards / panels ---------------- */
.card { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.card-title { font-size: 12.5px; font-weight: 600; color: var(--text-muted); letter-spacing: 0; white-space: nowrap; }
.panel { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-lg); }

.section { padding: 18px var(--pad); }
.grid { display: grid; gap: var(--gap); }

/* stat card */
.stat { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 14px 16px; position: relative; transition: border-color .14s, transform .1s; overflow: hidden; }
.stat.link { cursor: pointer; }
.stat.link:hover { border-color: var(--border-strong); transform: translateY(-1px); }
.stat-label { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-subtle); }
.stat-val { font-size: 28px; font-weight: 650; letter-spacing: -0.02em; line-height: 1.1; margin-top: 8px;
  font-variant-numeric: tabular-nums; }
.stat-foot { margin-top: 4px; font-size: 11.5px; color: var(--text-faint); }
.stat-icon { position: absolute; top: 13px; right: 14px; color: var(--text-faint); }

/* ---------------- badges / pills ---------------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 20px;
  font-size: 11px; font-weight: 550; border: 1px solid var(--border-strong); white-space: nowrap; line-height: 1.4; }
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.ok { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-border); }
.badge.warn { color: var(--warn); background: var(--warn-bg); border-color: var(--warn-border); }
.badge.bad { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-border); }
.badge.info { color: var(--info); background: var(--info-bg); border-color: var(--info-border); }
.badge.accent { color: var(--accent); background: var(--accent-bg); border-color: var(--accent-border); }
.badge.neutral { color: var(--text-muted); background: var(--bg-raised); }
.badge.sq { border-radius: var(--r-sm); }

.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: var(--r-sm);
  background: var(--bg-raised); border: 1px solid var(--border); font-family: var(--font-mono);
  font-size: 11px; color: var(--text-muted); }
.chip b { color: var(--text); font-weight: 600; }

/* ---------------- tables ---------------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-faint); padding: 8px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0;
  background: var(--bg-elevated); z-index: 1; }
.table td { padding: var(--row-pad-y) 14px; border-bottom: 1px solid var(--border); font-size: 12.5px; vertical-align: middle; }
.table tbody tr { transition: background .1s; }
.table tbody tr.click { cursor: pointer; }
.table tbody tr.click:hover { background: var(--bg-hover); }
.table tbody tr:last-child td { border-bottom: none; }

/* progress / meter */
.meter { height: 5px; border-radius: 20px; background: var(--bg-active); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 20px; background: var(--accent); }

/* divider */

/* input */
.input { height: 32px; padding: 0 10px; border-radius: var(--r-md); border: 1px solid var(--border-strong);
  background: var(--bg-canvas); color: var(--text); font-size: 13px; font-family: inherit; width: 100%; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.input::placeholder { color: var(--text-faint); }
textarea.input { height: auto; padding: 9px 11px; resize: vertical; line-height: 1.55; }

/* code block */
.code { font-family: var(--font-mono); font-size: 12px; line-height: 1.65; white-space: pre; overflow-x: auto;
  background: var(--bg-deep); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px 16px;
  color: var(--text-muted); }
.code .c-kw { color: var(--accent); } .code .c-cm { color: var(--text-faint); font-style: italic; }
.code .c-num { color: var(--info); } .code .c-drop { color: var(--bad); }

/* segmented control */
.seg { display: inline-flex; padding: 2px; border-radius: var(--r-md); background: var(--bg-raised); border: 1px solid var(--border); gap: 2px; }
.seg button { height: 24px; padding: 0 11px; border-radius: 5px; border: none; background: transparent;
  color: var(--text-muted); font-size: 12px; font-weight: 500; white-space: nowrap; }
.seg button.on { background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow); }
/* A choice that cannot be made looks unavailable (its reason is in the title and the text below). */
.seg button:disabled { opacity: .45; cursor: not-allowed; text-decoration: line-through; text-decoration-color: var(--text-faint); }

/* tabs */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.tab { padding: 9px 13px; font-size: 12.5px; font-weight: 500; color: var(--text-subtle); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .12s; }
.tab:hover { color: var(--text); }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }

/* ---------------- drawer ---------------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 40; opacity: 1; animation: fadeIn .16s ease; }
:root[data-theme="light"] .scrim { background: rgba(15,23,42,0.28); }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(720px, 92vw); z-index: 41;
  background: var(--bg-canvas); border-left: 1px solid var(--border-strong); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; opacity: 1; transform: none; animation: slideIn .22s cubic-bezier(.2,.7,.3,1); }
.drawer.wide { width: min(900px, 96vw); }
.drawer-head { display: flex; align-items: flex-start; gap: 12px; padding: 18px 20px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.drawer-body { flex: 1; overflow-y: auto; }
@keyframes slideIn { from { transform: translateX(18px); } }
@keyframes fadeIn { from { opacity: 0; } }

/* command palette */
.cmdk-scrim { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 60; display: flex;
  align-items: flex-start; justify-content: center; padding-top: 14vh; opacity: 1; animation: fadeIn .12s ease; }
.cmdk { width: min(620px, 92vw); background: var(--bg-elevated); border: 1px solid var(--border-strong);
  border-radius: var(--r-xl); box-shadow: var(--shadow-lg); overflow: hidden; }
.cmdk-input { width: 100%; height: 50px; padding: 0 18px; background: transparent; border: none; outline: none;
  color: var(--text); font-size: 15px; font-family: inherit; border-bottom: 1px solid var(--border); }
.cmdk-list { max-height: 50vh; overflow-y: auto; padding: 8px; }
.cmdk-item { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: var(--r-md);
  font-size: 13px; color: var(--text-muted); cursor: pointer; }
.cmdk-item.sel { background: var(--accent-bg); color: var(--text); }
.cmdk-item .hint { margin-left: auto; font-size: 11px; color: var(--text-faint); }

/* misc */
.muted { color: var(--text-muted); } .subtle { color: var(--text-subtle); } .faint { color: var(--text-faint); }
.row { display: flex; align-items: center; } .col { display: flex; flex-direction: column; }
.gap4{gap:4px}.gap6{gap:6px}.gap8{gap:8px}.gap10{gap:10px}.gap12{gap:12px}.gap14{gap:14px}.gap16{gap:16px}
.spread { display: flex; align-items: center; justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.pulse { animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{box-shadow:0 0 0 0 var(--ok-border)} 50%{box-shadow:0 0 0 5px transparent} }
.spin { animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }
.fadein { animation: fadeIn .2s ease; }

/* topology */
.flow-dash { animation: dashmove 1s linear infinite; }
@keyframes dashmove { to { stroke-dashoffset: -28; } }
.ping { animation: ping 1.6s cubic-bezier(0,0,.2,1) infinite; transform-box: fill-box; transform-origin: center; }
@keyframes ping { 0% { opacity: .9; } 70%,100% { opacity: 0; transform: scale(1.5); } }

@media (prefers-reduced-motion: reduce) {
  *, ::before, ::after { animation-duration: .001ms !important; transition-duration: .04s !important; }
}

/* Disabled buttons look disabled everywhere (pages used to dim them one by one). */
.btn:disabled, .icon-btn:disabled { opacity: .5; cursor: not-allowed; }
/* A half-transparent accent still reads as clickable: grey it out instead. */
.btn.primary:disabled { opacity: 1; background: var(--bg-active); border-color: var(--border); color: var(--text-faint); }

/* Compact lists: one row per item, columns set per page, built for
   hundreds of entries (Rules, Groups). */
.list { background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; }
.list-head, .list-row { display: grid; gap: 14px; align-items: center; padding: 10px 16px; }
.list-head { font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); border-bottom: 1px solid var(--border); background: var(--bg-raised); }
.list-row { width: 100%; text-align: left; background: transparent; border: none; border-bottom: 1px solid var(--border); color: inherit; font: inherit; cursor: pointer; transition: background .1s; }
.list-row:last-child { border-bottom: none; }
.list-row:hover { background: var(--bg-hover); }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; line-height: 1.3; padding: 1px 7px; border: 1px solid var(--border); border-radius: 999px; background: var(--bg-raised); white-space: nowrap; }
.rules-cols { grid-template-columns: minmax(0, 1fr) 250px 100px 72px; }
.apps-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) 110px 150px 70px; }
@media (max-width: 1100px) {
  .apps-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 100px 130px; }
  .apps-cols > :nth-child(5) { display: none; }
  .rules-cols { grid-template-columns: minmax(0, 1fr) 200px 88px; }
  .rules-cols > :nth-child(4) { display: none; }
}

/* Applications: parts in order, with what is allowed between them. */
.app-flow { display: flex; align-items: stretch; gap: 0; overflow-x: auto; }
.app-part { flex: 1 1 0; min-width: 170px; display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-raised); }
.app-link { flex: 0 0 auto; width: 132px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 0 8px; text-align: center; }
.app-link .tag { white-space: normal; text-align: center; max-width: 124px; }

/* Rule page: one searchable choice per side. */
.picker { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg-elevated); color: var(--text); font: inherit; font-size: 13px; text-align: left; cursor: pointer; min-width: 0; }
.picker:hover { border-color: var(--border-strong); }
.picker-pop { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 4px); background: var(--bg-elevated); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-lg); padding: 8px; }
.picker-list { max-height: 300px; overflow-y: auto; margin-top: 6px; }
.picker-sec { font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-faint); padding: 8px 8px 4px; }
.picker-opt { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 7px 8px; border: none; background: transparent; color: inherit; font: inherit; font-size: 12.5px; text-align: left; border-radius: var(--r-sm); cursor: pointer; min-width: 0; }
.picker-opt:hover:not(:disabled) { background: var(--bg-hover); }
.picker-opt.on { background: var(--accent-bg); }
.picker-opt.hi { background: var(--bg-hover); box-shadow: inset 2px 0 0 var(--accent); }
.picker-opt:disabled { opacity: 0.55; cursor: not-allowed; }
.gap18 { gap: 18px; }
/* Where a new kind of group starts in the Groups list. */

/* A "?" that opens an explanation (widgets.jsx Help). */
.help-btn { display: inline-flex; align-items: center; justify-content: center; vertical-align: -2px; margin-left: 4px; padding: 0; width: 15px; height: 15px; border: none; background: transparent; color: var(--text-faint); cursor: pointer; border-radius: 50%; flex-shrink: 0; }
.help-btn:hover, .help-btn[aria-expanded="true"] { color: var(--accent); }
.help-pop { position: fixed; z-index: 2000; max-height: 50vh; overflow-y: auto; padding: 10px 12px; background: var(--bg-elevated); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--r-md); box-shadow: var(--shadow-lg); font-size: 12px; font-weight: 400; line-height: 1.5; letter-spacing: 0; text-transform: none; white-space: normal; text-align: left; }
.help-pop p { margin: 0 0 6px; }
.help-pop p:last-child { margin-bottom: 0; }

/* New group: label names on the left, values to pick on the right. */
.cond-grid { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 12px 16px; align-items: start; }
.cond-label { padding-top: 6px; font-size: 10.5px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); overflow-wrap: anywhere; }
.cond-vals { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.cond-opt { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 9px; border: 1px solid var(--border); border-radius: 6px; background: transparent; color: var(--text); font: inherit; font-size: 12px; cursor: pointer; transition: border-color .1s, background .1s; }
.cond-opt:hover { border-color: var(--border-strong); background: var(--bg-hover); }
.cond-opt.on { background: var(--accent-bg); border-color: var(--accent-border); color: var(--accent); font-weight: 600; }
.cond-n { font-size: 10.5px; font-weight: 400; color: var(--text-faint); }
.cond-opt.on .cond-n { color: inherit; opacity: 0.75; }

/* Row buttons show when the row is pointed at or has focus. */
.row-actions > * { opacity: 0; transition: opacity .1s; }
tr:hover .row-actions > *, tr:focus-within .row-actions > *, .row-actions > *:focus { opacity: 1; }
@media (hover: none) { .row-actions > * { opacity: 1; } }

/* Groups: sites and subnets. */
.site-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.site-tile { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--bg-elevated); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: border-color .1s; }
.site-tile:hover { border-color: var(--accent-border); }
.protbar { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: var(--bg-raised); gap: 1px; }
.nets-cols { grid-template-columns: minmax(0, 1fr) 140px 80px minmax(140px, 220px); }
.custom-cols { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) 80px minmax(140px, 220px); }
.stat.on { border-color: var(--accent-border); box-shadow: 0 0 0 1px var(--accent-border) inset; background: var(--accent-bg); }


/* Audit log: a summary strip, entries grouped by day, a detail panel per entry. */
.audit-sum { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; margin-bottom: 14px; }
.audit-sum > div { background: var(--bg-elevated); padding: 10px 14px; display: flex; align-items: baseline; gap: 8px; }
.audit-sum b { font-size: 18px; font-weight: 650; color: var(--text); }
.audit-sum span { font-size: 11.5px; color: var(--text-muted); }
.audit-sum > div.bad b { color: var(--bad); }
.audit-list { overflow: hidden; }
.audit-day { position: sticky; top: 0; z-index: 1; padding: 7px 16px; font-size: 10.5px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted); background: var(--bg-raised); border-bottom: 1px solid var(--border); }
.audit-row { width: 100%; display: grid; grid-template-columns: 70px 128px 28px minmax(0, 1fr) 16px; align-items: center; gap: 12px; padding: 9px 16px; border: none; border-bottom: 1px solid var(--border); background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.audit-row:hover { background: var(--bg-hover); }
.audit-row.on { background: var(--accent-bg); }
.audit-time { font-size: 11.5px; color: var(--text-muted); font-family: var(--font-mono); }
.audit-who { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.audit-avatar { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; font-size: 9.5px; font-weight: 700; background: var(--accent-bg); color: var(--accent); border: 1px solid var(--accent-border); }
.audit-avatar.sys { background: var(--bg-raised); color: var(--text-muted); border-color: var(--border); }
.audit-icon { width: 26px; height: 26px; border-radius: var(--r-md); display: grid; place-items: center; background: var(--bg-raised); border: 1px solid var(--border); }
.audit-text { font-size: 12.5px; line-height: 1.45; min-width: 0; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
@media (max-width: 1100px) {
  .audit-sum { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .audit-row { grid-template-columns: 64px 28px minmax(0, 1fr) 16px; }
  .audit-row .audit-who { display: none; }
}
