html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

html {
    color-scheme: light dark;
}

[data-bs-theme="dark"] {
    color-scheme: dark;
}

[data-bs-theme="light"] {
    color-scheme: light;
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

[data-bs-theme="dark"] a:not(.btn),
[data-bs-theme="dark"] .btn-link {
    color: #6ea8fe;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

[data-bs-theme="dark"] .btn:focus,
[data-bs-theme="dark"] .btn:active:focus,
[data-bs-theme="dark"] .form-control:focus,
[data-bs-theme="dark"] .form-check-input:focus {
    box-shadow: 0 0 0 0.1rem #212529, 0 0 0 0.25rem #6ea8fe;
}

.content {
    padding-top: 1.1rem;
}

@media (max-width: 640.98px) {
    .profile-save-bar-inner:not(.profile-save-bar-inner--split) .btn-primary {
        flex: 1;
    }
}

main {
    background-color: var(--bs-body-bg);
    color: var(--bs-body-color);
    min-height: 100vh;
    min-height: 100dvh;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

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

[data-bs-theme="dark"] #blazor-error-ui {
    background: #332701;
    color: #ffecb5;
}

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

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 auto 0 auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

.dashboard-hero {
    border-radius: 0.75rem;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    color: var(--bs-body-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.dashboard-calorie-ring {
    position: relative;
    width: min(100%, 14rem);
    aspect-ratio: 1;
}

.dashboard-calorie-ring-svg {
    width: 100%;
    height: 100%;
    display: block;
    transform: rotate(-90deg);
}

.dashboard-calorie-ring-track,
.dashboard-calorie-ring-progress {
    fill: none;
    stroke-width: 12;
    stroke-linecap: round;
}

.dashboard-calorie-ring-track {
    stroke: var(--bs-border-color);
}

.dashboard-calorie-ring-progress {
    stroke: #1b6ec2;
    transition: stroke-dashoffset 0.35s ease;
}

[data-bs-theme="dark"] .dashboard-calorie-ring-progress {
    stroke: #6ea8fe;
}

.dashboard-calorie-ring-progress.is-over-limit {
    stroke: var(--bs-danger);
}

.dashboard-calorie-ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    line-height: 1.15;
}

.dashboard-calorie-ring-value {
    font-size: clamp(1.75rem, 6vw, 2.35rem);
    font-weight: 700;
    color: var(--bs-body-color);
}

.dashboard-calorie-ring-caption {
    margin-top: 0.35rem;
    font-size: 0.9rem;
    color: var(--bs-secondary-color);
}

.dashboard-hero.over-limit {
    background: var(--bs-danger-bg-subtle);
    border-color: var(--bs-danger-border-subtle);
}

.dashboard-label {
    margin: 0;
    color: var(--bs-secondary-color);
    font-size: 0.95rem;
}

.dashboard-remaining {
    margin: 0.25rem 0 0;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1.1;
}

.dashboard-over {
    margin: 0;
    color: var(--bs-danger-text-emphasis);
    font-weight: 600;
}

.stat-card {
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    color: var(--bs-body-color);
}

a.stat-card-link {
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

a.stat-card-link:hover,
a.stat-card-link:focus-visible {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-primary);
    color: var(--bs-body-color);
}

a.stat-card-link:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.dashboard-stats {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.stat-label {
    color: var(--bs-secondary-color);
    font-size: 0.875rem;
}

.stat-value {
    font-size: 1.25rem;
    font-weight: 600;
}

.weight-blank {
    width: 5rem;
    height: 2.5rem;
    border: 2px dashed var(--bs-border-color);
    border-radius: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--bs-secondary-color);
}

.weight-blank-muted {
    border-style: dotted;
    opacity: 0.6;
}

.weight-value {
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0;
}

.barcode-scan-shell--idle {
    position: fixed;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
    pointer-events: none;
}

.barcode-scanner {
    background: #111;
    border-radius: 0.75rem;
    overflow: hidden;
    margin-bottom: 1rem;
    max-width: 28rem;
}

.barcode-video {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    object-fit: cover;
}

.barcode-scan-modal {
    --bs-modal-zindex: 2100;
    z-index: 2100;
}

.barcode-scan-backdrop {
    --bs-backdrop-zindex: 2090;
    z-index: 2090;
}

.product-card {
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 1.25rem;
    color: var(--bs-body-color);
}

.intake-summary {
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    padding: 1.25rem;
    color: var(--bs-body-color);
}

.intake-summary .text-muted {
    color: var(--bs-secondary-color) !important;
}

.intake-total {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--bs-body-color);
}

.food-entry-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Quick add: keep recent rows full-width (easier tap targets beside square + buttons) */
.food-quick-recent-list.food-entry-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.food-entry-item {
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 0;
    color: var(--bs-body-color);
    overflow: hidden;
}

.food-entry-swipe-track {
    display: flex;
    align-items: stretch;
    position: relative;
}

.food-entry-swipe-content {
    flex: 1 1 auto;
    min-width: 0;
    padding: 0.875rem 1rem;
    background: var(--bs-tertiary-bg);
    position: relative;
    z-index: 1;
    touch-action: pan-y;
}

.food-entry-swipe-actions {
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 0.5rem;
    padding: 0 0.75rem;
    background: var(--bs-tertiary-bg);
    flex-shrink: 0;
}

@media (max-width: 640.98px) {
    .food-entry-swipe-actions {
        position: absolute;
        right: 0;
        top: 0;
        bottom: 0;
        z-index: 0;
    }

    .food-entry-swipe--open .food-entry-swipe-actions {
        z-index: 2;
    }

    .food-entry-action-icon {
        display: none;
    }
}

@media (min-width: 641px) {
    .food-entry-swipe-track {
        align-items: center;
        gap: 0.5rem;
    }

    .food-entry-swipe-content {
        flex: 1;
    }

    .food-entry-swipe-actions {
        padding: 0.875rem 1rem 0.875rem 0;
    }

    .food-entry-action-btn {
        width: 2.25rem;
        height: 2.25rem;
        padding: 0;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .food-entry-action-label {
        display: none;
    }

    .food-entry-action-icon {
        width: 1rem;
        height: 1rem;
    }
}

.food-entry-item .text-muted {
    color: var(--bs-secondary-color) !important;
}

.food-entry-main {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 1rem;
}

.food-entry-name {
    font-weight: 600;
    color: var(--bs-body-color);
}

.food-entry-calories {
    font-weight: 600;
    white-space: nowrap;
    color: var(--bs-body-color);
}

/* Quick-add row: fixed height; + button column matches row height */
.food-quick-log-row {
    --food-quick-btn-size: 3.5rem;
    --food-quick-row-height: 3.5rem;
    display: grid;
    grid-template-columns: var(--food-quick-btn-size) minmax(0, 1fr);
    align-items: center;
    width: 100%;
    height: var(--food-quick-row-height);
    min-height: var(--food-quick-row-height);
    max-height: var(--food-quick-row-height);
    border: 1px solid var(--bs-border-color);
    border-radius: var(--bs-border-radius);
    overflow: hidden;
    background-color: var(--bs-body-bg);
}

.food-quick-log-aside {
    position: relative;
    grid-column: 1;
    place-self: stretch;
    width: 100%;
    height: 100%;
    min-width: 0;
    min-height: 0;
}

.food-quick-log-aside .food-quick-log-btn {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    border-radius: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

.food-quick-log-aside .food-quick-log-icon {
    width: 58%;
    height: 58%;
    flex-shrink: 0;
}

.food-quick-log-row > .food-quick-entry-display {
    grid-column: 2;
    min-width: 0;
    min-height: 0;
    max-height: 100%;
    padding: 0.25rem 0.5rem;
    overflow: hidden;
    display: flex;
    align-items: center;
    background-color: var(--bs-body-bg);
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

.food-quick-entry-grid {
    display: grid;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto auto;
    width: 100%;
    column-gap: 0.375rem;
    row-gap: 0;
    align-items: center;
}

.food-quick-entry-grid .food-entry-name {
    grid-column: 1 / -1;
    grid-row: 1;
    min-width: 0;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.food-quick-entry-grid .food-entry-meta {
    grid-column: 1;
    grid-row: 2;
    min-width: 0;
}

.food-quick-entry-grid .food-entry-calories {
    grid-column: 2;
    grid-row: 2;
    justify-self: end;
    align-self: end;
}

.weekly-chart-section {
    color: var(--bs-body-color);
}

.weekly-calorie-chart {
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 1rem 0.75rem 0.5rem;
}

.weekly-calorie-chart-inner {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.5rem;
    align-items: end;
    min-height: 12rem;
}

.weekly-calorie-column {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    min-width: 0;
}

.weekly-calorie-bar-area {
    position: relative;
    width: 100%;
    height: 10rem;
    display: flex;
    align-items: flex-end;
    justify-content: center;
}

.weekly-calorie-bar {
    width: 70%;
    max-width: 2.5rem;
    background: #1b6ec2;
    border-radius: 0.25rem 0.25rem 0 0;
    min-height: 2px;
}

[data-bs-theme="dark"] .weekly-calorie-bar {
    background: #6ea8fe;
}

.weekly-budget-line {
    position: absolute;
    left: 0;
    right: 0;
    border-top: 2px dashed var(--bs-secondary-color);
    pointer-events: none;
}

.weekly-burn-badge {
    position: absolute;
    top: 0.25rem;
    font-size: 0.65rem;
    color: var(--bs-success);
    white-space: nowrap;
}

.weekly-day-label {
    font-size: 0.75rem;
    color: var(--bs-secondary-color);
    text-transform: uppercase;
}

.weekly-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

.weekly-legend-swatch {
    display: inline-block;
    width: 0.75rem;
    height: 0.75rem;
    margin-right: 0.35rem;
    vertical-align: middle;
    border-radius: 0.125rem;
}

.weekly-legend-swatch.consumed {
    background: #1b6ec2;
}

[data-bs-theme="dark"] .weekly-legend-swatch.consumed {
    background: #6ea8fe;
}

.weekly-legend-swatch.budget {
    border-top: 2px dashed var(--bs-secondary-color);
    height: 0;
    width: 1rem;
    margin-top: 0.35rem;
}

.weekly-weight-chart {
    background: var(--bs-tertiary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 1rem 0.75rem 0.5rem;
}

.weekly-weight-svg {
    width: 100%;
    max-width: 32rem;
    height: auto;
    display: block;
    margin: 0 auto;
}

.weekly-weight-line {
    fill: none;
    stroke: #1b6ec2;
    stroke-width: 2;
}

[data-bs-theme="dark"] .weekly-weight-line {
    stroke: #6ea8fe;
}

.weekly-weight-point {
    fill: #1b6ec2;
}

[data-bs-theme="dark"] .weekly-weight-point {
    fill: #6ea8fe;
}

.weekly-weight-labels {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 0.5rem;
    text-align: center;
}

.dashboard-macros .macro-row + .macro-row {
    margin-top: 1rem;
}

.macro-label {
    font-size: 0.875rem;
    font-weight: 600;
}

.macro-value {
    font-size: 0.875rem;
    color: var(--bs-secondary-color);
    margin-bottom: 0.35rem;
}

.macro-progress {
    height: 0.5rem;
}

.profile-intro {
    max-width: 40rem;
    margin-bottom: 1.5rem;
}

.profile-form {
    max-width: 48rem;
}

/* Desktop: use the full main column (sidebar + content), not a narrow left strip */
@media (min-width: 992px) {
    .profile-form,
    .profile-intro {
        max-width: none;
        width: 100%;
    }

    .weekly-weight-svg {
        max-width: none;
    }

    .dashboard-page-top {
        display: grid;
        grid-template-columns: minmax(17rem, 22rem) 1fr;
        gap: 1.5rem 2rem;
        align-items: stretch;
        margin-bottom: 1.5rem;
    }

    .dashboard-page-top .dashboard-hero {
        margin-bottom: 0;
        height: 100%;
    }

    .dashboard-page-top .dashboard-stats {
        margin-bottom: 0;
        align-self: center;
    }

    .dashboard-page-top .stat-card {
        width: 100%;
    }

    .food-entry-list:not(.food-quick-recent-list) {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.75rem;
    }

    .admin-content {
        max-width: none;
        width: 100%;
    }
}

@media (min-width: 1400px) {
    .food-entry-list:not(.food-quick-recent-list) {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .profile-form-body.weekly-summary-page {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 1rem;
        align-items: start;
    }

    .profile-form-body.weekly-summary-page > .profile-intro {
        grid-column: 1 / -1;
    }
}

.profile-form-with-save-bar {
    padding-bottom: calc(4.25rem + env(safe-area-inset-bottom, 0px));
}

.profile-save-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1020;
    background-color: var(--bs-body-bg);
    border-top: 1px solid var(--bs-border-color);
    box-shadow: 0 -0.25rem 0.75rem rgba(0, 0, 0, 0.06);
    padding: 0.75rem 1.5rem;
    padding-bottom: max(0.75rem, env(safe-area-inset-bottom, 0px));
}

@media (max-width: 640.98px) {
    .profile-save-bar {
        padding-left: 1rem;
        padding-right: 1rem;
        background-color: rgba(var(--bs-body-bg-rgb), 0.85);
        -webkit-backdrop-filter: saturate(180%) blur(20px);
        backdrop-filter: saturate(180%) blur(20px);
        border-top-width: 0.5px;
        box-shadow: none;
    }

    .profile-save-bar .btn {
        flex: 1 1 0;
        width: auto;
        min-width: 0;
        min-height: 44px;
        padding: 0.5rem;
        font-size: 0.875rem;
        border-radius: 10px;
        touch-action: manipulation;
        -webkit-tap-highlight-color: transparent;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .profile-save-bar-inner--split {
        flex-direction: row;
        flex-wrap: nowrap;
        align-items: stretch;
        gap: 0.5rem;
    }

    /* Flatten action groups so every button shares one horizontal row */
    .profile-save-bar-inner--split .profile-save-bar-actions {
        display: contents;
    }
}

.profile-save-bar-inner {
    width: 100%;
    max-width: 48rem;
    box-sizing: border-box;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.75rem;
}

.profile-save-bar-inner--split {
    justify-content: space-between;
}

.profile-save-bar-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

.profile-save-bar .btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1.25;
}

@media (min-width: 641px) {
    .profile-save-bar {
        left: 250px;
        padding-left: 2rem;
        padding-right: 1.5rem;
    }

    .profile-save-bar-inner {
        max-width: none;
    }
}

.profile-section {
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 1.25rem;
    margin-bottom: 1rem;
}

.login-card {
    width: 100%;
    max-width: 24rem;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 2rem;
}

.login-card-title {
    font-size: 1.5rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    text-align: center;
}

.login-submit {
    width: 100%;
}

.login-card-footer {
    margin-top: 1.25rem;
    margin-bottom: 0;
    text-align: center;
    color: var(--bs-secondary-color);
}

.login-card-footer a {
    margin-left: 0.25rem;
}

a.profile-section-link {
    display: block;
    text-decoration: none;
    color: inherit;
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

a.profile-section-link:hover,
a.profile-section-link:focus-visible {
    background: var(--bs-tertiary-bg);
    border-color: var(--bs-primary);
    color: var(--bs-body-color);
}

a.profile-section-link:focus-visible {
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.profile-section-title {
    font-size: 1.125rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
}

.profile-section-lead {
    color: var(--bs-secondary-color);
    font-size: 0.875rem;
    margin: 0 0 1rem;
}

.profile-subsection-title {
    font-size: 1rem;
    font-weight: 600;
    margin: 0 0 0.25rem;
}

.profile-notifications {
    border-top: 1px solid var(--bs-border-color);
    padding-top: 1rem;
}

.food-search-panel {
    border-top: 1px solid var(--bs-border-color);
}

.food-search-hit {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 0.125rem;
    width: 100%;
    text-align: left;
}

.food-search-hit-name {
    font-weight: 600;
}

.food-search-hit-meta {
    font-size: 0.875rem;
    color: var(--bs-secondary-color);
}

.profile-secondary-link {
    padding-left: 0;
    padding-right: 0;
}

.activity-sensor-live {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem 2rem;
}

.activity-sensor-stat {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.activity-sensor-label {
    font-size: 0.875rem;
    color: var(--bs-secondary-color);
}

.activity-sensor-value {
    font-size: 1.5rem;
    font-weight: 600;
}

.admin-page {
    display: flex;
    min-height: 100vh;
}

.admin-sidebar {
    width: 16rem;
    flex-shrink: 0;
    background: var(--bs-secondary-bg);
    border-right: 1px solid var(--bs-border-color);
    padding: 1rem;
}

.admin-sidebar-toolbar .navbar-toggler {
    display: none;
}

.admin-sidebar-toolbar .sidebar-header {
    --bs-gutter-x: 0;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.5rem;
    padding-left: 0;
    padding-right: 0;
}

.admin-sidebar-heading {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    min-width: 0;
    flex: 1;
}

.admin-sidebar-toolbar .navbar-brand {
    font-size: 1.1rem;
    color: var(--bs-emphasis-color);
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.admin-back-link--panel {
    display: none;
    margin-bottom: 0.75rem;
}

.admin-brand {
    font-size: 1.25rem;
    font-weight: 700;
    text-decoration: none;
    color: inherit;
}

.admin-back-link {
    font-size: 0.875rem;
}

.admin-nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.admin-nav-link {
    display: block;
    padding: 0.5rem 0.75rem;
    border-radius: 0.375rem;
    text-decoration: none;
    color: inherit;
}

.admin-nav-link.active {
    background: var(--bs-primary);
    color: var(--bs-primary-text-emphasis, #fff);
}

.admin-main {
    flex: 1;
    min-width: 0;
}

.admin-content {
    padding: 1.5rem;
    max-width: 72rem;
}

.admin-lead {
    color: var(--bs-secondary-color);
    margin-bottom: 1.5rem;
}

.admin-card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr));
    gap: 1rem;
}

.admin-card {
    display: block;
    padding: 1rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    background: var(--bs-secondary-bg);
    text-decoration: none;
    color: inherit;
}

.admin-card h2 {
    font-size: 1.125rem;
    margin: 0 0 0.5rem;
}

.admin-card p {
    margin: 0;
    font-size: 0.875rem;
    color: var(--bs-secondary-color);
}

.admin-table {
    margin-top: 1rem;
}

.admin-inline-form {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.admin-user-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

.admin-actions-dropdown {
    position: relative;
}

.admin-actions-dropdown .dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    z-index: 1050;
    margin-top: 0.125rem;
}

.admin-actions-dropdown .dropdown-item {
    width: 100%;
    text-align: left;
    border: 0;
    background: transparent;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 0.5rem;
}

.admin-form-section {
    margin-bottom: 1.5rem;
}

.admin-dl dt {
    font-weight: 600;
    margin-top: 0.75rem;
}

.admin-dl dd {
    margin-bottom: 0;
}

.admin-status-badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 999px;
    font-size: 0.875rem;
    font-weight: 600;
}

.admin-status-badge.is-healthy {
    background: rgba(25, 135, 84, 0.15);
    color: var(--bs-success);
}

.admin-status-badge.is-degraded {
    background: rgba(255, 193, 7, 0.2);
    color: var(--bs-warning-text-emphasis, #664d03);
}

.admin-status-badge.is-unhealthy {
    background: rgba(220, 53, 69, 0.15);
    color: var(--bs-danger);
}

@media (max-width: 768px) {
    .admin-page {
        flex-direction: column;
    }

    .admin-sidebar {
        width: 100%;
        padding: 0;
        border-right: none;
        border-bottom: 1px solid var(--bs-border-color);
    }

    .admin-sidebar-toolbar {
        margin-bottom: 0;
    }

    .admin-sidebar-toolbar .navbar-toggler {
        display: inline-block;
        flex-shrink: 0;
        border: 1px solid var(--bs-border-color);
        background-color: var(--bs-secondary-bg);
    }

    .admin-sidebar-heading {
        flex-direction: row;
        align-items: center;
    }

    .admin-sidebar-heading .admin-brand {
        flex: 1;
        min-width: 0;
    }

    .admin-back-link--toolbar {
        display: none;
    }

    .admin-back-link--panel {
        display: block;
        padding: 0.75rem 1rem 0;
    }

    .admin-nav-panel {
        padding: 0 1rem 1rem;
        background: var(--bs-secondary-bg);
    }

    .admin-nav-panel.collapse {
        display: none;
    }
}

@media (min-width: 769px) {
    .admin-sidebar-toolbar {
        margin-bottom: 1rem;
    }

    .admin-nav-panel.collapse {
        display: block;
    }
}

.onboarding-layout {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    padding-bottom: max(1.5rem, env(safe-area-inset-bottom, 0px));
    background-color: var(--bs-body-bg);
}

.onboarding-loading {
    text-align: center;
    color: var(--bs-secondary-color);
}

.onboarding-card {
    width: 100%;
    max-width: 32rem;
    background: var(--bs-secondary-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 0.5rem;
    padding: 1.5rem;
}

.onboarding-progress {
    display: flex;
    gap: 0.375rem;
    margin-bottom: 1rem;
}

.onboarding-progress-step {
    flex: 1;
    height: 0.25rem;
    border-radius: 999px;
    background: var(--bs-border-color);
}

.onboarding-progress-step.is-active,
.onboarding-progress-step.is-complete {
    background: var(--bs-primary);
}

.onboarding-step-label {
    font-size: 0.8125rem;
    color: var(--bs-secondary-color);
    margin-bottom: 0.5rem;
}

.onboarding-title {
    font-size: 1.375rem;
    font-weight: 600;
    margin-bottom: 0.75rem;
}

.onboarding-welcome {
    color: var(--bs-body-color);
    margin-bottom: 0.5rem;
}

.onboarding-why {
    color: var(--bs-secondary-color);
    font-size: 0.9375rem;
    margin-bottom: 1.25rem;
}

.onboarding-optional-hint {
    font-size: 0.875rem;
    margin-top: 0.75rem;
    margin-bottom: 0;
}

.onboarding-subtitle {
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.onboarding-trust {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--bs-secondary-color);
    margin-top: 1.25rem;
    margin-bottom: 0;
}

.onboarding-trust-icon {
    flex-shrink: 0;
    line-height: 1.4;
}

.onboarding-actions {
    display: flex;
    justify-content: space-between;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.onboarding-actions .btn-primary {
    min-width: 7rem;
}

.register-card {
    max-width: 28rem;
}

.register-intro {
    text-align: center;
    font-size: 0.9375rem;
    margin-bottom: 1.25rem;
}