﻿:root {
  --bg: #F4F6F9;
  --bg-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #f8f9fc;
  --line: #E0E0E0;
  --text: #333333;
  --muted: #888888;
  --blue: #4F84C4;
  --blue-2: #1D4F8F;
  --green: #38a169;
  --red: #E53935;
  --amber: #d69e2e;
  --shadow: 0 1px 3px rgba(0,0,0,.07), 0 4px 14px rgba(0,0,0,.06);
  --radius: 10px;
  --bg-grad: #F4F6F9;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg-grad);
  color: var(--text);
}
.app { display: grid; grid-template-columns: 260px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: #4F84C4;
  border-right: 1px solid #3a6fa8;
  padding: 22px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  color: #ffffff;
}
.brand { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; margin-bottom: 22px; }
.sidebar-logo { width: 100%; height: auto; mix-blend-mode: screen; display: block; cursor: pointer; }
.sidebar-site-label { margin: 0; font-size: 11px; color: #ffffff; }
.nav button, .btn, .input, select, textarea {
  width: 100%; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font: inherit;
}
.nav button {
  text-align: left; padding: 10px 12px; cursor: pointer; margin-bottom: 4px;
  background: transparent; border-color: transparent; color: #ffffff; font-size: 14px;
  display: flex; align-items: center; gap: 10px;
}
.nav button svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav button.active, .nav button:hover {
  background: #1D4F8F; border-color: #1D4F8F; color: #ffffff;
}
.sidebar .btn.ghost { background: rgba(255,255,255,.07); color: #ffffff; border-color: rgba(255,255,255,.12); }
.sidebar .btn.ghost:hover { background: rgba(255,255,255,.13); color: #ffffff; }
.nav-group { margin: 10px 0 4px; }
.nav-group-toggle {
  all: unset; box-sizing: border-box; width: 100%; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px; font-size: 14px; font-weight: 600; color: #fff; cursor: pointer;
}
.nav-group-toggle svg.lead { width: 16px; height: 16px; flex-shrink: 0; }
.nav-group-toggle .chev { margin-left: auto; width: 14px; height: 14px; transition: transform .15s ease; }
.nav-group-toggle[aria-expanded="true"] .chev { transform: rotate(180deg); }
.nav-group-toggle:hover { background: rgba(255,255,255,.10); }
.nav-sub { display: flex; flex-direction: column; gap: 2px; padding: 4px 0 6px 0; margin-left: 0; }
.nav-sub[hidden] { display: none; }
.nav-sub a {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 8px;
  font-size: 13px; color: rgba(255,255,255,.85); text-decoration: none; cursor: pointer;
}
.nav-sub a:hover { background: rgba(255,255,255,.10); }
.nav-sub a svg { width: 16px; height: 16px; flex-shrink: 0; }
.nav-badge {
  margin-left: auto; background: var(--red); color: #fff; font-size: 10.5px; font-weight: 700;
  min-width: 17px; height: 17px; border-radius: 999px; display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.main { padding: 24px; min-width: 0; }
/* Boxes in a grid may be narrower than their content; a wide table then scrolls in its own box. */
.grid > *, .two-col > *, .three-col > *, .form-grid > *, .room-grid > * { min-width: 0; }
.section { display: none; }
.section.active { display: block; }
.topbar { display: flex; justify-content: space-between; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.title h2 { margin: 0; font-size: 28px; }
.title p { margin: 6px 0 0; color: var(--muted); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.btn { padding: 10px 16px; cursor: pointer; transition: .15s ease; width: auto; font-weight: 500; }
.btn:hover { opacity: .88; }
.btn.primary { background: #1D4F8F; border: none; color: #fff; }
.btn.ghost { background: var(--panel); }
.btn.danger { background: rgba(229,62,62,.1); border-color: rgba(229,62,62,.28); color: #9b1c1c; }
/* Tenants page Import CSV menu */
.import-menu { position: relative; }
#importMenuBtn { display: inline-flex; align-items: center; gap: 8px; }
.import-menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 60; width: 340px; max-width: calc(100vw - 32px); padding: 6px; display: grid; gap: 2px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 12px 32px rgba(15,23,42,.16); }
.import-menu-list[hidden] { display: none; }
.import-menu-list button { display: grid; gap: 3px; width: 100%; padding: 10px 12px; text-align: left; background: none; border: 0; border-radius: 8px; color: var(--text); font: inherit; cursor: pointer; }
.import-menu-list button:hover, .import-menu-list button:focus-visible { background: #eef3fa; outline: none; }
.import-menu-list strong { font-size: 14px; font-weight: 600; }
.import-menu-list span { font-size: 12px; line-height: 1.4; color: #6b7280; }
.import-menu-line { height: 1px; margin: 4px 6px; background: var(--line); }
/* Additional charge: the weeks it relates to, ticked in a short scrolling list */
.week-picks { display: grid; gap: 2px; max-height: 170px; overflow-y: auto; padding: 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.week-picks label { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; font-size: 13px; cursor: pointer; }
.week-picks label:hover { background: #f1f5f9; }
.week-picks input { width: 16px; height: 16px; margin: 0; accent-color: #1D4F8F; }
/* Related week as a drop-down: the closed box shows the weeks picked; the list opens under it with a small × top right */
.week-drop > summary { display: block; position: relative; cursor: pointer; list-style: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-right: 30px; }
.week-drop > summary::-webkit-details-marker { display: none; }
.week-drop > summary::after { content: '\25BE'; position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.week-drop-panel { position: relative; margin-top: 6px; }
.week-drop-close { position: absolute; top: 4px; right: 16px; z-index: 1; width: 22px; height: 22px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted); font-size: 16px; line-height: 22px; cursor: pointer; }
.week-drop-close:hover { background: #f1f5f9; color: var(--text); }
/* Admins: Add admin and Admin list fold shut; permissions as grouped switches, each admin a card */
.admin-sections { display: grid; gap: 16px; }
.action-section summary .fold-title { font-size: 16px; font-weight: 700; color: var(--text); }
.action-section summary .fold-title .hint { margin-left: 6px; }
.perm-groups { display: grid; gap: 12px; margin-top: 8px; }
.perm-group { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); overflow: hidden; }
.perm-group-title { padding: 8px 12px; font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: #6b7280; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.perm-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; cursor: pointer; -webkit-user-select: none; user-select: none; }
.perm-row + .perm-row { border-top: 1px solid #eef0f3; }
.perm-row:hover { background: #f8fafd; }
.perm-text { display: grid; gap: 2px; }
.perm-text strong { font-size: 14px; font-weight: 500; }
.perm-text small { font-size: 12px; color: #6b7280; }
input.switch { -webkit-appearance: none; appearance: none; flex-shrink: 0; width: 38px; height: 22px; margin: 0; padding: 0; border: 0; border-radius: 999px; background: #cfd6e0; position: relative; cursor: pointer; transition: background .15s ease; }
input.switch::before { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s ease; }
input.switch:checked { background: #1D4F8F; }
input.switch:checked::before { transform: translateX(16px); }
input.switch:focus-visible { outline: 2px solid #4F84C4; outline-offset: 2px; }
.site-chip { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); cursor: pointer; -webkit-user-select: none; user-select: none; font-size: 14px; }
.site-chip:has(input:checked) { border-color: #1D4F8F; background: #eef3fa; }
.site-chip input { width: 16px; height: 16px; margin: 0; flex-shrink: 0; accent-color: #1D4F8F; cursor: pointer; }
.admin-card { display: flex; gap: 14px; align-items: flex-start; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); }
.admin-avatar { flex-shrink: 0; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #e6eef8; color: #1D4F8F; font-weight: 700; font-size: 14px; }
.admin-main { flex: 1; min-width: 0; display: grid; gap: 6px; }
.admin-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.admin-head strong { font-size: 15px; }
.admin-email { font-size: 13px; color: #6b7280; overflow-wrap: anywhere; }
.admin-tags { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px; align-items: start; }
.admin-tags-label { padding-top: 4px; font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: #6b7280; }
.admin-tag-list { display: flex; flex-wrap: wrap; gap: 4px; }
.admin-tag { padding: 2px 8px; border: 1px solid #e3e8ef; border-radius: 999px; background: #f1f4f8; color: #374151; font-size: 12px; }
.admin-tag.ok { background: #e8f5ee; border-color: #c7e8d4; color: #1f6b43; }
.admin-tag.warn { background: #fdf3e2; border-color: #f2dcb3; color: #8a5a10; }
.admin-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }
.admin-actions .btn { padding: 7px 14px; font-size: 13px; }
/* Reports: a filter bar every report uses, then one card per report with its own choices and button */
.report-scope { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin-bottom: 16px; padding: 14px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.report-scope-title { display: grid; gap: 2px; margin-right: 8px; padding-bottom: 6px; }
.report-scope-title strong { font-size: 15px; }
.report-scope-title span, .report-card-head p { font-size: 12px; color: #6b7280; }
.report-scope .field, .report-card-body .field { gap: 5px; }
.report-scope .field > span, .report-card-body .field > span { font-size: 12px; font-weight: 600; color: #4b5563; }
.report-scope select { min-width: 190px; }
.report-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); gap: 16px; }
.card.report-card { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.report-card-head { display: flex; gap: 12px; align-items: center; padding: 18px 18px 6px; }
.report-card-head h3 { margin: 0; font-size: 16px; }
.report-card-head p { margin: 2px 0 0; }
.report-card-icon { display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; border-radius: 10px; background: #e6eef8; color: #1D4F8F; }
.report-card-body { display: grid; gap: 12px; padding: 12px 18px 18px; }
.report-card-body select, .report-card-body input { width: 100%; }
.report-pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.report-card-body .field { min-width: 0; }
.report-stat { font-size: 13px; color: #4b5563; }
.report-pair:not(:has(> .field:not(:has(> .hide)))) { display: none; }
.report-card-body .field:has(> .hide) { display: none; }
.report-card-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: flex-end; margin-top: auto; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--panel-2); }
.segmented { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; border-radius: 10px; background: #eef2f7; }
.segmented .btn { flex: 1; padding: 7px 10px; border: 0; border-radius: 8px; font-size: 13px; }
.segmented .btn.ghost { background: transparent; color: #4b5563; }
.segmented .btn.primary { background: var(--panel); color: #1D4F8F; box-shadow: 0 1px 3px rgba(0,0,0,.14); }
.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.two-col { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; }
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px;
}
.stat-label { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: .4px; font-weight: 600; }
.stat-value { font-size: 32px; font-weight: 700; margin: 8px 0 4px; }
.stat-sub { color: #4F84C4; font-size: 12px; }
th { color: #333333; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field.full { grid-column: 1 / -1; }
.input, select, textarea { padding: 11px 12px; }
textarea { min-height: 86px; resize: vertical; }
.room-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.room-card {
  padding: 16px; border-radius: var(--radius); background: var(--panel);
  border: 1px solid var(--line); cursor: pointer; transition: .15s ease;
}
.room-card:hover { transform: translateY(-2px); border-color: rgba(56,189,248,.35); }
.room-card.unavailable, .tenant-item.unavailable { border-color: rgba(229,62,62,.5); background: rgba(254,215,215,.45); }
.room-card.available, .tenant-item.available { border-color: rgba(56,161,105,.5); background: rgba(198,246,213,.45); }
.room-card.full { border-color: rgba(214,158,46,.5); background: rgba(253,246,178,.45); }
.pill.unavailable { background: rgba(229,62,62,.1); border-color: rgba(229,62,62,.35); color: #9b1c1c; }
.pill.available { background: rgba(56,161,105,.1); border-color: rgba(56,161,105,.35); color: #276749; }
.site-check-item { cursor: pointer; -webkit-user-select: none; user-select: none; }
.site-check-item input { width: 18px; height: 18px; cursor: pointer; }
.room-top { display: flex; justify-content: space-between; gap: 8px; align-items: flex-start; margin-bottom: 10px; }
.room-top h4 { margin: 0 0 6px; }
.small { font-size: 12px; }
.muted { color: var(--muted); }
.beds { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.bed { padding: 7px 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(56,189,248,.08); font-size: 12px; }
.bed.double { background: rgba(37,99,235,.14); }
.bed.occupied { border-color: rgba(34,197,94,.28); background: rgba(34,197,94,.14); }
.bed.unavailable { border-color: rgba(229,62,62,.5); background: rgba(254,215,215,.45); color: #9b1c1c; }
.tenant-list { display: flex; flex-direction: column; gap: 8px; }
.tenant-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; background: var(--panel-2); }
.split { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; }
.pill { display: inline-flex; border: 1px solid rgba(49,130,206,.2); background: rgba(49,130,206,.08); color: #2c5282; padding: 6px 10px; border-radius: 999px; font-size: 12px; }
.pill.ok { background: #38a169; border-color: #38a169; color: #fff; }
.pill.warn { background: #d69e2e; border-color: #d69e2e; color: #fff; }
.pill.danger { background: #e53e3e; border-color: #e53e3e; color: #fff; }
.missing-clock { border-color: rgba(239,68,68,.4); box-shadow: inset 0 0 0 1px rgba(239,68,68,.14); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.footer-note { margin-top: 10px; color: var(--muted); font-size: 12px; }
.hide { display: none !important; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-wrap { display: flex; flex-direction: column; align-items: center; gap: 20px; width: min(420px, 100%); }
.logo-img { width: 240px; height: auto; mix-blend-mode: screen; display: block; transition: transform .1s ease; }
.logo-img-lg { width: 260px; height: auto; mix-blend-mode: screen; }
.logo-login-btn { background: none; border: none; padding: 0; cursor: pointer; display: block; }
.logo-login-btn:active .logo-img { transform: scale(0.94); }
.login-heading { color: #fff; font-size: 15px; font-weight: 700; margin: 4px 0 0; text-align: center; }
.login-helper { color: rgba(255,255,255,.85); font-size: 11px; margin: 0; text-align: center; }
.login-copyright { color: rgba(255,255,255,.75); font-size: 11px; padding: 10px 0 2px; text-align: center; }
.modal { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; padding: 20px; z-index: 50; background: rgba(2,6,23,.62); }
.modal.open { display: flex; }
.modal-box { width: min(980px, 100%); max-height: 90vh; overflow: auto; }
.inline-buttons { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }

.profile-layout { display: flex; gap: 14px; align-items: flex-start; }
.profile-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.profile-side { width: 250px; flex-shrink: 0; position: sticky; top: 20px; }
.overview-card h3 { margin: 0 0 2px; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); font-weight: 600; }
.overview-row { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.overview-row:last-child { border-bottom: none; }
.overview-row .k { font-size: 11px; color: var(--muted); }
.overview-row .v { font-size: 12px; font-weight: 600; text-align: right; }
.overview-row .v.owed { color: #9b1c1c; }
.overview-divider { height: 1px; background: var(--line); margin: 8px 0; }
.action-section { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: var(--shadow); overflow: hidden; }
.action-section summary {
  cursor: pointer; padding: 11px 14px; font-weight: 600; font-size: 13px; list-style: none;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.action-section summary::-webkit-details-marker { display: none; }
.action-section summary .chev { color: var(--muted); font-size: 11px; transition: transform .15s ease; }
.action-section[open] summary .chev { transform: rotate(90deg); }
.action-section summary .hint { font-size: 11px; color: var(--muted); font-weight: 400; }
.action-section .action-body { padding: 0 14px 14px; border-top: 1px solid var(--line); padding-top: 12px; }
@media (max-width: 900px) { .profile-layout { flex-direction: column; } .profile-side { width: 100%; position: static; } }

.dropdown { position: relative; display: inline-block; }
.dropdown-menu { display: none; position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 230px; z-index: 30; padding: 6px; overflow: hidden; }
.dropdown.open .dropdown-menu { display: block; }
.dropdown-menu button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: none; background: none; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text); font-family: inherit; border-radius: 8px; }
.dropdown-menu button:hover { background: var(--panel-2); }

/* Searchable tick-list combobox -- reuses .dropdown/.dropdown.open's existing show/hide and
   click-outside-to-close mechanics (see events.js); these classes only add the search-combo's
   own layout and internal panel content on top of that. */
.combo-trigger {
  width: 100%; text-align: left; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--panel); color: var(--text); font: inherit; font-size: 13.5px;
  cursor: pointer; display: flex; align-items: center; justify-content: space-between; gap: 8px;
}
.combo-trigger .placeholder { color: var(--muted); }
.combo-trigger .arrow { color: var(--muted); font-size: 11px; transition: transform .15s ease; flex-shrink: 0; }
.dropdown.open .combo-trigger .arrow { transform: rotate(180deg); }
.dropdown.open .combo-trigger { border-color: var(--blue); }
.combo-panel { left: 0; right: 0; width: 100%; min-width: unset; padding: 0; }
.combo-search { padding: 8px; border-bottom: 1px solid var(--line); }
.combo-search input { width: 100%; }
.combo-list { max-height: 260px; overflow-y: auto; padding: 6px; }
.combo-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 7px; cursor: pointer; font-weight: 400; }
.combo-row:hover { background: var(--panel-2); }
.combo-row input { width: 16px; height: 16px; flex-shrink: 0; cursor: pointer; }
.combo-row-meta { font-size: 11.5px; color: var(--muted); margin-left: auto; text-align: right; }
.combo-footer { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px; border-top: 1px solid var(--line); background: var(--panel-2); font-size: 12px; color: var(--muted); }
.combo-footer button { display: inline; width: auto; border: none; background: none; color: var(--blue-2); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; padding: 0; }
.combo-footer button:hover { background: none; text-decoration: underline; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { display: flex; align-items: center; gap: 6px; background: var(--panel-2); color: var(--blue-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 6px 5px 12px; font-size: 12.5px; font-weight: 500; }
.chip button { border: none; background: rgba(0,0,0,.08); color: inherit; width: 16px; height: 16px; border-radius: 50%; cursor: pointer; font-size: 11px; line-height: 1; display: flex; align-items: center; justify-content: center; padding: 0; }
.chip button:hover { background: rgba(0,0,0,.16); }

.site-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.site-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; cursor: pointer; transition: .15s ease; }
.site-card:hover { transform: translateY(-2px); border-color: rgba(56,189,248,.35); }
.site-card .site-card-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.site-card h4 { margin: 0; font-size: 15px; }
.site-card-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.site-card-stats .num { font-size: 17px; font-weight: 700; line-height: 1.1; }
.site-card-stats .lbl { font-size: 10.5px; color: var(--muted); margin-top: 2px; text-transform: uppercase; letter-spacing: .3px; }
.site-card .unavail-flag { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11px; color: #9b1c1c; font-weight: 600; }
.region-block { margin-bottom: 22px; }
.region-block .region-title { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.region-block h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin: 0; font-weight: 700; }
.region-block .region-line { flex: 1; height: 1px; background: var(--line); }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: #1D4F8F; font-size: 13px; font-weight: 700; cursor: pointer; }

.sub-room-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; margin: 10px 0 5px; }
.sub-room-label:first-of-type { margin-top: 0; }
.empty-slot { border: 1px dashed var(--line); border-radius: 7px; padding: 6px 9px; font-size: 11.5px; color: var(--muted); text-align: center; }

.occ-row { display: flex; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; margin-bottom: 6px; background: var(--panel-2); }
.occ-row .bed-tag { font-size: 10px; font-weight: 700; color: var(--muted); background: var(--panel); border: 1px solid var(--line); padding: 2px 7px; border-radius: 5px; flex-shrink: 0; width: 34px; text-align: center; }
.occ-row .occ-name { font-weight: 600; font-size: 13px; flex: 1; }
.occ-row.is-empty .occ-name { color: var(--muted); font-weight: 400; font-style: italic; }
.occ-room-label { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; margin: 14px 0 7px; }
.occ-room-label:first-of-type { margin-top: 0; }
.add-result-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; margin-bottom: 6px; }
.add-result-row .name { font-weight: 600; font-size: 12.5px; }
.add-result-row .meta { font-size: 11px; color: var(--muted); flex: 1; }

/* Dashboard > Previous week > Yearly view; on a phone a chart scrolls sideways in its own box. */
.yv-controls { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.yv-controls .field { min-width: 120px; }
.yv-controls .yv-region { min-width: 220px; }
.yv-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-left: auto; }
.yv-note { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; }
.yv-refresh { padding: 2px 10px; font-size: 12px; margin-left: 6px; }
.yv-tiles { margin-top: 16px; }
.yv-card { margin-top: 16px; }
.yv-title { font-size: 15px; font-weight: 700; }
.yv-card-note { margin: 2px 0 10px; }
.yv-sub { font-size: 12px; font-weight: 600; color: #52514e; margin: 14px 0 0 48px; }
.yv-scroll { overflow-x: auto; }
.yv-chart { display: block; width: 100%; min-width: 720px; height: auto; }
.yv-tick { font-size: 11px; fill: #898781; font-variant-numeric: tabular-nums; }
.yv-now { fill: #52514e; font-weight: 600; }
.yv-end { font-size: 12px; font-weight: 600; fill: #0b0b0b; }
.yv-end.muted { fill: #52514e; }
.yv-hit { fill: transparent; cursor: crosshair; }
.yv-hit:hover { fill: rgba(11, 11, 11, 0.05); }
.yv-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-bottom: 6px; font-size: 12px; color: #52514e; }
.yv-legend span, .yv-tip-row { display: inline-flex; align-items: center; gap: 6px; }
.yv-legend i, .yv-tip-row i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; }
.yv-legend i.line { height: 3px; width: 16px; border-radius: 2px; }
.yv-legend i.line.dashed { background: repeating-linear-gradient(90deg, #52514e 0 6px, transparent 6px 10px); }
.yv-legend i.hatch, .yv-tip-row i.hatch { background: repeating-linear-gradient(45deg, #a3a19b 0 2px, #eeede8 2px 5px); }
.yv-loading { display: flex; align-items: center; gap: 12px; color: #52514e; }
.yv-loading-bar { width: 80px; height: 4px; border-radius: 2px; background: linear-gradient(90deg, #e1e0d9 0%, #2a78d6 50%, #e1e0d9 100%); background-size: 200% 100%; animation: yv-load 1.2s linear infinite; }
@keyframes yv-load { from { background-position: 100% 0; } to { background-position: -100% 0; } }
#yearlyCharts.yv-busy { opacity: 0.5; transition: opacity .2s; }
/* The week box by the pointer ("hidden" works because no display is set here). */
.yv-tip { position: fixed; z-index: 1000; min-width: 190px; max-width: 280px; padding: 10px 12px; background: #fff; border: 1px solid rgba(11, 11, 11, 0.10); border-radius: 8px; box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12); font-size: 12px; color: #0b0b0b; pointer-events: none; }
.yv-tip-h { font-weight: 700; margin-bottom: 6px; }
.yv-tip-row { display: flex; width: 100%; margin: 2px 0; }
.yv-tip-row span { flex: 1; color: #52514e; }
.yv-tip-row b { font-variant-numeric: tabular-nums; }
.yv-tip-sep { border-top: 1px solid #e1e0d9; margin: 6px 0; }
.yv-tip-note { margin-top: 6px; color: #898781; font-style: italic; }
.yv-table-wrap { overflow-x: auto; }
.yv-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.yv-table th { text-align: right; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: #898781; font-weight: 600; padding: 8px 10px; border-bottom: 1px solid #c3c2b7; white-space: nowrap; }
.yv-table td { text-align: right; padding: 8px 10px; border-bottom: 1px solid #e1e0d9; font-variant-numeric: tabular-nums; white-space: nowrap; }
.yv-table th:first-child, .yv-table td:first-child { text-align: left; }
.yv-row { cursor: pointer; }
.yv-row:hover td, .yv-row.on td { background: rgba(42, 120, 214, 0.07); }
.yv-total td { font-weight: 700; border-top: 2px solid #c3c2b7; border-bottom: 0; }
.yv-section { margin: 24px 0 4px; font-size: 16px; font-weight: 700; }
/* The per-site switch: one button per site, the one shown is filled. */
.yv-switch { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 0; }
.yv-pill { border: 1px solid #c3c2b7; background: #fff; color: #0b0b0b; border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; cursor: pointer; }
.yv-pill:hover { border-color: #2a78d6; }
.yv-pill.on { background: #1d4f8f; border-color: #1d4f8f; color: #fff; }
@media (max-width: 820px) { .yv-actions { margin-left: 0; } .yv-controls .field { flex: 1 1 100%; } }

@media (max-width: 1100px) { .two-col, .three-col, .room-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 820px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .main { padding: 12px; }
  /* On a phone the page fits the screen: wide tables scroll sideways in their own box, and
     side-by-side blocks drawn by the page stack in one column. */
  .main table { display: block; overflow-x: auto; }
  .main [style*="grid-template-columns"] { grid-template-columns: minmax(0, 1fr) !important; }
  .sidebar { position: relative; height: auto; }
  .form-grid, .two-col, .three-col, .room-grid { grid-template-columns: 1fr; }
  .admin-card { flex-wrap: wrap; }
  .admin-actions { flex-direction: row; }
  .report-scope select { min-width: 0; width: 100%; }
  .report-scope .field { flex: 1 1 100%; }
}
/* On a phone the Tenants and Leavers tables show each row as a card: one line per field with its
   label, empty fields hidden. On a laptop they stay tables. */
@media (max-width: 820px) {
  .main table.phone-cards { display: block; overflow: visible; }
  .phone-cards tbody, .phone-cards tr, .phone-cards td { display: block; width: 100%; box-sizing: border-box; }
  .phone-cards thead { display: none; }
  .phone-cards tr { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 10px; background: var(--panel); }
  .phone-cards td { border: 0; padding: 3px 0; }
  .phone-cards td:empty { display: none; }
  .phone-cards td[data-label]::before { content: attr(data-label) ': '; font-weight: 600; color: var(--muted); }
}
@media print {
  body * { visibility: hidden; }
  #reportBox, #reportBox * { visibility: visible; }
  #reportBox { position: absolute; left: 0; top: 0; width: 100%; }
}
  
.pie-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(220px,1fr)); gap:14px; }
.pie-card { padding:14px; border:1px solid var(--line); border-radius:16px; background:var(--panel); box-shadow:var(--shadow); overflow:hidden; min-width:0; }
.pie-wrap { display:flex; align-items:center; gap:14px; min-width:0; }
.pie-chart { width:88px; height:88px; border-radius:50%; flex:0 0 88px; border:5px solid #fff; box-shadow:0 0 0 1px var(--line); overflow:hidden; }
.pie-legend { display:grid; gap:6px; font-size:12px; flex:1; min-width:0; overflow:hidden; }
.pie-legend div { display:flex; align-items:center; justify-content:space-between; gap:6px; min-width:0; }
.pie-legend div span { display:flex; align-items:center; min-width:0; overflow:hidden; white-space:nowrap; text-overflow:ellipsis; flex:1; }
.pie-legend div strong { white-space:nowrap; flex-shrink:0; }
.pie-legend span.swatch { width:9px; height:9px; border-radius:50%; display:inline-block; margin-right:5px; flex-shrink:0; }
.details-stack { display:grid; gap:10px; }
.details-panel { border:1px solid var(--line); border-radius:14px; padding:10px 12px; background:var(--card); }
.details-panel summary { cursor:pointer; font-weight:700; }
@keyframes pulse { 0%,100%{opacity:1;transform:scale(1)} 50%{opacity:.6;transform:scale(.94)} }
#loadingOverlay { position:fixed;inset:0;background:#4F84C4;display:flex;align-items:center;justify-content:center;z-index:9999;flex-direction:column;gap:18px;color:#fff; }
#loadingOverlay .occupy-logo { width:64px;height:64px;animation:pulse 1.4s ease-in-out infinite; }
.login-shell { background:#4F84C4; }
.login-box .brand h1 { color:#1a202c; font-size:20px; }
.login-box .brand p { color:#718096; }
.login-logo { width:44px;height:44px; }
#syncBanner { position:fixed;bottom:16px;right:16px;background:rgba(34,197,94,.15);border:1px solid rgba(34,197,94,.35);color:#bbf7d0;padding:10px 16px;border-radius:12px;font-size:13px;z-index:999;display:none; }
#reportDownloadBanner { position:fixed;bottom:64px;right:16px;background:rgba(34,197,94,.15);border:1px solid rgba(34,197,94,.35);color:#bbf7d0;padding:10px 16px;border-radius:12px;font-size:13px;z-index:999;display:none; }
#inactivityBanner { position:fixed;bottom:16px;left:50%;transform:translateX(-50%);background:rgba(245,158,11,.15);border:1px solid rgba(245,158,11,.45);color:#fde68a;padding:12px 20px;border-radius:12px;font-size:13px;z-index:1000;display:none;text-align:center; }

