:root {
    --bg: #f5f8f7;
    --surface: #ffffff;
    --text: #17302b;
    --muted: #6f817c;
    --line: #dfe9e5;
    --primary: #18866f;
    --primary-dark: #116a58;
    --primary-soft: #e5f5ef;
    --danger: #c64d58;
    --shadow: 0 12px 35px rgba(23, 48, 43, .07);
    --radius: 18px;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: var(--primary-dark); text-decoration: none; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.app-shell { min-height: 100vh; }
.topbar { display: flex; align-items: center; justify-content: space-between; max-width: 1180px; margin: 0 auto; padding: 22px 28px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-size: 18px; font-weight: 750; }
.brand-mark, .auth-logo { display: inline-grid; place-items: center; color: white; background: var(--primary); border-radius: 12px; font-weight: 800; }
.brand-mark { width: 30px; height: 30px; font-size: 17px; }
.top-actions, .heading-actions, .form-actions, .move-buttons { display: flex; align-items: center; gap: 10px; }
.main-content { max-width: 1180px; margin: 0 auto; padding: 34px 28px 80px; }
.page-heading { margin: 20px 0 28px; }
.heading-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: clamp(30px, 5vw, 44px); letter-spacing: -.04em; line-height: 1.1; }
h2 { margin-bottom: 8px; font-size: 20px; line-height: 1.2; }
.eyebrow { margin-bottom: 8px; color: var(--primary); font-size: 12px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.muted { color: var(--muted); }
.description-large { white-space: normal; }
.back-link { display: inline-block; margin-bottom: 17px; color: var(--muted); font-size: 14px; font-weight: 650; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 17px; border: 1px solid transparent; border-radius: 11px; font-weight: 700; transition: .18s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled, button:disabled { cursor: wait; opacity: .58; transform: none; }
.button-primary { color: white; background: var(--primary); box-shadow: 0 5px 14px rgba(24, 134, 111, .2); }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { color: var(--primary-dark); background: var(--primary-soft); }
.button-ghost { color: var(--muted); background: transparent; border-color: var(--line); }
.button-ghost:hover { color: var(--text); background: white; }
.button-small { min-height: 36px; padding: 0 12px; font-size: 13px; }
.button-full { width: 100%; }
.mobile-full { margin-top: 20px; }
.card { background: var(--surface); border: 1px solid rgba(223, 233, 229, .8); border-radius: var(--radius); box-shadow: var(--shadow); }
.search-form { position: relative; display: flex; align-items: center; max-width: 540px; margin: 0 0 27px; }
.search-form input { width: 100%; min-height: 48px; padding: 0 43px; border: 1px solid var(--line); border-radius: 13px; outline: none; background: white; color: var(--text); }
.search-form input:focus, input:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(24, 134, 111, .12); }
.search-icon { position: absolute; left: 16px; color: var(--muted); font-size: 24px; line-height: 1; }
.clear-search { position: absolute; right: 16px; color: var(--muted); font-size: 24px; line-height: 1; }
.checklist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(265px, 1fr)); gap: 18px; }
.checklist-card { display: flex; min-height: 248px; flex-direction: column; overflow: hidden; }
.card-main-link { display: block; flex: 1; padding: 23px 23px 16px; color: var(--text); }
.card-main-link:hover h2 { color: var(--primary-dark); }
.card-icon { display: grid; width: 39px; height: 39px; place-items: center; margin-bottom: 18px; border-radius: 12px; color: var(--primary-dark); background: var(--primary-soft); font-weight: 900; }
.checklist-card h2 { margin-bottom: 7px; }
.card-description { min-height: 24px; margin-bottom: 16px; color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-progress { margin-top: auto; }
.card-actions { display: flex; flex-wrap: wrap; gap: 4px; padding: 10px 13px; border-top: 1px solid var(--line); }
.card-actions a, .card-actions button { padding: 7px 9px; border: 0; border-radius: 7px; color: var(--muted); background: transparent; font-size: 13px; font-weight: 700; }
.card-actions a:hover, .card-actions button:hover { color: var(--primary-dark); background: var(--primary-soft); }
.inline-form { display: inline; }
.card-actions .danger-link { color: var(--danger); }
.progress-meta { display: flex; justify-content: space-between; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.progress-meta strong { color: var(--text); }
.progress { height: 8px; overflow: hidden; border-radius: 99px; background: #e8efec; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--primary); transition: width .25s ease; }
.empty-state { padding: 60px 24px; text-align: center; }
.empty-state.compact { padding: 40px 24px; }
.empty-state h2 { margin-bottom: 10px; }
.empty-state .button { margin-top: 12px; }
.empty-icon { margin-bottom: 15px; color: var(--primary); font-size: 38px; }
.auth-page { display: grid; min-height: 78vh; place-items: center; padding: 35px 15px; }
.auth-card { width: min(100%, 430px); padding: 38px; }
.install-card { width: min(100%, 510px); }
.auth-logo { width: 48px; height: 48px; margin-bottom: 25px; border-radius: 16px; font-size: 24px; }
.auth-card h1 { font-size: 32px; }
.stack-form { display: grid; gap: 9px; margin-top: 27px; }
label { color: var(--text); font-size: 14px; font-weight: 750; }
input, textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; outline: none; background: #fbfdfc; color: var(--text); }
input { min-height: 46px; padding: 10px 13px; }
textarea { resize: vertical; padding: 12px 13px; }
.stack-form input { margin-bottom: 9px; }
.alert { margin: 0 0 18px; padding: 13px 15px; border-radius: 10px; font-size: 14px; }
.alert-error { color: #8c2934; border: 1px solid #f2c7cc; background: #fff0f1; }
.editor-form { display: grid; gap: 18px; max-width: 850px; }
.form-section { padding: 27px; }
.form-section > label { display: block; margin: 18px 0 7px; }
.form-section > h2 { margin-bottom: 21px; }
.label-note, .form-hint { color: var(--muted); font-size: 13px; font-weight: 500; }
.section-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 22px; }
.section-title-row .muted { margin-bottom: 0; font-size: 14px; }
.category-editor { margin-bottom: 15px; padding: 17px; border: 1px solid var(--line); border-radius: 13px; background: #fbfdfc; }
.category-editor-head { display: flex; align-items: flex-end; gap: 9px; }
.category-editor-head label { flex: 1; }
.category-editor-head label input { display: block; margin-top: 6px; background: white; }
.drag-handle { flex: 0 0 18px; padding-bottom: 11px; color: #9aaca5; font-size: 22px; line-height: 1; }
.category-editor .drag-handle { align-self: center; padding-bottom: 0; }
.item-editor-list { display: grid; gap: 8px; margin: 14px 0 10px 28px; }
.item-editor-row { display: flex; align-items: center; gap: 7px; }
.item-editor-row .drag-handle { padding-bottom: 0; font-size: 18px; }
.item-editor-row input { min-height: 41px; flex: 1; background: white; }
.item-editor-row select { min-height: 41px; flex: 0 0 125px; padding: 8px 9px; border: 1px solid var(--line); border-radius: 9px; outline: none; background: white; color: var(--text); }
.item-editor-row select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(24, 134, 111, .12); }
.icon-button { display: inline-grid; width: 34px; height: 34px; flex: 0 0 34px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: white; font-weight: 800; }
.icon-button:hover { color: var(--primary-dark); border-color: var(--primary); }
.icon-button.danger:hover { color: var(--danger); border-color: #efb9be; background: #fff5f5; }
.text-button { padding: 5px 0 0 28px; border: 0; color: var(--primary-dark); background: transparent; font-size: 14px; font-weight: 750; }
.form-actions { justify-content: flex-end; padding-top: 4px; }
.checklist-summary { max-width: 700px; margin-bottom: 20px; padding: 22px 25px; }
.checklist-items { display: grid; max-width: 850px; gap: 17px; }
.category-view { padding: 23px 25px 11px; }
.category-view-title { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 12px; }
.category-view-title h2 { margin: 0; }
.category-count { color: var(--muted); font-size: 13px; }
.category-empty { margin: 10px 0 13px; font-size: 14px; }
.check-items { display: grid; }
.check-item { display: flex; min-height: 54px; align-items: center; gap: 13px; padding: 8px 3px; border-top: 1px solid #edf2f0; cursor: pointer; }
.check-item input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.custom-checkbox { width: 23px; height: 23px; flex: 0 0 23px; border: 2px solid #afc2bc; border-radius: 7px; background: white; transition: .15s ease; }
.check-item:hover .custom-checkbox { border-color: var(--primary); }
.check-item input:focus-visible + .custom-checkbox { outline: 3px solid rgba(24, 134, 111, .2); }
.check-item input:checked + .custom-checkbox { border-color: var(--primary); background: var(--primary); }
.check-item input:checked + .custom-checkbox::after { display: block; width: 6px; height: 11px; margin: 3px 0 0 7px; border: solid white; border-width: 0 2px 2px 0; transform: rotate(45deg); content: ''; }
.item-name { flex: 1; transition: .15s ease; }
.check-item.is-completed .item-name { color: var(--muted); text-decoration: line-through; }
.priority-badge { flex: 0 0 auto; padding: 4px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; }
.priority-essential { color: #a93743; background: #fde8ea; }
.priority-important { color: #956518; background: #fff2d5; }
.priority-useful { color: #27658b; background: #e4f2fb; }
.priority-comfort { color: #69499b; background: #eee7fb; }
.priority-optional { color: #66756f; background: #edf1ef; }
.danger-button { color: var(--danger); }
.toast-container { position: fixed; z-index: 20; right: 22px; bottom: 22px; display: grid; gap: 10px; max-width: min(360px, calc(100vw - 44px)); }
.toast { padding: 12px 16px; border: 1px solid #c9e8dc; border-radius: 11px; color: #155b49; background: #effbf6; box-shadow: var(--shadow); font-size: 14px; font-weight: 650; }
.toast-error { color: #8c2934; border-color: #f2c7cc; background: #fff0f1; }

@media (max-width: 680px) {
    .topbar { padding: 17px 16px; }
    .top-actions .button:first-child { display: none; }
    .main-content { padding: 24px 16px 60px; }
    .heading-row { align-items: flex-start; flex-direction: column; }
    .heading-actions { width: 100%; flex-wrap: wrap; }
    .heading-actions .button { flex: 1; }
    .auth-card { padding: 29px 22px; }
    .form-section { padding: 21px 17px; }
    .section-title-row { align-items: stretch; flex-direction: column; }
    .section-title-row .button { align-self: flex-start; }
    .category-editor-head { align-items: flex-start; }
    .category-editor-head .move-buttons { flex-wrap: wrap; width: 72px; }
    .category-editor-head .move-buttons .icon-button:first-child, .category-editor-head .move-buttons .icon-button:nth-child(2) { display: none; }
    .item-editor-list { margin-left: 0; }
    .item-editor-row .drag-handle { display: none; }
    .item-editor-row { flex-wrap: wrap; }
    .item-editor-row input { min-width: 0; }
    .item-editor-row select { flex: 1 1 140px; }
    .mobile-full { width: 100%; }
    .form-actions { justify-content: stretch; }
    .form-actions .button { flex: 1; }
    .checklist-summary, .category-view { padding-right: 18px; padding-left: 18px; }
    .category-view-title { align-items: flex-start; flex-direction: column; gap: 3px; }
}
