:root {
  --bg: #f6f7f9; --surface: #fff; --text: #17202a; --muted: #5b6673; --border: #d5dae1;
  --primary: #1f4e8c; --primary-text: #fff; --danger: #a4262c; --ok: #1d6b3a; --warn: #8a5a00;
  --focus: #f0b400; --radius: 6px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 16px; line-height: 1.45;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
a { color: var(--primary); }
main:focus { outline: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.skip { position: absolute; left: -999px; top: 0; background: #000; color: #fff; padding: 8px; z-index: 10; }
.skip:focus { left: 8px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.top { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 600; }
.brand-mark { background: var(--primary); color: #fff; padding: 2px 8px; border-radius: 4px; letter-spacing: .05em; }
.top-right { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.badge { background: #fff4d6; color: #5c3d00; border: 1px solid #e3c36b; padding: 2px 10px; border-radius: 999px; font-size: .85rem; font-weight: 600; }
.nav { display: flex; gap: 4px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--border); overflow-x: auto; }
.nav a { padding: 10px 14px; text-decoration: none; color: var(--muted); border-bottom: 3px solid transparent; white-space: nowrap; }
.nav a[aria-current="page"] { color: var(--text); border-bottom-color: var(--primary); font-weight: 600; }
main { padding: 20px; max-width: 1280px; margin: 0 auto; }
h1 { font-size: 1.4rem; margin: 0 0 12px; }
h2 { font-size: 1.15rem; margin: 18px 0 8px; }
h3 { font-size: 1rem; margin: 14px 0 6px; }
.muted { color: var(--muted); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: .9rem; font-weight: 500; }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid #9aa4b1; border-radius: 4px; background: #fff; color: var(--text); min-height: 38px; }
textarea { min-height: 140px; width: 100%; font-family: ui-monospace, monospace; font-size: .85rem; }
.btn { font: inherit; padding: 7px 14px; border-radius: 4px; border: 1px solid var(--primary); background: #fff; color: var(--primary); cursor: pointer; min-height: 38px; }
.btn.primary { background: var(--primary); color: var(--primary-text); }
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn.ghost { border-color: var(--border); color: var(--text); }
.btn.small { padding: 3px 10px; min-height: 32px; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .85rem; color: var(--muted); font-weight: 600; background: #eef1f5; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .8rem; font-weight: 600; border: 1px solid; }
.pill.available, .pill.active, .pill.success, .pill.completed { color: var(--ok); border-color: #8cc5a0; background: #eaf6ee; }
.pill.partial, .pill.reserved, .pill.out_of_service, .pill.rejected { color: var(--warn); border-color: #e0bf73; background: #fff6e0; }
.pill.occupied, .pill.in_residence { color: var(--primary); border-color: #9bb5d9; background: #eaf0f9; }
.pill.unavailable, .pill.inactive, .pill.cancelled, .pill.denied, .pill.transferred { color: #4a4a4a; border-color: #bbb; background: #f1f1f1; }
.pill.overdue { color: var(--danger); border-color: #e3a1a4; background: #fbeaea; }
.summary { display: flex; gap: 16px; flex-wrap: wrap; margin: 8px 0 14px; }
.summary div { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 14px; min-width: 110px; }
.summary strong { display: block; font-size: 1.3rem; }
.flash { max-width: 1280px; margin: 10px auto 0; padding: 0 20px; }
.flash .msg { padding: 10px 14px; border-radius: var(--radius); border: 1px solid; }
.flash .ok { background: #eaf6ee; border-color: #8cc5a0; }
.flash .err { background: #fbeaea; border-color: #e3a1a4; }
.error { color: var(--danger); min-height: 1.2em; margin: 6px 0; }
dialog { border: 1px solid var(--border); border-radius: 8px; padding: 20px; width: min(560px, 94vw); }
dialog::backdrop { background: rgba(0,0,0,.35); }
dialog h2 { margin-top: 0; }
dialog .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }
dialog label.field { margin-bottom: 10px; }
dialog input, dialog select { width: 100%; }
.tree ul { list-style: none; padding-left: 20px; margin: 4px 0; }
.tree > ul { padding-left: 0; }
.tree li { padding: 4px 0; }
.tree .node { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 4px 6px; border-radius: 4px; }
.tree .node:hover { background: #f0f3f7; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } main { padding: 12px; } }
.login-list { display: grid; gap: 10px; max-width: 560px; }
.login-list button { text-align: left; }
.ext { font-family: ui-monospace, monospace; font-size: .8rem; color: var(--muted); }
.nw { white-space: nowrap; }
