/* =========================================================
   Unimatched — application portal stylesheet
   Matches the homepage (styles.css): rainforest greens,
   hibiscus red, Bricolage Grotesque + Atkinson Hyperlegible.
   All class names used by app.js are kept.
   ========================================================= */

:root {
  --ink: #10231c;
  --canopy: #1f5a45;
  --canopy-deep: #143d2f;
  --leaf: #dbe8df;
  --paper: #eef3ef;
  --white: #fbfdfb;
  --hibiscus: #c8203a;
  --hibiscus-dark: #a3182e;
  --sun: #f2b33d;
  --line: #c9d6ce;
  --muted: #4d6359;
  --ok: #1f7a4d;

  /* Legacy names, in case app.js or inline styles reference them */
  --card: var(--white);
  --accent: var(--canopy);
  --text: var(--ink);
  --border: var(--line);
  --danger: var(--hibiscus);

  --font-display: "Bricolage Grotesque", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius-s: 8px;
  --radius-m: 14px;
  --radius-l: 24px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--canopy); }
:focus-visible { outline: 3px solid var(--sun); outline-offset: 2px; border-radius: 4px; }

/* ---------- Top bar ---------- */
.portal-bar {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 760px; margin: 0 auto; padding: 18px 20px 0;
}
.logo { display: flex; align-items: center; gap: .55rem; text-decoration: none; color: var(--ink); }
.logo-mark {
  width: 2rem; height: 2rem; border-radius: 50% 50% 50% 4px; background: var(--hibiscus);
  color: var(--white); display: grid; place-items: center; font: 800 1.05rem/1 var(--font-display);
}
.logo-word { font: 800 1.35rem/1 var(--font-display); letter-spacing: -0.03em; }
.portal-bar .back-home { font-size: 14px; font-weight: 700; color: var(--muted); text-decoration: none; }
.portal-bar .back-home:hover { color: var(--ink); text-decoration: underline; }

/* ---------- Card ---------- */
.app {
  width: calc(100% - 32px); max-width: 720px; margin: 20px auto 48px;
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-l);
  padding: clamp(22px, 5vw, 40px);
  box-shadow: 0 24px 48px -32px rgba(16, 35, 28, .35);
}
h1 {
  font: 700 clamp(1.6rem, 1.2rem + 1.6vw, 2.1rem)/1.12 var(--font-display);
  letter-spacing: -0.025em; margin-bottom: 8px;
}
.sub { color: var(--muted); font-size: 15px; margin-bottom: 24px; }
.screen { display: none; }
.screen.active { display: block; }

/* ---------- Form controls ---------- */
label { display: block; font-size: 14px; font-weight: 700; margin-bottom: 6px; color: var(--ink); }
input {
  width: 100%; padding: 12px 14px; border-radius: var(--radius-s);
  border: 1.5px solid var(--line); background: var(--paper); color: var(--ink);
  font: 16px var(--font-body); margin-bottom: 16px; outline: none;
}
input::placeholder { color: #7d9187; }
input:focus { border-color: var(--canopy); box-shadow: 0 0 0 3px var(--leaf); background: var(--white); }
input[type="checkbox"] { accent-color: var(--canopy); }
.row { display: flex; gap: 12px; }
.row > div { flex: 1; min-width: 0; }

button {
  width: 100%; padding: 14px; border-radius: 999px; border: 2px solid transparent; cursor: pointer;
  font: 700 16px/1 var(--font-body); background: var(--hibiscus); color: var(--white);
  transition: background-color .15s, color .15s, border-color .15s;
}
button:hover { background: var(--hibiscus-dark); }
button:disabled { opacity: .4; cursor: not-allowed; }
button:disabled:hover { background: var(--hibiscus); }

.consent {
  display: flex; align-items: flex-start; gap: 10px; margin: 6px 0 18px;
  font-size: 14px; font-weight: 400; line-height: 1.45; color: var(--muted);
}
.consent input { width: 18px; height: 18px; flex: 0 0 18px; margin: 2px 0 0; padding: 0; }
.consent span { flex: 1; min-width: 0; }
.opt { font-weight: 400; color: var(--muted); }

.switch { text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); }
.switch a { color: var(--canopy); font-weight: 700; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.switch a.quiet { color: var(--muted); font-weight: 400; }
.error { color: var(--hibiscus); font-size: 14px; font-weight: 700; margin-bottom: 12px; }
.error:empty { display: none; }
.email-target { color: var(--ink); }

/* ---------- Steps & user bar ---------- */
.userbar {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 22px; padding-bottom: 14px; border-bottom: 1px solid var(--line);
  font-size: 14px; color: var(--muted);
}
.userbar b { color: var(--ink); }
.userbar a { color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-weight: 700; }
.userbar a:hover { color: var(--hibiscus); }
.step-badge {
  display: inline-block; background: var(--leaf); color: var(--canopy-deep);
  padding: 4px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; margin-bottom: 14px;
}

/* ---------- Level picker ---------- */
.level-cards { display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.level-card {
  background: var(--paper); border: 1.5px solid var(--line); border-radius: var(--radius-m);
  padding: 18px 20px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 16px;
  transition: border-color .15s, background-color .15s;
}
.level-card:hover, .level-card:focus-visible { border-color: var(--canopy); background: var(--white); }
.level-card .lc-title { font: 700 18px/1.2 var(--font-display); margin-bottom: 4px; }
.level-card .lc-sub { font-size: 14px; color: var(--muted); }
.level-card .lc-icon { font-size: 22px; color: var(--canopy); flex-shrink: 0; }

.level-bar {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--paper); border: 1px solid var(--line);
  padding: 10px 14px; border-radius: var(--radius-s); margin-bottom: 18px; font-size: 14px;
}
.level-bar b { color: var(--ink); }
.level-bar a { color: var(--canopy); cursor: pointer; text-decoration: underline; font-size: 13px; font-weight: 700; }

/* ---------- Program search results ---------- */
.results { margin-top: 4px; max-height: 520px; overflow-y: auto; padding-right: 4px; }
.group-title {
  font: 700 15px/1.2 var(--font-display); color: var(--canopy-deep);
  margin: 20px 0 8px; padding-bottom: 6px; border-bottom: 2px solid var(--ink);
}
.uni-card {
  background: var(--white); border: 1.5px solid var(--line); border-radius: var(--radius-m);
  margin-bottom: 10px; overflow: hidden; transition: border-color .15s;
}
.uni-card:hover, .uni-card.open { border-color: var(--canopy); }
.uni-header { padding: 14px 16px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.uni-header .left { flex: 1; min-width: 0; }
.uni-header .name { font: 700 16px/1.3 var(--font-display); margin-bottom: 4px; }
.uni-header .meta { font-size: 13px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.uni-header .caret { color: var(--muted); font-size: 12px; transition: transform .2s; flex-shrink: 0; }
.uni-card.open .caret { transform: rotate(90deg); }
.variants { display: none; border-top: 1px solid var(--line); background: var(--paper); }
.uni-card.open .variants { display: block; }
.variant {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  cursor: pointer; transition: background-color .15s; border-left: 3px solid transparent;
}
.variant:last-child { border-bottom: none; }
.variant:hover { background: var(--leaf); }
.variant .vname { font-size: 14.5px; }
.variant .vmeta { font-size: 12px; color: var(--muted); margin-top: 3px; display: flex; gap: 8px; flex-wrap: wrap; }
.variant .arrow { color: var(--canopy); font-size: 14px; }
.variant .checkbox {
  width: 20px; height: 20px; border: 2px solid var(--line); border-radius: 5px; background: var(--white);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  font-size: 12px; font-weight: 700; color: transparent; transition: .15s;
}
.variant.selected { background: var(--leaf); border-left-color: var(--canopy); }
.variant.selected .checkbox { background: var(--canopy); border-color: var(--canopy); color: var(--white); }

/* Tuition bands */
.band { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 700; }
.band.low { background: #d7ecdf; color: #1f6a43; }
.band.mid { background: #fbecc9; color: #7a5410; }
.band.high { background: #fbdde1; color: var(--hibiscus-dark); }
.band.premium { background: var(--ink); color: var(--white); }

/* Study level tags */
.level { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 700;
  background: #e3e9e5; color: var(--muted); }
.level.Foundation { background: #e7e2f3; color: #4f3f86; }
.level.Diploma { background: #dcebf1; color: #24576b; }
.level.Bachelor { background: var(--leaf); color: var(--canopy-deep); }
.level.Master { background: #fbecc9; color: #7a5410; }
.level.PhD { background: #fbdde1; color: var(--hibiscus-dark); }

.empty { color: var(--muted); font-size: 15px; text-align: center; padding: 28px 0; }
mark { background: #fbe3a8; color: inherit; padding: 0 2px; border-radius: 3px; }

/* ---------- Selection bar ---------- */
.selection-bar {
  position: sticky; bottom: 12px; margin-top: 16px; padding: 12px 12px 12px 18px;
  background: var(--ink); color: var(--white); border-radius: 999px;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  box-shadow: 0 16px 32px -16px rgba(16, 35, 28, .6);
}
.sel-info { font-size: 14px; color: #cfe0d6; }
.sel-info b { color: var(--sun); font-size: 16px; }
.btn-next { width: auto; padding: 11px 24px; font-size: 15px; }
.btn-next:disabled { opacity: .45; }

/* ---------- Documents ---------- */
.notice {
  background: var(--paper); border: 1px solid var(--line); border-left: 4px solid var(--canopy);
  padding: 12px 14px; border-radius: var(--radius-s); color: var(--ink);
}
.selected-recap {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-m);
  padding: 16px 18px; margin-bottom: 20px;
}
.recap-title { font: 700 15px/1.2 var(--font-display); color: var(--canopy-deep); margin-bottom: 8px; }
.recap-list { display: flex; flex-direction: column; }
.recap-item { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.recap-item:last-child { border-bottom: none; }
.recap-item .rname { flex: 1; min-width: 0; font-weight: 700; }
.recap-item .runi { font-size: 12.5px; color: var(--muted); margin-top: 3px; font-weight: 400; }
.recap-item .rfee { font-size: 13px; color: var(--canopy-deep); font-weight: 700; white-space: nowrap; }

.upload-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.upload-item {
  position: relative; display: flex; align-items: center; gap: 14px;
  background: var(--white); border: 1.5px solid var(--line); border-radius: var(--radius-m); padding: 14px 16px;
}
.upload-item.has-file { border-color: var(--canopy); background: #f3f8f4; }
.upload-icon {
  width: 40px; height: 40px; border-radius: 10px; background: var(--leaf); color: var(--canopy-deep);
  display: grid; place-items: center; flex-shrink: 0; font-size: 20px;
}
.upload-icon svg { width: 20px; height: 20px; }
.upload-info { flex: 1; min-width: 0; }
.upload-name { font-size: 15px; font-weight: 700; margin-bottom: 2px; }
.upload-hint { font-size: 12.5px; color: var(--muted); }
.req-star { color: var(--hibiscus); }
.opt-tag { font-size: 11px; color: var(--muted); background: #e3e9e5; padding: 2px 7px; border-radius: 999px; margin-left: 4px; font-weight: 700; }
.upload-btn {
  flex-shrink: 0; width: auto; margin: 0; background: transparent; border: 2px solid var(--ink); color: var(--ink);
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 700; cursor: pointer; transition: .15s;
}
.upload-btn:hover { background: var(--ink); color: var(--white); }
.upload-btn:focus-within { outline: 3px solid var(--sun); outline-offset: 2px; }
.upload-btn input { display: none; }
.upload-status { flex-shrink: 0; font-size: 12px; color: var(--muted); min-width: 90px; text-align: right; }
.upload-status.ok { color: var(--ok); font-weight: 700; }
.upload-remove {
  flex-shrink: 0; width: 26px; height: 26px; padding: 0; margin-left: 4px; border-radius: 50%;
  background: transparent; border: none; color: var(--muted); display: none;
  align-items: center; justify-content: center; cursor: pointer; font-size: 16px; line-height: 1;
}
.upload-remove:hover { color: var(--hibiscus); background: #fbdde1; }
.upload-item.has-file .upload-remove { display: flex; }

.details-actions { display: flex; gap: 12px; margin-top: 24px; }
.details-actions button { width: 100%; }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-secondary:hover { background: var(--ink); color: var(--white); }

/* ---------- OTP ---------- */
.otp-inputs { display: flex; gap: 10px; justify-content: center; margin-bottom: 16px; }
.otp-digit {
  width: 48px; height: 58px; text-align: center; padding: 0; margin: 0; border-radius: 10px;
  font: 700 24px/1 var(--font-display); letter-spacing: 0;
}
.otp-digit:focus { border-color: var(--canopy); box-shadow: 0 0 0 3px var(--leaf); }
.otp-digit.filled { border-color: var(--canopy); background: var(--white); }
#resendLink.disabled { pointer-events: none; opacity: .4; cursor: not-allowed; }
.cooldown { opacity: .7; }

/* ---------- Success ---------- */
.success-mark {
  width: 52px; height: 52px; border-radius: 50%; background: var(--canopy); color: var(--white);
  display: grid; place-items: center; font-size: 26px; font-weight: 700; margin-bottom: 18px;
}
.app-id-box {
  background: var(--canopy-deep); color: var(--white); border-radius: var(--radius-m);
  padding: 18px 20px; margin: 4px 0 20px;
}
.app-id-label { font-size: 13px; color: #a9c7b8; }
.app-id-value { font: 800 22px/1.2 var(--font-display); letter-spacing: .02em; margin-top: 6px; color: var(--sun); word-break: break-all; }
.app-id-hint { font-size: 13px; color: #a9c7b8; margin-top: 6px; }
.next-steps { list-style: none; margin: 0 0 24px; padding: 0; border-top: 1px solid var(--line); }
.next-steps li { padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 14.5px; color: var(--muted); }
.next-steps b { color: var(--ink); }

.portal-foot { max-width: 720px; margin: 0 auto 32px; padding: 0 20px; font-size: 12px; color: var(--muted); text-align: center; }

/* ---------- Small screens ---------- */
@media (max-width: 560px) {
  .row { flex-direction: column; gap: 0; }
  .otp-inputs { gap: 6px; }
  .otp-digit { width: 42px; height: 52px; font-size: 21px; }
  .upload-item { flex-wrap: wrap; }
  .upload-info { flex-basis: calc(100% - 54px); }
  .upload-btn { margin-left: 54px; }
  .upload-status { min-width: 0; margin-left: auto; }
  .details-actions { flex-direction: column-reverse; }
  .selection-bar { border-radius: var(--radius-m); }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
