:root {
    --bg: #f4efe6;
    --surface: rgba(255, 252, 247, 0.88);
    --surface-strong: #fffaf2;
    --text: #2e2a25;
    --muted: #6e6457;
    --accent: #1d6b57;
    --accent-soft: #d8ede6;
    --line: rgba(46, 42, 37, 0.08);
    --shadow: 0 18px 60px rgba(58, 39, 23, 0.08);
}

* {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Avenir Next", "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(255, 255, 255, 0.65), transparent 32rem),
        linear-gradient(180deg, #efe7d9 0%, #f8f3eb 48%, #f3eee4 100%);
}

button,
input,
select,
textarea {
    font: inherit;
}

.app-shell {
    width: min(1120px, calc(100% - 2rem));
    margin: 0 auto;
    padding: 1.25rem 0 3rem;
}

.page-header {
    margin-bottom: 0.5rem;
}

.page-header-main {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.page-heading {
    display: grid;
    gap: 0.2rem;
    padding-top: 0.1rem;
}

.page-heading h1 {
    margin: 0;
    font-size: 1.45rem;
    line-height: 1.1;
}

.page-heading p {
    margin: 0;
    color: var(--muted);
    line-height: 1.45;
}

.page-header-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--line);
}

.plan-toolbar-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-left: auto;
}

.week-nav {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.18rem;
    border-radius: 999px;
    background: rgba(46, 42, 37, 0.045);
}

.week-nav-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border-radius: 999px;
    color: var(--muted);
    text-decoration: none;
}

.week-nav-button:hover {
    background: rgba(29, 107, 87, 0.08);
    color: var(--accent);
}

.week-nav-label {
    min-width: 7.4rem;
    text-align: center;
    color: var(--text);
    font-size: 0.9rem;
}

.menu-toggle {
    display: grid;
    gap: 0.3rem;
    width: 2.5rem;
    height: 2.5rem;
    padding: 0.55rem;
    border: 0;
    border-radius: 0.85rem;
    background: var(--accent-soft);
}

.menu-toggle span {
    display: block;
    width: 100%;
    height: 2px;
    border-radius: 999px;
    background: var(--accent);
}

.drawer {
    position: fixed;
    z-index: 30;
    inset: 4.1rem auto auto 1rem;
    width: min(18rem, calc(100vw - 2rem));
    padding: 0.85rem;
    border: 1px solid var(--line);
    border-radius: 1.15rem;
    background: rgba(255, 250, 242, 0.96);
    box-shadow: var(--shadow);
    transform: translateX(-120%);
    transition: transform 180ms ease;
}

.drawer.is-open {
    transform: translateX(0);
}

.drawer nav {
    display: grid;
    gap: 0.5rem;
}

.nav-group {
    display: grid;
    gap: 0.35rem;
}

.nav-group summary {
    list-style: none;
}

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

.nav-link {
    display: flex;
    align-items: center;
    gap: 0.62rem;
    padding: 0.7rem 0.85rem;
    border-radius: 0.85rem;
    color: var(--text);
    text-decoration: none;
}

.nav-summary {
    cursor: pointer;
}

.nav-summary-marker {
    display: none;
}

.nav-link img {
    display: block;
    width: 1.12rem;
    height: 1.12rem;
    object-fit: contain;
    opacity: 0.62;
    transition: opacity 140ms ease;
}

.nav-link.is-active,
.nav-link:hover,
.nav-group.is-active > .nav-summary {
    background: var(--accent-soft);
    color: var(--accent);
}

.nav-link.is-active img,
.nav-link:hover img,
.nav-group.is-active > .nav-summary img {
    opacity: 0.92;
}

.nav-submenu {
    display: grid;
    gap: 0.25rem;
    margin-left: 0.85rem;
    margin-bottom: -0.35rem;
    padding-left: 0.7rem;
    border-left: 1px solid rgba(46, 42, 37, 0.08);
}

.nav-sublink {
    padding: 0.55rem 0.7rem;
    font-size: 0.92rem;
}

.nav-sublink img {
    width: 1rem;
    height: 1rem;
}

.content {
    display: grid;
    gap: 1rem;
}

.session-strip {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 0.8rem;
    color: var(--muted);
    font-size: 0.86rem;
}

.session-item {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    line-height: 1;
}

.session-item img {
    display: block;
    width: 0.95rem;
    height: 0.95rem;
    object-fit: contain;
    opacity: 0.58;
}

.session-household strong {
    color: var(--text);
    font-weight: 700;
}

.session-user {
    font-weight: 400;
}

.session-logout-form {
    margin: 0;
}

.session-logout-button {
    display: inline-flex;
    align-items: center;
    gap: 0.32rem;
    padding: 0.28rem 0.48rem;
    border: 0;
    border-radius: 999px;
    background: rgba(46, 42, 37, 0.045);
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease;
}

.session-logout-button img {
    display: block;
    width: 0.9rem;
    height: 0.9rem;
    object-fit: contain;
    opacity: 0.58;
}

.session-logout-button:hover {
    background: rgba(29, 107, 87, 0.08);
    color: var(--accent);
}

.auth-shell {
    min-height: calc(100vh - 4rem);
    display: grid;
    place-items: center;
    padding: 2rem 0;
}

.auth-panel {
    width: min(28rem, 100%);
}

.auth-heading {
    display: grid;
    gap: 0.45rem;
    margin-bottom: 1.2rem;
}

.auth-heading h1 {
    margin: 0;
    font-size: 1.75rem;
    line-height: 1.1;
}

.auth-form {
    display: grid;
    gap: 1rem;
}

.auth-message {
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border-radius: 0.9rem;
    background: rgba(143, 75, 55, 0.12);
    color: #7d3425;
}

.auth-switch {
    margin-top: 1rem !important;
}

.invite-form {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: end;
}

.header-invite-form {
    width: 100%;
}

.header-invite-form .field {
    min-width: min(18rem, 100%);
}

.header-rule-form {
    width: 100%;
}

.header-rule-form .checkbox-field {
    padding-top: 0;
    align-self: center;
}

.header-rule-form .button {
    align-self: end;
}

.invite-link-field {
    margin-top: 1rem;
}

.invite-link-field input {
    cursor: text;
}

.member-card .badge {
    background: #efe7da;
    color: var(--muted);
}

.section-title {
    margin: 0 0 -0.25rem;
    padding-inline: 0.35rem;
    font-size: 1rem;
}

.plan-list,
.stack {
    display: grid;
    gap: 1rem;
}

.plan-list {
    position: relative;
    padding: 0.35rem;
    border-radius: 1.75rem;
    background: transparent;
}

.plan-list.is-empty-week {
    gap: 0;
}

.panel.past-stack-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    margin: 0.1rem 0 0.35rem;
    padding: 0.82rem 1rem;
    overflow: visible;
    color: var(--text);
    text-align: left;
    cursor: pointer;
    isolation: isolate;
    transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
}

.past-stack-toggle::before,
.past-stack-toggle::after {
    content: "";
    position: absolute;
    inset: 0.18rem 0.8rem -0.18rem;
    z-index: -1;
    border: 1px solid rgba(46, 42, 37, 0.045);
    border-radius: inherit;
    background: rgba(255, 252, 247, 0.48);
    transform: translateY(0.22rem) scale(0.985);
}

.past-stack-toggle::after {
    inset: 0.38rem 1.4rem -0.38rem;
    opacity: 0.75;
    transform: translateY(0.42rem) scale(0.965);
}

.past-stack-toggle:hover {
    border-color: rgba(29, 107, 87, 0.16);
    background: rgba(255, 252, 247, 0.96);
}

.past-stack-copy {
    display: block;
}

.past-stack-copy span {
    color: var(--muted);
    font-size: 0.82rem;
    line-height: 1.2;
}

.past-stack-indicator {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 999px;
    color: rgba(46, 42, 37, 0.48);
    background: rgba(46, 42, 37, 0.045);
    font-size: 1.05rem;
    line-height: 1;
    transition: background 140ms ease, color 140ms ease, transform 160ms ease;
}

.past-stack-toggle:hover .past-stack-indicator {
    color: var(--accent);
    background: rgba(29, 107, 87, 0.08);
}

.plan-list.is-past-expanded .past-stack-toggle::before,
.plan-list.is-past-expanded .past-stack-toggle::after {
    opacity: 0;
}

.plan-list.is-past-expanded .past-stack-indicator {
    transform: rotate(180deg);
}

.plan-list.has-past-stack:not(.is-past-expanded) .plan-row.is-past {
    display: none;
}

.panel {
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: 1.5rem;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.list-head,
.actions,
.meta-row {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 1rem;
}

.form-panel form,
.form-panel form {
    display: grid;
    gap: 1rem;
}

.form-intro {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.rule-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    align-items: end;
    gap: 1rem;
}

.rule-edit-form .list-head,
.rule-edit-form p,
.rule-edit-form .form-actions {
    grid-column: 1 / -1;
}

.rule-card.is-inactive {
    opacity: 0.66;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
}

.day-card h4,
.panel h2,
.panel h3 {
    margin: 0 0 0.35rem;
}

.day-label,
.day-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

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

.button,
.chip,
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: fit-content;
    padding: 0.7rem 1rem;
    border-radius: 999px;
    border: 1px solid transparent;
    background: #ece4d8;
    color: var(--text);
    text-decoration: none;
}

.button.primary {
    background: var(--accent);
    color: #fff;
}

.button.subtle {
    background: #efe7da;
    color: var(--text);
}

.button.is-active {
    background: var(--accent);
    color: #fff;
}

.button.small {
    padding: 0.5rem 0.85rem;
    font-size: 0.84rem;
}

.icon-button {
    gap: 0.42rem;
}

.icon-button img {
    display: block;
    width: 1rem;
    height: 1rem;
    object-fit: contain;
}

.chip,
.badge {
    padding: 0.45rem 0.8rem;
    background: var(--accent-soft);
    color: var(--accent);
}

.chip {
    padding: 0.35rem 0.7rem;
    font-size: 0.82rem;
}

.card-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: 0.15rem;
}

.dish-list-card {
    display: grid;
    gap: 0.85rem;
    color: inherit;
    text-decoration: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.dish-list-card:hover {
    border-color: rgba(29, 107, 87, 0.18);
    box-shadow: 0 22px 70px rgba(58, 39, 23, 0.1);
    transform: translateY(-1px);
}

.dish-list-card h3,
.dish-list-card p {
    text-decoration: none;
}

.dish-list-card h3 {
    color: var(--text);
}

.dish-name {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 500;
    line-height: 1.08;
}

.plan-row .dish-name {
    display: flex;
    align-items: center;
    margin: 0;
    min-height: 2.35rem;
    transform: none;
}

.recipe-preview {
    font-size: 0.94rem;
}

.plan-row .recipe-preview {
    display: none;
}

.dish-meta-line {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.52rem;
    width: fit-content;
    max-width: 100%;
}

.meta-group {
    display: inline-flex;
    align-items: center;
    min-height: 1.62rem;
    padding: 0.2rem 0.42rem;
    border: 1px solid rgba(46, 42, 37, 0.12);
    border-radius: 999px;
    background: rgba(255, 252, 246, 0.56);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.diet-icons {
    gap: 0.28rem;
}

.season-symbol,
.diet-symbol {
    position: relative;
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border-radius: 999px;
    border: 1px solid rgba(46, 42, 37, 0.12);
    background: rgba(46, 42, 37, 0.055);
}

.season-symbol::after,
.diet-symbol::after {
    content: "";
    position: absolute;
    inset: 0.32rem;
    border-radius: 999px;
    background: rgba(46, 42, 37, 0.34);
}

.season-symbol.is-active {
    border-color: rgba(29, 107, 87, 0.24);
    background: rgba(216, 237, 230, 0.86);
}

.season-symbol.is-active::after {
    background: var(--accent);
}

.diet-symbol.diet-vegetarian::after {
    inset: 0.3rem;
    border-radius: 0.16rem;
}

.diet-symbol.diet-meat::after {
    inset: auto 0.24rem;
    top: 50%;
    height: 0.22rem;
    transform: translateY(-50%);
}

.diet-symbol.diet-vegan.is-active {
    border-color: rgba(47, 138, 95, 0.28);
    background: rgba(216, 237, 230, 0.9);
}

.diet-symbol.diet-vegan.is-active::after {
    background: #2f8a5f;
}

.diet-symbol.diet-vegetarian.is-active {
    border-color: rgba(122, 168, 79, 0.3);
    background: rgba(231, 240, 217, 0.9);
}

.diet-symbol.diet-vegetarian.is-active::after {
    background: #7aa84f;
}

.diet-symbol.diet-meat.is-active {
    border-color: rgba(143, 75, 55, 0.28);
    background: rgba(241, 224, 217, 0.92);
}

.diet-symbol.diet-meat.is-active::after {
    background: #8f4b37;
}

.rating-icons {
    display: inline-flex;
    align-items: center;
    gap: 0.22rem;
}

.svg-icon-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2rem;
    height: 2rem;
    border: 1px solid rgba(46, 42, 37, 0.11);
    border-radius: 0.75rem;
    background: rgba(46, 42, 37, 0.04);
}

.svg-icon-pill.is-active {
    border-color: rgba(29, 107, 87, 0.22);
    background: rgba(255, 252, 246, 0.9);
}

.svg-icon-pill.effort-active {
    border-color: rgba(29, 107, 87, 0.22);
    background: rgba(255, 252, 246, 0.9);
}

.svg-icon-pill img {
    display: block;
    width: 1.15rem;
    height: 1.15rem;
    object-fit: contain;
    opacity: 0.28;
    filter: grayscale(1) brightness(0.45);
}

.svg-icon-pill.is-active img {
    opacity: 0.95;
    filter: brightness(0) saturate(100%) invert(31%) sepia(20%) saturate(1299%) hue-rotate(116deg) brightness(93%) contrast(89%);
}

.planning-meta {
    display: inline-flex;
    align-items: center;
    gap: 0.52rem;
    width: fit-content;
    margin-left: 0;
    vertical-align: middle;
}

.season-icons,
.effort-bars,
.effort-icons {
    gap: 0.28rem;
}

.effort-bars {
    gap: 0.18rem;
}

.effort-bar {
    width: 0.78rem;
    height: 0.28rem;
    border-radius: 999px;
    background: rgba(46, 42, 37, 0.14);
}

.effort-bar.is-active {
    background: var(--accent);
}

.plan-row {
    position: relative;
    overflow: visible;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0 0.85rem;
    padding-block: 0.65rem;
    transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
    cursor: pointer;
}

.slot-date {
    display: grid;
    justify-self: center;
    align-self: center;
    place-items: center;
    width: 3.7rem;
    min-width: 3.7rem;
}

.date-core {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 3.35rem;
    min-height: 2.65rem;
    padding: 0.18rem 0.16rem 0.14rem;
    border-radius: 0.85rem;
    text-align: center;
}

.date-order-stack {
    display: grid;
    grid-template-rows: 1fr 1fr;
    align-self: center;
    align-content: center;
    gap: 0.1rem;
    width: 1.45rem;
    margin-right: 0.55rem;
}

.date-order-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.35rem;
    height: 1.22rem;
    min-height: 1.22rem;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: rgba(46, 42, 37, 0.42);
    font-size: 0.42rem;
    line-height: 1;
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.date-order-button:not(:disabled):hover {
    color: var(--accent);
    background: rgba(29, 107, 87, 0.08);
}

.date-order-button:not(:disabled):active {
    transform: scale(0.96);
}

.date-order-button:disabled {
    opacity: 0.22;
    cursor: default;
}

.plan-row.is-past .date-order-stack,
.plan-row.is-past .date-order-button {
    display: none !important;
}

.plan-row.is-past .date-core {
    grid-column: auto;
}

.slot-weekday,
.slot-date-value {
    display: block;
    width: 100%;
    margin: 0;
    text-transform: uppercase;
    text-align: center;
    color: var(--muted);
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    font-feature-settings: "tnum";
    user-select: none;
}

.slot-weekday {
    letter-spacing: 0.04em;
    font-size: 1.12rem;
    font-weight: 500;
    line-height: 0.95;
}

.slot-date-value {
    margin-top: 0.18rem;
    letter-spacing: 0.02em;
    font-size: 0.68rem;
    line-height: 1;
}

.slot-body {
    position: relative;
    z-index: 1;
    display: flex;
    min-height: 2.35rem;
    align-self: center;
    align-items: center;
    min-width: 0;
}

.plan-row .slot-body,
.plan-row .slot-body * {
    color: inherit !important;
    text-decoration: none !important;
}

.plan-row .slot-body .swap-select {
    color: var(--text) !important;
}

.slot-body.is-clickable {
    cursor: pointer;
}

.slot-body[aria-disabled="true"] {
    pointer-events: none;
}

.slot-actions {
    display: flex;
    align-self: stretch;
    margin-block: -0.65rem;
    align-items: center;
    justify-content: flex-end;
    gap: 0.18rem;
}

.plan-row.is-past {
    padding-block: 0.65rem;
    opacity: 0.54;
}

.plan-row.is-locked:not(.is-past) {
    border-color: rgba(29, 107, 87, 0.16);
}

.plan-row:has(.detail-control) {
    padding-right: 0;
}

.plan-row.is-past .dish-name {
    font-size: 1.05rem;
}

.plan-row.is-past .recipe-preview,
.plan-row.is-past .slot-actions,
.plan-row.is-past .plan-details {
    display: none;
}

.detail-control {
    display: flex;
    align-self: stretch;
    width: 2.35rem;
    min-height: 100%;
    overflow: hidden;
    background: transparent;
}

.detail-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    cursor: pointer;
    transition: opacity 140ms ease;
}

.detail-toggle::before {
    content: "";
    position: absolute;
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 999px;
    background: transparent;
    transition: background 140ms ease, transform 140ms ease;
}

.detail-toggle img {
    position: relative;
    z-index: 1;
    display: block;
    width: 1.35rem;
    height: 1.35rem;
    object-fit: contain;
    opacity: 0.54;
}

.detail-toggle:hover::before {
    background: rgba(29, 107, 87, 0.045);
    transform: scale(1.04);
}

.detail-toggle[aria-expanded="true"] img {
    opacity: 0.88;
}

.plan-details {
    grid-column: 1 / -1;
    margin-top: 0.75rem;
    padding: 0.95rem 0.95rem 0.1rem;
    border-top: 1px solid rgba(46, 42, 37, 0.08);
    cursor: default;
}

.plan-details[hidden] {
    display: none;
}

.details-table {
    display: grid;
    gap: 0.55rem;
}

.details-row {
    display: grid;
    grid-template-columns: minmax(6.5rem, 0.34fr) minmax(0, 1fr);
    align-items: center;
    gap: 0.85rem;
    padding: 0.6rem 0.7rem;
    border: 1px solid rgba(46, 42, 37, 0.08);
    border-radius: 1rem;
    background: rgba(255, 252, 246, 0.58);
}

.details-label {
    font-size: 0.73rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.details-value {
    min-width: 0;
}

.details-icons {
    display: inline-flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.32rem;
}

.details-muted,
.details-text {
    color: var(--muted);
    font-size: 0.9rem;
    line-height: 1.45;
}

.details-text {
    color: var(--text);
}

.pin-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.1rem;
    padding: 0.45rem 0.8rem;
    border: 1px solid rgba(46, 42, 37, 0.1);
    border-radius: 999px;
    background: rgba(46, 42, 37, 0.04);
    color: var(--muted);
    font: inherit;
    font-size: 0.9rem;
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.pin-toggle:hover {
    border-color: rgba(29, 107, 87, 0.24);
    background: rgba(29, 107, 87, 0.08);
    color: var(--accent);
}

.pin-toggle.is-active {
    border-color: rgba(29, 107, 87, 0.28);
    background: rgba(29, 107, 87, 0.12);
    color: var(--accent);
    font-weight: 700;
}

.swap-select {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 1px solid rgba(46, 42, 37, 0.12);
    border-radius: 0.8rem;
    background: rgba(255, 252, 246, 0.82);
    color: var(--text);
}

.swap-search {
    position: relative;
    display: block;
    width: 100%;
}

.swap-search-input {
    width: 100%;
    padding: 0.7rem 0.8rem;
    border: 1px solid rgba(46, 42, 37, 0.12);
    border-radius: 0.8rem;
    background: rgba(255, 252, 246, 0.82);
    color: var(--text);
}

.swap-suggestion-popover {
    position: absolute;
    z-index: 24;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    display: grid;
    gap: 0.25rem;
    max-height: 18rem;
    overflow-y: auto;
    padding: 0.45rem;
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.swap-suggestion {
    display: grid;
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.swap-suggestion:hover {
    background: var(--accent-soft);
    color: var(--accent);
}

.swap-suggestion-empty {
    display: block;
    padding: 0.55rem 0.65rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.empty-week-panel {
    display: grid;
    gap: 0.35rem;
    min-height: 8rem;
    align-content: center;
}

.empty-week-panel h3 {
    margin: 0;
}

.dish-detail-panel,
.dish-detail-content {
    display: grid;
    gap: 1rem;
}

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

.dish-detail-header h2 {
    margin: 0.2rem 0 0;
}

.dish-detail-section {
    display: grid;
    gap: 0.45rem;
    padding-top: 0.25rem;
}

.dish-detail-text {
    white-space: pre-wrap;
}

.compact-stack {
    gap: 0.75rem;
}

.history-entry {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: rgba(255, 250, 242, 0.72);
}

.history-panel {
    padding: 0.75rem;
}

.history-list {
    display: grid;
}

.history-row {
    display: grid;
    grid-template-columns: 4.2rem minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.85rem;
    padding: 0.72rem 0.55rem;
    border-bottom: 1px solid rgba(46, 42, 37, 0.07);
}

.history-row:last-child {
    border-bottom: 0;
}

.history-date {
    color: var(--muted);
    font-size: 0.82rem;
    white-space: nowrap;
}

.history-main {
    display: grid;
    gap: 0.12rem;
    min-width: 0;
}

.history-main strong {
    font-size: 0.98rem;
    font-weight: 600;
    line-height: 1.2;
}

.history-main span {
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.35;
}

.history-rating {
    color: #aa7419;
    font-size: 0.82rem;
    white-space: nowrap;
}

.save-status {
    min-height: 1rem;
    margin: -0.35rem 0 0;
    font-size: 0.92rem;
    color: var(--muted);
}

.save-status[data-state="success"] {
    color: var(--accent);
}

.save-status[data-state="error"] {
    color: #a33f32;
}

.eyebrow {
    margin: 0 0 0.25rem;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--muted);
}

.field {
    display: grid;
    gap: 0.45rem;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    padding: 0.9rem 1rem;
    border: 1px solid var(--line);
    border-radius: 1rem;
    background: var(--surface-strong);
}

.field textarea {
    resize: vertical;
    line-height: 1.45;
}

.checkbox-field {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    padding-top: 1.8rem;
}

.checkbox-field input {
    width: auto;
}

.dish-edit-panel form {
    display: grid;
    gap: 1rem;
}

.ingredient-editor {
    display: grid;
    gap: 0.65rem;
}

.ingredient-rows {
    display: grid;
    gap: 0.55rem;
}

.ingredient-row {
    display: grid;
    grid-template-columns: minmax(5rem, 0.6fr) minmax(4.5rem, 0.5fr) minmax(12rem, 1.5fr) minmax(8rem, 1fr) auto;
    gap: 0.55rem;
    align-items: center;
}

.ingredient-remove {
    min-width: 2.35rem;
    padding-inline: 0.7rem;
}

.ingredient-add {
    justify-self: start;
}

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

.ingredient-list li {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.55rem 0;
    border-bottom: 1px solid var(--line);
}

.ingredient-list li:last-child {
    border-bottom: 0;
}

.ingredient-list strong {
    min-width: 5rem;
    color: var(--accent);
}

.ingredient-list em {
    color: var(--muted);
    font-style: normal;
}

.grocery-list-panel {
    overflow: hidden;
}

.grocery-list-panel h2 {
    margin: 0 0 0.75rem;
    font-size: 1rem;
}

.grocery-list-panel.is-pantry-check {
    background: rgba(255, 250, 242, 0.62);
}

.grocery-list-panel.is-pantry-check h2 {
    color: var(--muted);
}

.grocery-add-form {
    display: grid;
    grid-template-columns: minmax(14rem, 2fr) minmax(5rem, 0.7fr) minmax(5rem, 0.7fr) minmax(8rem, 1fr) minmax(10rem, 1.2fr) auto;
    gap: 0.75rem;
    align-items: end;
}

.grocery-print-form {
    display: flex;
    align-items: end;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin: 0;
}

.grocery-print-form label {
    display: grid;
    gap: 0.18rem;
    color: var(--muted);
    font-size: 0.74rem;
    font-weight: 700;
    letter-spacing: 0;
}

.grocery-print-form select {
    min-height: 2.1rem;
    padding: 0.35rem 2rem 0.35rem 0.65rem;
    border: 1px solid var(--line);
    border-radius: 0.55rem;
    background: var(--surface-strong);
    color: var(--text);
    font: inherit;
}

.grocery-search-field {
    position: relative;
}

.grocery-suggestion-popover {
    position: absolute;
    z-index: 20;
    top: calc(100% + 0.35rem);
    left: 0;
    right: 0;
    display: grid;
    gap: 0.25rem;
    max-height: 18rem;
    overflow-y: auto;
    padding: 0.45rem;
    border: 1px solid var(--line);
    border-radius: 0.8rem;
    background: var(--surface-strong);
    box-shadow: var(--shadow);
}

.grocery-suggestion {
    display: grid;
    gap: 0.12rem;
    width: 100%;
    padding: 0.55rem 0.65rem;
    border: 0;
    border-radius: 0.55rem;
    background: transparent;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.grocery-suggestion:hover {
    background: var(--accent-soft);
}

.grocery-suggestion span {
    color: var(--muted);
    font-size: 0.82rem;
}

.grocery-category-stack {
    display: grid;
    gap: 0.9rem;
}

.grocery-print-title {
    display: none;
}

.grocery-list {
    display: grid;
}

.grocery-item {
    display: grid;
    grid-template-columns: auto minmax(10rem, 1.2fr) minmax(5rem, 0.55fr) minmax(8rem, 1fr) minmax(12rem, 1.2fr) auto;
    gap: 0.7rem;
    align-items: center;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--line);
    overflow: visible;
}

.grocery-item:last-child {
    border-bottom: 0;
}

.grocery-check-button,
.grocery-print-check {
    display: inline-flex;
    flex: 0 0 auto;
    width: 1.1rem;
    height: 1.1rem;
    padding: 0;
    border: 1px solid rgba(46, 42, 37, 0.28);
    border-radius: 0.25rem;
    background: rgba(255, 255, 255, 0.68);
    box-sizing: border-box;
}

.grocery-check-label {
    position: relative;
    display: inline-flex;
    align-items: center;
    cursor: pointer;
}

.grocery-check-label input {
    position: absolute;
    inset: 0;
    opacity: 0;
    cursor: pointer;
}

.grocery-check-label input:focus-visible + .grocery-check-button {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

.grocery-check-form,
.grocery-delete-form {
    margin: 0;
}

.grocery-item.is-checked {
    opacity: 0.58;
}

.grocery-item.is-checked .grocery-check-button::after {
    content: "";
    width: 0.38rem;
    height: 0.65rem;
    margin: 0.1rem auto 0;
    border-right: 2px solid var(--accent);
    border-bottom: 2px solid var(--accent);
    transform: rotate(42deg);
}

.grocery-item input {
    width: 1rem;
    height: 1rem;
}

.grocery-amount {
    color: var(--accent);
    font-weight: 700;
    white-space: nowrap;
}

.grocery-name {
    font-weight: 700;
    min-width: 0;
    overflow-wrap: anywhere;
}

.grocery-fresh-dates {
    display: inline-flex;
    margin-left: 0.35rem;
    padding: 0.1rem 0.38rem;
    border-radius: 999px;
    background: rgba(29, 107, 87, 0.09);
    color: var(--accent);
    font-size: 0.78rem;
    font-weight: 700;
    vertical-align: middle;
}

.grocery-note,
.grocery-dishes {
    color: var(--muted);
    font-size: 0.9rem;
}

.serving-control {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.serving-control input {
    width: 5.2rem;
}

@media print {
    @page {
        margin: 0.8cm;
    }

    body {
        background: #fff;
        font-size: 9pt;
        line-height: 1.2;
    }

    .drawer,
    .session-strip,
    .page-header,
    .grocery-add-panel,
    .grocery-plan-hint,
    .save-status,
    .grocery-delete-form,
    script {
        display: none !important;
    }

    .app-shell,
    .is-authenticated .app-shell {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .content {
        display: block;
    }

    .panel {
        border: 0;
        box-shadow: none;
        background: #fff;
    }

    .grocery-print-title {
        display: block;
        margin-bottom: 0.35rem;
    }

    .grocery-print-title h2 {
        margin: 0;
        font-size: 14pt;
        line-height: 1.1;
    }

    .grocery-print-title p {
        margin: 0.08rem 0 0;
        color: #555;
        font-size: 9pt;
    }

    .grocery-category-stack {
        display: block;
        column-count: 2;
        column-gap: 1.1cm;
    }

    .grocery-list-panel {
        display: inline-block;
        width: 100%;
        break-inside: avoid;
        margin: 0 0 0.28rem;
        padding: 0;
    }

    .grocery-list-panel h2 {
        margin: 0 0 0.08rem;
        padding: 0 0 0.08rem;
        border-bottom: 1px solid #999;
        font-size: 9.5pt;
        line-height: 1.15;
    }

    .grocery-item {
        grid-template-columns: 0.32cm minmax(0, 1fr) 1.55cm minmax(0, 1fr);
        gap: 0.18cm;
        min-height: 0;
        padding: 0.05rem 0;
        border-bottom: 0;
        font-size: 8.7pt;
        line-height: 1.15;
    }

    .grocery-print-check {
        display: inline-flex;
        width: 0.24cm;
        height: 0.24cm;
        margin-top: 0.03cm;
        border-color: #555;
        border-radius: 0;
    }

    .grocery-amount {
        font-weight: 700;
        white-space: nowrap;
    }

    .grocery-name {
        font-weight: 400;
    }

    .grocery-note {
        color: #555;
        font-size: 8pt;
    }

    .grocery-dishes {
        display: none !important;
    }
}

.category-toggle-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
}

.category-chip-groups {
    display: grid;
    gap: 0.55rem;
    margin-top: 0.75rem;
}

.category-chip-group {
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 0.42rem 0.55rem;
}

.category-chip-heading {
    min-width: 5.8rem;
    padding-top: 0.22rem;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.category-chip-row {
    display: flex;
    flex: 1 1 12rem;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.category-group-list {
    display: grid;
    gap: 1rem;
}

.category-toggle-group {
    display: grid;
    gap: 0.55rem;
    padding: 0.85rem 0;
    border-top: 1px solid rgba(46, 42, 37, 0.08);
}

.category-toggle-group:first-child {
    border-top: 0;
    padding-top: 0;
}

.category-toggle-group h3,
.category-overview-group h2 {
    margin: 0;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0;
    text-transform: uppercase;
}

.category-toggle {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.48rem 0.78rem;
    border: 1px solid rgba(46, 42, 37, 0.08);
    border-radius: 999px;
    background: #ece4d8;
    color: var(--muted);
    cursor: pointer;
    transition: background 140ms ease, color 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.category-toggle input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.category-toggle:hover {
    border-color: rgba(29, 107, 87, 0.14);
    transform: translateY(-1px);
}

.category-toggle:has(input:checked),
.category-toggle.is-selected {
    border-color: rgba(29, 107, 87, 0.16);
    background: var(--accent-soft);
    color: var(--accent);
}

.category-overview-group {
    display: grid;
    gap: 0.8rem;
}

.category-overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
    gap: 0.8rem;
}

.import-status {
    display: grid;
    gap: 0.75rem;
}

.feature-request-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
}

.feature-request-form .field:has(textarea),
.feature-request-form button {
    grid-column: 1 / -1;
}

.feature-request-card {
    display: grid;
    gap: 1rem;
}

.feature-request-main {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 1rem;
    align-items: start;
}

.vote-form {
    margin: 0;
}

.vote-button {
    display: grid;
    justify-items: center;
    gap: 0.18rem;
    min-width: 3.1rem;
    padding: 0.55rem 0.5rem;
    border: 1px solid rgba(46, 42, 37, 0.1);
    border-radius: 0.9rem;
    background: #ece4d8;
    color: var(--muted);
    cursor: pointer;
}

.vote-button.is-active,
.vote-button:hover {
    border-color: rgba(29, 107, 87, 0.18);
    background: var(--accent-soft);
    color: var(--accent);
}

.vote-button strong {
    font-size: 1rem;
    line-height: 1;
}

.feature-request-body {
    display: grid;
    min-width: 0;
    gap: 1rem;
}

.feature-request-head {
    align-items: flex-start;
}

.feature-request-badges {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.feature-request-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.85rem;
}

.feature-request-detail-grid section,
.story-preview {
    display: grid;
    gap: 0.35rem;
    padding: 0.9rem;
    border: 1px solid rgba(46, 42, 37, 0.08);
    border-radius: 1rem;
    background: rgba(255, 252, 246, 0.58);
}

.story-preview {
    border-color: rgba(29, 107, 87, 0.14);
    background: rgba(241, 249, 246, 0.78);
}

.admin-module-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.admin-module-card {
    display: grid;
    gap: 0.45rem;
    color: inherit;
    text-decoration: none;
}

.admin-module-card.is-disabled {
    opacity: 0.72;
}

.admin-stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.admin-stat-card p {
    margin: 0;
    color: var(--muted);
}

.admin-stat-number {
    display: block;
    color: var(--accent);
    font-size: 2.75rem;
    line-height: 1;
}

.management-panel {
    display: grid;
    gap: 1rem;
}

.management-bulk-form {
    display: grid;
    gap: 0.85rem;
}

.management-toolbar {
    display: flex;
    justify-content: flex-end;
}

.management-table-wrap {
    overflow-x: auto;
}

.management-table {
    width: 100%;
    min-width: 760px;
    border-collapse: collapse;
}

.management-table th,
.management-table td {
    padding: 0.65rem;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

.management-table th {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.management-table input,
.management-table select {
    width: 100%;
    min-width: 0;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--line);
    border-radius: 0.65rem;
    background: var(--surface-strong);
}

.management-muted {
    color: var(--muted);
    white-space: nowrap;
}

.admin-global-ingredients-table {
    min-width: 980px;
}

.admin-feature-card {
    display: grid;
    gap: 1rem;
}

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

.admin-wide-field,
.admin-feature-form button {
    grid-column: 1 / -1;
}

.import-status.is-error {
    border-color: rgba(163, 63, 50, 0.22);
    background: rgba(255, 242, 239, 0.9);
}

.import-status.is-success {
    border-color: rgba(29, 107, 87, 0.22);
    background: rgba(241, 249, 246, 0.9);
}

.error-list {
    margin: 0;
    padding-left: 1.1rem;
    color: #a33f32;
}

.import-summary {
    display: grid;
    gap: 1rem;
}

.summary-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.summary-card {
    padding: 1rem;
    border: 1px solid var(--line);
    border-radius: 1.1rem;
    background: rgba(255, 250, 242, 0.78);
}

.summary-card {
    display: grid;
    gap: 0.35rem;
}

.summary-label {
    font-size: 0.78rem;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--muted);
}

.import-preview-table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 0.5rem;
    background: rgba(255, 255, 255, 0.46);
}

.import-preview-table {
    width: 100%;
    min-width: 860px;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.import-preview-table th,
.import-preview-table td {
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid rgba(46, 42, 37, 0.08);
    text-align: left;
    vertical-align: top;
}

.import-preview-table th {
    color: var(--muted);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
}

.import-preview-table tbody tr:last-child td {
    border-bottom: 0;
}

.import-row-number {
    width: 4rem;
    color: var(--muted);
}

@media screen and (min-width: 900px) {
    .app-shell {
        width: min(1240px, calc(100% - 3rem));
    }

    .is-authenticated .app-shell {
        padding-left: 20rem;
    }

    .drawer {
        position: fixed;
        inset: 3.25rem auto auto max(1.5rem, calc((100vw - 1240px) / 2));
        transform: translateX(0);
    }

    .menu-toggle {
        display: none;
    }

    .plan-row {
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: center;
    }

    .slot-actions {
        display: flex;
    }

    .date-order-button {
        display: inline-flex;
    }

    .sort-toggle {
        display: none;
    }

}

@media screen and (max-width: 720px) {
    .invite-form {
        grid-template-columns: 1fr;
    }

    .feature-request-form,
    .feature-request-detail-grid,
    .admin-feature-form {
        grid-template-columns: 1fr;
    }

    .ingredient-row {
        grid-template-columns: 1fr 1fr;
    }

    .ingredient-row input[name="ingredient_name[]"],
    .ingredient-row input[name="ingredient_note[]"] {
        grid-column: 1 / -1;
    }

    .ingredient-remove {
        grid-column: 1 / -1;
        width: fit-content;
    }

    .grocery-add-form {
        grid-template-columns: 1fr;
    }

    .grocery-item {
        grid-template-columns: auto minmax(0, 1fr);
        align-items: start;
    }

    .grocery-amount,
    .grocery-name,
    .grocery-note,
    .grocery-dishes {
        grid-column: 2;
    }

    .grocery-delete-form {
        grid-column: 2;
    }

    .feature-request-main {
        grid-template-columns: 1fr;
    }

    .vote-button {
        display: inline-flex;
        width: fit-content;
        gap: 0.45rem;
    }
}
