:root {
    /* Premium Dark Theme */
    --bg-color: #050511;
    /* Extremely dark deep blue/black */
    --bg-secondary: rgba(5, 5, 17, 0.95);
    --card-bg: rgba(255, 255, 255, 0.03);
    /* Subtle glass */
    --card-bg-light: #101223;
    --text-color: #F9FAFB;
    --text-secondary: #9CA3AF;
    --text-dark: #111827;

    /* Neon/Vibrant Accents for Dark Mode */
    --accent-green: #10B981;
    /* Neon Emerald */
    --accent-blue: #0EA5E9;
    /* Electric Blue/Teal */
    --accent-red: #F43F5E;
    /* Ruby/Neon Rose */
    --accent-yellow: #FACC15;

    --border-color: rgba(255, 255, 255, 0.06);
    --shadow-strong: 0 12px 40px rgba(0, 0, 0, 0.6);
    --shadow-soft: 0 4px 20px rgba(0, 0, 0, 0.4);

    --font-family: 'Inter', system-ui, -apple-system, sans-serif;

    /* Components */
    --modal-bg: rgba(16, 18, 35, 0.95);
    --input-bg: rgba(0, 0, 0, 0.5);
    --nav-bg: rgba(5, 5, 17, 0.85);
    /* For floating dock */
    --nav-border: rgba(255, 255, 255, 0.08);
    --toast-bg: rgba(16, 18, 35, 0.98);
    --toast-border: rgba(255, 255, 255, 0.1);
    --profile-card-bg: rgba(255, 255, 255, 0.04);
    --profile-card-border: rgba(255, 255, 255, 0.08);
}

/* ======= LIGHT THEME (Premium Sunlight-Readable) ======= */
[data-theme="light"] {
    --bg-color: #F8FAFC;
    --bg-secondary: rgba(248, 250, 252, 0.95);
    --card-bg: #FFFFFF;
    --card-bg-light: #FFFFFF;
    --text-color: #0F172A;
    --text-secondary: #475569;
    --text-dark: #0F172A;

    /* Darker, richer accents for sunlight readability */
    --accent-green: #059669;
    /* Deep Emerald */
    --accent-blue: #0284C7;
    /* Deep Sky Blue/Teal */
    --accent-red: #E11D48;
    /* Deep Rose */
    --accent-yellow: #CA8A04;

    --border-color: rgba(0, 0, 0, 0.06);
    --shadow-strong: 0 16px 40px rgba(0, 0, 0, 0.06);
    --shadow-soft: 0 4px 16px rgba(0, 0, 0, 0.03);

    --modal-bg: rgba(255, 255, 255, 0.98);
    --input-bg: rgba(0, 0, 0, 0.04);
    --nav-bg: rgba(255, 255, 255, 0.85);
    --nav-border: rgba(0, 0, 0, 0.05);
    --toast-bg: rgba(255, 255, 255, 0.98);
    --toast-border: rgba(0, 0, 0, 0.05);
    --profile-card-bg: #FFFFFF;
    --profile-card-border: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .timer-large {
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    font-weight: 800;
}

[data-theme="light"] .floating-emoji {
    filter: drop-shadow(0 10px 15px rgba(0, 0, 0, 0.15));
}

[data-theme="light"] .btn-close {
    border: none;
    background: rgba(255, 59, 48, 0.1);
    color: #ff3b30;
}

/* Info Fields - CLEAN TEXT ONLY in Light Mode */
/* Note: These rules are now redundant if default is also clean, but keeping for safety */
[data-theme="light"] .shift-timer-container {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin-bottom: 20px;
}

[data-theme="light"] .shift-timer-value {
    font-size: 20px;
}

/* Limit Badge - CLEAN TEXT ONLY in Light Mode */
[data-theme="light"] .limit-badge {
    background: transparent;
    border: none;
    box-shadow: none;
    padding: 0;
    margin-bottom: 8px;
    /* Tighter */
    font-size: 16px;
    font-weight: 800;
}

/* Specific colors for text-only limit */
[data-theme="light"] .limit-green {
    color: #34c759;
    background: transparent;
    border: none;
}

[data-theme="light"] .limit-yellow {
    color: #ffcc00;
    background: transparent;
    border: none;
}

[data-theme="light"] .limit-red {
    color: #ff3b30;
    background: transparent;
    border: none;
}

/* Keep frames for CARDS and BUTTONS */
[data-theme="light"] .pause-card {
    background: #ffffff;
    border: none;
    box-shadow: var(--shadow-strong);
}

[data-theme="light"] .btn-tacho-edit {
    background: #ffffff;
    border: none;
    box-shadow: var(--shadow-soft);
    color: var(--text-secondary);
}

[data-theme="light"] .nav-label {
    color: var(--text-color);
}

[data-theme="light"] .modal-card {
    background: #ffffff;
    border: none;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
}

[data-theme="light"] .modal-btn-cancel {
    background: #f2f2f7;
    color: #007aff;
    border: none;
}

/* Profile Card Light Mode */
[data-theme="light"] .profile-card {
    box-shadow: var(--shadow-strong);
    /* Keep card look for profile */
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-family);
    background-color: var(--bg-color);
    color: var(--text-color);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

/* Company subtitle bar */
.company-bar {
    padding: 6px 20px 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    opacity: 0.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: -4px;
}

/* Navigation Floating Dock */
.nav-bar {
    display: flex;
    justify-content: space-around;
    padding: 12px 10px;
    background-color: var(--nav-bg);
    backdrop-filter: blur(32px) saturate(180%);
    -webkit-backdrop-filter: blur(32px) saturate(180%);
    border: 1px solid var(--border-color);
    border-radius: 32px;
    position: fixed;
    bottom: max(24px, env(safe-area-inset-bottom, 24px));
    left: 16px;
    right: 16px;
    width: auto;
    z-index: 100;
    box-shadow: var(--shadow-strong);
}

.nav-item {
    background: none;
    border: none;
    font-size: 13px;
    cursor: pointer;
    opacity: 0.5;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);

    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 4px 6px;
    color: var(--text-color);
}

.nav-icon {
    font-size: 24px;
    line-height: 1;
}

.nav-item.active {
    opacity: 1;
    transform: translateY(-8px);
    color: var(--accent-blue);
    filter: drop-shadow(0 4px 16px rgba(14, 165, 233, 0.6));
}

.nav-label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

/* Main Content Area */
#content {
    flex: 1;
    padding: 24px 20px;
    padding-top: calc(30px + env(safe-area-inset-top));
    padding-bottom: calc(140px + env(safe-area-inset-bottom, 24px));
    /* Space for floating dock */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    width: 100%;
    max-width: 90%;
    margin: 0 auto;
}

/* ========= DASHBOARD GRID (2x2 glass cards) ========= */
.dashboard-section {
    margin-bottom: 16px;
}

.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.grid-card {
    padding: 18px 14px;
    border-radius: 24px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    text-align: center;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    min-height: 110px;
    aspect-ratio: 1 / 1;
    justify-content: center;
    box-shadow: var(--shadow-soft);
}

.grid-card:active {
    background: rgba(255, 255, 255, 0.08);
    /* Slightly more opaque on press */
    transform: scale(0.92);
}

.grid-card-icon {
    font-size: 32px;
    line-height: 1;
}

.grid-card-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    opacity: 0.8;
}

.grid-card-value {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-color);
}

.grid-card-badge {
    padding: 3px 10px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 700;
}

.badge-green {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.badge-red {
    background: rgba(239, 68, 68, 0.15);
    color: #ef4444;
}

.badge-gray {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
}

.badge-blue {
    background: rgba(59, 130, 246, 0.15);
    color: #60a5fa;
}

.text-green {
    color: #22c55e !important;
}

.text-yellow {
    color: #facc15 !important;
}

.text-red {
    color: #ef4444 !important;
}

/* Light theme dashboard */
[data-theme="light"] .grid-card {
    background: var(--card-bg);
    /* Opaque white */
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-soft);
}

[data-theme="light"] .grid-card:active {
    background: #F8FAFC;
    transform: scale(0.92);
}

/* Header */
header {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    height: 50px;
    padding: 10px 20px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    z-index: 101;
    /* Stabilize header stacking context */
}

/* GPS Indicator */
.gps-indicator {
    position: absolute;
    left: 60px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    z-index: 200;
    transition: all 0.3s ease;
}

.gps-on {
    text-shadow: 0 0 8px #22c55e, 0 0 16px #22c55e;
    filter: drop-shadow(0 0 4px #22c55e);
}

.gps-off {
    text-shadow: 0 0 8px #ef4444, 0 0 16px #ef4444;
    filter: drop-shadow(0 0 4px #ef4444);
    animation: gps-pulse 2s ease-in-out infinite;
}

@keyframes gps-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.4;
    }
}

/* GPS Error Overlay */
.gps-error-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999999;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.gps-error-card {
    text-align: center;
    padding: 40px 30px;
    max-width: 320px;
    background: rgba(30, 41, 59, 0.9);
    border-radius: 24px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 40px rgba(239, 68, 68, 0.2);
}

.gps-error-icon {
    font-size: 64px;
    margin-bottom: 16px;
    animation: gps-pulse 2s ease-in-out infinite;
}

.gps-error-card h2 {
    color: #ef4444;
    font-size: 24px;
    font-weight: 800;
    margin: 0 0 12px;
}

.gps-error-card p {
    color: var(--text-secondary);
    font-size: 15px;
    line-height: 1.5;
    margin: 0 0 8px;
}

.gps-error-warning {
    color: #fbbf24 !important;
    font-size: 14px !important;
    margin-bottom: 24px !important;
}

.gps-error-btn {
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    border: none;
    border-radius: 14px;
    padding: 14px 40px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.15s;
}

.gps-error-btn:active {
    transform: scale(0.95);
}

#page-title {
    font-size: 16px;
    font-weight: 400;
    margin: 0;
    margin-top: 10px;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.2;
    pointer-events: none;
    user-select: none;
}

/* Theme Toggle Container */
#theme-toggle-container {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 1000001;
}

#theme-toggle {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    cursor: pointer;
    font-size: 20px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
}

#theme-toggle:active {
    transform: scale(0.92);
}

/* Profile Button */
.profile-btn {
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    font-size: 18px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.1s;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
}

.header-close-btn {
    position: fixed;
    top: calc(14px + env(safe-area-inset-top, 0px));
    right: 64px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0 14px;
    height: 34px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-color);
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 40000;
}

/* State Views */
.state-view {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding-top: 5px;
    height: 100%;
    width: 100%;
}

/* Typography & Display */
.timer-large {
    font-size: 72px;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    margin-bottom: 25px;
    text-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    letter-spacing: -3px;
    transition: all 0.5s ease;
}

.timer-warning {
    color: var(--accent-yellow) !important;
    text-shadow: 0 8px 32px rgba(250, 204, 21, 0.4) !important;
}

.timer-danger {
    color: var(--accent-red) !important;
    text-shadow: 0 8px 32px rgba(244, 63, 94, 0.4) !important;
}

.status-label {
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 2px;
    opacity: 0.6;
    margin-bottom: 10px;
    font-weight: 600;
}

/* 15h Shift Timer - UNIFIED CLEAN STYLE (Default & Dark) */
.shift-timer-container {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    padding: 0;
    /* Removed padding */
    background: transparent;
    /* Removed bg */
    border: none;
    /* Removed border */
    border-radius: 0;
    backdrop-filter: none;
    box-shadow: none;
}

.shift-timer-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.shift-timer-value {
    font-size: 20px;
    /* Larger */
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    color: var(--accent-blue);
}

/* Limit Badge - UNIFIED CLEAN STYLE (Default & Dark) */
.limit-badge {
    font-size: 16px;
    /* Larger */
    font-weight: 800;
    padding: 0;
    border-radius: 0;
    margin-bottom: 12px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Colors for transparent badges (Dark Mode default) */
.limit-green {
    color: #22c55e;
    background: transparent;
    border: none;
}

.limit-yellow {
    color: #facc15;
    background: transparent;
    border: none;
}

.limit-red {
    color: #ef4444;
    background: transparent;
    border: none;
}


/* Buttons */
.btn-large-3d {
    width: 100%;
    max-width: 340px;
    padding: 22px;
    border-radius: 40px;
    /* Pill shape */
    border: none;
    font-size: 18px;
    font-weight: 800;
    text-transform: uppercase;
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 24px;
    letter-spacing: 1px;
}

.btn-large-3d:active {
    transform: scale(0.92);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-open {
    background: linear-gradient(135deg, var(--accent-green) 0%, #047857 100%);
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.4);
}

.btn-pause {
    background: linear-gradient(135deg, var(--accent-blue) 0%, #0369A1 100%);
    box-shadow: 0 8px 32px rgba(14, 165, 233, 0.4);
}

.btn-resume {
    background: linear-gradient(135deg, var(--accent-green) 0%, #047857 100%);
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.4);
}

.btn-close {
    background: rgba(244, 63, 94, 0.1);
    /* Accent Red */
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: var(--accent-red);
    padding: 16px 32px;
    border-radius: 30px;
    /* Pill */
    font-size: 16px;
    font-weight: 700;
    margin-top: auto;
    margin-bottom: env(safe-area-inset-bottom, 24px);
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.btn-close:active {
    transform: scale(0.92);
    background: rgba(244, 63, 94, 0.2);
}

.btn-tacho-edit {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    /* Soft pill */
    color: var(--text-color);
    font-size: 16px;
    font-weight: 700;
    padding: 16px 24px;
    min-height: 56px;
    width: 100%;
    max-width: 320px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-soft);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
}

.btn-tacho-edit:active {
    transform: scale(0.92);
    background: rgba(255, 255, 255, 0.1);
}

/* Pause Card */
.pause-card {
    background-color: var(--card-bg-light);
    color: var(--text-color);
    padding: 30px;
    border-radius: 32px;
    width: 100%;
    max-width: 340px;
    text-align: center;
    box-shadow: var(--shadow-strong);
    margin-bottom: 30px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid var(--border-color);
}

.floating-emoji {
    font-size: 90px;
    margin-top: 40px;
    margin-bottom: 40px;
    filter: drop-shadow(0 0 24px rgba(250, 204, 21, 0.5));
    animation: float 4s ease-in-out infinite;
}

@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-15px);
    }

    100% {
        transform: translateY(0px);
    }
}

/* Standard Components (Cards, Inputs, Modals) */
.card {
    background: var(--card-bg);
    border-radius: 24px;
    padding: 24px;
    margin-bottom: 20px;
    border: 1px solid var(--border-color);
    box-shadow: var(--shadow-soft);
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
}

.input-field {
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    border: 1px solid var(--border-color);
    background: var(--input-bg);
    color: var(--text-color);
    font-size: 16px;
    box-sizing: border-box;
    margin-bottom: 15px;
}

.btn-primary {
    width: 100%;
    padding: 16px;
    border-radius: 16px;
    border: none;
    background: linear-gradient(135deg, var(--accent-blue) 0%, #0369A1 100%);
    color: white;
    font-weight: 800;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 8px 24px rgba(14, 165, 233, 0.4);
}

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

.queue-counter {
    display: none !important;
}

/* CMR - Large Buttons */
.cmr-glass-btn {
    width: 100%;
    height: 72px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    padding-left: 24px;
    gap: 16px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    color: var(--text-color);
    margin-bottom: 16px;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    cursor: pointer;
    box-shadow: var(--shadow-soft);
    flex: none;
    backdrop-filter: blur(24px) saturate(180%);
    -webkit-backdrop-filter: blur(24px) saturate(180%);
}

.cmr-glass-btn:active {
    transform: scale(0.92);
    background: rgba(255, 255, 255, 0.1);
}

/* Profile Card - Strict Layout */
.profile-card {
    background: var(--profile-card-bg);
    border: 1px solid var(--profile-card-border);
    border-radius: 20px;
    padding: 24px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    text-align: left !important;
}

.profile-label {
    display: block;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 6px;
    margin-top: 18px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.profile-label:first-of-type {
    margin-top: 0;
}

.profile-input {
    width: 100%;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px;
    color: var(--text-color);
    font-size: 16px;
    box-sizing: border-box;
    font-family: inherit;
    margin-bottom: 0;
    /* Tightness handled by label margin-top */
}

.profile-input:focus {
    outline: none;
    border-color: #3b82f6;
    background: rgba(0, 0, 0, 0.5);
}

.btn-report {
    width: 100%;
    margin-top: 30px;
    background: linear-gradient(135deg, var(--accent-yellow) 0%, #B45309 100%);
    color: white;
    border: none;
    padding: 16px;
    border-radius: 16px;
    font-size: 16px;
    font-weight: 800;
    box-shadow: 0 8px 24px rgba(202, 138, 4, 0.4);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.section-title {
    font-size: 18px;
    font-weight: 700;
    color: #cbd5e1;
    margin: 30px 0 15px 0;
    padding-left: 4px;
    text-align: left;
}

/* Modal Overlay */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    /* Blur effect */
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 20000;
    padding: 20px;
    box-sizing: border-box;
}

.modal-card {
    background: var(--modal-bg);
    border-radius: 24px;
    padding: 30px 24px;
    width: 100%;
    max-width: 320px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.modal-title {
    font-size: 20px;
    font-weight: 800;
    color: var(--text-color);
    margin-bottom: 8px;
    text-transform: uppercase;
}

.modal-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 28px;
}

.modal-btn {
    width: 100%;
    padding: 20px;
    /* Larger for gloves */
    border-radius: 16px;
    border: none;
    font-size: 17px;
    font-weight: 800;
    cursor: pointer;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.modal-buttons {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    width: 100%;
}

.modal-buttons .modal-btn {
    width: auto;
    flex: 1;
    margin-bottom: 0;
}

.modal-btn-confirm {
    background: #ef4444;
    color: #fff;
}

.modal-btn-cancel {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}

.modal-btn-save {
    background: #3b82f6;
    color: #fff;
}

/* Helpers */
.static-time {
    font-size: 28px;
    font-weight: 700;
    color: #334155;
    margin-bottom: 5px;
}

.static-label {
    font-size: 12px;
    color: #94a3b8;
    text-transform: uppercase;
    font-weight: 600;
    margin-bottom: 20px;
}

/* Edit Inputs */
.edit-input {
    background: var(--input-bg);
    border-radius: 12px;
    border: 1px solid var(--border-color);
    color: var(--text-color);
    padding: 10px;
    font-size: 24px;
    font-weight: 700;
    text-align: center;
    width: 60px;
    -moz-appearance: textfield;
    appearance: textfield;
    /* Standard property */
}

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

.edit-input-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    align-items: center;
    margin-bottom: 24px;
}

.edit-input-group {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.edit-input-label {
    font-size: 10px;
    color: var(--text-secondary);
    margin-top: 5px;
    font-weight: 600;
    text-transform: uppercase;
}

.edit-input-sep {
    font-weight: 700;
    padding-bottom: 20px;
}

/* Version 3.7 Additions */
.card-widget {
    background: var(--card-bg);
    border-radius: 20px;
    padding: 20px;
    margin-bottom: 20px;
    border: none;
    box-shadow: var(--shadow-soft);
    display: flex;
    flex-direction: column;
    align-items: center;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

/* Native Time Input Style */
.native-time-input {
    appearance: none;
    -webkit-appearance: none;
    background: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 12px;
    font-size: 28px;
    font-weight: 700;
    color: var(--text-color);
    width: 100%;
    text-align: center;
    font-family: inherit;
    margin-bottom: 20px;
    display: block;
}

/* Focused / blurred state for Pause Modal */
.blur-content {
    transition: filter 0.3s ease;
}

.blur-active {
    filter: blur(8px);
    pointer-events: none;
    user-select: none;
}

/* Pause Modal specific (overrides/extends modal) */
.pause-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 30000;
    display: flex;
    align-items: center;
    justify-content: center;
    /* No background here, blur is on content beneath. Or semi-transparent dark? */
    /* User asked "основной экран должен заблюриться". This usually means content is blurred. 
       The overlay itself can be transparent or have a slight tint. */
    background: rgba(0, 0, 0, 0.3);
}

.pause-timer-large {
    font-size: 80px;
    font-weight: 900;
    color: var(--text-color);
    text-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
    margin-bottom: 40px;
    font-variant-numeric: tabular-nums;
}

/* v3.8 Final Polish */
[data-theme="light"] .card-widget {
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    /* Stronger border */
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    /* Deeper shadow */
}

/* Pause Modal - Live Shift Timer */
.pause-shift-display {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-color);
    margin-bottom: 5px;
    font-variant-numeric: tabular-nums;
}

/* =========================================
   v4.6 MINIMAL GLASS & 3D PATCH (SAFE MODE)
   ========================================= */

/* 1. Выпуклая гравировка (Embossed Title) */
#page-title {
    margin-top: 65px !important;
    opacity: 0.35 !important;
    font-weight: 800 !important;
    text-shadow: 1px 1px 1px rgba(255, 255, 255, 0.1), -1px -1px 1px rgba(0, 0, 0, 0.5) !important;
}

/* 2. Стеклянные блоки (Glassmorphism) */
.card-widget {
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
}

/* 3. Гарантия кликабельности верхних кнопок */
.theme-toggle,
.header-close-btn {
    z-index: 1000000 !important;
}

/* 4. Разрушение Stacking Context хедера */
header {
    z-index: auto !important;
}

/* 5. Поднимаем стандартные модальные окна выше Паузы */
.modal-overlay {
    z-index: 40000 !important;
}

/* 6. Стеклянный эффект для модальных окон (попапов) */
.modal-card {
    background: rgba(30, 41, 59, 0.7) !important;
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

/* Прозрачность для кнопки "Коррекция" (Тахограф) */
.btn-tacho-edit {
    background: rgba(255, 255, 255, 0.08) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

/* Прозрачность для кнопки "Завершить смену" */
.btn-close {
    background: rgba(255, 59, 48, 0.15) !important;
    backdrop-filter: blur(12px) !important;
    -webkit-backdrop-filter: blur(12px) !important;
    border: 1px solid rgba(255, 59, 48, 0.3) !important;
}

/* Поддержка светлой темы */
[data-theme="light"] .modal-card {
    background: rgba(255, 255, 255, 0.75) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

[data-theme="light"] .btn-tacho-edit {
    background: rgba(255, 255, 255, 0.5) !important;
    border: 1px solid rgba(0, 0, 0, 0.1) !important;
}

/* ========= SOS MODULE ========= */

/* SOS FAB */
.sos-fab {
    position: fixed;
    right: 16px;
    bottom: calc(110px + env(safe-area-inset-bottom, 35px));
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    border: none;
    font-size: 14px;
    font-weight: 900;
    letter-spacing: 1px;
    cursor: pointer;
    z-index: 9000;
    box-shadow: 0 4px 20px rgba(239, 68, 68, 0.5);
    animation: sos-glow 3s ease-in-out infinite;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sos-fab:active {
    transform: scale(0.9);
}

@keyframes sos-glow {

    0%,
    100% {
        box-shadow: 0 4px 20px rgba(239, 68, 68, 0.5);
    }

    50% {
        box-shadow: 0 4px 30px rgba(239, 68, 68, 0.8);
    }
}

/* SOS Modal Overlay */
.sos-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 50000;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.sos-card {
    width: 90%;
    max-width: 360px;
    background: rgba(30, 41, 59, 0.95);
    border-radius: 24px;
    border: 1px solid rgba(239, 68, 68, 0.3);
    padding: 28px 24px;
    position: relative;
    max-height: 85vh;
    overflow-y: auto;
}

.sos-title {
    text-align: center;
    font-size: 28px;
    font-weight: 900;
    color: #ef4444;
    margin: 0 0 20px;
}

/* SOS Action Items */
.sos-action-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    margin-bottom: 10px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
}

.sos-action-row.selected {
    border-color: #ef4444;
    background: rgba(239, 68, 68, 0.12);
}

.sos-radio,
.sos-checkbox {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s;
}

.sos-checkbox {
    border-radius: 6px;
}

.sos-radio.active,
.sos-checkbox.active {
    border-color: #ef4444;
    background: #ef4444;
}

.sos-radio.active::after {
    content: '';
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #fff;
}

.sos-checkbox.active::after {
    content: '✓';
    color: #fff;
    font-size: 14px;
    font-weight: 900;
}

.sos-action-text {
    flex: 1;
}

.sos-action-label {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-color);
}

.sos-action-desc {
    font-size: 12px;
    color: var(--text-secondary);
    margin-top: 2px;
}

.sos-action-icon {
    font-size: 24px;
}

/* SOS Buttons */
.sos-send-btn {
    width: 100%;
    padding: 16px;
    border: none;
    border-radius: 16px;
    background: linear-gradient(135deg, #ef4444, #dc2626);
    color: #fff;
    font-size: 16px;
    font-weight: 800;
    cursor: pointer;
    margin-top: 16px;
    transition: transform 0.15s;
}

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

.sos-send-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* SOS Divider */
.sos-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 20px 0;
}

/* Witness Button */
.sos-witness-btn {
    width: 100%;
    padding: 14px;
    border: 1px solid rgba(59, 130, 246, 0.3);
    border-radius: 16px;
    background: rgba(59, 130, 246, 0.1);
    color: #60a5fa;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

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

/* SOS Close */
.sos-close {
    position: absolute;
    right: 16px;
    top: 16px;
    background: none;
    border: none;
    color: rgba(255, 255, 255, 0.5);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

/* Witness Popup (nested) */
.witness-popup-card {
    width: 85%;
    max-width: 320px;
    background: rgba(30, 41, 59, 0.98);
    border-radius: 20px;
    border: 1px solid rgba(59, 130, 246, 0.3);
    padding: 30px 24px;
    text-align: center;
}

.witness-popup-card h3 {
    color: #60a5fa;
    font-size: 20px;
    font-weight: 800;
    margin: 0 0 12px;
}

.witness-popup-card p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
    margin: 0 0 20px;
}

.witness-activate-btn {
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 14px;
    background: linear-gradient(135deg, #3b82f6, #2563eb);
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    margin-bottom: 10px;
}

.witness-back-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 14px;
    cursor: pointer;
}

/* Emergency Stub */
.emergency-stub {
    text-align: center;
    padding: 20px;
}

.emergency-stub p {
    color: var(--text-secondary);
    font-size: 14px;
    line-height: 1.6;
}

/* Profile Contact Row */
.contact-row {
    display: flex;
    gap: 8px;
    margin-bottom: 10px;
    align-items: center;
}

.contact-row input {
    flex: 1;
    min-width: 0;
}

.contact-row select {
    width: 70px;
    flex-shrink: 0;
}

/* Light theme overrides for SOS */
[data-theme="light"] .sos-card {
    background: rgba(255, 255, 255, 0.95);
    border-color: rgba(239, 68, 68, 0.2);
}

[data-theme="light"] .sos-action-row {
    background: rgba(0, 0, 0, 0.03);
}

[data-theme="light"] .sos-action-row.selected {
    background: rgba(239, 68, 68, 0.08);
}

[data-theme="light"] .sos-action-label {
    color: #1e293b;
}

[data-theme="light"] .witness-popup-card {
    background: rgba(255, 255, 255, 0.98);
    border-color: rgba(59, 130, 246, 0.2);
}