:root {
  --bg: #fff7ed;
  --surface: #ffffff;
  --text: #1c1917;
  --text-muted: #78716c;
  --border: #fed7aa;
  --primary: #ea580c;
  --primary-hover: #c2410c;
  --success: #15803d;
  --danger: #dc2626;
  --radius: 12px;
  --shadow: 0 4px 16px rgba(154, 52, 18, 0.08);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* =========================================================
   VENTANA DE BIENVENIDA CON LOS MÓDULOS Y ESCUDO
   ========================================================= */
.welcome-screen {
  min-height: calc(100dvh - 54px);
  background: linear-gradient(180deg, #fff7ed 0%, #ffedd5 100%);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 24px;
  padding: 28px 18px 32px;
}

.welcome-blank-canvas {
  width: 100%;
  max-width: 960px;
}

.welcome-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
}

.welcome-crest-wrap {
  background: #ffffff;
  border: 2px solid #fdba74;
  border-radius: 18px;
  box-shadow: 0 10px 26px rgba(194, 65, 12, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px 20px;
}

.welcome-crest-img {
  width: auto;
  height: 155px;
  max-width: 220px;
  object-fit: contain;
  display: block;
}

.welcome-brand-title {
  margin: 6px 0 0;
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 800;
  color: #7c2d12;
  letter-spacing: -0.01em;
}

.welcome-brand-subtitle {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: #c2410c;
}

.welcome-modules-section {
  width: 100%;
  max-width: 980px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.welcome-modules-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
}

.welcome-module-card {
  appearance: none;
  border: 1px solid #e2e8f0;
  border-top: 5px solid var(--primary);
  border-radius: 16px;
  background: #ffffff;
  padding: 26px 22px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.welcome-module-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
}

.welcome-module-card:active {
  transform: translateY(-1px);
}

.welcome-module-card.card-apoyos {
  border-top-color: #ea580c;
}

.welcome-module-card.card-obras {
  border-top-color: #c2410c;
}

.welcome-module-card.card-dependencias {
  border-top-color: #d97706;
}

.welcome-module-card.card-panel-dependencias {
  border-top-color: #9a3412;
}

.welcome-module-card.card-configuracion {
  border-top-color: #7c2d12;
}

.welcome-module-icon {
  font-size: 32px;
  line-height: 1;
}

.welcome-module-name {
  font-size: 19px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}

.welcome-module-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
  flex: 1;
}

.welcome-module-cta {
  margin-top: 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.welcome-module-card.card-apoyos .welcome-module-cta { color: #ea580c; }
.welcome-module-card.card-obras .welcome-module-cta { color: #c2410c; }
.welcome-module-card.card-dependencias .welcome-module-cta { color: #d97706; }
.welcome-module-card.card-panel-dependencias .welcome-module-cta { color: #9a3412; }
.welcome-module-card.card-configuracion .welcome-module-cta { color: #7c2d12; }

/* Módulo de Configuración */
.config-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: start;
}

.cfg-full-span {
  grid-column: 1 / -1;
}

.cfg-pass-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px 14px;
}

.cfg-help-text {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.cfg-danger-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
}

.cfg-user-item {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff7ed;
}

.cfg-user-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 13px;
}

@media (max-width: 860px) {
  .config-grid {
    grid-template-columns: 1fr;
  }
}

/* Tarjetas de las 14 dependencias */
.dep-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.dep-card-btn {
  appearance: none;
  border: 1px solid var(--border);
  border-left: 5px solid #ea580c;
  border-radius: 12px;
  background: #fff7ed;
  padding: 16px;
  text-align: left;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.15s, box-shadow 0.15s, background-color 0.15s;
}

.dep-card-btn:hover {
  transform: translateY(-2px);
  background: #ffffff;
  box-shadow: 0 8px 18px rgba(194, 65, 12, 0.12);
}

.dep-card-name {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}

.dep-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.dep-card-icon {
  font-size: 26px;
  line-height: 1;
  flex-shrink: 0;
}

.badge-redirect {
  background: #ffedd5;
  color: #9a3412;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.dep-card-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 12px;
}

.dep-pill-total {
  background: #ffedd5;
  color: #9a3412;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
}

.dep-pill-pending {
  background: #fef3c7;
  color: #92400e;
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 700;
}

.dep-detail-topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.dep-detail-title {
  margin: 0;
  font-size: 21px;
  font-weight: 700;
  color: var(--text);
}

/* Modal de contraseña */
.password-modal {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.password-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}

.password-modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 400px;
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.25);
}

.password-modal-header {
  background: var(--primary);
  color: #ffffff;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.password-modal-title {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.password-modal-close {
  border: none;
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
}

.password-modal-body {
  padding: 18px;
}

.password-modal-hint {
  margin: 0 0 4px;
  font-size: 13px;
  color: var(--text-muted);
}

.password-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

@media (max-width: 760px) {
  .welcome-modules-grid {
    grid-template-columns: 1fr;
  }

  .welcome-blank-canvas {
    min-height: 40px;
  }
}

.login-form {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.password-input-group {
  display: flex;
  align-items: center;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  background: #ffffff;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.password-input-group:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
}

.password-input {
  flex: 1;
  border: none;
  outline: none;
  padding: 13px 14px;
  font-size: 16px;
  background: transparent;
  color: var(--text);
}

.icon-btn {
  border: none;
  background: transparent;
  padding: 0 14px;
  height: 44px;
  cursor: pointer;
  font-size: 16px;
  color: var(--text-muted);
}

.btn-enter {
  width: 100%;
  padding: 13px 16px;
  font-size: 15px;
}

.login-error,
.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

.login-error {
  text-align: center;
}

.btn-install {
  border: none;
  background: transparent;
  color: var(--primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  padding: 6px 10px;
}

/* =========================================================
   BOTONES
   ========================================================= */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.18s, border-color 0.18s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 13px;
  border-radius: 8px;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: #e2e8f0;
  color: var(--text);
}

.btn-secondary:hover {
  background: #cbd5e1;
}

.btn-outline-light {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.35);
  color: #ffffff;
}

.btn-outline-light:hover {
  background: rgba(255, 255, 255, 0.24);
}

.btn-danger-ghost {
  background: transparent;
  color: var(--danger);
  border: 1px solid #fecaca;
  padding: 6px 10px;
  font-size: 12px;
}

.btn-danger-ghost:hover {
  background: #fef2f2;
}

.btn-block {
  width: 100%;
}

/* =========================================================
   SHELL DE MÓDULOS Y SUBMÓDULOS
   ========================================================= */
.module-shell {
  min-height: calc(100dvh - 54px);
  display: flex;
  flex-direction: column;
}

.module-header {
  background: var(--primary);
  color: #ffffff;
  padding: max(16px, env(safe-area-inset-top)) 20px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.12);
}

.module-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.module-header-icon {
  width: 58px;
  height: 58px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  line-height: 1;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.module-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.18);
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 5px;
}

.module-title {
  margin: 0;
  font-size: clamp(20px, 3vw, 26px);
  line-height: 1.2;
}

.module-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  opacity: 0.92;
}

.module-header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.module-content {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 18px 16px 40px;
  flex: 1;
}

.submodule-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.tab-btn {
  flex: 1 1 180px;
  padding: 13px 18px;
  border-radius: 12px;
  border: 2px solid #fdba74;
  background: #ffffff;
  color: #7c2d12;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s;
}

.tab-btn:hover {
  border-color: #ea580c;
  color: #ea580c;
}

.tab-btn.active {
  background: #ea580c;
  border-color: #ea580c;
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(234, 88, 12, 0.28);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.module-grid {
  display: grid;
  grid-template-columns: minmax(320px, 460px) 1fr;
  gap: 18px;
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.card-title {
  margin: 0 0 14px;
  font-size: 17px;
  font-weight: 700;
}

/* =========================================================
   FORMULARIOS Y CAMPOS DE FOTOGRAFÍA
   ========================================================= */
.data-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-section-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #c2410c;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
  color: #334155;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}

.field-counter {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.field-counter.valid {
  color: var(--success);
}

.data-form input,
.data-form select,
.data-form textarea,
.list-filters input,
.list-filters select,
.inline-form input,
.inline-edit-input {
  width: 100%;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #ffffff;
}

.data-form input:focus,
.data-form select:focus,
.data-form textarea:focus,
.list-filters input:focus,
.list-filters select:focus,
.inline-form input:focus,
.inline-edit-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.1);
}

.photo-field {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.photo-label {
  font-size: 13px;
  font-weight: 700;
  color: #1e293b;
}

.photo-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.photo-buttons .btn {
  flex: 1 1 140px;
}

.photo-preview-box {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  margin-top: 4px;
}

.photo-preview-box img {
  width: 100%;
  max-height: 180px;
  object-fit: contain;
  background: #e2e8f0;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
}

.resolution-box {
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 10px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.resolution-box .form-section-label {
  border-top: none;
  padding-top: 0;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 8px;
}

.checkbox-chip {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 9px 11px;
  border: 1px solid #fdba74;
  border-radius: 9px;
  background: #fff7ed;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  transition: border-color 0.15s, background-color 0.15s;
}

.checkbox-chip-top {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.checkbox-chip-qty-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #9a3412;
}

.checkbox-chip-qty-wrap .chip-qty-input {
  width: 78px;
  padding: 5px 8px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid #fb923c;
  border-radius: 7px;
  background: #ffffff;
}

.checkbox-chip:hover {
  border-color: #ea580c;
}

.checkbox-chip:has(input:checked) {
  background: #ffedd5;
  border-color: #ea580c;
  color: #9a3412;
}

.checkbox-chip input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  accent-color: #ea580c;
  cursor: pointer;
}

/* =========================================================
   LISTAS Y REGISTROS
   ========================================================= */
.list-header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.list-header .card-title {
  margin: 0;
}

.list-header-top {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.view-toggle {
  display: inline-flex;
  background: #ffedd5;
  padding: 3px;
  border-radius: 10px;
  gap: 4px;
}

.view-toggle-btn {
  border: none;
  background: transparent;
  color: #7c2d12;
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 0.15s, color 0.15s;
}

.view-toggle-btn.active {
  background: #ffffff;
  color: #ea580c;
  box-shadow: 0 1px 4px rgba(154, 52, 18, 0.15);
}

.records-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
}

.records-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 820px;
}

.records-table th,
.records-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.records-table th {
  background: #f8fafc;
  font-size: 12px;
  font-weight: 700;
  color: #334155;
  white-space: nowrap;
}

.records-table tbody tr:hover {
  background: #fff7ed;
}

.dep-record-row {
  cursor: pointer;
}

/* Modal Ficha Completa del Oficio */
.detail-modal {
  position: fixed;
  inset: 0;
  z-index: 950;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.detail-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.65);
  backdrop-filter: blur(2px);
}

.detail-modal-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  background: #ffffff;
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.28);
}

.detail-modal-header {
  background: #9a3412;
  color: #ffffff;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-modal-kicker {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.85;
}

.detail-modal-title {
  margin: 2px 0 0;
  font-size: 20px;
  font-weight: 800;
}

.detail-modal-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-modal-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.detail-badges-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.detail-section-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #c2410c;
  border-bottom: 1px solid var(--border);
  padding-bottom: 5px;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 10px 16px;
}

.detail-field {
  background: #fff7ed;
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
}

.detail-field-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-bottom: 2px;
}

.detail-field-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  word-break: break-word;
}

.detail-asunto-box {
  background: #fff7ed;
  border: 1px solid #fdba74;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
}

.detail-photos-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.detail-photo-card {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  background: #fff7ed;
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  text-align: center;
}

.detail-photo-card img {
  width: 100%;
  height: 135px;
  object-fit: cover;
  border-radius: 7px;
  background: #ffffff;
}

.detail-photo-card span {
  font-size: 12px;
  font-weight: 700;
  color: #9a3412;
}

.table-photo-links {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.table-photo-btn {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: #1d4ed8;
  border-radius: 6px;
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
}

.table-photo-btn:hover {
  background: #e0e7ff;
}

.list-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.list-filters input {
  flex: 1 1 200px;
}

.list-filters select {
  flex: 0 1 180px;
}

.advanced-filters {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
  padding: 10px 12px;
  background: #fff7ed;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.filter-mini-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 135px;
}

.filter-mini-group label {
  font-size: 11px;
  font-weight: 700;
  color: #9a3412;
  text-transform: uppercase;
}

.filter-mini-group input,
.filter-mini-group select {
  width: 100%;
  border: 1px solid #fdba74;
  border-radius: 8px;
  padding: 7px 9px;
  font-size: 13px;
  background: #ffffff;
  color: var(--text);
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
}

.filter-pill {
  flex: 1 1 100px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.filter-pill:hover {
  border-color: #ea580c;
  color: #ea580c;
}

.filter-pill.active {
  background: #ea580c;
  border-color: #ea580c;
  color: #ffffff;
}

.form-submit-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.record-actions-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.records-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.empty-state {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-muted);
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  font-size: 14px;
}

.record-item {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.record-top {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.record-folio {
  font-family: Consolas, monospace;
  font-size: 12px;
  font-weight: 700;
  color: #9a3412;
  background: #ffedd5;
  padding: 3px 8px;
  border-radius: 6px;
}

.record-date {
  font-size: 12px;
  color: var(--text-muted);
}

.record-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 13px;
  color: #334155;
}

.record-notes {
  margin: 0;
  font-size: 13px;
  color: #475569;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.record-thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.thumb-btn {
  border: 1px solid #cbd5e1;
  background: #ffffff;
  border-radius: 8px;
  padding: 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  width: 96px;
}

.thumb-btn img {
  width: 86px;
  height: 58px;
  object-fit: cover;
  border-radius: 5px;
}

.thumb-btn span {
  font-size: 11px;
  font-weight: 600;
  color: #334155;
}

.record-resolution-editor {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

.record-resolution-editor .inline-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1 1 130px;
}

.record-resolution-editor label {
  font-size: 11px;
  font-weight: 700;
  color: #475569;
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid var(--border);
}

.badge-yes {
  background: #dcfce7;
  color: #166534;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge-no {
  background: #fef3c7;
  color: #92400e;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.status-select {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  font-weight: 600;
  background: #ffffff;
}

.priority-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
}

.priority-Alta { background: #fee2e2; color: #b91c1c; }
.priority-Media { background: #fef3c7; color: #b45309; }
.priority-Baja { background: #dcfce7; color: #15803d; }

/* =========================================================
   DEPENDENCIAS DE GOBIERNO
   ========================================================= */
.agencies-card {
  margin-bottom: 18px;
}

.inline-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 10px;
}

.agencies-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.agency-tile {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  background: #f8fafc;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
}

.agency-name { margin: 0; font-size: 15px; font-weight: 700; }
.agency-area { margin: 4px 0 0; font-size: 12px; color: var(--text-muted); }
.agency-phone { margin: 6px 0 0; font-size: 12px; color: #334155; font-weight: 600; }

.agency-link {
  width: 100%;
  text-decoration: none;
  text-align: center;
  padding: 8px 10px;
  font-size: 13px;
}

/* =========================================================
   MODAL DE IMAGEN
   ========================================================= */
.image-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.image-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.78);
}

.image-modal-content {
  position: relative;
  z-index: 1;
  background: #ffffff;
  border-radius: 12px;
  max-width: 92vw;
  max-height: 90vh;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.image-modal-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 14px;
}

.image-modal-content img {
  max-width: 86vw;
  max-height: 76vh;
  object-fit: contain;
  border-radius: 8px;
}

/* =========================================================
   RESPONSIVE (ANDROID / MÓVIL / TABLET)
   ========================================================= */
@media (max-width: 920px) {
  .module-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 540px) {
  .form-row {
    grid-template-columns: 1fr;
  }

  .module-header {
    padding: max(14px, env(safe-area-inset-top)) 14px 14px;
  }

  .module-content {
    padding: 14px 12px 28px;
  }

  .card {
    padding: 14px;
  }
}

/* =========================================================
   PIE DE PÁGINA GLOBAL (TODAS LAS PANTALLAS)
   ========================================================= */
.app-footer {
  background: #7c2d12;
  color: #ffedd5;
  padding: 10px 16px max(10px, env(safe-area-inset-bottom));
  border-top: 2px solid #ea580c;
}

.app-footer-inner {
  max-width: 1320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.app-footer-icon {
  height: 36px;
  width: 36px;
  border-radius: 8px;
  border: 1px solid #fb923c;
  object-fit: cover;
}

.app-footer-text {
  font-size: 13px;
  letter-spacing: 0.01em;
}

.app-footer-text a {
  color: #fed7aa;
  font-weight: 700;
  text-decoration: none;
}

.app-footer-text a:hover {
  text-decoration: underline;
}

[hidden] {
  display: none !important;
}
