:root {
  --navy: #28378b;
  --navy-900: #111b59;
  --orange: #f68623;
  --gold: #ffcf2f;
  --ice: #f3fbff;
  --cyan: #29b8c7;
  --green: #159447;
  --red: #c1121f;
  --ink: #102044;
  --muted: #5b6785;
  --line: #dbe5f6;
  --surface: #ffffff;
  --surface-soft: #f7faff;
  --shadow: 0 18px 45px rgba(18, 32, 72, 0.14);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--ice);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  min-height: 40px;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
}

body.auth-locked .app-shell {
  display: none;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 20px;
  background: #eef8ff;
}

.auth-screen-card {
  width: min(100%, 480px);
  overflow: hidden;
  border: 1px solid #cfddf3;
  border-top: 5px solid var(--gold);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 22px 55px rgba(18, 32, 72, 0.16);
}

.auth-screen-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 24px 28px 18px;
  border-bottom: 1px solid var(--line);
}

.auth-screen-brand img {
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  object-fit: contain;
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  background: #fff;
}

.auth-screen-brand p,
.auth-screen-brand strong {
  margin: 0;
}

.auth-screen-brand p {
  color: var(--navy);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.auth-screen-brand strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 1.1rem;
}

#authScreenPanel {
  padding: 26px 28px 28px;
}

.auth-screen-heading {
  margin-bottom: 22px;
}

.auth-screen-heading .eyebrow,
.auth-screen-heading h1,
.auth-screen-heading > p:last-child {
  margin: 0;
}

.auth-screen-heading h1 {
  margin-top: 5px;
  font-size: clamp(1.65rem, 5vw, 2rem);
  line-height: 1.15;
}

.auth-screen-heading > p:last-child {
  margin-top: 9px;
  color: var(--muted);
  line-height: 1.5;
}

.auth-form {
  display: grid;
  gap: 9px;
}

.auth-form > .field {
  margin-top: 5px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
}

.auth-form > input,
.password-field input {
  width: 100%;
  min-width: 0;
  min-height: 48px;
  padding: 11px 13px;
  border: 1px solid #cbd9ef;
  border-radius: var(--radius);
  color: var(--ink);
  background: #fff;
}

.auth-form > input::placeholder,
.password-field input::placeholder {
  color: #7b86a2;
}

.password-field {
  position: relative;
  min-width: 0;
}

.password-field input {
  padding-right: 92px;
}

.password-toggle {
  position: absolute;
  top: 5px;
  right: 5px;
  min-height: 38px;
  padding: 6px 10px;
  border: 0;
  border-radius: 6px;
  color: var(--navy);
  background: #edf2ff;
  font-weight: 800;
}

.auth-submit {
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
}

.button-spinner {
  display: inline-block;
  width: 15px;
  height: 15px;
  margin-right: 7px;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -2px;
  animation: app-loading-spin 0.8s linear infinite;
}

.auth-form-message {
  margin: 4px 0 0;
  padding: 9px 11px;
  border-left: 4px solid var(--cyan);
  border-radius: 6px;
  color: var(--ink);
  background: #eefbfc;
  font-size: 0.86rem;
  line-height: 1.4;
}

.auth-form-message.error {
  border-left-color: var(--red);
  color: #8e1220;
  background: #fff1f3;
}

.auth-secure-note {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-top: 20px;
  padding: 12px;
  border: 1px solid #d8e4f6;
  border-radius: var(--radius);
  color: var(--muted);
  background: var(--surface-soft);
}

.auth-secure-note > span {
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--green);
  font-weight: 900;
}

.auth-secure-note p,
.auth-secure-note strong,
.auth-secure-note small {
  margin: 0;
}

.auth-secure-note strong,
.auth-secure-note small {
  display: block;
}

.auth-secure-note strong {
  color: var(--ink);
  font-size: 0.86rem;
}

.auth-secure-note small {
  margin-top: 3px;
  line-height: 1.4;
}

.auth-screen-footer {
  padding: 13px 20px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 0.76rem;
  line-height: 1.4;
  text-align: center;
}

.auth-state-actions {
  align-items: stretch;
}

.auth-state-actions > button {
  flex: 1 1 160px;
}

.app-loading-gate {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: none;
  place-items: center;
  padding: 24px;
  background: #f3fbff;
}

.app-loading-gate.is-active {
  display: grid;
}

.app-loading-card {
  width: min(100%, 420px);
  display: grid;
  justify-items: center;
  gap: 14px;
  padding: 28px;
  border: 1px solid var(--line);
  border-top: 5px solid var(--gold);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  text-align: center;
}

.app-loading-card img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  border: 2px solid var(--gold);
  border-radius: var(--radius);
  background: #fff;
}

.app-loading-card h2,
.app-loading-card p {
  margin: 0;
}

.app-loading-card p {
  color: var(--muted);
  line-height: 1.5;
}

.app-loading-spinner {
  width: 34px;
  height: 34px;
  border: 4px solid #dfe8fb;
  border-top-color: var(--navy);
  border-radius: 50%;
  animation: app-loading-spin 0.8s linear infinite;
}

@keyframes app-loading-spin {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .app-loading-spinner {
    animation-duration: 1.8s;
  }
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1800;
  width: min(88vw, 320px);
  height: 100vh;
  overflow: auto;
  background: linear-gradient(180deg, var(--navy), var(--navy-900));
  color: #fff;
  padding: 16px 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  display: flex;
  flex-direction: column;
  gap: 12px;
  transform: translateX(-105%);
  transition: transform 0.2s ease;
}

.sidebar-close {
  position: sticky;
  top: 0;
  z-index: 2;
  align-self: flex-end;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  margin: 0 0 -40px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  font-size: 1.65rem;
  font-weight: 500;
  line-height: 1;
  box-shadow: 0 8px 20px rgba(5, 14, 48, 0.2);
  backdrop-filter: blur(8px);
}

.sidebar-close:hover,
.sidebar-close:focus-visible {
  background: #fff;
  color: var(--navy);
}

body.panel-open .sidebar {
  transform: translateX(0);
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1750;
  display: block;
  min-height: 0;
  border: 0;
  background: rgba(10, 18, 48, 0.48);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

body.panel-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}

body.panel-open {
  overflow: hidden;
}

.brand {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  align-items: center;
  padding: 6px 48px 12px 4px;
}

.brand img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  background: #fff;
  border-radius: 12px;
  border: 2px solid var(--gold);
}

.brand p,
.eyebrow {
  margin: 0;
  color: var(--gold);
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand h1 {
  margin: 2px 0 0;
  font-size: 1.15rem;
  line-height: 1.08;
}

.main-nav {
  display: grid;
  gap: 7px;
}

.nav-item,
.mobile-nav button {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.10);
  color: #fff;
  border-radius: var(--radius);
  padding: 10px 12px;
  text-align: left;
  font-weight: 750;
}

.nav-item.active,
.mobile-nav button.active {
  background: #fff;
  color: var(--navy);
}

.storage-card,
.auth-card,
.sidebar-card {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: var(--radius);
  padding: 10px;
  font-size: 0.86rem;
}

.storage-card.ok {
  border-color: rgba(46, 204, 113, 0.55);
}

.storage-card.warn {
  border-color: rgba(255, 207, 47, 0.7);
  background: rgba(255, 207, 47, 0.12);
}

.auth-card p,
.sidebar-card p {
  margin: 6px 0 0;
  line-height: 1.35;
}

.auth-card {
  display: grid;
  gap: 10px;
}

.auth-card .field {
  color: #eef4ff;
  gap: 4px;
}

.auth-card input {
  min-height: 38px;
  padding: 9px 10px;
  background: #eef4ff;
}

.auth-card .primary-button,
.auth-card .secondary-button {
  min-height: 38px;
  padding: 9px 10px;
}

.sidebar-card.compact {
  margin-top: auto;
}

.workspace {
  min-width: 0;
  position: relative;
}

body[data-active-view="map"] {
  overflow: hidden;
}

body[data-active-view="map"] .app-shell,
body[data-active-view="map"] .workspace,
body[data-active-view="map"] .map-view {
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

.view {
  display: none;
  min-height: 100vh;
}

.view.active {
  display: block;
}

.map-layout {
  height: 100vh;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  overflow: hidden;
}

body[data-active-view="map"] .map-layout {
  height: 100%;
  min-height: 0;
}

.map-auth-gate {
  display: none;
}

body.auth-locked .map-layout {
  display: none;
}

body.auth-locked .map-auth-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

body.auth-locked .map-auth-gate .empty-state {
  max-width: 520px;
  width: min(100%, 520px);
}

.map-stage {
  position: relative;
  min-width: 0;
  height: 100vh;
  min-height: 100vh;
}

body[data-active-view="map"] .map-stage {
  height: 100%;
  min-height: 0;
}

.map-tools {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 700;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.map-tools .secondary-button {
  min-height: 40px;
  padding: 9px 13px;
  border: 1px solid rgba(32, 55, 135, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--navy);
  box-shadow: 0 8px 22px rgba(16, 32, 68, 0.16);
  backdrop-filter: blur(8px);
}

.map-stage .leaflet-control-zoom {
  overflow: hidden;
  border: 1px solid rgba(32, 55, 135, 0.18);
  border-radius: 10px;
  box-shadow: 0 8px 22px rgba(16, 32, 68, 0.18);
}

.map-stage .leaflet-control-zoom a {
  width: 40px;
  height: 40px;
  line-height: 38px;
  border: 0;
  background: rgba(255, 255, 255, 0.96);
  color: var(--navy);
  font-size: 1.35rem;
}

.map-stage .leaflet-control-zoom a + a {
  border-top: 1px solid var(--line);
}

.map-stage .leaflet-bottom.leaflet-right .leaflet-control-zoom {
  margin-right: 14px;
  margin-bottom: 28px;
}

#coverageMap {
  width: 100%;
  height: 100%;
  min-height: 0;
}

.map-panel {
  border-left: 1px solid var(--line);
  background: rgba(247, 250, 255, 0.96);
  padding: 14px;
  overflow: auto;
  max-height: 100vh;
}

body.map-panel-collapsed .map-layout {
  grid-template-columns: minmax(0, 1fr);
}

body.map-panel-collapsed .map-panel {
  display: none;
}

.panel,
.ops-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: 0 6px 20px rgba(20, 38, 76, 0.05);
}

.panel + .panel,
.ops-card + .ops-card,
.space-top {
  margin-top: 14px;
}

.panel h2,
.panel h3,
.ops-card h3,
.ops-card h4 {
  margin: 0 0 10px;
}

.day-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chip {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 7px 10px;
  font-weight: 800;
  font-size: 0.83rem;
}

.chip.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.layer-toggle-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.layer-toggle {
  width: 100%;
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  text-align: left;
}

.layer-toggle:hover {
  border-color: #9fb3e6;
  background: #f8faff;
}

.layer-toggle.is-active {
  border-color: #91a7dd;
  background: #eef2ff;
}

.layer-toggle > span:nth-child(2) {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.layer-toggle strong,
.layer-toggle small {
  display: block;
}

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

.layer-swatch {
  width: 14px;
  height: 14px;
  border-radius: 4px;
  background: var(--orange);
}

.layer-swatch.risk {
  background: var(--red);
}

.layer-state {
  border-radius: 999px;
  padding: 4px 7px;
  background: #edf0f7;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 850;
  white-space: nowrap;
}

.layer-toggle.is-active .layer-state {
  background: var(--navy);
  color: #fff;
}

.layer-status {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink);
  min-width: 0;
}

.field.wide-field {
  grid-column: span 2;
}

.field.muted-field input {
  color: var(--muted);
  background: #f4f7ff;
}

.field-hint {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.35;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 11px;
  background: #fff;
  color: var(--ink);
  outline: none;
  min-width: 0;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(40, 55, 139, 0.14);
}

.required-mark {
  color: var(--red);
  display: inline-block;
  line-height: 1;
  margin-left: 3px;
  vertical-align: baseline;
}

.field.invalid input,
.field.invalid select,
.field.invalid textarea {
  border-color: rgba(246, 134, 35, 0.78);
  background: #fffaf0;
}

.field.invalid input:focus,
.field.invalid select:focus,
.field.invalid textarea:focus {
  box-shadow: 0 0 0 3px rgba(246, 134, 35, 0.16);
}

.error-summary {
  border: 1px solid rgba(246, 134, 35, 0.32);
  border-left: 5px solid var(--orange);
  border-radius: var(--radius);
  background: #fffaf0;
  color: var(--ink);
  padding: 9px 12px;
  margin: 0 0 12px;
}

.error-summary span {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

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

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

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

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

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: end;
  margin: 0 0 12px;
}

.filter-bar .field {
  min-width: min(220px, 100%);
  flex: 1 1 180px;
}

.manual-box {
  margin-top: 10px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 10px;
}

.manual-box summary {
  font-weight: 800;
  color: var(--navy);
}

.notice {
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: var(--radius);
  font-size: 0.83rem;
  background: #eef4ff;
  color: var(--muted);
}

.notice.ok {
  color: #0f6b35;
  background: #e9f8ef;
}

.notice.warn {
  color: #7a4b00;
  background: #fff5d8;
}

.notice.danger {
  color: #8f1020;
  background: #ffe8ec;
}

.eta-diagnostic {
  display: grid;
  gap: 4px;
}

.eta-diagnostic span {
  display: block;
}

.eta-diagnostic button {
  justify-self: start;
  margin-top: 4px;
}

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

.result.empty {
  color: var(--muted);
  background: var(--surface-soft);
}

.result.principal {
  border-color: rgba(21, 148, 71, 0.35);
}

.result.condicionada,
.result.fuera_matriz {
  border-color: rgba(246, 134, 35, 0.45);
}

.result.riesgo {
  border-color: rgba(193, 18, 31, 0.45);
  background: #fff7f8;
}

.result-heading {
  display: flex;
  align-items: start;
  gap: 10px;
}

.result-heading h3 {
  margin: 0;
}

.result-badge {
  display: inline-flex;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  padding: 5px 8px;
  font-size: 0.72rem;
  font-weight: 850;
  white-space: nowrap;
}

.facts {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.facts div {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.facts dt {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.facts dd {
  margin: 2px 0 0;
}

.facts dd small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

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

@media (max-width: 720px) {
  .operational-facts {
    grid-template-columns: 1fr;
  }
}

.button-row,
.button-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.button-stack {
  display: grid;
}

.page-actions {
  justify-content: flex-end;
}

.record-actions {
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.destructive-actions {
  margin-left: auto;
  justify-content: flex-end;
}

.readonly-fieldset {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.readonly-fieldset:disabled {
  opacity: 0.82;
}

.readonly-fieldset:disabled input,
.readonly-fieldset:disabled select,
.readonly-fieldset:disabled textarea {
  color: var(--ink);
  background: #f4f7fc;
}

.primary-button,
.secondary-button,
.accent-button,
.danger-button,
.icon-button,
.link-button {
  border: 0;
  border-radius: var(--radius);
  padding: 10px 12px;
  font-weight: 850;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

.primary-button {
  color: #fff;
  background: var(--navy);
}

.accent-button {
  color: var(--navy-900);
  background: var(--gold);
}

.secondary-button {
  color: var(--navy);
  background: #edf2ff;
}

.primary-button:disabled,
.secondary-button:disabled,
.accent-button:disabled,
.danger-button:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

button.is-pending {
  position: relative;
  cursor: wait;
}

button.is-pending::after {
  content: "";
  display: inline-block;
  width: 13px;
  height: 13px;
  margin-left: 8px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  vertical-align: -2px;
  animation: app-loading-spin 0.8s linear infinite;
}

.auth-status {
  color: #dbeafe;
  font-size: 0.82rem;
  font-weight: 700;
}

.danger-button {
  color: #fff;
  background: var(--red);
}

.icon-button {
  min-width: 34px;
  height: 34px;
  padding: 0;
  color: var(--red);
  background: #ffe8ec;
}

.full {
  width: 100%;
}

.danger-text {
  color: var(--red);
}

.image-preview {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface-soft);
  justify-items: center;
}

.image-preview img {
  width: min(100%, 520px);
  max-height: 680px;
  object-fit: contain;
  border-radius: var(--radius);
  background: #fff;
  box-shadow: 0 12px 32px rgba(16, 32, 68, 0.12);
}

.map-legend {
  position: absolute;
  left: 16px;
  bottom: 16px;
  z-index: 500;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  box-shadow: var(--shadow);
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 0.82rem;
}

.map-legend i {
  width: 14px;
  height: 14px;
  display: inline-block;
  border-radius: 4px;
}

.legend-main {
  background: var(--green);
}

.legend-conditional {
  background: var(--orange);
}

.legend-risk {
  background: var(--red);
}

.base-marker span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--navy);
  color: #fff;
  border: 3px solid #fff;
  box-shadow: 0 10px 24px rgba(16, 32, 68, 0.28);
  font-size: 0.75rem;
  font-weight: 900;
}

.color-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 8px;
  align-items: center;
}

.color-field input[type="color"] {
  width: 48px;
  min-height: 42px;
  padding: 3px;
  cursor: pointer;
}

.base-marker span::first-line {
  transform: rotate(45deg);
}

.search-marker span {
  display: block;
  width: 30px;
  height: 30px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--gold);
  border: 4px solid var(--navy);
  box-shadow: 0 10px 24px rgba(16, 32, 68, 0.28);
}

.route-stop-marker span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: var(--gold);
  border: 3px solid var(--navy);
  color: var(--navy);
  box-shadow: 0 10px 22px rgba(16, 32, 68, 0.28);
  font-size: 0.82rem;
  font-weight: 950;
}

.base-route-label span {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 74px;
  padding: 5px 8px;
  border: 2px solid var(--navy);
  border-radius: 9px;
  background: var(--gold);
  color: var(--navy);
  box-shadow: 0 10px 22px rgba(16, 32, 68, 0.24);
  font-size: 0.7rem;
  font-weight: 950;
  line-height: 1.05;
  text-align: center;
}

.base-route-end span {
  background: #fff;
}

.ops-view {
  padding: 70px 18px 18px;
}

.ops-page {
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.page-header h2 {
  margin: 2px 0 0;
  font-size: clamp(1.35rem, 2vw, 2rem);
}

.quote-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 14px;
  align-items: start;
}

.quote-layout > .ops-card:not(.cart-card) {
  grid-column: 1;
}

.quote-layout > .cart-card {
  grid-column: 2;
  grid-row: 1 / span 2;
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.38fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.split-layout.table-first {
  grid-template-columns: minmax(0, 0.64fr) minmax(300px, 0.36fr);
}

.table-workspace {
  display: grid;
  gap: 14px;
}

.list-pane,
.detail-pane,
.full-pane {
  min-width: 0;
}

.record-list,
.match-list,
.cart-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.record-list button,
.match-list button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  text-align: left;
  border-radius: var(--radius);
  padding: 10px;
}

.record-list button.active,
.match-list button:hover {
  border-color: var(--navy);
  background: #eef2ff;
}

.record-list small,
.match-list small,
.cart-row small,
.load-table small {
  display: block;
  color: var(--muted);
  margin-top: 3px;
}

.route-base-row td {
  background: #fff8e1;
  color: var(--ink);
  font-weight: 850;
}

.route-base-row small {
  color: var(--navy);
}

.coverage-box {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  display: grid;
  gap: 6px;
  background: var(--surface-soft);
}

.coverage-box.principal {
  border-color: rgba(21, 148, 71, 0.35);
  background: #f1fbf5;
}

.coverage-box.condicionada {
  border-color: rgba(246, 134, 35, 0.45);
  background: #fff8ee;
}

.coverage-box.risk {
  border-color: rgba(193, 18, 31, 0.45);
  background: #fff4f5;
}

.authorization-queue {
  border-left: 4px solid var(--yellow);
}

.authorization-queue .status-pill {
  align-self: center;
  border-radius: 999px;
  background: #fff4c7;
  color: #765200;
  padding: 8px 11px;
  font-weight: 850;
  white-space: nowrap;
}

.authorization-detail {
  display: grid;
  gap: 5px;
  margin: 12px 0;
  padding: 12px;
  border: 1px solid #efc55a;
  border-radius: var(--radius);
  background: #fff9e8;
}

.authorization-detail span {
  overflow-wrap: anywhere;
}

.authorization-detail.approved {
  border-color: rgba(21, 148, 71, 0.35);
  background: #f1fbf5;
}

.authorization-detail.rejected {
  border-color: rgba(193, 18, 31, 0.4);
  background: #fff4f5;
}

.cart-card {
  position: sticky;
  top: 14px;
  min-width: 0;
  overflow: hidden;
}

.product-shortcuts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 4px 0 12px;
}

.product-shortcuts button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 8px 12px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 850;
}

.product-shortcuts button.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.product-shortcuts small {
  color: inherit;
  opacity: 0.78;
  font-weight: 800;
}

.product-add-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #f8fbff;
}

.product-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.product-summary span {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px;
}

.product-summary small {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 850;
}

.product-summary strong {
  display: block;
  margin-top: 2px;
}

.product-summary p {
  grid-column: 1 / -1;
  margin: 0;
  color: var(--orange);
  font-weight: 800;
}

.product-actions {
  margin-top: 10px;
}

.quick-product-box {
  margin-top: 12px;
}

.cart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(72px, 84px) 34px;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px;
  min-width: 0;
  overflow: hidden;
}

.cart-row > div {
  min-width: 0;
}

.cart-row strong,
.cart-row small {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.cart-row input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 118px), 1fr));
  gap: 10px;
  margin: 14px 0;
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 14px 0;
}

.cart-card .totals {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 126px), 1fr));
}

.cart-card .totals span:last-child {
  grid-column: auto;
}

.totals span,
.metric-strip span {
  background: #f2f6ff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 8px;
  min-width: 0;
  overflow: visible;
}

.totals small,
.metric-strip small {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.totals strong,
.metric-strip strong {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
  word-break: break-word;
  line-height: 1.2;
  max-width: 100%;
  font-variant-numeric: tabular-nums;
}

.cart-card .totals strong {
  font-size: clamp(0.9rem, 2.8vw, 1rem);
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.status-line span {
  background: #eef2ff;
  color: var(--navy);
  border-radius: 999px;
  padding: 6px 9px;
  font-weight: 800;
  font-size: 0.82rem;
}

.table-card {
  overflow-x: auto;
  width: 100%;
}

.list-table-scroll {
  max-height: min(64vh, 680px);
  overflow: auto;
}

.scroll-list {
  max-height: min(62vh, 650px);
  overflow: auto;
  padding-right: 4px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  background: #f2f6ff;
  color: var(--navy);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.compact-table th,
.compact-table td {
  font-size: 0.86rem;
}

.data-table {
  min-width: 920px;
}

.data-table.orders-table {
  min-width: 1120px;
}

.data-table tr.active-row td {
  background: #eef2ff;
}

.data-table tr.clickable-row,
.compact-table tr.clickable-row,
.load-table tr.clickable-row {
  cursor: pointer;
}

.data-table tr.clickable-row:hover td,
.compact-table tr.clickable-row:hover td,
.load-table tr.clickable-row:hover td {
  background: #f7faff;
}

.data-table tr.clickable-row button,
.data-table tr.clickable-row input,
.data-table tr.clickable-row select,
.data-table tr.clickable-row textarea,
.data-table tr.clickable-row a,
.compact-table tr.clickable-row button,
.compact-table tr.clickable-row input,
.compact-table tr.clickable-row select,
.compact-table tr.clickable-row textarea,
.compact-table tr.clickable-row a,
.load-table tr.clickable-row button,
.load-table tr.clickable-row input,
.load-table tr.clickable-row select,
.load-table tr.clickable-row textarea,
.load-table tr.clickable-row a {
  cursor: pointer;
}

.data-table .button-row {
  margin: 0;
}

.data-table td {
  overflow-wrap: break-word;
  word-break: normal;
}

.data-table td[data-label="Folio"],
.data-table td[data-label="Fecha"],
.data-table td[data-label="Kg"],
.data-table td[data-label="Total"],
.data-table td[data-label="Acciones"] {
  white-space: nowrap;
}

.inline-number {
  width: 92px;
  min-height: 36px;
}

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

.section-heading h3 {
  margin: 0;
}

.finance-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.finance-tabs button {
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--navy);
  background: #fff;
  padding: 9px 13px;
  font-weight: 850;
}

.finance-tabs button.active {
  color: #fff;
  background: var(--navy);
  border-color: var(--navy);
}

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

.finance-model-status {
  display: grid;
  grid-template-columns: minmax(180px, auto) 1fr;
  gap: 12px 20px;
  align-items: center;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-left-width: 5px;
  border-radius: var(--radius);
  padding: 12px 14px;
  background: #f8fbff;
}

.finance-model-status.ok {
  border-left-color: #16834a;
  background: #effaf4;
}

.finance-model-status.warning {
  border-left-color: #d28700;
  background: #fff9e9;
}

.finance-model-status.danger {
  border-left-color: #c81e35;
  background: #fff2f3;
}

.finance-model-status small,
.finance-model-status strong {
  display: block;
}

.finance-model-status strong {
  margin-top: 2px;
  color: var(--navy);
}

.finance-model-status p {
  margin: 0;
  color: var(--muted);
}

.finance-model-status details {
  grid-column: 1 / -1;
}

.finance-status-pill,
.finance-classification-legend span,
.finance-model-sections summary span {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 0.73rem;
  font-weight: 900;
}

.finance-status-pill.ok,
.finance-classification-legend .confirmed,
.finance-model-sections summary .confirmed {
  color: #0b5b2a;
  background: #dcfce7;
}

.finance-status-pill.warning,
.finance-classification-legend .assumption,
.finance-model-sections summary .assumption {
  color: #7a4800;
  background: #fff0c2;
}

.finance-status-pill.danger,
.finance-classification-legend .pending,
.finance-model-sections summary .pending {
  color: #9f1239;
  background: #ffe4e6;
}

.finance-classification-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.finance-model-sections {
  display: grid;
  gap: 10px;
}

.finance-model-sections details,
.finance-audit-details {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px 12px;
  background: #fff;
}

.finance-model-sections summary,
.finance-audit-details > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 0;
  color: var(--navy);
  font-weight: 900;
  cursor: pointer;
}

.finance-model-field {
  min-width: 0;
}

.finance-derived-line,
.finance-thresholds {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: 8px;
  margin-top: 12px;
}

.finance-derived-line span,
.finance-thresholds span {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 10px;
  background: #f7f9ff;
}

.finance-derived-line strong,
.finance-thresholds small,
.finance-thresholds strong {
  display: block;
  margin-top: 2px;
  overflow-wrap: anywhere;
}

.finance-thresholds .threshold-alert {
  border-color: #f2b33d;
  background: #fff7dd;
}

.finance-price-audit {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.finance-price-audit > div {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: #f8fbff;
}

.finance-price-audit h4,
.finance-price-audit p {
  margin: 0 0 8px;
}

.finance-price-audit .table-card {
  margin: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.finance-price-table {
  min-width: 560px;
}

.finance-price-field {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.finance-price-field small {
  color: var(--muted);
  font-weight: 750;
  white-space: nowrap;
}

.finance-price-field input {
  width: 100%;
  min-width: 0;
}

.finance-scenario-table {
  min-width: 920px;
}

.finance-scenario-table td strong,
.finance-scenario-table td small {
  display: block;
}

.finance-scenario-table td small {
  margin-top: 3px;
  color: var(--muted);
}

.finance-model-actions {
  position: sticky;
  bottom: 10px;
  z-index: 4;
  margin-top: 14px;
  width: fit-content;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
}

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

.finance-bars {
  display: grid;
  gap: 9px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(96px, 0.45fr) minmax(120px, 1fr) auto;
  gap: 10px;
  align-items: center;
  font-size: 0.86rem;
}

.bar-row div {
  overflow: hidden;
  height: 10px;
  border-radius: 999px;
  background: #e8eefc;
}

.bar-row i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--navy), var(--cyan));
}

.finance-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  border-radius: 999px;
  padding: 3px 7px;
  font-size: 0.72rem;
  font-weight: 900;
}

.finance-badge.paid {
  color: #0b5b2a;
  background: #dcfce7;
}

.finance-badge.partial {
  color: #8a4b00;
  background: #fff0c2;
}

.finance-badge.pending {
  color: #9f1239;
  background: #ffe4e6;
}

.inline-form,
.warning-card {
  margin: 12px 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--surface-soft);
}

.warning-card {
  border-color: #ffd08a;
  background: #fff7e8;
}

.warning-card ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.check-row {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  margin: 8px 0 12px;
  font-weight: 750;
}

.route-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 12px 0;
}

.route-option {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f7faff;
  padding: 10px;
  font-weight: 800;
  min-height: 74px;
}

.route-option input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--navy);
}

.route-option small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.35;
}

.route-summary {
  display: grid;
  gap: 4px;
  margin: 12px 0;
}

.route-summary span {
  display: block;
}

.load-route-map-card {
  margin: 14px 0;
}

.load-route-map {
  width: 100%;
  min-height: 430px;
  height: min(54vh, 560px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #eaf5fb;
}

.route-map-count {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--navy);
  padding: 8px 10px;
  font-size: 0.82rem;
  font-weight: 900;
}

.route-map-empty {
  display: grid;
  min-height: 320px;
  place-items: center;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
  padding: 24px;
}

.compact-helper {
  margin-bottom: 0;
}

.compact-actions {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  flex-wrap: nowrap;
  min-width: max-content;
}

.compact-actions button,
.compact-actions a {
  min-width: max-content;
  white-space: nowrap;
  word-break: normal;
}

.compact-actions .secondary-button {
  padding: 6px 8px;
  font-size: 0.78rem;
}

.compact-actions .primary-button,
.compact-actions .accent-button,
.compact-actions .danger-button {
  padding: 6px 8px;
  font-size: 0.78rem;
}

.compact-actions .danger-text {
  background: transparent;
  padding-left: 2px;
  padding-right: 2px;
}

.inline-select {
  width: 160px;
  min-width: 140px;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.load-candidates {
  margin-bottom: 14px;
}

.sequence-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sequence-controls button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 6px;
  width: 28px;
  height: 28px;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 12px 0;
}

.permission-grid label {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  background: #fff;
}

.permission-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-width: 0;
  cursor: pointer;
}

.permission-option input {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 3px;
}

.permission-option span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.permission-option strong,
.permission-option small {
  overflow-wrap: anywhere;
}

.permission-option small {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.permission-option-approval {
  border-color: rgba(255, 184, 0, 0.72) !important;
  background: #fffaf0 !important;
}

.helper-note,
.form-error {
  color: var(--muted);
  font-size: 0.86rem;
}

.form-error {
  color: var(--red);
}

.empty-state {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 680px;
  margin: 36px auto;
}

.empty-state.small {
  margin: 0;
  padding: 18px;
}

.mobile-toggle,
.mobile-nav {
  display: none;
}

.mobile-toggle {
  display: inline-flex;
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 1850;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 999px;
  background: var(--navy);
  color: #fff;
  padding: 10px 14px;
  font-weight: 900;
  box-shadow: var(--shadow);
  transition: opacity 0.16s ease, transform 0.16s ease, background 0.2s ease, color 0.2s ease;
}

body.panel-open .mobile-toggle {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px);
}

.app-toast {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2000;
  width: min(560px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: 34px 1fr 30px;
  gap: 10px;
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 5px solid var(--green);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 12px;
}

.app-toast.ok {
  border-left-color: var(--green);
}

.app-toast.warn {
  border-left-color: var(--orange);
}

.app-toast.danger {
  border-left-color: var(--red);
}

.app-toast.info {
  border-left-color: var(--cyan);
}

.app-toast.hidden {
  display: none;
}

.toast-mark {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #eef2ff;
  color: var(--navy);
  font-weight: 900;
}

.app-toast.ok .toast-mark {
  color: #0f6b35;
  background: #e5f8ed;
}

.app-toast.warn .toast-mark {
  color: #8a4b00;
  background: #fff0c2;
}

.app-toast.danger .toast-mark {
  color: var(--red);
  background: #ffe4e6;
}

.app-toast.info .toast-mark {
  color: #086b78;
  background: #ddf7fb;
}

.app-toast small {
  display: block;
  color: var(--muted);
}

.app-toast button {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.1rem;
}

.app-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2500;
  display: grid;
  place-items: center;
  background: rgba(10, 18, 48, 0.54);
  padding: 18px;
}

.app-modal {
  width: min(460px, 100%);
  background: #fff;
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px;
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
}

.app-modal-wide {
  width: min(560px, 100%);
}

.app-modal h2 {
  margin: 0 0 8px;
}

.app-modal p {
  margin: 0;
  color: var(--muted);
}

.app-modal-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #eef2ff;
  color: var(--navy);
  font-weight: 900;
}

.app-modal-icon.danger {
  color: var(--red);
  background: #ffe8ec;
}

.app-modal-icon.warn {
  color: #a45d00;
  background: #fff4cf;
}

.modal-field {
  margin-top: 12px;
}

.modal-error[hidden] {
  display: none;
}

.app-modal-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

.record-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2400;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(10, 18, 48, 0.50);
}

.record-modal {
  width: min(1040px, calc(100vw - 32px));
  max-height: calc(100vh - 44px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.record-modal-header {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.record-modal-body {
  padding: 16px;
}

.record-modal-body > h3:first-child {
  margin-top: 0;
}

.hidden,
[hidden] {
  display: none !important;
}

.pac-container {
  z-index: 3000;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  font-family: inherit;
}

.pac-item {
  padding: 8px 10px;
}

@media (max-width: 1180px) {
  .quote-layout {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 0.75fr);
  }

  .cart-card {
    position: static;
  }

  .quote-layout > .cart-card {
    grid-row: auto;
  }

  .map-layout {
    grid-template-columns: minmax(0, 1fr) minmax(288px, 330px);
  }

  .quote-layout .ops-card:first-child {
    grid-column: 1 / -1;
  }

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

@media (max-width: 900px) {
  .mobile-nav {
    display: none;
  }

  .mobile-nav button {
    color: var(--navy);
    background: #eef2ff;
    border: 1px solid var(--line);
    padding: 9px 4px;
    text-align: center;
    font-size: 0.76rem;
  }

  .mobile-nav button.active {
    background: var(--navy);
    color: #fff;
  }

  .view {
    min-height: calc(100vh - 64px);
  }

  body[data-active-view="map"] {
    overflow: auto;
  }

  body[data-active-view="map"] .app-shell,
  body[data-active-view="map"] .workspace,
  body[data-active-view="map"] .map-view {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .map-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .map-stage {
    height: auto;
  }

  .map-tools {
    top: 12px;
    right: 12px;
  }

  .map-tools .secondary-button {
    min-height: 40px;
    padding: 8px 12px;
  }

  .map-stage .leaflet-bottom.leaflet-right .leaflet-control-zoom {
    margin-right: 12px;
    margin-bottom: 30px;
  }

  #coverageMap {
    height: 64vh;
    min-height: 420px;
  }

  .map-panel {
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  body.map-panel-collapsed #coverageMap {
    height: calc(100vh - 68px);
  }

  body.map-panel-collapsed .map-panel {
    display: none;
  }

  .ops-view {
    padding: 70px 12px 20px;
  }

  .split-layout,
  .split-layout.table-first,
  .quote-layout,
  .finance-charts,
  .form-grid.two,
  .form-grid.three,
  .form-grid.four,
  .totals,
  .metric-strip,
  .product-summary,
  .route-options,
  .permission-grid {
    grid-template-columns: 1fr;
  }

  .quote-layout > .ops-card:not(.cart-card),
  .quote-layout > .cart-card {
    grid-column: auto;
    grid-row: auto;
  }

  .cart-card .totals {
    grid-template-columns: 1fr;
  }

  .field.wide-field {
    grid-column: auto;
  }

  .finance-model-status,
  .finance-price-audit {
    grid-template-columns: 1fr;
  }

  .finance-model-actions,
  .finance-model-actions .primary-button {
    width: 100%;
  }

  .finance-scenario-table {
    min-width: 0;
  }

  .finance-price-table {
    min-width: 0;
  }

  .page-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .section-heading,
  .bar-row {
    grid-template-columns: 1fr;
  }

  .section-heading {
    flex-direction: column;
  }

  .page-header .button-row,
  .section-heading .button-row {
    width: 100%;
  }

  .page-header .button-row > button,
  .section-heading .button-row > button {
    flex: 1 1 auto;
  }

  .product-shortcuts {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 4px;
  }

  .product-shortcuts button {
    flex: 0 0 auto;
  }

  .image-preview img {
    width: min(100%, 440px);
    max-height: 600px;
  }

  .load-route-map {
    min-height: 340px;
    height: 48vh;
  }
}

@media (max-width: 520px) {
  .auth-screen {
    place-items: stretch;
    padding: 0;
    background: #fff;
  }

  .auth-screen-card {
    width: 100%;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    border: 0;
    border-top: 5px solid var(--gold);
    box-shadow: none;
  }

  .auth-screen-brand {
    padding: 22px 20px 16px;
  }

  #authScreenPanel {
    padding: 26px 20px;
  }

  .auth-screen-footer {
    margin-top: auto;
  }
}

@media (max-width: 760px) {
  .ops-card {
    padding: 12px;
  }

  .button-row {
    align-items: stretch;
  }

  .button-row > button,
  .button-row > a,
  .button-stack > button {
    flex: 1 1 100%;
    justify-content: center;
  }

  .table-card .compact-actions > button {
    flex: 0 0 auto;
  }

  .compact-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .record-actions,
  .action-group,
  .destructive-actions {
    width: 100%;
  }

  .destructive-actions {
    margin-left: 0;
  }

  .record-actions .action-group > button,
  .record-actions .action-group > a {
    flex: 1 1 100%;
  }

  .table-card {
    overflow: visible;
  }

  .table-card table,
  .table-card thead,
  .table-card tbody,
  .table-card tr,
  .table-card th,
  .table-card td {
    display: block;
    width: 100%;
  }

  .data-table {
    min-width: 0;
  }

  .data-table.orders-table {
    min-width: 0;
  }

  .table-card thead {
    display: none;
  }

  .table-card tr {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    padding: 8px;
    margin-bottom: 10px;
  }

  .table-card td {
    border: 0;
    display: grid;
    grid-template-columns: minmax(86px, 0.36fr) minmax(0, 1fr);
    gap: 8px;
    padding: 7px 4px;
    overflow-wrap: break-word;
    word-break: normal;
    white-space: normal;
  }

  .table-card td[data-label="Acciones"] .compact-actions {
    width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .table-card td[data-label="Acciones"] .compact-actions > button,
  .table-card td[data-label="Acciones"] .compact-actions > a {
    width: 100%;
    min-width: 0;
    white-space: normal;
  }

  .table-card td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 850;
    text-transform: uppercase;
  }

  .record-modal-backdrop {
    align-items: stretch;
    padding: 10px;
  }

  .record-modal {
    width: 100%;
    max-height: calc(100vh - 20px);
  }

  .cart-row {
    grid-template-columns: minmax(0, 1fr) 68px 34px;
  }

  .product-add-panel,
  .manual-box {
    padding: 10px;
  }
}

@media (max-width: 480px) {
  .ops-view {
    padding-left: 8px;
    padding-right: 8px;
  }

  .ops-card,
  .panel {
    padding: 10px;
  }

  .page-header h2 {
    font-size: 1.32rem;
  }

  .mobile-nav {
    gap: 4px;
    padding: 5px;
  }

  .mobile-nav button {
    font-size: 0.68rem;
  }

  .table-card td {
    grid-template-columns: 1fr;
  }

  .table-card td::before {
    margin-bottom: -3px;
  }

  .table-card td[data-label="Acciones"] .compact-actions {
    grid-template-columns: 1fr;
  }

  .product-shortcuts button {
    padding: 8px 10px;
  }

  .image-preview img {
    width: 100%;
    max-height: 560px;
  }
}
