/* =============================================================================
   EV Compartido — design system
   -----------------------------------------------------------------------------
   Tokens lifted from wallbox.com's own stylesheet: navy #142641, green #009B86,
   deep green #085D52, mint #B4E5DD, ink #202124, muted #626467, canvas #F0EEEE,
   line #E5E5E5, danger #DD3B3B.

   Their typeface (HeyWallbox) is proprietary, so we ship Inter — the closest
   free grotesk, vendored under /lib/inter (SIL OFL). Nothing here loads from a
   CDN, by design.

   This layers on Bootstrap rather than replacing it: Bootstrap's own CSS
   variables are overridden, so existing markup inherits the brand untouched.
   ========================================================================== */

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('/lib/inter/inter-400.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 500;
    font-display: swap;
    src: url('/lib/inter/inter-500.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 600;
    font-display: swap;
    src: url('/lib/inter/inter-600.woff2') format('woff2');
}

@font-face {
    font-family: 'Inter';
    font-style: normal;
    font-weight: 700;
    font-display: swap;
    src: url('/lib/inter/inter-700.woff2') format('woff2');
}

:root {
    /* Brand */
    --navy: #142641;
    --navy-2: #192538;
    --green: #009B86;
    --green-dark: #085D52;
    --green-soft: #B4E5DD;
    --green-tint: #EAF7F4;

    /* Neutrals */
    --ink: #202124;
    --muted: #626467;
    --faint: #9AA0A6;
    /* Status colours for the indicators: ok / warn / crit are states, never decoration. */
    --ok: #1E8E5A;
    --crit: #A82A2A;
    --crit-tint: #FBE9E9;
    --warn-tint: #FFF4E0;
    --track: #E1E7E4;
    --surface: #FFFFFF;
    --canvas: #F6F5F5;
    --line: #E5E5E5;
    --line-soft: #F0EEEE;

    --danger: #DD3B3B;
    --warn: #C77700;

    /* Shape */
    --r-sm: 8px;
    --r: 12px;
    --r-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(20, 38, 65, .05);
    --shadow: 0 1px 3px rgba(20, 38, 65, .06), 0 8px 24px -12px rgba(20, 38, 65, .12);

    /* Sidebar (navy, as in myWallbox) */
    --side: #142641;
    --side-hover: #1E3253;
    --side-line: #26374F;
    --side-text: #9BA9BC;

    /* Bootstrap inherits the brand from these. */
    --bs-primary: #009B86;
    --bs-primary-rgb: 0, 155, 134;
    --bs-body-color: #202124;
    --bs-body-bg: #F6F5F5;
    --bs-body-font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --bs-body-font-size: .9375rem;
    --bs-border-color: #E5E5E5;
    --bs-link-color: #085D52;
    --bs-link-hover-color: #009B86;
    --bs-border-radius: 12px;
    --bs-danger: #DD3B3B;
}

body {
    font-family: var(--bs-body-font-family);
    font-size: .9375rem;
    color: var(--ink);
    background: var(--canvas);
    -webkit-font-smoothing: antialiased;
    letter-spacing: -.005em;
}

/* Type scale — tight, dense, data-first. */
h1, .h1 { font-size: 1.5rem; font-weight: 600; letter-spacing: -.02em; }
h2, .h2 { font-size: 1.25rem; font-weight: 600; letter-spacing: -.015em; }
h3, .h3 { font-size: 1.0625rem; font-weight: 600; letter-spacing: -.01em; }
h4, h5, h6, .h4, .h5, .h6 { font-size: .9375rem; font-weight: 600; }

.text-muted { color: var(--muted) !important; }
.small { font-size: .8125rem; }

/* ---------- Buttons ---------- */

.btn {
    --bs-btn-font-weight: 500;
    --bs-btn-font-size: .875rem;
    --bs-btn-border-radius: var(--r-sm);
    --bs-btn-padding-x: 1rem;
    --bs-btn-padding-y: .5rem;
    letter-spacing: -.005em;
}

.btn-sm { --bs-btn-font-size: .8125rem; --bs-btn-padding-y: .35rem; }

.btn-primary, .btn-success {
    --bs-btn-bg: var(--green);
    --bs-btn-border-color: var(--green);
    --bs-btn-hover-bg: var(--green-dark);
    --bs-btn-hover-border-color: var(--green-dark);
    --bs-btn-active-bg: var(--green-dark);
    --bs-btn-active-border-color: var(--green-dark);
    --bs-btn-disabled-bg: var(--green);
    --bs-btn-disabled-border-color: var(--green);
    --bs-btn-color: #fff;
    --bs-btn-hover-color: #fff;
    --bs-btn-active-color: #fff;
    --bs-btn-disabled-color: #fff;
}

.btn-outline-primary, .btn-outline-success {
    --bs-btn-color: var(--green-dark);
    --bs-btn-border-color: var(--green);
    --bs-btn-hover-bg: var(--green);
    --bs-btn-hover-border-color: var(--green);
    --bs-btn-hover-color: #fff;
}

.btn-outline-secondary {
    --bs-btn-color: var(--ink);
    --bs-btn-border-color: var(--line);
    --bs-btn-bg: var(--surface);
    --bs-btn-hover-bg: var(--line-soft);
    --bs-btn-hover-border-color: #D5D5D5;
    --bs-btn-hover-color: var(--ink);
}

.btn-dark {
    --bs-btn-bg: var(--navy);
    --bs-btn-border-color: var(--navy);
    --bs-btn-hover-bg: var(--navy-2);
    --bs-btn-hover-border-color: var(--navy-2);
}

.btn-outline-danger { --bs-btn-color: var(--danger); --bs-btn-border-color: #F0C4C4; }

.btn-link {
    --bs-btn-color: var(--green-dark);
    --bs-btn-hover-color: var(--green);
    --bs-btn-font-weight: 500;
    text-decoration: none;
}

/* ---------- Surfaces ---------- */

.card {
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
    background: var(--surface);
}

.card-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    font-weight: 600;
    font-size: .9375rem;
    padding: .85rem 1.15rem;
    border-radius: var(--r) var(--r) 0 0 !important;
}

.card-body { padding: 1.15rem; }

/* ---------- Tables: quiet lines, loud numbers ---------- */

.table-wrap {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
    overflow-x: auto;
}

.table {
    --bs-table-bg: var(--surface);
    --bs-table-border-color: var(--line);
    margin-bottom: 0;
    font-size: .875rem;
}

.table > thead { background: var(--line-soft); }

.table > thead th {
    color: var(--muted);
    font-weight: 500;
    font-size: .75rem;
    letter-spacing: .03em;
    text-transform: uppercase;
    border-bottom: 1px solid var(--line);
    padding: .7rem 1rem;
    white-space: nowrap;
}

.table > tbody td {
    border-color: var(--line-soft);
    padding: .8rem 1rem;
    vertical-align: middle;
}

.table > tbody tr:last-child td { border-bottom: 0; }
.table > tbody tr:hover td { background: #FBFBFB; }

/* Numbers line up when they share a width. */
.num { font-variant-numeric: tabular-nums; }

/* Bootstrap has no min-width utility, and without it text-truncate cannot shrink inside a flex row. */
.min-w-0 { min-width: 0; }

/* ---------- Chips ---------- */

.badge {
    font-weight: 500;
    font-size: .75rem;
    letter-spacing: 0;
    padding: .32em .7em;
    border-radius: 999px;
    border: 1px solid transparent;
}

.badge.bg-success { background: var(--green-tint) !important; color: var(--green-dark) !important; border-color: var(--green-soft); }
.badge.bg-primary { background: #E7EDF6 !important; color: var(--navy) !important; border-color: #CBD8E8; }
.badge.bg-info { background: #E7EDF6 !important; color: var(--navy) !important; border-color: #CBD8E8; }
.badge.bg-warning { background: #FDF3E4 !important; color: var(--warn) !important; border-color: #F5DFB8; }
.badge.bg-danger { background: #FBEAEA !important; color: var(--danger) !important; border-color: #F2C9C9; }
.badge.bg-secondary { background: var(--line-soft) !important; color: var(--muted) !important; border-color: var(--line); }
.badge.bg-light { background: var(--line-soft) !important; color: var(--muted) !important; border-color: var(--line); }

/* ---------- Forms ---------- */

.form-label {
    font-weight: 500;
    font-size: .8125rem;
    color: var(--ink);
    margin-bottom: .3rem;
}

.form-control, .form-select {
    border-color: var(--line);
    border-radius: var(--r-sm);
    font-size: .875rem;
    padding: .5rem .75rem;
    background-color: var(--surface);
}

.form-control:focus, .form-select:focus, .form-check-input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(0, 155, 134, .12);
}

.form-check-input:checked { background-color: var(--green); border-color: var(--green); }
.form-text { font-size: .8125rem; color: var(--muted); }

.alert { border-radius: var(--r-sm); border: 1px solid var(--line); font-size: .875rem; padding: .75rem 1rem; }
.alert-success { background: var(--green-tint); border-color: var(--green-soft); color: var(--green-dark); }
.alert-danger { background: #FBEAEA; border-color: #F2C9C9; color: #A82A2A; }
.alert-warning { background: #FDF3E4; border-color: #F5DFB8; color: var(--warn); }

/* ---------- Shell ---------- */

.app { display: flex; min-height: 100vh; }

.sidebar {
    width: 248px;
    flex: 0 0 248px;
    background: var(--side);
    color: var(--side-text);
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: 1.15rem 1.25rem;
    color: #fff;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: -.02em;
    text-decoration: none;
}

.sidebar-brand:hover { color: #fff; }

.sidebar-mark {
    width: 26px;
    height: 26px;
    border-radius: 7px;
    background: var(--green);
    display: grid;
    place-items: center;
    color: #fff;
    font-weight: 700;
    font-size: .7rem;
    flex: none;
}

/* The scope switcher, as in myWallbox: which copropiedad am I looking at. */
.sidebar-scope-box {
    margin: 0 .85rem 1rem;
    padding: .55rem .7rem;
    border: 1px solid var(--side-line);
    border-radius: var(--r-sm);
    color: #fff;
    font-size: .8125rem;
    font-weight: 500;
    line-height: 1.3;
}

.sidebar-scope-box small { display: block; color: var(--side-text); font-weight: 400; font-size: .7rem; }

.sidebar-role {
    padding: .35rem 1.4rem .3rem;
    font-size: .68rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #6D7C90;
}

.sidebar-nav { list-style: none; padding: 0 .6rem; margin: 0 0 .4rem; }

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .5rem .75rem;
    margin-bottom: .1rem;
    border-radius: var(--r-sm);
    color: var(--side-text);
    text-decoration: none;
    font-size: .875rem;
    font-weight: 450;
    line-height: 1.3;
}

.sidebar-nav a:hover { background: var(--side-hover); color: #fff; }

.sidebar-nav a.active {
    background: var(--side-hover);
    color: #fff;
    font-weight: 500;
    box-shadow: inset 3px 0 0 var(--green);
}

.sidebar-nav svg { width: 17px; height: 17px; flex: none; opacity: .9; }

.sidebar-spacer { flex: 1; }

.sidebar-foot {
    border-top: 1px solid var(--side-line);
    padding: .85rem 1rem;
    display: flex;
    align-items: center;
    gap: .6rem;
}

.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--side-hover);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: .75rem;
    font-weight: 600;
    flex: none;
}

.sidebar-user { color: #fff; font-size: .8125rem; font-weight: 500; line-height: 1.2; }
.sidebar-mail { color: var(--side-text); font-size: .72rem; }

.sidebar-signout {
    background: none;
    border: 0;
    color: var(--side-text);
    padding: .2rem;
    display: grid;
    place-items: center;
}

.sidebar-signout:hover { color: #fff; }

.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    padding: .8rem 1.75rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    position: sticky;
    top: 0;
    z-index: 20;
}

.crumbs { font-size: .8125rem; color: var(--faint); }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--green-dark); }

.topbar h1 { font-size: 1.125rem; margin: 0; font-weight: 600; }

.topbar-bell {
    position: relative;
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    color: var(--muted);
    background: var(--line-soft);
}

.topbar-bell:hover { color: var(--navy); background: var(--line); }

.topbar-bell-count {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: .65rem;
    font-weight: 600;
    line-height: 17px;
    text-align: center;
    border: 2px solid var(--surface);
    box-sizing: content-box;
}

/* Charger tabs on the resident calendar. */
.nav-pills {
    --bs-nav-pills-link-active-bg: var(--navy);
    --bs-nav-link-color: var(--muted);
    --bs-nav-link-hover-color: var(--navy);
    --bs-nav-pills-border-radius: var(--r-sm);
    --bs-nav-link-font-size: .875rem;
    --bs-nav-link-font-weight: 500;
    --bs-nav-link-padding-y: .45rem;
    gap: .35rem;
}

.page { padding: 1.5rem 1.75rem; flex: 1; }
.page-lead { color: var(--muted); font-size: .875rem; margin-top: -.25rem; }

.section-title {
    font-size: .8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: var(--muted);
    margin-bottom: .75rem;
}

/* ---------- KPI tiles ---------- */

.tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: .9rem;
}

.tile {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--r);
    box-shadow: var(--shadow-sm);
    padding: 1rem 1.15rem;
    display: flex;
    flex-direction: column;
    gap: .2rem;
}

.tile-value {
    font-size: 1.75rem;
    font-weight: 600;
    line-height: 1.15;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
    color: var(--navy);
}

.tile-label { font-size: .8125rem; color: var(--muted); }
.tile-accent .tile-value { color: var(--green-dark); }
.tile-warn .tile-value { color: var(--warn); }

/* A bar chart of plain divs — no charting library, nothing extra to load. */
.chart { display: flex; align-items: flex-end; gap: .45rem; height: 180px; margin-top: 1.25rem; }
.chart-col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: .4rem; height: 100%; }
.chart-bar { width: 100%; max-width: 30px; background: var(--green); border-radius: 4px 4px 0 0; min-height: 3px; }
.chart-bar.is-empty { background: var(--line); }
.chart-label { font-size: .7rem; color: var(--faint); }

/* ---------- Entity header + tabs (detail pages) ---------- */

.entity-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

.nav-tabs {
    --bs-nav-tabs-border-color: var(--line);
    --bs-nav-tabs-link-active-color: var(--navy);
    --bs-nav-tabs-link-active-border-color: transparent transparent var(--green);
    --bs-nav-tabs-link-active-bg: transparent;
    --bs-nav-tabs-border-width: 2px;
    --bs-nav-tabs-border-radius: 0;
    --bs-nav-link-color: var(--muted);
    --bs-nav-link-hover-color: var(--navy);
    --bs-nav-link-font-size: .9375rem;
    --bs-nav-link-font-weight: 500;
    --bs-nav-link-padding-x: .1rem;
    gap: 1.5rem;
}

.nav-tabs .nav-link { border-top: 0; border-left: 0; border-right: 0; margin-bottom: -2px; }
.nav-tabs .nav-link:hover { border-color: transparent transparent var(--line); }

/* A key/value list that keeps its labels quiet and its values aligned. */
.kv { display: grid; grid-template-columns: auto 1fr; gap: .4rem 1.5rem; margin: 0; }
.kv dt { font-weight: 400; color: var(--muted); font-size: .875rem; }
.kv dd { margin: 0; font-weight: 500; font-size: .875rem; text-align: right; }

/* A lifecycle read left to right: Borrador → Emitido → Firmado → Pagado. */
.steps {
    display: flex;
    align-items: center;
    gap: .4rem;
    list-style: none;
    margin: 0;
    padding: 0;
    font-size: .75rem;
    color: var(--faint);
}

.steps li { display: flex; align-items: center; gap: .4rem; }

.steps li::before {
    content: "";
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--line);
    flex: none;
}

.steps li + li::after {
    content: "";
    order: -1;
    width: 14px;
    height: 1px;
    background: var(--line);
}

.steps li.is-done { color: var(--green-dark); font-weight: 500; }
.steps li.is-done::before { background: var(--green); }
.steps li.is-done + li.is-done::after { background: var(--green-soft); }

/* The opening values, read as a line of facts rather than a form. */
.summary-chips { display: flex; flex-wrap: wrap; gap: .4rem .5rem; font-size: .8125rem; color: var(--muted); }

.summary-chips > span {
    background: var(--line-soft);
    border: 1px solid var(--line);
    border-radius: 999px;
    padding: .2rem .6rem;
}

.summary-chips .num { color: var(--ink); font-weight: 600; }

/* A deactivated row is still readable, just clearly out of service. */
.is-muted-row td { opacity: .55; }

.modal-card-footer {
    display: flex;
    justify-content: flex-end;
    gap: .5rem;
    padding: 1rem 1.25rem;
    border-top: 1px solid var(--line);
}

/* ---------- Meter (utilization) ---------- */

.meter {
    flex: 1;
    min-width: 5rem;
    height: 6px;
    border-radius: 999px;
    background: var(--line);
    overflow: hidden;
}

.meter-fill { height: 100%; border-radius: 999px; background: var(--green); }
.meter-fill.is-mid { background: #E0A100; }
.meter-fill.is-high { background: var(--danger); }

/* ---------- Empty states ---------- */

.empty {
    text-align: center;
    padding: 2.5rem 1rem;
    color: var(--muted);
    background: var(--surface);
    border: 1px dashed var(--line);
    border-radius: var(--r);
}

.empty-mark {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--green-tint);
    color: var(--green-dark);
    display: grid;
    place-items: center;
    margin: 0 auto .75rem;
}

/* ---------- Slot grid (resident calendar) ---------- */

.slot-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr)); gap: .5rem; }

.slot {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    padding: .55rem .7rem;
    border: 1px solid transparent;
    border-radius: var(--r-sm);
    text-align: left;
    font-size: .8125rem;
}

.slot-time { font-weight: 600; font-variant-numeric: tabular-nums; }
.slot-state { font-size: .72rem; opacity: .9; }

.slot-free { background: var(--green-tint); border-color: var(--green-soft); color: var(--green-dark); cursor: pointer; }
.slot-free:hover { background: var(--green-soft); border-color: var(--green); }
.slot-mine { background: var(--green); border-color: var(--green-dark); color: #fff; }
.slot-taken { background: #FBEAEA; border-color: #F2C9C9; color: #A82A2A; }
.slot-outside { background: var(--line-soft); border-color: var(--line); color: var(--muted); }
.slot-past { background: #FAFAFA; border-color: var(--line-soft); color: var(--faint); }
/* Free of reservations but closed by the power cap: visibly different from "taken" and from "past". */
.slot-nocap { background: #FFF4E0; border-color: #F5D9A6; color: #8A5A00; }

/* The slot's power budget as a 4px bar under the hour (only when a cap is in force). */
.slot-bar { display: block; width: 100%; height: 4px; border-radius: 2px; background: rgba(0, 0, 0, .08); margin-top: .35rem; overflow: hidden; }
.slot-bar i { display: block; height: 100%; background: currentColor; opacity: .75; border-radius: 2px; }
.slot-mine .slot-bar { background: rgba(255, 255, 255, .25); }

/* A taken or capped slot is still a button: click it to get in line for that hour. */
.slot-queueable { cursor: pointer; }
.slot-queueable:hover { filter: brightness(.95); border-color: currentColor; }

.slot-legend { display: flex; flex-wrap: wrap; gap: 1rem; font-size: .8125rem; color: var(--muted); }

/* ---------- Admin: the load, made prominent ---------- */

.load-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1.5rem; align-items: center; }
.load-hero-value { font-size: 2.75rem; font-weight: 700; line-height: 1; letter-spacing: -.03em; font-variant-numeric: tabular-nums; color: var(--navy); }
.load-hero-value small { font-size: 1.1rem; font-weight: 600; color: var(--muted); margin-left: .25rem; }
.load-hero.is-near .load-hero-value { color: var(--warn); }
.load-hero.is-over .load-hero-value { color: #A82A2A; }
.load-meter { height: .9rem; border-radius: 999px; background: var(--line-soft); overflow: hidden; }
.load-meter > div { height: 100%; border-radius: 999px; background: var(--green); transition: width .3s ease; }
.load-hero.is-near .load-meter > div { background: var(--warn); }
.load-hero.is-over .load-meter > div { background: #A82A2A; }
.load-breakdown { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; }
.load-breakdown .value { font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--navy); }
.load-breakdown .label { font-size: .78rem; color: var(--muted); }

/* ---------- Admin: reservations per slot ---------- */

.slot-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.25rem, 1fr)); gap: .4rem; }
.slot-cell { border: 1px solid var(--line); border-radius: var(--r-sm); padding: .45rem .55rem; font-size: .78rem; background: var(--surface); }
.slot-cell .time { font-weight: 600; font-variant-numeric: tabular-nums; }
.slot-cell .num { font-size: 1.05rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--navy); line-height: 1.2; }
.slot-cell .meta { color: var(--muted); font-size: .72rem; }
.slot-cell.is-past { background: #FAFAFA; color: var(--faint); border-color: var(--line-soft); }
.slot-cell.is-past .num { color: var(--faint); }
.slot-cell.is-busy { border-color: var(--green-soft); background: var(--green-tint); }
.slot-cell.is-full { border-color: #F5D9A6; background: #FFF4E0; }
.slot-cell.is-full .num { color: #8A5A00; }

@media (max-width: 767.98px) {
    .load-hero { grid-template-columns: 1fr; }
}

/* ---------- Admin: reservations calendar ----------
   FullCalendar dressed in the app's tokens rather than its own dark buttons, blue links and yellow
   "today". Rows stay tall enough to read an event in (customer feedback, 2026-09-17: "se ve muy
   pequeño"). The whole day is on the axis, scrolling inside the card, and the hours no franja opens are
   shaded the way Outlook shades its non-working hours (customer feedback, 2026-09-19). */

#reservas-calendar {
    --fc-border-color: var(--line);
    --fc-page-bg-color: var(--surface);
    --fc-neutral-bg-color: var(--line-soft);
    /* Half the brand tint: a full-strength column read as one more booking. */
    --fc-today-bg-color: color-mix(in srgb, var(--green-tint) 55%, var(--surface));
    --fc-now-indicator-color: var(--green);
    --fc-event-border-color: transparent;
    --fc-button-text-color: var(--ink);
    --fc-button-bg-color: var(--surface);
    --fc-button-border-color: var(--line);
    --fc-button-hover-bg-color: var(--line-soft);
    --fc-button-hover-border-color: #D5D5D5;
    --fc-button-active-bg-color: var(--navy);
    --fc-button-active-border-color: var(--navy);
    color: var(--ink);
}

#reservas-calendar .fc-toolbar-title { font-size: 1.15rem; font-weight: 600; }
/* "septiembre de 2026" → "Septiembre de 2026": capitalize would also raise the "de". */
#reservas-calendar .fc-toolbar-title::first-letter { text-transform: uppercase; }
#reservas-calendar .fc-button {
    font-size: .8125rem;
    font-weight: 500;
    padding: .4rem .8rem;
    border-radius: var(--r-sm);
    box-shadow: none !important;
    text-transform: capitalize;
}
#reservas-calendar .fc-button-primary:not(:disabled).fc-button-active { color: #fff; }
#reservas-calendar .fc-button-primary:disabled { opacity: .55; }
#reservas-calendar .fc-button-group > .fc-button:not(:first-child) { margin-left: -1px; }

/* Column headers: labels, not links. */
#reservas-calendar .fc-col-header-cell { background: var(--canvas); }
#reservas-calendar .fc-col-header-cell-cushion,
#reservas-calendar .fc-daygrid-day-number {
    color: var(--muted);
    text-decoration: none;
    font-size: .8125rem;
    font-weight: 600;
    text-transform: capitalize;
    padding: .5rem .25rem;
}
#reservas-calendar .fc-day-today .fc-col-header-cell-cushion { color: var(--green-dark); }

#reservas-calendar .fc-timegrid-slot { height: 3.25rem; }
#reservas-calendar .fc-timegrid-slot-label { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; vertical-align: top; }
#reservas-calendar .fc-timegrid-slot-minor { border-top-style: dotted; }
/* Hour lines over the shading. The slot borders live in a layer below the background events, and the
   shaded hours are opaque (.fc-bg-event opacity 1 below), so every divider under a closed, past or busy
   block vanished the moment the feed arrived. Lifting the slot grid to the events' own z-index puts the
   lines above the shading and — same index, later in the DOM wins — still behind the bookings; the cells
   let the pointer through so clicking and hovering a shaded hour keeps working. */
#reservas-calendar .fc-timegrid-slots { z-index: 3; pointer-events: none; }
#reservas-calendar .fc-daygrid-day-frame { min-height: 6.5rem; }

/* Events: the list view's badge tints (.badge.bg-*), with a solid bar on the left for the status. One
   exception: brand.css turns the --green tokens blue, so "completed" would be a second pale blue next to
   "booked"; it takes the status green (--ok) instead, which is what a finished slot means. */
#reservas-calendar .fc-event {
    border: 1px solid transparent;
    border-left-width: 3px;
    border-radius: 6px;
    font-size: .8rem;
    line-height: 1.25;
    padding: 2px 4px;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
}
#reservas-calendar .fc-event .fc-event-main { color: inherit; }
#reservas-calendar .fc-ev-time { font-size: .72rem; opacity: .8; font-variant-numeric: tabular-nums; }
#reservas-calendar .fc-ev-unit { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#reservas-calendar .fc-ev-meta { font-size: .75rem; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.fc-ev-booked   { background: #E7EDF6 !important; color: var(--navy) !important; border-color: #CBD8E8 !important; border-left-color: var(--navy) !important; }
.fc-ev-progress { background: #FDF3E4 !important; color: #7A4A00 !important; border-color: #F5DFB8 !important; border-left-color: var(--warn) !important; }
.fc-ev-done     { background: #E8F5EE !important; color: #17683F !important; border-color: #BFE3CF !important; border-left-color: var(--ok) !important; }
.fc-ev-spent    { background: var(--surface) !important; color: var(--faint) !important; border: 1px dashed var(--line) !important; border-left: 3px solid var(--line) !important; box-shadow: none !important; }
#reservas-calendar .fc-ev-spent .fc-ev-unit { text-decoration: line-through; }

/* Month view: the dot-and-text rows become the same tinted blocks. */
#reservas-calendar .fc-daygrid-event { white-space: normal; margin: 1px 3px; }
#reservas-calendar .fc-daygrid-event-dot { display: none; }
#reservas-calendar .fc-ev-row { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#reservas-calendar .fc-ev-spent .fc-ev-row { text-decoration: line-through; }

.fc-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem 1.25rem;
    margin-top: .85rem;
    padding-top: .85rem;
    border-top: 1px solid var(--line-soft);
    font-size: .8125rem;
    color: var(--muted);
}
.fc-legend > span { display: inline-flex; align-items: center; gap: .4rem; }
.fc-swatch { display: inline-block; width: .9rem; height: .9rem; border-radius: 3px; border: 1px solid; border-left-width: 3px; }

/* The shaded hours of the admin calendar: opaque, so a booking over them still reads, and hatched
   like Outlook's non-working hours. The legend's swatch takes the same hatch, finer. */
#reservas-calendar .fc-bg-event { opacity: 1; }
#reservas-calendar .cal-bg-outside {
    background: repeating-linear-gradient(135deg, var(--line-soft) 0 6px, #E9EAEE 6px 7px);
}
.cal-sw-outside { background: repeating-linear-gradient(135deg, var(--line-soft) 0 3px, #DCDDE2 3px 4px); border-color: var(--line); border-left-width: 1px; }

/* ---------- Operator: the printed technical report ---------- */

.study-report { color: #000; }
.study-report h1 { font-size: 1.35rem; margin: 0; }
.study-report .report-brand { font-size: .8rem; letter-spacing: .08em; text-transform: uppercase; color: #444; }
.study-report h2 { font-size: .95rem; text-transform: uppercase; letter-spacing: .05em; margin: 1.1rem 0 .4rem; border-bottom: 1px solid #000; padding-bottom: .2rem; }
.study-report table { width: 100%; border-collapse: collapse; font-size: .85rem; }
.study-report th, .study-report td { border: 1px solid #000; padding: .3rem .5rem; vertical-align: top; }
.study-report th { width: 42%; text-align: left; font-weight: 600; background: #f2f2f2; }
.study-report .figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: .75rem; }
.study-report .figure { border: 1px solid #000; padding: .5rem .6rem; }
.study-report .figure .value { font-size: 1.3rem; font-weight: 700; }
.study-report .figure .gauge { max-width: 150px; margin: .25rem 0; }
.study-report .figure .ring { margin: .25rem 0; }
.study-report .figure svg { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
.study-report .figure .formula { font-size: .72rem; color: #444; }
.study-report .lines { border-bottom: 1px solid #000; height: 1.6rem; }
.study-report .signatures { display: grid; grid-template-columns: repeat(2, 1fr); gap: 3rem; margin-top: 2.5rem; }
.study-report .signatures > div { border-top: 1px solid #000; padding-top: .3rem; font-size: .8rem; }
.legend-box { display: inline-block; width: .8rem; height: .8rem; border-radius: .2rem; margin-right: .3rem; vertical-align: -1px; }

/* ---------- Confirm dialog (Alpine owns open/closed, htmx owns the contents) ---------- */

.modal-backdrop-custom {
    position: fixed;
    inset: 0;
    background: rgba(20, 38, 65, .55);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    z-index: 1050;
}

.modal-card {
    background: var(--surface);
    border-radius: var(--r-lg);
    width: 100%;
    max-width: 32rem;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 1.5rem 3rem rgba(20, 38, 65, .28);
}

.modal-card-header { display: flex; justify-content: space-between; align-items: center; padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); }
.modal-card-body { padding: 1.25rem; }

[x-cloak] { display: none !important; }

/* ---------- Sidebar toggle: drawer on narrow screens, rail on wide ones ---------- */

.sidebar-toggle {
    display: inline-flex;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--muted);
    border-radius: var(--r-sm);
    padding: .35rem .55rem;
    flex: none;
}

.sidebar-toggle:hover { color: var(--navy); background: var(--line-soft); }

/* Collapsed rail: icons only, labels return on hover as native tooltips. */
@media (min-width: 992px) {
    .sidebar { transition: width .2s ease, flex-basis .2s ease; overflow: hidden; }

    html.nav-collapsed .sidebar { width: 64px; flex: 0 0 64px; }
    html.nav-collapsed .sidebar-label,
    html.nav-collapsed .sidebar-scope-box,
    html.nav-collapsed .sidebar-role { display: none; }

    html.nav-collapsed .sidebar-brand { padding: 1.15rem 0; justify-content: center; }
    html.nav-collapsed .sidebar-nav { padding: 0 .5rem; }
    html.nav-collapsed .sidebar-nav a { justify-content: center; padding: .6rem 0; }
    html.nav-collapsed .sidebar-nav svg { width: 19px; height: 19px; }
    html.nav-collapsed .sidebar-foot { flex-direction: column; padding: .75rem .5rem; gap: .5rem; }
}

/* ---------- Mobile: the sidebar becomes a drawer ---------- */

@media (max-width: 991.98px) {
    .sidebar { position: fixed; z-index: 1050; transform: translateX(-100%); transition: transform .2s ease; }
    .sidebar.open { transform: translateX(0); }

    .scrim { position: fixed; inset: 0; background: rgba(20, 38, 65, .45); z-index: 1040; }
    .page { padding: 1rem; }
    .topbar { padding: .75rem 1rem; }
}

/* ---------- Indicators: gauge, ring, battery, bars, charger pictogram (Pages/Shared/_*.cshtml) ----------
   All inline SVG. Colour is by state (ok / warn / crit) so a full slot, an overloaded building and a
   charger fault read the same way on every screen; the number always sits beside the drawing. */

.gauge { width: 100%; max-width: 220px; height: auto; display: block; }
.gauge path { fill: none; stroke-width: 14; }
.gauge .gauge-ok { stroke: var(--green); }
.gauge .gauge-warn { stroke: var(--warn); }
.gauge .gauge-crit { stroke: var(--crit); }
.gauge .gauge-needle path { stroke: var(--navy); stroke-width: 3; stroke-linecap: round; }
.gauge .gauge-needle circle { fill: var(--navy); }
.gauge .gauge-tick { font-family: inherit; font-size: 9px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.gauge-sm { max-width: 150px; }
@media (prefers-reduced-motion: no-preference) { .gauge .gauge-needle { transition: transform .5s ease; } }

.ring { width: 56px; height: 56px; display: block; }
.ring-lg { width: 80px; height: 80px; }
.ring-sm { width: 40px; height: 40px; }
.ring circle { fill: none; stroke-width: 8; }
.ring .ring-track { stroke: var(--track); }
.ring .ring-fill { stroke: var(--green); stroke-linecap: round; }
.ring.is-warn .ring-fill { stroke: var(--warn); }
.ring.is-crit .ring-fill { stroke: var(--crit); }
.ring.is-muted .ring-fill { stroke: var(--faint); }
.ring .ring-text { font-size: 13px; font-weight: 700; fill: var(--navy); font-variant-numeric: tabular-nums; }
.ring-sm .ring-text { font-size: 15px; }
.ring-inline { display: inline-flex; flex-shrink: 0; }
.ring-inline .ring { width: 34px; height: 34px; }
.ring-inline .ring circle { stroke-width: 9; }
.ring-inline .ring .ring-text { font-size: 17px; }

.battery { display: block; height: auto; }
.battery-md { width: 96px; }
.battery-sm { width: 52px; }
.battery .battery-body { fill: var(--surface); stroke: var(--navy); stroke-width: 3; }
.battery .battery-cap { fill: var(--navy); }
.battery .battery-track { fill: var(--track); }
.battery .battery-ghost { fill: var(--green-soft); }
.battery .battery-fill { fill: var(--green); }
.battery.is-unknown .battery-body { stroke-dasharray: 6 4; stroke: var(--faint); }
.battery.is-unknown .battery-cap { fill: var(--faint); }
.battery .battery-text { font-size: 22px; font-weight: 700; fill: var(--faint); }

.bars { width: 100%; max-height: 200px; height: auto; display: block; }
.bars .bar { fill: var(--green); }
.bars .bar.is-full { fill: var(--warn); }
.bars .bar.is-past { fill: var(--track); }
.bars .bar:hover { fill: var(--green-dark); }
.bars .bar.is-full:hover { fill: #8A5A00; }
.bars .bars-axis { stroke: var(--line); }
.bars .bars-ref { stroke: var(--crit); stroke-width: 1.5; stroke-dasharray: 4 3; }
.bars .bars-ref-text { font-size: 8px; fill: var(--crit); font-variant-numeric: tabular-nums; }
.bars .bars-tick { font-size: 8px; fill: var(--muted); font-variant-numeric: tabular-nums; }
/* The building's own demand under the reserved chargers: fixed, so neutral — the colour is for what changes. */
.bars .bar-base { fill: #B8BFC9; }
.bars .bar-base.is-past { fill: #D5DAE0; }
.bars-legend { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.bars-legend .sw { display: inline-block; width: .8rem; height: .6rem; border-radius: 2px; margin-right: .35rem; vertical-align: 0; }
.bars-legend .sw-base { background: #B8BFC9; }
.bars-legend .sw-res { background: var(--green); }
.bars-legend .sw-cap { height: 0; border-top: 2px dashed var(--crit); border-radius: 0; vertical-align: 3px; }

.charger-icon { width: 34px; height: 44px; flex-shrink: 0; }
.charger-icon .charger-box { fill: var(--green-tint); stroke: var(--green); stroke-width: 2.5; }
.charger-icon .charger-screen { fill: var(--green); }
.charger-icon .charger-cable { fill: none; stroke: var(--green); stroke-width: 2.5; stroke-linecap: round; }
.charger-icon.is-warn .charger-box { fill: var(--warn-tint); stroke: var(--warn); }
.charger-icon.is-warn .charger-screen, .charger-icon.is-warn .charger-cable { fill: var(--warn); stroke: var(--warn); }
.charger-icon.is-warn .charger-cable { fill: none; }
.charger-icon.is-crit .charger-box { fill: var(--crit-tint); stroke: var(--crit); }
.charger-icon.is-crit .charger-screen { fill: var(--crit); }
.charger-icon.is-crit .charger-cable { stroke: var(--crit); }
.charger-icon.is-muted .charger-box { fill: var(--line-soft); stroke: var(--faint); }
.charger-icon.is-muted .charger-screen { fill: var(--faint); }
.charger-icon.is-muted .charger-cable { stroke: var(--faint); }

/* A status chip: icon + word, so state never depends on colour alone. */
.chip { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; font-weight: 500; padding: .18rem .55rem; border-radius: 999px; white-space: nowrap; }
.chip svg { width: 12px; height: 12px; flex-shrink: 0; fill: currentColor; }
.chip-ok { background: var(--green-tint); color: var(--green-dark); }
.chip-warn { background: var(--warn-tint); color: #8A5A00; }
.chip-crit { background: var(--crit-tint); color: var(--crit); }
.chip-info { background: #E7F0FA; color: #1F4E8C; }
.chip-muted { background: var(--line-soft); color: var(--muted); }
.kw-pill { font-family: ui-monospace, "Cascadia Mono", Menlo, monospace; font-size: .75rem; background: var(--line-soft); padding: .08rem .4rem; border-radius: 4px; color: var(--ink); white-space: nowrap; }

/* A severity stripe on a table row, read before the words are. */
tr.sev-crit > td:first-child { box-shadow: inset 4px 0 0 var(--crit); }
tr.sev-warn > td:first-child { box-shadow: inset 4px 0 0 var(--warn); }
tr.sev-info > td:first-child { box-shadow: inset 4px 0 0 var(--faint); }

/* Inline bar inside a table cell: value as a proportion of the column's largest. */
.cell-bar { display: flex; align-items: center; gap: .5rem; justify-content: flex-end; }
.cell-bar .track { width: 72px; height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; }
.cell-bar .track i { display: block; height: 100%; background: var(--green); border-radius: 3px; }

/* A queue as a row of dots: one per unit waiting, the reader's own emphasised. */
.queue-dots { display: inline-flex; align-items: center; gap: .3rem; }
.queue-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--faint); display: inline-block; }
.queue-dots i.is-me { width: 13px; height: 13px; background: var(--green); outline: 3px solid var(--green-tint); }

/* Lead funnel: one step per status, width proportional to count. */
.funnel { display: grid; gap: .35rem; }
.funnel-step { display: grid; grid-template-columns: 8rem minmax(0, 1fr) 3rem; align-items: center; gap: .6rem; font-size: .82rem; }
.funnel-step .track { height: 14px; background: var(--track); border-radius: 4px; overflow: hidden; }
.funnel-step .track i { display: block; height: 100%; background: var(--green); }
.funnel-step .num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Print: the statement leaves as a sign-ready sheet ---------- */

@media print {
    .no-print, .sidebar, .topbar, .btn, .scrim { display: none !important; }

    body, .page { background: #fff !important; padding: 0 !important; }

    .app { display: block; }

    .printable .table,
    .printable .table th,
    .printable .table td { border-color: #000 !important; color: #000 !important; background: #fff !important; }

    .printable .table > thead { background: #fff !important; }

    .printable .badge { border: 1px solid #000; color: #000 !important; background: #fff !important; }

    a[href]::after { content: ""; }

    /* The technical report prints as a sheet of its own: the form it was typed into stays on screen. */
    .study-report { display: block !important; }
    .study-report .figures, .study-report .signatures { break-inside: avoid; }
    .study-report table { page-break-inside: auto; }
    .study-report tr { break-inside: avoid; }
    @page { margin: 15mm; }
}

/* ---------- Check-in code stickers (admin /admin/codigos) and the resident's code field ---------- */
.checkin-form { max-width: 22rem; margin-left: auto; text-align: left; }
.checkin-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .25em; font-size: 1.1rem; }
.sticker-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 1rem; }
.sticker { border: 2px dashed var(--line); border-radius: 12px; padding: 1rem 1.25rem; text-align: center; break-inside: avoid; background: var(--surface, #fff); }
.sticker-brand { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sticker-charger { font-size: 1.1rem; font-weight: 700; margin: .25rem 0 .5rem; }
.sticker-how { font-size: .8rem; color: var(--muted); }
.sticker-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 2.4rem; font-weight: 800; letter-spacing: .12em; margin-top: .35rem; }
@media print {
    .sticker { border-color: #999; }
}

/* ---------- Admin Reservas: agenda (Iván's proposal, 2026-09-22) ---------- */
.agenda-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: .25rem; text-align: center; }
.agenda-dow { font-size: .7rem; font-weight: 600; color: var(--muted); padding-bottom: .15rem; }
.agenda-day {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    aspect-ratio: 1; border-radius: 50%; font-size: .85rem; line-height: 1; color: var(--ink); text-decoration: none;
    font-variant-numeric: tabular-nums; transition: background .15s, box-shadow .15s;
}
.agenda-day:hover { background: var(--line-soft); color: var(--ink); }
.agenda-day.is-other { color: var(--faint); }
.agenda-day.is-today { box-shadow: inset 0 0 0 2px var(--green); font-weight: 600; }
.agenda-day.is-selected { background: var(--navy); color: #fff; font-weight: 600; }
.agenda-dot { display: block; width: 5px; height: 5px; border-radius: 50%; background: var(--danger); }
.agenda-day:not(:has(.agenda-dot))::after { content: ""; display: block; width: 5px; height: 5px; }
.agenda-day.is-selected .agenda-dot { background: #fff; }
.agenda-legend { display: flex; flex-wrap: wrap; gap: .25rem .9rem; margin-top: .75rem; font-size: .75rem; color: var(--muted); }
.agenda-legend .sw { display: inline-block; width: .7rem; height: .7rem; border-radius: 50%; margin-right: .3rem; vertical-align: -1px; }
.agenda-legend .sw-selected { background: var(--navy); }
.agenda-legend .sw-today { box-shadow: inset 0 0 0 2px var(--green); }
.agenda-legend .agenda-dot { display: inline-block; margin-right: .3rem; vertical-align: 1px; }
.agenda-month-title { white-space: nowrap; font-size: .9rem; padding: 0 .35rem; }
.agenda-month .btn-sm { --bs-btn-padding-x: .6rem; }

.agenda-counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: .6rem; }
.agenda-counter { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: .7rem .9rem; box-shadow: var(--shadow-sm); }
.agenda-counter .value { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.agenda-counter .label { font-size: .75rem; color: var(--muted); }
.agenda-counter.is-booked .value { color: var(--navy); }
.agenda-counter.is-queued .value { color: #2B6CB0; }
.agenda-counter.is-progress .value { color: var(--warn); }
.agenda-counter.is-done .value { color: var(--ok); }
.agenda-counter.is-alert { border-color: #F0C4C4; background: var(--crit-tint); }
.agenda-counter.is-alert .value { color: var(--crit); }

.agenda-list { display: flex; flex-direction: column; gap: .5rem; }
.agenda-item {
    display: flex; gap: .9rem; align-items: flex-start; background: var(--surface);
    border: 1px solid var(--line); border-left: 4px solid var(--navy); border-radius: var(--r);
    padding: .75rem .9rem; box-shadow: var(--shadow-sm);
}
.agenda-item.is-progress { border-left-color: var(--warn); }
.agenda-item.is-done { border-left-color: var(--ok); }
.agenda-item.is-alert { border-left-color: var(--danger); }
.agenda-item.is-queued { border-left-color: #2B6CB0; }
.agenda-time { width: 3.6rem; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.agenda-actions { display: flex; flex-wrap: wrap; gap: .25rem; justify-content: flex-end; flex-shrink: 0; }
@media (max-width: 575.98px) {
    .agenda-item { flex-wrap: wrap; }
    .agenda-actions { width: 100%; justify-content: flex-start; }
}
