:root {
    --bg: #f6f5ef;
    --surface: #ffffff;
    --surface-soft: #f0efe8;
    --text: #252621;
    --muted: #6d7067;
    --border: #ddded7;
    --primary: #557a3e;
    --primary-dark: #3f612d;
    --danger: #a53a35;
    --shadow: 0 8px 28px rgba(25, 32, 20, .07);
    --radius: 18px;
}

* { box-sizing: border-box; }

html { color-scheme: light; }

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

button, input, textarea { font: inherit; }

button { cursor: pointer; }

.shell {
    width: min(1120px, calc(100% - 32px));
    margin-inline: auto;
}

.site-header {
    padding: 30px 0 24px;
}

.header-inner,
.panel-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

h1, h2, h3, p { margin-top: 0; }

h1 {
    margin-bottom: 0;
    font-size: clamp(1.9rem, 4vw, 3rem);
    letter-spacing: -.045em;
}

h2 {
    margin-bottom: 6px;
    font-size: clamp(1.3rem, 2.5vw, 1.85rem);
    letter-spacing: -.025em;
}

.eyebrow {
    margin-bottom: 4px;
    color: var(--primary);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.muted { color: var(--muted); }

.toolbar { margin-bottom: 18px; }

.tabs {
    display: inline-flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--surface);
}

.tab {
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--muted);
    padding: 10px 16px;
    font-weight: 700;
}

.tab.is-active {
    background: var(--text);
    color: white;
}

.panel {
    margin-bottom: 60px;
    padding: 26px;
    border: 1px solid var(--border);
    border-radius: 24px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.hidden { display: none !important; }

.button {
    min-height: 42px;
    border: 1px solid transparent;
    border-radius: 12px;
    padding: 9px 14px;
    font-weight: 750;
}

.button-primary {
    background: var(--primary);
    color: white;
}

.button-primary:hover { background: var(--primary-dark); }

.button-secondary {
    border-color: var(--border);
    background: var(--surface-soft);
    color: var(--text);
}

.button-ghost {
    border-color: var(--border);
    background: white;
    color: var(--text);
}

.button:disabled {
    cursor: not-allowed;
    opacity: .55;
}

.search input {
    width: min(340px, 72vw);
    border: 1px solid var(--border);
    border-radius: 14px;
    background: var(--surface-soft);
    padding: 11px 14px;
    outline: none;
}

.search input:focus,
dialog input:focus,
dialog textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(85, 122, 62, .14);
}

.status-line {
    min-height: 28px;
    margin: 16px 0 10px;
    color: var(--muted);
    font-size: .93rem;
}

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

.dish-card,
.suggestion-card {
    display: flex;
    min-height: 150px;
    flex-direction: column;
    justify-content: space-between;
    gap: 18px;
    padding: 18px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: #fff;
}

.dish-name,
.suggestion-name {
    margin-bottom: 8px;
    font-size: 1.04rem;
    line-height: 1.35;
}

.dish-notes {
    margin-bottom: 0;
    color: var(--muted);
    font-size: .92rem;
    white-space: pre-wrap;
}

.dish-notes:empty { display: none; }

.dish-actions {
    display: flex;
    gap: 14px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
}

.button-link {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--primary-dark);
    font-weight: 750;
}

.button-link.danger { color: var(--danger); }

.pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-top: 24px;
}

.page-button {
    min-width: 40px;
    min-height: 40px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: white;
}

.page-button.is-active {
    border-color: var(--text);
    background: var(--text);
    color: white;
}

.page-button:disabled { opacity: .4; }

.suggestion-group + .suggestion-group { margin-top: 28px; }

.group-title {
    display: flex;
    align-items: center;
    gap: 9px;
    margin-bottom: 12px;
}

.group-title::after {
    content: "";
    height: 1px;
    flex: 1;
    background: var(--border);
}

.suggestion-meta {
    margin-bottom: 4px;
    color: var(--muted);
    font-size: .78rem;
    font-weight: 750;
    text-transform: uppercase;
}

.favorite-badge {
    display: inline-flex;
    align-items: center;
    align-self: flex-start;
    border-radius: 999px;
    background: #e8f2e2;
    color: #3d6628;
    padding: 7px 10px;
    font-size: .85rem;
    font-weight: 800;
}

.empty {
    grid-column: 1 / -1;
    padding: 42px 16px;
    color: var(--muted);
    text-align: center;
}

.alert {
    margin-bottom: 18px;
    padding: 14px 16px;
    border-radius: 12px;
}

.alert-error {
    background: #fdebea;
    color: #7c2521;
}

dialog {
    width: min(520px, calc(100% - 28px));
    border: 0;
    border-radius: 20px;
    padding: 0;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .25);
}

dialog::backdrop {
    background: rgba(22, 26, 20, .52);
}

dialog form { padding: 24px; }

.dialog-heading,
.dialog-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.dialog-heading { margin-bottom: 20px; }
.dialog-heading h2 { margin-bottom: 0; }
.dialog-actions { justify-content: flex-end; margin-top: 22px; }

.icon-button {
    width: 38px;
    height: 38px;
    border: 0;
    border-radius: 50%;
    background: var(--surface-soft);
    font-size: 1.4rem;
}

dialog label {
    display: grid;
    gap: 7px;
    margin-top: 14px;
    font-weight: 700;
}

dialog small {
    color: var(--muted);
    font-weight: 500;
}

dialog input,
dialog textarea {
    width: 100%;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 11px 12px;
    outline: none;
    resize: vertical;
}

.form-error {
    min-height: 24px;
    margin-top: 10px;
    color: var(--danger);
    font-size: .9rem;
}

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

@media (max-width: 860px) {
    .dish-grid,
    .suggestion-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 620px) {
    .shell { width: min(100% - 20px, 1120px); }

    .site-header { padding-top: 20px; }

    .header-inner,
    .panel-heading {
        align-items: stretch;
        flex-direction: column;
    }

    .header-inner .button { align-self: flex-start; }

    .panel { padding: 18px; }

    .tabs {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
        border-radius: 16px;
    }

    .tab { border-radius: 12px; }

    .search,
    .search input {
        width: 100%;
    }

    .dish-grid,
    .suggestion-grid {
        grid-template-columns: 1fr;
    }
}
