:root {
    --vh: 1vh;

    /* safe-area fallback using env() */
    --safe-area-inset-top: env(safe-area-inset-top, 20px);
    --safe-area-inset-right: env(safe-area-inset-right, 0px);
    --safe-area-inset-bottom: env(safe-area-inset-bottom, 20px);
    --safe-area-inset-left: env(safe-area-inset-left, 0px);

    /* Minimal & Neutral Palette */
    --app-bg: #F8F9FA;
    --card-bg: #FFFFFF;
    --text-primary: #111827;
    --text-secondary: #6B7280;
    --accent-primary: #2563EB;
    --accent-warning: #EAB308;
    --accent-success: #16A34A;
    --border-color: #E5E7EB;
    --input-bg: #F9FAFB;
    --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);

    --text-tertiary: #9CA3AF;
    --accent-glow: rgba(37, 99, 235, 0.4);
    --warning-glow: rgba(245, 158, 11, 0.4);
    --accent-dark: #1F2937;

    /* Modern layered shadows (Soft UI) */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.02);
    --shadow-md: 0 8px 16px -4px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02);
    --shadow-glass: 0 10px 30px rgba(0, 0, 0, 0.05);
    --shadow-floating: 0 20px 40px -10px rgba(0, 0, 0, 0.1);
}

/* --- CORE APP STRUCTURE --- */
html,
body {
    height: 100%;
    margin: 0;
    padding: 0;
    background: var(--app-bg);
    touch-action: manipulation;
}

html {
    height: -webkit-fill-available;
}

body {
    font-family: 'Inter', sans-serif;
    width: 100%;
    overflow: hidden;
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

#app-container {
    width: 100%;
    max-width: 420px;
    height: calc(var(--vh, 1vh) * 100);
    margin: auto;
    display: flex;
    flex-direction: column;
    position: relative;
    background-color: var(--app-bg);
}

.page-container {
    flex-grow: 1;
    position: relative;
    padding: calc(20px + var(--safe-area-inset-top)) 0;
    padding-bottom: calc(100px + var(--safe-area-inset-bottom));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.page {
    display: none;
    flex-direction: column;
    gap: 20px;
    padding: 0 20px;
}

.page.active-page {
    display: flex;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(5px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    margin-bottom: 10px;
}

.page-header h1 {
    font-size: 1.8rem;
    margin: 0;
    font-weight: 700;
}

.page-header p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 5px 0 0 0;
}

/* --- BOTTOM NAVIGATION BAR --- */
.app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    max-width: 420px;
    margin: auto;
    padding: 10px 0;
    padding-bottom: calc(10px + var(--safe-area-inset-bottom));
    display: flex;
    justify-content: space-around;
    z-index: 3;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--border-color);
}

.app-nav::after {
    content: '';
    position: absolute;
    left: 0;
    right: 0;
    bottom: calc(-1px);
    height: calc(var(--safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.95);
    pointer-events: none;
}

.nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    width: 80px;
}

.nav-item i {
    font-size: 1.6rem;
    margin-bottom: 5px;
}

.nav-item.active {
    color: var(--accent-primary);
}

/* --- GLOBAL CARD STYLE --- */
.card {
    background: var(--card-bg);
    border-radius: 18px;
    padding: 25px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
}

/* ==================================================== */
/*          2026 DASHBOARD UI (Pure Spatial Design)     */
/* ==================================================== */
/* 1. Base Layout & Spatial Depth */
.d26-active-view {
    position: relative;
    z-index: 10;
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
    min-height: calc(100vh - 160px);
}

.d26-spatial-bg {
    position: absolute;
    top: -50px;
    left: -20px;
    right: -20px;
    height: 60vh;
    background: radial-gradient(circle at top, #E0E7FF 0%, var(--app-bg) 70%);
    z-index: -1;
    pointer-events: none;
}

/* 2. Zone 1: Glassmorphism Context Card */
.d26-glass-card {
    width: 100%;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 24px;
    padding: 24px 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.03);
    margin-bottom: 25px;
    text-align: center;
}

@keyframes d26PulseActive {
    0% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 var(--accent-glow);
    }

    70% {
        transform: scale(1);
        box-shadow: 0 0 0 6px rgba(37, 99, 235, 0);
    }

    100% {
        transform: scale(0.95);
        box-shadow: 0 0 0 0 rgba(37, 99, 235, 0);
    }
}

.d26-title {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text-primary);
    margin: 0 0 4px 0;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.d26-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 0;
    font-weight: 500;
}

.d26-tasks {
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid rgba(0, 0, 0, 0.03);
    font-size: 0.95rem;
    color: var(--text-secondary);
    white-space: pre-wrap;
    text-align: left;
    background: rgba(255, 255, 255, 0.4);
    border-radius: 12px;
    padding: 12px;
}

/* 3. Zone 2: Pure Control Center */
.d26-control-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    margin-bottom: 25px;
}

.d26-timer-wrap {
    margin-bottom: 20px;
    text-align: center;
}

.d26-time-display {
    font-size: 4.5rem;
    font-weight: 800;
    line-height: 1;
    letter-spacing: 1px;
    font-variant-numeric: tabular-nums;
    transition: color 0.4s ease;
    margin: 0;
    text-shadow: 0 8px 24px rgba(37, 99, 235, 0.15);
    /* Soft, premium glow */
}

.d26-timer-wrap.active .d26-time-display {
    color: var(--accent-primary);
}

.d26-timer-wrap.paused .d26-time-display {
    color: var(--text-tertiary);
    text-shadow: none;
}

.d26-pause-indicator {
    margin-top: 8px;
    font-size: 1rem;
    color: var(--accent-warning);
    font-weight: 600;
}

.d26-action-row {
    display: flex;
    gap: 15px;
    justify-content: center;
    width: 100%;
}

.d26-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    border-radius: 100px;
    padding: 12px 24px;
    border: none;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    background: white;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    text-transform: none;
}

.d26-btn:active {
    transform: scale(0.96);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.04);
}

.d26-btn i {
    font-size: 1.1rem;
}

.d26-btn-note {
    color: var(--text-primary);
}

.d26-btn-note i {
    color: var(--text-secondary);
}

.d26-btn-pause {
    color: var(--accent-warning);
}

.d26-btn-resume {
    color: var(--accent-primary);
}

/* ==================================================== */
/*          NEW ROUND FAB BUTTONS                       */
/* ==================================================== */

.d26-btn-fab {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(255, 255, 255, 0.8);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.08);
    outline: none;
}

.d26-btn-fab i {
    font-size: 1.4rem;
}

.d26-btn-fab:active {
    transform: scale(0.92);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.d26-btn-fab.note-fab {
    color: var(--text-secondary);
}

.d26-btn-fab.pause-fab {
    color: var(--accent-warning);
    background: rgba(255, 255, 255, 0.9);
}

.d26-btn-fab.resume-fab {
    color: white;
    background: var(--accent-primary);
    box-shadow: 0 4px 15px rgba(37, 99, 235, 0.3);
}

.d26-btn-fab.resume-fab i {
    /* Play button is often visually unbalanced, tiny nudge to right */
    margin-left: 3px;
}

/* The Premium Swipe */
.swipe-container {
    width: 100%;
    height: 64px;
    border-radius: 32px;
    position: relative;
    display: flex;
    align-items: center;
    overflow: hidden;
    background: var(--input-bg);
}

.swipe-container.swipe-disabled {
    opacity: 0.6;
    pointer-events: none;
}

.swipe-track {
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    border-radius: 32px;
    opacity: 0;
    background: var(--accent-primary);
}

.swipe-handle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    position: absolute;
    left: 4px;
    top: 4px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
    z-index: 2;
    transition: transform 0.2s ease;
    background: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    color: var(--accent-primary);
}

.swipe-handle i {
    font-size: 1.4rem;
}

.swipe-text {
    width: 100%;
    text-align: center;
    font-weight: 600;
    z-index: 1;
    user-select: none;
    font-size: 1rem;
    padding-left: 60px;
    padding-right: 20px;
}

.premium-swipe {
    background-color: var(--accent-dark);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.premium-swipe .swipe-text {
    color: rgba(255, 255, 255, 0.9);
    letter-spacing: 0.5px;
}

.premium-swipe .swipe-handle {
    color: var(--accent-dark);
}

.premium-swipe .swipe-track {
    background: linear-gradient(90deg, var(--accent-dark) 0%, var(--accent-success) 100%);
}

.primary-swipe {
    background-color: rgba(37, 99, 235, 0.1);
}

.primary-swipe .swipe-text {
    color: var(--accent-primary);
}

/* ==================================================== */
/*          IDLE STATE (BENTO DASHBOARD)                */
/* ==================================================== */
.idle-header {
    margin-bottom: 25px;
    padding: 0 5px;
}

.greeting-block h1 {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.5px;
    margin: 0;
}

.greeting-block .date-txt {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0 0 5px 0;
}

.bento-card {
    background: var(--card-bg);
    border-radius: 28px;
    padding: 24px;
    box-sizing: border-box;
    width: 100%;
    box-shadow: var(--shadow-md);
    margin-bottom: 25px;
    position: relative;
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.bento-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 12px;
}

.bento-title {
    font-size: 1.6rem;
    font-weight: 800;
    margin: 0 0 10px 0;
    line-height: 1.2;
}

.bento-time-row {
    margin-bottom: 15px;
}

.bento-time-pill {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: rgba(37, 99, 235, 0.1);
    color: var(--accent-primary);
    padding: 6px 12px;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.9rem;
}

.bento-client {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-weight: 500;
}

.bento-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.idle-action-link {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    border-radius: 16px;
    background: var(--input-bg);
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    transition: background 0.2s;
    cursor: pointer;
}

.idle-action-link:active {
    background: #E5E7EB;
}

.idle-reset-btn {
    position: absolute;
    top: 20px;
    right: 20px;
    font-size: 0.85rem;
    color: var(--text-tertiary);
    font-weight: 600;
    cursor: pointer;
    background: #F3F4F6;
    padding: 6px 12px;
    border-radius: 12px;
}

.empty-state {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px 20px;
}

.empty-icon {
    width: 64px;
    height: 64px;
    background: #F3F4F6;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
    color: var(--text-tertiary);
    margin-bottom: 15px;
}

.empty-icon.complete {
    background: #ECFDF5;
    color: var(--accent-success);
}

.empty-state p {
    color: var(--text-secondary);
    margin: 0;
}

.empty-state h2 {
    margin: 0 0 8px 0;
    font-weight: 800;
    color: var(--text-primary);
}

.bento-section-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-tertiary);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin: 0 0 15px 10px;
}

.bento-list-wrapper {
    background: var(--card-bg);
    border-radius: 28px;
    padding: 10px;
    box-shadow: var(--shadow-md);
    border: 1px solid rgba(0, 0, 0, 0.02);
}

.plan-item {
    display: flex;
    align-items: center;
    padding: 15px;
    border-radius: 20px;
    transition: background 0.2s;
    cursor: pointer;
}

.plan-item.selectable:active {
    background: var(--input-bg);
}

.plan-item.selected {
    background: rgba(37, 99, 235, 0.05);
}

.plan-item.completed {
    opacity: 0.6;
    pointer-events: none;
}

.plan-icon {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    background: var(--input-bg);
    color: var(--text-tertiary);
    margin-right: 15px;
    font-size: 0.8rem;
}

.plan-dot {
    width: 8px;
    height: 8px;
    background: #D1D5DB;
    border-radius: 50%;
}

.plan-item.selected .plan-icon {
    background: var(--accent-primary);
    color: white;
}

.plan-item.completed .plan-icon {
    background: var(--accent-success);
    color: white;
}

.plan-content {
    flex: 1;
}

.plan-title {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 2px;
}

.plan-item.completed .plan-title {
    text-decoration: line-through;
}

.plan-client {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* --- ABSENCE PAGE --- */
.absence-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.absence-header h1 {
    font-size: 1.8rem;
    margin: 0;
    font-weight: 700;
}

.absence-plus-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    background: var(--accent-primary);
    color: white;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(37, 99, 235, 0.3);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.absence-plus-btn:active {
    transform: scale(0.92);
    box-shadow: 0 1px 4px rgba(37, 99, 235, 0.2);
}

.absence-balance-card {
    padding: 20px 25px;
}

.absence-balance-header {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-primary);
    margin-bottom: 18px;
}

.absence-balance-header i {
    color: var(--accent-primary);
    font-size: 1.1rem;
}

.absence-balance-rows {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.absence-balance-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.absence-balance-row:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.absence-balance-row:first-child {
    padding-top: 0;
}

.absence-balance-label {
    font-size: 0.95rem;
    color: var(--text-secondary);
    font-weight: 500;
}

.absence-balance-value {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
}

.absence-section-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-secondary);
    margin: 5px 0 0 2px;
}

.absence-history-item {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 16px 18px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.absence-history-dates {
    display: flex;
    align-items: center;
    gap: 10px;
}

.absence-date-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 36px;
}

.absence-date-day {
    font-size: 0.7rem;
    text-transform: capitalize;
    color: var(--text-secondary);
    font-weight: 500;
}

.absence-date-num {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.absence-date-month {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--text-secondary);
    font-weight: 600;
}

.absence-date-arrow {
    color: var(--text-secondary);
    font-size: 1rem;
    font-weight: 400;
    margin: 0 2px;
}

.absence-history-info {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.absence-history-type {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.absence-type-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--accent-primary);
    display: inline-block;
}

.absence-history-duration {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}

/* --- PROFILE PAGE --- */
.profile-header {
    display: flex;
    align-items: center;
    gap: 15px;
    position: relative;
    padding-right: 50px;
}

.profile-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 3px solid var(--accent-primary);
}

.profile-info h2 {
    margin: 0;
    font-size: 1.5rem;
}

.profile-info p {
    margin: 2px 0 0 0;
    color: var(--text-secondary);
    font-size: 1rem;
}

.card-header-title {
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 15px;
    display: block;
}

.period-info {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
}

.period-info .hours {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-primary);
}

.period-info .label {
    color: var(--text-secondary);
    font-size: 1rem;
}

.progress-bar {
    width: 100%;
    height: 8px;
    background-color: #E5E7EB;
    border-radius: 4px;
    margin-top: 15px;
    overflow: hidden;
}

.progress-bar-inner {
    height: 100%;
    width: 0%;
    background-color: var(--accent-primary);
    border-radius: 4px;
    transition: width 0.5s ease;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 15px;
    text-align: center;
}

.achievement {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.achievement .icon {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background-color: #F3F4F6;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.8rem;
    color: #9CA3AF;
    margin-bottom: 8px;
}

.achievement.unlocked .icon {
    background-color: #DBEAFE;
    color: var(--accent-primary);
}

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

.resource-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.resource-list li a {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 18px 0;
    color: var(--text-primary);
    text-decoration: none;
    font-weight: 500;
}

.resource-list li:not(:last-child) a {
    border-bottom: 1px solid var(--border-color);
}

.resource-list .fa-chevron-right,
.resource-list .fa-calendar-plus {
    color: var(--text-secondary);
}

.profile-actions-footer button {
    width: 100%;
    padding: 16px;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 12px;
    cursor: pointer;
    margin-bottom: 10px;
}

.btn-settings {
    background-color: var(--border-color);
    color: var(--text-primary);
    border: none;
}

.btn-logout {
    background: transparent;
    color: #DC2626;
    border: none;
}

.modal-content h2 {
    margin: 0 0 10px 0;
    font-size: 1.3rem;
}

.modal-content p {
    color: var(--text-secondary);
    margin: 0 0 15px 0;
    font-size: 0.95rem;
}

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

.modal-btn {
    flex-grow: 1;
    padding: 14px;
    border-radius: 10px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s;
}

.modal-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
}

.btn-cancel {
    background-color: #F3F4F6;
    color: var(--text-primary);
}

.btn-save {
    background-color: var(--accent-primary);
    color: white;
}


/* --- MODAL SYSTEM (Shared Styles) --- */
#notes-modal-overlay,
#absence-modal-overlay,
#geofence-modal-overlay,
#shiftexchange-modal-overlay,
#manualshift-modal-overlay,
#storage-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 9999;

    /* FIXED: Use opacity/visibility instead of display:none so transitions work */
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#notes-modal-overlay.visible,
#absence-modal-overlay.visible,
#geofence-modal-overlay.visible,
#shiftexchange-modal-overlay.visible,
#manualshift-modal-overlay.visible,
#storage-modal-overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.modal-content {
    background: var(--card-bg);
    border-radius: 18px;
    width: 90%;
    max-width: 420px;
    padding: 24px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    transform: scale(0.95);
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.visible .modal-content {
    transform: scale(1);
}


/* --- MOBILE SPECIFIC OVERRIDES --- */
@media (max-width: 480px) {

    #notes-modal-overlay.visible,
    #absence-modal-overlay.visible,
    #storage-modal-overlay.visible,
    #manualshift-modal-overlay.visible,
    #shiftexchange-modal-overlay.visible {
        align-items: flex-end;
    }

    #notes-modal-overlay,
    #absence-modal-overlay,
    #storage-modal-overlay,
    #manualshift-modal-overlay,
    #shiftexchange-modal-overlay {
        align-items: flex-end;
        padding: 0;
    }

    #notes-modal-overlay .modal-content,
    #absence-modal-overlay .modal-content,
    #storage-modal-overlay .modal-content,
    #manualshift-modal-overlay .modal-content,
    #shiftexchange-modal-overlay .modal-content {
        width: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 24px 24px 0 0;
        padding-bottom: calc(30px + var(--safe-area-inset-bottom));
        transform: translateY(100%);
        transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    }

    #notes-modal-overlay.visible .modal-content,
    #absence-modal-overlay.visible .modal-content,
    #storage-modal-overlay.visible .modal-content,
    #manualshift-modal-overlay.visible .modal-content,
    #shiftexchange-modal-overlay.visible .modal-content {
        transform: translateY(0);
    }
}


/* --- NOTES MODAL SPECIFIC --- */
#notes-modal-textarea {
    width: 100%;
    height: 120px;
    box-sizing: border-box;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    padding: 12px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    margin-top: 5px;
    background-color: var(--input-bg);
}

/* --- ABSENCE MODAL SPECIFIC --- */
/* Form Elements Styling */
.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
    font-size: 0.9rem;
}

.form-input {
    width: 100%;
    box-sizing: border-box;
    padding: 12px 14px;
    border: 1px solid var(--border-color);
    border-radius: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 1rem;
    background-color: var(--input-bg);
    color: var(--text-primary);
    transition: border-color 0.2s, box-shadow 0.2s;
    appearance: none;
}

.form-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
    background-color: #FFF;
}

select.form-input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='%236B7280'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M19 9l-7 7-7-7'%3E%3C/path%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 18px;
    padding-right: 45px;
}

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

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

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

/* --- SKELETON LOADERS --- */
.skeleton {
    background: #F3F4F6;
    background: linear-gradient(90deg,
            #F3F4F6 0%,
            #E5E7EB 50%,
            #F3F4F6 100%);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite linear;
    border-radius: 6px;
    display: block;
}

@keyframes skeleton-shimmer {
    0% {
        background-position: 200% 0;
    }

    100% {
        background-position: -200% 0;
    }
}

.sk-text {
    height: 1em;
    width: 100%;
    margin-bottom: 8px;
}

.sk-h1 {
    height: 32px;
    width: 60%;
    margin-bottom: 12px;
}

.sk-p {
    height: 16px;
    width: 40%;
    margin-bottom: 20px;
}

.sk-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
}

.sk-btn {
    height: 50px;
    width: 100%;
    border-radius: 12px;
    margin-top: 15px;
}

.sk-dashboard-card {
    height: 300px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.sk-profile-header {
    display: flex;
    align-items: center;
    gap: 15px;
    margin-bottom: 25px;
}

/* --- GEOFENCE WARNING MODAL --- */
#geofence-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    z-index: 3000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s ease;
    display: flex;
    justify-content: center;
    align-items: center;
}

#geofence-modal-overlay.visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.geofence-icon {
    width: 60px;
    height: 60px;
    background-color: #FEF3C7;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto 15px auto;
    color: #D97706;
    font-size: 1.8rem;
}

.btn-warning-action {
    background-color: #D97706;
    color: white;
}

/* --- NEW FLOATING LANGUAGE SELECTOR --- */
.profile-lang-container {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 100;
}

.lang-dropdown-btn {
    all: unset;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.lang-dropdown-btn:active {
    transform: scale(0.92);
}

.lang-dropdown-menu {
    position: absolute;
    top: 45px;
    right: 0;
    background: white;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    min-width: 150px;
    display: none;
    border: 1px solid #F3F4F6;
    overflow: hidden;
    padding: 6px 0;
    animation: langSlideIn 0.2s ease-out;
}

.lang-dropdown-menu.visible {
    display: block;
}

.lang-dropdown-item {
    all: unset;
    display: flex;
    align-items: center;
    width: calc(100% - 24px);
    padding: 10px 12px;
    gap: 12px;
    cursor: pointer;
    font-size: 15px;
    color: var(--text-primary);
    transition: background 0.2s;
}

.lang-dropdown-item:hover {
    background: #F9FAFB;
}

.lang-dropdown-item.active {
    background: #EFF6FF;
    color: var(--accent-primary);
    font-weight: 600;
}

.flag-img {
    width: 34px;
    height: 34px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid #F3F4F6;
}

.flag-img-small {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border-radius: 50%;
    border: 1px solid #F3F4F6;
}

.lang-dropdown-item i.fa-check {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--accent-primary);
}

@keyframes langSlideIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* --- STORAGE PAGE --- */
#storage-page {
    align-items: center;
}

.storage-hero {
    text-align: center;
    padding: 30px 0;
}

.btn-scan-big {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), #1e40af);
    color: white;
    border: none;
    box-shadow: 0 10px 25px rgba(37, 99, 235, 0.4);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    margin: 0 auto;
}

.btn-scan-big:active {
    transform: scale(0.95);
    box-shadow: 0 5px 15px rgba(37, 99, 235, 0.3);
}

.btn-scan-big i {
    font-size: 3.5rem;
    margin-bottom: 10px;
}

.btn-scan-big span {
    font-size: 1.2rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* --- SCANNER OVERLAY --- */
#scanner-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 5000;
}

#scanner-overlay.hidden {
    display: none !important;
}

#reader {
    width: 100%;
    height: 100%;
    position: relative;
    overflow: hidden;
}

#reader video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    position: absolute;
    top: 0;
    left: 0;
}

#reader canvas {
    display: none;
}

.scanner-ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 5002;
}

.scanner-close-btn {
    position: absolute;
    top: 75px;
    right: 20px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.scanner-flash-btn {
    position: absolute;
    top: 75px;
    left: 20px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: white;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    font-size: 1.2rem;
    cursor: pointer;
    pointer-events: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
    transition: all 0.2s ease;
}

.scanner-flash-btn.active {
    background: rgba(255, 255, 255, 0.9);
    color: #F59E0B;
    border-color: white;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.5);
}

.scan-region-highlight {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 280px;
    height: 140px;
    border: 2px solid rgba(255, 255, 255, 0.7);
    border-radius: 12px;
    box-shadow: 0 0 0 4000px rgba(0, 0, 0, 0.6);
}

.scan-laser {
    position: absolute;
    width: 100%;
    height: 2px;
    background: #ef4444;
    box-shadow: 0 0 6px #ef4444;
    top: 50%;
    animation: laserScan 2s infinite ease-in-out;
}

@keyframes laserScan {
    0% {
        top: 5%;
        opacity: 0;
    }

    20% {
        opacity: 1;
    }

    80% {
        opacity: 1;
    }

    100% {
        top: 95%;
        opacity: 0;
    }
}

/* --- STORAGE MODAL ACTIONS --- */
.product-image-large {
    width: 120px;
    height: 120px;
    border-radius: 12px;
    object-fit: cover;
    margin: 0 auto 15px auto;
    display: block;
    background-color: #F3F4F6;
}

/* --- QTY CONTROL --- */
.qty-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    margin: 20px 0;
}

.qty-btn {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border-color);
    background: white;
    font-size: 1.2rem;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
}

.qty-btn:active {
    background-color: #F3F4F6;
    transform: scale(0.95);
}

select.qty-display {
    font-size: 1.8rem;
    font-weight: 700;
    width: 80px;
    text-align: center;
    text-align-last: center;
    border: none;
    background: transparent;
    appearance: none;
    -webkit-appearance: none;
    color: var(--text-primary);
    padding: 0;
    outline: none;
    cursor: pointer;
}

select.qty-display:focus {
    text-decoration: underline;
    text-decoration-color: var(--accent-primary);
}

.action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 10px;
}

.btn-action {
    padding: 15px;
    border-radius: 12px;
    border: none;
    font-weight: 600;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    cursor: pointer;
}

.btn-out {
    background: #FEE2E2;
    color: #DC2626;
}

.btn-in {
    background: #DCFCE7;
    color: #16A34A;
}

.btn-audit {
    background: #F3F4F6;
    color: #4B5563;
    grid-column: span 2;
}

/* --- Schedule page --- */
.schedule-tabs {
    display: flex;
    background-color: #F3F4F6;
    padding: 4px;
    border-radius: 12px;
    margin-bottom: 10px;
}

.tab-btn {
    flex: 1;
    border: 1px solid #E5E7EB;
    background: white;
    padding: 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn.active {
    background-color: #E5E7EB;
    color: var(--text-primary);
    border: 1px solid #E5E7EB;
    font-weight: 600;
}

.schedule-list {
    display: flex;
    flex-direction: column;
    background: #FFFFFF;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    border: 1px solid var(--border-color);
    overflow: hidden;
    margin-bottom: 20px;
}

.schedule-card {
    display: flex;
    padding: 16px;
    border-bottom: 1px solid #F3F4F6;
    background: #FFFFFF;
    align-items: center;
}

.schedule-card:last-child {
    border-bottom: none;
}

/* LEFT COLUMN: DATE */
.schedule-date-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 55px;
    flex-shrink: 0;
    margin-right: 15px;
}

.s-day {
    font-size: 0.8rem;
    color: #9CA3AF;
    text-transform: capitalize;
    font-weight: 500;
}

.s-date {
    font-size: 1.6rem;
    font-weight: 700;
    color: #111827;
    line-height: 1.1;
    margin: 2px 0;
}

.s-month {
    font-size: 0.8rem;
    color: #9CA3AF;
    text-transform: capitalize;
    font-weight: 500;
}

/* RIGHT COLUMN: DETAILS */
.schedule-details-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.s-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px;
}

.s-time {
    font-size: 1.05rem;
    font-weight: 700;
    color: #111827;
}

.s-client {
    font-size: 0.9rem;
    color: #9CA3AF;
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-weight: 500;
}

.s-role {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #6B7280;
    font-weight: 500;
}

.s-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

/* BADGES & BUTTONS */
.schedule-badge {
    font-size: 0.75rem;
    padding: 4px 8px;
    border-radius: 6px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 4px;
}

.schedule-badge.market {
    background: #DBEAFE;
    color: #2563EB;
}

.schedule-badge.pending {
    background: #FEF3C7;
    color: #D97706;
}

.schedule-swap-btn {
    background: transparent;
    border: none;
    color: #9CA3AF;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: background 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.schedule-swap-btn:hover,
.schedule-swap-btn:active {
    background: #F3F4F6;
    color: #111827;
}

/* Shift Exchange Modal Styles */
#shiftexchange-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

#shiftexchange-modal-overlay.visible {
    opacity: 1;
    visibility: visible;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
}

.modal-close-btn {
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    color: #6b7280;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close-btn:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.shift-exchange-summary {
    margin-bottom: 24px;
}

.shift-summary-badge {
    padding: 16px;
    border-radius: 8px;
    background: #f9fafb;
}

.shift-summary-date {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: #6b7280;
    margin-bottom: 6px;
    letter-spacing: 0.5px;
}

.shift-summary-time {
    font-size: 0.95rem;
    font-weight: 600;
    color: #1f2937;
    margin-bottom: 8px;
}

.shift-summary-title {
    font-size: 1rem;
    font-weight: 700;
    color: #111827;
    margin-bottom: 4px;
}

.shift-summary-client {
    font-size: 0.85rem;
    color: #6b7280;
}

.exchange-info-box {
    display: flex;
    gap: 12px;
    padding: 16px;
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    margin-bottom: 24px;
}

.exchange-info-box svg {
    flex-shrink: 0;
    margin-top: 2px;
}

.exchange-info-box strong {
    display: block;
    color: #1e40af;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.exchange-info-box p {
    margin: 0;
    color: #1e40af;
    font-size: 0.85rem;
    line-height: 1.5;
}

.btn-save svg {
    vertical-align: text-bottom;
}

/* Permission Request Dialog */
.permission-request-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 20px;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.permission-request-overlay.visible {
    display: flex;
    opacity: 1;
    pointer-events: auto;
}


.permission-request-dialog {
    background: #fff;
    border-radius: 16px;
    max-width: 400px;
    width: 100%;
    padding: 32px 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
}

.permission-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 16px;
}

.permission-request-dialog h2 {
    margin: 0 0 16px 0;
    font-size: 1.5rem;
    text-align: center;
    color: #1a1a1a;
}

.permission-request-dialog p {
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 16px;
    text-align: center;
}

.permission-request-dialog ul {
    margin: 16px 0;
    padding-left: 24px;
}

.permission-request-dialog li {
    color: #4a5568;
    margin-bottom: 8px;
    line-height: 1.5;
}

.privacy-note {
    background: #f7fafc;
    border-left: 3px solid #3b82f6;
    padding: 12px;
    border-radius: 4px;
    margin: 16px 0;
    text-align: left;
}

.permission-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.permission-actions button {
    flex: 1;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Permission Denied Dialog */
.permission-dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10001;
    padding: 20px;
}

.permission-dialog {
    background: #fff;
    border-radius: 16px;
    max-width: 400px;
    width: 100%;
    padding: 32px 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}

.permission-dialog-header h3 {
    margin: 0 0 16px 0;
    font-size: 1.3rem;
    color: #1a1a1a;
}

.permission-dialog-body {
    color: #4a5568;
    line-height: 1.6;
}

.permission-instructions {
    background: #f7fafc;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}

.permission-instructions ol {
    margin: 0;
    padding-left: 20px;
}

.permission-instructions li {
    margin-bottom: 8px;
    color: #4a5568;
    line-height: 1.6;
}

.permission-dialog-actions {
    margin-top: 24px;
}

.permission-dialog-actions button {
    width: 100%;
    padding: 12px;
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    border: none;
}