:root {
  --bg: #f7f8fb;
  --panel: #ffffff;
  --ink: #16181d;
  --muted: #667085;
  --line: #d8dee8;
  --accent: #155eef;
  --accent-soft: #e8f0ff;
  --ok: #087443;
  --warn: #b54708;
  --bad: #b42318;
  --shadow: 0 10px 30px rgba(20, 33, 61, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-form {
  width: min(100%, 360px);
  display: grid;
  gap: 12px;
}

.auth-form h1 { margin: 4px 0 10px; font-size: 26px; }
.auth-form button { margin-top: 8px; }
.auth-error { color: var(--bad); margin: 0; }

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  padding: 8px 11px;
  cursor: pointer;
  min-height: 36px;
  color: var(--ink);
}

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

button.danger {
  border-color: #f3b5ae;
  color: var(--bad);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select,
textarea {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  width: 100%;
  background: #fff;
  color: var(--ink);
}

.shell {
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
  min-height: 100vh;
}

.side {
  background: #111827;
  color: #e5e7eb;
  padding: 22px 18px;
}

.brand {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 20px;
}

.nav {
  display: grid;
  gap: 7px;
}

.nav button {
  background: transparent;
  border-color: transparent;
  color: #cbd5e1;
  text-align: left;
  width: 100%;
}

.nav button.active {
  background: #253044;
  color: #fff;
}

.main {
  padding: 24px;
  max-width: 1480px;
  width: 100%;
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.15;
}

h1 {
  font-size: 28px;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
  margin-bottom: 16px;
}

.card {
  padding: 14px;
}

.row {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.row.between {
  justify-content: space-between;
}

.stack {
  display: grid;
  gap: 10px;
}

.toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.kpi {
  display: grid;
  gap: 4px;
}

.kpi strong {
  font-size: 22px;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  min-height: 26px;
}

.pill.ok {
  color: var(--ok);
  background: #ecfdf3;
  border-color: #abefc6;
}

.pill.warn {
  color: var(--warn);
  background: #fffaeb;
  border-color: #fedf89;
}

.pill.bad {
  color: var(--bad);
  background: #fef3f2;
  border-color: #fecdca;
}

.scaffold-summary {
  margin-top: 10px;
  padding: 12px;
  border: 1px solid #fedf89;
  background: #fffbf0;
  border-radius: 8px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
  align-items: end;
}

.form-grid.scan {
  grid-template-columns: 1.2fr 2fr auto;
}

.form-grid.vault-login {
  grid-template-columns: minmax(160px, 0.8fr) minmax(180px, 1fr) minmax(220px, 1.2fr) auto;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.field-grid label,
.stack label {
  display: grid;
  gap: 5px;
}

.mini-list {
  display: grid;
  gap: 2px;
  margin-top: 10px;
}

pre {
  white-space: pre-wrap;
  overflow: auto;
  overflow-wrap: anywhere;
  overscroll-behavior: contain;
  max-height: 300px;
  background: #0b1020;
  color: #e6edf7;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid #18233d;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 12px;
}

.list {
  display: grid;
  gap: 10px;
}

.scan-body {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
  margin-top: 8px;
  align-items: start;
}

.launch-panel {
  min-height: 120px;
  border: 1px dashed #b9c6d8;
  border-radius: 8px;
  padding: 12px;
  background: #fbfdff;
}

.launch-log {
  height: 170px;
  max-height: 240px;
  margin: 10px 0 0;
  font-size: 12px;
}

.diagnosis {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  font-size: 13px;
}

.resource-row {
  margin-top: 10px;
  gap: 8px;
  flex-wrap: wrap;
}

.candidate-summary {
  margin-top: 10px;
}

.intelligence-summary {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.mini-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}

.protected-card {
  margin-top: 14px;
  border-color: #abefc6;
  background: #f6fef9;
}

.notice {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  background: #f8fbff;
  border: 1px solid #b9d2ff;
  border-radius: 8px;
  padding: 14px;
  margin-bottom: 16px;
}

.notice.warn {
  background: #fffaeb;
  border-color: #fedf89;
}

.notice .toolbar {
  margin-top: 0;
}

.hidden {
  display: none !important;
}

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

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .side {
    position: static;
  }

  .grid.two,
  .grid.three,
  .grid.four,
  .scan-body,
  .form-grid,
  .form-grid.scan,
  .form-grid.vault-login,
  .field-grid {
    grid-template-columns: 1fr;
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 24, 39, 0.42);
}

.modal {
  width: min(560px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.28);
  padding: 16px;
}
