/* ═══════════════════════════════════════════════════════════════════════════
   WorkMonitor - Admin Dashboard Styles
   Premium dark theme with glassmorphism, gradients, and micro-animations
   ═══════════════════════════════════════════════════════════════════════════ */

/* ─── CSS Variables / Design Tokens ────────────────────────────────────────── */
:root {
    /* Neutral, layered dark surfaces (not purple-tinted) — reads like a real SaaS console */
    --bg-primary: #0b0d11;
    --bg-secondary: #0f1218;
    --bg-card: #151921;
    --bg-card-hover: #1a1f29;
    --bg-sidebar: #0d0f14;
    --bg-input: #1a1e26;

    --text-primary: #e7e9ee;
    --text-secondary: #99a1af;
    --text-muted: #6b7382;

    --accent-primary: #6366f1;
    --accent-secondary: #818cf8;
    --accent-gradient: linear-gradient(135deg, #6366f1 0%, #818cf8 100%);

    --status-working: #22c55e;
    --status-working-bg: rgba(34, 197, 94, 0.12);
    --status-phone: #f59e0b;
    --status-phone-bg: rgba(245, 158, 11, 0.12);
    --status-break: #ef4444;
    --status-break-bg: rgba(239, 68, 68, 0.12);
    --status-offline: #6b7280;
    --status-offline-bg: rgba(107, 114, 128, 0.12);

    /* Hairline neutral borders — the single biggest change from the "template" look */
    --border-color: rgba(255, 255, 255, 0.08);
    --border-glow: rgba(255, 255, 255, 0.16);

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.5);
    --shadow-glow: none;

    --sidebar-width: 260px;
    --topbar-height: 70px;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 20px;

    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;
    --transition-slow: 0.5s ease;
}

/* ─── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 14px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

/* ─── Scrollbar ────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(99, 102, 241, 0.3);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(99, 102, 241, 0.5); }


/* ═══════════════════════════════════════════════════════════════════════════
   LOGIN PAGE
   ═══════════════════════════════════════════════════════════════════════════ */

.login-page {
    /* Calm neutral backdrop with one faint accent wash — no floating bubbles */
    background:
        radial-gradient(900px 500px at 50% -10%, rgba(99, 102, 241, 0.10), transparent 70%),
        var(--bg-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
}

.login-bg-animation { display: none; }   /* the animated colour blobs read as a template */

.floating-shape {
    position: absolute;
    border-radius: 50%;
    opacity: 0.08;
    animation: float 20s ease-in-out infinite;
}

.shape-1 {
    width: 400px; height: 400px;
    background: var(--accent-primary);
    top: -100px; left: -100px;
    animation-delay: 0s;
}
.shape-2 {
    width: 300px; height: 300px;
    background: var(--accent-secondary);
    top: 50%; right: -50px;
    animation-delay: -5s;
    animation-duration: 25s;
}
.shape-3 {
    width: 200px; height: 200px;
    background: #ec4899;
    bottom: -50px; left: 30%;
    animation-delay: -10s;
}
.shape-4 {
    width: 150px; height: 150px;
    background: #06b6d4;
    top: 20%; right: 20%;
    animation-delay: -7s;
    animation-duration: 30s;
}
.shape-5 {
    width: 250px; height: 250px;
    background: var(--accent-primary);
    bottom: 10%; right: 10%;
    animation-delay: -15s;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(30px, -50px) scale(1.1); }
    50% { transform: translate(-20px, 40px) scale(0.95); }
    75% { transform: translate(50px, 20px) scale(1.05); }
}

.login-container {
    width: 100%;
    max-width: 440px;
    padding: 20px;
    z-index: 10;
}

.login-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    padding: 44px 40px;
    box-shadow: var(--shadow-lg);
    transition: transform var(--transition-normal), box-shadow var(--transition-normal);
    animation: slideUp 0.4s ease-out;
}

@keyframes slideUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

.login-card:hover {
    box-shadow: var(--shadow-lg), 0 0 50px rgba(99, 102, 241, 0.2);
}

.login-card.login-success {
    transform: scale(0.95);
    opacity: 0;
    transition: all 0.5s ease;
}

.login-card.shake {
    animation: shake 0.5s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-10px); }
    40% { transform: translateX(10px); }
    60% { transform: translateX(-6px); }
    80% { transform: translateX(6px); }
}

.login-header {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.logo-icon svg {
    width: 52px;
    height: 52px;
}

.login-logo h1 {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.4px;
}

.login-subtitle {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-top: 4px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.form-group label svg {
    opacity: 0.6;
}

.form-group input {
    width: 100%;
    padding: 14px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all var(--transition-fast);
    outline: none;
}

.form-group input:focus {
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.15);
    background: rgba(30, 30, 65, 0.8);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.error-message {
    background: var(--status-break-bg);
    color: var(--status-break);
    padding: 10px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    margin-bottom: 16px;
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--accent-gradient);
    color: white;
    border: none;
    border-radius: var(--radius-md);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-normal);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

.btn-login:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(99, 102, 241, 0.4);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}

.spinner {
    width: 20px;
    height: 20px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

.btn-loader {
    display: inline-flex;
    align-items: center;
}

.login-footer {
    text-align: center;
    margin-top: 24px;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.login-footer code {
    background: var(--bg-input);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--accent-primary);
}


/* ═══════════════════════════════════════════════════════════════════════════
   SIDEBAR
   ═══════════════════════════════════════════════════════════════════════════ */

.sidebar {
    width: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-sidebar);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 100;
    transition: transform var(--transition-normal);
}

.sidebar.collapsed {
    transform: translateX(-100%);
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 11px;
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: -0.2px;
    color: var(--text-primary);
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    color: var(--text-secondary);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.9rem;
    transition: all var(--transition-fast);
    position: relative;
    overflow: hidden;
}

.nav-item:hover {
    background: rgba(99, 102, 241, 0.08);
    color: var(--text-primary);
}

.nav-item.active {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-primary);
}

.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 60%;
    background: var(--accent-gradient);
    border-radius: 0 3px 3px 0;
}

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.admin-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.admin-avatar {
    width: 36px;
    height: 36px;
    background: var(--accent-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.85rem;
    color: white;
}

.admin-details {
    display: flex;
    flex-direction: column;
}

.admin-details span {
    font-size: 0.85rem;
    font-weight: 600;
}

.admin-details small {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.btn-logout {
    background: none;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition-fast);
}

.btn-logout:hover {
    border-color: var(--status-break);
    color: var(--status-break);
    background: var(--status-break-bg);
}


/* ═══════════════════════════════════════════════════════════════════════════
   MAIN CONTENT
   ═══════════════════════════════════════════════════════════════════════════ */

.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    background: var(--bg-primary);
    transition: margin-left var(--transition-normal);
}

.main-content.expanded {
    margin-left: 0;
}


/* ─── Top Bar ──────────────────────────────────────────────────────────────── */

.topbar {
    height: var(--topbar-height);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    background: rgba(10, 10, 26, 0.8);
    backdrop-filter: blur(12px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-menu {
    display: none;
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
}

.page-title {
    display: flex;
    align-items: center;
    gap: 12px;
}

.page-title h2 {
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: -0.3px;
}

.live-indicator {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--status-working);
    background: var(--status-working-bg);
    padding: 4px 10px;
    border-radius: 20px;
    letter-spacing: 1px;
}

.live-dot {
    width: 8px;
    height: 8px;
    background: var(--status-working);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.connection-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    transition: background var(--transition-fast);
}

.status-dot.connected { background: var(--status-working); }
.status-dot.disconnected { background: var(--status-break); }

.current-time {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}


/* ─── Pages ────────────────────────────────────────────────────────────────── */

.page {
    display: none;
    padding: 28px;
    animation: fadeIn 0.3s ease;
}

.page.active {
    display: block;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.page-header-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    flex-wrap: wrap;
    gap: 12px;
}

.page-header-bar h3 {
    font-size: 1.15rem;
    font-weight: 700;
}


/* ─── Stats Cards ──────────────────────────────────────────────────────────── */

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
}

/* No multi-colour top bars — a uniform hairline card reads as a real product.
   Identity is carried by the small tinted icon, status colour stays on status only. */
.stat-card:hover {
    border-color: var(--border-glow);
    background: var(--bg-card-hover);
}

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.stat-total .stat-icon { background: rgba(99, 102, 241, 0.12); color: var(--accent-primary); }
.stat-online .stat-icon { background: rgba(6, 182, 212, 0.12); color: #06b6d4; }
.stat-working .stat-icon { background: var(--status-working-bg); color: var(--status-working); }
.stat-break .stat-icon { background: var(--status-break-bg); color: var(--status-break); }

.stat-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--text-secondary);
    font-weight: 500;
}


/* ─── Cards ────────────────────────────────────────────────────────────────── */

.card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    margin-bottom: 24px;
    transition: border-color var(--transition-normal);
}

.card:hover {
    border-color: var(--border-glow);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap;
    gap: 12px;
}

.card-header h3 {
    font-size: 1rem;
    font-weight: 700;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.card-body {
    padding: 24px;
}


/* ─── Dashboard Grid ───────────────────────────────────────────────────────── */

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 24px;
}


/* ─── Productivity Ring ────────────────────────────────────────────────────── */

.productivity-ring-container {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.productivity-ring {
    position: relative;
    width: 140px;
    height: 140px;
}

.ring-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.ring-bg {
    fill: none;
    stroke: rgba(99, 102, 241, 0.1);
    stroke-width: 8;
}

.ring-fill {
    fill: none;
    stroke: url(#ringGradient);
    stroke-width: 8;
    stroke-linecap: round;
    transition: stroke-dashoffset 1s ease;
}

.ring-text {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.ring-value {
    font-size: 1.6rem;
    font-weight: 800;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.ring-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.productivity-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.prod-item {
    display: flex;
    align-items: center;
    gap: 10px;
}

.prod-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    flex-shrink: 0;
}

.prod-dot.working { background: var(--status-working); }
.prod-dot.phone { background: var(--status-phone); }
.prod-dot.break { background: var(--status-break); }

.prod-label {
    flex: 1;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.prod-value {
    font-size: 0.9rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}


/* ─── Status Bars ──────────────────────────────────────────────────────────── */

.status-bars {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.status-bar-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.sbar-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sbar-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.sbar-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.sbar-dot.working { background: var(--status-working); }
.sbar-dot.phone { background: var(--status-phone); }
.sbar-dot.break { background: var(--status-break); }
.sbar-dot.offline { background: var(--status-offline); }

.sbar-count {
    font-size: 0.85rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.sbar-track {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    overflow: hidden;
}

.sbar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s ease;
}

.sbar-fill.working { background: linear-gradient(90deg, #10b981, #34d399); }
.sbar-fill.phone { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.sbar-fill.break { background: linear-gradient(90deg, #ef4444, #f87171); }
.sbar-fill.offline { background: linear-gradient(90deg, #6b7280, #9ca3af); }


/* ─── Search & Filters ─────────────────────────────────────────────────────── */

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    transition: border-color var(--transition-fast);
}

.search-box:focus-within {
    border-color: var(--accent-primary);
}

.search-box svg { color: var(--text-muted); flex-shrink: 0; }

.search-box input {
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    width: 160px;
}

.search-box input::placeholder { color: var(--text-muted); }

.filter-select {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    transition: border-color var(--transition-fast);
}

.filter-select:focus { border-color: var(--accent-primary); }
.filter-select option { background: var(--bg-secondary); }


/* ─── Employee Grid ────────────────────────────────────────────────────────── */

.employee-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

.emp-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 20px;
    transition: all var(--transition-normal);
    position: relative;
    overflow: hidden;
    animation: cardIn 0.4s ease;
}

@keyframes cardIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.emp-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-glow);
    box-shadow: var(--shadow-sm);
}

.emp-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}

.emp-card.status-WORKING::before { background: var(--status-working); }
.emp-card.status-PHONE::before { background: var(--status-phone); }
.emp-card.status-BREAK::before { background: var(--status-break); }
.emp-card.status-OFFLINE::before { background: var(--status-offline); }

.emp-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}

.emp-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.9rem;
    flex-shrink: 0;
}

.emp-card.status-WORKING .emp-avatar { background: var(--status-working-bg); color: var(--status-working); }
.emp-card.status-PHONE .emp-avatar { background: var(--status-phone-bg); color: var(--status-phone); }
.emp-card.status-BREAK .emp-avatar { background: var(--status-break-bg); color: var(--status-break); }
.emp-card.status-OFFLINE .emp-avatar { background: var(--status-offline-bg); color: var(--status-offline); }

.emp-name {
    font-weight: 600;
    font-size: 0.95rem;
}

.emp-dept {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.emp-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.3px;
    margin-bottom: 12px;
}

.emp-status-badge .badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
}

.emp-card.status-WORKING .emp-status-badge {
    background: var(--status-working-bg);
    color: var(--status-working);
}
.emp-card.status-WORKING .badge-dot { background: var(--status-working); animation: pulse 2s infinite; }

.emp-card.status-PHONE .emp-status-badge {
    background: var(--status-phone-bg);
    color: var(--status-phone);
}
.emp-card.status-PHONE .badge-dot { background: var(--status-phone); animation: pulse 2s infinite; }

.emp-card.status-BREAK .emp-status-badge {
    background: var(--status-break-bg);
    color: var(--status-break);
}
.emp-card.status-BREAK .badge-dot { background: var(--status-break); animation: pulse 2s infinite; }

.emp-card.status-OFFLINE .emp-status-badge {
    background: var(--status-offline-bg);
    color: var(--status-offline);
}
.emp-card.status-OFFLINE .badge-dot { background: var(--status-offline); }

.emp-time-grid {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 8px;
}

.emp-time-item {
    text-align: center;
    padding: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: var(--radius-sm);
}

.emp-time-value {
    font-size: 0.9rem;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    display: block;
}

.emp-time-label {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}


/* ─── Empty State ──────────────────────────────────────────────────────────── */

.empty-state {
    text-align: center;
    padding: 48px 20px;
    grid-column: 1 / -1;
}

.empty-state p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 12px;
}

.empty-state small {
    color: var(--text-muted);
    font-size: 0.8rem;
}


/* ─── Badges ───────────────────────────────────────────────────────────────── */

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.badge-info {
    background: rgba(99, 102, 241, 0.12);
    color: var(--accent-primary);
}

.badge-success {
    background: var(--status-working-bg);
    color: var(--status-working);
}


/* ─── Buttons ──────────────────────────────────────────────────────────────── */

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all var(--transition-fast);
}

.btn-primary {
    background: var(--accent-gradient);
    color: white;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.btn-secondary {
    background: var(--bg-input);
    color: var(--text-primary);
    border: 1px solid var(--border-color);
}

.btn-secondary:hover {
    border-color: var(--accent-primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
}

.btn-sm {
    padding: 6px 12px;
    font-size: 0.75rem;
}

.btn-danger {
    background: var(--status-break-bg);
    color: var(--status-break);
    border: 1px solid rgba(239, 68, 68, 0.2);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.2);
}


/* ─── Data Table ───────────────────────────────────────────────────────────── */

.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table thead th {
    text-align: left;
    padding: 12px 16px;
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border-color);
}

.data-table tbody td {
    padding: 14px 16px;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
    vertical-align: middle;
}

.data-table tbody tr {
    transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
    background: rgba(99, 102, 241, 0.04);
}

.table-status {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 600;
}

.table-status.working {
    background: var(--status-working-bg);
    color: var(--status-working);
}
.table-status.phone {
    background: var(--status-phone-bg);
    color: var(--status-phone);
}
.table-status.break {
    background: var(--status-break-bg);
    color: var(--status-break);
}
.table-status.offline {
    background: var(--status-offline-bg);
    color: var(--status-offline);
}

.api-key-cell {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
    max-width: 200px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}


/* ─── Modals ───────────────────────────────────────────────────────────────── */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: fadeIn 0.2s ease;
}

.modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    width: 90%;
    max-width: 480px;
    box-shadow: var(--shadow-lg);
    animation: slideUp 0.3s ease;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

.modal-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 4px;
    transition: color var(--transition-fast);
}

.modal-close:hover { color: var(--text-primary); }

.modal-body {
    padding: 24px;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid var(--border-color);
}


/* ─── API Key Display ──────────────────────────────────────────────────────── */

.api-key-display {
    text-align: center;
}

.api-key-warning {
    color: var(--status-phone);
    font-size: 0.85rem;
    margin-bottom: 16px;
    font-weight: 500;
}

.api-key-box {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    margin-bottom: 20px;
}

.api-key-box code {
    flex: 1;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
    color: var(--accent-primary);
    word-break: break-all;
}

.btn-copy {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(99, 102, 241, 0.12);
    border: 1px solid rgba(99, 102, 241, 0.2);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    color: var(--accent-primary);
    font-family: inherit;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    white-space: nowrap;
}

.btn-copy:hover {
    background: rgba(99, 102, 241, 0.2);
}

.api-key-command {
    text-align: left;
}

.api-key-command strong {
    display: block;
    margin-bottom: 8px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.api-key-command code {
    display: block;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 12px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.75rem;
    color: var(--status-working);
    word-break: break-all;
}


/* ─── Settings ─────────────────────────────────────────────────────────────── */

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.settings-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.settings-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.setup-steps {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.setup-step {
    display: flex;
    gap: 14px;
    align-items: flex-start;
}

.step-num {
    width: 28px;
    height: 28px;
    background: var(--accent-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.8rem;
    font-weight: 700;
    color: white;
    flex-shrink: 0;
}

.setup-step div {
    flex: 1;
}

.setup-step strong {
    display: block;
    margin-bottom: 4px;
    font-size: 0.85rem;
}

.setup-step p {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.setup-step code {
    display: block;
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 0.73rem;
    color: var(--status-working);
    margin-top: 6px;
    word-break: break-all;
}

.date-picker-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.date-input {
    background: var(--bg-input);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-sm);
    padding: 8px 12px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.85rem;
    outline: none;
}

.date-input:focus { border-color: var(--accent-primary); }


/* ─── Productivity Bar in table ────────────────────────────────────────────── */

.productivity-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.productivity-bar-track {
    width: 80px;
    height: 6px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 3px;
    overflow: hidden;
}

.productivity-bar-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.5s ease;
}

.productivity-bar-value {
    font-size: 0.8rem;
    font-weight: 600;
    min-width: 36px;
    font-variant-numeric: tabular-nums;
}


/* ─── Toast Notifications ──────────────────────────────────────────────────── */

.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 14px 20px;
    box-shadow: var(--shadow-md);
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 10px;
    max-width: 360px;
}

.toast.toast-out {
    animation: toastOut 0.3s ease forwards;
}

@keyframes toastIn {
    from { opacity: 0; transform: translateX(100%); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes toastOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(100%); }
}

.toast-success { border-left: 3px solid var(--status-working); }
.toast-error { border-left: 3px solid var(--status-break); }
.toast-info { border-left: 3px solid var(--accent-primary); }

.toast-message {
    font-size: 0.85rem;
    color: var(--text-primary);
}


/* ─── Responsive ───────────────────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .sidebar {
        transform: translateX(-100%);
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
    }
    .btn-menu {
        display: block;
    }
    .topbar {
        padding: 0 16px;
    }
    .page {
        padding: 16px;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }
    .employee-grid {
        grid-template-columns: 1fr;
    }
    .card-header {
        flex-direction: column;
        align-items: flex-start;
    }
    .card-actions {
        width: 100%;
    }
    .search-box {
        flex: 1;
    }
    .search-box input {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
    .login-card {
        padding: 32px 24px;
    }
}

/* ─── v2 additions ─────────────────────────────────────────────────────────── */
.emp-card { cursor: pointer; }
.emp-card.status-ABSENT::before { background: var(--status-offline); }
.emp-card.status-ABSENT .emp-avatar { background: var(--status-offline-bg); color: var(--status-offline); }
.emp-card.status-ABSENT .emp-status-badge {
    background: var(--status-offline-bg);
    color: var(--text-secondary);
}
.emp-card.status-ABSENT .badge-dot { background: var(--status-offline); animation: pulse 2s infinite; }

.alert-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 0 0 20px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    background: var(--status-phone-bg);
    border: 1px solid rgba(245, 158, 11, 0.35);
    color: var(--status-phone);
    font-size: 0.95rem;
}
.alert-banner code {
    background: rgba(0, 0, 0, 0.25);
    padding: 1px 6px;
    border-radius: 4px;
}

.link { color: inherit; text-decoration: none; }
.link:hover { color: var(--accent-primary); text-decoration: underline; }

.row-inactive td { opacity: 0.55; }
.badge-inactive { background: var(--status-break-bg); color: var(--status-break); }
.badge-consent-yes { background: var(--status-working-bg); color: var(--status-working); }
.badge-consent-no  { background: var(--status-phone-bg);   color: var(--status-phone); }
.actions-cell { white-space: nowrap; }
.actions-cell .btn + .btn { margin-left: 4px; }

.modal.modal-wide {
    max-width: 720px;
    max-height: 90vh;
    overflow-y: auto;
}
.detail-meta { color: var(--text-secondary); margin-bottom: 16px; }
.detail-heading {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    margin: 20px 0 12px;
}

.history-chart {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 10px;
    align-items: end;
}
.history-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.history-stack {
    width: 100%;
    max-width: 44px;
    height: 140px;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    background: var(--bg-input);
    border-radius: var(--radius-sm);
    overflow: hidden;
}
.history-stack .seg { width: 100%; transition: height var(--transition-normal); }
.history-stack .seg.working { background: var(--status-working); }
.history-stack .seg.phone { background: var(--status-phone); }
.history-stack .seg.break { background: var(--status-break); }
.history-pct { font-size: 0.8rem; font-weight: 600; }
.history-label { font-size: 0.75rem; color: var(--text-secondary); }
.history-legend {
    display: flex;
    gap: 16px;
    margin-top: 12px;
    font-size: 0.8rem;
    color: var(--text-secondary);
}
.history-legend span { display: inline-flex; align-items: center; gap: 6px; }

@media (max-width: 768px) {
    .alert-banner { flex-direction: column; align-items: flex-start; }
    .history-chart { gap: 4px; }
}

/* ─── v3: Excel report + monitoring links ─────────────────────────────────── */
.excel-card { margin-bottom: 20px; }
.excel-bar { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.excel-bar p { color: var(--text-secondary); font-size: 13px; margin-top: 4px; max-width: 520px; line-height: 1.5; }
.range-label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); }
.monitor-link-block {
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 14px 16px;
    margin-bottom: 18px;
}
.monitor-link-block > p { color: var(--text-secondary); font-size: 13px; margin: 6px 0 10px; line-height: 1.5; }
.monitor-link-block code { word-break: break-all; }
.monitor-link-block .link-note { font-size: 12px; margin: 8px 0 0; }
.api-key-subhead { color: var(--text-secondary); font-size: 13px; margin-bottom: 8px; }

/* ─── v4: Monitoring page ─────────────────────────────────────────────────── */
.nav-badge {
    margin-left: auto;
    min-width: 22px;
    padding: 1px 7px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-align: center;
    background: rgba(107, 114, 128, 0.25);
    color: var(--text-secondary);
}
.nav-badge.live { background: var(--status-working); color: #fff; box-shadow: 0 0 10px rgba(16, 185, 129, 0.5); }
.page-sub { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }

.mon-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; margin-bottom: 20px; }
@media (max-width: 1100px) { .mon-tiles { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 640px) { .mon-tiles { grid-template-columns: repeat(2, 1fr); } }
.mon-tile {
    display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
    background: var(--bg-card); border: 1px solid var(--border-color); border-left: 4px solid var(--status-offline);
    border-radius: var(--radius-md); padding: 16px 18px; cursor: pointer; text-align: left;
    font: inherit; color: var(--text-primary); transition: transform var(--transition-fast);
}
.mon-tile:hover { transform: translateY(-2px); }
.mon-tile-num { font-size: 1.9rem; font-weight: 800; line-height: 1.1; }
.mon-tile-label { font-size: 0.8rem; color: var(--text-secondary); }
.mon-tile.online { border-left-color: var(--status-working); }
.mon-tile.online .mon-tile-num { color: var(--status-working); }
.mon-tile.today { border-left-color: #60a5fa; }
.mon-tile.never { border-left-color: var(--status-break); }
.mon-tile.pending { border-left-color: var(--status-phone); }

.mon-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-tab {
    font: inherit; font-size: 0.82rem; font-weight: 600; padding: 7px 14px; border-radius: 999px; cursor: pointer;
    background: transparent; color: var(--text-secondary); border: 1px solid var(--border-color);
}
.filter-tab.active { background: var(--accent-primary); border-color: var(--accent-primary); color: #fff; }
.mon-search { min-width: 240px; }

.mon-table td { vertical-align: middle; }
.mon-table .muted { color: var(--text-muted); }
.mon-row.is-online { background: rgba(16, 185, 129, 0.04); }
.mon-state { font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
.mon-state-online { color: var(--status-working); }
.mon-state-offline_today, .mon-state-not_today { color: var(--text-secondary); }
.mon-state-never { color: var(--status-break); }
.mon-consent { margin-top: 4px; }
.mon-stale { color: var(--status-phone); font-weight: 600; }
.mon-consent .badge, .mon-table .table-status { white-space: nowrap; }

/* ─── v5: Work timeline ───────────────────────────────────────────────────── */
.tl-card { margin-bottom: 20px; }
.tl-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.tl-title { font-size: 1rem; font-weight: 700; }
.tl-controls { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.tl-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.78rem; color: var(--text-secondary); }
.tl-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tl-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.tl-legend .tl-swatch { margin-right: 0; }
.tl-swatch.working, .tl-seg.working { background: var(--status-working); }
.tl-swatch.phone, .tl-seg.phone { background: var(--status-phone); }
.tl-swatch.break, .tl-seg.break { background: var(--status-break); }
.tl-swatch.offline { background: rgba(107, 114, 128, 0.18); border: 1px dashed rgba(148, 163, 184, 0.45); }

.tl-scroll { max-height: 460px; overflow: auto; }
.tl-grid { min-width: 640px; }
.tl-row { display: grid; grid-template-columns: 170px 1fr 70px; align-items: center; gap: 12px; padding: 5px 0; }
.tl-axis-row { position: sticky; top: 0; z-index: 2; background: var(--bg-secondary); padding: 0 0 6px; }
.tl-axis { position: relative; height: 18px; }
.tl-tick { position: absolute; transform: translateX(-50%); font-size: 0.7rem; color: var(--text-muted); white-space: nowrap; }
.tl-tick:first-child { transform: none; }
.tl-tick:last-child { transform: translateX(-100%); }
.tl-name { display: flex; align-items: center; gap: 8px; min-width: 0; color: var(--text-primary); text-decoration: none; font-size: 0.85rem; font-weight: 500; }
.tl-name:hover .tl-name-text { text-decoration: underline; }
.tl-name-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-dot { width: 8px; height: 8px; border-radius: 50%; background: rgba(148, 163, 184, 0.35); flex-shrink: 0; }
.tl-dot.on { background: var(--status-working); box-shadow: 0 0 6px var(--status-working); }
.tl-track {
    position: relative; height: 22px; border-radius: 4px;
    background: rgba(107, 114, 128, 0.12);
}
.tl-gridline { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(148, 163, 184, 0.10); }
/* 2px surface gap between neighbouring blocks */
.tl-seg { position: absolute; top: 0; bottom: 0; border-radius: 4px; box-shadow: 0 0 0 1px var(--bg-secondary); cursor: default; }
.tl-seg:hover { filter: brightness(1.15); z-index: 1; }
.tl-now { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--text-primary); opacity: 0.7; border-radius: 1px; z-index: 1; }
.tl-total { font-size: 0.8rem; color: var(--text-secondary); text-align: right; font-variant-numeric: tabular-nums; }
.tl-total-head { font-size: 0.7rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; }
.tl-none { color: var(--text-muted); font-size: 0.85rem; padding: 10px 0 2px; }
.tl-tooltip {
    position: fixed; z-index: 1000; pointer-events: none; opacity: 0; transition: opacity 0.1s;
    background: #0f1020; border: 1px solid var(--border-color); border-radius: 8px;
    padding: 8px 12px; font-size: 0.8rem; color: var(--text-primary); line-height: 1.5;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
}
.tl-tooltip.show { opacity: 1; }
.tl-tip-time { color: var(--text-secondary); font-variant-numeric: tabular-nums; }
@media (max-width: 640px) { .tl-row { grid-template-columns: 110px 1fr 56px; gap: 8px; } }

/* ─── v7: Live camera view ────────────────────────────────────────────────── */
.btn-live { background: rgba(239, 68, 68, 0.12); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.4); white-space: nowrap; }
.btn-live:hover { background: rgba(239, 68, 68, 0.22); }
.live-pill { display: inline-block; background: #dc2626; color: #fff; font-size: 0.7rem; font-weight: 800; padding: 2px 8px; border-radius: 999px; margin-right: 8px; vertical-align: 2px; animation: live-blink 1.6s infinite; }
@keyframes live-blink { 50% { opacity: 0.55; } }
.live-stage { position: relative; background: #000; border-radius: 10px; overflow: hidden; aspect-ratio: 4 / 3; display: flex; align-items: center; justify-content: center; }
.live-stage img { width: 100%; height: 100%; object-fit: contain; display: block; }
.live-placeholder { display: flex; flex-direction: column; align-items: center; gap: 12px; color: var(--text-secondary); font-size: 0.85rem; text-align: center; padding: 24px; }
.live-placeholder[hidden], .live-stage img[hidden] { display: none; }
.spinner-sm { width: 28px; height: 28px; border: 3px solid rgba(148, 163, 184, 0.25); border-top-color: var(--accent-primary); border-radius: 50%; animation: live-spin 1s linear infinite; }
@keyframes live-spin { to { transform: rotate(360deg); } }
.live-meta { display: flex; justify-content: space-between; margin-top: 10px; font-size: 0.85rem; color: var(--text-secondary); }
.live-note { margin-top: 8px; font-size: 0.78rem; color: var(--text-muted); }

/* ─── v8: live status timers ──────────────────────────────────────────────── */
.emp-status-badge .since { margin-left: 6px; font-variant-numeric: tabular-nums; opacity: 0.85; font-weight: 600; }
.emp-status-badge .since::before { content: "· "; }


/* ─── v9: phones ──────────────────────────────────────────────────────────── */
.sidebar-backdrop { display: none; }
@media (max-width: 768px) {
    /* Menu: dim the page behind it; tapping outside closes it */
    .sidebar { z-index: 1001; }
    .sidebar-backdrop.show {
        display: block; position: fixed; inset: 0; z-index: 1000;
        background: rgba(0, 0, 0, 0.55);
    }

    /* Inputs at 16px stop iPhone Safari from zooming in on focus */
    input, select, textarea { font-size: 16px !important; }

    /* Modals become bottom sheets that fit the screen */
    .modal-overlay { align-items: flex-end !important; padding: 0 !important; }
    .modal, .modal.modal-wide {
        width: 100% !important; max-width: 100% !important;
        max-height: 92dvh; overflow-y: auto;
        border-radius: 18px 18px 0 0;
    }
    .modal-header, .modal-body, .modal-footer { padding: 14px 16px !important; }
    .modal-footer { flex-wrap: wrap; gap: 8px; }
    .modal-footer .btn { flex: 1 1 auto; }

    /* Live camera / screen: use the full width, never taller than the screen */
    .live-stage img { width: 100%; height: auto; max-height: 62dvh; object-fit: contain; }

    /* Tables scroll sideways; keep the name column in view and make buttons tappable */
    .data-table th, .data-table td { padding: 10px 8px; font-size: 13px; }
    .mon-table th:first-child, .mon-table td:first-child,
    #employeeTable th:first-child, #employeeTable td:first-child {
        position: sticky; left: 0; z-index: 1;
        background: var(--bg-card);
        box-shadow: 1px 0 0 var(--border-color);
    }
    .actions-cell { white-space: nowrap; }
    .actions-cell .btn, .btn-sm { min-height: 38px; min-width: 38px; }

    /* Toolbars stack instead of overflowing */
    .excel-bar, .excel-bar > div { flex-direction: column; align-items: stretch; }
    .excel-bar .range-label { justify-content: space-between; }
    .excel-bar .date-input, .excel-bar .btn { width: 100%; }
    .mon-toolbar, .card-actions { flex-wrap: wrap; gap: 8px; }

    /* Timeline: a little more room for the bars */
    .tl-row { grid-template-columns: 84px 1fr 48px !important; gap: 6px !important; }
    .tl-legend { flex-wrap: wrap; }
}

/* Screen view not possible for this employee (phone / desktop app): dimmed, click explains why */
.btn-live.is-unavailable { opacity: 0.45; filter: grayscale(0.8); cursor: help; }

/* ─── v10: server address card (follows WiFi/IP changes) ─────────────────────── */
.addr-card { background: var(--bg-card); border: 1px solid var(--border-color); border-left: 4px solid var(--brand, #6366f1); border-radius: 12px; padding: 14px 16px; margin-bottom: 20px; }
.addr-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-weight: 600; margin-bottom: 10px; }
.addr-head small { color: var(--text-secondary); font-weight: 400; }
.addr-pill { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px; background: rgba(107,114,128,.25); color: var(--text-secondary); white-space: nowrap; }
.addr-pill.ok { background: rgba(16,185,129,.18); color: #10b981; }
.addr-pill.bad { background: rgba(239,68,68,.18); color: #f87171; }
.addr-warn { background: rgba(245,158,11,.12); border: 1px solid rgba(245,158,11,.4); color: #fcd34d; border-radius: 10px; padding: 10px 12px; font-size: 13px; line-height: 1.5; margin-bottom: 10px; }
.addr-rows { display: flex; flex-direction: column; gap: 8px; }
.addr-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.addr-tag { font-size: 12px; font-weight: 700; color: #10b981; min-width: 190px; }
.addr-tag.muted { color: var(--text-secondary); font-weight: 600; }
.addr-row code { background: rgba(99,102,241,.1); border: 1px solid var(--border-color); border-radius: 8px; padding: 6px 10px; font-size: 13px; word-break: break-all; flex: 1; }
.addr-note { color: var(--text-secondary); font-size: 12.5px; line-height: 1.55; margin-top: 10px; }
@media (max-width: 768px) { .addr-tag { min-width: 0; } .addr-row code { width: 100%; flex: 1 1 100%; } }

/* ─── Workforce-management additions (v13): faces, analytics, projects, timesheets, screenshots ── */
.muted { color: var(--text-muted); }

/* Identity pills (monitoring table + anywhere) */
.face-pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid transparent; }
.face-verified        { color: var(--status-working); background: var(--status-working-bg); border-color: rgba(34,197,94,.3); }
.face-different_person{ color: var(--status-break);   background: var(--status-break-bg);   border-color: rgba(239,68,68,.35); }
.face-unverified      { color: var(--status-phone);   background: var(--status-phone-bg);   border-color: rgba(245,158,11,.3); }
.face-not_visible     { color: var(--text-muted);     background: var(--status-offline-bg); }
.face-multiple_faces  { color: var(--status-break);   background: var(--status-break-bg);   border-color: rgba(239,68,68,.35); }

/* Analytics */
.an-list { display: flex; flex-direction: column; gap: 10px; }
.an-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; background: var(--bg-input); border-radius: 8px; }
.an-row .muted { font-size: 12px; }

/* Projects */
.proj-list { display: flex; flex-direction: column; gap: 12px; }
.proj-item { background: var(--bg-input); border: 1px solid var(--border-color); border-radius: 10px; padding: 12px 14px; }
.proj-item.archived { opacity: .5; }
.proj-head { display: flex; align-items: center; gap: 8px; }
.proj-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.proj-tasks { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 6px; }
.task-chip { font-size: 12px; background: var(--bg-card-hover); border: 1px solid var(--border-color); border-radius: 999px; padding: 3px 10px; }
.task-chip.archived { opacity: .5; text-decoration: line-through; }
.task-chip a { color: var(--status-break); text-decoration: none; margin-left: 4px; font-weight: 700; }
.proj-report { display: flex; flex-direction: column; gap: 14px; }
.proj-report-item { border-bottom: 1px solid var(--border-color); padding-bottom: 10px; }
.proj-report-head { display: flex; justify-content: space-between; font-size: 15px; margin-bottom: 6px; }
.proj-report-task { display: flex; justify-content: space-between; font-size: 13px; padding: 2px 0 2px 12px; }

/* Timesheet total row */
.ts-total td { background: var(--bg-card-hover); border-top: 2px solid var(--border-color); }

/* Screenshot gallery */
.shot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.shot-cell { background: var(--bg-input); border: 1px solid var(--border-color); border-radius: 10px; overflow: hidden; cursor: pointer; transition: transform .1s, border-color .1s; }
.shot-cell:hover { transform: translateY(-2px); border-color: var(--accent-primary); }
.shot-cell img { width: 100%; height: 140px; object-fit: cover; display: block; background: #000; }
.shot-meta { display: flex; justify-content: space-between; padding: 8px 10px; font-size: 12px; }

/* ─── Organization page (companies / teams) ── */
.org-tree { display:flex; flex-direction:column; gap:10px; }
.org-node { background:var(--bg-input); border:1px solid var(--border-color); border-radius:10px; padding:12px 14px; }
.org-node.org-parent { border-color:var(--accent-primary); background:var(--status-offline-bg); }
.org-children { display:flex; flex-direction:column; gap:10px; margin-top:10px; padding-left:16px; border-left:2px dashed var(--border-color); }
.org-row { display:flex; align-items:center; gap:10px; }
.org-name { font-weight:600; }
.org-counts { color:var(--text-muted); font-size:12px; margin-left:auto; }
.org-mgrs { margin-top:8px; display:flex; flex-wrap:wrap; gap:6px; }
.team-list { display:flex; flex-direction:column; gap:10px; }
.team-item { background:var(--bg-input); border:1px solid var(--border-color); border-radius:10px; padding:12px 14px; }

/* ─── Activity tracking (keyboard/mouse levels, timeline, app categories) ─────── */
.act-meter { width: 72px; height: 7px; border-radius: 4px; background: var(--bg-input);
    overflow: hidden; display: inline-block; vertical-align: middle; }
.act-meter-fill { height: 100%; border-radius: 4px; transition: width .4s ease; }
.act-high { background: var(--status-working); }
.act-mid  { background: var(--status-phone); }
.act-low  { background: var(--status-break); }

.act-timeline { display: flex; align-items: flex-end; gap: 1px; height: 54px; margin: 10px 0 4px;
    padding: 6px; background: var(--bg-secondary); border: 1px solid var(--border-color);
    border-radius: 8px; overflow-x: auto; }
.act-bar { flex: 1 0 2px; min-width: 2px; border-radius: 1px 1px 0 0; opacity: .85; }
.act-bar.act-high { background: var(--status-working); }
.act-bar.act-mid  { background: var(--status-phone); }
.act-bar.act-low  { background: var(--status-break); }
.act-legend { font-size: 12px; margin: 2px 0 10px; }

.act-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
    gap: 8px; margin: 8px 0; }
.act-stat { background: var(--bg-secondary); border: 1px solid var(--border-color);
    border-radius: 8px; padding: 8px 10px; text-align: center; }
.act-stat-val { display: block; font-size: 18px; font-weight: 700; color: var(--text-primary); }
.act-stat-lbl { display: block; font-size: 11px; color: var(--text-muted); margin-top: 2px; }

.act-apps { display: flex; flex-direction: column; gap: 4px; }
.act-app-row { display: flex; align-items: center; gap: 8px; }
.act-app-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.cat-pill { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.cat-prod   { background: var(--status-working-bg); color: var(--status-working); }
.cat-unprod { background: var(--status-break-bg); color: var(--status-break); }
.cat-neutral{ background: var(--bg-input); color: var(--text-muted); }

.cat-add-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cat-add-form .date-input { max-width: 180px; }

/* Live "Idle while present" tag (at the desk, no keyboard/mouse input past the idle threshold) */
.idle-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin-left: 6px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    color: #b45309;
    background: rgba(245, 158, 11, 0.15);
    border: 1px solid rgba(245, 158, 11, 0.35);
    white-space: nowrap;
}
.idle-tag .since { opacity: 0.8; font-weight: 500; }
