:root {
    --bg: #f6efe5;
    --bg-accent: radial-gradient(circle at top left, rgba(225, 123, 72, 0.25), transparent 36%),
        radial-gradient(circle at top right, rgba(84, 120, 91, 0.18), transparent 28%),
        linear-gradient(180deg, #f9f3ea 0%, #f3eadf 100%);
    --panel: rgba(255, 251, 247, 0.92);
    --panel-strong: rgba(255, 248, 241, 0.98);
    --border: rgba(117, 84, 57, 0.16);
    --text: #2f241e;
    --muted: #6d5b4e;
    --accent: #c55b2c;
    --accent-deep: #8f3d18;
    --accent-soft: rgba(197, 91, 44, 0.12);
    --sage: #5f7b63;
    --sage-soft: rgba(95, 123, 99, 0.14);
    --shadow: 0 20px 55px rgba(81, 51, 31, 0.12);
    --radius-lg: 28px;
    --radius-md: 18px;
    --radius-sm: 12px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Manrope", sans-serif;
    color: var(--text);
    background: var(--bg-accent);
}

button,
textarea,
input {
    font: inherit;
}

.page-shell {
    width: min(1180px, calc(100% - 32px));
    margin: 0 auto;
    padding: 32px 0 44px;
}

.hero {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.95fr);
    gap: 24px;
    margin-bottom: 24px;
}

.hero-copy,
.note-card,
.panel {
    backdrop-filter: blur(8px);
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.hero-copy {
    border-radius: var(--radius-lg);
    padding: 34px 34px 30px;
}

.hero-copy h1 {
    margin: 0;
    font-family: "Fraunces", serif;
    font-size: clamp(2.2rem, 4vw, 4rem);
    line-height: 0.98;
    max-width: 12ch;
}

.eyebrow,
.section-label,
.note-kicker,
.stat-label {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.75rem;
    font-weight: 700;
}

.eyebrow,
.section-label,
.note-kicker {
    color: var(--accent);
}

.hero-text {
    margin: 18px 0 0;
    max-width: 56ch;
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.65;
}

.hero-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
    margin-top: 26px;
}

.stat-card,
.note-card {
    border-radius: 22px;
    padding: 18px 18px 16px;
}

.stat-card {
    background: var(--panel-strong);
    border: 1px solid rgba(95, 123, 99, 0.12);
}

.stat-label {
    display: block;
    margin-bottom: 8px;
    color: var(--sage);
}

.stat-card strong {
    font-size: 1rem;
    line-height: 1.4;
}

.hero-note {
    display: flex;
}

.note-card {
    width: 100%;
    background: linear-gradient(180deg, rgba(95, 123, 99, 0.96) 0%, rgba(65, 93, 70, 0.96) 100%);
    color: #f8f5ef;
}

.note-card ol {
    margin: 18px 0 0;
    padding-left: 20px;
    line-height: 1.7;
}

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

.panel {
    border-radius: var(--radius-lg);
    padding: 24px;
}

.panel-accent {
    background: linear-gradient(180deg, rgba(255, 247, 238, 0.98) 0%, rgba(255, 251, 247, 0.92) 100%);
}

.panel-status {
    background: linear-gradient(180deg, rgba(49, 38, 31, 0.96) 0%, rgba(34, 27, 22, 0.96) 100%);
    color: #f6eee7;
}

.panel-status-bottom {
    margin-top: 22px;
}

.panel-status .section-label,
.panel-status h2,
.panel-status .status-summary {
    color: inherit;
}

.panel-heading {
    display: flex;
    gap: 16px;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
}

.panel-heading h2 {
    margin: 4px 0 0;
    font-family: "Fraunces", serif;
    font-size: 1.6rem;
    line-height: 1.1;
}

.field-label {
    display: inline-block;
    margin-bottom: 10px;
    font-weight: 700;
    font-size: 0.95rem;
}

.text-area {
    width: 100%;
    border: 1px solid rgba(90, 69, 54, 0.16);
    border-radius: 18px;
    padding: 16px 18px;
    resize: vertical;
    background: rgba(255, 255, 255, 0.72);
    color: var(--text);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.text-area:focus,
.ingredient-input:focus {
    outline: 2px solid rgba(197, 91, 44, 0.18);
    border-color: rgba(197, 91, 44, 0.34);
}

.text-area-lg {
    min-height: 170px;
}

.helper-row,
.groups-meta {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: center;
    margin-top: 12px;
    color: var(--muted);
    font-size: 0.92rem;
}

.helper-row p,
.groups-meta {
    margin: 0;
}

.button {
    border: 0;
    border-radius: 999px;
    padding: 12px 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 140ms ease, opacity 140ms ease, box-shadow 140ms ease;
}

.button:hover:not(:disabled) {
    transform: translateY(-1px);
}

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

.button-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-deep) 100%);
    color: #fff9f5;
    box-shadow: 0 12px 24px rgba(143, 61, 24, 0.22);
}

.button-secondary {
    background: var(--sage-soft);
    color: #27412b;
}

.button-ghost {
    background: transparent;
    color: var(--accent-deep);
    border: 1px solid rgba(197, 91, 44, 0.18);
    padding: 8px 12px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 0.82rem;
    font-weight: 800;
    background: rgba(47, 36, 30, 0.08);
    color: var(--text);
}

.badge-muted {
    background: rgba(255, 255, 255, 0.12);
    color: #fff0e7;
}

.badge-success {
    background: rgba(118, 193, 146, 0.18);
    color: #bbf1cd;
}

.badge-warning {
    background: rgba(255, 211, 127, 0.18);
    color: #ffe5a7;
}

.badge-error {
    background: rgba(255, 142, 142, 0.18);
    color: #ffc8c8;
}

.status-summary {
    margin-bottom: 14px;
    color: #dfd3ca;
}

.status-log {
    margin: 0;
    min-height: 148px;
    max-height: 220px;
    overflow: auto;
    padding: 16px;
    border-radius: 18px;
    background: rgba(14, 11, 9, 0.45);
    border: 1px solid rgba(255, 255, 255, 0.07);
    color: #bdf7ce;
    line-height: 1.55;
    font-family: "Consolas", "SFMono-Regular", monospace;
    white-space: pre-wrap;
}

.groups-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 16px;
    margin-top: 18px;
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
}

.calendar-day {
    min-height: 116px;
    border: 1px solid rgba(95, 123, 99, 0.16);
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.7);
    padding: 13px;
}

.calendar-day h3 {
    margin: 0 0 10px;
    font-family: "Fraunces", serif;
    font-size: 1.05rem;
}

.calendar-recipes {
    display: grid;
    gap: 8px;
}

.calendar-recipes a,
.calendar-empty {
    display: block;
    font-size: 0.84rem;
    line-height: 1.35;
}

.calendar-recipes a {
    color: var(--accent-deep);
    font-weight: 800;
    text-decoration: none;
    overflow-wrap: anywhere;
}

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

.planner-heading {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    align-items: flex-start;
    margin-top: 20px;
}

.planner-heading h3 {
    margin: 0;
    font-family: "Fraunces", serif;
    font-size: 1.25rem;
}

.planner-heading p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

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

.recipe-plan-list {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.recipe-plan-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    gap: 12px;
    align-items: center;
    border: 1px solid rgba(90, 69, 54, 0.13);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.72);
    padding: 12px;
}

.recipe-link-text {
    display: grid;
    gap: 3px;
    min-width: 0;
}

.recipe-link-text a {
    color: var(--text);
    font-weight: 800;
    text-decoration: none;
    overflow-wrap: anywhere;
}

.recipe-link-text span {
    color: var(--muted);
    font-size: 0.78rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.day-select {
    width: 100%;
    border: 1px solid rgba(90, 69, 54, 0.16);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
    padding: 10px 12px;
    font: inherit;
    font-weight: 700;
}

.day-select:focus {
    outline: 2px solid rgba(95, 123, 99, 0.2);
    border-color: rgba(95, 123, 99, 0.34);
}

.planner-empty {
    border: 1px dashed rgba(117, 84, 57, 0.24);
    border-radius: 16px;
    color: var(--muted);
    padding: 16px;
    line-height: 1.5;
}

.group-card,
.empty-state {
    min-width: 0;
    border-radius: 22px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.76);
    padding: 18px;
}

.group-card h3 {
    margin: 0;
    font-family: "Fraunces", serif;
    font-size: 1.28rem;
}

.group-meta {
    margin: 6px 0 16px;
    color: var(--muted);
    font-size: 0.9rem;
}

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

.ingredient-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: 10px;
    min-width: 0;
}

.ingredient-input {
    min-width: 0;
    width: 100%;
    border: 1px solid rgba(90, 69, 54, 0.16);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    padding: 11px 12px;
    color: var(--text);
}

.remove-button {
    width: auto;
    white-space: nowrap;
}

.empty-state {
    min-height: 210px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: flex-start;
    background: linear-gradient(180deg, rgba(255, 248, 242, 0.9) 0%, rgba(249, 241, 233, 0.85) 100%);
}

.empty-state h3 {
    margin: 0 0 10px;
    font-family: "Fraunces", serif;
    font-size: 1.5rem;
}

.empty-state p {
    margin: 0;
    color: var(--muted);
    max-width: 42ch;
    line-height: 1.6;
}

@media (max-width: 920px) {
    .hero,
    .workspace {
        grid-template-columns: 1fr;
    }

    .calendar-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .hero-stats {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .page-shell {
        width: min(100% - 18px, 1180px);
        padding-top: 18px;
    }

    .hero-copy,
    .panel,
    .note-card {
        padding: 20px;
    }

    .panel-heading,
    .helper-row,
    .groups-meta,
    .planner-heading {
        flex-direction: column;
        align-items: flex-start;
    }

    .calendar-grid,
    .recipe-plan-row {
        grid-template-columns: 1fr;
    }

    .planner-actions {
        width: 100%;
        align-items: stretch;
        flex-direction: column;
    }

    .button {
        width: 100%;
        justify-content: center;
    }

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