html {
  font-size: 14px;
}

:root {
  --ct-space-1: 0.25rem;
  --ct-space-2: 0.5rem;
  --ct-space-3: 0.75rem;
  --ct-space-4: 1rem;
  --ct-space-5: 1.5rem;
  --ct-space-6: 2rem;
  --ct-space-7: 3rem;
  --ct-radius-sm: 0.625rem;
  --ct-radius-md: 0.875rem;
  --ct-radius-lg: 1.125rem;
  --ct-radius-xl: 1.5rem;
  --ct-radius-pill: 999px;
  --ct-shadow-sm: 0 2px 8px rgba(38, 48, 61, 0.06);
  --ct-shadow-md: 0 10px 28px rgba(38, 48, 61, 0.08);
  --ct-canvas: #f7f5f0;
  --ct-surface: #fffdfa;
  --ct-surface-raised: #ffffff;
  --ct-surface-soft: #f0ede6;
  --ct-sidebar-surface: #efede8;
  --ct-text: #17233b;
  --ct-text-muted: #647083;
  --ct-ink-on-pastel: #17233b;
  --ct-border: rgba(39, 48, 64, 0.12);
  --ct-border-strong: rgba(39, 48, 64, 0.2);
  --ct-primary: #356cb6;
  --ct-primary-strong: #265895;
  --ct-primary-soft: #e7f0fb;
  --ct-calorie-ring: #78a987;
  --ct-success: #3d9d63;
  --ct-warning: #d79535;
  --ct-danger: #c8525f;
  --ct-focus: #2e75d1;
  --ct-content-max: 86rem;
  --ct-reading-max: 52rem;
  --ct-sidebar-width: 15.75rem;
  --bs-body-bg: var(--ct-canvas);
  --bs-body-color: var(--ct-text);
  --bs-emphasis-color: var(--ct-text);
  --bs-secondary-color: var(--ct-text-muted);
  --bs-secondary-bg: var(--ct-surface-soft);
  --bs-tertiary-bg: var(--ct-surface);
  --bs-border-color: var(--ct-border);
  --bs-primary: var(--ct-primary);
  --bs-primary-rgb: 53, 108, 182;
  --bs-link-color: var(--ct-primary-strong);
  --bs-link-hover-color: #173f72;
  --ct-empty-favourite-color: #8a6500;
  --ct-macro-protein: #d63384;
  --ct-macro-carbohydrates: #ffc107;
  --ct-macro-fat: #198754;
  --ct-balance-heavy-cut: #696fb5;
  --ct-balance-light-cut: #a5a9d7;
  --ct-balance-maintenance: #70ae8a;
  --ct-balance-light-gain: #e2b565;
  --ct-balance-heavy-gain: #d27870;
  --ct-balance-no-data: #e4e7ea;
  --ct-balance-unclassified: #d7d0c2;
  --ct-balance-cell-border: rgba(33, 37, 41, 0.18);
}

[data-bs-theme="dark"] {
  color-scheme: dark;
  --ct-shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.22);
  --ct-shadow-md: 0 14px 34px rgba(0, 0, 0, 0.28);
  --ct-canvas: #151a20;
  --ct-surface: #1d232b;
  --ct-surface-raised: #232b35;
  --ct-surface-soft: #29323d;
  --ct-sidebar-surface: #12171d;
  --ct-text: #eef2f6;
  --ct-text-muted: #a9b4c2;
  --ct-border: rgba(235, 241, 247, 0.11);
  --ct-border-strong: rgba(235, 241, 247, 0.2);
  --ct-primary: #86b8f5;
  --ct-primary-strong: #a9ccf8;
  --ct-primary-soft: #263a50;
  --ct-calorie-ring: #7ead8b;
  --ct-success: #65bd82;
  --ct-warning: #e5b05e;
  --ct-danger: #e27b85;
  --ct-focus: #8fc4ff;
  --bs-body-bg: var(--ct-canvas);
  --bs-body-color: var(--ct-text);
  --bs-emphasis-color: var(--ct-text);
  --bs-secondary-color: var(--ct-text-muted);
  --bs-secondary-bg: var(--ct-surface-soft);
  --bs-tertiary-bg: var(--ct-surface);
  --bs-border-color: var(--ct-border);
  --bs-primary: var(--ct-primary);
  --bs-primary-rgb: 134, 184, 245;
  --bs-link-color: var(--ct-primary-strong);
  --bs-link-hover-color: #d1e5ff;
  --ct-empty-favourite-color: #ffc107;
  --ct-balance-heavy-cut: #7d83cd;
  --ct-balance-light-cut: #5f658f;
  --ct-balance-maintenance: #579671;
  --ct-balance-light-gain: #aa7f3f;
  --ct-balance-heavy-gain: #ae5e59;
  --ct-balance-no-data: #343a40;
  --ct-balance-unclassified: #625b50;
  --ct-balance-cell-border: rgba(255, 255, 255, 0.2);
}

@media (min-width: 768px) {
  html {
    font-size: 16px;
  }
}

.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;
}

.btn-outline-warning {
  --bs-btn-color: var(--ct-empty-favourite-color);
  --bs-btn-border-color: var(--ct-empty-favourite-color);
  --bs-btn-hover-bg: #ffc107;
  --bs-btn-hover-border-color: #ffc107;
  --bs-btn-hover-color: #212529;
}

html {
  position: relative;
  min-height: 100%;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  margin-bottom: 0;
}

/* =========================
   MY FOODS COLLECTION
   ========================= */

.foods-page {
    display: grid;
    width: 100%;
    min-width: 0;
    gap: var(--ct-space-5);
    padding-bottom: var(--ct-space-4);
}

.foods-hero {
    min-height: 13rem;
    margin-bottom: 0;
    padding: clamp(1.5rem, 3vw, 2.5rem);
}

.foods-hero.ct-scenic-header--with-art {
    grid-template-columns: minmax(0, 1fr) minmax(15rem, 24rem);
    gap: clamp(1rem, 3vw, 3rem);
}

.foods-hero .ct-page-title {
    font-size: clamp(2.25rem, 5vw, 4rem);
}

.foods-hero .ct-scenic-header__art {
    width: 100%;
    height: auto;
    min-height: 0;
    align-self: center;
    aspect-ratio: auto;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.foods-hero .ct-scenic-header__art img {
    width: 100%;
    height: auto;
    max-height: 10rem;
    object-fit: contain;
    object-position: center right;
}

.foods-search-panel {
    min-width: 0;
    padding: var(--ct-space-5);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-lg);
    background: var(--ct-surface-raised);
    box-shadow: var(--ct-shadow-sm);
}

.foods-empty-state h2 {
    margin: 0;
    font-size: 1.1rem;
}

.foods-empty-state p {
    margin: var(--ct-space-1) 0 0;
    color: var(--ct-text-muted);
}

.foods-search-form {
    display: grid;
    min-width: 0;
    gap: var(--ct-space-3);
}

.foods-search-controls {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(8rem, auto);
    min-width: 0;
    gap: var(--ct-space-2);
}

.foods-search-controls .form-control,
.foods-search-controls .form-select {
    min-height: 3rem;
    border-radius: var(--ct-radius-md);
}

.foods-search-actions {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ct-space-2);
}

.foods-search-actions .btn {
    display: inline-flex;
    align-items: center;
    gap: var(--ct-space-1);
}

.community-food-actions,
.community-vote {
    display: flex;
    align-items: center;
    gap: 0.65rem;
    flex-wrap: wrap;
}

.community-vote {
    gap: 0.2rem;
    padding: 0.2rem;
    border: 1px solid var(--ct-border);
    border-radius: 999px;
}

.community-vote form { display: flex; }

.community-vote__button {
    width: 2.25rem;
    min-height: 2.25rem;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
}

.community-vote__button:hover,
.community-vote__button:focus-visible,
.community-vote__button.is-active {
    color: var(--bs-primary);
    background: color-mix(in srgb, var(--bs-primary) 14%, transparent);
}

.community-vote__score {
    min-width: 2ch;
    text-align: center;
    font-weight: 700;
}

.diary-food-source-selector {
    display: inline-flex;
    max-width: 100%;
    gap: var(--ct-space-1);
    padding: var(--ct-space-1);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-md);
    background: var(--ct-surface-soft);
}

.diary-food-source-selector a {
    display: inline-flex;
    min-height: 2.5rem;
    align-items: center;
    justify-content: center;
    padding: var(--ct-space-2) var(--ct-space-3);
    border-radius: var(--ct-radius-sm);
    color: var(--ct-text-muted);
    font-weight: 700;
    text-decoration: none;
}

.diary-food-source-selector a:hover,
.diary-food-source-selector a:focus-visible {
    color: var(--ct-primary-strong);
    background: var(--ct-primary-soft);
}

.diary-food-source-selector a:focus-visible {
    outline: 3px solid var(--ct-focus);
    outline-offset: 1px;
}

.diary-food-source-selector a.is-active {
    background: var(--ct-surface-raised);
    box-shadow: var(--ct-shadow-sm);
    color: var(--ct-primary-strong);
}

.diary-community-search {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--ct-space-2);
    margin-top: var(--ct-space-4);
}

.diary-community-search .form-control,
.diary-community-search .btn {
    min-height: 3rem;
}

.diary-community-results {
    display: grid;
    gap: var(--ct-space-3);
    margin-top: var(--ct-space-4);
}

.diary-community-result {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: var(--ct-space-3);
    padding: var(--ct-space-3);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-md);
    background: var(--ct-surface-raised);
}

.diary-community-result > div {
    min-width: 0;
}

.diary-community-result h2 {
    margin: 0;
    overflow-wrap: anywhere;
    font-size: 1rem;
}

.diary-community-result p {
    margin: var(--ct-space-1) 0 0;
}

.diary-community-result small {
    color: var(--ct-text-muted);
}

.diary-community-result .btn {
    flex: 0 0 auto;
}

.diary-community-pagination {
    display: flex;
    gap: var(--ct-space-3);
    margin-top: var(--ct-space-3);
}

.foods-collection {
    display: grid;
    min-width: 0;
    gap: var(--ct-space-4);
}

.foods-page .foods-section,
.foods-page .foods-empty-state {
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-lg);
    background: var(--ct-surface);
    box-shadow: var(--ct-shadow-sm);
}

.foods-page .foods-section {
    padding: 0;
}

.foods-section-header {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: var(--ct-space-4);
    padding: var(--ct-space-4);
}

.foods-section-heading {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: var(--ct-space-3);
}

.foods-section-heading > div {
    min-width: 0;
}

.foods-section-heading h2 {
    margin: 0;
    font-size: 1.2rem;
}

.foods-section-heading p {
    margin: var(--ct-space-1) 0 0;
    color: var(--ct-text-muted);
    font-size: 0.85rem;
}

.foods-section-icon,
.foods-empty-state__icon {
    display: inline-grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: var(--ct-radius-pill);
}

.foods-section-icon {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.15rem;
}

.foods-section--favourites .foods-section-icon {
    background: rgba(255, 193, 7, 0.16);
    color: #a16b00;
}

.foods-section--custom .foods-section-icon {
    background: rgba(214, 51, 132, 0.13);
    color: #b52b70;
}

.foods-section--recent .foods-section-icon {
    background: rgba(var(--bs-primary-rgb), 0.13);
    color: var(--ct-primary-strong);
}

[data-bs-theme="dark"] .foods-section--favourites .foods-section-icon {
    color: #ffd76a;
}

[data-bs-theme="dark"] .foods-section--custom .foods-section-icon {
    color: #ef8abc;
}

.foods-section-count {
    flex: 0 0 auto;
    color: var(--ct-text-muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.foods-page .foods-list {
    gap: 0;
    border-top: 1px solid var(--ct-border);
    border-bottom: 1px solid var(--ct-border);
}

.foods-page .foods-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    gap: var(--ct-space-4);
    padding: var(--ct-space-3) var(--ct-space-4);
    border: 0;
    border-bottom: 1px solid var(--ct-border);
    border-radius: 0;
    background: transparent;
}

.foods-page .foods-row:last-child {
    border-bottom: 0;
}

.foods-page .foods-row .food-search-result-main,
.foods-page .foods-row .food-search-result-bottom {
    min-width: 0;
}

.foods-page .foods-row .food-search-result-main {
    align-items: center;
    gap: var(--ct-space-3);
}

.foods-page .foods-row .food-search-result-main > div {
    overflow-wrap: anywhere;
}

.foods-page .foods-row h3 {
    line-height: 1.3;
}

.foods-page .foods-row .food-search-calories {
    align-self: center;
    font-size: 0.92rem;
}

.foods-page .foods-row .food-search-result-bottom {
    justify-content: flex-end;
    gap: var(--ct-space-3);
    margin-top: 0;
}

.foods-page .foods-row .food-search-macros {
    justify-content: flex-end;
    gap: var(--ct-space-1);
}

.foods-page .foods-row .food-search-macros span {
    padding: 0.22rem 0.5rem;
    font-size: 0.78rem;
}

.foods-page .foods-row .food-search-actions {
    gap: var(--ct-space-1);
}

.foods-page .foods-row .food-search-favourite-button,
.foods-page .foods-row .food-actions-button {
    width: 2.25rem;
    height: 2.25rem;
    min-width: 2.25rem;
    border-radius: var(--ct-radius-sm);
}

.foods-page .foods-row .btn-sm {
    min-height: 2.25rem;
    align-content: center;
    border-radius: var(--ct-radius-sm);
}

.foods-section-footer,
.foods-search-status {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: var(--ct-space-3);
}

.foods-section-footer {
    padding: var(--ct-space-3) var(--ct-space-4);
    color: var(--ct-text-muted);
}

.foods-section-footer .pagination {
    flex-wrap: wrap;
}

.foods-section-footer .page-link {
    background: var(--ct-surface-raised);
}

.foods-search-status {
    padding: var(--ct-space-3) var(--ct-space-4);
    border: 1px solid rgba(var(--bs-primary-rgb), 0.2);
    border-radius: var(--ct-radius-md);
    background: var(--ct-primary-soft);
}

.foods-empty-state {
    display: flex;
    align-items: center;
    gap: var(--ct-space-4);
}

.foods-empty-state__icon {
    width: 3rem;
    height: 3rem;
    background: rgba(120, 169, 135, 0.15);
    font-size: 1.35rem;
}

@media (max-width: 1199.98px) {
    .foods-page .foods-row {
        grid-template-columns: 1fr;
        gap: var(--ct-space-2);
    }

    .foods-page .foods-row .food-search-result-bottom {
        justify-content: space-between;
    }

    .foods-page .foods-row .food-search-macros {
        justify-content: flex-start;
    }
}

@media (max-width: 991.98px) {
    .foods-hero.ct-scenic-header--with-art {
        grid-template-columns: minmax(0, 1fr) minmax(12rem, 18rem);
    }

}

@media (max-width: 650px) {
    .foods-page {
        gap: var(--ct-space-4);
    }

    .foods-hero {
        min-height: 0;
    }

    .foods-hero.ct-scenic-header--with-art {
        grid-template-columns: minmax(0, 1fr) 7rem;
        gap: var(--ct-space-3);
    }

    .foods-hero .ct-page-title {
        font-size: clamp(1.9rem, 10vw, 2.5rem);
    }

    .foods-search-panel {
        padding: var(--ct-space-4);
    }

    .foods-search-controls {
        grid-template-columns: 1fr;
    }

    .foods-search-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .foods-search-actions {
        display: grid;
        grid-template-columns: 1fr;
    }

    .foods-section-header {
        align-items: flex-start;
    }

    .foods-section-heading p {
        display: none;
    }

    .foods-page .foods-row .food-search-result-main {
        flex-direction: row;
        align-items: flex-start;
    }

    .foods-page .foods-row .food-search-result-bottom {
        flex-direction: column;
        align-items: stretch;
    }

    .foods-page .foods-row .food-search-actions {
        align-self: flex-end;
    }

    .foods-section-footer,
    .foods-search-status {
        align-items: flex-start;
        flex-direction: column;
    }

}

@media (max-width: 420px) {
    .diary-food-source-selector {
        display: grid;
        grid-template-columns: repeat(3, minmax(0, 1fr));
        width: 100%;
    }

    .diary-food-source-selector a {
        padding-inline: var(--ct-space-1);
        font-size: 0.82rem;
        text-align: center;
    }

    .diary-community-search {
        grid-template-columns: 1fr;
    }

    .diary-community-result {
        align-items: stretch;
        flex-direction: column;
    }
}

@media (max-width: 380px) {
    .foods-hero.ct-scenic-header--with-art {
        grid-template-columns: 1fr;
    }

    .foods-hero .ct-scenic-header__art {
        display: none;
    }

    .foods-section-header,
    .foods-page .foods-row,
    .foods-section-footer {
        padding-inline: var(--ct-space-3);
    }

    .foods-page .foods-row .food-search-result-main {
        gap: var(--ct-space-2);
    }

    .foods-page .foods-row .food-search-actions {
        width: 100%;
        flex-wrap: wrap;
        justify-content: flex-end;
    }

    .foods-section-footer .page-item.disabled:nth-child(2) {
        display: none;
    }
}

/* =========================
   DIARY LAYOUT
   ========================= */

.diary-page {
    display: grid;
    gap: var(--ct-space-5);
    width: min(100%, var(--ct-content-max));
    margin-inline: auto;
}

.diary-header {
    display: grid;
    gap: var(--ct-space-3);
}

.diary-hero,
.saved-meals-hero {
    min-height: 10rem;
    margin-bottom: 0;
    padding: clamp(1.5rem, 3vw, 2.25rem);
}

.diary-hero.ct-scenic-header--with-art,
.saved-meals-hero.ct-scenic-header--with-art {
    grid-template-columns: minmax(0, 1fr) minmax(13rem, 20rem);
    gap: clamp(1rem, 4vw, 3rem);
}

.diary-hero .ct-scenic-header__art,
.saved-meals-hero .ct-scenic-header__art {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: auto;
    align-self: center;
    border: 0;
    background: transparent;
    box-shadow: none;
}

.diary-hero .ct-scenic-header__art img,
.saved-meals-hero .ct-scenic-header__art img {
    width: 100%;
    height: auto;
    max-height: 8.5rem;
    object-fit: contain;
    object-position: center right;
}

.saved-meals-page {
    display: grid;
    width: min(100%, var(--ct-content-max));
    min-width: 0;
    gap: var(--ct-space-5);
    margin-inline: auto;
    padding-bottom: var(--ct-space-4);
}

.saved-meals-empty {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    align-items: center;
    gap: var(--ct-space-4);
    background:
        linear-gradient(135deg, rgba(120, 169, 135, 0.11), transparent 58%),
        var(--ct-surface);
}

.saved-meals-empty-icon {
    display: inline-grid;
    width: 3.5rem;
    height: 3.5rem;
    place-items: center;
    border-radius: var(--ct-radius-pill);
    background: rgba(120, 169, 135, 0.16);
    color: var(--ct-primary-strong);
    font-size: 2rem;
}

.saved-meals-empty h2 {
    margin: 0;
    color: var(--ct-text);
    font-size: 1.35rem;
}

.saved-meals-empty p {
    max-width: 42rem;
    margin: var(--ct-space-1) 0 var(--ct-space-3);
    color: var(--ct-text-muted);
}

.saved-meals-back-link {
    justify-self: start;
}

.diary-date-navigation {
    margin: 0;
}

.diary-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(18rem, 0.8fr);
    gap: var(--ct-space-5);
    align-items: start;
}

.diary-meals-column,
.diary-summary-rail {
    min-width: 0;
}

.diary-summary-rail {
    position: static;
}

.diary-summary-card {
    margin: 0;
    background: var(--ct-surface);
    box-shadow: var(--ct-shadow-sm);
}

.diary-summary-card .card-body {
    padding: var(--ct-space-5);
}

.diary-summary-card .daily-progress-heading {
    align-items: flex-start;
}

.diary-calorie-summary {
    display: grid;
    justify-items: center;
    gap: var(--ct-space-3);
    margin-bottom: var(--ct-space-4);
    text-align: center;
}

.diary-calorie-ring {
    position: relative;
    display: grid;
    width: clamp(10rem, 14vw, 12rem);
    aspect-ratio: 1;
    place-items: center;
    border-radius: 50%;
    background: conic-gradient(
        var(--ct-calorie-ring) 0 var(--diary-calorie-progress),
        var(--ct-surface-soft) var(--diary-calorie-progress) 100%);
}

.diary-calorie-ring::before {
    position: absolute;
    inset: 0.7rem;
    border: 1px solid var(--ct-border);
    border-radius: inherit;
    background: var(--ct-surface);
    content: "";
}

.diary-calorie-ring-content {
    position: relative;
    z-index: 1;
    display: grid;
    gap: 0.1rem;
    line-height: 1.15;
}

.diary-calorie-ring-content strong {
    font-size: clamp(1.75rem, 3vw, 2.2rem);
}

.diary-calorie-ring-content span,
.diary-calorie-status,
.diary-calorie-target-message {
    color: var(--ct-text-muted);
    font-size: 0.85rem;
}

.diary-calorie-status,
.diary-calorie-target-message {
    margin: 0;
}

.diary-calorie-status strong {
    color: var(--ct-text);
}

.diary-macro-totals {
    display: flex;
    flex-wrap: wrap;
    gap: var(--ct-space-2) var(--ct-space-3);
    color: var(--ct-text-muted);
    font-size: 0.82rem;
}

.diary-macro-totals strong {
    color: var(--ct-text);
}

.diary-summary-card .macro-goal-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--ct-space-3);
}

.diary-summary-card .macro-goal-heading {
    gap: var(--ct-space-3);
    font-size: 0.85rem;
}

.diary-summary-card .macro-goal-progress {
    height: 0.55rem;
    margin-top: 0.35rem;
}

.diary-reuse-actions {
    margin-bottom: var(--ct-space-4);
}

.diary-meal-card {
    margin-bottom: var(--ct-space-4);
    padding: var(--ct-space-4);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-lg);
    background: var(--ct-surface);
    box-shadow: var(--ct-shadow-sm);
}

.diary-meal-card:last-child {
    margin-bottom: 0;
}

.diary-meal-heading {
    align-items: center !important;
    gap: var(--ct-space-3);
}

.diary-meal-heading h2 {
    font-size: 1.2rem;
}

.diary-meal-summary {
    display: block;
    margin-top: 0.2rem;
}

.diary-meal-header-actions {
    flex-shrink: 0;
}

.diary-page .diary-entry-list {
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-md);
}

.diary-page .diary-entry-row,
.diary-page .diary-empty-state {
    background: transparent;
    box-shadow: none;
}

.diary-page .diary-entry-row {
    padding: 0.65rem var(--ct-space-3);
    border: 0;
    border-bottom: 1px solid var(--ct-border);
    border-radius: 0;
}

.diary-page .diary-entry-row:last-child {
    border-bottom: 0;
}

.diary-entry-row .food-search-result-main {
    align-items: center;
    gap: var(--ct-space-3);
}

.diary-page .diary-entry-row h3 {
    font-size: 0.95rem;
}

.diary-page .diary-entry-row p {
    margin-top: 0.2rem;
}

.diary-entry-row .food-search-result-bottom {
    margin-top: 0.35rem;
}

.diary-entry-row .food-search-macros {
    gap: 0.35rem;
}

.diary-entry-row .food-search-macros span {
    padding: 0.2rem 0.45rem;
    font-size: 0.75rem;
}

.diary-entry-actions {
    flex-shrink: 0;
}

.diary-entry-actions .diary-action-button {
    min-height: 2rem;
    padding: 0.25rem 0.55rem;
    font-size: 0.78rem;
}

.diary-page .diary-empty-state {
    padding: var(--ct-space-3) var(--ct-space-4);
    border-style: dashed;
    border-color: var(--ct-border);
}

@media (min-width: 992px) {
    .diary-summary-rail {
        position: sticky;
        top: 5rem;
    }
}

@media (min-width: 1740px) {
    .app-content.app-content-width:has(.diary-page) {
        width: min(100%, 92rem);
    }
}

@media (max-width: 991.98px) {
    .diary-layout {
        grid-template-columns: 1fr;
    }

    .diary-summary-rail {
        grid-row: 1;
    }

    .diary-meals-column {
        grid-row: 2;
    }
}

@media (max-width: 575.98px) {
    .diary-page {
        gap: var(--ct-space-4);
    }

    .diary-hero,
    .saved-meals-hero {
        padding: var(--ct-space-4);
    }

    .diary-hero.ct-scenic-header--with-art,
    .saved-meals-hero.ct-scenic-header--with-art {
        grid-template-columns: minmax(0, 1fr) 6.25rem;
        gap: var(--ct-space-3);
    }

    .diary-hero .ct-scenic-header__art img,
    .saved-meals-hero .ct-scenic-header__art img {
        max-height: 6rem;
    }

    .saved-meals-empty {
        grid-template-columns: 1fr;
        justify-items: start;
    }

    .diary-summary-card .card-body,
    .diary-meal-card {
        padding: var(--ct-space-4);
    }

    .diary-summary-card .daily-progress-heading {
        gap: var(--ct-space-2);
    }

    .diary-meal-heading {
        align-items: flex-start !important;
        flex-direction: column;
    }

    .diary-meal-header-actions {
        justify-content: flex-start;
    }

    .diary-entry-row .food-search-result-main {
        align-items: flex-start;
    }

    .diary-calorie-ring {
        width: min(100%, 10.5rem);
    }
}

body > .container {
  flex: 1 0 auto;
  width: 100%;
}

.content-page {
    max-width: 52rem;
}

.content-page h2 {
    margin-top: 2rem;
    font-size: 1.4rem;
}

.page-eyebrow {
    margin-bottom: .35rem;
    color: var(--bs-primary);
    font-weight: 700;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.content-card,
.faq-list details {
    margin-top: 1rem;
    padding: 1.25rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 1rem;
    background: var(--bs-tertiary-bg);
}

.content-card h2 {
    margin-top: 0;
}

.faq-list summary {
    cursor: pointer;
    font-weight: 700;
}

.faq-list details p {
    margin: 1rem 0 0;
}

.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;
}

.navbar-nav .nav-item {
    margin-right: 1.0rem;
}

.navbar-brand-mark {
    width: 2rem;
    height: 2rem;
    max-width: 2rem;
    max-height: 2rem;
    flex: 0 0 auto;
    object-fit: contain;
}

.development-banner {
    --ct-development-banner-background: #fff3cd;
    --ct-development-banner-border: #ffecb5;
    --ct-development-banner-color: #664d03;
    margin-bottom: 1rem;
    border-bottom: 1px solid var(--ct-development-banner-border);
    background: var(--ct-development-banner-background);
    color: var(--ct-development-banner-color);
}

html[data-development-banner-dismissed="true"] .development-banner {
    display: none;
}

[data-bs-theme="dark"] .development-banner {
    --ct-development-banner-background: #3d3217;
    --ct-development-banner-border: #705d2a;
    --ct-development-banner-color: #ffda6a;
}

.development-banner-inner {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    align-items: center;
    gap: 0.55rem;
    min-height: 2.75rem;
    padding-top: 0.45rem;
    padding-bottom: 0.45rem;
}

.development-banner-icon {
    font-size: 1rem;
    line-height: 1;
}

.development-banner-message {
    margin: 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.development-banner-link {
    color: inherit;
    font-size: 0.9rem;
    font-weight: 700;
    white-space: nowrap;
}

.development-banner-dismiss {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.75rem;
    height: 1.75rem;
    padding: 0;
    border: 1px solid currentColor;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    font-size: 1.2rem;
    line-height: 1;
}

.development-banner-dismiss:hover {
    background: rgba(102, 77, 3, 0.12);
}

[data-bs-theme="dark"] .development-banner-dismiss:hover {
    background: rgba(255, 218, 106, 0.15);
}

.development-banner-dismiss:focus-visible,
.development-banner-link:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

@media (max-width: 575.98px) {
    .diary-date-navigation > .diary-date-label {
        flex: 1 0 100%;
        order: -1;
        text-align: center;
    }

    .diary-date-navigation > .diary-date-picker {
        flex: 1 0 100%;
        margin-left: 0 !important;
    }

    .diary-date-picker input {
        min-width: 0;
        flex: 1 1 auto;
    }

    .diary-action-button {
        min-height: 2.75rem;
    }

    .development-banner-inner {
        grid-template-columns: auto minmax(0, 1fr) auto;
        align-items: start;
        row-gap: 0.2rem;
    }

    .development-banner-link {
        grid-column: 2;
        grid-row: 2;
    }

    .development-banner-dismiss {
        grid-column: 3;
        grid-row: 1;
    }
}

@media (max-width: 340px) {
    .diary-meal-heading {
        align-items: flex-start !important;
        flex-direction: column;
        gap: 0.5rem !important;
    }
}

.diary-copy-details {
  position: relative;
}

.diary-copy-details > summary {
  list-style: none;
  cursor: pointer;
}

.diary-copy-details > summary::-webkit-details-marker {
  display: none;
}

.diary-copy-form {
  width: min(22rem, calc(100vw - 2rem));
  position: absolute;
  right: 0;
  z-index: 20;
}

.diary-meal-header-actions {
  justify-content: flex-end;
}

@media (max-width: 575.98px) {
  .diary-copy-form {
    left: 0;
    right: auto;
  }

  .diary-meal-header-actions {
    justify-content: flex-start;
  }
}

.navbar-nav .dropdown-toggle,
.navbar-nav .dropdown-toggle:hover,
.navbar-nav .dropdown-toggle:focus {
    color: var(--bs-navbar-color) !important;
}

    .navbar-nav .dropdown-toggle:hover,
    .navbar-nav .dropdown-toggle:focus {
        color: var(--bs-navbar-hover-color) !important;
    }

.food-actions-button {
    min-width: 2.25rem;
    font-weight: 700;
}

.capy-avatar {
    position: relative;
    width: 100%;
    aspect-ratio: 1 / 1;
}

.capy-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

    .capy-layer img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

/* =========================
   CAPY CUSTOMISATION
   ========================= */

.capy-customisation-layout {
    display: grid;
    grid-template-columns: minmax(260px, 0.8fr) minmax(500px, 1.6fr);
    gap: 3rem;
    align-items: start;
}

.capy-preview-panel {
    text-align: center;
}

.capy-preview-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
}

.capy-preview {
    width: min(100%, 380px);
    margin: 0 auto;
    overflow: hidden;
    border-radius: 24px;
    border: 2px solid var(--bs-border-color);
    background: var(--bs-body-bg);
}

.capy-name-editor {
    width: min(100%, 380px);
    margin: 1rem auto 0;
    text-align: left;
}

.capy-name-editor summary,
.dashboard-estimates-summary {
    cursor: pointer;
    list-style: none;
}

.capy-name-editor summary::-webkit-details-marker,
.dashboard-estimates-summary::-webkit-details-marker {
    display: none;
}

.capy-name-editor summary::before,
.dashboard-estimates-summary::before {
    content: "▸";
    display: inline-block;
    margin-right: 0.45rem;
    transition: transform 0.15s ease;
}

.capy-name-editor[open] summary::before,
.dashboard-estimates-card[open] .dashboard-estimates-summary::before {
    transform: rotate(90deg);
}

.capy-name-editor summary:focus-visible,
.dashboard-estimates-summary:focus-visible {
    border-radius: var(--bs-border-radius-sm);
    outline: 0;
    box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.25);
}

.capy-name-form {
    margin-top: 0.75rem;
}


/* Inventory */

.capy-inventory {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.capy-inventory-row {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 0.75rem;
    min-height: 90px;
}

/* Item row */

.capy-item-list {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
    overflow-x: auto;
    padding: 0.6rem;
    border: 2px solid var(--bs-border-color);
    border-radius: 16px;
    background: var(--bs-tertiary-bg);
}


/* Individual inventory item */

.capy-item-tile {
    flex: 0 0 68px;
    width: 68px;
    height: 68px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid var(--bs-border-color);
    border-radius: 14px;
    background: var(--bs-body-bg);
    overflow: hidden;
    cursor: default;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

    .capy-item-tile:hover {
        transform: translateY(-2px);
        border-color: var(--bs-primary);
    }

    .capy-item-tile img {
        width: 100%;
        height: 100%;
        object-fit: contain;
    }

.capy-empty-category {
    color: var(--bs-secondary-color);
    font-size: 0.9rem;
    padding: 0 0.5rem;
}


/* Responsive */

@media (max-width: 900px) {

    .capy-customisation-layout {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .capy-preview-panel {
        position: static;
    }

    .capy-preview {
        width: min(100%, 300px);
    }
}

@media (max-width: 600px) {

    .capy-inventory-row {
        grid-template-columns: 70px 1fr;
        min-height: 70px;
    }

    .capy-item-tile {
        flex-basis: 54px;
        width: 54px;
        height: 54px;
        border-radius: 10px;
    }
}

.capy-item-tile {
    padding: 0;
    color: inherit;
}

    .capy-item-tile.is-equipped {
        border-color: var(--bs-primary);
        box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), 0.25), 0 3px 8px rgba(0, 0, 0, 0.12);
        transform: translateY(-2px);
    }

    .capy-item-tile:disabled {
        opacity: 0.7;
    }

.capy-customisation-title {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.capy-secret-crown {
    padding: 0;
    background: transparent;
    border: 0;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease;
}

    .capy-secret-crown:hover {
        transform: scale(1.15) rotate(-5deg);
        filter: brightness(1.1);
    }

    .capy-secret-crown:last-child:hover {
        transform: scale(1.15) rotate(5deg);
    }

    .capy-secret-crown:active {
        transform: scale(0.9);
    }

.capy-unlock-message {
    width: fit-content;
    margin: 0.75rem auto 0;
}

.capy-item-locked {
    position: relative;
    opacity: 0.45;
    cursor: not-allowed;
    filter: grayscale(0.65);
}

    .capy-item-locked:hover {
        transform: none;
        border-color: var(--bs-border-color);
        box-shadow: none;
    }

.capy-lock-icon {
    position: absolute;
    right: 4px;
    bottom: 3px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    font-size: 0.75rem;
    background: var(--bs-body-bg);
    border: 1px solid var(--bs-border-color);
    border-radius: 50%;
}

.capy-none-tile {
    font-size: 1.5rem;
    font-weight: 600;
    line-height: 1;
    color: var(--bs-secondary-color);
}

    .capy-none-tile span {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 100%;
        height: 100%;
    }

/* =========================
   NAVBAR CAPY
   ========================= */

.navbar-capy {
    display: block;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    overflow: hidden;
    border: 1px solid var(--bs-border-color);
    border-radius: 8px;
    background: var(--bs-body-bg);
    text-decoration: none;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

    .navbar-capy:hover {
        transform: translateY(-1px);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
    }

    .navbar-capy .capy-avatar {
        width: 100%;
        height: 100%;
    }

    .navbar-capy .capy-layer {
        width: 100%;
        height: 100%;
    }

/* =========================
   THEME CUSTOMISATION
   ========================= */

.capy-theme-section {
    max-width: 840px;
    margin: 2.5rem auto 0;
    padding-top: 2rem;
    border-top: 1px solid var(--bs-border-color);
}

.capy-theme-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.capy-theme-options {
    display: flex;
    gap: 0.75rem;
}

.capy-theme-option {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    padding: 1rem;
    text-align: left;
    color: var(--bs-body-color);
    background: var(--bs-tertiary-bg);
    border: 2px solid var(--bs-border-color);
    border-radius: 14px;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

    .capy-theme-option:hover {
        transform: translateY(-2px);
        border-color: var(--bs-secondary-color);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    }

.capy-theme-option-title {
    font-weight: 700;
}

.capy-theme-option-description {
    font-size: 0.85rem;
    color: var(--bs-secondary-color);
}

.capy-theme-option.is-selected {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 2px rgba(var(--bs-primary-rgb), 0.2);
}

    .capy-item-tile {
        cursor: pointer;
    }

    .capy-item-tile:hover:not(.is-equipped) {
        transform: translateY(-2px);
        border-color: var(--bs-secondary-color);
        box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
    }

/* =========================
   CAPY CUSTOMISATION REDESIGN
   ========================= */

.customisation-page {
    display: grid;
    width: min(100%, 88rem);
    min-width: 0;
    gap: var(--ct-space-5);
    margin-inline: auto;
    padding-bottom: var(--ct-space-5);
}

.customisation-page > .alert {
    margin: 0;
}

.capy-companion-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ct-space-4);
    padding: var(--ct-space-4) var(--ct-space-5);
}

.capy-companion-summary h2 {
    margin: var(--ct-space-1) 0 0;
    color: var(--ct-text);
    font-size: 1.2rem;
    font-weight: 800;
}

.capy-companion-summary p:last-child {
    margin: var(--ct-space-1) 0 0;
    color: var(--ct-text-muted);
    font-size: 0.88rem;
}

.capy-companion-summary-count {
    display: grid;
    flex: 0 0 auto;
    gap: var(--ct-space-1);
    text-align: right;
}

.capy-companion-summary-count span {
    color: var(--ct-text-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.capy-companion-summary-count strong {
    color: var(--ct-text);
    font-size: 1.35rem;
    line-height: 1;
}

.capy-provision-card {
    display: grid;
    gap: var(--ct-space-1);
    color: var(--ct-text);
}

.capy-provision-card span {
    color: var(--ct-text-muted);
}

.capy-customisation-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(20rem, 0.72fr);
    gap: var(--ct-space-5);
    align-items: start;
}

.capy-customisation-main,
.capy-customisation-sidebar,
.capy-inventory,
.capy-inventory-group {
    display: grid;
    min-width: 0;
}

.capy-customisation-main,
.capy-customisation-sidebar {
    gap: var(--ct-space-4);
}

.capy-customisation-sidebar {
    align-self: start;
}

.capy-category-tabs {
    display: flex;
    min-width: 0;
    gap: var(--ct-space-2);
    padding-bottom: var(--ct-space-1);
    overflow-x: auto;
    scrollbar-width: thin;
}

.capy-category-tab {
    display: inline-flex;
    align-items: center;
    min-height: 2.65rem;
    padding: 0.55rem 1rem;
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-pill);
    background: var(--ct-surface-raised);
    color: var(--ct-text-muted);
    font-size: 0.88rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.capy-category-tab:hover,
.capy-category-tab:focus-visible,
.capy-category-tab.is-selected {
    border-color: rgba(var(--bs-primary-rgb), 0.48);
    background: var(--ct-primary-soft);
    color: var(--ct-primary-strong);
}

@media (min-width: 1300px) {
    .capy-category-tabs {
        gap: 0.25rem;
        padding-bottom: 0;
        overflow-x: visible;
    }

    .capy-category-tab {
        padding-inline: 0.35rem;
        font-size: 0.8rem;
    }
}

.capy-collection-card {
    padding: 0;
    overflow: hidden;
    background: var(--ct-surface);
}

.capy-collection-heading {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: var(--ct-space-4);
    padding: var(--ct-space-5);
}

.capy-collection-heading h2,
.capy-inventory-group-heading h3,
.capy-collection-summary-copy h2,
.capy-sidebar-heading h2,
.capy-loadout-card h2 {
    margin: 0;
    color: var(--ct-text);
    font-weight: 800;
}

.capy-collection-heading h2 {
    margin-top: var(--ct-space-1);
    font-size: 1.35rem;
}

.capy-inventory-filters {
    display: flex;
    flex: 0 0 auto;
    gap: var(--ct-space-2);
}

.capy-inventory {
    gap: var(--ct-space-4);
}

.capy-inventory-group {
    gap: var(--ct-space-4);
    padding: var(--ct-space-5);
    background: var(--ct-surface);
}

.capy-inventory-group-heading {
    display: flex;
    align-items: center;
    gap: var(--ct-space-3);
}

.capy-inventory-group-heading h3 {
    font-size: 1.1rem;
}

.capy-item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(10rem, 1fr));
    min-width: 0;
    gap: var(--ct-space-3);
}

.capy-category-pagination {
    display: flex;
    min-width: 6.75rem;
    align-items: center;
    justify-content: flex-end;
    gap: var(--ct-space-2);
    margin-left: auto;
    color: var(--ct-text-muted);
    font-size: 0.88rem;
    font-weight: 800;
    white-space: nowrap;
}

.capy-category-pagination button {
    display: inline-grid;
    width: 2rem;
    height: 2rem;
    place-items: center;
    padding: 0;
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-sm);
    background: var(--ct-surface-raised);
    color: var(--ct-text);
    cursor: pointer;
    font-family: inherit;
    font-size: 1.25rem;
    line-height: 1;
}

.capy-category-pagination button:hover:not(:disabled),
.capy-category-pagination button:focus-visible {
    border-color: rgba(var(--bs-primary-rgb), 0.48);
    background: var(--ct-primary-soft);
    color: var(--ct-primary-strong);
}

.capy-category-pagination button:disabled {
    cursor: default;
    opacity: 0.38;
}

.capy-saved-outfits h2 {
    margin: 0;
    font-size: 1.2rem;
}

.capy-outfit-save-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: var(--ct-space-2);
    margin: var(--ct-space-3) 0;
}

.capy-saved-outfit-list {
    display: grid;
    gap: var(--ct-space-2);
    margin: var(--ct-space-3) 0 0;
    padding: 0;
    list-style: none;
}

.capy-saved-outfit-list li,
.capy-saved-outfit-list li > div {
    display: flex;
    align-items: center;
    gap: var(--ct-space-2);
}

.capy-saved-outfit-list li {
    justify-content: space-between;
    padding-top: var(--ct-space-2);
    border-top: 1px solid var(--ct-border);
}

.capy-saved-outfit-list form {
    margin: 0;
}

.capy-item-tile {
    position: relative;
    display: grid;
    width: auto;
    height: auto;
    min-width: 0;
    min-height: 13rem;
    grid-template-rows: minmax(7rem, 1fr) auto;
    align-items: stretch;
    justify-content: stretch;
    gap: var(--ct-space-3);
    padding: var(--ct-space-3);
    overflow: hidden;
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-lg);
    background: var(--ct-surface-raised);
    color: var(--ct-text);
    text-align: left;
    transition: border-color 0.16s ease, background-color 0.16s ease,
        box-shadow 0.16s ease, transform 0.16s ease;
}

button.capy-item-tile {
    cursor: pointer;
}

.capy-item-tile:hover:not(.is-equipped):not(.capy-item-locked) {
    border-color: rgba(var(--bs-primary-rgb), 0.42);
    background: var(--ct-surface);
    box-shadow: var(--ct-shadow-sm);
    transform: translateY(-1px);
}

.capy-item-tile.is-equipped {
    border-color: rgba(120, 169, 135, 0.72);
    background:
        linear-gradient(145deg, rgba(120, 169, 135, 0.16), transparent 70%),
        var(--ct-surface-raised);
    box-shadow: inset 0 0 0 1px rgba(120, 169, 135, 0.2), var(--ct-shadow-sm);
    transform: none;
}

.capy-item-tile:disabled {
    opacity: 0.68;
}

.capy-item-visual {
    position: relative;
    display: grid;
    min-width: 0;
    min-height: 7rem;
    place-items: center;
    overflow: hidden;
    border-radius: var(--ct-radius-md);
    background: var(--ct-surface-soft);
}

.capy-item-visual img {
    width: 100%;
    height: 100%;
    max-height: 8rem;
    object-fit: contain;
}

.capy-item-details {
    display: grid;
    min-width: 0;
    gap: 0.2rem;
}

.capy-item-details strong {
    overflow: hidden;
    color: var(--ct-text);
    font-size: 0.92rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.capy-item-status {
    width: fit-content;
    margin-top: var(--ct-space-1);
    padding: 0.2rem 0.5rem;
    border-radius: var(--ct-radius-pill);
    background: var(--ct-surface-soft);
    color: var(--ct-text-muted);
    font-size: 0.72rem;
    font-weight: 800;
}

.capy-item-tile.is-equipped .capy-item-status {
    background: rgba(120, 169, 135, 0.18);
    color: var(--ct-text);
}

.capy-item-locked {
    cursor: not-allowed;
    opacity: 1;
    filter: none;
}

.capy-item-locked .capy-item-visual img {
    opacity: 0.48;
    filter: grayscale(0.7);
}

.capy-item-locked .capy-item-status {
    background: color-mix(in srgb, var(--ct-text-muted) 12%, transparent);
}

.capy-lock-icon {
    right: var(--ct-space-2);
    bottom: var(--ct-space-2);
    width: 1.75rem;
    height: 1.75rem;
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-pill);
    background: var(--ct-surface-raised);
    font-size: 0.8rem;
}

.capy-none-tile {
    color: var(--ct-text-muted);
    font-size: inherit;
    font-weight: inherit;
    line-height: inherit;
}

.capy-none-tile .capy-item-visual {
    color: var(--ct-text-muted);
    font-size: 2.5rem;
    font-weight: 400;
}

.capy-none-tile .capy-item-details {
    display: grid;
    width: auto;
    height: auto;
    align-items: initial;
    justify-content: initial;
}

.capy-none-tile .capy-item-details span {
    display: inline-block;
    width: auto;
    height: auto;
}

.capy-category-empty {
    display: grid;
    gap: var(--ct-space-1);
    padding: var(--ct-space-4);
    border: 1px dashed var(--ct-border-strong);
    border-radius: var(--ct-radius-md);
    background: var(--ct-surface-soft);
    color: var(--ct-text);
}

.capy-category-empty span {
    color: var(--ct-text-muted);
    font-size: 0.88rem;
}

.capy-collection-summary {
    display: grid;
    background: var(--ct-surface);
}

.capy-collection-summary-copy {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--ct-space-4);
}

.capy-collection-summary-copy h2 {
    margin-top: var(--ct-space-1);
    font-size: 1.15rem;
}

.capy-preview-panel,
.capy-loadout-card,
.capy-motivation-card,
.capy-theme-section,
.capy-collection-summary {
    min-width: 0;
    margin: 0;
    background: var(--ct-surface);
}

.capy-preview-panel {
    position: static;
    top: auto;
    padding: var(--ct-space-5);
    text-align: left;
}

.capy-sidebar-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--ct-space-3);
}

.capy-sidebar-heading h2,
.capy-loadout-card h2 {
    margin-top: var(--ct-space-1);
    font-size: 1.2rem;
}

.capy-live-indicator {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.28rem 0.55rem;
    border-radius: var(--ct-radius-pill);
    background: rgba(120, 169, 135, 0.14);
    color: var(--ct-text);
    font-size: 0.72rem;
    font-weight: 800;
}

.capy-live-indicator::before {
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--ct-calorie-ring);
    content: "";
}

.capy-preview {
    width: min(100%, 22rem);
    margin: var(--ct-space-4) auto 0;
    overflow: hidden;
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-xl);
    background: var(--ct-surface-soft);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

.capy-name-editor {
    width: 100%;
    margin: var(--ct-space-4) 0 0;
    padding-top: var(--ct-space-3);
    border-top: 1px solid var(--ct-border);
    text-align: left;
}

.capy-name-editor summary {
    width: fit-content;
    color: var(--ct-primary-strong);
    font-size: 0.88rem;
    font-weight: 700;
}

.capy-name-form {
    margin-top: var(--ct-space-3);
}

.capy-loadout-list {
    display: grid;
    gap: 0;
    margin: var(--ct-space-3) 0 0;
}

.capy-loadout-list > div {
    display: grid;
    grid-template-columns: minmax(6rem, 0.7fr) minmax(0, 1.3fr);
    gap: var(--ct-space-3);
    padding: var(--ct-space-2) 0;
    border-bottom: 1px solid var(--ct-border);
}

.capy-loadout-list > div:last-child {
    border-bottom: 0;
}

.capy-loadout-list dt {
    color: var(--ct-text-muted);
    font-size: 0.82rem;
    font-weight: 600;
}

.capy-loadout-list dd {
    min-width: 0;
    margin: 0;
    color: var(--ct-text);
    font-size: 0.86rem;
    font-weight: 700;
    text-align: right;
    overflow-wrap: anywhere;
}

.capy-secret-crown {
    display: inline-flex;
    align-items: center;
    gap: var(--ct-space-2);
    padding: 0.45rem 0.7rem;
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-pill);
    background: var(--ct-surface-raised);
    color: var(--ct-text-muted);
    cursor: pointer;
    font-size: 0.82rem;
    line-height: 1.2;
    transform: none;
}

.capy-secret-crown:hover,
.capy-secret-crown:active {
    transform: none;
    filter: none;
}

.capy-motivation-card {
    display: flex;
    align-items: center;
    gap: var(--ct-space-3);
    background:
        linear-gradient(135deg, rgba(120, 169, 135, 0.14), transparent 72%),
        var(--ct-surface);
}

.capy-motivation-card > span {
    font-size: 1.5rem;
}

.capy-motivation-card strong {
    display: block;
    margin-top: var(--ct-space-1);
    color: var(--ct-text);
    font-size: 1rem;
}

.capy-theme-section {
    max-width: none;
    padding: var(--ct-space-5);
    border-top: 1px solid var(--ct-border);
}

.capy-theme-title {
    margin: 0;
    font-size: 1.2rem;
}

.capy-theme-section > p {
    margin: var(--ct-space-1) 0 var(--ct-space-3);
    font-size: 0.86rem;
}

.capy-theme-options {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--ct-space-2);
}

.capy-theme-option {
    display: grid;
    min-width: 0;
    gap: 0.1rem;
    padding: var(--ct-space-3);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-md);
    background: var(--ct-surface-raised);
    color: var(--ct-text);
    text-align: left;
    transition: border-color 0.16s ease, background-color 0.16s ease;
}

.capy-theme-option:hover {
    border-color: rgba(var(--bs-primary-rgb), 0.42);
    box-shadow: none;
    transform: none;
}

.capy-theme-option.is-selected {
    border-color: rgba(var(--bs-primary-rgb), 0.58);
    background: var(--ct-primary-soft);
    box-shadow: none;
}

.capy-unlock-message {
    width: 100%;
    margin: 0;
}

@media (max-width: 1099.98px) {
    .capy-customisation-layout {
        grid-template-columns: 1fr;
    }

    .capy-customisation-sidebar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        align-items: start;
    }

    .capy-preview-panel,
    .capy-theme-section {
        grid-row: span 2;
    }
}

@media (max-width: 767.98px) {
    .capy-customisation-sidebar {
        grid-template-columns: 1fr;
    }

    .capy-preview-panel,
    .capy-theme-section {
        grid-row: auto;
    }
}

@media (max-width: 575.98px) {
    .customisation-page {
        gap: var(--ct-space-4);
    }

    .capy-companion-summary {
        align-items: flex-start;
        flex-direction: column;
        gap: var(--ct-space-3);
        padding: var(--ct-space-4);
    }

    .capy-companion-summary-count {
        text-align: left;
    }

    .capy-collection-heading {
        align-items: flex-start;
        flex-direction: column;
        padding: var(--ct-space-4);
    }

    .capy-inventory-group {
        padding: var(--ct-space-4);
    }

    .capy-inventory-filters {
        width: 100%;
    }

    .capy-inventory-filters .btn {
        flex: 1;
    }

    .capy-item-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: var(--ct-space-2);
    }

    .capy-outfit-save-form {
        grid-template-columns: 1fr;
    }

    .capy-item-tile {
        min-height: 11.5rem;
        grid-template-rows: minmax(6rem, 1fr) auto;
        padding: var(--ct-space-2);
    }

    .capy-item-visual {
        min-height: 6rem;
    }

    .capy-item-details strong {
        font-size: 0.85rem;
    }

    .capy-progress-copy {
        align-items: flex-start;
    }

    .capy-preview-panel,
    .capy-loadout-card,
    .capy-motivation-card,
    .capy-theme-section,
    .capy-collection-summary {
        padding: var(--ct-space-4);
    }
}

/* =========================
   HOME DASHBOARD
   ========================= */

.dashboard-page {
    max-width: 980px;
    margin: 0 auto;
    padding-bottom: 2rem;
}

.dashboard-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.1rem;
}

.dashboard-title {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
}

.dashboard-date {
    margin: 0.2rem 0 0;
    color: var(--bs-secondary-color);
}

.dashboard-setup-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem 1.5rem;
    border: 2px solid rgba(var(--bs-primary-rgb), 0.35);
    border-radius: 20px;
    background: rgba(var(--bs-primary-rgb), 0.06);
}

    .dashboard-setup-card h2 {
        margin-bottom: 0.25rem;
        font-size: 1.15rem;
        font-weight: 700;
    }

    .dashboard-setup-card p {
        margin: 0;
        color: var(--bs-secondary-color);
    }

.dashboard-main-card {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 190px;
    gap: 2rem;
    align-items: center;
    padding: 2rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 24px;
    background: var(--bs-tertiary-bg);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06);
}

.dashboard-calorie-section {
    min-width: 0;
}

.dashboard-eyebrow {
    margin-bottom: 0.35rem;
    color: var(--bs-secondary-color);
    font-size: 0.9rem;
    font-weight: 600;
}

.dashboard-calorie-total {
    display: flex;
    align-items: baseline;
    gap: 0.4rem;
    margin-bottom: 1.25rem;
}

.dashboard-calorie-current {
    font-size: clamp(2.5rem, 6vw, 4rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.04em;
}

.dashboard-calorie-target {
    color: var(--bs-secondary-color);
    font-size: 1.15rem;
    font-weight: 600;
}

.dashboard-progress {
    width: 100%;
    height: 14px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--bs-secondary-bg);
}

.dashboard-progress-bar {
    height: 100%;
    border-radius: inherit;
    background: var(--bs-primary);
    transition: width 0.3s ease;
}

.dashboard-progress-details {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 0.65rem;
    color: var(--bs-secondary-color);
    font-size: 0.9rem;
}

    .dashboard-progress-details strong {
        color: var(--bs-body-color);
    }

.dashboard-capy-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.65rem;
}

.dashboard-capy-frame {
    display: block;
    width: 170px;
    height: 170px;
    overflow: hidden;
    border: 2px solid var(--bs-border-color);
    border-radius: 24px;
    background: var(--bs-body-bg);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
}

    .dashboard-capy-frame:hover {
        transform: translateY(-3px);
        border-color: var(--bs-primary);
        box-shadow: 0 8px 18px rgba(0, 0, 0, 0.12);
    }

    .dashboard-capy-frame .capy-avatar {
        width: 100%;
        height: 100%;
    }

.dashboard-capy-link {
    color: var(--bs-secondary-color);
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
}

.dashboard-capy-name {
    color: var(--bs-body-color);
    font-weight: 600;
    text-align: center;
}

    .dashboard-capy-link:hover {
        color: var(--bs-primary);
    }

.dashboard-macro-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.dashboard-macro-section {
    margin-top: 1rem;
}

.dashboard-macro-heading {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 0.5rem;
}

.dashboard-macro-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1.15rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 18px;
    background: var(--bs-body-bg);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

    .dashboard-macro-card:hover {
        transform: translateY(-2px);
        box-shadow: 0 5px 14px rgba(0, 0, 0, 0.07);
    }

.dashboard-macro-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    flex: 0 0 44px;
    border-radius: 14px;
    background: var(--bs-tertiary-bg);
    font-weight: 800;
    color: #212529;
}

.dashboard-macro-card:nth-child(1) .dashboard-macro-icon {
    background: #f8cdd8;
}

.dashboard-macro-card:nth-child(2) .dashboard-macro-icon {
    background: #f8e3ad;
}

.dashboard-macro-card:nth-child(3) .dashboard-macro-icon {
    background: #cce8e3;
}

.dashboard-macro-label {
    display: block;
    color: var(--bs-secondary-color);
    font-size: 0.85rem;
}

.dashboard-macro-value {
    display: block;
    margin-top: 0.1rem;
    font-size: 1.35rem;
}

.dashboard-macro-content {
    min-width: 0;
    flex: 1;
}

.dashboard-macro-goal {
    width: 100%;
}

.dashboard-macro-goal .dashboard-macro-value {
    font-size: 1.05rem;
    white-space: nowrap;
}

.dashboard-macro-goal .macro-goal-progress {
    margin-top: 0.45rem;
}

.daily-progress-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.macro-goal-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.macro-goal-item {
    min-width: 0;
}

.macro-goal-heading {
    display: flex;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    font-size: 0.85rem;
}

.macro-goal-heading strong {
    white-space: nowrap;
}

.macro-goal-progress {
    width: 100%;
    height: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: var(--bs-secondary-bg);
}

.macro-goal-progress > span {
    display: block;
    height: 100%;
    border-radius: inherit;
}

.macro-goal-item--protein > span {
    background: var(--ct-macro-protein);
}

.macro-goal-item--carbohydrates > span {
    background: var(--ct-macro-carbohydrates);
}

.macro-goal-item--fat > span {
    background: var(--ct-macro-fat);
}

.dashboard-year-card {
    min-width: 0;
    margin-top: 1rem;
    padding: 1.35rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 20px;
    background: var(--bs-body-bg);
}

.dashboard-year-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

.dashboard-year-heading h2 {
    margin: 0;
    font-size: 1.2rem;
    font-weight: 700;
}

.calorie-year-navigation {
    display: flex;
    flex: 0 0 auto;
    align-items: center;
    gap: 0.5rem;
}

.calorie-year-navigation strong {
    min-width: 3rem;
    text-align: center;
}

.dashboard-year-heading p {
    margin: 0.3rem 0 0;
    color: var(--bs-secondary-color);
    font-size: 0.9rem;
}

.calorie-year-scroll {
    max-width: 100%;
    margin-top: 0.65rem;
    overflow: auto;
    overscroll-behavior-inline: contain;
}

.calorie-year-scroll:focus-visible {
    border-radius: var(--bs-border-radius-sm);
    outline: 2px solid var(--bs-primary);
    outline-offset: 2px;
}

.calorie-year-grid {
    display: grid;
    grid-template-columns: var(--calorie-year-grid-columns);
    grid-template-rows: 1.25rem repeat(7, 0.78rem);
    column-gap: 0.2rem;
    row-gap: 0.2rem;
    width: max-content;
    min-width: 0;
    padding: 0.5rem 0;
}

@media (min-width: 60rem) {
    .calorie-year-grid {
        column-gap: 0.1rem;
    }
}

.calorie-year-month {
    grid-column: var(--calorie-year-month-column);
    grid-row: 1;
    align-self: end;
    color: var(--bs-secondary-color);
    font-size: 0.72rem;
    line-height: 1;
    white-space: nowrap;
}

.calorie-year-weekday {
    grid-column: 1;
    grid-row: var(--calorie-year-weekday);
    align-self: center;
    color: var(--bs-secondary-color);
    font-size: 0.62rem;
    line-height: 1;
}

.calorie-year-day {
    position: relative;
    grid-column: var(--calorie-year-column);
    grid-row: var(--calorie-year-weekday);
    display: block;
    width: 0.78rem;
    height: 0.78rem;
    border: 1px solid var(--ct-balance-cell-border);
    border-radius: 3px;
    text-decoration: none;
}

a.calorie-year-day {
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

a.calorie-year-day:hover {
    z-index: 4;
    transform: scale(1.25);
}

a.calorie-year-day:focus-visible {
    z-index: 5;
    outline: 2px solid var(--bs-emphasis-color);
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(var(--bs-primary-rgb), 0.35);
}

.calorie-year-day.is-heavy-cut,
.calorie-year-legend-swatch.is-heavy-cut {
    background: var(--ct-balance-heavy-cut);
}

.calorie-year-day.is-light-cut,
.calorie-year-legend-swatch.is-light-cut {
    background: var(--ct-balance-light-cut);
}

.calorie-year-day.is-maintenance,
.calorie-year-legend-swatch.is-maintenance {
    background: var(--ct-balance-maintenance);
}

.calorie-year-day.is-light-gain,
.calorie-year-legend-swatch.is-light-gain {
    background: var(--ct-balance-light-gain);
}

.calorie-year-day.is-heavy-gain,
.calorie-year-legend-swatch.is-heavy-gain {
    background: var(--ct-balance-heavy-gain);
}

.calorie-year-day.is-no-data,
.calorie-year-legend-swatch.is-no-data {
    background: var(--ct-balance-no-data);
}

.calorie-year-day.is-unclassified,
.calorie-year-legend-swatch.is-unclassified {
    background-color: var(--ct-balance-unclassified);
    background-image: repeating-linear-gradient(
        135deg,
        transparent,
        transparent 3px,
        var(--ct-balance-cell-border) 3px,
        var(--ct-balance-cell-border) 5px);
}

.calorie-year-tooltip {
    display: block;
    width: 14rem;
    padding: 0.65rem 0.75rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 10px;
    background: var(--bs-emphasis-color);
    box-shadow: 0 5px 16px rgba(0, 0, 0, 0.2);
    color: var(--bs-body-bg);
    font-size: 0.75rem;
    line-height: 1.35;
    pointer-events: none;
    transition: opacity 0.12s ease, transform 0.12s ease;
}

.calorie-year-day > .calorie-year-tooltip {
    display: none;
}

.calorie-year-tooltip-layer {
    position: fixed;
    z-index: 20;
    inset: 0;
    pointer-events: none;
}

.calorie-year-tooltip-layer .calorie-year-tooltip {
    position: fixed;
    top: 0;
    left: 0;
    opacity: 1;
    transform: none;
    visibility: visible;
}

.calorie-year-tooltip strong,
.calorie-year-tooltip span {
    display: block;
}

.calorie-year-tooltip strong {
    margin-bottom: 0.2rem;
}

.calorie-year-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem 1rem;
    margin: 0.8rem 0 0;
    padding: 0;
    list-style: none;
}

.calorie-year-legend li {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--bs-secondary-color);
    font-size: 0.72rem;
}

.calorie-year-legend strong,
.calorie-year-legend small {
    display: block;
}

.calorie-year-legend strong {
    color: var(--bs-body-color);
    font-size: 0.75rem;
}

.calorie-year-legend-exception {
    margin-left: 0.25rem;
    padding-left: 1rem;
    border-left: 1px solid var(--bs-border-color);
    color: var(--bs-tertiary-color);
}

.calorie-year-legend-exception strong {
    color: var(--bs-secondary-color);
}

.calorie-year-legend-swatch {
    width: 0.85rem;
    height: 0.85rem;
    flex: 0 0 0.85rem;
    border: 1px solid var(--ct-balance-cell-border);
    border-radius: 3px;
}

.dashboard-estimates-summary {
    padding: 0.9rem 1.25rem;
    color: var(--bs-body-color);
    font-weight: 600;
}

.dashboard-estimates-content {
    border-top: 1px solid var(--bs-border-color);
}

.dashboard-actions {
    display: flex;
    gap: 0.75rem;
    margin-top: 1.25rem;
}

.dashboard-action-primary {
    font-weight: 600;
}

@media (max-width: 700px) {

    .dashboard-main-card {
        grid-template-columns: 1fr;
    }

    .dashboard-capy-section {
        order: -1;
    }

    .dashboard-capy-frame {
        width: min(100%, 180px);
        height: auto;
        aspect-ratio: 1 / 1;
    }

    .dashboard-macro-grid {
        grid-template-columns: 1fr;
    }

    .daily-progress-heading {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.6rem;
    }

    .macro-goal-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-year-card {
        padding: 1rem;
    }

    .dashboard-progress-details {
        flex-direction: column;
        gap: 0.2rem;
    }

    .dashboard-setup-card {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-actions {
        flex-direction: column;
    }

        .dashboard-actions .btn {
            width: 100%;
        }
}

/* =========================
   PROGRESS
   ========================= */

.progress-page {
    display: grid;
    width: min(100%, 74rem);
    gap: var(--ct-space-5);
    margin: 0 auto;
    padding-bottom: var(--ct-space-6);
}

.progress-page > .progress-hero,
.progress-backfill-message {
    margin: 0;
}

.progress-summary-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr);
    gap: var(--ct-space-4);
}

.progress-level-card,
.progress-activity-card {
    display: grid;
    align-content: start;
    gap: var(--ct-space-5);
}

.progress-level-card {
    background:
        linear-gradient(135deg, rgba(120, 169, 135, 0.14), transparent 68%),
        var(--ct-surface-raised);
}

.progress-card-heading,
.progress-section-heading,
.progress-achievement-topline,
.progress-achievement-footer,
.progress-level-copy {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: var(--ct-space-3);
}

.progress-card-heading h2,
.progress-section-heading h2,
.progress-achievement-copy h3 {
    margin: 0;
}

.progress-card-heading h2 {
    font-size: clamp(1.65rem, 3vw, 2.35rem);
    font-weight: 800;
}

.progress-total-xp,
.progress-achievement-count,
.progress-achievement-state,
.progress-achievement-xp {
    flex: 0 0 auto;
    border-radius: var(--ct-radius-pill);
    font-weight: 700;
}

.progress-total-xp {
    padding: 0.55rem 0.8rem;
    background: var(--ct-primary-soft);
    color: var(--ct-primary-strong);
    font-size: 0.9rem;
}

.progress-level-copy {
    align-items: baseline;
    color: var(--ct-text-muted);
    font-size: 0.86rem;
}

.progress-level-copy strong {
    color: var(--ct-text);
    font-size: 1rem;
}

.progress-level-track {
    height: 0.8rem;
    overflow: hidden;
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-pill);
    background: var(--ct-surface-soft);
}

.progress-level-track > span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: var(--ct-calorie-ring);
}

.progress-level-complete {
    display: flex;
    align-items: center;
    gap: var(--ct-space-3);
    padding: var(--ct-space-4);
    border: 1px solid rgba(120, 169, 135, 0.32);
    border-radius: var(--ct-radius-md);
    background: rgba(120, 169, 135, 0.12);
}

.progress-level-complete strong,
.progress-level-complete span {
    display: block;
}

.progress-level-complete div > span {
    margin-top: 0.1rem;
    color: var(--ct-text-muted);
    font-size: 0.86rem;
}

.progress-level-symbol,
.progress-activity-symbol {
    display: inline-grid;
    width: 2.65rem;
    height: 2.65rem;
    flex: 0 0 2.65rem;
    place-items: center;
    border-radius: var(--ct-radius-md);
    background: rgba(120, 169, 135, 0.16);
    color: var(--ct-text);
    font-size: 1.15rem;
    font-weight: 800;
}

.progress-activity-empty {
    margin: 0;
    color: var(--ct-text-muted);
}

.progress-activity-stats {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--ct-space-2);
    margin: 0;
}

.progress-activity-stats > div {
    min-width: 0;
    padding: var(--ct-space-3);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-md);
    background: var(--ct-surface);
}

.progress-activity-stats dt {
    color: var(--ct-text-muted);
    font-size: 0.76rem;
    font-weight: 700;
}

.progress-activity-stats dd {
    display: flex;
    min-width: 0;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.25rem;
    margin: var(--ct-space-1) 0 0;
    color: var(--ct-text);
    font-size: 0.82rem;
}

.progress-activity-stats dd strong {
    font-size: 1.25rem;
}

.progress-achievements {
    display: grid;
    gap: var(--ct-space-4);
}

.progress-section-heading {
    align-items: end;
}

.progress-section-heading h2 {
    font-size: 1.6rem;
}

.progress-section-heading p:not(.ct-eyebrow) {
    margin: var(--ct-space-1) 0 0;
    color: var(--ct-text-muted);
}

.progress-achievement-count {
    padding: 0.45rem 0.75rem;
    border: 1px solid var(--ct-border);
    background: var(--ct-surface-raised);
    color: var(--ct-text-muted);
    font-size: 0.82rem;
}

.progress-achievement-controls {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--ct-space-2);
}

.progress-hide-unlocked {
    min-height: 2.2rem;
    padding: 0.42rem 0.7rem;
    border: 1px solid var(--ct-border-strong);
    border-radius: var(--ct-radius-pill);
    background: var(--ct-surface-raised);
    color: var(--ct-text-muted);
    font-size: 0.78rem;
    font-weight: 700;
}

.progress-hide-unlocked:hover,
.progress-hide-unlocked[aria-pressed="true"] {
    border-color: rgba(var(--bs-primary-rgb), 0.32);
    background: var(--ct-primary-soft);
    color: var(--ct-primary-strong);
}

.progress-hide-unlocked:focus-visible,
.app-nav-link--danger:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 2px;
}

.progress-achievement-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: var(--ct-space-3);
}

.progress-achievement-card {
    display: grid;
    min-width: 0;
    min-height: 14rem;
    grid-template-rows: auto 1fr auto;
    gap: var(--ct-space-4);
    padding: var(--ct-space-4);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-lg);
    background: var(--ct-surface-raised);
    box-shadow: var(--ct-shadow-sm);
}

.progress-achievement-card.is-unlocked {
    border-color: rgba(120, 169, 135, 0.46);
    background:
        linear-gradient(145deg, rgba(120, 169, 135, 0.12), transparent 65%),
        var(--ct-surface-raised);
}

.progress-achievement-card.is-locked {
    background: var(--ct-surface);
}

.progress-achievement-symbol {
    display: inline-grid;
    width: 3rem;
    height: 3rem;
    place-items: center;
    border: 1px solid var(--ct-border);
    border-radius: 50%;
    background: var(--ct-surface-soft);
    color: var(--ct-text-muted);
    font-size: 1.05rem;
    font-weight: 800;
}

.is-unlocked .progress-achievement-symbol {
    border-color: rgba(120, 169, 135, 0.38);
    background: rgba(120, 169, 135, 0.16);
    color: var(--ct-text);
}

.progress-achievement-state {
    padding: 0.28rem 0.6rem;
    background: var(--ct-surface-soft);
    color: var(--ct-text-muted);
    font-size: 0.76rem;
}

.is-unlocked .progress-achievement-state {
    background: rgba(120, 169, 135, 0.16);
    color: var(--ct-success);
}

.progress-achievement-copy h3 {
    font-size: 1.08rem;
}

.progress-achievement-lore {
    margin: var(--ct-space-2) 0 0;
    color: var(--ct-text-muted);
    font-size: 0.88rem;
}

.progress-achievement-how-to {
    margin-top: var(--ct-space-3);
}

.progress-achievement-how-to-label {
    display: block;
    color: var(--ct-text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.progress-achievement-how-to p {
    margin: 0.2rem 0 0;
    color: var(--ct-text);
    font-size: 0.82rem;
    line-height: 1.35;
}

.progress-achievement-footer {
    align-items: end;
    padding-top: var(--ct-space-3);
    border-top: 1px solid var(--ct-border);
}

.progress-achievement-xp {
    color: var(--ct-primary-strong);
    font-size: 0.82rem;
}

.progress-achievement-footer time {
    color: var(--ct-text-muted);
    font-size: 0.73rem;
    text-align: right;
}

.progress-achievements-empty {
    margin: 0;
    padding: var(--ct-space-4);
    border: 1px dashed var(--ct-border-strong);
    border-radius: var(--ct-radius-md);
    background: var(--ct-surface);
    color: var(--ct-text-muted);
    text-align: center;
}

@media (max-width: 767.98px) {
    .progress-summary-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .progress-page {
        gap: var(--ct-space-4);
    }

    .progress-level-card,
    .progress-activity-card {
        gap: var(--ct-space-4);
        padding: var(--ct-space-4);
    }

    .progress-card-heading,
    .progress-section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .progress-activity-stats {
        grid-template-columns: 1fr;
    }

    .progress-achievement-grid {
        grid-template-columns: 1fr;
    }
}

/* =========================
   LOGGED-OUT HOME
   ========================= */

.home-landing {
    max-width: 980px;
    margin: 2rem auto 0;
}

.home-hero {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 3rem;
    align-items: center;
    padding: 3rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 28px;
    background: var(--bs-tertiary-bg);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
}

.home-hero-content {
    max-width: 600px;
}

.home-hero-eyebrow {
    margin-bottom: 0.65rem;
    color: var(--bs-primary);
    font-size: 0.9rem;
    font-weight: 700;
}

.home-hero-title {
    max-width: 580px;
    margin-bottom: 1rem;
    font-size: clamp(2.3rem, 5vw, 4rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -0.04em;
}

.home-hero-description {
    max-width: 560px;
    margin-bottom: 1.5rem;
    color: var(--bs-secondary-color);
    font-size: 1.05rem;
    line-height: 1.6;
}

.home-hero-actions {
    display: flex;
    gap: 0.75rem;
}

    .home-hero-actions .btn {
        padding-inline: 1.25rem;
        font-weight: 600;
    }

.home-hero-capy {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
}

.home-hero-capy-frame {
    position: relative;
    width: 230px;
    height: 230px;
    overflow: hidden;
    border: 2px solid var(--bs-border-color);
    border-radius: 28px;
    background: var(--bs-body-bg);
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

    .home-hero-capy-frame:hover {
        transform: translateY(-4px) rotate(1deg);
        box-shadow: 0 10px 24px rgba(0, 0, 0, 0.14);
    }

.home-hero-capy-layer {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.home-hero-capy-caption {
    color: var(--bs-secondary-color);
    font-size: 0.9rem;
    font-weight: 600;
}

.home-feature-strip {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    margin-top: 1rem;
}

.home-feature {
    padding: 1.25rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 18px;
    background: var(--bs-body-bg);
}

    .home-feature strong {
        display: block;
        margin-bottom: 0.3rem;
        font-size: 0.95rem;
    }

    .home-feature span {
        color: var(--bs-secondary-color);
        font-size: 0.85rem;
        line-height: 1.45;
    }

@media (max-width: 700px) {

    .home-landing {
        margin-top: 1rem;
    }

    .home-hero {
        grid-template-columns: 1fr;
        gap: 2rem;
        padding: 2rem;
    }

    .home-hero-capy {
        order: -1;
    }

    .home-hero-capy-frame {
        width: min(100%, 200px);
        height: auto;
        aspect-ratio: 1 / 1;
    }

    .home-hero-title {
        font-size: clamp(2rem, 10vw, 3rem);
    }

    .home-feature-strip {
        grid-template-columns: 1fr;
    }

    .home-hero-actions {
        flex-direction: column;
    }

        .home-hero-actions .btn {
            width: 100%;
        }
}

/* Shared form treatment follows the existing card and theme palette. */
.form-shell {
    width: 100%;
    max-width: 48rem;
}

.account-form-shell {
    max-width: 30rem;
}

.form-section {
    position: relative;
    min-width: 0;
    margin-top: 2.25rem;
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    border: 1px solid var(--bs-border-color);
    border-radius: 0.75rem;
    background: var(--bs-tertiary-bg);
}

.form-section > legend {
    position: absolute;
    top: -2rem;
    left: 0;
    float: none;
    width: auto;
    margin: 0;
    padding: 0;
    font-size: 1.15rem;
    font-weight: 600;
    color: var(--bs-emphasis-color);
}

.form-section > .mb-3:last-child {
    margin-bottom: 0 !important;
}

.validation-summary-valid {
    display: none;
}

.validation-summary ul {
    margin-bottom: 0;
}

/* =========================
   COMFY CAPY DESIGN SYSTEM
   ========================= */

body {
    background: var(--ct-canvas);
    color: var(--ct-text);
    font-family: "Nunito", "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    line-height: 1.55;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    color: var(--ct-text);
    font-weight: 700;
    letter-spacing: -0.018em;
}

.ct-page-title {
    margin: 0;
    font-size: clamp(2rem, 4vw, 3rem);
    font-weight: 800;
    line-height: 1.08;
    letter-spacing: -0.035em;
}

.ct-eyebrow,
.page-eyebrow {
    margin: 0 0 var(--ct-space-2);
    color: var(--ct-primary-strong);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.ct-section-title {
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.25;
}

.ct-card-title {
    margin: 0;
    font-size: 1.05rem;
    line-height: 1.3;
}

.ct-muted,
.text-body-secondary,
.text-muted {
    color: var(--ct-text-muted) !important;
}

.ct-label,
.form-label {
    color: var(--ct-text);
    font-size: 0.9rem;
    font-weight: 600;
}

.ct-caption,
small,
.small {
    font-size: 0.82rem;
}

.content-page {
    max-width: var(--ct-reading-max);
}

.ct-card,
.card,
.content-card,
.faq-list details,
.form-section {
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-lg);
    background: var(--ct-surface-raised);
    box-shadow: var(--ct-shadow-sm);
}

.ct-card {
    min-width: 0;
    padding: var(--ct-space-5);
}

.card {
    --bs-card-bg: var(--ct-surface-raised);
    --bs-card-border-color: var(--ct-border);
    --bs-card-border-radius: var(--ct-radius-lg);
    --bs-card-cap-bg: var(--ct-surface);
}

.card-header,
.card-footer {
    border-color: var(--ct-border);
}

.content-card,
.faq-list details,
.form-section {
    background: var(--ct-surface);
}

.btn {
    --bs-btn-border-radius: var(--ct-radius-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--ct-space-2);
    font-weight: 600;
    transition: color 0.16s ease, background-color 0.16s ease,
        border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.btn:not(.btn-sm) {
    min-height: 2.65rem;
    padding-inline: 1rem;
}

.btn-primary {
    --bs-btn-bg: var(--ct-primary);
    --bs-btn-border-color: var(--ct-primary);
    --bs-btn-hover-bg: var(--ct-primary-strong);
    --bs-btn-hover-border-color: var(--ct-primary-strong);
    --bs-btn-active-bg: var(--ct-primary-strong);
    --bs-btn-active-border-color: var(--ct-primary-strong);
    box-shadow: 0 2px 7px rgba(var(--bs-primary-rgb), 0.18);
}

.btn-outline-primary {
    --bs-btn-color: var(--ct-primary-strong);
    --bs-btn-border-color: rgba(var(--bs-primary-rgb), 0.58);
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: var(--ct-primary-strong);
    --bs-btn-hover-border-color: var(--ct-primary-strong);
    --bs-btn-active-bg: var(--ct-primary-strong);
    --bs-btn-active-border-color: var(--ct-primary-strong);
}

[data-bs-theme="dark"] .btn-outline-primary {
    --bs-btn-hover-color: #14202f;
}

.btn:hover:not(:disabled):not(.disabled) {
    transform: translateY(-1px);
}

.btn:active:not(:disabled):not(.disabled) {
    transform: translateY(0);
}

.form-control,
.form-select,
.input-group-text {
    min-height: 2.65rem;
    border-color: var(--ct-border-strong);
    background-color: var(--ct-surface-raised);
    color: var(--ct-text);
}

.form-control,
.form-select {
    border-radius: var(--ct-radius-sm);
}

.form-control::placeholder {
    color: var(--ct-text-muted);
    opacity: 0.82;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus,
.btn:focus-visible,
.nav-link:focus-visible,
a:focus-visible,
button:focus-visible,
summary:focus-visible {
    border-color: var(--ct-focus);
    outline: 2px solid transparent;
    box-shadow: 0 0 0 0.22rem rgba(var(--bs-primary-rgb), 0.3);
}

.form-check-input:checked {
    border-color: var(--ct-primary);
    background-color: var(--ct-primary);
}

.badge,
.rounded-pill {
    border-radius: var(--ct-radius-pill) !important;
    font-weight: 600;
    letter-spacing: 0.01em;
}

.alert {
    border-radius: var(--ct-radius-md);
    border-color: var(--ct-border);
}

.dropdown-menu {
    --bs-dropdown-bg: var(--ct-surface-raised);
    --bs-dropdown-border-color: var(--ct-border);
    --bs-dropdown-border-radius: var(--ct-radius-md);
    --bs-dropdown-link-color: var(--ct-text);
    --bs-dropdown-link-hover-bg: var(--ct-primary-soft);
    --bs-dropdown-link-active-bg: var(--ct-primary-soft);
    --bs-dropdown-link-active-color: var(--ct-text);
    padding: var(--ct-space-2);
    box-shadow: var(--ct-shadow-md);
}

.dropdown-item {
    display: flex;
    min-height: 2.5rem;
    align-items: center;
    border-radius: calc(var(--ct-radius-sm) - 0.15rem);
}

.pagination {
    --bs-pagination-bg: var(--ct-surface-raised);
    --bs-pagination-border-color: var(--ct-border);
    --bs-pagination-border-radius: var(--ct-radius-sm);
    --bs-pagination-color: var(--ct-primary-strong);
    --bs-pagination-active-bg: var(--ct-primary);
    --bs-pagination-active-border-color: var(--ct-primary);
}

/* =========================
   APPLICATION SHELL
   ========================= */

.public-shell,
.shell-main {
    display: flex;
    min-width: 0;
    min-height: 100vh;
    flex-direction: column;
}

.public-shell-main,
.app-shell-main {
    flex: 1 1 auto;
}

.shell-content {
    width: 100%;
    min-width: 0;
    flex: 1 0 auto;
}

.public-navbar {
    background: color-mix(in srgb, var(--ct-surface-raised) 94%, transparent);
    backdrop-filter: blur(14px);
}

.public-navbar .nav-link {
    border-radius: var(--ct-radius-sm);
    font-weight: 600;
}

.public-navbar .nav-link[aria-current="page"] {
    color: var(--ct-primary-strong);
    background: var(--ct-primary-soft);
}

.app-shell {
    min-height: 100vh;
}

.app-content-width {
    width: min(100%, var(--ct-content-max));
    margin-inline: auto;
}

/* The shell itself must occupy the full region beside the sidebar. Individual
   pages retain their own readable-width constraints inside this region. */
.app-shell-main > .app-content-width {
    width: 100%;
    max-width: none;
}

.app-content {
    padding: var(--ct-space-5) var(--ct-space-5) var(--ct-space-6);
}

.app-sidebar {
    --bs-offcanvas-width: min(88vw, 20rem);
    color: var(--ct-text);
    background: var(--ct-sidebar-surface);
    border-color: var(--ct-border) !important;
}

.app-sidebar-body {
    display: flex;
    min-height: 0;
    flex-direction: column;
    padding: var(--ct-space-4);
    overflow-y: auto;
}

.app-sidebar-brand {
    padding: var(--ct-space-2) var(--ct-space-2) var(--ct-space-5);
}

.app-brand-lockup {
    display: block;
    width: min(11.875rem, 100%);
    max-width: 100%;
    aspect-ratio: 1200 / 512;
    line-height: 0;
}

.app-brand-lockup-image {
    display: block;
    width: 100%;
    height: auto;
}

.app-brand-lockup-image--dark {
    display: none;
}

[data-bs-theme="dark"] .app-brand-lockup-image--light {
    display: none;
}

[data-bs-theme="dark"] .app-brand-lockup-image--dark {
    display: block;
}

.app-navigation {
    display: flex;
    min-height: 0;
    flex: 1 1 auto;
    flex-direction: column;
    justify-content: flex-start;
    gap: var(--ct-space-5);
}

.app-nav-utility {
    display: flex;
    flex-direction: column;
    gap: var(--ct-space-2);
    margin-top: auto;
    padding-top: var(--ct-space-4);
    border-top: 1px solid var(--ct-border);
}

.app-nav-list {
    display: grid;
    gap: var(--ct-space-1);
    margin: 0;
    padding: 0;
    list-style: none;
}

.app-nav-link {
    display: flex;
    min-height: 2.7rem;
    align-items: center;
    gap: var(--ct-space-3);
    padding: 0.65rem 0.75rem;
    border: 1px solid transparent;
    border-radius: var(--ct-radius-sm);
    color: var(--ct-text);
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1.25;
    text-decoration: none;
    transition: color 0.16s ease, background-color 0.16s ease,
        border-color 0.16s ease, transform 0.16s ease;
}

.app-nav-link:hover {
    color: var(--ct-text);
    background: var(--ct-surface-soft);
    transform: translateX(2px);
}

.app-nav-link[aria-current="page"] {
    border-color: rgba(var(--bs-primary-rgb), 0.12);
    background: var(--ct-primary-soft);
    color: var(--ct-primary-strong);
}

.app-nav-link--supporting {
    min-height: 2.4rem;
    padding-block: 0.5rem;
    color: var(--ct-text-muted);
    font-size: 0.86rem;
}

.app-nav-actions form {
    margin: 0;
}

.app-nav-link--danger {
    width: 100%;
    border-color: transparent;
    color: var(--ct-danger);
    background: transparent;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
}

.app-nav-link--danger:hover {
    border-color: color-mix(in srgb, var(--ct-danger) 24%, transparent);
    color: var(--ct-danger);
    background: color-mix(in srgb, var(--ct-danger) 10%, transparent);
}

.app-nav-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex: 0 0 1.25rem;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.75;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.account-nav-summary {
    display: flex;
    width: 100%;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--ct-space-2);
    padding: var(--ct-space-2);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-md);
    background: var(--ct-surface-raised);
    box-shadow: var(--ct-shadow-sm);
}

.account-nav-toggle {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    align-items: center;
    padding: 0.2rem 0.25rem !important;
    border: 0;
    color: var(--ct-text) !important;
    background: transparent;
    text-align: left;
}

.account-nav-toggle::after {
    margin-left: auto;
}

.account-nav-copy,
.account-nav-greeting,
.account-nav-name {
    display: block;
    min-width: 0;
}

.account-nav-greeting {
    color: var(--ct-text-muted);
    font-size: 0.68rem;
    font-weight: 600;
    line-height: 1.2;
}

.account-nav-name {
    overflow: hidden;
    font-size: 0.88rem;
    font-weight: 700;
    line-height: 1.25;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-nav-level {
    display: block;
    margin-top: 0.12rem;
    color: var(--ct-text-muted);
    font-size: 0.72rem;
    font-weight: 600;
    line-height: 1.2;
}

.account-nav-logout {
    margin-top: var(--ct-space-1);
    padding-top: var(--ct-space-1);
    border-top: 1px solid var(--ct-border);
}

.app-page-account {
    display: flex;
    justify-content: flex-end;
    margin-bottom: var(--ct-space-4);
}

.app-page-account .account-nav,
.app-page-account .account-nav-item {
    width: min(100%, 18rem);
    margin: 0;
}

.app-mobile-header {
    display: none;
    min-height: 4rem;
    padding: var(--ct-space-2) var(--ct-space-4);
    border-bottom: 1px solid var(--ct-border);
    background: color-mix(in srgb, var(--ct-surface-raised) 94%, transparent);
    box-shadow: var(--ct-shadow-sm);
    backdrop-filter: blur(14px);
}

.app-mobile-menu-button {
    flex: 0 0 auto;
    width: 2.75rem;
    height: 2.75rem;
    padding: 0;
    border-color: var(--ct-border-strong);
    border-radius: var(--ct-radius-sm);
}

.app-mobile-brand {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    align-items: center;
    justify-content: flex-start;
    gap: var(--ct-space-2);
    color: var(--ct-text);
}

.app-mobile-brand .app-brand-lockup {
    width: min(10.625rem, 100%);
}

.development-banner {
    box-shadow: inset 0 -1px 0 rgba(102, 77, 3, 0.04);
}

.app-footer {
    background: var(--ct-surface);
}

.app-footer > .app-content-width {
    padding-inline: var(--ct-space-5);
}

/* =========================
   SCENIC HEADERS + ART SLOTS
   ========================= */

.ct-scenic-header {
    position: relative;
    display: grid;
    min-width: 0;
    min-height: 9.5rem;
    align-items: center;
    margin-bottom: var(--ct-space-5);
    padding: var(--ct-space-5) var(--ct-space-6);
    overflow: hidden;
    border: 1px solid rgba(var(--bs-primary-rgb), 0.14);
    border-radius: var(--ct-radius-xl);
    background:
        radial-gradient(circle at 82% 20%, rgba(255, 255, 255, 0.7), transparent 24%),
        linear-gradient(120deg, #edf6fb 0%, #f7f2df 58%, #e7f2df 100%);
    box-shadow: var(--ct-shadow-sm);
}

.ct-scenic-header::after {
    position: absolute;
    right: 9%;
    bottom: -3.5rem;
    width: 17rem;
    height: 8rem;
    border-radius: 50%;
    background: rgba(91, 151, 103, 0.12);
    content: "";
}

.ct-scenic-header--with-art {
    grid-template-columns: minmax(0, 1fr) minmax(7.5rem, 10.5rem);
    gap: var(--ct-space-5);
}

.ct-scenic-header__content,
.ct-scenic-header__art {
    position: relative;
    z-index: 1;
}

.ct-art-slot {
    display: grid;
    min-width: 0;
    place-items: center;
    overflow: hidden;
    border-radius: var(--ct-radius-lg);
}

.ct-art-slot img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center;
}

.ct-scenic-header__art {
    width: 100%;
    aspect-ratio: 1 / 1;
    justify-self: end;
    border: 1px solid rgba(255, 255, 255, 0.58);
    background: rgba(255, 255, 255, 0.42);
    box-shadow: 0 8px 22px rgba(49, 79, 76, 0.1);
}

[data-bs-theme="dark"] .ct-scenic-header {
    background:
        radial-gradient(circle at 82% 20%, rgba(134, 184, 245, 0.12), transparent 24%),
        linear-gradient(120deg, #202d38 0%, #302d29 58%, #213127 100%);
}

[data-bs-theme="dark"] .ct-scenic-header__art {
    border-color: rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.06);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}

.ct-scenic-header.secondary-page-hero {
    grid-template-columns: minmax(0, 1fr);
    min-height: 10.5rem;
    gap: 0;
    margin-bottom: 0;
    padding: clamp(1.5rem, 3vw, 2.25rem);
}

.ct-scenic-header.secondary-page-hero .ct-scenic-header__content {
    width: min(100%, 44rem);
}

.ct-scenic-header.secondary-page-hero .ct-page-title {
    max-width: 18ch;
    font-size: clamp(2.1rem, 4.5vw, 3.5rem);
}

@media (max-width: 767.98px) {
    .ct-scenic-header.secondary-page-hero {
        min-height: 0;
        padding: var(--ct-space-4);
    }

    .ct-scenic-header.secondary-page-hero .ct-page-title {
        max-width: none;
        font-size: clamp(1.9rem, 9vw, 2.5rem);
    }

}

@media (min-width: 992px) {
    .app-shell {
        display: grid;
        grid-template-columns: var(--ct-sidebar-width) minmax(0, 1fr);
    }

    .app-sidebar {
        position: sticky !important;
        top: 0;
        z-index: 20;
        width: var(--ct-sidebar-width) !important;
        height: 100vh;
        border-right: 1px solid var(--ct-border) !important;
        background: var(--ct-sidebar-surface) !important;
    }

    .app-sidebar .app-sidebar-body {
        min-height: 100%;
        flex-grow: 1;
        padding: var(--ct-space-4);
        overflow-y: auto;
        background: transparent !important;
    }

    .app-sidebar-mobile-heading {
        display: none;
    }
}

@media (max-width: 991.98px) {
    .app-sidebar .app-sidebar-body {
        overflow-y: auto;
    }

    .app-sidebar .app-navigation {
        flex: 0 0 auto;
    }

    .app-sidebar .app-nav-utility {
        margin-top: 0;
    }

    .app-sidebar,
    .app-sidebar-body {
        touch-action: pan-y;
    }

    .app-mobile-header {
        position: sticky;
        top: 0;
        z-index: 30;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-wrap: nowrap;
        gap: var(--ct-space-3);
    }

    .app-mobile-menu-button {
        order: -1;
    }

    .app-mobile-brand {
        justify-content: flex-end;
    }

    .app-content,
    .app-footer > .app-content-width {
        padding-inline: var(--ct-space-4);
    }
}

@media (max-width: 575.98px) {
    .app-content {
        padding-top: var(--ct-space-4);
        padding-inline: 0.875rem;
    }

    .app-footer > .app-content-width {
        padding-inline: 0.875rem;
    }

    .app-mobile-header {
        padding-inline: 0.875rem;
    }

    .ct-card {
        padding: var(--ct-space-4);
    }

    .ct-scenic-header {
        min-height: 8rem;
        padding: var(--ct-space-4);
        border-radius: var(--ct-radius-lg);
    }

    .ct-scenic-header--with-art {
        grid-template-columns: minmax(0, 1fr) 5.75rem;
        gap: var(--ct-space-3);
    }

    .ct-scenic-header .ct-page-title {
        font-size: clamp(1.7rem, 8vw, 2.15rem);
    }

    .ct-scenic-header::after {
        right: -3rem;
    }
}

@media (max-width: 350px) {
    .ct-scenic-header--with-art {
        grid-template-columns: minmax(0, 1fr) 4.75rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =========================
   PHASE 2 DASHBOARD
   ========================= */

.dashboard-page {
    display: grid;
    width: 100%;
    max-width: none;
    gap: var(--ct-space-5);
    margin: 0;
    padding-bottom: var(--ct-space-4);
}

.dashboard-hero {
    min-height: 16rem;
    margin-bottom: 0;
    padding: clamp(1.5rem, 4vw, 3rem);
}

.dashboard-hero.ct-scenic-header--with-art {
    grid-template-columns: minmax(0, 1.1fr) minmax(18rem, 0.9fr);
    gap: clamp(1.5rem, 4vw, 4rem);
}

.dashboard-hero .ct-page-title {
    max-width: 13ch;
    font-size: clamp(2.35rem, 5vw, 4.6rem);
}

.ct-scenic-header.ct-scenic-header--full-bleed-art {
    z-index: 1;
    grid-template-columns: minmax(0, 1fr);
    height: clamp(20rem, 28vw, 36rem);
    min-height: 0;
    aspect-ratio: auto;
    gap: 0;
    border: 0;
    border-radius: 0;
    background: #cce1fd;
    box-shadow: none;
    isolation: isolate;
    overflow: visible;
}

.ct-scenic-header.ct-scenic-header--full-bleed-art::after {
    display: none;
}

.ct-scenic-header.ct-scenic-header--full-bleed-art::before {
    position: absolute;
    z-index: 1;
    inset: 0;
    background: linear-gradient(
        90deg,
        rgba(10, 18, 24, 0.76) 0%,
        rgba(10, 18, 24, 0.58) 20%,
        rgba(10, 18, 24, 0.24) 40%,
        rgba(10, 18, 24, 0.08) 50%,
        transparent 60%);
    content: "";
    pointer-events: none;
}

.ct-scenic-header.ct-scenic-header--full-bleed-art .ct-scenic-header__content {
    z-index: 2;
    width: min(100%, 36rem);
}

.ct-scenic-header.ct-scenic-header--full-bleed-art .ct-page-title {
    color: #fff;
    text-shadow:
        0 2px 4px rgba(0, 0, 0, 0.45),
        0 1px 12px rgba(0, 0, 0, 0.2);
}

.ct-scenic-header.ct-scenic-header--full-bleed-art .ct-eyebrow {
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
}

.ct-scenic-header__account {
    position: absolute;
    z-index: 4;
    top: clamp(1.25rem, 3vw, 2.25rem);
    right: clamp(1.25rem, 3vw, 2.25rem);
    width: min(18rem, calc(100% - 2.5rem));
}

.ct-scenic-header__account .account-nav,
.ct-scenic-header__account .account-nav-item {
    width: 100%;
    margin: 0;
}

.ct-scenic-header__account .account-nav-summary {
    flex-wrap: nowrap;
    border-color: rgba(255, 255, 255, 0.2);
    background: rgba(10, 18, 24, 0.74);
    box-shadow: 0 10px 28px rgba(0, 0, 0, 0.22);
    backdrop-filter: blur(8px);
}

.ct-scenic-header__account .navbar-capy {
    width: 2.75rem;
    height: 2.75rem;
    flex-basis: 2.75rem;
    border-color: rgba(255, 255, 255, 0.24);
    border-radius: var(--ct-radius-sm);
    background: rgba(255, 255, 255, 0.12);
}

.ct-scenic-header__account .account-nav-toggle,
.ct-scenic-header__account .account-nav-name {
    color: #fff !important;
}

.ct-scenic-header__account .account-nav-level {
    color: rgba(255, 255, 255, 0.72);
}

.ct-scenic-header__account .account-nav-menu {
    z-index: 8;
    width: 100%;
    min-width: 13rem;
}

.ct-scenic-header.ct-scenic-header--full-bleed-art .ct-scenic-header__art {
    position: absolute;
    z-index: 0;
    inset: 0;
    width: 100%;
    height: 100%;
    align-self: stretch;
    justify-self: stretch;
    aspect-ratio: auto;
    border: 0;
    border-radius: inherit;
    background: transparent;
    box-shadow: none;
}

.ct-scenic-header.ct-scenic-header--full-bleed-art .ct-scenic-header__art img {
    width: 100%;
    height: 100%;
    max-width: none;
    max-height: none;
    object-fit: cover;
    object-position: center;
}

.app-shell-main:has(.ct-scenic-header--full-bleed-art) {
    overflow-x: clip;
}

[data-bs-theme="dark"] .ct-scenic-header.ct-scenic-header--full-bleed-art {
    background: #cce1fd;
}

@media (min-width: 768px) {
    .ct-scenic-header.ct-scenic-header--full-bleed-art .ct-scenic-header__content {
        width: min(36rem, calc(100% - 19rem));
    }
}

@media (max-width: 767.98px) {
    .ct-scenic-header.ct-scenic-header--full-bleed-art {
        align-content: center;
        align-items: start;
        gap: var(--ct-space-4);
    }

    .ct-scenic-header.ct-scenic-header--full-bleed-art .ct-scenic-header__content {
        width: 100%;
    }

    .ct-scenic-header__account {
        position: relative;
        top: auto;
        right: auto;
        width: min(100%, 18rem);
        justify-self: start;
    }
}

@media (min-width: 992px) {
    .ct-scenic-header.ct-scenic-header--full-bleed-art {
        height: 17.5rem;
        width: calc(100vw - var(--ct-sidebar-width));
        margin-left: calc((100% - 100vw + var(--ct-sidebar-width)) / 2);
    }

    .ct-scenic-header.ct-scenic-header--full-bleed-art .ct-scenic-header__account {
        top: 1.25rem;
    }
}

@media (max-width: 991.98px) {
    .ct-scenic-header.ct-scenic-header--full-bleed-art {
        width: calc(100% + var(--ct-space-5) + var(--ct-space-5));
        margin-left: calc(-1 * var(--ct-space-5));
    }
}

@media (max-width: 575.98px) {
    .ct-scenic-header.ct-scenic-header--full-bleed-art {
        width: calc(100% + 0.875rem + 0.875rem);
        height: 20rem;
        margin-left: -0.875rem;
        padding: var(--ct-space-4);
    }

    .ct-scenic-header.ct-scenic-header--full-bleed-art::before {
        background: linear-gradient(
            90deg,
            rgba(10, 18, 24, 0.82) 0%,
            rgba(10, 18, 24, 0.64) 56%,
            rgba(10, 18, 24, 0.24) 84%,
            transparent 100%);
    }
}

.ct-art-placeholder {
    display: grid;
    width: 100%;
    height: 100%;
    min-height: inherit;
    place-items: center;
    padding: var(--ct-space-4);
    color: var(--ct-text-muted);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-align: center;
}

.dashboard-setup-card {
    margin: 0;
    border-width: 1px;
    border-color: rgba(var(--bs-primary-rgb), 0.28);
    border-radius: var(--ct-radius-lg);
    background: var(--ct-primary-soft);
    box-shadow: var(--ct-shadow-sm);
}

.dashboard-two-column-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(22rem, 0.85fr);
    gap: var(--ct-space-5);
    align-items: stretch;
}

.dashboard-main-card,
.dashboard-macro-section,
.dashboard-year-card,
.dashboard-streak-card,
.dashboard-quick-actions,
.dashboard-comfy-note {
    min-width: 0;
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-xl);
    background: var(--ct-surface-raised);
    box-shadow: var(--ct-shadow-sm);
}

.dashboard-main-card,
.dashboard-macro-section,
.dashboard-streak-card,
.dashboard-quick-actions,
.dashboard-comfy-note {
    padding: clamp(1.25rem, 2.5vw, 2rem);
}

.dashboard-main-card {
    display: block;
}

.dashboard-card-heading,
.dashboard-year-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--ct-space-4);
}

.dashboard-card-heading h2,
.dashboard-year-heading h2 {
    margin: 0;
    font-size: 1.35rem;
    line-height: 1.2;
}

.dashboard-eyebrow {
    margin: 0 0 var(--ct-space-1);
    color: var(--ct-primary-strong);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.dashboard-heading-note {
    color: var(--ct-text-muted);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.dashboard-text-link {
    flex: 0 0 auto;
    color: var(--ct-primary-strong);
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
}

.dashboard-text-link:hover {
    color: var(--ct-primary);
    text-decoration: underline;
    text-underline-offset: 0.2rem;
}

.dashboard-calorie-layout {
    display: grid;
    grid-template-columns: minmax(11rem, 14rem) minmax(0, 1fr);
    gap: clamp(1.5rem, 3vw, 2.5rem);
    align-items: center;
    margin-top: var(--ct-space-5);
}

.dashboard-calorie-ring {
    display: grid;
    width: min(100%, 14rem);
    aspect-ratio: 1;
    place-items: center;
    justify-self: center;
    padding: 0.9rem;
    border-radius: 50%;
    background: conic-gradient(
        var(--ct-calorie-ring) var(--dashboard-calorie-progress, 0%),
        var(--ct-surface-soft) 0);
    box-shadow: inset 0 0 0 1px var(--ct-border);
}

.dashboard-calorie-ring.is-unset {
    background: var(--ct-surface-soft);
}

.dashboard-calorie-ring-centre {
    display: grid;
    width: 100%;
    height: 100%;
    place-content: center;
    border: 1px solid var(--ct-border);
    border-radius: 50%;
    background: var(--ct-surface-raised);
    color: var(--ct-text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-align: center;
}

.dashboard-calorie-current {
    color: var(--ct-text);
    font-size: clamp(2.35rem, 5vw, 3.75rem);
    font-weight: 800;
    line-height: 1;
    letter-spacing: -0.05em;
}

.dashboard-calorie-metrics {
    display: grid;
    gap: var(--ct-space-3);
    margin: 0;
}

.dashboard-calorie-metrics > div {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--ct-space-4);
    padding-bottom: var(--ct-space-3);
    border-bottom: 1px solid var(--ct-border);
}

.dashboard-calorie-metrics > div:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.dashboard-calorie-metrics dt {
    color: var(--ct-text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.dashboard-calorie-metrics dd {
    margin: 0;
    color: var(--ct-text);
    font-size: 1.05rem;
    font-weight: 700;
    text-align: right;
}

.dashboard-calorie-empty strong {
    display: block;
    margin-bottom: var(--ct-space-2);
}

.dashboard-calorie-empty p {
    margin: 0;
    color: var(--ct-text-muted);
}

.dashboard-macro-section {
    margin: 0;
}

.dashboard-macro-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    margin-top: var(--ct-space-4);
}

.dashboard-macro-card {
    display: flex;
    min-width: 0;
    align-items: center;
    gap: var(--ct-space-3);
    padding: var(--ct-space-4) 0;
    border: 0;
    border-bottom: 1px solid var(--ct-border);
    border-radius: 0;
    background: transparent;
    transition: none;
}

.dashboard-macro-card:first-child {
    padding-top: var(--ct-space-2);
}

.dashboard-macro-card:last-child {
    padding-bottom: 0;
    border-bottom: 0;
}

.dashboard-macro-card:hover {
    transform: none;
    box-shadow: none;
}

.dashboard-macro-icon {
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 2.5rem;
    border-radius: var(--ct-radius-sm);
    color: var(--ct-ink-on-pastel);
    font-size: 0.78rem;
}

.dashboard-macro-content {
    display: grid;
    min-width: 0;
    flex: 1;
    gap: var(--ct-space-2);
}

.dashboard-macro-copy {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--ct-space-3);
}

.dashboard-macro-label {
    color: var(--ct-text);
    font-size: 0.9rem;
    font-weight: 600;
}

.dashboard-macro-value {
    margin: 0;
    color: var(--ct-text);
    font-size: 1rem;
    white-space: nowrap;
}

.dashboard-macro-value span {
    color: var(--ct-text-muted);
    font-size: 0.78rem;
    font-weight: 600;
}

.dashboard-macro-content .macro-goal-progress {
    height: 0.55rem;
    margin: 0;
}

.dashboard-year-card {
    margin: 0;
    padding: clamp(1.25rem, 2.5vw, 2rem);
}

.dashboard-streak-card {
    display: grid;
    align-content: start;
    gap: var(--ct-space-4);
    min-width: 0;
}

.dashboard-streak-symbol {
    display: grid;
    width: 2.25rem;
    height: 2.25rem;
    flex: 0 0 2.25rem;
    place-items: center;
    border: 1px solid var(--ct-border);
    border-radius: 50%;
    background: var(--ct-primary-soft);
    color: var(--ct-primary-strong);
    font-size: 1rem;
}

.dashboard-streak-primary {
    display: flex;
    align-items: baseline;
    flex-wrap: wrap;
    column-gap: var(--ct-space-2);
    row-gap: var(--ct-space-1);
    padding-top: var(--ct-space-2);
}

.dashboard-streak-primary strong {
    color: var(--ct-text);
    font-size: clamp(2.5rem, 5vw, 3.75rem);
    font-weight: 800;
    line-height: 0.95;
    letter-spacing: -0.06em;
}

.dashboard-streak-primary > span {
    color: var(--ct-text-muted);
    font-size: 0.9rem;
    font-weight: 700;
}

.dashboard-streak-primary p {
    flex-basis: 100%;
    margin: var(--ct-space-1) 0 0;
    color: var(--ct-text-muted);
    font-size: 0.82rem;
}

.dashboard-streak-week {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: var(--ct-space-2);
    min-width: 0;
}

.dashboard-streak-day {
    display: grid;
    min-width: 0;
    justify-items: center;
    gap: var(--ct-space-2);
    padding: var(--ct-space-2) var(--ct-space-1);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-sm);
    background: var(--ct-surface);
    color: var(--ct-text-muted);
}

.dashboard-streak-day.is-active {
    border-color: rgba(var(--bs-primary-rgb), 0.45);
    background: var(--ct-primary-soft);
    color: var(--ct-primary-strong);
}

.dashboard-streak-day-label {
    overflow: hidden;
    max-width: 100%;
    font-size: 0.65rem;
    font-weight: 700;
    line-height: 1;
    text-overflow: ellipsis;
    text-transform: uppercase;
}

.dashboard-streak-day-dot {
    width: 0.55rem;
    height: 0.55rem;
    border: 1px solid currentColor;
    border-radius: 50%;
    opacity: 0.5;
}

.dashboard-streak-day.is-active .dashboard-streak-day-dot {
    border-color: var(--ct-primary-strong);
    background: var(--ct-primary-strong);
    opacity: 1;
}

.dashboard-streak-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--ct-space-3);
    margin: 0;
    padding-top: var(--ct-space-4);
    border-top: 1px solid var(--ct-border);
}

.dashboard-streak-stats > div {
    min-width: 0;
}

.dashboard-streak-stats dt {
    color: var(--ct-text-muted);
    font-size: 0.72rem;
    font-weight: 600;
}

.dashboard-streak-stats dd {
    margin: var(--ct-space-1) 0 0;
    color: var(--ct-text);
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.1;
}

.dashboard-streak-stats dd span {
    color: var(--ct-text-muted);
    font-size: 0.72rem;
    font-weight: 600;
}

.dashboard-year-heading p {
    max-width: 46rem;
    color: var(--ct-text-muted);
}

.calorie-year-scroll {
    margin-top: var(--ct-space-4);
    padding: var(--ct-space-2) 0;
}

.calorie-year-legend {
    margin-top: var(--ct-space-4);
    padding-top: var(--ct-space-3);
    border-top: 1px solid var(--ct-border);
}

.dashboard-estimates-card {
    margin-top: 0 !important;
    border-radius: var(--ct-radius-lg);
}

.dashboard-estimate-stats {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: var(--ct-space-3);
    margin: var(--ct-space-5) 0 0;
}

.dashboard-estimate-stat {
    min-width: 0;
    padding: var(--ct-space-3);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-md);
    background: var(--ct-surface);
}

.dashboard-estimate-stat dt {
    color: var(--ct-text-muted);
    font-size: 0.72rem;
    font-weight: 600;
}

.dashboard-estimate-stat dd {
    margin: 0.25rem 0 0;
    color: var(--ct-text);
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.2;
}

.dashboard-estimate-stat dd span {
    color: var(--ct-text-muted);
    font-size: 0.72rem;
    font-weight: 600;
}

.dashboard-estimates-card .goal-timeline {
    margin-top: var(--ct-space-4) !important;
    padding-top: var(--ct-space-4) !important;
}

.dashboard-estimates-card .goal-timeline h3 {
    margin-bottom: var(--ct-space-2);
    font-size: 0.95rem;
}

.dashboard-estimates-card .goal-timeline p {
    margin-bottom: 0.35rem !important;
    font-size: 0.82rem;
}

.dashboard-estimates-card .goal-timeline p.h4 {
    font-size: 1rem;
}

.dashboard-support-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(17rem, 0.65fr);
    gap: var(--ct-space-5);
    align-items: stretch;
}

.dashboard-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--ct-space-3);
    margin: var(--ct-space-4) 0 0;
}

.dashboard-action {
    display: grid;
    min-width: 0;
    min-height: 5.25rem;
    align-content: center;
    gap: var(--ct-space-1);
    padding: var(--ct-space-3) var(--ct-space-4);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-md);
    background: var(--ct-surface);
    color: var(--ct-text);
    text-decoration: none;
    transition: border-color 0.16s ease, background-color 0.16s ease,
        box-shadow 0.16s ease, transform 0.16s ease;
}

.dashboard-action strong {
    font-size: 0.95rem;
}

.dashboard-action > span:not(.dashboard-action-heading) {
    color: var(--ct-text-muted);
    font-size: 0.78rem;
    line-height: 1.35;
}

.dashboard-action-heading {
    display: flex;
    align-items: center;
    gap: var(--ct-space-2);
    color: var(--ct-text);
    font-size: inherit;
    line-height: inherit;
}

.dashboard-action-icon {
    width: 1.25rem;
    height: 1.25rem;
    flex: 0 0 1.25rem;
    color: var(--ct-primary-strong);
    fill: none;
    stroke: currentColor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 1.75;
}

.dashboard-action:hover {
    border-color: rgba(var(--bs-primary-rgb), 0.42);
    background: var(--ct-surface-raised);
    color: var(--ct-text);
    box-shadow: var(--ct-shadow-sm);
    transform: translateY(-1px);
}

.dashboard-comfy-note {
    display: flex;
    flex-direction: column;
    justify-content: center;
    background:
        radial-gradient(circle at 100% 0%, rgba(var(--bs-primary-rgb), 0.12), transparent 45%),
        var(--ct-surface);
}

.dashboard-comfy-note h2 {
    margin: 0;
    font-size: 1.35rem;
}

.dashboard-comfy-note > p:not(.dashboard-eyebrow) {
    margin: var(--ct-space-2) 0 0;
    color: var(--ct-text-muted);
}

.dashboard-capy-identity {
    display: flex;
    align-items: center;
    gap: var(--ct-space-3);
    margin-top: var(--ct-space-4);
    padding-top: var(--ct-space-4);
    border-top: 1px solid var(--ct-border);
    color: var(--ct-text);
    text-decoration: none;
}

.dashboard-capy-identity .dashboard-capy-frame {
    display: grid;
    width: 3.25rem;
    height: 3.25rem;
    flex: 0 0 3.25rem;
    place-items: center;
    border-width: 1px;
    border-radius: var(--ct-radius-sm);
    background: var(--ct-surface-soft);
    box-shadow: none;
    transition: none;
}

.dashboard-capy-identity .dashboard-capy-frame:hover {
    transform: none;
    box-shadow: none;
}

.dashboard-capy-identity .capy-avatar {
    width: 100%;
    height: 100%;
}

.dashboard-capy-identity > span:last-child {
    display: grid;
    min-width: 0;
}

.dashboard-capy-identity small {
    color: var(--ct-primary-strong);
    font-weight: 600;
}

@media (max-width: 1199.98px) {
    .dashboard-primary-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-macro-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
        gap: var(--ct-space-3);
    }

    .dashboard-macro-card,
    .dashboard-macro-card:first-child,
    .dashboard-macro-card:last-child {
        align-items: flex-start;
        padding: var(--ct-space-3);
        border: 1px solid var(--ct-border);
        border-radius: var(--ct-radius-md);
        background: var(--ct-surface);
    }

    .dashboard-macro-copy {
        align-items: flex-start;
        flex-direction: column;
        gap: 0;
    }
}

@media (max-width: 991.98px) {
    .dashboard-year-streak-row {
        grid-template-columns: 1fr;
    }

    .dashboard-support-grid {
        grid-template-columns: 1fr;
    }

    .dashboard-hero.ct-scenic-header--with-art {
        grid-template-columns: minmax(0, 1fr) minmax(14rem, 0.7fr);
    }

    .dashboard-hero.ct-scenic-header--full-bleed-art {
        grid-template-columns: minmax(0, 1fr);
        gap: 0;
    }
}

@media (max-width: 700px) {
    .dashboard-macro-grid {
        grid-template-columns: 1fr;
        gap: 0;
    }

    .dashboard-macro-card,
    .dashboard-macro-card:first-child,
    .dashboard-macro-card:last-child {
        align-items: center;
        padding: var(--ct-space-4) 0;
        border-width: 0 0 1px;
        border-radius: 0;
        background: transparent;
    }

    .dashboard-macro-card:first-child {
        padding-top: var(--ct-space-2);
    }

    .dashboard-macro-card:last-child {
        padding-bottom: 0;
        border-bottom: 0;
    }

    .dashboard-macro-copy {
        align-items: baseline;
        flex-direction: row;
        gap: var(--ct-space-2);
    }
}

@media (max-width: 575.98px) {
    .dashboard-page {
        gap: var(--ct-space-4);
    }

    .dashboard-hero {
        padding: var(--ct-space-4);
    }

    .dashboard-hero.ct-scenic-header--with-art {
        grid-template-columns: 1fr;
        gap: var(--ct-space-4);
    }

    .dashboard-hero.ct-scenic-header--full-bleed-art {
        gap: 0;
    }

    .dashboard-hero .ct-page-title {
        max-width: none;
        font-size: clamp(2rem, 11vw, 2.8rem);
    }

    .dashboard-setup-card,
    .dashboard-main-card,
    .dashboard-macro-section,
    .dashboard-year-card,
    .dashboard-streak-card,
    .dashboard-quick-actions,
    .dashboard-comfy-note {
        border-radius: var(--ct-radius-lg);
    }

    .dashboard-calorie-layout {
        grid-template-columns: 1fr;
        gap: var(--ct-space-5);
    }

    .dashboard-calorie-ring {
        width: min(100%, 11.5rem);
    }

    .dashboard-calorie-metrics {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        width: 100%;
    }

    .dashboard-calorie-metrics > div {
        display: block;
        padding: var(--ct-space-3);
        border: 1px solid var(--ct-border);
        border-radius: var(--ct-radius-sm);
        background: var(--ct-surface);
    }

    .dashboard-calorie-metrics > div:last-child {
        grid-column: 1 / -1;
        padding: var(--ct-space-3);
        border: 1px solid var(--ct-border);
    }

    .dashboard-calorie-metrics dd {
        margin-top: var(--ct-space-1);
        text-align: left;
    }

    .dashboard-year-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .dashboard-actions {
        grid-template-columns: 1fr;
    }

    .dashboard-estimate-stats {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .dashboard-action {
        min-height: 4.75rem;
    }
}

/* =========================
   PROFILE & GOALS
   ========================= */

.profile-page {
    display: grid;
    width: 100%;
    min-width: 0;
    gap: var(--ct-space-5);
    padding-bottom: var(--ct-space-4);
}

.profile-status {
    margin: 0;
    border-radius: var(--ct-radius-md);
}

.profile-form,
.profile-layout,
.profile-column {
    display: grid;
    min-width: 0;
}

.profile-form {
    gap: var(--ct-space-5);
}

.profile-layout {
    grid-template-columns: minmax(0, 1.18fr) minmax(22rem, 0.82fr);
    align-items: start;
    gap: var(--ct-space-5);
}

.profile-column {
    gap: var(--ct-space-4);
}

.profile-card {
    min-width: 0;
    margin: 0;
    padding: var(--ct-space-5);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-lg);
    background: var(--ct-surface);
    box-shadow: var(--ct-shadow-sm);
}

.profile-card-legend {
    display: flex;
    float: none;
    width: 100%;
    min-width: 0;
    align-items: center;
    gap: var(--ct-space-3);
    margin: 0;
    padding: 0;
    color: var(--ct-text);
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1.25;
}

.profile-card-icon {
    display: inline-grid;
    width: 2.5rem;
    height: 2.5rem;
    flex: 0 0 auto;
    place-items: center;
    border-radius: var(--ct-radius-pill);
    background: var(--ct-primary-soft);
    color: var(--ct-primary-strong);
    font-size: 1.2rem;
    font-weight: 800;
}

.profile-card-intro {
    margin: var(--ct-space-1) 0 var(--ct-space-4) 3.25rem;
    color: var(--ct-text-muted);
    font-size: 0.9rem;
}

.profile-fields {
    display: grid;
    min-width: 0;
    gap: var(--ct-space-4);
}

.profile-fields--two,
.profile-fields--goal {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-fields--goal {
    margin-top: var(--ct-space-4);
}

.profile-field {
    min-width: 0;
}

.profile-field + .profile-fieldset,
.profile-fieldset + .profile-fields,
.profile-fields + .profile-fieldset {
    margin-top: var(--ct-space-4);
}

.profile-card .form-label,
.profile-card .profile-fieldset > legend {
    margin-bottom: var(--ct-space-2);
    color: var(--ct-text);
    font-size: 0.88rem;
    font-weight: 700;
}

.profile-card .form-control,
.profile-card .form-select,
.profile-card .input-group-text {
    min-height: 2.85rem;
    border-color: var(--ct-border-strong);
}

.profile-card .form-control,
.profile-card .form-select {
    min-width: 0;
    border-radius: var(--ct-radius-sm);
    background-color: var(--ct-surface-raised);
}

.profile-card .input-group .form-control {
    border-radius: var(--ct-radius-sm) 0 0 var(--ct-radius-sm);
}

.profile-card .input-group-text {
    border-radius: 0 var(--ct-radius-sm) var(--ct-radius-sm) 0;
    background: var(--ct-surface-soft);
    color: var(--ct-text-muted);
}

.profile-card .form-text {
    margin-top: var(--ct-space-1);
    color: var(--ct-text-muted);
    font-size: 0.875rem;
    line-height: 1.4;
}

.profile-card .text-danger {
    display: block;
    margin-top: var(--ct-space-1);
    font-size: 0.875rem;
}

.profile-fieldset {
    min-width: 0;
    margin: var(--ct-space-4) 0 0;
    padding: 0;
    border: 0;
}

.profile-fieldset > legend {
    float: none;
    width: auto;
    padding: 0;
}

.profile-unit-choices,
.profile-choice-list {
    display: grid;
    min-width: 0;
    gap: var(--ct-space-2);
}

.profile-unit-choices {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.profile-unit-choice,
.profile-choice {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    min-width: 0;
    align-items: start;
    gap: var(--ct-space-2);
    margin: 0;
    padding: var(--ct-space-3);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-md);
    background: var(--ct-surface-raised);
}

.profile-unit-choice:has(.form-check-input:checked),
.profile-choice:has(.form-check-input:checked) {
    border-color: rgba(var(--bs-primary-rgb), 0.55);
    background: var(--ct-primary-soft);
}

.profile-unit-choice .form-check-input,
.profile-choice .form-check-input {
    float: none;
    margin: 0.2rem 0 0;
}

.profile-unit-choice .form-check-label,
.profile-choice .form-check-label {
    display: grid;
    min-width: 0;
    gap: 0.15rem;
    cursor: pointer;
}

.profile-unit-choice .form-check-label span,
.profile-choice .form-check-label span {
    color: var(--ct-text-muted);
    font-size: 0.875rem;
    line-height: 1.35;
}

.profile-height-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--ct-space-2);
}

.profile-target-card {
    background:
        linear-gradient(155deg, rgba(var(--bs-primary-rgb), 0.045), transparent 38%),
        var(--ct-surface);
}

.profile-target-summary {
    display: grid;
    grid-template-columns: minmax(13rem, 0.9fr) minmax(0, 1.1fr);
    align-items: stretch;
    gap: var(--ct-space-3);
    margin-top: var(--ct-space-3);
}

.profile-target-highlight {
    display: grid;
    place-items: center;
    margin: 0;
    padding: var(--ct-space-5) var(--ct-space-4);
    border: 1px solid rgba(var(--bs-primary-rgb), 0.18);
    border-radius: var(--ct-radius-lg);
    background: var(--ct-primary-soft);
    text-align: center;
}

.profile-target-highlight > span:first-child {
    color: var(--ct-text-muted);
    font-size: 0.875rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.profile-target-highlight strong {
    margin-top: var(--ct-space-1);
    color: var(--ct-text);
    font-size: clamp(2.2rem, 5vw, 3.4rem);
    line-height: 1;
}

.profile-target-highlight strong small {
    font-size: 0.95rem;
    font-weight: 700;
}

.profile-target-highlight > span:nth-of-type(2) {
    margin-top: var(--ct-space-1);
    color: var(--ct-text-muted);
    font-size: 0.875rem;
}

.profile-target-highlight p {
    margin: var(--ct-space-2) 0 0;
    color: var(--ct-text-muted);
    font-size: 0.875rem;
}

.profile-estimate-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1px;
    margin: 0;
    overflow: hidden;
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-md);
    background: var(--ct-border);
}

.profile-estimate-grid > div {
    min-width: 0;
    padding: var(--ct-space-3);
    background: var(--ct-surface-raised);
}

.profile-estimate-grid dt {
    color: var(--ct-text-muted);
    font-size: 0.875rem;
    font-weight: 700;
}

.profile-estimate-grid dd {
    margin: var(--ct-space-1) 0 0;
    color: var(--ct-text);
    font-size: 1rem;
    font-weight: 800;
}

.profile-estimate-grid dd span {
    color: var(--ct-text-muted);
    font-size: 0.85rem;
    font-weight: 600;
}

.profile-target-card .goal-timeline {
    margin-top: var(--ct-space-4) !important;
    padding-top: var(--ct-space-4) !important;
    border-color: var(--ct-border) !important;
}

.profile-target-card .goal-timeline h3 {
    margin-bottom: var(--ct-space-2);
    font-size: 0.95rem;
}

.profile-target-card .goal-timeline p {
    margin-bottom: var(--ct-space-1) !important;
    font-size: 0.875rem;
}

.profile-estimate-note {
    margin: var(--ct-space-4) 0 0;
    color: var(--ct-text-muted);
    font-size: 0.85rem;
    line-height: 1.45;
}

.profile-target-empty {
    margin-top: var(--ct-space-3);
    padding: var(--ct-space-4);
    border: 1px dashed var(--ct-border-strong);
    border-radius: var(--ct-radius-md);
    background: var(--ct-surface-soft);
}

.profile-target-empty p {
    margin: var(--ct-space-1) 0 0;
    color: var(--ct-text-muted);
}

.profile-target-options {
    margin-top: var(--ct-space-5);
    padding-top: var(--ct-space-4);
    border-top: 1px solid var(--ct-border);
}

.profile-target-options + .profile-field {
    margin-top: var(--ct-space-4);
}

.profile-motivation-card,
.profile-tips-card {
    min-width: 0;
    padding: var(--ct-space-4);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-lg);
    background: var(--ct-surface);
    box-shadow: var(--ct-shadow-sm);
}

.profile-motivation-card {
    display: grid;
    align-items: center;
    gap: var(--ct-space-3);
    overflow: hidden;
    background:
        linear-gradient(130deg, rgba(120, 169, 135, 0.16), transparent 72%),
        var(--ct-surface);
}

.profile-motivation-copy {
    display: grid;
    gap: var(--ct-space-2);
}

.profile-motivation-copy span {
    color: var(--ct-primary-strong);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.profile-motivation-copy strong {
    color: var(--ct-text);
    font-size: 1.05rem;
    line-height: 1.35;
}

.profile-tips-heading {
    display: flex;
    align-items: center;
    gap: var(--ct-space-3);
}

.profile-tips-heading h2 {
    margin: 0;
    color: var(--ct-text);
    font-size: 1.15rem;
    font-weight: 800;
}

.profile-tips-list {
    display: grid;
    gap: var(--ct-space-3);
    margin: var(--ct-space-4) 0 0;
    padding: 0;
    list-style: none;
}

.profile-tips-list li {
    display: grid;
    gap: 0.15rem;
    padding-left: var(--ct-space-3);
    border-left: 3px solid rgba(120, 169, 135, 0.45);
}

.profile-tips-list strong {
    color: var(--ct-text);
    font-size: 0.9rem;
}

.profile-tips-list span {
    color: var(--ct-text-muted);
    font-size: 0.85rem;
    line-height: 1.4;
}

.profile-save-bar {
    display: flex;
    min-width: 0;
    align-items: center;
    justify-content: space-between;
    gap: var(--ct-space-4);
    padding: var(--ct-space-4) var(--ct-space-5);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-lg);
    background: var(--ct-surface-raised);
    box-shadow: var(--ct-shadow-sm);
}

.profile-save-bar > div {
    display: grid;
    min-width: 0;
    gap: var(--ct-space-1);
}

.profile-save-bar span {
    color: var(--ct-text-muted);
    font-size: 0.85rem;
}

.profile-save-bar .btn {
    min-width: 10rem;
    min-height: 2.85rem;
    border-radius: var(--ct-radius-md);
}

@media (max-width: 1050px) {
    .profile-layout {
        display: flex;
        flex-direction: column;
    }

    .profile-column {
        display: contents;
    }

    .profile-body-card {
        order: 1;
    }

    .profile-goal-card {
        order: 2;
    }

    .profile-activity-card {
        order: 3;
    }

    .profile-target-card {
        order: 4;
    }

    .profile-motivation-card {
        order: 5;
    }

    .profile-tips-card {
        order: 6;
    }
}

@media (max-width: 767.98px) {
    .profile-fields--two,
    .profile-fields--goal {
        grid-template-columns: 1fr;
    }

    .profile-target-summary {
        grid-template-columns: 1fr;
    }

    .profile-card {
        padding: var(--ct-space-4);
    }

    .profile-card-intro {
        margin-left: 0;
    }

    .profile-save-bar {
        align-items: stretch;
        flex-direction: column;
        padding: var(--ct-space-4);
    }

    .profile-save-bar .btn {
        width: 100%;
    }
}

@media (max-width: 420px) {
    .profile-page {
        gap: var(--ct-space-4);
    }

    .profile-unit-choices,
    .profile-estimate-grid {
        grid-template-columns: 1fr;
    }

    .profile-card-legend {
        font-size: 1.1rem;
    }

    .profile-target-highlight strong {
        font-size: 2.25rem;
    }
}

/* =========================
   FAILURE PAGES
   ========================= */

.failure-shell-body {
    min-width: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top right, rgba(123, 97, 168, 0.14), transparent 28rem),
        var(--ct-canvas);
    color: var(--ct-text);
}

.failure-shell {
    display: grid;
    min-height: 100vh;
    grid-template-rows: auto 1fr auto;
}

.failure-shell-width {
    width: min(calc(100% - 2rem), 42rem);
    margin-inline: auto;
}

.failure-shell-header,
.failure-shell-footer {
    background: var(--ct-surface);
}

.failure-shell-header {
    border-bottom: 1px solid var(--ct-border);
}

.failure-shell-header .failure-shell-width {
    padding-block: var(--ct-space-3);
}

.failure-brand {
    display: inline-flex;
    align-items: center;
    gap: var(--ct-space-3);
    color: var(--ct-text);
    font-size: 1.05rem;
    font-weight: 800;
    text-decoration: none;
}

.failure-brand img {
    width: 3rem;
    height: 3rem;
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-md);
    background: var(--ct-surface-soft);
}

.failure-brand:hover {
    color: var(--ct-primary);
}

.failure-brand:focus-visible {
    border-radius: var(--ct-radius-sm);
    outline: 3px solid var(--ct-focus);
    outline-offset: 3px;
}

.failure-shell-main {
    display: grid;
    align-items: center;
    padding-block: clamp(2rem, 8vw, 5rem);
}

.failure-card {
    width: 100%;
    padding: clamp(1.5rem, 5vw, 2.5rem);
    border: 1px solid var(--ct-border);
    border-radius: var(--ct-radius-xl);
    background: var(--ct-surface-raised);
    box-shadow: var(--ct-shadow-md);
}

.failure-eyebrow {
    margin-bottom: var(--ct-space-2);
    color: var(--ct-primary);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.failure-card h1 {
    margin-bottom: var(--ct-space-3);
    font-size: clamp(1.75rem, 7vw, 2.5rem);
}

.failure-card .lead {
    color: var(--ct-text);
}

.failure-request-id {
    overflow-wrap: anywhere;
    color: var(--ct-text-muted);
    font-size: 0.9rem;
}

.failure-actions {
    margin-top: var(--ct-space-5);
}

.failure-actions .btn {
    min-height: 2.75rem;
    padding-inline: var(--ct-space-5);
}

.failure-shell-footer {
    padding-block: var(--ct-space-4);
    border-top: 1px solid var(--ct-border);
    color: var(--ct-text-muted);
    font-size: 0.85rem;
}

@media (max-width: 350px) {
    .failure-shell-width {
        width: min(calc(100% - 1rem), 42rem);
    }

    .failure-card {
        padding: var(--ct-space-4);
    }

    .failure-actions .btn {
        width: 100%;
    }
}
