:root {
  color-scheme: light;
  --paper: #faf9f5;
  --panel: #fffefa;
  --ink: #242620;
  --mute: #585c52;
  --line: #d8d9cf;
  --accent: #ae411a;
  --accent-hover: #863214;
  --soft: #f3e9de;
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, textarea, select { font: inherit; }
button, a { touch-action: manipulation; }
a, .text-btn { color: var(--accent); text-underline-offset: .2em; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid #a94b24; outline-offset: 3px; }
.site-head { border-bottom: 1px solid var(--line); background: var(--panel); }
.head-inner, .layout { width: min(1120px, calc(100% - 48px)); margin: auto; }
.head-inner { display: flex; align-items: center; min-height: 72px; gap: 19px; }
.head-inner a { display: flex; }
.head-inner img, .qr-brand { height: auto; }
.head-meta { border-left: 1px solid var(--line); padding-left: 19px; color: var(--mute); font-size: .87rem; }
.end { margin-left: auto; }
.layout { padding: clamp(28px, 5vw, 78px) 0 80px; }
h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { line-height: 1.12; letter-spacing: -.045em; }
h1 { font-size: clamp(2.3rem, 5vw, 4.2rem); margin-bottom: 14px; font-weight: 630; }
h2 { font-size: clamp(1.35rem, 3vw, 2rem); margin-bottom: 10px; font-weight: 620; }
h3 { font-size: 1.25rem; margin-bottom: 5px; }
.muted { color: var(--mute); }
.context { color: var(--accent); font-size: .88rem; font-weight: 600; margin-bottom: 10px; overflow-wrap:anywhere; }
.notice { color: #503725; padding: 13px 16px; border-radius: 8px; background: #f5eade; margin: 16px 0; }
.access { display: grid; grid-template-columns: minmax(0,1.1fr) minmax(0,1fr); overflow: hidden; border: 1px solid var(--line); border-radius: 23px; background: var(--panel); min-height: 540px; }
.access picture { position: relative; min-height: 100%; overflow: hidden; }
.access-photo { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.access-box { align-self: center; padding: clamp(25px,4.5vw,72px); min-width:0; }
.access-box h1 { font-size: clamp(2.05rem,3.3vw,3.25rem); }
.stack { display: grid; gap: 15px; }
label, legend { display: grid; gap: 6px; color: var(--ink); font-size: .93rem; font-weight: 570; }
input:not([type=radio]), select, textarea {
  border: 1px solid #aaafa3; padding: 9px 12px; width: 100%; max-width: 100%; min-width: 0; border-radius: 7px;
  background: #fff; color: var(--ink); min-height: 44px; font-size: 1rem; font-weight: 400;
}
textarea { resize: vertical; }
.primary, .quiet, .text-btn, .view-switch button {
  cursor: pointer; padding: 10px 15px; line-height:1.2; font-weight:600; border-radius: 8px; border:1px solid transparent; min-height:44px;
}
.primary { color: white; background: var(--accent); }
.primary:hover { background: var(--accent-hover); }
.quiet { border-color:var(--line); background: var(--panel); color:var(--ink); }
.quiet:hover { border-color: var(--mute); }
.text-btn { border:0; background:transparent; padding:3px 0; text-align:left; }
.text-btn:hover { text-decoration:underline; }
button:disabled { cursor: default; opacity: .58; }
.access-actions { display:flex; align-items:center; column-gap:16px; flex-wrap:wrap; margin-top:10px; }
.page-head, .panel-head, .ticket-head, .directory li, .qr-actions { display:flex; align-items:center; justify-content:space-between; gap:12px; }
.page-head { margin-bottom: 26px; }
.page-head h1 { margin: 0; }
.view-switch { display:inline-flex; flex-wrap:wrap; gap:2px; padding:3px; border-radius:10px; background:#e9e9e2; margin-bottom:22px; }
.view-switch button { background:transparent; color: var(--mute); }
.view-switch button[aria-pressed=true] { background: var(--panel); color: var(--ink); box-shadow:0 1px 3px #23271d24; }
.panel { background: var(--panel); border:1px solid var(--line); border-radius:15px; padding:clamp(19px,3.2vw,37px); }
.panel-head { flex-wrap:wrap; margin-bottom:10px; }
.panel-head h2, .panel .muted:last-child { margin-bottom: 0; }
.tickets { display:grid; }
.ticket { border-top:1px solid var(--line); padding:22px 0; min-width:0; }
.ticket:last-child { padding-bottom:0; }
.ticket-head { justify-content:flex-start; margin-bottom:10px; font-size:.78rem; }
.ticket-text { white-space:pre-wrap; overflow-wrap:anywhere; max-width:80ch; }
.status-tag, .urgent-tag { padding:3px 7px; border-radius:5px; color:#3d5941; background:#e6eee1; }
.urgent-tag { color:#8a321c; background:#f8e5da; }
.assignment { display:flex; flex-wrap:wrap; gap:8px; }
.assignment select { max-width:21rem; }
.setup-grid { display:grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items:start; gap:18px; }
.directory { padding:0; list-style:none; margin:24px 0 0; }
.directory li { border-top:1px solid var(--line); padding:10px 0; overflow-wrap:anywhere; }
.directory li:last-child { padding-bottom:0; }
.directory .text-btn { white-space:nowrap; }
.resident-layout { width:min(650px, calc(100% - 32px)); margin:clamp(32px,7vh,75px) auto; }
.resident-layout > div > .muted { margin-bottom:25px; }
.resident-layout .stack { gap:20px; }
fieldset { border:0; padding:0; margin:0; }
legend { margin-bottom:7px; }
.radios { display:flex; gap:14px; }
.radios label { display:inline-flex; align-items:center; flex-direction:row; padding:8px 12px; background:var(--paper); border:1px solid var(--line); border-radius:6px; }
input[type=radio] { accent-color:var(--accent); }
.reference { color:var(--accent); font-weight:680; font-size:1.35rem; overflow-wrap:anywhere; margin-bottom:0; }
.qr-dialog { width:min(450px, calc(100% - 24px)); max-height:90dvh; border:1px solid var(--line); border-radius:15px; padding:clamp(19px,4vw,36px); background:var(--panel); color:var(--ink); }
.qr-dialog::backdrop { background:#19221ac2; }
#print-card { text-align:center; }
#print-card h2 { font-size:1.65rem; }
#print-card .context { margin:13px 0 4px; }
#qr-code { width:min(100%,288px) !important; height:auto !important; image-rendering:pixelated; }
.qr-actions { justify-content:flex-start; flex-wrap:wrap; }
.qr-actions a { padding:7px 0; }
@media(max-width:740px) {
  .head-inner,.layout { width:calc(100% - 32px); }
  .head-inner { min-height:61px; gap:12px; }
  .head-meta { padding-left:12px; font-size:.78rem; }
  .access { grid-template-columns:1fr; min-height:unset; border-radius:15px; }
  .access picture { height:clamp(145px,28vw,210px); }
  .access-box { padding:24px 21px; }
  .setup-grid { grid-template-columns:1fr; }
}
@media(max-width:440px) {
  .site-head:has(#sign-out:not([hidden])) .head-meta { display:none; }
  .assignment { display:grid; }
  .assignment select { max-width:100%; }
}
@media print {
  body:has(#qr-dialog[open]) > :not(#qr-dialog) { display:none !important; }
  #qr-dialog[open] { display:block; position:static; max-height:none; width:110mm; max-width:100%; margin:16mm auto; border:1px solid #555; background:white; box-shadow:none; overflow:visible; }
  #qr-dialog::backdrop { background:transparent; }
  #qr-dialog[open] > :not(#print-card) { display:none !important; }
  #print-card { break-inside:avoid; padding:6mm; }
  #qr-code { width:65mm !important; max-width:100%; }
}
