:root {
    --bg: #fafafa;
    --surface: #ffffff;
    --text: #072b2e;
    --muted: #4f6f72;
    --border: #d7e1e3;
    --border-strong: #c5d4d6;
    --primary: #5ab774;
    --primary-hover: #489e5f;
    --accent-soft: #eef7f0;
    --warning-soft: #fff8d6;
    --ink-soft: #eef3f3;
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --motion-fast: 140ms;
    --motion-base: 220ms;
    --ease-smooth: cubic-bezier(0.22, 1, 0.36, 1);
}

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

body {
    font-family: Inter, system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    background-image:
        radial-gradient(circle at 18% 0%, rgba(90, 183, 116, 0.09), transparent 32%),
        radial-gradient(circle at 85% 12%, rgba(7, 43, 46, 0.07), transparent 28%);
}

button,
input,
textarea,
select {
    font-family: inherit;
    font-size: inherit;
    line-height: inherit;
}

.workbook-app {
    min-height: 100vh;
    padding: 0 20px 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.topbar {
    width: 100vw;
    margin-left: calc(50% - 50vw);
    background: #072b2e;
    border: none;
    border-radius: 0;
    padding: 12px 0;
}

.topbar-inner {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 14px;
}

.top-progress-wrap {
    margin: 10px 4px 0;
    height: 7px;
    border-radius: 999px;
    background: #e8eeef;
    overflow: hidden;
}

.top-progress-bar {
    height: 100%;
    width: 0;
    border-radius: 999px;
    background: linear-gradient(90deg, #5ab774, #7fc696);
    transition: width 420ms var(--ease-smooth);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.brand-logo {
    height: 24px;
    width: auto;
}

.brand-kicker {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.2;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    text-align: center;
}

.header-title h1 {
    font-size: 20px;
    font-weight: 600;
    line-height: 1.2;
    color: #ffffff;
    text-align: center;
}

.header-title {
    justify-self: center;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    justify-self: end;
}

.topbar-actions .btn {
    margin: 0;
    padding: 10px 16px;
    min-height: 40px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.2;
    white-space: nowrap;
}

.progress-label {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.8);
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.layout {
    margin-top: 16px;
    display: grid;
    grid-template-columns: 296px minmax(0, 1fr);
    gap: 16px;
}

.days-panel,
.sheet-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
}

.days-panel {
    padding: 14px 12px;
    position: sticky;
    top: 20px;
    align-self: start;
}

.days-meta {
    margin-top: 12px;
    border: 1px solid rgba(90, 183, 116, 0.38);
    background: linear-gradient(180deg, #f7fcf8 0%, #eef8f0 100%);
    border-radius: var(--radius-sm);
    padding: 10px 10px;
    box-shadow: 0 8px 22px rgba(20, 71, 39, 0.08);
}

.days-meta p {
    font-size: 12px;
    color: #35595d;
}

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

.skip-wait-btn {
    margin-top: 8px;
    width: 100%;
    min-height: 34px;
    font-size: 12px;
    font-weight: 700;
    border: 1px solid rgba(255, 146, 67, 0.65);
    background: linear-gradient(135deg, #ffefdb, #ffe3ba);
    color: #8a3e00;
    box-shadow: 0 8px 18px rgba(176, 91, 20, 0.18);
}

.skip-wait-btn:hover:not(:disabled) {
    border-color: rgba(255, 146, 67, 0.95);
    background: linear-gradient(135deg, #ffe9cb, #ffd9a4);
}

.streak-line {
    display: flex;
    align-items: center;
    gap: 6px;
}

.streak-icon {
    width: 15px;
    height: 15px;
    display: inline-flex;
    color: #ff8f3a;
}

.streak-icon svg {
    width: 15px;
    height: 15px;
}

.panel-title {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 10px;
}

.day-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.day-item {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 10px;
    background: #fff;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    font-size: 13px;
    line-height: 1.35;
    transition: border-color var(--motion-base) var(--ease-smooth), background-color var(--motion-base) var(--ease-smooth), transform var(--motion-fast) var(--ease-smooth);
    position: relative;
}

.day-main {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.day-title {
    font-size: 13px;
}

.day-unlock-time {
    font-size: 11px;
    color: var(--muted);
}

.day-item::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    border-radius: 8px 0 0 8px;
    background: transparent;
    transition: background-color var(--motion-base) var(--ease-smooth);
}

.day-item:hover:not(:disabled) {
    border-color: var(--border-strong);
    transform: translateY(-1px);
}

.day-item.locked {
    opacity: 0.55;
    cursor: not-allowed;
}

.day-item.active {
    border-color: var(--primary);
    background: var(--accent-soft);
}

.day-item.active::before,
.day-item.done::before {
    background: var(--primary);
}

.day-item.done .day-state {
    color: var(--primary);
}

.day-state {
    width: 18px;
    height: 18px;
    margin-left: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #6a8487;
}

.day-state svg {
    width: 18px;
    height: 18px;
}

.sheet-panel {
    padding: 22px;
    transition: border-color var(--motion-base) var(--ease-smooth), opacity var(--motion-base) var(--ease-smooth), transform var(--motion-base) var(--ease-smooth);
}

.sheet-panel.is-switching {
    opacity: 0;
    transform: translateY(4px);
}

.celebration-banner {
    display: none;
    margin-bottom: 12px;
    border: 1px solid rgba(90, 183, 116, 0.4);
    background: linear-gradient(90deg, rgba(90, 183, 116, 0.16), rgba(90, 183, 116, 0.05));
    color: #1f4f30;
    border-radius: var(--radius-sm);
    padding: 9px 12px;
    font-size: 13px;
    font-weight: 600;
}

.celebration-banner.show {
    display: block;
    animation: popBanner 360ms var(--ease-smooth);
}

.sheet-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.day-chip {
    font-size: 12px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.day-status {
    font-size: 12px;
    border: 1px solid var(--border);
    border-radius: 999px;
    padding: 4px 12px;
    color: var(--muted);
    background: #fff;
    transition: all var(--motion-base) var(--ease-smooth);
}

.day-status.status-current {
    border-color: rgba(90, 183, 116, 0.32);
    background: var(--accent-soft);
    color: var(--text);
}

.day-status.status-completed {
    border-color: rgba(90, 183, 116, 0.45);
    background: rgba(90, 183, 116, 0.18);
    color: var(--text);
}

.sheet-title {
    font-size: 26px;
    margin-bottom: 16px;
    line-height: 1.2;
}

.sheet-block + .sheet-block {
    margin-top: 18px;
}

.sheet-block {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    background: rgba(255, 255, 255, 0.92);
}

.summary-block { background: rgba(238, 247, 240, 0.65); }
.tasks-block { background: rgba(247, 250, 250, 0.86); }
.prompts-block { background: rgba(247, 250, 250, 0.86); }
.reflection-block { background: rgba(255, 248, 214, 0.38); }
.commitment-block { background: rgba(238, 243, 243, 0.55); }

.sheet-block h3 {
    font-size: 13px;
    margin-bottom: 10px;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.sheet-copy {
    color: var(--muted);
    line-height: 1.6;
}

.tasks-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.task-row {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    transition: border-color var(--motion-base) var(--ease-smooth), background-color var(--motion-base) var(--ease-smooth);
}

.task-row:has(input:checked) {
    border-color: rgba(90, 183, 116, 0.45);
    background: var(--accent-soft);
}

.task-row input[type="checkbox"] {
    accent-color: var(--primary);
    margin-top: 2px;
}

.task-row label {
    font-size: 14px;
    line-height: 1.4;
    transition: color var(--motion-base) var(--ease-smooth);
}

.task-row:has(input:checked) label {
    color: #2f595d;
}

.prompts-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
}

.prompt-item {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    font-size: 14px;
    line-height: 1.45;
    color: var(--text);
    background: #fff;
}

textarea,
input[type="text"] {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 14px;
    color: var(--text);
    background: #fff;
    transition: border-color var(--motion-base) var(--ease-smooth), background-color var(--motion-base) var(--ease-smooth);
}

textarea:focus,
input[type="text"]:focus {
    outline: none;
    border-color: rgba(90, 183, 116, 0.6);
    background: #fff;
}

.save-state {
    margin-top: 16px;
    font-size: 12px;
    color: var(--muted);
    transition: color var(--motion-base) var(--ease-smooth);
}

.save-state.state-saving {
    color: #41656a;
}

.save-state.state-saved {
    color: #2f6c44;
}

.save-state.state-error {
    color: #a74242;
}

.sheet-actions {
    margin-top: 12px;
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.btn {
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    padding: 10px 14px;
    font-size: 14px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color var(--motion-base) var(--ease-smooth), background-color var(--motion-base) var(--ease-smooth), transform var(--motion-fast) var(--ease-smooth);
}

.btn-secondary {
    background: #fff;
    border-color: var(--border);
    color: var(--text);
}

.btn-primary {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
}

.btn-primary:hover {
    background: var(--primary-hover);
    border-color: var(--primary-hover);
    transform: translateY(-1px);
}

.btn-secondary:hover {
    border-color: var(--border-strong);
    background: #fcfdfd;
}

.topbar .btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
    color: #ffffff;
}

.topbar .btn-secondary:hover {
    border-color: rgba(255, 255, 255, 0.46);
    background: rgba(255, 255, 255, 0.16);
}

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

@keyframes popBanner {
    from {
        opacity: 0;
        transform: translateY(-4px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        animation: none !important;
        transition: none !important;
    }
}

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

    .days-panel {
        position: static;
    }

    .topbar {
        padding: 10px 0;
    }

    .topbar-inner {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .brand {
        justify-content: center;
    }

    .topbar-actions {
        justify-self: center;
        flex-wrap: wrap;
        justify-content: center;
    }
}
