/* =============================================
   FREELETICS-STYLE DESIGN SYSTEM
   Pure black, teal accent, clean & minimal
   ============================================= */

/* Loading Screen */
.app-loader {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
}
.app-loader.fade-out {
    opacity: 0;
    pointer-events: none;
}
.app-loader-content {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.app-loader-icon {
    animation: loaderPulse 1.5s ease-in-out infinite;
}
@keyframes loaderPulse {
    0%, 100% { opacity: 0.4; transform: scale(0.95); }
    50% { opacity: 1; transform: scale(1.05); }
}

:root {
    --black: #000000;
    --bg-primary: #000000;
    --bg-card: #111111;
    --bg-card-hover: #1a1a1a;
    --bg-elevated: #222222;
    --bg-input: #1a1a1a;

    --text-primary: #ffffff;
    --text-secondary: #AAAAAA;  /* WCAG AA compliant: 4.5:1 contrast */
    --text-muted: #7A7A7A;      /* WCAG AA compliant: 4.5:1 contrast */
    --text-dim: #767676;        /* WCAG AA compliant: 4.5:1 contrast */

    --accent: #00E6B0;
    --accent-dark: #00CC9C;
    --accent-glow: rgba(0, 230, 176, 0.2);
    --accent-surface: rgba(0, 230, 176, 0.08);

    --success: #00E6B0;
    --warning: #FFB800;
    --danger: #FF4444;
    --danger-surface: rgba(255, 68, 68, 0.08);

    --protein-color: #FF6B6B;
    --carbs-color: #FFB800;
    --fat-color: #00E6B0;
    --sat-color: #16A88A;   /* saturated fat: one darker green, inside the fat bar and on its own line */
    --fiber-color: #C9A36B; /* fibre: a grain gold, its own line under the fat */
    --sugars-color: #E8892C; /* sugars: a deeper amber, part of the carbohydrates */
    --kcal-color: #E2E8F0;   /* kcal: a cool white, Registo's first row */
    --salt-color: #8FA3B8;   /* salt: a mineral blue-grey */

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-xl: 18px;
    --radius-full: 9999px;

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* =============================================
   Keyframes
   ============================================= */

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideUpSheet { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes confetti-fall { 0% { transform: translateY(0) rotate(0deg); opacity: 1; } 100% { transform: translateY(100vh) rotate(720deg); opacity: 0; } }

/* Reduced motion support - respect user preferences */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* =============================================
   Reset & Base
   ============================================= */

/* Fonts (Anton / Archivo / IBM Plex Mono) are loaded via <link> tags in each page head. */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

/* Focus indicators for keyboard navigation (accessibility) */
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

body {
    font-family: var(--font-sans);
    background: var(--black);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-size: 15px;
    line-height: 1.5;
    overflow-x: hidden;
}

/* =============================================
   Skeleton Loaders
   ============================================= */

.skeleton {
    background: linear-gradient(90deg, #111 25%, #1a1a1a 50%, #111 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius-lg);
}

.skeleton-card-hero { height: 200px; margin-bottom: 12px; border-radius: var(--radius-lg); }

/* =============================================
   Header
   ============================================= */

.header {
    background: var(--black);
    padding: 16px 20px 12px;
    padding-top: max(16px, env(safe-area-inset-top));
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.header-greeting h1 {
    font-size: 24px;
    font-weight: 800;
    letter-spacing: -0.03em;
    color: #fff;
}

.header-date {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 2px;
    font-weight: 500;
}

.header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.header-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: var(--bg-card);
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms;
}

.header-btn:active { transform: scale(0.92); }
.header-btn svg { width: 20px; height: 20px; }
.header-btn img { width: 36px; height: 36px; border-radius: 50%; display: block; object-fit: cover; }
.lang-picker {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-card);
    border-radius: 14px;
    padding: 6px;
    box-shadow: 0 8px 32px rgba(0,0,0,.5);
    z-index: 300;
    min-width: 160px;
    border: 1px solid var(--border);
}
.lang-picker.active { display: block; }
.lang-option {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 10px 12px;
    border: none;
    background: none;
    color: var(--text-primary);
    border-radius: 9px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-sans);
    text-align: left;
}
.lang-option:active { background: var(--bg-elevated); }
.lang-option img { width: 28px; height: 28px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.lang-option--active { color: var(--accent); }

.avatar-btn {
    background: var(--accent);
    color: #000;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.5px;
}

/* =============================================
   Calendar Strip - Week Day Selector
   ============================================= */

.tabs-scroll {
    display: flex;
    justify-content: space-between;
    padding: 4px 0 8px;
}

.cal-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 0;
    min-width: 44px;
    transition: all 150ms;
    font-family: var(--font-sans);
}

.cal-day.rest {
    cursor: default;
    opacity: 0.3;
}

.cal-day-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.cal-day-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 700;
    color: var(--text-secondary);
    background: transparent;
    border: 2px solid transparent;
    transition: all 150ms;
}

.cal-day.has-workout .cal-day-circle {
    border-color: #333;
    color: #fff;
}

.cal-day.today .cal-day-label {
    color: var(--accent);
}

.cal-day.today .cal-day-circle {
    border-color: var(--accent);
}

.cal-day.active .cal-day-circle {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
    font-weight: 800;
}

.cal-day:active:not(.rest) { transform: scale(0.92); }

.cal-day-workout {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    min-height: 12px;
}

.cal-day.active .cal-day-workout {
    color: var(--accent);
    font-weight: 700;
}

/* =============================================
   Main Content
   ============================================= */

.main {
    padding: 20px;
    padding-bottom: 120px;
}

/* =============================================
   Session Hero Card
   ============================================= */

.session-hero {
    position: relative;
    background: linear-gradient(135deg, #111 0%, #0a0a0a 100%);
    border: 1px solid #1a1a1a;
    border-radius: 16px;
    padding: 28px 24px;
    margin-bottom: 24px;
    text-align: center;
}

.session-hero-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
}

.session-hero-title {
    font-size: 28px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -0.03em;
    margin-bottom: 6px;
}

.session-hero-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.session-hero-meta {
    display: flex;
    justify-content: center;
    gap: 28px;
    margin-bottom: 20px;
}

.session-hero-meta-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 600;
}

.session-hero-meta-item svg { width: 16px; height: 16px; }

.session-progress-bar {
    height: 6px;
    background: #222;
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 10px;
}

.session-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    transition: width 400ms ease;
    width: 0%;
}

.session-progress-text {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* =============================================
   Exercise List Header
   ============================================= */

.exercise-list-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.exercise-list-label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

/* The plan options gear moved to .phase-settings on the plan card - see
   renderPhaseIndicator(). */

/* =============================================
   Exercise Rows - With GIF Thumbnails
   ============================================= */

#exercises-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.exercise-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 16px;
    background: var(--bg-card);
    cursor: pointer;
    transition: all 150ms;
    animation: slideUp 200ms ease both;
    border-bottom: 1px solid #1a1a1a;
}

.exercise-row:first-child { border-radius: 16px 16px 0 0; }
.exercise-row:last-child { border-radius: 0 0 16px 16px; border-bottom: none; }
.exercise-row:only-child { border-radius: 16px; border-bottom: none; }

.exercise-row:nth-child(1) { animation-delay: 0ms; }
.exercise-row:nth-child(2) { animation-delay: 30ms; }
.exercise-row:nth-child(3) { animation-delay: 60ms; }
.exercise-row:nth-child(4) { animation-delay: 90ms; }
.exercise-row:nth-child(5) { animation-delay: 120ms; }
.exercise-row:nth-child(6) { animation-delay: 150ms; }
.exercise-row:nth-child(7) { animation-delay: 180ms; }
.exercise-row:nth-child(8) { animation-delay: 210ms; }

.exercise-row:active { background: var(--bg-card-hover); }

.exercise-row.done { opacity: 0.5; }

/* Thumbnail with number badge */
.exercise-thumb-wrap {
    position: relative;
    flex-shrink: 0;
}

.exercise-thumb {
    width: 44px;
    height: 44px;
    border-radius: 10px;
    background: #1a1a1a;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.exercise-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.exercise-thumb-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #333;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #000;
}

.exercise-thumb-badge.done {
    background: var(--accent);
    color: #000;
}

.exercise-row.done .exercise-thumb {
    border: 2px solid var(--accent);
}

.exercise-row-info {
    flex: 1;
    min-width: 0;
}

.exercise-row-name {
    font-weight: 600;
    font-size: 14px;
    line-height: 1.3;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.exercise-row-detail {
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    margin-top: 3px;
}

.exercise-row-chevron {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #333;
    transition: color 150ms;
}

.exercise-row:active .exercise-row-chevron { color: #555; }

/* =============================================
   Start Training Button
   ============================================= */

.start-training-container {
    position: sticky;
    bottom: 70px;
    padding: 16px 0;
    background: linear-gradient(transparent, var(--black) 30%);
    z-index: 50;
    text-align: center;
}

.start-training-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px 28px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 9999px;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 150ms;
    font-family: var(--font-sans);
    box-shadow: 0 4px 24px rgba(0, 230, 176, 0.3);
}

.start-training-btn:active { transform: scale(0.97); }

.start-training-btn.completed {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
    box-shadow: none;
}

.edit-today-log-btn {
    margin-top: 10px;
    padding: 10px 24px;
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: var(--font-sans);
}

.edit-today-log-btn:active { opacity: 0.7; }

/* =============================================
   Training Mode - Full Screen
   ============================================= */

.training-mode {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 400;
    display: none;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

.training-mode.active {
    display: flex;
    animation: fadeIn 200ms;
}

.training-header {
    padding: 16px 20px 12px;
    padding-top: max(16px, env(safe-area-inset-top));
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.training-close {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1a1a1a;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.training-close:active { background: #333; }

.training-step {
    font-size: 14px;
    font-weight: 700;
    color: #fff;
    flex: 1;
    text-align: center;
}

.training-progress-track {
    width: 100%;
    height: 3px;
    background: #1a1a1a;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 4px;
}

.training-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 300ms ease;
}

.training-body {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.training-gif-container {
    width: 100%;
    max-width: 400px;
    background: #0a0a0a;
    border-radius: 20px;
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
    min-height: 250px;
}

.training-gif-container img {
    width: 100%;
    max-height: 300px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
    border-radius: 20px;
}

.training-gif-container .gif-loading,
.training-gif-container .gif-error {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.training-exercise-name {
    font-size: 22px;
    font-weight: 800;
    text-align: center;
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.training-exercise-muscles {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

.training-stats-row {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 400px;
    margin-bottom: 20px;
}

.training-stat {
    flex: 1;
    min-width: 0;
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 14px 6px;
    text-align: center;
}

.training-stat-label {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
    margin-bottom: 4px;
}

.training-stat-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--accent);
}

.training-stat-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.stat-adj-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.training-tips {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
}

.training-tips-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 10px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.training-footer {
    padding: 16px 20px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    display: flex;
    gap: 10px;
    align-items: center;
    background: #000;
    border-top: 1px solid #1a1a1a;
}

.training-btn-prev {
    flex: 1;
    padding: 14px;
    background: #1a1a1a;
    color: #999;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    min-height: 48px;
    font-family: var(--font-sans);
    transition: all 150ms;
}

.training-btn-prev:active { background: #222; }
.training-btn-prev:disabled { opacity: 0.3; }

.training-btn-timer {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: #1a1a1a;
    border: none;
    color: var(--accent);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 150ms;
}

.training-btn-timer:active { background: #222; }
.training-btn-timer svg { width: 22px; height: 22px; }

.training-btn-next {
    flex: 1;
    padding: 14px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    min-height: 48px;
    font-family: var(--font-sans);
    transition: all 150ms;
}

.training-btn-next:active { transform: scale(0.97); }

/* Training Complete Screen */
.training-complete {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    gap: 16px;
    padding: 40px 20px;
}

.training-complete-icon {
    font-size: 64px;
    margin-bottom: 8px;
}

.training-complete-title {
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.training-complete-subtitle {
    font-size: 15px;
    color: var(--text-secondary);
    max-width: 280px;
}

.training-complete-btn {
    margin-top: 16px;
    padding: 16px 48px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    min-height: 52px;
    letter-spacing: 1px;
    font-family: var(--font-sans);
    transition: all 150ms;
}

.training-complete-btn:active { transform: scale(0.97); }

/* =============================================
   Workout Settings Bottom Sheet
   ============================================= */

.settings-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.settings-overlay.active {
    display: flex;
    animation: fadeIn 150ms;
}

.settings-sheet {
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    padding: 0 20px 40px;
    max-width: 500px;
    width: 100%;
    /* The overlay anchors the sheet to the bottom of the screen, so a sheet
       taller than the viewport grows off the TOP of it - the first rows scroll
       out of reach and there is nothing to scroll, because the sheet itself was
       never a scroll container. Any list that can grow (the plan list grows by
       one on every generation) needs this. */
    max-height: 85vh;
    overflow-y: auto;
    overscroll-behavior: contain;
    animation: slideUpSheet 300ms ease;
}

.settings-title {
    font-size: 18px;
    font-weight: 800;
    text-align: center;
    padding: 16px 0 20px;
    letter-spacing: -0.02em;
}

.settings-option {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px;
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    color: var(--text-primary);
    transition: background 150ms;
    font-family: var(--font-sans);
}

.settings-option:active { background: var(--bg-elevated); }

.settings-option-icon {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-md);
    background: #222;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.settings-option-icon svg { width: 20px; height: 20px; stroke: var(--accent); }

.settings-option-text { flex: 1; }

.settings-option-label {
    display: block;
    font-size: 15px;
    font-weight: 600;
}

.settings-option-desc {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* Switch Plans list */
.switch-plan-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.switch-plan-item:last-child { border-bottom: none; }
.switch-plan-item--active { opacity: .85; }
.switch-plan-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.switch-plan-name { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.switch-plan-date { font-size: 12px; color: var(--text-secondary); }
.switch-plan-badge {
    font-size: 11px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: .5px;
    flex-shrink: 0;
}
.switch-plan-btn {
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 8px;
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    flex-shrink: 0;
}
.switch-plan-btn:active { opacity: .8; }

.switch-plan-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.switch-plan-delete {
    background: transparent;
    border: none;
    padding: 6px;
    border-radius: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    line-height: 0;
}

.switch-plan-delete:active { background: var(--bg-elevated); color: var(--danger); }
.switch-plan-delete svg { width: 18px; height: 18px; }

/* One menu button per plan row. Bigger than the icons it replaced because it
   is now the only way in, and a 28px tap target on a phone is a miss. */
.switch-plan-menu {
    background: transparent;
    border: none;
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 10px;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
    flex-shrink: 0;
}

.switch-plan-menu:active { background: var(--bg-elevated); color: var(--text-primary); }
.switch-plan-menu svg { width: 20px; height: 20px; }


/* Skeleton for exercise rows */
.skeleton-row {
    height: 60px;
    margin-bottom: 2px;
    border-radius: 0;
}

.skeleton-row:first-child { border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.skeleton-row:last-child { border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* Keep muscle-tag for training mode and modal */
.muscle-tag {
    padding: 4px 12px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

/* =============================================
   Exercise Modal - Bottom Sheet
   ============================================= */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 200;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn 150ms;
}

.modal {
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    padding: 0 20px 40px;
    max-width: 500px;
    width: 100%;
    max-height: 92vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: slideUpSheet 300ms ease;
}

.drag-handle {
    width: 36px;
    height: 4px;
    background: #333;
    border-radius: 2px;
    margin: 12px auto 8px;
}

.modal-close {
    position: absolute;
    top: 12px;
    right: 12px;
    background: #222;
    border: none;
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms;
}

.modal-close:active { background: #333; }

.modal-title {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-top: 16px;
    margin-bottom: 12px;
    padding-right: 40px;
}

.modal-muscles {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.modal-muscles .muscle-tag {
    padding: 6px 14px;
    font-size: 12px;
}

/* GIF Container */
.gif-container {
    background: #0a0a0a;
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 16px;
    position: relative;
    min-height: 200px;
}

.gif-container img {
    width: 100%;
    max-width: 400px;
    max-height: 350px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.gif-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 12px;
    color: var(--text-secondary);
    font-size: 13px;
}

.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #222;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.gif-error {
    text-align: center;
    padding: 40px;
    color: var(--text-secondary);
}

.gif-error svg { width: 48px; height: 48px; stroke: #333; margin-bottom: 12px; }

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 16px;
}

.stat-card {
    background: #0a0a0a;
    padding: 14px 10px;
    border-radius: var(--radius-md);
    text-align: center;
}

.stat-label {
    font-size: 10px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

.stat-value {
    font-size: 20px;
    font-weight: 800;
}

.stat-value.blue { color: var(--accent); }
.stat-value.green { color: var(--accent); }
.stat-value.orange { color: var(--warning); }

/* Tips */
.tips-card {
    background: #0a0a0a;
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
}

.tips-title {
    font-size: 14px;
    font-weight: 700;
    margin-bottom: 12px;
    color: var(--accent);
}

.tip-item {
    display: flex;
    gap: 10px;
    margin-bottom: 10px;
    align-items: flex-start;
}

.tip-item:last-child { margin-bottom: 0; }

.tip-icon {
    color: var(--accent);
    font-size: 14px;
    margin-top: 2px;
    flex-shrink: 0;
    font-weight: 700;
}

.tip-text {
    color: var(--text-secondary);
    line-height: 1.5;
    font-size: 13px;
}

/* Action Buttons */
.action-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

/* Three labels side by side on a phone: the row is flex so each button takes
   the width its label needs and the rest is shared, instead of three equal
   columns that clip "↩ Desmarcar". */
.action-buttons.action-buttons-3col {
    display: flex;
    gap: 8px;
}
.action-buttons-3col .action-btn {
    flex: 1 1 auto;
    padding-left: 8px;
    padding-right: 8px;
    white-space: nowrap;
    letter-spacing: 0.03em;
}
@media (max-width: 380px) {
    .action-buttons-3col .action-btn { font-size: 11px; letter-spacing: 0; padding-left: 6px; padding-right: 6px; }
}

.action-btn {
    padding: 14px;
    border-radius: var(--radius-md);
    border: none;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 150ms;
    min-height: 48px;
    font-family: var(--font-sans);
}

.action-btn.primary {
    background: var(--accent);
    color: #000;
}

.action-btn.secondary {
    background: #222;
    color: #fff;
}

.action-btn:active { transform: scale(0.97); }

.action-btn.done {
    background: #222;
    color: var(--accent);
    border: 1.5px solid var(--accent);
}

.action-btn.swap {
    background: #1a1a1a;
    color: var(--warning);
    border: 1.5px solid #333;
}

/* =============================================
   Swap Panel
   ============================================= */

.swap-panel {
    margin-top: 16px;
    background: #0a0a0a;
    border-radius: var(--radius-lg);
    overflow: hidden;
    animation: slideUp 200ms ease;
}

.swap-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid #1a1a1a;
}

.swap-panel-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--warning);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.swap-panel-close {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: #222;
    border: none;
    color: #fff;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swap-panel-close:active { background: #333; }

.swap-panel-list {
    max-height: 320px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.swap-panel-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px 16px;
    color: var(--text-secondary);
    font-size: 13px;
}

.swap-panel-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-secondary);
    font-size: 13px;
}

.swap-alt-row {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 1px solid #1a1a1a;
    cursor: pointer;
    text-align: left;
    color: var(--text-primary);
    transition: background 150ms;
    font-family: var(--font-sans);
}

.swap-alt-row:last-child { border-bottom: none; }
.swap-alt-row:active { background: #1a1a1a; }

.swap-alt-thumb {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: #1a1a1a;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.swap-alt-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.swap-alt-info { flex: 1; min-width: 0; }

.swap-alt-name {
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.swap-alt-muscles {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

/* =============================================
   Timer Modal
   ============================================= */

.timer-modal {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 500;
    display: none;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 32px;
}

.timer-modal.active {
    display: flex;
    animation: fadeIn 150ms;
}

.timer-ring-container {
    position: relative;
    width: 240px;
    height: 240px;
}

.timer-ring-container svg {
    transform: rotate(-90deg);
    width: 240px;
    height: 240px;
}

.timer-ring-bg { fill: none; stroke: #1a1a1a; stroke-width: 6; }

.timer-ring-fill {
    fill: none;
    stroke: var(--accent);
    stroke-width: 6;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear;
}

.timer-display {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 48px;
    font-weight: 700;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: #fff;
}

.timer-label {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 500;
}

.timer-buttons {
    display: flex;
    gap: 16px;
}

.timer-btn {
    padding: 14px 32px;
    border-radius: var(--radius-full);
    border: none;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    min-height: 48px;
    transition: all 150ms;
    font-family: var(--font-sans);
}

.timer-btn:active { transform: scale(0.95); }
.timer-btn.stop { background: var(--danger); color: #fff; }
.timer-btn.add { background: #1a1a1a; color: #fff; }

/* =============================================
   Nutrition Section
   ============================================= */

.workout-section { display: none; }
.workout-section.active { display: block; }

.nutrition-section { display: none; }
.nutrition-section.active { display: block; animation: fadeIn 250ms; }

.nutrition-header {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px 20px;
    margin-bottom: 20px;
}

.nutrition-type {
    display: flex;
    gap: 4px;
    justify-content: center;
    margin-bottom: 20px;
    background: #0a0a0a;
    border-radius: var(--radius-full);
    padding: 3px;
}

.nutrition-type-btn {
    padding: 10px 20px;
    border-radius: var(--radius-full);
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--text-secondary);
    transition: all 150ms;
    min-height: 40px;
    flex: 1;
    font-family: var(--font-sans);
}

.nutrition-type-btn:active { transform: scale(0.95); }

.nutrition-type-btn.active {
    background: transparent;
    color: var(--accent);
    font-weight: 700;
}

.nutrition-visual {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0;
    overflow: visible;
    margin-bottom: 20px;
}

.calorie-ring {
    position: relative;
    width: 160px;
    height: 160px;
    flex-shrink: 0;
}

.donut-svg { width: 100%; height: 100%; }

.calorie-ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.calorie-ring-value {
    font-size: 26px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.calorie-ring-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
    font-weight: 500;
}

/* Hide donut (kept in HTML for easy revert) */
.donut-chart-hidden { display: none; }

/* SVG macro donut chart */
.radial-chart-wrap {
    width: 100%;
    padding: 8px 0 4px;
}

.macro-legend {
    width: 100%;
    max-width: 260px;
    margin: 16px auto 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.macro-legend-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.macro-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.macro-legend-name {
    flex: 1;
    font-size: 14px;
    color: #bbb;
}

.macro-legend-grams {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    min-width: 48px;
    text-align: right;
}

.macro-legend-pct {
    font-size: 14px;
    font-weight: 600;
    color: #888;
    min-width: 38px;
    text-align: right;
}


.meal-card {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 16px;
    margin-bottom: 10px;
}

.meal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.meal-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.meal-badge {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #222;
    color: var(--accent);
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.meal-time { font-weight: 700; font-size: 14px; }

.meal-calories {
    color: var(--accent);
    font-weight: 700;
    font-size: 13px;
}

.meal-items {
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.7;
    padding-left: 36px;
}

/* =============================================
   Food Log
   ============================================= */

/* Main nutrition tabs (Plan / Log) */
.nutrition-main-tabs {
    display: flex;
    gap: 0;
    margin: 0 0 16px 0;
    background: #111;
    border-radius: 10px;
    padding: 3px;
}

.nutrition-main-tab {
    flex: 1;
    padding: 8px 0;
    background: none;
    border: none;
    border-radius: 8px;
    color: #666;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
}

.nutrition-main-tab.active {
    background: var(--accent);
    color: #000;
}

/* Training / Rest day toggle inside log summary */
.food-log-type-toggle {
    display: flex;
    background: #1a1a1a;
    border-radius: 8px;
    padding: 2px;
    margin-bottom: 12px;
}

.food-log-type-btn {
    flex: 1;
    padding: 6px 4px;
    background: none;
    border: none;
    border-radius: 6px;
    color: #555;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    text-align: center;
}

.food-log-type-btn.active {
    background: transparent;
    color: var(--accent);
    font-weight: 700;
}

/* Date navigation */
.food-log-date-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0 16px;
    gap: 12px;
}

.food-log-nav-btn {
    background: #1a1a1a;
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    color: #fff;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.food-log-nav-btn:disabled {
    opacity: 0.3;
    cursor: default;
}

.food-log-date-label {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    text-align: center;
    flex: 1;
}

.food-log-date-label-btn {
    background: none;
    border: none;
    font-size: 15px;
    font-weight: 600;
    color: #fff;
    text-align: center;
    flex: 1;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: 8px;
    font-family: var(--font-sans);
    transition: background 0.15s;
}

.food-log-date-label-btn:active { background: #1a1a1a; }

/* Food log calendar dropdown */
.fcal-dropdown {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 12px 12px 8px;
    margin-bottom: 12px;
    animation: fadeIn 180ms ease;
}

.fcal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.fcal-month {
    font-size: 14px;
    font-weight: 600;
    color: #fff;
    text-transform: capitalize;
}

.fcal-nav {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 22px;
    cursor: pointer;
    padding: 2px 8px;
    border-radius: 6px;
    font-family: var(--font-sans);
    line-height: 1;
    transition: color 0.15s;
}

.fcal-nav:hover { color: #fff; }
.fcal-nav:disabled { opacity: 0.25; cursor: default; }

.fcal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.fcal-grid--hdr { margin-bottom: 4px; }

.fcal-day-hdr {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 2px 0;
}

.fcal-cell {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.12s;
}

.fcal-cell:not(.fcal-future):not(.fcal-empty):hover { background: #2a2a2a; }

.fcal-empty { pointer-events: none; }

.fcal-future { opacity: 0.25; cursor: default; }

.fcal-today { color: #fff; font-weight: 600; }

.fcal-selected {
    background: var(--accent) !important;
    color: #000;
    font-weight: 700;
}

/* Progress summary */
.food-log-summary {
    background: #111;
    border-radius: 14px;
    padding: 14px 16px;
    margin-bottom: 16px;
}

.food-log-summary-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.food-log-targets-label {
    font-size: 13px;
    font-weight: 600;
    color: #999;
    display: flex;
    align-items: center;
    gap: 8px;
}

.food-log-mode-badge {
    font-size: 11px;
    font-weight: 500;
    color: #555;
    background: #1a1a1a;
    border-radius: 6px;
    padding: 2px 6px;
}

.food-log-targets-btn {
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
}

.food-progress-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.food-progress-row:last-child { margin-bottom: 0; }

.food-progress-label {
    font-size: 12px;
    color: #888;
    width: 52px;
    flex-shrink: 0;
}

.food-progress-track {
    flex: 1;
    height: 6px;
    background: #222;
    border-radius: 3px;
    overflow: hidden;
}

.food-progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.4s ease;
}

.food-progress-values {
    font-size: 11px;
    color: #888;
    white-space: nowrap;
    min-width: 70px;
    text-align: right;
}

.food-progress-sep {
    color: #444;
    margin: 0 1px;
}

/* Entries list */
.food-log-entries {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 80px;
}

.food-log-empty {
    text-align: center;
    color: #555;
    font-size: 14px;
    padding: 32px 0;
}

.food-log-entry {
    background: #111;
    border-radius: 12px;
    padding: 12px 14px;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    -webkit-user-select: none;
    user-select: none;
}

.food-log-entry:active { background: #161616; }

.food-entry-top {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 9px;
}

/* The name is the only thing allowed to give way; the hypo badge, the time and
   the kcal keep their width so the row can never break onto a second line. */
.food-entry-left {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
}

.food-entry-type {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.food-entry-time {
    font-size: 12px;
    color: #555;
    white-space: nowrap;
    flex-shrink: 0;
}

.food-entry-kcal {
    font-size: 14px;
    font-weight: 700;
    color: #E2E8F0;
    white-space: nowrap;
    flex-shrink: 0;
}

.food-entry-macros {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.food-macro-chip {
    flex: 1 0 auto;  /* as wide as its value; with açúcares and sal the row wraps */
    display: flex;
    align-items: baseline;
    justify-content: center;
    gap: 4px;
    border-radius: 6px;
    padding: 4px 6px;
    background: #1a1a1a;
    white-space: nowrap;
}

.food-macro-chip i {
    font-family: var(--font-mono, 'SF Mono', monospace);
    font-style: normal;
    font-size: 9.5px;
    font-weight: 600;
    letter-spacing: 0.1em;
    opacity: 0.75;
}

.food-macro-chip b {
    font-size: 12.5px;
    font-weight: 700;
}

.food-macro-chip.prot { color: #FF6B6B; }
.food-macro-chip.carb { color: #FFB800; }
.food-macro-chip.fat  { color: #00E6B0; }
.food-macro-chip.sat  { color: var(--sat-color); }
.food-macro-chip.fib  { color: var(--fiber-color); }
.food-macro-chip.sug  { color: var(--sugars-color); }
.food-macro-chip.salt { color: var(--salt-color); }

.food-entry-hypo {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #FF6B6B;
    background: rgba(255, 107, 107, 0.12);
    border-radius: 6px;
    padding: 2px 7px;
}

.food-hypo-toggle {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #2a2a2a;
    background: #141414;
    cursor: pointer;
    margin-bottom: 14px;
}

.food-hypo-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }

.food-hypo-toggle-box {
    width: 22px;
    height: 22px;
    border-radius: 6px;
    border: 2px solid #444;
    flex-shrink: 0;
    position: relative;
}

.food-hypo-toggle.active { border-color: rgba(255, 107, 107, 0.6); background: rgba(255, 107, 107, 0.08); }

.food-hypo-toggle.active .food-hypo-toggle-box { background: #FF6B6B; border-color: #FF6B6B; }

.food-hypo-toggle.active .food-hypo-toggle-box::after {
    content: '';
    position: absolute;
    left: 6px;
    top: 2px;
    width: 6px;
    height: 11px;
    border: solid #0b0b0b;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.food-hypo-toggle-text { display: flex; flex-direction: column; gap: 2px; }
.food-hypo-toggle-title { font-size: 14px; font-weight: 600; color: #E2E8F0; }
.food-hypo-toggle-hint { font-size: 12px; color: #666; }

.food-entry-comment {
    font-size: 12px;
    color: #555;
    margin-top: 6px;
    font-style: italic;
}

/* The meal's glucose under it in Registo: says its card (js/meal-card.js) is there */
.food-entry-glu {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 9px;
    padding-top: 8px;
    border-top: 1px solid #1d1d1d;
    font-size: 12.5px;
    color: var(--text-secondary);
}
.food-entry-glu b { font-weight: 700; color: var(--text-primary); }
.food-entry-glu b.hi { color: var(--warning); }
.food-entry-glu b.lo { color: var(--protein-color); }
.food-entry-glu .go { margin-left: auto; color: var(--text-dim); font-size: 16px; line-height: 1; }

/* The meal card's sheet (js/meal-sheet.js) */
.meal-card-sheet { padding-bottom: calc(32px + env(safe-area-inset-bottom)); }
.meal-card-back {
    font: 600 13px/1 var(--font-sans);
    color: var(--accent);
    background: none;
    border: 0;
    padding: 8px 0 12px;
    min-height: 40px;
    cursor: pointer;
}

/* Meal search: the box above the date, and the results that take the day's place */
.food-search {
    display: flex;
    align-items: center;
    gap: 8px;
    background: #1a1a1a;
    border-radius: 10px;
    height: 44px;
    padding: 0 8px 0 12px;
    margin-top: 4px;
    cursor: text;
}
.food-search > svg { width: 16px; height: 16px; color: #666; flex-shrink: 0; }
.food-search input {
    flex: 1;
    min-width: 0;
    background: none;
    border: none;
    outline: none;
    color: #fff;
    font: inherit;
    font-size: 16px; /* under 16px iOS zooms in on focus */
}
.food-search input::placeholder { color: #666; }
.food-search input::-webkit-search-cancel-button { display: none; }
.food-search:focus-within { box-shadow: 0 0 0 1px var(--accent); }
.food-search-clear {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    border: none;
    border-radius: 50%;
    background: #2a2a2a;
    color: #AAAAAA;
    display: grid;
    place-items: center;
    cursor: pointer;
    padding: 0;
}
.food-search-clear svg { width: 13px; height: 13px; }
.food-search-count {
    font-family: var(--font-mono, 'SF Mono', monospace);
    font-size: 11px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: #666;
    padding: 16px 2px 4px;
}
.food-search-month {
    font-family: var(--font-mono, 'SF Mono', monospace);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #AAAAAA;
    padding: 10px 2px 0;
}
.food-search-when {
    font-family: var(--font-mono, 'SF Mono', monospace);
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent);
    margin-bottom: 7px;
}
.food-log-entry mark {
    background: rgba(255, 184, 0, 0.28);
    color: #fff;
    font-style: normal;
    border-radius: 3px;
    padding: 0 1px;
}
.food-search-flash { animation: food-search-flash 1.8s ease-out; }
@keyframes food-search-flash {
    0%, 35% { box-shadow: 0 0 0 2px var(--accent); }
    100% { box-shadow: 0 0 0 2px transparent; }
}
@media (prefers-reduced-motion: reduce) {
    .food-search-flash { animation: none; box-shadow: 0 0 0 2px var(--accent); }
}

/* Add buttons */
.food-log-add-wrap {
    position: fixed;
    bottom: 72px;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
    gap: 10px;
    pointer-events: none;
    z-index: 50;
}

.food-log-add-btn {
    pointer-events: all;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 24px;
    padding: 12px 28px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

/* Insulin is the second way to fill the day, so it reads as secondary next to
   the meal button - same pill, borrowed colour instead of the accent fill. */
.food-log-add-btn--insulin {
    background: #1b1b1b;
    color: #8FB8FF;
    border: 1px solid rgba(143, 184, 255, 0.35);
    padding: 12px 22px;
}

/* ── Insulin entries ─────────────────────────────────────────────────────── */

.insulin-entry {
    border-left: 3px solid rgba(143, 184, 255, 0.5);
}

.insulin-entry-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #8FB8FF;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.insulin-entry-badge .insulin-icon { flex-shrink: 0; }

/* a medication dose taken: one short line */
.food-med-entry { border-left: 3px solid rgba(169, 155, 255, .5); padding-top: 10px; padding-bottom: 10px; }
.food-med-entry .food-entry-top { margin-bottom: 0; }
.food-med-entry .diary-badge { margin-left: 0; flex-shrink: 0; }
#food-meds .med-card { margin-bottom: 16px; }

.insulin-entry-units {
    font-size: 14px;
    font-weight: 700;
    color: #E2E8F0;
    white-space: nowrap;
    flex-shrink: 0;
}

.insulin-entry-units i {
    font-style: normal;
    font-size: 11.5px;
    font-weight: 600;
    color: #666;
}

.insulin-entry .food-entry-top { margin-bottom: 0; }

.food-log-insulin-total {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #1e1e1e;
    font-size: 13px;
    color: #777;
}

.food-log-insulin-total b { color: #8FB8FF; font-size: 14px; }

/* Units stepper */
.insulin-stepper {
    display: flex;
    align-items: center;
    gap: 8px;
}

.insulin-step-btn {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    border-radius: 12px;
    border: 1px solid #2a2a2a;
    background: #141414;
    color: #E2E8F0;
    font-size: 20px;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.insulin-step-btn:active { background: #1e1e1e; }

.insulin-units-input {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
}

/* Only shown once Outros is picked, so the box appears when it is needed */
.insulin-custom-name {
    margin-top: 8px;
}

.food-log-loading {
    display: flex;
    justify-content: center;
    padding: 40px;
}

/* Bottom sheet overlay */
.food-log-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 500;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
}

.food-log-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.food-log-sheet {
    background: #111;
    border-radius: 20px 20px 0 0;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    padding: 12px 20px 32px;
    transform: translateY(100%);
    transition: transform 0.25s ease-out;
}

.food-log-overlay.active .food-log-sheet {
    transform: translateY(0);
}

.food-log-sheet-handle {
    width: 40px;
    height: 4px;
    background: #333;
    border-radius: 2px;
    margin: 0 auto 16px;
}

.food-log-sheet-title {
    font-size: 17px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 20px;
}

/* Form inside sheet */
.food-log-form { display: flex; flex-direction: column; gap: 14px; }

.food-form-group { display: flex; flex-direction: column; gap: 6px; }

.food-form-group--half { flex: 1; }

/* The optional fields (Açúcares, Saturadas, Fibra, Sal): hidden, keeping their place, until their column exists */
.food-form-opt { min-width: 0; }
.food-form-sub-hint { font-size: 11px; color: #6b6b6b; }
.food-form-sub-hint:empty { display: none; }
.food-form-sub-hint.is-error { color: #FF6B6B; }
.food-form-input--error { border-color: #FF6B6B !important; }

.food-form-row { display: flex; gap: 12px; }

.food-form-label {
    font-size: 12px;
    font-weight: 600;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.food-form-input, .food-form-select {
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    color: #fff;
    font-size: 15px;
    padding: 10px 12px;
    width: 100%;
    box-sizing: border-box;
    -webkit-appearance: none;
}

.food-form-input:focus, .food-form-select:focus {
    outline: none;
    border-color: var(--accent);
}

.food-form-input::-webkit-calendar-picker-indicator {
    filter: invert(1);
    opacity: 0.6;
    cursor: pointer;
}

/* Meal picker - a dropdown that stays inside the sheet instead of handing the
   choice to the OS. The trigger deliberately mirrors .food-form-input. */
.food-form-picker {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    color: #fff;
    font-family: var(--font-sans);
    font-size: 15px;
    padding: 10px 12px;
    width: 100%;
    box-sizing: border-box;
    text-align: left;
    cursor: pointer;
}

.food-form-picker.open { border-color: var(--accent); }

.food-form-picker-value.is-empty { color: #5c5c58; }

.food-form-picker-chev {
    color: #666;
    flex-shrink: 0;
    transition: transform 0.2s;
}

.food-form-picker.open .food-form-picker-chev {
    color: var(--accent);
    transform: rotate(180deg);
}

.food-form-menu {
    margin-top: 6px;
    background: #1a1a1a;
    border: 1px solid #2a2a2a;
    border-radius: 10px;
    max-height: 232px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: fadeIn 180ms ease;
}

.food-form-option {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 10px 14px;
    background: none;
    border: none;
    border-bottom: 1px solid #232323;
    color: #E2E8F0;
    font-family: var(--font-sans);
    font-size: 15px;
    text-align: left;
    cursor: pointer;
}

.food-form-option:last-child { border-bottom: none; }
.food-form-option:active { background: #222; }
.food-form-option.selected { color: var(--accent); }

.food-form-error {
    color: var(--danger);
    font-size: 13px;
    text-align: center;
}

/* Heavy-meal reminder in the meal form: fat or protein over the limits */
.fp-note {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 184, 0, 0.45);
    background: rgba(255, 184, 0, 0.07);
}

.fp-note[hidden] { display: none; }
.fp-note-title { color: var(--warning); font-size: 14px; font-weight: 700; }
.fp-note p { margin: 0; font-size: 13px; line-height: 1.45; color: var(--text-secondary); }
.fp-note .fp-note-more { font-size: 12.5px; color: var(--text-dim); }

.fp-note .fp-note-plan {
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(255, 184, 0, 0.12);
    color: var(--text-primary);
    font-weight: 600;
}

.food-form-save-btn {
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 12px;
    padding: 14px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    width: 100%;
    margin-top: 4px;
}

.food-form-save-btn:disabled { opacity: 0.5; }

/* Every sheet that saves also offers a way out. Tapping the backdrop already
   discarded, but an invisible gesture is not an answer to "how do I get out of
   this without saving" - so the way out is a button, next to the one that
   saves. Cancel stays narrow; the save keeps the room it had. */
.form-actions {
    display: flex;
    align-items: stretch;
    gap: 10px;
    margin-top: 4px;
}

.form-actions > .food-form-save-btn,
.form-actions > .body-log-save-btn,
.form-actions > .training-complete-btn {
    flex: 1;
    margin-top: 0;
    padding-left: 16px;
    padding-right: 16px;
}

.form-cancel-btn {
    flex-shrink: 0;
    padding: 14px 22px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: none;
    border-radius: 12px;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms;
}

/* Beside a taller, rounder save button - the body log and the finish screen. */
.form-cancel-btn--lg { padding: 16px 22px; border-radius: var(--radius-lg); }

.form-cancel-btn:active { transform: scale(0.97); }

.light-mode .form-cancel-btn { background: #f0f0f0; color: #555; }

/* Targets mode toggle */
#food-manual-fields .food-form-label { white-space: nowrap; }

.food-targets-day-label {
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--accent, #00E6B0);
    margin: 14px 0 8px;
}

.food-targets-toggle {
    display: flex;
    background: #1a1a1a;
    border-radius: 10px;
    padding: 3px;
    gap: 0;
}

.food-targets-mode-btn {
    flex: 1;
    padding: 8px 6px;
    background: none;
    border: none;
    border-radius: 8px;
    color: #666;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, color 0.2s;
    text-align: center;
}

.food-targets-mode-btn.active {
    background: var(--accent);
    color: #000;
}

/* =============================================
   Bottom Navigation
   ============================================= */

.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #000;
    border-top: 1px solid #1a1a1a;
    padding: 6px 20px;
    padding-bottom: max(6px, env(safe-area-inset-bottom));
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 100;
}

.nav-item {
    background: none;
    border: none;
    color: #555;
    padding: 6px 0;
    cursor: pointer;
    transition: all 200ms;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 40px;
    min-width: 0;
    flex: 1;
    position: relative;
    border-radius: 12px;
}

.nav-item:active { transform: scale(0.92); }

.nav-item.active {
    color: var(--accent);
    background: rgba(0, 230, 176, 0.08);
}

.nav-icon {
    width: 26px;
    height: 26px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.nav-icon svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.nav-label {
    display: none;
}

.nav-item-center {
    margin-top: -22px;
}

.nav-item-center.active {
    background: none;
}

.nav-item-center .nav-icon-center {
    width: 56px;
    height: 56px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* =============================================
   Home Section
   ============================================= */

.home-section { display: none; }
.home-section.active { display: block; animation: fadeIn 250ms; }

.home-cards {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 500px;
    margin: 0 auto;
}

.home-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.home-card-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.home-workout-card {
    background: linear-gradient(135deg, rgba(0,230,176,0.12) 0%, rgba(0,230,176,0.04) 100%);
    border: 1px solid rgba(0,230,176,0.15);
    border-radius: var(--radius-lg);
    padding: 24px 20px;
}

.home-workout-name {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 4px;
}

.home-workout-subtitle {
    font-size: 14px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

.home-workout-meta {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 16px;
}

.home-workout-btn {
    width: 100%;
    padding: 14px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius-md);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.5px;
}

.home-workout-btn:active {
    transform: scale(0.98);
}

.home-workout-btn.completed {
    background: transparent;
    color: var(--accent);
    border: 2px solid var(--accent);
    cursor: default;
}

.home-rest-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 32px 20px;
    text-align: center;
}

.home-rest-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 12px;
    color: var(--accent);
}

.home-rest-icon svg {
    width: 48px;
    height: 48px;
}

.home-rest-title {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.home-rest-msg {
    font-size: 14px;
    color: var(--text-muted);
}

.home-streak-card {
    background: var(--card-bg);
    border-radius: var(--radius-lg);
    padding: 20px;
    display: flex;
    align-items: center;
    gap: 16px;
}

.home-streak-icon {
    font-size: 32px;
}

.home-streak-value {
    font-size: 28px;
    font-weight: 800;
    line-height: 1;
}

.home-streak-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.home-stats-row {
    margin-left: auto;
    display: flex;
    gap: 16px;
}

.home-stat-mini {
    text-align: center;
}

.home-stat-mini-value {
    font-size: 18px;
    font-weight: 700;
}

.home-stat-mini-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
}

.home-nutrition-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: none;
    border: none;
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    width: 100%;
    padding: 0;
}

.home-quick-actions {
    display: flex;
    gap: 12px;
}

.home-action-btn {
    flex: 1;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid #333;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.home-action-btn:active {
    transform: scale(0.97);
}

/* =============================================
   Explore Section
   ============================================= */

.explore-section { display: none; }
.explore-section.active { display: block; animation: fadeIn 250ms; }

.explore-search-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid #333;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 15px;
    margin-bottom: 20px;
    box-sizing: border-box;
}

.explore-search-input::placeholder {
    color: #666;
}

.explore-muscle-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 24px;
}

.explore-muscle-card {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px 12px;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    border: 1.5px solid #2a2a2a;
    cursor: pointer;
    transition: all 200ms;
    font-size: 14px;
    font-weight: 600;
    color: #aaa;
}

.explore-muscle-card.active {
    border-color: var(--accent);
    background: rgba(0,230,176,0.07);
    color: var(--accent);
}

.explore-muscle-card:active {
    transform: scale(0.97);
}


.explore-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 20px;
}

.explore-filter-pill {
    padding: 9px 18px;
    background: var(--card-bg);
    border: 1px solid #333;
    border-radius: var(--radius-full);
    color: #aaa;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 200ms;
    white-space: nowrap;
}

.explore-filter-pill.active {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}

.explore-exercise-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.explore-exercise-card {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 200ms;
}

.explore-exercise-card:active {
    background: rgba(255,255,255,0.06);
}

.explore-card-gif {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    object-fit: cover;
    background: #1a1a1a;
    flex-shrink: 0;
}

.explore-card-gif-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    background: #1a1a1a;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.explore-card-gif-placeholder svg {
    width: 28px;
    height: 28px;
    stroke: #444;
    fill: none;
    stroke-width: 1.5;
}

.explore-card-info {
    flex: 1;
    min-width: 0;
}

.explore-card-name {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.explore-card-muscles {
    font-size: 12px;
    color: var(--text-muted);
}

.explore-load-more-btn {
    display: block;
    width: 100%;
    padding: 14px;
    margin-top: 12px;
    background: var(--bg-input);
    border: 1px solid #333;
    border-radius: var(--radius-md);
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.explore-loading {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.explore-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.explore-result-count {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 12px;
}

/* Explore Detail Overlay */
.explore-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 200;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    pointer-events: none;
    transition: opacity 250ms;
}

.explore-detail-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.explore-detail-card {
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    padding: 16px 20px 32px;
    transform: translateY(100%);
    transition: transform 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

.explore-detail-overlay.active .explore-detail-card {
    transform: translateY(0);
}

.explore-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.explore-detail-name {
    font-size: 18px;
    font-weight: 700;
    flex: 1;
}

.explore-detail-close {
    background: none;
    border: none;
    color: #888;
    font-size: 28px;
    cursor: pointer;
    padding: 0 4px;
}

.explore-detail-gif {
    width: 100%;
    max-height: 250px;
    object-fit: contain;
    border-radius: var(--radius-md);
    background: #111;
    margin-bottom: 16px;
}

.explore-detail-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.explore-detail-tag {
    padding: 4px 12px;
    background: rgba(0,230,176,0.1);
    color: var(--accent);
    border-radius: var(--radius-full);
    font-size: 12px;
    font-weight: 600;
}

.explore-detail-tag.secondary {
    background: rgba(255,255,255,0.06);
    color: #aaa;
}

.explore-detail-tag.equipment {
    background: rgba(255,184,0,0.1);
    color: #FFB800;
}

.explore-detail-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin: 16px 0 10px;
}

.explore-detail-instructions {
    list-style: none;
    padding: 0;
    margin: 0;
}

.explore-detail-instructions li {
    display: flex;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    font-size: 14px;
    line-height: 1.5;
}

.explore-detail-step-num {
    color: var(--accent);
    font-weight: 700;
    flex-shrink: 0;
}

/* =============================================
   Profile Section
   ============================================= */

.profile-section { display: none; }
.profile-section.active { display: block; animation: fadeIn 250ms; }

.profile-header-card {
    text-align: center;
    margin-bottom: 24px;
}

.profile-avatar {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: var(--accent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 28px;
    font-weight: 800;
    color: #000;
    margin: 0 auto 12px;
}

.profile-avatar--photo {
    object-fit: cover;
    background: transparent;
}

.profile-name {
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 8px;
}

.profile-badge {
    display: inline-block;
    padding: 4px 14px;
    background: var(--accent-surface);
    color: var(--accent);
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.profile-stats-row {
    display: flex;
    gap: 10px;
    margin-bottom: 24px;
}

.stat-card-rect {
    flex: 1;
    background: var(--bg-card);
    border-radius: 14px;
    padding: 16px 12px;
    text-align: center;
}

.stat-card-value {
    font-size: 22px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
    margin-bottom: 4px;
}

.stat-card-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.profile-info-card {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 4px 16px;
    margin-bottom: 24px;
}

.info-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 0;
    border-bottom: 1px solid #1a1a1a;
}

.info-row:last-child { border-bottom: none; }

.info-row-icon {
    width: 28px;
    text-align: center;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.info-row-icon svg { width: 18px; height: 18px; stroke: var(--accent); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.info-row-label {
    font-size: 14px;
    color: var(--text-secondary);
    flex: 1;
}

.info-row-value {
    font-size: 14px;
    font-weight: 600;
    text-align: right;
}

.profile-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.profile-edit-btn {
    width: 100%;
    padding: 16px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 9999px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    min-height: 52px;
    transition: all 150ms;
    font-family: var(--font-sans);
    box-shadow: 0 4px 20px rgba(0, 230, 176, 0.25);
}

.profile-edit-btn:active { transform: scale(0.97); }

.profile-reset-btn {
    width: 100%;
    padding: 14px;
    background: var(--bg-card);
    border: none;
    color: var(--text-secondary);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    min-height: 48px;
    transition: all 150ms;
    font-family: var(--font-sans);
}

.profile-reset-btn:active { transform: scale(0.97); }

.profile-logout-btn {
    width: 100%;
    padding: 14px;
    background: transparent;
    border: 1.5px solid #222;
    color: var(--danger);
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    min-height: 48px;
    transition: all 150ms;
    font-family: var(--font-sans);
    margin-top: 8px;
}

.profile-logout-btn:active { background: var(--danger-surface); }

/* =============================================
   Profile Edit - Tappable field affordance
   ============================================= */

/* Stat cards (weight/height/days) get an edit affordance */
.stat-card-rect.editable {
    cursor: pointer;
    position: relative;
    transition: background 150ms, transform 150ms;
}

.stat-card-rect.editable:active {
    background: var(--bg-card-hover);
    transform: scale(0.97);
}

.stat-card-rect.editable::after {
    content: '';
    position: absolute;
    bottom: 8px;
    right: 8px;
    width: 6px;
    height: 6px;
    border-right: 1.5px solid var(--accent);
    border-bottom: 1.5px solid var(--accent);
    border-radius: 1px;
    opacity: 0.6;
}

/* Info rows (goal/session/equipment/conditions) get edit affordance */
.info-row.editable {
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background 150ms;
    margin: 0 -8px;
    padding: 14px 8px;
}

.info-row.editable:active {
    background: var(--bg-elevated);
}

.info-row-chevron {
    color: var(--text-muted);
    display: flex;
    align-items: center;
    flex-shrink: 0;
    margin-left: 4px;
}

.info-row-chevron svg {
    width: 14px;
    height: 14px;
    stroke: var(--text-muted);
    fill: none;
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* =============================================
   Profile Edit Bottom Sheet
   ============================================= */

.profile-edit-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    z-index: 300;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.profile-edit-overlay.active {
    display: flex;
    animation: fadeIn 150ms;
}

.profile-edit-sheet {
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    padding: 0 20px;
    padding-bottom: max(32px, env(safe-area-inset-bottom));
    max-width: 500px;
    width: 100%;
    max-height: 88vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: slideUpSheet 300ms ease;
}

.profile-edit-sheet-handle {
    width: 36px;
    height: 4px;
    background: #333;
    border-radius: 2px;
    margin: 12px auto 20px;
}

.profile-edit-sheet-title {
    font-size: 17px;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--text-primary);
}

/* Number input */
.profile-edit-field {
    margin-bottom: 20px;
}

.profile-edit-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.profile-edit-input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1.5px solid #333;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 22px;
    font-weight: 700;
    font-family: var(--font-sans);
    min-height: 56px;
    transition: border-color 150ms;
    -moz-appearance: textfield;
}

.profile-edit-input::-webkit-outer-spin-button,
.profile-edit-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.profile-edit-input:focus {
    outline: none;
    border-color: var(--accent);
}

/* Days stepper */
.profile-edit-stepper {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-input);
    border: 1.5px solid #333;
    border-radius: var(--radius-md);
    overflow: hidden;
    min-height: 56px;
}

.nav-icon-center svg {
    width: 24px;
    height: 24px;
    stroke: #000;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.stepper-btn {
    width: 56px;
    height: 56px;
    background: transparent;
    border: none;
    color: var(--accent);
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 150ms;
    flex-shrink: 0;
    font-family: var(--font-sans);
}

.stepper-btn:active { background: var(--bg-elevated); }
.stepper-btn:disabled { color: #444; cursor: not-allowed; }

.stepper-value {
    flex: 1;
    text-align: center;
    font-size: 28px;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.stepper-suffix {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    padding-right: 16px;
}

/* Radio-style selector (goal / session) */
.profile-edit-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-edit-option {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 150ms, background 150ms;
    min-height: 52px;
    width: 100%;
    text-align: left;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 500;
}

.profile-edit-option.selected {
    border-color: var(--accent);
    background: var(--accent-surface);
}

.profile-edit-option:active {
    background: var(--bg-elevated);
}

.option-radio {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid #444;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 150ms;
}

.profile-edit-option.selected .option-radio {
    border-color: var(--accent);
}

.option-radio-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent);
    display: none;
}

.profile-edit-option.selected .option-radio-dot {
    display: block;
}

.option-label { flex: 1; }

/* Select all button */
.profile-select-all-btn {
    display: block;
    width: 100%;
    padding: 12px 16px;
    margin-bottom: 12px;
    background: transparent;
    border: 1.5px solid var(--accent);
    border-radius: var(--radius-md);
    color: var(--accent);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 150ms, color 150ms;
}

.profile-select-all-btn:active {
    background: var(--accent-surface);
}

.profile-select-all-btn.all-selected {
    background: var(--accent-surface);
}

/* Checkbox multi-select (equipment / conditions) */
.profile-edit-checkboxes {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.profile-edit-custom-text {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #333;
}

.profile-edit-checkbox {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: border-color 150ms, background 150ms;
    min-height: 52px;
    width: 100%;
    text-align: left;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 500;
}

.profile-edit-checkbox.selected {
    border-color: var(--accent);
    background: var(--accent-surface);
}

.profile-edit-checkbox:active {
    background: var(--bg-elevated);
}

.option-check {
    width: 20px;
    height: 20px;
    border-radius: 5px;
    border: 2px solid #444;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: border-color 150ms, background 150ms;
}

.profile-edit-checkbox.selected .option-check {
    border-color: var(--accent);
    background: var(--accent);
}

.option-check svg {
    width: 12px;
    height: 12px;
    stroke: #000;
    fill: none;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    display: none;
}

.profile-edit-checkbox.selected .option-check svg {
    display: block;
}

/* Save/Cancel footer */
.profile-edit-actions {
    display: flex;
    gap: 10px;
    margin-top: 24px;
    padding-bottom: 4px;
}

.profile-edit-save-btn {
    flex: 1;
    padding: 16px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius-full);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    min-height: 52px;
    transition: all 150ms;
    font-family: var(--font-sans);
}

.profile-edit-save-btn:active { transform: scale(0.97); }
.profile-edit-save-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.profile-edit-cancel-btn {
    padding: 16px 20px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
    border: none;
    border-radius: var(--radius-full);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    min-height: 52px;
    transition: all 150ms;
    font-family: var(--font-sans);
}

.profile-edit-cancel-btn:active { transform: scale(0.97); }

/* Inline toast feedback */
.profile-edit-toast {
    text-align: center;
    font-size: 13px;
    font-weight: 600;
    padding: 10px;
    border-radius: var(--radius-md);
    margin-top: 10px;
    display: none;
}

.profile-edit-toast.success {
    display: block;
    background: var(--accent-surface);
    color: var(--accent);
}

.profile-edit-toast.error {
    display: block;
    background: var(--danger-surface);
    color: var(--danger);
}

/* =============================================
   Generate Plan Button
   ============================================= */

.generate-plan-container { text-align: center; padding: 32px 20px; }

.generate-plan-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 11px 28px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 9999px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 150ms;
    min-height: 0;
    font-family: var(--font-sans);
    box-shadow: 0 4px 20px rgba(0, 230, 176, 0.25);
}

.generate-plan-btn:active { transform: scale(0.97); }
.generate-plan-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.generate-plan-btn svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 2; }
.generate-plan-btn .spinner { width: 20px; height: 20px; border-width: 2px; border-top-color: #000; border-color: rgba(0,0,0,0.2); }

/* =============================================
   Phase Indicator
   ============================================= */

.phase-indicator {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 16px;
    margin-bottom: 12px;
}

.phase-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.phase-head { min-width: 0; }

.phase-name { font-weight: 700; font-size: 15px; color: var(--accent); margin-bottom: 2px; }
.phase-week { font-size: 13px; color: var(--text-secondary); }

/* Plan options. Lives here rather than on the exercise list header so it stays
   reachable on rest days and when there is no plan yet. */
.phase-settings {
    width: 36px;
    height: 36px;
    flex: none;
    border-radius: 50%;
    background: var(--bg-elevated);
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 150ms;
}

.phase-settings:active { background: var(--accent-surface); color: var(--accent); }
.phase-settings svg { width: 18px; height: 18px; }

.phase-bar {
    height: 4px;
    background: #222;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 10px;
    margin-bottom: 8px;
}

.phase-bar-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 300ms;
}

.phase-desc { font-size: 12px; color: var(--text-secondary); font-style: italic; }

/* End of cycle. Amber rather than accent: the plan is finished, which needs
   attention, not the "progressing nicely" the accent colour implies. */
.phase-indicator--complete {
    border: 1px solid rgba(255, 184, 0, 0.32);
}

.phase-indicator--complete .phase-bar-fill { background: var(--warning); }

.phase-end {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #1a1a1a;
}

.phase-end-text {
    flex: 1;
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-secondary);
}

.phase-end-text b {
    color: var(--warning);
    font-weight: 600;
}

.phase-end-btn {
    flex: none;
    font-family: inherit;
    font-size: 12px;
    font-weight: 700;
    color: #000;
    background: var(--accent);
    border: none;
    border-radius: 8px;
    padding: 9px 13px;
    min-height: 40px;
    white-space: nowrap;
    cursor: pointer;
    transition: opacity 150ms;
}

.phase-end-btn:active { opacity: 0.7; }

/* =============================================
   Adaptation Banner
   ============================================= */

.adaptation-banner {
    background: var(--accent-surface);
    border: 1px solid rgba(0, 230, 176, 0.15);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    font-size: 13px;
    color: var(--accent);
}

.adapt-restore-btn {
    background: none;
    border: 1px solid var(--accent);
    color: var(--accent);
    padding: 8px 12px;
    border-radius: var(--radius-sm);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    white-space: nowrap;
    transition: all 150ms;
    min-height: 36px;
    font-family: var(--font-sans);
}

.adapt-restore-btn:active { background: var(--accent); color: #000; }

/* (workout actions removed - now in settings bottom sheet) */

/* =============================================
   Wizard Modal
   ============================================= */

.wizard-overlay {
    position: fixed;
    inset: 0;
    background: #000;
    z-index: 500;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: fadeIn 150ms;
}

.wizard-container {
    max-width: 500px;
    margin: 0 auto;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.wizard-header {
    padding: 20px;
    padding-top: max(20px, env(safe-area-inset-top));
    position: relative;
}

.wizard-close {
    position: absolute;
    top: max(16px, env(safe-area-inset-top));
    right: 16px;
    background: #1a1a1a;
    border: none;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
}

.wizard-close:active { background: #333; }

.wizard-step-label {
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1.5px;
}

.wizard-progress-track {
    height: 3px;
    background: #1a1a1a;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 12px;
}

.wizard-progress-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    transition: width 300ms ease;
}

.wizard-body {
    flex: 1;
    padding: 0 20px;
    padding-bottom: 120px;
    animation: fadeIn 250ms;
}

.wizard-body .step-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 6px;
    letter-spacing: -0.02em;
}

.wizard-body .step-subtitle {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 24px;
}

.wizard-body .form-group { margin-bottom: 20px; }

.wizard-body .form-group label {
    display: block;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
}

.wizard-body .form-group input,
.wizard-body .form-group textarea {
    width: 100%;
    padding: 14px;
    background: var(--bg-input);
    border: 1.5px solid #333;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 15px;
    font-family: var(--font-sans);
    transition: border-color 150ms;
    min-height: 48px;
}

.wizard-body .form-group input:focus,
.wizard-body .form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.wizard-body .form-group input::placeholder,
.wizard-body .form-group textarea::placeholder { color: #555; }

.wizard-body .checkbox-group { display: flex; flex-wrap: wrap; gap: 10px; }

.wizard-body .checkbox-option {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    background: var(--bg-card);
    border: 1.5px solid #333;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 150ms;
    font-size: 14px;
    color: #fff;
    min-height: 44px;
}

.wizard-body .checkbox-option:active { transform: scale(0.97); }
.wizard-body .checkbox-option input[type="checkbox"] { display: none; }

.wizard-body .checkbox-option.selected {
    border-color: var(--accent);
    background: var(--accent-surface);
    color: var(--accent);
}

.wizard-body .radio-group { display: flex; flex-direction: column; gap: 10px; }

.wizard-body .radio-option {
    display: flex;
    align-items: center;
    padding: 14px 16px;
    background: var(--bg-card);
    border: 1.5px solid #333;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 150ms;
    color: #fff;
    min-height: 48px;
}

.wizard-body .radio-option:active { transform: scale(0.98); }

.wizard-body .radio-option.selected {
    border-color: var(--accent);
    background: var(--accent-surface);
}

.wizard-body .radio-option .radio-label { font-size: 15px; }
.wizard-body .radio-option.selected .radio-label { color: var(--accent); font-weight: 600; }

.wizard-body .profile-summary-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.wizard-body .profile-summary-card h3 {
    font-size: 14px;
    margin-bottom: 12px;
    color: var(--accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.wizard-body .summary-field {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #1a1a1a;
    font-size: 14px;
}

.wizard-body .summary-field:last-child { border-bottom: none; }
.wizard-body .summary-label { color: var(--text-secondary); }
.wizard-body .summary-value { font-weight: 600; }

.wizard-body .edit-profile-link {
    display: inline-block;
    margin-top: 12px;
    color: var(--accent);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.wizard-body .edit-profile-link:hover { text-decoration: underline; }

.wizard-body .range-container { text-align: center; }

.wizard-body .range-value {
    font-size: 36px;
    font-weight: 800;
    color: var(--accent);
    margin-bottom: 12px;
}

.wizard-body input[type="range"] {
    width: 100%;
    height: 4px;
    -webkit-appearance: none;
    background: #222;
    border-radius: 2px;
    outline: none;
    border: none;
}

.wizard-body input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 24px;
    height: 24px;
    background: var(--accent);
    border-radius: 50%;
    cursor: pointer;
}

.wizard-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 16px 20px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    background: #000;
    border-top: 1px solid #1a1a1a;
    display: flex;
    gap: 10px;
    z-index: 510;
}

.wizard-footer .btn-back,
.wizard-footer .btn-next {
    flex: 1;
    padding: 14px;
    border-radius: var(--radius-md);
    border: none;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 150ms;
    min-height: 48px;
    font-family: var(--font-sans);
}

.wizard-footer .btn-back { background: #1a1a1a; color: #999; }
.wizard-footer .btn-next { background: var(--accent); color: #000; }
.wizard-footer .btn-next:active { transform: scale(0.97); }
.wizard-footer .btn-next:disabled { opacity: 0.4; cursor: not-allowed; }

/* Wizard Loading */
.wizard-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 60vh;
    text-align: center;
    gap: 20px;
}

.wizard-loading .spinner-large {
    width: 48px;
    height: 48px;
    border: 3px solid #1a1a1a;
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.wizard-loading .loading-message {
    font-size: 16px;
    color: var(--text-secondary);
    font-weight: 500;
}

.wizard-loading .loading-submessage {
    font-size: 13px;
    color: var(--text-muted);
}

/* =============================================
   Section transitions
   ============================================= */

.workout-section.active,
.nutrition-section.active,
.profile-section.active,
.home-section.active,
.explore-section.active,
.progress-section.active {
    animation: fadeIn 250ms;
}

/* =============================================
   Confetti
   ============================================= */

.confetti-particle {
    position: fixed;
    top: -10px;
    width: 10px;
    height: 10px;
    border-radius: 2px;
    animation: confetti-fall 3s ease-out forwards;
    z-index: 1000;
    pointer-events: none;
}

/* =============================================
   Progress Section
   ============================================= */

.progress-section { display: none; }
.progress-section.active { display: block; animation: fadeIn 250ms; }

#progress-content {
    max-width: 500px;
    margin: 0 auto;
}

.history-loading {
    display: flex;
    justify-content: center;
    padding: 60px 20px;
}

/* =============================================
   Month Calendar (Hevy-style)
   ============================================= */

.progress-calendar {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 20px 16px;
    margin-bottom: 16px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.calendar-month-year {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
}

.calendar-nav {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #1a1a1a;
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 150ms;
}

.calendar-nav:active { background: #333; }
.calendar-nav svg { width: 18px; height: 18px; }

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    max-width: 400px;
    margin: 0 auto;
    touch-action: none;
    user-select: none;
}

.calendar-weekday {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    padding: 4px 0 8px;
}

.calendar-day {
    width: 100%;
    min-height: 44px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 150ms;
    position: relative;
    font-family: var(--font-sans);
    padding: 2px 0;
}

.calendar-day.has-label {
    min-height: 52px;
    justify-content: flex-start;
    padding: 4px 2px;
}

.calendar-day.empty {
    cursor: default;
}

.calendar-day-num {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid transparent;
    flex-shrink: 0;
}

.calendar-day-label {
    font-size: 8px;
    line-height: 1.1;
    color: var(--text-secondary);
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 40px;
    display: block;
    margin-top: 1px;
}

.calendar-day.has-workout .calendar-day-label {
    color: var(--accent);
}

.calendar-day.has-scheduled .calendar-day-label {
    color: var(--text-secondary);
    opacity: 0.7;
}

.calendar-day.selected .calendar-day-label {
    color: var(--accent);
    opacity: 1;
}

.calendar-day-label.rest {
    opacity: 0.45;
}

.calendar-day:not(.empty):hover {
    background: #1a1a1a;
}

.calendar-day:not(.empty):active {
    transform: scale(0.9);
}

.calendar-day.today {
    border: 1.5px solid var(--accent);
}

.calendar-day.today .calendar-day-num {
    color: var(--accent);
    font-weight: 700;
}

.calendar-day.has-workout .calendar-day-num {
    color: #fff;
}

.calendar-day.has-scheduled .calendar-day-num {
    color: var(--text-secondary);
}

.calendar-day.selected {
    background: #1a1a1a;
}

.calendar-day.selected .calendar-day-num {
    color: var(--accent);
    font-weight: 700;
}

.calendar-day.future {
    opacity: 0.5;
    cursor: pointer;
}

.calendar-day.dragging {
    opacity: 0.4;
    transform: scale(0.95);
    border: 1px dashed var(--accent);
}

.calendar-day.drop-target {
    border: 1px dashed var(--accent);
    opacity: 0.8;
}

.calendar-day.drop-hover {
    background: var(--accent);
    opacity: 1;
}

.calendar-day.drop-hover .calendar-day-num,
.calendar-day.drop-hover .calendar-day-label {
    color: #000;
}

.calendar-day-check {
    position: absolute;
    top: 2px;
    right: 2px;
    width: 14px;
    height: 14px;
    background: var(--accent);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.calendar-day-check svg {
    width: 8px;
    height: 8px;
    stroke: #000;
    stroke-width: 3;
    fill: none;
}

/* =============================================
   Progress Stats Row
   ============================================= */

.progress-stats-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
    max-width: 500px;
    margin-left: auto;
    margin-right: auto;
}

.progress-stat-card {
    flex: 1;
    background: var(--bg-card);
    border-radius: 14px;
    padding: 16px 12px;
    text-align: center;
}

.progress-stat-value {
    font-size: 28px;
    font-weight: 800;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 4px;
}

.progress-stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* =============================================
   Day Detail Panel
   ============================================= */

/* Day Detail Bottom Sheet Modal */
.day-detail-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 200ms ease;
}

.day-detail-overlay.active {
    opacity: 1;
    pointer-events: auto;
}

.day-detail-sheet {
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    padding: 12px 20px 28px;
    width: 100%;
    max-width: 500px;
    max-height: 70vh;
    overflow-y: auto;
    transform: translateY(100%);
    transition: transform 300ms cubic-bezier(0.32, 0.72, 0, 1);
}

.day-detail-overlay.active .day-detail-sheet {
    transform: translateY(0);
}

.day-detail-sheet .drag-handle {
    width: 36px;
    height: 4px;
    background: #444;
    border-radius: 2px;
    margin: 0 auto 12px;
}

.day-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.day-detail-date {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    text-transform: capitalize;
}

.day-detail-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #222;
    border: none;
    color: #fff;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.day-detail-close:active { background: #333; }

.day-detail-picker-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.day-detail-empty {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.day-detail-workout {
    background: #0a0a0a;
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 10px;
}

.day-detail-workout:last-child { margin-bottom: 0; }

.day-detail-workout-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.day-detail-workout-name {
    font-weight: 700;
    font-size: 14px;
    color: #fff;
}

.day-detail-workout-meta {
    font-size: 12px;
    color: var(--text-secondary);
}

.day-detail-rating {
    margin-bottom: 10px;
}

.day-detail-exercises {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.day-detail-exercise {
    font-size: 13px;
    color: var(--text-secondary);
    padding-left: 12px;
    position: relative;
}

.day-detail-exercise::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--accent);
}

.day-detail-workout-meta-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.day-detail-swap {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #1a1a1a;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 150ms;
}

.day-detail-swap:active {
    background: #333;
}

.day-detail-go-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px;
    margin-top: 10px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 150ms;
    font-family: var(--font-sans);
}

.day-detail-go-btn:active {
    opacity: 0.8;
}

.day-detail-go-btn svg {
    width: 16px;
    height: 16px;
    stroke: #000;
}

.day-detail-missed {
    display: block;
    font-weight: 600;
    color: #666;
    margin-bottom: 4px;
    text-decoration: line-through;
}

.day-detail-missed-badge {
    font-size: 11px;
    color: #f59e0b;
    background: rgba(245, 158, 11, 0.15);
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 500;
}

.day-detail-edit-btn,
.history-edit-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    margin-top: 10px;
    background: #1a1a1a;
    color: var(--text-secondary);
    border: 1px solid #333;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms;
    font-family: var(--font-sans);
}

.day-detail-edit-btn:active,
.history-edit-btn:active {
    background: #333;
}

/* =============================================
   History Tabs & Cards
   ============================================= */

.history-tabs {
    display: flex;
    gap: 4px;
    margin-bottom: 16px;
    background: #0a0a0a;
    border-radius: var(--radius-full);
    padding: 3px;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
}

.history-tab {
    flex: 1;
    padding: 10px 16px;
    border-radius: var(--radius-full);
    border: none;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    background: transparent;
    color: var(--text-secondary);
    transition: all 150ms;
    min-height: 40px;
    font-family: var(--font-sans);
}

.history-tab:active { transform: scale(0.95); }

.history-tab.active {
    background: #222;
    color: #fff;
}

.history-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
    font-size: 14px;
}

.history-card {
    background: var(--bg-card);
    border-radius: 14px;
    margin-bottom: 10px;
    overflow: hidden;
}

.history-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px;
    cursor: pointer;
    transition: background 150ms;
}

.history-card-header:active { background: var(--bg-card-hover); }

.history-card-left { flex: 1; min-width: 0; }

.history-card-date {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 2px;
}

.history-card-day {
    font-size: 15px;
    font-weight: 600;
    color: #fff;
}

.history-card-right {
    text-align: right;
}

.history-card-meta {
    display: flex;
    gap: 8px;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.history-card-stars { font-size: 12px; }
.history-card-stars .star { color: #333; }
.history-card-stars .star.filled { color: var(--warning); }

.history-card-chevron {
    width: 18px;
    height: 18px;
    color: #333;
    flex-shrink: 0;
    transition: transform 200ms;
}

.history-card.expanded .history-card-chevron {
    transform: rotate(180deg);
}

.history-card-detail {
    padding: 0 16px 16px;
    border-top: 1px solid #1a1a1a;
}

.history-detail-empty {
    padding: 16px 0;
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
}

.history-exercise-row {
    padding: 10px 0;
    border-bottom: 1px solid #1a1a1a;
}

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

.history-exercise-name {
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 4px;
}

.history-exercise-sets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.detail-set {
    font-size: 12px;
    color: var(--text-secondary);
    background: #1a1a1a;
    padding: 4px 8px;
    border-radius: 4px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.detail-set-effort {
    display: inline-flex;
    align-items: center;
    gap: 1px;
    color: #FF6B2B;
    line-height: 0;
}

/* =============================================
   Metrics Summary
   ============================================= */

.metrics-summary-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.metric-summary-card {
    flex: 1;
    background: var(--bg-card);
    border-radius: 14px;
    padding: 16px 10px;
    text-align: center;
    position: relative;
}

.metric-summary-value {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    line-height: 1;
}

.metric-summary-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.metric-change {
    position: absolute;
    top: 8px;
    right: 8px;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
}

.metric-change.up { background: rgba(0, 230, 176, 0.15); color: var(--accent); }
.metric-change.down { background: rgba(255, 68, 68, 0.15); color: var(--danger); }

.metrics-timeline {
    background: var(--bg-card);
    border-radius: 14px;
    padding: 4px 16px;
}

.metric-entry {
    padding: 14px 0;
    border-bottom: 1px solid #1a1a1a;
}

.metric-entry:last-child { border-bottom: none; }

.metric-entry-date {
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.metric-entry-values {
    font-size: 14px;
    font-weight: 500;
    color: #fff;
}

.metric-entry-notes {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
    font-style: italic;
}

/* Body Log Button */
.body-log-btn {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 20px;
    background: var(--bg-card);
    border: 1.5px solid #333;
    border-radius: var(--radius-full);
    color: var(--accent);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 150ms;
    font-family: var(--font-sans);
    margin-bottom: 16px;
    box-sizing: border-box;
}

.body-log-btn:active { transform: scale(0.97); }
.body-log-btn svg { width: 18px; height: 18px; }

/* Body Log Modal Form */
.body-log-field {
    margin-bottom: 16px;
}

.body-log-field label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.body-log-field input,
.body-log-field textarea {
    width: 100%;
    padding: 14px;
    background: var(--bg-input);
    border: 1.5px solid #333;
    border-radius: var(--radius-md);
    color: #fff;
    font-size: 15px;
    font-family: var(--font-sans);
    transition: border-color 150ms;
}

.body-log-field input:focus,
.body-log-field textarea:focus {
    outline: none;
    border-color: var(--accent);
}

.body-log-field input::placeholder,
.body-log-field textarea::placeholder {
    color: #555;
}

.body-log-bp-row {
    display: flex;
    align-items: center;
    gap: 8px;
}

.body-log-bp-row input { flex: 1; }

.body-log-bp-sep {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-secondary);
}

.body-log-save-btn {
    width: 100%;
    padding: 16px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: var(--radius-lg);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 150ms;
    font-family: var(--font-sans);
    margin-top: 8px;
}

.body-log-save-btn:active { transform: scale(0.97); }
.body-log-save-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Difficulty Rating Buttons */
.difficulty-rating {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin: 16px 0;
}

.diff-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: #1a1a1a;
    border: 2px solid #333;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 150ms;
    font-family: var(--font-sans);
}

.diff-btn:active { transform: scale(0.9); }

.diff-btn.selected {
    background: var(--accent);
    border-color: var(--accent);
    color: #000;
}

.difficulty-labels {
    display: flex;
    justify-content: space-between;
    width: 100%;
    max-width: 260px;
    padding: 0 8px;
    font-size: 12px;
    color: var(--text-secondary);
}

/* Training Sets Log */
.training-sets-log {
    width: 100%;
    max-width: 400px;
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 16px;
}

.training-sets-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 12px;
}

.training-sets-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.training-sets-effort-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.set-log-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin: 0 -8px 4px;
    padding: 7px 8px;
    border-radius: 10px;
    transition: background 160ms ease, box-shadow 160ms ease;
}

/* Each row is followed by its (usually hidden) incomplete-note div,
   so the last row is the second-to-last child of the log container. */
.set-log-row:nth-last-child(2) { margin-bottom: 0; }

.set-log-number {
    width: 48px;
    min-width: 42px;
    flex-shrink: 1;
    font-size: 13px;
    color: var(--text-secondary);
    font-weight: 600;
    white-space: nowrap;
}

.set-log-input {
    width: 70px;
    min-width: 0;
    flex-shrink: 1;
    padding: 9px 5px;
    background: #0a0a0a;
    border: 1.5px solid #333;
    border-radius: var(--radius-sm);
    color: #fff;
    font-size: 14px;
    text-align: center;
    font-family: var(--font-sans);
}

.set-log-input:focus {
    outline: none;
    border-color: var(--accent);
}

.set-log-input.from-prev {
    color: var(--text-secondary);
    border-color: #2a2a2a;
    font-style: italic;
}

.set-input-wrap {
    position: relative;
    display: inline-flex;
    width: 70px;
    flex-shrink: 1;
    min-width: 0;
}

.set-input-wrap .set-log-input {
    width: 100%;
}

.set-delta-badge {
    position: absolute;
    top: -6px;
    right: -4px;
    font-size: 9px;
    font-weight: 600;
    white-space: nowrap;
    pointer-events: none;
    z-index: 1;
}

.set-delta-badge.positive {
    color: var(--accent);
}

.set-delta-badge.negative {
    color: #e74c3c;
}

.set-delta-badge.neutral {
    color: #555;
}

.training-sets-prev-label {
    font-size: 11px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.set-log-x {
    color: var(--text-secondary);
    font-size: 14px;
}

.set-effort {
    display: flex;
    gap: 2px;
    margin-left: auto;
    flex-shrink: 0;
    align-items: center;
}

.effort-flame {
    background: transparent;
    border: none;
    padding: 1px;
    cursor: pointer;
    color: #333;
    line-height: 0;
    transition: color 0.15s, transform 0.1s;
    flex-shrink: 0;
}

.effort-flame:active { transform: scale(0.82); }

.effort-hint .effort-flame.lit svg circle { fill: transparent; stroke: currentColor; stroke-width: 1.5; }
.effort-hint.set-log-row[data-effort="1"] .effort-flame.lit { color: #22C55E; }
.effort-hint.set-log-row[data-effort="2"] .effort-flame.lit { color: #86EFAC; }
.effort-hint.set-log-row[data-effort="3"] .effort-flame.lit { color: #EAB308; }
.effort-hint.set-log-row[data-effort="4"] .effort-flame.lit { color: #F97316; }
.effort-hint.set-log-row[data-effort="5"] .effort-flame.lit { color: #EF4444; }

.set-log-row[data-effort="1"] .effort-flame.lit { color: #22C55E; }
.set-log-row[data-effort="2"] .effort-flame.lit { color: #86EFAC; }
.set-log-row[data-effort="3"] .effort-flame.lit { color: #EAB308; }
.set-log-row[data-effort="4"] .effort-flame.lit { color: #F97316; }
.set-log-row[data-effort="5"] .effort-flame.lit { color: #EF4444; }

/* GIF Placeholder */
.gif-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #1a1a1a;
    color: #333;
}

.explore-exercise-card .gif-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 10px;
    flex-shrink: 0;
}

.gif-placeholder svg {
    width: 24px;
    height: 24px;
}

/* =============================================
   Planner Section
   ============================================= */
.planner-section {
    padding: 20px 16px 100px;
    max-width: 500px;
    margin: 0 auto;
}

.planner-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 12px;
}

/* Monthly Calendar */
.pcal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding: 0 4px;
}

.pcal-month-year {
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    text-transform: capitalize;
}

.pcal-nav {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--bg-card);
    border: none;
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 150ms;
}

.pcal-nav:active { background: #333; }
.pcal-nav svg { width: 18px; height: 18px; }

.pcal-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
    margin-bottom: 4px;
}

.pcal-weekday {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    padding: 4px 0;
}

.pcal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 2px;
}

.pcal-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 6px 2px 4px;
    min-height: 52px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 150ms;
    font-family: var(--font-sans);
    position: relative;
}

.pcal-day.empty { cursor: default; min-height: 0; }

.pcal-day-num {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    line-height: 1;
}

.pcal-day.today { background: rgba(0, 230, 176, 0.08); }
.pcal-day.today .pcal-day-num { color: var(--accent); font-weight: 700; }
.pcal-day.has-completed .pcal-day-num { color: #fff; font-weight: 600; }
.pcal-day.selected { background: var(--accent); }
.pcal-day.selected .pcal-day-num { color: #000; font-weight: 700; }
.pcal-day.future { opacity: 0.4; }
.pcal-day:not(.empty):not(.future):active { transform: scale(0.92); }

.pcal-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
    margin-top: 2px;
}

.pcal-day.selected .pcal-dot { background: #000; }

.pcal-workout-label {
    font-size: 8px;
    font-weight: 600;
    color: var(--text-muted);
    margin-top: 1px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    text-align: center;
}

.pcal-day.has-completed .pcal-workout-label { color: var(--accent); }
.pcal-day.selected .pcal-workout-label { color: #000; }

/* Plan Timeline */
.planner-section > div {
    margin-bottom: 20px;
}

.planner-timeline-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
}

.planner-timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.planner-timeline-phase {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.planner-timeline-week {
    font-size: 13px;
    color: var(--accent);
    font-weight: 600;
}

.planner-timeline-bar {
    height: 8px;
    background: #222;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.planner-timeline-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #00b894);
    border-radius: 4px;
    transition: width 300ms ease;
}

.planner-timeline-dates {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: var(--text-secondary);
}

.planner-timeline-alert,
.planner-timeline-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
}

.planner-timeline-alert {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.planner-timeline-warning {
    background: rgba(251, 191, 36, 0.15);
    color: #fbbf24;
}

.planner-timeline-alert svg,
.planner-timeline-warning svg {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
}

/* No Plan State */
.planner-no-plan {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-secondary);
}

.planner-no-plan svg {
    width: 48px;
    height: 48px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.planner-no-plan p {
    font-size: 14px;
    line-height: 1.5;
}

/* Day Detail Panel */
.pcal-detail {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-top: 12px;
    animation: slideUp 200ms ease;
}

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

.pcal-detail-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.pcal-detail-date {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    text-transform: capitalize;
}

.pcal-detail-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
}

.pcal-detail-workout {
    background: var(--bg-primary);
    border-radius: var(--radius-md);
    padding: 12px;
    margin-bottom: 8px;
}

.pcal-detail-workout-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.pcal-detail-workout-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.pcal-detail-swap {
    background: none;
    border: 1.5px solid #333;
    border-radius: 8px;
    color: var(--text-secondary);
    padding: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}
.pcal-detail-swap:active {
    background: rgba(255,255,255,0.05);
}

.pcal-detail-workout-meta {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.pcal-detail-exercises {
    margin-top: 8px;
}

.pcal-detail-exercise {
    font-size: 13px;
    color: var(--text-secondary);
    padding: 4px 0;
    border-bottom: 1px solid #222;
}

.pcal-detail-exercise:last-child { border-bottom: none; }

.pcal-detail-go-btn {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: var(--radius-md);
    background: var(--accent);
    color: #000;
    font-size: 14px;
    font-weight: 700;
    font-family: var(--font-sans);
    cursor: pointer;
    margin-top: 12px;
}

.pcal-detail-go-btn:active { opacity: 0.8; }

.pcal-detail-rest {
    text-align: center;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 14px;
    font-style: italic;
}

.pcal-detail-rating {
    display: flex;
    gap: 2px;
    margin-top: 4px;
}

/* Light mode planner overrides */
.light-mode .pcal-nav { background: #f5f5f5; color: #333; }
.light-mode .pcal-month-year { color: #333; }
.light-mode .pcal-day.today { background: rgba(0, 200, 150, 0.1); }
.light-mode .pcal-day.selected { background: var(--accent); }
.light-mode .pcal-detail { background: #f5f5f5; }
.light-mode .pcal-detail-workout { background: #fff; }
.light-mode .planner-timeline-card { background: #f5f5f5; }
.light-mode .planner-timeline-bar { background: #ddd; }

/* =============================================
   Plan Builder
   ============================================= */
.builder-template-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-top: 20px;
}

.builder-template-card.full-width {
    grid-column: 1 / -1;
}

.builder-template-card {
    background: #1a1a1a;
    border: 1px solid #333;
    border-radius: 12px;
    padding: 20px 14px;
    text-align: center;
    cursor: pointer;
    transition: all 200ms ease;
    font-family: var(--font-sans);
    position: relative;
    overflow: hidden;
}

.builder-template-card:hover {
    background: #222;
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 255, 200, 0.15);
}

.builder-template-card:active {
    transform: translateY(0) scale(0.98);
}

.builder-template-name {
    font-size: 15px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 6px;
}

.builder-template-desc {
    font-size: 13px;
    color: var(--accent);
    font-weight: 600;
    margin-bottom: 8px;
}

.builder-template-days {
    font-size: 11px;
    color: #888;
    line-height: 1.4;
    padding-top: 8px;
    border-top: 1px solid #333;
}

/* Custom day picker */
.builder-custom-count {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    margin: 30px 0;
}

.builder-count-btn {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 2px solid #333;
    color: var(--text-primary);
    font-size: 24px;
    font-weight: 700;
    cursor: pointer;
    transition: all 150ms;
    font-family: var(--font-sans);
}

.builder-count-btn:active {
    transform: scale(0.9);
}

.builder-count-btn:hover {
    border-color: var(--accent);
}

.builder-count-value {
    font-size: 48px;
    font-weight: 700;
    color: var(--accent);
    min-width: 60px;
    text-align: center;
}

.builder-custom-names {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 400px;
    margin: 0 auto;
}

.builder-custom-day-row {
    display: flex;
    gap: 10px;
}

.builder-custom-day-input {
    flex: 1;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1.5px solid #333;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
}

.builder-custom-day-input:focus {
    outline: none;
    border-color: var(--accent);
}

.builder-custom-day-select {
    width: 120px;
    padding: 12px 10px;
    background: var(--bg-card);
    border: 1.5px solid #333;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
}

.builder-custom-day-select:focus {
    outline: none;
    border-color: var(--accent);
}

/* Build step */
.builder-day-tabs {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
}

.builder-day-tab {
    padding: 10px 16px;
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: all 150ms;
    font-family: var(--font-sans);
}

.builder-day-tab.active {
    background: rgba(0, 255, 200, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

.builder-search-row {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.builder-search-input {
    width: 100%;
    padding: 12px 14px;
    background: var(--bg-card);
    border: 1.5px solid #333;
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-sans);
    margin-bottom: 12px;
    box-sizing: border-box;
}

.builder-search-input:focus {
    outline: none;
    border-color: var(--accent);
}

.builder-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.builder-filter-btn {
    padding: 8px 12px;
    background: var(--bg-card);
    border: 1.5px solid transparent;
    border-radius: 20px;
    font-size: 12px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 150ms;
    font-family: var(--font-sans);
}

.builder-filter-btn.active {
    background: var(--accent);
    color: #000;
    font-weight: 600;
}

.builder-exercise-results {
    max-height: 40vh;
    min-height: 200px;
    overflow-y: auto;
    margin-bottom: 16px;
    border-radius: var(--radius-md);
    background: var(--bg-card);
}

.builder-exercise-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid #222;
    cursor: pointer;
    transition: background 150ms;
}

.builder-exercise-item:last-child {
    border-bottom: none;
}

.builder-exercise-item:active {
    background: rgba(0, 255, 200, 0.1);
}

.builder-exercise-gif {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    overflow: hidden;
    background: #1a1a1a;
    flex-shrink: 0;
}

.builder-exercise-gif img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.builder-exercise-info {
    flex: 1;
}

.builder-exercise-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.builder-exercise-muscle {
    font-size: 11px;
    color: var(--text-secondary);
}

.builder-day-exercises {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    padding: 12px;
    min-height: 100px;
    margin-bottom: 20px;
}

.builder-day-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.builder-section-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.builder-section-divider::before,
.builder-section-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: #2a2a2a;
}

.builder-section-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    white-space: nowrap;
}

.builder-empty-day {
    text-align: center;
    color: var(--text-secondary);
    font-size: 13px;
    padding: 20px;
}

.builder-added-exercise {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px;
    background: #0a0a0a;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
}

.builder-added-exercise:last-child {
    margin-bottom: 0;
}

.builder-added-gif {
    width: 40px;
    height: 40px;
    border-radius: var(--radius-sm);
    object-fit: cover;
    background: #1a1a1a;
}

.builder-added-info {
    flex: 1;
}

.builder-added-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
}

.builder-added-volume {
    font-size: 11px;
    color: var(--accent);
}

.builder-remove-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(239, 68, 68, 0.2);
    border: none;
    color: #ef4444;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.builder-drag-handle {
    color: #555;
    cursor: grab;
    padding: 6px 4px;
    display: flex;
    align-items: center;
    line-height: 0;
    flex-shrink: 0;
    /* The drag is driven by touchmove, and a touch the browser has already
       claimed for scrolling cannot be taken back - it has to never be claimed. */
    touch-action: none;
}

.builder-drag-handle:active { cursor: grabbing; color: var(--accent); }

/* The dragged row is translated over its neighbours, so it needs to sit above
   them, and it must not animate its way to where the finger already is. */
.builder-added-exercise.dragging {
    background: var(--bg-elevated);
    outline: 1px solid var(--accent);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
    position: relative;
    z-index: 5;
    transition: none;
    will-change: transform;
}

.builder-added-exercise.dragging .builder-drag-handle { color: var(--accent); }

.builder-day-tab-count {
    opacity: 0.7;
    margin-left: 4px;
}

.builder-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 20px;
    color: var(--text-secondary);
    font-size: 13px;
}

.builder-empty-results {
    text-align: center;
    color: var(--text-secondary);
    padding: 20px;
    font-size: 13px;
}

/* Sits at the end of the results, inside their own scroller, and says how far
   through the list you are - a filter like Costas matches far more than a page. */
.builder-load-more-btn {
    display: block;
    width: calc(100% - 20px);
    margin: 10px;
    padding: 12px;
    background: var(--bg-input);
    border: 1px solid var(--hairline-strong);
    border-radius: var(--radius-md);
    color: var(--accent);
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.builder-load-more-btn:active { background: var(--bg-card-hover); }

.light-mode .builder-load-more-btn { background: #fff; border-color: #ddd; }

.builder-add-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0, 255, 200, 0.15);
    border: none;
    color: var(--accent);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.builder-add-btn.added {
    background: #333;
    color: #666;
    cursor: default;
}

.builder-exercise-item.added {
    opacity: 0.5;
}

.builder-exercise-item:hover {
    background: rgba(0, 230, 176, 0.08);
}

/* Builder Exercise Preview Modal */
.builder-preview-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: fadeIn 200ms ease;
}

.builder-preview-card {
    background: var(--bg-card);
    border-radius: 16px;
    max-width: 400px;
    width: 100%;
    max-height: 80vh;
    overflow-y: auto;
    animation: slideUp 250ms ease;
}

.builder-preview-gif {
    width: 100%;
    aspect-ratio: 16/10;
    background: #000;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 16px 16px 0 0;
    overflow: hidden;
}

.builder-preview-gif img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.builder-preview-body {
    padding: 20px;
}

.builder-preview-name {
    font-size: 18px;
    font-weight: 700;
    color: #fff;
    margin-bottom: 12px;
}

.builder-preview-muscles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 16px;
}

.builder-preview-muscles .muscle-tag {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.builder-preview-instructions {
    margin-bottom: 20px;
}

.builder-preview-instructions-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 10px;
}

.builder-preview-instructions ol {
    padding-left: 20px;
    color: var(--text-secondary);
    font-size: 13px;
    line-height: 1.6;
}

.builder-preview-instructions li {
    margin-bottom: 6px;
}

.builder-preview-actions {
    display: flex;
    gap: 12px;
}

.builder-preview-close {
    flex: 1;
    padding: 14px;
    background: #222;
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
}

.builder-preview-close:active {
    background: #333;
}

.builder-preview-add {
    flex: 1;
    padding: 14px;
    background: var(--accent);
    border: none;
    border-radius: 10px;
    color: #000;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.builder-preview-add:active {
    opacity: 0.9;
}

/* Light mode */
.light-mode .builder-template-card {
    background: #f5f5f5;
    border-color: #ddd;
}

.light-mode .builder-template-card:hover {
    background: #eee;
    box-shadow: 0 8px 24px rgba(0, 180, 140, 0.12);
}

.light-mode .builder-template-name {
    color: #1a1a1a;
}

.light-mode .builder-template-days {
    color: #777;
    border-top-color: #e0e0e0;
}

.light-mode .builder-count-btn {
    background: #f5f5f5;
    border-color: #ddd;
}

.light-mode .builder-custom-day-input,
.light-mode .builder-custom-day-select,
.light-mode .builder-search-input {
    background: #f5f5f5;
    border-color: #ddd;
}

.light-mode .builder-day-tab {
    background: #f5f5f5;
}

.light-mode .builder-filter-btn {
    background: #f5f5f5;
}

.light-mode .builder-exercise-results,
.light-mode .builder-day-exercises {
    background: #f5f5f5;
}

.light-mode .builder-exercise-item {
    border-bottom-color: #e0e0e0;
}

.light-mode .builder-added-exercise {
    background: #e8e8e8;
}

/* =============================================
   Day Switcher Pills
   ============================================= */

.day-switcher {
    display: flex;
    gap: 8px;
    padding: 0 16px;
    overflow-x: auto;
    margin-bottom: 16px;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.day-switcher::-webkit-scrollbar {
    display: none;
}

.day-pill {
    padding: 8px 16px;
    border-radius: 20px;
    border: 1.5px solid #333;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-family: var(--font-sans);
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.day-pill:active {
    transform: scale(0.95);
}

/* =============================================
   PWA INSTALL BANNER
   ============================================= */
.pwa-install-banner {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: var(--bg-card, #111);
    border: 1px solid #222;
    border-radius: 14px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    max-width: 420px;
    margin: 0 auto;
    animation: pwaSlideUp 220ms ease-out;
}
@media (min-width: 768px) {
    .pwa-install-banner {
        left: auto;
        right: 16px;
        bottom: 16px;
        margin: 0;
    }
}
.pwa-install-banner--with-nav {
    bottom: calc(env(safe-area-inset-bottom, 0px) + 72px);
}
@keyframes pwaSlideUp {
    from { transform: translateY(20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}
.pwa-install-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    flex-shrink: 0;
}
.pwa-install-text {
    flex: 1;
    min-width: 0;
}
.pwa-install-title {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary, #fff);
}
.pwa-install-host {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--text-secondary, #aaa);
}
.pwa-install-btn {
    flex-shrink: 0;
    height: 36px;
    padding: 0 16px;
    border: none;
    border-radius: 999px;
    background: var(--accent, #00E6B0);
    color: #000;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.pwa-install-btn:active {
    transform: scale(0.97);
}
.pwa-install-close {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 6px;
    color: var(--text-secondary, #aaa);
    cursor: pointer;
    padding: 0;
}
.pwa-install-close:hover {
    background: var(--bg-elevated, #222);
}

.pwa-install-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 1100;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 16px;
}
@media (min-width: 768px) {
    .pwa-install-modal-overlay { align-items: center; }
}
.pwa-install-modal {
    width: 100%;
    max-width: 380px;
    background: var(--bg-card, #111);
    border: 1px solid #222;
    border-radius: 18px;
    padding: 22px;
    color: var(--text-primary, #fff);
}
.pwa-install-modal-head {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 18px;
}
.pwa-install-modal-head img {
    width: 48px;
    height: 48px;
    border-radius: 12px;
}
.pwa-install-modal-head h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}
.pwa-install-modal-head p {
    margin: 2px 0 0;
    font-size: 12px;
    color: var(--text-secondary, #aaa);
}
.pwa-install-steps {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.pwa-install-steps li {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    font-size: 14px;
    line-height: 1.4;
}
.pwa-step-num {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    border-radius: 999px;
    background: var(--bg-elevated, #222);
    color: var(--text-primary, #fff);
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.pwa-install-done {
    margin-top: 20px;
    width: 100%;
    height: 42px;
    border: none;
    border-radius: 10px;
    background: var(--accent, #00E6B0);
    color: #000;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}

.day-pill.active {
    border-color: var(--accent);
    background: var(--accent-surface);
    color: var(--accent);
    font-weight: 600;
}

/* Workout Picker Dropdown */
.hero-switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 16px 0 8px;
    padding: 8px 16px;
    border: 1.5px solid #333;
    border-radius: 20px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 150ms;
}

.hero-switch-btn:active {
    background: rgba(255,255,255,0.05);
    transform: scale(0.96);
}

.hero-switch-btn svg {
    width: 14px;
    height: 14px;
}

/* Workout Picker Overlay */
.workout-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 1000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 150ms ease;
}

.workout-picker-sheet {
    width: 100%;
    max-width: 500px;
    background: var(--bg-elevated);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 8px 8px max(24px, env(safe-area-inset-bottom));
    animation: sheetSlideUp 200ms ease;
}

@keyframes sheetSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.workout-picker-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 10px 8px;
}

.workout-picker-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.workout-picker-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 24px;
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.workout-picker-option {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 14px 12px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    text-align: left;
    gap: 8px;
    font-family: var(--font-sans);
    transition: background 150ms;
    min-height: 52px;
}

.workout-picker-option:active {
    background: rgba(255,255,255,0.05);
}

.workout-picker-option.active {
    background: var(--accent-surface);
}

.workout-picker-name {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.workout-picker-option.active .workout-picker-name {
    color: var(--accent);
}

.workout-picker-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
    flex: 1;
}

.workout-picker-check {
    color: var(--accent);
    font-size: 18px;
    font-weight: 700;
}

/* =============================================
   Dexcom G7 / Glucose Integration
   ============================================= */

/* Dexcom Card (Profile/You tab) */
.dexcom-card {
    background: var(--card-bg);
    border-radius: 16px;
    padding: 16px;
    margin: 12px 0;
    border: 1px solid var(--border);
}

.dexcom-card--connected {
    border-color: rgba(16, 185, 129, 0.3);
}

.dexcom-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.dexcom-icon {
    width: 24px;
    height: 24px;
    color: var(--accent);
    flex-shrink: 0;
}

.dexcom-icon svg {
    width: 100%;
    height: 100%;
}

.dexcom-title {
    font-weight: 600;
    font-size: 15px;
    flex: 1;
}

.dexcom-badge {
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.dexcom-badge--on {
    background: rgba(16, 185, 129, 0.15);
    color: #10b981;
}

.dexcom-badge--off {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}

.dexcom-connect-btn {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.dexcom-connect-btn:active {
    opacity: 0.8;
}

.dexcom-connect-btn svg {
    width: 18px;
    height: 18px;
}

/* Current glucose value */
.dexcom-current {
    text-align: center;
    padding: 8px 0 12px;
}

.dexcom-value {
    font-size: 42px;
    font-weight: 700;
    line-height: 1;
    color: #10b981;
}

.dexcom-value.glucose-very-low { color: #ef4444; }
.dexcom-value.glucose-low { color: #f59e0b; }
.dexcom-value.glucose-normal { color: #10b981; }
.dexcom-value.glucose-high { color: #f59e0b; }
.dexcom-value.glucose-very-high { color: #ef4444; }

.dexcom-unit {
    font-size: 14px;
    font-weight: 400;
    color: var(--text-secondary);
    margin-left: 4px;
}

.dexcom-trend {
    font-size: 24px;
    margin-left: 4px;
}

.dexcom-trend-text {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 4px;
}

/* Stats row (24h mini stats) */
.dexcom-stats-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 0 4px;
    text-align: center;
}

.dexcom-stats-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 12px 0;
    border-top: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
}

.dexcom-stat {
    text-align: center;
}

.dexcom-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
}

.dexcom-stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.dexcom-sync-info {
    font-size: 12px;
    color: var(--text-secondary);
    padding: 8px 0;
    text-align: center;
}

.dexcom-actions {
    display: flex;
    gap: 8px;
    margin-top: 4px;
}

.dexcom-sync-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.dexcom-sync-btn:active {
    opacity: 0.7;
}

.dexcom-sync-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.dexcom-sync-btn svg {
    width: 16px;
    height: 16px;
}

.dexcom-disconnect-btn {
    padding: 10px 16px;
    background: rgba(239, 68, 68, 0.1);
    color: #ef4444;
    border: none;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.dexcom-disconnect-btn:active {
    opacity: 0.7;
}

/* Glucose Tab (Progress section) */
.glucose-range-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 16px;
}

.glucose-range-btn {
    flex: 1;
    padding: 8px 4px;
    background: var(--card-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.glucose-range-btn.active {
    background: rgba(59, 130, 246, 0.15);
    color: #3b82f6;
    border-color: rgba(59, 130, 246, 0.3);
}

.glucose-stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.glucose-stat-card {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 12px 8px;
    text-align: center;
    border: 1px solid var(--border);
}

.glucose-stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.glucose-stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.glucose-low-text { color: #f59e0b; }
.glucose-high-text { color: #f59e0b; }
.glucose-tir-text { color: #10b981; }

.glucose-chart-container {
    background: var(--card-bg);
    border-radius: 12px;
    padding: 12px;
    border: 1px solid var(--border);
    margin-bottom: 12px;
}

.glucose-chart-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

#glucose-canvas {
    width: 100%;
    display: block;
}

.glucose-chart-legend {
    display: flex;
    gap: 14px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid var(--border);
}

.glucose-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-secondary);
}

.glucose-legend-line {
    width: 16px;
    height: 3px;
    border-radius: 2px;
    display: inline-block;
}

.glucose-legend-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.glucose-legend-bar {
    width: 16px;
    height: 12px;
    border-radius: 2px;
    display: inline-block;
}

.chart-tooltip {
    position: absolute;
    top: 30px;
    background: #1e1e2e;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 12px;
    z-index: 10;
    min-width: 120px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    animation: tooltipFadeIn 0.15s ease;
}

@keyframes tooltipFadeIn {
    from { opacity: 0; transform: translateY(-4px); }
    to { opacity: 1; transform: translateY(0); }
}

.chart-tooltip-header {
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 2px;
}

.chart-tooltip-header.meal {
    color: #f59e0b;
}

.chart-tooltip-header.workout {
    color: #8b5cf6;
}

.chart-tooltip-time {
    font-size: 11px;
    color: var(--text-secondary);
}

.chart-tooltip-detail {
    font-size: 12px;
    color: var(--text-primary);
    margin-top: 2px;
}

.chart-tooltip-macros {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.chart-tooltip-comment {
    font-size: 10px;
    color: var(--text-secondary);
    font-style: italic;
    margin-top: 2px;
}

/* Insight: Meal spike gauge */
.insight-empty {
    font-size: 12px;
    color: var(--text-secondary);
    text-align: center;
    padding: 12px 0;
    opacity: 0.7;
}

.insight-period-badge {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.08);
    padding: 2px 6px;
    border-radius: 4px;
    vertical-align: middle;
    margin-left: 4px;
}

.glucose-chart-subtitle {
    font-size: 11px;
    color: var(--text-secondary);
    margin-bottom: 10px;
}

.meal-spike-item {
    margin-bottom: 12px;
}

.meal-spike-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 6px;
}

.meal-spike-label {
    font-size: 13px;
    color: var(--text-primary);
}

.meal-spike-value {
    font-size: 14px;
    font-weight: 700;
}

.spike-gauge {
    position: relative;
    height: 14px;
}

.spike-gauge-zones {
    display: flex;
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    gap: 2px;
}

.spike-zone {
    opacity: 0.3;
}

.spike-gauge-marker {
    position: absolute;
    top: -1px;
    width: 4px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 2px;
    background: var(--bg);
    transform: translateX(-50%);
    box-shadow: 0 0 4px rgba(0, 0, 0, 0.5);
}

.spike-gauge-labels {
    display: flex;
    font-size: 9px;
    color: var(--text-secondary);
    opacity: 0.5;
    margin-top: 2px;
    margin-bottom: 4px;
}

.spike-gauge-labels span {
    text-align: center;
}

.spike-gauge-labels span:nth-child(1) { flex: 30; }
.spike-gauge-labels span:nth-child(2) { flex: 20; }
.spike-gauge-labels span:nth-child(3) { flex: 30; }
.spike-gauge-labels span:nth-child(4) { flex: 40; }

/* Insight: References link */
.insight-references {
    text-align: right;
    margin-top: 6px;
}

.insight-references a {
    font-size: 10px;
    color: var(--text-secondary);
    text-decoration: none;
    opacity: 0.6;
}

.insight-references a:hover {
    opacity: 1;
    text-decoration: underline;
}

.insight-ref-intro {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.insight-ref-list {
    list-style: none;
    padding: 0;
    margin: 0 0 12px 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.insight-ref-list li {
    font-size: 12px;
    padding-left: 12px;
    position: relative;
}

.insight-ref-list li::before {
    content: '';
    position: absolute;
    left: 0;
    top: 7px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--text-secondary);
}

.insight-ref-list a {
    color: #3b82f6;
    text-decoration: none;
    line-height: 1.5;
}

.insight-ref-list a:hover {
    text-decoration: underline;
}

.insight-ref-thresholds {
    font-size: 11px;
    color: var(--text-secondary);
    background: rgba(255, 255, 255, 0.04);
    border-radius: 6px;
    padding: 8px 10px;
    line-height: 1.5;
    margin-top: 8px;
}

/* Insight: Training vs Rest comparison cards */
.insight-compare-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    margin-bottom: 8px;
}

.insight-compare-card {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    padding: 10px;
}

.insight-compare-header {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 8px;
}

.insight-compare-icon {
    font-size: 14px;
}

.insight-compare-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-primary);
}

.insight-compare-metrics {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.insight-metric {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.insight-metric-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
}

.insight-metric-label {
    font-size: 10px;
    color: var(--text-secondary);
}

.insight-compare-diff {
    text-align: center;
    font-size: 11px;
    font-weight: 600;
    padding-top: 8px;
    border-top: 1px solid var(--border);
    line-height: 1.6;
    color: var(--text-secondary);
}

.glucose-readings-count {
    text-align: center;
    font-size: 12px;
    color: var(--text-secondary);
    margin-bottom: 12px;
}

.glucose-empty {
    text-align: center;
    padding: 32px 16px;
    color: var(--text-secondary);
}

.glucose-empty p {
    margin-bottom: 16px;
}

.glucose-sync-inline {
    margin: 0 auto;
}

/* AI Analysis */
.glucose-ai-section {
    text-align: center;
}

.glucose-ai-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 11px 28px;
    background: var(--accent);
    color: #000;
    border: none;
    border-radius: 9999px;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: 0.5px;
    cursor: pointer;
    transition: all 150ms;
    font-family: var(--font-sans);
    box-shadow: 0 4px 24px rgba(0, 230, 176, 0.3);
}

.glucose-ai-btn:active {
    transform: scale(0.97);
}

.glucose-ai-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.glucose-ai-btn svg {
    width: 16px;
    height: 16px;
}

.glucose-sync-inline.dexcom-sync-btn {
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    padding: 8px 0;
    gap: 5px;
}

.glucose-sync-inline.dexcom-sync-btn:active {
    color: var(--text-primary);
}

.ai-analysis-card {
    margin-top: 16px;
    background: #1a1a2e;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    overflow: hidden;
    text-align: left;
}

.ai-analysis-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ai-analysis-badge {
    background: var(--accent-surface);
    color: var(--accent);
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.ai-analysis-period {
    color: rgba(255, 255, 255, 0.5);
    font-size: 12px;
}

.ai-analysis-content {
    padding: 16px;
    font-size: 13px;
    line-height: 1.7;
    color: rgba(255, 255, 255, 0.85);
}

.ai-analysis-content h3.ai-md-h2 {
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    margin: 16px 0 8px;
}

.ai-analysis-content h3.ai-md-h2:first-child {
    margin-top: 0;
}

.ai-analysis-content ul {
    padding-left: 18px;
    margin: 8px 0;
}

.ai-analysis-content li {
    margin-bottom: 4px;
}

.ai-analysis-content strong {
    color: #fff;
}

.ai-analysis-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    font-size: 11px;
    color: rgba(255, 255, 255, 0.35);
}

.ai-analysis-disclaimer {
    flex: 1;
    line-height: 1.4;
}

.spinner-small {
    display: inline-block;
    width: 14px;
    height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

/* Global toast notification */
.app-toast {
    position: fixed;
    bottom: 90px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: #1e1e2e;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 14px;
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 500;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6);
    z-index: 10000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s, transform 0.3s;
    max-width: calc(100vw - 32px);
    text-align: center;
    display: flex;
    align-items: center;
    gap: 10px;
}

.app-toast.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateX(-50%) translateY(0);
}

.app-toast.success {
    border-color: rgba(16, 185, 129, 0.4);
}

.app-toast.error {
    border-color: rgba(239, 68, 68, 0.4);
}

.app-toast.warning {
    border-color: rgba(234, 179, 8, 0.4);
}

.app-toast-icon {
    flex-shrink: 0;
    width: 20px;
    height: 20px;
}

.app-toast.success .app-toast-icon { color: #10b981; }
.app-toast.error .app-toast-icon { color: #ef4444; }
.app-toast.warning .app-toast-icon { color: #EAB308; }

/* =============================================
   Plan Analysis / Evolve Plan
   ============================================= */
.analysis-card {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 20px;
}

.analysis-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.analysis-card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-primary);
}

.analysis-card-window {
    font-size: 13px;
    color: var(--accent);
    font-weight: 600;
}

.analysis-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    margin-bottom: 6px;
}

.analysis-stat {
    text-align: center;
    padding: 10px 4px;
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
}

.analysis-stat-value {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}

.analysis-stat-value.good { color: var(--accent); }
.analysis-stat-value.warn { color: var(--warning); }
.analysis-stat-value.bad { color: var(--danger); }

.analysis-stat-label {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 4px;
}

.analysis-section {
    margin-top: 16px;
}

.analysis-section h4 {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-secondary);
    margin: 0 0 8px;
}

.analysis-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
    border-bottom: 1px solid #1a1a1a;
    font-size: 14px;
}

.analysis-row:last-child { border-bottom: none; }

.analysis-row-name {
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.analysis-row-value {
    color: var(--text-secondary);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

.analysis-row-value.positive { color: var(--accent); }
.analysis-row-value.negative { color: var(--danger); }
.analysis-row-value.warn { color: var(--warning); }

.analysis-note {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.5;
    margin: 0;
}

.analysis-empty {
    padding: 16px 0;
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.analysis-card-cta {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin-top: 16px;
    min-height: 44px;
    padding: 12px;
    background: var(--accent-surface);
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: var(--radius-md);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
}

.analysis-card-cta svg {
    width: 16px;
    height: 16px;
}

.evolve-change {
    padding: 10px 0;
    border-bottom: 1px solid #1a1a1a;
}

.evolve-change:last-child { border-bottom: none; }

.evolve-change-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.evolve-change-reason {
    font-size: 13px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.light-mode .analysis-card { background: #f5f5f5; }
.light-mode .analysis-stat { background: #ffffff; }

/* =============================================
   Exercise History (modal)
   ============================================= */
.exercise-history {
    margin-top: 18px;
}

.exercise-history:empty { display: none; }

.eh-loading {
    display: flex;
    justify-content: center;
    padding: 24px 0;
}

.eh-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.eh-title {
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-primary);
}

.eh-range { display: flex; gap: 4px; }

.eh-range-btn {
    background: var(--bg-elevated);
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    padding: 6px 11px;
    min-height: 30px;
    border-radius: 8px;
    cursor: pointer;
}

.eh-range-btn.on {
    background: var(--accent-surface);
    color: var(--accent);
}

.eh-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 12px;
}

.eh-stat {
    background: var(--bg-elevated);
    border-radius: var(--radius-md);
    padding: 10px 6px;
    text-align: center;
}

.eh-stat b {
    display: block;
    font-size: 16px;
    font-weight: 700;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
    line-height: 1.15;
}

.eh-stat span {
    font-size: 10px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--text-secondary);
}

.eh-verdict {
    font-size: 13px;
    line-height: 1.45;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    margin-bottom: 14px;
    background: var(--bg-elevated);
    color: var(--text-secondary);
}

.eh-verdict.stalled {
    background: rgba(184, 130, 0, 0.14);
    color: #E2A21F;
}

.eh-verdict.up {
    background: var(--accent-surface);
    color: var(--accent);
}

.eh-chart-block { margin-bottom: 16px; }

.eh-chart-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 6px;
}

.eh-chart-block canvas { display: block; width: 100%; }

.eh-sets {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.eh-sets td {
    padding: 8px 0;
    border-bottom: 1px solid #1a1a1a;
}

.eh-sets tr:last-child td { border-bottom: none; }

.eh-sets td:first-child {
    color: var(--text-secondary);
    font-size: 12px;
    width: 56px;
}

.eh-sets-detail { color: var(--text-primary); }

.eh-empty {
    font-size: 13px;
    color: var(--text-secondary);
    margin: 0;
    padding: 8px 0 4px;
}

.light-mode .eh-sets td { border-bottom-color: #e5e5e5; }

/* =============================================
   Evolution Tab (Progresso)
   ============================================= */
.ev-block {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 14px;
}

.ev-title {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
}

.ev-note {
    font-size: 12px;
    line-height: 1.45;
    color: var(--text-secondary);
    margin: 0 0 14px;
}

.ev-row {
    display: grid;
    grid-template-columns: 84px minmax(0, 1fr) 44px;
    align-items: center;
    gap: 10px;
    padding: 4px 0;
    font-size: 12px;
}

.ev-row-label {
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ev-row-value {
    text-align: right;
    font-weight: 600;
    color: var(--text-primary);
    font-variant-numeric: tabular-nums;
}

.ev-track {
    position: relative;
    display: block;
    height: 14px;
    background: var(--bg-elevated);
    border-radius: 4px;
}

.ev-fill {
    display: block;
    height: 14px;
    border-radius: 4px;
    min-width: 3px;
}

.ev-fill.good { background: #009E7C; }
.ev-fill.warn { background: #B88200; }
.ev-fill.crit { background: #D6395F; }

.ev-mev {
    position: absolute;
    top: -3px;
    bottom: -3px;
    width: 1px;
    background: var(--text-secondary);
    opacity: 0.65;
}

.ev-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 12px;
    font-size: 11px;
    color: var(--text-secondary);
}

.ev-legend i {
    display: inline-block;
    width: 9px;
    height: 9px;
    border-radius: 3px;
    margin-right: 5px;
    vertical-align: -1px;
}

.ev-legend i.good { background: #009E7C; }
.ev-legend i.warn { background: #B88200; }
.ev-legend i.crit { background: #D6395F; }

.ev-weeks {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 4px;
    height: 96px;
    padding-top: 6px;
}

.ev-weeks::before {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    top: var(--target-line, 50%);
    border-top: 1px dashed var(--text-secondary);
    opacity: 0.4;
}

.ev-week {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    align-items: center;
    height: 100%;
    gap: 4px;
}

.ev-week-bar {
    width: 100%;
    border-radius: 4px 4px 0 0;
    min-height: 3px;
}

.ev-week-bar.good { background: #009E7C; }
.ev-week-bar.warn { background: #B88200; }
.ev-week-bar.crit { background: #D6395F; }

.ev-week-label {
    font-size: 8px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.light-mode .ev-block { background: #f5f5f5; }
.light-mode .ev-track { background: #e3e3e3; }

/* =============================================
   Plan Overview (full plan)
   ============================================= */
.plan-overview-overlay { align-items: flex-end; }

.plan-overview-sheet {
    max-height: 88vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.po-head { margin-bottom: 12px; }

.po-name {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 2px;
}

.po-created {
    font-size: 12px;
    color: var(--text-secondary);
}

.po-summary {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    padding: 12px 0;
    margin-bottom: 6px;
    border-top: 1px solid #1a1a1a;
    border-bottom: 1px solid #1a1a1a;
    font-size: 12px;
    color: var(--text-secondary);
}

.po-summary b {
    color: var(--text-primary);
    font-size: 15px;
    font-variant-numeric: tabular-nums;
    margin-right: 3px;
}

.po-phases {
    display: flex;
    gap: 6px;
    margin: 14px 0 8px;
    overflow-x: auto;
}

.po-phase {
    flex: 0 0 auto;
    background: var(--bg-elevated);
    border: none;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 11px;
    font-weight: 600;
    padding: 8px 12px;
    min-height: 34px;
    border-radius: 9px;
    cursor: pointer;
    white-space: nowrap;
}

.po-phase.on { background: var(--accent-surface); color: var(--accent); }

.po-phase-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 0 0 8px;
}

.po-day {
    padding: 14px 0;
    border-bottom: 1px solid #1a1a1a;
}

.po-day:last-of-type { border-bottom: none; }

.po-day-head {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
}

.po-day-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--accent);
}

.po-day-count {
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.po-day-focus {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
    margin-bottom: 8px;
}

.po-ex {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 12px;
    padding: 6px 0;
    font-size: 13px;
}

.po-ex-name { color: var(--text-primary); }

.po-ex-volume {
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
    font-weight: 600;
}

.po-note, .po-empty {
    font-size: 12px;
    color: var(--text-secondary);
    margin: 12px 0 0;
}

.po-changes { margin-top: 20px; }

.po-changes h4 {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin: 0 0 8px;
}

.po-change { padding: 8px 0; border-bottom: 1px solid #1a1a1a; }
.po-change:last-child { border-bottom: none; }

.po-change-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 3px;
}

.po-change-reason {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.45;
}

.light-mode .po-summary,
.light-mode .po-day,
.light-mode .po-change { border-color: #e5e5e5; }

/* Separates reading the plan from changing it, in the workout options sheet.
   The sheet's own background is --bg-card (#111), so a #1a1a1a hairline is
   invisible against it - this needs to be lighter than the surface, not darker. */
.settings-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.14);
    margin: 12px 2px;
}

.light-mode .settings-divider { background: rgba(0, 0, 0, 0.12); }

/* Standalone on/off control - the wizard's chip pattern hides its input and
   shows state by colouring the pill, which reads as nothing when there is only
   one of them. This one shows an actual box. */
.evolve-toggle {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    width: 100%;
    text-align: left;
    padding: 14px;
    background: var(--bg-card);
    border: 1.5px solid #333;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: var(--font-sans);
    min-height: 44px;
    transition: border-color 150ms, background 150ms;
}

.evolve-toggle:active { transform: scale(0.99); }

.evolve-toggle-box {
    flex: 0 0 auto;
    width: 22px;
    height: 22px;
    border: 2px solid #555;
    border-radius: 6px;
    display: grid;
    place-items: center;
    color: transparent;
    transition: all 150ms;
}

.evolve-toggle-box svg { width: 14px; height: 14px; }

.evolve-toggle.on { border-color: var(--accent); background: var(--accent-surface); }

.evolve-toggle.on .evolve-toggle-box {
    background: var(--accent);
    border-color: var(--accent);
    color: #001b14;
}

.evolve-toggle.on .evolve-toggle-label { color: var(--accent); }

.evolve-toggle-text { display: flex; flex-direction: column; gap: 3px; }

.evolve-toggle-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.evolve-toggle-desc {
    font-size: 12px;
    line-height: 1.4;
    color: var(--text-secondary);
}

.evolve-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Two short numeric fields side by side on the AI wizard's profile step */
.wizard-body .evolve-numbers {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.wizard-body .evolve-numbers input { width: 100%; }

/* =============================================
   Session time budget - wizard card + plan overview
   ============================================= */
.budget-card {
    background: var(--bg-card);
    border: 1px solid #232323;
    border-radius: var(--radius-lg);
    padding: 15px 15px 13px;
    margin-top: 12px;
}
.budget-head {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: 12px;
}
.budget-nums {
    display: flex;
    align-items: baseline;
    gap: 18px;
    margin-bottom: 12px;
}
.budget-num { display: flex; align-items: baseline; gap: 7px; }
.budget-n {
    font-size: 30px;
    font-weight: 700;
    letter-spacing: -0.035em;
    line-height: 1;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
}
.budget-num.alt .budget-n { font-size: 19px; color: var(--text-primary); }
.budget-u { font-size: 11px; color: var(--text-secondary); line-height: 1.2; }
.budget-ticks { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 10px; }
.budget-ticks i {
    display: block;
    width: 7px;
    height: 17px;
    border-radius: 2px;
    background: var(--accent);
}
.budget-scheme {
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    padding-bottom: 11px;
    border-bottom: 1px solid #1e1e1e;
    margin-bottom: 10px;
}
.budget-scheme b { color: var(--text-primary); font-weight: 600; }
.budget-prov { display: flex; align-items: flex-start; gap: 8px; }
.budget-prov svg { width: 14px; height: 14px; flex: none; margin-top: 1px; }
.budget-prov.is-measured svg { color: var(--accent); }
.budget-prov.is-estimate svg { color: var(--warning); }
.budget-prov-txt { font-size: 11px; line-height: 1.45; color: var(--text-muted); flex: 1; }
.budget-prov-txt b { color: var(--text-secondary); font-weight: 600; }
.budget-prov-act {
    font-size: 11px;
    font-weight: 600;
    color: var(--accent);
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    font-family: inherit;
    white-space: nowrap;
    text-decoration: underline;
    text-underline-offset: 2px;
    min-height: auto;
}
.budget-tempo {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-top: 12px;
    padding-top: 12px;
    border-top: 1px solid #1e1e1e;
}
.budget-tempo[hidden] { display: none; }
.budget-tempo-opt {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 2px;
    text-align: left;
    background: var(--bg-input);
    border: 1px solid #232323;
    border-radius: var(--radius-md);
    padding: 10px 12px;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
}
.budget-tempo-opt.on {
    border-color: var(--accent);
    background: var(--accent-surface);
}
.budget-tempo-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.budget-tempo-opt.on .budget-tempo-name { color: var(--accent); }
.budget-tempo-desc { font-size: 11px; color: var(--text-muted); line-height: 1.35; }
.budget-reassure {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 11px;
    padding-top: 10px;
    border-top: 1px solid #1e1e1e;
    line-height: 1.45;
}
.budget-reassure b { color: var(--text-secondary); font-weight: 600; }

.po-day-time {
    font-size: 12px;
    font-weight: 600;
    color: var(--accent);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}
.po-day-meta {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 3px;
    font-variant-numeric: tabular-nums;
}
.po-day-bar {
    display: flex;
    height: 3px;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 9px;
    background: #1e1e1e;
}
.po-day-bar i { display: block; height: 100%; background: var(--accent); }
.po-target {
    font-size: 11px;
    color: var(--text-muted);
    margin: -4px 0 14px;
    font-variant-numeric: tabular-nums;
}
.po-time-warnings { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.po-time-warning {
    font-size: 11.5px;
    line-height: 1.45;
    color: var(--text-secondary);
    background: rgba(255, 184, 0, 0.07);
    border: 1px solid rgba(255, 184, 0, 0.22);
    border-radius: var(--radius-md);
    padding: 10px 12px;
}
.po-time-warning b { color: var(--warning); font-weight: 600; }

/* ─── Confirm sheet (styled replacement for window.confirm) ───────────────── */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.65);
    z-index: 10001;
    display: flex;
    align-items: flex-end;
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
}

.confirm-overlay.active {
    opacity: 1;
    pointer-events: all;
}

.confirm-sheet {
    background: var(--bg-card);
    border-radius: 20px 20px 0 0;
    width: 100%;
    padding: 12px 20px calc(28px + env(safe-area-inset-bottom));
    transform: translateY(100%);
    transition: transform 0.25s ease-out;
}

.confirm-overlay.active .confirm-sheet {
    transform: translateY(0);
}

.confirm-sheet-handle {
    width: 40px;
    height: 4px;
    background: #333;
    border-radius: 2px;
    margin: 0 auto 18px;
}

.confirm-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 8px;
}

/* Action sheets name what is being acted on rather than asking something, so
   the heading is a caption over the list, not a question in front of it. */
.confirm-title--caption {
    font-size: 11px;
    font-weight: 500;
    color: var(--text-muted);
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    margin-bottom: 14px;
}

.confirm-message {
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-secondary);
    margin-bottom: 22px;
}

.confirm-actions { display: flex; gap: 12px; }

/* The one-line answer sheet: a plan name, and whatever else later needs a word
   typed into it. Sized like the buttons under it so the sheet reads as a block. */
.confirm-input {
    width: 100%;
    min-height: 52px;
    padding: 0 14px;
    margin-bottom: 18px;
    background: var(--bg-input);
    border: 1px solid var(--hairline-strong);
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 16px; /* under 16px iOS zooms the page on focus */
    font-weight: 600;
    outline: none;
    -webkit-appearance: none;
}

.confirm-input:focus { border-color: var(--accent); }

.confirm-input::placeholder { color: var(--text-muted); font-weight: 400; }

.confirm-btn--ok:disabled { opacity: 0.4; cursor: default; }

/* A row of short values - sets, reps, rest - each under its own caption. */
.confirm-fields {
    display: flex;
    gap: 10px;
    margin-bottom: 18px;
}

.confirm-field {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.confirm-field-label {
    font-size: 10px;
    font-weight: 500;
    color: var(--text-muted);
}

.confirm-input--compact {
    margin-bottom: 0;
    padding: 0 8px;
    text-align: center;
}

.confirm-action-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.confirm-action {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    min-height: 52px;
    padding: 0 16px;
    background: var(--bg-elevated);
    border: none;
    border-radius: 12px;
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    text-align: left;
    cursor: pointer;
}

.confirm-action:active { background: var(--bg-card-hover); }
/* An svg with only a viewBox has no size: inside a flex row it takes the
   whole cell. Every icon in a sheet is 20px, whatever the caller passes. */
.confirm-action svg { width: 20px; height: 20px; color: var(--text-muted); flex-shrink: 0; }

.confirm-action--danger { color: var(--danger); background: rgba(255, 68, 68, 0.09); }
.confirm-action--danger svg { color: var(--danger); }
.confirm-action--danger:active { background: rgba(255, 68, 68, 0.16); }

/* Same shape as an action, dimmer, and full width - it is a direct child of
   the sheet, so it cannot borrow the flex sizing the confirm buttons get. */
.confirm-action-cancel {
    display: block;
    width: 100%;
    min-height: 52px;
    margin-top: 14px;
    padding: 0 16px;
    background: var(--bg-elevated);
    border: none;
    border-radius: 12px;
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
}

.confirm-action-cancel:active { background: var(--bg-card-hover); }

.confirm-btn {
    flex: 1;
    min-height: 48px;
    border: none;
    border-radius: var(--radius-lg);
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
}

.confirm-btn--cancel {
    background: var(--bg-elevated);
    color: var(--text-primary);
}

.confirm-btn--ok {
    background: var(--accent);
    color: #000;
}

.confirm-btn--danger {
    background: var(--danger);
    color: #fff;
}

.light-mode .confirm-sheet { background: #fff; }
.light-mode .confirm-sheet-handle { background: #ddd; }
.light-mode .confirm-btn--cancel { background: #f0f0f0; color: #333; }
.light-mode .confirm-action-cancel { background: #f0f0f0; color: #555; }
.light-mode .confirm-input { background: #f7f7f7; border-color: #ddd; }

/* =============================================
   Workout: Hoje | Biblioteca switch
   ============================================= */
.workout-seg { margin: 4px auto 16px; }

/* =============================================
   Relatório section
   ============================================= */
.report-section { padding-bottom: 24px; }
.report-hero {
    background: linear-gradient(160deg, #122a29, #0e1717);
    border: 1px solid #1f3a37;
    border-radius: var(--radius-lg);
    padding: 16px;
    margin-bottom: 12px;
}
.report-kicker { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 600; }
.report-headline { font-size: 20px; line-height: 1.25; font-weight: 700; margin: 8px 0 6px; color: #fff; letter-spacing: -.01em; }
.report-sub { margin: 0; font-size: 12.5px; color: #b8c4c2; }
.report-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.report-compare > div { background: rgba(0,0,0,.35); border-radius: var(--radius-md); padding: 8px 10px; min-width: 0; }
.report-compare-label { display: block; font-size: 11px; color: var(--text-secondary); }
.report-compare b { display: block; font-size: 20px; color: #fff; font-weight: 700; font-variant-numeric: tabular-nums; }
.report-compare b em { font-style: normal; font-size: 11.5px; color: var(--accent); margin-left: 5px; }
.report-compare-note { margin: 8px 0 0; font-size: 11px; color: var(--text-muted); }
.report-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.report-tile { background: var(--bg-card); border-radius: var(--radius-md); padding: 10px 12px; display: flex; flex-direction: column; }
.report-tile-value { font-size: 20px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.report-tile.low .report-tile-value { color: var(--danger); }
.report-tile-label { font-size: 11px; color: var(--text-secondary); margin-top: 3px; }
.report-chapters { background: var(--bg-card); border-radius: var(--radius-lg); padding: 4px 14px; margin-bottom: 12px; }
.report-chapter { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--rule, #1e1e1e); color: var(--text-primary); text-decoration: none; font-size: 14px; font-weight: 500; }
.report-chapter:last-child { border-bottom: 0; }
.report-chapter-num { color: var(--text-dim); font-size: 11.5px; font-variant-numeric: tabular-nums; width: 18px; }
.report-chapter svg { width: 16px; height: 16px; margin-left: auto; color: var(--text-dim); }
.report-open-btn { display: block; text-align: center; background: var(--accent); color: #000; font-weight: 700; border-radius: var(--radius-md); padding: 13px; font-size: 14px; text-decoration: none; }
.report-open-btn:active { background: var(--accent-dark); }
.report-stamp { text-align: center; font-size: 11.5px; color: var(--text-dim); margin: 12px 0 0; }
.report-empty { text-align: center; padding: 48px 20px; color: var(--text-secondary); }
.report-empty h3 { color: var(--text-primary); font-size: 17px; margin: 0 0 8px; }
.report-empty p { margin: 0; font-size: 13.5px; }
.report-tile.ok .report-tile-value { color: var(--accent); }
.report-share-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 8px; background: var(--bg-card); color: var(--text-primary); border: 1px solid var(--rule, #1e1e1e); border-radius: var(--radius-md); padding: 12px; font: 600 14px/1.2 var(--font-sans); cursor: pointer; min-height: 44px; }
.report-share-btn svg { width: 16px; height: 16px; color: var(--accent); }
.report-share-btn:active { background: var(--bg-card-hover); }
.report-list-title { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; margin: 22px 2px 8px; }
.report-months .report-chapter > span:first-child { min-width: 0; }
.report-month-partial { font-style: normal; font-size: 11px; color: var(--text-dim); font-weight: 500; }
.report-month-stats { margin-left: auto; font-size: 12.5px; color: var(--text-secondary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.report-month-stats b { color: var(--accent); font-weight: 600; }
.report-month-stats + svg { margin-left: 0; }
.report-full-link { background: var(--bg-card); border-radius: var(--radius-lg); padding: 12px 14px; border-bottom: 0; }
.report-full-link + .report-full-link { margin-top: 8px; }

/* Doctor links: a sheet over the Relatório tab, below the confirm sheet it opens */
.share-overlay { z-index: 10000; }
.share-sheet { max-height: 88vh; overflow-y: auto; }
.share-label { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--text-muted); font-weight: 600; margin: 0 0 8px; }
.share-label--list { margin-top: 22px; }
/* validity: 1–90 days on a slider, or until switched off */
.share-days { display: grid; gap: 10px; background: var(--bg-elevated); border-radius: 12px; padding: 14px 12px 6px; margin-bottom: 18px; }
.share-days-value { font-size: 22px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.share-days-value small { font-size: 13px; font-weight: 500; color: var(--text-secondary); margin-left: 8px; }
.share-days-range { -webkit-appearance: none; appearance: none; width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer; }
.share-days-range::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--accent) var(--fill, 0%), var(--rule, #333) var(--fill, 0%)); }
.share-days-range::-moz-range-track { height: 4px; border-radius: 2px; background: linear-gradient(to right, var(--accent) var(--fill, 0%), var(--rule, #333) var(--fill, 0%)); }
.share-days-range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: var(--accent); border: 0; box-shadow: 0 0 0 6px var(--accent-glow); }
.share-days-range::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--accent); border: 0; box-shadow: 0 0 0 6px var(--accent-glow); }
.share-days-range:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 4px; }
.share-days-range:disabled { opacity: .35; cursor: default; }
.share-days-ticks { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-muted); margin-top: -4px; }
.share-days.is-forever .share-days-ticks { opacity: .35; }
.share-days .share-sw--plain { background: none; border: 0; border-top: 1px solid var(--rule, #1e1e1e); border-radius: 0; padding: 10px 0 8px; }
.share-days .share-sw--plain[aria-checked="true"] { border-color: var(--rule, #1e1e1e); }
.share-create, .share-send { width: 100%; }
.share-fresh { display: grid; }
.share-link { display: flex; gap: 8px; margin-bottom: 16px; }
.share-link input { flex: 1; min-width: 0; background: var(--bg-elevated); border: 1px solid var(--rule, #1e1e1e); border-radius: 10px; color: var(--text-primary); font: 12.5px/1.2 'IBM Plex Mono', ui-monospace, monospace; padding: 10px; }
.share-copy { background: var(--accent-surface); color: var(--accent); border: 1px solid var(--accent); border-radius: 10px; font: 600 13px/1 var(--font-sans); padding: 0 14px; min-height: 40px; cursor: pointer; }
.share-code { font: 600 30px/1 'IBM Plex Mono', ui-monospace, monospace; letter-spacing: .2em; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.share-code--small { font-size: 15px; letter-spacing: .12em; color: var(--accent); }
.share-note { font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); margin: 12px 0 16px; }
.share-error { font-size: 13px; color: var(--danger); margin: 12px 0 0; }
.share-list { display: grid; gap: 8px; }
.share-row { display: grid; gap: 10px; background: var(--bg-elevated); border-radius: 12px; padding: 10px 12px; }
.share-row-top { display: flex; align-items: center; gap: 12px; }
.share-switches { display: grid; gap: 8px; margin-bottom: 18px; }
.share-sw { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; background: var(--bg-elevated); border: 1px solid var(--rule, #1e1e1e); border-radius: 12px; padding: 10px 12px; min-height: 52px; color: var(--text-primary); font-family: var(--font-sans); cursor: pointer; }
.share-sw--fixed { cursor: default; }
.share-sw-text { display: grid; gap: 2px; min-width: 0; }
.share-sw-text b { font-size: 14px; font-weight: 600; }
.share-sw-text small { font-size: 12px; color: var(--text-secondary); line-height: 1.35; }
.share-sw-knob { flex: none; position: relative; width: 40px; height: 24px; border-radius: 12px; background: var(--rule, #333); transition: background .15s; }
.share-sw-knob::after { content: ''; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--text-secondary); transition: left .15s, background .15s; }
.share-sw[aria-checked="true"] { border-color: var(--accent); }
.share-sw[aria-checked="true"] .share-sw-knob { background: var(--accent); }
.share-sw[aria-checked="true"] .share-sw-knob::after { left: 19px; background: #000; }
.share-sw:focus-visible, .share-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* link card buttons: two equal columns, what it shares on one row, copy and switch off on the next */
.share-chips, .share-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.share-btn { display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 10px; border-radius: 10px; background: none; border: 1px solid var(--rule, #2a2a2a); color: var(--text-secondary); font: 600 13px/1.2 var(--font-sans); text-align: center; cursor: pointer; }
.share-btn--wide { grid-column: 1 / -1; }
.share-copy-row { background: var(--accent); border-color: var(--accent); color: #000; }
.share-row-sub { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-dim); margin: 2px 0 -2px; }
.share-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.share-chip[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-surface); }
.share-chip[aria-pressed="true"]::before { content: '✓'; margin-right: 6px; }
.share-chip:disabled { opacity: .5; cursor: progress; }
@media (prefers-reduced-motion: reduce) { .share-sw-knob, .share-sw-knob::after { transition: none; } }
.share-row.off { opacity: .55; }
.share-row-main { display: grid; gap: 2px; min-width: 0; margin-right: auto; }
.share-row-title { font-size: 13.5px; color: var(--text-primary); font-weight: 600; }
.share-row-meta { font-size: 11.5px; color: var(--text-secondary); }
.share-off { color: var(--danger); }
.share-code--small { white-space: nowrap; align-self: flex-start; padding-top: 2px; }
.light-mode .share-sheet { background: #fff; }

/* =============================================
   Diário: day timeline (also today's card on Início)
   ============================================= */
.diary-strip { display: flex; align-items: center; gap: 4px; margin: 0 0 12px; }
.diary-strip-nav { flex: 0 0 28px; height: 44px; background: none; border: 0; color: var(--text-dim); font-size: 22px; line-height: 1; cursor: pointer; }
.diary-strip-nav:disabled { opacity: .3; }
.diary-days { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; min-width: 0; }
.diary-day { background: var(--bg-card); border: 0; border-radius: 10px; padding: 6px 0; font-size: 11px; color: var(--text-dim); text-align: center; cursor: pointer; font-family: inherit; }
.diary-day b { display: block; font-size: 14px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.diary-day.on { background: var(--accent); color: #000; }
.diary-day.on b { color: #000; }
.diary-day.future { opacity: .35; }
.diary-card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 12px 14px 4px; margin-bottom: 12px; }
.diary-card-title { margin: 0 0 6px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); font-weight: 600; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.diary-card-title span { letter-spacing: 0; text-transform: none; font-weight: 500; color: var(--text-dim); text-align: right; }
.diary-entry { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid #1e1e1e; align-items: flex-start; cursor: pointer; user-select: none; -webkit-user-select: none; }
.diary-entry:last-child { border-bottom: 0; }
.diary-entry-time { flex: 0 0 40px; font-size: 11.5px; color: var(--text-dim); font-variant-numeric: tabular-nums; padding-top: 2px; }
.diary-entry-main { flex: 1; min-width: 0; }
.diary-entry-main b { display: block; font-size: 13.5px; font-weight: 600; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.diary-entry-main small { display: block; font-size: 11.5px; color: var(--text-secondary); margin-top: 1px; }
.diary-entry-right { font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; padding-top: 2px; color: var(--text-primary); }
.diary-badge { display: inline-block; font-size: 9.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 1px 6px; border-radius: 999px; vertical-align: 1px; margin-left: 5px; }
.diary-badge.ins { background: rgba(255,184,0,.15); color: var(--warning); }
.diary-badge.hypo { background: var(--danger-surface); color: var(--danger); }
.diary-badge.gym { background: var(--accent-surface); color: var(--accent); }
.diary-badge.med { background: rgba(143, 124, 255, .16); color: #a99bff; }
.diary-macros { display: flex; flex-wrap: wrap; gap: 2px 8px; font-size: 10.5px; margin-top: 3px; white-space: nowrap; }
.diary-macros i { font-style: normal; color: var(--text-secondary); }
.diary-macros i::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 4px; vertical-align: 1px; }
.diary-macros .c::before { background: var(--carbs-color); }
.diary-macros .p::before { background: var(--protein-color); }
.diary-macros .f::before { background: var(--fat-color); }
.diary-macros .s::before { background: var(--sat-color); }
.diary-macros .b::before { background: var(--fiber-color); }
.diary-macros .u::before { background: var(--sugars-color); }
.diary-macros .l::before { background: var(--salt-color); }
.diary-macros .u em, .diary-macros .l em { font-style: normal; color: var(--text-dim); }
.diary-macros .b em { font-style: normal; color: var(--text-dim); }
.diary-macros .s em { font-style: normal; color: var(--text-dim); }
.diary-empty { padding: 14px 0 18px; font-size: 13px; color: var(--text-dim); text-align: center; }
.diary-add-btn { display: block; width: 100%; background: var(--accent); color: #000; font-weight: 700; border: 0; border-radius: var(--radius-md); padding: 13px; font-size: 14px; margin: 0 0 20px; cursor: pointer; font-family: inherit; }
.diary-add-btn:active { background: var(--accent-dark); }

/* =============================================
   Início: glucose card, quick actions, report teaser
   ============================================= */
.glucose-card { background: var(--bg-card); border-radius: var(--radius-lg); padding: 12px 14px; }
.glucose-now { font-weight: 700; color: var(--text-primary); }
.glucose-now.low { color: var(--danger); }
.glucose-now.high { color: var(--warning); }
.glucose-now.ok { color: var(--accent); }
.glucose-spark { width: 100%; height: 64px; display: block; margin: 2px 0 8px; }
.glucose-band { fill: rgba(0,230,176,.07); }
.glucose-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.glucose-dot { fill: var(--accent); }
.glucose-dot.low { fill: var(--danger); }
.glucose-dot.high { fill: var(--warning); }
.glucose-axis { font-size: 9px; fill: var(--text-dim); font-family: inherit; }
.home-glucose-tiles { margin-bottom: 0; }
.home-glucose-tiles .report-tile { background: var(--bg-elevated); }
.home-glucose-tiles .report-tile.ok .report-tile-value { color: var(--accent); }
.home-glucose-tiles:empty { display: none; }

/* Treino > Plano */
.plan-options { background: var(--bg-card); border-radius: var(--radius-lg); padding: 4px 6px; margin-bottom: 20px; }

/* =============================================
   Browser chrome that never matched the app: scrollbars and number spinners.
   Both only show on desktop; phones draw neither.
   ============================================= */
* { scrollbar-width: thin; scrollbar-color: #2a2a2a transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 999px; }
*::-webkit-scrollbar-thumb:hover { background: #3a3a3a; }
*::-webkit-scrollbar-button { display: none; width: 0; height: 0; }
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button,
input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Glucose at the time of a meal or a dose */
.glucose-field-source { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--accent); margin-left: 6px; }
.glucose-field-row { display: flex; gap: 8px; align-items: stretch; }
.glucose-field-input { flex: 0 0 84px; text-align: center; }
.trend-chips { flex: 1; display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; min-width: 0; }
.trend-chip { background: var(--bg-input); border: 1px solid #2a2a2a; border-radius: 8px; color: var(--text-secondary); font-size: 16px; line-height: 1; padding: 0; min-width: 0; cursor: pointer; font-family: inherit; }
.trend-chip.selected { background: var(--accent-surface); border-color: var(--accent); color: var(--accent); }
.diary-more { display: block; width: 100%; background: none; border: 0; border-top: 1px solid #1e1e1e; color: var(--accent); font-size: 12.5px; font-weight: 600; padding: 11px 0 9px; text-align: left; cursor: pointer; font-family: inherit; }

/* Início glucose tiles: window chips and the change against the previous window */
.glucose-win { display: flex; gap: 6px; margin: 0 0 10px; }
.glucose-win:empty { display: none; }
.glucose-win-btn { background: var(--bg-elevated); border: 1px solid transparent; border-radius: 999px; color: var(--text-secondary); font-size: 12px; font-weight: 600; padding: 5px 12px; cursor: pointer; font-family: inherit; font-variant-numeric: tabular-nums; }
.glucose-win-btn.active { background: var(--accent-surface); border-color: var(--accent); color: var(--accent); }
.report-tile-delta { font-size: 11px; color: var(--text-dim); margin-top: 4px; font-variant-numeric: tabular-nums; }
.report-tile-delta.good { color: var(--accent); }
.report-tile-delta.bad { color: var(--danger); }

/* =============================================
   Dexcom sensors: the Início card, the log under Perfil, and their sheets
   ============================================= */
.sensor-mono { font-family: var(--font-mono, ui-monospace, monospace); letter-spacing: .02em; }
.sensor-ok { color: var(--accent); }
.sensor-warn { color: var(--warning); }
.sensor-bad { color: var(--danger) !important; }
.sensor-muted { color: var(--text-secondary); }
.sensor-card { display: block; width: 100%; text-align: left; background: var(--bg-card); border: 0; border-radius: var(--radius-lg); padding: 12px 14px; cursor: pointer; font-family: inherit; color: inherit; margin-bottom: 12px; box-sizing: border-box; }
.sensor-card--empty { cursor: default; }
.sensor-card--empty p { margin: 0 0 10px; font-size: 13px; line-height: 1.45; color: var(--text-secondary); }
.sensor-card-body { display: flex; align-items: center; gap: 14px; }
.sensor-card-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.sensor-card-text b { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.sensor-card-text small { font-size: 12.5px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sensor-card-text small.sensor-ok { color: var(--accent); }
.sensor-card-text small.sensor-warn { color: var(--warning); }
.sensor-card-text small.sensor-bad { color: var(--danger); }
.sensor-ring { position: relative; flex: 0 0 60px; width: 60px; height: 60px; }
.sensor-ring svg { width: 60px; height: 60px; display: block; }
.sensor-ring-bg { fill: none; stroke: var(--bg-elevated); stroke-width: 6; }
.sensor-ring-fill { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset .6s ease; }
.sensor-ring.warn .sensor-ring-fill { stroke: var(--warning); }
.sensor-ring.bad .sensor-ring-fill { stroke: var(--danger); }
.sensor-ring.muted .sensor-ring-fill { stroke: var(--text-dim); }
.sensor-ring span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.sensor-ring span b { font-size: 18px; color: var(--text-primary); font-weight: 700; }
.sensor-start-btn { display: block; width: 100%; background: var(--accent); color: #000; font-weight: 700; border: 0; border-radius: var(--radius-md); padding: 11px; font-size: 14px; cursor: pointer; font-family: inherit; }
.sensor-start-btn:active { background: var(--accent-dark); }
.sensor-claim-nudge, .sensor-pending { display: block; width: 100%; text-align: left; background: rgba(255,184,0,.1); border: 1px solid rgba(255,184,0,.3); border-radius: var(--radius-md); color: var(--warning); font-size: 12.5px; font-weight: 600; padding: 9px 12px; cursor: pointer; font-family: inherit; margin: 0 0 12px; box-sizing: border-box; }
.sensor-pending { cursor: default; }
.sensor-badges { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.sensor-badge { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 2px 7px; border-radius: 999px; white-space: nowrap; background: rgba(255,255,255,.08); color: var(--text-secondary); }
.sensor-badge.ok { background: var(--accent-surface); color: var(--accent); }
.sensor-badge.warn { background: rgba(255,184,0,.15); color: var(--warning); }
.sensor-badge.bad { background: var(--danger-surface); color: var(--danger); }

/* The log, drawn in place of Perfil */
.sensors-loading { display: flex; justify-content: center; padding: 60px 0; }
.sensors-back { display: inline-flex; align-items: center; gap: 4px; background: none; border: 0; color: var(--accent); font-size: 14px; font-weight: 600; padding: 4px 0; cursor: pointer; font-family: inherit; }
.sensors-title { font-size: 24px; font-weight: 800; margin: 6px 0 14px; letter-spacing: -.01em; }
.sensor-tiles .report-tile-value { font-size: 18px; }

/* Sheets */
.sensor-hint { font-size: 12px; line-height: 1.45; color: var(--text-dim); margin: 0; }
.sensor-note { margin: 0; font-size: 12.5px; line-height: 1.45; padding: 10px 12px; border-radius: var(--radius-md); background: var(--bg-elevated); color: var(--text-secondary); }
.sensor-note.warn { background: rgba(255,184,0,.1); color: var(--warning); }
#sensor-detail-body > .sensor-note { margin-bottom: 14px; }
.sensor-chip { align-self: flex-start; background: var(--accent-surface); border: 1px solid rgba(0,230,176,.3); border-radius: 999px; color: var(--accent); font-size: 12px; font-weight: 600; padding: 6px 12px; cursor: pointer; font-family: inherit; }
.sensor-choices { display: grid; gap: 8px; }
.sensor-choices--3 { grid-template-columns: repeat(3, 1fr); }
.sensor-choice { background: var(--bg-input); border: 1px solid #2a2a2a; border-radius: var(--radius-md); color: var(--text-primary); font-size: 13.5px; font-weight: 600; padding: 11px 8px; cursor: pointer; font-family: inherit; text-align: center; min-height: 44px; }
.sensor-choices:not(.sensor-choices--3) .sensor-choice { text-align: left; padding: 11px 14px; }
.sensor-choice.selected { background: var(--accent-surface); border-color: var(--accent); color: var(--accent); }

.sensor-detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.sensor-detail-head small { font-size: 12.5px; color: var(--text-secondary); }
.sensor-detail-head .food-log-sheet-title { margin: 2px 0 14px; word-break: break-all; }
.sensor-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 0 0 14px; }
.sensor-fact dt { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--text-dim); }
.sensor-fact dd { margin: 3px 0 0; font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.sensor-link { background: none; border: 0; padding: 0; color: var(--accent); font-size: 12.5px; font-weight: 600; cursor: pointer; font-family: inherit; text-transform: none; letter-spacing: 0; text-align: left; }
.sensor-facts + .sensor-link { display: block; margin: -4px 0 14px; }
.sensor-copy { background: var(--bg-card-hover); border-radius: var(--radius-md); padding: 2px 12px 12px; margin: 0 0 14px; }
.sensor-copy-row { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; border-bottom: 1px solid #262626; padding: 11px 0; cursor: pointer; font-family: inherit; color: var(--text-dim); text-align: left; }
.sensor-copy-row span { flex: 1; font-size: 12.5px; color: var(--text-secondary); }
.sensor-copy-row b { font-size: 14px; color: var(--text-primary); font-weight: 600; }
.sensor-copy-row.empty { cursor: default; }
.sensor-copy-row.empty b { color: var(--text-dim); font-weight: 500; font-size: 12.5px; }
.sensor-copy .sensor-link { margin-top: 12px; }
.sensor-box { background: var(--bg-card-hover); border-radius: var(--radius-md); padding: 12px; margin: 0 0 14px; display: flex; flex-direction: column; gap: 10px; }
.sensor-box > b { font-size: 14px; }
.sensor-box p { margin: 0; font-size: 13px; color: var(--text-secondary); }
.sensor-box-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.sensor-box-head b { font-size: 14px; }
.sensor-summary { margin: 0; max-height: 240px; overflow: auto; background: var(--bg-input); border-radius: var(--radius-md); padding: 10px 12px; font-family: var(--font-mono, ui-monospace, monospace); font-size: 11.5px; line-height: 1.55; color: var(--text-primary); white-space: pre-wrap; }
.sensor-wide { width: 100%; }
.sensor-notes { white-space: pre-wrap; }
#sensor-detail-body > .food-form-save-btn { margin: 0 0 14px; }
.sensor-detail-foot { display: flex; justify-content: space-between; gap: 12px; padding: 4px 0 8px; }

/* The box scanner: a full-screen camera with an aiming frame */
.sensor-scan-btn { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; background: var(--accent-surface); border: 1px solid rgba(0,230,176,.35); border-radius: var(--radius-md); color: var(--accent); font-size: 14px; font-weight: 700; padding: 12px; cursor: pointer; font-family: inherit; min-height: 44px; }
.sensor-scan-result { display: flex; flex-direction: column; gap: 6px; }
.sensor-scan-result:empty { display: none; }
.sensor-scan-raw summary { font-size: 12px; font-weight: 600; color: var(--accent); cursor: pointer; }
.sensor-scan-raw div { margin-top: 6px; font-size: 11px; line-height: 1.5; color: var(--text-secondary); word-break: break-all; }
.sensor-scan { position: fixed; inset: 0; z-index: 3000; background: #000; display: flex; flex-direction: column; }
.sensor-scan video { flex: 1; min-height: 0; width: 100%; object-fit: cover; }
.sensor-scan-frame { position: absolute; top: calc(50% - 50px); left: 50%; width: 220px; height: 220px; transform: translate(-50%, -50%); border: 2px solid rgba(255,255,255,.85); border-radius: 18px; box-shadow: 0 0 0 100vmax rgba(0,0,0,.45); pointer-events: none; }
.sensor-scan-msg { position: absolute; left: 0; right: 0; bottom: calc(96px + env(safe-area-inset-bottom)); padding: 0 32px; text-align: center; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.8); pointer-events: none; }
.sensor-scan-msg p { margin: 0; font-size: 14px; font-weight: 600; }
.sensor-scan-msg small { display: block; margin-top: 6px; font-size: 12px; opacity: .85; }
.sensor-scan-bar { display: flex; gap: 10px; padding: 14px 16px calc(18px + env(safe-area-inset-bottom)); background: #000; }
.sensor-scan-bar button { flex: 1; }

/* Pump: the Bomba card on Início and Perfil › Bomba */
.pump-card { display: flex; flex-direction: column; gap: 10px; cursor: pointer; }
.pump-card .diary-card-title { margin: 0; }
#pump-screen .pump-card { cursor: default; }
.pump-part { display: flex; flex-direction: column; gap: 6px; padding-top: 10px; border-top: 1px solid var(--border-subtle, #1f1f1f); }
.pump-card .diary-card-title + .pump-part { border-top: 0; padding-top: 0; }
.pump-part-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.pump-part-top b { font-size: 14.5px; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.pump-part-top small { font-size: 12.5px; color: var(--text-secondary); text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.pump-sub { font-size: 12px; color: var(--text-dim); }
.pump-bar { height: 6px; background: var(--bg-elevated); border-radius: 3px; overflow: hidden; }
.pump-bar i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.pump-bar.warn i { background: var(--warning); }
.pump-bar.bad i { background: var(--danger); }
.pump-sync { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 10px; border-top: 1px solid var(--border-subtle, #1f1f1f); }
.pump-sync small { font-size: 12px; color: var(--text-dim); }
.pump-sync .sensor-link { min-height: 32px; }
.pump-sync .sensor-link:disabled { opacity: .5; cursor: default; }
.pump-pills { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 3px; }
#pump-screen .diary-card-title .sensor-link { font-size: 12.5px; }
#pump-screen .pump-card { margin-bottom: 12px; }
.pump-settings-link { display: block; margin: 4px 0 24px; min-height: 36px; }
.pump-sites, .pump-models { grid-template-columns: repeat(2, 1fr); }
.pump-sites .sensor-choice, .pump-models .sensor-choice { text-align: center !important; padding: 11px 8px !important; }
.pump-step-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border-subtle, #1f1f1f); }
.pump-step-row b { font-size: 15px; }
.pump-step { display: flex; align-items: center; gap: 6px; }
.pump-step button { width: 40px; height: 40px; border-radius: var(--radius-md); border: 0; background: var(--bg-elevated); color: var(--text-primary); font-size: 18px; cursor: pointer; font-family: inherit; }
.pump-step span { min-width: 62px; text-align: center; font-weight: 700; font-size: 15px; }
.pump-delete { align-self: center; margin-top: 4px; min-height: 36px; }
.pump-fp-remove { align-self: flex-start; min-height: 36px; }

/* Scan checklist: what a box scan filled, ticked off live */
.scan-check { background: var(--bg-elevated); border-radius: var(--radius-md); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.scan-check-head { font-size: 13px; font-weight: 700; display: flex; justify-content: space-between; color: var(--text-primary); }
.scan-check-head span { font-weight: 500; color: var(--text-dim); }
.scan-check-item { display: flex; align-items: center; gap: 10px; font-size: 13.5px; }
.scan-check-item svg { width: 18px; height: 18px; flex: 0 0 18px; }
.scan-check-item.done { color: var(--text-primary); }
.scan-check-item.done svg { color: var(--accent); }
.scan-check-item.todo { color: var(--warning); }
.scan-check-item small { color: var(--text-dim); font-size: 12px; }

/* =============================================
   What a pen dose was for: the "Para" list in the insulin sheet, the
   "Para que foi esta dose?" sheet, undecided doses in the meal sheet, and
   the links in the Diário (dose-link.js)
   ============================================= */
.glucose-win-vs { margin-left: auto; align-self: center; font-size: 11.5px; color: var(--text-dim); white-space: nowrap; }

.dose-purpose { display: flex; flex-direction: column; gap: 6px; }
.dose-purpose-loading, .dose-purpose-empty { font-size: 12.5px; color: var(--text-dim); margin: 0 0 2px; }
.dose-opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 52px; padding: 9px 12px; background: #141414; border: 1px solid #2a2a2a; border-radius: 12px; color: var(--text-primary); font-family: inherit; text-align: left; cursor: pointer; }
.dose-opt-dot { width: 18px; height: 18px; border-radius: 50%; border: 2px solid #555; flex-shrink: 0; box-sizing: border-box; }
.dose-opt-txt { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.dose-opt-txt b { font-size: 14.5px; font-weight: 700; }
.dose-opt-txt small { font-size: 12px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dose-opt-meta { font-size: 11.5px; color: var(--text-secondary); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; line-height: 1.35; }
.dose-opt.sel { border-color: var(--accent); background: var(--accent-surface); }
.dose-opt.sel .dose-opt-dot { border-color: var(--accent); background: radial-gradient(var(--accent) 42%, transparent 48%); }
.dose-opt.pend b { color: var(--warning); }
.dose-opt.pend.sel { border-color: var(--warning); background: rgba(255,184,0,.06); }
.dose-opt.pend.sel .dose-opt-dot { border-color: var(--warning); background: radial-gradient(var(--warning) 42%, transparent 48%); }
.dose-opt.corr.sel { border-color: var(--warning); background: rgba(255,184,0,.06); }
.dose-opt.corr.sel .dose-opt-dot { border-color: var(--warning); background: radial-gradient(var(--warning) 42%, transparent 48%); }
.dose-also { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 4px 2px; font-size: 13.5px; color: var(--text-primary); cursor: pointer; }
.dose-also input { width: 18px; height: 18px; accent-color: var(--warning); margin: 0; }
.dose-resolve-sub { margin: -4px 0 12px; font-size: 13.5px; color: var(--text-secondary); }
.dose-resolve-sub b { color: var(--text-primary); }

.meal-insulin:empty { display: none; }
.meal-insulin { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.meal-insulin-linked, .meal-insulin-pending { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; }
.meal-insulin-linked { background: var(--accent-surface); border: 1px solid rgba(0,230,176,.35); }
.meal-insulin-pending { background: rgba(255,184,0,.06); border: 1px solid var(--warning); }
.meal-insulin-pending .food-form-label { color: var(--warning); }
.meal-insulin-row, .meal-insulin-check span { display: flex; flex-direction: column; gap: 1px; }
.meal-insulin-row b, .meal-insulin-check b { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.meal-insulin-row small, .meal-insulin-check small { font-size: 12px; color: var(--text-secondary); }
.meal-insulin-check { display: flex; align-items: center; gap: 12px; min-height: 44px; cursor: pointer; }
.meal-insulin-check input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; flex-shrink: 0; }

.diary-badge.pend { background: var(--warning); color: #000; }
.diary-badge.corr { background: rgba(255,184,0,.15); color: var(--warning); }
.diary-entry.pending { background: rgba(255,184,0,.05); box-shadow: inset 3px 0 0 var(--warning); padding-left: 8px; margin-left: -8px; border-radius: 6px; }
.diary-entry-main small.diary-link.meal { color: var(--accent); }
.diary-entry-main small.diary-link.pending { color: var(--warning); font-weight: 600; }
.diary-entry-main small.diary-link.auto { color: var(--text-secondary); }

.insulin-entry-purpose { display: inline-block; margin-top: 4px; font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; padding: 1px 6px; border-radius: 999px; }
.insulin-entry-purpose.pend { background: var(--warning); color: #000; }
.insulin-entry-purpose.corr { background: rgba(255,184,0,.15); color: var(--warning); }

/* Insulin vial: its place in the box, and the actions sheet */
.pump-vial { flex-direction: row; align-items: center; gap: 8px; cursor: pointer; }
.pump-vial > .pump-part-top { flex: 1; }
.pump-vial > svg { color: var(--text-dim); flex-shrink: 0; }
.pump-vial-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.pump-vial-sub { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.vial-dots { display: flex; gap: 3px; flex-shrink: 0; }
.vial-dots i { width: 14px; height: 5px; border-radius: 3px; background: var(--bg-elevated); }
.vial-dots i.used { background: var(--text-dim); }
.vial-dots i.cur { background: var(--accent); }
.vial-dots.last i.cur { background: var(--warning); }
.vial-actions { gap: 10px; }
.vial-current { display: flex; flex-direction: column; gap: 4px; padding: 12px 14px; border-radius: var(--radius-md); background: var(--bg-elevated); }
.vial-current b { font-size: 15.5px; color: var(--text-primary); }
.vial-current small { font-size: 12.5px; color: var(--text-secondary); }
.vial-action { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--border-subtle, #2a2a2a); background: var(--bg-elevated); color: var(--text-primary); font-family: inherit; text-align: left; cursor: pointer; }
.vial-action svg { flex-shrink: 0; }
.vial-action span { display: flex; flex-direction: column; gap: 3px; }
.vial-action b { font-size: 15px; }
.vial-action small { font-size: 12.5px; color: var(--text-secondary); }
.vial-action.main { background: var(--accent); border-color: var(--accent); color: #000; }
.vial-action.main small { color: rgba(0, 0, 0, .65); }
.vial-action:disabled { opacity: .5; cursor: default; }
.pump-step-row small { display: block; margin-top: 2px; font-size: 12px; color: var(--text-dim); }

/* ─── Medication (js/medication.js) ─── */
.med-card { padding-bottom: 12px; }
.med-card.folded { padding-bottom: 4px; }
/* the title folds and opens the card */
.med-fold { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; min-height: 40px; margin-bottom: 0; padding: 0; background: none; border: 0; font-family: inherit; text-align: left; cursor: pointer; }
.med-fold-count { display: inline-flex; align-items: center; gap: 8px; flex: none; text-transform: none; letter-spacing: 0; }
.med-fold-count i { font-style: normal; font-size: 11px; color: var(--text-dim); }
.med-fold .med-all { color: var(--accent); font-weight: 700; }
.med-ticks { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
/* one dose: a full-width line */
.med-tick { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 6px 0 10px; border: 1px solid rgba(255,255,255,.1); border-radius: 12px; background: var(--bg-input); color: inherit; font-family: inherit; text-align: left; cursor: pointer; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; transition: border-color .15s, background .15s; }
.med-tick-box { flex: 0 0 auto; width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--text-dim); display: grid; place-items: center; color: transparent; transition: background .15s, border-color .15s; }
.med-tick-box svg { width: 13px; height: 13px; }
.med-tick-name { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 600; color: var(--text-primary); }
.med-tick > small { flex: none; padding-right: 6px; font-size: 12.5px; color: var(--text-secondary); white-space: nowrap; }
.med-tick.on { border-color: var(--accent); background: rgba(0, 230, 176, .08); }
.med-tick.on .med-tick-box { background: var(--accent); border-color: var(--accent); color: #000; }
.med-tick.on .med-tick-name { color: var(--accent); }
.med-tick:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.med-time { flex: 0 0 auto; display: inline-flex; align-items: center; min-height: 34px; padding: 0 8px; border: 0; border-radius: 8px; background: none; color: var(--accent); font-family: inherit; font-size: 12.5px; font-weight: 600; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; cursor: pointer; text-decoration: underline dotted; text-underline-offset: 3px; }
.med-day-fixed { display: flex; align-items: center; color: var(--text-secondary); }
.med-day-close { width: 100%; margin-top: 8px; }
.med-dose-hint { margin: -8px 2px 2px; }
.med-hist-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.med-hist-name { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.med-hist-name .sensors-title { margin: 0; }
.med-hist-name small { font-size: 12.5px; color: var(--text-secondary); }
.med-hist-edit { flex: 0 0 auto; min-height: 36px; }
.med-hist-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.med-hist-stats > div { background: var(--bg-card, #111); border: 1px solid var(--border-subtle, #1f1f1f); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 3px; }
.med-hist-stats b { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.med-hist-stats small { font-size: 11.5px; color: var(--text-dim); }
.med-cal-month { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.med-cal-month b { font-size: 14px; }
.med-cal-nav { width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 10px; background: none; color: var(--text-primary); cursor: pointer; }
.med-cal-nav:disabled { color: var(--text-dim); opacity: .4; cursor: default; }
.med-cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; text-align: center; }
.med-cal-wd { font-size: 10.5px; font-weight: 600; color: var(--text-dim); padding-bottom: 4px; }
.med-cal-day { aspect-ratio: 1; max-width: 100%; display: grid; place-items: center; border: 0; border-radius: 9px; background: none; color: var(--text-secondary); font-family: inherit; font-size: 13px; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums; padding: 0; }
button.med-cal-day { cursor: pointer; }
.med-cal-day.taken { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--accent); font-weight: 700; }
.med-cal-day.part { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 22%, transparent) 50%, transparent 50%); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--danger) 55%, transparent); color: var(--text-primary); }
.med-cal-day.missed { box-shadow: inset 0 0 0 1.5px var(--danger); color: var(--danger); }
.med-cal-day.future { color: var(--text-dim); opacity: .5; }
.med-cal-day.today { outline: 1.5px solid var(--text-primary); outline-offset: 1px; }
.med-cal-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 12px; font-size: 11.5px; color: var(--text-dim); }
.med-cal-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.med-cal-legend i.taken { background: color-mix(in srgb, var(--accent) 40%, transparent); }
.med-cal-legend i.part { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 45%, transparent) 50%, transparent 50%); box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--danger) 55%, transparent); }
.med-cal-legend i.missed { box-shadow: inset 0 0 0 1.5px var(--danger); }
.med-recent { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 44px; padding: 0; border: 0; border-top: 1px solid var(--border-subtle, #1f1f1f); background: none; color: var(--text-primary); font-family: inherit; font-size: 13.5px; font-weight: 500; text-align: left; cursor: pointer; }
.diary-card-title + .med-recent { border-top: 0; }
.med-recent b { font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.med-recent b.med-missed { color: var(--danger); }
.med-missed { color: var(--danger); }
.med-hint { display: block; font-size: 12px; color: var(--text-dim); margin: 4px 0 4px; }
.med-row.removed b { color: var(--text-secondary); }
.med-adh { display: flex; flex-direction: column; align-items: flex-end; font-weight: 700; }
.med-adh small { font-size: 11px; font-weight: 500; color: var(--text-dim); }
.med-rule { margin: -4px 4px 14px; }
.med-choices--2 { grid-template-columns: repeat(2, 1fr); }
.med-choices--4 { grid-template-columns: repeat(4, 1fr); }
.sensor-choices.med-choices--2 .sensor-choice, .sensor-choices.med-choices--4 .sensor-choice { text-align: center; padding: 11px 4px; }
.med-week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-top: 8px; }
.med-week .sensor-choice { padding: 10px 0; font-size: 12.5px; min-height: 40px; }
.med-optional { text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text-dim); }
.med-sheet-link { align-self: center; margin-top: 4px; min-height: 36px; }
.med-sheet-hint { text-align: center; margin-top: -10px; }

/* ─── Saúde card and exams (js/exams.js) ─── */
.profile-info-card[hidden], .info-row[hidden] { display: none; }
.profile-card-label { padding: 12px 0 2px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); font-weight: 600; }
.exam-due { color: var(--warning); }
.exam-group { padding: 10px 0; border-top: 1px solid var(--border-subtle, #1f1f1f); }
.diary-card-title + .exam-group { border-top: 0; }
.exam-group-top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.exam-group-top b { font-size: 14.5px; font-weight: 600; color: var(--text-primary); }
.exam-group-top small { font-size: 12.5px; color: var(--text-secondary); white-space: nowrap; }
.exam-group.overdue .exam-group-top small, .exam-group.overdue .exam-interval-link { color: var(--warning); }
.exam-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.exam-chip { background: var(--bg-input); border: 1px solid #2a2a2a; border-radius: 999px; color: var(--text-secondary); font-family: inherit; font-size: 12px; font-weight: 600; padding: 8px 11px; min-height: 32px; cursor: pointer; }
.exam-chip.last { border-color: var(--accent); color: var(--accent); background: var(--accent-surface); }
.exam-interval-link { display: block; margin-top: 8px; min-height: 28px; color: var(--text-dim); font-weight: 500; }
.exam-title { display: flex; flex-direction: column; gap: 2px; }
.exam-title span { font-size: 14px; font-weight: 500; color: var(--text-secondary); letter-spacing: 0; }
.exam-card { padding-bottom: 14px; }
.exam-field { padding: 8px 0; }
.exam-field > small { display: block; font-size: 11.5px; letter-spacing: .05em; text-transform: uppercase; color: var(--text-dim); font-weight: 600; margin-bottom: 4px; }
.exam-field p { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text-primary); }
.exam-conclusion { white-space: pre-wrap; }
.exam-dim { color: var(--text-dim) !important; }
.exam-file { display: flex; align-items: center; gap: 10px; padding: 8px 0; color: inherit; text-decoration: none; border-top: 1px solid var(--border-subtle, #1f1f1f); }
.exam-field > small + .exam-file { border-top: 0; }
.exam-file.missing { opacity: .6; }
.exam-file-thumb { width: 40px; height: 40px; object-fit: cover; border-radius: 8px; flex: 0 0 auto; background: var(--bg-input); }
.exam-file-icon { width: 40px; height: 40px; border-radius: 8px; flex: 0 0 auto; display: grid; place-items: center; background: var(--bg-input); color: var(--accent); }
.exam-file-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.exam-file-text b { font-size: 13.5px; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.exam-file-text small { font-size: 12px; color: var(--text-dim); }
.exam-add-file { display: inline-flex; align-items: center; min-height: 36px; margin-top: 4px; }
.exam-upload { display: block; font-size: 12px; color: var(--text-secondary); }
.exam-upload:empty { display: none; }
.exam-edit-btn { width: 100%; margin-top: 8px; }
.exam-prev { display: block; width: 100%; text-align: left; border: 0; font-family: inherit; color: inherit; cursor: pointer; padding-bottom: 12px; }
.exam-prev p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-secondary); white-space: pre-wrap; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.sensor-choices.exam-types { grid-template-columns: repeat(2, 1fr); }
.sensor-choices.exam-types .sensor-choice { text-align: center; padding: 11px 6px; }
.exam-types + .food-form-input { margin-top: 8px; }
.exam-textarea { resize: vertical; min-height: 96px; line-height: 1.45; font-family: inherit; }
.exam-form-file { display: flex; align-items: center; gap: 10px; }
.exam-form-file .exam-file-icon { width: 32px; height: 32px; }
.exam-form-file-x { background: none; border: 0; color: var(--text-dim); width: 40px; height: 40px; display: grid; place-items: center; cursor: pointer; }
.exam-group.overdue .exam-chip.last { border-color: var(--warning); color: var(--warning); background: rgba(255,184,0,.1); }

/* Lab results: Perfil › Saúde › Análises */
.lab-seg { display: flex; gap: 4px; padding: 4px; margin: 4px 0 12px; background: var(--bg-input); border-radius: 12px; }
.lab-seg button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: none; color: var(--text-secondary); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.lab-seg button.on { background: var(--accent-surface); color: var(--accent); }
.lab-group-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); margin: 14px 0 2px; }
.lab-group-label:first-of-type { margin-top: 4px; }
.lab-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 8px 0; background: none; border: 0; border-bottom: 1px solid rgba(255,255,255,.06); color: inherit; font-family: inherit; text-align: left; cursor: pointer; }
.lab-row:last-child { border-bottom: 0; }
.lab-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lab-row-main b { font-size: 14px; font-weight: 600; }
.lab-row-main small { font-size: 12px; color: var(--text-dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lab-row-value { font-size: 16px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; text-align: right; }
.lab-row-value small { font-size: 11px; font-weight: 500; color: var(--text-dim); margin-left: 3px; }
.lab-row.out .lab-row-value { color: var(--warning); }
.lab-row-value em { display: block; font-style: normal; font-size: 10.5px; font-weight: 500; color: var(--text-dim); text-align: right; }
.lab-spark { width: 64px; height: 22px; flex: none; }
.lab-spark polyline { fill: none; stroke: var(--text-dim); stroke-width: 1.5; stroke-linejoin: round; }
.lab-spark circle { fill: var(--text-secondary); }
.lab-row.out .lab-spark circle { fill: var(--warning); }
.lab-now { font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.lab-now b { font-size: 28px; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }
.lab-now.out b, .lab-now span { color: var(--warning); }
.lab-now span.ok { color: var(--accent); }
.lab-chart { display: block; width: 100%; height: auto; overflow: visible; }
/* the label over a point, on hover or tap */
.lab-chart-wrap { position: relative; cursor: crosshair; -webkit-tap-highlight-color: transparent; }
.lab-ring { fill: none; stroke: var(--accent); stroke-width: 1.5; pointer-events: none; }
.lab-ring.out { stroke: var(--warning); }
.lab-tip { position: absolute; transform: translate(-50%, calc(-100% - 12px)); padding: 6px 9px; border-radius: 8px; background: var(--bg-input); border: 1px solid rgba(255,255,255,.12); box-shadow: 0 4px 14px rgba(0,0,0,.4); font-size: 12px; color: var(--text-secondary); white-space: nowrap; pointer-events: none; z-index: 2; }
.lab-tip.below { transform: translate(-50%, 12px); }
.lab-tip b { color: var(--accent); font-weight: 700; }
.lab-tip.out b { color: var(--warning); }
.lab-tip small { display: block; font-size: 11px; color: var(--text-dim); }
.lab-band { fill: var(--accent); opacity: .1; }
.lab-target { stroke: var(--text-secondary); stroke-width: 1.2; stroke-dasharray: 4 4; }
.lab-med { stroke: #8f7cff; stroke-width: 1; stroke-dasharray: 2 3; }
.lab-med-label { fill: #a99bff; font-size: 9.5px; }
.lab-axis { fill: var(--text-dim); font-size: 10px; font-variant-numeric: tabular-nums; }
.lab-axis.lab-band-num { fill: var(--accent); font-weight: 600; }
.lab-axis.lab-target-num { fill: var(--text-secondary); font-weight: 600; }
.lab-grid { stroke: rgba(255,255,255,.06); stroke-width: 1; }
.lab-line { fill: none; stroke: var(--text-secondary); stroke-width: 1.8; stroke-linejoin: round; }
.lab-dot { fill: var(--accent); stroke: var(--bg-card, #111); stroke-width: 2; }
.lab-dot.out { fill: var(--warning); }
.lab-dot.open { fill: var(--bg-card, #111); stroke: var(--accent); }
.lab-dot.open.out { stroke: var(--warning); }
.lab-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 11.5px; color: var(--text-dim); }
.lab-legend span { display: inline-flex; align-items: center; gap: 6px; }
.lab-key { display: inline-block; width: 14px; height: 10px; }
.lab-key.band { background: var(--accent); opacity: .25; border-radius: 2px; }
.lab-key.target { height: 0; border-top: 1.5px dashed var(--text-secondary); }
.lab-key.med { width: 0; height: 12px; border-left: 1.5px dashed #8f7cff; }
.lab-target-text { margin: 0 0 6px; font-size: 13.5px; color: var(--text-secondary); }
.lab-target-text b { color: var(--text-primary); }
.lab-chip-group { margin-top: 8px; }
.lab-chip-group small { display: block; font-size: 11px; color: var(--text-dim); margin-bottom: 5px; }
.lab-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.lab-form-row { padding: 10px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.lab-form-row-top { display: flex; align-items: center; justify-content: space-between; min-height: 32px; font-size: 14px; }
.lab-form-row-top .exam-form-file-x { width: 32px; height: 32px; }
.lab-form-fields { display: grid; grid-template-columns: 1fr 1fr 1.1fr; gap: 6px; }
.lab-form-fields .food-form-input { min-width: 0; }
.lab-form-row.bad .lab-form-fields input:first-child { border-color: #FF6B6B; }
.lab-unit { appearance: auto; padding-right: 4px; }
.lab-conv { margin-top: 6px; font-size: 12.5px; font-weight: 600; color: var(--accent); font-variant-numeric: tabular-nums; }
.lab-conv.warn { color: var(--warning); font-weight: 500; }
.lab-typical { margin-top: 4px; font-size: 11.5px; color: var(--text-dim); }
/* Reading the lab's PDF into the form */
.lab-pdf-btn { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; margin-bottom: 6px; border: 1px dashed var(--accent); border-radius: 12px; background: var(--accent-surface); color: var(--accent); font-size: 14px; font-weight: 600; cursor: pointer; }
.lab-pdf-btn.busy { opacity: .7; cursor: progress; }
.lab-pdf-banner { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; padding: 10px 12px; border-radius: 10px; background: var(--bg-input); font-size: 12.5px; line-height: 1.45; color: var(--text-secondary); }
.lab-pdf-banner b { color: var(--text-primary); font-size: 12px; overflow-wrap: anywhere; }
.lab-pdf-banner.warn { border-left: 3px solid var(--warning); }
.lab-form-name { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 6px; min-width: 0; }
.lab-form-name small { flex-basis: 100%; font-size: 11px; color: var(--text-dim); }
.lab-pdf-tag { font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 1px 5px; border-radius: 4px; color: var(--accent); background: var(--accent-surface); }
.lab-form-row.check { border-left: 3px solid var(--warning); padding-left: 8px; }
.lab-pdf-extra { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 13px; color: var(--text-secondary); }
.lab-pdf-extra .sensor-link { flex: none; min-height: 40px; white-space: nowrap; }
.lab-new-tag { font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 1px 5px; border-radius: 4px; color: var(--warning); background: rgba(255, 184, 0, .12); }
/* the test's name: tap to pick another test */
.lab-name-pick { display: inline-flex; align-items: baseline; gap: 4px; padding: 0 0 1px; min-height: 28px; background: none; border: 0; border-bottom: 1px dashed var(--accent); color: var(--text-primary); font-family: inherit; font-size: 14px; font-weight: 700; text-align: left; cursor: pointer; }
.lab-name-pick span { color: var(--accent); font-size: 11px; }
.lab-noref::placeholder { font-size: 11.5px; }
/* the form's rows under their groups */
.lab-fg-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 40px; margin-top: 12px; padding: 6px 0; background: none; border: 0; border-bottom: 1px solid rgba(255,255,255,.14); color: var(--text-secondary); font-family: inherit; text-align: left; cursor: pointer; }
.lab-fg-head:disabled { cursor: default; opacity: 1; }
.lab-fg-head b { font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.lab-fg-head span { flex: none; font-size: 12px; color: var(--text-dim); }
.lab-fg-head em { font-style: normal; font-weight: 600; color: var(--warning); background: rgba(255, 184, 0, .12); padding: 2px 7px; border-radius: 10px; }
.lab-fg-head i { font-style: normal; margin-left: 8px; }
.lab-fg-closed { display: flex; justify-content: space-between; gap: 10px; width: 100%; min-height: 40px; padding: 8px 0; background: none; border: 0; border-bottom: 1px solid rgba(255,255,255,.06); color: var(--text-dim); font-family: inherit; font-size: 12.5px; text-align: left; cursor: pointer; }
.lab-fg-closed span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-secondary); }
.lab-fg-closed b { flex: none; font-weight: 600; color: var(--accent); }
.lab-jump { display: flex; gap: 6px; overflow-x: auto; margin: 8px 0 2px; padding-bottom: 4px; scrollbar-width: none; }
.lab-jump button { flex: none; min-height: 32px; padding: 0 11px; border: 0; border-radius: 16px; background: var(--bg-input); color: var(--text-secondary); font-family: inherit; font-size: 12px; cursor: pointer; }
.lab-jump button.warn { color: var(--warning); }
.lab-lines-hint { margin: -4px 0 4px; }
.lab-search { margin: 2px 0 6px; }
.lab-search-none { margin: 10px 0 4px; }
.lab-tgroup[hidden], .lab-row[hidden] { display: none; }
.lab-prev-ref { font-size: 12px; padding: 0; min-height: 32px; text-align: left; }
.lab-differ .sensor-link { font-size: inherit; padding: 0; min-height: 0; margin-left: 4px; }
/* a report's targets by cardiovascular risk */
.lab-targets { margin-top: 8px; }
.lab-targets small { display: block; font-size: 11.5px; color: var(--text-dim); }
.lab-targets div { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 2px; }
.lab-targets button { min-height: 36px; padding: 0 11px; border: 1px solid rgba(255,255,255,.12); border-radius: 18px; background: var(--bg-input); color: var(--text-secondary); font-family: inherit; font-size: 12.5px; cursor: pointer; }
.lab-targets button b { color: var(--text-primary); font-weight: 700; }
.lab-targets button.on { border-color: var(--accent); color: var(--accent); background: rgba(0, 230, 176, .1); }
.lab-targets button.on b { color: var(--accent); }
.lab-targets .lab-targets-set { color: var(--accent); }
.lab-chip-more { border-style: dashed; color: var(--accent); }
/* Which test is it: the picker sheet */
.lab-pick-printed { margin: -4px 0 10px; font-size: 13px; color: var(--text-secondary); overflow-wrap: anywhere; }
.lab-pick-printed b { color: var(--text-primary); }
.lab-pick-q { width: 100%; margin-bottom: 6px; }
.lab-pick-list { max-height: 55vh; overflow-y: auto; overscroll-behavior: contain; }
.lab-pick-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; min-height: 44px; padding: 8px 2px; background: none; border: 0; border-bottom: 1px solid rgba(255,255,255,.06); color: var(--text-primary); font-family: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.lab-pick-item small { flex: none; max-width: 45%; font-size: 11.5px; color: var(--text-dim); text-align: right; overflow-wrap: anywhere; }
.lab-pick-item.on { color: var(--accent); font-weight: 600; }
.lab-pick-item:disabled { opacity: .45; cursor: default; }
.lab-pick-actions { margin-top: 10px; border-top: 1px solid rgba(255,255,255,.12); }
.lab-pick-own span, .lab-pick-skip span { color: var(--accent); font-weight: 600; }
.lab-pick-q[hidden] { display: none; }
.lab-own-box { padding: 4px 0 2px; }
.lab-own-box .sensor-hint { display: block; margin-top: 6px; }
.lab-rename-link { display: block; margin: -6px 0 10px; padding: 0; min-height: 32px; font-size: 13px; }
.lab-pick-skip span { color: var(--text-secondary); }
.lab-sources { margin-top: 10px; font-size: 11px; line-height: 1.45; }
/* Names on the reports */
.lab-names-link { display: block; margin: 14px auto 10px; }
.lab-names-hint { margin: 0 0 12px; }
.lab-name-row { border-bottom: 1px solid rgba(255,255,255,.06); }
.lab-name-row:last-child { border-bottom: 0; }
.lab-name-row .lab-row { border-bottom: 0; }
.lab-name-change { flex: none; font-size: 12.5px; font-weight: 600; color: var(--accent); }
.lab-name-warn { color: var(--warning) !important; }
.lab-suggest { display: block; margin: -4px 0 8px; font-size: 12.5px; }
.lab-pdf-extra b { color: var(--text-primary); font-weight: 600; }
.lab-pdf-extra small { color: var(--text-dim); }
.lab-notes { min-height: 60px; }
.lab-group-label { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.lab-group-label .lab-check-link { font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.lab-group-label.overdue .lab-check-link { color: var(--warning); }
.lab-none { font-size: 12.5px; color: var(--text-dim); padding: 4px 0 10px; }

/* ── Nutrição → Tendências ───────────────────────────────────────────────── */
.trends-periods { display: flex; gap: 2px; padding: 3px; margin: 0 0 12px; background: var(--bg-card); border-radius: 10px; }
.trends-period { flex: 1; min-height: 36px; padding: 0; border: 0; border-radius: 8px; background: none; color: var(--text-dim); font-family: inherit; font-size: 12.5px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.trends-period.active { background: rgba(0, 230, 176, .12); color: var(--accent); }
.trends-card { padding-bottom: 12px; }
.trends-card-head { font-size: 12px; color: var(--text-dim); margin: 0 0 4px; }
.trend-row { display: grid; grid-template-columns: minmax(0, 92px) minmax(0, 1fr) auto; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 6px 0; border: 0; border-bottom: 1px solid rgba(255,255,255,.06); background: none; color: inherit; font-family: inherit; text-align: left; cursor: pointer; }
.trend-row:last-of-type { border-bottom: 0; }
.trend-name b { display: block; font-size: 13.5px; font-weight: 600; color: var(--text-primary); }
.trend-name small { display: block; font-size: 11px; color: var(--text-dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trend-spark { width: 100%; height: 32px; }
.trend-spark-target { stroke: var(--text-dim); stroke-width: .8; stroke-dasharray: 2 2; vector-effect: non-scaling-stroke; }
.trend-val { display: grid; justify-items: end; gap: 1px; min-width: 64px; font-variant-numeric: tabular-nums; }
.trend-val b { font-size: 14px; font-weight: 700; color: var(--text-primary); white-space: nowrap; }
.trend-val em { font-style: normal; font-weight: 500; font-size: 12px; color: var(--text-dim); }
.trend-ch { font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.trend-ch.good { color: var(--accent); }
.trend-ch.bad { color: #FF8A65; }
.trend-ch.same { color: var(--text-dim); }
.trend-vs { font-weight: 400; color: var(--text-dim); }
.trends-note { display: block; margin-top: 8px; font-size: 11.5px; color: var(--text-dim); }
.trends-back { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; margin: 0 0 6px; padding: 0; border: 0; background: none; color: var(--text-primary); font-family: inherit; font-size: 16px; font-weight: 700; cursor: pointer; }
.trends-back span { font-size: 22px; color: var(--text-dim); line-height: 1; }
.trends-big { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 6px; }
.trends-big b { font-size: 26px; font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.trends-big small:not(.trend-ch) { font-size: 12px; color: var(--text-dim); }
.trends-chart { display: block; width: 100%; height: auto; overflow: visible; }
.trends-grid { stroke: rgba(255,255,255,.06); }
.trends-axis { fill: var(--text-dim); font-size: 9px; font-variant-numeric: tabular-nums; }
.trends-bar { opacity: .7; }
.trends-bar.picked { opacity: 1; }
.trends-bar.today { opacity: .3; }
.trends-target { stroke: var(--text-dim); stroke-width: 1; stroke-dasharray: 3 2; fill: none; }
.trends-avg { stroke: #fff; stroke-width: 1.6; fill: none; stroke-linejoin: round; }
.trends-hit { fill: transparent; cursor: pointer; }
.trends-mix-num { fill: #000; font-size: 9px; font-weight: 700; }
.trends-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 11px; color: var(--text-dim); }
.trends-legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.trends-legend i.avg { background: #fff; }
.trends-legend i.tg { background: repeating-linear-gradient(90deg, var(--text-dim) 0 3px, transparent 3px 5px); }
.trends-tip { display: grid; gap: 2px; margin-top: 10px; padding: 9px 12px; border-radius: 10px; background: var(--bg-input); border: 1px solid rgba(255,255,255,.08); font-size: 12px; color: var(--text-dim); }
.trends-tip b { font-size: 13px; color: var(--text-primary); }
.trends-tip .sensor-link { justify-self: start; min-height: 32px; padding: 0; font-size: 13px; }
.trends-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.trends-stats div { display: grid; padding: 10px; border-radius: 12px; background: var(--bg-card); }
.trends-stats b { font-size: 16px; font-variant-numeric: tabular-nums; }
.trends-stats small { font-size: 11px; color: var(--text-dim); }

/* ─── Início (js/home-renderer.js): the day's card, then three strips and a footer ─── */
#home-meds:empty, #home-glucose:empty, #home-equipment:empty { display: none; }
.home-strip { padding: 10px 14px 12px; margin-bottom: 0; }
.home-strip-head, .home-day-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; width: 100%; margin: 0; padding: 0; border: 0; background: none; font-family: inherit; text-align: left; color: inherit; }
.home-strip-head > b, .home-day-head > b { font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-dim); font-weight: 600; flex: none; }
.home-strip-head > span, .home-day-head > span { font-size: 12px; color: var(--text-dim); text-align: right; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.home-strip-head .sensor-link { font-size: 12px; flex: none; }
.home-day-head { cursor: pointer; min-height: 30px; }
.home-day-head > span i { font-style: normal; color: var(--accent); font-weight: 700; margin-left: 3px; }
/* the day */
.home-day { padding: 10px 14px 6px; margin-bottom: 0; }
.home-hero { display: flex; align-items: flex-end; gap: 10px; margin: 4px 0 14px; }
.home-hero-main { display: flex; align-items: baseline; gap: 7px; min-width: 0; }
.home-hero-main b { font-size: 36px; font-weight: 700; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.home-hero-main.over b { color: var(--warning); }
.home-hero-main span { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.home-hero-side { margin-left: auto; flex: none; text-align: right; font-size: 11.5px; line-height: 1.4; color: var(--text-dim); font-variant-numeric: tabular-nums; }
/* Macro rows (js/macro-bars.js), the same on Hoje and Registo: the empty track is a
   dark tint of the macro's colour, the fill brightens toward its end with a soft
   glow, and a part (sugars, saturated fat) is a deeper shade from the left with a
   thin gap where it ends. The small line under a bar gives that part's grams. */
.mrows { display: flex; flex-direction: column; gap: 11px; }
.mrow { display: grid; grid-template-columns: 62px 1fr auto; column-gap: 12px; row-gap: 5px; align-items: center; }
.mrow-l { font-size: 12.5px; color: var(--text-secondary); white-space: nowrap; }
.mrow-t { position: relative; height: 8px; border-radius: 99px; background: color-mix(in srgb, var(--c) 16%, transparent); }
.mrow-t i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 99px; transition: width 300ms ease; }
.mrow-t i:first-child { background: linear-gradient(90deg, color-mix(in srgb, var(--c) 55%, var(--bg-card)), var(--c)); box-shadow: 0 0 10px color-mix(in srgb, var(--c) 45%, transparent); }
.mrow-t i.part { z-index: 1; box-shadow: 2px 0 0 var(--bg-card); }
.mrow-v { min-width: 64px; text-align: right; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; color: var(--text-primary); }
.mrow-v b { font-weight: 700; }
.mrow-v small { font-size: 11.5px; color: var(--text-muted, #6f6f6f); }
.mrow.is-over > .mrow-v b, .mrow.is-over > .mrow-v small { color: var(--warning); }
.mrow.is-done > .mrow-v b { color: var(--c); }
.mrow-cap { grid-column: 2 / 4; display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; min-width: 0; font-size: 11.5px; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.mrow-cap i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.mrow-cap b { font-weight: 600; color: var(--text-primary); }
.mrow-cap b.warn { color: var(--warning); }
.mrow-cap .dim { color: var(--text-muted, #6f6f6f); }
.mrow-cap .note { flex-basis: 100%; }  /* "3 de 5 refeições com …" on a line of its own */
@media (prefers-reduced-motion: reduce) { .mrow-t i { transition: none; } }
.home-acts { display: grid; grid-template-columns: 1.5fr 1.15fr .85fr; gap: 8px; margin: 14px 0 2px; }
.home-acts button { min-height: 40px; padding: 0 8px; border: 1px solid var(--border-subtle, #2a2a2a); border-radius: 11px; background: var(--bg-elevated); color: var(--text-primary); font-family: inherit; font-size: 13px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.home-acts button.main { background: var(--accent); border-color: var(--accent); color: #000; }
.home-acts button.h { color: var(--danger); }
.home-acts button:active { transform: scale(.97); }
.home-tl { margin-top: 6px; }
.home-tl .diary-entry { padding: 9px 0; gap: 8px; align-items: baseline; }
.home-tl .diary-entry:last-of-type { border-bottom: 0; }
.home-entry-time { flex: 0 0 38px; font-size: 11.5px; color: var(--text-dim); font-variant-numeric: tabular-nums; }
.home-entry-main { flex: 1; min-width: 0; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--text-primary); }
.home-entry-main b { font-weight: 600; }
.home-entry-main small { font-size: 12px; color: var(--text-dim); }
.home-entry-right { flex: none; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text-primary); }
.home-entry-right.ins { color: var(--warning); }
.home-entry-right.hypo { color: var(--danger); }
.home-tl .diary-more { padding: 10px 0 8px; }
.home-tl .diary-empty { padding: 10px 0 12px; text-align: left; }
/* medication chips */
.med-strip .med-fold { min-height: 30px; }
.med-strip.folded { padding-bottom: 10px; }
.med-chips { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.med-chip { min-height: 42px; padding: 0 12px 0 11px; gap: 10px; }
.med-chip .med-tick-box { width: 18px; height: 18px; border-radius: 50%; border-width: 1.5px; }
.med-chip .med-tick-box svg { width: 10px; height: 10px; }
.med-chip b { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; font-size: 13.5px; font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.med-chip.on b { color: var(--accent); }
.med-chip small { flex: none; padding: 0; font-size: 12.5px; color: var(--text-dim); white-space: nowrap; }
.med-chip.on small { color: var(--accent); opacity: .75; }
/* glucose */
.home-gl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: center; width: 100%; margin: 8px 0 0; padding: 0; border: 0; background: none; color: inherit; font-family: inherit; text-align: left; cursor: pointer; }
.home-glucose .home-strip-head { cursor: pointer; }
.home-gl-win { margin: 12px 0 8px; }
.home-gl-win:empty + .home-glucose-tiles { margin-top: 12px; }
.home-gl > b { font-size: 30px; font-weight: 700; letter-spacing: -.02em; line-height: 1; font-variant-numeric: tabular-nums; white-space: nowrap; }
.home-gl > b i { font-style: normal; font-size: 18px; margin-left: 2px; }
.home-gl svg { width: 100%; height: 30px; display: block; }
.glucose-mini-line { fill: none; stroke: var(--text-primary); stroke-width: 1.6; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.glucose-detail-sync { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 12px; font-size: 12px; color: var(--text-dim); }
.glucose-detail-sync .sensor-link:disabled { opacity: .5; }
/* equipment */
.home-eq-rows { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; }
.home-eq-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 10px; align-items: center; min-height: 32px; font-size: 12px; cursor: pointer; }
.home-eq-row .n { color: var(--text-primary); font-weight: 600; font-size: 12.5px; }
.home-eq-row .t { height: 4px; border-radius: 2px; background: var(--bg-elevated); overflow: hidden; }
.home-eq-row .t i { display: block; height: 100%; border-radius: 2px; background: var(--accent); }
.home-eq-row.warn .t i { background: var(--warning); }
.home-eq-row.bad .t i { background: var(--danger); }
.home-eq-row.muted .t i { background: var(--text-dim); }
.home-eq-row .w { color: var(--text-dim); white-space: nowrap; font-variant-numeric: tabular-nums; max-width: 60vw; overflow: hidden; text-overflow: ellipsis; }
.home-eq-row.warn .w { color: var(--warning); }
.home-eq-row.bad .w { color: var(--danger); }
.home-eq .sensor-claim-nudge { margin: 8px 0 0; }
/* footer */
.home-foot { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 40px; margin: 0 0 4px; padding: 0 14px; border: 0; border-radius: var(--radius-lg); background: none; color: var(--text-dim); font-family: inherit; font-size: 12.5px; cursor: pointer; }
.home-foot i { font-style: normal; color: var(--accent); font-size: 16px; font-weight: 700; }

/* =============================================
   Estimar (js/meal-estimate.js)
   ============================================= */
.est-desc {
    min-height: 64px;
    resize: none;
    font-family: inherit;
    line-height: 1.4;
    overflow-y: auto;
}
.est-photos { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.est-thumb {
    position: relative;
    width: 58px; height: 58px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #2a2a2a;
    background: #1a1a1a;
}
.est-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.est-thumb button {
    position: absolute; top: 3px; right: 3px;
    width: 22px; height: 22px;
    border-radius: 50%;
    border: none;
    background: rgba(0, 0, 0, 0.72);
    color: #fff;
    font-size: 15px; line-height: 1;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
}
.est-acts { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; margin-top: 8px; }
.est-acts.three { grid-template-columns: 1.25fr 1fr 1fr; }
.est-acts.three .est-btn { gap: 6px; padding: 0 6px; font-size: 13.5px; }
.est-btn {
    display: flex; align-items: center; justify-content: center; gap: 7px;
    min-height: 42px;
    border-radius: 12px;
    border: 1px solid #2a2a2a;
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    transition: opacity 150ms, transform 100ms;
}
.est-btn:active:not(:disabled) { transform: scale(0.98); }
.est-btn.est-run { background: var(--accent); border-color: var(--accent); color: #000; }
.est-btn:disabled { opacity: 0.45; cursor: default; }
.est-btn.busy { opacity: 0.85; }
.est-btn.busy svg { animation: est-spin 1.2s linear infinite; }
@keyframes est-spin { to { transform: rotate(360deg); } }

.est-result { margin-top: 10px; }
.est-card {
    background: #141414;
    border: 1px solid #262626;
    border-radius: 12px;
    padding: 4px 12px 10px;
}
.est-item { padding: 8px 0; border-bottom: 1px solid #222; }
.est-item-head { display: flex; align-items: flex-start; gap: 6px; }
.est-item-name { flex: 1 1 auto; min-width: 0; font-size: 14px; line-height: 1.35; }
.est-del {
    flex: none;
    width: 32px; height: 32px; margin: -6px -8px -6px 0;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; border-radius: 8px;
    color: var(--text-dim);
    font-family: inherit; font-size: 20px; line-height: 1;
    cursor: pointer;
}
.est-qty {
    display: inline-flex; align-items: center; gap: 4px;
    padding: 1px 6px; margin: -1px 0;
    background: none; border: 1px solid #3a3a3a; border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
    cursor: pointer;
}
.est-qty svg { color: var(--text-dim); }
.est-qty-edit { display: inline-flex; align-items: center; gap: 4px; color: var(--text-primary); font-weight: 600; }
.est-qty-edit input {
    width: 64px; padding: 2px 6px;
    background: #111; border: 1px solid var(--accent); border-radius: 6px;
    color: var(--text-primary);
    font-family: inherit; font-size: 13px;
}
.est-item-name b { font-weight: 600; }
.est-item-name small { color: var(--text-dim); font-size: 12px; }
.est-src {
    display: inline-block;
    font-style: normal;
    font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.4px;
    color: var(--accent);
    background: var(--accent-surface);
    border-radius: 6px;
    padding: 1px 6px;
    vertical-align: 1px;
}
/* A row's eight values in the columns of the totals; plain numbers, the colour stays with the totals */
.est-item-vals {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px 10px;
    margin-top: 6px;
    font-size: 11px; color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}
.est-item-vals span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.est-item-vals b { font-size: 13px; font-weight: 500; color: var(--text-primary); margin-right: 2px; }
.est-item-name .est-qty { margin-left: 4px; vertical-align: 1px; }
.est-src.solid { color: #000; background: var(--accent); }
.est-keep {
    display: block;
    margin-top: 6px; padding: 4px 0;
    background: none; border: none;
    color: var(--accent);
    font-family: inherit; font-size: 12.5px; font-weight: 600;
    cursor: pointer;
}
.est-keep.done { color: var(--text-dim); cursor: default; }
.est-links { display: flex; flex-wrap: wrap; column-gap: 18px; margin-top: 4px; }
.est-links .est-keep { margin-top: 0; }
.prod-brand { color: var(--text-dim); font-weight: 400; font-size: 12.5px; }

/* Os meus produtos (products.js) */
.prod-search { margin-bottom: 4px; }
.prod-hint { margin: 6px 0 4px; font-size: 12.5px; line-height: 1.4; color: var(--text-dim); }
.prod-hint.error { color: var(--danger); }
.prod-list { display: flex; flex-direction: column; margin: 6px 0 12px; max-height: 52vh; overflow-y: auto; }
.prod-list .sensors-loading { padding: 30px 0; }
.prod-row { display: flex; align-items: center; border-bottom: 1px solid #222; }
.prod-row-main {
    flex: 1 1 auto; min-width: 0;
    display: flex; flex-direction: column; gap: 2px;
    padding: 11px 2px;
    background: none; border: none;
    color: var(--text-primary);
    font-family: inherit; text-align: left;
    cursor: pointer;
}
.prod-row-main b { font-size: 14.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod-row-main small { font-size: 12px; color: var(--text-dim); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod-row.on .prod-row-main { cursor: default; }
.prod-row-main b .est-src { margin-left: 6px; }
.prod-row-edit {
    flex: none;
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none; border-radius: 10px;
    color: var(--text-dim);
    cursor: pointer;
}
.prod-empty { margin: 14px 2px; font-size: 13px; line-height: 1.45; color: var(--text-secondary); }
.prod-new { width: 100%; }
.prod-photo { width: 100%; }
.prod-basis { margin: 0; flex-wrap: wrap; }
.prod-basis .glucose-win-btn { border-color: #2e2e2e; }
.prod-basis .glucose-win-btn.active { border-color: var(--accent); }
.prod-portion-row { display: flex; align-items: center; gap: 10px; }
.prod-portion-row .food-form-input { flex: 0 1 120px; min-width: 0; }
.prod-portion .prod-hint { margin: 0; }
.est-gallery-link {
    display: block;
    margin: 6px 0 0 auto; padding: 4px 0;
    background: none; border: none;
    color: var(--text-dim);
    font-family: inherit; font-size: 12.5px; font-weight: 500;
    text-decoration: underline; text-underline-offset: 3px;
    cursor: pointer;
}
.prod-gallery { margin: 2px auto 0; }
.prod-delete { color: var(--danger); }
.est-tot {
    display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px 10px;
    padding-top: 10px;
    font-size: 12px; color: var(--text-dim);
    font-variant-numeric: tabular-nums;
}
.est-tot b { font-size: 16px; font-weight: 700; color: var(--text-primary); margin-right: 2px; }
.est-tot .c b { color: var(--carbs-color); }
.est-tot .p b { color: var(--protein-color); }
.est-tot .f b { color: var(--fat-color); }
.est-tot .s b { color: var(--sat-color); }
.est-tot .fb b { color: var(--fiber-color); }
.est-tot .su b { color: var(--sugars-color); }
.est-tot .sa b { color: var(--salt-color); }
.est-unc {
    margin: 10px 0 0;
    padding-left: 9px;
    border-left: 2px solid var(--warning);
    font-size: 12.5px; line-height: 1.4;
    color: var(--text-secondary);
}
.est-foot {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    margin-top: 10px;
    font-size: 11.5px; color: var(--text-dim);
}
.est-undo {
    flex-shrink: 0;
    background: none; border: none; padding: 4px 0;
    color: var(--accent);
    font-size: 12px; font-weight: 600;
    cursor: pointer;
}
.est-error { margin: 0; font-size: 13px; color: var(--danger); }
.est-loading { display: flex; flex-direction: column; gap: 9px; padding: 14px 12px; }
.est-loading i {
    display: block; height: 11px; border-radius: 6px;
    background: linear-gradient(90deg, #1e1e1e 0%, #2c2c2c 50%, #1e1e1e 100%);
    background-size: 200% 100%;
    animation: est-shimmer 1.3s ease-in-out infinite;
}
.est-loading i:nth-child(2) { width: 78%; }
.est-loading i:nth-child(3) { width: 55%; }
@keyframes est-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }
.food-form-input.est-filled { animation: est-filled 1.4s ease-out; }
@keyframes est-filled {
    0%, 35% { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-surface); }
    100% { border-color: #2a2a2a; box-shadow: none; }
}
