:root {
  --bg: #f6f1e8;
  --panel: #fffdf8;
  --panel-strong: #f0e5d4;
  --text: #1f2933;
  --muted: #5f6c7b;
  --line: #dfd3c1;
  --accent: #b85c38;
  --accent-dark: #8f4528;
  --shadow: 0 18px 45px rgba(82, 55, 33, 0.12);
  --radius: 18px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(184, 92, 56, 0.15), transparent 28%),
    linear-gradient(180deg, #f9f4ed 0%, var(--bg) 100%);
}

body.signed-out {
  display: grid;
}

.app-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 40px 0 56px;
}

body.signed-out .app-shell {
  width: min(540px, calc(100% - 32px));
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 0;
}

.app-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.hero {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(2.2rem, 4vw, 3.6rem);
  line-height: 1;
}

.subtitle {
  max-width: 700px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
}

.top-nav {
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.nav-button {
  color: var(--accent-dark);
  background: rgba(240, 229, 212, 0.85);
}

.nav-button-active {
  color: #fffaf4;
  background: var(--accent);
}

.page-view {
  display: none;
}

.page-view-active {
  display: block;
}

.card {
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid rgba(223, 211, 193, 0.75);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
  backdrop-filter: blur(10px);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 18px;
}

.section-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--panel-strong);
  color: var(--accent-dark);
  font-weight: 700;
}

h2 {
  margin: 0;
  font-size: 1.5rem;
}

.profile-stack {
  display: grid;
  gap: 22px;
}

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

.task-form {
  display: grid;
  gap: 18px;
}

.planner-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.4fr);
  gap: 18px;
}

.questionnaire-grid {
  display: grid;
  gap: 18px;
}

.questionnaire-stack {
  display: grid;
  gap: 12px;
}

.ranking-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.ranking-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: grab;
}

.ranking-item:active {
  cursor: grabbing;
}

.ranking-item.dragging {
  opacity: 0.55;
  border-style: dashed;
}

.ranking-handle {
  font-size: 1.1rem;
  color: var(--muted);
  user-select: none;
}

.ranking-position {
  min-width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--panel-strong);
  color: var(--accent-dark);
  font-weight: 700;
}

.ranking-label {
  font-weight: 700;
}

.subsection {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(240, 229, 212, 0.26);
}

.subsection-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.subsection h3 {
  margin: 0;
  font-size: 1.1rem;
}

.heading-ed {
  color: #1e5aa8;
}

.heading-ea {
  color: #b01f7a;
}

.heading-rd {
  color: var(--text);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.98rem;
}

.field span {
  font-weight: 700;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  margin-top: 6px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 14px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(184, 92, 56, 0.22);
  border-color: var(--accent);
}

button {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 700;
  color: #fffaf4;
  background: var(--accent);
  cursor: pointer;
  transition: transform 140ms ease, background 140ms ease;
}

button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.secondary-button {
  color: var(--accent-dark);
  background: var(--panel-strong);
}

.secondary-button:hover {
  background: #e7d7bf;
}

.subjects-list,
.activities-list,
.planner-list {
  display: grid;
  gap: 12px;
}

.subject-row {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(120px, 0.9fr) auto;
  gap: 12px;
  align-items: end;
}



.academic-section[hidden] {
  display: none;
}

.curriculum-field {
  max-width: 320px;
}

.a-level-score-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.a-level-subject-row {
  grid-template-columns: minmax(0, 1.8fr) minmax(120px, 0.9fr);
}

.ib-subsection-gap {
  margin-top: 12px;
}

.ib-core-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.ib-score-display {
  min-width: 0;
  text-align: left;
}

.form-grid-single-academic {
  grid-template-columns: minmax(0, 1fr);
}

.ib-subject-row {
  grid-template-columns: minmax(0, 1.8fr) minmax(120px, 0.9fr);
}

.activity-row {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(220px, 0.7fr);
  grid-template-areas:
    "name impact"
    "description optimize";
  gap: 12px 28px;
  align-items: start;
}

.activity-name-field {
  grid-area: name;
}

.activity-impact-field {
  grid-area: impact;
  align-self: start;
}

.activity-description-field {
  grid-area: description;
}

.activity-optimize {
  grid-area: optimize;
  display: flex;
  align-items: flex-start;
  align-self: start;
}

.activity-description {
  resize: vertical;
  min-height: 88px;
}

.activity-optimize-button {
  width: 100%;
  white-space: nowrap;
}

.icon-button {
  padding: 12px 16px;
  color: #8f2b2b;
  background: #f9e2e2;
}

.icon-button:hover {
  background: #f0cbcb;
}

.profile-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 18px;
}

.score-display {
  min-width: 220px;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--panel-strong);
  text-align: right;
}

.score-label {
  display: block;
  color: var(--muted);
  font-size: 0.85rem;
  margin-bottom: 4px;
}

#profile-score-value {
  font-size: 1.4rem;
}

.helper-text {
  margin: 12px 0 0;
  color: var(--muted);
}

.breakdown-panel {
  margin-top: 18px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(240, 229, 212, 0.35);
}

.breakdown-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.breakdown-item {
  padding: 12px 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
}

.breakdown-item strong {
  display: block;
  margin-top: 6px;
  font-size: 1.1rem;
}

.selection-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
}

.task-filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.task-sort-bar {
  display: flex;
  gap: 14px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.task-sort-field {
  min-width: 220px;
}

.filter-button {
  color: var(--accent-dark);
  background: rgba(240, 229, 212, 0.85);
}

.filter-button-active {
  color: #fffaf4;
  background: var(--accent);
}

.task-list {
  display: grid;
  gap: 12px;
}

.task-card {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

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

.task-card h3 {
  margin: 0;
  font-size: 1.02rem;
}

.task-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.task-main {
  display: grid;
  gap: 10px;
  align-content: start;
}

.task-side {
  display: grid;
  justify-items: end;
  align-content: start;
  align-self: end;
  gap: 10px;
}

.task-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.task-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

button.task-edit-button,
button.task-toggle-button {
  padding-top: 10px;
  padding-bottom: 10px;
}

.task-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.84rem;
  font-weight: 700;
  background: var(--panel-strong);
  color: var(--accent-dark);
}

button.task-remove-button,
button.task-remove-button:hover {
  background: #f8d7d7;
  color: #922b2b;
}

button.task-remove-button {
  padding-top: 20px;
  padding-bottom: 20px;
  align-self: end;
}

.task-chip.priority-1-2 {
  background: #dff4d9;
  color: #1b6d30;
}

.task-chip.priority-3-4 {
  background: #dff0ff;
  color: #165c96;
}

.task-chip.priority-5-6 {
  background: #fff0c9;
  color: #8b6200;
}

.task-chip.priority-7-8 {
  background: #ffe0c7;
  color: #9b4d08;
}

.task-chip.priority-9-10 {
  background: #f8d7d7;
  color: #922b2b;
}

.planner-controls {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.statuses-grid {
  display: grid;
  gap: 12px;
}

.status-list {
  display: grid;
  gap: 12px;
}

.status-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.status-card h4 {
  margin: 0;
  font-size: 1rem;
}

.status-field {
  min-width: 240px;
}

.status-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 190px;
  padding: 8px 12px;
  border-radius: 999px;
  font-weight: 700;
}

.status-working {
  background: #e5e7eb;
  color: #4b5563;
}

.status-applied {
  background: #dff0ff;
  color: #165c96;
}

.status-rejected {
  background: #f8d7d7;
  color: #922b2b;
}

.status-deferred {
  background: #ffe0c7;
  color: #9b4d08;
}

.status-waitlisted {
  background: #fff0c9;
  color: #8b6200;
}

.status-accepted {
  background: #dff4d9;
  color: #1b6d30;
}

.status-enrolled {
  background: #b9e3ff;
  color: #0c5a96;
}

.planner-controls-wide {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.planner-control-field {
  min-width: 0;
}

.planner-control-search-wide {
  grid-column: 1 / 2;
}

.search-field {
  margin-bottom: 16px;
}

.university-list,
.planner-list-wide {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.university-option,
.planner-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.university-option input,
.planner-option input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
}

.planner-option-disabled {
  opacity: 0.55;
}

.planner-option strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.98rem;
}

.planner-option-text {
  flex: 1;
}

.planner-option-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.planner-option-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.planner-option span,
.university-option span {
  line-height: 1.4;
}

.planner-category {
  min-width: 96px;
  padding: 6px 10px;
  font-size: 0.82rem;
}

.fit-badge {
  min-width: 88px;
  padding: 6px 10px;
  font-size: 0.82rem;
}

.fit-90-plus {
  background: #47d16c;
  color: #0f3e1b;
}

.fit-80s {
  background: #1f8b4c;
  color: #f4fff7;
}

.fit-70s {
  background: #f2d34b;
  color: #5e4700;
}

.fit-60s {
  background: #ef9a3d;
  color: #5a2d00;
}

.fit-50s {
  background: #d94a4a;
  color: #fff4f4;
}

.fit-below-50 {
  background: #4d2b63;
  color: #f7efff;
}

.planner-select {
  background: #fff;
}

.planner-rd {
  margin-top: 18px;
}

.planner-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.option-group {
  margin: 0;
  padding-top: 20px;
}

.option-group legend {
  padding: 0 8px;
  font-weight: 700;
}

.choice-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}

.choice-row input {
  width: 18px;
  height: 18px;
  margin: 0;
}

.summary-block {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.summary-block h3 {
  margin: 0 0 10px;
  font-size: 1rem;
}

.summary-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.summary-list li + li {
  margin-top: 6px;
}

.results-empty {
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 14px;
  padding: 18px;
  background: rgba(240, 229, 212, 0.35);
}

.results-grid {
  display: grid;
  gap: 12px;
}

.result-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

.result-card h3,
.summary-block h3 {
  margin: 0;
}

.result-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 108px;
  padding: 10px 14px;
  border-radius: 999px;
  font-weight: 700;
}

.badge-safety {
  background: #dff4d9;
  color: #1b6d30;
}

.badge-match {
  background: #dff0ff;
  color: #165c96;
}

.badge-target {
  background: #fff0c9;
  color: #8b6200;
}

.badge-reach {
  background: #ffe0c7;
  color: #9b4d08;
}

.badge-hard-reach {
  background: #f8d7d7;
  color: #922b2b;
}

@media (max-width: 860px) {
  .planner-grid,
  .breakdown-grid,
  .planner-summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 760px) {
  .app-shell {
    width: min(100% - 20px, 1080px);
    padding-top: 24px;
  }

  .form-grid,
  .subject-row,
  .activity-row,
  .university-list,
  .planner-list-wide,
  .planner-controls,
  .planner-controls-wide,
  .ib-core-grid,
  .a-level-score-grid {
    grid-template-columns: 1fr;
  }

  .task-sort-field {
    min-width: 100%;
  }

  .profile-actions,
  .result-card,
  .task-card-top,
  .status-card {
    flex-direction: column;
    align-items: stretch;
  }

  .task-side,
  .task-meta {
    justify-items: stretch;
    justify-content: flex-start;
  }

  .score-display {
    text-align: left;
  }
}

.auth-shell {
  margin-bottom: 22px;
}

body.signed-out .auth-shell {
  width: 100%;
  margin-bottom: 0;
}

.auth-shell-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.auth-eyebrow {
  margin-bottom: 6px;
}

.auth-status {
  margin: 10px 0 0;
}

.auth-status-error {
  color: #9f2d2d;
}

.auth-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}

.auth-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

.auth-actions button {
  min-width: 172px;
  justify-content: center;
}

#app-content[hidden] {
  display: none;
}

#auth-shell[hidden] {
  display: none;
}

@media (max-width: 760px) {
  .auth-shell-top {
    flex-direction: column;
  }

  .auth-form {
    grid-template-columns: 1fr;
  }

  .auth-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .app-header {
    flex-direction: column;
    align-items: stretch;
  }
}

.section-actions {
  margin-top: 18px;
  display: flex;
  justify-content: flex-end;
}


.test-score-group {
  display: grid;
  gap: 1rem;
}

.checkbox-field {
  align-content: start;
}

.checkbox-inline {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.checkbox-inline input {
  width: auto;
}

.planner-option-disabled {
  opacity: 0.65;
}

.planner-restriction {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  background: rgba(160, 77, 43, 0.12);
  color: #a04d2b;
  font-size: 0.85rem;
  font-weight: 700;
}
