/* Diseño 1 — Formal / Empresarial. Tema claro sobre Bootstrap 5.3. */
:root {
  --ink: #15212d;
  --ink-2: #3d4b58;
  --muted: #6a7682;
  --line: #dde2e7;
  --line-2: #edf0f3;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --head: #f7f8fa;
  --navy: #0f2540;
  --navy-2: #173258;
  --navy-line: #213d66;
  --accent: #0f6b5c;
  --accent-h: #0b564a;
  --accent-soft: #e3f0ed;
  --neg: #a23b2c;
  --neg-soft: #f7e8e5;
  --warn: #8a5f0d;
  --warn-soft: #f6eeda;
  --info: #2b5a8e;
  --info-soft: #e5edf6;
  --sans: "IBM Plex Sans", system-ui, "Segoe UI", Arial, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, "Courier New", monospace;
  --side-w: 240px;
  --top-h: 52px;

  --bs-body-font-family: var(--sans);
  --bs-body-font-size: 0.875rem;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--bg);
  --bs-border-color: var(--line);
  --bs-border-radius: 4px;
  --bs-border-radius-sm: 3px;
  --bs-border-radius-lg: 6px;
  --bs-primary: #0f6b5c;
  --bs-primary-rgb: 15, 107, 92;
  --bs-link-color: #0f6b5c;
  --bs-link-color-rgb: 15, 107, 92;
  --bs-link-hover-color-rgb: 11, 86, 74;
  --bs-secondary-color: var(--muted);
}

body { font-family: var(--sans); background: var(--bg); color: var(--ink); -webkit-font-smoothing: antialiased; position: relative; min-height: 100vh; }
a { text-decoration: none; }
a:hover { text-decoration: underline; }
.mono, .num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.neg { color: var(--neg) !important; }
.pos { color: var(--accent) !important; }
.warn { color: var(--warn) !important; }
.lbl { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

/* ---------- Shell ---------- */
.sidebar {
  background: var(--navy) !important; color: #c3cfde; width: var(--side-w);
}
.side-in { display: flex; flex-direction: column; height: 100%; width: 100%; }
@media (min-width: 992px) {
  /* La barra ocupa todo el alto del documento; su contenido se queda fijo al hacer scroll. */
  .sidebar { position: absolute; top: 0; bottom: 0; left: 0; z-index: 1030; }
  .side-in { position: sticky; top: 0; height: 100vh; }
  .topbar { left: var(--side-w) !important; }
  .content { margin-left: var(--side-w); }
}
.sidebar.offcanvas-lg { --bs-offcanvas-width: var(--side-w); --bs-offcanvas-bg: var(--navy); --bs-offcanvas-color: #c3cfde; border: 0; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--navy-line); height: var(--top-h); }
.side-mark { width: 26px; height: 26px; border: 1.5px solid #fff; border-radius: 3px; position: relative; flex: none; }
.side-mark::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 1.5px solid #fff; }
.side-mark::after { content: ""; position: absolute; top: 50%; left: 4px; right: 4px; border-top: 1.5px solid #fff; }
.side-brand b { color: #fff; font-size: 0.95rem; font-weight: 600; line-height: 1.1; display: block; }
.side-brand small { font-size: 0.6563rem; color: #8ea1b8; display: block; line-height: 1.3; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-brand > div { min-width: 0; }
.side-nav { padding: 10px 0; flex: 1; overflow-y: auto; }
.side-sec { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 6px; font-size: 0.6563rem; font-weight: 600; letter-spacing: 0.09em; text-transform: uppercase; color: #7f93ab; }
.side-cap { padding: 0 16px 6px; font-size: 0.6719rem; color: #9fb0c6; display: flex; align-items: center; gap: 5px; margin-top: -2px; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 8px 16px; color: #c3cfde; font-size: 0.8438rem; border-left: 3px solid transparent; }
.side-link:hover { background: var(--navy-2); color: #fff; text-decoration: none; }
.side-link.active { background: var(--navy-2); color: #fff; border-left-color: #5cc2ae; font-weight: 500; }
.side-link i { font-size: 0.95rem; width: 16px; text-align: center; opacity: 0.85; }
.side-link .cnt { margin-left: auto; font-family: var(--mono); font-size: 0.6875rem; background: #c9941f; color: #1c1403; border-radius: 3px; padding: 0 6px; line-height: 1.5; font-weight: 600; }
.side-foot { border-top: 1px solid var(--navy-line); padding: 8px 0; }
.side-foot .side-link { font-size: 0.8125rem; }
.side-foot .tagx { margin-left: auto; font-size: 0.75rem; color: #8ea1b8; }

.topbar {
  position: fixed; top: 0; left: 0; right: 0; height: var(--top-h); z-index: 1020;
  background: #fff; border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; padding: 0 20px;
}
.topbar .crumbs { font-size: 0.8125rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.topbar .crumbs a { color: var(--muted); }
.topbar .crumbs b { color: var(--ink); font-weight: 600; }
.topbar .crumbs .sep { margin: 0 6px; color: #b3bcc5; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 16px; flex: none; }
.top-date { font-family: var(--mono); font-size: 0.75rem; color: var(--ink-2); }
.shift { display: flex; align-items: center; gap: 7px; font-size: 0.75rem; border: 1px solid var(--line); border-radius: 4px; padding: 4px 9px; background: var(--head); color: var(--ink-2); white-space: nowrap; }
.shift .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.shift b { font-weight: 600; color: var(--ink); }
.user { display: flex; align-items: center; gap: 8px; border-left: 1px solid var(--line); padding-left: 16px; }
.user .av { width: 28px; height: 28px; border-radius: 4px; background: var(--navy); color: #fff; font-size: 0.6875rem; font-weight: 600; display: grid; place-items: center; }
.user b { display: block; font-size: 0.8125rem; font-weight: 600; line-height: 1.15; }
.user small { display: block; font-size: 0.6875rem; color: var(--muted); line-height: 1.15; }
.menu-btn { border: 1px solid var(--line); background: #fff; border-radius: 4px; width: 34px; height: 32px; display: grid; place-items: center; color: var(--ink); flex: none; }

.content { padding: calc(var(--top-h) + 20px) 28px 40px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head h1 { font-size: 1.25rem; font-weight: 600; margin: 0; letter-spacing: -0.005em; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.page-head p { margin: 3px 0 0; font-size: 0.8125rem; color: var(--muted); }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Componentes ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.panel + .panel { margin-top: 16px; }
.panel-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; border-bottom: 1px solid var(--line); min-height: 44px; }
.panel-h h2 { font-size: 0.8438rem; font-weight: 600; margin: 0; }
.panel-h .sub { font-size: 0.75rem; color: var(--muted); }
.panel-b { padding: 14px; }
.panel-note { padding: 9px 14px; font-size: 0.7813rem; color: var(--ink-2); background: var(--head); border-bottom: 1px solid var(--line); display: flex; gap: 8px; align-items: flex-start; }
.panel-note i { color: var(--info); margin-top: 1px; }
.panel-foot { padding: 9px 14px; border-top: 1px solid var(--line); background: var(--head); font-size: 0.7813rem; color: var(--ink-2); border-radius: 0 0 6px 6px; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: 6px; margin-bottom: 16px; overflow: hidden; }
.kpi { padding: 12px 16px; border-right: 1px solid var(--line); margin-right: -1px; border-bottom: 1px solid var(--line); margin-bottom: -1px; }
.kpi .v { font-family: var(--mono); font-size: 1.3rem; font-weight: 500; letter-spacing: -0.02em; margin-top: 4px; line-height: 1.2; white-space: nowrap; }
.kpi .s { font-size: 0.7188rem; color: var(--muted); margin-top: 2px; }
.kpi.strong { background: var(--navy); border-color: var(--navy); }
.kpi.strong .lbl { color: #9fb0c6; }
.kpi.strong .v { color: #fff; }
.kpi.strong .s { color: #b6c4d6; }

.tbl { width: 100%; border-collapse: collapse; font-size: 0.8125rem; }
.tbl th { font-size: 0.6719rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); background: var(--head); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: left; }
.tbl td { padding: 7px 12px; border-bottom: 1px solid var(--line-2); height: 40px; vertical-align: middle; }
.tbl th.num, .tbl td.num { text-align: right; white-space: nowrap; }
.tbl td.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.tbl th.c, .tbl td.c { text-align: center; }
.tbl tbody tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover td { background: #fafbfc; }
.tbl tfoot td { font-weight: 600; border-top: 1.5px solid var(--ink); border-bottom: 0; background: #fff; }
.tbl .id { font-family: var(--mono); font-size: 0.75rem; color: var(--ink-2); white-space: nowrap; }
.tbl .strong { font-weight: 600; }
.tbl tr.grp td { background: #eef1f5; border-bottom: 1px solid var(--line); border-top: 1px solid var(--line); font-weight: 600; height: 38px; }
.tbl tr.grp:hover td { background: #eef1f5; }
.tbl tr.sub td { background: #fbfcfd; font-weight: 600; border-top: 1px solid var(--line); height: 36px; }
.tbl tr.calc td { height: 36px; }
.tbl tr.res td { font-weight: 600; background: var(--head); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.tbl tr.final td { font-weight: 700; background: var(--navy); color: #fff; border: 0; font-size: 0.875rem; }
.tbl tr.final:hover td { background: var(--navy); }
.tbl-wrap { overflow-x: auto; }
.tbl.tight th, .tbl.tight td { padding-left: 9px; padding-right: 9px; }
.tbl.tight th:first-child, .tbl.tight td:first-child { padding-left: 12px; }
.tbl .op { font-family: var(--mono); color: var(--muted); display: inline-block; width: 26px; }
.tbl td:has(> .op) { padding-left: 38px; text-indent: -26px; }
.tbl td:has(> .op) > * { text-indent: 0; }

.st { display: inline-flex; align-items: center; gap: 5px; font-size: 0.6875rem; font-weight: 600; padding: 2px 7px; border-radius: 3px; border: 1px solid transparent; white-space: nowrap; line-height: 1.45; }
.st::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.st.plain::before { display: none; }
.st-ok { color: var(--accent); background: var(--accent-soft); border-color: #c5e0da; }
.st-warn { color: var(--warn); background: var(--warn-soft); border-color: #e8d9ae; }
.st-neg { color: var(--neg); background: var(--neg-soft); border-color: #ecc9c2; }
.st-info { color: var(--info); background: var(--info-soft); border-color: #c8d8ea; }
.st-mute { color: var(--ink-2); background: #eef1f4; border-color: #dbe0e6; }
.st-navy { color: #fff; background: var(--navy); }

.bar { height: 4px; background: var(--line-2); border-radius: 2px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.bar.warn > i { background: #b98a22; }
.bar.navy > i { background: var(--navy-2); }
.bar.lg { height: 8px; }

.dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0; }
.dl > div { padding: 10px 14px; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); margin: 0 -1px -1px 0; }
.dl .v { font-size: 0.875rem; font-weight: 500; margin-top: 2px; }
.dl .v small { display: block; font-family: var(--sans); font-weight: 400; color: var(--muted); font-size: 0.75rem; margin-top: 1px; }
.dl .v small.inl { display: inline; }

.rows { margin: 0; }
.rows > div { display: flex; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line-2); font-size: 0.8125rem; }
.rows > div:last-child { border-bottom: 0; }
.rows .num { font-family: var(--mono); white-space: nowrap; }
.rows .tot { font-weight: 600; border-top: 1.5px solid var(--ink); border-bottom: 0; margin-top: -1px; }
.rows .big { font-size: 1.05rem; font-weight: 600; padding: 10px 0 4px; }

/* ---------- Bootstrap restilizado ---------- */
.btn { --bs-btn-font-size: 0.8125rem; --bs-btn-padding-y: 0.36rem; --bs-btn-padding-x: 0.8rem; --bs-btn-border-radius: 4px; --bs-btn-font-weight: 500; white-space: nowrap; }
.btn i { margin-right: 5px; }
.btn-sm { --bs-btn-padding-y: 0.16rem; --bs-btn-padding-x: 0.5rem; --bs-btn-font-size: 0.75rem; --bs-btn-border-radius: 3px; }
.btn-primary { --bs-btn-bg: var(--accent); --bs-btn-border-color: var(--accent); --bs-btn-hover-bg: var(--accent-h); --bs-btn-hover-border-color: var(--accent-h); --bs-btn-active-bg: var(--accent-h); --bs-btn-active-border-color: var(--accent-h); --bs-btn-disabled-bg: var(--accent); --bs-btn-disabled-border-color: var(--accent); }
.btn-outline-secondary { --bs-btn-color: var(--ink-2); --bs-btn-border-color: #c6cdd5; --bs-btn-bg: #fff; --bs-btn-hover-bg: #f0f2f5; --bs-btn-hover-color: var(--ink); --bs-btn-hover-border-color: #b3bcc6; --bs-btn-active-bg: var(--navy); --bs-btn-active-color: #fff; --bs-btn-active-border-color: var(--navy); --bs-btn-disabled-color: #9aa5b0; --bs-btn-disabled-border-color: #dde2e7; }
.btn-outline-danger { --bs-btn-color: var(--neg); --bs-btn-border-color: #dcb1a9; --bs-btn-bg: #fff; --bs-btn-hover-bg: var(--neg); --bs-btn-hover-border-color: var(--neg); --bs-btn-active-bg: var(--neg); --bs-btn-active-border-color: var(--neg); }
.form-label { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); margin-bottom: 4px; }
.modal { --bs-modal-bg: #fff; }
.form-control, .form-select { background-color: #fff; font-size: 0.8438rem; border-radius: 4px; border-color: #c6cdd5; padding: 0.4rem 0.6rem; color: var(--ink); }
.form-select { padding-right: 2rem; }
.form-control:focus, .form-select:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(15, 107, 92, 0.15); }
.form-control[readonly], .form-control:disabled, .form-select:disabled { background: var(--head); color: var(--ink-2); }
.form-control.num { text-align: right; font-family: var(--mono); }
.form-text { font-size: 0.7188rem; color: var(--muted); margin-top: 3px; }
.form-check-input { border-color: #aab4be; border-radius: 3px; }
.form-check-input[type="radio"] { border-radius: 50%; }
.form-check-input:checked { background-color: var(--accent); border-color: var(--accent); }
.form-check-input:focus { box-shadow: 0 0 0 2px rgba(15, 107, 92, 0.15); border-color: var(--accent); }
.form-check-label { font-size: 0.8125rem; }
.input-group-text { font-size: 0.8125rem; background: var(--head); border-color: #c6cdd5; color: var(--ink-2); border-radius: 4px; font-family: var(--mono); }
.modal-content { border-radius: 6px; border: 1px solid #b9c2cc; box-shadow: 0 14px 36px rgba(15, 37, 64, 0.2); }
.modal-header { padding: 11px 16px; background: var(--head); border-bottom: 1px solid var(--line); border-radius: 6px 6px 0 0; }
.modal-title { font-size: 0.9375rem; font-weight: 600; }
.modal-title small { display: block; font-size: 0.75rem; font-weight: 400; color: var(--muted); margin-top: 1px; }
.modal-body { padding: 16px; }
.modal-footer { padding: 10px 16px; background: var(--head); border-top: 1px solid var(--line); border-radius: 0 0 6px 6px; }
.modal-backdrop.show { opacity: 0.45; background: #0b1826; }
.fs-sec { font-size: 0.6875rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); border-bottom: 1px solid var(--line); padding-bottom: 5px; margin: 0 0 12px; }
.box { border: 1px solid var(--line); border-radius: 4px; background: var(--head); padding: 10px 12px; }
.pick { border: 1px solid var(--line); border-radius: 4px; overflow: hidden; }
.pick label { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-bottom: 1px solid var(--line-2); font-size: 0.8125rem; cursor: pointer; margin: 0; }
.pick label:last-child { border-bottom: 0; }
.pick label:has(input:checked) { background: var(--accent-soft); }
.pick label:has(input:disabled) { color: var(--muted); background: var(--head); cursor: default; }
.pick .grow { flex: 1; min-width: 0; }
.pick .num { font-family: var(--mono); font-size: 0.7813rem; white-space: nowrap; }
.pick small { color: var(--muted); font-size: 0.7188rem; }

/* Opciones de la reserva: pago por transferencia con comprobante y reserva periódica */
.xopt { border: 1px solid var(--line); border-radius: 4px; background: #fff; padding: 10px 12px; height: 100%; }
.xopt:has(.xopt-sw:checked) { border-color: #a9d2c9; }
.xopt .form-switch .form-check-input { border-radius: 2em; }
.xopt-b { border-top: 1px solid var(--line-2); margin-top: 10px; padding-top: 12px; }
.xopt:not(:has(.xopt-sw:checked)) .xopt-b { display: none; }
.file-chip { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 4px; background: var(--head); padding: 6px 8px; }
.file-chip > i { font-size: 1.25rem; color: var(--info); }
.file-chip .grow { flex: 1; min-width: 0; line-height: 1.25; }
.file-chip b { display: block; font-size: 0.7813rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-chip small { font-size: 0.6875rem; color: var(--muted); }
.file-drop { display: flex; align-items: center; gap: 8px; width: 100%; border: 1px dashed #aab4be; border-radius: 4px; background: #fff; padding: 9px 10px; font-size: 0.8125rem; color: var(--ink-2); }
.file-drop small { margin-left: auto; color: var(--muted); font-size: 0.6875rem; }
#r-file.has-file .file-drop, #r-file:not(.has-file) .file-chip { display: none; }
.date-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.date-chips span { font-family: var(--mono); font-size: 0.7188rem; border: 1px solid #c5e0da; background: var(--accent-soft); color: var(--accent-h); border-radius: 3px; padding: 2px 7px; white-space: nowrap; }
.proof { border: 1px solid var(--line); border-radius: 4px; background: var(--head); padding: 14px; }
.proof .comprobante-demo { max-width: 270px; margin: 0 auto; box-shadow: 0 4px 14px rgba(15, 37, 64, 0.12); }
.tbl tr.off td { color: var(--muted); }
.tbl tr.off td.strong { text-decoration: line-through; font-weight: 400; }
.ag-blk .t i { margin-left: 3px; }

/* ---------- Canchas ---------- */
.courts { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
@media (max-width: 1399px) { .courts { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 899px) { .courts { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 575px) { .courts { grid-template-columns: 1fr; } }
.court { background: #fff; border: 1px solid var(--line); border-radius: 6px; display: flex; flex-direction: column; border-top: 3px solid var(--navy); }
.court.free { border-top-color: #b9c2cc; }
.court-h { display: flex; align-items: center; justify-content: space-between; padding: 9px 12px; border-bottom: 1px solid var(--line-2); }
.court-h b { font-size: 0.875rem; font-weight: 600; }
.court-b { padding: 10px 12px; flex: 1; }
.court-b .who { font-weight: 600; font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.court-b .when { font-family: var(--mono); font-size: 0.75rem; color: var(--ink-2); margin-top: 1px; }
.court-b .left { display: flex; justify-content: space-between; font-size: 0.7188rem; color: var(--muted); margin: 10px 0 4px; }
.court-b .left b { color: var(--ink); font-weight: 600; }
.court-kv { margin-top: 10px; border-top: 1px solid var(--line-2); }
.court-kv div { display: flex; justify-content: space-between; font-size: 0.7813rem; padding: 4px 0; border-bottom: 1px solid var(--line-2); }
.court-kv span { color: var(--muted); }
.court-kv .num { font-family: var(--mono); }
.court-next { font-size: 0.7188rem; color: var(--muted); padding-top: 8px; }
.court-next b { color: var(--ink-2); font-weight: 600; }
.court-f { display: flex; gap: 6px; padding: 9px 12px; border-top: 1px solid var(--line-2); background: var(--head); border-radius: 0 0 6px 6px; }
.court-f .btn { flex: 1; padding-left: 4px; padding-right: 4px; }
.court-free { font-size: 0.8125rem; color: var(--ink-2); }
.court-free .big { font-family: var(--mono); font-size: 1.15rem; color: var(--ink); font-weight: 500; }

/* ---------- Agenda ---------- */
.ag { min-width: 720px; }
.ag-head, .ag-body { display: grid; grid-template-columns: 58px repeat(5, minmax(0, 1fr)); }
.ag-head { border-bottom: 1px solid var(--line); background: var(--head); }
.ag-head > div { padding: 8px 10px; border-left: 1px solid var(--line); }
.ag-head > div:first-child { border-left: 0; }
.ag-head b { font-size: 0.8125rem; font-weight: 600; }
.ag-head .top { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.ag-head small { font-family: var(--mono); font-size: 0.6875rem; color: var(--muted); white-space: nowrap; }
.ag-head .st { margin-top: 4px; }
.ag-body { position: relative; }
.ag-times { position: relative; }
.ag-times span { position: absolute; right: 8px; font-family: var(--mono); font-size: 0.6875rem; color: var(--muted); transform: translateY(-1px); background: transparent; }
.ag-col { position: relative; border-left: 1px solid var(--line); background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(var(--line-2) 1px, transparent 1px); background-size: 100% 46px, 100% 23px; }
.ag-free { position: absolute; inset: 0; display: block; cursor: cell; }
.ag-free:hover { background: rgba(15, 107, 92, 0.04); }
.ag-blk { position: absolute; left: 4px; right: 4px; padding: 3px 7px; font-size: 0.7188rem; line-height: 1.32; overflow: hidden; border: 1px solid #cfd6dd; border-left: 3px solid var(--navy-2); border-radius: 3px; background: #fff; color: var(--ink); z-index: 1; }
.ag-blk:hover { text-decoration: none; border-color: var(--ink-2); }
.ag-blk .t { font-family: var(--mono); font-size: 0.6719rem; color: var(--ink-2); display: flex; justify-content: space-between; gap: 4px; white-space: nowrap; }
.ag-blk .n { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-blk .x { font-size: 0.6563rem; color: var(--muted); }
.ag-blk.t-reta { border-left-color: #b98a22; }
.ag-blk.t-clase { border-left-color: #6b7f99; }
.ag-blk.s-fin { background: #f1f3f5; color: var(--muted); border-color: #e0e4e8; }
.ag-blk.s-fin.t-reserva { border-left-color: #8d99a6; }
.ag-blk.s-fin .t { color: var(--muted); }
.ag-blk.s-live { background: var(--accent-soft); border-color: #a9d2c9; }
.ag-blk.s-live.t-reserva { border-left-color: var(--accent); }
.ag-now { position: absolute; left: 0; right: 0; height: 0; border-top: 1.5px solid var(--neg); z-index: 0; pointer-events: none; }
.ag-now span { position: absolute; left: 4px; top: -9px; background: var(--neg); color: #fff; font-family: var(--mono); font-size: 0.6563rem; padding: 1px 5px; border-radius: 3px; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.7188rem; color: var(--ink-2); }
.legend i { display: inline-block; width: 14px; height: 10px; border: 1px solid #cfd6dd; border-left: 3px solid var(--navy-2); border-radius: 2px; margin-right: 5px; vertical-align: -1px; background: #fff; }
.daynav { display: flex; align-items: center; gap: 6px; }
.daynav .day { font-weight: 600; font-size: 0.875rem; margin: 0 6px; }

/* ---------- Dashboard ---------- */
.hbar { display: grid; grid-template-columns: 78px 1fr 62px; gap: 10px; align-items: center; font-size: 0.7813rem; padding: 5px 0; }
.hbar.wide { grid-template-columns: 100px 1fr 96px; }
.hbar .num { text-align: right; font-family: var(--mono); }
.occ { display: flex; align-items: baseline; gap: 10px; }
.occ .v { font-family: var(--mono); font-size: 1.9rem; font-weight: 500; letter-spacing: -0.03em; line-height: 1; }
.seg .btn { --bs-btn-padding-x: 0.75rem; }

/* ---------- Login ---------- */
body.login { background: #fff; }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(360px, 5fr) 7fr; }
.login-side { background: var(--navy); color: #c3cfde; padding: 48px 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login-side h1 { color: #fff; font-size: 1.75rem; font-weight: 600; letter-spacing: -0.01em; margin: 28px 0 10px; line-height: 1.2; }
.login-side p { font-size: 0.9375rem; max-width: 34ch; color: #a9b9cd; }
.login-side ul { list-style: none; padding: 0; margin: 28px 0 0; font-size: 0.8438rem; }
.login-side li { padding: 9px 0; border-top: 1px solid var(--navy-line); display: flex; gap: 10px; }
.login-side li i { color: #5cc2ae; }
.login-side footer { font-size: 0.7188rem; color: #7f93ab; }
.login-main { display: grid; place-items: center; padding: 32px; background: var(--bg); }
.login-card { width: 100%; max-width: 400px; }
.login-card h2 { font-size: 1.25rem; font-weight: 600; margin: 0 0 4px; }
.roles { margin-top: 18px; border: 1px solid var(--line); border-radius: 6px; background: #fff; font-size: 0.7813rem; }
.roles > div { padding: 9px 12px; border-bottom: 1px solid var(--line-2); display: flex; gap: 10px; }
.roles > div:last-child { border-bottom: 0; }
.roles b { display: block; font-weight: 600; }
.roles span { color: var(--muted); }
@media (max-width: 860px) { .login-wrap { grid-template-columns: 1fr; } .login-side { display: none; } }

/* ---------- Portal de reserva en línea ---------- */
body.portal { background: var(--bg); }
.portal-top { background: var(--navy); color: #fff; }
.portal-top .in { max-width: 1040px; margin: 0 auto; padding: 12px 20px; display: flex; align-items: center; gap: 12px; }
.portal-top b { font-weight: 600; font-size: 1rem; }
.portal-top .opt { margin-left: auto; font-size: 0.6875rem; color: #b6c4d6; border: 1px solid var(--navy-line); border-radius: 3px; padding: 2px 7px; white-space: nowrap; }
.portal-main { max-width: 1040px; margin: 0 auto; padding: 22px 20px 48px; }
.portal-main h1 { font-size: 1.35rem; font-weight: 600; margin: 0 0 3px; }
.step { display: flex; align-items: center; gap: 9px; font-size: 0.875rem; font-weight: 600; margin: 0; }
.step .n { width: 22px; height: 22px; border-radius: 3px; background: var(--navy); color: #fff; font-family: var(--mono); font-size: 0.75rem; display: grid; place-items: center; font-weight: 500; }
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.days button { border: 1px solid #c6cdd5; background: #fff; border-radius: 4px; padding: 7px 0; text-align: center; line-height: 1.2; color: var(--ink); }
.days button small { display: block; font-size: 0.6875rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.days button b { font-family: var(--mono); font-size: 1.05rem; font-weight: 500; }
.days button.on { background: var(--navy); border-color: var(--navy); color: #fff; }
.days button.on small { color: #b6c4d6; }
.slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 8px; }
.slots button { border: 1px solid #c6cdd5; background: #fff; border-radius: 4px; padding: 8px 10px; text-align: left; line-height: 1.25; color: var(--ink); }
.slots button b { font-family: var(--mono); font-size: 0.95rem; font-weight: 500; display: block; }
.slots button small { font-size: 0.6875rem; color: var(--accent); font-weight: 500; }
.slots button.low small { color: var(--warn); }
.slots button:disabled { background: var(--head); color: #a0aab4; border-color: var(--line); }
.slots button:disabled small { color: #a0aab4; }
.slots button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.slots button.on small { color: #d3ece6; }
.sticky-sum { position: sticky; top: 16px; }

/* ---------- Móvil ---------- */
@media (max-width: 991px) {
  .content { padding: calc(var(--top-h) + 14px) 14px 32px; }
  .topbar { padding: 0 12px; gap: 10px; }
  .top-date, .shift .hide-sm, .user .txt, .crumbs .pre { display: none; }
  .shift b { text-transform: capitalize; }
  .user { border-left: 0; padding-left: 0; }
  .top-right { gap: 10px; }
  .page-head h1 { font-size: 1.1rem; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .kpi { padding: 10px 12px; }
  .kpi .v { font-size: 1.08rem; }
  .tbl th, .tbl td { padding-left: 9px; padding-right: 9px; }
  .hide-sm { display: none !important; }
}
@media (max-width: 575px) {
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .portal-main { padding: 16px 14px 40px; }
}

/* ============================================================
   Sistema real: lo que el mockup no necesitaba.
   ============================================================ */
/* "Cerrar sesión" es un botón dentro de un formulario POST, con el aspecto de un enlace de la barra. */
.side-btn { width: 100%; background: none; border: 0; border-left: 3px solid transparent; text-align: left; cursor: pointer; }
a.shift { text-decoration: none; }
a.shift:hover { text-decoration: none; border-color: #b3bcc6; }
.shift.closed .dot { background: var(--neg); }
.shift.closed b { color: var(--neg); }

/* Avisos */
.cp-toast { background: #fff; border: 1px solid var(--line); border-left-width: 4px; border-radius: 4px; font-size: 0.8438rem; color: var(--ink); box-shadow: 0 8px 24px rgba(15, 37, 64, 0.16); min-width: 300px; max-width: 420px; }
.cp-toast-ok { border-left-color: var(--accent); }
.cp-toast-ok i { color: var(--accent); }
.cp-toast-err { border-left-color: var(--neg); }
.cp-toast-err i { color: var(--neg); }
/* Una regla del negocio impide la operación: advertencia, no falla del sistema. */
.cp-toast-warn { border-left-color: #d9a520; background: #fffbef; border-color: #e8d9ae; }
.cp-toast-warn i { color: #b07d0c; }

/* Estados vacíos y mensajes dentro de un panel */
.empty { padding: 28px 16px; text-align: center; color: var(--muted); font-size: 0.8438rem; }
.empty i { display: block; font-size: 1.6rem; color: #b3bcc5; margin-bottom: 6px; }
/* Advertencia dentro de un formulario (una regla impide guardar). Va en amarillo: es algo que el usuario corrige. */
.form-err { color: #6b4a08; font-size: 0.7813rem; background: #fdf3d0; border: 1px solid #e3c877; border-left: 4px solid #d9a520; border-radius: 4px; padding: 7px 10px; }
.form-err:empty { display: none; }
.form-err a { color: inherit; font-weight: 600; text-decoration: underline; }
/* Falla que no depende del usuario (sin conexión, error del servidor). */
.form-err.es-falla { color: var(--neg); background: var(--neg-soft); border-color: #ecc9c2; border-left-color: var(--neg); }

/* Validación en vivo: mensaje bajo el campo y borde del campo con problema. */
.cp-msg { display: flex; gap: 6px; align-items: flex-start; margin-top: 4px; color: #6b4a08; font-size: 0.75rem; line-height: 1.35; background: #fdf3d0; border: 1px solid #e3c877; border-radius: 4px; padding: 4px 8px; }
.cp-msg::before { content: "\F33A"; font-family: "bootstrap-icons"; color: #b07d0c; flex: none; }
.form-control.cp-invalid, .form-select.cp-invalid { border-color: #d9a520; box-shadow: 0 0 0 0.15rem rgba(217, 165, 32, 0.18); }
.form-check-input.cp-invalid { border-color: #d9a520; }
.input-group > .cp-invalid { z-index: 2; }
td > .cp-msg { text-align: left; white-space: normal; }

/* Nota en vivo que pasa de informativa a advertencia (p. ej. el importe de la transferencia). */
.cp-nota.es-aviso { margin-top: 4px; color: #6b4a08; background: #fdf3d0; border: 1px solid #e3c877; border-radius: 4px; padding: 4px 8px; }

/* Ventana de confirmación (sustituye al confirm() del navegador). */
dialog.cp-dialog { border: 1px solid #b9c2cc; border-radius: 6px; padding: 0; width: min(440px, calc(100vw - 32px)); box-shadow: 0 14px 36px rgba(15, 37, 64, 0.28); color: var(--ink); font-size: 0.875rem; }
dialog.cp-dialog::backdrop { background: rgba(15, 37, 64, 0.45); }
.cp-dialog-h { display: flex; align-items: center; gap: 8px; padding: 11px 16px; background: var(--head); border-bottom: 1px solid var(--line); font-size: 0.9375rem; }
.cp-dialog-h i { color: var(--info); }
.cp-dialog-b { padding: 18px 16px; line-height: 1.5; }
.cp-dialog-f { display: flex; justify-content: flex-end; gap: 8px; padding: 10px 16px; background: var(--head); border-top: 1px solid var(--line); }
.btn-danger { --bs-btn-bg: var(--neg); --bs-btn-border-color: var(--neg); --bs-btn-hover-bg: #8a3023; --bs-btn-hover-border-color: #8a3023; --bs-btn-active-bg: #7a2a1f; --bs-btn-active-border-color: #7a2a1f; }

/* Renglón de una tabla de cifras que abre su desglose. */
.tbl tr.cp-drill, .rows > div.cp-drill { cursor: pointer; }
.tbl tr.cp-drill:hover td { background: #eef3f9; }
.rows > div.cp-drill:hover { background: #eef3f9; }
.cp-drill .cp-drill-ico { color: var(--info); font-size: 0.75rem; margin-left: 6px; opacity: 0.75; }
.cp-drill:focus-visible { outline: 2px solid var(--info); outline-offset: -2px; }
[x-cloak] { display: none !important; }
.legend i.lg-ico { border: 0; width: auto; height: auto; background: none; }
.daynav .btn.active { background: var(--navy); color: #fff; border-color: var(--navy); }

/* Impresión (arqueo de caja): solo el contenido, sin el armazón. */
@media print {
  .sidebar, .topbar, .no-print, .toast-container { display: none !important; }
  .content { margin: 0 !important; padding: 0 !important; }
  body { background: #fff; }
  .panel { break-inside: avoid; }
}

/* Reserva periódica: fecha de la serie que ya está ocupada. */
.date-chips span.off { background: var(--neg-soft); border-color: #ecc9c2; color: var(--neg); text-decoration: line-through; }
.xopt .form-switch .form-check-input:disabled + label { opacity: 0.6; }

/* Comprobante de transferencia (detalle de la reserva) */
.proof { text-align: center; }
.proof-img { max-width: 100%; max-height: 340px; border-radius: 6px; border: 1px solid #cfd5dd; box-shadow: 0 4px 14px rgba(15, 37, 64, 0.12); background: #fff; }
.proof-pdf, .proof-vacio { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 18px 0; color: var(--muted); font-size: 0.8125rem; }
.proof-pdf i, .proof-vacio i { font-size: 2rem; color: #b3bcc5; }
.proof-pdf i { color: var(--neg); }
#modal-detalle .modal-content:empty { min-height: 120px; }

/* Menú del usuario en la barra superior */
.user-btn { background: none; border: 0; border-left: 1px solid var(--line); text-align: left; cursor: pointer; color: inherit; padding-top: 0; padding-bottom: 0; }
.dropdown-menu { font-size: 0.8125rem; border-color: var(--line); border-radius: 4px; box-shadow: 0 8px 24px rgba(15, 37, 64, 0.14); }
.dropdown-item:active { background: var(--accent); }
/* Catálogos: botón de quitar dentro de una etiqueta */
.chip-x { background: none; border: 0; padding: 0 0 0 2px; margin: 0; line-height: 1; color: var(--muted); cursor: pointer; }
.chip-x:hover { color: var(--neg); }
@media (max-width: 991px) { .user-btn { border-left: 0; padding-left: 0; } }
