/* ── IBM Carbon-inspired dark theme — v6.02 palette ── */
:root {
  --bg:         #0f1117;
  --surface:    #1a1d27;
  --surface2:   #22263a;
  --border:     #2e3250;
  --text:       #e2e8f0;
  --muted:      #7a85a3;
  --green:      #22c55e;
  --green-bg:   #14532d33;
  --red:        #ef4444;
  --red-bg:     #7f1d1d33;
  --amber:      #f59e0b;
  --amber-bg:   #78350f33;
  --blue:       #60a5fa;
  --blue-bg:    #1e3a5f55;
  --radius:     10px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

/* ── header ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: flex;
  align-items: center;
  gap: 14px;
  height: 56px;
}
header .logo { font-size: 20px; }
header h1 { font-size: 17px; font-weight: 600; }

/* ── page wrapper ── */
.page-wrap {
  max-width: 860px;
  margin: 40px auto;
  padding: 0 24px;
}

/* ── form card ── */
.form-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.form-card h2 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 24px;
  color: var(--text);
}

/* ── field groups ── */
.field-group {
  margin-bottom: 18px;
}
.field-group label {
  display: block;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 6px;
}
.field-group input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 12px;
  color: var(--text);
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
}
.field-group input:focus { border-color: var(--blue); }
.field-group input::placeholder { color: var(--muted); }

/* ── org block ── */
.org-block {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  position: relative;
}
.org-block-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--blue);
  margin-bottom: 14px;
}
.org-block .remove-btn {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 8px;
  transition: border-color .15s, color .15s;
}
.org-block .remove-btn:hover { border-color: var(--red); color: var(--red); }

/* ── buttons ── */
.btn-primary {
  background: var(--blue-bg);
  border: 1px solid var(--blue);
  color: var(--blue);
  border-radius: 6px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-primary:hover { background: #2a4a7f88; }
.btn-secondary {
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 13px;
  cursor: pointer;
  margin-right: 10px;
  transition: background .15s;
}
.btn-secondary:hover { background: var(--border); }
.btn-danger {
  background: var(--red-bg);
  border: 1px solid var(--red);
  color: var(--red);
  border-radius: 6px;
  padding: 8px 18px;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s;
}
.form-actions { display: flex; align-items: center; gap: 12px; margin-top: 24px; flex-wrap: wrap; }

/* ── alerts ── */
.alert {
  padding: 12px 16px;
  border-radius: 6px;
  margin-bottom: 20px;
  font-size: 13px;
}
.alert-error { background: var(--red-bg); border: 1px solid var(--red); color: var(--red); }
.alert-warn  { background: var(--amber-bg); border: 1px solid var(--amber); color: var(--amber); }

/* ── progress / status page ── */
.status-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
}
.status-card h2 { font-size: 18px; margin-bottom: 8px; }
.status-card .sub { color: var(--muted); font-size: 13px; margin-bottom: 24px; }
.progress-wrap { background: var(--surface2); border-radius: 20px; height: 8px; overflow: hidden; margin-bottom: 12px; }
.progress-bar  { height: 8px; background: var(--blue); border-radius: 20px; transition: width .4s ease; }
.progress-bar.pulsing {
  background: linear-gradient(90deg, var(--blue) 25%, #93c5fd 50%, var(--blue) 75%);
  background-size: 200% 100%;
  animation: progress-pulse 1.6s linear infinite;
}
@keyframes progress-pulse {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
.progress-label { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.current-step   { font-size: 13px; color: var(--blue); font-weight: 500; min-height: 20px; margin-bottom: 6px; }
.current-org    { font-size: 12px; color: var(--muted); min-height: 18px; margin-bottom: 12px; }
.job-id-note    { font-size: 11px; color: var(--muted); margin-top: 24px; }

/* ── org tab bar ── */
#org-tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 32px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}
.org-tab {
  cursor: pointer;
  padding: 12px 18px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
  user-select: none;
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
}
.org-tab:hover { color: var(--text); }
.org-tab.active { color: var(--text); border-bottom-color: var(--blue); }
.org-tab .tab-badge {
  display: inline-block;
  margin-left: 6px;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 10px;
}
.tab-badge-fail    { background: var(--red-bg);   color: var(--red); }
.tab-badge-warn    { background: var(--amber-bg);  color: var(--amber); }
.tab-badge-clean   { background: var(--green-bg);  color: var(--green); }

/* ── results content ── */
.results-wrap { max-width: 1200px; margin: 0 auto; padding: 24px 32px; }

.section-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin: 32px 0 14px;
}
.section-title { font-size: 15px; font-weight: 600; }
.last-updated  { font-size: 12px; color: var(--muted); }

/* ── cards ── */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-left: 4px solid var(--border);
}
.card.green  { border-left-color: var(--green); }
.card.red    { border-left-color: var(--red); }
.card.orange { border-left-color: var(--amber); }
.card.amber  { border-left-color: var(--amber); }
.card.info   { border-left-color: var(--blue); }
.card-label  { font-size: 12px; color: var(--muted); }
.card-value  { font-size: 22px; font-weight: 700; }
.card-sub    { font-size: 11px; color: var(--muted); }
.card-status { font-size: 11px; font-weight: 600; margin-top: auto; }
.card.green  .card-status { color: var(--green); }
.card.red    .card-status { color: var(--red); }
.card.orange .card-status, .card.amber .card-status { color: var(--amber); }
.card.info   .card-status { color: var(--blue); }

/* ── summary cards (multi-org overview) ── */
.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  padding: 24px 0;
}
.summary-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}
.summary-card h3 { font-size: 14px; font-weight: 600; margin-bottom: 10px; }
.summary-counts  { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.count-pill { padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; }

/* ── accordion tables ── */
details { margin-top: 12px; }
summary {
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
summary::-webkit-details-marker { display: none; }
summary::before { content: "▶"; font-size: 10px; color: var(--muted); transition: transform .2s; }
details[open] summary::before { transform: rotate(90deg); }
summary::after { content: "Expand"; font-size: 11px; color: var(--muted); margin-left: auto; font-weight: 400; letter-spacing: .3px; }
details[open] summary::after { content: "Collapse"; }
.table-wrap { margin-top: 2px; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); }
th { padding: 9px 14px; text-align: left; font-size: 12px; color: var(--muted); font-weight: 500; background: var(--surface2); border-bottom: 1px solid var(--border); }
td { padding: 9px 14px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:nth-child(even) { background: var(--surface2); }
tbody tr:hover { background: var(--border); }

/* ── pills ── */
.pill { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; font-weight: 600; }
.pill-green  { background: var(--green-bg);  color: var(--green); }
.pill-red    { background: var(--red-bg);    color: var(--red); }
.pill-amber  { background: var(--amber-bg);  color: var(--amber); }
.pill-blue   { background: var(--blue-bg);   color: var(--blue); }
.pill-muted  { background: var(--surface2);  color: var(--muted); }

/* ── download bar ── */
.download-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  padding: 16px 0;
  border-top: 1px solid var(--border);
  margin-top: 24px;
}

/* ── email status banner ── */
.email-banner {
  padding: 10px 32px;
  font-size: 13px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.email-banner-ok   { background: var(--green-bg); color: var(--green); border-bottom: 1px solid #22c55e33; }
.email-banner-warn { background: var(--amber-bg); color: var(--amber); border-bottom: 1px solid #f59e0b33; }
.email-banner strong { font-weight: 600; }
.email-vpn-hint {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  opacity: 0.85;
}

/* ── error page ── */
.error-wrap { max-width: 520px; margin: 80px auto; text-align: center; padding: 0 24px; }
.error-wrap h1 { font-size: 22px; margin-bottom: 12px; }
.error-wrap p  { color: var(--muted); line-height: 1.7; }
.error-wrap a  { color: var(--blue); }

/* ── empty state ── */
.empty-state { text-align: center; padding: 60px 24px; color: var(--muted); }
.empty-state .icon { font-size: 36px; margin-bottom: 12px; }
.not-collected { color: var(--muted); font-size: 13px; padding: 16px 0; }
.stale-banner  { background: var(--amber-bg); border: 1px solid var(--amber); color: var(--amber); border-radius: 6px; padding: 8px 14px; font-size: 12px; margin-bottom: 12px; }

/* ── org panel visibility ── */
.org-panel { display: none; }
.org-panel.active { display: block; }
#summary-panel { display: none; }
#summary-panel.active { display: block; }

/* ── single-org header ── */
.single-org-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 32px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
.single-org-header strong { color: var(--blue); font-weight: 600; }
.header-downloads { display: flex; gap: 8px; flex-shrink: 0; }
.header-downloads .btn-secondary { margin-right: 0; }

/* ── noscript fallback ── */
noscript .org-panel { display: block !important; }
noscript #org-tabs  { display: none; }
