﻿:root {
  --blue: #0f4c81;
  --blue-dark: #0a3154;
  --red: #c62828;
  --bg: #f5f7fb;
  --text: #172033;
  --muted: #667085;
  --line: #d9e2ec;
  --white: #ffffff;
  --green: #16834f;
  --amber: #b7791f;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--text); background: var(--bg); }
button, input, select { font: inherit; }
button { cursor: pointer; border: 0; border-radius: 8px; padding: 10px 14px; background: var(--blue); color: white; font-weight: 700; }
button:hover { filter: brightness(0.96); }
input, select { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: white; color: var(--text); }
label { display: grid; gap: 6px; color: var(--blue-dark); font-weight: 700; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(24px, 3vw, 38px); }
h2 { font-size: 18px; }
.hidden { display: none !important; }
.muted { color: var(--muted); line-height: 1.5; }
.eyebrow { color: var(--blue); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; font-weight: 800; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, #eef5ff, #ffffff); }
.login-card { width: min(920px, 100%); display: grid; grid-template-columns: 1.1fr .9fr; gap: 28px; align-items: start; background: white; border: 1px solid var(--line); border-radius: 8px; padding: 34px; box-shadow: 0 18px 45px rgba(15, 76, 129, .13); }
.uasd-logo { width: 72px; height: 72px; object-fit: contain; margin-bottom: 14px; }
.uasd-logo.small { width: 48px; height: 48px; margin: 0; }
.brand-lockup { display: flex; align-items: center; gap: 12px; }
.form-grid { display: grid; gap: 14px; }
.error { min-height: 20px; color: var(--red); font-weight: 700; }
.demo-users { grid-column: 1 / -1; display: grid; gap: 5px; padding: 14px; border-radius: 8px; background: #f8fafc; color: var(--muted); }

.app-shell { min-height: 100vh; padding: 18px; display: grid; gap: 18px; }
.topbar, .panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.topbar { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 16px 18px; }
.top-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.pill { display: inline-flex; align-items: center; min-height: 34px; padding: 6px 10px; border-radius: 999px; background: #eef5ff; color: var(--blue-dark); font-weight: 800; }
.ghost { background: white; color: var(--blue); border: 1px solid var(--line); }
.danger-outline { background: white; color: var(--red); border: 1px solid #f2b8b5; }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stats article { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: grid; gap: 4px; }
.stats strong { font-size: 28px; color: var(--blue); }
.stats span { color: var(--muted); font-weight: 700; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) 420px; gap: 18px; min-height: 560px; }
.map-wrap { position: relative; min-height: 560px; background: white; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
#map { height: 100%; min-height: 560px; }
.toast { position: absolute; top: 16px; left: 50%; transform: translateX(-50%); z-index: 500; background: var(--red); color: white; padding: 12px 16px; border-radius: 8px; font-weight: 800; box-shadow: 0 12px 28px rgba(0,0,0,.18); }
.side-panel, .table-panel { background: white; border: 1px solid var(--line); border-radius: 8px; padding: 14px; min-width: 0; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0; }
.filters input:first-child { grid-column: 1 / -1; }
.alerts-list { display: grid; gap: 10px; max-height: 430px; overflow: auto; padding-right: 4px; }
.alert-card { border: 1px solid var(--line); border-left: 5px solid var(--red); border-radius: 8px; padding: 12px; display: grid; gap: 8px; background: #fff; }
.alert-card.in_attention { border-left-color: var(--amber); }
.alert-card.resolved { border-left-color: var(--green); }
.alert-card.false_alarm, .alert-card.cancelled { border-left-color: var(--muted); }
.alert-row { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.small { font-size: 12px; color: var(--muted); }
.status { font-size: 12px; font-weight: 800; border-radius: 999px; padding: 4px 8px; background: #eef5ff; color: var(--blue); white-space: nowrap; }
.card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

.lower-grid { display: grid; grid-template-columns: 1.4fr .8fr; gap: 18px; }
.user-admin-panel { display: grid; gap: 18px; }
.user-form { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0; }
.csv-import { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; margin: 10px 0 14px; align-items: stretch; }
textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; resize: vertical; font: inherit; }
.table-scroll { overflow: auto; max-height: 360px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--blue-dark); background: #f8fafc; position: sticky; top: 0; }
.logs-list { display: grid; gap: 10px; max-height: 360px; overflow: auto; }
.log-item { border-bottom: 1px solid var(--line); padding-bottom: 10px; display: grid; gap: 4px; }

@media (max-width: 1050px) {
  .login-card, .dashboard-grid, .lower-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
  .app-shell { padding: 10px; }
  .topbar, .panel-head, .top-actions { align-items: stretch; flex-direction: column; }
  .stats, .filters { grid-template-columns: 1fr; }
  .user-form, .csv-import { grid-template-columns: 1fr; }
  #map, .map-wrap { min-height: 430px; }
}

.brand-title { color: var(--blue-dark); font-size: 13px; font-weight: 900; line-height: 1.1; }
.brand-lockup > div { display: grid; gap: 1px; }
.brand-lockup h1 { font-size: 22px; line-height: 1.1; }
.map-fullscreen-button { position: absolute; top: 12px; right: 12px; z-index: 600; background: white; color: var(--blue); border: 1px solid var(--line); box-shadow: 0 8px 22px rgba(15,76,129,.16); }
.map-wrap.map-fullscreen { position: fixed; inset: 14px; z-index: 2000; min-height: auto; border-radius: 8px; box-shadow: 0 24px 80px rgba(0,0,0,.28); }
.map-wrap.map-fullscreen #map { min-height: calc(100vh - 28px); }
.modal-panel::backdrop { background: rgba(15, 32, 51, .42); }
.modal-card { width: min(520px, 92vw); display: grid; gap: 14px; padding: 18px; background: white; border-radius: 8px; border: 1px solid var(--line); }
.modules-list { display: grid; gap: 10px; margin-top: 12px; }
.module-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 12px; background: #fff; }
.module-card input[type="text"], .module-card input:not([type]) { margin-top: 8px; }
.switch-row { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; color: var(--blue-dark); }
.switch-row input { width: auto; }
.lower-grid { grid-template-columns: 1fr; }
@media (max-width: 640px) {
  .brand-lockup h1 { font-size: 18px; }
  .module-card { grid-template-columns: 1fr; }
}
.dashboard-view { display: grid; gap: 18px; }
.profile-menu { position: relative; display: inline-flex; justify-content: flex-end; }
.profile-button { display: grid; place-items: center; width: 40px; height: 40px; min-width: 40px; min-height: 40px; padding: 0; border-radius: 50%; background: #eef5ff; color: var(--blue); border: 1px solid #c9d8e8; box-shadow: 0 8px 20px rgba(15, 76, 129, .12); cursor: pointer; }
.profile-button:hover { filter: none; background: #e1edf9; border-color: #adc4db; transform: translateY(-1px); }
.profile-button:focus-visible { outline: 3px solid rgba(15, 76, 129, .22); outline-offset: 2px; }
.profile-avatar { display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; }
.profile-avatar svg { width: 22px; height: 22px; fill: currentColor; }
.profile-name { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.profile-dropdown { position: absolute; top: calc(100% + 10px); right: 0; z-index: 1200; width: min(310px, calc(100vw - 36px)); display: grid; gap: 4px; padding: 10px; background: white; border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 18px 45px rgba(15, 32, 51, .18); }
.profile-summary { display: grid; gap: 3px; padding: 10px 12px 8px; }
.profile-summary strong { color: var(--blue-dark); font-size: 14px; line-height: 1.25; }
.profile-summary span { color: var(--muted); font-size: 12px; font-weight: 800; }
.profile-dropdown button { width: 100%; text-align: left; justify-content: flex-start; background: white; color: var(--blue-dark); border: 0; border-radius: 6px; padding: 10px 12px; }
.profile-dropdown button:hover, .profile-dropdown button.active { background: #eef5ff; color: var(--blue); filter: none; }
.profile-dropdown #logoutButton { color: var(--red); }
.profile-dropdown #soundToggleButton, .profile-dropdown #soundMuteButton, .profile-dropdown #adminSirenTestButton { color: var(--blue); }
.menu-divider { display: block; height: 1px; margin: 4px 0; background: var(--line); }
.about-panel { max-width: 760px; gap: 12px; }
.about-panel h3 { margin: 0; color: var(--blue-dark); font-size: 24px; }

@media (max-width: 640px) {
  .top-actions { align-items: flex-end; }
  .profile-menu { width: auto; align-self: flex-end; }
  .profile-button { width: 40px; height: 40px; }
  .profile-dropdown { right: 0; width: min(310px, calc(100vw - 20px)); }
}
.users-admin-card { display: grid; gap: 14px; }
.users-head { align-items: flex-start; }
.users-toolbar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.users-search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; }
.users-filters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; padding: 12px; background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; }
.professional-user-form { grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 12px; background: #fbfdff; border: 1px solid var(--line); border-radius: 8px; }
.users-filter-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
.csv-details { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff; }
.csv-details summary { cursor: pointer; color: var(--blue-dark); font-weight: 800; }
.users-table-scroll { max-height: 520px; }
.users-table th:last-child, .users-table td:last-child { text-align: right; min-width: 132px; }
.user-row-actions { display: inline-flex; gap: 6px; justify-content: flex-end; }
.icon-button { width: 32px; height: 32px; display: inline-grid; place-items: center; padding: 0; border-radius: 8px; background: #eef5ff; color: var(--blue); border: 1px solid #d7e4f2; font-weight: 900; }
.icon-button:hover { background: #e1edf9; filter: none; }
.danger-icon { color: var(--red); background: #fff5f5; border-color: #f2b8b5; }
.user-status-inactive { background: #f8fafc; color: var(--muted); }
.users-pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.users-pagination div { display: flex; gap: 8px; }
.edit-user-card { width: min(680px, 94vw); grid-template-columns: repeat(2, minmax(0, 1fr)); }
.edit-user-card .alert-row, .edit-user-card button[type="submit"], .edit-user-card #editUserMessage { grid-column: 1 / -1; }

@media (max-width: 820px) {
  .users-head, .users-toolbar, .users-pagination { align-items: stretch; flex-direction: column; }
  .users-search-row, .users-filters, .professional-user-form, .edit-user-card, .create-user-card { grid-template-columns: 1fr; }
  .users-filter-actions { flex-direction: column; }
  .users-toolbar { justify-content: stretch; }
  .users-toolbar button { width: 100%; }
}


/* Ajuste encabezado institucional SofiaShield */
.brand-title {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  color: #003b7a !important;
  line-height: 1.15 !important;
}

.brand-subtitle {
  font-size: 1.25rem !important;
  font-weight: 700 !important;
  line-height: 1.15 !important;
}

