:root {
  --bg: #f4f5f2; --surface: #ffffff; --surface-2: #f0f1ed; --line: #dfe1da; --text: #1d211c; --muted: #646b60;
  --brand: #17624f; --brand-ink: #ffffff; --danger: #b3261e; --warn: #8a5a00; --ok: #17624f;
  --vacant: #d5efe0; --vacant-ink: #0f5135; --occupied: #d7e3f6; --occupied-ink: #1e3f78;
  --reserved: #fbeac4; --reserved-ink: #6e4a00; --maint: #f8d9d4; --maint-ink: #8c2118; --inactive: #e4e4e0; --inactive-ink: #555;
  --radius: 8px; --shadow: 0 1px 2px rgb(0 0 0 / 6%);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1 { font-size: 22px; margin: 0; } h2 { font-size: 17px; margin: 0 0 10px; } h3 { font-size: 15px; margin: 0 0 8px; }
a { color: var(--brand); }
.muted { color: var(--muted); } .small { font-size: 13px; } .right { text-align: right; } .nowrap { white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }

.shell { display: grid; grid-template-columns: 226px minmax(0, 1fr); min-height: 100vh; }
.side { background: #16261f; color: #dfe8e3; padding: 14px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { font-weight: 700; font-size: 16px; padding: 6px 10px 14px; color: #fff; }
.side a { display: block; color: inherit; text-decoration: none; padding: 8px 10px; border-radius: 6px; }
.side a:hover { background: rgb(255 255 255 / 8%); }
.side a.active { background: #2a4c3e; color: #fff; }
.side .badge { float: right; background: #f2b84b; color: #2b2000; border-radius: 10px; font-size: 12px; padding: 0 7px; font-weight: 600; }
.side .who { margin-top: 14px; border-top: 1px solid rgb(255 255 255 / 15%); padding: 12px 10px 0; font-size: 13px; }
.side .who button { background: none; border: 0; color: #fff; text-decoration: underline; padding: 0; cursor: pointer; font-size: 13px; }
.main { padding: 22px; min-width: 0; }
.topbar { display: none; }
.head { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); margin-bottom: 14px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 14px; }
.grid2 { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 21px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat.alert .value { color: var(--danger); }
.chart-box { position: relative; height: 240px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 600; border-bottom: 1px solid var(--line); padding: 7px 8px; white-space: nowrap; }
td { border-bottom: 1px solid var(--surface-2); padding: 8px; vertical-align: top; }
tr.click { cursor: pointer; } tr.click:hover td { background: var(--surface-2); }
.empty { color: var(--muted); padding: 18px 8px; text-align: center; }

button, .btn { font: inherit; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 7px 12px; border-radius: 6px; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .btn:hover { background: var(--surface-2); }
button.primary, .btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
button.primary:hover { filter: brightness(1.1); }
button.danger { color: var(--danger); border-color: var(--danger); }
button:disabled { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }

label.field { display: block; margin-bottom: 10px; font-size: 13px; color: var(--muted); }
label.field > input, label.field > select, label.field > textarea { display: block; width: 100%; margin-top: 3px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--surface); padding: 7px 9px; border: 1px solid #c9ccc3; border-radius: 6px; max-width: 100%; }
textarea { min-height: 72px; }
label.check { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 10px; font-size: 14px; }
label.check input { margin-top: 3px; }
.form-grid { display: grid; gap: 0 12px; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.section-title { font-weight: 600; margin: 8px 0; font-size: 14px; }

.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 10px; background: var(--surface-2); white-space: nowrap; font-weight: 550; }
.pill.good { background: var(--vacant); color: var(--vacant-ink); } .pill.warn { background: var(--reserved); color: var(--reserved-ink); }
.pill.bad { background: var(--maint); color: var(--maint-ink); } .pill.info { background: var(--occupied); color: var(--occupied-ink); }

.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; font-size: 13px; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.legend i { width: 14px; height: 14px; border-radius: 3px; display: inline-block; border: 1px solid rgb(0 0 0 / 15%); }
.floor { display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 8px; margin-bottom: 8px; align-items: start; }
.floor .fl { color: var(--muted); font-size: 13px; padding-top: 8px; }
.units { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 8px; }
.unit { text-align: left; border-radius: 7px; padding: 8px 9px; border: 1px solid rgb(0 0 0 / 12%); min-height: 76px; display: block; width: 100%; }
.unit b { display: block; } .unit span { display: block; font-size: 12.5px; }
.VACANT { background: var(--vacant); color: var(--vacant-ink); }
.OCCUPIED { background: var(--occupied); color: var(--occupied-ink); }
.RESERVED { background: var(--reserved); color: var(--reserved-ink); }
.UNDER_MAINTENANCE { background: var(--maint); color: var(--maint-ink); }
.INACTIVE { background: var(--inactive); color: var(--inactive-ink); }
.unit:hover { filter: brightness(.97); }

.modal-back { position: fixed; inset: 0; background: rgb(0 0 0 / 45%); display: flex; justify-content: center; align-items: flex-start; padding: 28px 14px; overflow-y: auto; z-index: 20; }
.modal { background: var(--surface); border-radius: 10px; width: 100%; max-width: 640px; padding: 18px; }
.modal.wide { max-width: 1040px; }
.modal-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 12px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
#toast-root { position: fixed; right: 14px; bottom: 14px; z-index: 30; display: grid; gap: 8px; max-width: min(360px, calc(100vw - 28px)); }
.toast { background: #16261f; color: #fff; padding: 10px 13px; border-radius: 7px; }
.toast.error { background: var(--danger); }
.notice { background: var(--reserved); color: var(--reserved-ink); padding: 9px 12px; border-radius: 6px; margin-bottom: 12px; font-size: 14px; }
.notice.bad { background: var(--maint); color: var(--maint-ink); }
.notice.good { background: var(--vacant); color: var(--vacant-ink); }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 3px 14px; }
.kv dt { color: var(--muted); font-size: 13px; } .kv dd { margin: 0; overflow-wrap: anywhere; }
.review { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.review img, .review iframe { width: 100%; max-height: 560px; object-fit: contain; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-2); }
.review iframe { height: 520px; }
.secret { font-family: ui-monospace, Consolas, monospace; background: var(--surface-2); padding: 8px 10px; border-radius: 6px; overflow-wrap: anywhere; }

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login { width: 100%; max-width: 380px; }

@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; z-index: 15; left: 0; width: 240px; transform: translateX(-100%); transition: transform .15s; }
  .side.open { transform: none; }
  .topbar { display: flex; align-items: center; gap: 10px; background: #16261f; color: #fff; padding: 10px 14px; position: sticky; top: 0; z-index: 10; }
  .topbar button { background: none; color: #fff; border-color: rgb(255 255 255 / 35%); }
  .main { padding: 14px 16px; }
  .grid2, .review { grid-template-columns: minmax(0, 1fr); }
}
@media print {
  .side, .topbar, .actions, .filters, button { display: none !important; }
  .shell { display: block; } .card { border: 0; box-shadow: none; }
}
