/* Estilo alineado con demo tressillo.html (SF / Inter, sidebar oscura, accent Apple) */

:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --sidebar: #1d1d1f;
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-active: rgba(255, 255, 255, 0.12);
  --border: rgba(0, 0, 0, 0.08);
  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --success: #34c759;
  --warning: #ff9f0a;
  --danger: #ff3b30;
  --purple: #af52de;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
  --sidebar-w: 220px;
  --header-h: 52px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, "Helvetica Neue", Helvetica, Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  min-height: 100%;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  font: inherit;
}

a {
  color: var(--accent);
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--text-secondary);
}

/* ——— Login ——— */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.login-card {
  width: min(400px, 100%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 32px 28px 24px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-bottom: 24px;
}

.login-brand img,
.login-brand .brand-logo {
  height: 52px;
  width: auto;
  max-width: 220px;
  border-radius: 10px;
  background: #fff;
  padding: 6px 10px;
  display: block;
  object-fit: contain;
}

.login-brand strong {
  display: block;
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.login-brand span {
  display: block;
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.login-card form {
  text-align: left;
}

.field {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
}

.field label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.field input,
.field select,
.field textarea,
.toolbar input,
.toolbar select {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: #fff;
  font-size: 14px;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.toolbar input:focus,
.toolbar select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.15);
}

.form-error {
  color: var(--danger);
  font-size: 12px;
  min-height: 1.1em;
  margin: 4px 0 10px;
}

/* ——— Buttons (pill, Apple-like) ——— */
.btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  border: none;
  border-radius: 980px;
  padding: 7px 13px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap;
  text-decoration: none;
  color: inherit;
}

.btn-primary,
.btn-accent {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover,
.btn-accent:hover {
  background: var(--accent-hover);
}

.btn-secondary {
  background: rgba(0, 0, 0, 0.06);
  color: var(--text);
}

.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.1);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
}

.btn-ghost:hover {
  background: rgba(0, 113, 227, 0.08);
}

.btn-block {
  width: 100%;
  padding: 10px 16px;
  font-size: 14px;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ——— App shell ——— */
.app-shell {
  display: grid;
  grid-template-columns: 0 1fr;
  min-height: 100vh;
  transition: grid-template-columns 0.25s ease;
}

.app-shell.nav-open {
  grid-template-columns: var(--sidebar-w) 1fr;
}

.sidebar {
  background: var(--sidebar);
  color: #f5f5f7;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 16px 12px;
  z-index: 50;
  overflow: auto;
  width: var(--sidebar-w);
  margin-left: calc(-1 * var(--sidebar-w));
  transition: margin-left 0.25s ease;
  pointer-events: none;
}

.app-shell.nav-open .sidebar {
  margin-left: 0;
  pointer-events: auto;
}

.sidebar-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 8px 8px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 12px;
}

.sidebar-brand img,
.sidebar-brand .brand-logo {
  height: 44px;
  width: auto;
  max-width: 168px;
  border-radius: 8px;
  background: #fff;
  object-fit: contain;
  padding: 6px 8px;
  display: block;
  flex-shrink: 0;
}

.sidebar-brand strong {
  display: block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.sidebar-brand span {
  display: block;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 3px;
}

.nav-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.35);
  padding: 8px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
  background: transparent;
  border: none;
  border-radius: 10px;
  padding: 9px 10px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  margin-bottom: 2px;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: #fff;
}

.nav-item .ico {
  width: 18px;
  text-align: center;
  opacity: 0.7;
  font-size: 13px;
  flex-shrink: 0;
}

.nav-item.active .ico {
  opacity: 1;
}

.nav-item .badge {
  margin-left: auto;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 980px;
  background: rgba(255, 159, 10, 0.2);
  color: #ffd60a;
}

.sidebar-foot {
  margin-top: auto;
  padding: 12px 8px 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: rgba(255, 255, 255, 0.75);
}

.sidebar-user strong {
  display: block;
  font-size: 12px;
  color: #fff;
}

.sidebar-user small {
  display: block;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
}

.sidebar-foot .btn-ghost {
  width: 100%;
  color: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 980px;
}

.sidebar-foot .btn-ghost:hover {
  background: var(--sidebar-hover);
  color: #fff;
}

.main {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 100vh;
}

.topbar {
  height: var(--header-h);
  background: rgba(251, 251, 253, 0.85);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px 0 12px;
  position: sticky;
  top: 0;
  z-index: 40;
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar h1 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.topbar p {
  font-size: 12px;
  color: var(--text-secondary);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-menu {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}

.btn-menu:hover {
  background: #f5f5f7;
  border-color: rgba(0, 0, 0, 0.14);
}

.btn-menu .bars {
  display: flex;
  flex-direction: column;
  gap: 3px;
  width: 14px;
}

.btn-menu .bars i {
  display: block;
  height: 1.5px;
  background: currentColor;
  border-radius: 2px;
}

.content {
  padding: 14px 18px 40px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}

.panel + .panel {
  margin-top: 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  align-items: center;
}

.toolbar input[type="search"],
.toolbar select {
  min-width: 160px;
  font-size: 13px;
  padding: 7px 11px;
}

.accordion {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.accordion-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  text-align: left;
}

.accordion-head:hover {
  background: rgba(0, 0, 0, 0.02);
}

.accordion-head .chev {
  font-size: 11px;
  color: var(--text-secondary);
  transition: transform 0.2s;
}

.accordion.open .chev {
  transform: rotate(180deg);
}

.accordion-body {
  display: none;
  padding: 0 14px 14px;
  border-top: 1px solid var(--border);
}

.accordion.open .accordion-body {
  display: block;
  padding-top: 14px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 7px;
  margin-bottom: 10px;
}

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 700px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
}

.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 7px;
}

@media (max-width: 1100px) {
  .charts-grid { grid-template-columns: 1fr; }
}

.chart-card {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  height: 195px;
  display: flex;
  flex-direction: column;
}

.chart-card h3 {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}

.chart-wrap {
  flex: 1;
  min-height: 0;
  position: relative;
}

.workbench {
  display: grid;
  grid-template-columns: 1.35fr 0.9fr;
  gap: 12px;
  align-items: start;
}

@media (max-width: 1100px) {
  .workbench { grid-template-columns: 1fr; }
}

.card-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.card-header h2 {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.card-header-contacto {
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
  margin-bottom: 6px;
}

.contacto-head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}

.contacto-head-row h2 {
  margin: 0;
}

.contacto-head-row .filter-summary {
  margin: 0;
}

.selection-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 0;
  margin-bottom: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

.selection-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 11px;
}

.btn-success {
  background: var(--success);
  color: #fff;
}

.btn-success:hover {
  filter: brightness(1.05);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  filter: brightness(1.05);
}

.btn-danger:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: none;
}

.table-wrap {
  overflow: auto;
  max-height: min(62vh, 720px);
}

table.data tr.selected td {
  background: rgba(0, 113, 227, 0.07);
}

.mono {
  font-variant-numeric: tabular-nums;
}

.ellipsis {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 980px;
  font-size: 10px;
  font-weight: 500;
  white-space: nowrap;
  background: rgba(0, 0, 0, 0.06);
  color: #555;
}

.badge-prep { background: rgba(0, 113, 227, 0.12); color: #0058b0; }
.badge-avisar { background: rgba(255, 159, 10, 0.15); color: #b36b00; }
.badge-nocontestan { background: rgba(255, 59, 48, 0.12); color: #c41e16; }
.badge-ruta { background: rgba(175, 82, 222, 0.12); color: #7a2ea0; }
.badge-default { background: rgba(0, 0, 0, 0.06); color: #555; }

.cas-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 8px 4px 2px;
  font-size: 10.5px;
  color: var(--text-secondary);
}

.cas-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 6px;
}

.cas-group-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border, #d2d2d7);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  background: #f5f5f7;
  color: var(--text);
  transition: background 0.12s ease, border-color 0.12s ease;
}

.cas-group-btn .cas-n {
  font-variant-numeric: tabular-nums;
  font-size: 11px;
  opacity: 0.85;
}

.cas-group-btn:hover {
  background: #ebebed;
}

.cas-group-btn.active {
  background: #1d1d1f;
  color: #fff;
  border-color: #1d1d1f;
}

.cas-group-hint {
  margin: 0 0 8px;
  font-size: 11.5px;
  line-height: 1.35;
}

.cas-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin: 0 0 4px;
  min-height: 1.5rem;
}

.cas-strip-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 5px 9px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  color: var(--text);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.cas-strip-btn .cas-code {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  opacity: 0.85;
}

.cas-strip-btn .cas-name {
  font-size: 12px;
  font-weight: 600;
}

.cas-strip-btn .cas-n {
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  opacity: 0.9;
}

.cas-strip-btn:hover {
  transform: translateY(-1px);
}

.cas-strip-btn.active {
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.18);
}

/* Tonos: urgencia / dinero / riesgo / ops / especial */
.cas-tone-urgent {
  background: #ffe8d6;
  color: #9a3412;
  border-color: #fb923c;
}
.cas-tone-urgent .cas-code { color: #c2410c; }

.cas-tone-money {
  background: #fef3c7;
  color: #92400e;
  border-color: #f59e0b;
}
.cas-tone-money .cas-code { color: #b45309; }

.cas-tone-risk {
  background: #fee2e2;
  color: #991b1b;
  border-color: #f87171;
}
.cas-tone-risk .cas-code { color: #dc2626; }

.cas-tone-ops {
  background: #e0f2fe;
  color: #0c4a6e;
  border-color: #38bdf8;
}
.cas-tone-ops .cas-code { color: #0284c7; }

.cas-tone-special {
  background: #ede9fe;
  color: #5b21b6;
  border-color: #a78bfa;
}
.cas-tone-special .cas-code { color: #7c3aed; }

.cas-tone-neutral {
  background: #f3f4f6;
  color: #374151;
  border-color: #d1d5db;
}

.filters-main {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 0;
  width: 100%;
}

.cas-glossary {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--text-secondary);
}

.cas-glossary li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px;
}

.cas-glossary .chip {
  margin: 0;
}

.filters-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.filters-toolbar #searchInput {
  flex: 1 1 220px;
  min-width: 180px;
}

.filter-envio-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.filter-preset-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 12px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-secondary);
}

.filter-preset-btn:hover {
  border-color: var(--accent);
  color: var(--text);
}

.filter-preset-btn.active {
  border-color: #ea580c;
  background: #ffedd5;
  color: #9a3412;
  box-shadow: 0 0 0 1px #fb923c;
}

.filter-summary {
  margin: 0;
  font-size: 12px;
}

.filters-more {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0 10px;
  background: var(--surface);
}

.filters-more summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  padding: 8px 0;
  list-style: none;
}

.filters-more summary::-webkit-details-marker {
  display: none;
}

.filters-more-body {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 10px;
}

.edit-drawer {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  overflow: hidden;
  background: #fafafa;
}

.edit-drawer.disabled {
  opacity: 0.55;
  pointer-events: none;
}

.edit-drawer-head {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: transparent;
  border: none;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.edit-drawer-head:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text);
}

.edit-drawer-head .chev {
  font-size: 10px;
  transition: transform 0.2s;
}

.edit-drawer.open .edit-drawer-head .chev {
  transform: rotate(180deg);
}

.edit-drawer-body {
  display: none;
  padding: 0 12px 12px;
  border-top: 1px solid var(--border);
}

.edit-drawer.open .edit-drawer-body {
  display: block;
  padding-top: 10px;
}

.edit-bulk-hint {
  display: none;
  margin: 0 0 8px;
  font-size: 12px;
}

.edit-bulk-hint.show {
  display: block;
}

.composer-inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.btn-ia:disabled {
  opacity: 0.65;
}

/* Botón agente IA — visible, con icono robot (no envía solo; propone) */
.btn-ia-bot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  border-radius: 10px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #0f766e 0%, #0e7490 55%, #155e75 100%);
  box-shadow: 0 3px 12px rgba(15, 118, 110, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.btn-ia-bot:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 5px 16px rgba(15, 118, 110, 0.45);
}

.btn-ia-bot:disabled {
  cursor: not-allowed;
  filter: grayscale(0.35);
  opacity: 0.62;
  box-shadow: none;
}

.btn-ia-bot.sm {
  padding: 5px 10px;
  font-size: 11px;
  border-radius: 8px;
}

.ia-bot-ico {
  display: inline-flex;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.btn-ia-bot.sm .ia-bot-ico {
  width: 16px;
  height: 16px;
}

.ia-bot-ico svg,
.ia-bot-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.ia-bot-label {
  white-space: nowrap;
}

.ia-hint {
  margin: 0 0 8px;
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.35;
}

.preview-field {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.preview-field .preview-box {
  flex: 1;
  min-height: 140px;
}

/* ——— Camiones: panel de armado ——— */
.cam-hero {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background:
    radial-gradient(ellipse 80% 70% at 100% 0%, rgba(14, 116, 144, 0.12), transparent 55%),
    radial-gradient(ellipse 60% 50% at 0% 100%, rgba(234, 88, 12, 0.08), transparent 50%),
    linear-gradient(165deg, #f8fafc 0%, #ffffff 45%, #f1f5f9 100%);
  padding: 18px 20px 16px;
  margin-bottom: 14px;
}

.cam-hero-top {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.cam-hero h2 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #0f172a;
}

.cam-hero-lead {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 42ch;
}

.cam-hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(15, 23, 42, 0.06);
  color: #334155;
}

.cam-controls {
  display: grid;
  grid-template-columns: minmax(140px, 0.7fr) minmax(200px, 1.1fr) minmax(200px, 1.1fr) auto;
  gap: 12px;
  align-items: end;
}

@media (max-width: 960px) {
  .cam-controls {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .cam-controls {
    grid-template-columns: 1fr;
  }
}

.cam-field label.cam-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.cam-field input[type="date"] {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
}

.cam-sits {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 120px;
  overflow: auto;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
}

.cam-sit {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
}

.cam-extra {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
}

.cam-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.cam-kpi-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 8px;
  margin: 0 0 14px;
}

.cam-truck-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.cam-truck-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
  border-left: 4px solid #0e7490;
}

.cam-truck-card.especial {
  border-left-color: #ea580c;
}

.cam-truck-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 8px;
  background: linear-gradient(180deg, #f8fafc, #fff);
}

.cam-truck-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.cam-truck-count {
  font-size: 12px;
  font-weight: 700;
  color: #0e7490;
}

.cam-truck-card.especial .cam-truck-count {
  color: #c2410c;
}

.cam-truck-comarcas {
  margin: 0;
  padding: 0 14px 10px;
  font-size: 12px;
  color: var(--text-secondary);
}

.cam-truck-card .table-wrap {
  margin: 0;
  border-radius: 0;
  border-left: none;
  border-right: none;
  border-bottom: none;
}

.cam-empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--text-secondary);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: #fafafa;
}

.cam-empty strong {
  display: block;
  color: var(--text);
  font-size: 15px;
  margin-bottom: 4px;
}

.cam-human-note {
  margin: 8px 0 0;
  font-size: 12px;
  color: #92400e;
  max-width: 52ch;
}

.cam-human-checklist {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(234, 88, 12, 0.35);
  border-radius: 10px;
  background: rgba(255, 237, 213, 0.45);
}

.cam-human-checklist summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: #9a3412;
  list-style: none;
}

.cam-human-checklist summary::-webkit-details-marker {
  display: none;
}

.cam-check-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: grid;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
}

.cam-check-list label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  cursor: pointer;
}

.cam-check-list input {
  margin-top: 2px;
  flex-shrink: 0;
}

.cam-especial-warn {
  color: #9a3412;
  background: rgba(255, 237, 213, 0.5);
  padding: 6px 14px;
  border-radius: 0;
}

.channel-wa-hint {
  margin: 8px 0 0;
  font-size: 11.5px;
  line-height: 1.35;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin: -4px -4px 12px;
  padding: 0 4px 0;
}

.tab {
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 10px 12px;
  cursor: pointer;
  color: var(--text-secondary);
  border-bottom: 2px solid transparent;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--accent);
}

.mix-warn {
  display: none;
  font-size: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 159, 10, 0.12);
  color: #8a5608;
  margin-bottom: 10px;
}

.mix-warn.show {
  display: block;
}

.composer-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.preview-meta {
  font-size: 11px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

/* KPIs como la demo */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 7px;
}

.kpi {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 64px;
}

.kpi span,
.kpi-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 3px;
}

.kpi strong,
.kpi-value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.kpi.accent strong,
.kpi.accent .kpi-value { color: var(--accent); }
.kpi.success strong,
.kpi.success .kpi-value { color: var(--success); }
.kpi.warning strong,
.kpi.warning .kpi-value { color: var(--warning); }
.kpi.danger strong,
.kpi.danger .kpi-value { color: var(--danger); }
.kpi.purple strong,
.kpi.purple .kpi-value { color: var(--purple); }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table.data th,
table.data td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

table.data th {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  font-weight: 600;
}

table.data tbody tr {
  cursor: pointer;
}

table.data tbody tr:hover {
  background: rgba(0, 113, 227, 0.04);
}

.chip,
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 980px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(0, 0, 0, 0.06);
  color: #555;
  margin: 0 4px 4px 0;
}

.chip.warn,
.chip.alert { background: rgba(255, 159, 10, 0.15); color: #b36b00; }
.chip.info { background: rgba(0, 113, 227, 0.12); color: #0058b0; }
.chip.special { background: rgba(175, 82, 222, 0.12); color: #7a2ea0; }

.detail-grid {
  display: grid;
  grid-template-columns: 1.25fr 0.75fr;
  gap: 12px;
}

.row-detail-btn {
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 6px;
}

.row-detail-btn:hover {
  background: rgba(0, 113, 227, 0.08);
}

/* Modal ficha de pedido (como la demo) */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 200;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28);
  width: 100%;
  max-width: 720px;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-head h2 {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0;
}

.modal-head p {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 2px 0 0;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  cursor: pointer;
  font-size: 15px;
  color: var(--text);
  flex-shrink: 0;
  line-height: 1;
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.1);
}

.modal-body {
  padding: 18px 22px;
  overflow: auto;
}

.ficha-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

@media (max-width: 640px) {
  .ficha-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

.ficha-cell {
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 11px;
}

.ficha-cell .k {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.ficha-cell .v {
  font-size: 13px;
  font-weight: 600;
  word-break: break-word;
}

.ficha-cell.wide {
  grid-column: 1 / -1;
}

.ficha-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  margin: 14px 0 8px;
}

.cas-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 4px;
}

.cas-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: 980px;
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: #fff;
}

.cas-chip.warn {
  border-color: rgba(255, 159, 10, 0.4);
  background: rgba(255, 159, 10, 0.08);
  color: #b36b00;
}

.cas-chip.alert {
  border-color: rgba(255, 59, 48, 0.4);
  background: rgba(255, 59, 48, 0.07);
  color: #c41e16;
}

.cas-chip.info {
  border-color: rgba(0, 113, 227, 0.35);
  background: rgba(0, 113, 227, 0.06);
  color: #0058b0;
}

.cas-chip.special {
  border-color: rgba(175, 82, 222, 0.35);
  background: rgba(175, 82, 222, 0.07);
  color: #7a2ea0;
}

.detail-timeline {
  position: relative;
  padding-left: 22px;
  margin-top: 4px;
}

.detail-timeline::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 2px;
}

.dt-item {
  position: relative;
  padding: 0 0 14px 4px;
}

.dt-item::before {
  content: "";
  position: absolute;
  left: -19px;
  top: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid #fff;
}

.dt-item.error::before {
  background: var(--danger);
}

.dt-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.dt-head strong {
  font-size: 13px;
  font-weight: 600;
}

.dt-time {
  font-size: 11px;
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}

.dt-meta {
  font-size: 11px;
  margin-top: 1px;
}

.dt-detalle {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: pre-wrap;
}

.dt-to {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 980px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.dt-to.cliente {
  background: rgba(0, 113, 227, 0.12);
  color: #0058b0;
}

.dt-to.interno {
  background: rgba(255, 59, 48, 0.12);
  color: #c41e16;
}

.preview-box {
  white-space: pre-wrap;
  background: #fafafa;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px;
  font-size: 13px;
  line-height: 1.45;
  max-height: 360px;
  overflow: auto;
}

.composer-field {
  margin-bottom: 10px;
}

.composer-field label {
  display: block;
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.channel-pills {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

.channel-pill {
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: 980px;
  border: 1.5px solid var(--border);
  background: #fff;
  cursor: pointer;
  transition: all 0.15s;
  color: var(--text);
}

.channel-pill:hover {
  border-color: var(--accent);
}

.channel-pill.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.channel-pill:disabled,
.channel-pill.disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.channel-more-wrap {
  position: relative;
}

.channel-more {
  width: 30px;
  padding: 6px 0;
  font-weight: 700;
  font-size: 14px;
  line-height: 1;
}

.channel-more-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 20;
  min-width: 168px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 6px;
}

.channel-more-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  cursor: default;
}

.channel-more-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

.channel-more-item .badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 980px;
  background: rgba(255, 159, 10, 0.15);
  color: var(--warning);
  font-weight: 700;
  text-transform: uppercase;
}

.destino-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 11px;
  background: rgba(0, 113, 227, 0.05);
  border: 1px solid rgba(0, 113, 227, 0.12);
  border-radius: 10px;
  font-size: 12px;
  margin-bottom: 10px;
}

.destino-bar.logistica {
  background: rgba(255, 59, 48, 0.06);
  border-color: rgba(255, 59, 48, 0.18);
}

.destino-bar .dest-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 980px;
  background: rgba(0, 113, 227, 0.14);
  color: #0058b0;
}

.destino-bar.logistica .dest-tag {
  background: rgba(255, 59, 48, 0.14);
  color: #c41e16;
}

.sigla-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 10px;
}

.dropzone,
.import-strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  background: var(--surface);
  border: 1px dashed rgba(0, 0, 0, 0.12);
  border-radius: var(--radius);
  padding: 22px 14px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  text-align: center;
}

.dropzone:hover,
.dropzone.drag,
.import-strip:hover {
  border-color: var(--accent);
  background: rgba(0, 113, 227, 0.04);
}

.status-pill {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 980px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(52, 199, 89, 0.15);
  color: #248a3d;
}

.status-pill.off {
  background: rgba(255, 159, 10, 0.15);
  color: #b36b00;
}

.usuario-rol-select {
  font: inherit;
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.stub h2 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 8px 0;
}

.stub-list {
  margin: 8px 0 0 1.1rem;
  color: var(--text-secondary);
  font-size: 13px;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: var(--sidebar);
  color: #f5f5f7;
  padding: 11px 14px;
  border-radius: 12px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  z-index: 80;
  max-width: min(340px, calc(100vw - 36px));
  font-size: 13px;
  animation: toast-in 0.22s ease;
}

@keyframes toast-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
  z-index: 45;
}

@media (max-width: 980px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app-shell.nav-open {
    grid-template-columns: 1fr;
  }

  .app-shell.nav-open .sidebar {
    position: fixed;
    left: 0;
    margin-left: 0;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.25);
  }

  .app-shell.nav-open .backdrop {
    display: block;
  }
}
