: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 {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
  background: #eef3f8;
}

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

.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;
}

.toast {
  border-radius: 8px;
}

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

  .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));
  }
}

@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;
  }
}
