:root {
  --bg: #f5f7f8;
  --panel: #ffffff;
  --ink: #121619;
  --muted: #68727d;
  --line: #dfe5e8;
  --brand: #0c0f12;
  --accent: #c31926;
  --amber: #f7b731;
  --blue: #276ef1;
  --green: #12805c;
  --teal: #008c95;
  --shadow: 0 18px 48px rgba(10, 22, 34, 0.12);
}

/* Leaflet critical layout fallback. Keeps maps complete even if CDN CSS is slow or blocked. */
.leaflet-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-container,
.leaflet-pane > svg,
.leaflet-pane > canvas,
.leaflet-zoom-box,
.leaflet-image-layer,
.leaflet-layer {
  position: absolute;
  left: 0;
  top: 0;
}

.leaflet-container {
  overflow: hidden;
  outline: 0;
  font: 12px/1.5 "Helvetica Neue", Arial, Helvetica, sans-serif;
}

.leaflet-tile-pane {
  z-index: 200;
}

.leaflet-overlay-pane {
  z-index: 400;
}

.leaflet-shadow-pane {
  z-index: 500;
}

.leaflet-marker-pane {
  z-index: 600;
}

.leaflet-tooltip-pane {
  z-index: 650;
}

.leaflet-popup-pane {
  z-index: 700;
}

.leaflet-zoom-animated {
  transform-origin: 0 0;
}

.leaflet-interactive {
  cursor: pointer;
  pointer-events: auto;
}

.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow {
  -webkit-user-drag: none;
  user-select: none;
}

.leaflet-tile {
  filter: inherit;
  visibility: inherit;
  border: 0;
}

.leaflet-tile-loaded {
  visibility: inherit;
}

.leaflet-grab {
  cursor: grab;
}

.leaflet-dragging .leaflet-grab {
  cursor: move;
}

.leaflet-control {
  position: relative;
  z-index: 800;
  pointer-events: auto;
}

.leaflet-top,
.leaflet-bottom {
  position: absolute;
  z-index: 1000;
  pointer-events: none;
}

.leaflet-top {
  top: 0;
}

.leaflet-right {
  right: 0;
}

.leaflet-bottom {
  bottom: 0;
}

.leaflet-left {
  left: 0;
}

.leaflet-control {
  float: left;
  clear: both;
}

.leaflet-right .leaflet-control {
  float: right;
}

.leaflet-top .leaflet-control {
  margin-top: 10px;
}

.leaflet-bottom .leaflet-control {
  margin-bottom: 10px;
}

.leaflet-left .leaflet-control {
  margin-left: 10px;
}

.leaflet-right .leaflet-control {
  margin-right: 10px;
}

.leaflet-control-zoom a {
  display: block;
  width: 30px;
  height: 30px;
  background: #fff;
  color: #111;
  border-bottom: 1px solid #ccc;
  text-align: center;
  text-decoration: none;
  font: bold 18px/30px Arial, Helvetica, sans-serif;
}

.leaflet-control-zoom a:first-child {
  border-top-left-radius: 4px;
  border-top-right-radius: 4px;
}

.leaflet-control-zoom a:last-child {
  border-bottom: 0;
  border-bottom-left-radius: 4px;
  border-bottom-right-radius: 4px;
}

.leaflet-control-attribution {
  padding: 0 5px;
  background: rgba(255, 255, 255, 0.82);
  color: #333;
}

.leaflet-control-attribution a {
  color: #0078a8;
  text-decoration: none;
}

.leaflet-popup {
  position: absolute;
  margin-bottom: 20px;
  text-align: center;
}

.leaflet-tooltip {
  position: absolute;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.94);
  border: 1px solid #cbd5dc;
  border-radius: 4px;
  color: #111;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
}

.leaflet-popup-content-wrapper {
  padding: 1px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.28);
}

.leaflet-popup-content {
  margin: 12px 16px;
  line-height: 1.4;
}

.map-popup {
  display: grid;
  gap: 5px;
  min-width: 210px;
  text-align: left;
}

.map-popup strong {
  font-size: 15px;
}

.map-popup span {
  color: #40505c;
}

.map-popup button {
  min-height: 34px;
  margin-top: 6px;
  padding: 0 10px;
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  border-radius: 6px;
  font-weight: 800;
}

.leaflet-popup-tip-container {
  position: absolute;
  left: 50%;
  width: 40px;
  height: 20px;
  margin-left: -20px;
  overflow: hidden;
  pointer-events: none;
}

.leaflet-popup-tip {
  width: 17px;
  height: 17px;
  margin: -10px auto 0;
  transform: rotate(45deg);
  background: #fff;
  box-shadow: 0 3px 14px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

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

.app-locked {
  background: #0b0d10;
}

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

.login-screen {
  display: none;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(11, 13, 16, 0.96), rgba(28, 32, 36, 0.92)),
    #0b0d10;
}

.app-locked .login-screen {
  display: grid;
}

.app-restoring .login-screen {
  display: none;
}

.app-restoring::before {
  color: #fff;
  content: "Cargando sesión...";
  display: grid;
  font-weight: 800;
  inset: 0;
  letter-spacing: 0;
  place-items: center;
  position: fixed;
  z-index: 9999;
}

.login-card {
  width: min(420px, 100%);
  padding: 24px;
  background: #11161b;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.36);
  color: #fff;
}

.login-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.login-avanthia {
  width: min(220px, 58vw);
  height: 44px;
  object-fit: contain;
}

.login-emergency {
  width: 72px;
  height: 72px;
  object-fit: contain;
}

.login-copy h1 {
  margin: 0;
  font-size: 30px;
  letter-spacing: 0;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 22px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: #dbe1e5;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.login-form input {
  width: 100%;
  min-height: 46px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

.password-field {
  position: relative;
  display: block;
}

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

.password-toggle {
  position: absolute;
  top: 50%;
  right: 6px;
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: #4b5563;
  background: transparent;
  border: 0;
  box-shadow: none;
  transform: translateY(-50%);
}

.password-toggle:hover,
.password-toggle:focus-visible {
  color: var(--ink);
  background: #eef2f7;
}

.remember-session {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  font-weight: 800;
}

.remember-session input {
  width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: #ffb3b8;
  font-weight: 700;
}

.login-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  color: rgba(255, 255, 255, 0.58);
  font-size: 12px;
  font-weight: 800;
}

.login-links[hidden] {
  display: none;
}

.login-links a {
  color: rgba(255, 255, 255, 0.82);
  text-decoration: none;
}

.login-links a:hover {
  color: #fff;
  text-decoration: underline;
}

.login-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
}

.login-progress[hidden] {
  display: none;
}

.login-progress div {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
}

.login-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #f7b731;
  transition: width 180ms ease;
}

.login-progress span {
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  text-align: right;
}

.demo-access {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.demo-access button {
  min-height: 36px;
  padding: 0 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.18);
  font-size: 12px;
  font-weight: 800;
}

button,
input,
select {
  font: inherit;
}

button,
select,
input {
  border: 1px solid var(--line);
  border-radius: 8px;
}

button {
  cursor: pointer;
}

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

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

.brand-stack {
  display: grid;
  gap: 20px;
}

.avanthia-lockup {
  position: relative;
  display: grid;
  align-items: center;
  min-height: 78px;
  overflow: hidden;
  border-radius: 8px;
  background: #000;
  padding: 12px 16px;
}

.brand-logo {
  position: relative;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 1;
}

.emergency-logo {
  width: 120px;
  height: 120px;
  object-fit: contain;
  justify-self: center;
}

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

.nav-item,
.ghost-button,
.primary-button,
.danger-button,
.upload-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 42px;
  padding: 0 14px;
  transition: transform 140ms ease, background 140ms ease, border-color 140ms ease;
}

.nav-item {
  justify-content: flex-start;
  background: transparent;
  color: #dbe1e5;
  border-color: rgba(255, 255, 255, 0.12);
}

.nav-item.active,
.nav-item:hover {
  background: #ffffff;
  color: #0b0d10;
}

.nav-item:disabled {
  cursor: not-allowed;
  opacity: 0.42;
}

.nav-item svg,
.ghost-button svg,
.primary-button svg,
.danger-button svg,
.upload-button svg,
.icon-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.session-panel {
  display: grid;
  gap: 8px;
  margin-top: auto;
}

.session-panel span,
.field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

.session-panel span {
  color: #aeb8c1;
}

.session-panel strong {
  color: #fff;
  font-size: 16px;
  line-height: 1.25;
}

.session-panel small {
  color: #aeb8c1;
  font-weight: 800;
}

.server-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #e8eef4;
  font-size: 12px;
  font-weight: 800;
}

.server-status i {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: #f6c343;
  box-shadow: 0 0 0 3px rgba(246, 195, 67, 0.18);
}

.server-status span {
  color: inherit;
  font-size: 11px;
  line-height: 1.2;
  text-transform: none;
}

.server-status[data-state="online"] i {
  background: #18b77b;
  box-shadow: 0 0 0 3px rgba(24, 183, 123, 0.18);
}

.server-status[data-state="offline"] i,
.server-status[data-state="expired"] i {
  background: #e14d4d;
  box-shadow: 0 0 0 3px rgba(225, 77, 77, 0.18);
}

.server-status[data-state="syncing"] i {
  background: #2f80ed;
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.2);
}

.field select,
.field input,
.user-form input,
.user-form select,
.bulk-user-form textarea,
.bulk-user-form select,
.report-card input,
.report-card select,
.report-card textarea,
.detail-row select {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  background: #fff;
  color: var(--ink);
}

.hidden-select {
  display: none !important;
}

.main {
  display: grid;
  gap: 20px;
  align-content: start;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.topbar h1,
.section-heading h2,
.detail-modal h2,
.raw-fields h3 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 28px;
  line-height: 1.12;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.topbar-actions {
  display: none;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.role-admin .topbar-actions,
.role-superadmin .topbar-actions {
  display: flex;
}

.upload-button {
  position: relative;
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.upload-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.ghost-button {
  background: #fff;
  color: var(--ink);
}

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

.primary-button.is-action-blocked {
  opacity: 0.58;
  cursor: not-allowed;
}

a.primary-button {
  text-decoration: none;
}

.waze-button {
  background: #276ef1;
  border-color: #276ef1;
}

.disabled-link {
  opacity: 0.46;
  pointer-events: none;
}

.danger-button {
  background: #8b1e28;
  color: #fff;
  border-color: #8b1e28;
}

.import-status,
.provider-sync-card,
.orders-panel,
.map-panel,
.users-panel,
.notifications-panel,
.reports-panel,
.pending-monitor-panel,
.history-panel,
.detail-modal {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.import-status {
  padding: 12px 14px;
  color: var(--muted);
}

.provider-sync-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
}

.provider-sync-card strong,
.provider-sync-card span {
  display: block;
}

.provider-sync-card strong {
  color: var(--ink);
}

.provider-sync-card span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.pending-upload-monitor {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  padding: 14px 16px;
}

.pending-upload-list {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.pending-upload-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #f0c4ca;
  border-left: 5px solid #c31926;
  border-radius: 8px;
  background: #fff7f7;
}

.pending-upload-item strong,
.pending-upload-item span,
.pending-upload-item small {
  display: block;
}

.pending-upload-item strong {
  color: var(--ink);
  font-size: 14px;
}

.pending-upload-item span {
  color: var(--muted);
  font-size: 13px;
}

.pending-upload-counts {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  text-align: right;
}

.pending-upload-counts span {
  min-width: 68px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #fee2e2;
  color: #991b1b;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.pending-upload-counts small {
  min-width: 112px;
  color: var(--muted);
  font-size: 12px;
}

.pending-upload-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.compact-action {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.process-pill {
  display: inline-flex;
  width: fit-content;
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
}

.process-pill.review-error,
.process-pill.client-error {
  background: #fee2e2;
  color: #991b1b;
}

.process-pill.sending-client {
  background: #e0f2fe;
  color: #075985;
}

.provider-sync-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.provider-sync-dates {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
}

.provider-sync-dates label {
  display: grid;
  gap: 4px;
  min-width: 142px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.provider-sync-dates input {
  min-height: 42px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
}

.provider-sync-progress {
  display: grid;
  grid-template-columns: 42px minmax(120px, 180px);
  align-items: center;
  gap: 8px;
  font-weight: 800;
  color: var(--muted);
}

.provider-sync-progress[hidden] {
  display: none;
}

.provider-sync-progress > div {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf1f5;
}

.provider-sync-progress i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 0.2s ease;
}

.provider-sync-progress[data-type="success"] i {
  background: #168a4a;
}

.provider-sync-progress[data-type="error"] i {
  background: #9f1239;
}

.role-user .provider-sync-card,
.role-user .provider-column,
.role-admin [data-section="notifications"],
.role-supervisor [data-section="notifications"],
.role-user [data-section="notifications"],
.role-admin [data-section="pending-monitor"],
.role-supervisor [data-section="pending-monitor"],
.role-user [data-section="pending-monitor"],
.role-admin [data-section="backups"],
.role-supervisor [data-section="backups"],
.role-user [data-section="backups"],
.role-admin [data-section="history"],
.role-supervisor [data-section="history"],
.role-user [data-section="history"] {
  display: none !important;
}

.app-toast {
  position: fixed;
  right: 24px;
  top: 24px;
  z-index: 2000;
  min-width: min(360px, calc(100vw - 32px));
  max-width: min(440px, calc(100vw - 32px));
  padding: 14px 16px;
  border-radius: 8px;
  background: #121619;
  color: #fff;
  box-shadow: 0 18px 42px rgba(8, 14, 22, 0.24);
  font-weight: 800;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(-12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.app-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.app-toast[data-type="success"] {
  background: #0f5132;
}

.app-toast[data-type="warning"] {
  background: #8b5b00;
}

.review-alert-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: none;
  place-items: center;
  padding: 28px;
  background: #0052cc;
  color: #fff;
}

.review-alert-overlay.visible {
  display: grid;
}

.review-alert-overlay div {
  display: grid;
  justify-items: center;
  gap: 18px;
  text-align: center;
}

.review-alert-overlay svg {
  width: 92px;
  height: 92px;
  animation: alertPulse 800ms ease-in-out infinite;
}

.review-alert-overlay strong {
  font-size: clamp(36px, 7vw, 92px);
  line-height: 1;
  letter-spacing: 0;
}

.review-alert-overlay span {
  font-size: clamp(18px, 2.2vw, 28px);
  font-weight: 800;
  opacity: 0.92;
}

@keyframes alertPulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.12);
  }
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.metric-card {
  display: grid;
  gap: 8px;
  min-height: 92px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 5px solid var(--blue);
  border-radius: 8px;
}

.metric-card span {
  color: var(--muted);
  font-weight: 700;
}

.metric-card strong {
  font-size: 30px;
  line-height: 1;
}

.metric-card.status-no-iniciado {
  border-left-color: var(--accent);
  background: linear-gradient(90deg, rgba(195, 25, 38, 0.09), #ffffff 46%);
}

.metric-card.status-no-iniciado strong {
  color: #c31926;
}

.metric-card.status-pendiente {
  border-left-color: var(--amber);
}

.metric-card.status-pendiente strong {
  color: #8b5b00;
}

.metric-card.status-revision {
  border-left-color: var(--blue);
  background: linear-gradient(90deg, rgba(39, 110, 241, 0.08), #ffffff 46%);
}

.metric-card.status-revision strong {
  color: #276ef1;
}

.metric-card.status-rechazado {
  border-left-color: #8b1e28;
  background: linear-gradient(90deg, rgba(139, 30, 40, 0.08), #ffffff 46%);
}

.metric-card.status-rechazado strong {
  color: #8b1e28;
}

.metric-card.status-completado {
  border-left-color: var(--green);
}

.metric-card.status-completado strong {
  color: #12805c;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr 150px 1fr 170px 1.3fr;
  gap: 12px;
  align-items: end;
}

.field {
  display: grid;
  gap: 6px;
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.orders-panel,
.map-panel,
.users-panel {
  min-width: 0;
  overflow: hidden;
}

.section-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.inline-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.section-heading span {
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.orders-table-wrap {
  max-height: min(680px, 68vh);
  overflow: auto;
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.orders-table th,
.orders-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
}

.orders-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f9fbfc;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.orders-table tbody tr {
  cursor: pointer;
}

.orders-table tbody tr:hover {
  background: #f6fafb;
}

.orders-table tbody tr.has-excel-comment {
  background: #fffaf0;
  box-shadow: inset 4px 0 0 #d9822b;
}

.orders-table tbody tr.has-excel-comment:hover {
  background: #fff5e6;
}

.orders-table tbody tr.has-failed-visit {
  background: #eef6ff;
  box-shadow: inset 4px 0 0 #276ef1;
}

.orders-table tbody tr.has-failed-visit:hover {
  background: #e4f0ff;
}

.orders-table tbody tr.has-operator-evidence {
  background: #fff7ed;
  box-shadow: inset 4px 0 0 #f97316;
}

.orders-table tbody tr.has-operator-evidence:hover {
  background: #ffedd5;
}

.orders-table tbody tr.sent-to-client {
  background: #b7f0c7;
  box-shadow: inset 5px 0 0 #0f7a3a;
}

.orders-table tbody tr.sent-to-client:hover {
  background: #9be7b1;
}

.orders-table tbody tr.sent-to-client td {
  border-bottom-color: rgba(15, 122, 58, 0.22);
}

.orders-table tbody tr.manual-execute-row {
  background: #ecfdf5;
  box-shadow: inset 5px 0 0 #0f766e;
}

.orders-table tbody tr.manual-execute-row:hover {
  background: #d1fae5;
}

.orders-table tbody tr.manual-execute-row td {
  border-bottom-color: rgba(15, 118, 110, 0.18);
}

.orders-table.execute-table th:nth-child(4),
.orders-table.execute-table th:nth-child(8),
.orders-table.execute-table th:nth-child(9),
.orders-table.execute-table th:nth-child(10) {
  display: none;
}

.orders-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operational-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 14px;
}

.operational-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid #d7dee8;
  border-radius: 8px;
  background: #fff;
  color: #304050;
  font-weight: 800;
  cursor: pointer;
}

.operational-tab strong {
  min-width: 28px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f6;
  color: #5b6875;
  font-size: 12px;
  text-align: center;
}

.operational-tab.active {
  border-color: #c31926;
  background: #fff5f6;
  color: #8b1e28;
}

.operational-tab.active strong {
  background: #c31926;
  color: #fff;
}

.execute-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 16px 14px;
}

.execute-toolbar[hidden] {
  display: none;
}

.execute-sort-field {
  display: inline-grid;
  gap: 5px;
  min-width: 190px;
}

.execute-sort-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.execute-sort-field select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  background: #fff;
  font: inherit;
}

.row-sub-id {
  display: block;
  margin-top: 3px;
  color: #7a8694;
  font-size: 11px;
  font-weight: 800;
}

.status-pill,
.role-pill,
.origin-pill,
.provider-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 104px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.status-pill.no-iniciado {
  background: #fde7ea;
  color: #8b1e28;
  box-shadow: inset 0 0 0 1px rgba(195, 25, 38, 0.18);
}

.status-pill.pendiente {
  background: #fff4d8;
  color: #8b5b00;
  box-shadow: inset 0 0 0 1px rgba(247, 183, 49, 0.22);
}

.status-pill.revision {
  background: #e7efff;
  color: #174ea6;
  box-shadow: inset 0 0 0 1px rgba(39, 110, 241, 0.18);
}

.status-pill.rechazado {
  background: #fde7ea;
  color: #8b1e28;
  box-shadow: inset 0 0 0 1px rgba(139, 30, 40, 0.2);
}

.status-pill.completado {
  background: #dff4ea;
  color: #0a6848;
  box-shadow: inset 0 0 0 1px rgba(18, 128, 92, 0.18);
}

.status-pill.enviado-al-cliente {
  background: #b7f0c7;
  color: #075f35;
  box-shadow: inset 0 0 0 1px rgba(15, 122, 58, 0.24);
}

.role-pill {
  min-width: auto;
  background: #eef2f6;
  color: #304050;
}

.origin-pill {
  min-width: 86px;
  background: #eef2f6;
  color: #304050;
}

.origin-pill.ticket {
  background: #fff0d6;
  color: #815000;
  box-shadow: inset 0 0 0 1px rgba(210, 128, 0, 0.22);
}

.origin-pill.client {
  background: #e8f1ff;
  color: #174ea6;
  box-shadow: inset 0 0 0 1px rgba(39, 110, 241, 0.18);
}

.origin-pill.excel {
  background: #edf7f0;
  color: #17623b;
  box-shadow: inset 0 0 0 1px rgba(25, 126, 74, 0.16);
}

.origin-pill.execute {
  background: #f0ecff;
  color: #4b32a8;
  box-shadow: inset 0 0 0 1px rgba(88, 64, 180, 0.16);
}

.origin-pill.manual {
  background: #ccfbf1;
  color: #0f5f56;
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.2);
}

.origin-pill.operator-mail {
  background: #fff7ed;
  color: #9a3412;
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.2);
}

.provider-pill {
  min-width: 92px;
  background: #eef2f6;
  color: #40505c;
}

.provider-pill.exists {
  background: #dff4ea;
  color: #0a6848;
  box-shadow: inset 0 0 0 1px rgba(18, 128, 92, 0.18);
}

.provider-pill.missing {
  background: #fde7ea;
  color: #8b1e28;
  box-shadow: inset 0 0 0 1px rgba(139, 30, 40, 0.2);
}

.provider-pill.unchecked {
  background: #eef2f6;
  color: #657380;
}

.operation-pill {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-width: 118px;
  padding: 7px 10px;
  border-radius: 999px;
  overflow: hidden;
  color: #40505c;
  background: #eef2f6;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operation-pill.completado {
  background: #dff4ea;
  color: #0a6848;
  box-shadow: inset 0 0 0 1px rgba(18, 128, 92, 0.18);
}

.operation-pill.pendiente {
  background: #fff4d8;
  color: #8b5b00;
  box-shadow: inset 0 0 0 1px rgba(247, 183, 49, 0.22);
}

.operation-pill.revision {
  background: #e7efff;
  color: #174ea6;
  box-shadow: inset 0 0 0 1px rgba(39, 110, 241, 0.18);
}

.operation-pill.rechazado,
.operation-pill.missing {
  background: #fde7ea;
  color: #8b1e28;
  box-shadow: inset 0 0 0 1px rgba(139, 30, 40, 0.2);
}

.operation-pill.no-iniciado,
.operation-pill.unchecked {
  background: #eef2f6;
  color: #657380;
}

.viper-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  min-width: 112px;
  padding: 7px 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #eef2f6;
  color: #657380;
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viper-pill.found {
  background: #dff4ea;
  color: #0a6848;
  box-shadow: inset 0 0 0 1px rgba(18, 128, 92, 0.18);
}

.viper-pill.missing {
  background: #fde7ea;
  color: #8b1e28;
  box-shadow: inset 0 0 0 1px rgba(139, 30, 40, 0.2);
}

.viper-pill.unchecked {
  background: #eef2f6;
  color: #657380;
}

.comment-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 120px;
  margin-left: 8px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #fff2d9;
  color: #8b5b00;
  box-shadow: inset 0 0 0 1px rgba(217, 130, 43, 0.24);
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
}

.comment-badge svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.comment-badge span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operator-email-badge {
  background: #ffedd5;
  color: #9a3412;
  box-shadow: inset 0 0 0 1px rgba(249, 115, 22, 0.28);
}

.failed-visit-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: 128px;
  margin-left: 8px;
  padding: 5px 8px;
  border-radius: 999px;
  background: #e7efff;
  color: #174ea6;
  box-shadow: inset 0 0 0 1px rgba(39, 110, 241, 0.22);
  font-size: 11px;
  font-weight: 800;
  vertical-align: middle;
}

.failed-visit-badge svg {
  width: 14px;
  height: 14px;
  flex: 0 0 14px;
}

.failed-visit-badge span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.map,
.detail-map {
  width: 100%;
  background: #e7ecef;
}

.map {
  height: 460px;
}

.detail-map {
  height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.users-panel {
  display: none;
}

.users-panel.visible,
.notifications-panel.visible,
.reports-panel.visible,
.pending-monitor-panel.visible,
.backups-panel.visible,
.history-panel.visible {
  display: block;
}

.notifications-panel,
.reports-panel,
.pending-monitor-panel,
.backups-panel,
.history-panel {
  display: none;
  padding: 18px;
}

.history-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(160px, 220px) minmax(180px, 240px);
  gap: 12px;
  margin: 16px 0 12px;
}

.history-filters label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.history-filters input,
.history-filters select {
  min-height: 42px;
  background: #fff;
}

.history-summary {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.history-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
}

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

.history-table th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  background: #f6f8fa;
}

.history-table td {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
}

.history-table tr:last-child td {
  border-bottom: 0;
}

.audit-type-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: #eef2f7;
  color: #2b3440;
  font-size: 12px;
  font-weight: 900;
}

.audit-detail {
  color: var(--muted);
}

.notifications-form {
  display: grid;
  gap: 18px;
  max-width: 980px;
}

.notification-groups {
  display: grid;
  gap: 16px;
}

.notification-group {
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.notification-group-head {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

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

.notification-group label,
.notification-email-field {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.notification-group input[type="text"],
.notification-group textarea,
.notification-email-field textarea {
  width: 100%;
  padding: 12px;
  color: var(--ink);
}

.notification-group input[type="text"] {
  min-height: 42px;
}

.notification-group textarea,
.notification-email-field textarea {
  min-height: 150px;
  resize: vertical;
}

.notification-options {
  display: grid;
  gap: 10px;
}

.notification-options label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--ink);
  font-weight: 800;
}

.notification-options input {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
}

.notification-actions {
  display: flex;
  justify-content: flex-start;
}

.notification-save-status {
  align-self: center;
  color: var(--muted);
  font-weight: 800;
}

.notification-save-status[data-type="warning"] {
  color: #8b5b00;
}

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

.report-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.report-card h3 {
  margin: 0 0 6px;
  font-size: 18px;
  letter-spacing: 0;
}

.report-card p {
  margin: 0;
  color: var(--muted);
}

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

.report-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.report-card textarea {
  min-height: 96px;
  padding: 10px 12px;
  resize: vertical;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.report-card input[type="url"],
.report-card input[type="password"],
.report-card input[type="text"],
.report-card input[type="time"],
.report-card input[type="number"] {
  min-height: 42px;
}

.report-schedules {
  display: grid;
  gap: 12px;
}

.report-schedule {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.report-schedule-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.report-days {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.day-chip {
  display: inline-flex !important;
  align-items: center;
  gap: 6px !important;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink) !important;
  font-size: 12px !important;
  font-weight: 800 !important;
  text-transform: none !important;
}

.day-chip input {
  accent-color: var(--accent);
}

.report-schedule-status {
  font-size: 12px;
}

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

.backup-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.backup-row div {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.backup-row strong,
.backup-row span {
  overflow-wrap: anywhere;
}

.backup-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.toggle-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
  color: var(--ink) !important;
  text-transform: none !important;
  font-size: 14px !important;
}

.toggle-row input {
  width: 18px;
  min-height: 18px;
  padding: 0;
}

.report-preview-shell {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.report-preview-shell iframe {
  width: 100%;
  min-height: 720px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.section-heading.compact {
  margin-top: 4px;
}

.map-popup-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  margin-top: 8px;
  padding: 0 12px;
  border-radius: 8px;
  background: #276ef1;
  color: #fff;
  font-weight: 800;
  text-decoration: none;
}

.user-form {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 150px minmax(190px, 1fr) 130px 160px 160px 180px auto;
  gap: 10px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.bulk-user-form {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
}

.bulk-user-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 14px;
  align-items: end;
}

.bulk-user-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
}

.bulk-user-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.bulk-user-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.bulk-user-form textarea {
  min-height: 140px;
  padding: 12px;
  resize: vertical;
  line-height: 1.45;
}

.users-list {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.user-card {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 150px 190px 190px auto auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.user-card strong,
.user-card span {
  display: block;
}

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

.session-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0;
}

.session-pill.active {
  background: #dcfce7;
  color: #166534;
}

.session-pill.inactive {
  background: #f1f5f9;
  color: #64748b;
}

.user-rut-edit {
  display: grid;
  gap: 4px;
}

.user-rut-edit span {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.user-rut-edit input {
  min-width: 0;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
}

.user-category-edit {
  display: grid;
  gap: 4px;
}

.user-category-edit span {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
}

.user-category-edit select {
  min-width: 0;
  width: 100%;
  min-height: 38px;
  padding: 7px 10px;
  background: #fff;
}

.user-save-rut {
  min-height: 40px;
  white-space: nowrap;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  background: #fff;
  color: var(--ink);
}

.detail-modal {
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  box-shadow: var(--shadow);
}

.maintenance-modal,
.preview-modal,
.reject-modal,
.image-preview-modal,
.password-change-modal,
.manual-execute-modal {
  width: min(1380px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.preview-modal {
  width: min(1180px, calc(100vw - 28px));
}

.reject-modal {
  width: min(620px, calc(100vw - 28px));
}

.image-preview-modal {
  width: min(1040px, calc(100vw - 24px));
}

.password-change-modal {
  width: min(460px, calc(100vw - 28px));
}

.manual-execute-modal {
  width: min(860px, calc(100vw - 28px));
}

.detail-modal::backdrop,
.maintenance-modal::backdrop,
.preview-modal::backdrop,
.reject-modal::backdrop,
.image-preview-modal::backdrop,
.password-change-modal::backdrop,
.manual-execute-modal::backdrop {
  background: rgba(6, 10, 14, 0.55);
}

body.modal-compat-active::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9998;
  background: rgba(6, 10, 14, 0.55);
}

.password-change-modal.modal-compat-open {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 9999;
  transform: translate(-50%, -50%);
}

.modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.detail-layout {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 18px;
  padding: 18px;
}

.password-change-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.password-change-body p {
  margin: 0;
  color: var(--muted);
}

.password-change-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.password-change-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
}

.detail-summary {
  display: grid;
  gap: 10px;
  align-content: start;
}

.detail-row {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.detail-row strong {
  overflow-wrap: anywhere;
}

.sync-address-button {
  justify-content: center;
}

.sync-address-button.needs-sync {
  border-color: rgba(13, 110, 253, 0.34);
  color: #0b4f9f;
}

.sync-address-status {
  min-height: 18px;
  margin: -2px 2px 2px;
  color: var(--muted);
  font-size: 12px;
}

.raw-fields {
  padding: 0 18px 18px;
}

.order-comments-section {
  display: grid;
  gap: 12px;
}

.order-history-section {
  display: grid;
  gap: 12px;
}

.order-comment-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.order-comment-form textarea {
  width: 100%;
  min-height: 82px;
  padding: 10px 12px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font: inherit;
}

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

.order-comment-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid #276ef1;
  border-radius: 8px;
  background: #f7fbff;
}

.order-comment-item div {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}

.order-comment-item span,
.empty-comments {
  color: var(--muted);
  font-size: 13px;
}

.order-comment-item p {
  margin: 0;
  color: var(--ink);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

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

.order-history-item {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.history-marker {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 999px;
  background: #276ef1;
  box-shadow: 0 0 0 4px #eaf1ff;
}

.order-history-item.rechazo .history-marker {
  background: #9f1239;
  box-shadow: 0 0 0 4px #ffe4e6;
}

.order-history-item.proveedor .history-marker,
.order-history-item.viper .history-marker {
  background: #168a4a;
  box-shadow: 0 0 0 4px #dcfce7;
}

.order-history-item.borrador .history-marker {
  background: #f7b731;
  box-shadow: 0 0 0 4px #fff3cd;
}

.order-history-item header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 5px;
}

.order-history-item header span,
.order-history-item small {
  color: var(--muted);
  font-size: 12px;
}

.order-history-item p {
  margin: 0 0 6px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.wide-button {
  width: 100%;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.reject-modal .form-actions {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.provider-upload-progress {
  display: grid;
  gap: 8px;
  padding: 12px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: #f7fafb;
}

.provider-upload-progress[hidden] {
  display: none;
}

.provider-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
  font-size: 13px;
}

.provider-progress-head strong {
  overflow-wrap: anywhere;
}

.provider-progress-head span {
  color: var(--muted);
  font-weight: 900;
}

.provider-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #d9e1e4;
}

.provider-progress-track > div {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #c61224;
  transition: width 240ms ease;
}

.provider-upload-progress[data-type="success"] .provider-progress-track > div {
  background: #168a4a;
}

.provider-upload-progress[data-type="error"] .provider-progress-track > div {
  background: #9f1239;
}

.reject-body {
  padding: 18px;
}

.reject-body label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.reject-body textarea {
  width: 100%;
  min-height: 170px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  font: inherit;
}

.manual-execute-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.manual-execute-body .form-actions {
  margin: 0 -18px -18px;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.rejection-note {
  margin: 14px;
  padding: 12px 14px;
  border: 1px solid rgba(139, 30, 40, 0.22);
  border-left: 5px solid #8b1e28;
  border-radius: 8px;
  background: #fff4f5;
  color: #5f151c;
}

.rejection-note strong {
  display: block;
  margin-bottom: 6px;
}

.rejection-note p {
  margin: 0;
  white-space: pre-wrap;
}

.maintenance-workspace {
  display: grid;
  grid-template-columns: 360px minmax(720px, 1fr);
  gap: 18px;
  padding: 18px;
  background: #f5f7f8;
}

.maintenance-workspace.single-column-form {
  grid-template-columns: minmax(0, 1fr);
}

.emergency-form-modal .maintenance-editor {
  max-width: 1120px;
}

.maintenance-editor,
.maintenance-preview-wrap {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.compact-heading {
  padding: 14px;
}

.compact-heading h2 {
  font-size: 18px;
}

.editor-grid,
.check-grid,
.photo-loader-grid,
.evidence-upload-grid {
  display: grid;
  gap: 10px;
  padding: 14px;
}

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

.check-grid,
.photo-loader-grid,
.evidence-upload-grid {
  grid-template-columns: 1fr;
}

.editor-grid label,
.check-grid label,
.textarea-label,
.photo-loader {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.editor-grid input,
.check-grid select,
.textarea-label textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  text-transform: none;
}

.editor-grid input[readonly] {
  background: #f4f7fa;
  color: var(--muted);
}

.editor-grid input.locked-field,
.check-grid select:disabled {
  background: #eef3f6;
  color: var(--muted);
  cursor: not-allowed;
}

.textarea-label {
  padding: 0 14px 14px;
}

.textarea-label textarea {
  resize: vertical;
}

.photo-loader {
  min-height: 74px;
  align-content: center;
  padding: 12px;
  border: 1px dashed #b9c4cc;
  border-radius: 8px;
  background: #f9fbfc;
  cursor: pointer;
}

.photo-loader input {
  border: 0;
  padding: 0;
}

.photo-loader input:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.photo-loader.is-uploaded {
  border-color: rgba(5, 150, 105, 0.55);
  background: #effcf7;
}

.photo-loader small {
  color: var(--accent);
  font-size: 11px;
  font-weight: 900;
}

.photo-upload-state {
  display: inline-flex;
  width: fit-content;
  margin-left: 8px;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(5, 150, 105, 0.12);
  color: #047857 !important;
  letter-spacing: 0;
}

.photo-rule {
  margin: 0;
  padding: 0 14px 16px;
  color: var(--muted);
  font-size: 13px;
}

.ot-evidence-panel {
  border-top: 1px solid var(--line);
}

.extra-evidence-uploader {
  display: grid;
  gap: 10px;
  padding: 0 14px 14px;
}

.add-photo-button {
  justify-content: center;
  min-height: 44px;
}

.extra-evidence-upload-list {
  display: grid;
  gap: 10px;
}

.extra-evidence-upload-list:empty {
  display: none;
}

.photo-loader.extra-photo-loader {
  border-style: solid;
  background: #fff;
}

.photo-loader.extra-photo-loader.is-uploaded {
  border-color: rgba(22, 128, 74, 0.35);
  background: #f3fbf7;
}

.evidence-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
}

.evidence-gallery.compact {
  padding: 0 14px 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.evidence-card {
  min-width: 0;
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.evidence-card strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.25;
}

.evidence-card > span {
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.evidence-card small {
  color: var(--muted);
  display: block;
  font-size: 11px;
  line-height: 1.35;
  word-break: break-word;
}

.evidence-media {
  display: grid;
  place-items: center;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  background: #eef3f6;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.evidence-preview-button {
  position: relative;
  width: 100%;
  height: 100%;
  border: 0;
  padding: 0;
  overflow: hidden;
  background: transparent;
  cursor: zoom-in;
}

.evidence-media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.evidence-preview-button > span {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  background: rgba(8, 13, 18, 0.78);
  color: #fff;
  font-size: 11px;
  font-weight: 900;
}

.evidence-preview-button:focus-visible,
.sheet-photo-slot.has-photo:focus-visible,
.signature-slot.has-photo:focus-visible {
  outline: 3px solid rgba(198, 18, 36, 0.38);
  outline-offset: 2px;
}

.evidence-section {
  margin-top: 14px;
}

.maintenance-preview-wrap {
  padding: 16px;
  overflow: auto;
}

.maintenance-sheet {
  width: 1050px;
  min-height: 1360px;
  margin: 0 auto;
  background: #fff;
  color: #020304;
  border: 1.5px solid #0b0d10;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 13px;
  letter-spacing: 0;
}

.maintenance-sheet * {
  box-sizing: border-box;
}

.sheet-row {
  display: grid;
  border-bottom: 1.5px solid #0b0d10;
}

.sheet-header {
  grid-template-columns: 140px 1fr 270px;
  min-height: 56px;
}

.sheet-logo,
.sheet-title,
.sheet-version,
.info-row > div,
.general-grid > *,
.anomalies-grid > *,
.reception-grid > * {
  display: flex;
  align-items: center;
  border-right: 1.5px solid #0b0d10;
  padding: 5px 8px;
}

.sheet-logo img {
  max-width: 118px;
  height: auto;
}

.sheet-title {
  justify-content: center;
  font-size: 20px;
  font-weight: 900;
}

.sheet-version {
  justify-content: center;
}

.sheet-band {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  background: #d9d9d9;
  border-bottom: 1.5px solid #0b0d10;
  font-size: 18px;
  font-weight: 900;
}

.sheet-info-grid {
  grid-template-columns: 140px 1fr 190px 2.2fr 120px 1fr;
  border-bottom: 1.5px solid #0b0d10;
}

.sheet-info-grid > *,
.general-grid > * {
  display: flex;
  align-items: center;
  min-height: 42px;
  border-right: 1.5px solid #0b0d10;
  border-bottom: 1.5px solid #0b0d10;
  padding: 5px 8px;
}

.sheet-info-grid > :nth-last-child(-n + 6) {
  border-bottom: 0;
}

.sheet-info-grid > :last-child,
.general-grid > :last-child,
.anomalies-grid > :last-child {
  border-right: 0;
}

.sheet-info-grid > span,
.general-grid > span {
  font-size: 17px;
}

.sheet-info-grid strong,
.general-grid strong {
  font-weight: 900;
}

.sheet-grid {
  display: grid;
}

.general-grid {
  grid-template-columns: 125px 1.3fr 1.1fr 135px 1fr 0.9fr;
  border-bottom: 1.5px solid #0b0d10;
}

.general-grid > strong {
  justify-content: center;
}

.general-grid > :nth-last-child(-n + 6) {
  border-bottom: 0;
}

.general-grid .span-two {
  grid-column: span 2;
}

.general-grid .span-five {
  grid-column: span 5;
}

.requested {
  min-height: 78px;
  padding: 10px;
  border-bottom: 1.5px solid #0b0d10;
  font-size: 18px;
  font-weight: 900;
}

.anomalies-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(96px, 1.55fr) 0.45fr 0.45fr 0.45fr 0.45fr);
  border-bottom: 1.5px solid #0b0d10;
}

.anomalies-grid > * {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 4px 6px;
  border-right: 1.5px solid #0b0d10;
  font-size: 13px;
  text-align: center;
}

.anomalies-grid strong {
  font-weight: 900;
}

.anomalies-grid b {
  font-size: 14px;
  font-weight: 900;
}

.sheet-photos {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  min-height: 530px;
  border-bottom: 1.5px solid #0b0d10;
}

.sheet-photo-slot,
.signature-slot {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #f7f8f9;
  color: #68727d;
  font-weight: 800;
}

.sheet-photo-slot.has-photo,
.signature-slot.has-photo {
  cursor: zoom-in;
}

.sheet-photo-slot {
  border-right: 1.5px solid #0b0d10;
}

.sheet-photo-slot:last-child {
  border-right: 0;
}

.sheet-photo-slot img,
.signature-slot img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sheet-photo-slot span,
.signature-slot span {
  position: absolute;
  inset: auto 12px 12px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid #d8dee3;
  text-align: center;
}

.sheet-photo-slot.has-photo span {
  display: none;
}

.signature-slot {
  width: 300px;
  max-width: 100%;
  height: 78px;
  justify-self: center;
  border: 1px dashed #8b98a3;
}

.signature-slot img {
  object-fit: contain;
  background: #fff;
}

.signature-slot.has-photo span {
  display: none;
}

.contractor-signature-panel,
.client-signature-panel {
  display: grid;
  gap: 12px;
  padding: 12px 0;
}

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

.touch-signature-field > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.touch-signature-field canvas {
  width: 100%;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  touch-action: none;
}

.touch-signature-field .ghost-button {
  justify-self: start;
}

.contractor-reception-box,
.client-reception-box {
  display: grid;
  gap: 8px;
  padding: 8px;
}

.contractor-reception-box {
  align-content: start;
}

.client-reception-box .signature-slot {
  height: 70px;
}

.contractor-reception-box .signature-slot {
  height: 64px;
}

.sheet-observations {
  min-height: 100px;
  padding: 14px 12px;
  border-bottom: 1.5px solid #0b0d10;
  font-size: 20px;
  font-weight: 700;
}

.sheet-observations span {
  margin-left: 6px;
}

.reception-grid {
  display: grid;
  grid-template-columns: 42px 1fr 42px 1fr;
  min-height: 124px;
}

.reception-grid .contractor-reception-box,
.reception-grid .client-reception-box {
  display: grid;
  align-items: start;
}

.sheet-export-host {
  position: fixed;
  left: -200vw;
  top: 0;
  width: 1050px;
  background: #fff;
  pointer-events: none;
  z-index: 0;
}

.maintenance-sheet.exporting {
  margin: 0;
  transform: none;
}

.contractor-label,
.client-label {
  position: relative;
  justify-content: center;
  overflow: hidden;
  text-align: center;
  font-weight: 900;
}

.contractor-label span,
.client-label span {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 112px;
  transform: translate(-50%, -50%) rotate(-90deg);
  transform-origin: center;
  white-space: nowrap;
}

.client-label span {
  width: 80px;
}

.reception-grid > div:nth-child(2),
.reception-grid > div:nth-child(4) {
  display: grid;
  align-content: start;
  gap: 8px;
  border-right: 1.5px solid #0b0d10;
}

.preview-target {
  padding: 18px;
  overflow: auto;
  background: #eef2f5;
}

.preview-target .maintenance-sheet {
  transform-origin: top left;
}

.image-preview-body {
  display: grid;
  place-items: center;
  padding: 16px;
  background: #111820;
}

.image-preview-body img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 160px);
  object-fit: contain;
  background: #fff;
}

.fields-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.field-chip {
  min-height: 70px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.field-chip span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.field-chip strong {
  overflow-wrap: anywhere;
}

.excel-comment-chip {
  grid-column: 1 / -1;
  min-height: auto;
  background: #fff7e8;
  border-color: rgba(217, 130, 43, 0.45);
  box-shadow: inset 4px 0 0 #d9822b;
}

.excel-comment-chip span {
  color: #8b5b00;
}

.excel-comment-chip strong {
  display: block;
  color: #5f3b00;
  font-size: 15px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.hidden {
  display: none !important;
}

.mobile-app .shell {
  grid-template-columns: 1fr;
}

.mobile-app .sidebar {
  position: relative;
  height: auto;
  padding: 14px;
  gap: 14px;
}

.mobile-app .brand-stack {
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 12px;
}

.mobile-app .avanthia-lockup {
  min-height: 54px;
}

.mobile-app .emergency-logo {
  width: 64px;
  height: 64px;
}

.mobile-app .main-nav {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.mobile-app .nav-item {
  justify-content: center;
  min-height: 46px;
}

.mobile-app .nav-item span {
  display: none;
}

.mobile-app .session-panel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: center;
}

.mobile-app .session-panel span,
.mobile-app .session-panel small {
  grid-column: 1 / -1;
}

.mobile-app .session-panel .ghost-button {
  grid-row: auto;
  grid-column: auto;
  min-width: 44px;
  padding: 0 12px;
}

.mobile-app .session-panel strong,
.mobile-app .session-panel .server-status {
  grid-column: 1 / -1;
}

.mobile-app .main {
  padding: 14px;
}

.mobile-app .topbar,
.mobile-app .topbar-actions {
  align-items: stretch;
  flex-direction: column;
}

.mobile-app .topbar h1 {
  font-size: 22px;
}

.mobile-app .metrics,
.mobile-app .filters,
.mobile-app .content-grid,
.mobile-app .detail-layout,
.mobile-app .user-form,
.mobile-app .reports-grid,
.mobile-app .report-fields,
.mobile-app .fields-grid,
.mobile-app .maintenance-workspace,
.mobile-app .editor-grid {
  grid-template-columns: 1fr;
}

.mobile-app .map {
  height: 380px;
}

.mobile-app .orders-table {
  min-width: 1240px;
}

.mobile-app .maintenance-sheet {
  width: 980px;
}

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

  .content-grid,
  .detail-layout {
    grid-template-columns: 1fr;
  }

  .map {
    height: 430px;
  }
}

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

  .sidebar {
    position: relative;
    height: auto;
  }

  .brand-stack {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .emergency-logo {
    width: 84px;
    height: 84px;
  }

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

  .nav-item {
    justify-content: center;
  }

  .nav-item span {
    display: none;
  }

  .main,
  .sidebar {
    padding: 18px;
  }

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

  .topbar-actions {
    justify-content: flex-start;
  }

  .provider-sync-card,
  .provider-sync-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .provider-sync-actions {
    justify-content: flex-start;
  }

  .provider-sync-progress {
    grid-template-columns: 42px minmax(0, 1fr);
  }

  .pending-upload-item {
    grid-template-columns: 1fr;
  }

  .pending-upload-counts,
  .pending-upload-actions {
    justify-content: flex-start;
    text-align: left;
  }

  .metrics,
  .filters,
  .user-form,
  .bulk-user-head,
  .bulk-user-options,
  .reports-grid,
  .report-fields,
  .notification-group-grid,
  .history-filters,
  .fields-grid,
  .maintenance-workspace,
  .editor-grid,
  .evidence-gallery.compact {
    grid-template-columns: 1fr;
  }

  .orders-table {
    min-width: 1240px;
  }

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

  .maintenance-sheet {
    width: 980px;
  }
}
