:root {
  --bg: #f4f0e8;
  --panel: #fffdfa;
  --ink: #1d1b18;
  --muted: #6f665b;
  --line: #ded4c4;
  --brand: #7d1018;
  --brand-dark: #4b080d;
  --brand-soft: #f4e5e2;
  --accent: #b58a32;
  --accent-dark: #8a6723;
  --accent-soft: #f8ecd0;
  --charcoal: #202020;
  --success: #276345;
  --success-dark: #17402b;
  --danger: #7d1018;
  --shadow: 0 14px 34px rgba(29, 27, 24, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(rgba(250, 247, 239, 0.9), rgba(250, 247, 239, 0.94)),
    url("/fondo-bomberos.jpg?v=20260606") center top / cover fixed,
    var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Roboto", Arial, Helvetica, sans-serif;
}

.app {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.home-body {
  min-height: 100vh;
  background:
    linear-gradient(rgba(28, 19, 17, 0.34), rgba(250, 247, 239, 0.84)),
    url("/fondo-bomberos.jpg?v=20260606") center center / cover fixed,
    var(--bg);
}

.home-app {
  width: min(1120px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  align-items: center;
}

.home-shell {
  padding: 28px;
  border: 1px solid rgba(222, 212, 196, 0.72);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.92);
  box-shadow: 0 24px 60px rgba(29, 27, 24, 0.22);
  backdrop-filter: blur(4px);
}

.login-app {
  width: min(460px, calc(100% - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 32px 0;
  display: grid;
  align-items: center;
}

.login-shell {
  display: grid;
  gap: 22px;
  padding: 26px;
  border: 1px solid rgba(222, 212, 196, 0.72);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.94);
  box-shadow: 0 24px 60px rgba(29, 27, 24, 0.24);
  backdrop-filter: blur(4px);
}

.login-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 18px;
  border-bottom: 3px solid var(--accent);
}

.login-header .home-logo-left {
  width: min(205px, 62%);
}

.login-header .home-logo-right {
  width: 96px;
  height: 96px;
}

.login-title {
  display: grid;
  gap: 6px;
  text-align: center;
}

.login-title p,
.login-title h1 {
  margin: 0;
}

.login-title h1 {
  color: var(--brand-dark);
  font-size: 30px;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: #44382d;
  font-weight: 800;
}

.login-form input,
.login-form select {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

.login-form button {
  min-height: 44px;
  margin-top: 4px;
  font-weight: 900;
}

.login-message {
  min-height: 20px;
  margin: 0;
  color: var(--danger);
  font-weight: 800;
  text-align: center;
}

.home-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 18px;
}

.logout-button {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fffdfa;
  color: var(--brand-dark);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.logout-button:hover {
  border-color: var(--accent);
  color: var(--brand);
}

.tools-logout {
  width: 100%;
  margin-top: 0;
}

.home-header {
  display: grid;
  grid-template-columns: 230px 1fr 150px;
  gap: 22px;
  align-items: center;
  padding-bottom: 24px;
  border-bottom: 3px solid var(--accent);
}

.home-title {
  display: grid;
  gap: 8px;
  text-align: center;
}

.home-title p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
}

.home-title .home-welcome {
  color: var(--brand);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: uppercase;
}

.home-logo {
  display: block;
}

.home-logo-left {
  width: min(220px, 100%);
  height: auto;
  object-fit: contain;
  mix-blend-mode: multiply;
}

.home-logo-right {
  justify-self: end;
  width: 140px;
  height: 140px;
  object-fit: cover;
  border: 3px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 8px 18px rgba(22, 22, 22, 0.18);
}

.module-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 24px;
}

.module-card {
  min-height: 235px;
  display: grid;
  align-content: space-between;
  justify-items: center;
  gap: 22px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 253, 250, 0.94);
  box-shadow: var(--shadow);
  text-align: center;
}

.module-card-active {
  border-top: 5px solid var(--brand);
}

.module-card-disabled {
  border-top: 5px solid #8f8a82;
  opacity: 0.76;
}

.module-kicker {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.module-card h2 {
  margin-top: 8px;
  color: var(--brand-dark);
  font-size: 28px;
}

.module-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.module-button {
  width: fit-content;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 16px;
  border: 0;
  border-radius: 6px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  cursor: pointer;
}

.module-button:hover {
  background: var(--brand-dark);
}

.module-button:disabled {
  background: #8f8a82;
  color: #fff;
  cursor: not-allowed;
}

.hidden,
.eventos-hidden-fields {
  display: none !important;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(29, 27, 24, 0.48);
}

.modal-panel {
  width: min(720px, 100%);
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(29, 27, 24, 0.28);
}

.home-legal {
  margin-top: 24px;
}

.topbar {
  display: grid;
  grid-template-columns: 240px 1fr 150px;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-bottom: 20px;
  padding: 14px 0 20px;
  border-bottom: 3px solid var(--accent);
}

.header-copy {
  display: grid;
  justify-items: center;
  gap: 6px;
  min-width: 0;
  text-align: center;
}

.header-logo {
  display: block;
  object-fit: cover;
}

.header-logo-left {
  width: min(220px, 100%);
  height: auto;
  object-fit: contain;
  mix-blend-mode: multiply;
  filter: drop-shadow(0 8px 16px rgba(29, 27, 24, 0.08));
}

.header-logo-right {
  justify-self: end;
  width: 140px;
  height: 140px;
  border: 3px solid var(--accent);
  border-radius: 50%;
  box-shadow: 0 8px 18px rgba(22, 22, 22, 0.18);
}

.eyebrow {
  margin: 0;
  color: var(--accent-dark);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.15;
  color: var(--brand-dark);
  font-weight: 800;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
}

.section-title {
  margin: 10px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--brand);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.status {
  min-width: 220px;
  padding: 10px 12px;
  border-left: 4px solid var(--success);
  background: #edf5ef;
  color: var(--success-dark);
  font-size: 14px;
  font-weight: 700;
  text-align: left;
}

.workspace {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 18px;
  align-items: start;
}

.panel {
  background: rgba(255, 253, 250, 0.94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(2px);
}

.tools,
.capture,
.table-panel {
  padding: 18px;
}

.tools {
  display: grid;
  gap: 12px;
}

.tools h2 + label,
.tools h2 + button {
  margin-top: 4px;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

form {
  display: grid;
  gap: 14px;
}

.form-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.form-head span {
  color: var(--muted);
  font-size: 14px;
}

.grid {
  display: grid;
  gap: 14px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.grid.four {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.fixed-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 236, 208, 0.45);
}

.fixed-summary input[readonly] {
  border-color: #d2c2aa;
  background: rgba(255, 253, 250, 0.78);
  color: var(--brand-dark);
  font-weight: 800;
}

.map-actions {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

label {
  display: grid;
  gap: 6px;
  color: #3a332d;
  font-size: 14px;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
  font: inherit;
  font-weight: 400;
  background: rgba(255, 254, 250, 0.98);
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  outline: 3px solid rgba(198, 154, 46, 0.25);
  border-color: var(--accent);
}

.form-tabs {
  display: inline-flex;
  width: fit-content;
  max-width: 100%;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8f1e4;
}

.tab-button {
  background: transparent;
  color: var(--ink);
  padding: 8px 14px;
}

.tab-button:hover {
  background: var(--accent-soft);
}

.tab-button.active {
  background: var(--brand-dark);
  color: #fff;
}

.form-page {
  display: none;
  gap: 14px;
}

.form-page.active {
  display: grid;
}

button,
.file-label,
.button-link {
  border: 0;
  border-radius: 6px;
  padding: 10px 12px;
  background: var(--brand);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-align: center;
  text-decoration: none;
}

button:hover,
.file-label:hover,
.button-link:hover {
  background: var(--brand-dark);
}

button.secondary,
.file-label,
.secondary-link {
  background: var(--accent-soft);
  color: var(--ink);
  border: 1px solid #dfc37b;
}

button.secondary:hover,
.file-label:hover,
.secondary-link:hover {
  background: #efd977;
}

.mobile-app {
  width: min(760px, calc(100% - 20px));
}

.mobile-topbar {
  grid-template-columns: 96px 1fr 96px;
  gap: 10px;
}

.mobile-topbar .header-logo-left {
  width: 96px;
}

.mobile-topbar .header-logo-right {
  width: 86px;
  height: 86px;
}

.mobile-search,
.mobile-supervision {
  display: grid;
  gap: 14px;
}

.mobile-actions {
  position: sticky;
  bottom: 0;
  z-index: 2;
  margin: 0 -18px -18px;
  padding: 12px 18px;
  border-top: 1px solid var(--line);
  background: rgba(255, 253, 250, 0.96);
  backdrop-filter: blur(6px);
}

.signature-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.signature-panel {
  display: grid;
  gap: 8px;
}

.signature-canvas {
  width: 100%;
  height: 150px;
  display: block;
  border: 2px dashed var(--accent);
  border-radius: 6px;
  background: rgba(255, 254, 250, 0.98);
  box-shadow: inset 0 0 0 1px rgba(125, 16, 24, 0.06);
  touch-action: none;
  pointer-events: none;
}

.signature-modal-panel {
  width: min(960px, 100%);
}

.signature-modal-canvas {
  width: 100%;
  height: min(52vh, 430px);
  min-height: 280px;
  display: block;
  border: 2px solid var(--brand);
  border-radius: 6px;
  background: #fff;
  touch-action: none;
  box-shadow: inset 0 0 0 1px rgba(125, 16, 24, 0.08);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 4px;
}

.document-actions {
  display: grid;
  grid-template-columns: minmax(120px, max-content) repeat(3, minmax(150px, max-content));
  align-items: center;
}

.document-actions button {
  width: 100%;
}

.eventos-document-actions {
  grid-template-columns: minmax(120px, max-content) repeat(2, minmax(180px, max-content));
  align-items: start;
}

.document-action-stack {
  display: grid;
  gap: 8px;
}

.time-segment {
  display: grid;
  grid-template-columns: minmax(64px, 1fr) auto minmax(64px, 1fr);
  align-items: center;
  gap: 8px;
}

.time-segment select {
  width: 100%;
}

.time-segment-separator {
  font-weight: 800;
  color: var(--ink);
}

input.segmented-time-source {
  display: none;
}

.observation-panel {
  display: grid;
  gap: 10px;
}

.observation-panel .section-title {
  margin-top: 0;
}

.observation-list {
  display: grid;
  gap: 10px;
}

.observation-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  align-items: start;
  gap: 8px;
}

.observation-number {
  display: grid;
  place-items: center;
  width: 32px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--brand-dark);
  font-weight: 800;
}

.observation-item textarea {
  min-height: 40px;
}

#observaciones {
  display: none;
}

#archivoRespaldo {
  display: none;
}

.small {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.table-panel {
  margin-top: 18px;
}

.app-legal {
  margin: 18px 0 0;
  padding: 12px 16px;
  color: #5d5047;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
  border-top: 1px solid rgba(125, 16, 24, 0.22);
}

.app-legal strong {
  color: var(--brand-dark);
  font-weight: 700;
}

.table-wrap {
  overflow-x: auto;
  margin-top: 14px;
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  flex-wrap: wrap;
}

.pagination-controls span {
  color: var(--muted);
  font-weight: 700;
  min-width: 120px;
  text-align: center;
}

.pagination-controls button {
  padding: 8px 12px;
}

.pagination-controls button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  font-size: 14px;
  vertical-align: top;
}

th {
  color: #44382d;
  background: #f8f1e4;
}

td button {
  padding: 7px 9px;
  font-size: 13px;
}

.supervision-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 118px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.supervision-badge.supervised {
  background: #e2f5e8;
  color: #155c32;
  border: 1px solid #8dd0a2;
}

.supervision-badge.pending {
  background: #fde7e7;
  color: #9a161d;
  border: 1px solid #ec9b9b;
}

.danger {
  background: var(--danger);
}

.danger:hover {
  background: var(--brand-dark);
}

@media (max-width: 820px) {
  .app {
    width: min(100% - 20px, 1180px);
    padding-top: 18px;
  }

  .topbar,
  .workspace,
  .grid.two,
  .grid.three,
  .grid.four,
  .fixed-summary,
  .document-actions {
    grid-template-columns: 1fr;
    display: grid;
  }

  .document-actions span {
    display: none;
  }

  .status {
    min-width: 0;
    width: 100%;
  }

  .topbar {
    grid-template-columns: auto 1fr auto;
    gap: 10px;
  }

  .header-logo-left {
    width: 112px;
  }

  .header-logo-right {
    width: 82px;
    height: 82px;
  }

  .mobile-topbar {
    grid-template-columns: 72px 1fr 72px;
  }

  .mobile-topbar .header-logo-left {
    width: 72px;
  }

  .mobile-topbar .header-logo-right {
    width: 64px;
    height: 64px;
  }

  .observation-item {
    grid-template-columns: 32px 1fr;
  }

  .observation-item button {
    grid-column: 2;
  }

  .signature-grid {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 24px;
  }

  .home-app {
    width: min(100% - 20px, 1120px);
    padding: 18px 0;
    align-items: start;
  }

  .home-shell {
    padding: 18px;
  }

  .home-header,
  .module-grid {
    grid-template-columns: 1fr;
  }

  .home-header {
    justify-items: center;
    gap: 14px;
  }

  .home-logo-left {
    width: 180px;
  }

  .home-logo-right {
    justify-self: center;
    width: 110px;
    height: 110px;
  }

  .module-card {
    min-height: 205px;
  }

  .module-card h2 {
    font-size: 24px;
  }
}
