/* app.css — Plataforma IA TunedHotel. Vanilla, sin framework. */
:root {
  --bg: #0f172a;
  --bg-2: #1e293b;
  --panel: #ffffff;
  --panel-2: #f8fafc;
  --panel-3: #f1f5f9;
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --txt: #0f172a;
  --txt-soft: #64748b;
  --txt-faint: #94a3b8;
  --brand: #0e7490;
  --brand-2: #0891b2;
  --brand-ink: #155e75;
  --accent: #f59e0b;
  --ok: #16a34a;
  --warn: #d97706;
  --bad: #dc2626;
  --hbt: #0891b2;
  --hba: #7c3aed;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 14px rgba(15, 23, 42, 0.10), 0 2px 4px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, .4);
  --ring: 0 0 0 3px rgba(8, 145, 178, .35);
  --ease: cubic-bezier(.4, 0, .2, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--panel-2);
  color: var(--txt);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
.hidden { display: none !important; }
.tnum { font-variant-numeric: tabular-nums; }

/* Accesibilidad: foco de teclado visible y consistente */
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
button:focus-visible, a:focus-visible, select:focus-visible, input:focus-visible { box-shadow: var(--ring); }

/* ---------- Marca / wordmark ---------- */
.wordmark { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; letter-spacing: -.01em; font-size: 19px; color: var(--brand-ink); }
.wordmark .wm-dot {
  width: 16px; height: 16px; border-radius: 5px;
  background: linear-gradient(135deg, var(--brand-2), var(--accent));
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .85);
}

/* ---------- Login ---------- */
#login {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 600px at 70% -10%, #155e75 0%, transparent 60%),
              linear-gradient(135deg, var(--bg) 0%, var(--bg-2) 100%);
  padding: 20px;
}
.login-card {
  background: var(--panel); border-radius: 16px; padding: 32px 30px 26px;
  width: 360px; max-width: 100%; box-shadow: var(--shadow-lg);
  animation: cardIn .35s var(--ease) both;
}
@keyframes cardIn { from { opacity: 0; transform: translateY(10px) scale(.99); } to { opacity: 1; transform: none; } }
.login-brand { margin-bottom: 18px; }
.login-card h1 { margin: 0 0 2px; font-size: 21px; letter-spacing: -.01em; }
.login-card .sub { color: var(--txt-soft); margin: 0 0 18px; font-size: 13px; }
.login-card .field { display: block; }
.login-card label { display: block; font-size: 12px; font-weight: 600; color: var(--txt-soft); margin: 14px 0 5px; }
.login-card input {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line-2);
  border-radius: 9px; font-size: 14px; transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.login-card input:focus { border-color: var(--brand-2); }
.login-card button {
  margin-top: 22px; width: 100%; padding: 11px; border: 0; border-radius: 9px;
  background: var(--brand); color: #fff; font-weight: 600; cursor: pointer; font-size: 14px;
  transition: background .15s var(--ease), transform .05s var(--ease);
}
.login-card button:hover { background: var(--brand-2); }
.login-card button:active { transform: translateY(1px); }
.login-card button[disabled] { opacity: .7; cursor: progress; }
.login-err { color: var(--bad); font-size: 13px; margin-top: 12px; min-height: 18px; }
.login-hint { color: var(--txt-faint); font-size: 11px; margin-top: 18px; text-align: center; }

/* ---------- Layout ---------- */
header.topbar {
  display: flex; align-items: center; gap: 16px;
  background: var(--panel); border-bottom: 1px solid var(--line);
  padding: 0 20px; height: 56px; position: sticky; top: 0; z-index: 30;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--txt); flex-shrink: 0; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--brand-2), var(--accent));
  display: grid; place-items: center; position: relative;
}
.brand .logo::after {
  content: ""; width: 12px; height: 12px; border-radius: 4px;
  background: #fff; opacity: .92; box-shadow: 0 0 0 2px rgba(255, 255, 255, .25);
}
.brand-text { display: flex; align-items: baseline; gap: 6px; font-size: 15px; white-space: nowrap; }
.brand-text strong { font-weight: 800; letter-spacing: -.01em; }
.brand-sep { color: var(--line-2); font-weight: 400; }
.brand-sub { color: var(--txt-soft); font-weight: 600; font-size: 13px; }

nav.tabs { display: flex; gap: 4px; margin-left: 6px; }
nav.tabs button {
  border: 0; background: transparent; padding: 8px 16px; border-radius: 8px;
  color: var(--txt-soft); font-weight: 600; cursor: pointer; font-size: 14px;
  transition: background .15s var(--ease), color .15s var(--ease);
}
nav.tabs button:hover { background: var(--panel-2); color: var(--txt); }
nav.tabs button.active { background: var(--panel-3); color: var(--brand); }
.spacer { flex: 1; }
.badge-src {
  font-size: 11px; padding: 3px 9px; border-radius: 999px; font-weight: 600;
  border: 1px solid var(--line-2); color: var(--txt-soft); white-space: nowrap;
}
.badge-src::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 5px; vertical-align: 1px; opacity: .8; }
.badge-src.mock { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.badge-src.python { background: #dcfce7; border-color: #86efac; color: #166534; }
.user-chip { display: flex; align-items: center; gap: 8px; color: var(--txt-soft); }
.user-chip .user-name { font-weight: 600; color: var(--txt); }
.user-chip button {
  border: 1px solid var(--line-2); background: var(--panel); border-radius: 8px;
  padding: 6px 12px; cursor: pointer; font-size: 13px; transition: background .15s var(--ease), border-color .15s var(--ease);
}
.user-chip button:hover { background: var(--panel-2); border-color: var(--line); }

main { padding: 20px; max-width: 1500px; margin: 0 auto; animation: viewIn .22s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.view-title { font-size: 19px; font-weight: 800; margin: 0 0 3px; letter-spacing: -.01em; }
.view-sub { color: var(--txt-soft); margin: 0; font-size: 13px; }

/* ---------- KPI cards ---------- */
.kpi-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px; margin-bottom: 22px;
}
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 4px;
  transition: box-shadow .18s var(--ease), transform .18s var(--ease), border-color .18s var(--ease);
}
.kpi:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); border-color: var(--line-2); }
.kpi .kpi-top { display: flex; align-items: center; gap: 8px; }
.kpi .kpi-ico {
  width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; flex-shrink: 0;
  background: var(--panel-3); color: var(--brand); font-size: 14px;
}
.kpi .label { font-size: 11px; color: var(--txt-soft); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.kpi .value { font-size: 27px; font-weight: 800; margin-top: 2px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.kpi .unit { font-size: 15px; color: var(--txt-soft); font-weight: 600; margin-left: 1px; }
.kpi .foot { font-size: 12px; color: var(--txt-soft); margin-top: 1px; display: flex; align-items: center; gap: 6px; }
.kpi .delta { font-weight: 600; font-variant-numeric: tabular-nums; }
.kpi .delta.up { color: var(--ok); }
.kpi .delta.down { color: var(--bad); }
.kpi .delta.flat { color: var(--txt-faint); }
/* sparkline / minibarra CSS (sin libs) */
.spark { display: flex; align-items: flex-end; gap: 2px; height: 22px; margin-top: 6px; }
.spark i { flex: 1; background: linear-gradient(180deg, var(--brand-2), var(--brand)); border-radius: 2px 2px 0 0; min-height: 2px; opacity: .85; }
.spark i:last-child { background: linear-gradient(180deg, var(--accent), #d97706); opacity: 1; }

/* ---------- Panels & grids ---------- */
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); overflow: hidden; margin-bottom: 16px;
}
.panel-head {
  padding: 12px 16px; border-bottom: 1px solid var(--line);
  font-weight: 700; font-size: 14px; display: flex; align-items: center; gap: 8px;
}
.panel-head .head-note { margin-left: auto; font-weight: 500; font-size: 12px; color: var(--txt-soft); }
.panel-body { padding: 14px 16px; }

/* ---------- Filters ---------- */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; margin-bottom: 12px; box-shadow: var(--shadow);
}
.filters .field { display: flex; flex-direction: column; gap: 4px; }
.filters label { font-size: 11px; color: var(--txt-soft); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.filters select, .filters input {
  padding: 7px 10px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); font-size: 13px; background: #fff;
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.filters select:focus, .filters input:focus { border-color: var(--brand-2); }
.filters .btn {
  padding: 8px 16px; border: 0; border-radius: var(--radius-sm); background: var(--brand);
  color: #fff; font-weight: 600; cursor: pointer; font-size: 13px;
  transition: background .15s var(--ease), transform .05s var(--ease);
}
.filters .btn:hover { background: var(--brand-2); }
.filters .btn:active { transform: translateY(1px); }
.filters .btn.ghost { background: var(--panel); color: var(--txt-soft); border: 1px solid var(--line-2); }
.filters .btn.ghost:hover { background: var(--panel-2); color: var(--txt); }

/* Chips de filtros activos + contador */
.filter-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; min-height: 26px; }
.filter-count { font-size: 13px; color: var(--txt-soft); margin-right: 2px; }
.filter-count strong { color: var(--txt); font-variant-numeric: tabular-nums; }
.fchip {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600;
  background: var(--panel-3); border: 1px solid var(--line-2); color: var(--brand-ink);
  border-radius: 999px; padding: 3px 6px 3px 10px;
}
.fchip .fchip-k { color: var(--txt-soft); font-weight: 500; }
.fchip button {
  border: 0; background: transparent; color: var(--txt-soft); cursor: pointer;
  width: 17px; height: 17px; border-radius: 50%; line-height: 1; font-size: 13px; padding: 0;
  display: grid; place-items: center; transition: background .12s var(--ease), color .12s var(--ease);
}
.fchip button:hover { background: var(--line-2); color: var(--txt); }
.fchip-clear { font-size: 12px; color: var(--brand); background: none; border: 0; cursor: pointer; font-weight: 600; padding: 4px 6px; border-radius: 6px; }
.fchip-clear:hover { background: var(--panel-3); }

/* ---------- Tables (densas, cabecera sticky) ---------- */
/* Sin scroll vertical interno: las tablas fluyen y se usa el scroll de la
   página (una sola barra que llega hasta el final). Solo scroll horizontal
   cuando la tabla es más ancha que el panel. */
/* Scroll propio por tabla: la cabecera sticky se pega al tope de SU contenedor
   (no del viewport), así nunca se superpone con la topbar/banner ni con la 1ª fila. */
.table-wrap { overflow: auto; max-height: 70vh; border-radius: var(--radius); border: 1px solid var(--line); background: var(--panel); position: relative; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  position: sticky; top: 0; z-index: 5; background: var(--panel-2);
  text-align: left; padding: 9px 12px; border-bottom: 2px solid var(--line-2);
  font-size: 11px; text-transform: uppercase; letter-spacing: .03em; color: var(--txt-soft); white-space: nowrap; font-weight: 700;
}
/* Dentro del modal el contenedor ya scrollea; las tablas fluyen sin doble scroll. */
.drawer .table-wrap { max-height: none; overflow: visible; }
tbody td { padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr { transition: background .12s var(--ease); }
tbody tr[data-id] { cursor: pointer; }
tbody tr[data-id]:hover { background: var(--panel-2); }
tbody tr[data-id]:focus-visible { background: var(--panel-3); outline: none; box-shadow: inset 3px 0 0 var(--brand-2); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.muted { color: var(--txt-soft); }

/* ---------- Chips de estado / hotel / canal ---------- */
.chip {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600;
  border: 1px solid var(--line-2); background: var(--panel-2); white-space: nowrap;
}
.chip.hbt { background: #cffafe; border-color: #67e8f9; color: #155e75; }
.chip.hba { background: #ede9fe; border-color: #c4b5fd; color: #5b21b6; }
.chip.C { background: #dcfce7; border-color: #86efac; color: #166534; }
.chip.P { background: #fef3c7; border-color: #fcd34d; color: #92400e; }
.chip.X { background: #fee2e2; border-color: #fca5a5; color: #991b1b; }
.chip.I { background: #dbeafe; border-color: #93c5fd; color: #1e40af; }
.chip.O { background: #f1f5f9; border-color: #cbd5e1; color: #475569; }

/* ---------- Bars (ocupación / pickup / forecast) ---------- */
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: grid; grid-template-columns: 130px 1fr 64px; align-items: center; gap: 10px; }
.bar-track { background: var(--panel-2); border-radius: 6px; height: 22px; overflow: hidden; border: 1px solid var(--line); }
.bar-fill { height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--accent)); border-radius: 6px 0 0 6px; width: 0; transition: width .5s var(--ease); }
.bar-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.bar-label { font-size: 12px; color: var(--txt-soft); overflow: hidden; text-overflow: ellipsis; }

/* Forecast chart (dos barras superpuestas: on-books vs forecast) */
.fc-row { display: grid; grid-template-columns: 88px 1fr 132px; align-items: center; gap: 10px; padding: 2px 0; }
.fc-row.is-weekend .bar-label { color: var(--brand); font-weight: 600; }
.fc-track { position: relative; height: 18px; background: var(--panel-2); border-radius: 5px; border: 1px solid var(--line); overflow: hidden; cursor: default; }
.fc-forecast { position: absolute; inset: 0 auto 0 0; background: #bae6fd; width: 0; transition: width .5s var(--ease); }
.fc-onbooks { position: absolute; inset: 0 auto 0 0; background: var(--brand); width: 0; transition: width .5s var(--ease); }
.fc-legend { display: flex; gap: 16px; font-size: 12px; color: var(--txt-soft); margin-bottom: 12px; flex-wrap: wrap; }
.fc-legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.fc-axis { display: grid; grid-template-columns: 88px 1fr 132px; gap: 10px; font-size: 11px; color: var(--txt-faint); padding: 6px 0 2px; border-top: 1px dashed var(--line); margin-top: 6px; }
.fc-axis .scale { display: flex; justify-content: space-between; }

/* Tooltip genérico (CSS, sin libs) */
[data-tip] { position: relative; }
[data-tip]:hover::after, [data-tip]:focus-visible::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 7px); left: 50%; transform: translateX(-50%);
  background: var(--bg); color: #fff; padding: 6px 9px; border-radius: 7px; font-size: 11.5px; font-weight: 500;
  white-space: pre; line-height: 1.5; box-shadow: var(--shadow-md); z-index: 50; pointer-events: none;
  opacity: 0; animation: tipIn .12s var(--ease) forwards;
}
[data-tip]:hover::before, [data-tip]:focus-visible::before {
  content: ""; position: absolute; bottom: calc(100% + 2px); left: 50%; transform: translateX(-50%);
  border: 5px solid transparent; border-top-color: var(--bg); z-index: 50; pointer-events: none;
  opacity: 0; animation: tipIn .12s var(--ease) forwards;
}
@keyframes tipIn { to { opacity: 1; } }

/* ---------- Drawer ficha reserva ---------- */
.drawer-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .5); z-index: 40; animation: fadeIn .2s var(--ease) both; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
/* Modal central amplio (para operar con comodidad: cuenta, check-out, ficha…). */
.drawer {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(960px, 95vw); max-height: 92vh;
  background: var(--panel); z-index: 41; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, .35);
  display: flex; flex-direction: column; overflow: hidden;
  animation: popIn .22s var(--ease) both;
}
@keyframes popIn { from { transform: translate(-50%, -50%) scale(.96); opacity: .4; } to { transform: translate(-50%, -50%) scale(1); opacity: 1; } }
.drawer-head { padding: 16px 22px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 10px; flex: 0 0 auto; }
.drawer-head h2 { margin: 0; font-size: 17px; display: flex; align-items: center; gap: 8px; }
.drawer-head .x {
  margin-left: auto; border: 0; background: transparent; font-size: 20px; cursor: pointer; color: var(--txt-soft);
  width: 32px; height: 32px; border-radius: 8px; line-height: 1; transition: background .12s var(--ease), color .12s var(--ease);
}
.drawer-head .x:hover { background: var(--panel-2); color: var(--txt); }
.drawer-body { padding: 18px 22px; overflow: auto; flex: 1 1 auto; min-height: 0; }
.drawer-section { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; }
.drawer-amount { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.drawer-amount .big { font-size: 24px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.drawer-amount .lbl { font-size: 12px; color: var(--txt-soft); text-transform: uppercase; letter-spacing: .03em; font-weight: 600; }
.kv { display: grid; grid-template-columns: 142px 1fr; gap: 7px 12px; font-size: 13px; margin: 0; }
.kv dt { color: var(--txt-soft); }
.kv dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.sec-title { font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--txt-soft); margin: 4px 0 8px; font-weight: 700; }

.empty { padding: 40px; text-align: center; color: var(--txt-soft); }
.pager { display: flex; align-items: center; gap: 12px; justify-content: flex-end; margin-top: 12px; color: var(--txt-soft); font-size: 13px; }
.pager .pager-info { font-variant-numeric: tabular-nums; }
.pager button { border: 1px solid var(--line-2); background: #fff; border-radius: var(--radius-sm); padding: 6px 12px; cursor: pointer; transition: background .12s var(--ease), border-color .12s var(--ease); }
.pager button:not(:disabled):hover { background: var(--panel-2); border-color: var(--line); }
.pager button:disabled { opacity: .4; cursor: default; }

/* ---------- Estados: loading / error / vacío ---------- */
.state {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 48px 24px; text-align: center; color: var(--txt-soft);
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.state .state-ico { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; background: var(--panel-3); }
.state.error .state-ico { background: #fee2e2; color: var(--bad); }
.state .state-title { font-weight: 700; color: var(--txt); font-size: 15px; }
.state .state-msg { font-size: 13px; max-width: 420px; }
.state .btn-retry {
  margin-top: 4px; border: 1px solid var(--line-2); background: var(--panel); color: var(--brand);
  font-weight: 600; padding: 8px 16px; border-radius: var(--radius-sm); cursor: pointer; font-size: 13px;
  transition: background .12s var(--ease), border-color .12s var(--ease);
}
.state .btn-retry:hover { background: var(--panel-2); border-color: var(--brand-2); }

/* Spinner */
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand-2); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.inline-loading { display: flex; align-items: center; gap: 10px; color: var(--txt-soft); font-size: 13px; padding: 6px 2px; }
.inline-loading .spinner { width: 18px; height: 18px; border-width: 2px; }

/* Skeleton shimmer */
.sk { position: relative; overflow: hidden; background: var(--panel-3); border-radius: 6px; }
.sk::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .65), transparent);
  transform: translateX(-100%); animation: shimmer 1.25s var(--ease) infinite;
}
@keyframes shimmer { to { transform: translateX(100%); } }
.sk-line { height: 12px; margin: 7px 0; }
.sk-kpi { height: 92px; border: 1px solid var(--line); border-radius: var(--radius); }
.sk-row { height: 22px; margin: 8px 0; }
tr.sk-tr td { padding: 0; }
tr.sk-tr .sk { height: 14px; margin: 9px 12px; }

/* ---------- Informes: sub-selector segmentado ---------- */
.seg-row {
  display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 5px; box-shadow: var(--shadow);
}
.seg-btn {
  border: 0; background: transparent; padding: 8px 16px; border-radius: var(--radius-sm);
  color: var(--txt-soft); font-weight: 600; cursor: pointer; font-size: 13.5px;
  transition: background .15s var(--ease), color .15s var(--ease); flex: 1 1 auto; white-space: nowrap;
}
.seg-btn:hover { background: var(--panel-2); color: var(--txt); }
.seg-btn.active { background: var(--brand); color: #fff; box-shadow: var(--shadow); }
.informe-filters { margin-bottom: 16px; }

/* Mini-barra de porcentaje dentro de celdas de tabla */
.mini-bar {
  display: inline-block; vertical-align: middle; width: 56px; height: 7px; margin-right: 7px;
  background: var(--panel-3); border-radius: 4px; overflow: hidden; border: 1px solid var(--line);
}
.mini-bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand-2), var(--accent)); border-radius: 4px; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  header.topbar { flex-wrap: wrap; height: auto; gap: 10px; padding: 10px 14px; }
  .brand { order: 1; }
  .user-chip { order: 2; margin-left: auto; }
  .badge-src { order: 3; }
  nav.tabs { order: 4; width: 100%; margin-left: 0; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  nav.tabs button { flex: 1; white-space: nowrap; padding: 8px 12px; }
  .spacer { display: none; }
  .row2 { grid-template-columns: 1fr; }
  main { padding: 14px; }
  .brand-sub, .brand-sep { display: none; }
  .filters .field { flex: 1 1 140px; }
  .filters select, .filters input { width: 100%; }
  .drawer { width: 100vw; max-width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; top: 0; left: 0; transform: none; }
  @keyframes popIn { from { opacity: .4; } to { opacity: 1; } }
  .bar-row { grid-template-columns: 96px 1fr 56px; }
}
@media (max-width: 560px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .view-head { align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ===========================================================================
   MODO CONTINGENCIA (Plan B fallback OfiHotel)
   =========================================================================== */
#bannerEmergencia {
  position: sticky; top: 0; z-index: 60;
  background: #b91c1c; color: #fff;
  padding: 9px 18px; font-size: 13.5px; letter-spacing: .2px;
  border-bottom: 3px solid #7f1d1d;
}
#bannerEmergencia strong { font-weight: 800; }
#bannerEmergencia .banner-aviso { color: #fde68a; }

.tabs .tab-emergencia { color: #b91c1c; font-weight: 700; }
.tabs .tab-emergencia.active { background: #b91c1c; color: #fff; }

.btn-mini { padding: 4px 10px; font-size: 12px; }
.btn-danger { background: #b91c1c; border-color: #991b1b; color: #fff; }
.btn-danger:hover { background: #991b1b; }

tr.cargo-anulado td { text-decoration: line-through; color: var(--muted, #94a3b8); }
tr.cargo-anulado td:last-child { text-decoration: none; }

.cont-form {
  display: grid; grid-template-columns: 2fr 1.4fr .7fr .9fr auto;
  gap: 8px; align-items: center; margin: 10px 0 4px;
}
.cont-form input, .cont-form select { width: 100%; }
.cont-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.code-block {
  background: #0f172a; color: #e2e8f0; border-radius: 8px;
  padding: 12px 14px; font-size: 12.5px; overflow-x: auto;
}
@media (max-width: 760px) { .cont-form { grid-template-columns: 1fr 1fr; } }

/* Operador de contingencia = usuario logueado (no editable, trazabilidad) */
.op-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel-2); font-weight: 600; font-size: 13px; color: var(--txt);
}
.op-dot { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,.18); }
