:root {
    --bg: #f5efe3;
    --surface: rgba(255, 252, 247, 0.92);
    --surface-strong: #fffaf2;
    --text: #1e1b18;
    --muted: #655c52;
    --accent: #ca5f34;
    --accent-dark: #8f3818;
    --border: rgba(101, 92, 82, 0.18);
    --shadow: 0 20px 40px rgba(73, 51, 35, 0.1);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(202, 95, 52, 0.18), transparent 25%),
        radial-gradient(circle at right, rgba(131, 164, 97, 0.14), transparent 20%),
        linear-gradient(180deg, #f8f3ea 0%, var(--bg) 100%);
}

body.modal-open {
    overflow: hidden;
}

.layout {
    width: min(1100px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 3rem 0 4rem;
    display: grid;
    gap: 1.5rem;
}

.top-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.2rem 0;
}

.brand-mark {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text);
    text-decoration: none;
}

.nav-links {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.nav-link {
    padding: 0.55rem 0.9rem;
    border-radius: 999px;
    color: var(--muted);
    text-decoration: none;
    border: 1px solid transparent;
}

.nav-link.is-active {
    color: var(--accent-dark);
    border-color: rgba(143, 56, 24, 0.18);
    background: rgba(255, 250, 242, 0.7);
}

.hero,
.panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
    backdrop-filter: blur(8px);
}

.hero {
    padding: 3rem;
}

.hero-home {
    min-height: 24rem;
    display: grid;
    align-content: center;
}

.hero-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.eyebrow {
    margin: 0 0 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.18em;
    color: var(--accent-dark);
    font-size: 0.78rem;
    font-weight: 700;
}

.hero h1,
.panel h2,
.recipe-card h3 {
    font-family: Georgia, "Times New Roman", serif;
}

.hero h1 {
    margin: 0;
    font-size: clamp(2.5rem, 4vw, 4.25rem);
    line-height: 0.95;
}

.intro,
.panel-header p,
.recipe-card li,
label {
    color: var(--muted);
}

.intro {
    max-width: 42rem;
    margin: 1rem 0 0;
    font-size: 1.05rem;
    line-height: 1.6;
}

.panel {
    padding: 1.5rem;
}

.panel-header {
    margin-bottom: 1.25rem;
}

.panel-header h2 {
    margin: 0;
    font-size: 1.6rem;
}

.panel-header p {
    margin: 0.35rem 0 0;
}

.recipe-form {
    display: grid;
    gap: 0.75rem;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background: rgba(30, 27, 24, 0.48);
    backdrop-filter: blur(6px);
    z-index: 20;
}

.modal-backdrop[data-open="true"] {
    display: flex;
}

.modal-shell {
    width: min(760px, 100%);
    max-height: calc(100vh - 2rem);
}

.modal-panel {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: 0 28px 60px rgba(30, 27, 24, 0.18);
    padding: 1.5rem;
    overflow: auto;
    max-height: inherit;
}

.modal-header {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.75rem;
    margin-top: 0.5rem;
}

.ingredient-header {
    margin-top: 0.5rem;
}

.ingredient-list {
    display: grid;
    gap: 0.75rem;
}

.ingredient-row {
    display: grid;
    grid-template-columns: minmax(120px, 180px) 1fr;
    gap: 0.75rem;
    align-items: start;
}

label {
    font-size: 0.95rem;
    font-weight: 600;
}

input,
textarea,
button {
    font: inherit;
}

input,
textarea {
    width: 100%;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface-strong);
    color: var(--text);
}

textarea {
    resize: vertical;
    min-height: 12rem;
}

input:focus,
textarea:focus {
    outline: 2px solid rgba(202, 95, 52, 0.25);
    border-color: var(--accent);
}

button {
    justify-self: start;
    margin-top: 0.5rem;
    border: 0;
    border-radius: 999px;
    padding: 0.9rem 1.35rem;
    background: linear-gradient(135deg, var(--accent) 0%, #e18b57 100%);
    color: white;
    font-weight: 700;
    cursor: pointer;
}

.button-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    padding: 0.9rem 1.35rem;
    background: linear-gradient(135deg, var(--accent) 0%, #e18b57 100%);
    color: white;
    font-weight: 700;
    text-decoration: none;
}

.button-link-secondary {
    background: transparent;
    color: var(--accent-dark);
    border: 1px solid rgba(143, 56, 24, 0.22);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.button-secondary {
    margin-top: 0;
    background: transparent;
    color: var(--accent-dark);
    border: 1px solid rgba(143, 56, 24, 0.22);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35);
}

.button-icon {
    margin-top: 0;
    padding: 0.55rem 0.9rem;
    background: transparent;
    color: var(--muted);
    border: 1px solid var(--border);
    box-shadow: none;
}

.field-error {
    margin: -0.2rem 0 0;
    color: #a22f2f;
    font-size: 0.92rem;
}

.alert.success {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    background: rgba(131, 164, 97, 0.16);
    color: #355623;
}

.alert.error {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 14px;
    background: rgba(162, 47, 47, 0.12);
    color: #7d2020;
}

.feature-strip {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.feature-card {
    padding: 1.2rem;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--surface-strong);
}

.feature-card h2 {
    margin: 0.2rem 0 0.5rem;
    font-size: 1.3rem;
}

.feature-card p {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.feature-label {
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--accent-dark);
}

.recipe-list {
    display: grid;
    gap: 0.85rem;
}

.recipe-item {
    border: 1px solid var(--border);
    border-radius: 18px;
    background: var(--surface-strong);
    overflow: hidden;
}

.recipe-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    list-style: none;
    cursor: pointer;
    padding: 1rem 1.2rem;
}

.recipe-summary::-webkit-details-marker {
    display: none;
}

.recipe-title {
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.2rem;
    font-weight: 700;
}

.recipe-meta {
    color: var(--muted);
    font-size: 0.95rem;
    white-space: nowrap;
}

.recipe-item[open] .recipe-summary {
    border-bottom: 1px solid var(--border);
    background: rgba(202, 95, 52, 0.05);
}

.recipe-item-body {
    padding: 1rem 1.2rem 1.2rem;
}

.recipe-item-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.9rem;
}

.recipe-item-actions p {
    margin: 0;
    color: var(--muted);
    font-weight: 600;
}

.recipe-item-buttons {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.button-inline {
    padding: 0.55rem 0.9rem;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.button-danger {
    margin-top: 0;
    padding: 0.55rem 0.9rem;
    background: transparent;
    color: #8d2222;
    border: 1px solid rgba(141, 34, 34, 0.22);
    box-shadow: none;
}

.recipe-ingredients {
    margin: 0;
    padding-left: 1.2rem;
}

.recipe-ingredients li + li {
    margin-top: 0.35rem;
}

.ingredient-quantity {
    margin-right: 0.45rem;
    font-weight: 700;
    color: var(--accent-dark);
}

.planner-header {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.planner-header h2 {
    margin: 0;
    font-size: 1.6rem;
}

.planner-header p {
    margin: 0.35rem 0 0;
    color: var(--muted);
}

.week-nav {
    display: flex;
    gap: 0.75rem;
}

.planner-empty {
    padding: 1rem;
    border-radius: 16px;
    background: var(--surface-strong);
    color: var(--muted);
    border: 1px solid var(--border);
}

.shopping-empty {
    padding: 1rem;
    border-radius: 16px;
    background: var(--surface-strong);
    color: var(--muted);
    border: 1px solid var(--border);
}

.planner-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.9rem;
}

.planner-day {
    padding: 1.2rem;
    border-radius: 18px;
    border: 1px solid var(--border);
    background: var(--surface-strong);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
    display: grid;
    gap: 1rem;
    grid-template-columns: minmax(180px, 220px) minmax(0, 1fr);
    align-items: start;
}

.planner-day-header {
    display: flex;
    flex-direction: column;
    align-items: start;
    gap: 0.75rem;
}

.planner-day-header h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.45rem;
}

.planner-day-label {
    margin: 0 0 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--accent-dark);
}

.planner-day-count {
    padding: 0.4rem 0.7rem;
    border-radius: 999px;
    background: rgba(202, 95, 52, 0.1);
    color: var(--accent-dark);
    font-size: 0.88rem;
    font-weight: 700;
}

.planner-form {
    display: grid;
    gap: 0.9rem;
}

.planner-form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: center;
}

.planner-search {
    position: relative;
}

select {
    width: 100%;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    font: inherit;
}

select:focus {
    outline: 2px solid rgba(202, 95, 52, 0.25);
    border-color: var(--accent);
}

.planner-recipe-search {
    background: var(--surface);
}

.planner-day-empty {
    margin: 0;
    padding: 0.95rem 1rem;
    border-radius: 14px;
    background: rgba(101, 92, 82, 0.06);
    color: var(--muted);
}

.planned-meals {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.65rem;
}

.planner-day-body {
    display: grid;
    gap: 0.9rem;
}

.planned-meal {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(202, 95, 52, 0.09) 0%, rgba(202, 95, 52, 0.04) 100%);
    border: 1px solid rgba(202, 95, 52, 0.12);
}

.planned-meal-copy {
    display: grid;
    gap: 0.18rem;
}

.planned-meal-name {
    font-weight: 700;
}

.planned-meal-meta {
    color: var(--muted);
    font-size: 0.85rem;
}

.shopping-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.8rem;
}

.shopping-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: 0.9rem;
    padding: 0.95rem 1rem;
    border-radius: 18px;
    border: 1px solid rgba(101, 92, 82, 0.14);
    background: linear-gradient(180deg, rgba(255, 250, 242, 0.95) 0%, rgba(255, 248, 238, 0.88) 100%);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75);
}

.shopping-check-form {
    margin: 0;
}

.shopping-check {
    display: inline-flex;
    align-items: center;
    cursor: pointer;
    margin-top: 0;
}

.shopping-check input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.shopping-check-indicator {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 0.35rem;
    border: 1px solid rgba(101, 92, 82, 0.32);
    background: white;
    display: inline-block;
    position: relative;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.shopping-check input:checked + .shopping-check-indicator {
    background: var(--accent);
    border-color: var(--accent);
}

.shopping-check input:checked + .shopping-check-indicator::after {
    content: "";
    position: absolute;
    left: 0.42rem;
    top: 0.15rem;
    width: 0.3rem;
    height: 0.66rem;
    border: solid white;
    border-width: 0 0.14rem 0.14rem 0;
    transform: rotate(45deg);
}

.shopping-item-content {
    display: grid;
    gap: 0.28rem;
    min-width: 0;
}

.shopping-item-main {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.shopping-item-main h3 {
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 1.2rem;
    line-height: 1.1;
}

.shopping-item-quantity,
.shopping-item-recipes {
    margin: 0;
    color: var(--muted);
}

.shopping-item-quantity {
    flex-shrink: 0;
    padding: 0.2rem 0.55rem;
    border-radius: 999px;
    background: rgba(202, 95, 52, 0.08);
    color: var(--accent-dark);
    font-size: 0.88rem;
    font-weight: 700;
}

.shopping-item-recipes {
    font-size: 0.92rem;
    line-height: 1.4;
}

.is-checked {
    text-decoration: line-through;
    opacity: 0.65;
}

.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: 700px) {
    .layout {
        width: min(100% - 1rem, 100%);
        padding-top: 1rem;
        padding-bottom: 2rem;
    }

    .hero,
    .panel {
        border-radius: 20px;
    }

    .top-nav,
    .nav-links,
    .hero-actions,
    .feature-strip,
    .planner-header,
    .week-nav,
    .planned-meal,
    .planner-day-header,
    .planner-form-row,
    .planner-day,
    .shopping-item {
        display: grid;
    }

    .shopping-item-main {
        display: grid;
        gap: 0.45rem;
    }

    .hero {
        padding: 2rem 1.25rem;
    }

    .panel {
        padding: 1.25rem;
    }

    .ingredient-header,
    .ingredient-row,
    .recipe-summary,
    .recipe-item-actions {
        grid-template-columns: 1fr;
    }

    .ingredient-header {
        align-items: stretch;
    }

    .recipe-summary,
    .recipe-item-actions {
        display: grid;
    }

    .modal-panel {
        padding: 1.25rem;
        border-radius: 20px;
    }

    .modal-header,
    .modal-actions {
        display: grid;
    }

    .nav-link,
    .button-link {
        text-align: center;
    }

    .button-secondary,
    button {
        width: 100%;
        justify-self: stretch;
    }
}
