/* ==========================================================================
   SIFRA admin console (v2) — calm, data-first surfaces for the live admin tools.
   Scoped to .ac so it never touches the rest of the dashboard.
   ========================================================================== */
.ac {
  --ac-bg: #0a0f1f;
  --ac-bg-2: #0d1326;
  --ac-bg-3: #111a33;
  --ac-line: rgba(148, 163, 184, .13);
  --ac-line-2: rgba(148, 163, 184, .22);
  --ac-fg: #e8edf6;
  --ac-fg-2: #b4bfd3;
  --ac-mute: #7d8aa5;
  --ac-dim: #56627c;
  --ac-blue: #3b82f6;
  --ac-blue-2: #60a5fa;
  --ac-amber: #d97706;
  --ac-good: #0ca30c;
  --ac-warn: #fab219;
  --ac-serious: #ec835a;
  --ac-crit: #d03b3b;
  --ac-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  color: var(--ac-fg);
  font-size: 15px;
  display: grid;
  gap: 18px;
}
.ac * { box-sizing: border-box; }
.ac .num { font-variant-numeric: tabular-nums; }
.ac .mono { font-family: var(--ac-mono); font-size: .86em; }
.ac .mute { color: var(--ac-mute); }
.ac .dim { color: var(--ac-dim); }

/* Toolbar */
.ac-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.ac-bar .grow { flex: 1 1 auto; }
.ac-seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 10px; background: var(--ac-bg-2); border: 1px solid var(--ac-line); }
.ac-seg button { height: 30px; padding: 0 12px; border-radius: 7px; font-size: 13.5px; font-weight: 600; color: var(--ac-mute); transition: color .15s, background .15s; }
.ac-seg button:hover { color: var(--ac-fg); }
.ac-seg button[aria-pressed="true"] { background: var(--ac-bg-3); color: var(--ac-fg); box-shadow: inset 0 0 0 1px var(--ac-line-2); }
.ac-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 34px; padding: 0 14px; border-radius: 9px; font-size: 13.5px; font-weight: 600;
  color: var(--ac-fg); background: var(--ac-bg-2); border: 1px solid var(--ac-line-2); transition: border-color .15s, background .15s, color .15s; white-space: nowrap; }
.ac-btn:hover { border-color: rgba(148,163,184,.45); background: var(--ac-bg-3); }
.ac-btn:disabled { opacity: .45; cursor: not-allowed; }
.ac-btn svg { width: 15px; height: 15px; }
.ac-btn.primary { background: var(--ac-blue); border-color: var(--ac-blue); color: #fff; }
.ac-btn.primary:hover { background: #2f6fe0; }
.ac-btn.danger { color: #ff9b9b; border-color: rgba(208,59,59,.45); background: rgba(208,59,59,.08); }
.ac-btn.danger:hover { background: rgba(208,59,59,.18); border-color: var(--ac-crit); }
.ac-btn.sm { height: 28px; padding: 0 10px; font-size: 12.5px; border-radius: 7px; }
.ac-btn.ghost { background: transparent; border-color: transparent; color: var(--ac-mute); }
.ac-btn.ghost:hover { color: var(--ac-fg); background: rgba(255,255,255,.04); }
.ac-live { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ac-mute); }
.ac-live i { width: 7px; height: 7px; border-radius: 50%; background: var(--ac-dim); }
.ac-live.on i { background: var(--ac-good); box-shadow: 0 0 0 0 rgba(12,163,12,.5); animation: acPulse 2s infinite; }
@keyframes acPulse { 70% { box-shadow: 0 0 0 7px rgba(12,163,12,0); } 100% { box-shadow: 0 0 0 0 rgba(12,163,12,0); } }
.ac-input, .ac-select { height: 34px; padding: 0 11px; border-radius: 9px; background: var(--ac-bg); border: 1px solid var(--ac-line-2); color: var(--ac-fg); font-size: 13.5px; min-width: 0; }
.ac-input:focus, .ac-select:focus { outline: none; border-color: var(--ac-blue-2); box-shadow: 0 0 0 3px rgba(59,130,246,.18); }
.ac-input::placeholder { color: var(--ac-dim); }
textarea.ac-input { height: auto; padding: 9px 11px; resize: vertical; }

/* Cards & grids */
.ac-card { background: var(--ac-bg); border: 1px solid var(--ac-line); border-radius: 14px; padding: 18px; min-width: 0; }
.ac-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.ac-card h3 { margin: 0; font-size: 16px; font-weight: 700; letter-spacing: .01em; color: var(--ac-fg); }
.ac-card h3 + p, .ac-card header p { margin: 3px 0 0; font-size: 13.5px; color: var(--ac-mute); line-height: 1.4; }
.ac-grid { display: grid; gap: 18px; }
.ac-grid > * { min-width: 0; }
.ac-grid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ac-grid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ac-grid.c21 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
@media (max-width: 1180px) { .ac-grid.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ac-grid.c21 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) { .ac-grid.c2, .ac-grid.c3 { grid-template-columns: minmax(0, 1fr); } }

/* KPIs */
.ac-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); border: 1px solid var(--ac-line); border-radius: 14px; background: var(--ac-bg); overflow: hidden; }
.ac-kpi { padding: 15px 18px; border-right: 1px solid var(--ac-line); min-width: 0; }
.ac-kpi:last-child { border-right: 0; }
.ac-kpi span { display: block; font-size: 12.5px; font-weight: 600; color: var(--ac-mute); letter-spacing: .02em; }
.ac-kpi b { display: block; margin-top: 4px; font-size: 27px; line-height: 1.1; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ac-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ac-kpi b small { font-size: 14px; font-weight: 600; color: var(--ac-mute); margin-left: 3px; }
.ac-kpi em { display: block; margin-top: 3px; font-style: normal; font-size: 12.5px; color: var(--ac-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .ac-kpi { border-right: 0; border-bottom: 1px solid var(--ac-line); } }

/* Status pills (always icon-dot + word, never colour alone) */
.ac-st { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; font-weight: 700; letter-spacing: .02em; white-space: nowrap;
  background: rgba(148,163,184,.1); color: var(--ac-fg-2); }
.ac-st::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ac-st.good { color: #4ade80; background: rgba(12,163,12,.12); }
.ac-st.warn { color: var(--ac-warn); background: rgba(250,178,25,.1); }
.ac-st.serious { color: var(--ac-serious); background: rgba(236,131,90,.12); }
.ac-st.crit { color: #ff7a7a; background: rgba(208,59,59,.14); }
.ac-st.neutral { color: var(--ac-mute); }
.ac-tag { display: inline-block; padding: 2px 7px; border-radius: 6px; font-size: 11.5px; font-weight: 600; background: rgba(148,163,184,.1); color: var(--ac-fg-2); white-space: nowrap; }
.ac-tag.blue { background: rgba(59,130,246,.14); color: var(--ac-blue-2); }

/* Tables */
.ac-tablewrap { overflow: auto; border: 1px solid var(--ac-line); border-radius: 10px; max-height: 520px; }
.ac-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.ac-table th { position: sticky; top: 0; z-index: 1; background: var(--ac-bg-2); text-align: left; font-size: 12px; font-weight: 700; color: var(--ac-mute); letter-spacing: .03em; padding: 9px 12px; border-bottom: 1px solid var(--ac-line); white-space: nowrap; }
.ac-table td { padding: 9px 12px; border-bottom: 1px solid var(--ac-line); color: var(--ac-fg-2); vertical-align: middle; }
.ac-table tr:last-child td { border-bottom: 0; }
.ac-table tbody tr:hover td { background: rgba(255,255,255,.02); }
.ac-table td.r, .ac-table th.r { text-align: right; }
.ac-table td.num { white-space: nowrap; }
.ac-table td.strong { color: var(--ac-fg); font-weight: 600; }
.ac-table .clip { max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-table input[type=checkbox] { width: 15px; height: 15px; accent-color: var(--ac-blue); }
.ac-empty { padding: 28px 16px; text-align: center; color: var(--ac-mute); font-size: 14px; }

/* Bar lists */
.ac-bars { display: grid; gap: 9px; }
.ac-bars .row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 13.5px; }
.ac-bars .row .k { color: var(--ac-fg-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ac-bars .row .v { color: var(--ac-fg); font-weight: 600; font-variant-numeric: tabular-nums; }
.ac-bars .row .v small { color: var(--ac-dim); font-weight: 500; margin-left: 6px; }
.ac-bars .row .track { grid-column: 1 / -1; height: 4px; border-radius: 4px; background: rgba(148,163,184,.1); overflow: hidden; }
.ac-bars .row .track i { display: block; height: 100%; border-radius: 4px; background: var(--ac-blue); }

/* Chart */
.ac-chart { position: relative; }
.ac-chart svg { display: block; width: 100%; overflow: visible; }
.ac-chart .grid line { stroke: rgba(148,163,184,.12); stroke-width: 1; }
.ac-chart .axis text { fill: var(--ac-dim); font-size: 11px; font-family: var(--ac-mono); }
.ac-chart .hit { fill: transparent; cursor: crosshair; }
.ac-chart .hit:hover { fill: rgba(148,163,184,.06); }
.ac-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 13px; color: var(--ac-fg-2); }
.ac-legend span { display: inline-flex; align-items: center; gap: 7px; }
.ac-legend i { width: 10px; height: 10px; border-radius: 3px; }
.ac-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 150px; padding: 9px 11px; border-radius: 9px; background: #060a17; border: 1px solid var(--ac-line-2);
  box-shadow: 0 10px 30px rgba(0,0,0,.45); font-size: 12.5px; color: var(--ac-fg-2); opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; }
.ac-tip.on { opacity: 1; transform: none; }
.ac-tip b { display: block; margin-bottom: 5px; color: var(--ac-fg); font-size: 12.5px; }
.ac-tip div { display: flex; justify-content: space-between; gap: 14px; }
.ac-tip div i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 6px; }

/* Stacked status bar */
.ac-stack { display: flex; gap: 2px; height: 10px; border-radius: 5px; overflow: hidden; }
.ac-stack i { display: block; height: 100%; min-width: 2px; }

/* Meters */
.ac-meter { display: grid; gap: 7px; padding: 14px 0; border-bottom: 1px solid var(--ac-line); }
.ac-meter:last-child { border-bottom: 0; padding-bottom: 0; }
.ac-meter:first-child { padding-top: 0; }
.ac-meter .top { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.ac-meter .name { font-weight: 600; color: var(--ac-fg); font-size: 14.5px; }
.ac-meter .val { font-size: 13.5px; color: var(--ac-fg-2); font-variant-numeric: tabular-nums; }
.ac-meter .track { height: 8px; border-radius: 6px; background: rgba(148,163,184,.1); overflow: hidden; }
.ac-meter .track i { display: block; height: 100%; border-radius: 6px; }
.ac-meter .hint { font-size: 12.5px; color: var(--ac-dim); }

/* Health */
.ac-health { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.ac-svc { padding: 14px; border-radius: 12px; border: 1px solid var(--ac-line); background: var(--ac-bg-2); display: grid; gap: 8px; align-content: start; }
.ac-svc .top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ac-svc b { font-size: 14.5px; color: var(--ac-fg); }
.ac-svc p { margin: 0; font-size: 13px; color: var(--ac-mute); line-height: 1.4; }
.ac-svc .ms { font-family: var(--ac-mono); font-size: 12px; color: var(--ac-dim); }

/* Toggles & settings rows */
.ac-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--ac-line); }
.ac-row:last-child { border-bottom: 0; padding-bottom: 0; }
.ac-row:first-child { padding-top: 0; }
.ac-row .txt b { display: block; font-size: 14.5px; color: var(--ac-fg); }
.ac-row .txt p { margin: 3px 0 0; font-size: 13px; color: var(--ac-mute); line-height: 1.45; max-width: 620px; }
.ac-switch { position: relative; width: 42px; height: 24px; flex-shrink: 0; border-radius: 999px; background: rgba(148,163,184,.25); transition: background .2s; }
.ac-switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.ac-switch[aria-checked="true"] { background: var(--ac-blue); }
.ac-switch[aria-checked="true"].danger { background: var(--ac-crit); }
.ac-switch[aria-checked="true"]::after { transform: translateX(18px); }
.ac-form { display: grid; gap: 10px; }
.ac-form.inline { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1.4fr) auto; align-items: end; }
@media (max-width: 760px) { .ac-form.inline { grid-template-columns: minmax(0, 1fr); } }
.ac-field { display: grid; gap: 5px; font-size: 12.5px; color: var(--ac-mute); font-weight: 600; }

/* Shield mode picker */
.ac-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@media (max-width: 760px) { .ac-modes { grid-template-columns: minmax(0, 1fr); } }
.ac-mode { text-align: left; padding: 14px; border-radius: 12px; border: 1px solid var(--ac-line-2); background: var(--ac-bg-2); display: grid; gap: 6px; transition: border-color .15s, background .15s; }
.ac-mode:hover { border-color: rgba(148,163,184,.45); }
.ac-mode b { font-size: 14.5px; color: var(--ac-fg); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ac-mode p { margin: 0; font-size: 13px; color: var(--ac-mute); line-height: 1.45; }
.ac-mode[aria-pressed="true"] { border-color: var(--ac-blue); background: rgba(59,130,246,.08); }
.ac-mode.lock[aria-pressed="true"] { border-color: var(--ac-crit); background: rgba(208,59,59,.08); }
.ac-mode.attack[aria-pressed="true"] { border-color: var(--ac-warn); background: rgba(250,178,25,.06); }

/* Notices */
.ac-note { display: flex; gap: 12px; padding: 13px 15px; border-radius: 12px; font-size: 13.5px; line-height: 1.5; color: var(--ac-fg-2); background: rgba(59,130,246,.07); border: 1px solid rgba(59,130,246,.25); }
.ac-note.warn { background: rgba(250,178,25,.06); border-color: rgba(250,178,25,.28); }
.ac-note.crit { background: rgba(208,59,59,.08); border-color: rgba(208,59,59,.35); }
.ac-note b { color: var(--ac-fg); }
.ac-note svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; color: var(--ac-blue-2); }
.ac-note.warn svg { color: var(--ac-warn); }
.ac-note.crit svg { color: #ff7a7a; }
.ac-steps { min-width: 0; margin: 8px 0 0; padding-left: 20px; display: grid; gap: 8px; color: var(--ac-fg-2); }
.ac-code { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 8px 10px; border-radius: 8px; background: #060a17; border: 1px solid var(--ac-line); font-family: var(--ac-mono); font-size: 12.5px; color: #bfdbfe; overflow-x: auto; white-space: nowrap; }
.ac-code button { margin-left: auto; flex-shrink: 0; }

/* Guide */
.ac-guide { display: grid; gap: 22px; }
.ac-guide section h4 { margin: 0 0 10px; font-size: 13px; letter-spacing: .08em; text-transform: uppercase; color: var(--ac-mute); font-weight: 700; }
.ac-feature { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 6px 22px; padding: 14px 0; border-top: 1px solid var(--ac-line); }
.ac-feature:first-of-type { border-top: 0; }
@media (max-width: 760px) { .ac-feature { grid-template-columns: minmax(0, 1fr); } }
.ac-feature > b { font-size: 14.5px; color: var(--ac-fg); }
.ac-feature > div p { margin: 0; font-size: 13.5px; color: var(--ac-fg-2); line-height: 1.55; }
.ac-feature > div p + p { margin-top: 4px; color: var(--ac-mute); }
.ac-feature .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }

/* Skeleton */
.ac-skel { height: 14px; border-radius: 6px; background: linear-gradient(90deg, rgba(148,163,184,.08), rgba(148,163,184,.16), rgba(148,163,184,.08)); background-size: 200% 100%; animation: acSkel 1.2s infinite; }
@keyframes acSkel { to { background-position: -200% 0; } }

/* Confirm dialog */
.ac-dialog-back { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 16px; background: rgba(3,6,15,.72); }
.ac-dialog { width: min(440px, 100%); background: #0b1124; border: 1px solid var(--ac-line-2); border-radius: 14px; padding: 20px; box-shadow: 0 30px 80px rgba(0,0,0,.6); color: var(--ac-fg); }
.ac-dialog h4 { margin: 0; font-size: 17px; }
.ac-dialog p { margin: 8px 0 0; font-size: 14px; color: var(--ac-fg-2); line-height: 1.5; }
.ac-dialog .acts { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* Admin console frame (header area of the dashboard section) */
#adminCommandCenter.ac-v2-tab #adminTopStatCards,
#adminCommandCenter.ac-v2-tab .ac-hide-v2 { display: none !important; }

/* Long code lines scroll inside their box instead of widening the card; headers wrap on small screens */
.ac-steps > li { min-width: 0; }
.ac-card > header { flex-wrap: wrap; }
.ac-card > header > div:first-child { flex: 1 1 260px; min-width: 0; }
.ac-code { white-space: normal; }
.ac-code span { word-break: break-word; }
