/* RO Real Estate: contractor compliance.
   Navy gives structure, white and light grey are the surfaces, orange marks the primary action. Status colours are muted, always
   paired with an icon and a word (never colour alone). One typeface (Inter), one icon set, one set of components. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("../vendor/inter/inter-latin-wght-normal.woff2") format("woff2-variations"), url("../vendor/inter/inter-latin-wght-normal.woff2") format("woff2"); }

:root {
  --navy: #1E3A5F; --navy-900: #12253d; --navy-800: #182f4d; --navy-100: #dfe7f1; --navy-50: #eff3f8;
  --orange: #D9583A;                 /* brand accent: highlights and lines */
  --orange-strong: #C4472A;          /* primary buttons (white text passes AA on this) */
  --orange-hover: #A93A20; --orange-50: #fdf0ec;
  --ink: #14202e; --muted: #556579; --faint: #8794a6;
  --bg: #f6f7f9; --surface: #ffffff; --line: #e3e7ed; --line-strong: #cdd5df;
  --green: #14693f; --green-bg: #e7f6ee; --green-line: #bfe3cf;
  --amber: #7a4a00; --amber-bg: #fdf2d9; --amber-line: #f1d9a0;
  --red: #a72a1f;   --red-bg: #fdecea;   --red-line: #f3c4be;
  --grey: #4d5d70;  --grey-bg: #eef1f5;  --grey-line: #dbe1e9;
  --radius: 8px; --radius-lg: 12px;
  --shadow-sm: 0 1px 2px rgba(18, 37, 61, .06);
  --shadow: 0 1px 2px rgba(18, 37, 61, .06), 0 4px 14px rgba(18, 37, 61, .05);
  --shadow-lg: 0 12px 40px rgba(18, 37, 61, .22);
  --ring: 0 0 0 3px rgba(30, 58, 95, .28);
  --sidebar: 248px;
  font-size: 15px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif; font-feature-settings: "tnum" 1, "cv11" 1; color: var(--ink); background: var(--bg); line-height: 1.5; -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
h1 { font-size: 1.55rem; line-height: 1.2; font-weight: 650; letter-spacing: -.015em; margin: 0; color: var(--navy-900); }
h2 { font-size: 1.1rem; font-weight: 650; letter-spacing: -.01em; margin: 0; color: var(--navy-900); }
h3 { font-size: 1rem; font-weight: 650; margin: 1rem 0 .4rem; color: var(--navy-900); }
p { margin: .4rem 0; }
a { color: var(--navy); text-decoration-color: rgba(30, 58, 95, .35); text-underline-offset: 2px; }
a:hover { text-decoration-color: currentColor; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .right { margin-left: auto; } .hidden { display: none !important; }
.ico { display: inline-flex; flex: none; vertical-align: middle; } .ico svg { display: block; }
strong { font-weight: 600; }

/* ---------- app shell: sidebar + content ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: linear-gradient(180deg, var(--navy-900), var(--navy-800)); color: #fff; display: flex; flex-direction: column; padding: 1.1rem .8rem; gap: 1.2rem; border-right: 1px solid rgba(255, 255, 255, .06); }
.brand { display: flex; align-items: center; gap: .65rem; color: #fff; text-decoration: none; padding: .2rem .4rem; }
.brand img { height: 40px; width: auto; background: #fff; border-radius: 8px; padding: 3px 7px; flex: none; }
.brandtext { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brandtext strong { font-size: .95rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand small { font-size: .7rem; color: #aebdd1; letter-spacing: .02em; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav a { display: flex; align-items: center; gap: .7rem; color: #cbd7e6; text-decoration: none; padding: .55rem .7rem; border-radius: var(--radius); font-weight: 500; position: relative; }
.nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.nav a.active { background: rgba(255, 255, 255, .12); color: #fff; font-weight: 600; box-shadow: inset 3px 0 0 var(--orange); }
.nav a .lbl { flex: 1; }
.nav .count { background: var(--orange-strong); color: #fff; border-radius: 999px; font-size: .72rem; line-height: 1; padding: .22rem .5rem; font-weight: 650; font-variant-numeric: tabular-nums; }
.userbox { border-top: 1px solid rgba(255, 255, 255, .1); padding-top: .8rem; display: flex; flex-direction: column; gap: .5rem; font-size: .85rem; }
.userbox .who { color: #dbe5f1; padding: 0 .4rem; overflow-wrap: anywhere; line-height: 1.35; }
.userbox .row { display: flex; gap: .4rem; flex-wrap: nowrap; }
.userbox button { flex: 1; background: rgba(255, 255, 255, .06); color: #e6eef8; border: 1px solid rgba(255, 255, 255, .16); border-radius: var(--radius); padding: .4rem .5rem; cursor: pointer; font: inherit; font-size: .8rem; min-height: 36px; display: inline-flex; align-items: center; justify-content: center; gap: .35rem; }
.userbox button:hover { background: rgba(255, 255, 255, .14); }
.content { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
main { width: 100%; max-width: 1280px; margin: 0 auto; padding: 1.75rem 2rem 4rem; flex: 1; }
.appfoot { text-align: center; color: var(--muted); font-size: .78rem; padding: 1rem 1rem 1.6rem; }

.pagehead { display: flex; align-items: flex-start; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.pagehead > div:first-child { min-width: 0; flex: 1 1 320px; }
.pagehead p { margin: .3rem 0 0; }
.pagehead .actions, .sectionhead .actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.sectionhead { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin: 2rem 0 .75rem; }
.banner.test { background: #fff7de; color: #5d4300; border-bottom: 1px solid #efd88f; padding: .55rem 1rem; font-size: .85rem; text-align: center; font-weight: 500; }
.banner.test a { color: inherit; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; min-height: 40px; padding: .45rem 1rem; border-radius: var(--radius); border: 1px solid var(--orange-strong); background: var(--orange-strong); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; transition: background .12s, border-color .12s, box-shadow .12s; box-shadow: var(--shadow-sm); white-space: nowrap; }
.btn:hover { background: var(--orange-hover); border-color: var(--orange-hover); }
.btn.secondary { background: var(--surface); color: var(--navy-900); border-color: var(--line-strong); }
.btn.secondary:hover { background: var(--navy-50); border-color: var(--navy-100); }
.btn.danger { background: var(--surface); color: var(--red); border-color: var(--red-line); }
.btn.danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn.good { background: var(--green); border-color: var(--green); }
.btn.small { min-height: 32px; padding: .2rem .65rem; font-size: .85rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.big { min-height: 52px; font-size: 1.05rem; width: 100%; }
.menubtn { padding: .2rem .5rem; font-size: 1.1rem; line-height: 1; letter-spacing: .05em; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius); }
.btn:focus-visible { box-shadow: var(--ring); }

/* ---------- cards, KPIs ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 1.1rem 1.25rem; margin-bottom: 1rem; }
.stats, .kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .85rem; margin-bottom: 1rem; }
.stat, .kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: .95rem 1.1rem; text-align: left; font: inherit; color: inherit; box-shadow: var(--shadow-sm); display: block; }
.stat { cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s; }
.stat:hover { border-color: var(--line-strong); box-shadow: var(--shadow); }
.stat.on { border-color: var(--navy); box-shadow: 0 0 0 1px var(--navy); }
.stat .n, .kpi .n { font-size: 1.9rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; color: var(--navy-900); font-variant-numeric: tabular-nums; }
.stat .l, .kpi .l { font-weight: 600; margin-top: .15rem; }
.stat .d, .kpi .d { font-size: .8rem; color: var(--muted); margin-top: .1rem; }
.kpi.amber .n, .stat.amber .n { color: var(--amber); } .kpi.red .n, .stat.red .n { color: var(--red); } .kpi.green .n { color: var(--green); }
.statgroup { margin: 0 0 .5rem; font-size: .75rem; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--faint); }

/* ---------- badges: soft background, strong text, an icon, and always a word ---------- */
.badge { display: inline-flex; align-items: center; gap: .3rem; font-weight: 600; font-size: .78rem; line-height: 1; padding: .3rem .6rem .3rem .45rem; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.badge .ico svg { width: 13px; height: 13px; }
.badge.red { background: var(--red-bg); color: var(--red); border-color: var(--red-line); }
.badge.amber { background: var(--amber-bg); color: var(--amber); border-color: var(--amber-line); }
.badge.green { background: var(--green-bg); color: var(--green); border-color: var(--green-line); }
.badge.grey { background: var(--grey-bg); color: var(--grey); border-color: var(--grey-line); }
.verdict { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .85rem; border-radius: var(--radius); font-weight: 650; font-size: .95rem; }
.verdict.green { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-line); }
.verdict.red { background: var(--red-bg); color: var(--red); border: 1px solid var(--red-line); }

/* ---------- forms ---------- */
label { font-weight: 600; font-size: .85rem; display: block; margin: .9rem 0 .3rem; color: var(--navy-900); }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=date], input[type=number], input[type=password], input[type=search], select, textarea {
  width: 100%; min-height: 40px; padding: .45rem .7rem; border: 1px solid var(--line-strong); border-radius: var(--radius); font: inherit; background: var(--surface); color: var(--ink); transition: border-color .12s, box-shadow .12s; }
textarea { min-height: 92px; resize: vertical; }
input:hover, select:hover, textarea:hover { border-color: #b6c1cf; }
input:focus, select:focus, textarea:focus { border-color: var(--navy); }
input::placeholder, textarea::placeholder { color: var(--faint); }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 500; font-size: .95rem; margin: .6rem 0; color: var(--ink); }
.check input { width: 18px; height: 18px; margin-top: .15rem; flex: none; accent-color: var(--navy); }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .1rem .8rem; }
.hint { color: var(--muted); font-size: .8rem; margin: .25rem 0 0; }
.error { color: var(--red); font-weight: 600; font-size: .9rem; margin: .6rem 0; }
.filters { display: grid; grid-template-columns: 2fr repeat(6, 1fr); gap: .6rem; margin-bottom: 1rem; }
.filters input[type=search] { background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238794a6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat .7rem center; padding-left: 2.2rem; }
.row { display: flex; gap: .6rem; flex-wrap: wrap; align-items: center; }

.tip { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; border-radius: 50%; background: var(--navy-50); color: var(--navy); font-size: .65rem; font-weight: 700; border: 1px solid var(--navy-100); cursor: help; margin-left: .4rem; padding: 0; position: relative; vertical-align: middle; }
.tip:hover::after, .tip:focus::after { content: attr(data-tip); position: absolute; left: 50%; bottom: 140%; transform: translateX(-50%); width: max-content; max-width: 260px; background: var(--ink); color: #fff; padding: .5rem .7rem; border-radius: var(--radius); font-weight: 450; font-size: .8rem; line-height: 1.4; z-index: 60; text-align: left; white-space: normal; box-shadow: var(--shadow-lg); }
.tip.off::after { display: none !important; }

/* ---------- tables: sticky header, row hover, tidy columns ---------- */
.tablewrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow: auto; max-height: 75vh; }
table { border-collapse: separate; border-spacing: 0; width: 100%; }
th { position: sticky; top: 0; z-index: 2; text-align: left; font-size: .78rem; font-weight: 600; color: var(--muted); padding: .65rem 1rem; background: #fafbfc; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: .7rem 1rem; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
td:first-child { font-weight: 500; }
tr.click { cursor: pointer; }
tbody tr:hover td { background: #f8fafc; }
td.actions { text-align: right; white-space: nowrap; width: 1%; }
td .btn + .btn { margin-left: .35rem; }
td input[type=checkbox] { width: 18px; height: 18px; accent-color: var(--navy); }
.tabs { display: flex; gap: .1rem; border-bottom: 1px solid var(--line); margin-bottom: 1.25rem; overflow-x: auto; }
.tabs button { background: transparent; border: 0; padding: .65rem .9rem; font: inherit; font-weight: 600; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; min-height: 42px; display: inline-flex; align-items: center; gap: .45rem; }
.tabs button:hover { color: var(--navy-900); }
.tabs button.on { color: var(--navy-900); border-bottom-color: var(--orange); }
.tabcount { background: var(--grey-bg); color: var(--grey); border-radius: 999px; font-size: .72rem; padding: .12rem .45rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.tabs button.on .tabcount { background: var(--navy-50); color: var(--navy); }

.empty { text-align: center; padding: 3rem 1.25rem; background: var(--surface); border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); }
.empty .big { width: 52px; height: 52px; margin: 0 auto .6rem; border-radius: 50%; background: var(--navy-50); color: var(--navy); display: grid; place-items: center; font-size: 1.4rem; }
.empty h2 { margin: 0 0 .25rem; font-size: 1.05rem; }
.empty p { max-width: 42ch; margin: .2rem auto .9rem; }

/* ---------- action menu ---------- */
.menulist { position: fixed; z-index: 90; min-width: 220px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: .35rem; animation: pop .12s ease-out; }
.menulist button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: .5rem .7rem; border-radius: 6px; font: inherit; font-size: .9rem; cursor: pointer; color: var(--ink); }
.menulist button:hover, .menulist button:focus-visible { background: var(--navy-50); outline: none; }
.menulist button.danger { color: var(--red); } .menulist button.danger:hover { background: var(--red-bg); }
.menulist hr { border: 0; border-top: 1px solid var(--line); margin: .3rem 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ---------- contractor summary header ---------- */
.summary { display: flex; gap: 1rem; align-items: flex-start; flex-wrap: wrap; margin-bottom: 1.1rem; }
.summary .who { flex: 1 1 360px; min-width: 0; }
.summary h1 { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.meta { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; margin-top: .55rem; color: var(--muted); font-size: .88rem; }
.meta .item { display: inline-flex; align-items: center; gap: .35rem; } .meta strong { color: var(--ink); font-weight: 550; }
.chip { display: inline-flex; align-items: center; gap: .3rem; background: var(--grey-bg); color: var(--grey); border-radius: 6px; padding: .12rem .5rem; font-size: .75rem; font-weight: 600; letter-spacing: .01em; }

/* ---------- dialogs and toasts ---------- */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, 94vw); max-height: 92vh; box-shadow: var(--shadow-lg); color: var(--ink); background: var(--surface); animation: dlg .14s ease-out; }
dialog::backdrop { background: rgba(14, 28, 46, .5); backdrop-filter: blur(2px); }
dialog .dhead { margin: 0; padding: 1.1rem 1.4rem .2rem; font-size: 1.1rem; font-weight: 650; letter-spacing: -.01em; color: var(--navy-900); }
dialog .dbody { padding: .3rem 1.4rem 1rem; overflow-y: auto; max-height: calc(92vh - 150px); }
dialog .dfoot { padding: .85rem 1.4rem 1.1rem; display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line); background: #fafbfc; border-radius: 0 0 14px 14px; }
@keyframes dlg { from { opacity: 0; transform: translateY(6px) scale(.985); } to { opacity: 1; transform: none; } }
#toasts { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); display: flex; flex-direction: column; gap: .5rem; z-index: 100; width: min(92vw, 540px); pointer-events: none; }
.toast { pointer-events: auto; background: var(--navy-900); color: #fff; padding: .75rem 1rem; border-radius: var(--radius-lg); display: flex; align-items: center; gap: 1rem; box-shadow: var(--shadow-lg); font-size: .9rem; animation: pop .18s ease-out; }
.toast.bad { background: var(--red); }
.toast button { margin-left: auto; background: rgba(255, 255, 255, .16); color: #fff; border: 0; border-radius: 6px; padding: .35rem .75rem; font: inherit; font-weight: 600; cursor: pointer; min-height: 32px; }
.spinner { text-align: center; padding: 3rem; color: var(--muted); }

/* ---------- loading placeholders ---------- */
.skeleton { padding-top: .25rem; }
.sk { background: linear-gradient(90deg, #e9edf3 25%, #f3f5f9 37%, #e9edf3 63%); background-size: 400% 100%; animation: sk 1.4s ease infinite; border-radius: var(--radius); }
.sk-title { height: 1.8rem; width: 16rem; max-width: 70%; margin-bottom: .6rem; } .sk-line { height: 1rem; width: 24rem; max-width: 90%; margin-bottom: 1.4rem; }
.sk-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: .85rem; margin-bottom: 1.2rem; } .sk-stat { height: 5.4rem; border-radius: var(--radius-lg); } .sk-row { height: 2.6rem; margin-bottom: .5rem; }
@keyframes sk { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
#view > * { animation: fade .16s ease-out; } @keyframes fade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* ---------- phone: the sidebar becomes a bottom bar ---------- */
@media (max-width: 860px) {
  .app { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "brand user" "content content"; }
  .sidebar { display: contents; }
  .brand { grid-area: brand; position: sticky; top: 0; z-index: 20; background: var(--navy-900); padding: .5rem .8rem; }
  .brand img { height: 34px; } .brand small { display: none; }
  .userbox { grid-area: user; position: sticky; top: 0; z-index: 20; background: var(--navy-900); border: 0; padding: .5rem .8rem .5rem 0; flex-direction: row; align-items: center; }
  .userbox .who { display: none; } .userbox button { flex: none; min-width: 40px; min-height: 40px; padding: .3rem; } .userbox button .lbl { display: none; }
  .content { grid-area: content; min-height: 0; }
  main { padding: 1.1rem 1rem 6rem; }
  .nav { display: none; }
  .tabbar { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; background: var(--navy-900); display: flex; justify-content: space-around; padding: .25rem .2rem calc(.25rem + env(safe-area-inset-bottom)); box-shadow: 0 -2px 12px rgba(0, 0, 0, .25); }
  .tabbar a, .tabbar .moretab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem; padding: .45rem .1rem; font-size: .66rem; text-align: center; min-width: 0; min-height: 48px; color: #cbd7e6; text-decoration: none; background: none; border: 0; border-radius: var(--radius); font-family: inherit; position: relative; cursor: pointer; }
  .tabbar a.active { background: rgba(255, 255, 255, .14); color: #fff; }
  .tabbar .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
  .tabbar .count { position: absolute; top: 2px; right: 18%; font-size: .6rem; padding: .15rem .35rem; background: var(--orange-strong); color: #fff; border-radius: 999px; line-height: 1; }
  .topbar { padding: .4rem 1rem 0; }
  .filters { grid-template-columns: 1fr 1fr; } .filters > :first-child { grid-column: 1 / -1; }
  #toasts { bottom: 90px; }
  .tablewrap { max-height: none; }
  table.stack thead { display: none; }
  table.stack tr { display: block; border-bottom: 1px solid var(--line); padding: .5rem 0; }
  table.stack td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; border: 0; padding: .3rem 1rem; text-align: right; }
  table.stack td::before { content: attr(data-label); font-weight: 600; font-size: .8rem; color: var(--muted); text-align: left; flex: none; }
  table.stack td.actions { justify-content: flex-end; width: auto; } table.stack td.actions::before { content: none; }
  .stats, .kpis { grid-template-columns: 1fr 1fr; } .stat .n, .kpi .n { font-size: 1.55rem; }
  .pagehead .actions { margin-left: 0; width: 100%; }
}
@media print { .sidebar, .nav, .btn { display: none !important; } .app { display: block; } }

/* ---------- accessibility ---------- */
.skip { position: absolute; left: .5rem; top: -4rem; background: #fff; color: var(--navy); padding: .7rem 1rem; border-radius: var(--radius); font-weight: 650; z-index: 200; box-shadow: var(--shadow-lg); }
.skip:focus { top: .5rem; }
h1:focus, main:focus { outline: none; }
fieldset.group { border: 0; padding: 0; margin: .8rem 0 0; min-width: 0; } fieldset.group legend { font-weight: 600; font-size: .85rem; padding: 0; margin-bottom: .25rem; }
input[type=file]:focus-visible + .filebtn, input[type=file]:focus-visible + .filelabel { box-shadow: var(--ring); }
.filelabel { cursor: pointer; }
.sr, .sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }
@media (forced-colors: active) { .btn, .badge, .stat, .kpi, .filebtn { border: 2px solid ButtonText; } }
.badge, .verdict { forced-color-adjust: none; }

/* password inputs and the temporary-password card */
.row.nowrap { flex-wrap: nowrap; align-items: stretch; } .row.nowrap input { flex: 1; min-width: 0; }
.creds { display: grid; grid-template-columns: max-content 1fr; gap: .3rem 1rem; background: var(--navy-50); border-radius: var(--radius); padding: .8rem 1rem; margin: .6rem 0; }
.creds dt { font-weight: 600; color: var(--navy); } .creds dd { margin: 0; word-break: break-all; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 1.05rem; font-weight: 600; letter-spacing: .03em; }
.linkbtn { background: none; border: 0; padding: .5rem .2rem; font: inherit; font-weight: 600; color: var(--navy); text-decoration: underline; cursor: pointer; min-height: 40px; } .linkbtn.small { font-size: .85rem; }

/* file drop zone and upload progress */
.dropzone.drag { background: var(--green-bg); border-style: solid; }
.filepick .filebtn { margin: 0; }
.filebtn { display: block; width: 100%; border: 1.5px dashed var(--line-strong); background: #fafbfc; color: var(--navy); border-radius: var(--radius-lg); padding: 1.1rem; font-weight: 600; text-align: center; cursor: pointer; transition: background .12s, border-color .12s; }
.filebtn:hover { background: var(--navy-50); border-color: var(--navy); }
.filebtn.has { border-style: solid; background: var(--green-bg); border-color: var(--green-line); color: var(--green); }
input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
.bar { height: 8px; background: var(--grey-bg); border-radius: 8px; overflow: hidden; margin: .8rem 0; } .bar > div { height: 100%; width: 0; background: var(--orange-strong); transition: width .2s; }

/* several files per RAMS: the list under the drop zone, and the file list shown on a RAMS record */
.filelist { list-style: none; margin: .6rem 0 0; padding: 0; display: grid; gap: .5rem; }
.fileitem { border: 1px solid var(--line); border-radius: var(--radius); padding: .5rem .65rem; background: #fff; }
.fileitem-top { display: flex; align-items: center; justify-content: space-between; gap: .6rem; margin-bottom: .35rem; }
.fileitem-top input { flex: 1; margin: 0; }
.fileitem .fname { font-weight: 600; overflow-wrap: anywhere; }
.fileitem > input[type=text] { margin: 0; }
.rams-files { list-style: none; margin: .3rem 0; padding: 0; display: grid; gap: .35rem; }
.rams-files li { display: flex; align-items: center; justify-content: space-between; gap: .6rem; border: 1px solid var(--line); border-radius: var(--radius); padding: .4rem .65rem; background: #fff; }
.rams-files .flabel { font-weight: 600; overflow-wrap: anywhere; }
.rams-files .fname { color: var(--muted); font-size: .85rem; overflow-wrap: anywhere; }

/* Contracts */
.cfacts { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1.2rem; margin: 0; }
.cfacts dt { color: var(--muted); font-weight: 600; } .cfacts dd { margin: 0; white-space: pre-wrap; }
.cflag { display: flex; gap: .4rem; align-items: flex-start; background: var(--amber-bg); border: 1px solid var(--amber-line); color: var(--amber); border-radius: var(--radius); padding: .3rem .6rem; font-size: .82rem; margin: .3rem 0 0; }
.cgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1.2rem; }
.cfilters { display: grid; grid-template-columns: 2fr repeat(5, 1fr); gap: .6rem; margin-bottom: 1rem; }
.plist { max-height: 14rem; overflow: auto; border: 1px solid var(--line-strong); border-radius: var(--radius); padding: .3rem .6rem; background: var(--surface); }
.plist .check { margin: .1rem 0; }
.split input[type=number] { width: 8.5rem; }
.split td { vertical-align: middle; }
.dl-list { list-style: none; margin: 0; padding: 0; }
.dl-list li { display: flex; justify-content: space-between; gap: .8rem; padding: .45rem 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.dl-list li:first-child { border-top: 0; }
@media (max-width: 800px) { .cfilters { grid-template-columns: 1fr 1fr; } .cfilters input[type=search] { grid-column: 1 / -1; } }

/* ---------- contracts: structured AI summary, suggested updates, tidy names, review screen ---------- */
.csummary { display: grid; gap: .8rem; }
.csec { border-left: 4px solid var(--navy-100); padding: .1rem 0 .1rem .8rem; }
.csec h3 { margin: 0 0 .25rem; font-size: 1rem; color: var(--navy-900); }
.csec ul { margin: 0; padding-left: 1.2rem; display: grid; gap: .2rem; }
.csec.amber { background: var(--amber-bg); border: 1px solid var(--amber-line); border-left: 4px solid var(--amber); border-radius: var(--radius); padding: .6rem .8rem; color: var(--amber); }
.csec.amber h3 { color: var(--amber); }
.csec.grey { background: var(--grey-bg); border: 1px solid var(--grey-line); border-left: 4px solid var(--grey); border-radius: var(--radius); padding: .6rem .8rem; color: var(--grey); }
.csec.grey h3 { color: var(--grey); }
.csummary.editing textarea { width: 100%; font: inherit; line-height: 1.4; }
.csummary.editing .csec label { display: block; }
.csummary.editing .csec h3 { display: inline; }
table.suggest { width: 100%; }
table.suggest th[scope=row] { text-align: left; font-weight: 600; vertical-align: top; min-width: 9rem; }
table.suggest td { vertical-align: top; }
table.suggest td.tick { text-align: center; width: 3.2rem; }
table.suggest td.tick input { width: 1.3rem; height: 1.3rem; }
table.suggest input[type=text], table.suggest input[type=date], table.suggest input[type=number], table.suggest select, table.suggest textarea { width: 100%; }
table.suggest .row.nowrap input { max-width: 6rem; }
.aipanel { border-color: var(--orange-strong); }
.usagebar { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; margin: .4rem 0; font-size: .9rem; }
.usagebar progress, .rvprogress progress { width: 12rem; height: .6rem; accent-color: var(--navy); }
.usagebar progress.hot { accent-color: var(--red); }
.namehints .row { gap: .4rem; }
.tidygroup { margin-bottom: 1rem; }
.rvprogress { display: flex; flex-wrap: wrap; gap: .5rem 1rem; align-items: center; font-weight: 600; margin: .4rem 0 .8rem; }
.rvgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.rvfiles, .rvside { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: .8rem; min-width: 0; }
.rvfiles { position: sticky; top: .5rem; }
.rvtabs { display: flex; flex-wrap: wrap; gap: .3rem; margin-bottom: .5rem; }
.rvtab { border: 1px solid var(--line-strong); background: var(--surface); border-radius: var(--radius); padding: .25rem .6rem; font: inherit; font-size: .85rem; cursor: pointer; }
.rvtab[aria-selected=true] { background: var(--navy); color: #fff; border-color: var(--navy); }
.rvframe iframe { width: 100%; height: 72vh; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
.rvbtns { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: 1rem; position: sticky; bottom: 0; background: var(--surface); padding: .6rem 0; border-top: 1px solid var(--line); }
.rvkeys kbd, kbd { border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 .35rem; font: inherit; font-size: .8rem; background: var(--grey-bg); }
@media (max-width: 900px) {
  .rvgrid { grid-template-columns: 1fr; } .rvfiles { position: static; } .rvframe iframe { height: 60vh; }
  table.suggest thead { display: none; } table.suggest tr { display: block; border-top: 1px solid var(--line); padding: .5rem 0; } table.suggest th, table.suggest td { display: block; width: 100%; padding: .15rem 0; }
  table.suggest td[data-label]::before { content: attr(data-label) ': '; font-weight: 600; font-size: .8rem; color: var(--muted); display: block; }
  table.suggest td.tick { text-align: left; width: auto; } table.suggest td.tick::after { content: ' Use this'; }
}
.rvfilters { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; align-items: center; } @media (max-width: 800px) { .rvfilters { grid-template-columns: 1fr; } }
dialog.wide { width: min(980px, 96vw); }
.cfilters { grid-template-columns: 2fr repeat(6, 1fr); }
.noticeform textarea.letter { width: 100%; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; line-height: 1.4; }
.btn.disabled { opacity: .5; pointer-events: none; }

/* ---------- home ---------- */
.hometiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.hometile { display: block; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); padding: 1rem 1.1rem; color: inherit; text-decoration: none; transition: box-shadow .12s, border-color .12s; }
.hometile:hover { border-color: var(--navy); box-shadow: var(--shadow-lg); }
.ht-head { display: flex; align-items: center; gap: .5rem; color: var(--navy-900); } .ht-head h2 { margin: 0; font-size: 1.05rem; }
.ht-figs { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; margin-top: .7rem; }
.ht-fig .n { font-size: 1.6rem; font-weight: 700; line-height: 1.1; } .ht-fig .l { font-size: .78rem; color: var(--muted); }
.ht-fig.red .n { color: var(--red); } .ht-fig.amber .n { color: var(--amber); } .ht-fig.green .n { color: var(--green); }
.homeactions { gap: .5rem; margin: .4rem 0 0; }
.todolist { list-style: none; margin: 0; padding: 0; }
.todo { display: flex; gap: .7rem; align-items: baseline; padding: .5rem 0 .5rem .7rem; border-top: 1px solid var(--line); border-left: 4px solid var(--grey-line); }
.todo:first-child { border-top: 0; } .todo.red { border-left-color: var(--red); } .todo.amber { border-left-color: var(--amber); }
.todo .area { flex: 0 0 9.5rem; font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
@media (max-width: 600px) { .todo { flex-direction: column; gap: .1rem; } .todo .area { flex-basis: auto; } }

/* ---------- property compliance ---------- */
.subnav { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0 0 1rem; border-bottom: 1px solid var(--line); }
.subnav a { padding: .45rem .9rem; border-radius: var(--radius) var(--radius) 0 0; color: var(--navy-900); text-decoration: none; font-weight: 600; }
.subnav a.active { background: var(--navy); color: #fff; }
.pcgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.pclegend { list-style: none; margin: 0; padding: 0; display: grid; gap: .25rem; font-size: .9rem; }
.pclegend .sw { display: inline-block; width: .8rem; height: .8rem; border-radius: 3px; margin-right: .45rem; vertical-align: -1px; }
a.stat { text-decoration: none; color: inherit; display: block; }
.bulkbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; position: sticky; top: .5rem; z-index: 5; }
.bulkbar input[type=text] { flex: 1; min-width: 14rem; }

/* ---------- date fields (always DD/MM/YYYY) ---------- */
.datefield { max-width: 11rem; font-variant-numeric: tabular-nums; } .datefield[aria-invalid=true] { border-color: var(--red); background: var(--red-bg); }
.datepop { position: fixed; z-index: 3000; background: #fff; border: 1px solid var(--line-strong); border-radius: 10px; box-shadow: var(--shadow-lg); padding: .6rem; width: 17.5rem; }
.dp-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .4rem; } .dp-head button, .dp-foot button { border: 0; background: transparent; font: inherit; font-weight: 700; cursor: pointer; padding: .25rem .6rem; border-radius: 6px; color: var(--navy-900); } .dp-head button:hover, .dp-foot button:hover { background: var(--navy-50); }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; } .dp-dow { font-size: .72rem; color: var(--muted); font-weight: 700; padding: .2rem 0; }
.dp-grid button { border: 0; background: transparent; font: inherit; border-radius: 6px; padding: .35rem 0; cursor: pointer; color: var(--ink); } .dp-grid button:hover { background: var(--navy-50); } .dp-grid button.today { box-shadow: inset 0 0 0 1.5px var(--navy); } .dp-grid button.on { background: var(--navy); color: #fff; } .dp-grid button:disabled { color: var(--faint); cursor: not-allowed; text-decoration: line-through; }
.dp-foot { display: flex; justify-content: space-between; margin-top: .4rem; border-top: 1px solid var(--line); padding-top: .3rem; }

/* ---------- grouped menu, scope switch, phone bar, check page ---------- */
.navhead { font-size: .68rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: #8fa3bd; padding: .9rem .7rem .25rem; }
.nav { overflow-y: auto; }
.tabbar { display: none; }
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: .75rem; padding: .55rem 1.5rem 0; }
.scope { display: flex; align-items: center; gap: .5rem; } .scopelbl { font-size: .8rem; color: var(--muted); }
.scope select { min-height: 36px; max-width: 16rem; }
.moresheet { display: flex; flex-direction: column; gap: 2px; min-width: min(20rem, 80vw); }
.moresheet a { display: flex; align-items: center; gap: .7rem; padding: .7rem .6rem; color: var(--navy-900); text-decoration: none; border-radius: var(--radius); font-weight: 500; min-height: 44px; }
.moresheet a.active { background: var(--surface-2, #eef2f7); font-weight: 650; }
.moresheet .navhead { color: var(--muted); } .moresheet .count { margin-left: auto; background: var(--orange-strong); color: #fff; border-radius: 999px; font-size: .72rem; padding: .22rem .5rem; }
.linkbtn { background: none; border: 0; text-align: left; padding: .7rem .6rem; font: inherit; color: var(--navy-900); cursor: pointer; min-height: 44px; }
.checkcard h2 { margin: 0 0 .5rem; font-size: 1.15rem; } .checksites { list-style: none; margin: .7rem 0 0; padding: 0; } .checksites li { padding: .45rem 0; border-top: 1px solid var(--line); }
@media (max-width: 860px) { .tabbar { display: flex; } .topbar { justify-content: flex-start; padding: .4rem 1rem 0; } .scope select { max-width: 60vw; } }

.movednote { margin-bottom: 1rem; border-left: 4px solid var(--navy); } .movednote ul { margin: .4rem 0 .6rem 1.1rem; padding: 0; }

/* ---------- property page tabs ---------- */
.hubtabs { display: flex; gap: .25rem; border-bottom: 1px solid var(--line); margin: 1rem 0 1.1rem; overflow-x: auto; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.hubtabs a { display: inline-flex; align-items: center; gap: .4rem; padding: .6rem .95rem; color: var(--navy-900); text-decoration: none; font-weight: 600; border-bottom: 3px solid transparent; white-space: nowrap; min-height: 44px; }
.hubtabs a:hover { background: rgba(30, 58, 95, .05); } .hubtabs a.active { border-bottom-color: var(--orange); color: var(--navy); }
.tabflag { background: var(--red); color: #fff; border-radius: 999px; font-size: .7rem; line-height: 1; padding: .2rem .45rem; font-variant-numeric: tabular-nums; }
.tabtools { gap: .5rem; align-items: center; justify-content: flex-end; margin: 0 0 .8rem; flex-wrap: wrap; }
.hubpanel > h2:first-child { margin-top: 0; }

/* ---------- search palette ---------- */
.topbar { gap: .6rem; } .searchhost { margin-right: auto; }
.searchbtn { display: inline-flex; align-items: center; gap: .5rem; min-height: 40px; padding: .4rem .8rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); font: inherit; cursor: pointer; min-width: 14rem; }
.searchbtn:hover { border-color: var(--navy); color: var(--navy-900); } .searchbtn .lbl { flex: 1; text-align: left; }
.searchbtn kbd { font: inherit; font-size: .72rem; border: 1px solid var(--line); border-radius: 4px; padding: .05rem .35rem; background: #f4f6f9; }
dialog.palette { width: min(640px, calc(100vw - 1.5rem)); max-height: min(78vh, 640px); margin-top: 8vh; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: 0 20px 60px rgba(8, 20, 40, .35); display: flex; flex-direction: column; overflow: hidden; }
dialog.palette:not([open]) { display: none; }
.palette::backdrop { background: rgba(8, 20, 40, .45); }
.pal-head { display: flex; align-items: center; gap: .6rem; padding: .7rem .9rem; border-bottom: 1px solid var(--line); }
.pal-input { flex: 1; border: 0; outline: none; font: inherit; font-size: 1.05rem; min-height: 40px; background: transparent; }
.pal-input:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; border-radius: 4px; }
.pal-close { background: none; border: 0; min-width: 40px; min-height: 40px; cursor: pointer; color: var(--muted); }
.pal-kinds { display: flex; gap: .35rem; padding: .5rem .9rem; overflow-x: auto; border-bottom: 1px solid var(--line); }
.pal-chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: .25rem .7rem; font: inherit; font-size: .82rem; cursor: pointer; white-space: nowrap; min-height: 32px; }
.pal-chip.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.pal-list { overflow-y: auto; padding: .3rem 0 .5rem; flex: 1; }
.pal-grp { font-size: .7rem; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); padding: .6rem .9rem .2rem; display: flex; justify-content: space-between; align-items: center; }
.pal-more { background: none; border: 0; color: var(--navy); font: inherit; font-size: .75rem; text-transform: none; letter-spacing: 0; cursor: pointer; text-decoration: underline; min-height: 28px; }
.pal-opt { display: flex; flex-direction: column; gap: .05rem; padding: .5rem .9rem; color: var(--ink, #14233a); text-decoration: none; border-left: 3px solid transparent; }
.pal-opt.on { background: #eef3f9; border-left-color: var(--orange); }
.pal-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .pal-sub { font-size: .82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pal-empty { padding: 1.2rem .9rem; margin: 0; } .pal-help { padding: .4rem .9rem; margin: 0; border-top: 1px solid var(--line); }
@media (max-width: 860px) { .searchbtn { min-width: 0; } .searchbtn kbd { display: none; } dialog.palette { margin-top: 4vh; max-height: 88vh; } .pal-help { display: none; } }

/* ---------- my menu dialog, settings layout ---------- */
.userbox .row { flex-wrap: wrap; } .userbox #prefs { flex-basis: 100%; }
@media (max-width: 860px) { .userbox .row { flex-wrap: nowrap; } .userbox #prefs { flex-basis: auto; } }
.prefsform fieldset { border: 1px solid var(--line); border-radius: var(--radius); margin: .8rem 0; padding: .6rem .9rem; } .prefsform legend { font-weight: 650; padding: 0 .3rem; }
.pf-preset, .pf-row { display: flex; align-items: flex-start; gap: .5rem; padding: .3rem 0; cursor: pointer; } .pf-preset input, .pf-row input { margin-top: .25rem; flex: none; }
.pf-pair { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1rem; align-items: center; } .pf-pair select { min-height: 40px; }

.settingslayout { display: grid; grid-template-columns: 13.5rem minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.settingsnav { position: sticky; top: 1rem; } .settingsnav [role=tablist] { display: flex; flex-direction: column; gap: 2px; }
.settingsnav .navgroup { font-size: .68rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: .9rem .7rem .25rem; }
.settingsnav button { text-align: left; background: transparent; border: 0; border-left: 3px solid transparent; padding: .5rem .7rem; font: inherit; font-weight: 600; color: var(--navy-900); cursor: pointer; border-radius: 0 var(--radius) var(--radius) 0; min-height: 40px; }
.settingsnav button:hover { background: rgba(30, 58, 95, .06); } .settingsnav button.on { border-left-color: var(--orange); background: rgba(30, 58, 95, .08); }
.settingsbody { min-width: 0; }
.modlist { list-style: none; margin: 0; padding: 0; } .modlist li { padding: .7rem 0; border-top: 1px solid var(--line); } .modlist li:first-child { border-top: 0; } .modlist label { display: flex; align-items: center; gap: .5rem; cursor: pointer; } .modlist p { margin: .2rem 0 0 1.7rem; }
@media (max-width: 860px) { .settingslayout { grid-template-columns: 1fr; gap: .5rem; } .settingsnav { position: static; } .settingsnav [role=tablist] { flex-direction: row; overflow-x: auto; gap: .2rem; border-bottom: 1px solid var(--line); } .settingsnav .navgroup { display: none; }
  .settingsnav button { border-left: 0; border-bottom: 3px solid transparent; white-space: nowrap; border-radius: 0; } .settingsnav button.on { border-bottom-color: var(--orange); } }
[data-role=property-kpis] { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.history { margin: 1rem 0; } .history summary { cursor: pointer; font-weight: 600; padding: .4rem 0; }

.actionhistory { margin: .4rem 0 .4rem 1.2rem; padding: 0; } .actionhistory li { margin: .25rem 0; }
