:root {
  color-scheme: light;
  --red: #c8102e;
  --red-dark: #8f1428;
  --red-soft: #f8e8eb;
  --ink: #182027;
  --muted: #68727b;
  --line: #dde2e4;
  --surface: #fffdf9;
  --surface-2: #f4f2ed;
  --green: #27765e;
  --amber: #a15c16;
  --blue: #315a7d;
  --shadow: 0 18px 55px rgba(29, 25, 21, 0.09);
  --radius-lg: 26px;
  --radius-md: 17px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(circle at 92% 0%, rgba(200, 16, 46, 0.08), transparent 30rem),
    #f6f4ef;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(200, 16, 46, 0.2);
  outline-offset: 2px;
}

.app-shell { width: min(1240px, calc(100% - 32px)); margin: 0 auto; }
.topbar {
  min-height: 82px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid rgba(24, 32, 39, 0.1);
}
.brand { display: flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; }
.brand-mark {
  width: 40px; height: 40px; display: grid; place-items: center;
  color: white; background: var(--red); font-family: Georgia, serif;
  font-weight: 700; font-size: 23px; border-radius: 10px 10px 10px 3px;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 14px; letter-spacing: .02em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.privacy-pill {
  display: inline-flex; align-items: center; gap: 8px; margin-right: 4px;
  color: var(--muted); font-size: 12px; font-weight: 650;
}
.privacy-pill span { width: 7px; height: 7px; border-radius: 999px; background: var(--green); box-shadow: 0 0 0 4px rgba(39,118,94,.12); }

.button {
  min-height: 42px; border: 1px solid transparent; border-radius: 11px;
  padding: 0 16px; font-weight: 700; font-size: 13px;
  transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.button:hover { transform: translateY(-1px); }
.button-primary { color: white; background: var(--red); box-shadow: 0 8px 20px rgba(200,16,46,.18); }
.button-primary:hover { background: #aa0d27; }
.button-quiet { background: rgba(255,255,255,.62); border-color: var(--line); color: var(--ink); }
.button-dark { background: var(--ink); color: white; }
.text-button { border: 0; background: transparent; color: var(--red-dark); font-weight: 750; padding: 8px 3px; }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.danger { color: #a62231; }

.section { padding: 88px 0; }
.hero { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 42px 62px; }
.hero-copy { align-self: center; max-width: 740px; }
.eyebrow, .panel-kicker {
  margin: 0 0 12px; color: var(--red-dark); font-weight: 800;
  font-size: 11px; letter-spacing: .15em;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 18px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(48px, 7vw, 86px); font-weight: 500; letter-spacing: -.055em; line-height: .97; }
.hero-intro { max-width: 650px; color: #4f5a62; font-size: 18px; line-height: 1.65; }
.hero-actions { display: flex; align-items: center; gap: 18px; margin-top: 28px; }

.readiness-card {
  min-height: 242px; padding: 28px; border-radius: var(--radius-lg);
  background: var(--ink); color: white; display: grid; grid-template-columns: 132px 1fr;
  align-items: center; gap: 22px; box-shadow: var(--shadow);
}
.progress-ring {
  --progress: 0;
  width: 132px; aspect-ratio: 1; border-radius: 50%; display: grid; place-items: center;
  background: conic-gradient(#f04d63 calc(var(--progress) * 1%), rgba(255,255,255,.12) 0);
  position: relative;
}
.progress-ring::before { content: ""; position: absolute; inset: 9px; border-radius: inherit; background: var(--ink); }
.progress-ring div { position: relative; text-align: center; }
.progress-ring strong, .progress-ring span { display: block; }
.progress-ring strong { font-family: Georgia, serif; font-size: 31px; }
.progress-ring span { margin-top: 3px; color: rgba(255,255,255,.6); font-size: 10px; text-transform: uppercase; letter-spacing: .12em; }
.deadline-copy span, .deadline-copy small, .deadline-copy strong { display: block; }
.deadline-copy span { color: rgba(255,255,255,.55); text-transform: uppercase; letter-spacing: .12em; font-size: 10px; }
.deadline-copy strong { margin: 8px 0; font-size: 17px; line-height: 1.3; }
.deadline-copy small { color: #f1a6b2; line-height: 1.35; }

.metric-grid { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric-card { padding: 20px 22px; background: rgba(255,255,255,.7); border: 1px solid var(--line); border-radius: var(--radius-md); }
.metric-card span { display: block; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.metric-card strong { display: block; margin-top: 6px; font-family: Georgia, serif; font-size: 30px; font-weight: 500; }
.metric-card small { color: var(--muted); }

.research-compass {
  grid-column: 1 / -1;
  padding: 27px 30px;
  border-radius: var(--radius-lg);
  background:
    linear-gradient(115deg, rgba(200,16,46,.06), transparent 48%),
    var(--surface);
  border: 1px solid var(--line);
  box-shadow: 0 12px 34px rgba(29,25,21,.05);
}
.compass-heading { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.compass-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 30px; font-weight: 500; letter-spacing: -.025em; }
.compact-segmented { flex: 0 0 auto; }
.compact-segmented button { padding: 8px 13px; }
.central-research-label { display: block; margin-top: 23px; color: var(--red-dark); font-size: 10px; font-weight: 850; letter-spacing: .13em; }
.research-statement { max-width: 1040px; margin: 9px 0 20px; font-family: Georgia, serif; font-size: clamp(21px, 2.4vw, 29px); line-height: 1.42; letter-spacing: -.018em; white-space: pre-line; }
.branch-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 11px; }
.branch-card { padding: 16px; border: 1px solid #e1d6d7; border-radius: 16px; background: rgba(255,255,255,.75); }
.branch-card-heading { display: flex; align-items: center; gap: 9px; }
.branch-card-heading span { width: 26px; height: 26px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--red-soft); color: var(--red-dark); font-family: Georgia, serif; font-size: 13px; font-weight: 700; }
.branch-card-heading strong { color: #403239; font-size: 14px; line-height: 1.35; }
.branch-card p { margin: 12px 0 0; color: #5f686e; font-size: 14px; line-height: 1.55; }
.application-path { display: flex; align-items: center; gap: 16px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.application-path-label { flex: 0 0 auto; color: var(--muted); font-size: 9px; font-weight: 850; letter-spacing: .13em; }
.application-path > div { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.application-step { display: inline-flex; align-items: center; gap: 8px; color: #49535a; font-size: 11px; font-weight: 750; }
.application-step:not(:last-child)::after { content: "→"; color: #a9afb2; font-weight: 500; }
.application-step strong { color: var(--red-dark); font-weight: 850; }

.focus-strip { grid-column: 1 / -1; margin-top: 8px; }
.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 30px; }
.section-heading.compact { margin-bottom: 18px; }
.section-heading h2 { margin: 0; font-family: Georgia, serif; font-weight: 500; font-size: clamp(32px, 4vw, 48px); letter-spacing: -.035em; }
.section-heading.compact h2 { font-size: 30px; }
.section-heading > p { max-width: 470px; margin: 0; color: var(--muted); line-height: 1.6; font-size: 14px; }
.focus-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.focus-card {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius-md);
  padding: 18px; display: grid; grid-template-columns: 38px 1fr auto; gap: 13px; align-items: center;
}
.focus-number { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--red-soft); color: var(--red-dark); font-family: Georgia, serif; font-weight: 700; }
.focus-card strong, .focus-card small { display: block; }
.focus-card strong { margin-bottom: 4px; font-size: 13px; line-height: 1.3; }
.focus-card small { color: var(--muted); }
.focus-card button { border: 0; background: transparent; color: var(--muted); font-size: 20px; }

.workspace { border-top: 1px solid rgba(24,32,39,.11); }
.workspace-toolbar { display: grid; grid-template-columns: auto minmax(240px, 1fr) 190px 170px; gap: 10px; align-items: center; margin-bottom: 22px; }
.segmented { display: flex; padding: 4px; background: #e8e6e0; border-radius: 12px; }
.segmented button { border: 0; border-radius: 9px; padding: 10px 15px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 750; }
.segmented button.active { background: white; color: var(--ink); box-shadow: 0 3px 10px rgba(20,20,20,.07); }
.search-field, .select-field { min-height: 45px; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 11px; background: rgba(255,255,255,.72); }
.search-field { gap: 8px; padding: 0 13px; }
.search-field svg { width: 17px; fill: none; stroke: var(--muted); stroke-width: 1.7; }
.search-field input, .select-field select { width: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); font-size: 13px; }
.select-field select { padding: 0 12px; }
.study-list-header, .study-row { display: grid; grid-template-columns: minmax(0, 1.4fr) 160px minmax(210px, .8fr) 42px; gap: 20px; align-items: center; }
.study-list-header { padding: 0 22px 9px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.study-list { display: grid; gap: 8px; }
.study-row { min-height: 86px; padding: 15px 17px 15px 22px; border: 1px solid var(--line); background: var(--surface); border-radius: 15px; transition: border-color .18s, transform .18s; }
.study-row:hover { border-color: #c7cdd0; transform: translateY(-1px); }
.study-item-main { display: flex; min-width: 0; align-items: center; gap: 13px; }
.study-item-main > div { min-width: 0; }
.type-icon { flex: 0 0 auto; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: var(--red-dark); background: var(--red-soft); }
.type-icon.reading { color: var(--blue); background: #e7eef4; }
.type-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.study-item-main strong, .study-item-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.study-item-main strong { margin-bottom: 5px; font-size: 14px; }
.study-item-main small { color: var(--muted); font-size: 12px; }
.status-select { width: 138px; border: 1px solid var(--line); border-radius: 999px; padding: 8px 28px 8px 12px; color: var(--ink); background-color: white; font-size: 12px; font-weight: 700; }
.progress-cell { min-width: 0; }
.progress-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; color: var(--muted); font-size: 11px; }
.progress-bar { height: 6px; background: #e6e5df; border-radius: 999px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; border-radius: inherit; background: var(--red); }
.due-label { color: var(--muted); font-size: 12px; }
.row-actions { display: flex; justify-content: end; }
.row-actions button, .icon-button { width: 36px; height: 36px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--muted); font-size: 18px; }
.row-actions button:hover, .icon-button:hover { color: var(--ink); border-color: #bdc4c7; }
.empty-state { padding: 60px 20px; text-align: center; color: var(--muted); border: 1px dashed #c9cdcf; border-radius: 15px; }
.empty-state strong, .empty-state span { display: block; }
.empty-state strong { color: var(--ink); margin-bottom: 5px; }

.roadmap { border-top: 1px solid rgba(24,32,39,.11); }
.roadmap-grid { display: grid; grid-template-columns: 1.05fr .95fr; gap: 18px; }
.panel { border-radius: var(--radius-lg); background: var(--surface); border: 1px solid var(--line); padding: 27px; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
.panel-kicker { display: block; margin-bottom: 7px; }
.panel-heading h3 { margin: 0; font-family: Georgia, serif; font-size: 27px; font-weight: 500; }
.timeline { display: grid; }
.timeline-item { position: relative; display: grid; grid-template-columns: 72px 24px 1fr; gap: 14px; min-height: 83px; }
.timeline-item:not(:last-child)::after { content: ""; position: absolute; left: 83px; top: 31px; bottom: 0; width: 1px; background: var(--line); }
.timeline-date { padding-top: 4px; color: var(--muted); font-size: 11px; text-align: right; line-height: 1.4; }
.timeline-dot { width: 13px; height: 13px; margin-top: 5px; border: 3px solid var(--surface); border-radius: 50%; background: #adb4b7; box-shadow: 0 0 0 1px #adb4b7; z-index: 1; }
.timeline-item.complete .timeline-dot { background: var(--green); box-shadow: 0 0 0 1px var(--green); }
.timeline-item.in-progress .timeline-dot { background: var(--red); box-shadow: 0 0 0 1px var(--red); }
.timeline-copy { padding-bottom: 22px; }
.timeline-copy button { display: block; width: 100%; padding: 0; border: 0; background: transparent; text-align: left; color: inherit; }
.timeline-copy strong { display: block; margin-bottom: 4px; font-size: 13px; }
.timeline-copy small { display: block; color: var(--muted); line-height: 1.45; }
.timeline-status { display: inline-flex; margin-top: 8px; color: var(--red-dark); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }

.autosave-label { color: var(--green); font-size: 11px; font-weight: 700; }
.note-composer { padding: 13px; border: 1px solid var(--line); border-radius: 15px; background: #f8f7f3; }
.note-composer textarea { width: 100%; min-height: 88px; border: 0; resize: vertical; background: transparent; outline: 0; line-height: 1.55; color: var(--ink); }
.note-composer > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.note-composer select { border: 0; background: transparent; color: var(--muted); font-size: 12px; font-weight: 700; }
.note-composer .button { min-height: 36px; }
.note-list { display: grid; gap: 9px; margin-top: 15px; max-height: 376px; overflow: auto; padding-right: 2px; }
.note-card { position: relative; border: 1px solid var(--line); border-radius: 13px; padding: 15px 92px 15px 16px; background: white; }
.note-card p { margin: 8px 0 0; color: #48535a; font-size: 13px; line-height: 1.55; white-space: pre-wrap; }
.note-meta { display: flex; gap: 9px; align-items: center; color: var(--muted); font-size: 10px; }
.note-tag { color: var(--red-dark); background: var(--red-soft); padding: 4px 7px; border-radius: 999px; font-weight: 800; }
.note-actions { position: absolute; right: 9px; top: 9px; display: flex; align-items: center; gap: 2px; }
.note-actions button { min-width: 28px; height: 28px; padding: 0 7px; border: 0; border-radius: 8px; background: transparent; color: #7a8388; font-size: 11px; font-weight: 750; }
.note-actions button:last-child { padding: 0; font-size: 16px; }
.note-actions button:hover { background: #f1efea; color: var(--red-dark); }

footer { min-height: 100px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-top: 1px solid rgba(24,32,39,.11); color: var(--muted); font-size: 11px; }

.modal { width: min(610px, calc(100% - 30px)); border: 0; border-radius: 22px; padding: 0; background: var(--surface); box-shadow: 0 32px 100px rgba(0,0,0,.28); }
.small-modal { width: min(470px, calc(100% - 30px)); }
.page-modal { width: min(850px, calc(100% - 30px)); max-height: calc(100vh - 32px); }
.modal::backdrop { background: rgba(13,18,22,.56); backdrop-filter: blur(4px); }
.modal form { padding: 27px; }
.page-modal form { max-height: calc(100vh - 32px); overflow-y: auto; }
.modal-heading { display: flex; justify-content: space-between; align-items: start; margin-bottom: 24px; }
.modal-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 34px; font-weight: 500; }
.close-button { font-size: 24px; line-height: 1; }
.form-field { display: grid; gap: 7px; margin-bottom: 15px; }
.form-field > span { color: #48535a; font-size: 11px; font-weight: 800; letter-spacing: .04em; }
.form-field input, .form-field select, .form-field textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; color: var(--ink); background: white; }
.form-field textarea { resize: vertical; line-height: 1.5; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.page-form-section { padding: 19px 0 5px; border-top: 1px solid var(--line); }
.page-form-section h3 { margin: 0 0 16px; font-size: 14px; }
.branch-edit-card { margin: 14px 0; padding: 16px 16px 1px; border: 1px solid var(--line); border-radius: 14px; background: #faf8f6; }
.branch-edit-card h4 { margin: 0 0 14px; color: var(--red-dark); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.modal-actions { display: grid; grid-template-columns: auto 1fr auto auto; gap: 9px; align-items: center; margin-top: 24px; }
.page-modal-actions { position: sticky; bottom: -27px; margin-inline: -27px; padding: 15px 27px 27px; background: linear-gradient(transparent, var(--surface) 18%); }
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 20; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 11px 16px; border-radius: 999px; background: var(--ink); color: white; box-shadow: var(--shadow); font-size: 12px; font-weight: 700; transition: .22s ease; }
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 930px) {
  .hero { grid-template-columns: 1fr; }
  .readiness-card { grid-template-columns: 132px 1fr; min-height: auto; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .focus-list { grid-template-columns: 1fr; }
  .workspace-toolbar { grid-template-columns: 1fr 1fr; }
  .segmented, .search-field { grid-column: span 2; }
  .study-list-header { display: none; }
  .study-row { grid-template-columns: minmax(0, 1fr) 42px; gap: 12px; }
  .study-row .status-cell, .study-row .progress-cell { grid-column: 1 / -1; }
  .row-actions { grid-column: 2; grid-row: 1; }
  .roadmap-grid { grid-template-columns: 1fr; }
  .branch-list { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .app-shell { width: min(100% - 22px, 1240px); }
  .topbar { align-items: flex-start; padding: 15px 0; }
  .brand small, .privacy-pill, #exportButton { display: none; }
  .button { padding-inline: 13px; }
  .section { padding: 62px 0; }
  h1 { font-size: 52px; }
  .hero { gap: 28px; }
  .readiness-card { grid-template-columns: 108px 1fr; padding: 22px; }
  .progress-ring { width: 108px; }
  .progress-ring strong { font-size: 26px; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { padding: 16px; }
  .section-heading { display: block; }
  .section-heading > p { margin-top: 12px; }
  .workspace-toolbar { grid-template-columns: 1fr; }
  .segmented, .search-field { grid-column: auto; }
  .segmented button { flex: 1; }
  .study-row { padding: 15px; }
  .roadmap-grid { margin-inline: -3px; }
  .research-compass { padding: 22px 18px; }
  .compass-heading { display: block; }
  .compact-segmented { margin-top: 18px; }
  .research-statement { font-size: 22px; }
  .application-path { align-items: flex-start; flex-direction: column; gap: 10px; }
  .panel { padding: 21px 17px; }
  .timeline-item { grid-template-columns: 60px 20px 1fr; gap: 10px; }
  .timeline-item:not(:last-child)::after { left: 69px; }
  .form-grid { grid-template-columns: 1fr; gap: 0; }
  .modal-actions { grid-template-columns: 1fr 1fr; }
  .modal-actions .danger { grid-column: 1 / -1; justify-self: start; }
  .page-modal-actions > span, .note-modal-actions > span { display: none; }
  .note-modal-actions { display: flex; flex-wrap: wrap; }
  .note-modal-actions .danger { margin-right: auto; }
  footer { align-items: flex-start; flex-direction: column; justify-content: center; }
}
