:root {
    --background: #f0f4f8;
    --foreground: #0f1e3d;
    --card: #fff;
    --card-shadow: 0 1px 3px rgba(0, 0, 0, .07), 0 1px 2px rgba(0, 0, 0, .04);
    --border: #c8d8ea;
    --muted-foreground: #5a7090;
    --navy-800: #0f1e3d;
    --blue-accent: #3a7bd5;
    --green-signal: #22a35c;
    --red-signal: #cc2222;
}
*, *::before, *::after { box-sizing: border-box; }
html, body, form { min-height: 100%; }
body { margin: 0; font-family: Inter, "Segoe UI", Arial, sans-serif; background: var(--background); color: var(--foreground); }
button { font: inherit; }
.app-shell { min-height: 100vh; display: flex; }
.sidebar { width: 220px; flex: 0 0 220px; background: #e8eef7; border-right: 1px solid #dbe4ef; display: flex; flex-direction: column; height: 100vh; min-height: 100vh; position: sticky; top: 0; }
.brand { display: flex; justify-content: center; align-items: center; padding: 30px 24px; border-bottom: 1px solid rgba(0, 0, 0, .07); }
.brand img { width: 160px; max-width: 100%; height: auto; display: block; }
.brand .brand-icon { display: none; }
.sidebar-collapse-toggle { position: absolute; right: -11px; bottom: 120px; z-index: 2; display: grid; place-items: center; width: 21px; height: 21px; padding: 0; border: 1px solid #536782; border-radius: 50%; background: #213752; color: #fff; cursor: pointer; }
.sidebar-collapse-toggle svg { width: 12px; height: 12px; }
.sidebar-collapse-toggle:hover { background: #315b8d; }
.sidebar-collapse-toggle:focus-visible { outline: 2px solid var(--blue-accent); outline-offset: 3px; }
.sidebar-nav { flex: 1; padding: 10px 0; overflow-y: auto; }
.nav-item { min-height: 38px; display: flex; align-items: center; gap: 12px; padding: 8px 16px; color: var(--muted-foreground); text-decoration: none; font-size: 14px; font-weight: 500; }
.nav-item.active { color: var(--navy-800); background: rgba(58, 123, 213, .10); border-left: 3px solid var(--blue-accent); padding-left: 13px; }
.nav-item.inactive { cursor: default; }
.nav-icon { width: 20px; flex: 0 0 20px; color: #94a3b8; text-align: center; font-size: 20px; line-height: 1; }
.nav-icon svg { width: 20px; height: 20px; display: block; }
.active .nav-icon { color: var(--blue-accent); }
.nav-parent { width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; }
.nav-parent-label { flex: 1; }
.nav-chevron { width: 14px; height: 14px; color: #94a3b8; transition: transform .2s ease; }
.nav-parent[aria-expanded="false"] .nav-chevron { transform: rotate(-90deg); }
.nav-submenu { margin-bottom: 4px; }
.nav-submenu[hidden] { display: none; }
.nav-sub { padding-left: 44px; padding-right: 8px; gap: 10px; font-size: 12px; min-height: 32px; }
.nav-sub .nav-icon { width: 14px; flex-basis: 14px; }
.nav-sub .nav-icon svg { width: 14px; height: 14px; }
.nav-sub.active { margin: 0 8px 0 32px; padding-left: 12px; border-left: 0; border-radius: 7px; }
.panel-version { flex-shrink: 0; padding: 8px 16px; border-top: 1px solid rgba(0, 0, 0, .07); color: var(--muted-foreground); text-align: center; font-size: 11px; line-height: 16px; white-space: nowrap; }
.sidebar-user { border-top: 1px solid rgba(0, 0, 0, .07); padding: 16px; display: flex; align-items: center; gap: 10px; }
.sidebar-user strong, .sidebar-user small { display: block; }
.sidebar-user strong { font-size: 13px; }
.sidebar-user small { font-size: 11px; color: var(--muted-foreground); margin-top: 2px; }
.avatar { border-radius: 50%; background: var(--blue-accent); color: white; width: 32px; height: 32px; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.logout-link{margin-left:auto;color:var(--muted-foreground);text-decoration:none;font-size:21px;line-height:1}.logout-link:hover{color:var(--blue-accent)}
@media (min-width: 701px) {
    .sidebar { transition: width .25s ease, flex-basis .25s ease; }
    .sidebar-collapsed .sidebar { width: 64px; flex-basis: 64px; }
    .sidebar-collapsed .brand { min-height: 64px; padding: 12px; }
    .sidebar-collapsed .brand .brand-full { display: none; }
    .sidebar-collapsed .brand .brand-icon { display: block; width: 36px; height: 36px; object-fit: contain; }
    .sidebar-collapsed .sidebar-nav > .nav-item { justify-content: center; width: 100%; padding: 9px 0; font-size: 0; }
    .sidebar-collapsed .sidebar-nav > .nav-item.active { padding-left: 0; }
    .sidebar-collapsed .sidebar-nav > .nav-item .nav-icon { flex: 0 0 20px; width: 20px; }
    .sidebar-collapsed .nav-parent-label, .sidebar-collapsed .nav-chevron, .sidebar-collapsed .nav-submenu { display: none; }
    .sidebar-collapsed .panel-version { padding: 8px 2px; font-size: 10px; }
    .sidebar-collapsed .panel-version-label { display: none; }
    .sidebar-collapsed .sidebar-user { justify-content: center; padding: 16px 0; }
    .sidebar-collapsed .sidebar-user > span:not(.avatar), .sidebar-collapsed .logout-link { display: none; }
}
.app-main { min-width: 0; flex: 1; }
.topbar { height: 56px; padding: 0 24px; display: flex; align-items: center; gap: 14px; background: #fff; border-bottom: 1px solid var(--border); box-shadow: 0 1px 4px rgba(0, 0, 0, .06); }
.breadcrumb { display: flex; align-items: center; gap: 9px; font-size: 13px; }
.breadcrumb span { color: var(--muted-foreground); }
.breadcrumb b { color: var(--border); }
.breadcrumb strong { font-size: 14px; }
.connection-state { margin-left: auto; display: flex; align-items: center; gap: 7px; background: #dcfce7; color: #15803d; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.connection-state i { width: 7px; height: 7px; background: #22c55e; border-radius: 50%; }
.connection-state.offline { background: #fee2e2; color: #b91c1c; }
.connection-state.offline i { background: #dc2626; }
.main-content { padding: 24px; }
.dashboard { max-width: 1440px; margin: 0 auto; }
.dashboard-meta { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; margin-bottom: 10px; color: var(--muted-foreground); font-size: 12px; }
.dashboard-meta span { color: var(--navy-800); font-weight: 600; }
.dashboard-alerts { display: grid; grid-template-columns: 150px repeat(2, minmax(0, 1fr)); align-items: center; gap: 12px; padding: 13px 18px; margin-bottom: 16px; }
.dashboard-alerts > strong { font-size: 13px; }
.dashboard-alerts a { display: flex; align-items: center; gap: 9px; min-width: 0; padding: 8px 11px; border-radius: 7px; background: #f3f7fc; color: var(--navy-800); font-size: 12px; text-decoration: none; }
.dashboard-alerts a:hover { background: #e8f0fc; }
.dashboard-alerts a b { font-size: 17px; font-variant-numeric: tabular-nums; }
.dashboard-alert-arrow { margin-left: auto; color: #346cb5; white-space: nowrap; font-weight: 600; }
.dashboard-types { margin-top: 16px; padding: 18px 20px; }
.dashboard-types-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.dashboard-types h2 { margin: 0; font-size: 16px; }
.dashboard-types-head a { color: #346cb5; font-size: 12px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.dashboard-types-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 10px; }
.dashboard-type { display: flex; flex-wrap: wrap; align-items: center; gap: 7px 12px; min-width: 0; padding: 12px 14px; border: 1px solid #dde7f2; border-radius: 8px; background: #f8fafd; color: #5a7090; font-size: 12px; }
.dashboard-type > strong { width: 100%; color: var(--navy-800); font-size: 13px; }
.dashboard-type span b { color: var(--navy-800); font-size: 14px; }
.dashboard-types > p { margin: 12px 0 0; color: var(--muted-foreground); font-size: 11px; }
.data-error { margin: 0 0 16px; padding: 10px 14px; border-radius: 8px; background: #fff3e6; color: #8c4a00; font-size: 13px; }
.data-error[hidden] { display: none; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--card-shadow); }
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { padding: 20px; min-height: 142px; }
.kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted-foreground); font-size: 14px; font-weight: 500; margin-bottom: 12px; }
.kpi-icon { font-size: 22px; font-weight: 500; line-height: 1; }
.kpi-icon svg { width: 20px; height: 20px; display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.kpi-value { display: block; font-size: 30px; line-height: 1.2; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi small { display: block; color: var(--muted-foreground); font-size: 12px; margin-top: 7px; }
.blue { color: var(--blue-accent); }
.green { color: var(--green-signal); }
.red { color: var(--red-signal); }
.chart-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(300px, 2fr); gap: 16px; margin-top: 16px; }
.chart-grid .card { min-height: 390px; padding: 20px; }
.chart-grid h2 { font-size: 16px; line-height: 1.3; margin: 0 0 20px; color: var(--navy-800); }
.floor-card { display: flex; flex-direction: column; }
.floor-list { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 14px; }
.floor-row { display: grid; grid-template-columns: 78px minmax(0, 1fr) 47px; align-items: center; gap: 12px; }
.floor-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.floor-total { font-size: 12px; color: var(--muted-foreground); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stacked-bar { height: 20px; display: flex; overflow: hidden; border-radius: 4px; background: #e8eef7; }
.bar-segment + .bar-segment { border-left: 1px solid white; }
.free, .bar-segment.free { background: #22a35c; }
.no-comm, .bar-segment.no-comm { background: #f5d800; }
.occupied, .bar-segment.occupied { background: #cc2222; }
.legend { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 13px; display: flex; flex-wrap: wrap; gap: 10px 20px; color: var(--muted-foreground); font-size: 12px; }
.legend span, .total-legend span { display: inline-flex; align-items: center; gap: 7px; }
.swatch { display: inline-block; flex: 0 0 11px; width: 11px; height: 11px; border-radius: 2px; }
.total-card { display: flex; flex-direction: column; }
.donut-wrap { flex: 1; display: grid; place-items: center; }
.donut { width: 170px; height: 170px; }
.donut-total { font-size: 26px; font-weight: 700; fill: var(--navy-800); }
.donut-caption { font-size: 11px; fill: var(--muted-foreground); }
.total-legend { display: grid; gap: 10px; font-size: 13px; }
.total-legend > div { display: flex; justify-content: space-between; gap: 10px; }
.total-legend span { color: var(--muted-foreground); }
.total-legend strong { color: var(--navy-800); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.empty-state { margin: 0; color: var(--muted-foreground); font-size: 13px; }
.menu-toggle { display: none; background: transparent; border: 0; color: var(--navy-800); padding: 4px; cursor: pointer; font-size: 20px; }
.sidebar-overlay { display: none; }
@media (max-width: 1050px) { .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .chart-grid { grid-template-columns: 1fr; } }
@media (max-width: 1050px) { .dashboard-alerts { grid-template-columns: 1fr 1fr; } .dashboard-alerts > strong { grid-column: 1 / -1; } }
@media (max-width: 700px) {
    .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 20; transform: translateX(-100%); transition: transform .2s ease; }
    .sidebar-collapse-toggle { display: none; }
    .sidebar.is-open { transform: translateX(0); }
    .sidebar-overlay.is-open { display: block; position: fixed; inset: 0; z-index: 19; background: rgba(10, 22, 40, .5); }
    .menu-toggle { display: block; }
    .main-content { padding: 18px; }
    .kpi-grid { gap: 10px; }
    .kpi { padding: 16px; min-height: 128px; }
    .kpi-top { font-size: 12px; }
    .kpi-value { font-size: 26px; }
    .chart-grid .card { padding: 16px; }
    .dashboard-alerts { grid-template-columns: 1fr; }
    .dashboard-alerts > strong { grid-column: auto; }
}
@media (max-width: 440px) { .kpi-grid { grid-template-columns: 1fr; } .floor-row { grid-template-columns: 65px minmax(0, 1fr) 40px; gap: 7px; } .floor-name, .floor-total { font-size: 11px; } }

/* Control de horario compartido por las estadísticas. */
.stats-schedule { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 9px; min-height: 35px; padding: 5px 8px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.stats-schedule.limited { border-color: var(--blue-accent); }
.oh-page .stats-schedule .stats-check, .dp-page .stats-schedule .stats-check { display: inline-flex; flex-direction: row; align-items: center; gap: 7px; margin: 0; color: var(--navy-800); font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; white-space: nowrap; cursor: pointer; }
.oh-page .stats-schedule .stats-time-label, .dp-page .stats-schedule .stats-time-label { display: inline-flex; flex-direction: row; align-items: center; gap: 5px; margin: 0; color: var(--muted-foreground); font-size: 12px; font-weight: 400; letter-spacing: 0; text-transform: none; white-space: nowrap; }
.oh-page .stats-schedule input[type="checkbox"], .dp-page .stats-schedule input[type="checkbox"] { width: 16px; min-width: 16px; height: 16px; margin: 0; padding: 0; accent-color: var(--blue-accent); }
.oh-page .stats-schedule input[type="time"], .dp-page .stats-schedule input[type="time"] { width: 94px; min-width: 94px; height: 29px; padding: 3px 5px; font-size: 12px; }
.stats-schedule input[type="time"]:disabled { opacity: .5; }
.oh-page .stats-schedule button, .dp-page .stats-schedule button { height: 29px; min-width: 78px; padding: 4px 9px; border: 0; border-radius: 6px; background: #e8eef7; color: var(--muted-foreground); font-size: 12px; font-weight: 600; }
.oh-page .stats-schedule button.dirty, .dp-page .stats-schedule button.dirty { background: var(--blue-accent); color: #fff; }
.stats-schedule .stats-saved { padding: 5px 8px; border-radius: 999px; background: #dcfce7; color: #15803d; font-size: 11px; font-weight: 600; white-space: nowrap; }
.stats-schedule .stats-saved[hidden] { display: none; }

