/* ===================================================================
   Frogy 2.0 — Dashboard CSS
   Design: zinc base · cyan accent · Linear/Vercel aesthetic
   =================================================================== */

/* ── Design Tokens ─────────────────────────────────────────────── */
:root {
  color-scheme: dark;

  /* Base */
  --bg:             #09090b;
  --surface:        #111115;
  --surface-raised: #18181c;
  --border:         #27272a;
  --border-subtle:  #1e1e22;

  /* Text */
  --text:           #fafafa;
  --text-2:         #a1a1aa;
  --text-3:         #71717a;

  /* Accent — cyan */
  --accent:         #06b6d4;
  --accent-dim:     rgba(6,182,212,0.12);

  /* Semantic */
  --success:        #22c55e;
  --success-dim:    rgba(34,197,94,0.12);
  --warning:        #f59e0b;
  --warning-dim:    rgba(245,158,11,0.12);
  --danger:         #ef4444;
  --danger-dim:     rgba(239,68,68,0.12);
  --info:           #818cf8;
  --info-dim:       rgba(129,140,248,0.12);

  /* Misc */
  --radius:         8px;
  --radius-lg:      12px;
  --shadow:         0 4px 24px rgba(0,0,0,0.6);
  --transition:     0.15s ease;

  /* Inputs */
  --input-bg:       #1c1c20;
  --input-border:   #3f3f46;
  --input-text:     #fafafa;
}

body[data-theme="light"] {
  color-scheme: light;

  --bg:             #f4f4f5;
  --surface:        #ffffff;
  --surface-raised: #f9f9fa;
  --border:         #e4e4e7;
  --border-subtle:  #eeeeef;

  --text:           #09090b;
  --text-2:         #52525b;
  --text-3:         #a1a1aa;

  --accent:         #0891b2;
  --accent-dim:     rgba(8,145,178,0.1);

  --success:        #16a34a;
  --success-dim:    rgba(22,163,74,0.1);
  --warning:        #d97706;
  --warning-dim:    rgba(217,119,6,0.1);
  --danger:         #dc2626;
  --danger-dim:     rgba(220,38,38,0.1);
  --info:           #6366f1;
  --info-dim:       rgba(99,102,241,0.1);

  --shadow:         0 2px 12px rgba(0,0,0,0.1);

  --input-bg:       #ffffff;
  --input-border:   #d4d4d8;
  --input-text:     #09090b;
}

/* ── Reset ─────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; }

/* ── App Shell ─────────────────────────────────────────────────── */
.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ── Sidebar ───────────────────────────────────────────────────── */
.sidebar {
  width: 224px;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  z-index: 60;
  overflow: hidden;
}

.sidebar-brand {
  padding: 20px 20px 16px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.01em;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
}

.sidebar-nav-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  padding: 8px 10px 4px;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  color: var(--text-2);
  text-decoration: none;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  transition: background var(--transition), color var(--transition);
}

.sidebar-nav-item:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.sidebar-nav-item.is-active {
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 500;
}

.sidebar-dev-credit {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  font-size: 0.72rem;
  color: var(--text-3);
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex-shrink: 0;
}

.sidebar-dev-credit a {
  color: var(--text-3);
  text-decoration: none;
}

.sidebar-dev-credit a:hover { color: var(--accent); }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Main Content ──────────────────────────────────────────────── */
.main-content {
  margin-left: 224px;
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 28px 32px;
  gap: 20px;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--text);
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ── Search Input ──────────────────────────────────────────────── */
.search-input {
  height: 34px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  width: 220px;
  transition: border-color var(--transition);
}

.search-input:focus {
  border-color: var(--accent);
}

.search-input::placeholder { color: var(--text-3); }

/* ── Buttons ───────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--transition), color var(--transition),
              border-color var(--transition), box-shadow var(--transition);
}

.btn--primary {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.btn--primary:hover { filter: brightness(1.1); }

.btn--ghost {
  background: transparent;
  color: var(--text-2);
  border-color: var(--border);
}

.btn--ghost:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.btn--danger-ghost {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

.btn--danger-ghost:hover {
  background: var(--danger-dim);
}

.btn--sm {
  height: 28px;
  padding: 0 10px;
  font-size: 0.8rem;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  font-size: 1rem;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition), color var(--transition);
}

.icon-btn:hover {
  background: var(--surface-raised);
  color: var(--text);
}

/* ── KPI Cards ─────────────────────────────────────────────────── */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.kpi-card-label {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-3);
}

.kpi-card-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
}

.kpi-card-value.accent  { color: var(--accent); }
.kpi-card-value.success { color: var(--success); }
.kpi-card-value.warning { color: var(--warning); }
.kpi-card-value.danger  { color: var(--danger); }

.kpi-card-sub {
  font-size: 0.72rem;
  color: var(--text-3);
}

/* ── Controls Bar ──────────────────────────────────────────────── */
.controls-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.filter-tabs {
  display: flex;
  gap: 3px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
}

.filter-tab {
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-2);
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  transition: background var(--transition), color var(--transition);
}

.filter-tab.is-active {
  background: var(--surface-raised);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,0.35);
}

/* ── Project List ──────────────────────────────────────────────── */
.project-list {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.project-list-header {
  display: grid;
  grid-template-columns: 28px 1fr 130px 190px 110px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
  align-items: center;
}

.project-list-header span {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.project-list-header span:nth-child(3),
.project-list-header span:nth-child(4) {
  text-align: center;
}

.project-card {
  display: grid;
  grid-template-columns: 28px 1fr 130px 190px 110px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-subtle);
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: background var(--transition);
}

.project-card:last-child { border-bottom: none; }

.project-card:hover { background: var(--surface-raised); }

.project-card.selected { background: var(--accent-dim); }

/* Center status badge and progress column content */
.project-card > div:nth-child(3) {
  display: flex;
  justify-content: center;
  align-items: center;
}

.project-card > div:nth-child(4) {
  text-align: center;
}

.project-card__name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-card__name a {
  color: inherit;
  text-decoration: none;
}

.project-card__name a:hover { color: var(--accent); }

.project-card__meta {
  font-size: 0.75rem;
  color: var(--text-3);
  margin-top: 2px;
}

.progress-bar-wrap {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.4s ease;
}

.progress-bar-fill.done   { background: var(--success); }
.progress-bar-fill.failed { background: var(--danger); }

.progress-label {
  font-size: 0.7rem;
  color: var(--text-3);
  margin-top: 4px;
}

.proj-stats-line {
  font-size: 0.72rem;
  color: var(--accent);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-card__actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.project-list-empty {
  padding: 56px 24px;
  text-align: center;
  color: var(--text-3);
  font-size: 0.9rem;
}

/* ── Status Badges ─────────────────────────────────────────────── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}

.status-badge .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-badge--success   { background: var(--success-dim); color: var(--success); }
.status-badge--success .dot   { background: var(--success); }

.status-badge--running   { background: var(--accent-dim); color: var(--accent); }
.status-badge--running .dot   { background: var(--accent); animation: pulse 1.5s infinite; }

.status-badge--failed    { background: var(--danger-dim); color: var(--danger); }
.status-badge--failed .dot    { background: var(--danger); }

.status-badge--queued    { background: var(--warning-dim); color: var(--warning); }
.status-badge--queued .dot    { background: var(--warning); }

.status-badge--scheduled { background: var(--info-dim); color: var(--info); }
.status-badge--scheduled .dot { background: var(--info); }

.status-badge--never     { background: var(--surface-raised); color: var(--text-3); }
.status-badge--never .dot     { background: var(--text-3); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}

/* ── Bulk Bar ──────────────────────────────────────────────────── */
.bulk-bar {
  position: fixed;
  bottom: 24px;
  left: calc(224px + 24px);
  right: 24px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  font-size: 0.875rem;
  color: var(--text-2);
  z-index: 100;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.bulk-bar.hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

/* ── Flash Message ─────────────────────────────────────────────── */
.flash {
  display: none;
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 0.875rem;
  border: 1px solid transparent;
}

.flash:not(:empty) { display: block; }

.flash.error   { background: var(--danger-dim); border-color: var(--danger); color: var(--danger); }
.flash.success { background: var(--success-dim); border-color: var(--success); color: var(--success); }

/* ── Modals ────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  backdrop-filter: blur(2px);
}

.modal-backdrop.show {
  opacity: 1;
  pointer-events: all;
}

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 300;
}

.modal.show { pointer-events: all; }

.modal-content {
  width: min(560px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 22px 24px 26px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  transform: translateY(10px);
  opacity: 0;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.modal.show .modal-content {
  transform: translateY(0);
  opacity: 1;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 600;
}

#modal-close,
#targets-modal-close {
  background: none;
  border: none;
  color: var(--text-3);
  font-size: 1.5rem;
  width: 32px;
  height: 32px;
  border-radius: var(--radius);
  padding: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), color var(--transition);
}

#modal-close:hover,
#targets-modal-close:hover {
  background: var(--surface-raised);
  color: var(--text);
}

.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-field label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
}

.modal-field input[type="text"],
.modal-field input[type="datetime-local"],
.modal-field textarea {
  background: var(--input-bg);
  color: var(--input-text);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}

.modal-field input:focus,
.modal-field textarea:focus {
  border-color: var(--accent);
}

.modal-field textarea {
  resize: vertical;
  min-height: 140px;
}


.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.modal-actions button {
  height: 34px;
  padding: 0 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface-raised);
  color: var(--text-2);
  font-size: 0.875rem;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}

.modal-actions button:hover:enabled {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--accent);
}

.modal-actions button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.modal-actions button[data-run-mode="immediate"] {
  background: var(--accent);
  color: #000;
  border-color: var(--accent);
}

.modal-actions button[data-run-mode="immediate"]:hover:enabled {
  filter: brightness(1.1);
  color: #000;
}

#modal-cancel,
#targets-modal-ok {
  background: transparent;
  color: var(--text-3);
  border-color: var(--border);
}

#modal-cancel:hover,
#targets-modal-ok:hover {
  background: var(--surface-raised);
  color: var(--text-2);
}

.feedback {
  font-size: 0.875rem;
  color: var(--accent);
  min-height: 1em;
}

.feedback.error { color: var(--danger); }

/* ── Targets Modal ─────────────────────────────────────────────── */
.targets-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.targets-body .targets-count {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-3);
}

.targets-scroll {
  max-height: 300px;
  overflow: auto;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--input-bg);
  border: 1px solid var(--input-border);
}

.targets-scroll ol {
  margin: 0;
  padding-left: 22px;
  color: var(--text-2);
  line-height: 1.7;
  font-size: 0.875rem;
}

/* ── Hidden utility ────────────────────────────────────────────── */
.hidden { display: none !important; }

/* ── Log Panel ─────────────────────────────────────────────────── */
.log-backdrop { position:fixed; inset:0; background:rgba(0,0,0,0.6); z-index:200 }
.log-panel { position:fixed; top:0; right:0; bottom:0; width:min(680px,95vw); background:var(--surface); border-left:1px solid var(--border); display:flex; flex-direction:column; z-index:201; transition:transform 0.25s ease }
.log-panel.hidden { transform:translateX(100%) }
.log-backdrop.hidden { display:none }
.log-panel-header { padding:14px 20px; border-bottom:1px solid var(--border); display:flex; align-items:center; justify-content:space-between; flex-shrink:0 }
.log-panel-title { font-size:0.9rem; font-weight:600; color:var(--text) }
.log-output { flex:1; overflow-y:auto; padding:16px 20px; font-family:monospace; font-size:0.78rem; line-height:1.6; color:var(--text-2); white-space:pre-wrap; word-break:break-all }

/* ── API Keys Panel ────────────────────────────────────────────── */
.api-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
}

.api-panel-loading {
  color: var(--text-3);
  font-size: 0.875rem;
  margin: 0;
}

.api-panel-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.api-panel-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  padding: 8px 2px 2px;
  margin-top: 4px;
  border-top: 1px solid var(--border);
}

.api-row {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.api-row__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.api-row__label {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.api-status {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
}

.api-status--ok   { background: var(--success-dim); color: var(--success); }
.api-status--none { background: var(--surface); color: var(--text-3); border: 1px solid var(--border); }

.api-row__note {
  font-size: 0.75rem;
  color: var(--text-3);
}

.api-row__preview {
  font-size: 0.75rem;
  color: var(--text-2);
  font-family: monospace;
}

.api-row__controls {
  display: flex;
  gap: 6px;
  align-items: center;
}

.api-input {
  flex: 1;
  height: 30px;
  padding: 0 10px;
  border-radius: var(--radius);
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
  font-size: 0.8rem;
  font-family: monospace;
  outline: none;
  transition: border-color var(--transition);
}

.api-input:focus { border-color: var(--accent); }

.api-row__feedback {
  font-size: 0.75rem;
  min-height: 1em;
}

/* ── Checkboxes ────────────────────────────────────────────────── */
input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--accent);
}

/* ── Footer ────────────────────────────────────────────────────── */
footer {
  padding: 24px 32px;
  margin-left: 224px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 0.8rem;
  text-align: center;
}

footer a {
  color: var(--text-2);
  text-decoration: none;
}

footer a:hover { color: var(--accent); }

/* ── Breadcrumb ────────────────────────────────────────────────── */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-3);
}

.breadcrumb-link {
  color: var(--text-2);
  text-decoration: none;
}

.breadcrumb-link:hover {
  color: var(--accent);
}

/* ── Project Detail ────────────────────────────────────────────── */
.project-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.project-detail-meta {
  font-size: 0.85rem;
  color: var(--text-3);
  margin: 4px 0 0;
}

.targets-expandable {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.875rem;
}

.targets-expandable summary {
  cursor: pointer;
  font-weight: 500;
  color: var(--text-2);
  list-style: none;
  user-select: none;
}

.targets-expandable summary::before {
  content: "▶ ";
  font-size: 0.65rem;
  color: var(--text-3);
}

details[open] .targets-expandable summary::before { content: "▼ "; }

.targets-list-detail {
  margin: 10px 0 0;
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  font-size: 0.85rem;
  color: var(--text-2);
}

.targets-hint {
  font-size: 0.8rem;
  color: var(--text-3);
  margin: 0 0 8px;
}

.targets-textarea {
  width: 100%;
  box-sizing: border-box;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.85rem;
  padding: 8px 10px;
  resize: vertical;
  font-family: var(--font-mono, monospace);
}

.excl-list-display {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
  font-size: 0.8rem;
}

.excl-pill {
  background: rgba(239, 68, 68, 0.12);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: 999px;
  padding: 2px 10px;
  font-size: 0.78rem;
  font-family: var(--font-mono, monospace);
}

.excl-empty {
  color: var(--text-3);
  font-size: 0.82rem;
  font-style: italic;
}

.section-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text);
}

/* ── Run History ───────────────────────────────────────────────── */
.run-history-list {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.run-history-header {
  display: grid;
  grid-template-columns: 100px 160px 110px 130px 1fr auto;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
  gap: 12px;
}

.run-history-header span {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
}

.run-row {
  display: grid;
  grid-template-columns: 100px 160px 110px 130px 1fr auto;
  padding: 13px 16px;
  border-bottom: 1px solid var(--border-subtle);
  align-items: center;
  gap: 12px;
  transition: background var(--transition);
}

.run-row:last-child { border-bottom: none; }
.run-row:hover { background: var(--surface-raised); }

.run-row__id {
  font-size: 0.75rem;
  color: var(--text-3);
  font-family: monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.run-row__stat {
  font-size: 0.78rem;
  color: var(--text-3);
}

.run-row__stat strong {
  color: var(--accent);
  font-weight: 600;
}

.run-row__actions {
  display: flex;
  gap: 6px;
  justify-content: flex-end;
}

.run-history-empty {
  padding: 40px 24px;
  text-align: center;
  color: var(--text-3);
  font-size: 0.875rem;
}

/* ── Summary Stats ─────────────────────────────────────────────── */
.summary-stats-row {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.summary-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.summary-stat-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent);
}

.summary-stat-label {
  font-size: 0.72rem;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Login ─────────────────────────────────────────────────────── */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.login-card {
  width: min(400px, 92vw);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  box-shadow: var(--shadow);
}

.login-brand {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--accent);
  margin: 0 0 6px;
}

.login-tagline {
  font-size: 0.85rem;
  color: var(--text-3);
  margin: 0 0 24px;
}

.login-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.login-field label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-2);
}

.login-field input {
  background: var(--input-bg);
  color: var(--input-text);
  border: 1px solid var(--input-border);
  border-radius: var(--radius);
  padding: 8px 12px;
  font-size: 0.875rem;
  font-family: inherit;
  outline: none;
  transition: border-color var(--transition);
}

.login-field input:focus { border-color: var(--accent); }

.login-btn {
  width: 100%;
  height: 36px;
  margin-top: 6px;
  background: var(--accent);
  color: #000;
  border: none;
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: filter var(--transition);
}

.login-btn:hover { filter: brightness(1.1); }

.login-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 8px 0 0;
}

/* ── Responsive ────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .main-content {
    margin-left: 0;
    padding: 16px;
  }

  footer {
    margin-left: 0;
  }

  .kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }

  .bulk-bar {
    left: 16px;
    right: 16px;
  }

  .project-list-header,
  .project-card {
    grid-template-columns: 28px 1fr 100px 1fr;
  }
}

/* ===================================================================
   Attack Graph Explorer — graph.html styles
   =================================================================== */

/* ── Layout ─────────────────────────────────────────────────────── */
.graph-main {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  padding: 0;
}
.graph-page-header {
  flex-shrink: 0;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--surface);
}
.graph-header-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.graph-body {
  flex: 1;
  display: flex;
  overflow: hidden;
  position: relative;
}

/* ── Query panel ─────────────────────────────────────────────────── */
.graph-query-panel {
  width: 258px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}
.graph-query-panel.hidden { display: none; }
.graph-query-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px 6px;
  flex-shrink: 0;
}
.graph-query-panel__title {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.graph-panel-toggle {
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: none;
  color: var(--text-2);
  cursor: pointer;
  padding: 6px 5px;
  border-radius: 0 6px 6px 0;
  font-size: 14px;
  line-height: 1;
}
.sev-tabs {
  display: flex;
  gap: 3px;
  padding: 4px 10px 8px;
  flex-shrink: 0;
}
.sev-tab {
  flex: 1;
  padding: 3px 0;
  font-size: .7rem;
  font-weight: 600;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
  transition: background .12s, color .12s;
}
.sev-tab.is-active          { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.sev-tab--critical.is-active { background: rgba(239,68,68,.12); color: #f87171; border-color: #f87171; }
.sev-tab--high.is-active     { background: rgba(249,115,22,.12); color: #fb923c; border-color: #fb923c; }
.sev-tab--medium.is-active   { background: rgba(234,179,8,.12);  color: #facc15; border-color: #facc15; }
.sev-tab--low.is-active      { background: rgba(96,165,250,.12); color: #60a5fa; border-color: #60a5fa; }
.sev-tab--info.is-active     { background: rgba(156,163,175,.1); color: #9ca3af; border-color: #9ca3af; }
.graph-query-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 6px 12px;
}

/* ── Query list items ────────────────────────────────────────────── */
.query-item {
  padding: 9px 10px;
  border-radius: 6px;
  cursor: pointer;
  margin-bottom: 4px;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s;
}
.query-item:hover          { background: var(--surface-raised); }
.query-item.is-active      { background: var(--accent-dim); border-color: var(--accent); }
.query-item.has-findings   { border-left: 3px solid transparent; }
.query-item.has-findings.sev-critical { border-left-color: #ef4444; }
.query-item.has-findings.sev-high     { border-left-color: #f97316; }
.query-item.has-findings.sev-medium   { border-left-color: #facc15; }
.query-item.has-findings.sev-low      { border-left-color: #60a5fa; }
.query-item.has-findings.sev-info     { border-left-color: #9ca3af; }
.query-item__title  { font-size: .78rem; font-weight: 600; color: var(--text); margin-bottom: 4px; }
.query-item__meta   { display: flex; align-items: center; gap: 6px; }
.query-item__count  { font-size: .7rem; color: var(--text-3); }

/* severity badges */
.sev-badge {
  display: inline-block;
  padding: .1rem .35rem;
  border-radius: 3px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.sev-badge--critical { background: rgba(239,68,68,.15);  color: #f87171; }
.sev-badge--high     { background: rgba(249,115,22,.15); color: #fb923c; }
.sev-badge--medium   { background: rgba(234,179,8,.15);  color: #facc15; }
.sev-badge--low      { background: rgba(96,165,250,.15); color: #60a5fa; }
.sev-badge--info     { background: rgba(156,163,175,.1); color: #9ca3af; }

/* ── SVG canvas area ─────────────────────────────────────────────── */
.graph-canvas-area {
  flex: 1;
  position: relative;
  overflow: hidden;
  background: var(--bg);
}
#graph-svg {
  width: 100%;
  height: 100%;
  display: block;
}
.graph-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .85rem;
  color: var(--text-3);
  background: var(--bg);
  z-index: 5;
}

/* ── Floating toolbar ─────────────────────────────────────────────── */
.graph-canvas-toolbar {
  position: absolute;
  top: 10px;
  right: 10px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  z-index: 4;
}
.graph-toolbar-btn {
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, color .12s;
}
.graph-toolbar-btn:hover { background: var(--surface-raised); color: var(--text); }

/* ── Canvas legend ────────────────────────────────────────────────── */
.graph-canvas-legend {
  position: absolute;
  bottom: 8px;
  left: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-width: 360px;
  padding: 5px 8px;
  background: rgba(0,0,0,.55);
  border-radius: 6px;
  font-size: 10px;
  color: #ccc;
}
.graph-legend-item { display: flex; align-items: center; gap: 4px; }
.graph-legend-dot  { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }

/* ── Stat chips ───────────────────────────────────────────────────── */
.graph-stat-chips { display: flex; gap: 5px; flex-wrap: wrap; }
.graph-chip {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: .72rem;
  font-weight: 600;
  background: var(--surface-raised);
  color: var(--text-2);
  border: 1px solid var(--border);
}
.graph-chip.chip--danger { background: rgba(239,68,68,.1);  color: #f87171; border-color: rgba(239,68,68,.25); }
.graph-chip.chip--warn   { background: rgba(249,115,22,.1); color: #fb923c; border-color: rgba(249,115,22,.25); }

/* ── Search + run selector ───────────────────────────────────────── */
.graph-search-wrap { position: relative; }
.graph-search-input {
  padding: 5px 10px;
  border-radius: 6px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
  font-size: .8rem;
  width: 180px;
}
.graph-search-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-dim); }
.graph-run-select {
  padding: 5px 8px;
  border-radius: 6px;
  border: 1px solid var(--input-border);
  background: var(--input-bg);
  color: var(--input-text);
  font-size: .8rem;
  max-width: 200px;
}
.graph-run-select:focus { outline: none; border-color: var(--accent); }

/* ── Node inspector ──────────────────────────────────────────────── */
.graph-inspector {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  background: var(--surface);
  overflow: hidden;
}
.graph-inspector.hidden { display: none; }
.graph-inspector__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.graph-inspector__title {
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-2);
}
.graph-inspector__content {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}
.inspector-node-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}
.inspector-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.inspector-node-label {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}
.inspector-node-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}
.inspector-type-badge {
  font-size: .68rem;
  font-weight: 600;
  padding: .1rem .4rem;
  border-radius: 4px;
}
.inspector-risk {
  font-size: .72rem;
  color: var(--text-3);
}
.inspector-section-title {
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--accent);
  margin: 10px 0 4px;
}
.inspector-table {
  width: 100%;
  font-size: .75rem;
  border-collapse: collapse;
}
.inspector-table tr { border-bottom: 1px solid var(--border-subtle); }
.inspector-table td { padding: 4px 2px; vertical-align: top; }
.inspector-key {
  color: var(--text-3);
  white-space: nowrap;
  padding-right: 8px;
  width: 40%;
}

/* ── Context menu ────────────────────────────────────────────────── */
.graph-context-menu {
  position: fixed;
  z-index: 999;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 160px;
  overflow: hidden;
}
.ctx-item {
  padding: 8px 14px;
  font-size: .8rem;
  color: var(--text);
  cursor: pointer;
  transition: background .1s;
}
.ctx-item:hover { background: var(--accent-dim); color: var(--accent); }

/* ── Diff animations ─────────────────────────────────────────────── */
@keyframes graph-new-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.4; }
}
.node-g.diff-new .node-circle {
  fill: #22c55e !important;
  animation: graph-new-pulse 1.4s ease-in-out infinite;
  stroke: #4ade80 !important;
}
.node-g.diff-removed .node-circle {
  opacity: 0.18 !important;
  stroke-dasharray: 3 2 !important;
  stroke: #94a3b8 !important;
}
.node-g.diff-changed .node-circle {
  stroke: #f59e0b !important;
  stroke-width: 2.5 !important;
}
.diff-chip { display: flex; gap: 5px; align-items: center; }
.diff-new-badge { padding: 2px 7px; border-radius: 4px; font-size:.72rem; font-weight:600; background:rgba(34,197,94,.15); color:#4ade80; border:1px solid rgba(34,197,94,.3); }
.diff-rmv-badge { padding: 2px 7px; border-radius: 4px; font-size:.72rem; font-weight:600; background:rgba(148,163,184,.1); color:#94a3b8; border:1px solid rgba(148,163,184,.25); }
.diff-chg-badge { padding: 2px 7px; border-radius: 4px; font-size:.72rem; font-weight:600; background:rgba(245,158,11,.1); color:#fbbf24; border:1px solid rgba(245,158,11,.25); }

/* ── Compare controls ─────────────────────────────────────────────── */
.graph-compare-wrap { display: flex; align-items: center; gap: 5px; }
.graph-compare-wrap label { font-size: .72rem; color: var(--text-3); white-space: nowrap; }
.graph-compare-clear {
  background: none; border: none; color: var(--text-3); cursor: pointer;
  font-size: 14px; padding: 0 3px; line-height: 1;
}
.graph-compare-clear:hover { color: var(--danger); }

/* ── Export dropdown ─────────────────────────────────────────────── */
.export-menu-wrap { position: relative; }
.export-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 160px;
  overflow: hidden;
  z-index: 100;
}
.export-dropdown[hidden] { display: none; }
.export-dropdown-item {
  padding: 8px 14px;
  font-size: .8rem;
  color: var(--text);
  cursor: pointer;
  transition: background .1s;
}
.export-dropdown-item:hover { background: var(--accent-dim); color: var(--accent); }

/* ── Query CSV button ─────────────────────────────────────────────── */
.query-csv-btn {
  font-size: .68rem;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: background .1s, color .1s;
  white-space: nowrap;
}
.query-csv-btn:hover { background: var(--accent-dim); color: var(--accent); border-color: var(--accent); }
.query-csv-btn[hidden] { display: none; }

/* ── Tour overlay ────────────────────────────────────────────────── */
.tour-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 48px;
}
.tour-overlay[hidden] { display: none; }
.tour-card {
  background: var(--surface-raised);
  border: 1px solid var(--accent);
  border-radius: 12px;
  padding: 20px 24px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 8px 40px rgba(0,0,0,.7), 0 0 0 1px rgba(6,182,212,.3);
}
.tour-card__step  { font-size:.7rem; color:var(--accent); font-weight:700; letter-spacing:.06em; text-transform:uppercase; margin-bottom:5px; }
.tour-card__title { font-size:1rem; font-weight:700; color:var(--text); margin-bottom:6px; }
.tour-card__body  { font-size:.82rem; color:var(--text-2); line-height:1.55; margin-bottom:16px; }
.tour-card__actions { display:flex; align-items:center; justify-content:space-between; }
.tour-card__dots { display:flex; gap:5px; }
.tour-dot { width:6px; height:6px; border-radius:50%; background:var(--border); }
.tour-dot.is-active { background:var(--accent); }
.tour-skip { font-size:.75rem; color:var(--text-3); cursor:pointer; text-decoration:underline; background:none; border:none; padding:0; }
