:root {
    --bg: #0b0b0a;
    --panel: #121210;
    --panel-strong: #181714;
    --text: #f1efe8;
    --muted: #9d9a91;
    --dim: #67655f;
    --line: #2c2a26;
    --amber: #f2ca72;
    --green: #86d89a;
    --blue: #83bddd;
    --coral: #ef755f;
    --serif: "Instrument Serif", Georgia, serif;
    --sans: "DM Sans", Arial, sans-serif;
}

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

html {
    background: var(--bg);
    color: var(--text);
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    -webkit-font-smoothing: antialiased;
}

button,
input,
select {
    font: inherit;
}

button,
a,
select {
    color: inherit;
}

button {
    cursor: pointer;
}

a {
    text-underline-offset: 4px;
}

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

.gate {
    display: grid;
    min-height: 100svh;
    grid-template-rows: auto 1fr auto;
    padding: 34px 4vw;
}

.gate-wordmark,
.wordmark {
    font-family: var(--serif);
    font-size: 26px;
    text-decoration: none;
}

.gate-form {
    width: min(100%, 520px);
    align-self: center;
    justify-self: center;
}

.kicker {
    margin: 0 0 14px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.gate h1 {
    margin: 0;
    font-family: var(--serif);
    font-size: 82px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 0.88;
}

.gate-copy {
    margin: 24px 0 40px;
    color: var(--muted);
    font-family: var(--serif);
    font-size: 23px;
}

.gate-form input {
    width: 100%;
    height: 56px;
    padding: 0 16px;
    border: 1px solid var(--line);
    border-radius: 4px;
    outline: 0;
    background: var(--panel);
    color: var(--text);
}

.gate-form input:focus {
    border-color: var(--amber);
    box-shadow: 0 0 0 3px rgba(242, 202, 114, 0.1);
}

.gate-form button {
    width: 100%;
    height: 52px;
    margin-top: 10px;
    border: 0;
    border-radius: 4px;
    background: var(--amber);
    color: #17130a;
    font-weight: 600;
}

.gate-error {
    display: none;
    margin: 12px 0 0;
    color: var(--coral);
    font-size: 13px;
}

.gate-error.visible {
    display: block;
}

.gate-nav {
    display: flex;
    gap: 22px;
    justify-content: flex-end;
}

.gate-nav a {
    color: var(--muted);
    font-size: 12px;
    text-decoration: none;
}

.topbar {
    display: flex;
    min-height: 72px;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
    padding: 0 4vw;
    border-bottom: 1px solid var(--line);
}

.tool-nav {
    display: flex;
    gap: 24px;
    align-items: center;
}

.tool-nav a,
.tool-nav button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--muted);
    font-size: 11px;
    text-decoration: none;
}

.tool-nav a:hover,
.tool-nav button:hover {
    color: var(--text);
}

.workspace {
    width: min(1120px, calc(100% - 48px));
    margin: 0 auto;
    padding: 82px 0 130px;
}

.page-heading {
    display: grid;
    grid-template-columns: 1.5fr 0.5fr;
    gap: 60px;
    align-items: end;
}

.page-heading h1 {
    margin: 0;
    font-family: var(--serif);
    font-size: 104px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 0.82;
}

.heading-meta {
    padding-bottom: 4px;
    color: var(--muted);
    font-size: 12px;
    text-align: right;
}

.heading-meta p {
    margin: 6px 0 0;
}

.sync-line {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.sync-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--amber);
    box-shadow: 0 0 0 4px rgba(242, 202, 114, 0.08);
}

.sync-line.synced .sync-dot {
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(134, 216, 154, 0.08);
}

.sync-line.error .sync-dot {
    background: var(--coral);
    box-shadow: 0 0 0 4px rgba(239, 117, 95, 0.08);
}

.capture-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 140px auto;
    margin-top: 64px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--panel);
}

.capture-bar input,
.capture-bar select,
.capture-bar button {
    height: 58px;
    border: 0;
    background: transparent;
}

.capture-bar input {
    min-width: 0;
    padding: 0 20px;
    outline: 0;
    color: var(--text);
}

.capture-bar input::placeholder {
    color: var(--dim);
}

.capture-bar select {
    padding: 0 16px;
    border-left: 1px solid var(--line);
    outline: 0;
    color: var(--muted);
}

.capture-bar button {
    padding: 0 22px;
    border-left: 1px solid var(--line);
    background: var(--amber);
    color: #17130a;
    font-size: 11px;
    font-weight: 600;
}

.focus-section,
.inbox-section,
.habit-section {
    margin-top: 105px;
}

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 40px;
    margin-bottom: 28px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.section-heading h2 {
    margin: 0;
    font-family: var(--serif);
    font-size: 50px;
    font-weight: 400;
    letter-spacing: 0;
    line-height: 1;
}

.section-heading > p {
    margin: 0 0 4px;
    color: var(--muted);
    font-size: 11px;
}

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

.focus-card {
    display: flex;
    min-height: 260px;
    flex-direction: column;
    justify-content: space-between;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: var(--panel);
}

.focus-slot {
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.focus-card h3 {
    margin: 34px 0 10px;
    font-family: var(--serif);
    font-size: 31px;
    font-weight: 400;
    line-height: 1.05;
}

.focus-card.empty {
    border-style: dashed;
    background: transparent;
}

.focus-card.empty p {
    margin: 34px 0 0;
    color: var(--dim);
    font-family: var(--serif);
    font-size: 22px;
    line-height: 1.15;
}

.focus-actions,
.task-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.quiet-button,
.focus-actions button,
.task-actions button {
    min-height: 32px;
    padding: 0 11px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: transparent;
    color: var(--muted);
    font-size: 9px;
    text-transform: uppercase;
}

.focus-actions .complete-button {
    border-color: rgba(134, 216, 154, 0.4);
    color: var(--green);
}

.focus-card.empty button {
    align-self: flex-start;
}

.category {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--muted);
    font-size: 9px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.category::before {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--amber);
    content: "";
}

.category-photo::before {
    background: var(--blue);
}

.category-running::before {
    background: var(--coral);
}

.category-health::before {
    background: var(--green);
}

.filter-bar {
    display: flex;
    gap: 6px;
    margin-bottom: 18px;
    overflow-x: auto;
    scrollbar-width: none;
}

.filter-bar::-webkit-scrollbar {
    display: none;
}

.filter-bar button {
    flex: 0 0 auto;
    height: 34px;
    padding: 0 12px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: transparent;
    color: var(--muted);
    font-size: 10px;
}

.filter-bar button.active {
    border-color: var(--amber);
    color: var(--text);
}

.filter-bar span {
    margin-left: 5px;
    color: var(--dim);
}

.task-list {
    border-top: 1px solid var(--line);
}

.task-row {
    display: grid;
    grid-template-columns: 28px minmax(0, 1fr) auto;
    gap: 14px;
    align-items: center;
    min-height: 72px;
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
}

.task-check {
    display: grid;
    width: 20px;
    height: 20px;
    place-items: center;
    border: 1px solid var(--dim);
    border-radius: 50%;
    background: transparent;
}

.task-check:hover {
    border-color: var(--green);
}

.task-copy {
    min-width: 0;
}

.task-copy p {
    margin: 0 0 7px;
    overflow-wrap: anywhere;
    font-family: var(--serif);
    font-size: 23px;
    line-height: 1.1;
}

.task-row.done .task-copy p {
    color: var(--dim);
    text-decoration: line-through;
}

.task-row.done .task-check {
    border-color: var(--green);
    background: var(--green);
    color: var(--bg);
}

.delete-button {
    width: 30px;
    padding: 0 !important;
    font-size: 16px !important;
}

.empty-state {
    margin: 0;
    padding: 40px 0;
    color: var(--dim);
    font-family: var(--serif);
    font-size: 21px;
}

.habit-layout {
    display: grid;
    grid-template-columns: 0.7fr 1.3fr;
    gap: 44px;
}

.today-habits {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}

.habit-toggle {
    display: flex;
    min-height: 112px;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    padding: 16px;
    border: 0;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    background: transparent;
    text-align: left;
}

.habit-toggle:hover {
    background: var(--panel);
}

.habit-toggle.readonly {
    cursor: default;
}

.habit-toggle.done {
    background: rgba(134, 216, 154, 0.05);
}

.habit-check {
    width: 16px;
    height: 16px;
    border: 1px solid var(--dim);
    border-radius: 3px;
}

.habit-toggle.done .habit-check {
    border-color: var(--green);
    background: var(--green);
    box-shadow: inset 0 0 0 3px var(--bg);
}

.habit-name {
    font-family: var(--serif);
    font-size: 20px;
}

.habit-source {
    color: var(--dim);
    font-size: 8px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.habit-week-wrap {
    min-width: 0;
    overflow-x: auto;
}

.habit-week {
    display: grid;
    min-width: 560px;
    grid-template-columns: 130px repeat(7, minmax(54px, 1fr));
    border-top: 1px solid var(--line);
    border-left: 1px solid var(--line);
}

.habit-week-cell {
    display: grid;
    min-height: 46px;
    place-items: center;
    border-right: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    color: var(--dim);
    font-size: 9px;
}

.habit-week-cell.label {
    place-items: center start;
    padding-left: 12px;
    color: var(--muted);
}

.habit-week-cell.header {
    min-height: 52px;
    color: var(--muted);
    text-align: center;
    text-transform: uppercase;
}

.habit-week-cell.today {
    background: var(--panel);
    color: var(--text);
}

.week-dot {
    width: 10px;
    height: 10px;
    border: 1px solid var(--dim);
    border-radius: 50%;
}

.week-dot.done {
    border-color: var(--green);
    background: var(--green);
}

.completed-section {
    margin-top: 110px;
    border-top: 1px solid var(--line);
}

.completed-section summary {
    display: flex;
    justify-content: space-between;
    padding: 22px 0;
    color: var(--muted);
    cursor: pointer;
    font-size: 11px;
    list-style: none;
    text-transform: uppercase;
}

.completed-section summary::-webkit-details-marker {
    display: none;
}

.completed-list {
    opacity: 0.78;
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 30px;
    padding: 28px 4vw;
    border-top: 1px solid var(--line);
    color: var(--dim);
    font-size: 10px;
}

.footer div {
    display: flex;
    gap: 20px;
}

.footer a {
    color: var(--muted);
    text-decoration: none;
}

@media (max-width: 900px) {
    .page-heading h1 {
        font-size: 82px;
    }

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

    .focus-card {
        min-height: 210px;
    }

    .habit-layout {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .gate {
        padding: 24px 20px;
    }

    .gate h1 {
        font-size: 59px;
    }

    .gate-nav {
        justify-content: flex-start;
    }

    .topbar {
        min-height: 104px;
        flex-direction: column;
        gap: 12px;
        align-items: flex-start;
        justify-content: center;
        padding: 18px 20px 0;
    }

    .tool-nav {
        width: 100%;
        gap: 20px;
        padding-bottom: 14px;
        overflow-x: auto;
    }

    .workspace {
        width: calc(100% - 36px);
        padding-top: 62px;
    }

    .page-heading {
        grid-template-columns: 1fr;
        gap: 24px;
    }

    .page-heading h1 {
        font-size: 61px;
    }

    .heading-meta {
        text-align: left;
    }

    .capture-bar {
        grid-template-columns: minmax(0, 1fr) 105px;
    }

    .capture-bar button {
        grid-column: 1 / -1;
        border-top: 1px solid var(--line);
        border-left: 0;
    }

    .focus-section,
    .inbox-section,
    .habit-section {
        margin-top: 82px;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 18px;
    }

    .section-heading h2 {
        font-size: 41px;
    }

    .task-row {
        grid-template-columns: 26px minmax(0, 1fr);
    }

    .task-actions {
        grid-column: 2;
    }

    .today-habits {
        grid-template-columns: 1fr;
    }

    .footer {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        transition-duration: 0.01ms !important;
    }
}
