:root {
    --bg: #f5f7fb;
    --surface: #ffffff;
    --surface-soft: #f8fafc;
    --text: #18212f;
    --muted: #6b7280;
    --border: #e5e7eb;
    --primary: #2457d6;
    --primary-dark: #1d46aa;
    --success: #087a55;
    --success-bg: #e8f7f0;
    --warning: #9a5b00;
    --warning-bg: #fff5df;
    --danger: #b42318;
    --danger-bg: #ffebe9;
    --sidebar: #111827;
    --sidebar-muted: #98a2b3;
    --radius: 10px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { color: var(--text); background: var(--bg); font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { outline-color: var(--primary); }

.admin-shell { display: grid; grid-template-columns: 246px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--sidebar); color: white; display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; z-index: 30; overflow: hidden; min-height: 0; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; flex: 0 0 auto; }
.brand-mark { width: 36px; height: 36px; border-radius: 9px; display: grid; place-items: center; font-weight: 800; background: white; color: var(--sidebar); letter-spacing: -.03em; }
.brand-title { font-size: 15px; font-weight: 750; line-height: 1.2; }
.brand-subtitle { margin-top: 2px; color: var(--sidebar-muted); font-size: 11px; }
.nav-list { display: grid; gap: 5px; margin-top: 28px; flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding-right: 5px; padding-bottom: 14px; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.28) transparent; }
.nav-list::-webkit-scrollbar { width: 6px; }
.nav-list::-webkit-scrollbar-track { background: transparent; }
.nav-list::-webkit-scrollbar-thumb { background: rgba(255,255,255,.24); border-radius: 999px; }
.nav-list::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.38); }
.nav-link { min-height: 40px; display: flex; align-items: center; padding: 0 12px; border-radius: 8px; color: #cbd5e1; font-weight: 600; }
.nav-link:hover { background: rgba(255,255,255,.07); color: white; }
.nav-link.active { background: rgba(255,255,255,.12); color: white; }
.sidebar-footer { margin-top: 0; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); flex: 0 0 auto; }
.sidebar-user { display: flex; gap: 10px; align-items: center; margin-bottom: 12px; min-width: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: #263449; display: grid; place-items: center; font-weight: 700; flex: 0 0 auto; }
.sidebar-user-copy { display: grid; min-width: 0; }
.sidebar-user-copy strong { font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-copy span { color: var(--sidebar-muted); font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main-column { min-width: 0; }
.topbar { height: 60px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 14px; padding: 0 24px; position: sticky; top: 0; z-index: 20; }
.topbar-title { font-size: 15px; font-weight: 700; }
.topbar-meta { margin-left: auto; color: var(--muted); font-size: 12px; }
.menu-button { display: none; border: 0; background: transparent; font-size: 21px; padding: 5px; cursor: pointer; }
.content { padding: 24px; max-width: 1500px; margin: 0 auto; }
.page-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 18px; }
.page-header h1 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.page-header p { margin: 6px 0 0; color: var(--muted); max-width: 760px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 17px; box-shadow: var(--shadow); }
.metric-card span { color: var(--muted); font-size: 12px; font-weight: 600; }
.metric-card strong { display: block; margin-top: 7px; font-size: 25px; letter-spacing: -.03em; }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(300px, .75fr); gap: 16px; margin-bottom: 16px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 16px; margin-bottom: 16px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; min-width: 0; }
.panel-table { padding: 0; overflow: hidden; }
.panel-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.panel-heading h2, .status-panel h2 { margin: 0; font-size: 15px; }
.panel-heading p, .status-panel p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.phase-tag { white-space: nowrap; padding: 5px 8px; border-radius: 999px; background: #eef2ff; color: #3749b5; font-size: 10px; font-weight: 700; }
.placeholder-canvas { position: relative; min-height: 310px; border: 1px dashed #cfd6e1; background: linear-gradient(135deg, #f8fafc 25%, #f4f7fa 25%, #f4f7fa 50%, #f8fafc 50%, #f8fafc 75%, #f4f7fa 75%); background-size: 28px 28px; border-radius: 9px; overflow: hidden; }
.placeholder-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; padding: 25px; }
.placeholder-center strong { font-size: 14px; }
.placeholder-center span { color: var(--muted); font-size: 12px; margin-top: 4px; max-width: 310px; }
.placeholder-marker { position: absolute; width: 13px; height: 13px; border-radius: 50%; background: var(--primary); border: 3px solid white; box-shadow: 0 0 0 2px rgba(36,87,214,.18); }
.marker-a { left: 21%; top: 29%; }
.marker-b { right: 23%; top: 38%; }
.marker-c { left: 42%; bottom: 18%; }
.compact-list { display: grid; }
.compact-list-item { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.compact-list-item:last-child { border-bottom: 0; }
.compact-list-item > div { display: grid; min-width: 0; }
.compact-list-item strong { font-size: 12px; }
.compact-list-item span { color: var(--muted); font-size: 10px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.button { min-height: 38px; border-radius: 8px; border: 1px solid transparent; padding: 8px 13px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; font-weight: 650; cursor: pointer; transition: .15s ease; }
.button-primary { background: var(--primary); color: white; }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { background: var(--surface); border-color: #cfd6e1; color: var(--text); }
.button-secondary:hover { background: var(--surface-soft); }
.button-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.sidebar .button-ghost { color: #cbd5e1; border-color: rgba(255,255,255,.12); }
.button-small { min-height: 32px; padding: 6px 10px; font-size: 11px; }
.button-full { width: 100%; }
.text-link { color: var(--primary); font-weight: 650; }

.alert { border-radius: 8px; padding: 11px 13px; margin-bottom: 16px; border: 1px solid; }
.alert-success { color: var(--success); background: var(--success-bg); border-color: #b7e7d4; }
.alert-error { color: var(--danger); background: var(--danger-bg); border-color: #fecaca; }

.filter-bar { display: grid; grid-template-columns: minmax(240px, 1fr) 170px auto auto; gap: 8px; margin-bottom: 12px; align-items: center; }
.filter-bar input, .filter-bar select,
.field-group input, .field-group select, .field-group textarea,
.status-form input, .status-form select { width: 100%; border: 1px solid #cfd6e1; border-radius: 8px; background: white; color: var(--text); min-height: 39px; padding: 8px 10px; }
.field-group textarea { min-height: 100px; resize: vertical; }
.field-group input:focus, .field-group select:focus, .field-group textarea:focus,
.filter-bar input:focus, .filter-bar select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36,87,214,.1); outline: 0; }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 780px; }
.data-table th { text-align: left; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .045em; background: #fafbfc; border-bottom: 1px solid var(--border); padding: 11px 14px; }
.data-table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover { background: #fbfcfe; }
.employee-cell { display: grid; min-width: 190px; }
.employee-cell strong { font-size: 12px; }
.employee-cell span { color: var(--muted); font-size: 10px; margin-top: 3px; }
.table-actions { text-align: right !important; }
.status-badge { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; padding: 4px 8px; font-size: 10px; font-weight: 750; }
.status-active { background: var(--success-bg); color: var(--success); }
.status-suspended { background: var(--warning-bg); color: var(--warning); }
.status-terminated { background: var(--danger-bg); color: var(--danger); }
.empty-state { display: grid; place-items: center; text-align: center; color: var(--muted); padding: 34px 18px; gap: 4px; }
.empty-state.small { padding: 25px 12px; }
.empty-state.left-aligned { place-items: start; text-align: left; padding: 10px 0; }
.empty-state strong { color: var(--text); }
.pagination-row { padding: 12px 14px; border-top: 1px solid var(--border); }
.pagination-row nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pagination-row a, .pagination-row span { font-size: 11px; }

.form-panel { max-width: 1050px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 15px; }
.field-group { display: grid; gap: 6px; align-content: start; }
.field-group label { font-size: 11px; font-weight: 700; }
.field-error { color: var(--danger); font-size: 10px; }
.field-hint { color: var(--muted); font-size: 10px; }
.field-optional { color: var(--muted); font-weight: 500; }
.table-subtext { display: block; color: var(--muted); font-size: 10px; margin-top: 3px; }
.field-span-2 { grid-column: span 2; }
.required { color: var(--danger); }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.detail-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; margin: 0; }
.detail-list > div { padding: 12px 0; border-bottom: 1px solid var(--border); }
.detail-list dt { color: var(--muted); font-size: 10px; margin-bottom: 4px; }
.detail-list dd { margin: 0; font-weight: 600; font-size: 12px; }
.notes-box { margin-top: 16px; padding: 13px; border-radius: 8px; background: var(--surface-soft); }
.notes-box strong { font-size: 11px; }
.notes-box p { margin: 5px 0 0; color: var(--muted); white-space: pre-line; }
.status-panel { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.status-form { display: grid; grid-template-columns: 150px minmax(190px, 1fr) auto; gap: 8px; min-width: min(100%, 570px); }

.login-body { min-height: 100vh; background: #f3f5f9; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); }
.login-intro { background: var(--sidebar); color: white; padding: 42px clamp(32px, 6vw, 90px); display: flex; flex-direction: column; }
.brand-login { max-width: max-content; }
.login-copy { margin: auto 0; max-width: 640px; padding: 70px 0; }
.eyebrow { color: #9db5ff; font-size: 10px; font-weight: 800; letter-spacing: .14em; }
.login-copy h1 { font-size: clamp(32px, 4vw, 54px); line-height: 1.03; letter-spacing: -.045em; margin: 14px 0 18px; }
.login-copy p { color: #b9c2d0; font-size: 15px; line-height: 1.7; max-width: 560px; }
.login-panel { display: grid; place-items: center; padding: 28px; }
.login-card { width: min(100%, 420px); background: white; border: 1px solid var(--border); border-radius: 12px; padding: 28px; box-shadow: 0 8px 30px rgba(16,24,40,.06); display: grid; gap: 18px; }
.login-card h2 { margin: 0; font-size: 21px; }
.login-card > div > p { margin: 5px 0 0; color: var(--muted); }
.checkbox-row { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.checkbox-row input { width: 16px; height: 16px; }

@media (max-width: 1050px) {
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dashboard-grid, .detail-grid { grid-template-columns: 1fr; }
    .filter-bar { grid-template-columns: minmax(220px, 1fr) 160px auto; }
    .filter-bar .button-ghost { grid-column: 1 / -1; justify-self: start; }
}

@media (max-width: 820px) {
    .admin-shell { grid-template-columns: 1fr; }
    .sidebar { position: fixed; left: -270px; width: 246px; transition: left .18s ease; box-shadow: 12px 0 28px rgba(0,0,0,.18); }
    .sidebar.sidebar-open { left: 0; }
    .menu-button { display: block; }
    .content { padding: 18px; }
    .topbar { padding: 0 18px; }
    .topbar-meta { display: none; }
    .filter-bar { grid-template-columns: 1fr 1fr; }
    .filter-search { grid-column: 1 / -1; }
    .status-panel { align-items: stretch; flex-direction: column; }
    .status-form { min-width: 0; width: 100%; }
    .login-shell { grid-template-columns: 1fr; }
    .login-intro { min-height: 330px; padding: 28px; }
    .login-copy { padding: 55px 0 15px; }
    .login-copy h1 { font-size: 34px; }
}

@media (max-width: 600px) {
    .content { padding: 14px; }
    .page-header { flex-direction: column; }
    .page-actions { width: 100%; justify-content: flex-start; }
    .metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .metric-card { padding: 14px; }
    .metric-card strong { font-size: 21px; }
    .form-grid, .detail-list { grid-template-columns: 1fr; }
    .field-span-2 { grid-column: span 1; }
    .filter-bar { grid-template-columns: 1fr; }
    .filter-search { grid-column: auto; }
    .status-form { grid-template-columns: 1fr; }
    .form-actions { flex-wrap: wrap; }
    .placeholder-canvas { min-height: 240px; }
    .login-panel { padding: 16px; }
    .login-card { padding: 21px; }
}

/* Employee Active On/Off control */
.status-inactive { background: #eef1f5; color: #5d6675; }
.toggle-control { display: inline-flex; align-items: center; gap: 12px; cursor: pointer; width: fit-content; }
.toggle-control > input { position: absolute; opacity: 0; pointer-events: none; }
.toggle-track { width: 46px; height: 26px; padding: 3px; border-radius: 999px; background: #c9d0da; transition: background .18s ease; flex: 0 0 auto; }
.toggle-knob { display: block; width: 20px; height: 20px; border-radius: 50%; background: white; box-shadow: 0 1px 3px rgba(15, 23, 42, .18); transition: transform .18s ease; }
.toggle-control > input:checked + .toggle-track { background: var(--success); }
.toggle-control > input:checked + .toggle-track .toggle-knob { transform: translateX(20px); }
.toggle-control > input:focus-visible + .toggle-track { outline: 2px solid #2563eb; outline-offset: 2px; }
.toggle-copy { display: grid; gap: 2px; }
.toggle-copy strong { font-size: 13px; }
.toggle-copy small { color: var(--muted); font-size: 11px; }
.status-toggle-form { display: flex; align-items: center; gap: 10px; }
.status-state { display: inline-flex; align-items: center; justify-content: center; min-width: 42px; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 750; }
.status-state.is-on { background: var(--success-bg); color: var(--success); }
.status-state.is-off { background: #eef1f5; color: #5d6675; }
@media (max-width: 640px) { .status-toggle-form { width: 100%; justify-content: space-between; } }
.employee-header-status-form { margin: 0; flex: 0 0 auto; }
.employee-header-status-toggle { gap: 8px; }
.employee-header-status-label { font-size: 12px; font-weight: 700; color: var(--text); white-space: nowrap; }

/* Phase 2: employee invitation and device enrollment */
.enrollment-summary { align-self: start; }
.enrollment-state { border: 1px solid var(--border); background: var(--surface-soft); border-radius: 9px; padding: 14px; display: grid; gap: 4px; }
.enrollment-state strong { font-size: 13px; }
.enrollment-state span { color: var(--muted); font-size: 12px; }
.enrollment-state small { color: var(--muted); font-size: 10px; }
.enrollment-state-success { background: var(--success-bg); border-color: #b7e7d4; }
.enrollment-state-success strong { color: var(--success); }
.enrollment-action { margin-top: 14px; display: grid; gap: 7px; }
.button:disabled { cursor: not-allowed; opacity: .5; }
.enrollment-section { margin-bottom: 16px; }
.invitation-created-panel { margin-bottom: 16px; border-color: #cbd8fb; }
.invitation-link-row { display: grid; grid-template-columns: minmax(260px, 1fr) auto auto auto auto; gap: 8px; align-items: center; }
.invitation-link-row .button { white-space: nowrap; }
.invitation-link-row input { width: 100%; min-height: 39px; border: 1px solid #cfd6e1; border-radius: 8px; padding: 8px 10px; background: #f8fafc; color: var(--text); }
.invitation-note { color: var(--muted); font-size: 10px; margin-top: 9px; }
.invitation-status { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; padding: 4px 8px; font-size: 10px; font-weight: 750; white-space: nowrap; }
.status-pending { background: #eef2ff; color: #3749b5; }
.status-used { background: var(--success-bg); color: var(--success); }
.status-expired { background: var(--warning-bg); color: var(--warning); }
.status-revoked { background: #eef1f5; color: #5d6675; }
.inline-form { display: inline; margin: 0; }
.text-button { border: 0; background: transparent; padding: 0; cursor: pointer; font: inherit; font-weight: 650; }
.text-danger { color: var(--danger); }
.enrollment-table { min-width: 850px; }

.join-body { margin: 0; min-height: 100vh; background: #f4f6fa; display: grid; place-items: center; padding: 24px; }
.join-shell { width: min(100%, 520px); }
.join-card { background: white; border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: 0 12px 35px rgba(16, 24, 40, .07); text-align: center; }
.join-brand { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 28px; text-align: left; }
.join-brand .brand-mark { background: var(--sidebar); color: white; }
.join-brand > div:last-child { display: grid; }
.join-brand strong { font-size: 14px; }
.join-brand span { color: var(--muted); font-size: 10px; margin-top: 2px; }
.join-state-icon { width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; margin: 0 auto 14px; font-size: 20px; font-weight: 800; }
.join-state-ready { background: var(--success-bg); color: var(--success); }
.join-state-muted { background: #eef1f5; color: #5d6675; }
.join-state-error { background: var(--danger-bg); color: var(--danger); }
.join-card h1 { margin: 0; font-size: 23px; letter-spacing: -.025em; }
.join-lead { color: var(--muted); line-height: 1.6; margin: 8px auto 20px; max-width: 410px; }
.join-employee { border: 1px solid var(--border); background: var(--surface-soft); border-radius: 10px; padding: 14px; display: grid; gap: 3px; margin: 0 0 16px; }
.join-employee span, .join-employee small { color: var(--muted); font-size: 10px; }
.join-employee strong { font-size: 14px; }
.join-actions { display: grid; gap: 8px; }
.join-info { border-radius: 8px; padding: 11px; background: var(--warning-bg); color: var(--warning); text-align: left; font-size: 11px; line-height: 1.5; }
.join-security { color: var(--muted); font-size: 10px; line-height: 1.55; margin: 16px 0 0; }

@media (max-width: 760px) {
    .invitation-link-row { grid-template-columns: 1fr 1fr; }
    .invitation-link-row input { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
    .join-body { padding: 14px; }
    .join-card { padding: 21px; }
    .invitation-link-row { grid-template-columns: 1fr; }
    .invitation-link-row input { grid-column: auto; }
}

/* Phase 6: live tracking dashboard */
.tracking-metric-grid { margin-bottom: 12px; }
.metric-live { border-left: 3px solid var(--success); }
.metric-offline { border-left: 3px solid var(--danger); }
.tracking-toolbar { display: grid; grid-template-columns: minmax(220px, .8fr) 190px minmax(260px, 1fr); gap: 12px; align-items: end; margin-bottom: 16px; padding: 14px 16px; }
.tracking-filter-group { display: grid; gap: 5px; }
.tracking-filter-group label { font-size: 10px; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tracking-filter-group input, .tracking-filter-group select { width: 100%; min-height: 39px; border: 1px solid #cfd6e1; border-radius: 8px; padding: 8px 10px; background: white; color: var(--text); }
.tracking-refresh-state { justify-self: end; display: flex; align-items: center; gap: 9px; min-width: 0; }
.tracking-refresh-state > div { display: grid; min-width: 0; }
.tracking-refresh-state strong { font-size: 11px; }
.tracking-refresh-state small { color: var(--muted); font-size: 10px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-pulse { width: 9px; height: 9px; border-radius: 50%; background: var(--success); box-shadow: 0 0 0 5px rgba(8,122,85,.11); flex: 0 0 auto; }
.live-dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(290px, .65fr); gap: 16px; margin-bottom: 16px; }
.live-map-panel { padding-bottom: 14px; }
.phase-tag-live { background: var(--success-bg); color: var(--success); }
.live-map-wrap { position: relative; min-height: 440px; overflow: hidden; border: 1px solid var(--border); border-radius: 10px; background: #eef2f6; }
.live-map { width: 100%; min-height: 440px; z-index: 1; }
.map-empty-state { position: absolute; inset: 0; z-index: 2; display: grid; place-content: center; text-align: center; pointer-events: none; background: rgba(248,250,252,.86); padding: 30px; }
.map-empty-state.is-hidden { display: none; }
.map-empty-state strong { font-size: 13px; }
.map-empty-state span { color: var(--muted); font-size: 11px; max-width: 340px; margin-top: 5px; }
.map-legend { display: flex; flex-wrap: wrap; gap: 14px; padding-top: 11px; color: var(--muted); font-size: 10px; }
.map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot, .employee-state-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.legend-live, .state-live { background: var(--success); }
.legend-offline, .state-offline { background: var(--danger); }
.legend-waiting, .state-waiting { background: #d08b18; }
.tracking-count { min-width: 27px; height: 27px; border-radius: 999px; display: grid; place-items: center; padding: 0 8px; background: var(--surface-soft); border: 1px solid var(--border); font-size: 11px; font-weight: 750; }
.live-employee-panel { min-height: 0; }
.selected-employee-card { border: 1px solid #d8e0ea; border-radius: 9px; padding: 12px; background: #f8fafc; margin-bottom: 10px; }
.selected-employee-card.empty { display: grid; gap: 3px; color: var(--muted); }
.selected-employee-card.empty strong { color: var(--text); font-size: 12px; }
.selected-employee-card.empty span { font-size: 10px; }
.selected-employee-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.selected-employee-head > div { display: grid; min-width: 0; }
.selected-employee-head strong { font-size: 12px; }
.selected-employee-head span { color: var(--muted); font-size: 10px; margin-top: 2px; }
.tracking-state-badge { border-radius: 999px; padding: 4px 7px; font-size: 9px !important; font-weight: 750; white-space: nowrap; }
.tracking-state-badge.state-live { background: var(--success-bg); color: var(--success); }
.tracking-state-badge.state-offline { background: var(--danger-bg); color: var(--danger); }
.tracking-state-badge.state-waiting { background: var(--warning-bg); color: var(--warning); }
.selected-employee-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; margin: 0; }
.selected-employee-stats > div { padding: 7px 0; border-top: 1px solid var(--border); }
.selected-employee-stats dt { color: var(--muted); font-size: 9px; }
.selected-employee-stats dd { margin: 3px 0 0; font-size: 11px; font-weight: 700; }
.live-employee-list { display: grid; max-height: 330px; overflow-y: auto; padding-right: 2px; }
.live-employee-item { width: 100%; border: 0; border-bottom: 1px solid var(--border); background: transparent; padding: 10px 5px; display: grid; grid-template-columns: 10px minmax(0, 1fr) auto; align-items: center; gap: 9px; text-align: left; cursor: pointer; color: var(--text); }
.live-employee-item:last-child { border-bottom: 0; }
.live-employee-item:hover, .live-employee-item.is-selected { background: #f7f9fc; }
.live-employee-copy { display: grid; min-width: 0; }
.live-employee-copy strong { font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-employee-copy small { color: var(--muted); font-size: 9px; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-employee-duration { font-size: 10px; font-variant-numeric: tabular-nums; color: var(--muted); }
.employee-marker-shell { background: transparent !important; border: 0 !important; }
.employee-marker { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; border: 3px solid white; box-shadow: 0 2px 7px rgba(16,24,40,.28); }
.employee-marker > span { width: 8px; height: 8px; border-radius: 50%; background: white; }
.employee-marker-live { background: var(--success); }
.employee-marker-offline { background: var(--danger); }
.employee-marker-waiting { background: #d08b18; }
.map-popup { display: grid; min-width: 180px; gap: 3px; }
.map-popup > strong { font-size: 12px; }
.map-popup > span { color: #6b7280; font-size: 10px; }
.map-popup > small { color: #6b7280; font-size: 10px; line-height: 1.45; }
.popup-status { width: fit-content; margin: 5px 0 2px; border-radius: 999px; padding: 3px 6px; font-size: 9px; font-weight: 750; }
.popup-status-live { background: var(--success-bg); color: var(--success); }
.popup-status-offline { background: var(--danger-bg); color: var(--danger); }
.popup-status-waiting { background: var(--warning-bg); color: var(--warning); }
.location-activity-panel { padding: 0; overflow: hidden; }
.location-table-heading { padding: 16px 18px 0; }
.table-live-note { color: var(--success); background: var(--success-bg); border-radius: 999px; padding: 5px 8px; font-size: 9px; font-weight: 750; white-space: nowrap; }
.tracking-data-table { min-width: 960px; }
.coordinate-copy { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; font-size: 10px; white-space: nowrap; }
.activity-chip, .sync-chip { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 7px; font-size: 9px; font-weight: 700; white-space: nowrap; }
.activity-chip { background: #eef2f7; color: #465467; }
.activity-chip.is-mocked { background: var(--warning-bg); color: var(--warning); }
.sync-chip.is-live { background: var(--success-bg); color: var(--success); }
.sync-chip.is-delayed { background: var(--warning-bg); color: var(--warning); }
.leaflet-control-attribution { font-size: 9px !important; }

@media (max-width: 1050px) {
    .live-dashboard-grid { grid-template-columns: 1fr; }
    .tracking-toolbar { grid-template-columns: 1fr 180px; }
    .tracking-refresh-state { grid-column: 1 / -1; justify-self: start; }
    .live-employee-list { max-height: 260px; }
}

@media (max-width: 640px) {
    .tracking-toolbar { grid-template-columns: 1fr; }
    .tracking-refresh-state { grid-column: auto; }
    .live-map-wrap, .live-map { min-height: 340px; }
    .selected-employee-stats { grid-template-columns: 1fr 1fr; }
    .map-legend { gap: 10px; }
    .location-table-heading { align-items: flex-start; }
}

/* Phase 7: route history */
.route-history-toolbar { display: grid; grid-template-columns: minmax(230px, 1.2fr) 170px 170px auto; gap: 12px; align-items: end; margin-bottom: 12px; }
.route-toolbar-actions { display: flex; align-items: end; }
.route-presets { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 7px; padding-top: 2px; }
.route-preset { border: 1px solid #cfd6e1; background: var(--surface); color: var(--muted); border-radius: 999px; padding: 5px 10px; font-size: 10px; font-weight: 700; cursor: pointer; }
.route-preset:hover { color: var(--primary); border-color: #aebbd0; background: #f8faff; }
.route-history-error { margin-bottom: 12px; }
.route-history-metrics { margin-bottom: 16px; }
.route-history-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .55fr); gap: 16px; margin-bottom: 16px; }
.route-map-panel { min-width: 0; }
.route-map-wrap { position: relative; min-height: 470px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #eef2f6; }
.route-history-map { width: 100%; min-height: 470px; z-index: 1; }
.route-map-legend { display: flex; flex-wrap: wrap; gap: 14px; padding-top: 11px; color: var(--muted); font-size: 10px; }
.route-map-legend span { display: inline-flex; align-items: center; gap: 6px; }
.route-legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.route-start-dot { background: var(--success); }
.route-end-dot { background: var(--danger); }
.route-legend-line { width: 20px; height: 3px; border-radius: 999px; background: var(--primary); display: inline-block; }
.route-legend-gap { width: 20px; border-top: 2px dashed #98a2b3; display: inline-block; }
.route-summary-panel { align-self: start; }
.route-detail-list { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.route-detail-list > div { min-width: 0; padding: 10px 0; border-top: 1px solid var(--border); }
.route-detail-list > div:nth-child(odd) { padding-right: 10px; }
.route-detail-list > div:nth-child(even) { padding-left: 10px; }
.route-detail-list dt { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .035em; }
.route-detail-list dd { margin: 4px 0 0; font-size: 11px; font-weight: 700; overflow-wrap: anywhere; }
.route-marker-shell { background: transparent !important; border: 0 !important; }
.route-marker { width: 20px; height: 20px; display: block; border-radius: 50%; border: 3px solid white; box-shadow: 0 2px 7px rgba(16,24,40,.3); }
.route-marker-start { background: var(--success); }
.route-marker-end { background: var(--danger); }
.route-marker-current { background: var(--primary); box-shadow: 0 0 0 5px rgba(36,87,214,.16), 0 2px 7px rgba(16,24,40,.3); }
.route-playback-panel { margin-bottom: 16px; }
.playback-time-label { font-size: 11px; font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.route-playback-controls { display: grid; grid-template-columns: auto minmax(0, 1fr) 80px; gap: 12px; align-items: center; }
.route-playback-controls input[type="range"] { width: 100%; accent-color: var(--primary); }
.route-playback-controls select { min-height: 34px; border: 1px solid #cfd6e1; background: white; color: var(--text); border-radius: 8px; padding: 5px 8px; }
.route-session-panel { padding: 0; overflow: hidden; }
.route-session-panel .panel-heading { padding: 16px 18px 0; }
.route-session-table { min-width: 900px; }
.route-session-status { display: inline-flex; border-radius: 999px; padding: 4px 7px; font-size: 9px; font-weight: 750; }
.route-session-status.is-active { color: var(--success); background: var(--success-bg); }
.route-session-status.is-completed { color: #465467; background: #eef2f7; }

@media (max-width: 1100px) {
    .route-history-grid { grid-template-columns: 1fr; }
    .route-history-toolbar { grid-template-columns: 1fr 160px 160px auto; }
}

@media (max-width: 780px) {
    .route-history-toolbar { grid-template-columns: 1fr 1fr; }
    .route-history-toolbar .tracking-filter-group:first-child { grid-column: 1 / -1; }
    .route-toolbar-actions { grid-column: 1 / -1; }
    .route-toolbar-actions .button { width: 100%; }
    .route-map-wrap, .route-history-map { min-height: 360px; }
}

@media (max-width: 560px) {
    .route-history-toolbar { grid-template-columns: 1fr; }
    .route-history-toolbar .tracking-filter-group:first-child, .route-toolbar-actions { grid-column: auto; }
    .route-detail-list { grid-template-columns: 1fr; }
    .route-detail-list > div:nth-child(odd), .route-detail-list > div:nth-child(even) { padding-left: 0; padding-right: 0; }
    .route-playback-controls { grid-template-columns: 1fr 76px; }
    .route-playback-controls input[type="range"] { grid-column: 1 / -1; grid-row: 2; }
}

/* Phase 8: geofences, visits and time spent */
.header-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.phase8-place-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(360px, 1.1fr); gap: 16px; align-items: start; }
.place-form-panel, .place-list-panel { min-width: 0; }
.place-form { display: grid; gap: 14px; }
.form-grid.three-columns { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.place-picker-wrap { display: grid; gap: 7px; }
.place-picker-map { min-height: 330px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: #eef2f6; }
.place-picker-help { color: var(--muted); font-size: 10px; line-height: 1.45; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: #f8fafc; cursor: pointer; }
.toggle-row > span { display: grid; gap: 3px; }
.toggle-row strong { font-size: 11px; }
.toggle-row small { color: var(--muted); font-size: 9px; line-height: 1.45; }
.toggle-row input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); }
.place-list { display: grid; }
.place-list-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); }
.place-list-item:last-child { border-bottom: 0; }
.place-list-main { display: grid; gap: 4px; min-width: 0; }
.place-list-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.place-list-title > strong { font-size: 12px; }
.place-list-main > span { color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.place-list-main > small { color: var(--muted); font-size: 9px; font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }
.place-type-chip, .place-status-chip { display: inline-flex; align-items: center; border-radius: 999px; padding: 4px 7px; font-size: 9px; font-weight: 750; }
.place-type-chip { color: #465467; background: #eef2f7; }
.place-status-chip.is-active { color: var(--success); background: var(--success-bg); }
.place-status-chip.is-inactive { color: var(--muted); background: #f0f2f5; }
.place-list-actions { display: flex; gap: 7px; align-items: center; }
.place-list-actions form { margin: 0; }

.visit-toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) 180px auto; gap: 12px; align-items: end; margin-bottom: 12px; }
.visit-toolbar-actions { display: flex; gap: 8px; align-items: end; }
.visit-recalc-help { grid-column: 1 / -1; color: var(--muted); font-size: 9px; padding-top: 2px; }
.visit-metric-grid { margin-bottom: 16px; }
.visit-metric-grid .metric-card small { color: var(--muted); font-size: 9px; margin-top: 3px; }
.phase8-visit-grid { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr); gap: 16px; margin-bottom: 16px; }
.visit-map-panel { min-width: 0; }
.visit-map { min-height: 460px; border: 1px solid var(--border); border-radius: 10px; background: #eef2f6; overflow: hidden; }
.visit-map-legend { display: flex; flex-wrap: wrap; gap: 14px; padding-top: 11px; color: var(--muted); font-size: 10px; }
.visit-map-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.visit-legend-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.visit-legend-dot.known { background: var(--primary); }
.visit-legend-dot.stop { background: #d08b18; }
.visit-legend-ring { width: 13px; height: 13px; border: 1px solid #667085; border-radius: 50%; background: rgba(102,112,133,.08); display: inline-block; }
.visit-summary-panel { align-self: start; }
.visit-detection-note { display: grid; gap: 5px; margin-top: 12px; padding: 11px; border: 1px solid var(--border); border-radius: 9px; background: #f8fafc; }
.visit-detection-note strong { font-size: 10px; }
.visit-detection-note span { color: var(--muted); font-size: 9px; line-height: 1.5; }
.visit-timeline-panel { margin-bottom: 16px; }
.visit-timeline { display: grid; }
.visit-timeline-item { display: grid; grid-template-columns: 78px 20px minmax(0, 1fr); gap: 10px; min-height: 88px; }
.visit-timeline-time { display: grid; align-content: start; gap: 3px; padding-top: 13px; text-align: right; }
.visit-timeline-time strong { font-size: 10px; font-variant-numeric: tabular-nums; }
.visit-timeline-time span { color: var(--muted); font-size: 9px; font-variant-numeric: tabular-nums; }
.visit-timeline-rail { position: relative; display: flex; justify-content: center; }
.visit-timeline-rail::before { content: ''; position: absolute; top: 0; bottom: 0; width: 1px; background: var(--border); }
.visit-timeline-rail i { position: relative; z-index: 1; width: 11px; height: 11px; margin-top: 16px; border-radius: 50%; border: 2px solid white; box-shadow: 0 0 0 1px var(--border); }
.visit-timeline-rail i.known { background: var(--primary); }
.visit-timeline-rail i.stop { background: #d08b18; }
.visit-timeline-content { min-width: 0; padding: 11px 0 14px; border-bottom: 1px solid var(--border); }
.visit-timeline-item:last-child .visit-timeline-content { border-bottom: 0; }
.visit-timeline-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.visit-timeline-head > div { display: grid; gap: 3px; min-width: 0; }
.visit-timeline-head strong { font-size: 12px; }
.visit-timeline-head span { color: var(--muted); font-size: 9px; }
.visit-duration-chip { flex: 0 0 auto; color: var(--primary) !important; background: #eef3ff; border-radius: 999px; padding: 4px 7px; font-weight: 750; }
.visit-timeline-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; margin-top: 8px; color: var(--muted); font-size: 9px; }
.visit-timeline-content > small { display: block; margin-top: 7px; color: var(--muted); font-size: 9px; }
.visit-timeline-content .focus-visit { margin-top: 7px; }
.visit-ongoing-chip { color: var(--success) !important; background: var(--success-bg); border-radius: 999px; padding: 2px 6px; font-weight: 750; }

@media (max-width: 1080px) {
    .phase8-place-grid, .phase8-visit-grid { grid-template-columns: 1fr; }
    .visit-toolbar { grid-template-columns: 1fr 170px auto; }
}

@media (max-width: 760px) {
    .visit-toolbar { grid-template-columns: 1fr 1fr; }
    .visit-toolbar-actions { grid-column: 1 / -1; }
    .visit-toolbar-actions .button { flex: 1; }
    .form-grid.three-columns { grid-template-columns: 1fr; }
    .place-list-item { grid-template-columns: 1fr; }
    .place-list-actions { justify-content: flex-start; }
    .visit-map { min-height: 360px; }
}

@media (max-width: 520px) {
    .visit-toolbar { grid-template-columns: 1fr; }
    .visit-toolbar-actions { grid-column: auto; display: grid; grid-template-columns: 1fr; }
    .visit-timeline-item { grid-template-columns: 60px 16px minmax(0, 1fr); gap: 7px; }
    .visit-timeline-head { display: grid; }
    .visit-duration-chip { width: fit-content; }
}

/* Phase 9: reports, security and production hardening */
.metric-card small { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; line-height: 1.4; }
.metric-card.metric-warning { border-color: #f2c66d; background: #fffaf0; }
.report-toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) 170px 170px auto; gap: 12px; align-items: end; margin-bottom: 10px; }
.report-toolbar-actions { display: flex; align-items: center; gap: 8px; }
.report-range-note { display: flex; flex-wrap: wrap; gap: 8px 14px; margin: 0 0 14px; color: var(--muted); font-size: 10px; }
.report-range-note span { display: inline-flex; align-items: center; }
.phase9-report-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.report-table-panel, .audit-panel, .anomaly-panel { padding: 0; overflow: hidden; }
.report-table-panel .panel-heading, .audit-panel .panel-heading, .anomaly-panel .panel-heading { padding: 18px 18px 0; }
.phase9-report-table { min-width: 1280px; }
.report-live-chip { display: inline-flex; margin-left: 5px; padding: 3px 6px; border-radius: 999px; color: var(--success); background: var(--success-bg); font-size: 8px; font-weight: 750; white-space: nowrap; }
.quality-chip, .severity-chip, .anomaly-status-chip { display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; padding: 4px 7px; font-size: 9px; font-weight: 750; white-space: nowrap; }
.quality-chip.is-clean { color: var(--success); background: var(--success-bg); }
.quality-chip.is-warning { color: var(--warning); background: var(--warning-bg); }
.system-health-banner { margin-bottom: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); padding: 15px 17px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.system-health-banner > div { display: grid; gap: 3px; }
.system-health-banner span, .system-health-banner small { color: var(--muted); font-size: 10px; }
.system-health-banner strong { font-size: 17px; }
.system-health-banner.is-healthy { border-color: #b7e7d4; background: #f2fbf7; }
.system-health-banner.is-warning { border-color: #f2c66d; background: #fffaf0; }
.system-health-banner.is-failed { border-color: #fecaca; background: #fff4f3; }
.health-check-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.health-check-card { padding: 13px; }
.health-check-card.is-warning { border-color: #f2c66d; }
.health-check-card.is-failed { border-color: #fecaca; }
.health-check-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.health-check-head strong { font-size: 11px; }
.health-check-head span { border-radius: 999px; padding: 3px 6px; background: #eef2f7; color: #465467; font-size: 8px; font-weight: 750; }
.health-check-card.is-healthy .health-check-head span { color: var(--success); background: var(--success-bg); }
.health-check-card.is-warning .health-check-head span { color: var(--warning); background: var(--warning-bg); }
.health-check-card.is-failed .health-check-head span { color: var(--danger); background: var(--danger-bg); }
.health-check-card p { margin: 8px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.phase9-health-metrics { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.phase9-system-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.system-detail-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; gap: 0 16px; }
.system-detail-list > div { min-width: 0; padding: 10px 0; border-top: 1px solid var(--border); }
.system-detail-list dt { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .035em; }
.system-detail-list dd { margin: 4px 0 0; font-size: 11px; font-weight: 700; overflow-wrap: anywhere; }
.system-command-note { margin-top: 12px; display: grid; gap: 6px; padding: 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface-soft); }
.system-command-note strong { font-size: 10px; }
.system-command-note code { width: fit-content; max-width: 100%; overflow-wrap: anywhere; color: #344054; font-size: 9px; }
.system-command-note span { color: var(--muted); font-size: 9px; line-height: 1.45; }
.anomaly-filters, .audit-toolbar { display: grid; grid-template-columns: repeat(3, minmax(170px, 1fr)) auto; gap: 10px; align-items: end; }
.anomaly-filters { padding: 0 18px 14px; }
.audit-toolbar { margin-bottom: 14px; }
.anomaly-table { min-width: 1180px; }
.audit-table { min-width: 1050px; }
.severity-chip.is-high { color: var(--danger); background: var(--danger-bg); }
.severity-chip.is-medium { color: var(--warning); background: var(--warning-bg); }
.severity-chip.is-low { color: #2457d6; background: #eef3ff; }
.anomaly-status-chip.is-open { color: var(--danger); background: var(--danger-bg); }
.anomaly-status-chip.is-acknowledged { color: var(--warning); background: var(--warning-bg); }
.anomaly-status-chip.is-resolved { color: var(--success); background: var(--success-bg); }
.anomaly-details, .audit-metadata { display: block; max-width: 320px; max-height: 72px; overflow: auto; white-space: normal; overflow-wrap: anywhere; color: #475467; font-size: 8px; line-height: 1.45; }
.audit-action { color: #344054; font-size: 9px; }
.text-button { border: 0; background: transparent; padding: 0; color: var(--primary); font-weight: 650; font-size: 10px; cursor: pointer; }
.pagination-wrap { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.pagination-wrap .page-link { display: inline-flex; min-height: 32px; align-items: center; justify-content: center; border: 1px solid #cfd6e1; border-radius: 7px; padding: 5px 9px; background: white; color: var(--text); font-size: 10px; }
.pagination-wrap .page-link.is-disabled { color: #98a2b3; background: #f7f8fa; cursor: default; }
.pagination-wrap .page-count { color: var(--muted); font-size: 10px; }

@media (max-width: 1250px) {
    .phase9-report-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .health-check-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .phase9-health-metrics { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
    .report-toolbar, .anomaly-filters, .audit-toolbar { grid-template-columns: 1fr 1fr; }
    .report-toolbar .tracking-filter-group:first-child { grid-column: 1 / -1; }
    .report-toolbar-actions { grid-column: 1 / -1; }
    .phase9-system-grid { grid-template-columns: 1fr; }
    .health-check-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 600px) {
    .phase9-report-metrics, .phase9-health-metrics, .health-check-grid { grid-template-columns: 1fr 1fr; }
    .report-toolbar, .anomaly-filters, .audit-toolbar { grid-template-columns: 1fr; }
    .report-toolbar .tracking-filter-group:first-child, .report-toolbar-actions { grid-column: auto; }
    .report-toolbar-actions { display: grid; grid-template-columns: 1fr 1fr; }
    .system-health-banner { align-items: flex-start; flex-direction: column; }
    .system-detail-list { grid-template-columns: 1fr; }
}

@media (max-width: 430px) {
    .phase9-report-metrics, .phase9-health-metrics, .health-check-grid { grid-template-columns: 1fr; }
}

/* Administrator accounts and company branding */
.brand-mark-image { overflow: hidden; background: white; padding: 4px; }
.brand-mark-image img { width: 100%; height: 100%; object-fit: contain; display: block; }
.sidebar-user-link { border-radius: 8px; padding: 7px; margin: -7px -7px 12px; transition: background .15s ease; }
.sidebar-user-link:hover, .sidebar-user-link.active { background: rgba(255,255,255,.07); }
.sidebar-user-copy small { color: #7f8da3; font-size: 9px; margin-top: 2px; }
.button-danger { background: var(--danger-bg); color: var(--danger); border-color: #fecaca; }
.button-danger:hover { background: #fee2e2; }
.status-neutral { background: #eef2f7; color: #475467; }
.admin-account-grid { align-items: start; }
.admin-profile-summary { margin-bottom: 2px; }
.compact-admin-form { gap: 13px; }
.admin-table-heading { padding: 18px 18px 0; }
.admin-accounts-table { min-width: 850px; }
.protected-account-notice { max-width: 1050px; border: 1px solid #f4d58d; background: #fff8e7; color: #7a4a00; border-radius: 10px; padding: 14px 16px; margin-bottom: 16px; display: grid; gap: 3px; }
.protected-account-notice strong { font-size: 12px; }
.protected-account-notice span { font-size: 11px; line-height: 1.45; }
.password-confirm-panel { border: 1px solid #d9e1f2; background: #f8faff; border-radius: 9px; padding: 13px; }
.settings-section + .settings-section { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--border); }
.settings-section-heading { margin-bottom: 14px; }
.settings-section-heading h2 { margin: 0; font-size: 15px; }
.settings-section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }
.branding-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.branding-upload-card { border: 1px solid var(--border); border-radius: 10px; background: var(--surface-soft); padding: 14px; display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 14px; align-items: center; }
.branding-preview { height: 92px; border: 1px dashed #cfd6e1; border-radius: 9px; background: white; display: grid; place-items: center; overflow: hidden; padding: 8px; }
.branding-preview img { width: 100%; height: 100%; object-fit: contain; display: block; }
.branding-favicon-preview { width: 92px; }
.branding-placeholder { width: 64px; height: 64px; border-radius: 12px; background: var(--sidebar); color: white; display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.branding-placeholder-small { width: 40px; height: 40px; border-radius: 8px; font-size: 12px; }
.branding-remove-option { margin-top: 5px; }

@media (max-width: 760px) {
    .branding-grid { grid-template-columns: 1fr; }
    .branding-upload-card { grid-template-columns: 90px minmax(0, 1fr); }
    .branding-preview { height: 78px; }
    .branding-favicon-preview { width: 78px; }
}

@media (max-width: 480px) {
    .branding-upload-card { grid-template-columns: 1fr; }
    .branding-preview, .branding-favicon-preview { width: 100%; }
}
