:root {
  color-scheme: light;
  --page: #f4f5f3;
  --paper: #ffffff;
  --paper-soft: #fbfaf7;
  --ink: #20201d;
  --muted: #6e6b63;
  --muted-2: #8a877f;
  --line: rgba(32, 32, 29, 0.12);
  --line-strong: rgba(32, 32, 29, 0.22);
  --blue: #234d73;
  --blue-soft: #e7eef4;
  --olive: #6f7564;
  --red: #a2473d;
  --green: #4f7b63;
  --ochre: #9a6b2f;
  --gray: #7b8287;
  --radius: 8px;
}

* { box-sizing: border-box; }

html { background: var(--page); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--page);
}

button, select, input {
  font: inherit;
}

.loading-shell, .error-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
  text-align: center;
}

.loading-shell h1, .error-shell h1 {
  margin: 0.3rem 0;
  color: var(--ink);
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: 0;
}

.eyebrow, .section-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0;
  text-transform: uppercase;
}

.page-shell {
  width: min(1440px, calc(100vw - 40px));
  margin: 24px auto;
}

.app-grid {
  display: grid;
  grid-template-columns: 304px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.sidebar {
  padding: 20px;
  position: sticky;
  top: 20px;
}

.brand-block {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.brand-block h2 {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 1.32rem;
  line-height: 1.2;
  letter-spacing: 0;
}

.brand-block p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.brand-meta {
  display: none;
}

.brand-pill, .brand-link, .stats-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border-radius: 999px;
  padding: 6px 10px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.2;
}

.stats-pill:first-child {
  background: var(--blue-soft);
  border-color: rgba(35, 77, 115, 0.2);
  color: var(--blue);
}

.brand-link {
  text-decoration: none;
}

.brand-link:hover {
  color: var(--blue);
  border-color: rgba(35, 77, 115, 0.35);
}

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

.archive-panel {
  width: min(720px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.archive-panel h1 {
  margin: 0.3rem 0 0.8rem;
  font-size: clamp(2rem, 6vw, 3.2rem);
  letter-spacing: 0;
}

.archive-panel p {
  color: var(--muted);
  line-height: 1.7;
}

.archive-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.archive-actions a {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 14px;
  color: var(--ink);
  text-decoration: none;
  background: var(--paper-soft);
}

.section-card, .content-card {
  background: transparent;
}

.section-card {
  padding-top: 18px;
}

.content-card {
  padding: 0;
}

.section-card h2,
.section-card h3,
.content-card h2 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 1.04rem;
  letter-spacing: 0;
}

.section-label {
  display: block;
  margin-bottom: 14px;
}

.control-group + .control-group {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.control-group h3 {
  font-size: 0.92rem;
}

.select-input, .search-input {
  width: 100%;
  min-height: 40px;
  border-radius: 5px;
  border: 1px solid var(--line-strong);
  background: var(--paper);
  color: var(--ink);
  padding: 9px 11px;
}

.select-input:focus, .search-input:focus {
  outline: 2px solid rgba(35, 77, 115, 0.2);
  border-color: var(--blue);
}

.select-input option {
  background: var(--paper);
  color: var(--ink);
}

.school-search {
  margin-bottom: 8px;
}

.check-grid {
  display: grid;
  gap: 7px;
}

.check-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 32px;
  color: var(--muted);
  font-size: 0.91rem;
}

.check-pill input {
  width: 15px;
  height: 15px;
  margin: 0;
  accent-color: var(--blue);
}

.reset-button, .pager-button, .tab-button, .notes-toggle {
  border: 1px solid var(--line-strong);
  background: var(--paper-soft);
  color: var(--ink);
  cursor: pointer;
  border-radius: 5px;
  transition: border-color 150ms ease, color 150ms ease, background 150ms ease;
}

.reset-button:hover, .pager-button:hover, .tab-button:hover, .notes-toggle:hover {
  border-color: rgba(35, 77, 115, 0.35);
  color: var(--blue);
}

.reset-button {
  width: 100%;
  margin-top: 20px;
  padding: 10px 14px;
  font-weight: 650;
}

.summary-list {
  display: grid;
  gap: 8px;
}

.summary-item {
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--paper-soft);
  border: 1px solid var(--line);
  font-weight: 600;
}

.comparison-table, .results-table {
  width: 100%;
  border-collapse: collapse;
}

.comparison-table th, .comparison-table td,
.results-table th, .results-table td {
  padding: 12px 13px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.comparison-table th, .results-table th {
  color: var(--muted);
  font-weight: 650;
}

.main-panel {
  padding: 28px;
}

.hero-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.hero-title {
  margin: 0;
  color: var(--ink);
  font-size: clamp(1.85rem, 3.1vw, 2.7rem);
  line-height: 1.08;
  letter-spacing: 0;
  font-weight: 700;
}

.hero-copy {
  max-width: 760px;
  margin: 0.7rem 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.stats-inline {
  display: flex;
  gap: 8px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.view-stack {
  display: grid;
  gap: 28px;
  margin-top: 24px;
}

.hero-stage .content-card,
.stack-section .content-card,
.analysis-details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.hero-stage .content-card {
  padding: 20px;
}

.stack-section .content-card {
  padding: 20px;
}

.analysis-details {
  overflow: hidden;
}

.analysis-details summary {
  list-style: none;
  cursor: pointer;
  padding: 15px 18px;
  font-weight: 650;
  color: var(--muted);
}

.analysis-details summary:hover {
  color: var(--blue);
}

.analysis-details summary::-webkit-details-marker {
  display: none;
}

.analysis-grid {
  display: grid;
  gap: 20px;
  padding: 0 18px 18px;
}

.analysis-grid .content-card {
  padding: 18px 0 0;
  border-top: 1px solid var(--line);
}

.content-card p {
  color: var(--muted);
  line-height: 1.55;
}

.chart-shell {
  width: 100%;
  height: 400px;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--paper), var(--paper-soft));
  padding: 12px;
}

.chart-shell.chart-tall {
  height: 600px;
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 240px;
  color: var(--muted);
  text-align: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper-soft);
}

.data-toolbar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 18px;
}

.data-toolbar .search-input {
  flex: 1 1 320px;
}

.table-wrap {
  overflow: auto;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
}

.results-table {
  min-width: 980px;
  font-size: 0.91rem;
}

.results-table th {
  position: sticky;
  top: 0;
  background: var(--paper-soft);
  z-index: 1;
}

.results-table tr:hover {
  background: rgba(35, 77, 115, 0.035);
}

.results-table .notes-cell {
  min-width: 300px;
  max-width: 520px;
  color: var(--muted);
  line-height: 1.45;
}

.notes-text {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}

.notes-expanded .notes-text {
  display: block;
  white-space: pre-wrap;
}

.notes-toggle {
  margin-top: 7px;
  padding: 5px 8px;
  color: var(--blue);
  background: transparent;
  border-color: transparent;
  font-size: 0.78rem;
  font-weight: 650;
}

.decision-tag {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  border-radius: 999px;
  padding: 4px 8px;
  border: 1px solid currentColor;
  background: var(--paper);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.2;
}

.decision-accepted { color: var(--blue); }
.decision-rejected { color: var(--red); }
.decision-interview { color: var(--green); }
.decision-waitlisted { color: var(--ochre); }
.decision-other { color: var(--gray); }

.pager {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  color: var(--muted);
}

.pager-button {
  padding: 8px 12px;
}

.pager-button:disabled {
  cursor: default;
  opacity: 0.45;
}

.detail-card {
  margin-top: 16px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--paper-soft);
  border: 1px solid var(--line);
  white-space: pre-wrap;
  line-height: 1.6;
}

.tooltip-card {
  border-radius: 8px;
  padding: 12px;
  background: rgba(32, 32, 29, 0.96);
  color: white;
  box-shadow: 0 16px 42px rgba(32, 32, 29, 0.18);
}

.tooltip-card p {
  margin: 0;
  color: rgba(255, 255, 255, 0.84);
}

.tooltip-card strong {
  display: block;
  margin-bottom: 6px;
}

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

  .sidebar {
    position: static;
  }

  .page-shell {
    width: min(100vw - 20px, 1440px);
    margin: 10px auto;
  }
}

@media (max-width: 680px) {
  .main-panel, .sidebar {
    padding: 16px;
  }

  .hero-stage .content-card,
  .stack-section .content-card {
    padding: 14px;
  }

  .hero-title {
    font-size: 1.65rem;
  }

  .chart-shell {
    height: 340px;
  }

  .chart-shell.chart-tall {
    height: 480px;
  }

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