:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --ink: #111827;
  --muted: #667085;
  --line: #d7deea;
  --brand: #1f5eff;
  --brand-dark: #1747bd;
  --green: #12805c;
  --orange: #b95d00;
  --red: #b42318;
  --soft-blue: #eef4ff;
  --shadow: 0 18px 50px rgba(17, 24, 39, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

button {
  border: 0;
  border-radius: 8px;
  color: #fff;
  background: var(--brand);
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--brand-dark);
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto;
  padding: 34px 0 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--brand);
  font-size: 13px;
  font-weight: 900;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 10px;
  font-size: 18px;
}

.lead {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.65;
}

.status-card {
  align-self: end;
  min-width: 230px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.status-card span,
.status-card small {
  display: block;
  color: var(--muted);
}

.status-card strong {
  display: block;
  margin: 7px 0;
  font-size: 24px;
}

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 18px;
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto 48px;
}

.admin-layout {
  width: min(1220px, calc(100% - 32px));
  margin: 0 auto 48px;
}

.admin-message {
  margin: 14px 0 0;
}

.workspace,
.side-panel,
.admin-panel,
.data-preview {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.workspace {
  min-width: 0;
  padding: 18px;
}

.side-panel {
  align-self: start;
  padding: 18px;
}

.side-panel ul {
  padding-left: 18px;
  color: #344054;
  line-height: 1.9;
}

.side-panel p {
  color: var(--muted);
  line-height: 1.65;
}

.mode-tabs,
.result-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.mode-tab,
.result-tab {
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--line);
  color: #344054;
  background: #fff;
  white-space: nowrap;
}

.mode-tab.active,
.result-tab.active {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.query-panel {
  display: grid;
  grid-template-columns: 1fr 0.75fr 0.85fr 0.75fr auto;
  gap: 12px;
  align-items: end;
  padding: 16px;
  border-radius: 8px;
  background: #f8fafc;
}

label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid #cfd6e2;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
}

select,
input {
  height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 210px;
  padding: 12px;
  resize: vertical;
  line-height: 1.5;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

select:focus,
input:focus,
textarea:focus {
  outline: 3px solid rgba(31, 94, 255, 0.16);
  border-color: var(--brand);
}

.query-panel button {
  height: 44px;
  padding: 0 18px;
}

.message {
  margin-top: 12px;
  padding: 11px 12px;
  border-radius: 8px;
  color: var(--red);
  background: #fff0ee;
  font-weight: 700;
}

.message.success {
  color: var(--green);
  background: #eaf8f2;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 16px 0;
}

.metric {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.metric span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.metric strong {
  font-size: 26px;
}

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

.result-card {
  display: grid;
  gap: 13px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.school-name {
  margin-bottom: 5px;
  font-size: 19px;
}

.major-name {
  margin: 0;
  color: var(--muted);
}

.badge {
  flex: 0 0 auto;
  height: 28px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 900;
}

.badge.sprint {
  color: var(--red);
  background: #fff0ee;
}

.badge.steady {
  color: var(--orange);
  background: #fff4e5;
}

.badge.safe {
  color: var(--green);
  background: #eaf8f2;
}

.facts {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.fact {
  padding: 9px;
  border-radius: 8px;
  background: #f3f6fb;
}

.fact span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.fact strong {
  font-size: 14px;
}

.reason,
.risk {
  margin: 0;
  color: #344054;
  line-height: 1.55;
}

.risk {
  color: var(--muted);
  font-size: 13px;
}

details {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 900;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 10px;
  font-size: 13px;
}

th,
td {
  padding: 8px 6px;
  border-bottom: 1px solid #edf0f5;
  text-align: left;
}

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

.empty-state {
  padding: 30px;
  border: 1px dashed #b8c0cc;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

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

.admin-panel,
.data-preview {
  padding: 16px;
}

.admin-panel p,
.data-preview p {
  color: var(--muted);
  line-height: 1.6;
}

.admin-panel button,
.section-head button {
  height: 40px;
  margin-top: 10px;
  padding: 0 14px;
}

.data-preview {
  margin-top: 14px;
}

.section-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: start;
}

.preview-box {
  min-width: 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.preview-box h3 {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--soft-blue);
  font-size: 15px;
}

.preview-box table {
  margin: 0;
  min-width: 620px;
}

@media (max-width: 980px) {
  .app-header,
  .layout,
  .admin-layout {
    width: min(100% - 24px, 760px);
  }

  .app-header,
  .layout,
  .query-panel,
  .summary-grid,
  .result-list,
  .admin-grid,
  .preview-grid,
  .facts {
    grid-template-columns: 1fr;
  }

  .app-header {
    display: block;
  }

  .status-card {
    margin-top: 18px;
  }

  .query-panel button {
    width: 100%;
  }
}
