/* ============================================================
   REMIXT · Sistema integral de gestión y despacho de remises
   Static dashboard frontend
   ============================================================ */

:root {
  /* Dark palette */
  --navy-950: #00112d;
  --navy-900: #031737;
  --navy-850: #061d40;
  --navy-800: #082349;
  --navy-700: #0a2a58;
  --card-dark: #0a1e41;
  --card-dark-2: #0c2349;
  --border-dark: rgba(120, 155, 215, 0.14);
  --border-dark-strong: rgba(120, 155, 215, 0.24);

  /* Accents */
  --blue: #165be5;
  --blue-light: #3b82f6;
  --blue-glow: rgba(22, 91, 229, 0.25);
  --amber: #ffb219;
  --amber-soft: rgba(255, 178, 25, 0.14);
  --green: #11b247;
  --green-soft: rgba(17, 178, 71, 0.14);
  --red: #ef4444;
  --red-soft: rgba(239, 68, 68, 0.13);

  /* Light palette */
  --light-bg: #eef1f7;
  --card-light: #ffffff;
  --border-light: #e5e9f2;
  --ink: #13213b;
  --ink-soft: #5b6b87;
  --ink-muted: #8c9ab2;

  /* Text on dark */
  --text: #eef3fc;
  --text-soft: #a7b8d6;
  --text-muted: #7286a8;

  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 10px 34px rgba(2, 12, 32, 0.28);
  --font: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--navy-950);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

button, input { font-family: inherit; }
button { cursor: pointer; }
svg { width: 100%; height: 100%; display: block; }

/* ============================================================
   APP SHELL
   ============================================================ */
.app-shell { display: flex; min-height: 100vh; }

/* ---------- SIDEBAR ---------- */
.sidebar {
  width: 252px;
  flex: 0 0 252px;
  background: linear-gradient(180deg, #021033 0%, var(--navy-950) 100%);
  border-right: 1px solid var(--border-dark);
  display: flex;
  flex-direction: column;
  padding: 24px 14px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 60;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 4px 10px 26px;
}
.brand__mark {
  width: 38px; height: 38px; flex: 0 0 38px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--blue), #0d3fa8);
  color: #fff;
  padding: 8px;
  box-shadow: 0 6px 18px var(--blue-glow);
}
.brand__text strong {
  display: block;
  font-size: 19px;
  letter-spacing: 1.6px;
  line-height: 1.1;
}
.brand__text span {
  display: block;
  font-size: 10.5px;
  color: var(--text-muted);
  margin-top: 3px;
  letter-spacing: .3px;
}

.sidebar__group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.6px;
  color: #4d6287;
  padding: 0 12px 8px;
}
.sidebar__group-label--spaced { padding-top: 22px; }

.sidebar__nav { display: flex; flex-direction: column; gap: 2px; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text-soft);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  transition: background .18s, color .18s;
}
.nav-item svg { width: 19px; height: 19px; flex: 0 0 19px; opacity: .85; }
.nav-item:hover { background: rgba(255,255,255,.045); color: #fff; }
.nav-item.is-active {
  background: linear-gradient(90deg, var(--blue-glow), rgba(22,91,229,.06));
  color: #fff;
  box-shadow: inset 3px 0 0 var(--blue-light);
}
.nav-item.is-active svg { color: var(--blue-light); opacity: 1; }
.nav-item__badge {
  margin-left: auto;
  background: var(--blue);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  min-width: 20px;
  text-align: center;
  padding: 2px 6px;
  border-radius: 20px;
}
.nav-item__badge--amber { background: var(--amber); color: #4a3200; }

.sidebar__user {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 10px 2px;
  border-top: 1px solid var(--border-dark);
}
.avatar {
  width: 36px; height: 36px; flex: 0 0 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffb219, #f07c1f);
  color: #4a3200;
  display: grid; place-items: center;
  font-weight: 800; font-size: 12px;
}
.user-meta { flex: 1; min-width: 0; }
.user-meta strong { display: block; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { display: block; font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.sidebar__user .icon-btn { flex: 0 0 30px; }
.user-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); margin-left: auto; box-shadow: 0 0 0 3px var(--green-soft); }

/* ---------- MAIN WRAP ---------- */
.main-wrap { flex: 1; min-width: 0; background: var(--navy-950); }

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 28px;
  border-bottom: 1px solid var(--border-dark);
  background: rgba(2, 16, 48, .72);
  backdrop-filter: blur(10px);
  position: sticky;
  top: 0;
  z-index: 50;
}
.menu-toggle { display: none; background: none; border: 0; color: var(--text); width: 26px; height: 26px; padding: 0; }
.topbar__title h1 { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: .2px; }
.topbar__title p { margin: 2px 0 0; font-size: 11.5px; color: var(--text-muted); }
.topbar__actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.system-pill {
  display: flex; align-items: center; gap: 8px;
  background: var(--green-soft);
  border: 1px solid rgba(17,178,71,.28);
  color: #7fe6a4;
  font-size: 11.5px; font-weight: 600;
  padding: 7px 12px; border-radius: 30px;
}
.system-pill__date { color: #5fbf85; font-weight: 400; border-left: 1px solid rgba(17,178,71,.3); padding-left: 8px; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--green); animation: pulse 1.8s infinite; }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(17,178,71,.5); } 50% { box-shadow: 0 0 0 5px rgba(17,178,71,0); } }

.api-badge {
  font-size: 10px; font-weight: 700; letter-spacing: .4px;
  padding: 6px 10px; border-radius: 20px;
  border: 1px solid var(--border-dark-strong);
  color: var(--text-muted); background: rgba(255,255,255,.03);
  white-space: nowrap;
}
.api-badge--online { color: #7ea8ff; border-color: rgba(91,145,255,.35); background: var(--blue-glow); }
.api-badge--offline { color: var(--amber); border-color: rgba(255,178,25,.3); background: var(--amber-soft); }
.api-badge--live {
  display: inline-flex; align-items: center; gap: 6px;
  color: #5fbf85; border-color: rgba(17,178,71,.35); background: rgba(17,178,71,.12);
}
.api-badge--live::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: #22c55e; animation: badgePulse 1.8s infinite;
}
@keyframes badgePulse {
  0% { box-shadow: 0 0 0 0 rgba(34,197,94,.55); }
  70% { box-shadow: 0 0 0 6px rgba(34,197,94,0); }
  100% { box-shadow: 0 0 0 0 rgba(34,197,94,0); }
}

.icon-btn {
  width: 34px; height: 34px; flex: 0 0 34px;
  border-radius: 9px;
  border: 1px solid var(--border-dark);
  background: rgba(255,255,255,.03);
  color: var(--text-soft);
  padding: 8px;
  position: relative;
  transition: background .18s, color .18s;
}
.icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }
.icon-btn--sm { width: 30px; height: 30px; flex-basis: 30px; padding: 7px; }
.notif-dot { position: absolute; top: 6px; right: 7px; width: 6px; height: 6px; background: var(--amber); border-radius: 50%; }

/* ============================================================
   VIEWS
   ============================================================ */
.view { display: none; padding: 24px 28px 40px; animation: fade .25s ease; }
.view.is-active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- KPI GRID ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi-grid--3 { grid-template-columns: repeat(3, 1fr); }
.kpi-card {
  background: linear-gradient(135deg, var(--card-dark), var(--navy-900));
  border: 1px solid var(--border-dark);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
  display: flex; gap: 13px; align-items: flex-start;
  position: relative; overflow: hidden;
  min-height: 104px;
}
.kpi-card::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(120px 60px at 100% 0, rgba(22,91,229,.10), transparent 70%);
}
.kpi-card__icon {
  width: 40px; height: 40px; flex: 0 0 40px;
  border-radius: 10px; padding: 9px;
}
.kpi-card__icon--blue { background: var(--blue-glow); color: #5b91ff; }
.kpi-card__icon--green { background: var(--green-soft); color: #4ade80; }
.kpi-card__icon--amber { background: var(--amber-soft); color: var(--amber); }
.kpi-card__icon--red { background: var(--red-soft); color: #ff7b7b; }
.kpi-card__body { position: relative; z-index: 1; }
.kpi-card__label { font-size: 11.5px; color: var(--text-muted); display: block; margin-bottom: 6px; }
.kpi-card__value { font-size: 24px; font-weight: 700; line-height: 1; letter-spacing: -.5px; }
.kpi-card__delta { font-size: 10.5px; font-weight: 600; margin-left: 6px; vertical-align: middle; }
.kpi-card__delta--up { color: #4ade80; }
.kpi-card__delta--down { color: #ff8f8f; }
.kpi-card__delta--muted { color: var(--text-muted); }
.kpi-spark { position: absolute; bottom: 0; left: 0; right: 0; height: 26px; opacity: .35; }
.kpi-spark--blue { background: linear-gradient(180deg, transparent, rgba(22,91,229,.4)); clip-path: polygon(0 100%,0 70%,12% 55%,24% 65%,36% 35%,48% 48%,60% 20%,72% 38%,84% 12%,100% 28%,100% 100%); }
.kpi-spark--green { background: linear-gradient(180deg, transparent, rgba(17,178,71,.4)); clip-path: polygon(0 100%,0 60%,14% 68%,28% 42%,42% 55%,56% 30%,70% 45%,84% 25%,100% 38%,100% 100%); }
.kpi-spark--amber { background: linear-gradient(180deg, transparent, rgba(255,178,25,.4)); clip-path: polygon(0 100%,0 72%,15% 50%,30% 60%,45% 30%,60% 44%,75% 18%,90% 34%,100% 15%,100% 100%); }
.kpi-spark--red { background: linear-gradient(180deg, transparent, rgba(239,68,68,.35)); clip-path: polygon(0 100%,0 40%,16% 55%,32% 30%,48% 48%,64% 22%,80% 42%,100% 20%,100% 100%); }

/* Light KPI variant */
.kpi-card--light { background: var(--card-light); border-color: var(--border-light); }
.kpi-card--light::after { display: none; }
.kpi-card--light .kpi-card__label { color: var(--ink-soft); }
.kpi-card__value--dark { color: var(--ink); }

/* ---------- DASHBOARD GRID ---------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.85fr) minmax(320px, 1fr); gap: 16px; align-items: start; }
.side-stack { display: flex; flex-direction: column; gap: 16px; }

/* ---------- PANELS ---------- */
.panel {
  border-radius: var(--radius);
  border: 1px solid var(--border-dark);
  background: linear-gradient(160deg, var(--card-dark), var(--navy-900));
  overflow: hidden;
}
.panel--dark { color: var(--text); }
.panel--light { background: var(--card-light); border-color: var(--border-light); color: var(--ink); box-shadow: 0 3px 14px rgba(20,40,80,.05); }

.panel__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 14px; }
.panel__head--tight { padding: 16px 18px 12px; }
.panel__head h2 { margin: 0; font-size: 15px; font-weight: 700; }
.panel__sub { margin: 3px 0 0; font-size: 11px; color: var(--text-muted); }
.panel--light .panel__sub { color: var(--ink-muted); }
.panel__toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 0 20px 14px; }
.panel__foot { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px; border-top: 1px solid var(--border-dark); font-size: 11px; color: var(--text-muted); }
.panel--light .panel__foot { border-color: var(--border-light); color: var(--ink-muted); }

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: 9px; border: 1px solid transparent;
  padding: 9px 15px; font-size: 12.5px; font-weight: 600;
  transition: transform .12s, background .18s, border-color .18s;
  white-space: nowrap;
}
.btn svg { width: 15px; height: 15px; }
.btn:active { transform: translateY(1px); }
.btn--sm { padding: 7px 11px; font-size: 11.5px; }
.btn--primary { background: var(--blue); color: #fff; box-shadow: 0 5px 16px var(--blue-glow); }
.btn--primary:hover { background: #2a6bf0; }
.btn--ghost { background: rgba(255,255,255,.04); border-color: var(--border-dark-strong); color: var(--text-soft); }
.btn--ghost:hover { background: rgba(255,255,255,.09); color: #fff; }
.panel--light .btn--ghost, .btn--ghost-on-light { color: var(--ink-soft); border-color: var(--border-light); background: #fff; }
.panel--light .btn--ghost:hover { background: #f6f8fc; color: var(--ink); }
.btn--danger-ghost { background: var(--red-soft); border-color: rgba(239,68,68,.3); color: #ff8f8f; }
.btn--danger-ghost:hover { background: rgba(239,68,68,.2); }

/* ---------- SEARCH + TABS ---------- */
.searchbox {
  display: flex; align-items: center; gap: 8px;
  background: rgba(2,12,32,.5);
  border: 1px solid var(--border-dark);
  border-radius: 9px; padding: 0 11px;
  height: 36px; flex: 1; min-width: 190px;
  color: var(--text-muted);
}
.searchbox svg { width: 16px; height: 16px; flex: 0 0 16px; }
.searchbox input { border: 0; outline: 0; background: transparent; color: var(--text); font-size: 12.5px; width: 100%; }
.searchbox input::placeholder { color: #5f7396; }

.tabs { display: flex; gap: 4px; background: rgba(2,12,32,.45); padding: 3px; border-radius: 9px; border: 1px solid var(--border-dark); }
.tab { border: 0; background: transparent; color: var(--text-muted); font-size: 11.5px; font-weight: 600; padding: 7px 10px; border-radius: 6px; white-space: nowrap; }
.tab span { opacity: .6; margin-left: 2px; }
.tab:hover { color: var(--text); }
.tab.is-active { background: var(--blue); color: #fff; box-shadow: 0 3px 10px var(--blue-glow); }
.tab.is-active span { opacity: .85; }

/* ---------- TABLE ---------- */
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.data-table th {
  text-align: left; font-size: 10px; font-weight: 700; letter-spacing: .8px;
  text-transform: uppercase; color: var(--text-muted);
  padding: 10px 20px; background: rgba(2,12,32,.35);
  border-top: 1px solid var(--border-dark);
  border-bottom: 1px solid var(--border-dark);
  white-space: nowrap;
}
.data-table td { padding: 13px 20px; border-bottom: 1px solid var(--border-dark); color: var(--text-soft); vertical-align: middle; }
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr:hover { background: rgba(255,255,255,.03); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.vj-id { font-weight: 700; color: #7ea8ff; font-size: 12px; }
.pax-name { color: var(--text); font-weight: 600; }
.route { display: flex; align-items: center; gap: 6px; font-size: 11.5px; white-space: nowrap; }
.route .arrow { color: var(--text-muted); }
.route .dot { width: 6px; height: 6px; border-radius: 50%; flex: 0 0 6px; }
.dot--origin { background: var(--green); }
.dot--dest { background: var(--amber); }
.time-cell { font-variant-numeric: tabular-nums; color: var(--text-muted); }
.row-more { border: 0; background: none; color: var(--text-muted); padding: 4px; width: 24px; }
.row-more:hover { color: #fff; }

/* Status tags */
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; padding: 4px 9px; border-radius: 20px; white-space: nowrap; }
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag--green { background: var(--green-soft); color: #4ade80; }
.tag--amber { background: var(--amber-soft); color: var(--amber); }
.tag--blue { background: var(--blue-glow); color: #7ea8ff; }
.tag--gray { background: rgba(140,154,178,.15); color: #9fb0c9; }
.tag--red { background: var(--red-soft); color: #ff8f8f; }

/* Light table */
.data-table--light th { color: var(--ink-soft); background: #f8fafd; border-color: var(--border-light); }
.data-table--light td { color: var(--ink-soft); border-color: var(--border-light); }
.data-table--light tbody tr:hover { background: #f8fafd; }
.data-table--light .vj-id { color: var(--blue); }
.data-table--light .pax-name { color: var(--ink); }
.data-table--light .route { color: var(--ink-soft); }
.data-table--light .time-cell { color: var(--ink-muted); }

/* Pagination */
.pagination { display: flex; gap: 4px; }
.page-btn { width: 26px; height: 26px; border-radius: 6px; border: 1px solid var(--border-dark); background: transparent; color: var(--text-muted); font-size: 11px; }
.page-btn.is-active { background: var(--blue); border-color: var(--blue); color: #fff; }
.page-btn:disabled { opacity: .35; cursor: default; }

/* ---------- REQUEST PANEL ---------- */
.segmented { display: flex; gap: 4px; margin: 0 18px 14px; background: rgba(2,12,32,.45); padding: 3px; border-radius: 8px; border: 1px solid var(--border-dark); }
.seg { flex: 1; border: 0; background: transparent; color: var(--text-muted); font-size: 11px; font-weight: 600; padding: 7px 4px; border-radius: 6px; }
.seg.is-active { background: var(--card-dark-2); color: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.2); }

.field { padding: 0 18px; margin-bottom: 12px; }
.field label { display: block; font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--text-muted); margin-bottom: 5px; }
.field__input { display: flex; align-items: center; gap: 8px; background: rgba(2,12,32,.5); border: 1px solid var(--border-dark); border-radius: 8px; padding: 9px 10px; font-size: 12px; color: var(--text-soft); }
.field-row { display: flex; gap: 10px; }
.field-row .field { flex: 1; min-width: 0; }
.request-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 18px 18px; }
.request-actions .btn { flex: 1 1 auto; }

/* ---------- DETAIL PANEL ---------- */
.person { display: flex; align-items: center; gap: 10px; padding: 8px 18px; }
.person__avatar { width: 34px; height: 34px; flex: 0 0 34px; border-radius: 9px; background: linear-gradient(135deg,#7c5cff,#5b39d6); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 11px; }
.person__avatar--blue { background: linear-gradient(135deg,#3b82f6,#165be5); }
.person__info strong { display: block; font-size: 12.5px; }
.person__info span { display: block; font-size: 10.5px; color: var(--text-muted); margin-top: 2px; }
.rating { margin-left: auto; color: var(--amber); font-size: 11.5px; font-weight: 700; }

.timeline { position: relative; margin: 14px 22px 16px; padding-left: 4px; }
.timeline::before { content: ""; position: absolute; left: 8px; top: 8px; bottom: 8px; width: 2px; background: var(--border-dark-strong); }
.timeline__step { position: relative; display: flex; align-items: center; gap: 12px; padding: 6px 0; }
.timeline__dot { width: 10px; height: 10px; border-radius: 50%; background: var(--navy-700); border: 2px solid #3a4f73; flex: 0 0 10px; z-index: 1; }
.timeline__step.is-done .timeline__dot { background: var(--green); border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.timeline__step.is-current .timeline__dot { background: var(--amber); border-color: var(--amber); box-shadow: 0 0 0 4px var(--amber-soft); }
.timeline__step strong { display: block; font-size: 11.5px; color: var(--text-soft); }
.timeline__step small { font-size: 10px; color: var(--text-muted); }
.timeline__step.is-current strong { color: var(--amber); }

.detail-total { display: flex; align-items: center; justify-content: space-between; margin: 0 18px; padding: 12px 0; border-top: 1px solid var(--border-dark); }
.detail-total > div:first-child span { display: block; font-size: 10.5px; color: var(--text-muted); }
.detail-total > div:first-child strong { font-size: 19px; }
.mini-map { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--blue-light); }
.mini-map svg { width: 92px; height: 34px; }
.mini-map span { font-size: 10px; font-weight: 600; }
.detail-actions { display: flex; gap: 8px; padding: 0 18px 18px; }
.detail-actions .btn { flex: 1; }

/* ============================================================
   RESERVAS (WhatsApp)
   ============================================================ */
.reservas-layout { display: grid; grid-template-columns: minmax(320px, 480px) minmax(280px, 1fr); gap: 18px; align-items: start; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border-light); background: #f8fafd; }
.chat-head__avatar { width: 36px; height: 36px; border-radius: 50%; background: linear-gradient(135deg,#165be5,#0a3590); color: #fff; display: grid; place-items: center; font-weight: 800; }
.chat-head__meta strong { display: block; font-size: 13px; color: var(--ink); }
.chat-head__meta span { display: block; font-size: 10.5px; color: #11b247; margin-top: 2px; }
.online-dot { display: inline-block; width: 6px; height: 6px; background: var(--green); border-radius: 50%; margin-right: 3px; }
.chat-head .icon-btn { margin-left: auto; color: var(--ink-soft); }
.chat-body { background: #e5ddd5; background-image: radial-gradient(rgba(255,255,255,.35) 1px, transparent 1px); background-size: 18px 18px; padding: 18px 16px; min-height: 380px; display: flex; flex-direction: column; gap: 12px; }
.chat-day { align-self: center; background: #e4f3e8; color: #5b7a63; font-size: 9.5px; font-weight: 700; letter-spacing: .6px; padding: 4px 12px; border-radius: 20px; }
.bubble { max-width: 82%; padding: 10px 12px 7px; border-radius: 10px; font-size: 12.5px; line-height: 1.5; box-shadow: 0 1px 2px rgba(0,0,0,.08); position: relative; }
.bubble p { margin: 0; color: var(--ink); }
.bubble__time { display: block; text-align: right; font-size: 9.5px; color: #8a9bab; margin-top: 4px; }
.bubble--in { align-self: flex-start; background: #fff; border-top-left-radius: 2px; }
.bubble--out { align-self: flex-end; background: #d9fdd3; border-top-right-radius: 2px; }
.bubble--typing { display: flex; gap: 4px; padding: 12px; background: #fff; align-self: flex-start; }
.bubble--typing span { width: 6px; height: 6px; border-radius: 50%; background: #9cb2a1; animation: typing 1.2s infinite; }
.bubble--typing span:nth-child(2) { animation-delay: .2s; }
.bubble--typing span:nth-child(3) { animation-delay: .4s; }
@keyframes typing { 0%,60%,100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }
.chat-input { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: #f8fafd; border-top: 1px solid var(--border-light); }
.chat-input .icon-btn { color: var(--ink-soft); }
.chat-input input { flex: 1; border: 0; outline: 0; background: #fff; border: 1px solid var(--border-light); border-radius: 20px; padding: 9px 14px; font-size: 12.5px; color: var(--ink); }
.send-btn { width: 34px; height: 34px; flex: 0 0 34px; border: 0; border-radius: 50%; background: var(--green); color: #fff; padding: 9px; }
.send-btn:hover { background: #0e9e3f; }

.reservas-side { display: flex; flex-direction: column; gap: 18px; }
.reserva-item { display: flex; align-items: center; gap: 12px; padding: 13px 18px; border-bottom: 1px solid var(--border-light); }
.reserva-item:last-child { border-bottom: 0; }
.reserva-item__date { flex: 0 0 42px; text-align: center; font-size: 17px; font-weight: 800; color: var(--ink); line-height: 1; }
.reserva-item__date span { display: block; font-size: 9px; color: var(--ink-muted); letter-spacing: .8px; margin-top: 2px; }
.reserva-item__info { flex: 1; min-width: 0; }
.reserva-item__info strong { display: block; font-size: 12px; color: var(--ink); }
.reserva-item__info span { display: block; font-size: 10.5px; color: var(--ink-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.panel--light .tag--green { color: #0e9e3f; background: var(--green-soft); }
.panel--light .tag--amber { color: #b57f00; }
.stats-mini { display: grid; grid-template-columns: repeat(3,1fr); padding: 18px 8px; text-align: center; }
.stats-mini__num { display: block; font-size: 22px; font-weight: 800; color: var(--blue); }
.stats-mini__label { display: block; font-size: 10px; color: var(--ink-muted); margin-top: 3px; }

/* ============================================================
   LIQUIDACIONES / INFORMES (light admin)
   ============================================================ */
.admin-tabs { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--border-light); margin-bottom: 20px; }
.admin-tab { border: 0; background: none; color: var(--ink-soft); font-size: 12.5px; font-weight: 600; padding: 10px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.admin-tab:hover { color: var(--ink); }
.admin-tab.is-active { color: var(--blue); border-color: var(--blue); }
.admin-tabs__date { margin-left: auto; display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-soft); padding-right: 8px; }
.admin-tabs__date svg { width: 15px; height: 15px; }
.admin-tabs__right { margin-left: auto; }

.stat-row { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 18px; }
.stat-box { background: var(--card-light); border: 1px solid var(--border-light); border-radius: var(--radius); padding: 16px 18px; color: var(--ink); box-shadow: 0 3px 14px rgba(20,40,80,.05); }
.stat-box__label { display: block; font-size: 11.5px; color: var(--ink-soft); margin-bottom: 8px; }
.stat-box__value { display: block; font-size: 23px; font-weight: 800; letter-spacing: -.5px; }
.stat-box__trend { display: inline-block; font-size: 10.5px; color: var(--ink-muted); margin-top: 6px; }
.stat-box__trend--up { color: #0e9e3f; background: var(--green-soft); padding: 2px 7px; border-radius: 20px; font-weight: 700; }

.chart-grid { display: grid; grid-template-columns: 1.55fr 1fr; gap: 16px; margin-bottom: 18px; }
.legend { display: flex; gap: 12px; font-size: 10.5px; color: var(--ink-soft); }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend__dot { width: 8px; height: 8px; border-radius: 2px; }
.legend__dot--blue { background: var(--blue); }
.legend__dot--gray { background: #c9d2e0; }
.bar-chart { display: flex; align-items: flex-end; gap: 8px; height: 180px; padding: 10px 20px 22px; }
.bar-group { flex: 1; display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 100%; position: relative; }
.bar { width: 13px; border-radius: 3px 3px 0 0; background: var(--blue); transition: height .5s ease; }
.bar--prev { background: #c9d2e0; }
.bar-group span { position: absolute; bottom: -18px; font-size: 9px; color: var(--ink-muted); }
.donut-wrap { display: flex; align-items: center; justify-content: center; gap: 26px; padding: 10px 20px 24px; }
.donut { width: 132px; height: 132px; flex: 0 0 132px; border-radius: 50%; background: conic-gradient(var(--blue) 0 65%, var(--amber) 65% 90%, var(--green) 90% 100%); display: grid; place-items: center; position: relative; }
.donut::before { content: ""; position: absolute; width: 92px; height: 92px; border-radius: 50%; background: #fff; }
.donut__center { position: relative; text-align: center; }
.donut__center strong { display: block; font-size: 22px; color: var(--ink); }
.donut__center span { font-size: 10px; color: var(--ink-muted); }
.donut-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.donut-legend li { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--ink-soft); }
.donut-legend i { width: 9px; height: 9px; border-radius: 2px; }
.donut-legend strong { color: var(--ink); margin-left: 6px; }

.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px,1fr)); gap: 14px; padding: 18px 20px 22px; }
.report-card { border: 1px solid var(--border-light); border-radius: 10px; padding: 16px; display: flex; align-items: center; gap: 12px; transition: border-color .18s, transform .12s; cursor: pointer; }
.report-card:hover { border-color: var(--blue); transform: translateY(-2px); }
.report-card__icon { width: 38px; height: 38px; flex: 0 0 38px; border-radius: 9px; background: var(--blue-glow); color: var(--blue); padding: 9px; }
.report-card strong { display: block; font-size: 12.5px; color: var(--ink); }
.report-card span { display: block; font-size: 10.5px; color: var(--ink-muted); margin-top: 3px; }

/* ============================================================
   CONFIGURACIÓN
   ============================================================ */
.config-layout { display: grid; grid-template-columns: minmax(0,1.7fr) minmax(280px,1fr); gap: 16px; align-items: start; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border-light); }
.setting-row:last-child { border-bottom: 0; }
.setting-row strong { display: block; font-size: 12px; color: var(--ink); }
.setting-row span { display: block; font-size: 10.5px; color: var(--ink-muted); margin-top: 2px; }
.switch { position: relative; width: 38px; height: 21px; flex: 0 0 38px; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #cbd5e5; border-radius: 20px; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 15px; height: 15px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::before { transform: translateX(17px); }
.edit-btn { border: 0; background: var(--blue-glow); color: var(--blue); font-size: 11px; font-weight: 700; padding: 5px 10px; border-radius: 6px; }
.edit-btn:hover { background: var(--blue); color: #fff; }

/* ============================================================
   TOAST
   ============================================================ */
.toast {
  /* Por encima del modal (z-index 300): si queda debajo, el blur del backdrop lo desenfoca. */
  position: fixed; bottom: 26px; right: 26px; z-index: 400;
  background: #0d2348; color: #fff; border: 1px solid var(--border-dark-strong);
  border-left: 3px solid var(--green);
  padding: 13px 18px; border-radius: 10px; font-size: 12.5px;
  box-shadow: var(--shadow);
  transform: translateY(20px); opacity: 0; pointer-events: none;
  transition: transform .25s, opacity .25s;
}
.toast.is-visible { transform: none; opacity: 1; }
.toast.toast--error { border-left-color: var(--red); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1180px) {
  .kpi-grid { grid-template-columns: repeat(2,1fr); }
  .dash-grid { grid-template-columns: 1fr; }
  .chart-grid, .config-layout, .reservas-layout { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0;
    width: min(84vw, 300px); flex-basis: auto;
    transform: translateX(-102%);
    transition: transform .25s ease;
    box-shadow: 20px 0 50px rgba(0,0,0,.45);
    padding-top: calc(20px + env(safe-area-inset-top));
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }
  .sidebar.is-open { transform: none; }
  .sidebar-backdrop {
    position: fixed; inset: 0; z-index: 55;
    background: rgba(2, 10, 28, .62);
    opacity: 0; visibility: hidden; pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
  }
  .sidebar-backdrop.is-visible { opacity: 1; visibility: visible; pointer-events: auto; }
  body.menu-open { overflow: hidden; }
  .menu-toggle {
    display: grid; place-items: center;
    width: 36px; height: 36px; flex: 0 0 36px;
    margin-left: -6px; border-radius: 8px;
  }
  .menu-toggle:active { background: rgba(255,255,255,.08); }
  .topbar {
    height: 60px; gap: 10px;
    padding: 0 calc(12px + env(safe-area-inset-right)) 0 calc(12px + env(safe-area-inset-left));
  }
  .topbar__title { min-width: 0; }
  .topbar__title h1 { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar__actions { gap: 6px; }
  .topbar__actions .icon-btn { width: 34px; height: 34px; flex: 0 0 34px; }
  #helpBtn { display: none; }
  .view { padding: 14px 12px 28px; }
  .system-pill__date { display: none; }
  .panel__head { flex-wrap: wrap; }
  .panel__head > .btn, .panel__head > .tabs { width: 100%; }
  .notif-panel {
    position: fixed; top: 56px; left: 8px; right: 8px;
    width: auto; max-width: none;
  }
}
@media (max-width: 560px) {
  .kpi-grid, .kpi-grid--3, .stat-row { grid-template-columns: 1fr; }
  .topbar__title p { display: none; }
  .system-pill, .api-badge { display: none; }
  .tabs { width: 100%; overflow-x: auto; }
  .donut-wrap { flex-direction: column; }
  .kpi-card { padding: 14px; }
  .data-table { min-width: 540px; font-size: 11.5px; }
  .data-table th, .data-table td { padding: 10px 12px; }
  .form-grid { grid-template-columns: 1fr; }
  .btn { min-height: 36px; }
  .modal { padding: 10px; }
  .modal__dialog { max-height: calc(100vh - 20px); }
  .modal__foot { flex-wrap: wrap; }
  .modal__foot .btn { flex: 1 1 calc(50% - 4px); }
}

/* ============================================================
   FORMULARIOS EN PANELES
   ============================================================ */
.field__input input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
}
.field__input input::placeholder { color: #5f7396; }
button.mini-map { border: 0; background: none; padding: 0; cursor: pointer; }
.detail-actions { flex-wrap: wrap; }
.detail-actions .btn { flex: 1 1 calc(50% - 4px); font-size: 11px; padding: 7px 8px; }
.timeline__step.is-cancelled .timeline__dot { background: var(--red); border-color: var(--red); box-shadow: 0 0 0 3px var(--red-soft); }
.timeline__step.is-cancelled strong { color: #ff8f8f; }

/* ============================================================
   ACCIONES DE TABLA
   ============================================================ */
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.action-btn {
  border: 1px solid var(--border-light);
  background: #fff;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 700;
  padding: 5px 9px;
  border-radius: 6px;
  transition: background .15s, border-color .15s, color .15s;
}
.action-btn:hover { border-color: var(--blue); color: var(--blue); }
.action-btn--danger { color: #c22b2b; border-color: #f3caca; background: #fff5f5; }
.action-btn--danger:hover { border-color: var(--red); color: #a51f1f; }
.action-btn--ok { color: #0e7a34; border-color: #bfe8cc; background: #f1fbf4; }
.action-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ============================================================
   ESTADOS VACÍOS
   ============================================================ */
.empty-state { text-align: center; padding: 30px 20px; color: var(--text-muted); font-size: 12px; }
.empty-state strong { display: block; color: var(--text-soft); font-size: 13px; margin-bottom: 5px; }
.data-table--light .empty-state { color: var(--ink-muted); }
.data-table--light .empty-state strong { color: var(--ink); }
.page-gap { color: var(--text-muted); padding: 0 4px; font-size: 11px; align-self: center; }

/* ============================================================
   MODAL
   ============================================================ */
body.modal-open { overflow: hidden; }
.modal { position: fixed; inset: 0; z-index: 300; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(0, 8, 24, .74); backdrop-filter: blur(4px); }
.modal__dialog {
  position: relative;
  width: min(580px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
  background: linear-gradient(160deg, var(--card-dark), var(--navy-900));
  border: 1px solid var(--border-dark-strong);
  border-radius: 16px;
  box-shadow: var(--shadow);
  color: var(--text);
  animation: modalIn .2s ease;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal__head { display: flex; justify-content: space-between; gap: 12px; padding: 20px 22px 12px; }
.modal__head h2 { margin: 0; font-size: 17px; }
.modal__head p { margin: 3px 0 0; font-size: 11.5px; color: var(--text-muted); }
.modal__close { border: 0; background: rgba(255,255,255,.05); color: var(--text-soft); width: 30px; height: 30px; border-radius: 8px; font-size: 20px; line-height: 1; flex: 0 0 30px; }
.modal__close:hover { background: rgba(255,255,255,.1); color: #fff; }
.modal__body { padding: 6px 22px 4px; }
.modal__body > p { font-size: 12.5px; line-height: 1.65; color: var(--text-soft); margin: 0 0 12px; }
.modal__body ul { margin: 8px 0 14px; padding-left: 18px; font-size: 12.5px; line-height: 1.7; color: var(--text-soft); }
.modal__body code { background: rgba(255,255,255,.06); padding: 1px 5px; border-radius: 4px; font-size: 11.5px; color: #9fc0ff; }
.modal__body a { color: #7ea8ff; }
.modal__body .modal-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px 20px; border-top: 1px solid var(--border-dark); margin-top: 10px; }
.modal__foot:empty { display: none; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-field { display: flex; flex-direction: column; gap: 5px; }
.form-field--full { grid-column: 1 / -1; }
.form-field label { font-size: 10px; font-weight: 700; letter-spacing: .6px; text-transform: uppercase; color: var(--text-muted); }
.form-field input, .form-field select, .form-field textarea {
  width: 100%;
  background: rgba(2,12,32,.55);
  border: 1px solid var(--border-dark);
  border-radius: 8px;
  padding: 9px 10px;
  color: var(--text);
  font-size: 12.5px;
  outline: none;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--blue-light); box-shadow: 0 0 0 3px var(--blue-glow); }
.form-field select option { background: #0a1e41; color: #fff; }
.form-check { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-soft); grid-column: 1 / -1; padding: 4px 0; }
.form-check input { width: 16px; height: 16px; accent-color: var(--blue); }

/* ============================================================
   NOTIFICACIONES
   ============================================================ */
.notif-wrap { position: relative; }
.notif-panel {
  position: absolute;
  right: 0;
  top: 44px;
  width: 340px;
  max-width: calc(100vw - 32px);
  background: #081c3e;
  border: 1px solid var(--border-dark-strong);
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 120;
  overflow: hidden;
}
.notif-panel[hidden] { display: none; }
.notif-panel__head { display: flex; justify-content: space-between; gap: 10px; padding: 13px 15px; border-bottom: 1px solid var(--border-dark); font-size: 12px; }
.notif-panel__head span { color: var(--text-muted); font-size: 11px; }
.notif-panel__list { max-height: 320px; overflow: auto; }
.notif-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; border-bottom: 1px solid var(--border-dark); background: transparent; padding: 11px 14px; color: var(--text); }
.notif-item:hover { background: rgba(255,255,255,.05); }
.notif-item:last-child { border-bottom: 0; }
.notif-item__body { flex: 1; min-width: 0; }
.notif-item__body strong { display: block; font-size: 11.5px; }
.notif-item__body span { display: block; font-size: 10.5px; color: var(--text-muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-empty { padding: 20px 15px; font-size: 11.5px; color: var(--text-muted); text-align: center; }

/* ============================================================
   IMPRESIÓN (Exportar PDF)
   ============================================================ */
@media print {
  body { background: #fff; color: #000; }
  .sidebar, .topbar, .toast, .modal, .notif-panel, .menu-toggle { display: none !important; }
  .main-wrap { background: #fff; }
  .view { display: none !important; }
  .view.is-active { display: block !important; padding: 0; }
  .panel, .stat-box { box-shadow: none; border-color: #d9dee8; }
  .admin-tabs, .admin-tabs__right, .btn, .pagination, .row-actions { display: none !important; }
  .data-table th { background: #f3f5f9; }
  .view.is-active .panel { break-inside: avoid; }
}

@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .modal { padding: 12px; }
  .modal__dialog { max-height: calc(100vh - 24px); }
  .field-row { flex-direction: column; gap: 0; }
  .admin-tabs { overflow-x: auto; }
  .admin-tabs__date { display: none; }
}

/* ---------- Botones de tarjetas y filas seleccionadas ---------- */
button.reserva-item {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border-light);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
button.reserva-item:hover { background: #f8fafd; }
button.report-card {
  width: 100%;
  background: #fff;
  font: inherit;
  text-align: left;
}
.data-table tbody tr.is-selected { background: rgba(22, 91, 229, .12); }
.data-table--light tbody tr.is-selected { background: #eef4ff; }
