/* eFIT Web App — Premium Dark Theme with Glassmorphism */

:root {
    --bg: #060610;
    --bg-subtle: #0a0a18;
    --card: rgba(14, 14, 28, 0.8);
    --card-solid: #0e0e1c;
    --card-hover: #12121f;
    --border: rgba(255, 255, 255, .06);
    --border-active: rgba(0, 230, 118, .3);
    --text: #f0f0f5;
    --text-secondary: #c8c8d8;
    --muted: rgba(255, 255, 255, .45);
    --primary: #00e676;
    --primary-glow: rgba(0, 230, 118, .12);
    --primary-dark: #00c853;
    --accent: #40c4ff;
    --accent-glow: rgba(64, 196, 255, .1);
    --error: #ff5252;
    --error-glow: rgba(255, 82, 82, .1);
    --warning: #ffab40;
    --warning-glow: rgba(255, 171, 64, .1);
    --success: #69f0ae;
    --input-bg: rgba(255, 255, 255, .03);
    --input-focus: rgba(255, 255, 255, .06);
    --radius: 14px;
    --radius-sm: 10px;
    --radius-lg: 20px;
    --shadow: 0 4px 24px rgba(0, 0, 0, .4);
    --shadow-glow: 0 0 40px rgba(0, 230, 118, .08);
    --transition: .25s cubic-bezier(.4, 0, .2, 1);
    --glass: rgba(14, 14, 26, 0.88);
    --glass-border: rgba(255, 255, 255, .08);
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100dvh;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    line-height: 1.5;
}

/* Subtle background gradient */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse 600px 400px at 50% 0%, rgba(0, 230, 118, .04), transparent),
        radial-gradient(ellipse 400px 300px at 80% 80%, rgba(64, 196, 255, .03), transparent);
    pointer-events: none;
    z-index: 0;
}

/* ── Layout ── */
.app-shell {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
    position: relative;
    z-index: 1;
}

.app-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: var(--glass);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--glass-border);
}

.app-header h1 {
    font-size: 22px;
    font-weight: 800;
    letter-spacing: -0.5px;
}

.app-header h1 span {
    color: var(--primary);
    text-shadow: 0 0 20px rgba(0, 230, 118, .3);
}

.header-title {
    font-size: 13px;
    color: var(--muted);
    font-weight: 500;
    letter-spacing: .3px;
    text-transform: uppercase;
}

.app-content {
    flex: 1;
    padding: 16px;
    padding-bottom: 90px;
    max-width: 500px;
    margin: 0 auto;
    width: 100%;
}

.screen {
    display: none;
}

.screen.active {
    display: block;
    animation: screenIn .35s cubic-bezier(.4, 0, .2, 1);
}

/* ── Bottom Tab Bar ── */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--glass);
    backdrop-filter: blur(24px) saturate(1.2);
    -webkit-backdrop-filter: blur(24px) saturate(1.2);
    border-top: 1px solid var(--glass-border);
    display: flex;
    z-index: 100;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab-bar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 8px 4px 6px;
    text-decoration: none;
    font-size: 10px;
    font-weight: 600;
    color: var(--muted);
    transition: color var(--transition), transform var(--transition);
    position: relative;
    letter-spacing: .3px;
}

.tab-bar a.active {
    color: var(--primary);
}

.tab-bar a.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 2px;
    background: var(--primary);
    border-radius: 0 0 2px 2px;
    box-shadow: 0 0 8px rgba(0, 230, 118, .5);
}

.tab-bar a:active {
    transform: scale(.92);
}

.tab-bar a .tab-icon {
    font-size: 20px;
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 28px;
}

/* ── Cards ── */
.card {
    background: var(--card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 12px;
    transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition);
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.stat-card {
    background: var(--card);
    backdrop-filter: blur(12px);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 10px;
    text-align: center;
    transition: transform var(--transition), border-color var(--transition);
    position: relative;
    overflow: hidden;
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--primary), transparent);
    opacity: 0;
    transition: opacity var(--transition);
}

.stat-card:hover::before {
    opacity: 1;
}

.stat-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-active);
}

.stat-val {
    font-size: 26px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1.1;
    text-shadow: 0 0 20px rgba(0, 230, 118, .2);
}

.stat-label {
    font-size: 10px;
    color: var(--muted);
    margin-top: 6px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
}

/* ── Forms ── */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.form-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 13px 16px;
    color: var(--text);
    font-size: 15px;
    font-family: inherit;
    outline: none;
    transition: border-color var(--transition), background var(--transition), box-shadow var(--transition);
}

.form-input:focus {
    border-color: var(--primary);
    background: var(--input-focus);
    box-shadow: 0 0 0 3px rgba(0, 230, 118, .08);
}

.form-input::placeholder {
    color: rgba(255, 255, 255, .2);
}

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

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

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

.form-input option {
    background: var(--card-solid);
    color: var(--text);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 14px 20px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    border: none;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    position: relative;
    overflow: hidden;
    letter-spacing: .3px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #000;
    box-shadow: 0 4px 16px rgba(0, 230, 118, .25);
}

.btn-primary:active {
    transform: scale(.97);
    box-shadow: 0 2px 8px rgba(0, 230, 118, .3);
}

.btn-outline {
    background: transparent;
    border: 1.5px solid var(--border);
    color: var(--text);
}

.btn-outline:hover {
    border-color: rgba(255, 255, 255, .15);
    background: rgba(255, 255, 255, .03);
}

.btn-sm {
    padding: 10px 16px;
    font-size: 13px;
    width: auto;
    border-radius: 8px;
}

.btn-success {
    background: var(--primary-glow);
    color: var(--primary);
    border: 1px solid rgba(0, 230, 118, .15);
}

.btn-warn {
    background: var(--warning-glow);
    color: var(--warning);
    border: 1px solid rgba(255, 171, 64, .15);
}

.btn-turbo {
    background: linear-gradient(135deg, #ffab40 0%, #ff9100 100%);
    color: #000;
    box-shadow: 0 4px 16px rgba(255, 171, 64, .25);
}

.btn-danger {
    background: transparent;
    color: var(--error);
    border: none;
}

.btn-danger:hover {
    background: var(--error-glow);
}

.btn:disabled {
    opacity: .4;
    pointer-events: none;
}

/* ── Links ── */
.link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
    cursor: pointer;
    transition: opacity var(--transition);
}

.link:hover {
    opacity: .8;
}

/* ── Divider ── */
.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 24px 0;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--border), transparent);
}

/* ── Error / Success Boxes ── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    margin-bottom: 16px;
    text-align: center;
    font-weight: 500;
    animation: fadeSlideIn .3s ease;
}

.alert-error {
    background: var(--error-glow);
    color: var(--error);
    border: 1px solid rgba(255, 82, 82, .2);
}

.alert-success {
    background: var(--primary-glow);
    color: var(--primary);
    border: 1px solid rgba(0, 230, 118, .2);
}

/* ── Item Lists ── */
.item-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .03);
}

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

.item-name {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.item-detail {
    font-size: 13px;
    color: var(--muted);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.item-sub {
    font-size: 12px;
    color: var(--muted);
    margin-top: 2px;
}

/* ── Actions Row ── */
.actions-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.actions-row .btn {
    flex: 1;
}

.quick-actions {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
}

.quick-action {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 14px 4px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition), transform var(--transition);
    border: 1px solid transparent;
}

.quick-action:hover {
    background: rgba(255, 255, 255, .03);
    border-color: var(--border);
    transform: translateY(-2px);
}

.quick-action:active {
    transform: scale(.95);
}

.quick-action-icon {
    font-size: 28px;
    margin-bottom: 6px;
}

.quick-action-text {
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
    letter-spacing: .3px;
}

/* ── Badge ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .3px;
}

.badge-turbo {
    background: var(--warning-glow);
    color: var(--warning);
    border: 1px solid rgba(255, 171, 64, .2);
}

.badge-type {
    background: var(--accent-glow);
    color: var(--accent);
    border: 1px solid rgba(64, 196, 255, .2);
}

/* ── Macro Row ── */
.macro-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
}

.macro {
    text-align: center;
    min-width: 60px;
}

.macro-val {
    font-size: 18px;
    font-weight: 800;
    color: var(--accent);
}

.macro-label {
    font-size: 10px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-top: 2px;
}

/* ── Weight Row ── */
.weight-row {
    display: flex;
    justify-content: space-around;
}

.weight-item {
    text-align: center;
}

.weight-val {
    font-size: 20px;
    font-weight: 800;
    color: var(--primary);
}

.weight-date {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

/* ── FAB ── */
.fab {
    position: fixed;
    bottom: 76px;
    right: 20px;
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    color: #000;
    font-size: 26px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 24px rgba(0, 230, 118, .35);
    z-index: 90;
    transition: transform var(--transition), box-shadow var(--transition);
}

.fab:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 32px rgba(0, 230, 118, .45);
}

.fab:active {
    transform: scale(.9);
}

/* ── Modal ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 200;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.modal-overlay.active {
    display: flex;
    animation: fadeIn .2s ease;
}

.modal-sheet {
    background: var(--card-solid);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    padding: 24px;
    padding-top: 16px;
    width: 100%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp .35s cubic-bezier(.4, 0, .2, 1);
    overscroll-behavior: contain;
}

.modal-sheet::before {
    content: '';
    display: block;
    width: 40px;
    height: 4px;
    background: rgba(255, 255, 255, .15);
    border-radius: 2px;
    margin: 0 auto 16px;
}

.modal-title {
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 20px;
    letter-spacing: -.3px;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-actions .btn {
    flex: 1;
    border-radius: var(--radius-sm);
}

/* ── Toast ── */
.toast {
    position: fixed;
    bottom: 84px;
    left: 50%;
    transform: translateX(-50%);
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    color: #000;
    background: var(--primary);
    box-shadow: 0 8px 32px rgba(0, 0, 0, .4);
    z-index: 999;
    animation: toastIn .4s cubic-bezier(.4, 0, .2, 1);
    white-space: nowrap;
}

.toast-error {
    background: var(--error);
    color: #fff;
}

/* ── Auth Screen ── */
.auth-center {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 80vh;
    padding: 0 4px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 48px;
}

.auth-logo h1 {
    font-size: 52px;
    font-weight: 800;
    letter-spacing: -3px;
}

.auth-logo h1 span {
    color: var(--primary);
    text-shadow: 0 0 30px rgba(0, 230, 118, .35);
}

.auth-logo p {
    color: var(--muted);
    font-size: 15px;
    margin-top: 6px;
    font-weight: 400;
}

/* ── Locked (paywall) ── */
.locked-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 60px 20px;
    min-height: 60vh;
}

.locked-icon {
    font-size: 56px;
    margin-bottom: 16px;
}

.locked-title {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 8px;
}

.locked-text {
    color: var(--muted);
    line-height: 1.6;
    margin-bottom: 24px;
}

/* ── AI Box ── */
.ai-box {
    background: var(--accent-glow);
    border: 1px solid rgba(64, 196, 255, .15);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 14px;
    position: relative;
    overflow: hidden;
}

.ai-box::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: .5;
}

.ai-box-title {
    color: var(--accent);
    font-weight: 700;
    font-size: 13px;
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .5px;
}

.ai-box-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.7;
}

/* ── Greeting ── */
.greet {
    font-size: 24px;
    font-weight: 600;
    padding: 8px 0 20px;
    letter-spacing: -.3px;
}

.greet-name {
    font-weight: 800;
    color: var(--primary);
    text-shadow: 0 0 20px rgba(0, 230, 118, .2);
}

/* ── Entry Preview ── */
.entry-preview {
    background: var(--primary-glow);
    padding: 10px 12px;
    border-radius: 8px;
    font-size: 13px;
    margin-bottom: 6px;
    border: 1px solid rgba(0, 230, 118, .08);
    transition: background var(--transition);
}

/* ── Info Row ── */
.info-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .03);
}

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

.info-label {
    color: var(--muted);
    font-size: 13px;
}

.info-val {
    font-size: 13px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    color: var(--text-secondary);
}

/* ── Skeleton Loading ── */
.skeleton {
    position: relative;
    overflow: hidden;
    border-radius: var(--radius);
    background: var(--card);
    padding: 18px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
}

.skeleton::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.03) 40%, rgba(255,255,255,.05) 50%, rgba(255,255,255,.03) 60%, transparent 100%);
    animation: shimmer 1.5s infinite;
}

.skeleton-line {
    height: 14px;
    background: rgba(255, 255, 255, .06);
    border-radius: 4px;
    margin-bottom: 10px;
}

.skeleton-line.w-60 { width: 60%; }
.skeleton-line.w-40 { width: 40%; }
.skeleton-line.w-80 { width: 80%; }
.skeleton-line.h-24 { height: 24px; }

.skeleton-stat {
    height: 80px;
    background: rgba(255, 255, 255, .04);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

/* ── Empty State ── */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 48px 20px;
    color: var(--muted);
}

.empty-icon {
    font-size: 48px;
    margin-bottom: 16px;
    opacity: .6;
}

.empty-title {
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 6px;
    color: var(--text-secondary);
}

.empty-text {
    font-size: 13px;
    line-height: 1.6;
    max-width: 260px;
}

/* ── Card Action Buttons ── */
.card-actions {
    display: flex;
    gap: 6px;
}

.card-action-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all var(--transition);
    padding: 0;
}

.card-action-btn.edit {
    background: var(--accent-glow);
    color: var(--accent);
    border: 1px solid rgba(64, 196, 255, .15);
}

.card-action-btn.delete {
    background: var(--error-glow);
    color: var(--error);
    border: 1px solid rgba(255, 82, 82, .15);
}

.card-action-btn:hover {
    transform: scale(1.1);
}

/* ── Progress Indicators ── */
.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, .06);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 8px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 3px;
    transition: width .6s cubic-bezier(.4, 0, .2, 1);
}

/* ── Animations ── */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

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

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

@keyframes toastIn {
    0% {
        transform: translateX(-50%) translateY(20px);
        opacity: 0;
    }
    100% {
        transform: translateX(-50%) translateY(0);
        opacity: 1;
    }
}

@keyframes shimmer {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

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

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .5; }
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
    width: 4px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, .08);
    border-radius: 4px;
}

::selection {
    background: rgba(0, 230, 118, .2);
    color: var(--text);
}

/* ── View Toggle (List vs Agenda) ── */
.view-toggle {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, .03);
    border-radius: 8px;
    padding: 3px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.view-toggle-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--transition);
    text-transform: uppercase;
    letter-spacing: .5px;
}

.view-toggle-btn.active {
    background: var(--primary-glow);
    color: var(--primary);
    border: 1px solid rgba(0, 230, 118, .15);
}

/* ── Week Agenda ── */
.week-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.week-nav-btn {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card);
    color: var(--text);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.week-nav-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.week-nav-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-secondary);
}

.day-column {
    margin-bottom: 10px;
}

.day-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: rgba(255, 255, 255, .02);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    cursor: pointer;
    transition: all var(--transition);
}

.day-header:hover {
    background: rgba(255, 255, 255, .04);
}

.day-header.today {
    border-color: rgba(0, 230, 118, .3);
    background: var(--primary-glow);
}

.day-name {
    font-size: 13px;
    font-weight: 700;
    color: var(--text);
}

.day-date {
    font-size: 11px;
    color: var(--muted);
    font-weight: 600;
}

.day-body {
    background: var(--card);
    border: 1px solid var(--border);
    border-top: none;
    border-radius: 0 0 var(--radius-sm) var(--radius-sm);
    padding: 10px 14px;
}

.day-body.empty {
    color: var(--muted);
    font-size: 12px;
    font-style: italic;
    padding: 14px;
    text-align: center;
}

.day-workout {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .03);
}

.day-workout:last-child {
    border-bottom: none;
}

.day-workout-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.day-workout-detail {
    font-size: 11px;
    color: var(--muted);
    margin-top: 2px;
}

.day-workout-actions {
    display: flex;
    gap: 4px;
}

.day-workout-actions button {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
}

.copy-btn {
    background: var(--accent-glow);
    color: var(--accent);
    border: 1px solid rgba(64, 196, 255, .15) !important;
}

.copy-btn:hover {
    transform: scale(1.1);
}

/* ── Sub-Tabs (in-screen tab navigation) ── */
.sub-tabs {
    display: flex;
    gap: 4px;
    background: rgba(255, 255, 255, .03);
    border-radius: 8px;
    padding: 3px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
}

.sub-tab {
    flex: 1;
    padding: 9px 12px;
    border: none;
    background: transparent;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    border-radius: 6px;
    transition: all var(--transition);
    letter-spacing: .3px;
}

.sub-tab.active {
    background: var(--primary-glow);
    color: var(--primary);
    border: 1px solid rgba(0, 230, 118, .15);
}

.sub-tab:not(.active):hover {
    background: rgba(255, 255, 255, .03);
    color: var(--text-secondary);
}

/* ── Stat Icon (dashboard) ── */
.stat-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 8px;
}

.stat-icon svg {
    opacity: .7;
}

.stat-card:hover .stat-icon svg {
    opacity: 1;
}

/* ── Meds Timeline ── */
.meds-timeline {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.timeline-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: rgba(255, 255, 255, .02);
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.timeline-item.tomado {
    border-color: rgba(0, 230, 118, .15);
    background: rgba(0, 230, 118, .04);
    opacity: .7;
}

.timeline-item.atrasado {
    border-color: rgba(255, 171, 64, .25);
    background: rgba(255, 171, 64, .06);
}

.timeline-item.pendente {
    border-color: rgba(64, 196, 255, .15);
}

.timeline-time {
    font-size: 14px;
    font-weight: 800;
    color: var(--accent);
    min-width: 48px;
    font-variant-numeric: tabular-nums;
}

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

.timeline-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.timeline-dose {
    font-size: 12px;
    color: var(--muted);
    margin-top: 1px;
}

.timeline-status {
    flex-shrink: 0;
}

/* ── Badge Variants ── */
.badge-done {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    background: var(--primary-glow);
    color: var(--primary);
    border: 1px solid rgba(0, 230, 118, .2);
}

.badge-skipped {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    background: var(--error-glow);
    color: var(--error);
    border: 1px solid rgba(255, 82, 82, .2);
}

.badge-meal {
    display: inline-flex;
    align-items: center;
    padding: 3px 8px;
    border-radius: 12px;
    font-size: 10px;
    font-weight: 700;
    background: rgba(64, 196, 255, .08);
    color: var(--accent);
    border: 1px solid rgba(64, 196, 255, .15);
    text-transform: uppercase;
    letter-spacing: .3px;
}

.badge-active {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    background: var(--warning-glow);
    color: var(--warning);
    border: 1px solid rgba(255, 171, 64, .2);
}

.badge-pending {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    background: var(--accent-glow);
    color: var(--accent);
    border: 1px solid rgba(64, 196, 255, .2);
}

/* ── Button Sizes ── */
.btn-xs {
    padding: 6px 12px;
    font-size: 12px;
    width: auto;
    border-radius: 6px;
    font-weight: 700;
}

/* ── Workout Execution ── */
.execution-exercise {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    margin-bottom: 12px;
}

.execution-exercise-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 2px;
}

.execution-exercise-target {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 10px;
    font-weight: 600;
}

.execution-sets {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ── Set Rows ── */
.set-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, .02);
    border-radius: 8px;
    border: 1px solid var(--border);
    transition: all var(--transition);
}

.set-row.done {
    background: rgba(0, 230, 118, .04);
    border-color: rgba(0, 230, 118, .12);
}

.set-num {
    font-size: 12px;
    font-weight: 700;
    color: var(--muted);
    min-width: 50px;
}

.set-detail {
    flex: 1;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.set-check {
    color: var(--primary);
    font-size: 16px;
    font-weight: 800;
}

.set-input {
    padding: 6px 8px !important;
    font-size: 13px !important;
    text-align: center;
    border-radius: 6px !important;
}

/* ── Preset Pills ── */
.preset-row {
    display: flex;
    gap: 6px;
    margin-top: 6px;
    flex-wrap: wrap;
}

.preset-pill {
    padding: 5px 10px !important;
    font-size: 11px !important;
    border-radius: 20px !important;
    white-space: nowrap;
    color: var(--accent) !important;
    border-color: rgba(64, 196, 255, .2) !important;
}

.preset-pill:hover {
    background: var(--accent-glow) !important;
}

/* ── Meal Cards (Diet Plans) ── */
.meal-card {
    background: rgba(255, 255, 255, .02);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 10px;
}

.meal-card h4 {
    font-size: 13px;
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: .3px;
}

.meal-item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    border-bottom: 1px solid rgba(255, 255, 255, .03);
    font-size: 13px;
}

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

.meal-item-row span:first-child {
    flex: 1;
    color: var(--text-secondary);
    font-weight: 500;
}

.meal-item-row span:last-child {
    color: var(--muted);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    font-weight: 600;
}

/* ── Time Slot Row (Meds Schedule) ── */
.time-slot-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 6px;
}

.time-slot-row .form-input {
    flex: 1;
    padding: 8px 12px;
}

/* ── Card Active State ── */
.card-active,
.card.card-active {
    border-color: rgba(0, 230, 118, .25);
    background: rgba(0, 230, 118, .03);
}

/* ── Adherence Bar ── */
.adherence-bar {
    height: 4px;
    background: rgba(255, 255, 255, .06);
    border-radius: 2px;
    overflow: hidden;
    margin-top: 6px;
}

.adherence-fill {
    height: 100%;
    border-radius: 2px;
    transition: width .6s cubic-bezier(.4, 0, .2, 1);
}

.adherence-fill.good { background: var(--primary); }
.adherence-fill.warn { background: var(--warning); }
.adherence-fill.bad { background: var(--error); }

/* ── Plan Targets ── */
.plan-targets {
    display: flex;
    gap: 12px;
    margin: 8px 0;
    flex-wrap: wrap;
}

.plan-targets span {
    font-size: 12px;
    color: var(--muted);
    font-weight: 600;
}

.plan-targets span strong {
    color: var(--accent);
    font-weight: 800;
}

/* ── AI accept buttons row ── */
.ai-actions {
    display: flex;
    gap: 8px;
    margin-top: 10px;
}

.ai-actions .btn {
    flex: 1;
}

/* ── Clickable stat card ── */
.stat-card[onclick] {
    cursor: pointer;
}

/* ── App Footer ── */
.app-footer {
    text-align: center;
    padding: 16px 20px 24px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0));
    font-size: 11px;
    color: var(--muted);
    letter-spacing: .3px;
    margin-bottom: 60px;
}

.app-footer a {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
    transition: opacity var(--transition);
}

.app-footer a:hover {
    opacity: .8;
}

/* ── Responsive Desktop ── */
@media (min-width: 481px) {
    .app-content {
        padding: 24px;
        padding-bottom: 100px;
    }

    .tab-bar {
        max-width: 500px;
        left: 50%;
        transform: translateX(-50%);
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        border: 1px solid var(--glass-border);
        border-bottom: none;
    }

    .fab {
        right: calc(50% - 250px + 20px);
    }

    .card:hover {
        transform: translateY(-1px);
        box-shadow: 0 8px 32px rgba(0, 0, 0, .2);
    }
}

@media (min-width: 768px) {
    .app-header {
        max-width: 500px;
        margin: 0 auto;
        border-left: 1px solid var(--glass-border);
        border-right: 1px solid var(--glass-border);
    }
}
