:root {
    --bg: #f7f2ea;
    --panel: #fffaf3;
    --panel-2: #eef7f2;
    --ink: #17211c;
    --muted: #657069;
    --line: rgba(23, 33, 28, 0.12);
    --accent: #1f8a70;
    --accent-2: #c7522a;
    --accent-3: #325d8a;
    --shadow: 0 20px 60px rgba(27, 34, 30, 0.12);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(31, 138, 112, 0.11), transparent 34%),
        linear-gradient(180deg, #f9f3e8 0%, #edf4ef 100%);
    color: var(--ink);
}

button,
input,
select {
    font: inherit;
}

button {
    cursor: pointer;
}

.app-shell {
    width: min(1480px, calc(100% - 32px));
    margin: 0 auto;
    padding: 24px 0 40px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
    min-height: 78px;
}

.kicker {
    color: var(--accent);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

h1,
h2 {
    margin: 0;
    letter-spacing: 0;
}

h1 {
    font-size: clamp(2rem, 5vw, 4.2rem);
    line-height: 1;
}

h2 {
    font-size: 1rem;
}

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

.sync-pill,
.icon-button,
.text-button,
.primary-action,
.check-button,
.delete-button,
.quick-grid button,
.category-tabs button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.72);
    color: var(--ink);
    min-height: 42px;
}

.sync-pill {
    padding: 0 12px;
    color: var(--muted);
}

.icon-button {
    width: 42px;
    text-decoration: none;
}

.summary-band {
    display: grid;
    grid-template-columns: 170px 170px minmax(220px, 1fr);
    gap: 12px;
    margin: 18px 0;
}

.summary-block {
    min-height: 96px;
    padding: 18px;
    border: 1px solid var(--line);
    background: rgba(255, 250, 243, 0.82);
    box-shadow: var(--shadow);
    border-radius: 8px;
}

.summary-block span {
    display: block;
    color: var(--muted);
    font-weight: 700;
    font-size: 0.88rem;
}

.summary-block strong {
    display: block;
    margin-top: 8px;
    font-size: 2rem;
}

.summary-block.wide {
    background: linear-gradient(120deg, rgba(31, 138, 112, 0.16), rgba(50, 93, 138, 0.12));
}

.workspace {
    display: grid;
    grid-template-columns: minmax(290px, 370px) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.side-panel,
.list-panel,
.auth-panel {
    border: 1px solid var(--line);
    background: rgba(255, 250, 243, 0.9);
    border-radius: 8px;
    box-shadow: var(--shadow);
}

.side-panel {
    padding: 18px;
    position: sticky;
    top: 16px;
}

.user-chip {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: var(--panel-2);
    border-radius: 8px;
    color: #25493d;
    font-weight: 800;
}

.add-form {
    display: grid;
    gap: 12px;
    margin: 18px 0;
}

label span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    margin-bottom: 6px;
}

input,
select {
    width: 100%;
    min-height: 44px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
    color: var(--ink);
    padding: 0 12px;
    outline: none;
}

input:focus,
select:focus {
    border-color: rgba(31, 138, 112, 0.72);
    box-shadow: 0 0 0 4px rgba(31, 138, 112, 0.12);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1.25fr;
    gap: 10px;
}

.primary-action {
    background: var(--accent);
    color: white;
    border-color: transparent;
    font-weight: 900;
}

.quick-panel {
    display: grid;
    gap: 10px;
}

.quick-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
}

.quick-grid button {
    min-height: 38px;
    background: #fff;
}

.list-panel {
    min-height: 560px;
    padding: 18px;
}

.list-toolbar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
}

.search-box {
    position: relative;
}

.search-box svg {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    width: 18px;
    height: 18px;
}

.search-box input {
    padding-left: 40px;
}

.text-button {
    padding: 0 14px;
    font-weight: 800;
}

.category-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0;
}

.category-tabs button {
    min-height: 36px;
    padding: 0 12px;
    font-weight: 800;
}

.category-tabs button.active {
    background: #17211c;
    color: #fff;
}

.items-list {
    display: grid;
    gap: 10px;
}

.item-card {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 42px;
    gap: 12px;
    align-items: center;
    min-height: 78px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #fff;
}

.item-card.is-checked {
    background: rgba(238, 247, 242, 0.7);
}

.item-card.is-checked .item-name {
    text-decoration: line-through;
    color: var(--muted);
}

.check-button,
.delete-button {
    width: 42px;
    background: #f7f2ea;
}

.check-button {
    color: var(--accent);
}

.delete-button {
    color: var(--accent-2);
}

.item-title-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.item-name {
    font-size: 1.08rem;
}

.item-category {
    flex: 0 0 auto;
    padding: 5px 8px;
    border-radius: 8px;
    background: rgba(50, 93, 138, 0.12);
    color: var(--accent-3);
    font-size: 0.78rem;
    font-weight: 900;
}

.item-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-height: 20px;
    color: var(--muted);
    margin-top: 4px;
    font-size: 0.9rem;
}

.empty-state {
    min-height: 360px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 10px;
    text-align: center;
    color: var(--muted);
}

.empty-state svg {
    width: 56px;
    height: 56px;
    color: var(--accent);
}

.empty-state h2 {
    color: var(--ink);
    font-size: 1.35rem;
}

.empty-state p {
    max-width: 420px;
    margin: 0;
}

.auth-page {
    display: grid;
    place-items: center;
    padding: 20px;
}

.auth-shell {
    width: min(100%, 460px);
}

.auth-panel {
    padding: 28px;
}

.auth-mark {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    padding: 0 10px;
    border-radius: 8px;
    background: var(--panel-2);
    color: var(--accent);
    font-weight: 900;
    margin-bottom: 14px;
}

.auth-panel h1 {
    font-size: 2.2rem;
}

.auth-panel p {
    color: var(--muted);
    line-height: 1.55;
}

.auth-form {
    display: grid;
    gap: 14px;
}

.auth-form button {
    min-height: 46px;
    border: 0;
    border-radius: 8px;
    background: var(--accent);
    color: white;
    font-weight: 900;
}

.auth-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

.auth-form .ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--line);
}

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

.check-row input {
    width: 18px;
    min-height: 18px;
}

.check-row span {
    margin: 0;
}

.notice,
.error {
    padding: 12px;
    border-radius: 8px;
    margin: 12px 0;
    line-height: 1.45;
}

.notice {
    background: rgba(31, 138, 112, 0.12);
    color: #155946;
}

.error {
    background: rgba(199, 82, 42, 0.12);
    color: #8a2d18;
}

svg {
    width: 18px;
    height: 18px;
}

@media (max-width: 900px) {
    .app-shell {
        width: min(100% - 20px, 760px);
        padding-top: 14px;
    }

    .topbar,
    .list-toolbar {
        align-items: stretch;
        flex-direction: column;
    }

    .summary-band,
    .workspace,
    .list-toolbar {
        grid-template-columns: 1fr;
    }

    .side-panel {
        position: static;
    }

    .summary-block {
        min-height: 76px;
    }
}

@media (max-width: 520px) {
    .topbar {
        display: grid;
    }

    .top-actions {
        justify-content: space-between;
    }

    .form-row,
    .quick-grid,
    .auth-actions {
        grid-template-columns: 1fr;
    }

    .item-card {
        grid-template-columns: 38px minmax(0, 1fr) 38px;
        gap: 8px;
        padding: 10px;
    }

    .item-title-row {
        display: grid;
        justify-items: start;
    }
}
