:root {
  color-scheme: light dark;
  --bg: #0f1419;
  --card: #1a222c;
  --text: #e8eef4;
  --muted: #9aa7b4;
  --accent: #3d8bfd;
  --border: #2a3544;
  --err: #f87171;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f6f9;
    --card: #ffffff;
    --text: #1a222c;
    --muted: #5c6b7a;
    --border: #d5dde6;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  padding: 1.5rem 1rem 2.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.shell {
  width: 100%;
  max-width: 80rem;
  margin-left: auto;
  margin-right: auto;
}

.top h1 {
  margin: 0 0 0.25rem;
  font-size: 1.75rem;
}

.lead {
  margin: 0 0 1.5rem;
  color: var(--muted);
  max-width: 52rem;
  margin-left: auto;
  margin-right: auto;
  text-align: center;
}

.top {
  text-align: center;
  margin-bottom: 0.25rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  max-width: 72rem;
  margin-left: auto;
  margin-right: auto;
  margin-bottom: 1rem;
}

.card h2 {
  margin-top: 0;
}

label {
  display: block;
  margin: 0.5rem 0;
  font-size: 0.9rem;
}

input[type="email"],
input[type="password"],
input[type="text"] {
  width: 100%;
  max-width: 28rem;
  padding: 0.45rem 0.6rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
}

button {
  margin: 0.35rem 0.35rem 0.35rem 0;
  padding: 0.45rem 1rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

button#btn-logout {
  background: transparent;
  color: var(--text);
}

.row {
  margin-bottom: 0.75rem;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  justify-content: center;
  align-items: center;
  margin: 0.75rem 0 1rem;
}

#auth-panel {
  text-align: center;
}

#auth-panel label {
  text-align: left;
  max-width: 28rem;
  margin-left: auto;
  margin-right: auto;
}

#org-disp,
#run-err:not([hidden]),
#disclaimer {
  text-align: center;
}

.err {
  color: var(--err);
  font-size: 0.9rem;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.85rem;
}

.rag-legend {
  text-align: center;
  margin: 0 auto 0.5rem;
  max-width: 52rem;
}

.grid-wrap {
  overflow-x: auto;
  margin-top: 1rem;
}

table.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

table.grid th,
table.grid td {
  border: 1px solid var(--border);
  padding: 0.6rem 0.65rem;
  vertical-align: top;
}

table.grid thead th {
  text-align: left;
  background: rgba(61, 139, 253, 0.12);
}

table.grid tbody th {
  text-align: left;
  background: var(--card);
}

ul.compact {
  margin: 0.25rem 0 0 1rem;
  padding: 0;
}

ul.compact li {
  margin-bottom: 0.2rem;
}

.align-cell ul.compact {
  margin-top: 0;
}

/* RAG bands — same idea as standards portfolio (emerald / amber / red left stripe + light fill) */
table.grid tbody th.rag-green,
table.grid td.rag-green {
  border-left: 4px solid #10b981;
  background: rgba(16, 185, 129, 0.14);
}

table.grid tbody th.rag-amber,
table.grid td.rag-amber {
  border-left: 4px solid #f59e0b;
  background: rgba(245, 158, 11, 0.14);
}

table.grid tbody th.rag-red,
table.grid td.rag-red {
  border-left: 4px solid #ef4444;
  background: rgba(239, 68, 68, 0.12);
}

@media (prefers-color-scheme: light) {
  table.grid tbody th.rag-green,
  table.grid td.rag-green {
    background: rgba(16, 185, 129, 0.1);
  }

  table.grid tbody th.rag-amber,
  table.grid td.rag-amber {
    background: rgba(245, 158, 11, 0.1);
  }

  table.grid tbody th.rag-red,
  table.grid td.rag-red {
    background: rgba(239, 68, 68, 0.08);
  }
}

@media print {
  table.grid tbody th.rag-green,
  table.grid td.rag-green {
    background: #ecfdf5 !important;
    border-left-color: #059669 !important;
  }

  table.grid tbody th.rag-amber,
  table.grid td.rag-amber {
    background: #fffbeb !important;
    border-left-color: #d97706 !important;
  }

  table.grid tbody th.rag-red,
  table.grid td.rag-red {
    background: #fef2f2 !important;
    border-left-color: #dc2626 !important;
  }
}
