:root {
    --canvas: #f3f2ed;
    --surface: #fffefa;
    --ink: #262725;
    --muted: #6f716c;
    --line: #e5e3dc;
    --purple: #6858d9;
    --purple-dark: #5143bd;
    --lilac: #e2ddff;
    --mint: #dff3e7;
    --peach: #f8ded3;
    --yellow: #f6e6a8;
    --blue: #dce9ff;
    --danger: #b34141;
    --shadow: 0 20px 60px rgba(38, 39, 37, .08);
    --radius-xl: 30px;
    --radius-lg: 24px;
    --radius-md: 16px;
    --month-width: 68px;
    --label-width: 244px;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    color: var(--ink);
    background: var(--canvas);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    font-size: 19px;
    -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { color: inherit; font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

.app-page { min-height: 100vh; }

.side-nav {
    position: fixed;
    inset: 16px auto 16px 16px;
    z-index: 20;
    display: flex;
    width: 216px;
    flex-direction: column;
    padding: 22px 16px 18px;
    border: 1px solid rgba(255, 255, 255, .72);
    border-radius: var(--radius-xl);
    background: rgba(255, 254, 250, .9);
    box-shadow: var(--shadow);
    backdrop-filter: blur(18px);
}

.brand-block, .signed-user, .nav-item, .panel-heading, .detail-heading,
.dialog-progress > div:first-child { display: flex; align-items: center; }

.brand-block { gap: 12px; padding: 2px 6px 24px; }
.brand-mark, .login-mark {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    flex: 0 0 auto;
    border-radius: 16px;
    color: #fff;
    background: var(--purple);
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -.04em;
}
.brand-copy { font-size: 17px; font-weight: 760; line-height: 1.2; }
.profile-tabs { display: grid; gap: 8px; }
.nav-item {
    gap: 11px;
    min-height: 46px;
    padding: 8px 10px;
    border-radius: 15px;
    color: var(--muted);
    text-decoration: none;
    font-size: 17px;
    font-weight: 700;
}
.nav-item:hover { background: #f4f1ff; color: var(--ink); }
.nav-item.is-active { color: var(--purple-dark); background: var(--lilac); }
.nav-icon {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 10px;
    background: rgba(255,255,255,.7);
    font-size: 14px;
}
.nav-footer { margin-top: auto; padding: 18px 4px 2px; border-top: 1px solid var(--line); }
.signed-user { gap: 10px; margin-bottom: 12px; }
.signed-user > span {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--mint);
    font-size: 16px;
    font-weight: 800;
}
.signed-user div { display: grid; min-width: 0; }
.signed-user strong { overflow: hidden; font-size: 16px; text-overflow: ellipsis; white-space: nowrap; }
.signed-user small { color: var(--muted); font-size: 13px; }

.quiet-button {
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 12px;
    color: var(--muted);
    background: transparent;
    font-size: 14px;
    font-weight: 700;
    text-align: left;
}
.quiet-button:hover { color: var(--danger); background: #fff1ef; }

.app-shell { max-width: 1660px; margin-left: 248px; padding: 42px 32px 72px; }
.page-heading { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; margin-bottom: 28px; }
.eyebrow {
    margin: 0 0 9px;
    color: var(--purple-dark);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(38px, 5vw, 62px); line-height: 1; letter-spacing: -.055em; }
.heading-copy { max-width: 650px; margin-bottom: 0; color: var(--muted); font-size: 18px; line-height: 1.55; }
.phase-pill {
    display: grid;
    min-width: 210px;
    gap: 4px;
    padding: 14px 18px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: var(--surface);
}
.phase-pill span { color: var(--muted); font-size: 13px; font-weight: 650; }
.phase-pill strong { font-size: 17px; }

.metric-bento { display: grid; grid-template-columns: 1.15fr 1fr 1fr 1fr; gap: 14px; margin-bottom: 18px; }
.metric-card { min-height: 166px; padding: 20px; border-radius: var(--radius-lg); overflow: hidden; }
.metric-card > span { display: block; margin-bottom: 18px; color: rgba(38,39,37,.68); font-size: 14px; font-weight: 750; }
.metric-card > strong { display: block; font-size: 46px; line-height: 1; letter-spacing: -.05em; }
.metric-card > strong small { font-size: 24px; }
.metric-card > .metric-title { max-width: 250px; font-size: 24px; line-height: 1.15; letter-spacing: -.025em; }
.metric-card p { margin: 15px 0 0; color: rgba(38,39,37,.7); font-size: 14px; line-height: 1.45; }
.metric-card--lilac { background: var(--lilac); }
.metric-card--mint { background: var(--mint); }
.metric-card--peach { background: var(--peach); }
.metric-card--yellow { background: var(--yellow); }
.metric-progress { height: 6px; margin-top: 14px; overflow: hidden; border-radius: 10px; background: rgba(255,255,255,.75); }
.metric-progress span { display: block; height: 100%; border-radius: inherit; background: var(--purple); }

.roadmap-panel { padding: 26px; border: 1px solid rgba(255,255,255,.8); border-radius: var(--radius-xl); background: var(--surface); box-shadow: var(--shadow); }
.panel-heading { justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.panel-heading h2 { margin: 0; font-size: 30px; letter-spacing: -.035em; }
.panel-heading > p { margin: 0; color: var(--muted); font-size: 14px; }
.filter-row { display: flex; gap: 8px; padding-bottom: 17px; overflow-x: auto; scrollbar-width: none; }
.filter-row::-webkit-scrollbar { display: none; }
.filter-chip {
    flex: 0 0 auto;
    min-height: 36px;
    padding: 7px 13px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    background: #fff;
    font-size: 14px;
    font-weight: 720;
}
.filter-chip:hover, .filter-chip.is-active { color: var(--ink); border-color: transparent; background: var(--lilac); }
.filter-chip--academic.is-active { background: var(--blue); }
.filter-chip--language.is-active { background: var(--lilac); }
.filter-chip--career.is-active { background: var(--mint); }
.filter-chip--scholarship.is-active { background: var(--yellow); }
.filter-chip--documents.is-active { background: var(--peach); }

.gantt-scroll { width: 100%; overflow: auto; border: 1px solid var(--line); border-radius: 19px; background: #fff; scrollbar-color: #cbc7bd transparent; scrollbar-width: thin; }
.gantt-board { min-width: calc(var(--label-width) + var(--month-count) * var(--month-width)); }
.gantt-grid { display: grid; grid-template-columns: var(--label-width) repeat(var(--month-count), var(--month-width)); }
.gantt-years { position: sticky; top: 0; z-index: 8; min-height: 39px; border-bottom: 1px solid var(--line); background: #fbfaf6; }
.gantt-months { position: sticky; top: 39px; z-index: 7; min-height: 48px; border-bottom: 1px solid var(--line); background: #fff; }
.gantt-corner {
    position: sticky;
    left: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    padding: 0 17px;
    border-right: 1px solid var(--line);
    background: #fbfaf6;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .08em;
    text-transform: uppercase;
}
.gantt-corner--sub { background: #fff; }
.year-band { display: grid; place-items: center; border-right: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 750; }
.month-cell { display: grid; place-items: center; border-right: 1px solid #efeee9; font-size: 12px; font-weight: 750; }
.month-cell small { color: #aaa9a4; font-size: 10px; font-weight: 650; }
.gantt-row { position: relative; min-height: 64px; border-bottom: 1px solid #efeee9; }
.gantt-row:last-child { border-bottom: 0; }
.gantt-row[hidden] { display: none; }
.task-label {
    position: sticky;
    left: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 0;
    padding: 9px 14px;
    border-right: 1px solid var(--line);
    background: #fff;
}
.task-label div { display: grid; min-width: 0; gap: 3px; }
.task-label strong { overflow: hidden; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.task-label small { color: var(--muted); font-size: 11px; }
.category-mark { display: grid; place-items: center; width: 27px; height: 27px; flex: 0 0 auto; border-radius: 9px; font-size: 12px; font-weight: 850; }
.category-mark--academic { background: var(--blue); }
.category-mark--language { background: var(--lilac); }
.category-mark--career { background: var(--mint); }
.category-mark--scholarship { background: var(--yellow); }
.category-mark--documents { background: var(--peach); }
.grid-line { grid-row: 1; border-right: 1px solid #f1f0eb; pointer-events: none; }
.task-bar {
    position: relative;
    z-index: 2;
    align-self: center;
    grid-row: 1;
    height: 34px;
    margin: 0 5px;
    overflow: visible;
    border: 0;
    border-radius: 11px;
    box-shadow: inset 0 0 0 1px rgba(38,39,37,.04);
    text-align: left;
}
.task-bar:hover { filter: saturate(1.08); transform: translateY(-1px); box-shadow: 0 5px 15px rgba(38,39,37,.12); }
.task-bar--academic { background: var(--blue); }
.task-bar--language { background: var(--lilac); }
.task-bar--career { background: var(--mint); }
.task-bar--scholarship { background: var(--yellow); }
.task-bar--documents { background: var(--peach); }
.task-bar__progress { position: absolute; inset: 0 auto 0 0; max-width: 100%; border-radius: inherit; background: rgba(104,88,217,.16); }
.task-bar__label { position: relative; display: block; overflow: hidden; padding: 0 11px; font-size: 12px; font-weight: 750; line-height: 34px; text-overflow: ellipsis; white-space: nowrap; }
.milestone-dot { position: absolute; top: 50%; right: -5px; width: 10px; height: 10px; border: 2px solid #fff; border-radius: 3px; background: var(--purple); transform: translateY(-50%) rotate(45deg); }
.legend { display: flex; gap: 20px; margin-top: 14px; color: var(--muted); font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { display: inline-block; width: 12px; height: 8px; border-radius: 3px; }
.legend-progress { background: rgba(104,88,217,.25); }
.legend-milestone { width: 8px !important; height: 8px !important; background: var(--purple); transform: rotate(45deg); }

.task-dialog { width: min(760px, calc(100vw - 30px)); max-height: calc(100dvh - 32px); padding: 0; overflow: hidden; border: 0; border-radius: 28px; background: var(--surface); box-shadow: 0 30px 100px rgba(25,25,24,.28); }
.task-dialog::backdrop { background: rgba(31,31,30,.42); backdrop-filter: blur(5px); }
.dialog-shell { max-height: calc(100dvh - 32px); padding: 26px; overflow-y: auto; }
.dialog-header { display: flex; justify-content: space-between; gap: 20px; }
.dialog-header h2 { margin: 8px 0 6px; font-size: 34px; line-height: 1.1; letter-spacing: -.04em; }
.dialog-header p { margin: 0; color: var(--muted); font-size: 14px; }
.detail-category { display: inline-flex; padding: 5px 9px; border-radius: 999px; background: var(--lilac); color: var(--purple-dark); font-size: 12px; font-weight: 800; }
.dialog-close { width: 40px; height: 40px; flex: 0 0 auto; border: 0; border-radius: 50%; background: #f0efea; font-size: 28px; line-height: 1; }
.dialog-close:hover { background: var(--peach); }
.dialog-progress { margin: 22px 0; padding: 15px 17px; border-radius: 17px; background: #f6f4ff; }
.dialog-progress > div:first-child { justify-content: space-between; margin-bottom: 9px; font-size: 13px; }
.progress-track { height: 7px; overflow: hidden; border-radius: 10px; background: #fff; }
.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--purple); transition: width .2s ease; }
.task-form, .login-form { display: grid; gap: 14px; }
.task-form label, .login-form label { display: grid; gap: 7px; }
.task-form label > span, .login-form label > span { color: var(--muted); font-size: 12px; font-weight: 780; letter-spacing: .04em; text-transform: uppercase; }
input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 13px;
    outline: 0;
    background: #fff;
    font-size: 16px;
}
input, select { min-height: 44px; padding: 0 12px; }
textarea { padding: 11px 12px; resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus { border-color: var(--purple); box-shadow: 0 0 0 3px rgba(104,88,217,.11); }
input[readonly], textarea[readonly], input:disabled, textarea:disabled, select:disabled { color: var(--ink); opacity: 1; background: #f8f7f3; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid--three { grid-template-columns: 1fr 1fr 1.2fr; }
.primary-button, .secondary-button {
    min-height: 44px;
    padding: 10px 16px;
    border: 0;
    border-radius: 13px;
    font-size: 14px;
    font-weight: 800;
}
.primary-button { color: #fff; background: var(--purple); }
.primary-button:hover { background: var(--purple-dark); }
.secondary-button { background: var(--lilac); color: var(--purple-dark); }
.primary-button:disabled, .secondary-button:disabled { cursor: wait; opacity: .55; }
.save-task { justify-self: end; }
.detail-section { margin-top: 22px; padding-top: 21px; border-top: 1px solid var(--line); }
.detail-section h3 { margin: 0; font-size: 18px; }
.detail-heading { justify-content: space-between; margin-bottom: 12px; }
.detail-heading span { color: var(--muted); font-size: 13px; }
.checklist { display: grid; gap: 8px; }
.check-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 13px; background: #f7f6f1; font-size: 14px; line-height: 1.45; }
.check-item input { width: 18px; min-height: 18px; height: 18px; margin: 0; accent-color: var(--purple); }
.check-item.is-done span { color: var(--muted); text-decoration: line-through; }
.source-section a { display: inline-block; margin-top: 10px; color: var(--purple-dark); font-size: 14px; font-weight: 700; }
.note-form { display: flex; align-items: flex-end; gap: 9px; }
.note-form textarea { min-height: 64px; }
.note-form button { flex: 0 0 auto; }
.notes-list { display: grid; gap: 9px; margin-top: 12px; }
.note-card { padding: 12px 14px; border-radius: 14px; background: #f7f6f1; }
.note-card p { margin: 0 0 7px; font-size: 14px; line-height: 1.5; white-space: pre-wrap; }
.note-card small { color: var(--muted); font-size: 11px; }
.empty-state { padding: 14px; border: 1px dashed var(--line); border-radius: 13px; color: var(--muted); font-size: 13px; text-align: center; }
.toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 100;
    max-width: 360px;
    padding: 12px 16px;
    border-radius: 13px;
    color: #fff;
    background: var(--ink);
    box-shadow: var(--shadow);
    font-size: 14px;
    font-weight: 700;
}
.toast.is-error { background: var(--danger); }

.login-page { display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 20% 10%, var(--lilac), transparent 32%), radial-gradient(circle at 85% 85%, var(--mint), transparent 28%), var(--canvas); }
.login-shell { width: min(430px, 100%); padding: 38px; border: 1px solid rgba(255,255,255,.85); border-radius: var(--radius-xl); background: rgba(255,254,250,.94); box-shadow: var(--shadow); }
.login-mark { margin-bottom: 26px; }
.login-shell h1 { margin-bottom: 12px; font-size: 46px; }
.login-intro { margin-bottom: 25px; color: var(--muted); font-size: 16px; line-height: 1.55; }
.login-form .primary-button { margin-top: 4px; }
.form-error { padding: 10px 12px; border-radius: 12px; color: #8e2f2f; background: #ffe6e2; font-size: 14px; }

@media (max-width: 1180px) {
    .metric-bento { grid-template-columns: 1fr 1fr; }
    .metric-card { min-height: 145px; }
}

@media (max-width: 820px) {
    body { padding-bottom: 82px; }
    .side-nav {
        inset: auto 12px 12px;
        width: auto;
        min-height: 62px;
        flex-direction: row;
        align-items: center;
        justify-content: center;
        padding: 8px;
        border-radius: 22px;
    }
    .brand-block, .nav-footer { display: none; }
    .profile-tabs { display: flex; width: 100%; gap: 7px; }
    .nav-item { flex: 1; justify-content: center; min-height: 46px; }
    .app-shell { margin-left: 0; padding: 28px 18px 36px; }
    .page-heading { align-items: flex-start; }
    .phase-pill { min-width: 185px; }
    .roadmap-panel { padding: 20px 16px; border-radius: 24px; }
}

@media (max-width: 620px) {
    :root { --label-width: 184px; --month-width: 58px; }
    .app-shell { padding-inline: 13px; }
    .page-heading { display: grid; margin-bottom: 20px; }
    h1 { font-size: 43px; }
    .phase-pill { width: 100%; min-width: 0; }
    .metric-bento { grid-template-columns: 1fr 1fr; gap: 9px; }
    .metric-card { min-height: 142px; padding: 16px; border-radius: 20px; }
    .metric-card > span { margin-bottom: 14px; }
    .metric-card > strong { font-size: 35px; }
    .metric-card > .metric-title { font-size: 19px; }
    .metric-card p { margin-top: 11px; font-size: 12px; }
    .panel-heading { display: block; }
    .panel-heading > p { margin-top: 7px; }
    .gantt-row { min-height: 60px; }
    .task-label { padding-inline: 10px; }
    .task-label strong { font-size: 12px; }
    .task-bar__label { font-size: 11px; }
    .legend { flex-wrap: wrap; }
    .dialog-shell { padding: 20px 17px; }
    .dialog-header h2 { font-size: 28px; }
    .form-grid, .form-grid--three { grid-template-columns: 1fr; }
    .note-form { align-items: stretch; flex-direction: column; }
    .note-form button, .save-task { width: 100%; justify-self: stretch; }
    .login-shell { padding: 28px 22px; }
}

@media (prefers-reduced-motion: no-preference) {
    .task-bar, .filter-chip, .primary-button, .dialog-close { transition: .18s ease; }
    .task-dialog[open] { animation: dialog-in .2s ease-out; }
    @keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }
}
