:root {
  color-scheme: light;
  --blue-deep: #07519c;
  --blue: #1475df;
  --blue-bright: #1683d4;
  --teal: #1f8f6e;
  --ink: #163b68;
  --muted: #58718f;
  --line: #d7e5f5;
  --panel-head-bg: #e3f0ff;
  --panel-head-text: #075bb5;
  --table-font: clamp(14px, 1.05vw, 19px);
  --control-font: clamp(12px, .85vw, 16px);
  --row-height: clamp(18px, 2.6vh, 32px);
  font-family: "Segoe UI", "Nunito Sans", Arial, sans-serif;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-width: 320px; height: 100%; }
body { background: #f3f7fc; color: var(--ink); }
button, input, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 10; top: 8px; left: 8px; padding: 9px 14px; background: white; border-radius: 8px; transform: translateY(-150%); }
.skip-link:focus { transform: none; }
.container { width: min(100% - 32px, 2400px); margin-inline: auto; }
.content { display: flex; flex-direction: column; height: 100vh; height: 100dvh; min-height: 0; gap: 12px; padding-block: 12px; }

/* ---- Header gradient (matches simgos dashboard) ---- */
.page-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(115deg, #07519c, #1683d4);
  flex: none;
}
.page-heading-title, .heading-side { display: flex; align-items: center; gap: 14px; min-width: 0; }
.page-heading-title img { width: 44px; height: 44px; object-fit: contain; flex: none; }
.page-heading-title h1 { margin: 0; color: #fff; font-size: clamp(20px, 2vw, 28px); line-height: 1.2; font-weight: 700; letter-spacing: -.02em; }
.brand-logo { display: block; width: 126px; height: 44px; object-fit: contain; }
.snapshot-time { display: inline-flex; align-items: center; gap: 6px; color: #d9ebff; font-size: 12px; white-space: nowrap; }
.snapshot-time strong { color: #fff; }
.snapshot-time svg { width: 15px; height: 15px; color: #d9ebff; }

.overview { flex: none; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 14px;
  min-width: 0;
  min-height: 0;
  padding: 12px 16px;
  color: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px #173e6814;
  overflow: hidden;
}
.stat-total { background: linear-gradient(135deg, #1680ed, #079be6); }
.stat-available { background: linear-gradient(135deg, #00a888, #00b99a); }
.stat-occupied { background: linear-gradient(135deg, #ff981b, #ffb332); }
.stat-bor { background: linear-gradient(135deg, #7552e9, #8d6bf0); }
.stat-top { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-width: 0; color: #ffffffdd; font-size: 12px; font-weight: 700; }
.stat-icon { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: #ffffff26; border: 1px solid #ffffff45; color: #fff; flex: none; }
.stat-icon svg { width: 20px; height: 20px; }
.stat-number { font-size: clamp(22px, 1.8vw, 28px); line-height: 1; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat-foot { display: none; }
.mini-dot { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: #bfffe8; }

/* ---- Panel layout ---- */
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1fr) clamp(200px, 18vw, 320px); gap: 14px; flex: 1 1 auto; min-height: 0; }
.panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 2px 6px #173e680a; }
.panel-header { flex: none; padding: 14px 17px; background: var(--panel-head-bg); border-bottom: 1px solid #cbdff4; }
.panel-header h2 { margin: 0; color: var(--panel-head-text); font-size: clamp(17px, 1.25vw, 22px); line-height: 1.3; font-weight: 700; }
.data-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding-block: 2px; }
.export-button { display: inline-flex; align-items: center; gap: 5px; flex: none; padding: 7px 11px; background: #fff; color: #124e8d; border: 1px solid #bfd6f1; border-radius: 8px; font-size: var(--control-font); font-weight: 700; }
.export-button:hover { background: #edf5ff; }
.export-button:disabled { cursor: not-allowed; opacity: .5; }
.export-button svg { width: 14px; height: 14px; }
.filters { display: flex; align-items: center; gap: 8px; padding: 12px 15px 4px; flex: none; }
.search-box { position: relative; flex: 1; min-width: 0; }
.search-box > svg { position: absolute; left: 10px; top: 50%; width: 14px; height: 14px; transform: translateY(-50%); color: #8791a0; pointer-events: none; }
.search-box input, .select-wrap select { width: 100%; height: 2.2em; border: 1px solid #cbdced; border-radius: 8px; background: #fff; color: #163b68; font-size: var(--control-font); }
.search-box input { padding: 0 10px 0 30px; }
.search-box input::placeholder { color: #8791a0; }
.select-wrap { position: relative; width: 10em; font-size: var(--control-font); flex: none; }
.select-wrap select { appearance: none; padding: 0 25px 0 9px; cursor: pointer; }
.select-wrap svg { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 13px; height: 13px; pointer-events: none; }
.table-toolbar { display: flex; justify-content: space-between; align-items: center; flex: none; gap: 8px; height: 2.3em; font-size: var(--control-font); padding: 0 15px; border-top: 1px solid #f0f1ee; }
.filter-tabs { display: flex; gap: 17px; align-self: stretch; }
.tab { position: relative; border: 0; background: transparent; padding: 0; color: #52769b; font-size: inherit; font-weight: 700; }
.tab:hover, .tab.active { color: var(--blue); }
.tab.active::after { content: ""; position: absolute; bottom: 0; left: 0; right: 0; height: 2px; background: var(--blue); }
.result-count { color: #52769b; font-size: inherit; white-space: nowrap; }
.table-scroll { flex: 1 1 auto; min-height: 0; overflow: auto; scrollbar-color: #cbd6df #f7f8f5; }
table { width: 100%; min-width: 600px; border-collapse: collapse; text-align: left; font-size: var(--table-font); line-height: 1.3; }
thead { position: sticky; top: 0; z-index: 1; background: #e8f3ff; color: #174574; }
th { height: var(--row-height); padding: 4px 10px; white-space: nowrap; font-size: .82em; font-weight: 700; }
th:first-child, td:first-child { padding-left: 15px; }
th:last-child, td:last-child { padding-right: 15px; }
td { height: var(--row-height); padding: 0 10px; border-top: 1px solid #eef3f9; color: #39463d; font-variant-numeric: tabular-nums; white-space: nowrap; }
tbody tr:nth-child(even) { background: #f3f8fe; }
.room-row { background: #fff; }
.room-row:hover { background: #e7f2ff; }
.row-number { color: #39463d; }
.room-name { color: #163b68; font-weight: 700; }
.class-name { font-weight: 600; }
.numeric { text-align: center; }
.available-number { display: inline-flex; justify-content: center; min-width: 25px; padding: 0 5px; color: #087443; background: #e8f8ef; border-radius: 5px; font-weight: 700; }
.available-number.zero { color: #9b4045; background: #fbeced; }
.bor-cell { min-width: 82px; }
.bor-value { color: #3e5048; font-weight: 700; }
.bor-value.high, .occupancy-item.high .occupancy-label strong { color: #b91c1c; }
.bor-value.low, .occupancy-item.low .occupancy-label strong { color: #147453; }
.bor-value.medium, .occupancy-item.medium .occupancy-label strong { color: #c99600; }
.bor-track { display: inline-block; vertical-align: middle; width: 2.5em; height: 4px; margin-left: 6px; background: #e9eee9; border-radius: 20px; overflow: hidden; }
.bor-fill { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.bor-fill.high, .occupancy-item.high .occupancy-fill, .legend-high { background: #b91c1c; }
.bor-fill.low, .occupancy-item.low .occupancy-fill, .legend-low { background: #147453; }
.bor-fill.medium, .occupancy-item.medium .occupancy-fill, .legend-medium { background: #E1D20B; }
.empty-row td { height: 50px; text-align: center; white-space: normal; color: var(--muted); }
.table-footer { display: flex; align-items: center; min-height: 26px; padding: 4px 15px; color: #52769b; font-size: var(--control-font); border-top: 1px solid var(--line); flex: none; }
.occupancy-panel .panel-header { padding-bottom: 8px; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; padding: 10px 15px 8px; font-size: clamp(10px, .72vw, 14px); color: #58718f; font-weight: 700; }
.chart-legend > span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.occupancy-list { display: grid; align-content: space-around; flex: 1 1 auto; min-height: 0; padding: 0 15px 8px; overflow-y: auto; }
.occupancy-item { min-width: 0; padding: 4px 6px; border-radius: 6px; }
.occupancy-label { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 3px; font-size: clamp(13px, .95vw, 20px); font-weight: 700; }
.occupancy-label strong { font-variant-numeric: tabular-nums; color: #3e5048; }
.occupancy-track { width: 100%; height: 6px; border-radius: 999px; background: #edf1ec; overflow: hidden; }
.occupancy-fill { display: block; height: 100%; border-radius: inherit; background: var(--teal); }
.occupancy-meta { margin-top: 2px; color: #39463d; font-size: clamp(11px, .8vw, 16px); }
.chart-empty { color: var(--muted); font-size: 11px; text-align: center; }
.page-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 14px; flex: none; color: #7890a9; font-size: 11px; }
.view-switch { display: none; }
@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr) 190px; }
  .brand-logo { width: 105px; }
  .stat-card { padding-inline: 14px; }
}
@media (max-width: 700px) {
  .filters { flex-wrap: wrap; }
  .filters .search-box { flex: 1 0 100%; }
  .filters .select-wrap { flex: 1; width: auto; min-width: 0; }
  .content { gap: 10px; }
  .page-heading { padding: 16px 18px; }
  .page-heading-title img { width: 34px; height: 34px; }
  .brand-logo { display: none; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat-card { padding: 10px 14px; gap: 12px; }
  .stat-top { font-size: 11px; }
  .stat-icon { width: 34px; height: 34px; }
  .stat-icon svg { width: 17px; height: 17px; }
  .stat-number { font-size: 24px; }
  .stat-foot { display: none; }
  .view-switch { display: flex; flex: none; gap: 5px; }
  .view-button { flex: 1; padding: 7px; border: 1px solid var(--line); border-radius: 8px; background: white; color: #124e8d; font-size: 11px; font-weight: 700; }
  .view-button.active { background: #1475df; border-color: #1475df; color: white; }
  .dashboard-grid { display: flex; min-height: 0; }
  .dashboard-grid .panel { width: 100%; }
  .dashboard-grid[data-view="data"] .occupancy-panel, .dashboard-grid[data-view="chart"] .data-panel { display: none; }
  .page-footer { font-size: 9px; }
}
@media (max-width: 480px) {
  .container { width: calc(100% - 20px); }
  .content { padding-block: 10px 7px; }
  .page-heading { min-height: 31px; flex-wrap: wrap; gap: 0; }
  .page-heading-title h1 { font-size: 18px; }
  .snapshot-time { font-size: 9px; }
  .snapshot-time svg { display: none; }
  .heading-side { width: 100%; margin-left: 48px; }
  .page-footer span:first-child { display: none; }
}
@media (max-height: 640px) {
  .content { gap: 8px; padding-block: 8px 4px; }
  .page-heading { min-height: 32px; padding-block: 12px; }
  .brand-logo { height: 32px; }
  .stat-card { padding-block: 8px; }
  .stat-foot { display: none; }
  .stat-number { margin-top: 0; font-size: 22px; }
  .page-footer { display: none; }
  .occupancy-meta { display: none; }
}
@media (min-width: 701px) and (max-height: 800px) {
  .page-footer { display: none; }
}
@media (max-height: 450px) {
  .stat-icon, .chart-legend { display: none; }
  .occupancy-label { margin-bottom: 2px; }
  .occupancy-track { height: 4px; }
}

/* Keep the summary compact so the room table receives the available height. */
.content { gap: 6px; padding-block: 6px; }
.page-heading { padding-block: 8px; }
.stat-card { padding: 6px 12px; gap: 8px; justify-content: space-between; border-radius: 8px; }
.stat-top { flex-direction: row; align-items: center; font-size: clamp(14px, 1.05vw, 21px); line-height: 1.15; }
.stat-icon { display: none; }
.stat-number { font-size: clamp(26px, 1.9vw, 38px); }
.filters { padding-block: 5px 3px; }
.table-toolbar { height: 2em; }
.table-footer { min-height: 20px; padding-block: 2px; }
th { padding-block: 2px; }
:root { --table-font: clamp(16px, 1.15vw, 23px); }
.data-panel table { line-height: 1.05; }
.data-panel td { padding-block: 0; }
.data-panel th { font-size: .9em; }

@media (min-width: 701px) and (max-height: 800px) {
  :root { --table-font: 16px; --row-height: 20px; }
  .page-heading-title h1 { font-size: 20px; }
  .page-heading-title img { width: 34px; height: 34px; }
}
@media (max-width: 700px) {
  .stats-grid { gap: 5px; }
  .stat-card { padding: 5px 8px; }
  .stat-number { font-size: 20px; }
}

