/* Beacon35 App Styles — extracted for cacheability */
:root {
    --bg-primary: #f8f9fb;
    --bg-card: #ffffff;
    --bg-input: #ffffff;
    --bg-hover: #f3f4f6;
    --bg-section: #f9fafb;
    --bg-checkbox: #f9fafb;
    --text-primary: #111827;
    --text-secondary: #374151;
    --text-muted: #6b7280;
    --text-light: #9ca3af;
    --border-color: #e5e7eb;
    --border-light: #d1d5db;
    --accent-primary: #e85d04;
    --accent-hover: #d35400;
    --accent-light: #fff7ed;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
    --shadow-md: 0 1px 3px rgba(0,0,0,0.08), 0 1px 2px rgba(0,0,0,0.06);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
    --radius: 8px;
}

[data-theme="dark"] {
    --bg-primary: #111827;
    --bg-card: #1f2937;
    --bg-input: #1f2937;
    --bg-hover: #374151;
    --bg-section: #1f2937;
    --bg-checkbox: #374151;
    --text-primary: #f9fafb;
    --text-secondary: #e5e7eb;
    --text-muted: #9ca3af;
    --text-light: #6b7280;
    --border-color: #374151;
    --border-light: #4b5563;
    --accent-primary: #f48c06;
    --accent-hover: #e85d04;
    --accent-light: #1c1105;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.2);
    --shadow-md: 0 1px 3px rgba(0,0,0,0.3);
    --shadow-lg: 0 4px 12px rgba(0,0,0,0.4);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; background: var(--bg-primary); min-height: 100vh; color: var(--text-primary); -webkit-text-size-adjust: 100%; }
.container { max-width: 1200px; margin: 0 auto; padding: 20px; }
.container-medium { max-width: 900px; margin: 0 auto; padding: 20px; }
.card { background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border-color); box-shadow: var(--shadow-md); padding: 28px; margin-bottom: 20px; }
.header { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 16px; }
.header-left { display: flex; align-items: center; gap: 12px; }
.logo { width: 36px; height: 36px; object-fit: contain; }
.title { font-size: 22px; font-weight: 700; color: var(--text-primary); letter-spacing: -0.3px; }
.subtitle { color: var(--text-muted); font-size: 13px; }
.btn { padding: 10px 16px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; transition: background .15s, border-color .15s, box-shadow .15s; min-height: 44px; }
.btn-primary { background: var(--accent-primary); color: white; border-color: var(--accent-primary); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { background: var(--bg-section); color: var(--text-secondary); border-color: var(--border-color); }
.btn-secondary:hover { background: var(--bg-hover); border-color: var(--border-light); }
.btn-success { background: #16a34a; color: white; border-color: #16a34a; }
.btn-success:hover { background: #15803d; border-color: #15803d; }
.btn-danger { background: var(--accent-light); color: #dc2626; border-color: #fecaca; }
.btn-danger:hover { background: #fef2f2; border-color: #fca5a5; }
[data-theme="dark"] .btn-danger { background: #2d1215; color: #f87171; border-color: #450a0a; }
[data-theme="dark"] .btn-danger:hover { background: #450a0a; }
.btn-info { background: #1e3a5f; color: #93c5fd; border-color: #1e3a5f; }
.btn-info:hover { background: #1e40af; color: white; }
.btn-ai { background: #7c3aed; color: white; border-color: #7c3aed; }
.btn-ai:hover { background: #6d28d9; border-color: #6d28d9; }
.btn-ai:disabled { background: #c4b5fd; border-color: #c4b5fd; cursor: not-allowed; }
.btn-reset { background: #fef3c7; color: #92400e; border-color: #fde68a; }
.btn-reset:hover { background: #fde68a; border-color: #fcd34d; }
.narrative-buttons { display: flex; gap: 8px; margin-top: 8px; }
.loading-spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid #fff; border-radius: 50%; border-top-color: transparent; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.module-tile:hover { border-color: var(--border-light) !important; box-shadow: var(--shadow-lg) !important; }
.incident-card { background: var(--bg-card); padding: 20px; border-radius: var(--radius); box-shadow: var(--shadow-sm); border: 1px solid var(--border-color); cursor: pointer; transition: border-color .15s, box-shadow .15s; text-align: center; }
.incident-card:hover { border-color: var(--accent-primary); box-shadow: var(--shadow-lg); }
.incident-icon { width: 40px; height: 40px; margin: 0 auto 10px; color: var(--accent-primary); }
.incident-name { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 14px; font-weight: 500; color: var(--text-secondary); margin-bottom: 4px; }
.form-input, .form-select, .form-textarea { width: 100%; padding: 10px 14px; border: 1px solid var(--border-light); border-radius: 6px; font-size: 16px; font-family: inherit; background: var(--bg-input); color: var(--text-primary); transition: border-color .15s, box-shadow .15s; }
.form-input:focus, .form-select:focus, .form-textarea:focus { outline: none; border-color: var(--accent-primary); box-shadow: 0 0 0 3px rgba(232, 93, 4, 0.1); }
.form-select[multiple] { padding: 8px; }
.form-select[multiple] option { padding: 6px 8px; margin: 2px 0; border-radius: 4px; }
.form-select[multiple] option:checked { background: var(--accent-primary); color: white; }
.form-select[multiple] option:hover { background: var(--accent-light); }
.personnel-assignment-table { border: 1px solid var(--border-light); border-radius: var(--radius); overflow: hidden; }
.personnel-assignment-table table { margin: 0; }
.personnel-assignment-table th { position: sticky; top: 0; z-index: 1; }
.personnel-assignment-table select { min-width: 120px; }
.btn-sm { padding: 5px 10px; font-size: 12px; min-height: 36px; }
.form-textarea { resize: vertical; }
.checkbox-group { display: flex; flex-wrap: wrap; gap: 10px; }
.checkbox-label { display: flex; align-items: center; padding: 10px 14px; cursor: pointer; border-radius: 6px; background: var(--bg-checkbox); border: 1px solid var(--border-color); color: var(--text-secondary); font-size: 14px; transition: border-color .15s; min-height: 44px; }
.checkbox-label:hover { border-color: var(--border-light); }
.checkbox-label input { margin-right: 8px; width: 20px; height: 20px; }
.upload-area { border: 2px dashed var(--border-light); border-radius: var(--radius); padding: 24px; text-align: center; cursor: pointer; background: var(--bg-section); transition: border-color .15s; }
.upload-area:hover { border-color: var(--accent-primary); }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 16px; }
.image-item { position: relative; }
.image-item img { width: 100%; height: 128px; object-fit: cover; border-radius: 6px; }
.image-remove { position: absolute; top: 4px; right: 4px; background: var(--accent-primary); color: white; border: none; border-radius: 50%; width: 36px; height: 36px; cursor: pointer; font-size: 18px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.image-remove:hover { background: var(--accent-hover); }
.alert { padding: 14px; border-radius: 6px; margin-bottom: 20px; font-size: 14px; }
.alert-success { background: #dcfce7; border: 1px solid #86efac; color: #166534; font-weight: 600; }
[data-theme="dark"] .alert-success { background: #052e16; border-color: #166534; color: #86efac; }
.text-center { text-align: center; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.flex { display: flex; gap: 16px; }
.flex-1 { flex: 1; }
.icon { width: 20px; height: 20px; vertical-align: middle; }
.icon-lg { width: 40px; height: 40px; }
.admin-textarea { font-family: monospace; font-size: 13px; }
.help-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.section-header { font-size: 15px; font-weight: 600; color: var(--accent-primary); padding-bottom: 8px; border-bottom: 2px solid var(--border-color); margin: 24px 0 16px 0; }
.config-section { background: var(--bg-section); border: 1px solid var(--border-color); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.config-section-title { font-weight: 600; font-size: 13px; color: var(--text-secondary); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.3px; }
.tab-container { display: flex; border-bottom: 1px solid var(--border-color); margin-bottom: 20px; flex-wrap: wrap; }
.tab { padding: 10px 18px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; font-size: 13px; color: var(--text-muted); transition: color .15s, border-color .15s; min-height: 44px; }
.tab:hover { color: var(--accent-primary); }
.tab.active { color: var(--accent-primary); border-bottom-color: var(--accent-primary); }

/* Admin Header Styles */
.admin-header-card { background: var(--bg-card); border-radius: var(--radius) var(--radius) 0 0; box-shadow: var(--shadow-md); padding: 0; margin-bottom: 0; border: 1px solid var(--border-color); border-bottom: none; }
.admin-header-top { display: flex; justify-content: space-between; align-items: center; padding: 20px 24px; border-bottom: 1px solid var(--border-color); }
.admin-header-left { display: flex; align-items: center; gap: 14px; }
.admin-header-icon { width: 44px; height: 44px; background: var(--accent-primary); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: white; }
.admin-header-icon svg { width: 22px; height: 22px; }
.admin-header-title { font-size: 20px; font-weight: 700; color: var(--text-primary); margin: 0; letter-spacing: -0.3px; }
.admin-header-subtitle { font-size: 13px; color: var(--text-muted); margin: 2px 0 0; }
.admin-header-actions { display: flex; gap: 8px; }

/* Admin Tab Groups */
.admin-tabs-container { display: flex; flex-wrap: wrap; gap: 0; padding: 0 12px; background: var(--bg-section); border-left: 1px solid var(--border-color); border-right: 1px solid var(--border-color); }
.admin-tab-group { flex: 1; min-width: 180px; padding: 14px 10px 0; }
.admin-tab-group-header { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-light); margin-bottom: 8px; display: flex; align-items: center; gap: 6px; padding-left: 4px; }
.admin-tab-group-header svg { width: 14px; height: 14px; }
.admin-tab-group-tabs { display: flex; flex-direction: column; gap: 2px; padding-bottom: 14px; }
.admin-tab { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: 6px; cursor: pointer; transition: background .15s; color: var(--text-secondary); font-size: 13px; font-weight: 500; min-height: 44px; }
.admin-tab:hover { background: var(--bg-hover); color: var(--text-primary); }
.admin-tab.active { background: var(--accent-primary); color: white; }
.admin-tab-icon { display: flex; align-items: center; justify-content: center; width: 18px; }
.admin-tab-icon svg { width: 16px; height: 16px; }

/* Admin Content Card */
.admin-content-card { background: var(--bg-card); border-radius: 0 0 var(--radius) var(--radius); box-shadow: var(--shadow-md); padding: 24px; border: 1px solid var(--border-color); border-top: none; }
.admin-footer-actions { display: flex; gap: 10px; margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--border-color); }

.cad-incidents-container { max-height: 400px; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.cad-incident-row { display: flex; align-items: center; padding: 10px 16px; border-bottom: 1px solid var(--border-color); cursor: pointer; transition: background .15s; gap: 12px; }
.cad-incident-row:hover { background: var(--bg-hover); }
.cad-incident-row:last-child { border-bottom: none; }
.cad-incident-icon { width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; background: var(--accent-light); border-radius: 6px; flex-shrink: 0; }
.cad-incident-icon svg { width: 20px; height: 20px; }
.cad-incident-info { flex: 1; min-width: 0; }
.cad-incident-number { font-weight: 600; color: var(--accent-primary); font-size: 13px; }
.cad-incident-type { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.cad-incident-address { font-size: 12px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cad-incident-time { text-align: right; font-size: 13px; font-weight: 600; color: var(--text-secondary); flex-shrink: 0; }
.cad-incident-date { font-size: 11px; color: var(--text-light); font-weight: normal; }
.cad-incident-action { flex-shrink: 0; }
.cad-type-badge { display: inline-block; padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 600; cursor: pointer; transition: box-shadow .15s; }
.cad-type-badge:hover { box-shadow: 0 1px 3px rgba(0,0,0,0.1); }
.cad-type-select { padding: 6px 10px; border-radius: 6px; border: 1px solid var(--border-light); font-size: 12px; background: var(--bg-input); color: var(--text-primary); cursor: pointer; min-height: 44px; }
.cad-type-select:hover { border-color: var(--accent-primary); }
.app-footer { background: var(--bg-card); border-top: 1px solid var(--border-color); padding: 14px 20px; margin-top: 28px; text-align: center; }
.app-footer-links { display: flex; justify-content: center; align-items: center; gap: 20px; flex-wrap: wrap; }
.app-footer-link { display: inline-flex; align-items: center; gap: 5px; color: var(--text-muted); text-decoration: none; font-size: 13px; padding: 6px 10px; border-radius: 6px; transition: color .15s; }
.app-footer-link:hover { color: var(--accent-primary); }
.app-footer-link svg { width: 14px; height: 14px; }
.app-footer-divider { width: 1px; height: 16px; background: var(--border-color); }
.app-footer-brand { margin-top: 10px; font-size: 11px; color: var(--text-light); }

/* Focus visible indicators */
:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }
.btn:focus-visible, .tab:focus-visible, .admin-tab:focus-visible { outline: 2px solid var(--accent-primary); outline-offset: 2px; }

/* Responsive */
@media (max-width: 768px) {
    .header { flex-direction: column; align-items: flex-start; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .flex { flex-direction: column; }
    .tab { padding: 10px 14px; font-size: 13px; }
    .cad-incident-row { flex-wrap: wrap; }
    .cad-incident-time { order: -1; width: 100%; text-align: left; margin-bottom: 8px; }
    .cad-incident-action { width: 100%; margin-top: 8px; }
    .app-footer-links { gap: 12px; }
    .admin-tabs-container { flex-direction: column; }
    .admin-tab-group { min-width: 100%; }
    .admin-tab-group-tabs { flex-direction: row; flex-wrap: wrap; gap: 6px; }
    .admin-header-top { flex-direction: column; gap: 16px; align-items: stretch; }
    .admin-header-actions { justify-content: flex-end; }
    .grid-2 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
    .container { padding: 12px; }
    .card { padding: 16px; }
}
