:root {
  --ink: #17202a;
  --muted: #5b6675;
  --line: #d8dee8;
  --panel: #ffffff;
  --wash: #f5f7fb;
  --accent: #116466;
  --accent-strong: #0b4f51;
  --gold: #bc7c18;
  --good: #1d7f4f;
  --warn: #a45b13;
  --bad: #8f2f2f;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family:
    Inter,
    Segoe UI,
    Arial,
    sans-serif;
  background: var(--wash);
}

button,
input,
select {
  font: inherit;
}

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

.control-panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  padding: 28px;
}

.results-panel {
  padding: 20px;
  min-width: 0;
}

.brand-row {
  margin-bottom: 6px;
}

.eyebrow {
  color: var(--gold);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0 0 8px;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: 30px;
  line-height: 1.1;
}

h2 {
  margin: 0;
  font-size: 20px;
}

.candidate-form {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.hero-label {
  font-size: 15px;
  color: var(--ink);
}

input,
select {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 12px;
}

#air {
  font-size: 20px;
  font-weight: 800;
  border: 2px solid var(--accent);
  min-height: 54px;
}

input:focus,
select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(17, 100, 102, 0.15);
}

/* Category pill row */
.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill-row button {
  flex: 1 1 auto;
  min-width: 58px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
  cursor: pointer;
}

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

.pwd-check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

.pwd-check input {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--accent);
}

/* Course tabs */
.tab-row {
  display: flex;
  gap: 6px;
  background: var(--wash);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px;
}

.tab-row button {
  flex: 1;
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
  cursor: pointer;
}

.tab-row button.active {
  background: #fff;
  color: var(--accent-strong);
  box-shadow: 0 1px 3px rgba(17, 24, 39, 0.12);
}

.form-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary-button,
.ghost-button {
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  min-height: 46px;
  padding: 9px 13px;
  font-weight: 800;
}

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

.primary-button:hover {
  background: var(--accent-strong);
}

.ghost-button {
  background: #eef3f4;
  color: var(--accent-strong);
  border-color: #d4e2e4;
}

/* Collapsible filters */
.more-filters {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 4px 12px;
  background: var(--wash);
}

.more-filters summary {
  cursor: pointer;
  padding: 10px 0;
  font-weight: 800;
  color: var(--accent-strong);
  font-size: 13px;
}

.filter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  padding: 4px 0 12px;
}

.filter-grid .span-2 {
  grid-column: 1 / -1;
}

.checkbox-line {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
  min-height: 0;
  accent-color: var(--accent);
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(110px, 1fr));
  gap: 8px;
}

.summary-strip > div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  text-align: center;
}

.summary-strip span {
  display: block;
  font-size: 25px;
  font-weight: 700;
}

.summary-strip small {
  color: var(--muted);
  font-weight: 800;
  text-transform: uppercase;
}

.notice {
  margin: 14px 0;
  color: var(--muted);
  background: #fff8eb;
  border: 1px solid #f0d7aa;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
}

.table-wrap {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: calc(100vh - 170px);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
  border: 1px solid var(--line);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px;
  /*text-align: left;*/
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f3f4f6;
  color: #222;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  text-align: center;
}

td {
  font-size: 14px;
}

.round-col {
  display: none;
}

table.show-rounds .round-col {
  display: table-cell;
}

table.show-rounds {
  min-width: 1160px;
}

.college-name {
  font-weight: 900;
}
tbody tr:nth-child(even) {
  background: #fafafa;
}

td:nth-child(3),
td:nth-child(4),
td:nth-child(5),
td:nth-child(6),
td:nth-child(7),
td:nth-child(8),
td:nth-child(9),
td:nth-child(10),
td:nth-child(11),
td:nth-child(12),
td:nth-child(13) {
  text-align: center;
  vertical-align: middle;
}

.meta {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
  max-width: 42ch;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 900;
}

.safe {
  background: #e8f7ef;
  color: var(--good);
}

.moderate {
  background: #fff2d9;
  color: var(--warn);
}

.tight,
.reach {
  background: #fbe8e8;
  color: var(--bad);
}

.print-heading,
.print-only {
  display: none;
}
/* ================= QUOTA DROPDOWN ================= */

.quota-wrapper {
  position: relative;
}

#quotaDropdown {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  z-index: 999;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.12);
}

#quotaDropdown.show {
  display: block;
}

#quotaSearch {
  width: 100%;
  height: 36px;
  margin-bottom: 8px;
}

/* checkbox list */

#quotaList {
  max-height: 140px;
  overflow-y: auto;
}

#quotaList label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

/* checkbox size */

#quotaList input[type="checkbox"] {
  width: 14px;
  height: 14px;
  min-height: 14px;
  margin: 0;
  padding: 0;
  accent-color: var(--accent);
}

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

  .control-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .summary-strip {
    grid-template-columns: 1fr 1fr;
  }

  .table-wrap {
    max-height: none;
  }

  /* Card-style table for small screens: no more side-scrolling */
  table,
  table.show-rounds {
    min-width: 0;
  }

  table thead {
    display: none;
  }

  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
  }

  tbody tr {
    border: 1px solid var(--line);
    border-radius: 10px;
    margin: 12px;
    padding: 10px 12px;
    background: #fff;
  }

  tbody td {
    border: none;
    padding: 6px 0;
  }

  tbody td.print-only {
    display: none;
  }

  tbody td[data-label]:not(:empty)::before {
    content: attr(data-label);
    display: block;
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    color: var(--muted);
    margin-bottom: 2px;
  }

  tbody td.round-col {
    display: none;
  }

  table.show-rounds tbody td.round-col {
    display: block;
  }
}

@media (max-width: 560px) {
  .control-panel,
  .results-panel {
    padding: 16px;
  }

  h1 {
    font-size: 24px;
  }

  .filter-grid {
    grid-template-columns: 1fr;
  }

  .filter-grid .span-2 {
    grid-column: auto;
  }
}

@media print {
  @page {
    size: A4 portrait;
    margin: 5mm;
  }

  html,
  body {
    background: #fff !important;
    color: #000 !important;
    font-family: "Inter", "Segoe UI", Arial, sans-serif !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  /* Hide controls */
  .control-panel,
  .summary-strip,
  .notice,
  .more-filters {
    display: none !important;
  }

  .app {
    display: block !important;
    min-height: 0 !important;
  }

  .results-panel {
    padding: 0 !important;
    width: 100% !important;
  }

  /* Heading */

  .print-heading {
    display: block !important;
    margin-bottom: 10px !important;
  }

  .print-heading h2 {
    font-size: 18px !important;
    margin: 0 0 4px !important;
    font-weight: 800 !important;
  }

  .print-heading p {
    font-size: 14px !important;
    margin: 0 !important;
    font-weight: 600 !important;
  }

  /* Table reset */

  .table-wrap {
    overflow: visible !important;
    border: none !important;
    max-height: none !important;
  }

  #resultsTable {
    display: table !important;

    width: 100% !important;

    min-width: 0 !important;

    border-collapse: collapse !important;

    table-layout: fixed !important;
  }

  #resultsTable thead {
    display: table-header-group !important;
  }

  #resultsTable tbody {
    display: table-row-group !important;
  }

  #resultsTable tr {
    display: table-row !important;

    page-break-inside: avoid !important;
  }

  #resultsTable th,
  #resultsTable td {
    display: table-cell !important;

    border: 1px solid #555 !important;

    padding: 10px 3px !important;

    font-size: 11px !important;

    vertical-align: middle !important;

    word-break: break-word;
  }

  #resultsTable th {
    background: #eee !important;

    color: #000 !important;

    text-align: center !important;

    font-weight: 900 !important;

    position: static !important;
  }

  /* =========================
       DEFAULT 5 COLUMN PRINT
     ========================= */

  #resultsTable th:nth-child(1),
  #resultsTable td:nth-child(1) {
    width: 55px !important;

    text-align: center;
  }

  #resultsTable th:nth-child(2),
  #resultsTable td:nth-child(2) {
    width: 230px !important;

    text-align: left;
  }

  #resultsTable th:nth-child(3),
  #resultsTable td:nth-child(3) {
    width: 55px !important;

    text-align: center;
  }

  #resultsTable th:nth-child(4),
  #resultsTable td:nth-child(4) {
    width: 80px !important;

    text-align: center;
  }
  /* Quota */
  #resultsTable th:nth-child(5),
  #resultsTable td:nth-child(5) {
    width: 75px !important;
  }

  #resultsTable th:nth-child(6),
  #resultsTable td:nth-child(6) {
    width: 70px !important;

    text-align: center;
  }

  /* =========================
       ROUND COLUMN LOGIC
     ========================= */

  #resultsTable .round-col {
    display: none !important;
  }

  #resultsTable.show-rounds .round-col {
    display: table-cell !important;
  }

  /* when rounds visible */

  #resultsTable.show-rounds th:nth-child(2),
  #resultsTable.show-rounds td:nth-child(2) {
    width: 180px !important;
  }

  #resultsTable.show-rounds .round-col {
    width: 65px !important;

    text-align: center !important;
  }

  /* Closing Rank */
  #resultsTable th:nth-child(12),
  #resultsTable td:nth-child(12) {
    width: 70px !important;
    text-align: center;
    font-weight: 600;
  }

  /* Chance */
  #resultsTable th:nth-child(13),
  #resultsTable td:nth-child(13) {
    width: 90px !important;
    text-align: center;
  }

  /* College */

  .college-name {
    font-size: 12x !important;

    font-weight: 600 !important;

    /*line-height: 1.2; */
    text-transform: uppercase;
  }

  /* remove address */

  .meta {
    display: none !important;
  }

  /* chance badge */

  .pill {
    display: inline-block !important;

    border: 1px solid #555 !important;

    background: #fff !important;

    color: #000 !important;

    border-radius: 3px;

    padding: 2px 3px;

    font-size: 11px !important;

    font-weight: 600;
  }

  .safe,
  .moderate,
  .tight,
  .reach {
    background: #fff !important;

    color: #000 !important;
  }

  /* Choice blank */

  .print-only {
    display: table-cell !important;
  }

  td[data-label]::before {
    content: none !important;

    display: none !important;
  }

  tbody tr {
    background: #fff !important;
  }
}
