/* Diseño: contenido centrado con ancho máximo, recuadros blancos con bordes suaves,
   grillas de columnas parejas y tipografía del sistema. */
:root {
  --bg: #f3f5f8;
  --card: #ffffff;
  --text: #182131;
  --muted: #667085;
  --soft: #f7f9fc;
  --border: #e3e7ee;
  --border-strong: #cfd6e2;
  --primary: #1f6feb;
  --primary-dark: #1658c4;
  --primary-soft: #eaf2ff;
  --danger: #d1373a;
  --danger-soft: #fdecec;
  --ok: #17915a;
  --warn: #b57c00;
  --warn-soft: #fff6e0;
  --sidebar: #0f1b2d;
  --sidebar-text: #b9c5d8;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.04);
  --content: 1320px;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
.hidden { display: none !important; }
h1, h2, h3 { margin: 0 0 12px; font-weight: 650; letter-spacing: -0.01em; text-wrap: balance; }
h1 { font-size: 24px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1em; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
small { font-size: 12px; }

/* ---------- Estructura ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 232px; background: var(--sidebar); color: var(--sidebar-text); display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; flex-shrink: 0; }
.brand { font-weight: 700; font-size: 17px; color: #fff; padding: 20px 20px 16px; letter-spacing: -0.01em; }
.sidebar nav { display: flex; flex-direction: column; padding: 4px 12px; gap: 2px; overflow-y: auto; flex: 1; }
.sidebar nav a { color: var(--sidebar-text); text-decoration: none; padding: 9px 12px; border-radius: 8px; font-weight: 500; }
.sidebar nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.sidebar nav a.active { background: var(--primary); color: #fff; }
.user-box { padding: 14px 20px 18px; border-top: 1px solid rgba(255, 255, 255, 0.08); display: flex; flex-direction: column; gap: 6px; }
.user-name { color: #fff; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-actions { display: flex; gap: 14px; flex-wrap: wrap; }
.user-box .btn.link { color: #9fb3d1; font-size: 13px; }
.user-box .btn.link:hover { color: #fff; }
.lang-switch { display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); }
.lang-switch .btn.link.active { font-weight: 700; text-decoration: none; cursor: default; }
.login-card .lang-switch { justify-content: center; }
.user-box .lang-switch { color: #9fb3d1; }
.user-box .lang-switch .btn.link.active { color: #fff; }

/* El contenido queda centrado y no se estira más allá de un ancho cómodo. */
.view { flex: 1; min-width: 0; width: 100%; max-width: var(--content); margin: 0 auto; padding: 28px 32px 48px; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 12px 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h1 { margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---------- Recuadros y grillas ---------- */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); min-width: 0; }
.card > h2:first-child { display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stack > * + * { margin-top: 16px; }
.notice { border-radius: var(--radius); padding: 12px 16px; margin-bottom: 16px; border: 1px solid var(--border); background: var(--card); }
.notice.warn { background: var(--warn-soft); border-color: #f3dd9b; }

/* Panel: indicadores en filas parejas de 4 */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.kpi { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi .l { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.kpi .v { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .v small { font-size: 16px; color: var(--muted); font-weight: 600; }
.kpi .s { color: var(--muted); font-size: 12px; }
.meter { height: 6px; background: #edf1f7; border-radius: 99px; overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: var(--primary); border-radius: 99px; }
.dash { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.dash .wide { grid-column: 1 / -1; }
.card.alert { border-color: #f2c2c3; }
.card.alert h2 { color: var(--danger); }
.count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 99px; background: #edf1f7; color: var(--muted); font-size: 12px; font-weight: 700; }
.card.alert .count { background: var(--danger-soft); color: var(--danger); }
.empty { color: var(--muted); margin: 0; padding: 14px 0 4px; }
.daylist { display: flex; flex-direction: column; }
.dayrow { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto auto; gap: 14px; align-items: center; padding: 10px 8px; border-top: 1px solid var(--border); border-radius: 8px; }
.daylist .dayrow:first-child { border-top: none; }
.dayrow.click { cursor: pointer; }
.dayrow.click:hover { background: var(--soft); }
.dayrow small { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dayrow .when b { font-size: 16px; font-variant-numeric: tabular-nums; }
.dayrow .who { min-width: 0; }
.dayrow .who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dayrow .what { text-align: right; }
.dayrow.docs { grid-template-columns: 120px repeat(2, minmax(0, 1fr)); }
.plate { display: inline-block; font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 700; font-size: 12.5px; letter-spacing: 0.04em; padding: 2px 8px; border: 1.5px solid var(--text); border-radius: 5px; background: #fff; }

/* Detalle de la reserva: dos columnas que se apilan sin huecos */
.detail { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.detail .col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
dl.info { display: grid; grid-template-columns: 128px minmax(0, 1fr); gap: 8px 16px; margin: 0; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; overflow-wrap: anywhere; }
.timeline { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--border); display: flex; flex-direction: column; gap: 12px; }
.timeline li { position: relative; }
.timeline li::before { content: ''; position: absolute; left: -20px; top: 5px; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--primary); }
.timeline .t-head { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.timeline .t-head small { color: var(--muted); }
.timeline .t-detail { color: var(--muted); font-size: 12.5px; margin-top: 2px; overflow-wrap: anywhere; }

/* ---------- Formularios ---------- */
label { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
input, select, textarea { font: inherit; font-weight: 400; color: var(--text); padding: 8px 11px; min-height: 38px; border: 1px solid var(--border-strong); border-radius: 8px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 3px solid #cfe0ff; outline-offset: 0; border-color: var(--primary); }
textarea { min-height: 84px; resize: vertical; }
textarea.code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; min-height: 220px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); font-size: 14px; font-weight: 400; }
.check input { width: auto; min-height: 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-bottom: 14px; padding: 14px 16px; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.toolbar label { flex: 1 1 150px; }
.toolbar input, .toolbar select { width: 100%; min-width: 0; }
.toolbar > .btn, .toolbar > input { flex: 0 0 auto; width: auto; }
.toolbar > input#crud-q { flex: 1 1 260px; }

.btn { font: inherit; font-weight: 600; border: 1px solid var(--border-strong); background: #fff; color: var(--text); padding: 0 14px; min-height: 36px; border-radius: 8px; cursor: pointer; white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background 0.12s, border-color 0.12s; }
.btn:hover { border-color: #b9c3d3; background: var(--soft); }
.btn:focus-visible { outline: 3px solid #cfe0ff; outline-offset: 1px; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn.primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); }
.btn.danger { color: var(--danger); border-color: #f0c4c5; }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn.ok:hover { filter: brightness(0.95); }
.btn.small { padding: 0 10px; min-height: 28px; font-size: 12.5px; }
.btn.link { border: none; background: none; padding: 0; min-height: 0; color: var(--primary); font-weight: 500; }
.btn.link:hover { background: none; text-decoration: underline; }
.btn:disabled { opacity: 0.5; cursor: default; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card .table-wrap { box-shadow: none; }
.table-wrap > .card { border: none; box-shadow: none; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
th { font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; background: var(--soft); white-space: nowrap; }
td { font-variant-numeric: tabular-nums; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--soft); }
.card table th, .card table td { padding: 9px 10px; }
table.mini th, table.mini td { padding: 8px 8px; }
table.mini th { background: transparent; }

/* ---------- Etiquetas de estado ---------- */
.badge { display: inline-flex; align-items: center; padding: 2px 10px; border-radius: 99px; font-size: 12px; font-weight: 650; background: #eef1f6; color: #4a5468; white-space: nowrap; vertical-align: middle; }
.b-pendiente { background: #fff1cc; color: #8a5a00; }
.b-confirmada { background: #dceaff; color: #1450b5; }
.b-en_curso { background: #d9f4e6; color: #0f6e43; }
.b-finalizada { background: #eceff3; color: #555f72; }
.b-cancelada, .b-no_show, .b-error { background: #fde2e2; color: #a12427; }
.b-disponible, .b-procesada { background: #d9f4e6; color: #0f6e43; }
.b-alquilado { background: #dceaff; color: #1450b5; }
.b-mantenimiento, .b-duplicada { background: #fff1cc; color: #8a5a00; }
.b-fuera_servicio { background: #fde2e2; color: #a12427; }
.b-cotizador { background: #efe4ff; color: #6131b5; }
h1 .badge { font-size: 12.5px; }

/* ---------- Nueva reserva: categorías ---------- */
.cat-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.cat-card { border: 1.5px solid var(--border); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; background: #fff; display: flex; flex-direction: column; gap: 4px; transition: border-color 0.12s, box-shadow 0.12s; }
.cat-card:hover { border-color: #9cbcf5; }
.cat-card.selected { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px #d6e5ff; }
.cat-card.none { opacity: 0.55; }
.cat-name { font-weight: 600; display: flex; gap: 8px; align-items: flex-start; }
.cat-code { flex: 0 0 auto; display: inline-flex; align-items: center; justify-content: center; min-width: 24px; height: 22px; padding: 0 6px; border-radius: 6px; background: var(--primary-soft); color: var(--primary-dark); font-size: 12px; font-weight: 700; }
.cat-card .price { font-size: 20px; font-weight: 700; margin-top: auto; padding-top: 6px; font-variant-numeric: tabular-nums; }
.breakdown { width: 100%; }
.breakdown td { padding: 6px 0; border: none; }
.breakdown td.right { white-space: nowrap; padding-left: 12px; }
.breakdown tr.total td { font-weight: 700; font-size: 17px; border-top: 1px solid var(--border); padding-top: 10px; }

/* ---------- Fotos ---------- */
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 10px; }
.thumb { aspect-ratio: 1; max-width: 100%; padding: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--soft); cursor: pointer; display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb:hover { border-color: var(--primary); }

/* ---------- Planning ---------- */
.planning { overflow-x: auto; background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.pl-row { display: grid; grid-template-columns: 190px 1fr; border-bottom: 1px solid var(--border); min-width: 900px; }
.pl-row:last-child { border-bottom: none; }
.pl-row.head { position: sticky; top: 0; background: var(--soft); z-index: 2; }
.pl-row.group { background: #eef2f8; font-weight: 650; font-size: 12px; }
.pl-label { padding: 8px 12px; border-right: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-label small { color: var(--muted); }
.pl-track { position: relative; height: 36px; background-image: linear-gradient(to right, var(--border) 1px, transparent 1px); }
.pl-days { display: grid; }
.pl-days div { font-size: 11px; text-align: center; padding: 7px 0; border-left: 1px solid var(--border); color: var(--muted); }
.pl-days div.today { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.pl-days div.weekend { background: #f1f4f8; }
.pl-bar { position: absolute; top: 6px; height: 24px; border-radius: 6px; font-size: 11px; font-weight: 600; color: #fff; padding: 4px 7px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; cursor: pointer; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.15); }
.pl-bar.pendiente { background: #d99a00; }
.pl-bar.confirmada { background: #1f6feb; }
.pl-bar.en_curso { background: #17915a; }
.pl-bar.finalizada { background: #8b94a6; }
/* Arrastrar para crear: el gesto horizontal es nuestro, el vertical sigue desplazando la página */
.pl-track.pl-drag { cursor: crosshair; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.pl-sel { position: absolute; top: 5px; height: 26px; border-radius: 6px; background: rgba(31, 111, 235, 0.18); border: 2px dashed var(--primary); color: var(--primary-dark); font-size: 11px; font-weight: 600; padding: 4px 6px; white-space: nowrap; overflow: visible; pointer-events: none; z-index: 1; }
.pl-sel.bad { background: rgba(209, 55, 58, 0.15); border-color: var(--danger); color: var(--danger); }
.pl-bar.mant { background: repeating-linear-gradient(45deg, #d1373a, #d1373a 6px, #e25b5d 6px, #e25b5d 12px); cursor: default; }
.legend { display: flex; gap: 8px 16px; font-size: 12px; color: var(--muted); align-items: center; flex-wrap: wrap; }
.legend span::before { content: ''; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; background: var(--c); }

/* Aviso de programa desactualizado */
.stale-bar { position: fixed; top: 12px; left: 248px; right: 16px; z-index: 45; background: #fff; border: 2px solid var(--danger); border-radius: var(--radius); padding: 12px 16px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15); }

/* ---------- Ventanas, avisos e ingreso ---------- */
.modal { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.5); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 40px; overflow-y: auto; z-index: 50; }
.modal-box { width: 100%; max-width: 720px; box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25); padding: 22px 24px 24px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-head .btn.link { color: var(--muted); font-size: 18px; }
.toast { position: fixed; bottom: 20px; right: 20px; background: #182131; color: #fff; padding: 12px 16px; border-radius: 10px; z-index: 60; max-width: 420px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25); }
.toast.err { background: var(--danger); }
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(1200px 600px at 50% -10%, #e4edfb, var(--bg)); }
.login-card { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; padding: 28px; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.08); }
.login-card h1 { margin: 0; }
.copy { display: flex; gap: 6px; }
.copy input { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
pre { background: #0f172a; color: #dbe4f3; padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 12px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; flex-wrap: wrap; }
.tabs button { border: none; background: none; padding: 10px 14px; font: inherit; font-weight: 500; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 650; }

/* ---------- Pantallas medianas ---------- */
@media (max-width: 1100px) {
  .view { padding: 24px 20px 40px; }
  .detail { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash, .grid.cols-2, .grid.cols-3 { grid-template-columns: minmax(0, 1fr); }
}

/* ---------- Celular: menú en una fila deslizable arriba ---------- */
@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: sticky; top: 0; z-index: 30; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .brand { padding: 12px 16px; font-size: 16px; flex: 1 1 auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .user-box { border-top: none; padding: 8px 16px; flex-direction: row; align-items: center; gap: 12px; }
  .user-name { display: none; }
  .sidebar nav { order: 3; flex: 0 0 100%; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; padding: 0 12px 10px; gap: 4px; scrollbar-width: none; }
  .sidebar nav::-webkit-scrollbar { display: none; }
  .sidebar nav a { white-space: nowrap; padding: 7px 12px; background: rgba(255, 255, 255, 0.06); }
  .view { padding: 16px 16px 40px; }
  h1 { font-size: 21px; }
  .card { padding: 16px; }
  .kpi { padding: 14px; }
  .kpi .v { font-size: 22px; white-space: normal; overflow-wrap: anywhere; }
  dl.info { grid-template-columns: 104px minmax(0, 1fr); }
  .dayrow { grid-template-columns: 52px minmax(0, 1fr) auto auto; gap: 10px; }
  .stale-bar { left: 16px; }
  .page-head .actions { width: 100%; }
}

/* Contrato imprimible */
@media print {
  .sidebar, .no-print, .toast, .modal { display: none !important; }
  .view { padding: 0; max-width: none; }
  .card { border: none; box-shadow: none; }
  body { background: #fff; }
}
.thumbs > .muted { grid-column: 1 / -1; }
.table-scroll { overflow-x: auto; max-width: 100%; }
@media (max-width: 800px) { table.mini th, table.mini td { padding: 7px 6px; font-size: 13px; } }
/* Barra de búsqueda dentro de un recuadro: sin doble borde */
.card .toolbar { padding: 0; border: none; box-shadow: none; background: none; }

/* Importar datos */
.import-intro p:first-child { margin-top: 0; }
.import-intro details { margin: 8px 0 12px; }
.import-intro summary, .card details summary { cursor: pointer; color: var(--primary); font-weight: 600; }
.import-intro ul { margin: 8px 0 0; padding-left: 20px; line-height: 1.55; }
.import-kinds { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
.imp-counts { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 6px 0 14px; }
.imp-count { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; gap: 2px; background: var(--soft); }
.imp-count b { font-size: 22px; }
.imp-count span { font-size: 12.5px; color: var(--muted); }
.imp-count.ok b { color: #0f6e43; }
.imp-count.info b { color: #1450b5; }
.imp-count.warn b { color: #8a5a00; }
.imp-count.bad b { color: #a12427; }

/* Simplificación: opciones plegadas y menú "Más acciones" */
details.more-opts { margin-top: 14px; }
details.more-opts > summary, details.menu > summary { cursor: pointer; list-style: none; }
details.more-opts > summary { color: var(--primary); font-weight: 600; font-size: 14px; }
details.more-opts > summary::before { content: '▸ '; }
details.more-opts[open] > summary::before { content: '▾ '; }
details.more-opts > summary::-webkit-details-marker, details.menu > summary::-webkit-details-marker { display: none; }
details.menu { position: relative; display: inline-block; }
details.menu > summary::after { content: ' ▾'; font-size: 11px; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 40; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 10px 30px rgba(15, 23, 42, 0.14); padding: 6px; min-width: 230px; display: flex; flex-direction: column; }
.menu-list button { font: inherit; text-align: left; background: none; border: 0; border-radius: 6px; padding: 9px 12px; cursor: pointer; color: var(--text); }
.menu-list button:hover { background: var(--soft); }
.menu-list button.danger { color: var(--danger); }
.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 auto 18px; max-width: 1320px; border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.subnav a { text-decoration: none; color: var(--muted); font-weight: 600; font-size: 14px; padding: 7px 12px; border-radius: 8px; }
.subnav a:hover { background: var(--soft); color: var(--text); }
.subnav a.active { background: var(--primary-soft, #e8f0ff); color: var(--primary); }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: #7c8aa5; padding: 14px 12px 4px; font-weight: 700; }
.calm { display: flex; align-items: center; gap: 10px; color: var(--muted); }
@media (max-width: 800px) { .nav-label { display: none; } .subnav { overflow-x: auto; flex-wrap: nowrap; } .subnav a { white-space: nowrap; } }
@media print { .subnav { display: none; } }
details.filters { flex: 0 0 100%; margin-top: 4px; }
details.filters .toolbar { margin-top: 10px; border: 0; padding: 0; box-shadow: none; background: none; }

/* Primeros pasos (empresa nueva) */
.card.setup { margin-bottom: 16px; border-color: #c9dcff; }
.steps { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.steps li { font-size: 14px; }
.steps li.done { color: var(--muted); text-decoration: line-through; }
.steps a { font-weight: 600; }

/* Asistente web */
pre.snippet { color: var(--text); background: var(--soft); border: 1px solid var(--border); border-radius: 8px; padding: 12px; overflow-x: auto; font-size: 13px; white-space: pre-wrap; word-break: break-all; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand h1 { margin: 0; line-height: 1.1; }
.login-brand p { margin: 2px 0 0; font-size: 13px; }

/* ---------- Floty simple: menú de 4 secciones, botón Nueva reserva, Hoy, reserva rápida y Más ---------- */
.sidebar nav a { display: flex; align-items: center; gap: 10px; }
.sidebar nav svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.fab { position: fixed; right: 24px; bottom: 24px; z-index: 40; min-height: 56px; padding: 0 22px; border-radius: 999px; background: var(--text); color: #fff; display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 16px; text-decoration: none; box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25); }
.fab svg { flex-shrink: 0; width: 20px; height: 20px; fill: none; stroke: #fff; stroke-width: 2.6; stroke-linecap: round; }
.fab:hover { background: #2b3850; }
@media (max-width: 800px) {
  .sidebar nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); padding: 0 0 env(safe-area-inset-bottom); gap: 0; background: #fff; border-top: 1px solid var(--border); overflow: visible; }
  .sidebar nav a { flex-direction: column; justify-content: center; gap: 3px; min-height: 64px; padding: 6px 2px; background: none; color: var(--muted); font-size: 12.5px; border-radius: 0; }
  .sidebar nav a:hover { background: none; color: var(--text); }
  .sidebar nav a.active { background: none; color: var(--primary); font-weight: 700; }
  .sidebar nav svg { width: 24px; height: 24px; }
  .view { padding-bottom: 160px; }
  .fab { right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); }
  .toast { bottom: calc(148px + env(safe-area-inset-bottom)); }
}

.hoy-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.hoy-head .date { color: var(--muted); font-size: 14px; }
.hoy-head h1 { margin: 0; font-size: 26px; }
.hoy-counts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 18px; }
.hoy-counts a { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; }
.hoy-counts b { font-size: 26px; line-height: 1.2; }
.hoy-counts span { font-size: 13px; color: var(--muted); }
.hoy-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
@media (max-width: 900px) { .hoy-cols { grid-template-columns: minmax(0, 1fr); } }
.hoy-col h2 { display: flex; align-items: center; gap: 8px; font-size: 17px; }
.hoy-col h2 svg { width: 20px; height: 20px; fill: none; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.trip { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 12px; margin-bottom: 10px; }
.trip-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; cursor: pointer; }
.trip-top b { font-size: 17px; }
.trip-top small { display: block; color: var(--muted); font-size: 14px; }
.pill { font-size: 13px; font-weight: 700; border-radius: 999px; padding: 4px 10px; white-space: nowrap; }
.pill.debe { background: #fef3c7; color: #92400e; }
.pill.ok { background: #dcfce7; color: #166534; }
.trip-actions { display: flex; gap: 8px; }
.trip-actions .btn { flex: 1; min-height: 46px; font-size: 16px; font-weight: 700; border-radius: 12px; }
.trip-actions .btn.back { color: #9a3412; border: 1.5px solid #c2410c; }
.trip-actions .btn.wa { flex: 0 0 52px; padding: 0; color: #15803d; }
.trip-actions .btn.wa svg { flex-shrink: 0; width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.hoy-empty { color: var(--muted); background: var(--card); border: 1px dashed var(--border-strong); border-radius: 16px; padding: 18px; margin: 0 0 10px; }
.hoy-next { color: var(--muted); margin: 6px 0 18px; font-size: 14px; }

.qr { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.qr h2 { font-size: 15px; margin: 0 0 8px; }
.qr-dates { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.qr-field { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 8px 12px; display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--muted); }
.qr-field input, .qr-field select { border: none; padding: 0; font: inherit; font-size: 16px; font-weight: 600; color: var(--text); background: transparent; min-height: 28px; width: 100%; }
.qr-field:focus-within { border-color: var(--primary); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.chip { min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--border-strong); background: #fff; font: inherit; font-size: 14px; cursor: pointer; color: var(--text); }
.chip.on { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-dark); font-weight: 700; }
.cars { display: flex; flex-direction: column; gap: 8px; }
.car { min-height: 60px; border-radius: 14px; border: 1.5px solid var(--border); background: #fff; padding: 8px 14px; display: flex; align-items: center; justify-content: space-between; gap: 10px; font: inherit; text-align: left; cursor: pointer; color: var(--text); }
.car.on { border: 2px solid var(--primary); background: var(--primary-soft); }
.car b { font-size: 16px; }
.car small { display: block; color: var(--muted); font-size: 13px; }
.car .price { font-weight: 700; font-size: 16px; white-space: nowrap; }
.car .price small { display: inline; }
.qr-total { position: sticky; bottom: 0; background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 10px; box-shadow: 0 -4px 16px rgba(15, 23, 42, 0.06); }
.qr-total .sum { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.qr-total .sum b { font-size: 26px; }
.btn.big { min-height: 54px; font-size: 17px; font-weight: 700; border-radius: 14px; }
.btn.big svg { flex-shrink: 0; width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 800px) { .qr-total { bottom: calc(72px + env(safe-area-inset-bottom)); } }

.mas-group { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.mas { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.mas a { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; text-decoration: none; color: var(--text); display: flex; flex-direction: column; gap: 2px; min-height: 64px; }
.mas a:hover { border-color: var(--border-strong); }
.mas a b { font-size: 15px; }
.mas a span { color: var(--muted); font-size: 13px; }

/* Páginas públicas: link de reservas (/reservar) y hoja "Cómo funciona" (/como-funciona). */
.pub { max-width: 640px; margin: 0 auto; padding: 20px 16px 32px; display: flex; flex-direction: column; gap: 18px; }
.pub .lang-switch { justify-content: center; }
.pub-head h1 { margin: 0 0 4px; font-size: 26px; }
.pub-head p { margin: 0; color: var(--muted); font-size: 15px; }
.pub .qr { width: 100%; }
.pub .qr-total { bottom: 8px; }
.pub .qr-total small { text-align: center; }
.pub .car .price small { display: block; text-align: right; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.pub-faq details { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 12px 14px; margin-bottom: 8px; }
.pub-faq summary { cursor: pointer; font-weight: 600; font-size: 15px; }
.pub-faq p { margin: 8px 0 0; color: var(--muted); }
.pub-done { display: flex; flex-direction: column; gap: 10px; text-align: center; padding: 28px 20px; }
.pub-done h1 { margin: 0; font-size: 22px; }
.pub-done p { margin: 0; }
.pub-ok { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; background: #dcfce7; color: #166534; font-size: 30px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.sheet { max-width: 720px; width: 100%; margin: 0 auto; padding: 28px; }
.sheet h2 { margin: 22px 0 8px; font-size: 18px; }
.sheet p, .sheet li { font-size: 15px; }
.sheet ul { padding-left: 20px; margin: 0; }
.sheet-list { padding-left: 22px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.sheet-list b { display: block; }
.sheet-list span { color: var(--muted); }
.sheet .actions { margin-top: 22px; }
@media print { .pub { max-width: none; padding: 0; } .pub .lang-switch { display: none; } .sheet { padding: 0; } }

/* Guía de la primera vez. */
.tour { position: fixed; inset: auto 0 0 0; z-index: 90; display: flex; justify-content: center; padding: 16px; pointer-events: none; }
.tour-card { pointer-events: auto; width: 100%; max-width: 420px; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.22); }
.tour-card p { margin: 0 0 14px; font-size: 15px; }
.tour-dots { display: flex; gap: 6px; margin-bottom: 10px; }
.tour-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); }
.tour-dots i.on { background: var(--primary); }
.tour-hi { outline: 3px solid #f59e0b !important; outline-offset: 3px; border-radius: 12px; position: relative; z-index: 89; }
@media (max-width: 800px) { .tour { bottom: calc(72px + env(safe-area-inset-bottom)); } }
@media (min-width: 801px) { .tour { inset: auto 24px 24px auto; justify-content: flex-end; } }

/* Pedidos para confirmar: en la compu, de a varios por fila para que "Salen hoy" quede a la vista. */
.hoy-pending { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 10px; margin-bottom: 18px; }
.hoy-pending .trip { margin-bottom: 0; }
@media (max-width: 800px) { .hoy-pending { grid-template-columns: minmax(0, 1fr); } }
