/* Theme tokens centralize colors and spacing for maintainable UI evolution. */
:root {
    --bg-deep: #0d1e2b;
    --bg-mid: #142d3e;
    --bg-soft: #edf2f7;
    --brand: #2f84c9;
    --brand-strong: #0d5c9d;
    --accent: #ffa830;
    --success: #0d8f56;
    --danger: #c13747;
    --text-main: #102131;
    --text-soft: #4f6475;
    --line: #d3e0ea;
    --card: #ffffff;
    --radius-lg: 18px;
    --radius-md: 12px;
}

/* Base reset guarantees predictable sizing across components. */
* {
    box-sizing: border-box;
}

/* Body background mixes gradients and soft radial lights for a modern identity. */
body {
    margin: 0;
    min-height: 100vh;
    font-family: "Avenir Next", "Trebuchet MS", "Segoe UI", sans-serif;
    color: var(--text-main);
    background:
        radial-gradient(circle at 10% 15%, rgba(89, 171, 239, 0.26), transparent 40%),
        radial-gradient(circle at 85% 20%, rgba(255, 168, 48, 0.2), transparent 30%),
        linear-gradient(145deg, #eef3f8 0%, #dde8f1 100%);
}

/* Header keeps identity and session controls visible with strong contrast. */
.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.5rem;
    background: linear-gradient(120deg, var(--bg-deep), var(--bg-mid));
    color: #eef5fb;
    border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

/* Brand stack with uppercase subtitle for a premium dashboard feel. */
.brand {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    letter-spacing: 0.02em;
}

/* Brand lockup aligns club logo with text identity. */
.brand-lockup {
    flex-direction: row;
    align-items: center;
    gap: 0.7rem;
}

/* Dashboard brand logo keeps strong presence without overwhelming nav. */
.brand-logo {
    width: 52px;
    height: 52px;
    border-radius: 12px;
    object-fit: cover;
    border: 1px solid rgba(255, 255, 255, 0.24);
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35);
}

/* Text stack paired with logo in top bar. */
.brand-copy {
    display: flex;
    flex-direction: column;
    gap: 0.08rem;
}

/* Subtitle keeps dashboard context explicit. */
.brand-subtitle {
    font-size: 0.83rem;
    opacity: 0.9;
}

/* Admin action area groups identity and logout action compactly. */
.admin-actions {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

/* Supporting text appears muted but still readable on dark background. */
.admin-label,
.small-note {
    color: #c9d9e8;
    font-size: 0.84rem;
}

/* Main navigation uses pill links and subtle transparency overlays. */
.menu {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    padding: 0.8rem 1.5rem 1rem;
    background: linear-gradient(120deg, #112637, #18344a);
}

/* Menu links stay highly legible and animated on interaction. */
.menu a {
    text-decoration: none;
    color: #eaf4fc;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 999px;
    padding: 0.45rem 0.95rem;
    font-size: 0.9rem;
    transition: transform 120ms ease, background-color 120ms ease, color 120ms ease;
}

/* Active section highlight ensures orientation during long admin sessions. */
.menu a.active {
    background: linear-gradient(130deg, #ffffff, #f4fbff);
    color: #103252;
    border-color: #f4fbff;
}

/* Hover affordance improves discoverability of dashboard sections. */
.menu a:hover {
    transform: translateY(-1px);
    background: rgba(255, 255, 255, 0.12);
}

/* Main content wrapper defines a balanced reading width and vertical rhythm. */
.container {
    width: min(1260px, 95vw);
    margin: 1.3rem auto 2.2rem;
    display: grid;
    gap: 1rem;
    animation: fadeIn 260ms ease;
}

/* Generic card style powers all content blocks with soft elevation. */
.card {
    background: linear-gradient(160deg, #ffffff 0%, #fbfdff 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 1rem 1.15rem;
    box-shadow: 0 14px 34px rgba(12, 34, 52, 0.08);
}

/* Stats grid is responsive and keeps KPIs visually balanced. */
.stats-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

/* KPI cards get a decorative left stripe to improve scanning speed. */
.stat-card {
    position: relative;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 1rem 1rem 1rem 1.2rem;
    overflow: hidden;
}

/* Accent stripe indicates each KPI block starts at a fixed visual anchor. */
.stat-card::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 6px;
    height: 100%;
    background: linear-gradient(180deg, var(--brand), var(--accent));
}

/* Headings and paragraphs keep consistent spacing across all cards. */
h1,
h2,
h3,
p {
    margin-top: 0;
}

/* Flash message styles communicate operation outcome clearly. */
.flash {
    border-radius: var(--radius-md);
    padding: 0.85rem 1rem;
    border: 1px solid transparent;
}

/* Success feedback uses a green palette with strong contrast. */
.flash-success {
    background: #eaf9f1;
    color: #09583a;
    border-color: #9ed8bb;
}

/* Error feedback uses a red palette while preserving readability. */
.flash-error {
    background: #ffeced;
    color: #7f1928;
    border-color: #f4b9c1;
}

/* Login page removes dashboard chrome and uses a cinematic backdrop. */
body.login-page {
    background:
        radial-gradient(circle at 18% 22%, rgba(248, 198, 74, 0.2), transparent 42%),
        radial-gradient(circle at 82% 16%, rgba(60, 94, 174, 0.22), transparent 36%),
        linear-gradient(140deg, #0a1d31 0%, #111f33 38%, #10192a 100%);
    color: #edf2ff;
}

/* Login main container expands to full viewport for centered auth card. */
.login-main-container {
    width: min(1200px, 96vw);
    min-height: 100vh;
    margin: 0 auto;
    display: grid;
    place-items: center;
    padding: 2rem 0 1.5rem;
}

/* Login shell keeps decorative glows and card tightly grouped. */
.login-shell {
    width: 100%;
    max-width: 520px;
    position: relative;
    display: grid;
    gap: 0.9rem;
}

/* Soft glows mimic the mood from the provided visual reference. */
.login-glow {
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 999px;
    filter: blur(75px);
    pointer-events: none;
    opacity: 0.35;
    z-index: 0;
}

/* Left glow adds warm contrast against the cool background. */
.login-glow-left {
    background: #d4a43d;
    top: -80px;
    left: -100px;
}

/* Right glow reinforces depth with colder brand-adjacent tones. */
.login-glow-right {
    background: #355fb8;
    right: -100px;
    bottom: -90px;
}

/* Glass panel reproduces the modern translucent login card style. */
.login-glass-card {
    position: relative;
    z-index: 1;
    border-radius: 26px;
    padding: 2rem 1.9rem 1.35rem;
    background: linear-gradient(160deg, rgba(24, 35, 55, 0.82), rgba(35, 46, 66, 0.74));
    border: 1px solid rgba(245, 248, 255, 0.22);
    backdrop-filter: blur(12px);
    box-shadow: 0 28px 60px rgba(5, 12, 26, 0.55);
}

/* Logo wrapper centers the AGELAI emblem above the brand text. */
.login-logo-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 0.9rem;
}

/* Hero logo tuned for clarity without overpowering the form. */
.login-logo-hero {
    width: min(200px, 58vw);
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 16px 26px rgba(0, 0, 0, 0.35);
}

/* Brand title mirrors the bold uppercase treatment in the reference. */
.login-title {
    margin: 0;
    text-align: center;
    font-size: clamp(2rem, 5vw, 2.6rem);
    letter-spacing: -0.02em;
    color: #f5f8ff;
}

/* Red accent highlights GYM to match the club identity palette. */
.login-title span {
    color: #ea374c;
}

/* Subtitle uses muted contrast for elegant hierarchy. */
.login-subtitle {
    margin: 0.35rem 0 1.2rem;
    text-align: center;
    color: rgba(233, 240, 255, 0.72);
    font-size: 1.02rem;
}

/* Form stack keeps vertical rhythm aligned to modern auth layouts. */
.login-form {
    display: grid;
    gap: 0.86rem;
}

.login-divider {
    display: flex;
    align-items: center;
    justify-content: center;
    color: rgba(217, 181, 175, 0.92);
    font-weight: 700;
    font-size: 0.78rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    margin: 0.12rem 0;
}

.login-divider::before,
.login-divider::after {
    content: "";
    flex: 1 1 auto;
    height: 1px;
    background: rgba(255, 255, 255, 0.2);
}

.login-divider span {
    padding: 0 0.72rem;
}

/* Input rows hold icon + field inside a single glassy container. */
.login-field {
    display: flex;
    align-items: center;
    gap: 0;
    border-radius: 14px;
    border: 1px solid rgba(240, 246, 255, 0.26);
    background: rgba(255, 255, 255, 0.08);
    padding: 0.25rem 0.9rem;
}

/* Input icon uses reduced opacity so it guides without distracting. */
.login-icon {
    font-size: 1.06rem;
    opacity: 0.74;
}

/* Login inputs use transparent backgrounds to preserve glass effect. */
.login-field input {
    border: none;
    box-shadow: none;
    background: transparent;
    color: #f6f9ff;
    padding: 0.72rem 0;
}

/* Placeholder color keeps fields readable before user input. */
.login-field input::placeholder {
    color: rgba(228, 237, 255, 0.7);
}

/* Focused fields brighten border for clear keyboard accessibility. */
.login-field:focus-within {
    border-color: rgba(255, 255, 255, 0.64);
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12);
}

/* Remove generic input focus glow inside custom login field wrapper. */
.login-field input:focus {
    box-shadow: none;
}

/* Secondary actions align checkbox and help link in one row. */
.login-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.7rem;
    flex-wrap: wrap;
    font-size: 0.94rem;
}

/* Checkbox label keeps a compact inline arrangement. */
.login-check-wrap {
    display: inline-flex;
    flex-direction: row;
    align-items: center;
    gap: 0.48rem;
    color: rgba(234, 241, 255, 0.8);
    margin: 0;
}

/* Checkbox color matches card palette while preserving visibility. */
.login-check-wrap input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #ea374c;
}

/* Help link uses soft contrast and stronger hover affordance. */
.login-help-link {
    color: rgba(234, 241, 255, 0.8);
    text-decoration: none;
}

/* Hover state keeps link discoverable and elegant. */
.login-help-link:hover {
    color: #ffffff;
}

/* Primary action mirrors the bold red CTA from the reference screen. */
.login-submit {
    border: 1px solid #c72f42;
    background: linear-gradient(120deg, #e33449, #c8293b);
    color: #ffffff;
    border-radius: 14px;
    padding: 0.82rem 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 800;
    font-size: 1.1rem;
    cursor: pointer;
    transition: transform 120ms ease, filter 120ms ease;
}

/* Button hover gives subtle lift to reinforce clickability. */
.login-submit:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
}

/* Credentials helper remains visible but intentionally de-emphasized. */
.login-credentials {
    margin: 1rem 0 0;
    text-align: center;
    color: rgba(229, 237, 255, 0.82);
    font-size: 0.86rem;
}

/* Inline credentials code style improves scanability for first login. */
.login-credentials code {
    color: #fff3f5;
    background: rgba(233, 55, 76, 0.3);
    border: 1px solid rgba(247, 179, 188, 0.35);
    border-radius: 8px;
    padding: 0.1rem 0.35rem;
}

/* Footer anchors the login screen with subtle legal text. */
.login-footer {
    position: relative;
    z-index: 1;
    margin: 0;
    text-align: center;
    color: rgba(223, 233, 252, 0.62);
    font-size: 0.93rem;
}

/* Login flash is centered and constrained so alerts stay elegant. */
.login-page .flash {
    width: min(520px, 94vw);
    position: fixed;
    top: 1rem;
    left: 50%;
    z-index: 20;
    margin: 0;
    transform: translateX(-50%);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.35);
}

/* Dashboard login now mirrors APP login composition with centered side card over branded backdrop. */
.login-sport-shell {
    width: min(1320px, 96vw);
    min-height: calc(100vh - 1rem);
    margin: 0 auto;
    display: grid;
    place-items: center;
    padding: 1.2rem 0;
    position: relative;
}

/* Backdrop panel provides the same dark identity used in app.agelaigym.es. */
.login-sport-bg {
    position: absolute;
    inset: 0;
    border-radius: 24px;
    background:
        linear-gradient(115deg, rgba(7, 16, 30, 0.9), rgba(7, 16, 30, 0.55)),
        url('/assets/brand/agelai-logo.png') center/80% no-repeat;
    border: 1px solid rgba(226, 241, 255, 0.12);
    box-shadow: 0 20px 46px rgba(3, 9, 18, 0.62);
}

/* Auth card style synchronized with APP login dark card. */
.login-sport-card {
    position: relative;
    z-index: 1;
    width: min(460px, 92vw);
    border-radius: 22px;
    padding: 1.6rem 1.35rem 1.2rem;
    background: linear-gradient(160deg, rgba(18, 22, 36, 0.92), rgba(10, 13, 24, 0.92));
    border: 1px solid rgba(223, 232, 246, 0.16);
    box-shadow: 0 18px 36px rgba(0, 0, 0, 0.44);
}

/* DASH login should visually match APP login: fullscreen branded backdrop. */
.login-page .login-sport-shell {
    width: 100%;
    min-height: 100vh;
    margin: 0;
    padding: 0;
    position: relative;
}

/* Removes framed panel look and uses full background image/gradient style. */
.login-page .login-sport-bg {
    position: fixed;
    inset: 0;
    border-radius: 0;
    border: 0;
    box-shadow: none;
    background:
        linear-gradient(115deg, rgba(8, 13, 24, 0.78), rgba(8, 13, 24, 0.78)),
        url('/assets/brand/agelai-logo.png') center/78% no-repeat,
        radial-gradient(circle at 16% 22%, rgba(220, 176, 73, 0.16), transparent 40%),
        radial-gradient(circle at 84% 18%, rgba(53, 95, 184, 0.18), transparent 36%),
        linear-gradient(150deg, #0a1322 0%, #0b1628 100%);
}

/* Card width/shape/skin tuned to mimic app.agelaigym.es login card. */
.login-page .login-sport-card {
    width: min(540px, 92vw);
    border-radius: 18px;
    padding: 1.65rem 1.35rem 1.25rem;
    background: linear-gradient(160deg, rgba(11, 17, 29, 0.88), rgba(10, 14, 24, 0.88));
    border: 1px solid rgba(210, 224, 246, 0.2);
    box-shadow: 0 22px 45px rgba(0, 0, 0, 0.5);
}

/* Logo proportions aligned to app login lockup. */
.login-page .login-logo-hero {
    width: min(170px, 44vw);
    border-radius: 16px;
}

/* Dashboard title keeps strong hierarchy similar to app login title. */
.login-page .login-title {
    font-size: clamp(2rem, 4.2vw, 2.85rem);
    line-height: 1.05;
    letter-spacing: -0.02em;
    margin-bottom: 0.45rem;
}

/* Subtitle tone mirrors app login muted text. */
.login-page .login-subtitle {
    margin: 0 0 0.95rem;
    color: rgba(236, 214, 204, 0.9);
}

/* Label + input block matches app form rhythm and text treatment. */
.login-page .login-input-block {
    display: grid;
    gap: 0.24rem;
}

.login-page .login-input-label {
    color: rgba(241, 227, 220, 0.94);
    font-size: 0.96rem;
    font-weight: 700;
    letter-spacing: 0.04em;
}

/* Inputs are dark, flat and compact as in app login card. */
.login-page .login-field {
    padding: 0.12rem 0.75rem;
    background: rgba(0, 0, 0, 0.74);
    border: 1px solid rgba(208, 221, 243, 0.24);
    border-radius: 10px;
}

.login-page .login-field input {
    padding: 0.66rem 0;
    font-size: 1.02rem;
}

/* Divider matches app's centered local access separator. */
.login-page .login-divider {
    margin: 0.12rem 0 0.2rem;
    color: rgba(232, 200, 193, 0.9);
}

/* Remember/forgot row colors tuned to app style. */
.login-page .login-check-wrap {
    color: rgba(234, 241, 255, 0.9);
}

.login-page .login-help-link {
    color: rgba(235, 64, 62, 0.95);
}

.login-page .login-help-link:hover {
    color: #ff8f8d;
}

/* CTA button copies app login red action style. */
.login-page .login-submit {
    width: 100%;
    border-radius: 11px;
    padding: 0.78rem 1rem;
    font-size: 1.05rem;
    background: linear-gradient(120deg, #e33425, #d6281f);
    border-color: #d6281f;
}

/* Footer is subtle and pinned visually near bottom like app login. */
.login-page .login-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 16px;
}

/* Form grid supports two-column desktop editing and stacks on mobile. */
.form-grid {
    display: grid;
    gap: 0.9rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

/* Utility class allows full-width controls inside two-column forms. */
.col-span-2 {
    grid-column: span 2;
}

/* Labels define compact vertical hierarchy between caption and field. */
label {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    color: #20384a;
    font-size: 0.9rem;
}

/* Field styles provide a clean, modern surface and consistent spacing. */
input,
select,
textarea {
    width: 100%;
    border: 1px solid #bed1df;
    border-radius: 10px;
    padding: 0.58rem 0.66rem;
    font-size: 0.95rem;
    background: #fafdff;
    color: #11293a;
}

/* Focus state adds strong visual guidance for keyboard and pointer users. */
input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--brand);
    box-shadow: 0 0 0 3px rgba(47, 132, 201, 0.18);
}

/* Primary button style follows brand color system and motion affordance. */
.button {
    border: 1px solid var(--brand-strong);
    background: linear-gradient(130deg, var(--brand), var(--brand-strong));
    color: #ffffff;
    border-radius: 10px;
    padding: 0.57rem 0.95rem;
    cursor: pointer;
    font-weight: 700;
    transition: transform 120ms ease, filter 120ms ease;
}

/* Hover animation gives tactile feedback without being distracting. */
.button:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
}

/* Small button variant for compact table actions. */
.button-small {
    font-size: 0.82rem;
    padding: 0.35rem 0.66rem;
}

/* Secondary action variant for non-primary toggles. */
.button-secondary {
    border-color: #768b9d;
    background: linear-gradient(120deg, #8a9cad, #6d8091);
}

/* Destructive action variant with elevated contrast for risk actions. */
.button-danger {
    border-color: #9e2432;
    background: linear-gradient(120deg, #c64152, #a72f3f);
}

/* Inline forms keep table actions readable and aligned. */
.inline-form {
    display: inline-flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin: 0.15rem 0.15rem 0.15rem 0;
}

/* Compact label width avoids layout jumps in inline controls. */
.inline-label {
    min-width: 170px;
    max-width: 240px;
}

/* Wider notes field improves readability when editing long activity comments. */
.activity-notes-label {
    min-width: 240px;
    max-width: 360px;
}

/* Disabled destructive buttons remain visible but clearly non-interactive. */
button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
    filter: grayscale(0.15);
}

/* Dashed fieldset boundary distinguishes grouped module options. */
.module-fieldset {
    border: 1px dashed #bad0e0;
    border-radius: 10px;
    padding: 0.55rem;
    display: grid;
    gap: 0.3rem;
}

/* Responsive table wrapper preserves layout while allowing horizontal scroll. */
.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #ffffff;
    box-shadow: 0 10px 24px rgba(16, 40, 58, 0.05);
}

/* Users section switch cards highlight the two management modes clearly. */
.users-switch-grid {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
}

/* Clickable cards with icon and text improve discoverability over plain links. */
.users-switch-card {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.9rem 1rem;
    border-radius: 14px;
    border: 1px solid #c6d8e7;
    text-decoration: none;
    color: #14344d;
    background: linear-gradient(140deg, #f8fcff, #edf5fc);
    transition: transform 120ms ease, box-shadow 120ms ease, border-color 120ms ease;
}

/* Hover state keeps movement subtle while signaling interactivity. */
.users-switch-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(20, 52, 77, 0.12);
    border-color: #8db8da;
}

/* Active tab card uses strong brand contrast for instant orientation. */
.users-switch-card.active {
    background: linear-gradient(140deg, #1d4e74, #2f84c9);
    border-color: #1d4e74;
    color: #ffffff;
}

/* Icon bubble separates symbol from copy for faster visual parsing. */
.users-switch-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.65);
    font-size: 1.25rem;
}

/* Copy stack keeps title and description compact and legible. */
.users-switch-copy {
    display: inline-flex;
    flex-direction: column;
    gap: 0.2rem;
}

/* Secondary copy is intentionally smaller to preserve hierarchy. */
.users-switch-copy small {
    opacity: 0.92;
    font-size: 0.8rem;
}

/* Search actions align with fields and avoid uneven wrapping. */
.users-search-actions {
    display: flex;
    align-items: flex-end;
    gap: 0.5rem;
}

/* CRUD toolbar keeps create/list/movements actions visible near filters. */
.users-crud-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 0.55rem;
    margin: 0.2rem 0 0.85rem;
}

/* Secondary link styled as button remains aligned with primary action. */
.users-clear-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

/* Darkened note variant keeps helper text readable on light cards. */
.users-note-dark {
    color: var(--text-soft);
}

/* User list cards replace dense table layout for easier high-volume browsing. */
.users-list-grid {
    display: grid;
    gap: 0.7rem;
}

/* Each user row card balances identity and main action in one line. */
.users-list-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.9rem 1rem;
    border: 1px solid #d4e2ee;
    border-radius: 14px;
    background: linear-gradient(145deg, #ffffff, #f6fbff);
}

/* User row heading spacing is tightened for compact vertical rhythm. */
.users-list-card h3 {
    margin: 0 0 0.3rem;
}

/* User row paragraph spacing is reduced for clean list alignment. */
.users-list-card p {
    margin: 0 0 0.45rem;
}

/* Nutrition checkbox row keeps marker and text aligned in one readable line. */
.nutrition-inline-check {
    flex-direction: row;
    align-items: center;
    gap: 0.55rem;
}

/* Nutrition preview list displays first meals compactly inside plan tables. */
.nutrition-preview-list {
    margin-top: 0.35rem;
    display: grid;
    gap: 0.2rem;
}

/* Nutrition overview uses column cards to separate public/user/admin scopes. */
.nutrition-columns {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

/* Info blocks present MVP/legal/data in readable grouped cards. */
.nutrition-info-block,
.nutrition-priority-card,
.nutrition-status-card {
    border: 1px solid rgba(212, 228, 250, 0.16);
    border-radius: 14px;
    padding: 0.75rem 0.85rem;
    background: rgba(18, 33, 49, 0.45);
}

/* Remove oversized default list spacing in compact nutrition cards. */
.nutrition-info-block ul {
    margin: 0.45rem 0 0;
    padding-left: 1rem;
}

/* Priority cards keep key build phases clearly separated. */
.nutrition-priority-card h3,
.nutrition-status-card strong {
    margin: 0 0 0.35rem;
}

/* Status grid mirrors recommendation table from design PDF. */
.nutrition-status-grid {
    display: grid;
    gap: 0.65rem;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    margin-top: 0.75rem;
}

/* Status text keeps concise explanation readable without visual noise. */
.nutrition-status-card p {
    margin: 0;
}

/* Nutrition page hero card gets a stronger premium emphasis line. */
.nutrition-hero-card {
    border-left: 4px solid rgba(219, 48, 56, 0.92);
    background: linear-gradient(155deg, rgba(10, 18, 30, 0.96), rgba(13, 24, 39, 0.9));
    border-color: rgba(212, 228, 250, 0.2);
}

/* Nutrition panel cards share a consistent high-contrast dark container look. */
.nutrition-panel-card {
    border: 1px solid rgba(212, 228, 250, 0.2);
    box-shadow: 0 16px 32px rgba(1, 8, 16, 0.34);
    background: linear-gradient(150deg, rgba(13, 22, 36, 0.95), rgba(10, 18, 29, 0.92));
}

/* Hero heading in nutrition follows compact uppercase treatment from reference. */
.nutrition-hero-card h1 {
    margin-bottom: 0.45rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    font-size: clamp(1.95rem, 4.2vw, 3rem);
}

/* Secondary description with soft contrast under hero title. */
.nutrition-hero-card p {
    max-width: 80ch;
}

/* Action row below title/subtitle keeps quick module buttons visible. */
.nutrition-hero-actions {
    margin-top: 0.85rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

/* Sub-navigation tabs for Nutrition (Panel/Publico/Mensajes). */
.nutrition-nav-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin: 0.25rem 0 0.95rem;
}

.nutrition-nav-tabs a {
    display: inline-flex;
    align-items: center;
    padding: 0.48rem 0.9rem;
    border-radius: 999px;
    border: 1px solid rgba(212, 228, 250, 0.24);
    background: rgba(16, 26, 44, 0.85);
    color: #e8f0ff;
    text-decoration: none;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.nutrition-nav-tabs a:hover {
    border-color: rgba(255, 64, 74, 0.66);
}

.nutrition-nav-tabs a.active {
    border-color: #e33642;
    background: linear-gradient(120deg, #2a0d12, #431319);
    color: #fff;
}

/* Dedicated public-content trigger uses red accent to match mockup language. */
.nutrition-public-toggle {
    border-color: #ca2a32;
    background: linear-gradient(120deg, #e31f2b, #b91421);
    letter-spacing: 0.05em;
    text-transform: uppercase;
    font-size: 0.86rem;
}

/* Public section cards emulate the compact previews from the reference image. */
.nutrition-public-preview-grid {
    display: grid;
    gap: 0.8rem;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    margin: 0.75rem 0 0.95rem;
}

/* Individual public cards use dark panel and thin border with red micro-accent. */
.nutrition-public-preview-card {
    border: 1px solid rgba(212, 228, 250, 0.14);
    border-left: 3px solid rgba(226, 35, 47, 0.92);
    border-radius: 10px;
    padding: 0.65rem 0.72rem;
    background: rgba(19, 27, 40, 0.85);
}

/* Category label appears in red and compact typography. */
.nutrition-public-preview-card small {
    display: block;
    color: #f24f57;
    letter-spacing: 0.06em;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

/* Title/value hierarchy mirrors visual sample proportions. */
.nutrition-public-preview-card h3 {
    margin: 0;
    font-size: 1.1rem;
}

.nutrition-public-preview-card p {
    margin: 0.2rem 0 0;
    color: rgba(222, 233, 250, 0.8);
    font-size: 0.84rem;
}

/* Dedicated scrollable chat window for Nutrition > Mensajes detail view. */
.nutrition-chat-window {
    max-height: 420px;
    overflow: auto;
    border: 1px solid rgba(212, 228, 250, 0.15);
    border-radius: 12px;
    padding: 0.8rem;
    background: rgba(7, 15, 27, 0.74);
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

/* Message bubbles emulate instant-messaging layout with sender alignment. */
.nutrition-chat-bubble {
    max-width: min(92%, 780px);
    border-radius: 12px;
    border: 1px solid rgba(212, 228, 250, 0.18);
    padding: 0.65rem 0.75rem;
}

.nutrition-chat-bubble header,
.nutrition-chat-bubble footer {
    display: flex;
    justify-content: space-between;
    gap: 0.7rem;
    font-size: 0.78rem;
    color: rgba(212, 228, 250, 0.78);
}

.nutrition-chat-bubble p {
    margin: 0.42rem 0 0.45rem;
    white-space: pre-wrap;
}

.nutrition-chat-bubble-admin {
    margin-left: auto;
    background: linear-gradient(130deg, rgba(194, 26, 41, 0.22), rgba(148, 23, 33, 0.24));
    border-color: rgba(227, 53, 70, 0.45);
}

.nutrition-chat-bubble-user {
    margin-right: auto;
    background: linear-gradient(130deg, rgba(42, 76, 122, 0.26), rgba(25, 52, 84, 0.26));
    border-color: rgba(84, 140, 212, 0.4);
}

/* Standalone messages page pairs recent user threads with an active chat. */
.nutrition-messages-layout {
    display: grid;
    grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
    gap: 1rem;
}

/* Recent thread column behaves like a compact inbox. */
.nutrition-thread-list {
    display: grid;
    align-content: start;
    gap: 0.65rem;
    max-height: 690px;
    overflow: auto;
    padding-right: 0.15rem;
}

/* Inbox header keeps count visible without overloading the title. */
.nutrition-thread-list-head {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.6rem;
}

.nutrition-thread-list-head h2 {
    margin: 0;
}

.nutrition-thread-list-head span {
    color: rgba(212, 228, 250, 0.68);
    font-size: 0.82rem;
}

/* Thread cards make each user conversation clearly selectable. */
.nutrition-thread-card {
    display: grid;
    gap: 0.25rem;
    text-decoration: none;
    color: #eaf2ff;
    border: 1px solid rgba(212, 228, 250, 0.14);
    border-radius: 14px;
    padding: 0.72rem;
    background: rgba(14, 25, 40, 0.68);
    transition: transform 120ms ease, border-color 120ms ease, background-color 120ms ease;
}

.nutrition-thread-card:hover,
.nutrition-thread-card.active {
    transform: translateY(-1px);
    border-color: rgba(228, 54, 60, 0.66);
    background: linear-gradient(135deg, rgba(83, 25, 35, 0.55), rgba(18, 33, 49, 0.72));
}

.nutrition-thread-card-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.nutrition-thread-card span:not(.nutrition-thread-card-top) {
    color: rgba(212, 228, 250, 0.78);
    font-size: 0.86rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nutrition-thread-card small {
    color: rgba(212, 228, 250, 0.55);
}

/* Unread badge gives immediate attention to pending user replies. */
.nutrition-thread-unread {
    min-width: 1.4rem;
    height: 1.4rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: #e33425;
    color: #ffffff;
    font-style: normal;
    font-size: 0.78rem;
    font-weight: 800;
}

/* Active chat column keeps conversation and reply form together. */
.nutrition-thread-chat {
    display: grid;
    align-content: start;
    gap: 0.85rem;
    min-width: 0;
}

.nutrition-chat-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
}

.nutrition-chat-header h2 {
    margin-bottom: 0.2rem;
}

.nutrition-chat-window-large {
    min-height: 430px;
    max-height: 560px;
}

/* Reply composer looks like a chat input area rather than a generic form. */
.nutrition-chat-reply-form {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.75rem;
    align-items: end;
}

.nutrition-chat-reply-form label {
    margin: 0;
}

.nutrition-chat-reply-form textarea {
    min-height: 84px;
    resize: vertical;
}

/* User search + selector zone groups filters clearly above the dropdown. */
.nutrition-user-picker {
    display: grid;
    gap: 0.9rem;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: end;
    border: 1px solid rgba(212, 228, 250, 0.2);
    border-radius: 14px;
    padding: 0.9rem;
    background: rgba(11, 22, 36, 0.35);
}

/* Keep clear action aligned to bottom of the search fields row. */
.nutrition-user-picker-actions {
    display: flex;
    align-items: end;
    justify-content: flex-end;
}

/* Helper note under file upload should remain readable on dark cards. */
.nutrition-panel-card small {
    color: rgba(212, 228, 250, 0.72);
}

/* Nutrition section headings get red leading accent similar to provided design. */
.nutrition-panel-card > h2,
.nutrition-panel-card > h3 {
    position: relative;
    padding-left: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.nutrition-panel-card > h2::before,
.nutrition-panel-card > h3::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.17rem;
    width: 3px;
    height: 1.25em;
    border-radius: 2px;
    background: linear-gradient(180deg, #ff3342, #cb1b2b);
}

/* Nutrition forms receive denser dark styling to better match red/black UI. */
.nutrition-panel-card .form-grid input,
.nutrition-panel-card .form-grid select,
.nutrition-panel-card .form-grid textarea {
    background: rgba(8, 13, 23, 0.92);
    border-color: rgba(212, 228, 250, 0.16);
    border-radius: 8px;
    color: #f2f7ff;
}

.nutrition-panel-card .form-grid input:focus,
.nutrition-panel-card .form-grid select:focus,
.nutrition-panel-card .form-grid textarea:focus {
    border-color: rgba(244, 62, 79, 0.7);
    box-shadow: 0 0 0 2px rgba(244, 62, 79, 0.15);
}

/* Nutrition primary actions use red call-to-action style from visual reference. */
.nutrition-panel-card .button {
    border-color: #cd2635;
    background: linear-gradient(120deg, #e02636, #ba1726);
}

/* Secondary utility actions remain neutral dark for hierarchy. */
.nutrition-panel-card .button-secondary {
    border-color: rgba(212, 228, 250, 0.3);
    background: linear-gradient(120deg, #3b4659, #2c3444);
}

/* Weekly plan item previews keep diet details readable in dark nutrition tables. */
.nutrition-plan-item-summary {
    display: grid;
    gap: 0.28rem;
    margin: 0.35rem 0;
    padding: 0.62rem 0.72rem;
    border-radius: 12px;
    border: 1px solid rgba(212, 228, 250, 0.16);
    background: linear-gradient(145deg, rgba(7, 12, 24, 0.72), rgba(17, 29, 44, 0.7));
    color: rgba(232, 240, 255, 0.92);
}

/* Meal title stands out without breaking the compact table layout. */
.nutrition-plan-item-summary strong {
    color: #ffffff;
}

/* Photo links use the same red accent as nutrition CTAs. */
.nutrition-plan-item-summary a {
    color: #ff5a52;
    font-weight: 800;
    text-decoration: none;
}

/* Photo links remain obvious on hover for mouse users. */
.nutrition-plan-item-summary a:hover {
    text-decoration: underline;
}

/* Detail screen close action sits apart from section switch for clarity. */
.user-detail-close-wrap {
    margin-top: 0.95rem;
}

/* Detail metadata chips wrap naturally while preserving visual rhythm. */
.user-detail-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.8rem;
}

/* Dedicated action row in detail keeps primary save control easy to find. */
.user-detail-actions {
    display: flex;
    gap: 0.6rem;
}

/* Secondary action area groups account controls with consistent spacing. */
.user-detail-action-grid {
    display: grid;
    gap: 0.6rem;
    margin-top: 0.9rem;
}

/* Movements dashboard uses a two-column analytics layout on wide screens. */
.movements-grid {
    display: grid;
    gap: 0.9rem;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

/* Bar list keeps metric rows compact and easy to compare at a glance. */
.bars-list {
    display: grid;
    gap: 0.6rem;
}

/* Bar head aligns label and value for immediate value recognition. */
.bar-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.7rem;
    margin-bottom: 0.25rem;
    font-size: 0.9rem;
}

/* Track provides consistent visual baseline for relative bar widths. */
.bar-track {
    width: 100%;
    height: 10px;
    border-radius: 999px;
    background: #e5eef6;
    overflow: hidden;
}

/* Default fill color for main analytics bars. */
.bar-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(120deg, #2f84c9, #0d5c9d);
}

/* Accent fill differentiates product/service series from activity series. */
.bar-fill-accent {
    background: linear-gradient(120deg, #f3a332, #d48618);
}

/* Contrast fill emphasizes peak-hour charts with a third hue. */
.bar-fill-contrast {
    background: linear-gradient(120deg, #21a182, #17705a);
}

/* Slot chips wrap into readable pills for quick schedule preference checks. */
.slot-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
}

/* Slot tag variant improves contrast over default module tags. */
.movements-tag {
    background: #eef6ff;
    color: #164569;
}

/* Table layout and minimum width maintain readability in data-heavy pages. */
table {
    width: 100%;
    min-width: 980px;
    border-collapse: collapse;
}

/* Cell styling prioritizes scanability and clear row boundaries. */
th,
td {
    border-bottom: 1px solid #e3edf4;
    text-align: left;
    padding: 0.7rem;
    vertical-align: top;
    font-size: 0.9rem;
}

/* Header row uses contrasting background for instant contextual anchoring. */
th {
    background: linear-gradient(120deg, #eaf3fb, #e2eef8);
    color: #173852;
}

/* Tags visually encode module/state metadata with compact capsules. */
.tag {
    display: inline-flex;
    align-items: center;
    padding: 0.2rem 0.5rem;
    margin: 0.1rem 0.15rem 0.1rem 0;
    border-radius: 999px;
    font-size: 0.78rem;
    background: #e6f2fb;
    color: #124266;
}

/* Pending tags use amber palette to draw attention to unresolved access. */
.tag-pending {
    background: #ffefcc;
    color: #7b5300;
}

/* Schedule week cards use stronger separation for board-style readability. */
.schedule-week {
    border: 1px solid #cfe0ed;
}

/* Multi-column schedule board adapts from desktop to mobile naturally. */
.schedule-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

/* Day card acts as a column in the weekly board. */
.schedule-day {
    border: 1px solid #d7e5f0;
    border-radius: 14px;
    padding: 0.7rem;
    background: linear-gradient(150deg, #ffffff, #f8fbff);
}

/* Day header anchors the reading order by date context. */
.schedule-day header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 0.55rem;
}

/* Item stack inside each day maintains consistent spacing. */
.schedule-items {
    display: grid;
    gap: 0.5rem;
}

/* Individual activity cards with subtle brand border accent. */
.schedule-item {
    border: 1px solid #cfe0ef;
    border-left: 5px solid var(--brand);
    border-radius: 12px;
    padding: 0.5rem 0.6rem;
    background: #ffffff;
    display: grid;
    gap: 0.3rem;
}

/* Metadata row keeps module and location chips aligned neatly. */
.meta-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

/* Accessible helper keeps labels available to screen readers only. */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Application page adopts a premium dark athletic visual system. */
body.app-page {
    background:
        radial-gradient(circle at 12% 20%, rgba(204, 0, 60, 0.14) 0%, transparent 42%),
        radial-gradient(circle at 88% 82%, rgba(233, 195, 73, 0.09) 0%, transparent 34%),
        radial-gradient(circle at 42% 58%, rgba(15, 23, 42, 1) 0%, #051424 100%);
    color: #d4e4fa;
}

/* App shell splits sidebar and main content for desktop workflows. */
.app-shell {
    min-height: 100vh;
    display: flex;
}

/* Checkbox controller enables CSS-only mobile sidebar toggle. */
.app-nav-toggle-control {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* Sidebar column keeps navigation and actions fixed on the left. */
.app-sidebar {
    width: 280px;
    background: linear-gradient(180deg, rgba(12, 28, 46, 0.96), rgba(7, 20, 35, 0.95));
    border-right: 1px solid rgba(212, 228, 250, 0.12);
    padding: 1.1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
    position: sticky;
    top: 0;
    height: 100vh;
}

/* Mobile-only head keeps close affordance visible in off-canvas mode. */
.app-sidebar-mobile-head {
    display: none;
}

/* Overlay is disabled on desktop and enabled on smaller screens. */
.app-sidebar-overlay {
    display: none;
}

/* Sidebar brand aligns logo and identity in a compact top module. */
.app-sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    padding: 0.35rem 0.25rem 1rem;
    border-bottom: 1px solid rgba(212, 228, 250, 0.12);
}

/* Sidebar logo card frames the emblem like a product badge. */
.app-sidebar-logo-wrap {
    width: 58px;
    height: 58px;
    border-radius: 14px;
    border: 1px solid rgba(212, 228, 250, 0.18);
    background: rgba(10, 24, 41, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Logo sizing keeps edge quality while fitting the brand card. */
.app-sidebar-logo {
    width: 50px;
    height: 50px;
    object-fit: cover;
    border-radius: 10px;
}

/* Sidebar heading hierarchy follows the premium dashboard reference. */
.app-sidebar-brand h2 {
    margin: 0;
    font-size: 2rem;
    line-height: 1.1;
    color: #e3ecff;
}

/* Supporting subheading uses subtle opacity to reduce visual noise. */
.app-sidebar-brand p {
    margin: 0.1rem 0 0;
    color: rgba(212, 228, 250, 0.7);
    letter-spacing: 0.03em;
}

/* Sidebar nav stacks clear hit targets for each main section. */
.app-sidebar-nav {
    display: grid;
    gap: 0.25rem;
}

/* Sidebar links use ghost styling with high-contrast active state. */
.app-sidebar-nav a {
    text-decoration: none;
    color: rgba(212, 228, 250, 0.8);
    padding: 0.7rem 0.85rem;
    border-radius: 12px;
    transition: background-color 120ms ease, color 120ms ease, transform 120ms ease;
}

/* Hover state clarifies interactivity while keeping motion subtle. */
.app-sidebar-nav a:hover {
    background: rgba(39, 54, 71, 0.45);
    color: #f6fbff;
    transform: translateX(2px);
}

/* Active sidebar item mirrors current section with stronger emphasis. */
.app-sidebar-nav a.active {
    background: rgba(15, 23, 42, 0.92);
    color: #e7efff;
    border: 1px solid rgba(190, 198, 224, 0.3);
}

/* Primary sidebar CTA follows the red action style from mockup. */
.app-sidebar-cta {
    text-decoration: none;
    text-align: center;
    background: linear-gradient(120deg, #dd154f, #c7073d);
    color: #fff;
    border-radius: 12px;
    padding: 0.75rem 0.85rem;
    font-weight: 700;
    letter-spacing: 0.03em;
}

/* Sidebar footer anchors config/logout controls at the bottom. */
.app-sidebar-footer {
    margin-top: auto;
    padding-top: 0.9rem;
    border-top: 1px solid rgba(212, 228, 250, 0.12);
    display: grid;
    gap: 0.2rem;
}

/* Footer links keep consistency with main sidebar navigation. */
.app-sidebar-link {
    text-decoration: none;
    color: rgba(212, 228, 250, 0.8);
    padding: 0.66rem 0.85rem;
    border-radius: 12px;
    background: transparent;
}

/* Logout button uses neutral style to avoid accidental emphasis. */
.app-sidebar-logout {
    width: 100%;
    text-align: left;
    border: none;
    cursor: pointer;
    font: inherit;
}

/* Main region houses topbar, page content and footer on dark canvas. */
.app-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
}

/* Topbar aligns logo, nav and utility actions in a single row. */
.app-topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 1rem;
    justify-content: space-between;
    padding: 0.9rem 1.5rem;
    background: rgba(18, 33, 49, 0.82);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(212, 228, 250, 0.12);
}

/* Logo-only top-left lockup matches your request and aligns with menu. */
.app-topbar-logo-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 74px;
    height: 74px;
    border-radius: 16px;
    border: 1px solid rgba(212, 228, 250, 0.22);
    background: rgba(6, 18, 32, 0.85);
}

/* Topbar logo remains crisp and centered in its container. */
.app-topbar-logo {
    width: 64px;
    height: 64px;
    border-radius: 12px;
    object-fit: cover;
}

/* Horizontal nav mirrors desktop mockup structure and spacing rhythm. */
.app-topbar-nav {
    display: flex;
    align-items: center;
    gap: 1.3rem;
    flex-wrap: wrap;
}

/* Top nav links use subdued tone and brighten on interaction. */
.app-topbar-nav a {
    text-decoration: none;
    color: rgba(212, 228, 250, 0.78);
    padding-bottom: 0.2rem;
    border-bottom: 2px solid transparent;
    font-weight: 600;
}

/* Active top nav state underlines current route for clear orientation. */
.app-topbar-nav a.active {
    color: #eef5ff;
    border-bottom-color: #bec6e0;
}

/* Utility cluster includes search and admin identity chip. */
.app-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

/* Mobile menu trigger hidden in desktop layouts. */
.app-menu-toggle {
    display: none;
}

/* Compact search form offers quick user lookup from any screen. */
.app-search-form input {
    width: 210px;
    border-radius: 999px;
    border: 1px solid rgba(212, 228, 250, 0.2);
    background: rgba(39, 54, 71, 0.62);
    color: #d4e4fa;
    padding: 0.48rem 0.8rem;
}

/* Search focus state keeps contrast strong for keyboard users. */
.app-search-form input:focus {
    border-color: rgba(233, 195, 73, 0.72);
    box-shadow: 0 0 0 2px rgba(233, 195, 73, 0.2);
}

/* Admin badge keeps operator identity visible in top controls. */
.app-admin-chip {
    border: 1px solid rgba(212, 228, 250, 0.2);
    border-radius: 999px;
    padding: 0.38rem 0.72rem;
    color: rgba(212, 228, 250, 0.88);
    font-size: 0.84rem;
}

/* Content container in app mode uses wider flow and no auto-centering. */
.app-content.container {
    width: min(1320px, 100%);
    margin: 0;
    padding: 1.4rem 1.5rem 1.5rem;
    gap: 1rem;
}

/* Dark variant cards replace light background for app-mode pages. */
.app-page .card {
    background: linear-gradient(155deg, rgba(18, 33, 49, 0.88), rgba(15, 28, 42, 0.84));
    border: 1px solid rgba(212, 228, 250, 0.13);
    box-shadow: 0 16px 32px rgba(0, 0, 0, 0.28);
    color: #d4e4fa;
}

/* KPI mini-cards inside users movements must match dark dashboard theme. */
.app-page .stat-card {
    background: linear-gradient(150deg, rgba(18, 33, 49, 0.9), rgba(17, 29, 44, 0.8));
    border: 1px solid rgba(212, 228, 250, 0.13);
    box-shadow: 0 14px 24px rgba(3, 11, 20, 0.35);
}

/* Stat titles in dark cards use high-contrast but softer than values. */
.app-page .stat-card h3 {
    margin-bottom: 0.5rem;
    color: rgba(212, 228, 250, 0.9);
}

/* Stat value container keeps readable spacing and contrast. */
.app-page .stat-card p {
    margin: 0;
    color: rgba(212, 228, 250, 0.92);
}

/* Big number stands out clearly in dark metric cards. */
.app-page .stat-card p strong {
    display: inline-block;
    font-size: 2rem;
    line-height: 1.1;
    color: #ecf3ff;
}

/* App page headings use brighter tone for hierarchy on dark surfaces. */
.app-page h1,
.app-page h2,
.app-page h3 {
    color: #e8f0ff;
}

/* App page paragraph text gets tuned for comfortable contrast. */
.app-page p {
    color: rgba(212, 228, 250, 0.84);
}

/* Form labels in app pages use light tones for dark card readability. */
.app-page label {
    color: rgba(220, 233, 252, 0.9);
}

/* Inputs/selects/textarea get dark variants while preserving contrast. */
.app-page input,
.app-page select,
.app-page textarea {
    background: rgba(39, 54, 71, 0.48);
    border-color: rgba(212, 228, 250, 0.22);
    color: #eaf2ff;
}

/* Placeholder color adjusted for dark fields and accessibility. */
.app-page input::placeholder,
.app-page textarea::placeholder {
    color: rgba(212, 228, 250, 0.62);
}

/* Table surfaces in app pages use dark styling for visual consistency. */
.app-page .table-wrap {
    background: rgba(18, 33, 49, 0.84);
    border-color: rgba(212, 228, 250, 0.18);
}

/* User list cards in app mode must match dark dashboard surfaces. */
.app-page .users-list-card {
    background: linear-gradient(145deg, rgba(18, 33, 49, 0.9), rgba(12, 24, 39, 0.85));
    border-color: rgba(212, 228, 250, 0.18);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}

/* Force dark card skin in app mode to override any stale/light cascade leftovers. */
.app-page .card .users-list-card,
.app-page .users-list-grid .users-list-card {
    background: linear-gradient(145deg, rgba(18, 33, 49, 0.94), rgba(10, 22, 37, 0.9)) !important;
    border-color: rgba(212, 228, 250, 0.22) !important;
    color: #eaf2ff !important;
}

/* Keep all inner text readable regardless of inherited light palette rules. */
.app-page .users-list-grid .users-list-card h3,
.app-page .users-list-grid .users-list-card p,
.app-page .users-list-grid .users-list-card strong,
.app-page .users-list-grid .users-list-card span {
    color: #eaf2ff !important;
}

/* User name and mobile text need bright contrast on dark cards. */
.app-page .users-list-card h3 {
    color: #e8f0ff;
}

/* Secondary row text stays readable but visually softer than headings. */
.app-page .users-list-card p {
    color: rgba(212, 228, 250, 0.9);
}

/* Table headers and cells are recolored for dark dashboard theme. */
.app-page th {
    background: linear-gradient(120deg, rgba(39, 54, 71, 0.68), rgba(28, 43, 60, 0.66));
    color: #edf4ff;
    border-bottom-color: rgba(212, 228, 250, 0.18);
}

/* Body cells keep sufficient contrast with subtle separators. */
.app-page td {
    color: rgba(223, 235, 252, 0.88);
    border-bottom-color: rgba(212, 228, 250, 0.12);
}

/* Flash success style adapted to dark UI while preserving semantics. */
.app-page .flash-success {
    background: rgba(18, 33, 49, 0.88);
    border-color: rgba(233, 195, 73, 0.75);
    color: #f2f7ff;
}

/* Flash error style retains alert prominence in dark context. */
.app-page .flash-error {
    background: rgba(104, 0, 26, 0.3);
    border-color: rgba(255, 180, 171, 0.65);
    color: #ffd5ce;
}

/* Nutrition helper note in dark mode needs brighter contrast than default. */
.app-page .users-note-dark {
    color: rgba(212, 228, 250, 0.82);
}

/* Hero card anchors dashboard introduction and key quick actions. */
.app-hero-card {
    padding: 1.7rem 1.65rem;
    border-radius: 24px;
    background: linear-gradient(130deg, rgba(15, 33, 56, 0.85), rgba(25, 42, 66, 0.64));
    border: 1px solid rgba(212, 228, 250, 0.13);
}

/* Hero heading is intentionally larger for strong first impression. */
.app-hero-card h1 {
    font-size: clamp(2rem, 4vw, 3.1rem);
    margin-bottom: 0.5rem;
}

/* Hero actions align side by side and wrap on narrow screens. */
.app-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-top: 1rem;
}

/* Primary hero action mirrors red energy accent of the brand. */
.app-hero-primary {
    text-decoration: none;
    background: linear-gradient(120deg, #dd154f, #c7073d);
    color: #fff;
    border-radius: 12px;
    padding: 0.66rem 1.05rem;
    font-weight: 700;
}

/* Secondary action uses subtle border treatment on dark surface. */
.app-hero-secondary {
    text-decoration: none;
    color: #dce7ff;
    border: 1px solid rgba(212, 228, 250, 0.22);
    border-radius: 12px;
    padding: 0.66rem 1.05rem;
}

/* KPI grid follows responsive card arrangement across breakpoints. */
.app-kpi-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

/* KPI cards use dark glass and gold progress accent styling. */
.app-kpi-card {
    border-radius: 18px;
    border: 1px solid rgba(212, 228, 250, 0.13);
    background: linear-gradient(150deg, rgba(18, 33, 49, 0.9), rgba(17, 29, 44, 0.8));
    padding: 1rem;
}

/* KPI titles are uppercase-like for dashboard metric rhythm. */
.app-kpi-card h2 {
    margin: 0;
    font-size: 0.97rem;
    letter-spacing: 0.06em;
    color: rgba(212, 228, 250, 0.86);
}

/* KPI values are bold and large to emphasize operational status. */
.app-kpi-card strong {
    display: block;
    margin-top: 0.68rem;
    font-size: 2.9rem;
    line-height: 1;
    color: #e8f0ff;
}

/* Bottom row combines recent activity with quick actions panel. */
.app-bottom-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1rem;
}

/* Activity panel visual treatment stays cohesive with main cards. */
.app-activity-card,
.app-quick-card {
    border-radius: 20px;
    border: 1px solid rgba(212, 228, 250, 0.13);
    background: linear-gradient(145deg, rgba(18, 33, 49, 0.9), rgba(12, 24, 39, 0.85));
    padding: 1.2rem;
}

/* Activity panel header aligns title and trailing 'Ver todo' link. */
.app-activity-card header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.6rem;
    margin-bottom: 0.8rem;
}

/* Activity links retain understated style until hover interaction. */
.app-activity-card header a {
    text-decoration: none;
    color: rgba(212, 228, 250, 0.78);
}

/* Activity list spacing keeps each row easy to scan quickly. */
.app-activity-card ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    gap: 0.55rem;
}

/* Activity rows mimic feed cards with subtle hover highlight. */
.app-activity-card li {
    padding: 0.72rem;
    border-radius: 12px;
    border: 1px solid rgba(212, 228, 250, 0.08);
    background: rgba(39, 54, 71, 0.2);
}

/* Activity row meta keeps label above bold operational message. */
.app-activity-card li span {
    display: block;
    color: rgba(212, 228, 250, 0.72);
    font-size: 0.85rem;
}

/* Quick actions grid provides evenly sized action tiles. */
.app-quick-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.65rem;
}

/* Quick action buttons align with dark tonal style and hover states. */
.app-quick-grid a {
    text-decoration: none;
    text-align: center;
    padding: 1rem 0.6rem;
    border-radius: 14px;
    border: 1px solid rgba(212, 228, 250, 0.12);
    color: #e6efff;
    background: rgba(39, 54, 71, 0.25);
}

/* Footer sits below content and mirrors global dark mode palette. */
.app-footer {
    margin-top: auto;
    padding: 1rem 1.5rem 1.3rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    color: rgba(212, 228, 250, 0.58);
    font-size: 0.84rem;
}

/* Footer links remain understated and readable on dark background. */
.app-footer a {
    text-decoration: none;
    color: rgba(212, 228, 250, 0.58);
    margin-left: 0.8rem;
}

/* Simple fade animation to soften hard layout swaps after page load. */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(3px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Mobile tune-ups preserve usability on narrow devices. */
@media (max-width: 900px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .col-span-2 {
        grid-column: span 1;
    }

    .topbar {
        padding: 0.9rem 1rem;
    }

    .menu {
        padding: 0.75rem 1rem 1rem;
    }

    /* User list cards stack action below summary on smaller screens. */
    .users-list-card {
        flex-direction: column;
        align-items: flex-start;
    }

    /* Search actions can wrap under fields without clipping in mobile widths. */
.users-search-actions {
    align-items: center;
    flex-wrap: wrap;
}

/* On small screens, CRUD actions can wrap without overlapping form fields. */
    .users-crud-toolbar {
    margin-top: 0.35rem;
}

    .nutrition-user-picker {
        grid-template-columns: 1fr;
    }

    .nutrition-messages-layout {
        grid-template-columns: 1fr;
    }

    .nutrition-thread-list {
        max-height: 360px;
    }

    .nutrition-chat-reply-form {
        grid-template-columns: 1fr;
    }

    .nutrition-user-picker-actions {
        justify-content: flex-start;
    }

    /* Login card already handles mobile; app footer stacks on small widths. */
    .app-footer {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* Tablet and below: sidebar hides, topbar/nav become compact and scrollable. */
@media (max-width: 1200px) {
    .app-sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: min(300px, 86vw);
        transform: translateX(-106%);
        transition: transform 180ms ease;
        z-index: 80;
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.42);
    }

    .app-sidebar-mobile-head {
        display: flex;
        align-items: center;
        justify-content: space-between;
        color: #e6efff;
        padding: 0.2rem 0.35rem 0.75rem;
        border-bottom: 1px solid rgba(212, 228, 250, 0.12);
        margin-bottom: 0.45rem;
    }

    .app-sidebar-mobile-close {
        cursor: pointer;
        display: inline-flex;
        width: 34px;
        height: 34px;
        align-items: center;
        justify-content: center;
        border-radius: 10px;
        border: 1px solid rgba(212, 228, 250, 0.22);
        color: #e6efff;
        font-size: 1.5rem;
        line-height: 1;
    }

    .app-sidebar-overlay {
        display: block;
        position: fixed;
        inset: 0;
        z-index: 75;
        background: rgba(3, 10, 19, 0.56);
        opacity: 0;
        pointer-events: none;
        transition: opacity 160ms ease;
    }

    .app-nav-toggle-control:checked ~ .app-shell .app-sidebar {
        transform: translateX(0);
    }

    .app-nav-toggle-control:checked ~ .app-shell .app-sidebar-overlay {
        opacity: 1;
        pointer-events: auto;
    }

    .app-topbar {
        flex-wrap: wrap;
        padding: 0.8rem 1rem;
    }

    .app-topbar-nav {
        display: none;
    }

    .app-topbar-actions {
        margin-left: 0;
        width: 100%;
        justify-content: space-between;
    }

    .app-menu-toggle {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        border-radius: 10px;
        border: 1px solid rgba(212, 228, 250, 0.24);
        padding: 0.42rem 0.6rem;
        color: #e6efff;
        cursor: pointer;
        font-size: 0.92rem;
    }

    .app-content.container {
        padding: 1rem;
    }

    .app-bottom-grid {
        grid-template-columns: 1fr;
    }
}

/* Mobile sizing tunes logo/search to prevent crowding in narrow widths. */
@media (max-width: 640px) {
    .app-topbar-logo-link {
        width: 60px;
        height: 60px;
    }

    .app-topbar-logo {
        width: 52px;
        height: 52px;
    }

    .app-search-form input {
        width: 150px;
    }

    .app-admin-chip {
        font-size: 0.76rem;
        padding: 0.3rem 0.55rem;
    }
}

/* Nutrition workspace uses the industrial high-performance language supplied for Agelai. */
.app-page .nutrition-workspace-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    padding: 1.8rem 0 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: #e5e2e1;
}

.nutrition-eyebrow,
.nutrition-card-kicker {
    margin: 0 0 0.4rem;
    color: #e9bcb6;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.15em;
    text-transform: uppercase;
}

.app-page .nutrition-workspace-header h1 {
    margin: 0;
    max-width: 760px;
    color: #f2eeee;
    font-size: clamp(2rem, 4vw, 3.55rem);
    font-weight: 900;
    line-height: 1.03;
    letter-spacing: -0.045em;
    text-transform: uppercase;
}

.app-page .nutrition-workspace-header h1 span {
    color: #e9bcb6;
}

.nutrition-workspace-tabs {
    display: flex;
    gap: clamp(1rem, 3vw, 2.5rem);
    margin-top: 1.35rem;
    overflow-x: auto;
    scrollbar-width: thin;
}

.nutrition-workspace-tabs a {
    padding: 0.55rem 0 0.7rem;
    color: #e9bcb6;
    border-bottom: 3px solid transparent;
    font-size: 0.86rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-decoration: none;
    text-transform: uppercase;
    white-space: nowrap;
}

.nutrition-workspace-tabs a:hover,
.nutrition-workspace-tabs a.active {
    color: #ef0718;
    border-bottom-color: #ef0718;
}

.nutrition-header-tools {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: min(100%, 440px);
}

.app-page .nutrition-global-search {
    position: relative;
    flex: 1;
}

.nutrition-global-search > span {
    position: absolute;
    left: 0.85rem;
    top: 50%;
    z-index: 1;
    color: #e9bcb6;
    font-size: 1.25rem;
    transform: translateY(-50%);
}

.app-page .nutrition-global-search input {
    min-height: 46px;
    padding-left: 2.5rem;
    background: #050505;
    border-color: rgba(255, 255, 255, 0.12);
    border-radius: 9px;
}

.app-page .nutrition-user-selector {
    min-width: 190px;
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: center;
    gap: 0.55rem;
    padding: 0.42rem 0.55rem;
    background: #353534;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
}

.nutrition-user-avatar {
    width: 36px;
    height: 36px;
    display: grid;
    place-items: center;
    color: #fff;
    background: radial-gradient(circle at 35% 30%, #e30613, #4e0005 62%, #0e0e0e);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 50%;
    font-size: 0.7rem;
    font-weight: 900;
}

.app-page .nutrition-user-selector select {
    padding: 0.25rem;
    min-width: 0;
    background: transparent;
    border: 0;
    box-shadow: none;
    color: #ffffff;
    color-scheme: dark;
}

/* Native select menus need explicit colors; otherwise Windows may render white on white. */
.app-page .nutrition-user-selector select option {
    background-color: #171717 !important;
    color: #ffffff !important;
    forced-color-adjust: none;
}

/* Strong ID selectors override browser/theme defaults applied to native options. */
#nutrition-user-select,
#nutrition-user-select option {
    background-color: #171717 !important;
    color: #ffffff !important;
    color-scheme: dark !important;
}

.nutrition-user-load-button {
    min-height: 46px;
    padding: 0.65rem 0.9rem;
    color: #ffffff;
    background: #e30613;
    border: 1px solid #e30613;
    border-radius: 8px;
    font-weight: 900;
    cursor: pointer;
    text-transform: uppercase;
}

.nutrition-user-load-button:hover {
    background: #b9000c;
}

.nutrition-tab-return {
    display: flex;
    justify-content: flex-start;
}

.nutrition-tab-return a {
    display: inline-flex;
    align-items: center;
    min-height: 42px;
    padding: 0.6rem 0.9rem;
    color: #ffffff;
    background: #252424;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 8px;
    font-weight: 800;
    text-decoration: none;
}

.nutrition-tab-return a:hover {
    border-color: #e30613;
    background: #321114;
}

/* Only the active Nutrition workspace tab is rendered, avoiding one very long page. */
.app-page [data-nutrition-panel][hidden] {
    display: none !important;
}

.app-page [data-nutrition-panel]:not([hidden]) {
    animation: nutritionPanelReveal 180ms ease-out;
}

@keyframes nutritionPanelReveal {
    from {
        opacity: 0;
        transform: translateY(5px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.nutrition-profile-workspace {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 1rem;
}

.app-page .nutrition-desk-card {
    position: relative;
    padding: 1.45rem;
    color: #e5e2e1;
    background: linear-gradient(150deg, #1c1b1b, #171717);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    overflow: hidden;
}

.app-page .nutrition-desk-card::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(227, 6, 19, 0.42), transparent);
    pointer-events: none;
}

.app-page .nutrition-desk-card:hover {
    border-color: rgba(227, 6, 19, 0.45);
}

.nutrition-physical-card {
    grid-column: span 5;
}

.nutrition-objectives-card {
    grid-column: span 7;
}

.nutrition-preferences-card,
.nutrition-restrictions-card,
.nutrition-actions-card {
    grid-column: span 4;
}

.nutrition-clinical-card {
    grid-column: 1 / -1;
}

.nutrition-card-heading {
    margin-bottom: 1.3rem;
}

.app-page .nutrition-card-heading h2 {
    margin: 0;
    color: #f0eceb;
    font-size: clamp(1.35rem, 2vw, 1.8rem);
    font-weight: 900;
    letter-spacing: -0.025em;
}

.nutrition-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.55rem;
    margin-bottom: 1rem;
}

.app-page .nutrition-stat-field {
    min-width: 0;
    align-items: center;
    text-align: center;
    color: #e9bcb6;
    font-size: 0.74rem;
}

.nutrition-stat-icon {
    width: 46px;
    height: 46px;
    display: grid;
    place-items: center;
    margin-bottom: 0.25rem;
    color: #f20a1b;
    background: #353534;
    border-radius: 9px;
    font-size: 1.2rem;
    font-weight: 900;
}

.nutrition-user-picker {
    display: flex;
    align-items: center;
    gap: 0.7rem;
}

.nutrition-user-search-menu {
    position: relative;
    z-index: 20;
}

.nutrition-user-search-menu > summary {
    min-height: 46px;
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.65rem 1rem;
    color: #fff;
    background: #050505;
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 9px;
    font-weight: 800;
    cursor: pointer;
    list-style: none;
}

.nutrition-user-search-menu > summary::-webkit-details-marker {
    display: none;
}

.nutrition-user-search-menu[open] > summary {
    border-color: #e30613;
}

.nutrition-user-search-popover {
    position: absolute;
    top: calc(100% + 0.65rem);
    right: 0;
    width: min(560px, 80vw);
    padding: 1rem;
    color: #fff;
    background: #121318;
    border: 1px solid rgba(227, 6, 19, 0.65);
    border-radius: 12px;
    box-shadow: 0 22px 55px rgba(0, 0, 0, 0.55);
}

.nutrition-user-search-popover label {
    display: grid;
    gap: 0.45rem;
}

.app-page .nutrition-user-search-popover input {
    min-height: 48px;
    color: #fff;
    background: #050505;
    border-color: rgba(255, 255, 255, 0.2);
}

.nutrition-user-search-actions {
    display: flex;
    gap: 0.65rem;
    margin-top: 0.75rem;
}

.nutrition-user-search-results {
    max-height: 320px;
    display: grid;
    gap: 0.45rem;
    margin-top: 1rem;
    overflow-y: auto;
}

.nutrition-user-search-results > strong {
    color: #e9bcb6;
}

.nutrition-user-search-results > a {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.75rem;
    color: #fff;
    background: #1b1c22;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    text-decoration: none;
}

.nutrition-user-search-results > a:hover {
    border-color: #e30613;
    background: #24252c;
}

.nutrition-user-search-results small {
    color: #b8bac3;
}

.nutrition-ghost-action.is-disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.nutrition-observations-history-link {
    width: fit-content;
    margin-top: 0.45rem;
    color: #ef4a55;
    font-weight: 800;
}

.nutrition-history-hero {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
}

.nutrition-history-hero h1 {
    margin: 0.25rem 0;
    font-size: clamp(2rem, 5vw, 4rem);
}

.nutrition-history-filter-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr)) auto auto;
    align-items: end;
    gap: 0.75rem;
}

.nutrition-history-summary {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 0.8rem;
    margin: 1rem 0;
}

.nutrition-history-stat {
    display: grid;
    gap: 0.35rem;
    padding: 1rem;
    background: #17181c;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 12px;
}

.nutrition-history-stat span {
    color: #b8bac3;
    font-size: 0.82rem;
    font-weight: 700;
}

.nutrition-history-stat strong {
    font-size: 1.35rem;
}

.nutrition-history-card {
    margin-top: 1rem;
}

.nutrition-observation-history {
    display: grid;
    gap: 0.8rem;
}

.nutrition-observation-history article {
    padding: 1rem;
    background: #101116;
    border-left: 3px solid #e30613;
    border-radius: 6px;
}

.nutrition-observation-history time {
    color: #e9bcb6;
    font-size: 0.8rem;
    font-weight: 800;
}

.nutrition-observation-history p {
    margin: 0.5rem 0 0;
}

.app-page .nutrition-stat-field input {
    padding: 0.35rem 0.2rem;
    color: #f5f1f0;
    background: transparent;
    border: 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 0;
    text-align: center;
    font-size: 1.03rem;
    font-weight: 800;
}

.nutrition-readonly-stat strong {
    min-height: 31px;
    display: flex;
    align-items: center;
    color: #f5f1f0;
    font-size: 1.08rem;
}

.nutrition-stat-field small {
    color: rgba(229, 226, 225, 0.55);
}

.nutrition-compact-fields,
.nutrition-objective-grid,
.nutrition-clinical-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
}

.app-page .nutrition-profile-workspace label {
    color: #e9bcb6;
    font-size: 0.8rem;
}

.app-page .nutrition-profile-workspace input,
.app-page .nutrition-profile-workspace select,
.app-page .nutrition-profile-workspace textarea {
    background: #070707;
    border: 1px solid rgba(255, 255, 255, 0.13);
    border-radius: 7px;
    color: #f5f1f0;
}

.app-page .nutrition-profile-workspace input:focus,
.app-page .nutrition-profile-workspace select:focus,
.app-page .nutrition-profile-workspace textarea:focus {
    border-color: #e30613;
    box-shadow: 0 0 0 3px rgba(227, 6, 19, 0.14);
}

.nutrition-wide-field,
.nutrition-clinical-wide {
    grid-column: 1 / -1;
}

.nutrition-progress-summary {
    margin-top: 1.7rem;
    padding-top: 1.1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.nutrition-progress-summary > div:first-child {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.55rem;
    color: #e9bcb6;
    font-size: 0.85rem;
}

.nutrition-progress-track {
    height: 9px;
    background: #292929;
    overflow: hidden;
    border-radius: 99px;
}

.nutrition-progress-track span {
    display: block;
    width: 0;
    height: 100%;
    background: linear-gradient(90deg, #ed0718, #8e0008);
    transition: width 220ms ease;
}

.nutrition-ghost-action,
.nutrition-primary-action,
.nutrition-secondary-action {
    width: 100%;
    min-height: 48px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem 1rem;
    border-radius: 8px;
    font-weight: 900;
    letter-spacing: 0.035em;
    text-align: center;
    text-decoration: none;
    text-transform: uppercase;
}

.nutrition-ghost-action,
.nutrition-secondary-action {
    color: #f5f1f0;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.22);
}

.nutrition-primary-action {
    color: #fff;
    background: linear-gradient(100deg, #ef0718, #b7000c);
    border: 1px solid #ef0718;
    box-shadow: 0 0 18px rgba(227, 6, 19, 0.25);
    cursor: pointer;
}

.nutrition-ghost-action:hover,
.nutrition-secondary-action:hover {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.48);
    background: rgba(255, 255, 255, 0.04);
}

.nutrition-chip-preview {
    min-height: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 0.45rem 0 1rem;
}

.nutrition-chip-preview span {
    padding: 0.38rem 0.65rem;
    color: #f1e9e7;
    background: #353534;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 6px;
    font-size: 0.78rem;
}

.nutrition-actions-card {
    display: flex;
    flex-direction: column;
}

.nutrition-actions-stack {
    display: grid;
    gap: 0.75rem;
    margin: auto 0;
}

.nutrition-user-context {
    display: grid;
    gap: 0.25rem;
    margin-top: 1.4rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    text-align: center;
}

.nutrition-user-context span,
.nutrition-user-context small {
    color: rgba(229, 226, 225, 0.55);
    font-size: 0.72rem;
}

.nutrition-user-context strong {
    color: #f5f1f0;
}

.nutrition-clinical-card summary {
    color: #f0eceb;
    font-weight: 900;
    cursor: pointer;
    text-transform: uppercase;
}

.nutrition-clinical-grid {
    margin-top: 1rem;
}

.nutrition-inline-check {
    align-self: end;
    display: flex;
    flex-direction: row;
    align-items: center;
}

.nutrition-inline-check input {
    width: 18px;
    height: 18px;
}

.app-page #nutrition-plans,
.app-page #nutrition-recipes,
.app-page #nutrition-follow-up {
    scroll-margin-top: 100px;
}

@media (max-width: 1100px) {
    .app-page .nutrition-workspace-header {
        align-items: stretch;
        flex-direction: column;
    }

    .nutrition-header-tools {
        width: 100%;
        min-width: 0;
    }

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

    .nutrition-physical-card,
    .nutrition-objectives-card {
        grid-column: 1 / -1;
    }

    .nutrition-preferences-card,
    .nutrition-restrictions-card {
        grid-column: span 6;
    }

    .nutrition-actions-card {
        grid-column: 1 / -1;
    }
}

@media (max-width: 700px) {
    .app-page .nutrition-workspace-header {
        padding-top: 0.6rem;
    }

    .nutrition-header-tools {
        align-items: stretch;
        flex-direction: column;
    }

    .nutrition-user-picker {
        align-items: stretch;
        flex-direction: column;
    }

    .nutrition-user-search-menu > summary {
        width: 100%;
        justify-content: center;
    }

    .nutrition-user-search-popover {
        position: static;
        width: 100%;
        margin-top: 0.6rem;
    }

    .nutrition-user-search-results > a {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.2rem;
    }

    .nutrition-history-hero {
        align-items: stretch;
        flex-direction: column;
    }

    .nutrition-history-filter-grid,
    .nutrition-history-summary {
        grid-template-columns: 1fr;
    }

    .app-page .nutrition-user-selector {
        width: 100%;
    }

    .nutrition-profile-workspace {
        display: block;
    }

    .app-page .nutrition-desk-card {
        margin-bottom: 0.85rem;
        padding: 1rem;
    }

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

    .nutrition-compact-fields,
    .nutrition-objective-grid,
    .nutrition-clinical-grid {
        grid-template-columns: 1fr;
    }

    .nutrition-wide-field,
    .nutrition-clinical-wide {
        grid-column: auto;
    }
}
/* Training module: premium Agelai dark workspace. */
.training-hero {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 22px;
    padding: 30px;
    border: 1px solid #343434;
    border-radius: 20px;
    background:
        radial-gradient(circle at 85% 10%, rgb(232 58 40 / 16%), transparent 30%),
        #101010;
}

.training-hero h1 {
    margin: 5px 0;
    color: #f4e3de;
    font-size: clamp(2.2rem, 5vw, 4.8rem);
    font-weight: 950;
    letter-spacing: -.04em;
}

.training-kicker {
    color: #e83a28;
    font-size: .72rem;
    font-weight: 900;
    letter-spacing: .2em;
}

.training-primary {
    background: #e83a28;
    border-color: #e83a28;
    color: #fff;
}

.training-stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.training-stat-grid article {
    min-height: 145px;
    padding: 22px;
    border: 1px solid #343434;
    border-top: 3px solid #e83a28;
    border-radius: 16px;
    background: #1a1a1a;
}

.training-stat-grid article.warning { border-top-color: #f6d95b; }
.training-stat-grid span,
.training-stat-grid small { display: block; color: #b8aaa6; }
.training-stat-grid strong { display: block; margin: 8px 0; color: #f4e3de; font-size: 2.7rem; }

.training-panel {
    border-color: #343434;
    background: #101010;
    color: #f4e3de;
}

.training-panel input,
.training-panel select,
.training-panel textarea {
    border-color: #343434;
    background: #080808;
    color: #f4e3de;
}

.training-section-heading,
.training-session-card header,
.training-inline {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.training-filter-grid {
    display: grid;
    grid-template-columns: 2fr repeat(4, 1fr) auto;
    gap: 12px;
    align-items: end;
    margin: 18px 0 24px;
}

.training-filter-grid label { margin: 0; }
.training-session-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.training-session-card {
    padding: 20px;
    border: 1px solid #343434;
    border-left: 4px solid #e83a28;
    border-radius: 14px;
    background: #1a1a1a;
}
.training-session-card.status-completed { border-left-color: #63c987; }
.training-session-card.status-rest { border-left-color: #74839a; }
.training-session-card.status-skipped { border-left-color: #c84a4a; }
.training-session-card.status-started { border-left-color: #f6d95b; }
.training-session-card h3 { margin: 4px 0; }
.training-status {
    padding: 7px 10px;
    border-radius: 999px;
    background: rgb(232 58 40 / 15%);
    color: #f3a499;
    font-size: .78rem;
    font-weight: 800;
}
.training-session-metrics { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.training-session-metrics span {
    padding: 7px 9px;
    border: 1px solid #343434;
    border-radius: 8px;
    color: #b8aaa6;
    font-size: .8rem;
}
.training-inline select { min-width: 150px; }
.training-session-card details { margin-top: 14px; }
.training-session-card summary { color: #f6d95b; cursor: pointer; font-weight: 800; }
.training-exercise-form {
    display: grid;
    grid-template-columns: 2fr repeat(5, minmax(70px, 1fr));
    gap: 8px;
    margin-top: 12px;
}
.training-two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.training-comparison { margin: 14px 0; }
.training-comparison summary { color: #f6d95b; }
.training-alert-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.training-alert-grid article {
    display: grid;
    gap: 5px;
    padding: 14px;
    border: 1px solid #6c4f1e;
    border-radius: 12px;
    background: rgb(246 217 91 / 7%);
}
.training-alert-grid small { color: #f6d95b; }

@media (max-width: 1100px) {
    .training-stat-grid { grid-template-columns: repeat(2, 1fr); }
    .training-filter-grid { grid-template-columns: repeat(2, 1fr); }
    .training-session-grid,
    .training-two-column,
    .training-alert-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .training-hero { align-items: stretch; flex-direction: column; padding: 20px; }
    .training-stat-grid,
    .training-filter-grid { grid-template-columns: 1fr; }
    .training-exercise-form { grid-template-columns: 1fr 1fr; }
    .training-exercise-form select { grid-column: 1 / -1; }
}
