:root {
    --bg: #f7f7fb;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --danger: #dc2626;
    --border: #e5e7eb;
    --success: #16a34a;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--bg);
    color: var(--text);
}

a { color: inherit; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    padding: 14px 16px;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
}
.brand { font-weight: 800; text-decoration: none; }
nav { display: flex; gap: 10px; font-size: 14px; flex-wrap: wrap; justify-content: flex-end; }
nav a { text-decoration: none; color: var(--muted); }
.container { width: min(760px, 100%); margin: 0 auto; padding: 18px 14px 80px; }
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.04);
}
h1 { font-size: 28px; margin: 0 0 14px; }
h2 { font-size: 20px; margin: 0 0 12px; }
p { color: var(--muted); line-height: 1.5; }
label { display: block; margin: 12px 0 6px; font-weight: 700; }
input, select, button, textarea {
    width: 100%;
    font: inherit;
    border-radius: 12px;
    border: 1px solid var(--border);
    padding: 13px 14px;
    background: #fff;
}
button, .btn {
    display: inline-block;
    text-align: center;
    background: var(--primary);
    color: #fff;
    border: 0;
    text-decoration: none;
    font-weight: 800;
    cursor: pointer;
    min-height: 48px;
}
button:hover, .btn:hover { background: var(--primary-dark); }
.btn.secondary { background: #111827; }
.btn.danger, button.danger { background: var(--danger); }
.grid { display: grid; gap: 12px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions > * { flex: 1; }
.small { font-size: 14px; color: var(--muted); }
.error { background: #fee2e2; color: #991b1b; padding: 12px; border-radius: 12px; }
.success { background: #dcfce7; color: #166534; padding: 12px; border-radius: 12px; }
.list-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-top: 1px solid var(--border);
}
.list-row:first-child { border-top: 0; }
.item-row {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 14px 0;
    border-top: 1px solid var(--border);
}
.item-row input[type="checkbox"] {
    width: 30px;
    height: 30px;
    padding: 0;
    accent-color: var(--success);
}
.item-row.done .item-name { text-decoration: line-through; color: var(--muted); }
.qty { color: var(--muted); font-size: 14px; }
.inline-form { display: inline; }
.inline-form button { width: auto; min-height: 38px; padding: 8px 10px; border-radius: 10px; }
.sticky-add {
    position: sticky;
    bottom: 0;
    background: rgba(247,247,251,0.96);
    padding: 12px 0 2px;
    border-top: 1px solid var(--border);
}
@media (max-width: 560px) {
    .topbar { align-items: flex-start; }
    nav { max-width: 210px; }
    h1 { font-size: 24px; }
    .actions { display: grid; }
}
