:root {
    color-scheme: light;
    --bg: #f6f7f9;
    --panel: #ffffff;
    --ink: #17202a;
    --muted: #687381;
    --line: #dfe5ec;
    --accent: #0f766e;
    --accent-strong: #115e59;
    --danger: #b42318;
    --soft: #edf7f5;
    --shadow: 0 12px 28px rgba(17, 24, 39, 0.08);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
    font: inherit;
}

a {
    color: inherit;
    text-decoration: none;
}

.topbar {
    align-items: center;
    background: #ffffff;
    border-bottom: 1px solid var(--line);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 18px clamp(16px, 4vw, 36px);
    position: sticky;
    top: 0;
    z-index: 5;
}

.topbar h1,
.workspace-head h2,
.login-panel h1 {
    font-size: 28px;
    line-height: 1.1;
    margin: 0;
}

.eyebrow,
.section-title {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0;
    margin: 0 0 5px;
    text-transform: uppercase;
}

.top-actions {
    align-items: center;
    display: flex;
    gap: 8px;
}

.ghost,
.primary {
    align-items: center;
    border-radius: 7px;
    display: inline-flex;
    min-height: 40px;
    padding: 0 14px;
}

.ghost {
    border: 1px solid var(--line);
    color: var(--muted);
}

.ghost.disabled {
    cursor: default;
    opacity: 0.7;
}

.primary {
    background: var(--accent);
    border: 0;
    color: #ffffff;
    cursor: pointer;
    justify-content: center;
}

.app-shell {
    display: grid;
    gap: 22px;
    grid-template-columns: minmax(190px, 260px) minmax(0, 1fr);
    padding: 22px clamp(14px, 4vw, 36px);
}

.sidebar,
.workspace,
.login-panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.sidebar {
    align-self: start;
    padding: 16px;
    position: sticky;
    top: 92px;
}

.list-nav {
    display: grid;
    gap: 6px;
}

.nav-item {
    align-items: center;
    background: transparent;
    border: 0;
    border-radius: 6px;
    color: var(--ink);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    min-height: 38px;
    padding: 8px 10px;
    text-align: left;
}

.nav-item.active,
.nav-item:hover {
    background: var(--soft);
}

.workspace {
    min-width: 0;
    padding: clamp(14px, 3vw, 22px);
}

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

.icon-button,
.mini,
.complete,
.expand {
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 7px;
    cursor: pointer;
    display: inline-flex;
    justify-content: center;
}

.icon-button {
    background: var(--accent);
    border-color: var(--accent);
    color: #ffffff;
    font-size: 26px;
    height: 44px;
    width: 44px;
}

.quick-create {
    background: #f9fafb;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    grid-template-columns: 140px minmax(180px, 1fr) 190px 190px;
    margin-bottom: 16px;
    padding: 10px;
}

.quick-create.is-targeting-child {
    background: var(--soft);
    border-color: rgba(15, 118, 110, 0.35);
}

.quick-create .appointment-field {
    display: none;
}

.quick-create.is-appointment .appointment-field {
    display: block;
}

input,
select {
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 6px;
    color: var(--ink);
    min-height: 40px;
    padding: 8px 10px;
    width: 100%;
}

input:focus,
select:focus,
button:focus {
    outline: 3px solid rgba(15, 118, 110, 0.18);
    outline-offset: 1px;
}

.items {
    display: grid;
    gap: 8px;
}

.item {
    border-left: 2px solid var(--line);
    padding-left: 10px;
}

.item-row {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--line);
    border-radius: 8px;
    display: grid;
    gap: 8px;
    grid-template-columns: 32px 32px minmax(0, 1fr) 130px 78px 34px;
    min-height: 54px;
    padding: 8px;
}

.item-main {
    min-width: 0;
}

.title-input {
    border-color: transparent;
    min-height: 34px;
    padding-left: 4px;
}

.title-input:hover,
.title-input:focus {
    border-color: var(--line);
}

.complete,
.expand,
.mini {
    background: #ffffff;
    color: var(--muted);
    height: 32px;
    width: 32px;
}

.add-child {
    font-size: 13px;
    font-weight: 700;
    width: 78px;
}

.complete::before {
    border: 2px solid currentColor;
    border-radius: 50%;
    content: "";
    height: 14px;
    width: 14px;
}

.item.done {
    opacity: 0.62;
}

.item.done .complete::before {
    background: var(--accent);
    border-color: var(--accent);
}

.delete:hover {
    border-color: #f3b5af;
    color: var(--danger);
}

.children {
    display: grid;
    gap: 8px;
    margin-left: 20px;
    margin-top: 8px;
}

.item.collapsed > .children,
.item.collapsed > .appointment-editor {
    display: none;
}

.appointment-editor {
    display: none;
    gap: 8px;
    grid-template-columns: 190px 190px;
    margin: 8px 0 0 74px;
}

.item.appointment > .appointment-editor {
    display: grid;
}

.meta {
    color: var(--muted);
    font-size: 12px;
    min-height: 16px;
    padding-left: 4px;
}

.type-list {
    border-left-color: #0f766e;
}

.type-task {
    border-left-color: #2563eb;
}

.type-subtask {
    border-left-color: #7c3aed;
}

.type-appointment {
    border-left-color: #c2410c;
}

.login-page {
    align-items: center;
    display: flex;
    justify-content: center;
    padding: 24px;
}

.login-shell {
    max-width: 420px;
    width: 100%;
}

.login-panel {
    display: grid;
    gap: 16px;
    padding: 24px;
}

.login-panel label {
    display: grid;
    gap: 6px;
}

.login-panel span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

.notice {
    border-radius: 7px;
    padding: 10px 12px;
}

.notice.error {
    background: #fef3f2;
    color: var(--danger);
}

@media (max-width: 820px) {
    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .top-actions {
        flex-wrap: wrap;
        width: 100%;
    }

    .ghost {
        flex: 1;
        justify-content: center;
    }

    .app-shell {
        display: block;
        padding: 14px;
    }

    .sidebar {
        margin-bottom: 14px;
        position: static;
    }

    .list-nav {
        display: flex;
        overflow-x: auto;
        padding-bottom: 4px;
    }

    .nav-item {
        flex: 0 0 auto;
        min-width: 130px;
    }

    .quick-create,
    .item-row {
        grid-template-columns: 1fr;
    }

    .item-row {
        align-items: stretch;
    }

    .complete,
    .expand,
    .mini {
        height: 40px;
        width: 100%;
    }

    .appointment-editor {
        grid-template-columns: 1fr;
        margin-left: 0;
    }

    .children {
        margin-left: 10px;
    }
}
