:root {
  --bg: #0b0d10;
  --bg-2: #12161b;
  --bg-3: #181d24;
  --border: #232a33;
  --text: #e6edf3;
  --muted: #8b97a5;
  --accent: #3b82f6;
  --accent-2: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --mono: "Cascadia Mono", "JetBrains Mono", Consolas, ui-monospace, monospace;
}
body.light-theme {
  --bg: #f0f2f5;
  --bg-2: #e4e7eb;
  --bg-3: #d1d5db;
  --border: #b0b7c0;
  --text: #1a1d23;
  --muted: #6b7280;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }

.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 12px;
  z-index: 500;
  max-width: 400px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  white-space: pre-wrap;
  text-align: center;
}
.toast.hidden { display: none; }
.toast.error { border-color: var(--danger); color: var(--danger); }
.toast.success { border-color: var(--accent-2); }
.toast.auth-toast {
  left: auto;
  right: 20px;
  bottom: 20px;
  transform: none;
  width: min(420px, calc(100vw - 32px));
  max-width: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  text-align: left;
  white-space: normal;
  border-color: rgba(34, 197, 94, 0.52);
  background: linear-gradient(180deg, rgba(10, 20, 30, 0.98), rgba(5, 12, 20, 0.98));
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.48), 0 0 0 1px rgba(34, 197, 94, 0.08);
}
.auth-toast-body {
  min-width: 0;
  display: grid;
  gap: 4px;
}
.auth-toast-body strong {
  color: #ffffff;
  font-size: 13px;
  line-height: 1.25;
}
.auth-toast-body span {
  color: #9eb2c8;
  font-size: 12px;
  line-height: 1.4;
}
.auth-toast-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.auth-toast-actions button,
.auth-toast-actions a {
  min-height: 34px;
  border-radius: 7px;
  border: 1px solid rgba(71, 151, 255, 0.7);
  background: rgba(47, 134, 255, 0.12);
  color: #dceeff;
  font: 800 11px var(--mono);
  text-decoration: none;
  padding: 8px 10px;
  white-space: nowrap;
}
.auth-toast-actions a {
  display: inline-flex;
  align-items: center;
}
.auth-toast-actions button:hover,
.auth-toast-actions a:hover {
  border-color: #62a7ff;
  background: rgba(47, 134, 255, 0.22);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#toolbar {
  position: relative;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
  overflow: visible;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand .logo { font-weight: 700; font-size: 16px; letter-spacing: 1px; color: var(--accent); }
.brand .sub { color: var(--muted); font-size: 11px; }
.tools { display: flex; align-items: center; gap: 8px; }

button {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text);
  background: var(--bg-3);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
}
button:hover { border-color: var(--accent); }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--danger); }
button.danger:hover { border-color: var(--danger); }
button.ghost { background: transparent; }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.small { font-size: 11px; padding: 4px 10px; }

.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  width: 340px;
  z-index: 1100;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.dropdown-menu.hidden { display: none; }
.dropdown-section { display: flex; flex-direction: column; gap: 6px; }
.dropdown-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.dropdown-select {
  font-family: var(--mono); font-size: 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.dropdown-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.bulk-add-row { display: flex; gap: 6px; align-items: center; }
.bulk-count {
  width: 48px; flex: 0 0 48px;
  font-family: var(--mono); font-size: 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 6px;
  text-align: center;
}
.bulk-add-row select { flex: 1; min-width: 0; }
.bulk-add-row .small { flex: 0 0 auto; }
.dropdown-menu textarea {
  font-family: var(--mono); font-size: 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 8px;
  resize: vertical;
}

.status-pill { font-size: 11px; color: var(--muted); padding: 4px 8px; }
.status-pill.busy { color: var(--warn); }
.status-pill.ok { color: var(--accent-2); }

.agent-status {
  border-color: var(--border);
  color: var(--muted);
  white-space: nowrap;
}
.agent-status.online {
  color: var(--accent-2);
  border-color: rgba(24, 212, 180, 0.55);
  background: rgba(24, 212, 180, 0.08);
}
.agent-status.offline {
  color: var(--warn);
  border-color: rgba(245, 158, 11, 0.45);
  background: rgba(245, 158, 11, 0.07);
}

main {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: 1fr 380px;
  min-height: 0;
  transition: grid-template-columns 0.2s ease;
}
main.sidebar-hidden {
  grid-template-columns: 1fr 0px;
}

.sidebar-toggle {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  width: 28px;
  min-height: 72px;
  border-radius: 8px 0 0 8px;
  background: var(--accent);
  border: 1px solid var(--border);
  border-right: none;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
  writing-mode: vertical-lr;
  text-orientation: upright;
  letter-spacing: 2px;
}
.sidebar-toggle:hover,
.sidebar-toggle:hover:not(:disabled) {
  transform: translateY(-50%);
  background: #2d6fd6;
}
.sidebar-toggle.hidden { background: var(--bg-3); color: var(--muted); border-color: var(--border); }
.sidebar-toggle.hidden:hover,
.sidebar-toggle.hidden:hover:not(:disabled) {
  transform: translateY(-50%);
  background: var(--bg-3);
  color: var(--accent);
}

.panels {
  overflow: auto;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(440px, 1fr));
  gap: 12px;
  align-content: start;
}

.panel-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  height: 400px;
  overflow: hidden;
  transition: border-color 0.15s ease;
}
.panel-card:hover {
  border-color: var(--accent);
}
.panel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bg-3);
  border-bottom: 1px solid var(--border);
}
.panel-head .name { font-weight: 600; }
.panel-head .phase {
  font-size: 10px;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  padding: 1px 7px;
}
.panel-head .tag-input {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 6px;
  width: 70px;
  flex: 0 0 70px;
}
.panel-head .run-dot {
  width: 9px; height: 9px; border-radius: 50%;
  flex: 0 0 9px;
}
.panel-head .run-dot.green { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.panel-head .run-dot.red { background: #ef4444; box-shadow: 0 0 6px #ef4444; }
.panel-head .run-dot.pending { animation: pulse-dot 1.2s ease-in-out infinite; }
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.3); }
}
.panel-head .import-btn {
  font-size: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 8px;
  cursor: pointer;
  color: var(--text);
}
.panel-head .import-btn:hover { border-color: var(--accent); color: var(--accent); }
.panel-head .spacer { flex: 1; }
.panel-head .x { cursor: pointer; color: var(--muted); padding: 0 4px; }
.panel-head .x:hover { color: var(--danger); }
.panel-head .model-sel {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 4px;
  max-width: 150px;
  cursor: pointer;
}
.panel-head .model-sel:hover { border-color: var(--accent); }

.modal-card select {
  font-family: var(--mono); font-size: 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 8px;
}

.term-wrap {
  background: #000;
  padding: 6px;
  flex: 1 1 0;
  min-height: 180px;
  position: relative;
  overflow: hidden;
}
.term-wrap .xterm {
  height: 100%;
  overflow: hidden;
}
/* Hide xterm's scrollbar; scrolling is handled via wheel on hover */
.term-wrap .xterm-viewport {
  overflow-y: hidden !important;
  scrollbar-width: none;
}
.term-wrap .xterm-viewport::-webkit-scrollbar {
  display: none;
}

.approval {
  border-top: 1px solid var(--border);
  padding: 6px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-2);
  flex: 0 0 auto;
  max-height: 140px;
  overflow: hidden;
}
.approval .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.approval .gate { font-size: 10px; color: var(--warn); font-weight: 600; }
.approval button { font-size: 10px; padding: 3px 8px; }
.findings-preview {
  max-height: 60px;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 6px;
  white-space: pre-wrap;
  font-size: 10px;
  color: var(--text);
}

aside#sidebar {
  border-left: 1px solid var(--border);
  background: var(--bg-2);
  overflow: auto;
  display: flex;
  flex-direction: column;
  position: relative;
  min-width: 0;
}
main.sidebar-hidden aside#sidebar {
  overflow: hidden;
  border-left: none;
}
main.sidebar-hidden aside#sidebar > *:not(.sidebar-toggle) {
  visibility: hidden;
}
.side-section { padding: 12px; border-bottom: 1px solid var(--border); }
.side-section h2 { font-size: 12px; margin: 0 0 8px; text-transform: uppercase; letter-spacing: 1px; color: var(--text); }
.section-title-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.section-title-row h2 { margin: 0; }
.section-title-row button { flex: 0 0 auto; }
.pdf-export-controls { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.pdf-export-controls select { width: 140px; min-width: 0; }
.muted { color: var(--muted); }

.arranger-controls { display: flex; gap: 6px; margin-bottom: 8px; }
.arranger-controls select { flex: 1; min-width: 0; }
.arranger-controls .small { flex: 0 0 auto; }
.arranger-live {
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.4;
  max-height: 200px;
  overflow-y: auto;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px;
  color: #c8d3e0;
}
.arranger-live.live { border-color: var(--accent); }

.timeline-view {
  max-height: 200px;
  overflow-y: auto;
  font-size: 10px;
  line-height: 1.4;
}
.timeline-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  padding: 3px 0;
  border-bottom: 1px solid var(--border);
}
.ti-icon { flex: 0 0 16px; color: var(--accent); font-weight: 700; text-align: center; }
.ti-time { flex: 0 0 60px; color: var(--muted); font-size: 9px; }
.ti-text { flex: 1; color: var(--text); }

.cost-view { font-size: 11px; }
.cost-total { color: var(--accent-2); font-weight: 600; }

.findings-box {
  white-space: pre-wrap;
  font-size: 10px;
  line-height: 1.5;
  max-height: 30vh;
  overflow: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px;
}
.findings-entry { margin-bottom: 10px; }
.findings-entry .head { color: var(--accent); font-size: 11px; margin-bottom: 2px; }
.findings-entry .body { white-space: pre-wrap; font-size: 11px; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal.hidden { display: none; }
.modal-card {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.modal-card.wide { width: 560px; }
.modal-card h3 { margin: 0; }
.modal-card h4 { margin: 0 0 4px; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.modal-card label { display: flex; flex-direction: column; gap: 4px; font-size: 11px; color: var(--muted); }
.modal-card input, .modal-card textarea, .modal-card select {
  font-family: var(--mono); font-size: 12px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: 6px; padding: 8px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; }
.hint { font-size: 10px; color: var(--muted); margin: 0; }
.hint code { background: var(--bg-3); padding: 1px 4px; border-radius: 3px; }

.agent-status-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  padding: 10px;
  font-size: 12px;
}
.agent-status-panel strong { color: var(--text); }
.agent-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.agent-steps > div,
.pairing-box {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  padding: 10px;
}
.agent-steps strong {
  display: block;
  margin-bottom: 4px;
  font-size: 12px;
}
.pairing-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pairing-code {
  font-size: 22px;
  color: var(--accent);
  letter-spacing: 2px;
  font-weight: 800;
}
.command-box {
  margin: 0;
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #020711;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 11px;
}

.project-area { display: flex; align-items: center; gap: 4px; }
.project-area select {
  font-family: var(--mono); font-size: 11px;
  background: var(--bg-3); color: var(--text);
  border: 1px solid var(--border); border-radius: 5px; padding: 4px 6px;
  max-width: 180px;
}
.project-area select:hover { border-color: var(--accent); }

.project-list { display: flex; flex-direction: column; gap: 6px; max-height: 200px; overflow-y: auto; }
.project-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px;
}
.project-item.active { border-color: var(--accent); }
.project-item .pname { font-weight: 600; font-size: 12px; }
.project-item .ppath { font-size: 10px; color: var(--muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-item .pdel { color: var(--danger); cursor: pointer; padding: 0 6px; }
.project-item .pdel:hover { text-decoration: underline; }
.project-item .psel { font-size: 10px; color: var(--accent); cursor: pointer; }
.project-item .psel:hover { text-decoration: underline; }

.folder-picker { display: flex; gap: 6px; }
.folder-picker input { flex: 1; }
.folder-picker input[readonly] { cursor: pointer; opacity: 0.7; }

.divider { border: none; border-top: 1px solid var(--border); margin: 8px 0; }

.browser-path {
  font-size: 11px; color: var(--accent); background: var(--bg);
  border: 1px solid var(--border); border-radius: 6px; padding: 8px;
  word-break: break-all;
}
.browser-list {
  max-height: 280px; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 4px;
  display: flex; flex-direction: column; gap: 2px;
}
.browser-item {
  font-size: 12px; padding: 5px 8px; border-radius: 4px; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
}
.browser-item:hover { background: var(--bg-3); }
.browser-item .icon { color: var(--accent); }
.browser-item.empty { color: var(--muted); cursor: default; }
.browser-item.empty:hover { background: transparent; }

.empty-hint {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%);
  color: var(--muted); font-size: 14px; text-align: center; pointer-events: none;
}
.empty-hint.hidden { display: none; }

@media (max-width: 900px) {
  main { grid-template-columns: 1fr; }
  aside#sidebar { border-left: none; border-top: 1px solid var(--border); max-height: 40vh; }
}

/* Command-center visual upgrade */
:root {
  --bg: #060a0f;
  --bg-2: #0b1118;
  --bg-3: #111a24;
  --surface: #0d151f;
  --surface-2: #101b27;
  --surface-3: #152333;
  --terminal: #020406;
  --border: #223043;
  --border-strong: #31506b;
  --text: #e8f1f8;
  --muted: #8aa0b5;
  --faint: #617386;
  --accent: #3b82f6;
  --accent-2: #18d4b4;
  --warn: #f59e0b;
  --danger: #ef4444;
  --critical: #b91c1c;
  --high: #ef4444;
  --medium: #f59e0b;
  --low: #3b82f6;
  --info: #18d4b4;
  --unrated: #64748b;
  --ui: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "Cascadia Mono", "JetBrains Mono", Consolas, ui-monospace, monospace;
  --shadow: 0 16px 44px rgba(0, 0, 0, 0.34);
}

body.light-theme {
  --bg: #eef3f8;
  --bg-2: #f7fafc;
  --bg-3: #e8eef5;
  --surface: #ffffff;
  --surface-2: #f4f7fb;
  --surface-3: #e7eef7;
  --terminal: #071018;
  --border: #c6d3df;
  --border-strong: #92a9bb;
  --text: #102033;
  --muted: #5c7084;
  --faint: #7e91a4;
}

body {
  font-family: var(--ui);
  background:
    linear-gradient(90deg, rgba(59, 130, 246, 0.05) 1px, transparent 1px),
    linear-gradient(180deg, rgba(59, 130, 246, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, #05080d 0%, var(--bg) 46%, #05080d 100%);
  background-size: 34px 34px, 34px 34px, auto;
  letter-spacing: 0;
}

#toolbar {
  min-height: 48px;
  padding: 8px 14px;
  background: rgba(8, 13, 20, 0.94);
  border-bottom: 1px solid rgba(49, 80, 107, 0.8);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
  overflow: visible;
}

.brand { align-items: center; gap: 9px; }
.brand .logo {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 15px;
  letter-spacing: 0.5px;
  color: #dff7ff;
}
.brand .logo::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: var(--accent-2);
  box-shadow: 0 0 18px rgba(24, 212, 180, 0.8);
}
.brand .sub {
  font-family: var(--mono);
  color: var(--faint);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
}
.tools { gap: 7px; flex-wrap: wrap; justify-content: flex-end; }

button,
.dropdown-select,
.project-area select,
.modal-card input,
.modal-card textarea,
.modal-card select,
.bulk-count,
.dropdown-menu textarea {
  font-family: var(--ui);
  border-radius: 7px;
  border-color: rgba(71, 96, 123, 0.78);
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease, box-shadow 0.14s ease;
}

button {
  background: linear-gradient(180deg, #162434, #101a26);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}
button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: #4ea2ff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28), 0 0 0 1px rgba(59, 130, 246, 0.18);
}
button.primary {
  background: linear-gradient(180deg, #3b82f6, #1f5fd0);
  border-color: #5ca2ff;
  color: #ffffff;
}
button.ghost {
  background: rgba(13, 21, 31, 0.72);
}
button.danger {
  background: rgba(127, 29, 29, 0.22);
  border-color: rgba(239, 68, 68, 0.45);
}
.status-pill {
  font-family: var(--mono);
  border: 1px solid rgba(71, 96, 123, 0.58);
  border-radius: 999px;
  background: rgba(13, 21, 31, 0.78);
}

main {
  grid-template-columns: minmax(0, 1fr) 420px;
  background: transparent;
}

.workspace {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
}

.ops-dashboard {
  margin: 12px 12px 0;
  padding: 10px;
  display: grid;
  grid-template-columns: minmax(210px, 1.15fr) minmax(360px, 2.1fr) minmax(240px, 0.95fr);
  gap: 10px;
  align-items: stretch;
  background: linear-gradient(180deg, rgba(16, 27, 39, 0.94), rgba(10, 17, 25, 0.96));
  border: 1px solid rgba(49, 80, 107, 0.75);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.ops-identity,
.ops-visual,
.metric-card {
  background: rgba(6, 10, 15, 0.42);
  border: 1px solid rgba(71, 96, 123, 0.48);
  border-radius: 7px;
}

.ops-identity {
  padding: 10px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
}
.ops-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.ops-title {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}
.ops-project {
  max-width: 46%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent-2);
}
.ops-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.ops-metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(62px, 1fr));
  gap: 8px;
}
.metric-card {
  padding: 9px 10px;
  min-width: 0;
  position: relative;
  overflow: hidden;
}
.metric-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--accent);
}
.metric-card.metric-hot::before { background: var(--warn); }
.metric-label {
  display: block;
  font-family: var(--mono);
  color: var(--faint);
  font-size: 9px;
  text-transform: uppercase;
}
.metric-card strong {
  display: block;
  margin-top: 4px;
  font-family: var(--mono);
  font-size: 23px;
  line-height: 1;
  color: #ffffff;
}

.ops-visual {
  padding: 9px 10px;
  min-width: 0;
}
.viz-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  color: var(--muted);
}
.viz-total { color: var(--accent-2); }
.signal-bars,
.risk-bars {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.signal-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 7px;
  font-family: var(--mono);
  font-size: 9px;
}
.signal-row.compact {
  grid-template-columns: 62px minmax(0, 1fr) 22px;
}
.signal-label { color: var(--muted); }
.signal-track {
  height: 6px;
  border-radius: 999px;
  background: rgba(97, 115, 134, 0.18);
  overflow: hidden;
}
.signal-track span {
  display: block;
  height: 100%;
  min-width: 0;
  border-radius: inherit;
  background: var(--unrated);
}
.signal-row strong { color: var(--text); text-align: right; }
.sev-critical .signal-track span { background: var(--critical); }
.sev-high .signal-track span { background: var(--high); }
.sev-medium .signal-track span { background: var(--medium); }
.sev-low .signal-track span { background: var(--low); }
.sev-info .signal-track span { background: var(--info); }
.sev-unrated .signal-track span { background: var(--unrated); }

.panels {
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px;
  grid-template-columns: repeat(auto-fill, minmax(470px, 1fr));
  gap: 12px;
}

.panel-card {
  height: 410px;
  position: relative;
  background: linear-gradient(180deg, rgba(14, 23, 34, 0.98), rgba(8, 13, 20, 0.98));
  border-color: rgba(49, 80, 107, 0.8);
  border-radius: 8px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.34);
}
.panel-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--border-strong);
  z-index: 1;
}
.panel-card.is-working::before { background: var(--danger); }
.panel-card.is-ready::before { background: var(--warn); }
.panel-card.is-awaiting::before { background: var(--accent-2); }
.panel-card:hover {
  border-color: #4ea2ff;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(59, 130, 246, 0.16);
}
.panel-head {
  min-height: 43px;
  padding: 7px 10px 7px 12px;
  background: linear-gradient(180deg, rgba(21, 35, 51, 0.98), rgba(13, 21, 31, 0.98));
}
.panel-head .name {
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--ui);
  font-size: 12px;
}
.panel-head .phase {
  border-radius: 5px;
  font-family: var(--mono);
  text-transform: uppercase;
  background: rgba(59, 130, 246, 0.18);
  color: #8ec5ff;
  border: 1px solid rgba(59, 130, 246, 0.45);
  padding: 2px 6px;
}
.panel-head .tag-input,
.panel-head .model-sel,
.panel-head .import-btn {
  height: 25px;
  background: rgba(3, 7, 12, 0.8);
  border-color: rgba(71, 96, 123, 0.72);
}
.panel-head .model-sel { max-width: 168px; }
.panel-head .import-btn {
  color: #d8edff;
  font-weight: 700;
}
.panel-head .run-dot {
  width: 10px;
  height: 10px;
}
.term-wrap {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.12), transparent 24px),
    var(--terminal);
  padding: 8px;
}
.approval {
  background: rgba(8, 13, 20, 0.98);
  border-top-color: rgba(49, 80, 107, 0.68);
}
.approval .gate {
  color: #ffd28a;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.findings-preview {
  background: #05090e;
  border-color: rgba(71, 96, 123, 0.72);
  border-radius: 6px;
}

aside#sidebar {
  background: linear-gradient(180deg, rgba(10, 17, 25, 0.98), rgba(6, 10, 15, 0.98));
  border-left-color: rgba(49, 80, 107, 0.86);
}
.side-section {
  padding: 12px;
  border-bottom-color: rgba(49, 80, 107, 0.7);
}
.side-section h2 {
  font-family: var(--mono);
  font-size: 10px;
  color: #d7eaff;
  letter-spacing: 1.2px;
}
.section-title-row {
  align-items: flex-start;
}
.pdf-export-controls {
  align-items: stretch;
}
.pdf-export-controls select { width: 150px; }
.arranger-controls { align-items: stretch; }
.arranger-live,
.findings-box,
.timeline-view,
.cost-view,
.risk-signal-view {
  background: rgba(3, 7, 12, 0.82);
  border: 1px solid rgba(49, 80, 107, 0.7);
  border-radius: 7px;
}
.arranger-live {
  max-height: 210px;
  padding: 8px;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28);
}
.arranger-live.live {
  border-color: rgba(24, 212, 180, 0.8);
  box-shadow: 0 0 0 1px rgba(24, 212, 180, 0.12), inset 0 0 20px rgba(24, 212, 180, 0.04);
}
.timeline-view,
.cost-view,
.risk-signal-view {
  padding: 8px;
}
.timeline-item {
  border-bottom-color: rgba(49, 80, 107, 0.55);
}
.ti-icon {
  color: var(--accent-2);
}
.ti-time {
  font-family: var(--mono);
}
.findings-box {
  max-height: 34vh;
  padding: 9px;
  line-height: 1.55;
}
.findings-entry {
  padding: 8px;
  border: 1px solid rgba(49, 80, 107, 0.52);
  border-radius: 7px;
  background: rgba(10, 17, 25, 0.58);
}
.findings-entry .head {
  color: #8ec5ff;
  font-family: var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.risk-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-bottom: 10px;
}
.risk-summary div {
  padding: 8px;
  border-radius: 7px;
  background: rgba(16, 27, 39, 0.84);
  border: 1px solid rgba(71, 96, 123, 0.52);
}
.risk-summary strong {
  display: block;
  font-family: var(--mono);
  font-size: 18px;
}
.risk-summary span {
  display: block;
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 9px;
  text-transform: uppercase;
  color: var(--faint);
}

.modal {
  background: rgba(2, 6, 11, 0.72);
  backdrop-filter: blur(5px);
}
.modal-card {
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(16, 27, 39, 0.98), rgba(8, 13, 20, 0.98));
  border-color: rgba(49, 80, 107, 0.85);
  box-shadow: var(--shadow);
}
.toast {
  border-radius: 8px;
  background: rgba(10, 17, 25, 0.96);
  border-color: rgba(49, 80, 107, 0.86);
}
.empty-hint {
  position: absolute;
  left: 50%;
  top: 52%;
  transform: translate(-50%, -50%);
  padding: 18px 20px;
  border: 1px solid rgba(49, 80, 107, 0.7);
  border-radius: 8px;
  background: rgba(10, 17, 25, 0.88);
  box-shadow: var(--shadow);
  pointer-events: none;
  max-width: calc(100% - 48px);
}

@media (max-width: 1180px) {
  main { grid-template-columns: minmax(0, 1fr) 370px; }
  .ops-dashboard {
    grid-template-columns: 1fr;
  }
  .ops-metrics {
    grid-template-columns: repeat(5, minmax(70px, 1fr));
  }
  .panels {
    grid-template-columns: repeat(auto-fill, minmax(390px, 1fr));
  }
}

@media (max-width: 900px) {
  body { overflow: auto; }
  #toolbar {
    align-items: flex-start;
    gap: 8px;
  }
  .tools {
    justify-content: flex-start;
  }
  main,
  main.sidebar-hidden {
    display: block;
    grid-template-columns: minmax(0, 1fr);
    min-height: auto;
    overflow: visible;
  }
  .workspace {
    overflow: visible;
    width: 100%;
  }
  .ops-dashboard {
    margin: 10px;
  }
  .ops-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ops-visual {
    min-height: 150px;
  }
  .panels {
    padding: 10px;
    grid-template-columns: 1fr;
    overflow: visible;
  }
  .panel-card {
    height: 430px;
  }
  aside#sidebar {
    width: 100%;
    border-left: none;
    border-top: 1px solid rgba(49, 80, 107, 0.86);
    max-height: none;
  }
  main.sidebar-hidden aside#sidebar {
    display: none;
  }
  .sidebar-toggle {
    display: none;
  }
  .empty-hint {
    position: static;
    transform: none;
    margin: 0 10px 12px;
    max-width: none;
  }
}

@media (max-width: 560px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }
  .toast.auth-toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    grid-template-columns: 1fr;
  }
  .auth-toast-actions {
    justify-content: flex-end;
  }
  #toolbar {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    max-width: 100vw;
  }
  .brand {
    width: 100%;
    justify-content: space-between;
    min-width: 0;
  }
  .brand .sub {
    display: none;
  }
  .tools {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    max-width: 100%;
    overflow: hidden;
  }
  .tools > *,
  .tools button,
  .tools .dropdown,
  .tools .dropdown > button {
    min-width: 0;
    max-width: 100%;
  }
  .tools button,
  .tools .dropdown > button {
    width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .project-area,
  #globalStatus {
    grid-column: 1 / -1;
  }
  .project-area,
  .arranger-controls,
  .pdf-export-controls {
    display: flex;
    width: 100%;
    max-width: 100%;
  }
  .project-area select,
  .project-area button,
  .arranger-controls select,
  .arranger-controls button,
  .pdf-export-controls select,
  .pdf-export-controls button {
    flex: 1;
    min-width: 0;
  }
  #themeBtn {
    min-width: 38px;
  }
  #globalStatus {
    display: block;
    width: 100%;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
  }
  main,
  .workspace,
  aside#sidebar,
  .side-section {
    max-width: 100vw;
    overflow-x: hidden;
  }
  .ops-dashboard {
    margin: 8px;
    padding: 8px;
    width: calc(100% - 16px);
    max-width: calc(100vw - 16px);
  }
  .ops-title-row {
    align-items: flex-start;
    flex-direction: column;
  }
  .ops-project {
    max-width: 100%;
  }
  .metric-card strong {
    font-size: 20px;
  }
  .ops-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ops-metrics .metric-card:last-child {
    grid-column: 1 / -1;
  }
  .signal-row,
  .signal-row.compact {
    grid-template-columns: 58px minmax(0, 1fr) 22px;
  }
  .signal-label,
  .signal-row strong {
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .panels {
    width: 100%;
    max-width: 100vw;
  }
  .empty-hint {
    overflow-wrap: anywhere;
  }
  .panel-card {
    min-width: 0;
  }
  .panel-head {
    flex-wrap: wrap;
  }
  .panel-head .name {
    max-width: none;
    flex: 1 1 120px;
  }
  .panel-head .model-sel {
    flex: 1 1 160px;
    max-width: none;
  }
  .section-title-row {
    flex-direction: column;
  }
  .arranger-controls,
  .pdf-export-controls {
    flex-wrap: wrap;
  }
  .pdf-export-controls select {
    width: auto;
  }
  .modal-card,
  .modal-card.wide {
    width: calc(100vw - 24px);
  }
}

/* Auth entry */
.auth-body {
  min-height: 100vh;
  display: block;
  overflow: auto;
  color: #eaf4ff;
  background:
    linear-gradient(90deg, rgba(38, 92, 130, 0.16) 1px, transparent 1px),
    linear-gradient(180deg, rgba(38, 92, 130, 0.11) 1px, transparent 1px),
    linear-gradient(135deg, rgba(18, 212, 180, 0.12), transparent 34%),
    linear-gradient(225deg, rgba(245, 158, 11, 0.12), transparent 38%),
    #05080d;
  background-size: 36px 36px, 36px 36px, auto, auto, auto;
}

.auth-body .hidden {
  display: none !important;
}

.auth-shell {
  position: relative;
  min-height: 100vh;
  padding: 24px;
}

.auth-shell::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), transparent 24%),
    linear-gradient(90deg, transparent 0, rgba(24, 212, 180, 0.05) 48%, transparent 100%);
  mask-image: linear-gradient(180deg, #000 0%, transparent 82%);
}

.auth-topbar,
.auth-main {
  position: relative;
  z-index: 1;
}

.auth-topbar {
  max-width: 1240px;
  margin: 0 auto;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #eaf4ff;
  text-decoration: none;
  min-width: 0;
}

.auth-logo-mark {
  width: 13px;
  height: 13px;
  border-radius: 3px;
  background:
    linear-gradient(180deg, #23e0bf, #149b87);
  box-shadow: 0 0 20px rgba(24, 212, 180, 0.72);
  flex: 0 0 auto;
}

.auth-logo-text {
  font-family: var(--mono);
  font-size: 18px;
  font-weight: 800;
}

.auth-logo-sub {
  font-family: var(--mono);
  font-size: 10px;
  color: #7f92a5;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  white-space: nowrap;
}

.auth-route-nav,
.auth-tabs {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(85, 121, 155, 0.62);
  border-radius: 8px;
  background: rgba(8, 14, 22, 0.82);
  padding: 4px;
  gap: 4px;
}

.auth-route-nav a,
.auth-tabs a {
  color: #9eb1c4;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  padding: 9px 12px;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.auth-route-nav a:hover,
.auth-tabs a:hover {
  color: #ffffff;
  background: rgba(59, 130, 246, 0.16);
}

.auth-route-nav a.active,
.auth-tabs a.active {
  color: #ffffff;
  background: linear-gradient(180deg, #316fdd, #1d4fac);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.auth-main {
  width: 100%;
  max-width: 1240px;
  min-height: calc(100vh - 120px);
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  gap: 34px;
  align-items: center;
}

.auth-visual {
  min-height: 560px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
}

.auth-visual-copy {
  max-width: 660px;
}

.auth-visual-copy h1 {
  margin: 0 0 14px;
  font-size: 48px;
  line-height: 1.02;
  font-weight: 850;
  letter-spacing: 0;
  color: #f5fbff;
}

.auth-visual-copy p {
  margin: 0;
  max-width: 560px;
  color: #99acbf;
  font-size: 15px;
  line-height: 1.65;
}

.auth-command-preview,
.auth-report-strip,
.auth-panel {
  border: 1px solid rgba(71, 109, 144, 0.72);
  border-radius: 8px;
  background: rgba(8, 14, 22, 0.82);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(14px);
}

.auth-command-preview {
  width: min(100%, 760px);
  overflow: hidden;
}

.preview-toolbar {
  height: 43px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px;
  border-bottom: 1px solid rgba(71, 109, 144, 0.46);
  background: rgba(12, 22, 34, 0.86);
}

.preview-toolbar span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #33475d;
}

.preview-toolbar span:nth-child(1) { background: #ef4444; }
.preview-toolbar span:nth-child(2) { background: #f59e0b; }
.preview-toolbar span:nth-child(3) { background: #18d4b4; }

.preview-toolbar strong {
  margin-left: auto;
  color: #8fa5b9;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
}

.preview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(220px, 0.8fr);
  gap: 1px;
  background: rgba(71, 109, 144, 0.36);
}

.preview-terminal,
.preview-signal {
  background: rgba(3, 7, 12, 0.94);
  min-height: 250px;
}

.preview-terminal {
  padding: 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 11px;
  font-family: var(--mono);
}

.terminal-line {
  color: #dbeafe;
  font-size: 13px;
  line-height: 1.45;
}

.terminal-line span {
  color: #f7b955;
  font-weight: 800;
}

.terminal-line.hot { color: #ff7373; }
.terminal-line.amber { color: #f5c164; }
.terminal-line.teal { color: #23e0bf; }

.preview-signal {
  padding: 26px 22px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 17px;
}

.preview-signal div {
  display: grid;
  grid-template-columns: 64px minmax(70px, 1fr) 22px;
  align-items: center;
  gap: 10px;
  color: #8fa5b9;
  font-family: var(--mono);
  font-size: 11px;
}

.preview-signal b,
.preview-signal em {
  font-style: normal;
  font-weight: 700;
}

.preview-signal span {
  height: 7px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, #18d4b4 var(--w), rgba(72, 91, 113, 0.5) var(--w));
}

.auth-report-strip {
  width: min(100%, 760px);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  background: rgba(71, 109, 144, 0.36);
}

.auth-report-strip div {
  min-height: 84px;
  padding: 18px 20px;
  background: rgba(11, 20, 31, 0.94);
}

.auth-report-strip span {
  display: block;
  margin-bottom: 9px;
  color: #7f92a5;
  font-family: var(--mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.9px;
}

.auth-report-strip strong {
  color: #f5fbff;
  font-size: 15px;
  line-height: 1.35;
}

.auth-panel {
  padding: 26px;
}

.signed-in-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding: 12px;
  border: 1px solid rgba(24, 212, 180, 0.36);
  border-radius: 8px;
  background: rgba(24, 212, 180, 0.08);
  color: #b6fff1;
  font-size: 12px;
}

.auth-open-link {
  color: #ffffff;
  font-weight: 800;
  text-decoration: none;
}

.auth-tabs {
  margin-bottom: 24px;
  width: 100%;
}

.auth-tabs a {
  flex: 1 1 0;
  text-align: center;
}

.auth-panel h2 {
  margin: 0;
  color: #f5fbff;
  font-size: 30px;
  line-height: 1.15;
}

.auth-subtitle {
  margin: 9px 0 24px;
  color: #93a7ba;
  font-size: 13px;
  line-height: 1.55;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.auth-field span {
  color: #b6c7d8;
  font-size: 12px;
  font-weight: 800;
}

.auth-field input {
  width: 100%;
  min-height: 46px;
  color: #f5fbff;
  background: rgba(2, 6, 12, 0.8);
  border: 1px solid rgba(85, 121, 155, 0.72);
  border-radius: 7px;
  padding: 0 13px;
  font: 600 13px var(--ui);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.auth-field input::placeholder {
  color: #60758b;
}

.auth-field input:focus {
  border-color: #18d4b4;
  background: rgba(3, 9, 17, 0.94);
  box-shadow: 0 0 0 3px rgba(24, 212, 180, 0.12);
}

.auth-submit {
  min-height: 48px;
  margin-top: 5px;
  font-size: 13px;
  font-weight: 850;
}

.auth-message {
  min-height: 18px;
  color: #93a7ba;
  font-size: 12px;
  line-height: 1.45;
}

.auth-message.error { color: #ff8b8b; }
.auth-message.success { color: #72f2dc; }

.auth-user-pill {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #dff7ff;
}

@media (max-width: 980px) {
  .auth-shell {
    padding: 18px;
  }
  .auth-topbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .auth-logo-sub {
    white-space: normal;
  }
  .auth-route-nav {
    display: none;
  }
  .auth-main {
    min-height: auto;
    grid-template-columns: 1fr;
    gap: 22px;
    padding: 24px 0 6px;
  }
  .auth-panel {
    order: 1;
  }
  .auth-visual {
    order: 2;
    min-height: 0;
  }
  .auth-visual-copy h1 {
    font-size: 36px;
  }
  .preview-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .auth-shell {
    padding: 12px;
  }
  .auth-brand {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .auth-tabs {
    display: grid;
    grid-template-columns: 1fr;
  }
  .auth-panel {
    padding: 18px;
  }
  .auth-panel h2 {
    font-size: 26px;
  }
  .auth-visual-copy h1 {
    font-size: 32px;
  }
  .auth-report-strip {
    grid-template-columns: 1fr;
  }
  .preview-terminal {
    padding: 18px;
  }
  .terminal-line {
    font-size: 12px;
    overflow-wrap: anywhere;
  }
  .signed-in-notice {
    align-items: flex-start;
    flex-direction: column;
  }
}

/* Admin dashboard */
.admin-body {
  min-height: 100vh;
  display: block;
  overflow: auto;
  color: #eaf4ff;
  background:
    linear-gradient(90deg, rgba(42, 92, 130, 0.15) 1px, transparent 1px),
    linear-gradient(180deg, rgba(42, 92, 130, 0.10) 1px, transparent 1px),
    radial-gradient(circle at 12% 0%, rgba(24, 212, 180, 0.16), transparent 28%),
    radial-gradient(circle at 88% 12%, rgba(245, 158, 11, 0.10), transparent 30%),
    #05080d;
  background-size: 36px 36px, 36px 36px, auto, auto, auto;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 58px;
  padding: 10px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(49, 80, 107, 0.82);
  background: rgba(5, 10, 16, 0.92);
  backdrop-filter: blur(14px);
}

.admin-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #f5fbff;
  text-decoration: none;
  min-width: 0;
}

.admin-logo-text {
  font: 850 17px var(--mono);
}

.admin-logo-sub {
  color: #7f92a5;
  font: 700 10px var(--mono);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.admin-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-shell {
  width: min(100%, 1480px);
  margin: 0 auto;
  padding: 18px;
  display: block;
}

.admin-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.82fr);
  gap: 18px;
  align-items: stretch;
  margin-bottom: 16px;
}

.admin-hero > div:first-child,
.admin-health-strip,
.admin-kpi,
.admin-panel {
  border: 1px solid rgba(71, 109, 144, 0.66);
  border-radius: 8px;
  background: rgba(8, 14, 22, 0.84);
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  backdrop-filter: blur(12px);
}

.admin-hero > div:first-child {
  padding: 24px;
  min-height: 148px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.admin-hero h1 {
  margin: 0 0 10px;
  color: #f5fbff;
  font-size: 34px;
  line-height: 1.08;
  font-weight: 850;
  letter-spacing: 0;
}

.admin-hero p {
  margin: 0;
  max-width: 720px;
  color: #9db0c2;
  font-size: 14px;
  line-height: 1.6;
}

.admin-health-strip {
  min-height: 148px;
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.admin-health-strip div {
  border-left: 2px solid rgba(24, 212, 180, 0.8);
  padding: 8px 10px;
  background: rgba(2, 6, 12, 0.38);
}

.admin-health-strip span,
.admin-kpi span,
.admin-panel-head p,
.admin-meta,
.admin-table td span,
.admin-session p,
.admin-record span,
.admin-activity-item time {
  color: #8297aa;
}

.admin-health-strip span,
.admin-kpi span,
.admin-meta {
  display: block;
  font: 750 10px var(--mono);
  letter-spacing: 0.75px;
  text-transform: uppercase;
}

.admin-health-strip strong {
  display: block;
  margin-top: 6px;
  color: #eaf4ff;
  font-size: 13px;
}

.admin-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.admin-kpi {
  padding: 16px;
  min-height: 118px;
  position: relative;
  overflow: hidden;
}

.admin-kpi::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: linear-gradient(180deg, #18d4b4, #3b82f6);
}

.admin-kpi strong {
  display: block;
  margin: 12px 0 8px;
  color: #ffffff;
  font-size: 32px;
  line-height: 1;
  font-weight: 850;
}

.admin-kpi em {
  color: #8fa5b9;
  font-size: 12px;
  font-style: normal;
  line-height: 1.35;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.85fr);
  gap: 16px;
  align-items: start;
}

.admin-panel {
  min-width: 0;
  overflow: hidden;
}

.admin-panel-wide {
  grid-column: span 1;
}

.admin-panel-head {
  min-height: 76px;
  padding: 16px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid rgba(71, 109, 144, 0.44);
}

.admin-panel-head h2 {
  margin: 0 0 6px;
  color: #f5fbff;
  font-size: 15px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.admin-panel-head p {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
}

.admin-table-wrap {
  overflow: auto;
  max-height: 420px;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 690px;
}

.admin-table th,
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(71, 109, 144, 0.34);
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #8fa5b9;
  background: rgba(9, 16, 25, 0.98);
  font: 800 10px var(--mono);
  letter-spacing: 0.75px;
  text-transform: uppercase;
}

.admin-table td {
  color: #dcecff;
  font-size: 12px;
}

.admin-table td strong,
.admin-table td span,
.admin-table td code {
  display: block;
}

.admin-table td strong {
  margin-bottom: 4px;
  color: #ffffff;
  font-weight: 800;
}

.admin-table td code {
  max-width: 310px;
  overflow: hidden;
  color: #9fd8ff;
  text-overflow: ellipsis;
  white-space: nowrap;
  font: 700 11px var(--mono);
}

.role-chip,
.state-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font: 850 10px var(--mono);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.role-admin {
  color: #fff7d6;
  border: 1px solid rgba(245, 158, 11, 0.52);
  background: rgba(245, 158, 11, 0.16);
}

.role-user {
  color: #c8e7ff;
  border: 1px solid rgba(59, 130, 246, 0.46);
  background: rgba(59, 130, 246, 0.12);
}

.state-chip {
  color: #dcecff;
  border: 1px solid rgba(115, 139, 163, 0.5);
  background: rgba(25, 38, 54, 0.72);
}

.state-chip.ok,
.state-awaiting_proceed {
  color: #c8fff5;
  border-color: rgba(24, 212, 180, 0.45);
  background: rgba(24, 212, 180, 0.12);
}

.state-findings_ready {
  color: #fff2c6;
  border-color: rgba(245, 158, 11, 0.52);
  background: rgba(245, 158, 11, 0.14);
}

.state-working,
.state-arranging {
  color: #dbeafe;
  border-color: rgba(59, 130, 246, 0.55);
  background: rgba(59, 130, 246, 0.14);
}

.state-chip.muted {
  color: #94a3b8;
  border-color: rgba(100, 116, 139, 0.42);
  background: rgba(100, 116, 139, 0.1);
}

.admin-severity {
  padding: 16px;
  display: grid;
  gap: 13px;
}

.admin-severity-row {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 11px;
  color: #a8bbce;
  font: 750 11px var(--mono);
  text-transform: capitalize;
}

.admin-severity-row b {
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(82, 105, 128, 0.4);
}

.admin-severity-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #18d4b4;
}

.sev-critical i { background: #ef4444; }
.sev-high i { background: #f97316; }
.sev-medium i { background: #f59e0b; }
.sev-low i { background: #3b82f6; }
.sev-info i { background: #18d4b4; }
.sev-unrated i { background: #94a3b8; }

.admin-session-list,
.admin-activity,
.admin-record-list {
  padding: 14px;
  display: grid;
  gap: 10px;
  max-height: 420px;
  overflow: auto;
}

.admin-session,
.admin-activity-item,
.admin-record {
  border: 1px solid rgba(71, 109, 144, 0.38);
  border-radius: 8px;
  background: rgba(2, 6, 12, 0.42);
  padding: 12px;
}

.admin-session {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
}

.admin-session strong,
.admin-session span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-session strong {
  color: #ffffff;
  font-size: 13px;
}

.admin-session span,
.admin-session p {
  color: #8fa5b9;
  font-size: 11px;
}

.admin-session p {
  grid-column: 1 / -1;
  margin: 0;
}

.admin-activity-item {
  position: relative;
  padding-left: 16px;
}

.admin-activity-item::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 999px;
  background: #3b82f6;
}

.type-user::before { background: #18d4b4; }
.type-finding::before { background: #f59e0b; }
.type-report::before { background: #22c55e; }
.type-panel::before { background: #3b82f6; }
.type-project::before { background: #a78bfa; }

.admin-activity-item span {
  color: #7f92a5;
  font: 800 10px var(--mono);
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.admin-activity-item strong {
  display: block;
  margin: 5px 0;
  color: #f5fbff;
  font-size: 13px;
}

.admin-activity-item p {
  margin: 0 0 7px;
  color: #9db0c2;
  font-size: 12px;
  line-height: 1.4;
}

.admin-two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  background: rgba(71, 109, 144, 0.34);
}

.admin-two-col > div {
  min-width: 0;
  background: rgba(8, 14, 22, 0.82);
}

.admin-two-col h3 {
  margin: 0;
  padding: 13px 14px;
  color: #f5fbff;
  border-bottom: 1px solid rgba(71, 109, 144, 0.34);
  font: 850 12px var(--mono);
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.admin-record {
  border-left: 3px solid #94a3b8;
}

.admin-record.sev-critical { border-left-color: #ef4444; }
.admin-record.sev-high { border-left-color: #f97316; }
.admin-record.sev-medium { border-left-color: #f59e0b; }
.admin-record.sev-low { border-left-color: #3b82f6; }
.admin-record.sev-info,
.admin-record.report { border-left-color: #18d4b4; }

.admin-record div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.admin-record strong {
  min-width: 0;
  color: #ffffff;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-record mark {
  color: #dcecff;
  background: rgba(59, 130, 246, 0.14);
  border: 1px solid rgba(59, 130, 246, 0.4);
  border-radius: 999px;
  padding: 2px 8px;
  font: 850 10px var(--mono);
  text-transform: uppercase;
}

.admin-record p {
  margin: 8px 0 0;
  color: #b6c7d8;
  font-size: 12px;
  line-height: 1.45;
}

.admin-empty,
.admin-empty-block {
  color: #8297aa;
  font-size: 12px;
}

.admin-empty-block {
  padding: 16px;
  border: 1px dashed rgba(71, 109, 144, 0.42);
  border-radius: 8px;
  background: rgba(2, 6, 12, 0.28);
}

.admin-denied {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
}

.admin-denied h1 {
  margin: 0;
  color: #f5fbff;
  font-size: 32px;
}

.admin-denied p {
  max-width: 520px;
  margin: 0;
  color: #9db0c2;
}

.admin-denied a {
  color: #77c6ff;
  font-weight: 800;
}

@media (max-width: 1180px) {
  .admin-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .admin-grid,
  .admin-hero {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .admin-topbar {
    align-items: flex-start;
    flex-direction: column;
  }
  .admin-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .admin-shell {
    padding: 12px;
  }
  .admin-hero h1 {
    font-size: 28px;
  }
  .admin-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .admin-health-strip,
  .admin-two-col {
    grid-template-columns: 1fr;
  }
  .admin-panel-head {
    flex-direction: column;
  }
}

@media (max-width: 460px) {
  .admin-logo-sub {
    display: none;
  }
  .admin-kpis {
    grid-template-columns: 1fr;
  }
  .admin-actions button {
    flex: 1 1 130px;
  }
}

/* Admin command center dashboard */
body.admin-ref-body {
  --admin-bg: #06101a;
  --admin-panel: #0c1722;
  --admin-panel-2: #111d29;
  --admin-panel-3: #152333;
  --admin-line: rgba(93, 121, 148, 0.28);
  --admin-line-strong: rgba(109, 145, 178, 0.42);
  --admin-text: #eef6ff;
  --admin-muted: #9badbd;
  --admin-soft: #6f8296;
  --admin-blue: #2f90ff;
  --admin-green: #32d583;
  --admin-cyan: #1fd5c2;
  --admin-amber: #f7b319;
  --admin-red: #ff4d5a;
  --admin-purple: #a879ff;
  display: block;
  min-height: 100%;
  overflow: auto;
  background:
    linear-gradient(rgba(47, 144, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(47, 144, 255, 0.035) 1px, transparent 1px),
    var(--admin-bg);
  background-size: 36px 36px;
  color: var(--admin-text);
  font-family: Inter, "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
}

.admin-ref-body button,
.admin-ref-body input {
  font-family: inherit;
}

.admin-icon-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.admin-icon {
  display: block;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.admin-ref-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 200px minmax(0, 1fr);
  grid-template-rows: 52px minmax(0, 1fr);
}

.admin-ref-main {
  display: contents;
}

.admin-ref-topbar {
  grid-column: 1 / -1;
  grid-row: 1;
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: minmax(330px, 1fr) minmax(360px, 520px) minmax(360px, 1fr);
  align-items: center;
  gap: 18px;
  height: 52px;
  padding: 0 14px;
  background: rgba(8, 16, 25, 0.96);
  border-bottom: 1px solid var(--admin-line);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
}

.admin-ref-brand,
.admin-ref-account {
  display: flex;
  align-items: center;
  min-width: 0;
}

.admin-ref-brand {
  gap: 14px;
}

.admin-ref-brand a {
  color: #ffffff;
  text-decoration: none;
  font-size: 22px;
  font-weight: 850;
  letter-spacing: 0;
}

.admin-ref-brand span {
  color: var(--admin-muted);
  font-size: 13px;
  white-space: nowrap;
}

.admin-menu-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  color: #c9d5e1;
  background: transparent;
  border-color: transparent;
}

.admin-ref-search {
  justify-self: center;
  width: 100%;
  min-width: 0;
  height: 32px;
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  background: rgba(6, 13, 21, 0.84);
  border: 1px solid var(--admin-line-strong);
  border-radius: 5px;
}

.admin-ref-search .search-icon {
  width: 17px;
  height: 17px;
  margin-left: 8px;
  color: #7f93a8;
}

.admin-ref-search input {
  min-width: 0;
  color: #dce9f6;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 13px;
}

.admin-ref-search kbd {
  padding: 2px 8px;
  color: #8ea0b2;
  background: rgba(18, 31, 45, 0.85);
  border: 1px solid rgba(109, 145, 178, 0.26);
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.admin-ref-account {
  justify-content: flex-end;
  gap: 10px;
}

.admin-ref-account > div:not(.admin-avatar) {
  min-width: 0;
}

.admin-ref-account strong {
  display: block;
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.admin-ref-account span {
  display: block;
  color: var(--admin-muted);
  font-size: 11px;
}

.admin-live-status {
  min-width: 72px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 10px;
  color: #9fb0c1;
  background: rgba(8, 16, 25, 0.65);
  border: 1px solid var(--admin-line);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 850;
}

.admin-live-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.admin-live-status.live {
  color: var(--admin-green);
  border-color: rgba(50, 213, 131, 0.38);
  background: rgba(50, 213, 131, 0.08);
}

.admin-live-status.connecting {
  color: var(--admin-amber);
  border-color: rgba(247, 179, 25, 0.34);
  background: rgba(247, 179, 25, 0.08);
}

.admin-live-status.offline {
  color: var(--admin-red);
  border-color: rgba(255, 77, 90, 0.34);
  background: rgba(255, 77, 90, 0.08);
}

.icon-btn,
.admin-logout-mini {
  height: 32px;
  border-radius: 5px;
  background: transparent;
  border-color: var(--admin-line);
}

.icon-btn {
  position: relative;
  width: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  color: #c5d2df;
}

.icon-btn .admin-icon {
  width: 18px;
  height: 18px;
}

.icon-btn em {
  position: absolute;
  right: -3px;
  top: -5px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: var(--admin-red);
  border-radius: 999px;
  font-size: 10px;
  font-style: normal;
  font-weight: 900;
}

.admin-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #eef6ff;
  background: linear-gradient(135deg, #516477, #8a9bad);
  border: 1px solid rgba(255, 255, 255, 0.13);
  font-size: 12px;
  font-weight: 850;
}

.admin-logout-mini {
  padding: 0 10px;
  color: #f6d0d2;
}

.admin-ref-sidebar {
  grid-column: 1;
  grid-row: 2;
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto auto;
  gap: 12px;
  padding: 14px 12px 16px;
  background: linear-gradient(180deg, rgba(10, 23, 34, 0.96), rgba(6, 13, 20, 0.98));
  border-right: 1px solid var(--admin-line);
}

.admin-ref-nav {
  min-height: 0;
  overflow: auto;
}

.admin-ref-nav button {
  width: 100%;
  min-height: 31px;
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  gap: 7px;
  margin: 0 0 4px;
  padding: 7px 10px;
  color: #c8d3df;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 5px;
  text-align: left;
  font-size: 13px;
  font-weight: 650;
}

.admin-ref-nav button.active,
.admin-ref-nav button:hover {
  color: #78bdff;
  background: rgba(47, 144, 255, 0.16);
  border-color: rgba(47, 144, 255, 0.22);
}

.admin-ref-nav p {
  margin: 18px 12px 9px;
  color: #7d8fa3;
  font-size: 10px;
  font-weight: 850;
  letter-spacing: 0.7px;
  text-transform: uppercase;
}

.admin-ref-nav hr {
  margin: 12px 0;
  border: 0;
  border-top: 1px solid var(--admin-line);
}

.nav-mark {
  width: 17px;
  height: 17px;
  color: #a9bacb;
}

.admin-ref-nav button.active .nav-mark,
.admin-ref-nav button:hover .nav-mark {
  color: #69b7ff;
}

.metric-glyph {
  width: 18px;
  height: 18px;
  color: #8da1b4;
}

.admin-ref-status {
  padding: 12px;
  background: rgba(16, 29, 42, 0.86);
  border: 1px solid var(--admin-line);
  border-radius: 5px;
}

.admin-ref-status h3 {
  margin: 0 0 9px;
  color: #ffffff;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.admin-ref-status strong {
  display: flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  margin-bottom: 14px;
  padding: 4px 8px;
  color: #8ff2bd;
  background: rgba(50, 213, 131, 0.12);
  border-radius: 4px;
  font-size: 11px;
}

.admin-ref-status strong i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--admin-green);
}

.admin-ref-status div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  color: #b8c7d6;
  font-size: 12px;
}

.admin-ref-status b {
  color: var(--admin-green);
  font-size: 11px;
}

.admin-ref-sidebar footer {
  color: #718396;
  text-align: center;
  font-size: 12px;
}

.admin-ref-content {
  grid-column: 2;
  grid-row: 2;
  display: block;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  padding: 14px 18px;
}

.admin-ref-kpis {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 10px;
}

.admin-ref-kpi {
  min-height: 104px;
  padding: 14px 13px 10px;
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(18, 32, 45, 0.95), rgba(10, 20, 31, 0.96));
  border: 1px solid var(--admin-line);
  border-radius: 5px;
}

.admin-ref-kpi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--admin-green);
}

.admin-ref-kpi.metric-sessions::before { background: var(--admin-cyan); }
.admin-ref-kpi.metric-projects::before { background: var(--admin-blue); }
.admin-ref-kpi.metric-panels::before { background: var(--admin-purple); }
.admin-ref-kpi.metric-findings::before { background: var(--admin-amber); }
.admin-ref-kpi.metric-reports::before { background: var(--admin-red); }

.admin-ref-kpi div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: #a9b9c8;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.metric-glyph {
  color: #8da1b4;
}

.admin-ref-kpi strong {
  display: block;
  margin-top: 8px;
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
  font-weight: 850;
}

.admin-ref-kpi p {
  margin: 6px 0 0;
  color: #9babb9;
  font-size: 11px;
}

.admin-ref-kpi em {
  margin-left: 5px;
  font-style: normal;
  font-weight: 850;
}

.admin-ref-kpi .kpi-sparkline {
  position: absolute;
  right: 12px;
  bottom: 10px;
  width: 96px;
  height: 40px;
}

.admin-ref-kpi .kpi-sparkline path {
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.admin-ref-kpi.metric-users .kpi-sparkline path { color: var(--admin-green); }
.admin-ref-kpi.metric-sessions .kpi-sparkline path { color: var(--admin-cyan); }
.admin-ref-kpi.metric-projects .kpi-sparkline path { color: var(--admin-blue); }
.admin-ref-kpi.metric-panels .kpi-sparkline path { color: var(--admin-purple); }
.admin-ref-kpi.metric-findings .kpi-sparkline path { color: var(--admin-amber); }
.admin-ref-kpi.metric-reports .kpi-sparkline path { color: var(--admin-red); }

.admin-ref-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 430px;
  grid-template-areas:
    "sessions risk"
    "activity side"
    "projects reports";
  gap: 10px;
  align-items: stretch;
}

.admin-ref-card {
  min-width: 0;
  height: 100%;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(17, 31, 43, 0.96), rgba(10, 20, 30, 0.98));
  border: 1px solid var(--admin-line);
  border-radius: 5px;
  box-shadow: inset 0 1px rgba(255, 255, 255, 0.03);
}

.admin-active-sessions { grid-area: sessions; }
.admin-risk-overview { grid-area: risk; }
.admin-recent-activity { grid-area: activity; }
.admin-ref-stack { grid-area: side; }
.admin-top-projects { grid-area: projects; }
.admin-recent-reports { grid-area: reports; }

.admin-ref-card-head {
  min-height: 36px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-bottom: 1px solid rgba(93, 121, 148, 0.18);
}

.admin-ref-card-head h2 {
  margin: 0;
  color: #ffffff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.small-view-btn {
  height: 24px;
  padding: 0 8px;
  color: #c4d2df;
  background: rgba(8, 16, 25, 0.65);
  border: 1px solid var(--admin-line);
  border-radius: 4px;
  font-size: 11px;
}

.admin-ref-table-wrap {
  overflow: auto;
}

.admin-ref-table {
  width: 100%;
  min-width: 790px;
  border-collapse: collapse;
  table-layout: fixed;
}

.admin-ref-table.compact {
  min-width: 620px;
}

.admin-active-sessions .admin-ref-table {
  min-width: 100%;
}

.admin-active-sessions .admin-ref-table th:nth-child(1),
.admin-active-sessions .admin-ref-table td:nth-child(1) { width: 16%; }
.admin-active-sessions .admin-ref-table th:nth-child(2),
.admin-active-sessions .admin-ref-table td:nth-child(2) { width: 10%; }
.admin-active-sessions .admin-ref-table th:nth-child(3),
.admin-active-sessions .admin-ref-table td:nth-child(3) { width: 18%; }
.admin-active-sessions .admin-ref-table th:nth-child(4),
.admin-active-sessions .admin-ref-table td:nth-child(4) { width: 14%; }
.admin-active-sessions .admin-ref-table th:nth-child(5),
.admin-active-sessions .admin-ref-table td:nth-child(5) { width: 14%; }
.admin-active-sessions .admin-ref-table th:nth-child(6),
.admin-active-sessions .admin-ref-table td:nth-child(6) { width: 13%; }
.admin-active-sessions .admin-ref-table th:nth-child(7),
.admin-active-sessions .admin-ref-table td:nth-child(7) { width: 15%; }

.admin-recent-reports .admin-ref-table {
  min-width: 100%;
}

.admin-recent-reports .admin-ref-table th,
.admin-recent-reports .admin-ref-table td {
  padding-left: 9px;
  padding-right: 9px;
}

.admin-recent-reports .admin-ref-table th:nth-child(1),
.admin-recent-reports .admin-ref-table td:nth-child(1) { width: 31%; }
.admin-recent-reports .admin-ref-table th:nth-child(2),
.admin-recent-reports .admin-ref-table td:nth-child(2) { width: 24%; }
.admin-recent-reports .admin-ref-table th:nth-child(3),
.admin-recent-reports .admin-ref-table td:nth-child(3) { width: 17%; }
.admin-recent-reports .admin-ref-table th:nth-child(4),
.admin-recent-reports .admin-ref-table td:nth-child(4) { width: 15%; }
.admin-recent-reports .admin-ref-table th:nth-child(5),
.admin-recent-reports .admin-ref-table td:nth-child(5) { width: 13%; }

.admin-ref-table th,
.admin-ref-table td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(93, 121, 148, 0.17);
  text-align: left;
  vertical-align: middle;
}

.admin-ref-table th {
  color: #d7e3ee;
  font-size: 11px;
  font-weight: 750;
}

.admin-ref-table td {
  color: #c5d3e1;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.session-user {
  display: grid;
  grid-template-columns: 10px 26px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.session-user i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--admin-green);
}

.session-user span {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  color: #ffffff;
  background: #52667a;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 850;
}

.session-user strong {
  min-width: 0;
  overflow: hidden;
  color: #f8fbff;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-role {
  display: inline-grid;
  place-items: center;
  min-width: 42px;
  padding: 3px 7px;
  color: #ffffff;
  background: #2d74ba;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 750;
  text-transform: capitalize;
}

.admin-role.admin {
  background: #c33c3f;
}

.row-action {
  min-height: 24px;
  margin-right: 6px;
  padding: 3px 8px;
  color: #56b2ff;
  background: rgba(47, 144, 255, 0.1);
  border-color: rgba(47, 144, 255, 0.5);
  border-radius: 4px;
  font-size: 11px;
}

.row-action.revoke {
  color: #ff6c6c;
  background: rgba(255, 77, 90, 0.08);
  border-color: rgba(255, 77, 90, 0.45);
}

.admin-action-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, .8fr) 120px auto;
  gap: 10px;
  align-items: end;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid rgba(73, 137, 190, 0.34);
  background: rgba(7, 18, 29, 0.74);
}

.admin-action-form label {
  display: grid;
  gap: 6px;
  color: #9bb2c8;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.admin-action-form input,
.admin-action-form select {
  min-height: 34px;
  border: 1px solid rgba(82, 131, 172, 0.52);
  border-radius: 6px;
  background: rgba(4, 12, 20, 0.86);
  color: #e9f4ff;
  padding: 0 10px;
  font: inherit;
  text-transform: none;
  letter-spacing: 0;
}

.admin-action-result {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  padding: 12px;
  border: 1px solid rgba(24, 212, 180, 0.42);
  background: rgba(12, 56, 49, 0.25);
}

.admin-action-result > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.admin-action-result p {
  margin: 0;
  color: #b9cce0;
}

.admin-action-result textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  border: 1px solid rgba(82, 131, 172, 0.52);
  border-radius: 6px;
  background: rgba(2, 8, 14, 0.88);
  color: #87f7df;
  padding: 10px;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.admin-actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 240px;
}

.risk-overview-body {
  display: grid;
  grid-template-columns: 185px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 190px;
  padding: 18px 16px;
}

.risk-donut {
  width: 150px;
  height: 150px;
  justify-self: center;
  display: grid;
  place-items: center;
  position: relative;
  border-radius: 50%;
  background: conic-gradient(#263442 0deg 360deg);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.risk-donut::after {
  content: "";
  position: absolute;
  inset: 34px;
  background: #101c28;
  border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.05);
}

.risk-donut strong,
.risk-donut span {
  position: relative;
  z-index: 1;
  text-align: center;
}

.risk-donut strong {
  color: #ffffff;
  font-size: 28px;
  line-height: 1;
  font-weight: 900;
}

.risk-donut span {
  margin-top: 31px;
  color: #b5c3d0;
  font-size: 11px;
  position: absolute;
}

.risk-legend {
  display: grid;
  gap: 13px;
}

.risk-legend div {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 8px;
  color: #c8d5e0;
  font-size: 12px;
}

.risk-legend i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
}

.risk-legend strong {
  color: #dce7f1;
  font-weight: 750;
}

.admin-ref-stack {
  display: grid;
  gap: 10px;
}

.health-rows,
.usage-rows {
  display: grid;
  gap: 0;
  padding: 8px 12px 12px;
}

.health-rows > div,
.usage-rows > div {
  min-height: 28px;
  display: grid;
  align-items: center;
  gap: 10px;
  color: #c8d4df;
  font-size: 12px;
}

.health-rows > div {
  grid-template-columns: minmax(120px, 1fr) 92px 120px;
}

.health-rows strong {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--admin-green);
  font-weight: 750;
}

.health-rows strong i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--admin-green);
}

.health-rows b,
.mini-bars {
  display: flex;
  align-items: end;
  gap: 3px;
  height: 30px;
  overflow: hidden;
}

.health-rows b i,
.mini-bars i {
  width: 4px;
  min-height: 4px;
  background: rgba(50, 213, 131, 0.75);
  border-radius: 1px 1px 0 0;
}

.usage-rows > div {
  grid-template-columns: minmax(130px, 1fr) 80px 48px 92px;
}

.usage-rows strong {
  color: #f3f8ff;
  font-weight: 800;
}

.usage-rows em {
  color: var(--admin-green);
  font-style: normal;
  font-weight: 800;
}

.usage-rows svg {
  width: 92px;
  height: 36px;
}

.usage-rows path {
  fill: none;
  stroke: var(--admin-blue);
  stroke-width: 2;
}

.admin-activity-table {
  padding: 6px 14px 8px;
}

.activity-row {
  display: grid;
  grid-template-columns: 62px 26px 116px minmax(0, 1fr) 72px;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  border-bottom: 1px solid rgba(93, 121, 148, 0.17);
}

.activity-row:last-child {
  border-bottom: 0;
}

.activity-row time {
  color: #aebcca;
  font-size: 12px;
}

.activity-icon {
  width: 22px;
  height: 22px;
  padding: 4px;
  display: block;
  color: #ffffff;
  background: rgba(47, 144, 255, 0.2);
  border: 1px solid rgba(47, 144, 255, 0.45);
  border-radius: 50%;
}

.activity-icon.user { color: var(--admin-green); }
.activity-icon.project { color: var(--admin-blue); }
.activity-icon.finding { color: var(--admin-amber); }
.activity-icon.panel { color: var(--admin-purple); }
.activity-icon.report { color: var(--admin-red); }
.activity-icon.system { color: var(--admin-cyan); }

.activity-row strong {
  color: #ffffff;
  font-size: 12px;
  font-weight: 850;
}

.activity-row span {
  min-width: 0;
  overflow: hidden;
  color: #b7c6d4;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-row mark {
  justify-self: end;
  min-width: 54px;
  padding: 3px 7px;
  color: #8dc8ff;
  background: rgba(47, 144, 255, 0.09);
  border: 1px solid rgba(47, 144, 255, 0.32);
  border-radius: 3px;
  text-align: center;
  font-size: 10px;
  font-weight: 800;
  text-transform: capitalize;
}

.admin-top-projects,
.admin-recent-reports {
  align-self: stretch;
}

.admin-ref-empty {
  padding: 18px;
  color: #8fa1b4;
  text-align: center;
}

.mini-bars {
  display: inline-flex;
  width: 70px;
  height: 20px;
  margin-left: 8px;
  vertical-align: middle;
}

.mini-bars i {
  width: 3px;
}

.admin-section-view.hidden,
.admin-ref-grid.hidden {
  display: none;
}

.admin-section-view {
  margin-bottom: 10px;
}

.admin-detail-card {
  min-height: 360px;
}

.admin-detail-head {
  align-items: flex-start;
}

.admin-detail-head > div {
  min-width: 0;
}

.admin-detail-head p {
  margin: 4px 0 0;
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 500;
  text-transform: none;
}

.admin-detail-table {
  min-width: 920px;
}

.admin-status,
.severity-pill {
  display: inline-grid;
  place-items: center;
  min-width: 64px;
  padding: 3px 7px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 850;
  text-transform: capitalize;
}

.admin-status {
  color: #8dc8ff;
  background: rgba(47, 144, 255, 0.1);
  border: 1px solid rgba(47, 144, 255, 0.34);
}

.admin-status.findings_ready,
.admin-status.awaiting_proceed {
  color: #fbd47f;
  background: rgba(247, 179, 25, 0.1);
  border-color: rgba(247, 179, 25, 0.38);
}

.admin-status.working,
.admin-status.arranging {
  color: #83f1be;
  background: rgba(50, 213, 131, 0.1);
  border-color: rgba(50, 213, 131, 0.34);
}

.severity-pill {
  color: #ffffff;
  background: #64748b;
}

.severity-pill.sev-critical { background: #c73542; }
.severity-pill.sev-high { background: #c95f1a; }
.severity-pill.sev-medium { background: #9b7415; }
.severity-pill.sev-low { background: #2568bd; }
.severity-pill.sev-info { background: #617182; }
.severity-pill.sev-unrated { background: #475569; }

.admin-detail-grid {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(360px, 1.2fr);
  gap: 10px;
  padding: 12px;
}

.admin-signal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.admin-signal-card,
.integration-card,
.admin-kv-list,
.admin-settings-actions {
  background: rgba(8, 17, 27, 0.72);
  border: 1px solid rgba(93, 121, 148, 0.22);
  border-radius: 5px;
}

.admin-signal-card {
  min-height: 76px;
  display: grid;
  grid-template-columns: 10px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 12px;
}

.admin-signal-card span {
  width: 9px;
  height: 34px;
  border-radius: 999px;
}

.admin-signal-card strong {
  color: #f5fbff;
  font-size: 13px;
}

.admin-signal-card b {
  color: #ffffff;
  font-size: 24px;
}

.admin-kv-list {
  display: grid;
  gap: 0;
  padding: 6px 12px;
}

.admin-kv-list > div {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(93, 121, 148, 0.14);
}

.admin-kv-list > div:last-child {
  border-bottom: 0;
}

.admin-kv-list span {
  color: var(--admin-muted);
}

.admin-kv-list strong {
  min-width: 0;
  overflow: hidden;
  color: #eef6ff;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.integration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
  padding: 12px;
}

.integration-card {
  min-height: 132px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 10px;
  padding: 13px;
}

.integration-card strong {
  display: block;
  color: #ffffff;
  font-size: 14px;
}

.integration-card span,
.integration-card p {
  color: var(--admin-muted);
}

.integration-card mark {
  width: fit-content;
  padding: 3px 8px;
  color: #8ff2bd;
  background: rgba(50, 213, 131, 0.12);
  border: 1px solid rgba(50, 213, 131, 0.24);
  border-radius: 999px;
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.integration-card.status-attention mark {
  color: #ffd37a;
  background: rgba(247, 179, 25, 0.12);
  border-color: rgba(247, 179, 25, 0.28);
}

.integration-card.status-local mark {
  color: #9fc8ff;
  background: rgba(47, 144, 255, 0.12);
  border-color: rgba(47, 144, 255, 0.28);
}

.integration-card p {
  margin: 0;
  line-height: 1.45;
}

.admin-settings-actions {
  display: flex;
  gap: 8px;
  margin: 12px;
  padding: 12px;
}

.admin-settings-actions a {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

@media (max-width: 1380px) {
  .admin-ref-topbar {
    grid-template-columns: minmax(260px, 1fr) minmax(300px, 440px) minmax(280px, 1fr);
  }

  .admin-ref-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-ref-grid {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "sessions"
      "risk"
      "activity"
      "side"
      "projects"
      "reports";
  }
}

@media (max-width: 920px) {
  .admin-action-form {
    grid-template-columns: 1fr;
  }

  .admin-ref-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .admin-ref-topbar {
    grid-column: 1;
    grid-row: 1;
    position: relative;
    height: auto;
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
  }

  .admin-ref-account {
    justify-content: flex-start;
  }

  .admin-ref-sidebar {
    grid-column: 1;
    grid-row: 2;
    min-height: auto;
  }

  .admin-ref-nav {
    display: flex;
    gap: 6px;
    overflow-x: auto;
  }

  .admin-ref-nav p,
  .admin-ref-nav hr,
  .admin-ref-status,
  .admin-ref-sidebar footer {
    display: none;
  }

  .admin-ref-nav button {
    width: auto;
    white-space: nowrap;
    margin: 0;
  }

  .admin-ref-content {
    grid-column: 1;
    grid-row: 3;
    padding: 12px;
  }
}

@media (max-width: 640px) {
  .admin-ref-kpis {
    grid-template-columns: 1fr;
  }

  .risk-overview-body,
  .admin-detail-grid,
  .health-rows > div,
  .usage-rows > div,
  .activity-row {
    grid-template-columns: 1fr;
  }

  .admin-signal-grid,
  .admin-kv-list > div {
    grid-template-columns: 1fr;
  }

  .activity-row {
    gap: 5px;
    padding: 10px 0;
  }

  .activity-row mark {
    justify-self: start;
  }
}
