/* ============================================================
   Genetixx — Component Styles
   ============================================================ */

/* --- Page Spinner --- */
.page-spinner {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
}
.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid var(--border-subtle);
    border-top-color: var(--red);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* --- Page Header --- */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-lg);
    padding-top: var(--space-sm);
}

.page-header h1 {
    font-size: 1.5rem;
    font-weight: 800;
}

.page-header__actions {
    display: flex;
    gap: var(--space-sm);
}

/* --- Cards --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: background var(--theme-transition), border-color var(--theme-transition);
}

.card--glass {
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.card--gradient {
    background: var(--gradient-main);
    border: none;
    color: #fff;
}

.card--gradient .text-secondary,
.card--gradient .text-muted {
    color: rgba(255, 255, 255, 0.7);
}

.card + .card {
    margin-top: var(--space-md);
}

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    transition: all 0.3s var(--ease-out);
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

.btn-primary {
    background: var(--gradient-main);
    color: #fff;
}

.btn-primary:hover {
    background: var(--red-dim);
    transform: translateY(-1px);
    box-shadow: 0 8px 25px var(--red-glow);
}

.btn-primary:active {
    transform: translateY(0);
}

.btn-secondary {
    background: var(--bg-elevated);
    color: var(--text-primary);
    border: 1px solid var(--border-medium);
}

.btn-secondary:hover {
    border-color: var(--red);
}

.btn-full {
    width: 100%;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
}

.btn-icon {
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease-out);
}

.btn-icon:hover {
    color: var(--red);
    border-color: var(--red);
}

/* --- Tags / Badges --- */
.tag {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 500;
    letter-spacing: 0.15em;
    text-transform: uppercase;
    padding: 0.3rem 0.75rem;
    border-radius: var(--radius-xl);
    background: var(--red-subtle);
    color: var(--red);
    border: 1px solid var(--border-accent);
    display: inline-block;
}

.tag--blue {
    background: rgba(139, 92, 252, 0.08);
    color: var(--blue);
    border-color: rgba(139, 92, 252, 0.3);
}

.tag--cyan {
    background: rgba(139, 92, 252, 0.08);
    color: var(--cyan);
    border-color: rgba(139, 92, 252, 0.3);
}

.tag--green {
    background: rgba(16, 185, 129, 0.08);
    color: var(--green);
    border-color: rgba(16, 185, 129, 0.3);
}

/* --- Forms --- */
.form-group {
    margin-bottom: var(--space-md);
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: var(--space-xs);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--red);
    box-shadow: 0 0 0 3px var(--red-glow);
}

.form-input--lg {
    font-size: 2rem;
    font-family: var(--font-mono);
    font-weight: 700;
    text-align: center;
    padding: 1rem;
}

textarea.form-input {
    min-height: 80px;
    resize: vertical;
}

/* --- Inline Input Row --- */
.input-row {
    display: flex;
    gap: var(--space-sm);
    align-items: center;
}

.input-row .form-input {
    flex: 1;
}

.input-row__separator {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 1.2rem;
}

/* --- Checkbox / Toggle --- */
.check-item {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border-subtle);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.check-item:last-child {
    border-bottom: none;
}

.check-item__checkbox {
    width: 24px;
    height: 24px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s var(--ease-spring);
}

.check-item.checked .check-item__checkbox {
    background: var(--green);
    border-color: var(--green);
    animation: checkPop 0.3s var(--ease-spring);
}

@keyframes checkPop {
    0%   { transform: scale(1); }
    40%  { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.check-item.checked .check-item__checkbox::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translateY(-1px);
}

.check-item.checked .check-item__info {
    opacity: 0.5;
}

.check-item__info {
    flex: 1;
    transition: opacity 0.2s;
}

.check-item__name {
    font-weight: 500;
    font-size: 0.95rem;
}

.check-item__dose {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.check-item__time {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* --- Progress Bar --- */
.progress-bar {
    height: 8px;
    background: var(--bg-elevated);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar__fill {
    height: 100%;
    border-radius: 3px;
    background: var(--gradient-main);
    transition: width 0.5s var(--ease-out);
}

.progress-bar__fill--red { background: var(--red); }
.progress-bar__fill--blue { background: var(--blue); }
.progress-bar__fill--cyan { background: var(--cyan); }
.progress-bar__fill--green { background: var(--green); }

/* --- Circular Progress --- */
.circle-progress {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.circle-progress svg {
    transform: rotate(-90deg);
}

.circle-progress__track {
    fill: none;
    stroke: var(--bg-elevated);
}

.circle-progress__fill {
    fill: none;
    stroke: var(--red);
    stroke-linecap: round;
    transition: stroke-dashoffset 0.6s var(--ease-out);
}

.circle-progress__text {
    position: absolute;
    font-family: var(--font-mono);
    font-weight: 700;
    font-size: 0.9rem;
}

/* --- Score Scale (1-10) --- */
.score-scale {
    display: flex;
    gap: clamp(2px, 0.6vw, 4px);
    flex: 1;
    min-width: 0;
}

.score-scale__dot {
    width: 28px;
    min-width: 0;
    flex-shrink: 1;
    aspect-ratio: 1;
    border-radius: 50%;
    border: 2px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-mono);
    font-size: 0.7rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s var(--ease-spring);
    -webkit-tap-highlight-color: transparent;
    color: var(--text-muted);
    position: relative;
}

/* Extend touch target to 44x44px without changing visual */
.score-scale__dot::before {
    content: '';
    position: absolute;
    inset: -8px;
}

.score-scale__dot:hover {
    border-color: var(--red);
    color: var(--red);
}

.score-scale__dot.active {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
    transform: scale(1.1);
}

.score-scale__dot.active.score-high {
    background: var(--green);
    border-color: var(--green);
}

.score-scale__dot.active.score-mid {
    background: var(--yellow);
    border-color: var(--yellow);
}

.score-scale__dot.active.score-low {
    background: var(--red);
    border-color: var(--red);
}

/* --- NSP (Ne sais pas) --- */
.score-scale__dot--nsp {
    font-size: 0.65rem;
    font-weight: 700;
}

.score-scale__dot--nsp.active {
    background: var(--text-muted);
    border-color: var(--text-muted);
    color: var(--bg-card);
}

.nsp-toggle {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 2px solid var(--border-medium);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.7rem;
    font-weight: 700;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
}

.nsp-toggle:hover {
    border-color: var(--text-secondary);
}

.nsp-toggle.active {
    background: var(--text-muted);
    border-color: var(--text-muted);
    color: var(--bg-card);
}

.nsp-disabled {
    opacity: 0.4;
    pointer-events: none;
}

/* --- Validation Status --- */
.validation-status__row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 0;
    font-size: 0.85rem;
}

.validation-status__row + .validation-status__row {
    border-top: 1px solid var(--border-subtle);
}

.validation-status__row.done .validation-status__icon {
    color: var(--green);
    font-weight: 700;
}

.validation-status__row.missing .validation-status__icon {
    color: var(--red);
}

.validation-status__action {
    margin-left: auto;
    font-size: 0.75rem;
    color: var(--red);
    font-weight: 600;
    cursor: pointer;
}

.validation-status__skip {
    margin-left: 8px;
    font-size: 0.7rem;
    color: var(--text-muted);
    cursor: pointer;
    text-decoration: underline;
}

.validation-status__skip:hover {
    color: var(--text-secondary);
}

/* --- Day Pills --- */
.day-pills {
    display: flex;
    gap: var(--space-xs);
    overflow-x: auto;
    padding-bottom: var(--space-sm);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.day-pills::-webkit-scrollbar { display: none; }

.day-pill {
    flex-shrink: 0;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    min-width: 52px;
    transition: all 0.2s var(--ease-out);
    -webkit-tap-highlight-color: transparent;
}

.day-pill__day {
    font-weight: 700;
    display: block;
}

.day-pill__type {
    font-size: 0.6rem;
    color: var(--text-muted);
    display: block;
    margin-top: 2px;
}

.day-pill.active {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.day-pill.active .day-pill__type {
    color: rgba(255, 255, 255, 0.7);
}

.day-pill.rest {
    opacity: 0.5;
}

/* --- Metric Card --- */
.metric-card {
    text-align: center;
    padding: var(--space-md);
}

.metric-card__value {
    font-family: var(--font-mono);
    font-size: 1.5rem;
    font-weight: 700;
}

.metric-card__label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: var(--space-xs);
}

.metrics-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-sm);
}

/* --- Section Title --- */
.section-title {
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: var(--space-md);
    margin-top: var(--space-xl);
}

.section-title:first-child {
    margin-top: 0;
}

/* --- Exercise Card --- */
.exercise-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transition: background var(--theme-transition);
}

.exercise-card + .exercise-card {
    margin-top: var(--space-sm);
}

.exercise-card__header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md) var(--space-lg);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
}

.exercise-card__number {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--red-subtle);
    color: var(--red);
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

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

.exercise-card__name {
    font-weight: 600;
    font-size: 0.9rem;
    overflow-wrap: anywhere;
}

.exercise-card__target {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    color: var(--text-muted);
}

.exercise-card__status {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    border: 2px solid var(--border-medium);
    flex-shrink: 0;
    transition: all 0.2s;
}

.exercise-card.completed .exercise-card__status {
    background: var(--green);
    border-color: var(--green);
}

.exercise-card__chevron {
    color: var(--text-muted);
    transition: transform 0.2s var(--ease-out);
    flex-shrink: 0;
}

.exercise-card.expanded .exercise-card__chevron {
    transform: rotate(180deg);
}

.exercise-card__body {
    max-height: 0;
    overflow: hidden;
    padding: 0 var(--space-lg);
    border-top: 1px solid transparent;
    transition: max-height 0.35s var(--ease-out), padding 0.35s var(--ease-out), border-color 0.2s;
}

.exercise-card.expanded .exercise-card__body {
    max-height: 800px;
    padding: 0 var(--space-lg) var(--space-lg);
    border-top-color: var(--border-subtle);
}

/* --- Set Row --- */
.set-row {
    display: grid;
    grid-template-columns: 36px 1fr 1fr 40px;
    gap: var(--space-sm);
    align-items: center;
    padding: var(--space-sm) 0;
}

.set-row__label {
    font-family: var(--font-mono);
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-align: center;
}

.set-row input {
    width: 100%;
    padding: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    text-align: center;
    -webkit-appearance: none;
}

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

.set-row input::placeholder {
    color: var(--text-muted);
    font-size: 0.7rem;
}

.set-row__check {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-medium);
    background: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s var(--ease-spring);
    -webkit-tap-highlight-color: transparent;
}

.set-row__check.checked {
    background: var(--green);
    border-color: var(--green);
    animation: checkPop 0.3s var(--ease-spring);
}

.set-row__check.checked::after {
    content: '';
    width: 6px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translateY(-1px);
}

.set-row__prev {
    grid-column: 2 / -1;
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}

.set-header {
    display: grid;
    grid-template-columns: 36px 1fr 1fr 40px;
    gap: var(--space-sm);
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-subtle);
    margin-bottom: var(--space-xs);
}

.set-header span {
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    text-align: center;
}

/* --- Bottom Navigation --- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: calc(var(--bottom-nav-height) + var(--safe-bottom));
    padding-bottom: var(--safe-bottom);
    background: var(--bg-glass);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border-subtle);
    display: flex;
    align-items: center;
    justify-content: space-around;
    z-index: 1000;
    transition: background var(--theme-transition);
}

.nav-tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 12px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-family: var(--font-body);
    font-size: 0.6rem;
    font-weight: 500;
    letter-spacing: 0.05em;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: color 0.2s;
    position: relative;
    text-transform: uppercase;
}

.nav-tab svg {
    width: 22px;
    height: 22px;
    stroke-width: 1.5;
}

.nav-tab.active {
    color: var(--red);
}

.nav-tab.active::after {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 2px;
    background: var(--red);
    border-radius: 2px;
}

/* --- More Menu Overlay --- */
.more-menu {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + var(--safe-bottom));
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border-subtle);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    padding: var(--space-lg);
    transform: translateY(100%);
    transition: transform 0.3s var(--ease-out);
    z-index: 999;
}

.more-menu.open {
    transform: translateY(0);
}

.more-menu__grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-md);
}

.more-menu__item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    text-decoration: none;
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.75rem;
    font-weight: 500;
    -webkit-tap-highlight-color: transparent;
    transition: all 0.2s;
}

.more-menu__item:hover {
    border-color: var(--red);
}

.more-menu__item svg {
    width: 24px;
    height: 24px;
    color: var(--red);
}

/* --- Backdrop --- */
.backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

/* --- Info Box --- */
.info-box {
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    border-left: 3px solid var(--red);
    background: var(--red-subtle);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.info-box--warning {
    border-left-color: var(--yellow);
    background: rgba(245, 158, 11, 0.08);
}

.info-box--success {
    border-left-color: var(--green);
    background: rgba(16, 185, 129, 0.08);
}

/* --- Meal Card --- */
.meal-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
}

.meal-card__header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-md);
}

.meal-card__title {
    font-weight: 600;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.meal-card__kcal {
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.food-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 0.85rem;
    gap: var(--space-sm);
}

.food-item > *:first-child {
    min-width: 0;
    flex: 1;
}

.food-item:last-child {
    border-bottom: none;
}

.food-item__macros {
    font-family: var(--font-mono);
    font-size: 0.7rem;
    color: var(--text-muted);
}

.food-item__delete {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-size: 1.2rem;
    border-radius: var(--radius-sm);
    transition: color 0.2s, background 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.food-item__delete:hover {
    color: var(--red);
    background: var(--red-subtle);
}

/* --- Preset Pills --- */
.preset-pills {
    display: flex;
    gap: var(--space-xs);
    overflow-x: auto;
    padding-bottom: var(--space-sm);
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}

.preset-pills::-webkit-scrollbar { display: none; }

.preset-pill {
    flex-shrink: 0;
    padding: 0.4rem 0.8rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-subtle);
    background: var(--bg-card);
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
    white-space: nowrap;
}

.preset-pill:hover {
    border-color: var(--red);
    color: var(--red);
}

/* --- Rest Timer Overlay --- */
.rest-timer {
    position: fixed;
    inset: 0;
    background: rgba(17, 17, 17, 0.92);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-xl);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

.rest-timer.active {
    opacity: 1;
    pointer-events: auto;
}

.rest-timer__time {
    font-family: var(--font-mono);
    font-size: 4rem;
    font-weight: 700;
}

.rest-timer__label {
    font-size: 0.85rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.15em;
}

.rest-timer__presets {
    display: flex;
    gap: var(--space-sm);
    flex-wrap: wrap;
    justify-content: center;
}

.rest-timer__preset {
    padding: 0.5rem 1.25rem;
    border-radius: var(--radius-xl);
    border: 1px solid var(--border-medium);
    background: none;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
}

.rest-timer__preset.active {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

/* --- Nutrition Progress Sticky --- */
.nutrition-sticky {
    position: sticky;
    top: 0;
    z-index: 10;
    background: var(--bg-primary);
    padding: var(--space-md) 0;
    margin-bottom: var(--space-md);
}

.macro-bars {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: var(--space-sm);
}

.macro-bar {
    text-align: center;
}

.macro-bar__value {
    font-family: var(--font-mono);
    font-size: 1.1rem;
    font-weight: 700;
}

.macro-bar__target {
    font-size: 0.6rem;
    color: var(--text-muted);
}

.macro-bar__bar {
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 2px;
    margin-top: 4px;
    overflow: hidden;
}

.macro-bar__fill {
    height: 100%;
    border-radius: 2px;
    transition: width 0.5s var(--ease-out);
}

/* --- Theme Toggle --- */
.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border-subtle);
    background: var(--bg-elevated);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    transition: all 0.2s;
    -webkit-tap-highlight-color: transparent;
}

.theme-toggle svg {
    width: 18px;
    height: 18px;
}

.theme-toggle:hover {
    border-color: var(--red);
    color: var(--red);
}

/* --- Chart Container --- */
.chart-container {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    margin-bottom: var(--space-md);
}

.chart-container canvas {
    width: 100% !important;
    height: 200px !important;
}

.chart-container h3 {
    font-size: 0.85rem;
    margin-bottom: var(--space-md);
}

/* --- Empty State --- */
.empty-state {
    text-align: center;
    padding: var(--space-2xl) var(--space-lg);
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-md);
    opacity: 0.3;
}

.empty-state p {
    font-size: 0.9rem;
}

/* --- Toast --- */
.toast {
    position: fixed;
    bottom: calc(var(--bottom-nav-height) + var(--safe-bottom) + 16px);
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-elevated);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 0.75rem 1.25rem;
    font-size: 0.85rem;
    z-index: 3000;
    opacity: 0;
    transition: all 0.3s var(--ease-out);
    pointer-events: none;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    max-width: 90vw;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
    pointer-events: auto;
}

.toast--success {
    border-color: var(--green);
    color: var(--green);
}

.toast--error {
    border-color: var(--red);
    color: var(--red);
}

.toast__icon {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

.toast__msg {
    flex: 1;
}

.toast__close {
    background: none;
    border: none;
    color: inherit;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0 0 0 var(--space-sm);
    opacity: 0.5;
    transition: opacity 0.2s;
    line-height: 1;
}

.toast__close:hover {
    opacity: 1;
}

/* --- Confirm Dialog --- */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-lg);
    opacity: 0;
    transition: opacity 0.25s var(--ease-out);
}

.confirm-overlay.show {
    opacity: 1;
}

.confirm-dialog {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    max-width: 340px;
    width: 100%;
    transform: scale(0.95);
    transition: transform 0.25s var(--ease-spring);
}

.confirm-overlay.show .confirm-dialog {
    transform: scale(1);
}

.confirm-dialog h3 {
    margin-bottom: var(--space-sm);
}

.confirm-dialog p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: var(--space-lg);
}

.confirm-dialog__actions {
    display: flex;
    gap: var(--space-sm);
    justify-content: flex-end;
}

/* --- Calendar Picker --- */
.calendar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 5000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: var(--space-md);
    opacity: 0;
    transition: opacity 0.25s var(--ease-out);
}

.calendar-overlay.show {
    opacity: 1;
}

.calendar {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    width: 100%;
    max-width: 340px;
    transform: scale(0.95);
    transition: transform 0.25s var(--ease-spring);
}

.calendar-overlay.show .calendar {
    transform: scale(1);
}

.calendar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-md);
}

.calendar__title {
    font-weight: 700;
    font-size: 0.95rem;
    text-transform: capitalize;
}

.calendar__nav {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 1.4rem;
    cursor: pointer;
    padding: 8px;
    line-height: 1;
    border-radius: var(--radius-sm);
    transition: color 0.2s;
}

.calendar__nav:hover:not(:disabled) {
    color: var(--red);
}

.calendar__nav:disabled {
    opacity: 0.2;
    cursor: default;
}

.calendar__weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    text-align: center;
    font-size: 0.65rem;
    color: var(--text-muted);
    margin-bottom: var(--space-xs);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

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

.calendar__day {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    font-size: 0.8rem;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--text-primary);
    position: relative;
    transition: background 0.15s;
    font-family: var(--font-body);
}

.calendar__day:hover:not(:disabled):not(.calendar__day--outside) {
    background: var(--border-subtle);
}

.calendar__day--today {
    font-weight: 700;
}

.calendar__day--today::after {
    content: '';
    position: absolute;
    bottom: 3px;
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--red);
}

.calendar__day--selected {
    background: var(--red);
    color: #fff;
}

.calendar__day--selected::after {
    background: #fff;
}

.calendar__day--selected:hover {
    background: var(--red-dim);
}

.calendar__day:disabled {
    color: var(--text-muted);
    opacity: 0.25;
    cursor: default;
}

.calendar__day--outside {
    visibility: hidden;
}

/* Calendar pill variant for period-pills */
.period-pill--calendar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 0.4rem 0.75rem;
}

.period-pill--calendar svg {
    flex-shrink: 0;
}

/* Calendar pill variant for day-pills */
.day-pill--calendar {
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
}

.day-pill--calendar svg {
    width: 18px;
    height: 18px;
}

/* --- Offline Banner --- */
.offline-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: var(--yellow);
    color: #1a1a2e;
    font-size: 0.75rem;
    font-weight: 600;
    text-align: center;
    padding: 6px var(--space-md);
    z-index: 5000;
    transform: translateY(-100%);
    transition: transform 0.3s var(--ease-out);
}

.offline-banner.show {
    transform: translateY(0);
}

/* --- Timer Ring --- */
.rest-timer__ring {
    position: relative;
    width: 200px;
    height: 200px;
}

.rest-timer__ring svg {
    transform: rotate(-90deg);
}

.rest-timer__ring-track {
    fill: none;
    stroke: var(--bg-elevated);
}

.rest-timer__ring-fill {
    fill: none;
    stroke: var(--red);
    stroke-linecap: round;
    transition: stroke-dashoffset 1s linear, stroke 0.5s;
}

.rest-timer__ring .rest-timer__time {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* --- Empty State Enhanced --- */
.empty-state__hint {
    font-size: 0.75rem;
    margin-top: var(--space-sm);
    opacity: 0.5;
}

/* ============================================================
   Onboarding Overlay
   ============================================================ */

.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: rgba(17, 17, 17, 0.85);
    z-index: 6000;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 0 0 calc(var(--bottom-nav-height) + var(--safe-bottom) + var(--space-md));
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s var(--ease-out);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.onboarding-overlay.show {
    opacity: 1;
    pointer-events: auto;
}

.onboarding-card {
    background: var(--bg-card);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-xl) var(--radius-xl) var(--radius-lg) var(--radius-lg);
    padding: var(--space-xl) var(--space-lg) var(--space-lg);
    width: 100%;
    max-width: 480px;
    transform: translateY(40px);
    transition: transform 0.4s var(--ease-spring);
    position: relative;
    max-height: 80dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.onboarding-overlay.show .onboarding-card {
    transform: translateY(0);
}

.onboarding-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: var(--space-lg);
}

.onboarding-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--border-medium);
    transition: all 0.3s var(--ease-spring);
}

.onboarding-dot.active {
    width: 20px;
    border-radius: 3px;
    background: var(--red);
}

.onboarding-step {
    display: none;
    animation: onboardingStepIn 0.3s var(--ease-out) both;
}

.onboarding-step.active {
    display: block;
}

@keyframes onboardingStepIn {
    from { opacity: 0; transform: translateX(12px); }
    to   { opacity: 1; transform: translateX(0); }
}

.onboarding-step__icon {
    font-size: 2.5rem;
    line-height: 1;
    margin-bottom: var(--space-md);
    display: block;
}

.onboarding-step__title {
    font-size: 1.25rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    margin-bottom: var(--space-sm);
    line-height: 1.2;
}

.onboarding-step__body {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.65;
    margin-bottom: var(--space-md);
}

.onboarding-step__list {
    list-style: none;
    margin: var(--space-sm) 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space-xs);
}

.onboarding-step__list li {
    display: flex;
    align-items: flex-start;
    gap: var(--space-sm);
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.onboarding-step__list li::before {
    content: '\2192';
    color: var(--red);
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 1px;
}

.onboarding-nav {
    display: flex;
    gap: var(--space-sm);
    margin-top: var(--space-lg);
}

.onboarding-nav .btn {
    flex: 1;
}

.onboarding-nav .btn-secondary {
    flex: 0 0 auto;
    min-width: 90px;
}

.onboarding-skip-row {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-top: var(--space-md);
    padding-top: var(--space-md);
    border-top: 1px solid var(--border-subtle);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}

.onboarding-skip-row__box {
    width: 20px;
    height: 20px;
    border-radius: var(--radius-sm);
    border: 2px solid var(--border-medium);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s var(--ease-spring);
}

.onboarding-skip-row__box.checked {
    background: var(--green);
    border-color: var(--green);
}

.onboarding-skip-row__box.checked::after {
    content: '';
    width: 5px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translateY(-1px);
}

.onboarding-skip-row__label {
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* --- Onboarding Questionnaire Page --- */
.ob-progress {
    height: 4px;
    background: var(--bg-elevated);
    border-radius: 2px;
    overflow: hidden;
}

.ob-progress-bar {
    height: 100%;
    background: var(--red);
    border-radius: 2px;
    transition: width 0.3s var(--ease-out);
}

.ob-progress-labels {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 12px 0 20px;
}

.ob-label {
    font-size: 0.65rem;
    padding: 3px 8px;
    border-radius: 12px;
    background: var(--bg-elevated);
    color: var(--text-muted);
    white-space: nowrap;
}

.ob-label.active {
    background: var(--red-subtle, rgba(239,68,68,0.1));
    color: var(--red);
}

.ob-fields {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
}

.ob-field { display: flex; flex-direction: column; gap: 6px; }
.ob-field-full { width: 100%; }
.ob-field-half { width: calc(50% - 8px); }
.ob-field-third { width: calc(33.33% - 11px); }

@media (max-width: 600px) {
    .ob-field-half, .ob-field-third { width: 100%; }
}

.ob-field label {
    font-size: 0.8rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.ob-field input,
.ob-field select,
.ob-field textarea {
    width: 100%;
    padding: 10px 12px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-medium);
    background: var(--bg-elevated);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 0.9rem;
    transition: border-color 0.2s;
}

.ob-field input:focus,
.ob-field select:focus,
.ob-field textarea:focus {
    outline: none;
    border-color: var(--red);
}

.ob-field textarea {
    resize: vertical;
    min-height: 70px;
}

.scale-row {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.scale-opt {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    border: 2px solid var(--border-medium);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
    color: var(--text-secondary);
}

.scale-opt input { display: none; }

.scale-opt:hover {
    border-color: var(--red);
    color: var(--red);
}

.scale-opt.selected {
    background: var(--red);
    border-color: var(--red);
    color: #fff;
}

.cb-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.cb-opt {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    padding: 6px 12px;
    border-radius: var(--radius-md);
    background: var(--bg-elevated);
    border: 1px solid var(--border-subtle);
    cursor: pointer;
    transition: border-color 0.15s;
}

.cb-opt:has(input:checked) {
    border-color: var(--red);
    background: var(--red-subtle, rgba(239,68,68,0.08));
}

.ob-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 24px;
}

.btn-gold {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    background: var(--red);
    color: #fff;
    transition: all 0.2s var(--ease-out);
}

.btn-gold:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px var(--red-glow);
}

.btn-outline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    background: transparent;
    color: var(--text-primary);
    transition: all 0.2s;
}

.btn-outline:hover {
    border-color: var(--red);
    color: var(--red);
}

.msg { font-size: 0.85rem; padding: 8px 0; }
.msg.ok { color: var(--green); }
.msg.err { color: var(--red); }
