/* ==========================================
   GLOBAL VARIABLES
   ========================================== */
:root {
    --c-brand: #1B4F8A;
    --c-brand-hover: #163D6F;
    --c-success: #10B981;
    --c-success-bg: #D1FAE5;
    --c-success-text: #065F46;
    --c-danger: #EF4444;
    --c-danger-bg: #FEE2E2;
    --c-danger-text: #991B1B;
    --c-warning: #F59E0B;
    --c-text-main: #1E293B;
    --c-text-muted: #64748B;
    --bg-main: #F8FAFC;
    --bg-card: #FFFFFF;
    --border-color: #E2E8F0;
    --border-dark: #CBD5E1;
}

/* ==========================================
   RESET & BASE  (moved from layout.html)
   ========================================== */
html, body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

body {
    font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg-main);
    margin: 0;
    padding: 0;
    color: #334155;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

img {
    max-width: 100%;
    height: auto;
}

/* ==========================================
   NAVBAR  (moved from layout.html)
   ========================================== */
.navbar {
    background: var(--c-brand-hover);
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    color: white;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.navbar a { color: white; text-decoration: none; font-weight: 500; font-size: 14px; transition: opacity 0.2s; }
.navbar a:hover { opacity: 0.8; }

.logo { font-size: 28px !important; font-weight: 800 !important; letter-spacing: -1px; margin-right: 30px; display: flex; align-items: center; }
.logo span { font-weight: 300; opacity: 0.8; }

.nav-container { display: flex; align-items: center; flex: 1; justify-content: space-between; }
.nav-links { display: flex; gap: 20px; align-items: center; }

.user-controls { display: flex; align-items: center; gap: 15px; }
.logout-btn { color: var(--c-danger) !important; }

.hamburger { display: none; background: none; border: none; color: white; font-size: 24px; cursor: pointer; padding: 0; margin-left: auto; }
.mobile-only { display: none !important; }

.menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(2px);
    z-index: 900;
    opacity: 0;
    transition: opacity 0.3s ease;
}
.menu-overlay.active { display: block; opacity: 1; }

.container { padding: 20px; max-width: 1200px; margin: 0 auto; }

/* ==========================================
   NAVBAR — MOBILE  (moved from layout.html)
   ========================================== */
@media (max-width: 768px) {
    .logo { font-size: 26px !important; margin-right: 0; }

    .hamburger { display: block; }
    .nav-container { justify-content: flex-end; }
    .user-controls { display: none; }

    .nav-links {
        position: fixed;
        top: 0;
        right: 0;
        width: 260px;
        height: 100vh;
        height: 100dvh;
        background: var(--c-brand-hover);
        flex-direction: column;
        align-items: flex-start;
        padding: 80px 20px 20px;
        box-sizing: border-box;
        box-shadow: -5px 0 15px rgba(0,0,0,0.3);
        transform: translateX(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 1000;
    }
    .nav-links.active { transform: translateX(0); }
    .nav-links > a { width: 100%; padding: 14px 0; border-bottom: 1px solid rgba(255,255,255,0.1); font-size: 16px; font-weight: 600; }

    .mobile-only { display: block !important; margin-top: auto; width: 100%; }
    .mobile-only .user-name-text { display: block; padding: 14px 0; color: rgba(255,255,255,0.6); font-size: 14px; border-bottom: 1px solid rgba(255,255,255,0.1); }
    .mobile-only a.logout-btn { display: block; padding-top: 14px; border-bottom: none; font-size: 16px; }
}

/* ==========================================
   TYPOGRAPHY & LAYOUT
   ========================================== */
.page-title {
    color: var(--c-text-main);
    font-size: 22px;
    font-weight: 800;
    margin: 0 0 16px 0;
    letter-spacing: -0.3px;
}

.section-title {
    color: var(--c-text-main);
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 14px 0;
}

/* ==========================================
   CARDS
   ========================================== */
.card {
    background: var(--bg-card);
    padding: 20px;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    box-sizing: border-box;
}

/* ==========================================
   BUTTONS
   ========================================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 20px;
    border-radius: 6px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    border: none;
    text-decoration: none;
    transition: background 0.2s, color 0.2s;
}

.btn-primary { background: var(--c-brand); color: white; }
.btn-primary:hover { background: var(--c-brand-hover); }

.btn-danger { background: var(--c-danger); color: white; }
.btn-danger:hover { background: #DC2626; }

.btn-outline { background: white; color: var(--c-brand); border: 1px solid var(--border-dark); }
.btn-outline:hover { background: var(--bg-main); color: var(--c-brand-hover); }

/* ==========================================
   BADGES
   ========================================== */
.badge {
    font-size: 11px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    display: inline-block;
    white-space: nowrap;
}

.badge-success { background: var(--c-success-bg); color: var(--c-success-text); }
.badge-danger { background: var(--c-danger-bg); color: var(--c-danger-text); }
.badge-warning { background: #DBEAFE; color: #1E40AF; }
.badge-amber { background: #FEF3C7; color: #92400E; }
.badge-neutral { background: var(--bg-main); color: var(--c-text-muted); border: 1px solid var(--border-color); }

/* ==========================================
   FORMS & INPUTS
   ========================================== */
.form-group { margin-bottom: 15px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--c-text-muted);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 14px;
    color: var(--c-text-main);
    font-family: inherit;
}
.form-control:focus {
    border-color: var(--c-brand);
    outline: none;
    box-shadow: 0 0 0 2px rgba(27, 79, 138, 0.1);
}

.form-row { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 15px; }
.form-row > .form-group { flex: 1; min-width: 0; margin-bottom: 0; }
@media (max-width: 768px) {
    .form-row > .form-group { flex-basis: 100%; margin-bottom: 15px; }
    .form-row > .form-group:last-child { margin-bottom: 0; }
}

/* ==========================================
   FILTERS, SEARCH & SELECTS
   ========================================== */
.filter-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 14px;
    background: var(--bg-main);
    border: 1px solid var(--border-dark);
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    color: var(--c-text-muted);
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    text-decoration: none;
}
.filter-pill input { display: none; }
.filter-pill:has(input:checked),
.filter-pill.active { background: var(--c-brand); border-color: var(--c-brand); color: white; }
.filter-pill .pill-count { font-size: 10px; opacity: 0.7; font-weight: 800; }
.filter-pill:has(input:checked) .pill-count,
.filter-pill.active .pill-count { opacity: 0.9; }

.search-wrap { position: relative; flex: 1; min-width: 0; }
.search-input { width: 100%; padding: 9px 12px 9px 36px; border-radius: 8px; border: 1px solid var(--border-dark); font-size: 14px; background: white; color: var(--c-text-main); outline: none; box-sizing: border-box; }
.search-input:focus { border-color: var(--c-brand); box-shadow: 0 0 0 2px rgba(27,79,138,0.1); }
.search-icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--c-text-muted); pointer-events: none; }

.sort-select,
.loc-select {
    padding: 9px 12px;
    border-radius: 8px;
    border: 1px solid var(--border-dark);
    font-size: 13px;
    font-weight: 600;
    background: white;
    color: var(--c-text-main);
    outline: none;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748B' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    padding-right: 30px;
}
.loc-select { max-width: 200px; }
.sort-select:focus, .loc-select:focus { border-color: var(--c-brand); box-shadow: 0 0 0 2px rgba(27,79,138,0.1); }

/* ==========================================
   COMPLIANCE HUB
   ========================================== */
.ch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 16px;
    padding-bottom: 32px;
}
.ch-card {
    background: white;
    border-radius: 10px;
    border: 1px solid var(--border-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.ch-head {
    padding: 14px 16px 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--bg-main);
}
.ch-head h3 { font-size: 15px; font-weight: 700; color: var(--c-text-main); margin: 0; }

.ch-badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; letter-spacing: 0.3px; text-transform: uppercase; }
.ch-badge-live { background: var(--c-success-bg); color: var(--c-success-text); }
.ch-badge-off { background: var(--bg-main); color: var(--c-text-muted); }

.ch-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 0; flex-grow: 1; }
.ch-stat { padding: 12px 16px; border-bottom: 1px solid var(--bg-main); }
.ch-stat:nth-child(odd) { border-right: 1px solid var(--bg-main); }
.ch-stat-label { font-size: 11px; font-weight: 600; color: var(--c-text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 2px; }
.ch-stat-val { font-size: 22px; font-weight: 800; color: var(--c-text-main); letter-spacing: -0.5px; line-height: 1.1; }
.ch-stat-val.s-pass { color: var(--c-success); }
.ch-stat-val.s-fail { color: var(--c-danger); }
.ch-stat-val.s-warn { color: var(--c-warning); }
.ch-stat-val.s-mute { color: var(--border-dark); }

.ch-action { display: block; width: 100%; padding: 12px 16px; text-align: center; font-weight: 700; font-size: 13px; text-decoration: none; border: none; cursor: pointer; transition: background 0.15s; box-sizing: border-box; border-top: 1px solid var(--bg-main); }
.ch-action-pat { background: var(--c-brand); color: white; }
.ch-action-pat:hover { background: var(--c-brand-hover); }
.ch-action-el { background: #b45309; color: white; }
.ch-action-el:hover { background: #92400e; }
.ch-action-off { background: var(--bg-main); color: var(--border-dark); cursor: not-allowed; }

/* ==========================================
   STAFF PAGE (admin_users.html)
   ========================================== */
.staff-form { display: flex; gap: 15px; align-items: flex-end; margin: 0; flex-wrap: wrap; }
.staff-form .field { flex: 1; min-width: 140px; }
.desktop-table { display: block; }
.mobile-cards { display: none; }

@media (max-width: 768px) {
    .staff-form { flex-direction: column; }
    .staff-form .field { min-width: 0; width: 100%; }
    .desktop-table { display: none; }
    .mobile-cards { display: flex; flex-direction: column; gap: 10px; }
}

/* ==========================================
   LOCATIONS PAGE (admin_locations.html)
   ========================================== */
.wizard-row { display: flex; gap: 15px; margin-bottom: 20px; flex-wrap: wrap; align-items: flex-end; border-bottom: 1px solid var(--border-color); padding-bottom: 20px; }
.inp-grp { flex: 1; min-width: 120px; }
.step-badge { display: inline-block; background: var(--c-brand); color: white; width: 24px; height: 24px; text-align: center; line-height: 24px; border-radius: 50%; font-size: 12px; font-weight: bold; margin-right: 8px; }
#bulk-action-bar { display: none; position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%); background: var(--c-text-main); color: white; padding: 15px 24px; border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.3); z-index: 1000; align-items: center; gap: 20px; border: 1px solid var(--c-text-muted); }
.table-cb { width: 18px; height: 18px; cursor: pointer; accent-color: var(--c-brand); }
.top-layout { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; }
.top-layout > .card:first-child { flex: 2; min-width: 0; }
.top-layout > .card:last-child { flex: 1; min-width: 0; }
.al-desktop-view { display: block; }
.al-mobile-view { display: none; }

@media (max-width: 768px) {
    .al-desktop-view { display: none; }
    .al-mobile-view { display: flex; flex-direction: column; gap: 12px; }
    .top-layout { flex-direction: column; }
    .top-layout > .card { width: 100% !important; min-width: 0 !important; }
    .fmt-row { flex-direction: column; }
    .wizard-row { gap: 10px; }
    .inp-grp { min-width: 0; flex-basis: 45%; }
    .page-wrap { padding: 0 4px; }
}

/* ==========================================
   UTILITIES & DANGER CARDS
   ========================================== */
.card-danger { border-color: var(--c-danger); }
.card-danger h2 { color: var(--c-danger); margin-top: 0; margin-bottom: 16px; }
.alert-danger { color: var(--c-danger-text); background: var(--c-danger-bg); padding: 12px; border-radius: 6px; margin-bottom: 20px; font-size: 14px; }
.danger-box { background: var(--bg-main); padding: 12px; border: 1px solid var(--border-color); margin-bottom: 20px; border-radius: 6px; font-size: 14px; }
.flex-actions { display: flex; gap: 10px; margin-top: 20px; }

/* ==========================================
   SETTINGS PAGE (Toggle Switches)
   ========================================== */
.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--bg-main); }
.setting-row:last-child { border-bottom: none; padding-bottom: 0; }
.setting-info h4 { margin: 0 0 4px 0; color: var(--c-text-main); font-size: 15px; }
.setting-info p { margin: 0; color: var(--c-text-muted); font-size: 13px; }
.switch { position: relative; display: inline-block; width: 50px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: var(--border-dark); transition: .3s; border-radius: 28px; }
.slider:before { position: absolute; content: ""; height: 20px; width: 20px; left: 4px; bottom: 4px; background-color: white; transition: .3s; border-radius: 50%; }
input:checked + .slider { background-color: var(--c-success); }
input:checked + .slider:before { transform: translateX(22px); }

/* ==========================================
   DATA TABLES (PAT, Admin)
   ========================================== */
.data-table { width: 100%; border-collapse: collapse; background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.data-table th { background: var(--c-brand); color: white; padding: 12px; text-align: left; font-size: 14px; font-weight: 700; }
.data-table td { padding: 12px; border-bottom: 1px solid var(--border-color); font-size: 14px; }
.data-table tr:last-child td { border-bottom: none; }

/* ==========================================
   INBOX & EL REGISTERS (LIST CARDS)
   ========================================== */
.job-card, .el-card { background: var(--bg-card); border-radius: 10px; border: 1px solid var(--border-color); overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,0.04); display: flex; text-decoration: none; color: inherit; }
.job-card-photo, .job-card-photo-empty { width: 117px; height: 117px; flex-shrink: 0; }
.job-card-photo { object-fit: cover; display: block; }
.job-card-photo-empty { background: var(--bg-main); display: flex; align-items: center; justify-content: center; }
.job-card-info, .el-info { flex: 1; min-width: 0; padding: 10px 12px; display: flex; flex-direction: column; justify-content: space-between; }

.avatar { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: white; flex-shrink: 0; margin-left: -4px; border: 2px solid var(--bg-card); }
.avatar:first-child { margin-left: 0; }

.el-status-bar { width: 5px; flex-shrink: 0; }
.el-status-bar.ok { background: var(--c-success); }
.el-status-bar.overdue { background: var(--c-warning); }
.el-status-bar.fail { background: var(--c-danger); }
.el-status-bar.untested { background: var(--border-dark); }

.pager a, .pager .pg { padding: 6px 12px; border-radius: 6px; font-size: 12px; font-weight: 700; text-decoration: none; }
.pager a { border: 1px solid var(--border-dark); color: var(--c-text-muted); background: white; }
.pager .pg-active { background: var(--c-brand); color: white; border: 1px solid var(--c-brand); }

/* ==========================================
   PLANS GRID
   ========================================== */
.plans-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 20px; }
.plan-card { display: block; text-decoration: none; background: white; border: 1px solid var(--border-color); border-radius: 12px; padding: 20px; transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 1px 3px rgba(0,0,0,0.05); position: relative; overflow: hidden; }
.plan-card:hover { border-color: var(--border-dark); transform: translateY(-3px); box-shadow: 0 10px 20px -5px rgba(0,0,0,0.1); }
.plan-title { margin: 0 0 12px 0; color: var(--c-brand-hover); font-size: 18px; font-weight: 800; display: flex; justify-content: space-between; align-items: center; }
.plan-meta { display: flex; gap: 12px; align-items: center; margin-top: 16px; }

.badge-active { background: var(--c-danger-bg); color: var(--c-danger-text); padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 800; border: 1px solid var(--border-dark); }
.badge-clear { background: var(--bg-main); color: var(--c-text-muted); padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; }

.empty-state { grid-column: 1/-1; text-align: center; padding: 60px 20px; color: var(--c-text-muted); background: white; border: 2px dashed var(--border-dark); border-radius: 12px; }
.empty-state-title { font-size: 18px; font-weight: 800; color: var(--c-text-main); margin-bottom: 8px; }

/* ==========================================
   ASSET TEST RESULTS (PAT / EL)
   ========================================== */
.test-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 25px; }
@media (max-width: 600px) { .test-grid { grid-template-columns: 1fr; gap: 10px; } }

.result-btn { flex: 1; padding: 14px 0; border-radius: 8px; font-weight: 700; font-size: 14px; cursor: pointer; text-align: center; transition: all 0.15s ease; border: 2px solid; }
.result-btn input { display: none; }
.result-pass { border-color: var(--c-success); color: var(--c-success); background: white; }
.result-pass:has(input:checked) { background: var(--c-success); color: white; box-shadow: 0 4px 12px rgba(16,185,129,0.3); }
.result-fail { border-color: var(--c-danger); color: var(--c-danger); background: white; }
.result-fail:has(input:checked) { background: var(--c-danger); color: white; box-shadow: 0 4px 12px rgba(239,68,68,0.3); }

/* ==========================================
   JOB DETAIL PAGE
   ========================================== */
.job-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; flex-wrap: wrap; gap: 10px; }

.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 20px; }
.meta-box { background: var(--bg-main); padding: 12px; border-radius: 8px; border: 1px solid var(--border-color); }
.meta-box span { display: block; font-size: 11px; font-weight: 700; color: var(--c-text-muted); text-transform: uppercase; margin-bottom: 4px; }
.meta-box strong { font-size: 14px; color: var(--c-text-main); }

/* Old-style status buttons (column layout with icon) */
.status-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 12px 8px; background: white; border: 2px solid var(--border-color); border-radius: 8px; cursor: pointer; font-weight: 700; font-size: 13px; color: var(--c-text-muted); transition: 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,0.02); width: 100%; }
.status-btn.active { border-color: var(--c-brand); background: #EFF6FF; color: var(--c-brand); }
.status-btn.active .icon { background: var(--c-brand); color: white; }
.status-btn .icon { width: 32px; height: 32px; border-radius: 50%; background: var(--bg-main); display: flex; align-items: center; justify-content: center; margin-bottom: 8px; transition: 0.2s; font-size: 14px; }
.status-btn:hover:not(.active) { border-color: var(--border-dark); }

/* Inline status buttons (compact row layout) */
.status-btn-new {
    width: 100%;
    padding: 12px 0;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 700;
    background: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}
.status-btn-new.pending { border: 2px solid #F59E0B; color: #F59E0B; }
.status-btn-new.pending.active { background: #F59E0B; color: white; }
.status-btn-new.progress { border: 2px solid var(--c-brand); color: var(--c-brand); }
.status-btn-new.progress.active { background: var(--c-brand); color: white; }
.status-btn-new.completed { border: 2px solid var(--c-success); color: var(--c-success); }
.status-btn-new.completed.active { background: var(--c-success); color: white; }

/* Comment / Activity Area */
.cm-area { margin-top: 24px; padding-top: 24px; border-top: 1px solid var(--border-color); }

.chat-bubble { display: flex; gap: 12px; margin-bottom: 20px; }
.chat-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--c-brand); color: white; display: flex; align-items: center; justify-content: center; font-weight: bold; font-size: 14px; flex-shrink: 0; }
.chat-content { background: var(--bg-main); padding: 12px 16px; border-radius: 12px; border-top-left-radius: 0; border: 1px solid var(--border-color); flex: 1; }
.chat-content.system { background: #EFF6FF; border-color: #BFDBFE; border-top-left-radius: 12px; border-top-right-radius: 0; }
.chat-header { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 12px; }
.chat-name { font-weight: 700; color: var(--c-text-main); }
.chat-time { color: var(--c-text-muted); }
.chat-text { font-size: 14px; color: var(--c-text-main); line-height: 1.5; white-space: pre-wrap; }
.chat-photo { margin-top: 8px; max-width: 200px; border-radius: 8px; border: 1px solid var(--border-color); cursor: pointer; }

/* Loading Spinner */
@keyframes spin { 100% { transform: rotate(360deg); } }
.spinner-icon { animation: spin 1s linear infinite; }

/* ==========================================
   TOAST NOTIFICATIONS (global)
   ========================================== */
#toast-container {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    display: flex;
    flex-direction: column-reverse;
    gap: 8px;
    pointer-events: none;
    width: 90%;
    max-width: 420px;
}

.toast {
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 700;
    color: white;
    pointer-events: auto;
    text-align: center;
    animation: toast-in 0.3s ease, toast-out 0.3s ease 2.7s forwards;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.toast-success { background: var(--c-success); }
.toast-error { background: var(--c-danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(20px); } }

/* ==========================================
   SHARED UTILITIES
   ========================================== */
.btn-sm { padding: 6px 12px; font-size: 13px; gap: 5px; }
.btn-pill { padding: 8px 16px; border-radius: 20px; }
.btn-outline-danger { color: var(--c-danger); border-color: var(--c-danger); }
.btn-outline-danger:hover { background: var(--c-danger-bg); color: var(--c-danger-text); }

.text-muted { color: var(--c-text-muted); }
.text-sm { font-size: 13px; }

.detail-label { font-size: 13px; font-weight: 800; color: var(--c-text-muted); text-transform: uppercase; margin-bottom: 10px; letter-spacing: 0.5px; }
.detail-divider { border: 0; border-top: 1px solid var(--border-color); margin: 20px 0; }

/* Detail meta rows */
.detail-meta { margin-bottom: 20px; }
.detail-meta-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border-color); }
.detail-meta-row:last-child { border-bottom: none; }
.detail-meta-label { font-size: 13px; font-weight: 700; color: var(--c-text-muted); }
.detail-meta-value { font-size: 14px; font-weight: 600; color: var(--c-text-main); text-align: right; }

/* Fade-out animation for removed items */
.removing { animation: fade-out 0.3s ease forwards; }
@keyframes fade-out { to { opacity: 0; transform: translateX(20px); height: 0; margin: 0; padding: 0; overflow: hidden; } }

/* ==========================================
   REUSABLE COMPONENTS
   ========================================== */

/* Universal Back Button */
.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--c-brand);
    text-decoration: none;
    font-weight: 700;
    font-size: 14px;
    margin-bottom: 16px;
    transition: opacity 0.2s ease;
}
.back-link:hover {
    opacity: 0.7;
}

/* Status row */
.status-row { display: flex; gap: 10px; width: 100%; }
.status-row .status-form { flex: 1; min-width: 0; display: flex; margin: 0; }
.status-row .status-btn-new { width: 100%; }

/* Meta grid variants */
.meta-grid-3col { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 600px) { .meta-grid-3col { grid-template-columns: 1fr 1fr; } }
@media (max-width: 400px) { .meta-grid-3col { grid-template-columns: 1fr; } }

/* Team picker */
.team-picker { display: flex; gap: 10px; align-items: stretch; }
.team-list { flex: 1; border: 1px solid var(--border-color); border-radius: 6px; padding: 10px; max-height: 150px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.team-list-readonly { border: 1px solid var(--border-color); border-radius: 6px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.team-member { display: flex; align-items: center; gap: 10px; cursor: pointer; margin: 0; }
.team-member input { accent-color: var(--c-brand); width: 18px; height: 18px; }
.team-member span { font-size: 14px; font-weight: 600; color: var(--c-text-main); }

/* Comment feed & input */
.comment-feed { margin-bottom: 24px; }
.empty-comments { text-align: center; color: var(--c-text-muted); font-size: 13px; font-style: italic; margin: 20px 0; }
.chat-delete-row { text-align: right; margin-top: 8px; }
.chat-delete-btn { background: none; border: none; color: var(--c-danger); font-size: 11px; font-weight: 700; cursor: pointer; padding: 0; }
.chat-delete-btn:hover { text-decoration: underline; }

/* Confirmation modal (global) */
.confirm-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    animation: confirm-fade-in 0.15s ease;
}
.confirm-box {
    background: white;
    border-radius: 12px;
    padding: 24px;
    max-width: 320px;
    width: 100%;
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    text-align: center;
}
.confirm-box p {
    margin: 0 0 20px 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--c-text-main);
    line-height: 1.4;
}
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; padding: 12px; font-size: 14px; }
@keyframes confirm-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pulse-opacity { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
.pulse { animation: pulse-opacity 1.2s ease-in-out infinite; }

.comment-input-card { background: white; padding: 12px; border-radius: 12px; border: 1px solid var(--border-color); }
.comment-textarea { border: none; background: transparent; padding: 0; box-shadow: none; resize: none; margin-bottom: 0; }
.comment-input-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-color); }
.attach-label { cursor: pointer; display: flex; align-items: center; gap: 6px; color: var(--c-text-muted); font-weight: 700; font-size: 13px; }
.attach-label input[type="file"] { display: none; }

/* ==========================================
   LOCATION PICKER MODAL (global)
   ========================================== */
.loc-picker-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    backdrop-filter: blur(2px);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    animation: confirm-fade-in 0.15s ease;
}
.loc-picker {
    background: white;
    margin: 60px 16px 16px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    max-height: calc(100vh - 80px);
    box-shadow: 0 20px 40px rgba(0,0,0,0.2);
    overflow: hidden;
}
.loc-picker-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 10px;
}
.loc-picker-header input {
    flex: 1;
    padding: 10px 12px;
    border: 1px solid var(--border-dark);
    border-radius: 8px;
    font-size: 15px;
    outline: none;
    font-family: inherit;
}
.loc-picker-header input:focus { border-color: var(--c-brand); }
.loc-picker-close {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--c-text-muted);
    cursor: pointer;
    padding: 4px 8px;
    line-height: 1;
}
.loc-picker-list {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.loc-picker-item {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.loc-picker-item:active { background: var(--bg-main); }
.loc-picker-item-name { font-size: 15px; font-weight: 600; color: var(--c-text-main); }
.loc-picker-item-id { font-size: 12px; color: var(--c-text-muted); }
.loc-picker-none {
    padding: 14px 16px;
    cursor: pointer;
    border-bottom: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--c-text-muted);
    font-weight: 600;
    font-style: italic;
}
.loc-picker-none:active { background: var(--bg-main); }
.loc-picker-empty {
    padding: 30px 16px;
    text-align: center;
    color: var(--c-text-muted);
    font-size: 14px;
}

/* Location trigger button (replaces the old input/datalist) */
.loc-trigger {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border-dark);
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    color: var(--c-text-main);
    background: white;
    text-align: left;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
}
.loc-trigger:focus { border-color: var(--c-brand); outline: none; box-shadow: 0 0 0 2px rgba(27,79,138,0.1); }
.loc-trigger-placeholder { color: var(--c-text-muted); }
.loc-trigger svg { flex-shrink: 0; color: var(--c-text-muted); }


/* ==========================================
   FORM VALIDATION (Report Form)
   ========================================== */
.req-field label .asterisk { color: #94A3B8; display: inline; margin-left: 4px; transition: color 0.2s; }
.req-field.is-error label .asterisk { color: var(--c-danger); }
.req-field.is-error input, 
.req-field.is-error textarea { border-color: var(--c-danger) !important; background-color: var(--c-danger-bg) !important; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.1) !important;}
.req-field.is-error .camera-box { border-color: var(--c-danger) !important; background-color: var(--c-danger-bg) !important; }
.req-field.is-valid input, 
.req-field.is-valid textarea { border-color: var(--c-success) !important; background-color: var(--c-success-bg) !important;}
.req-field.is-valid label .asterisk { color: var(--c-success); }
.error-msg { color: var(--c-danger); font-size: 13px; font-weight: bold; display: none; margin-top: 6px; }
.req-field.is-error .error-msg { display: block; }
input, textarea, .camera-box { transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s; }


/* ==========================================
   JOB DETAIL PAGE (Overrides & Additions)
   ========================================== */
.job-container { max-width: 600px; margin: 0 auto; padding-bottom: 40px; }
.job-detail-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.job-detail-title { margin: 0; font-size: 22px; font-weight: 800; color: var(--c-text-main); line-height: 1.3; flex: 1; min-width: 200px; }
.job-detail-actions { display: flex; gap: 8px; flex-shrink: 0; }
.job-description { font-size: 15px; line-height: 1.6; color: var(--c-text-main); white-space: pre-wrap; margin-bottom: 4px; }
