/* Tenant Service Desk — work-order look: carbon-copy sheets, dashed tear lines, status stripes. */
:root {
  --bg: #eef1f2; --surface: #ffffff; --sunken: #e3e8ea; --fg: #17252b; --muted: #56666d; --line: #cdd6d9;
  --accent: #1d5c6e; --accent-ink: #ffffff; --accent-soft: #d6e7ec;
  --emergency: #b3261e; --emergency-soft: #f9dedb; --urgent: #9a5b00; --urgent-soft: #fbe9c8; --good: #26703f; --good-soft: #d7efdf;
  --display: "Archivo", "Helvetica Neue", Arial, sans-serif;
  --body: "Public Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --radius: 6px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11191c; --surface: #1a2529; --sunken: #0d1416; --fg: #e4ecee; --muted: #93a5ab; --line: #2c3b40;
    --accent: #6fb6c9; --accent-ink: #0b1a1f; --accent-soft: #1d3a43;
    --emergency: #ff8a80; --emergency-soft: #3d1b19; --urgent: #f2b860; --urgent-soft: #3a2a10; --good: #7fd29a; --good-soft: #17301f;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--body); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); }
img { max-width: 100%; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
main.wrap { padding-block: 20px 48px; display: grid; gap: 16px; align-content: start; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: 24px; font-weight: 800; }
h2 { font-size: 17px; font-weight: 700; }
p { margin: 0; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.lead { max-width: 70ch; }
.label { font-size: 11.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* header */
header.top { position: sticky; top: 0; z-index: 5; background: var(--bg); border-bottom: 1px solid var(--line); }
.topin { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding-block: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--fg); font-family: var(--display); font-weight: 800; font-size: 18px; }
.brand .mark { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--accent); display: grid; place-items: center; flex: none; }
.brand .mark::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }
nav.tabs { display: flex; flex-wrap: wrap; gap: 4px; background: var(--sunken); padding: 4px; border-radius: 999px; }
nav.tabs a, .navbtn { border: 0; background: transparent; color: var(--muted); font: 600 13.5px var(--body); padding: 6px 13px; border-radius: 999px; cursor: pointer; text-decoration: none; }
nav.tabs a[aria-current="page"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
nav.tabs a:hover, .navbtn:hover { color: var(--fg); }
form.inline, details.inline { display: inline; }
.foot { color: var(--muted); font-size: 12.5px; padding-block: 0 28px; }

/* banners */
.banner { padding: 11px 14px; border-radius: var(--radius); background: var(--accent-soft); font-size: 14px; }
.banner.ok { background: var(--good-soft); }
.banner.warn { background: var(--urgent-soft); }
.banner.err { background: var(--emergency-soft); color: var(--fg); border-left: 3px solid var(--emergency); }

/* sheets & forms */
.sheet { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.sheet.narrow { max-width: 620px; width: 100%; }
main > .sheet:not(.narrow) { max-width: 780px; width: 100%; }
.sheet-head { padding: 20px 22px 14px; border-bottom: 1px dashed var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: end; }
.sheet-head p { margin-top: 4px; color: var(--muted); max-width: 56ch; }
.pad { padding: 16px 22px; }
.pad + .pad, .sheet-head + .pad { padding-top: 14px; }
.stack { display: grid; gap: 14px; }
.muted-box { border-top: 1px dashed var(--line); color: var(--muted); font-size: 14px; }
fieldset { border: 0; margin: 0; padding: 16px 22px; border-bottom: 1px dashed var(--line); display: grid; gap: 14px; min-width: 0; }
legend { padding: 0; margin-bottom: 4px; float: left; width: 100%; }
legend + * { clear: both; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.field { display: grid; gap: 5px; min-width: 0; }
.field > span:first-child { font-weight: 600; font-size: 13.5px; }
.field small, small.muted { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.static { padding: 9px 0; font-weight: 500; }
input[type=text], input:not([type]), input[type=tel], input[type=email], input[type=password], input[type=date], input[type=search], select, textarea {
  width: 100%; font: 15px var(--body); color: var(--fg); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 11px; min-width: 0; }
input[type=file] { font: 14px var(--body); color: var(--muted); max-width: 100%; }
textarea { resize: vertical; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 13.5px; cursor: pointer; background: var(--bg); }
.chip input:checked + span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.chip input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.urg { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.urg label { position: relative; display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; background: var(--bg); }
.urg label b { font-size: 14px; }
.urg label small { color: var(--muted); font-size: 12.5px; }
.urg input { position: absolute; opacity: 0; pointer-events: none; }
.urg label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.urg label:has(input[value=emergency]:checked) { border-color: var(--emergency); box-shadow: inset 0 0 0 1px var(--emergency); background: var(--emergency-soft); }
.urg label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.emergency-note { display: none; }
form:has(input[name=urgency][value=emergency]:checked) .emergency-note { display: block; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.actions { display: flex; flex-wrap: wrap; gap: 14px; align-items: center; padding: 16px 22px 20px; }
.btn { display: inline-block; border: 1px solid var(--line); background: var(--surface); color: var(--fg); font: 600 14px var(--body); padding: 9px 16px; border-radius: var(--radius); cursor: pointer; text-decoration: none; line-height: 1.3; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.small { padding: 5px 10px; font-size: 12.5px; }

/* pills */
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--sunken); color: var(--muted); white-space: nowrap; }
.pill.emergency { background: var(--emergency-soft); color: var(--emergency); }
.pill.urgent { background: var(--urgent-soft); color: var(--urgent); }
.pill.st-new { background: var(--accent-soft); color: var(--accent); }
.pill.st-done { background: var(--good-soft); color: var(--good); }

/* tenant list */
.pagehead { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; }
.mine { display: grid; gap: 12px; max-width: 780px; }
.mcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 8px; min-width: 0; }
.meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; color: var(--muted); font-size: 13px; }
.reply { border-left: 3px solid var(--accent); padding: 6px 10px; background: var(--bg); font-size: 14px; }
.empty { padding: 24px; color: var(--muted); background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty.flat { border: 0; }
.empty b { color: var(--fg); display: block; margin-bottom: 4px; font-family: var(--display); }

/* manager */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.stat { background: var(--surface); padding: 14px 16px; display: grid; gap: 2px; }
.stat .n { font-family: var(--display); font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat.hot .n { color: var(--emergency); }
@media (max-width: 620px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.filters, .addrow { display: flex; flex-wrap: wrap; gap: 10px; align-items: end; }
.filters .field { flex: 1 1 150px; }
.filters .grow, .addrow .grow { flex: 3 1 220px; }
.queue { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.row { display: grid; grid-template-columns: 6px minmax(0, 1fr) auto; gap: 12px; padding: 12px 14px 12px 0; border-bottom: 1px solid var(--line); color: inherit; text-decoration: none; }
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--bg); }
.stripe { border-radius: 0 3px 3px 0; }
.stripe.emergency { background: var(--emergency); }
.stripe.urgent { background: var(--urgent); }
.rmain { display: grid; gap: 2px; min-width: 0; }
.row .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .s { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .r { display: flex; flex-wrap: wrap; justify-content: end; align-content: start; gap: 4px 6px; font-size: 12.5px; color: var(--muted); max-width: 170px; }
.back a { text-decoration: none; font-weight: 600; font-size: 14px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .detail-grid { grid-template-columns: minmax(0, 1fr); } }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.desc { background: var(--bg); padding: 12px; border-radius: var(--radius); font-size: 14.5px; overflow-wrap: anywhere; }
.photos { display: flex; flex-wrap: wrap; gap: 8px; }
.photos a { display: block; width: 110px; height: 110px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: var(--sunken); }
.photos.small a { width: 72px; height: 72px; }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.history { display: grid; gap: 6px; font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); }
.history div { display: flex; flex-wrap: wrap; gap: 4px 10px; }

/* tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr.off td { opacity: .55; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .code { font-size: 16px; letter-spacing: .12em; }
.tbl .acts { white-space: nowrap; text-align: right; }
.tbl .acts > * { margin-left: 4px; }
.inline-edit { display: flex; gap: 6px; align-items: center; min-width: 240px; }
.inline-edit input, .inline-edit select { padding: 6px 9px; font-size: 14px; }
.inline-edit .unit { width: 80px; flex: none; }
details.inline summary { list-style: none; display: inline-block; }
details.inline summary::-webkit-details-marker { display: none; }
.confirm-pop { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; padding: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); white-space: normal; text-align: left; font-size: 13px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* accessibility */
.skip { position: absolute; left: 12px; top: -60px; z-index: 100; background: var(--accent); color: var(--accent-ink); padding: 10px 16px; border-radius: var(--radius); font-weight: 600; text-decoration: none; }
.skip:focus { top: 12px; }
.foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 18px; }
.foot-links { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.foot-links a { color: var(--muted); }
.notice-collect { font-size: 13px; color: var(--muted); border-top: 1px dashed var(--line); }
.btn { min-height: 40px; }
.foot .legal { flex-basis: 100%; display: grid; gap: 6px; max-width: 90ch; font-size: 12.5px; line-height: 1.55; color: var(--muted); border-top: 1px solid var(--line); padding-top: 12px; margin-top: 6px; }
.foot .legal p { margin: 0; }
.foot .legal a { color: var(--muted); text-decoration: underline; }
/* invites & forms */
.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; }
.req { color: var(--emergency); }
.ferr { color: var(--emergency); font-size: 13px; font-weight: 600; }
[aria-invalid="true"] { border-color: var(--emergency) !important; }
.copyline { display: flex; gap: 8px; margin-top: 8px; }
.copyline input { flex: 1; min-width: 0; font-family: var(--mono); font-size: 13px; background: var(--surface); }
main.wrap > h2 { margin-top: 10px; }
.small { font-size: 12.5px; }
/* category tabs on Requests */
.cattabs { display: flex; flex-wrap: wrap; gap: 6px; border-bottom: 2px solid var(--line); padding-bottom: 0; margin-bottom: -6px; }
.cattabs a { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 8px 14px; border: 1px solid var(--line); border-bottom: 0; border-radius: var(--radius) var(--radius) 0 0; background: var(--sunken); color: var(--muted); font-weight: 600; font-size: 14px; text-decoration: none; margin-bottom: -2px; }
.cattabs a:hover { color: var(--fg); }
.cattabs a[aria-current="page"] { background: var(--surface); color: var(--fg); border-color: var(--line); border-bottom: 2px solid var(--surface); box-shadow: inset 0 3px 0 var(--accent); }
.cattabs .cnt { font-family: var(--mono); font-size: 12px; background: var(--bg); color: var(--muted); border-radius: 999px; padding: 1px 7px; }
.cattabs a[aria-current="page"] .cnt { background: var(--accent-soft); color: var(--accent); }
.cattabs + .queue { border-top-left-radius: 0; }
