:root {
    /* Color Palette - Sky Blue */
    --bg-base: #0b1420;
    --bg-panel: rgba(15, 23, 42, 0.8);
    --bg-panel-hover: rgba(30, 41, 59, 0.96);
    --border-color: rgba(186, 230, 253, 0.16);
    
    --text-primary: #f8fafc;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;
    
    --primary: #38bdf8;
    --primary-hover: #7dd3fc;
    --primary-glow: rgba(56, 189, 248, 0.28);
    
    --success: #4ade80;
    --success-bg: rgba(129, 199, 132, 0.15);
    --success-glow: rgba(129, 199, 132, 0.3);
    
    --warning: #fbbf24;
    --warning-bg: rgba(255, 183, 77, 0.15);
    
    --danger: #f43f5e;
    --danger-bg: rgba(229, 115, 115, 0.15);

    --radius-lg: 24px;
    --radius-md: 16px;
    --radius-sm: 8px;
    
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
    --bg-base: #f3f9ff;
    --bg-panel: rgba(255, 255, 255, 0.9);
    --bg-panel-hover: rgba(255, 255, 255, 1);
    --border-color: rgba(15, 23, 42, 0.08);
    --text-primary: #0f172a;
    --text-secondary: #475569;
    --text-muted: #64748b;
    --primary: #0284c7;
    --primary-hover: #0ea5e9;
    --primary-glow: rgba(2, 132, 199, 0.18);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background:
        radial-gradient(circle at top left, rgba(56, 189, 248, 0.14), transparent 28%),
        radial-gradient(circle at bottom right, rgba(14, 165, 233, 0.12), transparent 32%),
        var(--bg-base);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
    transition: background-color var(--transition);
}
html, body {
    width: 100%;
    max-width: 100%;
}

/* Typography Utility */
h1, h2, h3, h4 { color: var(--text-primary); font-weight: 600; }
p { color: var(--text-secondary); line-height: 1.5; }

/* Views & Visibility */
.view {
    min-height: 100vh;
    width: 100%;
    max-width: 100%;
    position: absolute;
    top: 0;
    left: 0;
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.view.hidden {
    opacity: 0;
    pointer-events: none;
    transform: scale(0.98);
}
.hidden {
    display: none !important;
}
.view.active {
    opacity: 1;
    pointer-events: all;
    transform: scale(1);
    z-index: 10;
}

.content-view {
    display: none;
    animation: fadeIn 0.4s ease forwards;
}
.content-view.active {
    display: block;
}

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

/* Glassmorphism Classes */
.glass-bg {
    background: 
        radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.16) 0%, transparent 35%),
        radial-gradient(circle at 85% 85%, rgba(14, 165, 233, 0.14) 0%, transparent 35%),
        linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
    background-size: 100% 100%, 100% 100%, 30px 30px, 30px 30px;
}

.glass-panel {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 100%), var(--bg-panel);
    backdrop-filter: blur(28px);
    -webkit-backdrop-filter: blur(28px);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top: 1px solid rgba(255, 255, 255, 0.14);
    border-left: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow: 0 20px 50px rgba(2, 6, 23, 0.35),
                inset 1px 1px 2px rgba(255, 255, 255, 0.08),
                inset -1px -1px 2px rgba(255, 255, 255, 0.02);
    border-radius: var(--radius-lg);
}

/* Forms & Inputs */
.input-group { margin-bottom: 1.5rem; }
.input-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.field-help {
    margin-top: 0.55rem;
    font-size: 0.78rem;
    color: var(--text-muted);
}
.input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-wrapper i {
    position: absolute;
    left: 1rem;
    color: var(--text-muted);
    width: 1.2rem;
    height: 1.2rem;
    z-index: 2;
    pointer-events: none;
}
.input-wrapper input {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.8rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 1rem;
    transition: var(--transition);
}
.input-wrapper input::placeholder {
    color: var(--text-muted);
}
[data-theme="light"] .input-wrapper input {
    background: rgba(255, 255, 255, 0.5);
}
.input-wrapper input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: var(--radius-md);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
}
.btn-block { width: 100%; }
.btn-primary {
    background: linear-gradient(135deg, var(--primary) 0%, #0ea5e9 100%);
    color: #082f49;
    box-shadow: 0 10px 24px rgba(56, 189, 248, 0.24);
}
.btn-primary:hover {
    background: var(--primary-hover);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(56, 189, 248, 0.3);
}
.btn-success {
    background: linear-gradient(135deg, var(--success) 0%, #22c55e 100%);
    color: #052e16;
    box-shadow: 0 4px 15px var(--success-glow);
}
.btn-success:hover {
    background: #a5d6a7;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--success-glow);
}
.btn-danger {
    background: var(--danger);
    color: var(--bg-base);
    box-shadow: 0 4px 15px rgba(229, 115, 115, 0.3);
}
.btn-danger:hover {
    background: #ef9a9a;
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(229, 115, 115, 0.5);
}
.btn-secondary {
    background: rgba(56, 189, 248, 0.14);
    color: var(--text-primary);
    border: 1px solid rgba(56, 189, 248, 0.24);
}
.btn-secondary:hover {
    background: rgba(56, 189, 248, 0.22);
    transform: translateY(-2px);
}
.btn-secondary.is-tracking {
    background: rgba(16, 185, 129, 0.16);
    border-color: rgba(16, 185, 129, 0.32);
    color: var(--success);
}
.header-refresh-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    min-height: 42px;
    padding-inline: 0.95rem;
    white-space: nowrap;
}
.header-refresh-btn i {
    width: 18px;
    height: 18px;
}
.header-refresh-btn.is-loading i {
    animation: spin 0.9s linear infinite;
}
@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}
.btn-comp-off {
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    color: #3b2200;
    box-shadow: 0 10px 22px rgba(245, 158, 11, 0.24);
}
.btn-comp-off:hover {
    background: linear-gradient(135deg, #fcd34d 0%, #f59e0b 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(245, 158, 11, 0.3);
}
.btn-leave {
    background: linear-gradient(135deg, #fb7185 0%, #f43f5e 100%);
    color: #fff1f2;
    box-shadow: 0 10px 22px rgba(244, 63, 94, 0.24);
}
.btn-leave:hover {
    background: linear-gradient(135deg, #fda4af 0%, #f43f5e 100%);
    transform: translateY(-2px);
    box-shadow: 0 12px 26px rgba(244, 63, 94, 0.3);
}
.btn-comp-off:disabled,
.btn-leave:disabled {
    opacity: 0.62;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}
.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}
.btn-ghost:hover {
    background: var(--bg-panel-hover);
    color: var(--text-primary);
}
.btn-icon {
    padding: 0.5rem;
    border-radius: var(--radius-sm);
}
.mobile-menu-toggle,
.mobile-menu-close {
    display: none;
}

.btn-pulse {
    animation: pulseGlow 2s infinite;
}
@keyframes pulseGlow {
    0% { box-shadow: 0 0 0 0 var(--success-glow); }
    70% { box-shadow: 0 0 0 10px rgba(16,185,129,0); }
    100% { box-shadow: 0 0 0 0 rgba(16,185,129,0); }
}

/* Login View specific */
.view-center {
    display: flex;
    align-items: center;
    justify-content: center;
}
.login-card {
    width: 100%;
    max-width: 460px;
    padding: 2.75rem;
    text-align: left;
}
.login-kicker {
    margin-bottom: 0.75rem;
    font-size: 0.76rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--primary);
}
.logo-container {
    text-align: center;
    margin-bottom: 2rem;
}
.logo-container h1 {
    font-size: clamp(1.8rem, 3vw, 2.3rem);
}
.brand-icon {
    width: 48px;
    height: 48px;
    color: var(--primary);
    margin-bottom: 1rem;
}
.login-highlights {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.6rem;
    margin-bottom: 1.6rem;
}
.feature-chip {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.45rem 0.8rem;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.12);
    border: 1px solid rgba(56, 189, 248, 0.2);
    color: var(--text-secondary);
    font-size: 0.78rem;
}
.login-hint {
    margin-top: 1.5rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.login-link-btn {
    margin-top: 1rem;
    width: 100%;
    background: transparent;
    border: none;
    color: var(--primary);
    font-size: 0.9rem;
    cursor: pointer;
    padding: 0.35rem 0;
}
.login-link-btn:hover {
    color: var(--primary-hover);
    text-decoration: underline;
}
.login-helper-text {
    margin-top: 0.75rem;
    font-size: 0.82rem;
    line-height: 1.5;
    text-align: center;
    color: var(--text-muted);
}

/* App Wrapper & Layout */
#app-wrapper {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

/* Sidebar */
.sidebar {
    width: 260px;
    display: flex;
    flex-direction: column;
    border-radius: 0;
    border-right: 1px solid var(--border-color);
    border-top: none;
    border-bottom: none;
    border-left: none;
}
.sidebar-header {
    padding: 2rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}
.sidebar-brand-row {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    width: 100%;
}
.brand-name {
    font-size: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.brand-icon-sm {
    color: var(--primary);
}
.sidebar-nav {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0 1rem;
}
.nav-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.8rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    transition: var(--transition);
}
.nav-item:hover {
    background: var(--bg-panel-hover);
    color: var(--text-primary);
}
.nav-item.active {
    background: rgba(56, 189, 248, 0.16);
    color: var(--primary);
    position: relative;
    border-left: 3px solid var(--primary);
}

.sidebar-footer {
    padding: 1.5rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.sidebar-footer-actions {
    display: flex;
    width: 100%;
    justify-content: center;
    gap: 1rem;
}
.sidebar-action-btn {
    padding: 0.5rem;
}
.logout-btn {
    color: var(--danger);
}
.user-profile {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    min-width: 0;
}
.avatar {
    width: 36px;
    height: 36px;
    background: var(--bg-panel-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.user-info { display: flex; flex-direction: column; min-width: 0; }
.user-info span:first-child { font-size: 0.9rem; font-weight: 500;}
.user-info span:last-child { font-size: 0.75rem; color: var(--text-muted); }

/* Main Content Area */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    min-width: 0;
    background: 
        radial-gradient(circle at top center, rgba(56,189,248,0.1) 0%, transparent 55%),
        linear-gradient(rgba(255,255,255,0.01) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255,255,255,0.01) 1px, transparent 1px);
    background-size: 100% 100%, 40px 40px, 40px 40px;
}

.top-nav {
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}
.top-nav-shell {
    border-radius: 0;
    margin-bottom: 1.15rem;
    position: relative;
}
.top-nav-start,
.top-nav-actions {
    display: flex;
    align-items: center;
    min-width: 0;
}
.top-nav-start {
    gap: 0.75rem;
}
.clock-display {
    display: flex;
    flex-direction: column;
}
#live-time { font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; }
#live-date { font-size: 0.9rem; color: var(--text-secondary); }

.nav-actions { display: flex; gap: 0.5rem; }
.top-nav-actions {
    gap: 0.75rem;
}
.nav-divider {
    width: 1px;
    height: 24px;
    background: var(--border-color);
}
.admin-notifications-section {
    padding: 1.15rem 1.25rem;
}
.notification-head {
    margin-bottom: 0.65rem;
}
.section-subtext {
    margin-top: 0.2rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.notification-summary-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}
.notification-inline-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 30px;
    padding: 0.2rem 0.7rem;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.14);
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 700;
}
.notification-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    max-height: 320px;
    overflow-y: auto;
}
.notification-item {
    padding: 0.8rem 0.9rem;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-color);
    background: rgba(255,255,255,0.03);
}
.notification-item.unread {
    border-color: rgba(56, 189, 248, 0.32);
    background: rgba(56, 189, 248, 0.08);
}
.notification-item strong {
    display: block;
    margin-bottom: 0.2rem;
    font-size: 0.88rem;
}
.notification-item p {
    color: var(--text-secondary);
    font-size: 0.8rem;
    line-height: 1.4;
}
.notification-time {
    display: inline-block;
    margin-top: 0.35rem;
    color: var(--text-muted);
    font-size: 0.74rem;
}
.user-info-right {
    text-align: right;
    min-width: 0;
}
.user-name {
    font-weight: 600;
}
#current-user-role {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.user-device {
    font-size: 0.72rem;
    color: var(--primary);
}
.user-name,
#current-user-role,
.user-device {
    overflow-wrap: anywhere;
}
.top-nav-avatar {
    width: 40px;
    height: 40px;
    background: var(--primary-glow);
    border: 2px solid var(--border-color);
}
.avatar-icon {
    color: var(--text-primary);
}

/* Dashboard Content */
.content-view {
    padding: 1.5rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    min-width: 0;
}
.content-view-wide {
    max-width: 1520px;
}
.view-header {
    margin-bottom: 1.15rem;
    display: flex;
    justify-content: space-between;
    align-items: end;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(300px, 1fr) 2fr;
    gap: 1.15rem;
    align-items: stretch;
}

.hero-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    gap: 1rem;
}
.hero-meta-grid {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.75rem;
}
.meta-pill {
    padding: 0.85rem 0.95rem;
    border-radius: var(--radius-md);
    background: rgba(15, 23, 42, 0.34);
    border: 1px solid var(--border-color);
    text-align: left;
}
.meta-pill span {
    display: block;
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
}
.meta-pill strong {
    display: block;
    font-size: 0.95rem;
    color: var(--text-primary);
}
.hero-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0,0,0,0.2);
    padding: 0.5rem 1rem;
    border-radius: 2rem;
}
.location-display {
    display: none;
    align-items: center;
    gap: 0.35rem;
    margin-top: -10px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.location-icon {
    width: 14px;
    height: 14px;
}
.status-indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--text-muted);
}
.status-indicator.active {
    background: var(--success);
    box-shadow: 0 0 10px var(--success-glow);
}

.worked-time h2 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
    font-variant-numeric: tabular-nums;
}
.action-buttons {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.55rem;
}
.action-buttons .btn {
    min-width: 130px;
}
.chart-card {
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.chart-title {
    margin-bottom: 1rem;
}
.chart-frame {
    position: relative;
    height: 250px;
    width: 100%;
    min-width: 0;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.9rem;
    align-content: start;
    height: auto;
}
.stat-card {
    padding: 1.5rem;
    display: flex;
    align-items: center;
    gap: 1.2rem;
    transition: var(--transition);
}
.stat-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 18px 30px rgba(2, 6, 23, 0.18);
}
.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
}
.stat-icon i { width: 24px; height: 24px; }
.stat-icon.info { background: rgba(56,189,248,0.12); color: var(--primary); }
.stat-icon.warning { background: var(--warning-bg); color: var(--warning); }
.stat-icon.danger { background: var(--danger-bg); color: var(--danger); }
.stat-icon.primary { background: rgba(14,165,233,0.12); color: #0284c7; }

.stat-details { display: flex; flex-direction: column;}
.stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-label { font-size: 0.85rem; color: var(--text-secondary); }

.mt-6 { margin-top: 1.5rem; }

.recent-activity {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
}
.recent-activity h3 {
    margin-bottom: 1rem;
    padding-left: 0;
}
.dashboard-bottom-grid {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 1rem;
    align-items: stretch;
}
.dashboard-bottom-grid.mt-6 {
    margin-top: 0.85rem;
}
.stats-grid.mt-6 {
    margin-top: 1rem;
}
.scroll-panel {
    max-height: 400px;
    overflow-y: auto;
}
.mini-logs {
    display: flex;
    flex-direction: column;
}
.mini-logs .table-container {
    flex: 1;
}
.section-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.65rem;
}
.compact-btn {
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
}
.btn-icon-xs {
    width: 14px;
    height: 14px;
}

/* Form Controls */
.controls {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.65rem;
}
.records-controls {
    justify-content: flex-end;
}
.search-wrapper,
.filter-field {
    min-width: 220px;
}
.admin-log-filter {
    display: none;
}
.input-control {
    width: 100%;
    padding: 0.8rem 1rem 0.8rem 2.8rem;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    outline: none;
}
[data-theme="light"] .input-control {
    background: rgba(255, 255, 255, 0.5);
}
.input-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 15px var(--primary-glow);
}
.input-wrapper select.input-control,
.input-wrapper input.input-control {
    appearance: none;
}
.input-wrapper input[type="date"],
.input-wrapper input[type="month"] {
    padding-right: 3rem;
}
.input-wrapper input[type="date"]::-webkit-calendar-picker-indicator,
.input-wrapper input[type="month"]::-webkit-calendar-picker-indicator {
    opacity: 0.9;
    cursor: pointer;
    filter: invert(88%) sepia(14%) saturate(619%) hue-rotate(169deg) brightness(100%) contrast(98%);
}
[data-theme="light"] .input-wrapper input[type="date"]::-webkit-calendar-picker-indicator,
[data-theme="light"] .input-wrapper input[type="month"]::-webkit-calendar-picker-indicator {
    filter: invert(32%) sepia(60%) saturate(1761%) hue-rotate(168deg) brightness(91%) contrast(98%);
}

/* Timeline */
.timeline {
    list-style: none;
    padding: 0.25rem 0 0;
    margin: 0;
}
.timeline-item {
    position: relative;
    padding-left: 2.5rem;
    margin-bottom: 1rem;
    min-height: 60px;
}
.timeline-item::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 5px;
    bottom: -1rem;
    width: 2px;
    background: var(--border-color);
}
.timeline-item:last-child::before { display: none; }
.timeline-item::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 8px;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 3px var(--bg-base);
}
.time-stamp {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.35rem;
    font-weight: 600;
}
.timeline-content {
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.03);
    padding: 0.85rem 1rem;
}
.timeline-content h4 {
    margin-bottom: 0.25rem;
}
.timeline-content p {
    color: var(--text-secondary);
    font-size: 0.84rem;
    line-height: 1.45;
}

/* Tables */
.table-container {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    -webkit-overflow-scrolling: touch;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 760px;
}
.data-table th, .data-table td {
    padding: 0.5rem 0.62rem;
    text-align: left;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
    vertical-align: middle;
}
.data-table th {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 0.9rem;
    background: rgba(0,0,0,0.1);
}
.data-table tr:hover { background: rgba(255,255,255,0.02); }
.inline-action-row,
.report-action-row,
.log-action-row {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-wrap: wrap;
}
.report-action-row .btn {
    flex: 1 1 220px;
}
.log-action-row {
    justify-content: flex-start;
}
.table-secondary-text {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.log-duration-stack {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.log-location-stack {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}
.log-location-link {
    color: var(--primary);
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
}
.log-location-link.warning {
    color: var(--warning);
}
.log-device-stack {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}
.compact-icon-btn {
    padding: 0.25rem;
}

/* Badges */
.badge {
    display: inline-flex;
    padding: 0.25rem 0.75rem;
    border-radius: 2rem;
    font-size: 0.8rem;
    font-weight: 500;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }

/* Employee Grid */
.employee-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 2rem;
}
.driver-live-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}
.driver-live-card {
    padding: 1rem;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    background: rgba(255,255,255,0.03);
}
.driver-live-card h3 {
    margin-bottom: 0.25rem;
}
.driver-live-card p {
    color: var(--text-secondary);
    font-size: 0.82rem;
    line-height: 1.45;
}
.driver-live-meta {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-top: 0.65rem;
}
.driver-live-link {
    margin-top: 0.75rem;
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    color: var(--primary);
    font-size: 0.82rem;
}

.emp-card {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 1rem;
    transition: var(--transition);
    cursor: pointer;
    min-height: 220px;
}
.emp-card:hover { transform: translateY(-5px); }
.emp-avatar {
    width: 64px;
    height: 64px;
    background: var(--bg-panel-hover);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    color: var(--text-muted);
}
.emp-info h3 { margin-bottom: 0.2rem; }
.emp-info p { font-size: 0.85rem; color: var(--text-muted); }
.emp-device {
    margin-top: 0.85rem;
    display: inline-flex;
    padding: 0.35rem 0.7rem;
    border-radius: 999px;
    background: rgba(56, 189, 248, 0.12);
    color: var(--primary);
    font-size: 0.74rem;
}
.emp-last-login {
    margin-top: 0.45rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Toast */
#toast-container {
    position: fixed;
    top: 1.25rem;
    right: 2rem;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    align-items: flex-end;
}
.toast {
    background: var(--bg-panel);
    backdrop-filter: blur(10px);
    border: 1px solid var(--border-color);
    padding: 1rem 1.5rem;
    border-radius: var(--radius-md);
    color: var(--text-primary);
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 0.8rem;
    max-width: min(380px, calc(100vw - 2rem));
    animation: slideInRight 0.3s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}
.toast-admin-alert {
    background: linear-gradient(135deg, rgba(14, 165, 233, 0.96) 0%, rgba(2, 132, 199, 0.94) 100%);
    border-color: rgba(125, 211, 252, 0.65);
    color: #f8fcff;
    box-shadow: 0 14px 28px rgba(2, 132, 199, 0.34);
}
.toast-admin-alert i {
    color: #e0f2fe;
}
@keyframes slideInRight {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@media (max-width: 768px) {
    html, body {
        overflow-x: hidden;
    }
    .view {
        width: 100%;
        min-height: 100dvh;
    }
    #toast-container {
        top: 0.75rem;
        right: 0.75rem;
        left: 0.75rem;
        align-items: stretch;
    }
    .toast {
        max-width: 100%;
    }
    #app-wrapper { 
        display: block; 
        min-height: 100dvh;
    }
    .sidebar { 
        position: fixed;
        top: 0;
        left: 0;
        width: min(82vw, 300px);
        height: 100dvh;
        z-index: 1000;
        flex-direction: column;
        justify-content: flex-start;
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        border-right: 1px solid var(--border-color);
        border-bottom: none;
        background: var(--bg-panel);
    }
    .sidebar.show {
        transform: translateX(0);
        box-shadow: 10px 0 30px rgba(0,0,0,0.5);
    }
    .sidebar-nav { display: flex; width: 100%; }
    
    #sidebar-open-btn { display: flex !important; }
    #sidebar-close-btn { display: flex !important; }
    
    .main-content {
        width: 100%;
        padding: 0;
        min-width: 0;
        overflow-x: hidden;
    }
    
    .dashboard-grid, .admin-grid, .form-grid.two-col { grid-template-columns: 1fr; }
    .dashboard-bottom-grid { grid-template-columns: 1fr !important; }
    .top-nav {
        padding: 0.9rem 0.95rem;
        gap: 0.85rem;
        position: sticky;
        top: 0;
        z-index: 40;
        backdrop-filter: blur(14px);
    }
    .view-header,
    .controls,
    .top-nav {
        flex-direction: column;
    }
    .view-header,
    .records-controls {
        align-items: stretch;
    }
    .top-nav-start,
    .top-nav-actions {
        width: 100%;
        justify-content: space-between;
        gap: 0.75rem;
        flex-wrap: wrap;
    }
    .top-nav-start {
        align-items: center;
    }
    .clock-display {
        flex: 1;
        min-width: 0;
    }
    .header-refresh-btn {
        width: 100%;
        justify-content: center;
        order: 1;
        display: inline-flex !important;
        min-height: 46px;
        font-size: 0.95rem;
    }
    .nav-actions {
        width: 100%;
        justify-content: space-between;
        align-items: stretch;
        flex-wrap: wrap;
    }
    .nav-divider {
        display: none;
    }
    #theme-toggle {
        flex: 0 0 44px;
        align-self: flex-start;
    }
    .user-profile {
        width: 100%;
        justify-content: space-between;
        gap: 0.65rem;
        align-items: center;
        padding: 0.75rem 0.85rem;
        border-radius: var(--radius-md);
        background: rgba(255,255,255,0.04);
        border: 1px solid var(--border-color);
    }
    .user-info-right {
        text-align: left;
        flex: 1;
    }
    .search-wrapper,
    .filter-field {
        width: 100%;
        min-width: 0;
    }
    .content-view {
        padding: 1rem;
        max-width: 100%;
    }
    .content-view-wide {
        max-width: 100%;
    }
    .controls,
    .records-controls,
    .inline-action-row,
    .report-action-row {
        width: 100%;
    }
    .controls > *,
    .records-controls > *,
    .inline-action-row > *,
    .report-action-row > * {
        width: 100%;
    }
    .records-controls .btn,
    .inline-action-row .btn,
    .report-action-row .btn {
        justify-content: center;
    }
    .search-wrapper,
    .filter-field,
    .records-controls .input-wrapper {
        min-width: 0;
    }
    .view-header {
        gap: 0.5rem;
    }
    .view-header p {
        width: 100%;
    }
    .login-card {
        margin: 1rem;
        padding: 1.5rem;
        max-width: calc(100vw - 2rem);
    }
    .hero-card,
    .chart-card,
    .recent-activity,
    .mini-logs,
    .stat-card,
    .glass-panel.p-6 {
        padding: 1rem;
    }
    .hero-meta-grid,
    .branch-grid {
        grid-template-columns: 1fr;
    }
    .meta-pill,
    .stat-card,
    .notification-item {
        min-width: 0;
    }
    .action-buttons {
        width: 100%;
        flex-direction: column;
    }
    .action-buttons .btn {
        width: 100%;
        min-width: 0;
    }
    .worked-time h2 {
        font-size: 2.3rem;
    }
    .data-table {
        min-width: 520px;
        font-size: 0.82rem;
    }
    .notification-summary-row {
        width: 100%;
        justify-content: space-between;
        flex-wrap: wrap;
    }
    .data-table th, .data-table td {
        padding: 0.5rem 0.55rem;
    }
    .table-container {
        margin-inline: -0.25rem;
        padding-inline: 0.25rem;
    }
    .employee-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    .driver-live-grid {
        grid-template-columns: 1fr;
    }
    .emp-card {
        min-height: auto;
        padding: 1rem;
    }
    .mini-logs .table-container,
    .glass-panel .table-container {
        width: 100%;
    }
    .modal-content {
        width: calc(100vw - 1rem);
        max-height: calc(100dvh - 1rem);
        padding: 1rem;
        margin: 0.5rem;
    }
    #toast-container {
        left: 1rem;
        right: 1rem;
        bottom: auto;
    }
}

@media (max-width: 480px) {
    .top-nav {
        padding: 0.8rem 0.8rem;
    }
    #live-time {
        font-size: 1.2rem;
    }
    #live-date {
        font-size: 0.78rem;
    }
    .header-refresh-btn {
        min-height: 44px;
        padding-inline: 0.8rem;
    }
    .content-view,
    .content-view-wide {
        padding: 0.85rem;
    }
    .hero-card,
    .chart-card,
    .recent-activity,
    .mini-logs,
    .stat-card,
    .glass-panel.p-6 {
        padding: 0.9rem;
    }
    .hero-meta-grid,
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .data-table {
        min-width: 460px;
        font-size: 0.78rem;
    }
    .data-table th,
    .data-table td {
        padding: 0.45rem 0.5rem;
    }
    .modal-content {
        width: calc(100vw - 0.5rem);
        max-height: calc(100dvh - 0.5rem);
        padding: 0.9rem;
    }
}

/* Utilities */
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-column { display: flex; flex-direction: column; }
.gap-4 { gap: 1rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-6 { margin-top: 1.5rem; }
.p-6 { padding: 1.5rem; }
.btn-sm {
    padding: 0.55rem 0.9rem;
    font-size: 0.85rem;
}
.hidden-input {
    display: none;
}

/* Admin Grid */
.admin-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
}
.settings-stack {
    grid-template-columns: 1fr;
}
.settings-table-shell {
    max-height: 250px;
    overflow-y: auto;
}
.form-grid.two-col {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.settings-toggle {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.5rem;
}
.toggle-checkbox {
    width: 1.2rem;
    height: 1.2rem;
}
.toggle-label {
    margin: 0;
    cursor: pointer;
    color: var(--text-secondary);
}
.settings-submit-btn {
    margin-top: 1rem;
}
.settings-danger-zone {
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
}

/* Modal */
.modal {
    position: fixed;
    top: 0; left: 0; width: 100vw; height: 100vh;
    z-index: 100;
    display: flex;
    align-items: center; justify-content: center;
    opacity: 1; pointer-events: all;
    transition: opacity 0.3s ease;
}
.modal.hidden {
    opacity: 0; pointer-events: none;
}
.modal-backdrop {
    position: absolute; top:0; left:0; width:100%; height:100%;
    background: rgba(0,0,0,0.5);
    backdrop-filter: blur(4px);
}
.modal-content {
    position: relative;
    width: min(92vw, 500px);
    max-height: min(88vh, 760px);
    overflow-y: auto;
    padding: 2rem;
    border-radius: var(--radius-lg);
    z-index: 101;
    transform: scale(1);
    transition: transform 0.3s ease;
}
.modal.hidden .modal-content { transform: scale(0.95); }
.modal-select {
    width: 100%;
    padding: 0.8rem 1rem;
    background: rgba(0,0,0,0.2);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    cursor: pointer;
}
.multi-select {
    min-height: 120px;
    padding: 0.75rem;
}
.multi-select option {
    padding: 0.45rem 0.65rem;
    border-radius: 0.5rem;
}
.modal-toggle {
    margin-bottom: 1.5rem;
}
.modal-action-btn {
    width: auto;
}
.branch-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
.branch-location-actions {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1.25rem;
    flex-wrap: wrap;
}
.branch-locate-btn {
    padding-inline: 1rem;
}
.branch-location-status {
    font-size: 0.8rem;
    color: var(--text-muted);
}
.password-modal {
    max-width: 400px;
}
.modal-header {
    display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem;
}
.modal-actions {
    display: flex; justify-content: flex-end; gap: 1rem; margin-top: 2rem; border-top: 1px solid var(--border-color); padding-top: 1.5rem;
}
