html,
body {
    --faula-theme-loaded: 1;
    min-height: 100%;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f8faf9;
}

.app-startup {
    display: grid;
    min-height: 100vh;
    place-items: center;
    padding: 1.5rem;
    color: #1f2933;
    background: #f8faf9;
}

.app-startup-card {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    width: min(360px, 100%);
    padding: 1rem;
    border: 1px solid #d8ded9;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(31, 41, 51, 0.08);
}

.app-startup-card > div:last-child {
    display: grid;
    gap: 0.15rem;
}

.app-startup-card span {
    color: #607067;
}

.app-startup-spinner {
    width: 2rem;
    height: 2rem;
    flex: 0 0 auto;
    border: 3px solid #d8ded9;
    border-top-color: #176b43;
    border-radius: 50%;
    animation: app-startup-spin 0.8s linear infinite;
}

.app-startup-error .app-startup-card {
    align-items: flex-start;
    border-color: #f0c2c0;
}

.app-startup-error .app-startup-spinner {
    display: none;
}

@keyframes app-startup-spin {
    to {
        transform: rotate(360deg);
    }
}

.app-shell {
    min-height: 100vh;
    background: #f8faf9;
    color: #1f2933;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    gap: 0.55rem;
    padding: 0.75rem clamp(1rem, 3vw, 2rem);
    border-bottom: 1px solid #d8ded9;
    background: rgba(255, 255, 255, 0.96);
}

.app-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
}

.brand {
    color: #21312a;
    font-size: 1.15rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.app-nav {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
}

.app-nav a {
    padding: 0.45rem 0.7rem;
    border-radius: 6px;
    color: #46554d;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
}

.app-nav a.active,
.app-nav a:hover {
    background: #e8f2eb;
    color: #14532d;
}

.header-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.6rem;
    min-width: 0;
}

.user-name {
    color: #5c6670;
    font-size: 0.95rem;
    overflow-wrap: anywhere;
    text-align: right;
}

.admin-label {
    appearance: none;
    margin-left: 0.35rem;
    padding: 0;
    border: 0;
    background: transparent;
    color: #176b43;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.admin-label[aria-pressed="false"] {
    color: #6b7280;
    font-weight: 600;
}

.app-main {
    width: min(1680px, 100%);
    margin: 0 auto;
    padding: clamp(1rem, 2vw, 1.5rem);
}

.login-panel {
    display: grid;
    min-height: calc(100vh - 6.5rem);
    place-items: center;
}

.login-card {
    display: grid;
    gap: 1rem;
    width: min(420px, 100%);
    padding: 1.5rem;
    border: 1px solid #d8ded9;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 10px 24px rgba(31, 41, 51, 0.08);
}

.login-card h1 {
    margin: 0;
    font-size: 1.6rem;
}

.login-help {
    margin: 0;
    color: #607067;
    font-size: 0.95rem;
    line-height: 1.35;
}

.login-language-control {
    display: grid;
    gap: 0.35rem;
}

#blazor-error-ui {
    color-scheme: light only;
    background: #fff7cc;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.55rem;
}

a,
.btn-link {
    color: #1267a8;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    min-height: 2.35rem;
    padding: 0.42rem 0.72rem;
    border-radius: 6px;
    font-weight: 500;
    line-height: 1.2;
}

.btn-sm {
    min-height: 2.05rem;
    padding: 0.3rem 0.58rem;
    font-size: 0.86rem;
}

.btn:disabled,
.btn.disabled {
    opacity: 0.55;
}

.btn-primary {
    background-color: #176b43;
    border-color: #176b43;
}

.btn-primary:hover,
.btn-primary:focus {
    background-color: #125735;
    border-color: #125735;
}

.btn-danger,
.btn-outline-danger {
    border-color: #a23b35;
    background-color: #a23b35;
    color: #fff7f5;
}

.btn-danger:hover,
.btn-danger:focus,
.btn-outline-danger:hover,
.btn-outline-danger:focus {
    border-color: #87302b;
    background-color: #87302b;
    color: #fff;
}

.form-control,
.form-select {
    border-color: #cfd8d3;
    border-radius: 6px;
}

.form-control:focus,
.form-select:focus,
.btn:focus,
.btn:active:focus {
    border-color: #4b9270;
    box-shadow: 0 0 0 0.18rem rgba(23, 107, 67, 0.18);
}

.form-field {
    display: grid;
    gap: 0.25rem;
}

.upload-box label,
.food-edit-form label,
.feedback-form label,
.form-field,
.days-control {
    min-width: 0;
    color: #46554d;
    font-weight: 700;
}

.upload-box label,
.food-edit-form label,
.feedback-form label {
    display: grid;
    gap: 0.35rem;
}

.upload-box .form-control,
.upload-box .form-select,
.food-edit-form .form-control,
.food-edit-form .form-select,
.feedback-form .form-control {
    font-weight: 400;
}

.tag-picker {
    display: grid;
    gap: 0.45rem;
}

.tag-picker-selected {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    min-height: calc(1.5em + 0.75rem + 2px);
    padding: 0.35rem;
    border: 1px solid #cfd8d3;
    border-radius: 6px;
    background: #fbfcfb;
}

.tag-picker-placeholder {
    color: #607067;
    font-size: 0.9rem;
}

.tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    max-width: 100%;
    padding: 0.2rem 0.45rem;
    border: 1px solid #b8d0c1;
    border-radius: 6px;
    background: #eef6f0;
    color: #176b43;
    font-size: 0.88rem;
    font-weight: 700;
}

.tag-chip span:first-child {
    overflow-wrap: anywhere;
}

.tag-chip span:last-child {
    color: #46554d;
    font-size: 1rem;
    line-height: 1;
}

.tag-picker-add-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.tag-picker-add-row .form-control {
    min-width: 0;
}

h1:focus {
    outline: none;
}

.page-title-row {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.page-title-row h1 {
    margin: 0;
    font-size: clamp(1.55rem, 2.2vw, 2.15rem);
}

.page-title-row p {
    margin: 0.2rem 0 0;
    color: #607067;
}

.planner-title-row {
    align-items: flex-start;
    flex-direction: column;
    justify-content: flex-start;
    gap: 0.75rem;
}

.planner-title-row .planner-week-actions {
    align-self: flex-start;
    justify-content: flex-start;
}

.planner-week-actions .btn {
    min-height: 2.05rem;
    padding: 0.3rem 0.58rem;
}

.status-banner {
    position: fixed;
    right: max(0.75rem, calc((100vw - 1680px) / 2 + 1rem));
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    left: max(0.75rem, calc((100vw - 1680px) / 2 + 1rem));
    z-index: 110;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    margin: 0;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.24);
}

.status-banner span {
    flex: 1 1 auto;
    min-width: 0;
    overflow-wrap: anywhere;
}

.status-banner-actions {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    justify-content: flex-end;
    gap: 0.45rem;
    white-space: nowrap;
}

.status-banner-actions .btn {
    flex: 0 0 auto;
}

.toolbar,
.button-row,
.pager {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.icon-button {
    min-width: 2.5rem;
    padding-right: 0.55rem;
    padding-left: 0.55rem;
    font-weight: 700;
    text-align: center;
}

.btn-sm.icon-button {
    min-width: 2.15rem;
    padding-right: 0.4rem;
    padding-left: 0.4rem;
}

.toolbar {
    margin: 1rem 0;
}

.catalog-toolbar {
    position: sticky;
    top: calc(var(--faula-header-height, 5.5rem) + 0.5rem);
    z-index: 8;
    padding: 0.35rem 0;
    background: #f8faf9;
}

.toolbar .form-control {
    min-width: min(420px, 100%);
}

.toolbar-check {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    min-height: calc(1.5em + 0.75rem + 2px);
    color: #46554d;
    font-weight: 600;
    white-space: nowrap;
}

.upload-box {
    margin-bottom: 1rem;
    padding: 0.85rem;
    border: 1px solid #d8ded9;
    border-radius: 8px;
    background: #fff;
}

.upload-box form {
    display: grid;
    gap: 0.85rem;
}

.upload-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.85rem;
    align-items: start;
}

.file-picker-control {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-height: calc(1.5em + 0.75rem + 2px);
}

.file-picker-state {
    color: #607067;
    font-size: 0.9rem;
}

.file-picker-input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.upload-preview {
    display: block;
    width: min(420px, 100%);
    aspect-ratio: 16 / 9;
    border-radius: 8px;
    object-fit: cover;
}

.added-by-display {
    display: block;
    min-height: calc(1.5em + 0.75rem + 2px);
    padding: 0.375rem 0;
    color: #1f2933;
    font-weight: 600;
}

.upload-recipe {
    display: block;
}

.upload-recipe textarea,
.food-edit-form textarea {
    min-height: 11rem;
    resize: vertical;
}

.food-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 1rem;
}

.food-card {
    display: grid;
    grid-template-rows: 1fr auto;
    overflow: hidden;
    border: 1px solid #d8ded9;
    border-radius: 8px;
    background: #fff;
}

.food-card-link {
    display: grid;
    grid-template-rows: auto 1fr;
    color: inherit;
    text-decoration: none;
}

.food-card-link:hover h2 {
    color: #176b43;
}

.food-card img {
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    background: #e9ecef;
}

.food-card-body {
    display: grid;
    grid-auto-rows: min-content;
    gap: 0.5rem;
    padding: 0.8rem;
}

.food-card h2,
.planner-catalog h2,
.day-slot h2 {
    margin: 0;
    font-size: 1.05rem;
}

.food-card p {
    margin: 0;
    color: #64736b;
    font-size: 0.9rem;
}

.food-usage,
.food-summary .food-usage {
    color: #607067;
    font-size: 0.82rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.food-usage-detail {
    display: block;
    margin-top: 0.2rem;
    color: #607067;
}

.food-tags.empty {
    color: #8a6d3b;
    font-style: italic;
}

.recipe-present {
    color: #176b43;
    font-size: 0.88rem;
    font-weight: 700;
}

.recipe-details {
    font-size: 0.9rem;
}

.recipe-details summary {
    cursor: pointer;
    color: #176b43;
    font-weight: 700;
}

.recipe-details pre {
    max-height: 16rem;
    margin: 0.5rem 0 0;
    padding: 0.65rem;
    overflow: auto;
    border: 1px solid #d8ded9;
    border-radius: 6px;
    background: #fbfcfb;
    color: #1f2933;
    font-family: inherit;
    font-size: 0.9rem;
    white-space: pre-wrap;
}

.food-edit-form {
    display: grid;
    gap: 0.75rem;
    min-width: 0;
}

.food-edit-preview {
    width: min(360px, 100%);
    aspect-ratio: 16 / 9;
    border: 1px solid #d8ded9;
    border-radius: 8px;
    object-fit: cover;
    background: #e9ecef;
}

.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.food-card-actions {
    align-self: end;
    padding: 0 0.8rem 0.8rem;
}

.food-card .food-edit-preview {
    width: 100%;
}

.food-detail-layout {
    display: grid;
    grid-template-columns: minmax(320px, 0.95fr) minmax(320px, 0.7fr);
    gap: 1.25rem;
    align-items: start;
}

.food-detail-layout-single {
    grid-template-columns: minmax(0, 760px);
}

.food-detail-image-button {
    display: block;
    width: 100%;
    min-width: 0;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: transparent;
    cursor: zoom-in;
}

.food-detail-image-button:focus-visible {
    outline: 3px solid rgba(75, 146, 112, 0.45);
    outline-offset: 3px;
}

.food-detail-image {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    max-height: min(62vh, 680px);
    border: 1px solid #d8ded9;
    border-radius: 8px;
    background: #e9ecef;
    object-fit: cover;
}

.food-image-lightbox-backdrop {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: grid;
    place-items: center;
    padding: clamp(0.75rem, 2vw, 1.5rem);
    background: rgba(4, 8, 7, 0.88);
}

.food-image-lightbox {
    display: grid;
    gap: 0.75rem;
    width: min(1180px, 100%);
    max-height: calc(100vh - 2rem);
    margin: 0;
}

.food-image-lightbox-close {
    justify-self: end;
}

.food-image-lightbox img {
    display: block;
    width: 100%;
    max-height: calc(100vh - 5rem);
    border: 1px solid #303936;
    border-radius: 8px;
    background: #0f1412;
    object-fit: contain;
}

.food-detail-panel {
    display: grid;
    gap: 1rem;
    min-width: 0;
    padding: 1rem;
    border: 1px solid #d8ded9;
    border-radius: 8px;
    background: #fff;
}

.food-meta {
    display: grid;
    gap: 0.75rem;
    margin: 0;
}

.food-meta div {
    display: grid;
    gap: 0.15rem;
}

.food-meta dt {
    color: #607067;
    font-size: 0.85rem;
    font-weight: 700;
}

.food-meta dd {
    margin: 0;
    color: #1f2933;
}

.recipe-full {
    display: grid;
    gap: 0.5rem;
}

.recipe-full h2 {
    margin: 0;
    font-size: 1.2rem;
}

.recipe-full p {
    margin: 0;
    color: #64736b;
}

.recipe-full pre {
    max-height: 42vh;
    margin: 0;
    padding: 0.8rem;
    overflow: auto;
    border: 1px solid #d8ded9;
    border-radius: 6px;
    background: #fbfcfb;
    color: #1f2933;
    font-family: inherit;
    font-size: 0.95rem;
    white-space: pre-wrap;
}

.plan-picker-backdrop {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: rgba(15, 23, 42, 0.42);
}

.plan-picker {
    display: grid;
    gap: 0.85rem;
    width: min(820px, 100%);
    max-height: min(720px, calc(100vh - 2rem));
    overflow: auto;
    padding: 0.9rem;
    border: 1px solid #d8ded9;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(31, 41, 51, 0.22);
}

.plan-picker header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    min-width: 0;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #d8ded9;
}

.plan-picker header > div {
    min-width: 0;
}

.plan-picker-toolbar {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 0.65rem;
    min-width: 0;
    padding: 0.55rem;
    border: 1px solid #d8ded9;
    border-radius: 8px;
    background: #fbfcfb;
}

.plan-picker h2,
.plan-picker p {
    margin: 0;
}

.plan-picker h2 {
    font-size: 1.15rem;
    line-height: 1.2;
}

.plan-picker p {
    color: #607067;
    overflow-wrap: anywhere;
}

.plan-picker-toolbar strong {
    min-width: 0;
    text-align: center;
}

.plan-day-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.5rem;
}

.plan-day-button {
    display: grid;
    gap: 0.35rem;
    min-height: 5.5rem;
    padding: 0.65rem;
    border: 1px solid #d8ded9;
    border-radius: 8px;
    background: #fbfcfb;
    color: #1f2933;
    text-align: left;
}

.plan-day-button:hover,
.plan-day-button:focus {
    border-color: #176b43;
    background: #eef6f0;
}

.plan-day-button span {
    color: #64736b;
    font-size: 0.86rem;
    overflow-wrap: anywhere;
}

.pager {
    justify-content: center;
    margin: 1.25rem 0;
}

.planner-layout {
    display: grid;
    gap: 1rem;
}

.planner-catalog {
    align-self: start;
    display: grid;
    gap: 0.75rem;
    padding: 1rem;
    border: 1px solid #d8ded9;
    border-radius: 8px;
    background: #fff;
    min-width: 0;
}

.drag-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
    gap: 0.5rem;
    max-height: 18rem;
    overflow: auto;
}

.drag-food {
    display: grid;
    grid-template-columns: 48px 1fr;
    align-items: start;
    gap: 0.6rem;
    width: 100%;
    padding: 0.35rem;
    border: 1px solid #d8ded9;
    border-radius: 8px;
    background: #fff;
    color: #1f2933;
    text-decoration: none;
    text-align: left;
}

.drag-food:hover,
.drag-food:focus {
    border-color: #176b43;
    background: #eef6f0;
}

.food-summary {
    display: grid;
    gap: 0.18rem;
    min-width: 0;
}

.food-summary strong {
    overflow-wrap: anywhere;
    line-height: 1.3;
}

.food-summary .food-tags {
    color: #64736b;
    font-size: 0.82rem;
    line-height: 1.25;
    overflow-wrap: anywhere;
}

.food-summary .food-tags.empty {
    color: #8a6d3b;
    font-style: italic;
}

.food-summary .food-added-by {
    color: #607067;
    font-size: 0.78rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.drag-food img,
.planned-food img {
    width: 48px;
    height: 48px;
    border-radius: 6px;
    object-fit: cover;
}

.week-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    align-items: stretch;
    gap: 0.65rem;
    min-width: 0;
}

.day-slot {
    position: relative;
    display: grid;
    grid-template-rows: 3.2rem minmax(10.8rem, 1fr);
    gap: 0.6rem;
    min-width: 0;
    min-height: 340px;
    padding: 0.75rem;
    border: 1px solid #d8ded9;
    border-radius: 8px;
    background: #fff;
}

.day-slot:hover {
    border-color: #9bb8a8;
}

.day-slot.is-past {
    border-color: #bfc7c2;
    background: #e4e9e5;
}

.day-slot.is-past .planned-food {
    background: #dde6df;
    color: #3d4a43;
}

.day-slot.is-past .planned-food img {
    filter: saturate(0.72) brightness(0.9);
}

.day-slot.is-today {
    border-color: #b5d9c3;
    background: #edfbf1;
}

.day-slot.is-today::before,
.day-slot.is-today::after {
    position: absolute;
    left: 0.45rem;
    right: 0.45rem;
    height: 0.18rem;
    border-radius: 999px;
    background: #25a060;
    content: "";
    pointer-events: none;
}

.day-slot.is-today::before {
    top: 0.45rem;
}

.day-slot.is-today::after {
    bottom: 0.45rem;
}

.day-heading {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    min-width: 0;
}

.day-heading > div {
    min-width: 0;
}

.day-heading-actions {
    display: flex;
    flex: 0 0 auto;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.35rem;
}

.day-heading-actions .btn {
    min-height: 1.85rem;
    padding: 0.24rem 0.52rem;
}

@media (min-width: 761px) {
    .day-heading-actions {
        align-items: flex-start;
    }

    .day-heading-actions .btn.btn-sm {
        height: 1.65rem;
        min-height: 1.65rem;
        padding: 0.08rem 0.46rem;
        font-size: 0.78rem;
        line-height: 1;
    }
}

.day-heading h2 {
    overflow: hidden;
    font-size: 1.15rem;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.day-heading span {
    color: #69776f;
    display: block;
    font-size: 0.8rem;
    line-height: 1.25;
}

.day-date-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
}

.day-date-row > span:first-child {
    white-space: nowrap;
}

.day-edit-panel {
    display: grid;
    gap: 0.45rem;
    padding: 0.55rem;
    border: 1px solid #d7ddd9;
    border-radius: 8px;
    background: #f5f7f5;
}

.duration-edit-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.45rem;
    align-items: end;
}

.shift-days-control {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    color: #49564f;
    font-size: 0.85rem;
}

.shift-days-control .form-select {
    width: 4.5rem;
}

.day-shift-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.4rem;
}

.plan-conflict-dialog {
    display: grid;
    gap: 0.85rem;
    width: min(440px, 100%);
    padding: 0.9rem;
    border: 1px solid #d8ded9;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 24px 60px rgba(31, 41, 51, 0.22);
}

.plan-conflict-dialog header {
    padding-bottom: 0.65rem;
    border-bottom: 1px solid #d8ded9;
}

.plan-conflict-dialog h2,
.plan-conflict-dialog p {
    margin: 0;
}

.plan-conflict-dialog p {
    color: #49564f;
}

.plan-conflict-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
}

.plan-conflict-actions .btn {
    width: 100%;
}

.planned-food {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
    height: 100%;
    min-height: 0;
    padding: 0.6rem;
    overflow: hidden;
    border-radius: 8px;
    background: #eef6f0;
    color: #1f2933;
    text-decoration: none;
}

.planned-food-name {
    display: flex;
    align-items: center;
    justify-content: center;
    color: inherit;
    font-weight: 700;
    line-height: 1.25;
    overflow-wrap: anywhere;
    text-align: center;
    text-decoration: none;
}

.planned-food-name:hover,
.planned-food-name:focus {
    color: #176b43;
}

.planned-food-planned-by {
    align-self: center;
    margin-top: auto;
    color: #607067;
    font-size: 0.78rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
    text-align: center;
}

.planned-food-image-link {
    display: block;
    width: 100%;
    aspect-ratio: 3 / 2;
    overflow: hidden;
    border-radius: 6px;
    background: #e9ecef;
    min-width: 0;
    text-decoration: none;
}

.planned-food-notes {
    height: auto;
    min-height: calc(1.35em + 0.75rem + 2px);
    overflow: hidden;
    line-height: 1.35;
    resize: none;
    text-align: left;
}

.planned-food-stack {
    display: grid;
    gap: 0.45rem;
    min-width: 0;
}

.planned-food:hover,
.planned-food:focus {
    background: #e1f0e6;
}

.planned-food-continuation {
    border: 1px dashed #70a382;
    background: #e8f5ec;
    color: #2b4a37;
    cursor: default;
    box-shadow: inset 0.28rem 0 0 rgba(112, 163, 130, 0.34);
}

.planned-food img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.planned-food img.planned-food-image-contain {
    padding: 8%;
    object-fit: contain;
}

.empty-slot,
.empty-state,
.loading-state {
    display: grid;
    min-height: 0;
    place-items: center;
    border: 1px dashed #c9d4ce;
    border-radius: 8px;
    color: #66736b;
    background: #fbfcfb;
}

.empty-slot-button {
    width: 100%;
    cursor: pointer;
}

.empty-slot-button:hover,
.empty-slot-button:focus {
    border-color: #176b43;
    background: #eef6f0;
    color: #176b43;
}

.food-selector-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 0.65rem;
    max-height: min(460px, 60vh);
    overflow: auto;
}

.food-selector-choice {
    min-height: 4rem;
    padding: 0.45rem;
}

.days-control {
    display: grid;
    gap: 0.35rem;
    width: min(12rem, 100%);
    color: #46554d;
    font-weight: 700;
}

.day-slot textarea:not(.planned-food-notes) {
    height: 100%;
    min-height: 86px;
    resize: vertical;
}

.day-slot .form-select,
.day-slot .form-control {
    min-width: 0;
    font-size: 0.92rem;
}

.day-slot .form-select {
    height: 2.35rem;
}

.users-panel {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #d8ded9;
    border-radius: 8px;
    background: #fff;
}

.admin-settings-panel {
    display: grid;
    gap: 0.75rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #d8ded9;
}

.admin-settings-panel h2 {
    margin: 0;
    font-size: 1.1rem;
}

.admin-settings-form {
    align-items: flex-end;
    margin: 0;
}

.admin-settings-form .days-control {
    width: 8.5rem;
}

.admin-users-section {
    display: grid;
    gap: 0.75rem;
}

.admin-users-section h2 {
    margin: 0;
    font-size: 1.1rem;
}

.user-list {
    display: grid;
    gap: 0.6rem;
}

.user-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem;
    border: 1px solid #d8ded9;
    border-radius: 8px;
}

.user-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.4rem;
}

.user-row span {
    margin-left: 0.5rem;
    color: #176b43;
    font-size: 0.85rem;
    font-weight: 700;
}

.feedback-panel {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #d8ded9;
    border-radius: 8px;
    background: #fff;
}

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

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

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

.feedback-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    border: 1px solid #d8ded9;
    border-radius: 8px;
    background: #fff;
}

.feedback-item p {
    margin: 0 0 0.5rem;
    white-space: pre-wrap;
}

.feedback-item span {
    color: #607067;
    font-size: 0.88rem;
}

.checklist-add-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.6rem;
    margin: 1rem 0;
    padding: 0.65rem;
    border: 1px solid #d8ded9;
    border-radius: 8px;
    background: #fff;
}

.reminder-add-form {
    grid-template-columns: minmax(0, 1fr) minmax(8rem, auto) minmax(10rem, auto) auto;
}

.checklist {
    display: grid;
    gap: 0.5rem;
}

.checklist-item {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: start;
    gap: 0.75rem;
    padding: 0.75rem;
    border: 1px solid #d8ded9;
    border-radius: 8px;
    background: #fff;
}

.checklist-item.is-checked {
    background: #f6f8f7;
}

.checklist-item.is-checked .checklist-text {
    color: #607067;
    text-decoration: line-through;
}

.checklist-item .form-check-input {
    margin-top: 0.25rem;
}

.checklist-text {
    min-width: 0;
    color: #1f2933;
    font-weight: 700;
    overflow-wrap: anywhere;
    text-align: left;
}

.checklist-trailing {
    display: grid;
    justify-items: end;
    gap: 0.45rem;
    min-width: max-content;
    color: #607067;
    font-size: 0.86rem;
    text-align: right;
}

.checklist-edit {
    grid-column: 2 / -1;
    display: grid;
    gap: 0.55rem;
    min-width: 0;
    padding: 0.65rem;
    border: 1px solid #d8ded9;
    border-radius: 8px;
    background: #fbfcfb;
}

.reminder-edit {
    grid-template-columns: minmax(0, 1fr) minmax(8rem, auto) minmax(10rem, auto) auto;
    align-items: start;
}

.reminder-edit .card-actions {
    justify-content: flex-end;
}

.reminder-trailing {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 0.4rem;
}

.urgency-pill,
.due-date {
    display: inline-flex;
    align-items: center;
    min-height: 1.55rem;
    padding: 0.15rem 0.45rem;
    border-radius: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    white-space: nowrap;
}

.urgency-pill.low {
    border: 1px solid #cfd8d3;
    background: #f6f8f7;
    color: #46554d;
}

.urgency-pill.medium {
    border: 1px solid #c8d8ef;
    background: #eef5ff;
    color: #24527a;
}

.urgency-pill.high {
    border: 1px solid #f0c2c0;
    background: #fff1f0;
    color: #9b2d26;
}

.due-date {
    border: 1px solid #d8ded9;
    background: #fbfcfb;
    color: #46554d;
}

.due-date.today {
    border-color: #e5cf8f;
    background: #fff8df;
    color: #775a13;
}

.due-date.overdue {
    border-color: #f0c2c0;
    background: #fff1f0;
    color: #9b2d26;
}

.alert {
    border-radius: 8px;
}

@media (max-width: 1280px) {
    .planner-catalog {
        position: static;
    }

    .drag-list {
        grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
        max-height: 180px;
    }

    .week-grid {
        grid-template-columns: repeat(7, minmax(150px, 1fr));
        overflow-x: auto;
        padding-bottom: 0.5rem;
    }

    .day-slot {
        min-width: 150px;
    }
}

@media (max-width: 920px) {
    .page-title-row,
    .toolbar,
    .tag-picker-add-row {
        align-items: stretch;
        flex-direction: column;
    }

    .admin-settings-form {
        align-items: flex-end;
        flex-direction: row;
    }

    .button-row {
        flex-wrap: wrap;
    }

    .checklist-add-form,
    .reminder-add-form,
    .reminder-edit,
    .upload-grid,
    .planner-layout,
    .week-grid {
        grid-template-columns: 1fr;
    }

    .checklist-item {
        grid-template-columns: auto minmax(0, 1fr);
    }

    .checklist-trailing {
        grid-column: 2;
        justify-items: start;
        min-width: 0;
        text-align: left;
    }

    .reminder-trailing,
    .reminder-edit .card-actions {
        justify-content: flex-start;
    }

    .week-grid {
        overflow-x: visible;
    }

    .food-detail-layout,
    .plan-day-grid {
        grid-template-columns: 1fr;
    }

    .food-detail-image {
        max-height: 54vh;
    }

    .plan-picker header {
        align-items: stretch;
        flex-direction: column;
    }

    .plan-picker-toolbar {
        grid-template-columns: auto minmax(0, 1fr) auto;
    }
}

@media (max-width: 760px) {
    .app-header {
        gap: 0.35rem;
        padding: 0.55rem 0.75rem;
    }

    .app-header-top {
        align-items: center;
        gap: 0.75rem;
    }

    .brand {
        font-size: 1.05rem;
    }

    .app-nav {
        flex-wrap: nowrap;
        gap: 0.2rem;
        margin: 0 -0.2rem;
        overflow-x: auto;
        padding-bottom: 0.05rem;
        scrollbar-width: none;
    }

    .app-nav::-webkit-scrollbar {
        display: none;
    }

    .app-nav a {
        padding: 0.35rem 0.55rem;
        font-size: 0.92rem;
    }

    .header-actions {
        align-items: center;
        flex-direction: row;
        gap: 0.45rem;
        min-width: 0;
    }

    .header-actions .btn {
        padding: 0.25rem 0.45rem;
        font-size: 0.8rem;
    }

    .user-name {
        max-width: 11rem;
        overflow: hidden;
        font-size: 0.86rem;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .app-main {
        padding: 0.75rem;
    }

    .page-title-row {
        gap: 0.65rem;
        margin-bottom: 0.75rem;
    }

    .page-title-row h1 {
        font-size: 1.45rem;
    }

    .page-title-row p {
        font-size: 0.92rem;
    }

    .planner-week-actions {
        display: grid;
        grid-template-columns: auto minmax(0, 1fr) auto;
        gap: 0.45rem;
    }

    .planner-week-actions .btn {
        width: 100%;
        min-height: 2.05rem;
        padding: 0.3rem 0.58rem;
    }

    .planner-week-prev {
        grid-column: 1;
    }

    .planner-week-today {
        grid-column: 2;
    }

    .planner-week-next {
        grid-column: 3;
    }

    .planner-layout {
        gap: 0.75rem;
    }

    .week-grid {
        gap: 0.5rem;
    }

    .day-slot {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
        gap: 0.5rem;
        min-height: 0;
        padding: 0.65rem;
    }

    .day-heading {
        grid-column: 1 / -1;
        align-items: center;
    }

    .day-heading h2 {
        font-size: 1.15rem;
        white-space: normal;
    }

    .day-date-row {
        gap: 0.4rem;
    }

    .day-heading .btn {
        min-height: 2.05rem;
        padding: 0.3rem 0.58rem;
        font-size: 0.8rem;
    }

    .status-banner {
        align-items: center;
        flex-direction: row;
        right: 0.75rem;
        left: 0.75rem;
    }

    .status-banner span {
        display: -webkit-box;
        overflow: hidden;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
    }

    .status-banner-actions {
        justify-content: flex-end;
    }

    .empty-slot {
        min-height: 4.9rem;
    }

    .planned-food {
        align-items: stretch;
        min-height: 0;
        padding: 0.5rem;
    }

    .day-slot textarea:not(.planned-food-notes) {
        height: auto;
        min-height: 5rem;
    }

    .planned-food-notes {
        height: auto;
        min-height: calc(1.35em + 0.75rem + 2px);
    }

    .planner-catalog {
        padding: 0.75rem;
    }

    .plan-picker {
        max-height: calc(100vh - 1rem);
        padding: 0.75rem;
    }

    .plan-picker-backdrop {
        padding: 0.5rem;
    }

    .plan-day-button {
        min-height: 4.5rem;
    }

    .drag-list {
        grid-template-columns: 1fr;
        max-height: 20rem;
    }

    .drag-food {
        grid-template-columns: 42px minmax(0, 1fr);
        gap: 0.55rem;
    }

    .drag-food img {
        width: 42px;
        height: 42px;
    }
}

@media (max-width: 420px) {
    .app-header-top {
        flex-wrap: nowrap;
    }

    .header-actions {
        flex-shrink: 1;
        width: auto;
    }

    .user-name {
        max-width: 7.25rem;
        text-align: right;
    }
}

@media (max-width: 640px) {
    .upload-preview,
    .food-edit-preview {
        width: 100%;
    }

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

    .food-card {
        display: grid;
        grid-template-rows: 1fr auto;
    }

    .food-card-link {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
    }

    .food-card-link > img {
        width: 100%;
        height: auto;
        max-height: 18rem;
        aspect-ratio: 16 / 9;
        object-fit: cover;
    }

    .food-card > img {
        aspect-ratio: 16 / 9;
        max-height: 18rem;
    }

    .food-card-body {
        gap: 0.4rem;
        padding: 0.75rem;
    }

    .food-card h2 {
        font-size: 1.05rem;
        line-height: 1.25;
    }

    .food-card p,
    .food-usage,
    .food-summary .food-usage {
        font-size: 0.82rem;
    }

    .food-card-actions {
        padding: 0 0.75rem 0.75rem;
    }

    .food-card-actions .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.85rem;
    }

    .food-detail-image {
        max-height: 48vh;
    }
}

html,
body {
    color-scheme: dark;
    background: #0f1412;
    color: #f4efe7;
}

.app-startup,
.app-shell {
    background: #0f1412;
    color: #f4efe7;
}

.app-startup-card,
.app-header,
.login-card,
.upload-box,
.food-card,
.food-detail-panel,
.plan-conflict-dialog,
.plan-picker,
.planner-catalog,
.day-slot,
.users-panel,
.feedback-panel,
.feedback-item,
.checklist-add-form,
.day-edit-panel,
.checklist-item {
    border-color: #303936;
    background: #171c1a;
    color: #f4efe7;
}

.user-row,
.admin-settings-panel {
    border-color: #303936;
}

.day-slot.is-past {
    border-color: #222a27;
    background: #0b0f0d;
}

.day-slot.is-past .planned-food {
    border-color: #25332b;
    background: #111915;
    color: #bdc8c2;
}

.day-slot.is-past .planned-food-planned-by {
    color: #7f8a84;
}

.day-slot.is-past .planned-food-image-link {
    background: #141a17;
}

.day-slot.is-past .planned-food img {
    filter: saturate(0.58) brightness(0.66);
}

.day-slot.is-past .form-control {
    border-color: #343d39;
    background-color: #121715;
    color: #9aa39e;
}

.day-slot.is-today {
    border-color: #3b5545;
    background: #122619;
}

.day-slot.is-today::before,
.day-slot.is-today::after {
    background: #8fe0a7;
}

.app-header {
    background: rgba(15, 20, 18, 0.97);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04);
}

.catalog-toolbar {
    background: #0f1412;
}

.plan-picker header,
.plan-conflict-dialog header,
.plan-picker-toolbar,
.checklist-edit {
    border-color: #303936;
}

.plan-picker-toolbar,
.checklist-edit {
    background: #111715;
}

.checklist-item.is-checked {
    border-color: #29322f;
    background: #111715;
}

.brand {
    color: #f4efe7;
}

.app-nav a {
    color: #c9d3ce;
}

.app-nav a.active,
.app-nav a:hover {
    background: #233a2d;
    color: #e8fff0;
}

.user-name,
.app-startup-card span,
.page-title-row p,
.food-card p,
.login-help,
.food-usage,
.food-usage-detail,
.food-summary .food-usage,
.food-summary .food-tags,
.food-summary .food-added-by,
.upload-box label,
.food-edit-form label,
.feedback-form label,
.form-field,
.days-control,
.planned-food-planned-by,
.recipe-full p,
.plan-picker p,
.plan-conflict-dialog p,
.plan-day-button span,
.day-heading span,
.checklist-trailing,
.feedback-item span,
.toolbar-check,
.tag-picker-placeholder,
.tag-chip span:last-child,
.shift-days-control,
.file-picker-state {
    color: #aeb8b3;
}

.admin-label {
    color: #8fe0a7;
}

.admin-label[aria-pressed="false"] {
    color: #c9d3ce;
}

.form-control,
.form-select,
.tag-picker-selected,
.recipe-details pre,
.recipe-full pre,
.plan-day-button,
.drag-food,
.empty-slot,
.empty-state,
.loading-state,
.due-date {
    border-color: #3a4541;
    background-color: #202624;
    color: #f4efe7;
}

.checklist-text,
.added-by-display {
    color: #f4efe7;
}

.checklist-item.is-checked .checklist-text {
    color: #aeb8b3;
}

.form-control::placeholder {
    color: #77827d;
}

.form-control:disabled,
.form-select:disabled {
    background-color: #1b211f;
    color: #7f8984;
}

.tag-chip,
.planned-food,
.drag-food:hover,
.drag-food:focus,
.empty-slot-button:hover,
.empty-slot-button:focus,
.plan-day-button:hover,
.plan-day-button:focus {
    border-color: #315d43;
    background: #1d3327;
    color: #f4efe7;
}

.planned-food:hover,
.planned-food:focus {
    background: #24402f;
}

.planned-food-continuation {
    border-color: #82d598;
    background: #172f20;
    color: #e3f6e7;
    box-shadow: inset 0.28rem 0 0 rgba(130, 213, 152, 0.32);
}

.day-slot.is-past .planned-food-continuation {
    border-color: #4f7d5b;
    background: #111c16;
    color: #b8c8be;
    box-shadow: inset 0.28rem 0 0 rgba(79, 125, 91, 0.28);
}

.food-card-link,
.planned-food-name,
.planned-food-image-link,
.drag-food {
    color: #f4efe7;
}

.food-card-link:hover h2,
.planned-food-name:hover,
.planned-food-name:focus {
    color: #9be3ad;
}

.food-card img,
.food-detail-image,
.food-edit-preview,
.drag-food img,
.planned-food img {
    background: #252d2a;
}

.food-tags.empty,
.food-summary .food-tags.empty {
    color: #d8b878;
}

.recipe-present,
.recipe-details summary,
.user-row span {
    color: #9be3ad;
}

.urgency-pill.low {
    border-color: #4c5953;
    background: #202624;
    color: #c9d3ce;
}

.urgency-pill.medium {
    border-color: #35618c;
    background: #142434;
    color: #c8e2ff;
}

.urgency-pill.high,
.due-date.overdue {
    border-color: #9b5a55;
    background: #3a1f1d;
    color: #ffd8d4;
}

.due-date.today {
    border-color: #7d6630;
    background: #352b19;
    color: #ffe6a7;
}

.food-meta dt {
    color: #aeb8b3;
}

.food-meta dd,
.recipe-full pre,
.recipe-details pre {
    color: #f4efe7;
}

.btn-outline-dark,
.btn-outline-secondary {
    border-color: #7a8580;
    color: #f4efe7;
}

.btn-outline-dark:hover,
.btn-outline-dark:focus,
.btn-outline-secondary:hover,
.btn-outline-secondary:focus {
    border-color: #f4efe7;
    background: #f4efe7;
    color: #0f1412;
}

.btn-outline-primary {
    border-color: #4b9270;
    color: #9be3ad;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
    border-color: #9be3ad;
    background: #1d3327;
    color: #f4efe7;
}

.btn-danger,
.btn-outline-danger {
    border-color: #9b5a55;
    background: #7c342f;
    color: #fff7f5;
}

.btn-danger:hover,
.btn-danger:focus,
.btn-outline-danger:hover,
.btn-outline-danger:focus {
    border-color: #ffb9b3;
    background: #963f39;
    color: #fff;
}

.alert-info {
    border-color: #315d43;
    background: #1d3327;
    color: #ddf7e3;
}

.alert-danger {
    border-color: #7c342f;
    background: #3a1f1d;
    color: #ffd8d4;
}

.alert-success {
    border-color: #315d43;
    background: #1d3327;
    color: #ddf7e3;
}

.alert-warning {
    border-color: #7d6630;
    background: #352b19;
    color: #ffe6a7;
}

#blazor-error-ui {
    color-scheme: dark;
    background: #352b19;
    color: #ffe6a7;
}
