﻿:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #132033;
  --muted: #667085;
  --line: #d7deea;
  --blue: #0b3b8f;
  --blue-strong: #072b6f;
  --blue-soft: #e8f0ff;
  --green: #20845c;
  --red: #c83333;
  --yellow: #b87900;
  --shadow: 0 8px 24px rgba(20, 35, 60, 0.08);
}


* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 1080px;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  line-height: 1.45;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(11, 59, 143, 0.10), rgba(32, 132, 92, 0.08)),
    var(--bg);
  padding: 24px;
}

.login-card {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-card h1 {
  color: var(--blue-strong);
}

.login-message {
  margin: 0;
  border: 1px solid #f2b5b5;
  border-radius: 8px;
  background: #fff0f0;
  color: var(--red);
  padding: 10px;
  font-weight: 800;
}

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

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 16px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 25px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-switch {
  display: grid;
  gap: 4px;
  min-width: 240px;
}

.user-info {
  display: grid;
  gap: 2px;
  min-width: 190px;
}

.user-info span {
  color: var(--blue-strong);
  font-size: 12px;
  font-weight: 800;
}

.user-info strong {
  color: var(--ink);
  font-size: 14px;
}

.user-switch span,
.field span,
.choice-field legend {
  color: var(--blue-strong);
  font-size: 12px;
  font-weight: 800;
}

.status-pill,
.hint-pill {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.hint-pill {
  background: var(--blue-soft);
  color: var(--blue);
}

.case-number-box {
  display: grid;
  min-width: 230px;
  place-items: center;
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  padding: 12px 16px;
  text-align: center;
}

.case-number-box span {
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.case-number-box strong {
  margin-top: 3px;
  font-size: 20px;
}

.compact-box {
  min-width: 190px;
  padding: 10px 12px;
}

.compact-box strong {
  font-size: 17px;
}

.status-ok {
  background: #e7f6ef;
  border-color: #b8e3cc;
  color: var(--green);
}

.status-error {
  background: #fff0f0;
  border-color: #f2b5b5;
  color: var(--red);
}

.status-waiting {
  background: #fff7e8;
  border-color: #f5d49a;
  color: var(--yellow);
}

.module-nav {
  display: flex;
  gap: 8px;
  padding: 12px 24px;
  background: #eef2f7;
  border-bottom: 1px solid var(--line);
}

.nav-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: var(--blue);
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
}

.nav-button.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.nav-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.app-shell {
  display: grid;
  grid-template-columns: 345px minmax(720px, 1fr);
  gap: 18px;
  padding: 18px;
}

.side-panel,
.view-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.side-panel {
  min-height: calc(100vh - 150px);
  padding: 16px;
}

.workspace {
  min-width: 0;
}

.panel-title-row,
.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-title-row h2 {
  margin-bottom: 12px;
  font-size: 19px;
}

.counter {
  display: inline-grid;
  min-width: 32px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  font-weight: 800;
}

.orders-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

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

.summary-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px;
}

.summary-grid strong,
.summary-grid span {
  display: block;
}

.summary-grid strong {
  color: var(--blue);
  font-size: 18px;
}

.summary-grid span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.filters-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
}

.filters-box summary {
  color: var(--blue);
  cursor: pointer;
  font-weight: 800;
}

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

.order-item {
  display: grid;
  gap: 5px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 12px;
  text-align: left;
  cursor: pointer;
}

.order-item strong {
  color: var(--blue);
  font-size: 14px;
}

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

.order-item em {
  justify-self: start;
  border-radius: 999px;
  background: #f1e7ff;
  color: #6b21a8;
  padding: 2px 8px;
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}

.order-item.status-pending-entry {
  background: #ffffff;
  border-color: #1d4ed8;
  box-shadow: inset 4px 0 0 #1d4ed8;
}

.order-item.status-received {
  border-color: #f97316;
  background: #ffedd5;
  box-shadow: inset 4px 0 0 #f97316;
}

.order-item.status-provider {
  border-color: #0891b2;
  background: #cffafe;
  box-shadow: inset 4px 0 0 #0891b2;
}

.order-item.status-ready {
  border-color: #16a34a;
  background: #dcfce7;
  box-shadow: inset 4px 0 0 #16a34a;
}

.order-item.status-closed {
  opacity: 0.72;
  border-color: #64748b;
  background: #f1f5f9;
}

.order-item.status-special {
  border-color: #7e22ce;
  background: #f3e8ff;
  box-shadow: inset 4px 0 0 #7e22ce;
}

.order-item.status-reentry {
  border-color: #dc2626;
  background: #fee2e2;
  box-shadow: inset 4px 0 0 #dc2626;
}

.order-item .reentry-badge {
  background: #dc2626;
  color: #ffffff;
}

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

.flow-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px;
}

.flow-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--blue);
  padding: 0 16px;
  font-weight: 800;
  cursor: pointer;
}

.flow-button.active {
  border-color: var(--blue);
  background: var(--blue);
  color: #ffffff;
  box-shadow: var(--shadow-soft, 0 4px 14px rgba(15, 23, 42, 0.06));
}

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

.queue-grid div {
  border: 1px solid #aac0e7;
  border-radius: 8px;
  background: #eef5ff;
  padding: 12px;
}

.queue-grid strong {
  display: block;
  color: var(--blue-strong);
  font-size: 28px;
  line-height: 1;
}

.queue-grid span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.view-panel {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.view-header h2 {
  margin-bottom: 0;
  color: var(--blue-strong);
  font-size: 24px;
}

.message {
  margin-bottom: 14px;
  border-radius: 8px;
  padding: 12px 14px;
  font-weight: 800;
}

.message.success {
  background: #e7f6ef;
  color: var(--green);
  border: 1px solid #b8e3cc;
}

.message.error {
  background: #fff0f0;
  color: var(--red);
  border: 1px solid #f2b5b5;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(15, 23, 42, 0.5);
  padding: 24px;
}

.receipt-modal {
  display: grid;
  gap: 14px;
  width: min(980px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.28);
  padding: 16px;
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h2 {
  margin-bottom: 0;
  color: var(--blue-strong);
}

.modal-actions {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.print-receipt {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
}

.receipt-sheet {
  display: grid;
  gap: 14px;
  color: #111827;
}

.receipt-header {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 3px solid var(--blue);
  padding-bottom: 12px;
}

.receipt-header p {
  margin-bottom: 2px;
  color: var(--blue);
  font-size: 14px;
  font-weight: 800;
  text-transform: uppercase;
}

.receipt-header h1 {
  color: var(--blue-strong);
  font-size: 24px;
}

.receipt-number {
  display: grid;
  min-width: 190px;
  place-items: center;
  border-radius: 8px;
  background: var(--blue);
  color: #ffffff;
  padding: 12px;
  text-align: center;
}

.receipt-number span {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.receipt-number strong {
  font-size: 24px;
}

.receipt-section {
  display: grid;
  gap: 8px;
}

.receipt-section h2 {
  margin-bottom: 0;
  border-radius: 6px;
  background: var(--blue);
  color: #ffffff;
  padding: 6px 10px;
  font-size: 14px;
}

.receipt-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.receipt-grid div,
.receipt-note,
.receipt-signatures div {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  padding: 8px;
}

.receipt-grid span,
.receipt-note span,
.receipt-signatures span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.receipt-grid strong,
.receipt-note strong,
.receipt-signatures strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.receipt-span {
  grid-column: span 2;
}

.receipt-conditions {
  margin-bottom: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  padding: 10px;
}

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

.receipt-signatures div {
  min-height: 120px;
}

.receipt-signatures img {
  display: block;
  max-width: 260px;
  max-height: 80px;
  margin-top: 8px;
}

.receipt-signatures small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

.case-form,
.support-form {
  display: grid;
  gap: 12px;
}

.module-split {
  display: grid;
  grid-template-columns: minmax(360px, 0.8fr) minmax(560px, 1.2fr);
  gap: 14px;
  align-items: start;
}

/* ══ Hub de navegación (Mostrador, Soporte Remoto, Soporte Físico) ══════════ */

/* Modo pantalla completa: oculta sidebar */
.app-shell.hub-mode .side-panel,
.app-shell.mostrador-hub-mode .side-panel {
  display: none;
}
.app-shell.hub-mode .workspace,
.app-shell.mostrador-hub-mode .workspace {
  grid-column: 1 / -1;
}

/* Contenedor del hub */
.hub-layout,
.mostrador-hub {
  padding: 24px 28px 32px;
}
.hub-layout .view-header,
.mostrador-hub .view-header {
  margin-bottom: 32px;
}
.hub-layout .view-header h2,
.mostrador-hub .view-header h2 {
  font-size: 1.5rem;
}

/* Grilla de acciones */
.hub-action-grid,
.mostrador-action-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
/* Mostrador sigue siendo 3 columnas */
.mostrador-action-grid {
  grid-template-columns: repeat(3, 1fr);
}

/* Tarjeta de acción */
.hub-action-card,
.mostrador-action-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  padding: 24px 20px 20px;
  border-radius: 12px;
  border: 2px solid transparent;
  background: var(--panel);
  cursor: pointer;
  text-align: left;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  position: relative;
}
.hub-action-card:hover,
.mostrador-action-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(0,0,0,.14);
}
.hub-action-card:active,
.mostrador-action-card:active {
  transform: translateY(0);
}

/* Variantes de color */
.hub-action-card.mac-blue,
.mostrador-action-card.mac-blue   { border-color: #3b82f6; background: #eff6ff; }
.hub-action-card.mac-green,
.mostrador-action-card.mac-green  { border-color: #22c55e; background: #f0fdf4; }
.hub-action-card.mac-amber,
.mostrador-action-card.mac-amber  { border-color: #f59e0b; background: #fffbeb; }
.hub-action-card.mac-purple       { border-color: #8b5cf6; background: #f5f3ff; }
.hub-action-card.mac-rose         { border-color: #f43f5e; background: #fff1f2; }
.hub-action-card.mac-slate        { border-color: #94a3b8; background: #f8fafc; }

/* Ícono */
.mac-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.mac-blue   .mac-icon   { background: #3b82f6; color: #fff; }
.mac-green  .mac-icon   { background: #22c55e; color: #fff; }
.mac-amber  .mac-icon   { background: #f59e0b; color: #fff; }
.mac-purple .mac-icon   { background: #8b5cf6; color: #fff; }
.mac-rose   .mac-icon   { background: #f43f5e; color: #fff; }
.mac-slate  .mac-icon   { background: #94a3b8; color: #fff; }
.mac-icon svg { width: 24px; height: 24px; }

/* Texto */
.mac-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.25;
}
.mac-desc {
  font-size: .82rem;
  color: var(--subtle);
  line-height: 1.4;
}

/* Badge de conteo */
.mac-badge {
  position: absolute;
  top: 12px; right: 14px;
  min-width: 26px; height: 26px;
  padding: 0 7px;
  border-radius: 13px;
  font-size: .78rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.mac-blue   .mac-badge { background: #3b82f6; color: #fff; }
.mac-green  .mac-badge { background: #22c55e; color: #fff; }
.mac-amber  .mac-badge { background: #f59e0b; color: #fff; }
.mac-purple .mac-badge { background: #8b5cf6; color: #fff; }
.mac-rose   .mac-badge { background: #f43f5e; color: #fff; }
.mac-slate  .mac-badge { background: #94a3b8; color: #fff; }

/* Sub-vista */
.hub-subview,
.mostrador-subview {
  padding: 0;
}
.hub-subview > .view-header,
.mostrador-subview > .view-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 0;
}
.hub-subview .detail-panel,
.mostrador-subview .detail-panel {
  margin: 16px 20px 20px;
}
/* Panel de detalle compartido para sub-vistas de Remoto y Físico */
.hub-subview-detail {
  margin: 16px 20px 20px;
}
.hub-subview-detail:empty::before {
  display: block;
  padding: 20px;
  color: var(--subtle);
  font-size: .9rem;
  content: "Seleccioná un caso de la lista.";
}
/* ══ fin Hub de navegación ══════════════════════════════════════════════════ */

.sub-header {
  padding: 8px 0 2px;
}

.form-section {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.form-section h3 {
  margin: 0;
  background: var(--blue);
  color: #ffffff;
  padding: 8px 14px;
  font-size: 15px;
}

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

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

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

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

.span-3 {
  grid-column: span 3;
}

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.field.compact {
  margin-bottom: 10px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 38px;
  border: 1px solid #c7d0dd;
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 8px 10px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  outline: 2px solid rgba(11, 59, 143, 0.14);
}

.choice-field {
  display: flex;
  align-items: end;
  gap: 16px;
  min-height: 62px;
  border: 0;
  margin: 0;
  padding: 0;
}

.choice-field label,
.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-weight: 700;
}

.inline-check {
  align-self: end;
  min-height: 38px;
}

.choice-field input,
.checkbox-line input {
  width: 18px;
  min-height: 18px;
}

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

.signature-field > span {
  color: var(--blue-strong);
  font-size: 12px;
  font-weight: 800;
}

.signature-field canvas {
  width: 100%;
  height: 150px;
  border: 1px solid #c7d0dd;
  border-radius: 6px;
  background: #ffffff;
  touch-action: none;
}

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

.intake-highlight {
  border: 2px solid #0ea5e9;
  border-radius: 8px;
  background: #eff6ff;
  padding: 2px;
}

.intake-highlight .form-section {
  border-color: #93c5fd;
}

.intake-highlight .form-section h3 {
  background: #075985;
}

.form-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  padding: 12px;
  box-shadow: var(--shadow);
}

.primary-button,
.secondary-button {
  min-height: 38px;
  border-radius: 7px;
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
}

.primary-button {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #ffffff;
}

.secondary-button {
  border: 1px solid #c7d0dd;
  background: #ffffff;
  color: var(--blue);
}

.small-button {
  justify-self: start;
  min-height: 32px;
  padding: 0 10px;
}

.customer-hint {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 6px 12px;
  align-items: center;
  border: 1px solid #c084fc;
  border-radius: 8px;
  background: #faf5ff;
  color: #3b0764;
  padding: 10px;
}

.customer-hint strong {
  display: block;
}

.customer-hint span {
  color: #6b21a8;
  font-size: 12px;
}

.serial-hint-warning {
  display: block;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  color: #92400e;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 4px;
}

.serial-hint-info {
  display: block;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  color: #1e40af;
  padding: 10px 12px;
  font-size: 13px;
}

.notifications-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.notification-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  background: #f0f9ff;
  padding: 10px;
}

.notification-item strong,
.notification-item span {
  display: block;
}

.notification-item span,
.notification-item p {
  color: var(--muted);
  font-size: 12px;
}

.notification-item p {
  margin: 4px 0 0;
}

.notification-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.lock-banner {
  border: 1px solid #c7d0dd;
  border-radius: 8px;
  background: #f8fafc;
  color: var(--blue-strong);
  padding: 10px 12px;
  font-weight: 800;
}

.lock-banner.warning {
  border-color: #f5d49a;
  background: #fff7e8;
  color: var(--yellow);
}

.lock-banner.ok {
  border-color: #b8e3cc;
  background: #e7f6ef;
  color: var(--green);
}

.lock-banner.printed {
  border-color: #c4b5fd;
  background: #f5f3ff;
  color: #5b21b6;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.lock-banner.printed .secondary-button {
  margin-left: auto;
}

.receipt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.receipt-table th,
.receipt-table td {
  border: 1px solid #d1d5db;
  padding: 4px 8px;
  text-align: left;
}

.receipt-table th {
  background: #f3f4f6;
  font-weight: 700;
}

.fallas-por-marca-wrap {
  overflow-x: auto;
}

.fallas-por-marca-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  min-width: 600px;
}

.fallas-por-marca-table th,
.fallas-por-marca-table td {
  border: 1px solid #e5e7eb;
  padding: 6px 10px;
  text-align: center;
  white-space: nowrap;
}

.fallas-por-marca-table thead th {
  background: #f1f5f9;
  font-weight: 700;
  font-size: 11px;
  max-width: 120px;
  white-space: normal;
  text-align: center;
  vertical-align: bottom;
  line-height: 1.3;
}

.fallas-por-marca-table thead th:first-child {
  text-align: left;
  min-width: 100px;
}

.falla-marca-label,
.fallas-por-marca-table tbody td:first-child {
  text-align: left;
  font-weight: 600;
  background: #f8fafc;
  color: var(--ink);
}

.fallas-por-marca-table tbody tr:hover td {
  filter: brightness(0.95);
}

.falla-detectada-section {
  border-left: 4px solid #d97706;
  background: #fffbeb;
}

.falla-detectada-section h3 {
  color: #92400e;
}

.falla-causas-box {
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 10px 14px;
  min-height: 48px;
}

.falla-causas-list {
  margin: 0;
  padding-left: 20px;
}

.falla-causas-list li {
  margin-bottom: 4px;
  color: #78350f;
  font-size: 13px;
}

.falla-causas-empty {
  color: #a16207;
  font-size: 13px;
  margin: 0;
  font-style: italic;
}

.support-work-section {
  border: 2px solid #1d4ed8;
  border-radius: 8px;
  padding: 12px;
  background: #eff6ff;
}

.support-work-section h2 {
  color: #1d4ed8;
}

.detail-panel {
  display: grid;
  gap: 14px;
}

.empty-detail {
  min-height: 160px;
  place-items: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

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

.detail-grid div,
.mini-list div,
.timeline article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 10px;
}

.detail-grid span,
.mini-list span,
.timeline span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.detail-grid strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.clean-summary div {
  border-color: #b9c8df;
  background: #ffffff;
}

.clean-summary .span-2 {
  grid-column: span 2;
}

.subsection {
  display: grid;
  gap: 10px;
}

.subsection h3 {
  margin-bottom: 0;
  color: var(--blue-strong);
}

.timeline,
.mini-list {
  display: grid;
  gap: 8px;
}

.timeline p {
  margin: 6px 0 0;
  color: var(--ink);
}

.grouped-timeline article {
  display: grid;
  gap: 8px;
}

.grouped-timeline ul {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.grouped-timeline li {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 8px;
}

.grouped-timeline time,
.grouped-timeline b {
  display: block;
}

.grouped-timeline time {
  color: var(--muted);
  font-size: 11px;
}

.grouped-timeline b {
  margin-top: 2px;
  color: var(--blue-strong);
}

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

.attachments a {
  display: grid;
  gap: 6px;
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.attachments button {
  display: grid;
  gap: 6px;
  color: var(--blue);
  font-weight: 800;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

.image-viewer-modal {
  background: #fff;
  border-radius: 12px;
  width: min(90vw, 900px);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.image-viewer-body {
  overflow: auto;
  padding: 16px;
  display: flex;
  justify-content: center;
}

.image-viewer-body img {
  max-width: 100%;
  max-height: 75vh;
  object-fit: contain;
  border-radius: 8px;
}

.attachments img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.case-context,
.complete-history {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  padding: 14px;
}

.compact-disclosure {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  padding: 10px;
}

.compact-disclosure summary {
  color: var(--blue);
  cursor: pointer;
  font-weight: 800;
}

.compact-disclosure[open] {
  background: #ffffff;
}

.case-context > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.case-context h3,
.case-context h4,
.complete-history h4 {
  margin-bottom: 0;
  color: var(--blue-strong);
}

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

.context-columns > section,
.complete-history > section {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.wise-box,
.accessory-grid,
.physical-state-grid,
.provider-summary-grid,
.operational-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.wise-box {
  align-items: center;
}

.wise-box div,
.accessory-grid div,
.physical-state-grid div,
.provider-summary-grid div,
.operational-grid div,
.context-note {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-soft);
  padding: 10px;
}

.wise-box span,
.accessory-grid span,
.physical-state-grid span,
.provider-summary-grid span,
.operational-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 760;
}

.wise-box strong,
.accessory-grid strong,
.physical-state-grid strong,
.provider-summary-grid strong,
.operational-grid strong {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
}

.provider-field.hidden {
  display: none !important;
}

.section-help {
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 1180px) {
  body {
    min-width: 960px;
  }

  .app-shell {
    grid-template-columns: 300px minmax(620px, 1fr);
  }

  .module-split {
    grid-template-columns: 1fr;
  }

  .hub-action-grid,
  .mostrador-action-grid {
    grid-template-columns: 1fr;
  }

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

  .span-3 {
    grid-column: span 2;
  }
}

@media print {
  @page {
    size: A4;
    margin: 12mm;
  }

  body {
    min-width: 0;
    background: #ffffff;
    height: auto;
    overflow: visible;
  }

  body > :not(#printModal) {
    display: none !important;
  }

  #printModal {
    display: block !important;
  }

  #printReceipt {
    position: static;
    border: 0;
    padding: 0;
    width: 100%;
  }

  .modal-backdrop,
  .receipt-modal {
    position: static;
    display: block;
    width: auto;
    max-height: none;
    overflow: visible;
    background: #ffffff;
    box-shadow: none;
    padding: 0;
  }

  .modal-header,
  .modal-actions {
    display: none;
  }

  .receipt-sheet {
    gap: 4px;
    font-size: 9px;
    page-break-after: avoid;
  }

  .receipt-header h1 {
    font-size: 18px;
  }

  .receipt-header {
    padding-bottom: 6px;
  }

  .receipt-number {
    min-width: 150px;
    padding: 8px;
  }

  .receipt-number strong {
    font-size: 19px;
  }

  .receipt-section h2 {
    padding: 4px 8px;
    font-size: 10px;
  }

  .receipt-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 3px;
  }

  .receipt-grid div,
  .receipt-note,
  .receipt-signatures div {
    padding: 4px;
    page-break-inside: avoid;
  }

  .receipt-grid div,
  .receipt-note,
  .receipt-signatures div,
  .receipt-conditions {
    background: #ffffff;
  }

  .receipt-conditions {
    padding: 6px;
  }

  .receipt-signatures div {
    min-height: 58px;
  }

  .receipt-signatures img {
    max-height: 36px;
  }
}

@media screen {
  :root {
    color-scheme: light;
    --bg: #f6f8fb;
    --panel: #ffffff;
    --panel-soft: #f9fafb;
    --panel-elevated: #ffffff;
    --ink: #111827;
    --muted: #667085;
    --muted-2: #98a2b3;
    --line: #e5e7eb;
    --line-strong: #d0d5dd;
    --blue: #2563eb;
    --blue-strong: #1d4ed8;
    --blue-soft: #eff6ff;
    --green: #16a34a;
    --green-soft: #ecfdf3;
    --red: #dc2626;
    --red-soft: #fef2f2;
    --orange: #f97316;
    --orange-soft: #fff7ed;
    --cyan: #0891b2;
    --cyan-soft: #ecfeff;
    --violet: #7c3aed;
    --violet-soft: #f5f3ff;
    --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
    --shadow-soft: 0 4px 14px rgba(15, 23, 42, 0.06);
    --radius-sm: 10px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --focus: 0 0 0 4px rgba(37, 99, 235, 0.14);
  }

  body {
    min-width: 0;
    min-height: 100vh;
    background:
      radial-gradient(circle at top left, rgba(37, 99, 235, 0.08), transparent 32rem),
      linear-gradient(180deg, #fbfcff 0%, var(--bg) 42%);
    color: var(--ink);
    font-family: Inter, Manrope, "Segoe UI", Arial, sans-serif;
    font-size: 14px;
  }

  h1 {
    font-size: 24px;
    letter-spacing: 0;
  }

  h2 {
    letter-spacing: 0;
  }

  .app-header {
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 18px 28px;
    border-bottom: 1px solid rgba(229, 231, 235, 0.9);
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(18px);
  }

  .app-header h1,
  .view-header h2,
  .panel-title-row h2 {
    color: var(--ink);
    font-weight: 760;
  }

  .eyebrow {
    color: #526071;
    font-size: 11px;
    font-weight: 760;
  }

  .header-actions {
    gap: 10px;
  }

  .user-info {
    min-width: 180px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel-soft);
    padding: 9px 12px;
  }

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

  .module-nav {
    position: sticky;
    top: 77px;
    z-index: 19;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 12px 28px;
    border-bottom: 1px solid var(--line);
    background: rgba(246, 248, 251, 0.9);
    backdrop-filter: blur(18px);
  }

  .nav-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    border: 1px solid transparent;
    border-radius: 999px;
    background: transparent;
    color: #475467;
    padding: 0 14px;
    font-size: 13px;
    font-weight: 760;
    transition: background 160ms ease, color 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
  }

  .nav-button::before {
    content: "";
    width: 16px;
    height: 16px;
    background: currentColor;
    -webkit-mask: var(--nav-icon) center / contain no-repeat;
    mask: var(--nav-icon) center / contain no-repeat;
  }

  .nav-button[data-icon="inbox"] {
    --nav-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 4h16v11h-4l-2 3h-4l-2-3H4z' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
  }

  .nav-button[data-icon="activity"] {
    --nav-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 13h4l2-7 4 14 2-7h4' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }

  .nav-button[data-icon="truck"] {
    --nav-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M3 7h11v10H3zM14 11h4l3 3v3h-7z' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3Ccircle cx='7' cy='18' r='2' fill='none' stroke='black' stroke-width='2'/%3E%3Ccircle cx='18' cy='18' r='2' fill='none' stroke='black' stroke-width='2'/%3E%3C/svg%3E");
  }

  .nav-button[data-icon="wifi"] {
    --nav-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 13a10 10 0 0 1 14 0M8 16a6 6 0 0 1 8 0M12 20h.01' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  }

  .nav-button[data-icon="store"],
  .nav-button[data-view="mostrador"] {
    --nav-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 10h16l-1-5H5zM6 10v10h12V10M9 20v-6h6v6' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3C/svg%3E");
  }

  .nav-button[data-icon="tool"],
  .nav-button[data-view="soporte"] {
    --nav-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M14 7 7 14l-3 1 1-3 7-7 2 2zM13 6l5 5M16 4l4 4' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }

  .nav-button[data-icon="admin"] {
    --nav-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 3 5 6v5c0 5 3.5 8 7 10 3.5-2 7-5 7-10V6z' fill='none' stroke='black' stroke-width='2' stroke-linejoin='round'/%3E%3Cpath d='M9 12l2 2 4-5' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  }

  .nav-button[data-icon="metrics"] {
    --nav-icon: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M4 19V5M4 19h17M8 16v-5M13 16V8M18 16v-9' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  }

  .nav-button:hover {
    background: #eef2ff;
    color: var(--blue-strong);
  }

  .nav-button.active {
    border-color: rgba(37, 99, 235, 0.28);
    background: #ffffff;
    color: var(--blue-strong);
    box-shadow: var(--shadow-soft);
  }

  .nav-button.active::after {
    content: "";
    position: absolute;
    inset: auto 16px -12px;
    height: 2px;
    border-radius: 999px;
    background: var(--blue);
  }

  .app-shell {
    grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
    gap: 20px;
    width: min(1800px, 100%);
    margin: 0 auto;
    padding: 22px 28px 32px;
  }

  .app-shell.metrics-mode,
  .app-shell.mostrador-hub-mode {
    grid-template-columns: minmax(0, 1fr);
  }

  .app-shell.metrics-mode .side-panel,
  .app-shell.mostrador-hub-mode .side-panel {
    display: none;
  }

  .app-shell.mostrador-hub-mode .workspace {
    grid-column: auto;
  }

  .mostrador-action-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .side-panel,
  .view-panel,
  .form-section,
  .receipt-modal,
  .print-receipt,
  .login-card {
    border: 1px solid rgba(208, 213, 221, 0.78);
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: var(--shadow-soft);
  }

  .side-panel {
    position: sticky;
    top: 144px;
    max-height: calc(100vh - 166px);
    min-height: 0;
    overflow: auto;
    padding: 16px;
  }

  .view-panel {
    gap: 16px;
    padding: 18px;
  }

  .panel-title-row h2 {
    margin-bottom: 0;
    font-size: 20px;
  }

  .counter {
    min-width: 34px;
    height: 30px;
    border: 1px solid #dbeafe;
    background: #eff6ff;
    color: var(--blue-strong);
  }

  .search-field {
    position: relative;
  }

  .search-field input {
    padding-left: 38px;
    background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m21 21-4.3-4.3M10.5 18a7.5 7.5 0 1 1 0-15 7.5 7.5 0 0 1 0 15z' fill='none' stroke='%2398a2b3' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
    background-position: 12px center;
    background-repeat: no-repeat;
    background-size: 16px;
  }

  input,
  select,
  textarea {
    min-height: 42px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius-sm);
    background: #ffffff;
    color: var(--ink);
    padding: 9px 12px;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
  }

  textarea {
    line-height: 1.5;
  }

  input:hover,
  select:hover,
  textarea:hover {
    border-color: #aab6c8;
  }

  input:focus,
  select:focus,
  textarea:focus,
  button:focus-visible {
    border-color: var(--blue);
    box-shadow: var(--focus);
    outline: 0;
  }

  .field span,
  .choice-field legend,
  .signature-field > span {
    color: #344054;
    font-size: 12px;
    font-weight: 760;
  }

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

  .kpi-card {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4px 10px;
    min-height: 82px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel-elevated);
    padding: 12px;
    overflow: hidden;
  }

  .kpi-card::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 3px;
    background: var(--kpi-color, var(--blue));
  }

  .kpi-icon {
    grid-row: span 2;
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border-radius: 10px;
    background: color-mix(in srgb, var(--kpi-color, var(--blue)) 12%, white);
    color: var(--kpi-color, var(--blue));
  }

  .kpi-icon svg,
  .notification-dot svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .kpi-card strong {
    color: var(--ink);
    font-size: 24px;
    line-height: 1;
  }

  .kpi-card span:last-child {
    color: var(--muted);
    font-size: 11px;
    font-weight: 760;
    text-transform: uppercase;
  }

  .kpi-pending { --kpi-color: var(--orange); }
  .kpi-active { --kpi-color: var(--blue); }
  .kpi-provider { --kpi-color: var(--cyan); }
  .kpi-resolved { --kpi-color: var(--green); }
  .kpi-reentry { --kpi-color: var(--red); }
  .kpi-special { --kpi-color: #7c3aed; }

  .metrics-toolbar {
    overflow: visible;
  }

  .metrics-toolbar-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(180px, 240px)) auto;
    gap: 12px;
    align-items: end;
    padding: 16px;
  }

  .metrics-panel {
    display: grid;
    gap: 16px;
  }

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

  .metric-summary-card {
    --metric-color: var(--blue);
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 12px;
    min-height: 112px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--panel-elevated);
    padding: 16px;
    overflow: hidden;
    box-shadow: var(--shadow-soft);
  }

  .metric-summary-card::after {
    content: "";
    position: absolute;
    inset: auto 0 0;
    height: 4px;
    background: var(--metric-color);
  }

  .metric-summary-card .kpi-icon {
    background: color-mix(in srgb, var(--metric-color) 13%, white);
    color: var(--metric-color);
  }

  .metric-summary-card strong {
    display: block;
    color: var(--ink);
    font-size: 30px;
    line-height: 1;
  }

  .metric-summary-card span {
    display: block;
    margin-top: 4px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 820;
    text-transform: uppercase;
  }

  .metric-summary-card small {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
  }

  .metric-total { --metric-color: var(--blue); }
  .metric-open { --metric-color: var(--orange); }
  .metric-closed { --metric-color: var(--green); }
  .metric-provider { --metric-color: var(--cyan); }
  .metric-reentry { --metric-color: var(--red); }
  .metric-special { --metric-color: var(--violet); }

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

  .metric-panel {
    display: grid;
    gap: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: var(--panel-elevated);
    padding: 16px;
    box-shadow: var(--shadow-soft);
  }

  .metric-panel.wide {
    grid-column: 1 / -1;
  }

  .metric-panel header {
    display: flex;
    justify-content: space-between;
    gap: 12px;
  }

  .metric-panel h3 {
    margin: 0;
    color: var(--ink);
    font-size: 15px;
    font-weight: 820;
  }

  .metric-panel p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 12px;
  }

  .metric-bars {
    display: grid;
    gap: 10px;
  }

  .metric-bar-row {
    display: grid;
    grid-template-columns: minmax(120px, 0.8fr) minmax(140px, 1.4fr) 48px;
    gap: 10px;
    align-items: center;
  }

  .metric-bar-row span {
    min-width: 0;
    color: var(--ink);
    font-size: 12px;
    font-weight: 760;
    overflow-wrap: anywhere;
  }

  .metric-bar-row small {
    display: block;
    margin-top: 2px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
  }

  .metric-bar-track {
    height: 10px;
    border-radius: 999px;
    background: var(--panel-soft);
    overflow: hidden;
  }

  .metric-bar-track i {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--blue), #38bdf8);
  }

  .metric-bar-row strong {
    color: var(--ink);
    font-size: 13px;
    text-align: right;
  }

  .metric-series {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(32px, 1fr));
    gap: 8px;
    min-height: 180px;
    align-items: end;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel-soft);
    padding: 14px;
  }

  .metric-series-day {
    display: grid;
    gap: 6px;
    align-items: end;
    min-width: 0;
    height: 150px;
  }

  .metric-series-bars {
    display: flex;
    align-items: end;
    justify-content: center;
    gap: 4px;
    height: 126px;
  }

  .metric-series-bars i {
    display: block;
    width: 9px;
    min-height: 0;
    border-radius: 999px 999px 0 0;
  }

  .metric-series-bars .created,
  .metric-legend .created {
    background: var(--blue);
  }

  .metric-series-bars .closed,
  .metric-legend .closed {
    background: var(--green);
  }

  .metric-series-day span {
    color: var(--muted);
    font-size: 10px;
    text-align: center;
  }

  .metric-legend {
    display: flex;
    justify-content: flex-end;
    gap: 14px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 760;
  }

  .metric-legend span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }

  .metric-legend i {
    width: 10px;
    height: 10px;
    border-radius: 999px;
  }

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

  .metric-risk-list article {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 12px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    background: var(--panel-soft);
    padding: 12px;
  }

  .metric-risk-list strong {
    display: block;
    color: var(--ink);
    font-size: 13px;
  }

  .metric-risk-list span:not(.state-badge),
  .metric-risk-list small {
    color: var(--muted);
    font-size: 12px;
  }

  .metric-risk-list small {
    grid-column: 1 / -1;
  }

  .diagnostic-matrix {
    display: grid;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
  }

  .diagnostic-matrix-header,
  .diagnostic-matrix-row {
    display: grid;
    grid-template-columns: 120px minmax(160px, 1.2fr) minmax(140px, 1fr) 70px;
    gap: 12px;
    align-items: center;
    padding: 11px 14px;
  }

  .diagnostic-matrix.cols-3 .diagnostic-matrix-header,
  .diagnostic-matrix.cols-3 .diagnostic-matrix-row {
    grid-template-columns: minmax(140px, 1fr) minmax(200px, 2fr) 70px;
  }

  .diagnostic-matrix-header {
    background: var(--panel-soft);
    color: var(--muted);
    font-size: 11px;
    font-weight: 820;
    text-transform: uppercase;
  }

  .diagnostic-matrix-row {
    border-top: 1px solid var(--line);
    background: var(--panel-elevated);
  }

  .diagnostic-matrix-row strong,
  .diagnostic-matrix-row b {
    color: var(--ink);
    font-size: 13px;
  }

  .diagnostic-matrix-row span:not(.state-badge) {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
  }

  .filters-box {
    border-color: var(--line);
    border-radius: var(--radius-md);
    background: #fbfcfe;
  }

  .filters-box summary {
    color: #344054;
  }

  .orders-list {
    gap: 10px;
  }

  .order-item {
    position: relative;
    gap: 8px;
    border-radius: var(--radius-md);
    background: #ffffff;
    padding: 13px;
    box-shadow: none;
    transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
  }

  .order-item:hover {
    transform: translateY(-1px);
    border-color: #bac7db;
    box-shadow: var(--shadow-soft);
  }

  .order-item.is-selected {
    border-color: var(--blue);
    background: #f8fbff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.11), var(--shadow-soft);
  }

  .order-card-top,
  .order-card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .order-card-top strong {
    color: var(--ink);
    font-size: 14px;
    font-weight: 820;
  }

  .order-customer {
    color: var(--ink);
    font-size: 13px;
    font-weight: 700;
  }

  .order-product,
  .order-card-footer span {
    color: var(--muted);
    font-size: 12px;
  }

  .order-badges {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 5px;
  }

  .order-item em,
  .state-badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 3px 8px;
    font-size: 10px;
    font-style: normal;
    font-weight: 820;
    line-height: 1.2;
  }

  .state-badge {
    color: var(--badge-color, #475467);
    background: var(--badge-bg, #f2f4f7);
  }

  .state-badge.status-pending-entry,
  .order-item.status-pending-entry { --badge-color: #c2410c; --badge-bg: var(--orange-soft); }

  .state-badge.status-received,
  .order-item.status-received { --badge-color: #1d4ed8; --badge-bg: var(--blue-soft); }

  .state-badge.status-provider,
  .order-item.status-provider { --badge-color: #0e7490; --badge-bg: var(--cyan-soft); }

  .state-badge.status-ready,
  .order-item.status-ready { --badge-color: #15803d; --badge-bg: var(--green-soft); }

  .state-badge.status-special,
  .order-item.status-special { --badge-color: #6d28d9; --badge-bg: var(--violet-soft); }

  .state-badge.status-reentry,
  .order-item.status-reentry { --badge-color: #b91c1c; --badge-bg: var(--red-soft); }

  .order-item.status-pending-entry,
  .order-item.status-received,
  .order-item.status-provider,
  .order-item.status-ready,
  .order-item.status-special,
  .order-item.status-reentry {
    background: #ffffff;
    border-color: color-mix(in srgb, var(--badge-color) 24%, var(--line));
    box-shadow: inset 3px 0 0 var(--badge-color);
  }

  .order-item .reentry-badge {
    background: var(--red);
    color: #ffffff;
  }

  .form-section {
    overflow: hidden;
    border-radius: var(--radius-lg);
    background: #ffffff;
  }

  .form-section h3 {
    border-bottom: 1px solid var(--line);
    background: #ffffff;
    color: var(--ink);
    padding: 14px 16px;
    font-size: 14px;
    font-weight: 820;
  }

  .form-grid {
    gap: 14px;
    padding: 16px;
  }

  .case-number-box {
    border: 1px solid rgba(37, 99, 235, 0.25);
    border-radius: var(--radius-lg);
    background: linear-gradient(135deg, #1d4ed8, #2563eb);
    box-shadow: 0 10px 24px rgba(37, 99, 235, 0.22);
  }

  .hint-pill,
  .status-pill {
    border-radius: 999px;
    font-size: 12px;
  }

  .status-ok {
    background: var(--green-soft);
    border-color: #bbf7d0;
    color: #15803d;
  }

  .status-error {
    background: var(--red-soft);
    border-color: #fecaca;
    color: #b91c1c;
  }

  .status-waiting {
    background: var(--orange-soft);
    border-color: #fed7aa;
    color: #c2410c;
  }

  .queue-grid div {
    border-radius: var(--radius-md);
    background: #f8fbff;
  }

  .notifications-panel {
    position: relative;
    gap: 0;
    padding: 14px 16px 16px;
  }

  .notification-item {
    position: relative;
    grid-template-columns: 34px 1fr auto;
    gap: 12px;
    align-items: start;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0 0 16px;
  }

  .notification-item:not(:last-child)::after {
    content: "";
    position: absolute;
    left: 16px;
    top: 36px;
    bottom: 0;
    width: 1px;
    background: var(--line);
  }

  .notification-dot {
    z-index: 1;
    display: inline-grid;
    width: 34px;
    height: 34px;
    place-items: center;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: #ffffff;
    color: var(--blue);
  }

  .notification-item.priority-alta .notification-dot {
    border-color: #fed7aa;
    background: var(--orange-soft);
    color: var(--orange);
  }

  .notification-meta,
  .notification-item time {
    display: block;
    color: var(--muted);
    font-size: 11px;
    font-weight: 760;
    text-transform: uppercase;
  }

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

  .notification-item p {
    margin: 5px 0 0;
    color: #475467;
    font-size: 13px;
  }

  .notification-actions {
    align-self: center;
  }

  .primary-button,
  .secondary-button,
  .danger-button {
    border-radius: var(--radius-sm);
    font-weight: 760;
    transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease, border-color 120ms ease;
  }

  .primary-button {
    border-color: var(--blue);
    background: var(--blue);
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.16);
  }

  .primary-button:hover {
    background: var(--blue-strong);
    transform: translateY(-1px);
  }

  .secondary-button {
    border-color: var(--line-strong);
    background: #ffffff;
    color: #344054;
  }

  .secondary-button:hover {
    border-color: #aab6c8;
    background: #f9fafb;
  }

  .danger-button {
    min-height: 38px;
    border: 1px solid #fecaca;
    background: var(--red-soft);
    color: #b91c1c;
    padding: 0 14px;
    cursor: pointer;
  }

  .danger-button:hover {
    border-color: #fca5a5;
    background: #fee2e2;
  }

  .form-actions {
    border-radius: var(--radius-lg);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
  }

  .detail-grid {
    gap: 12px;
  }

  .detail-grid div,
  .mini-list div,
  .timeline article,
  .lock-banner,
  .customer-hint {
    border-radius: var(--radius-md);
    background: #ffffff;
  }

  .clean-summary div {
    background: #ffffff;
    box-shadow: var(--shadow-soft);
  }

  .intake-highlight {
    border-color: #38bdf8;
    border-radius: var(--radius-lg);
  }

  .intake-highlight .form-section h3 {
    background: #f0f9ff;
    color: #075985;
  }

  .modal-backdrop {
    background: rgba(15, 23, 42, 0.55);
    backdrop-filter: blur(8px);
  }

  .receipt-modal {
    border-radius: var(--radius-lg);
  }

  .login-screen {
    background:
      radial-gradient(circle at top left, rgba(37, 99, 235, 0.14), transparent 32rem),
      linear-gradient(135deg, #f8fbff, #f3f6fb);
  }

  .login-card {
    border-radius: var(--radius-lg);
    padding: 28px;
  }

  .admin-grid {
    display: grid;
    grid-template-columns: minmax(360px, 0.8fr) minmax(520px, 1.2fr);
    gap: 16px;
    align-items: start;
  }

  .admin-users-panel,
  .admin-events-panel {
    display: grid;
    gap: 12px;
    padding: 16px;
  }

  .admin-user-card {
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    background: #ffffff;
    box-shadow: var(--shadow-soft);
    overflow: hidden;
  }

  .admin-user-card.is-disabled {
    opacity: 0.72;
  }

  .admin-user-card form {
    display: grid;
    gap: 0;
  }

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

  .admin-user-head strong {
    display: block;
    color: var(--ink);
    font-size: 15px;
  }

  .admin-user-head span {
    display: block;
    margin-top: 3px;
    color: var(--muted);
    font-size: 12px;
  }

  .admin-user-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    padding: 12px 16px 0;
  }

  .admin-user-meta span {
    border: 1px solid var(--line);
    border-radius: var(--radius-sm);
    background: var(--panel-soft);
    color: var(--muted);
    padding: 8px;
    font-size: 12px;
    font-weight: 700;
  }

  .admin-user-fields {
    padding-top: 12px;
  }

  .admin-user-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    border-top: 1px solid var(--line);
    padding: 12px 16px;
  }

  .admin-events-table {
    display: grid;
    gap: 0;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
  }

  .admin-events-header,
  .admin-event-row {
    display: grid;
    grid-template-columns: 1.15fr 1fr 1fr 0.9fr;
    gap: 12px;
    align-items: center;
    padding: 11px 14px;
  }

  .admin-events-header {
    background: var(--panel-soft);
    color: var(--muted);
    font-size: 11px;
    font-weight: 820;
    text-transform: uppercase;
  }

  .admin-event-row {
    background: #ffffff;
    border-top: 1px solid var(--line);
  }

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

@media screen and (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0b1220;
    --panel: #111827;
    --panel-soft: #172033;
    --panel-elevated: #141c2e;
    --ink: #f8fafc;
    --muted: #98a2b3;
    --muted-2: #667085;
    --line: #263244;
    --line-strong: #344054;
    --blue: #60a5fa;
    --blue-strong: #93c5fd;
    --blue-soft: rgba(96, 165, 250, 0.14);
    --green-soft: rgba(34, 197, 94, 0.14);
    --red-soft: rgba(239, 68, 68, 0.14);
    --orange-soft: rgba(249, 115, 22, 0.16);
    --cyan-soft: rgba(6, 182, 212, 0.14);
    --violet-soft: rgba(124, 58, 237, 0.16);
    --shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
    --shadow-soft: 0 4px 14px rgba(0, 0, 0, 0.22);
  }

  body {
    background:
      radial-gradient(circle at top left, rgba(96, 165, 250, 0.14), transparent 32rem),
      linear-gradient(180deg, #0e1728 0%, var(--bg) 52%);
  }

  .app-header,
  .module-nav,
  .form-actions {
    background: rgba(13, 19, 33, 0.88);
  }

  .side-panel,
  .view-panel,
  .form-section,
  .receipt-modal,
  .print-receipt,
  .login-card,
  .summary-grid div,
  .kpi-card,
  .order-item,
  .detail-grid div,
  .mini-list div,
  .timeline article,
  .lock-banner,
  .customer-hint,
  .clean-summary div,
  .user-info,
  .filters-box,
  .queue-grid div {
    background: var(--panel-elevated);
    border-color: var(--line);
  }

  .admin-user-card,
  .admin-event-row {
    background: var(--panel-elevated);
    border-color: var(--line);
  }

  .admin-events-header,
  .admin-user-meta span {
    background: var(--panel-soft);
  }

  .form-section h3 {
    background: var(--panel-elevated);
    color: var(--ink);
  }

  input,
  select,
  textarea,
  .secondary-button {
    background: #0f172a;
    border-color: var(--line-strong);
    color: var(--ink);
  }

  .secondary-button:hover,
  .nav-button.active {
    background: #172033;
  }

  .nav-button:hover {
    background: #172033;
  }

  .order-item.status-pending-entry,
  .order-item.status-received,
  .order-item.status-provider,
  .order-item.status-ready,
  .order-item.status-special,
  .order-item.status-reentry {
    background: var(--panel-elevated);
  }

  .notification-dot {
    background: #0f172a;
    border-color: var(--line);
  }

  .notification-item p,
  .order-product,
  .order-card-footer span {
    color: var(--muted);
  }
}

@media screen and (max-width: 1180px) {
  .app-header,
  .module-nav {
    position: static;
  }

  .app-shell {
    grid-template-columns: 1fr;
    padding: 16px;
  }

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

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

  .side-panel {
    position: static;
    max-height: none;
  }

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

@media screen and (max-width: 760px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .header-actions,
  .view-header,
  .panel-title-row,
  .notification-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid,
  .metrics-toolbar-grid,
  .metrics-summary-grid,
  .metrics-grid,
  .queue-grid,
  .admin-user-meta,
  .admin-events-header,
  .admin-event-row,
  .cols-2,
  .cols-3,
  .detail-grid,
  .receipt-signatures,
  .module-split {
    grid-template-columns: 1fr;
  }

  .metric-bar-row {
    grid-template-columns: 1fr;
  }

  .diagnostic-matrix-header,
  .diagnostic-matrix-row {
    grid-template-columns: 1fr;
  }

  .metric-bar-row strong {
    text-align: left;
  }

  .metric-series {
    overflow-x: auto;
    grid-template-columns: repeat(12, minmax(36px, 1fr));
  }

  .span-2,
  .span-3,
  .clean-summary .span-2 {
    grid-column: span 1;
  }

  .notification-item {
    grid-template-columns: 34px 1fr;
  }

  .notification-actions {
    grid-column: 2;
  }
}

