:root {
    --primary: #667eea;
    --success: #28a745;
    --danger: #dc3545;
    --warning: #ffc107;
    --info: #17a2b8;
    --dark: #1e1e2f;
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --text: #212529;
    --text-muted: #6c757d;
    --border: #e9ecef;
}
[data-theme="dark"] {
    --bg: #15151f;
    --card-bg: #25253a;
    --text: #e9ecef;
    --text-muted: #adb5bd;
    --border: #3a3a52;
}
[data-theme="dark"] body { color: var(--text); }
[data-theme="dark"] .stat-card, [data-theme="dark"] .job-card, [data-theme="dark"] .notif-item, [data-theme="dark"] .bottom-nav, [data-theme="dark"] .login-card { background: var(--card-bg); color: var(--text); }
[data-theme="dark"] .stat-card .label, [data-theme="dark"] .section-title, [data-theme="dark"] .job-card .job-meta { color: var(--text-muted); }
[data-theme="dark"] .bottom-nav a { color: var(--text-muted); }
[data-theme="dark"] input, [data-theme="dark"] textarea, [data-theme="dark"] select { background: var(--card-bg) !important; color: var(--text) !important; border-color: var(--border) !important; }
* { box-sizing: border-box; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    margin: 0;
    padding: 0;
    padding-bottom: 70px;
    min-height: 100vh;
}

/* Top bar */
.top-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.top-bar h5 { margin: 0; font-size: 1.1rem; }

/* Bottom nav */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    display: flex;
    justify-content: space-around;
    padding: 8px 0;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1);
    z-index: 100;
}
.bottom-nav a {
    text-decoration: none;
    color: #999;
    text-align: center;
    font-size: 0.7rem;
    flex: 1;
    padding: 5px;
    position: relative;
}
.bottom-nav a.active { color: var(--primary); }
.bottom-nav a i { font-size: 1.3rem; display: block; margin-bottom: 2px; }
.notif-badge {
    position: absolute;
    top: 0;
    right: 25%;
    background: var(--danger);
    color: white;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 0.65rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Cards */
.stat-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    text-align: center;
    margin-bottom: 10px;
}
.stat-card .number { font-size: 1.8rem; font-weight: bold; }
.stat-card .label { font-size: 0.75rem; color: #999; }

.job-card {
    background: white;
    border-radius: 12px;
    padding: 15px;
    margin-bottom: 10px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    border-left: 4px solid var(--primary);
    cursor: pointer;
    transition: 0.2s;
}
.job-card:active { transform: scale(0.98); }
.job-card.urgent { border-left-color: var(--danger); }
.job-card.high { border-left-color: #fd7e14; }
.job-card.broadcast { border-left-color: var(--warning); background: #fffdf0; }

.job-card .job-code { font-weight: bold; font-size: 0.85rem; }
.job-card .job-customer { font-size: 0.9rem; margin: 5px 0; }
.job-card .job-meta { font-size: 0.75rem; color: #999; }
.job-card .distance { font-size: 0.8rem; color: var(--primary); font-weight: bold; }

/* Status badges */
.status-badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.7rem;
    font-weight: 600;
    color: white;
}
.status-assigned { background: var(--warning); color: #000; }
.status-confirmed { background: var(--info); }
.status-en_route { background: var(--primary); }
.status-arrived { background: #6f42c1; }
.status-in_progress { background: #fd7e14; }
.status-completed { background: var(--success); }
.status-cancelled { background: var(--danger); }

/* Priority */
.priority-urgent { color: var(--danger); font-weight: bold; }
.priority-high { color: #fd7e14; font-weight: bold; }

/* Action buttons */
.action-btn {
    display: block;
    width: 100%;
    padding: 14px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    color: white;
    margin-bottom: 10px;
    cursor: pointer;
}
.action-btn.accept { background: linear-gradient(135deg, #11998e, #38ef7d); }
.action-btn.reject { background: linear-gradient(135deg, #eb3349, #f45c43); }
.action-btn.status { background: linear-gradient(135deg, #667eea, #764ba2); }
.action-btn.call { background: linear-gradient(135deg, #11998e, #38ef7d); }
.action-btn.navigate { background: linear-gradient(135deg, #4568dc, #b06ab3); }

/* Login */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 20px;
}
.login-card {
    background: white;
    border-radius: 20px;
    padding: 40px 30px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    text-align: center;
}
.login-card h2 { margin-bottom: 5px; }
.login-card .subtitle { color: #999; margin-bottom: 30px; font-size: 0.9rem; }
.login-card input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid #eee;
    border-radius: 12px;
    font-size: 1rem;
    margin-bottom: 12px;
    outline: none;
    transition: 0.3s;
}
.login-card input:focus { border-color: var(--primary); }
.login-btn {
    width: 100%;
    padding: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 12px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
}

/* Content area */
.content { padding: 15px; }
.section-title { font-size: 0.85rem; font-weight: 600; color: #999; margin: 15px 0 8px; text-transform: uppercase; }

/* Notification item */
.notif-item {
    background: white;
    border-radius: 10px;
    padding: 12px;
    margin-bottom: 8px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    border-left: 3px solid var(--primary);
}
.notif-item.unread { border-left-color: var(--danger); background: #fff5f5; }
.notif-item .time { font-size: 0.7rem; color: #999; }

/* Status selector */
.status-flow {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin: 15px 0;
}
.status-flow button {
    flex: 1;
    min-width: 100px;
    padding: 10px;
    border: 2px solid #eee;
    border-radius: 10px;
    background: white;
    font-size: 0.8rem;
    cursor: pointer;
}
.status-flow button.active { border-color: var(--primary); background: #f0f4ff; }
.status-flow button:disabled { opacity: 0.4; }

/* Pulse animation for online status */
.pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--success);
    display: inline-block;
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(40,167,69,0.5); }
    70% { box-shadow: 0 0 0 8px rgba(40,167,69,0); }
    100% { box-shadow: 0 0 0 0 rgba(40,167,69,0); }
}
