* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f6f8;
  color: #1d2733;
}

button, .button, .file-button {
  appearance: none;
  border: 0;
  border-radius: 7px;
  background: #2563eb;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  min-height: 38px;
  padding: 8px 14px;
  text-decoration: none;
}

button.secondary, .secondary { background: #e4e8ef; color: #263241; }
button.ghost { background: transparent; border: 1px solid #cbd3df; color: #263241; }
button.small { min-height: 32px; padding: 6px 10px; font-size: 13px; }

input, select {
  background: #fff;
  border: 1px solid #cbd3df;
  border-radius: 7px;
  color: #1d2733;
  font: inherit;
  min-height: 38px;
  padding: 8px 10px;
  width: 100%;
}

input:disabled, select:disabled { background: #f1f3f6; color: #5c6674; }
label { color: #4a5565; display: grid; font-size: 13px; gap: 5px; }

.login-body {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
}

.login-panel {
  background: #fff;
  border: 1px solid #dde3eb;
  border-radius: 8px;
  box-shadow: 0 24px 60px rgba(31, 41, 55, .12);
  padding: 28px;
  width: min(380px, calc(100vw - 32px));
}

.login-panel h1 { margin: 8px 0 20px; }
.login-panel form { display: grid; gap: 14px; }
.error { background: #fee2e2; border-radius: 6px; color: #991b1b; padding: 10px; }

.topbar {
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #dde3eb;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  min-height: 74px;
  padding: 14px 28px;
}

.brand {
  color: #172033;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: .02em;
  text-transform: uppercase;
}

.topbar p { color: #667085; margin: 4px 0 0; }
.actions, .card-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.shell, .workspace { margin: 0 auto; max-width: 1280px; padding: 28px; }

.toolbar, .section-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

h1, h2, h3 { color: #172033; margin-top: 0; }
h1 { font-size: 28px; }
h2 { font-size: 18px; }
h3 { font-size: 14px; }
.muted { color: #667085; }

.project-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
}

.project-card, .panel, .metric {
  background: #fff;
  border: 1px solid #dde3eb;
  border-radius: 8px;
  padding: 18px;
}

.project-card p { color: #667085; font-size: 13px; }
.file-button input { display: none; }

.back-link {
  color: #667085;
  font-size: 13px;
  text-decoration: none;
}

.title-input {
  border: 0;
  font-size: 22px;
  font-weight: 760;
  min-height: 34px;
  padding: 0;
}

.tabs {
  background: #e9edf3;
  border-radius: 8px;
  display: flex;
  gap: 4px;
  margin-bottom: 18px;
  padding: 4px;
}

.tabs button {
  background: transparent;
  color: #4a5565;
  flex: 1;
  min-height: 34px;
}

.tabs button.active {
  background: #fff;
  color: #172033;
  box-shadow: 0 1px 4px rgba(15, 23, 42, .08);
}

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.metric-row {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.metric strong {
  display: block;
  font-size: 30px;
}

.metric span { color: #667085; font-size: 13px; }
.workflow { color: #4a5565; line-height: 1.7; }
.stack { display: grid; gap: 12px; }
.two-col { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }

.assignments {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.assignment {
  background: #f8fafc;
  border: 1px solid #e5eaf0;
  border-radius: 8px;
  display: grid;
  gap: 10px;
  grid-template-columns: 1.2fr repeat(4, minmax(110px, 1fr)) 1.8fr;
  padding: 12px;
}

.assignment strong { align-self: center; font-size: 13px; }
.scenario-grid, .results-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
}

.settings-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  margin-top: 12px;
}

.result-head {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
}

.risk, .readonly-pill {
  border-radius: 999px;
  font-size: 12px;
  font-weight: 760;
  padding: 5px 9px;
}

.risk.low { background: #dcfce7; color: #166534; }
.risk.medium { background: #fef3c7; color: #92400e; }
.risk.high { background: #fed7aa; color: #9a3412; }
.risk.critical { background: #fecaca; color: #7f1d1d; }
.readonly-pill { background: #eef2ff; color: #3730a3; }

.summary {
  background: #f1f5f9;
  border-left: 3px solid #2563eb;
  border-radius: 6px;
  color: #263241;
  line-height: 1.55;
  padding: 12px;
}

.score-row {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, 1fr);
  margin: 14px 0;
}

.score-row div {
  background: #f8fafc;
  border-radius: 7px;
  padding: 10px;
}

.score-row strong { display: block; font-size: 22px; }
.score-row span { color: #667085; font-size: 12px; }
.result-card li { color: #4a5565; margin-bottom: 6px; }
details { margin-top: 12px; }
summary { cursor: pointer; font-weight: 700; }
.stake-row { border-top: 1px solid #e5eaf0; display: grid; gap: 8px; grid-template-columns: 1fr auto auto; padding: 10px 0; }

@media (max-width: 760px) {
  .topbar, .toolbar, .section-head { align-items: stretch; flex-direction: column; }
  .shell, .workspace { padding: 16px; }
  .tabs { overflow-x: auto; }
  .tabs button { flex: 0 0 auto; }
  .metric-row, .two-col, .assignment { grid-template-columns: 1fr; }
}
