:root {
  --bg: #f6f7fb;
  --surface: #ffffff;
  --ink: #18212f;
  --muted: #697386;
  --line: #dbe1ea;
  --teal: #0f766e;
  --blue: #1d4ed8;
  --amber: #b45309;
  --rose: #be123c;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.login-body {
  position: relative;
  min-height: 100vh;
  padding: 96px 18px 28px;
  background: #eef3f8;
}

.login-topbar {
  position: fixed;
  top: 16px;
  left: 16px;
  right: 16px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid rgba(219, 225, 234, 0.86);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.1);
  backdrop-filter: blur(8px);
}

.login-wrap {
  width: min(100%, 430px);
}

.public-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  width: min(100%, 1480px);
  margin: 0 auto;
}

.public-dashboard-main {
  min-width: 0;
}

.public-dashboard-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.public-dashboard-heading h1 {
  margin: 0;
  font-size: clamp(1.8rem, 3vw, 3rem);
  line-height: 1.05;
}

.public-dashboard-heading p:last-child {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
}

.public-login-panel {
  position: sticky;
  top: 96px;
  align-self: start;
}

.login-panel {
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.12);
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 24px;
  height: 100vh;
  padding: 24px 18px;
  background: #122033;
  color: #f8fafc;
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: #16a34a;
  color: #fff;
  font-weight: 800;
}

.brand-block small {
  display: block;
  color: #b6c2d3;
}

.sidebar .nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  border-radius: 8px;
  color: #dbe7f6;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
  background: #223653;
  color: #fff;
}

.sidebar svg,
.btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.sync-status {
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  color: #c9d6e8;
  font-size: 0.85rem;
}

.main-content {
  min-width: 0;
  padding: 28px;
}

.topbar,
.module-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
}

.topbar-actions,
.report-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.user-pill {
  display: grid;
  grid-template-columns: 18px auto;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.user-pill svg {
  grid-row: 1 / span 2;
  width: 18px;
  height: 18px;
  color: var(--teal);
}

.user-pill span,
.user-pill small {
  line-height: 1.05;
}

.user-pill span {
  font-size: 0.86rem;
  font-weight: 700;
}

.user-pill small {
  color: var(--muted);
  font-size: 0.72rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border-radius: 8px;
  white-space: nowrap;
}

.eyebrow {
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.module {
  display: none;
}

.module.active {
  display: block;
}

.kpi-grid,
.content-grid {
  display: grid;
  gap: 18px;
}

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

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

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

.compact {
  gap: 12px;
}

.kpi-card,
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.05);
}

.kpi-card {
  position: relative;
  min-height: 142px;
  padding: 20px;
  overflow: hidden;
}

.kpi-card::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 6px;
  content: "";
}

.kpi-card span,
.kpi-card small,
.panel-title span {
  color: var(--muted);
}

.kpi-card strong {
  display: block;
  margin: 12px 0 4px;
  font-size: clamp(2rem, 4vw, 2.75rem);
  line-height: 1;
}

.accent-teal::before {
  background: var(--teal);
}

.accent-blue::before {
  background: var(--blue);
}

.accent-amber::before {
  background: var(--amber);
}

.accent-rose::before {
  background: var(--rose);
}

.panel {
  min-width: 0;
  padding: 18px;
}

.panel-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-title h2,
.module-heading h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.25;
}

.module-heading h2 {
  font-size: 1.45rem;
}

.form-label {
  margin-bottom: 5px;
  color: #344054;
  font-size: 0.86rem;
  font-weight: 700;
}

.form-control,
.form-select {
  min-height: 40px;
  border-radius: 8px;
}

textarea.form-control {
  min-height: 82px;
}

.check-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f9fafb;
}

.check-grid label {
  display: flex;
  gap: 7px;
  align-items: center;
  min-width: 0;
  margin: 0;
  color: #384454;
  font-size: 0.88rem;
}

.lookup-status {
  min-height: 24px;
  margin-top: 8px;
  padding: 6px 8px;
  border-radius: 8px;
  background: #f4f7fb;
  color: var(--muted);
  font-size: 0.82rem;
}

.lookup-status.found {
  background: #ecfdf3;
  color: #047857;
}

.lookup-status.missing {
  background: #fff7ed;
  color: #b45309;
}

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

.geo-toolbox {
  padding: 12px;
  border: 1px dashed #b7c4d6;
  border-radius: 8px;
  background: #f9fbff;
}

.scan-result:empty {
  display: none;
}

.scan-result {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.scan-result dl {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 6px 10px;
  margin: 0;
  font-size: 0.9rem;
}

.scan-result dt {
  color: var(--muted);
  font-weight: 700;
}

.scan-result dd {
  margin: 0;
}

.table {
  margin-bottom: 0;
}

.table thead th {
  color: #536173;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0;
}

.badge-soft {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef6ff;
  color: #1d4ed8;
  font-weight: 700;
}

.qr-box {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px dashed #b7c4d6;
  border-radius: 8px;
  background: #f9fbff;
}

.qr-render {
  display: inline-grid;
  place-items: center;
  overflow: hidden;
  background: #fff;
}

.qr-render-sm {
  width: 96px;
  height: 96px;
}

.qr-render-lg {
  width: 220px;
  height: 220px;
}

.qr-render canvas,
.qr-render img,
.qr-render svg {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.signature-pad {
  display: block;
  width: 100%;
  height: 180px;
  border: 1px dashed #97a6ba;
  border-radius: 8px;
  background: #fff;
  touch-action: none;
}

.evidence-preview {
  display: block;
  width: min(100%, 320px);
  max-height: 220px;
  object-fit: contain;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  background: #fff;
}

.queue-count {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: var(--muted);
}

.queue-count strong {
  color: var(--ink);
  font-size: 2.5rem;
}

.input-with-button .btn {
  min-width: 46px;
}

.admin-table-select {
  width: min(100%, 280px);
}

.admin-table th:last-child,
.admin-table td:last-child,
#tablaUsuarios th:last-child,
#tablaUsuarios td:last-child {
  width: 112px;
  text-align: right;
}

.admin-actions {
  display: inline-flex;
  justify-content: flex-end;
  gap: 6px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 8px;
}

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

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

.location-map {
  width: 100%;
  height: 320px;
  min-height: 260px;
  overflow: hidden;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  background: #eef2f7;
}

.map-layer-picker {
  display: flex;
  gap: 10px;
  max-width: calc(100vw - 64px);
  padding: 10px;
  border-radius: 10px;
  background: rgba(17, 24, 39, 0.78);
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.28);
  backdrop-filter: blur(5px);
}

.map-layer-card {
  width: 88px;
  min-height: 86px;
  padding: 6px;
  border: 2px solid transparent;
  border-radius: 8px;
  background: #fff;
  color: #172033;
  font-size: 0.76rem;
  font-weight: 700;
  line-height: 1.1;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease, box-shadow 0.15s ease;
}

.map-layer-card:hover,
.map-layer-card.active {
  border-color: #2563eb;
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.16);
  transform: translateY(-1px);
}

.layer-thumb {
  display: block;
  width: 100%;
  height: 50px;
  margin-bottom: 6px;
  border-radius: 6px;
  border: 1px solid #d9e0ea;
  background: #e8edf4;
}

.map-layer-card.map .layer-thumb {
  background:
    linear-gradient(135deg, transparent 42%, #9aa7b8 43%, #9aa7b8 48%, transparent 49%),
    linear-gradient(35deg, transparent 58%, #c2cad6 59%, #c2cad6 63%, transparent 64%),
    linear-gradient(90deg, #eef4fb 0 38%, #dbeafe 38% 43%, #eef4fb 43% 100%);
}

.map-layer-card.terrain .layer-thumb {
  background:
    radial-gradient(circle at 18% 24%, #f2f4e8 0 16%, transparent 17%),
    radial-gradient(circle at 52% 42%, #b9c39b 0 22%, transparent 23%),
    radial-gradient(circle at 78% 30%, #7d9466 0 18%, transparent 19%),
    repeating-linear-gradient(135deg, #87966d 0 3px, #d9dfc5 3px 8px);
}

.map-layer-card.satellite .layer-thumb {
  background:
    radial-gradient(circle at 22% 32%, #96b384 0 14%, transparent 15%),
    radial-gradient(circle at 70% 22%, #4f6f52 0 20%, transparent 21%),
    linear-gradient(135deg, #445d3f, #6f745d 44%, #a18c73 45% 60%, #506e5a 61%);
}

.geo-toolbox {
  display: grid;
  gap: 10px;
}

.toast {
  border-radius: 8px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 92px minmax(0, 1fr);
  }

  .sidebar .brand-block div,
  .sidebar .nav-link span {
    display: none;
  }

  .brand-block {
    justify-content: center;
  }

  .sidebar .nav-link {
    justify-content: center;
  }

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

  .public-dashboard {
    grid-template-columns: 1fr;
  }

  .public-login-panel {
    position: static;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
    padding: 12px;
  }

  .sidebar .nav {
    flex-direction: row !important;
    overflow-x: auto;
    padding-bottom: 2px;
  }

  .sidebar .nav-link {
    min-width: 48px;
  }

  .sync-status {
    display: none;
  }

  .main-content {
    padding: 18px;
  }

  .topbar,
  .module-heading,
  .panel-title {
    align-items: stretch;
    flex-direction: column;
  }

  .kpi-grid,
  .two-columns,
  .three-columns,
  .admin-form-grid {
    grid-template-columns: 1fr;
  }

  .login-body {
    padding: 92px 12px 18px;
  }

  .login-topbar {
    left: 10px;
    right: 10px;
  }

  .public-dashboard-heading {
    flex-direction: column;
  }
}
