/* Protocol — Dark Theme CSS */

:root {
    --bg: #080E1A;
    --surface: #111827;
    --surface-2: #172034;
    --line: #1E2A3D;
    --text: #F0F4FF;
    --text-2: #8896B3;
    --muted: #4A5A78;
    --accent: #2DD4A0;
    --warning: #F59E3F;
    --danger: #E05555;
    --info: #4D8EFF;
}

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.6;
    min-height: 100vh;
}

a {
    color: var(--accent);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

.container {
    max-width: 1120px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 0;
}

.logo {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.5px;
}

.logo:hover {
    text-decoration: none;
}

.header nav {
    display: flex;
    gap: 12px;
    align-items: center;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 15px;
    font-weight: 500;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s, background 0.15s;
    text-decoration: none;
}

.btn:hover {
    opacity: 0.85;
    text-decoration: none;
}

.btn-primary {
    background: var(--accent);
    color: #000;
}

.btn-ghost {
    background: transparent;
    color: var(--text);
    border: 1px solid var(--line);
}

.btn-lg {
    padding: 14px 28px;
    font-size: 16px;
}

/* Cards */
.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 24px;
}

.card-hero {
    background: linear-gradient(135deg, var(--surface), var(--surface-2));
    border-radius: 24px;
    padding: 32px;
}

/* Forms */
.input {
    width: 100%;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 16px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.15s;
}

.input:focus {
    border-color: var(--accent);
}

.input::placeholder {
    color: var(--muted);
}

.label {
    display: block;
    color: var(--text-2);
    font-size: 13px;
    margin-bottom: 8px;
    font-weight: 500;
}

/* Alerts */
.alert {
    border-radius: 12px;
    padding: 12px 16px;
    margin-bottom: 16px;
    font-size: 14px;
}

.alert p + p {
    margin-top: 4px;
}

.alert-danger {
    background: rgba(224, 85, 85, 0.12);
    border: 1px solid rgba(224, 85, 85, 0.3);
    color: var(--danger);
}

/* Hero */
.hero {
    padding: 80px 0 64px;
    text-align: center;
}

.hero-title {
    font-size: 56px;
    font-weight: 800;
    letter-spacing: -1.5px;
    margin-bottom: 16px;
}

.hero-subtitle {
    font-size: 18px;
    color: var(--text-2);
    max-width: 480px;
    margin: 0 auto 32px;
}

.hero-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    flex-wrap: wrap;
}

/* Stack */
.stack > * + * {
    margin-top: 16px;
}

.stack-lg > * + * {
    margin-top: 32px;
}

/* Footer */
.footer {
    padding: 32px 0;
    color: var(--muted);
    text-align: center;
    font-size: 13px;
    margin-top: 64px;
}

/* ========================================
   Onboarding
   ======================================== */

.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;
}

.onboarding-wrap {
    max-width: 560px;
    margin: 0 auto;
    padding: 32px 24px;
}

.onboard-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
}

.onboard-subtitle {
    font-size: 16px;
    color: var(--text-2);
    margin-bottom: 32px;
}

.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 32px;
}

.progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 0.4s ease;
}

.step {
    display: none;
}

.step.active {
    display: block;
}

/* Choice cards */
.choice-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.choice-card {
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: 20px;
    padding: 24px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s, background 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.choice-card:hover {
    border-color: var(--text-2);
    transform: translateY(-2px);
}

.choice-card.selected {
    border-color: var(--accent);
    background: var(--surface-2);
}

.choice-card .emoji {
    font-size: 40px;
    margin-bottom: 12px;
    display: block;
}

.choice-card .title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 4px;
}

.choice-card .desc {
    font-size: 13px;
    color: var(--text-2);
}

/* Goal grid */
.goal-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.goal-card {
    padding: 20px;
}

/* Field groups */
.field-group {
    margin-bottom: 20px;
}

.field-hint {
    display: block;
    font-size: 12px;
    color: var(--muted);
    margin-top: 6px;
}

.field-note {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px 16px;
    font-size: 13px;
    color: var(--text-2);
    line-height: 1.5;
    margin-bottom: 20px;
}

/* Buttons */
.btn-row {
    display: flex;
    justify-content: space-between;
    margin-top: 32px;
}

.btn-back {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--text-2);
    padding: 12px 24px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 15px;
    font-family: inherit;
    transition: border-color 0.15s;
}

.btn-back:hover {
    border-color: var(--text-2);
}

.btn-next {
    background: var(--accent);
    color: #000;
    padding: 12px 32px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 15px;
    font-family: inherit;
    cursor: pointer;
    border: none;
    transition: opacity 0.15s;
}

.btn-next:hover {
    opacity: 0.85;
}

.btn-next:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Ready screen */
.ready-wrap {
    max-width: 480px;
    margin: 0 auto;
    padding: 48px 24px;
    text-align: center;
}

.ready-icon {
    font-size: 64px;
    margin-bottom: 24px;
}

.ready-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.ready-subtitle {
    font-size: 16px;
    color: var(--text-2);
    margin-bottom: 32px;
}

.ready-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 24px;
    text-align: left;
    margin-bottom: 32px;
}

.ready-card .label {
    font-size: 13px;
    color: var(--text-2);
    margin-bottom: 4px;
}

.ready-card .value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
}

.ready-card .value.accent {
    color: var(--accent);
    font-size: 22px;
}

.ready-card .value.small {
    font-size: 15px;
    font-weight: 500;
}

.ready-row {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
}

.ready-row:last-child {
    margin-bottom: 0;
}

.ready-col {
    flex: 1;
}

.ready-divider {
    height: 1px;
    background: var(--line);
    margin: 16px 0;
}

.ready-motto {
    font-size: 14px;
    color: var(--muted);
    margin-top: 24px;
    font-style: italic;
    line-height: 1.6;
}

/* ========================================
   Profile Page
   ======================================== */

.profile-wrap {
    max-width: 600px;
    margin: 0 auto;
    padding: 32px 24px;
}

.back-link {
    display: inline-block;
    font-size: 14px;
    color: var(--text-2);
    margin-bottom: 24px;
}

.back-link:hover {
    color: var(--text);
    text-decoration: none;
}

.page-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 24px;
}

.profile-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.profile-item {
    background: var(--surface-2);
    border-radius: 12px;
    padding: 14px 16px;
}

.profile-label {
    font-size: 12px;
    color: var(--text-2);
    margin-bottom: 4px;
}

.profile-value {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.profile-value.accent {
    color: var(--accent);
}

.profile-form .form-row {
    margin-bottom: 20px;
}

.profile-form .two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.profile-form .form-group {
    display: flex;
    flex-direction: column;
}

.choice-card.small {
    padding: 14px;
}

.choice-card.small .emoji {
    font-size: 28px;
    margin-bottom: 6px;
}

.choice-card.small .title {
    font-size: 14px;
}

.choice-grid.compact {
    gap: 10px;
}

.alert-success {
    background: rgba(45, 212, 160, 0.12);
    border: 1px solid rgba(45, 212, 160, 0.3);
    color: var(--accent);
}

/* ========================================
   Dashboard — Today Screen
   ======================================== */

.today-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 24px;
}

.hero-card {
    background: linear-gradient(135deg, var(--surface), var(--surface-2));
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 32px;
    position: relative;
    overflow: hidden;
}

.hero-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: var(--phase-color, var(--accent));
}

.hero-emoji {
    font-size: 56px;
    margin-bottom: 16px;
    display: block;
}

.hero-day {
    font-size: 14px;
    color: var(--text-2);
    margin-bottom: 4px;
}

.hero-phase {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 20px;
}

.hero-title {
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 16px;
}

.hero-dots {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 16px;
}

.hero-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--line);
    transition: background 0.2s;
}

.hero-dot.filled {
    background: var(--phase-color, var(--accent));
    border-color: var(--phase-color, var(--accent));
}

.hero-dots-count {
    font-size: 13px;
    color: var(--text-2);
    margin-left: 8px;
}

.hero-progress-bar {
    width: 100%;
    height: 6px;
    background: var(--surface-2);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 20px;
}

.hero-progress-fill {
    height: 100%;
    background: var(--phase-color, var(--accent));
    border-radius: 3px;
    transition: width 0.4s ease;
}

.hero-progress-text {
    font-size: 13px;
    color: var(--text-2);
    margin-top: 8px;
    text-align: right;
}

.section-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin: 32px 0 12px;
}

.focus-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 24px;
}

.focus-text {
    font-size: 16px;
    color: var(--text);
    margin-bottom: 16px;
    line-height: 1.5;
}

.link-why {
    color: var(--phase-color, var(--accent));
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    border: none;
    background: transparent;
    padding: 0;
    font-family: inherit;
}

.task-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-bottom: 8px;
}

.task-card:hover {
    border-color: var(--text-2);
}

.task-card.done {
    background: var(--surface-2);
    opacity: 0.7;
}

.task-card.done .task-title {
    text-decoration: line-through;
    color: var(--text-2);
}

.task-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--text-2);
    border-radius: 50%;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    background: transparent;
}

.task-card:hover .task-checkbox {
    border-color: var(--phase-color, var(--accent));
}

.task-card.done .task-checkbox {
    background: var(--phase-color, var(--accent));
    border-color: var(--phase-color, var(--accent));
}

.task-checkbox svg {
    width: 14px;
    height: 14px;
    stroke: #fff;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.task-card.done .task-checkbox svg {
    opacity: 1;
}

.task-icon {
    font-size: 24px;
    flex-shrink: 0;
}

.task-title {
    font-size: 15px;
    color: var(--text);
    flex: 1;
}

.metrics-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 24px;
}

.metric-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
}

.metric-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.metric-value.accent {
    color: var(--phase-color, var(--accent));
    font-size: 18px;
}

.metric-label {
    font-size: 12px;
    color: var(--text-2);
}

.close-day-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 24px;
    margin-top: 32px;
}

.rating-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.rating-label {
    font-size: 14px;
    color: var(--text-2);
}

.rating-stars {
    display: flex;
    gap: 4px;
}

.rating-star {
    width: 32px;
    height: 32px;
    border: 2px solid var(--line);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s;
    background: transparent;
}

.rating-star:hover {
    border-color: var(--text-2);
}

.rating-star.active {
    background: var(--phase-color, var(--accent));
    border-color: var(--phase-color, var(--accent));
}

.hours-input {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 10px 16px;
    color: var(--text);
    width: 100%;
    margin-top: 8px;
    font-family: inherit;
    font-size: 15px;
}

.hours-input:focus {
    border-color: var(--accent);
    outline: none;
}

.btn-close-day {
    background: var(--phase-color, var(--accent));
    color: #000;
    border: none;
    border-radius: 12px;
    padding: 14px;
    width: 100%;
    font-weight: 600;
    font-size: 15px;
    cursor: pointer;
    margin-top: 20px;
    font-family: inherit;
}

.btn-close-day:hover {
    opacity: 0.9;
}

.day-closed-badge {
    background: var(--surface-2);
    color: var(--phase-color, var(--accent));
    padding: 12px 20px;
    border-radius: 12px;
    text-align: center;
    font-weight: 600;
    margin-top: 20px;
}

/* Bottom sheet */
.sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.sheet-overlay.open {
    opacity: 1;
    pointer-events: auto;
}

.sheet {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--surface);
    border-top: 1px solid var(--line);
    border-radius: 24px 24px 0 0;
    padding: 24px;
    padding-bottom: 40px;
    z-index: 101;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    max-height: 80vh;
    overflow-y: auto;
}

.sheet.open {
    transform: translateY(0);
}

.sheet-handle {
    width: 40px;
    height: 4px;
    background: var(--muted);
    border-radius: 2px;
    margin: 0 auto 20px;
}

.sheet-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
}

.sheet-body {
    font-size: 15px;
    color: var(--text-2);
    line-height: 1.6;
}

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

    .profile-form .two-col {
        grid-template-columns: 1fr;
    }

    .profile-wrap {
        padding: 24px 16px;
    }

    .today-wrap { padding: 16px; }
    .hero-card { padding: 24px; }
    .hero-title { font-size: 22px; }
    .hero-emoji { font-size: 44px; }
    .metrics-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .metric-value { font-size: 20px; }
    .metric-value.accent { font-size: 16px; }
}

/* Responsive */
@media (max-width: 640px) {
    .container {
        padding: 0 16px;
    }

    .hero {
        padding: 48px 0 40px;
    }

    .hero-title {
        font-size: 36px;
    }

    .hero-subtitle {
        font-size: 16px;
    }

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

    .btn-lg {
        width: 100%;
    }

    .header nav {
        gap: 8px;
    }

    .btn {
        padding: 8px 14px;
        font-size: 14px;
    }

    /* Onboarding responsive */
    .choice-grid,
    .goal-grid {
        grid-template-columns: 1fr;
    }

    .ready-wrap {
        padding: 32px 16px;
    }

    .onboarding-wrap {
        padding: 24px 16px;
    }

    .onboard-title {
        font-size: 24px;
    }
}

/* === BLOCK 4: PROTOCOL === */

.protocol-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.protocol-header {
    text-align: center;
    margin-bottom: 32px;
}

.protocol-title {
    font-size: 32px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 8px;
}

.protocol-subtitle {
    color: var(--text-2);
    font-size: 16px;
    margin: 0;
}

.protocol-progress {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px 20px;
    margin-bottom: 40px;
}

.protocol-progress-text {
    font-size: 14px;
    color: var(--text-2);
    margin-bottom: 10px;
}

.protocol-progress-bar {
    height: 6px;
    background: var(--line);
    border-radius: 3px;
    overflow: hidden;
}

.protocol-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.phase-section {
    margin-bottom: 40px;
}

.phase-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--line);
}

.phase-num {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 1px;
    color: var(--phase-color);
}

.phase-name {
    font-size: 14px;
    color: var(--text-2);
}

.phase-1 { --phase-color: #2DD4A0; }
.phase-2 { --phase-color: #4D8EFF; }
.phase-3 { --phase-color: #F59E3F; }

.weeks-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.week-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.week-card:hover {
    border-color: var(--phase-color);
}

.week-card.is-done {
    opacity: 0.6;
}

.week-card.is-current {
    border: 1px solid var(--phase-color);
    box-shadow: 0 0 20px rgba(45, 212, 160, 0.1);
}

.week-card.is-future {
    opacity: 0.5;
}

.week-card__status {
    position: absolute;
    top: 12px;
    right: 12px;
}

.status-icon {
    font-size: 14px;
}

.status-done {
    color: var(--phase-color);
}

.status-current {
    color: var(--phase-color);
    font-size: 18px;
    animation: pulse 2s infinite;
}

.status-future {
    color: var(--muted);
}

.week-card__emoji {
    font-size: 36px;
    margin-bottom: 8px;
}

.week-card__num {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 4px;
}

.week-card__title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

/* === UNIFIED BOTTOM SHEET === */

.sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(8, 14, 26, 0.72);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 200ms ease, visibility 200ms ease;
    z-index: 90;
}
.sheet-backdrop.is-open {
    opacity: 1;
    visibility: visible;
}

.sheet {
    position: fixed;
    background: var(--surface);
    border: 1px solid var(--line);
    color: var(--text);
    z-index: 100;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 240ms cubic-bezier(0.16, 1, 0.3, 1),
                transform 240ms cubic-bezier(0.16, 1, 0.3, 1),
                visibility 240ms;
}

/* Desktop: centered modal */
@media (min-width: 769px) {
    .sheet {
        top: 50%;
        left: 50%;
        width: 520px;
        max-width: calc(100vw - 48px);
        max-height: calc(100vh - 80px);
        overflow-y: auto;
        border-radius: 20px;
        transform: translate(-50%, calc(-50% + 20px));
    }
    .sheet.is-open {
        opacity: 1;
        visibility: visible;
        transform: translate(-50%, -50%);
    }
}

/* Mobile: bottom sheet */
@media (max-width: 768px) {
    .sheet {
        left: 0;
        right: 0;
        bottom: 0;
        max-height: 88vh;
        overflow-y: auto;
        border-radius: 24px 24px 0 0;
        border-bottom: none;
        transform: translateY(100%);
    }
    .sheet.is-open {
        opacity: 1;
        visibility: visible;
        transform: translateY(0);
    }
    .sheet::before {
        content: "";
        display: block;
        width: 40px;
        height: 4px;
        background: var(--muted);
        border-radius: 2px;
        margin: 12px auto 0;
        opacity: 0.5;
    }
}

/* Close button */
.sheet__close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--line);
    color: var(--text-2);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    line-height: 1;
    transition: background 150ms ease, color 150ms ease;
    z-index: 2;
}
.sheet__close:hover {
    background: var(--line);
    color: var(--text);
}

/* Body padding */
.sheet__body {
    padding: 40px 32px 40px;
}
@media (max-width: 768px) {
    .sheet__body {
        padding: 32px 20px 36px;
    }
}

/* Inner elements */
.sheet__emoji {
    font-size: 56px;
    line-height: 1;
    text-align: center;
    margin-bottom: 16px;
}
.sheet__meta {
    text-align: center;
    color: var(--text-2);
    font-size: 14px;
    margin-bottom: 8px;
}
.sheet__title {
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    line-height: 1.2;
    margin: 0 0 8px;
}
.sheet__subtitle {
    text-align: center;
    color: var(--text-2);
    font-size: 15px;
    margin: 0 0 24px;
}
.sheet__section {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 16px;
}
.sheet__section-title {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-2);
    margin: 0 0 8px;
}
.sheet__section-text {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
}
.sheet__tasks {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
}
.sheet__task {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 12px;
    font-size: 15px;
}
.sheet__task-icon {
    font-size: 22px;
    line-height: 1;
}
.sheet__status {
    border-top: 1px solid var(--line);
    padding-top: 20px;
    margin-top: 8px;
    text-align: center;
    font-size: 14px;
    color: var(--text-2);
}
.sheet__status.is-current {
    color: var(--accent);
}
.sheet__status .btn {
    margin-top: 12px;
    display: inline-block;
}

body.sheet-open {
    overflow: hidden;
}

@media (max-width: 600px) {
    .protocol-page {
        padding: 24px 16px 60px;
    }

    .protocol-title {
        font-size: 24px;
    }

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

    .week-card__emoji {
        font-size: 28px;
    }
}

/* === BLOCK 5: PROGRESS === */

.progress-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

.progress-hero {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 28px 24px;
    margin-bottom: 32px;
    position: relative;
}

.progress-hero-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 16px;
}

.progress-hero-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 4px;
}

.progress-hero-sub {
    color: var(--text-2);
    font-size: 14px;
    margin: 0;
}

.progress-add-btn {
    flex-shrink: 0;
    white-space: nowrap;
}

.progress-delta {
    font-size: 48px;
    font-weight: 800;
    line-height: 1;
    margin-bottom: 6px;
}

.progress-delta.is-loss {
    color: var(--accent);
}

.progress-delta.is-gain {
    color: var(--warning);
}

.progress-delta.is-flat {
    color: var(--muted);
}

.progress-hero-meta {
    color: var(--text-2);
    font-size: 14px;
    margin: 0 0 20px;
}

.progress-chart {
    width: 100%;
    height: 200px;
    display: block;
}

.progress-chart-empty {
    height: 200px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--muted);
    font-size: 14px;
}

.progress-section {
    margin-bottom: 32px;
}

.progress-section-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
    margin: 0 0 16px;
}

/* Heatmap */
.progress-heatmap {
    overflow-x: auto;
}

.progress-heatmap-header {
    display: grid;
    grid-template-columns: repeat(12, 20px);
    gap: 4px;
    margin-bottom: 4px;
    padding-left: 2px;
}

.progress-heatmap-week-label {
    font-size: 10px;
    color: var(--muted);
    text-align: center;
}

.progress-heatmap-grid {
    display: grid;
    grid-template-columns: repeat(12, 20px);
    grid-template-rows: repeat(7, 20px);
    gap: 4px;
}

.progress-heatmap-cell {
    width: 20px;
    height: 20px;
    border-radius: 4px;
    transition: opacity 0.2s;
}

.progress-heatmap-cell:hover {
    outline: 2px solid var(--text-2);
    outline-offset: 1px;
}

.progress-heatmap-legend {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-2);
}

.legend-dot {
    width: 12px;
    height: 12px;
    border-radius: 3px;
    flex-shrink: 0;
}

/* Metrics */
.progress-metrics {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 10px;
}

.progress-metric {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 16px;
    text-align: center;
}

.progress-metric-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 4px;
}

.progress-metric-label {
    font-size: 12px;
    color: var(--text-2);
}

/* History */
.progress-history {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.progress-history-item {
    display: flex;
    gap: 12px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 10px;
    font-size: 14px;
}

.progress-history-date {
    color: var(--text-2);
    flex-shrink: 0;
    min-width: 90px;
}

.progress-history-data {
    color: var(--text);
}

.progress-history-empty {
    color: var(--muted);
    font-size: 14px;
}

/* Form */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    padding: 10px 14px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 10px;
    color: var(--text);
    font-size: 15px;
    outline: none;
    transition: border-color 0.15s;
}

.form-input:focus {
    border-color: var(--accent);
}

.form-input::placeholder {
    color: var(--muted);
}

/* Responsive */
@media (max-width: 768px) {
    .progress-page {
        padding: 24px 16px 60px;
    }

    .progress-hero-title {
        font-size: 22px;
    }

    .progress-delta {
        font-size: 36px;
    }

    .progress-heatmap-header {
        grid-template-columns: repeat(12, 14px);
        gap: 3px;
    }

    .progress-heatmap-grid {
        grid-template-columns: repeat(12, 14px);
        grid-template-rows: repeat(7, 14px);
        gap: 3px;
    }

    .progress-heatmap-cell {
        width: 14px;
        height: 14px;
        border-radius: 3px;
    }

    .progress-metrics {
        grid-template-columns: 1fr 1fr;
    }
}

/* === BLOCK 6: LIBRARY === */

.library-page {
    max-width: 800px;
    margin: 0 auto;
    padding: 0 16px;
}

.library-header {
    text-align: center;
    margin-bottom: 24px;
}

.library-title-page {
    font-size: 22px;
    font-weight: 600;
    color: var(--text);
    margin: 0 0 4px;
}

.library-subtitle {
    font-size: 14px;
    color: var(--text-2);
    margin: 0;
}

.library-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.library-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 20px 16px;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}

.library-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.library-card.phase-1 { border-left-color: var(--accent); }
.library-card.phase-2 { border-left-color: var(--info); }
.library-card.phase-3 { border-left-color: var(--warning); }

.library-emoji {
    font-size: 48px;
    margin-bottom: 12px;
    line-height: 1;
}

.library-card-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin: 0;
}

.library-excerpt {
    font-size: 14px;
    color: var(--text-2);
    margin-top: 6px;
    line-height: 1.4;
}

/* Article body inside sheet */
.article-body h4 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
    margin: 20px 0 8px;
}

.article-body p {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-2);
    margin: 0 0 12px;
}

.article-body ul {
    padding-left: 20px;
    margin: 12px 0;
}

.article-body li {
    font-size: 15px;
    line-height: 1.6;
    color: var(--text-2);
    margin-bottom: 6px;
}

.article-body li b {
    color: var(--text);
}

/* Responsive: library */
@media (max-width: 900px) {
    .library-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

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

    .library-emoji {
        font-size: 40px;
    }
}

/* === BLOCK 6.5: EATING WINDOW === */
.eating-window {
    margin-top: 12px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-size: 14px;
    color: var(--text);
}
.eating-window--inside { border-color: var(--accent); }
.eating-window--before { border-color: var(--info); }
.eating-window--after  { border-color: var(--muted); color: var(--text-2); }
.eating-window--unlimited { border-color: var(--line); color: var(--text-2); }

/* === BLOCK 7D.1: PROGRESS HEATMAP WEEKDAY LABELS === */
.heatmap-layout {
    display: flex;
    gap: 6px;
    align-items: flex-start;
}

.heatmap-weekdays {
    display: grid;
    grid-template-rows: repeat(7, 20px);
    gap: 4px;
    padding-top: 22px; /* align with grid below header */
    flex-shrink: 0;
}

.heatmap-weekdays span {
    font-size: 10px;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding-right: 4px;
    line-height: 1;
    user-select: none;
}

.heatmap-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

@media (max-width: 900px) {
    .heatmap-weekdays {
        grid-template-rows: repeat(7, 14px);
        gap: 3px;
        padding-top: 18px;
    }

    .heatmap-weekdays span {
        font-size: 9px;
        padding-right: 2px;
    }
}
/* === END BLOCK 7D.1 === */

/* === BLOCK 7D.2: DASHBOARD MEAL OVERRIDE === */
.meal-override-link {
    display: inline-block;
    margin-top: 8px;
    padding: 6px 12px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-2);
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    cursor: pointer;
    transition: color .15s, border-color .15s, background .15s;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.meal-override-link:hover {
    color: var(--accent);
    border-color: var(--accent);
    background: rgba(45, 212, 160, 0.08);
}

.meal-override-badge {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--accent);
    background: rgba(45, 212, 160, 0.1);
    border: 1px solid rgba(45, 212, 160, 0.25);
    border-radius: 6px;
    line-height: 1.3;
}

.meal-override-reset {
    width: 100%;
    color: var(--text-2);
    border-color: var(--line);
}

.meal-override-reset:hover {
    color: var(--warning);
    border-color: var(--warning);
}

@media (max-width: 900px) {
    .meal-override-link {
        font-size: 12px;
        padding: 5px 10px;
    }

    .meal-override-badge {
        font-size: 11px;
        padding: 3px 8px;
    }
}
/* === END BLOCK 7D.2 === */

/* === BLOCK 7E: EXTENDED WEEK CONTENT === */

.sheet__section--how,
.sheet__section--pitfalls,
.sheet__section--expectations {
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 16px 18px;
    margin-bottom: 16px;
}

.sheet__section--how {
    border-left: 3px solid var(--accent);
}

.sheet__section--pitfalls {
    border-left: 3px solid var(--danger);
}

.sheet__section--expectations {
    border-left: 3px solid var(--info);
}

.sheet__motivator {
    border-left: 3px solid var(--warning);
    padding: 12px 16px;
    color: var(--text);
    font-style: italic;
    background: rgba(245, 158, 63, 0.06);
    border-radius: 8px;
    margin-top: 16px;
}

.sheet__motivator blockquote {
    margin: 0;
    padding: 0;
    font-size: 15px;
    line-height: 1.5;
}

/* === END BLOCK 7E === */

/* === BLOCK 7B-RESTORE: NAV + BURGER + MOBILE MENU === */

/* Desktop nav */
.nav-desktop {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav-desktop a {
  color: var(--text-2);
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s, background 0.2s;
  white-space: nowrap;
}

.nav-desktop a:hover,
.nav-desktop a.active {
  color: var(--text);
  background: var(--surface-2);
}

/* Burger button — hidden on desktop */
.burger {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 8px;
  flex-direction: column;
  gap: 5px;
  z-index: 1001;
}

.burger span {
  display: block;
  width: 24px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
  transition: transform 0.3s, opacity 0.3s;
}

/* Mobile menu — hidden by default */
.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: var(--bg);
  padding: 80px 24px 24px;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
}

.mobile-menu.is-open {
  display: flex;
}

.mobile-menu-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.6);
}

.mobile-menu-backdrop.is-open {
  display: block;
}

.mobile-menu-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mobile-menu-nav a {
  color: var(--text);
  text-decoration: none;
  font-size: 1.15rem;
  font-weight: 500;
  padding: 14px 16px;
  border-radius: 12px;
  transition: background 0.2s;
}

.mobile-menu-nav a:hover,
.mobile-menu-nav a.active {
  background: var(--surface-2);
}

.mobile-menu-close {
  position: absolute;
  top: 20px;
  right: 20px;
  background: none;
  border: none;
  color: var(--text-2);
  font-size: 1.8rem;
  cursor: pointer;
  padding: 8px;
  line-height: 1;
}

/* Responsive: mobile */
@media (max-width: 768px) {
  .header .nav-desktop {
    display: none;
  }

  .burger {
    display: flex;
  }
}

/* === BLOCK 7F: WEEK ADVANCE MECHANICS === */

.week-card.is-available {
  border: 2px solid var(--accent);
  animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(45, 212, 160, 0.3); }
  50% { box-shadow: 0 0 12px 4px rgba(45, 212, 160, 0.15); }
}

.advance-banner {
  background: linear-gradient(135deg, rgba(45, 212, 160, 0.15), rgba(45, 212, 160, 0.05));
  border: 1px solid var(--accent);
  border-radius: 16px;
  padding: 16px 20px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.advance-banner__text {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 500;
}

.advance-banner__text span {
  color: var(--accent);
  font-weight: 700;
}

.btn-advance {
  background: var(--accent);
  color: var(--bg);
  border: none;
  padding: 10px 20px;
  border-radius: 10px;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  white-space: nowrap;
  transition: opacity 0.2s;
}

.btn-advance:hover {
  opacity: 0.85;
}

.btn-back {
  background: none;
  border: 1px solid var(--line);
  color: var(--text-2);
  padding: 8px 16px;
  border-radius: 10px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
  margin-top: 8px;
}

.btn-back:hover {
  border-color: var(--text-2);
  color: var(--text);
}

.sheet__locked-msg {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-2);
}

.sheet__locked-msg .emoji {
  font-size: 2rem;
  display: block;
  margin-bottom: 8px;
}

.sheet__locked-msg .days {
  color: var(--warning);
  font-weight: 700;
}

.status-available {
  color: var(--accent);
}

.status-locked {
  opacity: 0.5;
}
