/* ============================================
   LET IT TRACK — MODERN NATIVE DESIGN SYSTEM
   iOS / Android Native PWA & Responsive Web
   ============================================ */

:root {
    /* Brand & Color Palette (Serene Emerald / Teal Modern Native) */
    --primary: #0d9488;
    --primary-hover: #0f766e;
    --primary-active: #115e59;
    --primary-light: #ccfbf1;
    --primary-lighter: #e6fffa;
    --primary-glow: rgba(13, 148, 136, 0.22);
    --primary-container: #0d9488;
    --on-primary-container: #ffffff;
    
    /* Neutrals & Backgrounds */
    --navy: #0f172a;
    --bg: #f8fafc;
    --bg-alt: #ffffff;
    --surface: #ffffff;
    --surface-container-low: #f1f5f9;
    --surface-container-high: #e2e8f0;
    --surface-container-highest: #cbd5e1;
    --surface-container-lowest: #ffffff;
    --text: #0f172a;
    --text-main: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --border-light: #f1f5f9;
    --outline-variant: #cbd5e1;
    --success: #10b981;
    --pending: #e2e8f0;
    --danger: #ef4444;

    /* Category Accents */
    --cat-water: #0284c7;
    --cat-nutrition: #10b981;
    --cat-meals: #f59e0b;
    --cat-supplements: #8b5cf6;
    --cat-sleep: #6366f1;
    --cat-weight: #ec4899;

    /* Glassmorphism & Shadow Tokens */
    --glass-bg: rgba(255, 255, 255, 0.88);
    --glass-border: rgba(255, 255, 255, 0.6);
    --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 16px -2px rgba(0, 0, 0, 0.06), 0 2px 6px -1px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 12px 30px -4px rgba(0, 0, 0, 0.08), 0 4px 12px -2px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 25px rgba(13, 148, 136, 0.18);
    
    /* Animation Timings */
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
    --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    background-color: var(--bg);
    color: var(--text);
    -webkit-user-select: none;
    user-select: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    touch-action: manipulation;
    overscroll-behavior-y: contain;
}

body {
    display: flex;
    flex-direction: column;
    overflow: clip;
    position: fixed;
    inset: 0;
}

#app {
    position: fixed;
    inset: 0;
    overflow: clip;
    display: flex;
    flex-direction: column;
    background: var(--bg);
}

/* ============================================
   KEYFRAME ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInScale {
    from { opacity: 0; transform: scale(0.98) translateY(8px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes slideUpFade {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideDownFade {
    from { opacity: 0; transform: translateY(-16px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-6px); }
    40%, 80% { transform: translateX(6px); }
}

@keyframes checkPop {
    0% { transform: scale(0.7); }
    50% { transform: scale(1.22); }
    100% { transform: scale(1); }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 0 0 var(--primary-glow); }
    50% { box-shadow: 0 0 0 8px rgba(13, 148, 136, 0); }
}

@keyframes orbFloat1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(30px, -25px) scale(1.1); }
}

@keyframes orbFloat2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-25px, 30px) scale(1.15); }
}

/* Material Symbols Outlined Icon Styling */
.material-symbols-outlined {
    font-family: 'Material Symbols Outlined';
    font-weight: normal;
    font-style: normal;
    font-size: 22px;
    line-height: 1;
    letter-spacing: normal;
    text-transform: none;
    display: inline-block;
    white-space: nowrap;
    word-wrap: normal;
    direction: ltr;
    -webkit-font-feature-settings: 'liga';
    -webkit-font-smoothing: antialiased;
    font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
    transition: transform 0.2s var(--ease-spring), color 0.2s ease;
}

.material-symbols-outlined.filled {
    font-variation-settings: 'FILL' 1, 'wght' 400, 'GRAD' 0, 'opsz' 24;
}

/* ============================================
   AUTH GATE & LOGIN REDESIGN
   ============================================ */
.auth-gate-wrapper {
    position: fixed;
    inset: 0;
    z-index: 9998;
    background: radial-gradient(circle at 10% 20%, rgba(13, 148, 136, 0.08) 0%, transparent 40%),
                radial-gradient(circle at 90% 80%, rgba(99, 102, 241, 0.06) 0%, transparent 40%),
                var(--bg);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: calc(20px + env(safe-area-inset-top, 0px)) 20px calc(24px + env(safe-area-inset-bottom, 0px)) 20px;
}

.auth-ambient-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(50px);
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
}

.auth-orb-1 {
    width: 260px;
    height: 260px;
    top: -40px;
    left: -40px;
    background: radial-gradient(circle, rgba(13, 148, 136, 0.25) 0%, transparent 70%);
    animation: orbFloat1 12s ease-in-out infinite;
}

.auth-orb-2 {
    width: 300px;
    height: 300px;
    bottom: -60px;
    right: -60px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.18) 0%, transparent 70%);
    animation: orbFloat2 15s ease-in-out infinite;
}

.auth-card-modern {
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 36px 30px;
    width: 100%;
    max-width: 440px;
    box-shadow: var(--shadow-lg), var(--shadow-glow);
    position: relative;
    z-index: 1;
    animation: fadeInScale 0.4s var(--ease-smooth) forwards;
}

.auth-logo-badge {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
    position: relative;
}

.auth-logo-img {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    box-shadow: 0 8px 20px -4px rgba(13, 148, 136, 0.3);
    transition: transform 0.3s var(--ease-spring);
}

.auth-logo-img:hover {
    transform: scale(1.06) rotate(-2deg);
}

.auth-heading {
    font-size: 22px;
    font-weight: 700;
    text-align: center;
    color: var(--text);
    letter-spacing: -0.02em;
    margin-bottom: 6px;
}

.auth-subheading {
    font-size: 14px;
    color: var(--text-muted);
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Role Segmented Selector Pills */
.role-pills {
    display: flex;
    background: var(--surface-container-low);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 4px;
    gap: 4px;
    margin-bottom: 20px;
}

.role-pill {
    flex: 1;
    text-align: center;
    padding: 8px 6px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    border: none;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s var(--ease-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.role-pill:hover {
    color: var(--text);
}

.role-pill.active {
    background: var(--bg-alt);
    color: var(--primary);
    box-shadow: var(--shadow-sm);
}

/* Animated Alerts */
.alert-error, .alert-modern-error {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: var(--danger);
    padding: 12px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 16px;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 8px;
    animation: shake 0.4s ease-in-out;
}

.alert-modern-error::before {
    content: "error";
    font-family: 'Material Symbols Outlined';
    font-size: 18px;
    flex-shrink: 0;
}

/* Password Toggle Field */
.pw-toggle-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.pw-toggle-wrap input[type="password"],
.pw-toggle-wrap input[type="text"].pw-toggle-active {
    width: 100%;
    padding-right: 46px;
}

.pw-toggle-btn {
    position: absolute;
    right: 6px;
    top: 50%;
    transform: translateY(-50%);
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: 8px;
    padding: 0;
    z-index: 1;
    transition: background 0.15s, color 0.15s, transform 0.1s;
}

.pw-toggle-btn:hover {
    background: var(--surface-container-low);
    color: var(--text);
}

.pw-toggle-btn:active {
    transform: translateY(-50%) scale(0.92);
}

.pw-toggle-btn svg {
    width: 18px;
    height: 18px;
    pointer-events: none;
}

/* Inputs & Form Groups */
.form-group {
    margin-bottom: 16px;
    text-align: left;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 6px;
}

.form-input {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    display: block;
    box-sizing: border-box;
    height: 46px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 16px; /* 16px avoids iOS zoom */
    font-family: inherit;
    background: var(--bg-alt);
    color: var(--text);
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

input[type="time"].form-input,
input[type="date"].form-input {
    -webkit-appearance: none;
    appearance: none;
    min-width: 0;
    max-width: 100%;
    display: block;
    width: 100%;
}

.form-input::-webkit-date-and-time-value {
    min-height: 1.5em;
    line-height: normal;
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3.5px var(--primary-glow);
    background: #ffffff;
}

/* Time Input Card Wrapper (Sleep Target) */
.time-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
    min-width: 0;
    max-width: 100%;
    box-sizing: border-box;
    height: 46px;
    padding: 0 12px;
    gap: 6px;
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: 10px;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
}

.time-input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3.5px var(--primary-glow);
}

.time-input-icon {
    font-size: 18px;
    width: 18px;
    height: 18px;
    line-height: 1;
    color: var(--text-muted);
    flex-shrink: 0;
    pointer-events: none;
    user-select: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.time-input-icon.bedtime-icon {
    color: #6366f1;
}

.time-input-icon.wakeup-icon {
    color: #f59e0b;
}

.time-input-icon.trailing-icon {
    font-size: 18px;
    width: 18px;
    height: 18px;
    color: var(--text-muted);
    opacity: 0.65;
    margin-left: auto;
}

.time-input-wrap .form-input.time-input-field {
    flex: 1;
    min-width: 0;
    width: 100%;
    height: 100%;
    border: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding: 0 !important;
    margin: 0 !important;
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
    text-align: left !important;
    box-shadow: none !important;
    outline: none !important;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
    display: flex;
    align-items: center;
}

.time-input-wrap .form-input.time-input-field:focus {
    border: none !important;
    background: transparent !important;
    box-shadow: none !important;
    outline: none !important;
}

.time-input-wrap .form-input.time-input-field::-webkit-date-and-time-value {
    min-height: 1.2em;
    line-height: normal;
    text-align: left !important;
    margin: 0 !important;
    padding: 0 !important;
    font-size: 16px;
    font-weight: 500;
    color: var(--text);
}

.time-input-wrap .form-input.time-input-field::-webkit-calendar-picker-indicator {
    display: none;
    -webkit-appearance: none;
}

.form-input.input-otp {
    text-align: center;
    letter-spacing: 6px;
    font-size: 20px;
    font-weight: 700;
    font-family: monospace;
}

/* Primary and Secondary Buttons */
.btn-primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 46px;
    padding: 0 20px;
    background: var(--primary);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.25);
    transition: all 0.2s var(--ease-smooth);
    position: relative;
    overflow: hidden;
}

.btn-primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.35);
    transform: translateY(-1px);
}

.btn-primary:active {
    background: var(--primary-active);
    transform: scale(0.97);
    box-shadow: 0 1px 4px rgba(13, 148, 136, 0.2);
}

.btn-primary:disabled {
    opacity: 0.65;
    cursor: not-allowed;
    transform: none !important;
}

.btn-secondary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 0 16px;
    background: var(--bg-alt);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s var(--ease-smooth);
}

.btn-secondary:hover {
    background: var(--surface-container-low);
    border-color: var(--outline-variant);
}

.btn-secondary:active {
    transform: scale(0.97);
    background: var(--surface-container-high);
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    min-height: 44px;
    padding: 0 16px;
    background: var(--danger);
    color: #ffffff;
    border: none;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.btn-danger:active {
    transform: scale(0.97);
    opacity: 0.9;
}

/* ============================================
   SCREEN CONTAINER & TRANSITIONS
   ============================================ */
.screen {
    display: none;
    flex: 1;
    overflow: hidden;
    width: 100%;
}

.screen.active {
    display: flex;
    flex-direction: column;
    position: absolute;
    inset: 0;
    overflow: hidden;
    min-height: 0;
    animation: fadeInScale 0.28s var(--ease-smooth) forwards;
}

.screen-content {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    padding: 20px 20px calc(24px + 76px + env(safe-area-inset-bottom, 0px)) 20px;
    max-width: 620px;
    margin: 0 auto;
    width: 100%;
}

/* Header */
.screen-header {
    padding: calc(10px + env(safe-area-inset-top, 0px)) 20px 10px 20px;
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    min-height: calc(60px + env(safe-area-inset-top, 0px));
    max-width: 620px;
    margin: 0 auto;
    width: 100%;
    position: sticky;
    top: 0;
    z-index: 90;
}

.brand-header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.brand-header-logo {
    height: 32px;
    width: auto;
    display: block;
    border-radius: 8px;
}

.header-icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    border: 1px solid transparent;
    background: transparent;
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s var(--ease-smooth);
}

.header-icon-btn:hover {
    background: var(--surface-container-low);
    border-color: var(--border);
}

.header-icon-btn:active {
    transform: scale(0.92);
}

.header-avatar {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--primary-light);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    border: 2px solid #ffffff;
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    overflow: hidden;
    padding: 0;
    position: relative;
    transition: transform 0.2s var(--ease-spring), box-shadow 0.2s;
}

.header-avatar:hover {
    transform: scale(1.08);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.header-avatar:active {
    transform: scale(0.92);
}

.header-avatar img.avatar-photo {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

.header-avatar .avatar-initials {
    position: relative;
    z-index: 1;
}

.header-avatar.has-photo .avatar-initials {
    display: none;
}

/* ============================================
   FLOATING GLASSMORPHIC BOTTOM NAVIGATION DOCK
   ============================================ */
.nav-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    min-height: 64px;
    height: calc(64px + env(safe-area-inset-bottom, 0px));
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(24px);
    backdrop-filter: blur(24px);
    border-top: 1px solid rgba(226, 232, 240, 0.8);
    box-shadow: 0 -4px 20px -2px rgba(0, 0, 0, 0.04);
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    padding-top: 4px;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
    z-index: 100;
    max-width: 620px;
    margin: 0 auto;
}

.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    height: 56px;
    padding: 4px 0;
    cursor: pointer;
    border: none;
    background: none;
    color: var(--text-muted);
    transition: color 0.2s ease, transform 0.15s var(--ease-spring);
    font-size: 11px;
    font-weight: 500;
}

.nav-item:active {
    transform: scale(0.9);
}

.nav-item.active {
    color: var(--primary);
    font-weight: 700;
}

.nav-indicator {
    position: absolute;
    top: -4px;
    width: 24px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 6px 6px;
    display: none;
    box-shadow: 0 2px 6px var(--primary-glow);
    animation: fadeIn 0.2s ease;
}

.nav-item.active .nav-indicator {
    display: block;
}

.nav-item-icon {
    font-size: 22px;
    margin-bottom: 2px;
    transition: transform 0.25s var(--ease-spring);
}

.nav-item.active .nav-item-icon {
    transform: translateY(-2px);
}

/* ============================================
   TODAY SCREEN & CARDS
   ============================================ */
.role-switch-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.08) 0%, rgba(99, 102, 241, 0.06) 100%);
    border: 1px solid rgba(13, 148, 136, 0.22);
    border-radius: 14px;
    padding: 10px 14px;
    margin-bottom: 18px;
    gap: 10px;
    font-size: 13px;
}

.role-switch-content {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
    min-width: 0;
    flex: 1;
}

.role-switch-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: var(--primary);
    color: #ffffff;
    text-decoration: none;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 8px;
    white-space: nowrap;
    flex-shrink: 0;
    transition: background 0.15s var(--ease-smooth), transform 0.1s;
}

.role-switch-btn:hover {
    background: var(--primary-hover);
}

.role-switch-btn:active {
    transform: scale(0.96);
}

.greeting-container {
    margin-bottom: 20px;
    animation: slideUpFade 0.3s var(--ease-smooth) forwards;
}

.greeting-date-caps {
    font-size: 11px;
    font-weight: 700;
    color: var(--primary);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 4px;
}

.greeting {
    font-size: 26px;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.03em;
}

/* Daily Balance Card */
.daily-balance-card {
    background: linear-gradient(135deg, var(--bg-alt) 0%, var(--surface-container-low) 100%);
    padding: 20px;
    border-radius: 20px;
    margin-bottom: 20px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.daily-balance-card:hover {
    box-shadow: var(--shadow-md);
}

.daily-balance-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 14px;
}

.daily-balance-title {
    font-size: 17px;
    font-weight: 700;
    color: var(--text);
}

.daily-balance-subtitle {
    font-size: 13px;
    color: var(--text-muted);
    margin-top: 2px;
}

.daily-balance-score {
    font-size: 32px;
    font-weight: 800;
    color: var(--primary);
    line-height: 1;
    letter-spacing: -0.03em;
}

.progress-track {
    width: 100%;
    height: 10px;
    background: var(--surface-container-high);
    border-radius: 999px;
    overflow: hidden;
    padding: 2px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary) 0%, #14b8a6 100%);
    border-radius: 999px;
    transition: width 0.7s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 1px 4px var(--primary-glow);
}

/* Quick Log Bento Grid Trigger */
.quick-log-trigger {
    width: 100%;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: #ffffff;
    border: none;
    border-radius: 16px;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    margin-bottom: 24px;
    font-family: inherit;
    box-shadow: 0 6px 20px -3px rgba(13, 148, 136, 0.35);
    transition: transform 0.15s var(--ease-spring), box-shadow 0.2s;
}

.quick-log-trigger:active {
    transform: scale(0.97);
    box-shadow: 0 2px 8px rgba(13, 148, 136, 0.2);
}

.quick-log-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.quick-log-title {
    font-size: 16px;
    font-weight: 700;
}

.quick-log-subtitle {
    font-size: 12px;
    opacity: 0.9;
}

/* Sections */
.section {
    margin-bottom: 24px;
}

.section-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Tracking Checklist Item Row */
.item-row {
    width: 100%;
    background: var(--bg-alt);
    padding: 14px 16px;
    min-height: 56px;
    border-radius: 14px;
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: transform 0.15s var(--ease-spring), border-color 0.2s, box-shadow 0.2s;
    text-align: left;
}

.item-row:hover {
    border-color: var(--outline-variant);
    box-shadow: var(--shadow-md);
}

.item-row:active {
    transform: scale(0.985);
}

.item-row-left {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
    min-width: 0;
}

.item-badge {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--surface-container-low);
    color: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: background 0.2s, color 0.2s;
}

.item-row-info {
    flex: 1;
    min-width: 0;
}

.item-row-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.item-row-sub {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
}

.item-check-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid var(--outline-variant);
    background: transparent;
    color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s var(--ease-spring);
    flex-shrink: 0;
}

.item-check-btn:hover {
    border-color: var(--primary);
    background: var(--primary-lighter);
}

.item-check-btn.completed {
    background: var(--primary);
    border-color: var(--primary);
    color: #ffffff;
    box-shadow: 0 2px 8px var(--primary-glow);
    animation: checkPop 0.3s var(--ease-spring);
}

/* Water Display & Buttons */
.water-display {
    background: var(--bg-alt);
    padding: 18px;
    border-radius: 16px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.water-amount {
    font-size: 24px;
    font-weight: 700;
    color: var(--cat-water);
    margin-bottom: 2px;
    letter-spacing: -0.02em;
}

.water-amount-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
}

.water-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 14px;
}

.btn-water {
    padding: 12px;
    min-height: 46px;
    border: 1px solid rgba(2, 132, 199, 0.3);
    background: rgba(2, 132, 199, 0.05);
    border-radius: 10px;
    font-size: 14px;
    color: var(--cat-water);
    font-weight: 700;
    cursor: pointer;
    transition: all 0.15s var(--ease-spring);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-water:hover {
    background: rgba(2, 132, 199, 0.12);
    border-color: var(--cat-water);
}

.btn-water:active {
    transform: scale(0.96);
    background: rgba(2, 132, 199, 0.2);
}

.btn-undo-water {
    padding: 8px 14px;
    min-height: 38px;
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.15s;
}

.btn-undo-water:hover {
    background: var(--surface-container-low);
    color: var(--text);
}

/* Sleep & Weight Display */
.data-display {
    background: var(--bg-alt);
    padding: 16px 18px;
    border-radius: 14px;
    margin-bottom: 12px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.data-display.sleep { border-left: 4px solid var(--cat-sleep); }
.data-display.sleep .data-value { color: var(--cat-sleep); }
.data-display.weight { border-left: 4px solid var(--cat-weight); }
.data-display.weight .data-value { color: var(--cat-weight); }

.data-value {
    font-size: 24px;
    font-weight: 700;
}

.btn-sm {
    padding: 8px 14px;
    min-height: 38px;
    background: var(--surface-container-low);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-sm:hover {
    background: var(--surface-container-high);
}

/* Bento Grid */
.bento-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.bento-item-hero {
    grid-column: span 2;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-hover) 100%);
    color: #ffffff;
    border-radius: 16px;
    padding: 18px 20px;
    height: 100px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    border: none;
    text-align: left;
    box-shadow: 0 4px 14px rgba(13, 148, 136, 0.3);
    transition: transform 0.15s var(--ease-spring), box-shadow 0.2s;
}

.bento-item-hero:active {
    transform: scale(0.97);
}

.bento-item {
    background: var(--surface-container-low);
    border-radius: 14px;
    padding: 14px;
    height: 90px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    cursor: pointer;
    border: 1px solid var(--border);
    text-align: left;
    transition: transform 0.15s var(--ease-spring), background 0.2s;
}

.bento-item:hover {
    background: #ffffff;
    border-color: var(--outline-variant);
    box-shadow: var(--shadow-sm);
}

.bento-item:active {
    transform: scale(0.96);
    background: var(--surface-container-high);
}

.bento-title {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text);
}

/* Meal Photo Picker */
.meal-photo-section {
    margin-top: 12px;
}

.photo-picker-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 14px;
    background: var(--surface-container-low);
    border: 1px dashed var(--outline-variant);
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    cursor: pointer;
    transition: all 0.2s;
}

.photo-picker-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--primary-lighter);
}

.meal-thumbnail {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    object-fit: cover;
    border: 1px solid var(--border);
    cursor: pointer;
    transition: transform 0.2s var(--ease-spring);
}

.meal-thumbnail:hover {
    transform: scale(1.06);
}

.lightbox-modal {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(0, 0, 0, 0.88);
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.lightbox-modal.active {
    display: flex;
}

.lightbox-img {
    max-width: 90vw;
    max-height: 80vh;
    border-radius: 16px;
    object-fit: contain;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    animation: fadeInScale 0.25s var(--ease-smooth);
}

.lightbox-close {
    position: absolute;
    top: calc(20px + env(safe-area-inset-top, 0px));
    right: 20px;
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: #ffffff;
    font-size: 24px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============================================
   PROGRESS & HISTORY CARDS
   ============================================ */
.progress-card, .history-day {
    background: var(--bg-alt);
    padding: 20px;
    border-radius: 16px;
    margin-bottom: 16px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

.progress-card:hover, .history-day:hover {
    box-shadow: var(--shadow-md);
}

.progress-item, .history-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
    font-size: 14px;
}

.progress-item:last-child, .history-item:last-child {
    margin-bottom: 0;
}

.progress-label, .history-item-label {
    color: var(--text);
    font-weight: 500;
}

.progress-value, .history-item-value {
    font-weight: 700;
    color: var(--primary);
}

/* Today Pro Card */
.today-pro-card {
    background: linear-gradient(135deg, rgba(13, 148, 136, 0.06) 0%, rgba(99, 102, 241, 0.04) 100%);
    border: 1px solid rgba(13, 148, 136, 0.2);
    border-radius: 16px;
    padding: 16px 18px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
}

/* ============================================
   SETTINGS, TOGGLES & LIST ITEMS
   ============================================ */
.settings-section {
    margin-bottom: 24px;
}

.settings-section-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.settings-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 10px;
}

.form-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 12px;
}

.form-row > .form-group {
    margin-bottom: 0;
    min-width: 0;
}

@media (max-width: 360px) {
    .form-row {
        grid-template-columns: 1fr;
        gap: 8px;
    }
}

.list-item, .reminder-row, .setting-toggle {
    background: var(--bg-alt);
    padding: 12px 14px;
    border-radius: 14px;
    margin-bottom: 8px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

.list-item:hover, .reminder-row:hover, .setting-toggle:hover {
    border-color: var(--outline-variant);
    box-shadow: var(--shadow-md);
}

.list-item-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
    word-break: break-word;
    flex: 1;
}

.item-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.reminder-row-info {
    flex: 1;
    min-width: 0;
}

.reminder-row-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.reminder-row-schedule {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.reminder-row-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
}

.setting-toggle-label {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.setting-toggle-sublabel {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.4;
    margin-top: 2px;
}

/* Toggle Switch & Slider compatibility */
.toggle-switch, .switch {
    position: relative;
    display: inline-block;
    width: 46px;
    height: 28px;
    flex-shrink: 0;
}

.toggle-switch input, .switch input {
    opacity: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    cursor: pointer;
    position: absolute;
    z-index: 1;
}

.toggle-switch .toggle-track, .slider {
    position: absolute;
    inset: 0;
    background: var(--surface-container-high);
    border-radius: 999px;
    transition: background 0.25s var(--ease-smooth);
}

.slider::before {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.25s var(--ease-spring);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
}

.toggle-switch .toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.25s var(--ease-spring);
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
}

.toggle-switch input:checked ~ .toggle-track, .switch input:checked + .slider {
    background: var(--primary);
}

.toggle-switch input:checked ~ .toggle-thumb {
    transform: translateX(18px);
}

.switch input:checked + .slider::before {
    transform: translateX(18px);
}

/* Permission Banner */
.permission-banner {
    background: rgba(13, 148, 136, 0.08);
    border: 1px solid rgba(13, 148, 136, 0.22);
    border-radius: 12px;
    padding: 12px 14px;
    margin-top: 8px;
    margin-bottom: 12px;
    font-size: 13px;
    line-height: 1.5;
}

.permission-banner.banner-warning {
    background: #fef3c7;
    border-color: #fde68a;
    color: #92400e;
}

.permission-banner.banner-neutral {
    background: var(--surface-container-low);
    border-color: var(--border);
    color: var(--text-muted);
}

.permission-banner-text {
    font-size: 13px;
    margin-bottom: 8px;
    color: inherit;
    line-height: 1.4;
}

.permission-status {
    font-size: 12px;
    margin-top: 6px;
}

/* Empty State Helper */
.empty-state {
    padding: 18px 14px;
    text-align: center;
    background: var(--bg-alt);
    border: 1px dashed var(--border);
    border-radius: 12px;
    margin-bottom: 8px;
}

.empty-state-text {
    font-size: 13px;
    color: var(--text-muted);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    min-height: 40px;
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 10px;
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.15s, color 0.15s;
    padding: 0;
}

.btn-icon:hover {
    background: var(--surface-container-low);
    color: var(--text);
}

.btn-icon:active {
    transform: scale(0.92);
}

.btn-icon.btn-icon-danger {
    color: var(--danger);
}

.btn-icon.btn-icon-danger:hover {
    background: rgba(239, 68, 68, 0.1);
}

/* ============================================
   MODALS / NATIVE BOTTOM SHEETS
   ============================================ */
.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    animation: fadeIn 0.2s ease forwards;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: var(--bg-alt);
    width: 100%;
    max-width: 620px;
    margin: auto auto 0 auto;
    border-radius: 24px 24px 0 0;
    padding: 24px 22px calc(30px + env(safe-area-inset-bottom, 0px)) 22px;
    max-height: 90vh;
    max-height: 90dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.15);
    position: relative;
    animation: modalSlideUp 0.32s var(--ease-smooth) forwards;
}

@keyframes modalSlideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    position: relative;
}

.modal-header::before {
    content: "";
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    background: var(--surface-container-high);
    border-radius: 999px;
}

.modal-title {
    font-size: 19px;
    font-weight: 700;
    color: var(--text);
}

.modal-close {
    background: var(--surface-container-low);
    border: none;
    font-size: 18px;
    color: var(--text-muted);
    cursor: pointer;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.modal-close:hover {
    background: var(--surface-container-high);
    color: var(--text);
}

.modal-close:active {
    transform: scale(0.9);
}

/* Checkbox Row */
.checkbox-row {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text);
    cursor: pointer;
}

.checkbox-row input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ============================================
   PWA INSTALL BANNER & HELPER
   ============================================ */
.pwa-banner-card {
    position: fixed;
    bottom: calc(72px + env(safe-area-inset-bottom, 0px));
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    background: var(--glass-bg);
    -webkit-backdrop-filter: blur(20px);
    backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    padding: 14px 18px;
    box-shadow: var(--shadow-lg);
    max-width: 380px;
    width: calc(100% - 32px);
    display: flex;
    align-items: center;
    gap: 12px;
    animation: slideUpFade 0.35s var(--ease-spring);
}

/* Day Picker Chips */
.day-picker {
    display: flex;
    gap: 6px;
    margin-top: 6px;
}

.day-chip {
    flex: 1;
    position: relative;
    cursor: pointer;
}

.day-chip input {
    position: absolute;
    opacity: 0;
}

.day-chip span {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 38px;
    background: var(--surface-container-low);
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    transition: all 0.15s var(--ease-smooth);
}

.day-chip input:checked + span {
    background: var(--primary);
    color: #ffffff;
    border-color: var(--primary);
    box-shadow: 0 2px 6px var(--primary-glow);
}

/* ============================================
   RESPONSIVE DESKTOP ENHANCEMENT
   ============================================ */
@media (min-width: 768px) {
    .screen-content {
        padding-top: 28px;
    }

    .auth-card-modern {
        padding: 44px 38px;
    }

    .modal-content {
        border-radius: 20px;
        margin: auto;
        padding-bottom: 28px;
        max-height: 85vh;
        animation: fadeInScale 0.25s var(--ease-smooth) forwards;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
    }
}
