/* Snag List — PWA styles. One font (IBM Plex Sans), tonal surfaces, hairline borders, status colour only where it means something. */

@font-face { font-family: "Plex"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Plex"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Plex"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/ibm-plex-sans-latin-600-normal.woff2") format("woff2"); }

:root {
  --bg: #F3F5F4;
  --surface: #FFFFFF;
  --surface-2: #E9EDEC;
  --surface-3: #DFE4E3;
  --ink: #1B2A41;
  --ink-2: #3A4757;
  --muted: #65717E;
  --line: #D6DCE0;
  --line-strong: #B9C2C8;
  --accent: #8C1D2B;
  --accent-ink: #FFFFFF;
  --accent-soft: #F6E7E9;
  --accent-soft-ink: #6E1522;
  --logo: #971A22;                 /* the QHSE shield: the Adada & Kabbani maroon */
  --open: #D9480F;      --open-soft: #FDE3D7;
  --corrected: #C98A05; --corrected-soft: #FBEFD1;
  --accepted: #2E8B57;  --accepted-soft: #DDF3E4;
  --rejected: #9B2C2C;  --rejected-soft: #F3D9D9;
  --dot-open: #DC2626;   --dot-closed: #15803D;   /* the observation dots on region / unit cards: plain red and green */
  --high: #B42318; --medium: #B54708; --low: #475467;
  --shadow: 0 1px 2px rgba(27, 42, 65, .06), 0 8px 24px -12px rgba(27, 42, 65, .18);
  --radius: 14px;
  --radius-s: 9px;
  --nav-h: 64px;
  --top-h: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #0F1416;
  --surface: #171D20;
  --surface-2: #1F2629;
  --surface-3: #283034;
  --ink: #E8ECEE;
  --ink-2: #C6CED3;
  --muted: #94A0A9;
  --line: #2A3338;
  --line-strong: #3B464C;
  --accent: #D14A5E;
  --accent-ink: #FFFFFF;
  --accent-soft: #3A1A20;
  --accent-soft-ink: #F2B8C2;
  --logo: #E8A0AA;                 /* a light rose: the shield shows on dark */
  --open: #F58A5B;      --open-soft: #3A2217;
  --corrected: #F2B63B; --corrected-soft: #3A2E12;
  --accepted: #4FC57F;  --accepted-soft: #16301F;
  --rejected: #E07A7A;  --rejected-soft: #3A1E1E;
  --dot-open: #F15B5B;   --dot-closed: #6EE7A0;   /* lighter than the red, so red-green colour-blind eyes still tell them apart */
  --high: #F08A7E; --medium: #F2A65A; --low: #A5B0BA;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 28px -14px rgba(0,0,0,.7);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Plex", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
img { display: block; max-width: 100%; }
h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 24px; line-height: 1.2; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- app frame ---------- */
#app { display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: calc(var(--top-h) + var(--safe-t));
  padding-top: var(--safe-t);
  display: flex; align-items: center; gap: 10px;
  padding-left: 14px; padding-right: 10px;
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar .title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.15; }
.topbar .title strong { font-size: 17px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .title span { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.villa-switch { display: flex; align-items: center; gap: 8px; background: none; border: 0; padding: 6px 8px 6px 0; text-align: left; min-width: 0; flex: 1; border-radius: 10px; }
.villa-switch .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); flex: none; }
.iconbtn {
  width: 42px; height: 42px; border-radius: 12px; border: 0; background: transparent;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2);
  position: relative;
}
.iconbtn:active { background: var(--surface-2); }
.iconbtn svg { width: 22px; height: 22px; }
.badge-count {
  position: absolute; top: 4px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 9px; background: var(--corrected); color: #fff; font-size: 11px; font-weight: 600;
  display: flex; align-items: center; justify-content: center;
}
.badge-count.ok { background: var(--accepted); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

main { flex: 1; padding: 16px 16px calc(var(--nav-h) + var(--safe-b) + 24px); max-width: 720px; width: 100%; margin: 0 auto; }
main.wide { max-width: 1100px; }

.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--nav-h) + var(--safe-b)); padding-bottom: var(--safe-b);
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;     /* 3 tabs on Home, 6 inside a unit */
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 500; -webkit-tap-highlight-color: transparent;
}
.bottomnav a svg { width: 24px; height: 24px; }
.bottomnav a.active { color: var(--accent); }
.bottomnav a.active svg { stroke-width: 2.2; }

@media (min-width: 900px) {
  #app { flex-direction: row; }
  .topbar { position: fixed; left: 232px; right: 0; }
  .bottomnav {
    position: fixed; top: 0; bottom: 0; left: 0; width: 232px; height: auto; padding: 24px 12px;
    display: flex; flex-direction: column; justify-content: flex-start; gap: 4px;
    border-top: 0; border-right: 1px solid var(--line); background: var(--surface);
  }
  .bottomnav a { flex-direction: row; justify-content: flex-start; gap: 12px; padding: 11px 14px; border-radius: 10px; font-size: 14px; }
  .bottomnav a.active { background: var(--accent-soft); color: var(--accent-soft-ink); }
  .bottomnav .brand { display: flex !important; padding: 2px 14px 20px; }
  main { margin-left: 232px; padding: calc(var(--top-h) + 24px) 32px 48px; max-width: none; }
  main > .page { max-width: 760px; margin: 0 auto; }
  main.wide > .page { max-width: 1080px; }
}
.bottomnav .brand { display: none; }

/* ---------- side menu (the shield opens / hides it) ---------- */
.brandbtn { padding: 2px 4px; }
.brandbtn .mark { width: 26px; height: 30px; }
.drawer-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); z-index: 40; }
.drawer-back.hidden { display: none; }
.drawer { position: fixed; top: 0; bottom: 0; left: 0; width: min(300px, 84vw); z-index: 41; background: var(--surface); box-shadow: var(--shadow);
  transform: translateX(-104%); transition: transform .22s ease; display: flex; flex-direction: column; padding: calc(12px + var(--safe-t)) 12px calc(12px + var(--safe-b)); }
.drawer.open { transform: none; }
.drawer-head { position: relative; display: flex; justify-content: center; padding: 8px 6px 16px; border-bottom: 1px solid var(--line); }
.drawer-head .iconbtn { position: absolute; top: 0; right: 0; }
.drawer-nav { display: flex; flex-direction: column; gap: 4px; padding: 12px 0; flex: 1; overflow: auto; }
.drawer-nav a { display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 10px; text-decoration: none; color: var(--ink-2); font-weight: 500; }
.drawer-nav a svg { width: 22px; height: 22px; }
.drawer-nav a.active { background: var(--accent-soft); color: var(--accent-soft-ink); }
.drawer-foot { border-top: 1px solid var(--line); padding-top: 12px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
@media (min-width: 900px) {
  html.nav-collapsed .bottomnav { display: none; }
  html.nav-collapsed .topbar { left: 0; }
  html.nav-collapsed main { margin-left: 0; }
}

/* ---------- dashboard ---------- */
.dash-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.dash-head .seg.sm button { min-height: 36px; padding: 0 12px; font-size: 13px; }
.filters .input { min-height: 40px; padding: 6px 32px 6px 12px; width: auto; font-size: 14px; }
.kpi { position: relative; overflow: hidden; padding-left: 16px; }
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--line-strong); }
.kpi.open::before { background: var(--open); } .kpi.accepted::before { background: var(--accepted); }
.kpi.replace::before { background: var(--rejected); } .kpi.repair::before { background: var(--corrected); } .kpi.pct::before { background: var(--accent); }
.kpi.replace b { color: var(--rejected); } .kpi.repair b { color: var(--corrected); } .kpi.pct b { color: var(--accent); }
.kpi small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 18px; font-size: 13px; color: var(--muted); margin: 8px 0 4px; }
.facts b { color: var(--ink); font-variant-numeric: tabular-nums; }
.table td .pct { display: inline-block; width: 42px; height: 6px; border-radius: 3px; background: var(--surface-3); vertical-align: middle; margin-right: 6px; overflow: hidden; }
.table td .pct i { display: block; height: 100%; background: var(--accepted); }
.empty-dash { display: flex; gap: 14px; align-items: center; padding: 28px 18px; color: var(--muted); }
.empty-dash svg { width: 40px; height: 40px; flex: none; color: var(--accent); }
/* users & roles: one row per person — who + username | role tick boxes | actions (stacked on a phone) */
.urow { display: grid; grid-template-columns: 1fr; gap: 10px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.urow:last-child { border-bottom: 0; }
.urow .who { min-width: 0; }
.urow .who > b { font-size: 15px; }
.urow.archived .who > b { color: var(--muted); text-decoration: line-through; }
.urow .acts { display: flex; flex-wrap: wrap; gap: 6px; }
.urow .acts .btn { flex: 1 1 auto; }
.uhead { display: none; }
@media (min-width: 980px) {
  .urow, .uhead { grid-template-columns: minmax(240px, 300px) 1fr 140px; gap: 18px; align-items: start; }
  .uhead { display: grid; padding: 12px 0 8px; border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
  .urow .acts { flex-direction: column; } .urow .acts .btn { flex: none; }
}
.roles-pick { display: flex; flex-wrap: wrap; gap: 2px 16px; }
.roles-pick label { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; font-size: 14px; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.roles-pick input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.roles-pick input:checked + span { color: var(--ink); font-weight: 600; }
.roles-pick input:disabled { cursor: not-allowed; }
.roles-legend { margin: 6px 0 2px; }
/* the username, written so nobody can misread it (l / I / 1, O / 0) */
.mono-id { font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace; overflow-wrap: anywhere; }
.uname { display: flex; align-items: center; gap: 10px; width: fit-content; max-width: 100%; margin: 8px 0 6px; padding: 4px 4px 4px 12px; border-radius: 10px; background: var(--accent-soft); }
.uname small { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-soft-ink); }
.uname b { font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Roboto Mono", monospace; font-size: 20px; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }
.uname .btn { min-height: 32px; padding: 0 10px; font-size: 13px; }
.user-row.archived .uname { opacity: .6; }
.user-form .grow { flex: 1 1 220px; }     /* side by side on a laptop, one per line on a phone */
.err-text { color: var(--rejected); } .warn-text { color: var(--corrected); }
.fail-row { padding: 10px 0; border-bottom: 1px solid var(--line); } .fail-row:last-child { border-bottom: 0; }
.signin-kv { grid-template-columns: 90px 1fr; align-items: baseline; margin: 6px 0 4px; }
.signin-kv dd.big { font-size: 20px; font-weight: 700; }
.pw-wrap { position: relative; }
.pw-wrap .input { padding-right: 76px; }
.pw-eye { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); min-height: 34px; padding: 0 12px; border: 0; border-radius: 8px; background: transparent; color: var(--accent); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }

.tag.consultant { display: inline-block; background: var(--low); color: #fff; border-radius: 6px; padding: 1px 7px; font-size: 11px; font-weight: 600; vertical-align: middle; }
.tag.drawings { display: inline-block; background: #EDE9FB; color: #4A3AA7; border-radius: 6px; padding: 1px 7px; font-size: 11px; font-weight: 600; vertical-align: middle; }
:root[data-theme="dark"] .tag.drawings { background: #2A2250; color: #C9BFF5; }
/* KAPSARC (2026-10-24): a general observation, and the rows of its other places (level / area / wing) */
.tag.general { display: inline-block; background: #DDF0F4; color: #155E75; border-radius: 6px; padding: 1px 7px; font-size: 11px; font-weight: 600; vertical-align: middle; }
:root[data-theme="dark"] .tag.general { background: #133A44; color: #A5DDEA; }
.place-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)) auto; gap: 6px; align-items: center; margin-top: 6px; }
.place-row .input { min-width: 0; padding-left: 8px; padding-right: 4px; font-size: 14px; }
.place-btn { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 5px 2px 2px; font: inherit; font-size: 12px; color: var(--ink); cursor: pointer; }
div.place-btn { cursor: default; }
.general-card .code { color: #155E75; }
:root[data-theme="dark"] .general-card .code { color: #A5DDEA; }
.tag.client { display: inline-block; background: var(--ink); color: var(--bg); border-radius: 6px; padding: 1px 7px; font-size: 11px; font-weight: 600; letter-spacing: .02em; vertical-align: middle; }
.check-row { display: flex; align-items: center; gap: 10px; padding: 10px 2px; cursor: pointer; }
.check-row input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card + .card { margin-top: 12px; }
.section { margin: 18px 0 8px; display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.section h2 { font-size: 15px; font-weight: 600; color: var(--ink-2); }
.section .hint { font-size: 12px; color: var(--muted); }
.stack > * + * { margin-top: 12px; }
.row { display: flex; align-items: center; gap: 10px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.list { display: flex; flex-direction: column; gap: 10px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); font-weight: 500; font-size: 15px; text-decoration: none;
  -webkit-tap-highlight-color: transparent; transition: transform .06s ease, background .15s ease;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.soft { background: var(--accent-soft); border-color: transparent; color: var(--accent-soft-ink); }
.btn.danger { background: var(--open-soft); border-color: transparent; color: var(--open); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.btn.block { width: 100%; }
.btn.lg { min-height: 54px; font-size: 16px; border-radius: 14px; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn svg { width: 20px; height: 20px; flex: none; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

.capture-btn {
  width: 100%; min-height: 96px; border-radius: 16px; border: 2px dashed var(--line-strong);
  background: var(--surface); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  color: var(--accent); font-weight: 600; font-size: 16px; -webkit-tap-highlight-color: transparent;
}
.capture-btn svg { width: 34px; height: 34px; }
.capture-btn:active { background: var(--accent-soft); }
.capture-btn span { color: var(--muted); font-weight: 400; font-size: 12px; }

/* ---------- forms ---------- */
.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.input, textarea.input, select.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink); outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea.input { min-height: 88px; resize: vertical; line-height: 1.4; }
select.input { appearance: none; -webkit-appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }

/* chips: the main selectors on site — big enough for a thumb */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin: 0 -16px; padding-left: 16px; padding-right: 16px; scrollbar-width: none; }
.chips.scroll::-webkit-scrollbar { display: none; }
.chip {
  min-height: 42px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink-2); font-size: 14px; font-weight: 500; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
  -webkit-tap-highlight-color: transparent;
}
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
:root[data-theme="dark"] .chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.chip.add { border-style: dashed; color: var(--accent); }
.chip.sm { min-height: 34px; padding: 0 12px; font-size: 13px; }
.chip.status-open.on { background: var(--open); border-color: var(--open); color: #fff; }
.chip.status-corrected.on { background: var(--corrected); border-color: var(--corrected); color: #fff; }
.chip.status-accepted.on { background: var(--accepted); border-color: var(--accepted); color: #fff; }
.chip.status-rejected.on { background: var(--rejected); border-color: var(--rejected); color: #fff; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; border: 1px solid var(--line-strong); border-radius: 12px; overflow: hidden; background: var(--surface); }
.seg button { min-height: 44px; border: 0; background: transparent; color: var(--muted); font-weight: 500; border-right: 1px solid var(--line); }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--ink); color: var(--bg); }
:root[data-theme="dark"] .seg button.on { background: var(--accent); color: var(--accent-ink); }
.seg button.on.p-high { background: var(--high); color: #fff; }
.seg button.on.p-medium { background: var(--medium); color: #fff; }
.seg button.on.p-low { background: var(--low); color: #fff; }

/* ---------- status / priority ---------- */
.status { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.open { background: var(--open-soft); color: var(--open); }
.status.corrected { background: var(--corrected-soft); color: var(--corrected); }
.status.accepted { background: var(--accepted-soft); color: var(--accepted); }
.status.rejected { background: var(--rejected-soft); color: var(--rejected); }
.prio { font-size: 12px; font-weight: 600; }
.prio.high { color: var(--high); } .prio.medium { color: var(--medium); } .prio.low { color: var(--low); }
.tag { display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); font-size: 12px; }

/* ---------- activity log ---------- */
.act-row { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13.5px; }
.act-row .when { flex: none; width: 46px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 1px; }
.act-row.bad { background: var(--rejected-soft); margin: 0 -14px; padding: 8px 14px; }
.act-person { display: flex; gap: 10px; width: 100%; padding: 8px 0; border: 0; border-bottom: 1px solid var(--line); background: none; color: inherit; font: inherit; font-size: 13.5px; text-align: left; cursor: pointer; }
.act-person:last-of-type { border-bottom: 0; }
.act-person .when { flex: none; width: 96px; color: var(--muted); font-variant-numeric: tabular-nums; }
.act-person.on b { color: var(--accent); }

/* ---------- photos ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.photo-grid.two { grid-template-columns: repeat(2, 1fr); }
.photo { position: relative; aspect-ratio: 4 / 3; border-radius: 10px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line); }
.photo img, .photo canvas { width: 100%; height: 100%; object-fit: cover; }
.photo .x, .photo .mark {
  position: absolute; width: 30px; height: 30px; border-radius: 50%; border: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.55); color: #fff;
}
.photo .x { top: 6px; right: 6px; }
.photo .mark { bottom: 6px; right: 6px; }
.photo .mark svg, .photo .x svg { width: 16px; height: 16px; }
.photo .pending { position: absolute; left: 6px; bottom: 6px; padding: 2px 7px; border-radius: 6px; background: rgba(0,0,0,.55); color: #fff; font-size: 11px; }
.photo .pending.lost { background: rgba(176, 36, 24, .85); }
.photo.empty { display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; border-style: dashed; }
.photo-placeholder { aspect-ratio: 4 / 3; border: 1.5px dashed var(--line-strong); border-radius: 10px; display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 13px; font-style: italic; }
/* an observation's photos as pairs: the defect photo and, beside it, its correction photo (or the place to add it) */
.pair-head { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0 2px 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.photo-grid.pairs { row-gap: 14px; }
.photo-placeholder.add { width: 100%; flex-direction: column; gap: 6px; padding: 0; background: var(--accent-soft); border-color: var(--accent); color: var(--accent-soft-ink); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.photo-placeholder.add svg { width: 22px; height: 22px; }

/* ---------- item cards ---------- */
.item-card {
  display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 10px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: inherit; position: relative; overflow: hidden;
}
.item-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--muted); }
.item-card.s-open::before { background: var(--open); }
.item-card.s-corrected::before { background: var(--corrected); }
.item-card.s-accepted::before { background: var(--accepted); }
.item-card.s-rejected::before { background: var(--rejected); }
.item-card .thumb { width: 84px; height: 84px; border-radius: 8px; overflow: hidden; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 11px; }
.item-card .thumb img, .item-card .thumb canvas { width: 100%; height: 100%; object-fit: cover; }
.item-card .num { font-weight: 600; font-size: 16px; letter-spacing: .01em; font-variant-numeric: tabular-nums; }
.item-card .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.item-card .cmt { font-size: 14px; color: var(--ink-2); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.item-card .foot { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.group-head { margin: 18px 0 8px; font-size: 13px; font-weight: 600; color: var(--muted); text-transform: none; display: flex; justify-content: space-between; }
.group-head.floor { font-size: 15px; color: var(--ink); margin-top: 24px; }

/* ---------- villa list ---------- */
.villa-card { display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.villa-card.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.villa-card .code { font-size: 20px; font-weight: 600; letter-spacing: .01em; }
.villa-card .name { color: var(--muted); font-size: 14px; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.progress > i { display: block; height: 100%; background: var(--accepted); border-radius: 3px; }
.counts { display: flex; gap: 14px; margin-top: 8px; font-size: 13px; }
.counts b { font-weight: 600; }
/* one dot per observation on the region and unit cards (green = closed, red = open); every card of a list shares one size */
.obs-dots { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 12px; --d: 10px; }
.obs-dots.d-m { gap: 3px; --d: 8px; }
.obs-dots.d-s { gap: 2px; --d: 6px; }
.obs-dots.d-xs { gap: 2px; --d: 5px; }
.obs-dots.d-xxs { gap: 1px; --d: 4px; }
.obs-dots > i { flex: none; width: var(--d); height: var(--d); border-radius: 50%; background: var(--dot-open); }
.obs-dots > i.dc { background: var(--dot-closed); }
.obs-none { margin-top: 12px; }
.counts .c-open { color: var(--dot-open); } .counts .c-closed { color: var(--dot-closed); }
.counts .z { color: var(--muted); }      /* "0 open" on a finished unit is not red */
.region-card, .unit-card { container-type: inline-size; }
@container (min-width: 560px) {          /* a wide card (desktop Home, iPad) has twice the room: bigger dots, about the same height */
  .obs-dots.d-m   { --d: 10px; gap: 4px; }
  .obs-dots.d-s   { --d: 8px;  gap: 3px; }
  .obs-dots.d-xs  { --d: 7px;  gap: 3px; }
  .obs-dots.d-xxs { --d: 6px;  gap: 2px; }
}

/* ---------- regions / units ---------- */
.region-card { display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.region-card.current { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.region-card .code { font-size: 20px; font-weight: 600; letter-spacing: .01em; }
.region-card .name { color: var(--muted); font-size: 13px; }
.unit-card { -webkit-tap-highlight-color: transparent; }     /* a .villa-card: same shape as a region card */
.unit-card:active { background: var(--surface-2); }
.unit-card .name { font-variant-numeric: tabular-nums; }
@media (min-width: 900px) { .list.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } }

/* ---------- parts / elements / drawings ---------- */
.part-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.part-card { display: block; text-decoration: none; color: inherit; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-height: 108px; position: relative; overflow: hidden; -webkit-tap-highlight-color: transparent; }
.part-card::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--surface-3); }
.part-card.has-open::after { background: var(--open); }
.part-card:active { background: var(--surface-2); }
.part-card .pname { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 17px; }
.part-card .pname svg { width: 26px; height: 26px; color: var(--accent); flex: none; }
.part-card .pcounts { margin-top: 10px; font-size: 13px; }
.dwg-strip { display: flex; gap: 8px; overflow-x: auto; margin: 10px -4px 0; padding: 4px; scrollbar-width: none; }
.dwg-strip::-webkit-scrollbar { display: none; }
.dwg { flex: none; width: 124px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); padding: 0; overflow: hidden; text-align: left; cursor: pointer; }
.dwg img { width: 100%; height: 84px; object-fit: cover; object-position: left top; display: block; background: #fff; }
.dwg span { display: block; font-size: 11px; padding: 5px 7px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* KAPSARC's plans (2026-10-26): the first one large, the whole plan seen (not a sheet's corner) */
.plan-hero { display: block; width: 100%; margin-top: 10px; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; cursor: pointer; text-align: left; }
.plan-hero img { display: block; width: 100%; height: 200px; object-fit: contain; background: #fff; }
.plan-hero span { display: block; font-size: 12px; padding: 6px 9px; color: var(--ink-2); border-top: 1px solid var(--line); background: var(--surface-2); }
.plan-strip .dwg img { object-fit: contain; object-position: center; }
.el-card .obs-list { margin-top: 10px; border-top: 1px solid var(--line); }
.obs-row { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.obs-row:last-child { border-bottom: 0; }
.obs-row .thumb { width: 56px; height: 56px; border-radius: 8px; background: var(--surface-2); overflow: hidden; flex: none; }
.obs-row .thumb img { width: 100%; height: 100%; object-fit: cover; }
.obs-row .cmt { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--ink-2); }
.photo-cell .caption { min-height: 36px; font-size: 13px; padding: 6px 10px; margin-top: 6px; border-radius: 9px; }
.photo-cap { font-size: 12px; color: var(--ink-2); margin-top: 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.seg button.on.a-replace { background: var(--open); color: #fff; }
details.more { margin-top: 14px; }
details.more summary { cursor: pointer; color: var(--accent); font-weight: 500; padding: 6px 0; list-style: none; }
details.more summary::before { content: "+ "; }
details.more[open] summary::before { content: "– "; }
.viewer.sheetview .vbody { background: #2a2a2a; }
.viewer.sheetview img { position: absolute; left: 0; top: 0; max-width: none; max-height: none; transform-origin: 0 0; will-change: transform; user-select: none; -webkit-user-drag: none; }
.viewer .vtitle { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.viewer .vtitle b { font-size: 15px; } .viewer .vtitle span { font-size: 12px; opacity: .75; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer .vhint { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); color: #fff; font-size: 11px; opacity: .6; pointer-events: none; white-space: nowrap; }
.viewer .vloading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 13px; padding: 20px; text-align: center; }
.viewer .vnav { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 10px calc(8px + var(--safe-b)); }
.viewer .vnav .btn, .viewer .vhead .btn { background: rgba(255,255,255,.12); border-color: transparent; color: #fff; }
.viewer .vspecs { position: absolute; left: 0; right: 0; bottom: 0; max-height: 45%; overflow: auto; background: rgba(0,0,0,.88); color: #fff; padding: 10px 14px calc(10px + var(--safe-b)); font-size: 12px; z-index: 2; }
.viewer .vspecs div { padding: 3px 0; border-bottom: 1px solid rgba(255,255,255,.1); }
.viewer .vspecs .tag { background: rgba(255,255,255,.15); color: #fff; }
.kv-code { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- KPI / dashboard ---------- */
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.kpi b { display: block; font-size: 22px; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi span { font-size: 12px; color: var(--muted); }
.kpi.open b { color: var(--open); } .kpi.corrected b { color: var(--corrected); } .kpi.accepted b { color: var(--accepted); } .kpi.rejected b { color: var(--rejected); }
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 12px 6px; }
.chart-card h3 { font-size: 14px; color: var(--ink-2); margin-bottom: 6px; }
.chart-card canvas { width: 100% !important; }
.chart-wrap { position: relative; height: 220px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.table th { font-size: 12px; color: var(--muted); font-weight: 500; }
.table td.n, .table th.n { text-align: right; font-variant-numeric: tabular-nums; }
@media (min-width: 900px) { .kpis { grid-template-columns: repeat(6, 1fr); } .charts-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--line-strong); }
.timeline li::after { content: ""; position: absolute; left: 8px; top: 18px; bottom: -2px; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline li.accepted::before { background: var(--accepted); } .timeline li.rejected::before { background: var(--rejected); } .timeline li.corrected::before { background: var(--corrected); }
.timeline .when { font-size: 12px; color: var(--muted); }

/* ---------- banners / toast / modal ---------- */
.banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--corrected-soft); color: var(--ink); font-size: 14px; margin-bottom: 14px; }
.banner.info { background: var(--accent-soft); }
.banner.danger { background: var(--open-soft); }
.banner svg { width: 20px; height: 20px; flex: none; margin-top: 1px; }
.banner .btn { margin-left: auto; }
#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); transform: translateX(-50%) translateY(20px); opacity: 0; transition: .2s; z-index: 60; background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; max-width: 92vw; pointer-events: none; box-shadow: var(--shadow); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
@media (min-width: 900px) { #toast { bottom: 24px; } }

.modal-back { position: fixed; inset: 0; background: rgba(10, 16, 20, .55); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.modal { background: var(--surface); width: 100%; max-width: 560px; border-radius: 20px 20px 0 0; padding: 18px 18px calc(18px + var(--safe-b)); max-height: 92vh; overflow: auto; box-shadow: var(--shadow); }
.modal h2 { margin-bottom: 10px; }
@media (min-width: 900px) { .modal-back { align-items: center; } .modal { border-radius: 20px; padding-bottom: 18px; } }
.sheet-actions { display: flex; flex-direction: column; gap: 8px; margin-top: 12px; }

/* ---------- viewer / annotate ---------- */
.viewer { position: fixed; inset: 0; background: #000; z-index: 70; display: flex; flex-direction: column; }
.viewer .vhead { display: flex; justify-content: space-between; align-items: center; padding: calc(10px + var(--safe-t)) 10px 10px; color: #fff; }
.viewer .vhead .btn { background: rgba(255,255,255,.12); border-color: transparent; color: #fff; }
.viewer .vbody { flex: 1; position: relative; overflow: hidden; display: flex; align-items: center; justify-content: center; touch-action: none; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer canvas.draw { position: absolute; touch-action: none; }
.viewer .tools { display: flex; gap: 8px; padding: 10px; justify-content: center; flex-wrap: wrap; padding-bottom: calc(10px + var(--safe-b)); }
.viewer .tools button { min-width: 48px; height: 44px; border-radius: 10px; border: 1px solid rgba(255,255,255,.2); background: rgba(255,255,255,.08); color: #fff; font-size: 13px; }
.viewer .tools button.on { background: #fff; color: #000; }
.viewer .tools .swatch { width: 36px; min-width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; }
.viewer .tools .swatch.on { border-color: #fff; }

/* ---------- login ---------- */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; }
.login .card { width: 100%; max-width: 380px; padding: 28px 24px; }
.logo-mark { width: 84px; height: 96px; margin: 0 auto 12px; display: flex; align-items: center; justify-content: center; }
.logo-mark .qmark { width: 100%; height: 100%; }
.login h1.stacked { line-height: 1.12; letter-spacing: .06em; margin-bottom: 10px; }
.login h1, .login p.muted { text-align: center; }
/* the QHSE shield: hollow (lines only), no halo - A&K maroon on light, a light rose on dark (the user's choice).
   One shield.svg used as a mask, so it takes the theme colour. */
.qmark { display: block; flex: none; width: 26px; height: 30px; background: var(--logo);
  -webkit-mask: url(/static/icons/shield.svg) center / contain no-repeat; mask: url(/static/icons/shield.svg) center / contain no-repeat; }
/* logo lockup (desktop sidebar, side menu): the shield, then "A&K" and "QHSE" under each other, then the app name */
.lockup { display: flex; flex-direction: column; align-items: center; text-align: center; }
.lockup .qmark { width: 42px; height: 48px; margin-bottom: 8px; }
.lockup b { display: block; font-size: 17px; font-weight: 700; line-height: 1.15; letter-spacing: .08em; color: var(--ink); }
.lockup small { display: block; margin-top: 5px; font-size: 11.5px; font-weight: 500; color: var(--muted); }
.logo-mark svg { width: 30px; height: 30px; stroke: #fff; }
.error { color: var(--open); font-size: 14px; margin: 8px 0; }

/* ---------- sticky save bar ---------- */
.savebar { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 8px); background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(10px); padding: 10px 0 2px; margin-top: 16px; z-index: 5; }
@media (min-width: 900px) { .savebar { bottom: 0; } }

.empty { text-align: center; padding: 40px 16px; color: var(--muted); }
.empty svg { width: 44px; height: 44px; margin: 0 auto 10px; opacity: .6; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.cat-row { display: flex; align-items: center; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cat-row:last-child { border-bottom: 0; }
.cat-row .name { flex: 1; font-weight: 500; }
.cat-row .name small { display: block; color: var(--muted); font-weight: 400; font-size: 12px; }
.cat-row.archived .name { color: var(--muted); text-decoration: line-through; }
.num-preview { font-size: 28px; font-weight: 600; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.pill-online { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--accepted-soft); color: var(--accepted); font-weight: 600; }
.pill-offline { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-weight: 600; }
.pill-pending { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--corrected-soft); color: var(--corrected); font-weight: 600; }
.rev-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.rev-row:last-child { border-bottom: 0; }
.rev-row .rev { font-weight: 600; font-size: 16px; min-width: 58px; }
.rev-row .grow { flex: 1 1 200px; }
.rev-row .actions { display: flex; gap: 6px; flex-basis: 100%; justify-content: flex-end; }
.rev-row .actions.inline { flex-basis: auto; }
@media (min-width: 900px) { .rev-row .actions { flex-basis: auto; } }

[hidden] { display: none !important; }     /* a field hidden by the app stays hidden whatever its class says */
/* ---------- Dashboard: every unit's reports (2026-10-13) ---------- */
.dash-reports { margin: 14px 0; }
.dash-reports .dr-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 2px; }
.dash-reports .dr-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.dash-reports .seg.sm button { min-height: 36px; padding: 0 12px; font-size: 13px; }
@media (max-width: 699px) {          /* phone: the two views on one line, the two "all" downloads side by side under them */
  .dash-reports .dr-head > div:first-child, .dash-reports .dr-tools, .dash-reports .dr-tools .seg { flex: 1 1 100%; }
  .dash-reports .dr-tools .btn { flex: 1 1 0; justify-content: center; }
}
.dr-row { cursor: pointer; margin: 0 -8px; padding-left: 8px; padding-right: 8px; border-radius: 10px; }
.dr-row:hover, .dr-row:focus-visible { background: var(--surface-2); outline: none; }
.dr-row .rev { min-width: 44px; }
/* ---------- Home: three cards - SOR, NCR, Reports (2026-10-11) ---------- */
.home-grid { display: grid; gap: 12px; }
@media (min-width: 640px) { .home-grid { grid-template-columns: 1fr 1fr; } .home-card[data-home="sor"] { grid-column: 1 / -1; } }
.home-card { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); container-type: inline-size; padding-bottom: 4px; }
.home-card::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--surface-3); }
.home-card.due::after { background: var(--corrected); }
.home-card.attn::after { background: var(--open); }
.home-link { display: block; min-height: 120px; padding: 16px; text-decoration: none; color: inherit; -webkit-tap-highlight-color: transparent; }
.home-link:active { background: var(--surface-2); }
.home-head { display: flex; align-items: center; gap: 12px; }
.home-icon { flex: none; width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center; background: var(--accent-soft); color: var(--accent); }
.home-icon svg { width: 26px; height: 26px; }
.home-card .code { font-size: 24px; font-weight: 700; letter-spacing: .02em; line-height: 1.1; }
.home-card .name { font-size: 14px; color: var(--muted); }
.home-card .go { margin-left: auto; color: var(--muted); display: flex; }
.home-card .go svg { width: 22px; height: 22px; transform: rotate(180deg); }
.home-meta { margin-top: 8px; font-size: 13px; color: var(--ink-2); }
.home-meta.due-line, .home-meta.attn-line { display: flex; align-items: center; gap: 6px; }
.home-meta.due-line { color: var(--corrected); } .home-meta.attn-line { color: var(--open); }
.home-meta svg { width: 16px; height: 16px; flex: none; }
.home-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 16px 14px; }
.home-quick .chip { text-decoration: none; color: var(--ink-2); }
.home-quick .chip svg { width: 15px; height: 15px; }
.home-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.counts .c-review { color: var(--corrected); }
.villa-switch.static { cursor: default; }
/* ---------- Projects (2026-10-21): the chooser's cards, as the Home cards; the project chip in the top bar ---------- */
.project-card { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); container-type: inline-size; padding-bottom: 4px; }
.project-card::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--accent); }
.project-card[data-project="KAP"]::after { background: var(--ink-2); }
.project-card.due::after { background: var(--corrected); }
.project-card .code { font-size: 24px; font-weight: 700; letter-spacing: .02em; line-height: 1.1; }
.project-card .name { font-size: 14px; color: var(--muted); }
.project-card .go { margin-left: auto; color: var(--muted); display: flex; }
.project-card .go svg { width: 22px; height: 22px; transform: rotate(180deg); }
.project-card[data-project="KAP"] .home-icon { background: var(--surface-2); color: var(--ink-2); }
.proj-chip { flex: none; height: 26px; min-width: 42px; padding: 0 9px; border-radius: 13px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-2);
  font-size: 11px; font-weight: 700; letter-spacing: .08em; display: inline-flex; align-items: center; justify-content: center; }
.proj-chip.other { background: var(--ink); border-color: var(--ink); color: var(--bg); }       /* KAPSARC: dark, never mistaken for the Ritz-Carlton */
.login-project { display: flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; margin: 2px 0 8px; }

/* ---------- NCR register ---------- */
.kpis.ncr-kpis { grid-template-columns: repeat(4, 1fr); }
.ncr-row { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; -webkit-tap-highlight-color: transparent; }
.ncr-row:last-child { border-bottom: 0; }
.ncr-row:active { background: var(--surface-2); }
.ncr-row.queued .ncr-num { color: var(--muted); }
.ncr-num { flex: none; min-width: 84px; max-width: 120px; font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.ncr-title { font-weight: 600; }
.ncr-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ncr-headline { font-size: 17px; font-weight: 600; }
.ncr-obs { padding: 10px 0; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.ncr-obs:last-child { border-bottom: 0; }
.ncr-photo { display: block; width: 100%; padding: 0; cursor: zoom-in; }
.status.cancelled { background: var(--surface-2); color: var(--muted); }
.tag.overdue { background: var(--open-soft); color: var(--open); font-weight: 600; }
.tag.major { background: var(--rejected-soft); color: var(--rejected); font-weight: 600; }
.tag.recv { background: var(--accent-soft); color: var(--accent-soft-ink); }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.obs-pick { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 2px 10px; }
.obs-pick .check-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.obs-pick .check-row:last-child { border-bottom: 0; }

/* ---------- Reports hub ---------- */
.make-grid { display: grid; gap: 10px; grid-template-columns: 1fr; }
@media (min-width: 640px) { .make-grid { grid-template-columns: 1fr 1fr; } }
.make-tile { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: inherit; }
.make-tile:active { background: var(--surface-2); }
.make-tile svg { width: 24px; height: 24px; color: var(--accent); flex: none; }
.make-tile b { display: block; font-size: 15px; }
.make-tile span { font-size: 12px; color: var(--muted); }
.doc-row .doc-type { font-size: 12px; font-weight: 700; min-width: 46px; text-align: center; padding: 3px 0; border-radius: 6px; background: var(--surface-2); color: var(--ink-2); }
.doc-type.t-SOR { background: var(--accent-soft); color: var(--accent-soft-ink); }
.doc-type.t-NCR, .doc-type.t-CPA { background: var(--open-soft); color: var(--open); }
.doc-type.t-QRP { background: var(--accepted-soft); color: var(--accepted); }
.doc-type.t-REC { background: var(--corrected-soft); color: var(--corrected); }

/* ---------- NCR Closure (2026-10-20): each photo of their NCR with our correction photo opposite ---------- */
/* Home: SOR full width, NCR and NCR Closure side by side, Reports full width */
@media (min-width: 640px) { .home-card[data-home="reports"] { grid-column: 1 / -1; } }
/* five cards (2026-10-27): Material Receiving and Reports side by side under NCR and NCR Closure */
@media (min-width: 640px) { .home-card[data-home="receiving"] ~ .home-card[data-home="reports"] { grid-column: auto; } }
.clo-ref { font-size: 21px; font-weight: 700; letter-spacing: .01em; line-height: 1.2; overflow-wrap: anywhere; margin-top: 2px; }
.clo-tags { gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.clo-tags:empty { display: none; }
.clo-progress { margin-top: 12px; }
.clo-big { font-size: 15px; color: var(--ink-2); }
.clo-big b { font-size: 28px; font-weight: 700; line-height: 1; color: var(--accepted); font-variant-numeric: tabular-nums; }
.clo-bar { display: flex; height: 8px; border-radius: 4px; background: var(--open-soft); overflow: hidden; margin-top: 8px; }
.clo-bar.none { background: var(--surface-2); }      /* no photo yet: a plain thin bar (never the page's big ".empty" box) */
.clo-bar i { display: block; flex: none; height: 100%; background: var(--accepted); }
.clo-bar i.w { background: var(--corrected); }
.clo-row .clo-bar { height: 6px; margin-top: 8px; }
.clo-sref { font-size: 15px; overflow-wrap: anywhere; }
.clo-frac { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.clo-kv dd { overflow-wrap: anywhere; }
.clo-btns { flex-wrap: wrap; }
.clo-btns .btn { flex: 1 1 160px; }
/* the photo pairs: both photos keep the shape of their photo (tall 9:16 from the site camera), never squeezed */
.clo-pair-head { padding: 0 11px; margin-top: 4px; }
.clo-items { display: flex; flex-direction: column; gap: 12px; }
.clo-item { position: relative; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 10px 12px; }
.clo-item::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--open); }
.clo-item.s-closed::before { background: var(--accepted); }
.clo-item.s-wait::before { background: var(--corrected); }
.clo-item-head { display: flex; align-items: center; gap: 8px; margin: 0 0 8px 4px; font-size: 14px; min-height: 30px; }
.clo-item-head .grow { min-width: 0; overflow-wrap: anywhere; }
.clo-no { font-size: 16px; }
.clo-menu { width: 36px; height: 36px; margin: -4px -4px -4px 0; flex: none; }
.clo-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; --ar: .5625; }
.clo-pair .photo-cell { min-width: 0; }
.clo-photo { display: block; width: 100%; aspect-ratio: var(--ar); padding: 0; margin: 0; background: var(--surface-2); font: inherit; color: inherit; }
.clo-photo img { object-fit: contain; }
button.photo.clo-photo { cursor: zoom-in; }
.photo-placeholder.clo-photo { display: flex; text-align: center; padding: 8px; }
.photo-placeholder.add.clo-photo { padding: 8px; }
.clo-lib { width: 100%; margin-top: 4px; }
.clo-drop { color: var(--open); }                      /* "Remove from this device": a refused photo, or one waiting for its author */
.clo-removed .clo-drop { padding: 0; min-height: 30px; }
.clo-more { margin-top: 4px; overflow-wrap: anywhere; }
.photo .pending.held { background: rgba(150, 100, 0, .9); }     /* waiting for its author to sign in on this phone */
.clo-wait .pending { max-width: calc(100% - 12px); overflow-wrap: anywhere; text-align: left; }
.clo-days { margin: -4px 0 12px; }
.clo-days .chip { min-height: 32px; }
.clo-note { margin: 8px 4px 0; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.clo-hint { display: flex; align-items: center; flex-wrap: wrap; gap: 2px 8px; margin: 6px 4px 0; color: var(--muted); }
.clo-hint .btn { min-height: 30px; padding: 0 8px; }
.clo-removed .clo-rrow { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.clo-removed .clo-rrow:last-child { border-bottom: 0; }
.clo-rrow img { width: 42px; height: 64px; object-fit: cover; border-radius: 6px; background: var(--surface-2); flex: none; }
.clo-file { display: flex; align-items: center; gap: 12px; padding: 12px; margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.clo-file svg { width: 28px; height: 28px; color: var(--accent); flex: none; }
.clo-file b { overflow-wrap: anywhere; }
@media (min-width: 640px) { .clo-pair { gap: 12px; } .clo-pair-head { gap: 12px; } }
@media (min-width: 900px) {             /* a wide screen: the pair stays tall but not huge, in the middle of its card */
  .clo-pair { max-width: 640px; margin: 0 auto; }
  .clo-pair-head { max-width: 662px; margin: 4px auto 6px; }
}

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Material receiving (2026-10-27): a delivery checked against its packing list. On hold = orange, escalated = violet. */
:root { --hold: #C2410C; --hold-soft: #FFEDD5; --esc: #4A3AA7; --esc-soft: #EDE9FB; }
:root[data-theme="dark"] { --hold: #FB923C; --hold-soft: #3A2412; --esc: #A79BF0; --esc-soft: #262040; }
.status.hold { background: var(--hold-soft); color: var(--hold); }
.status.esc { background: var(--esc-soft); color: var(--esc); }
.kpis.rcv-kpis { grid-template-columns: repeat(4, 1fr); }
.kpi.hold b { color: var(--hold); } .kpi.hold::before { background: var(--hold); }
.kpi.esc b { color: var(--esc); } .kpi.esc::before { background: var(--esc); }
.rcv-row .ncr-num { min-width: 74px; }
.rcv-result { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 13px 16px; border-radius: var(--radius); color: #fff; background: #2E8B57; }
.rcv-result b { font-size: 17px; letter-spacing: .03em; white-space: nowrap; }
.rcv-result span { font-size: 14px; line-height: 1.35; }
.rcv-result.r-remarks { background: #A16207; }
.rcv-result.r-hold { background: #C2410C; }
.rcv-result.r-partly_rejected, .rcv-result.r-rejected { background: #B42318; }
.rcv-result.r-none { background: var(--surface-3); color: var(--ink); }
.rcv-line { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 2px 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: transparent; color: inherit; font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.rcv-line:disabled { cursor: default; opacity: 1; }
.rcv-line:active:not(:disabled) { background: var(--surface-2); }
.rcv-line::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 2px; background: var(--accepted); }
.rcv-line.s-remarks::before { background: var(--corrected); }
.rcv-line.s-hold::before { background: var(--hold); }
.rcv-line.s-rejected::before, .rcv-line.s-partly_rejected::before { background: var(--rejected); }
.rcv-line .sn { min-width: 22px; text-align: right; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.rcv-line .grow { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rcv-line b { font-weight: 600; font-size: 14px; overflow-wrap: anywhere; }
.rcv-line .status { flex: none; }
.rcv-total { padding-top: 10px; }
.rcv-check { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rcv-check:last-of-type { border-bottom: 0; }
.rcv-check .grow { font-size: 14px; min-width: 0; }
.rcv-check .seg { flex: none; width: 168px; }
.rcv-check .seg button { min-height: 36px; font-size: 13px; }
.rcv-check .seg button.on.v-yes { background: var(--accepted); color: #fff; }
.rcv-check .seg button.on.v-no { background: var(--open); color: #fff; }
.rcv-docrow { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.rcv-docrow:last-of-type { border-bottom: 0; }
.rcv-docrow .grow { min-width: 0; overflow-wrap: anywhere; font-size: 14px; }
.rcv-docrow img { width: 40px; height: 52px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); flex: none; }
.rcv-doci { width: 40px; height: 52px; border-radius: 6px; background: var(--surface-2); display: flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.rcv-doci svg { width: 20px; height: 20px; }
.rcv-docbtns { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; margin-top: 12px; }
.rcv-docbtns > span { font-size: 14px; color: var(--ink-2); }
.rcv-read { margin: 10px 0 0; }
.rcv-act { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rcv-act:last-of-type { border-bottom: 0; }
.rcv-act input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--accepted); flex: none; }
.rcv-acttext { display: flex; flex-direction: column; gap: 2px; text-align: left; border: 0; background: transparent; color: inherit; font: inherit; padding: 0; cursor: pointer; min-width: 0; }
.rcv-acttext:disabled { cursor: default; }
.rcv-acttext .t { font-size: 14px; overflow-wrap: anywhere; }
.rcv-act.done .t { text-decoration: line-through; color: var(--muted); }
.rcv-qty { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.rcv-qty.two { grid-template-columns: 1fr 1fr; }      /* received and rejected; on hold under More (2026-11-03) */
.rcv-seg button { padding: 0 6px; font-size: 13px; }
.rcv-rline { display: flex; gap: 10px; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.rcv-rline:last-child { border-bottom: 0; }
.rcv-rline .sn { min-width: 20px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.rcv-rline .grow { min-width: 0; overflow-wrap: anywhere; }
.rcv-rline b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.rcv-pkgh { display: flex; align-items: baseline; gap: 8px; padding: 12px 2px 5px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.rcv-pkgh b { color: var(--ink); font-weight: 700; font-size: 14px; }
.rcv-pkgh:first-child { padding-top: 4px; }
/* several packing lists in one delivery (2026-11-03): a band per list that folds, its packages under it with a Checked
   mark; then "Without packing list" */
.rcv-plh { display: flex; align-items: center; gap: 10px; margin: 0 -14px; padding: 10px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-2); }
.rcv-plh .grow { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.rcv-plh b { color: var(--ink); font-weight: 700; font-size: 15px; }
div.rcv-plh { margin-top: 12px; border-top: 1px solid var(--line); }
.rcv-lines > div.rcv-plh:first-child { margin-top: -14px; border-top: 0; border-radius: var(--radius) var(--radius) 0 0; }
details.rcv-pl { margin: 0 -14px; border-bottom: 1px solid var(--line); }
details.rcv-pl > summary.rcv-plh { margin: 0; list-style: none; cursor: pointer; border-bottom: 0; }
details.rcv-pl > summary.rcv-plh::-webkit-details-marker { display: none; }
details.rcv-pl > summary.rcv-plh::after { content: ""; flex: none; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); margin: 0 4px 0 2px; transition: transform .15s; }
details.rcv-pl[open] > summary.rcv-plh::after { transform: rotate(45deg); }
details.rcv-pl[open] > summary.rcv-plh { border-bottom: 1px solid var(--line); }
.rcv-plbody { padding: 0 14px 6px; }
.rcv-plwarn { color: var(--open); font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.rcv-plwarn svg { width: 14px; height: 14px; }
.rcv-plprog { flex: none; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 999px; background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.rcv-plprog.done { background: var(--accepted-soft); color: var(--accepted); border-color: transparent; }
.rcv-pkgh .grow { flex: 1; }
.rcv-pkgh .chip.on { background: var(--accepted-soft); color: var(--accepted); border-color: transparent; }
.rcv-plh + .rcv-pkgh, .rcv-plbody > .rcv-pkgh:first-child { padding-top: 8px; }
/* approve / reject in one tap (2026-11-03): every line is Approved unless rejected - on its row, on its package's
   header or on its packing list's bar; a whole package's or list's photos in a strip under it */
.rcv-line.rcv-lrow { padding: 0 2px 0 0; gap: 6px; cursor: default; }
.rcv-line.rcv-lrow:active { background: transparent; }
.rcv-lmain { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 10px 2px 10px 12px; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.rcv-lmain:disabled { cursor: default; opacity: 1; }
.rcv-lmain:active:not(:disabled) { background: var(--surface-2); }
.rcv-dec { flex: none; display: inline-flex; align-items: center; gap: 4px; max-width: 48%; min-height: 34px; padding: 0 11px; border: 0; border-radius: 999px; font: inherit; font-size: 12px; font-weight: 600; white-space: nowrap; cursor: pointer; -webkit-tap-highlight-color: transparent; transition: transform .06s ease; }
.rcv-dec span { overflow: hidden; text-overflow: ellipsis; }
.rcv-dec svg { width: 14px; height: 14px; flex: none; }
.rcv-dec:active { transform: scale(.96); }
.rcv-dec:disabled { opacity: .55; cursor: default; }
.rcv-dec.ok { background: var(--accepted-soft); color: var(--accepted); }
.rcv-dec.no { background: var(--rejected); color: var(--surface); }
.rcv-dec.hold { background: var(--hold-soft); color: var(--hold); }
.rcv-pkgh.rcv-pkgx { flex-wrap: wrap; align-items: center; row-gap: 6px; }
.rcv-pkgt { flex: 1 1 0; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 2px 0; border: 0; background: transparent; color: inherit; font: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
span.rcv-pkgt { cursor: default; }
.rcv-pkga { flex: 1 0 100%; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.rcv-pkga .chip { gap: 4px; }
.rcv-pkga .chip svg, .rcv-pltools .btn svg { width: 16px; height: 16px; }
.rcv-gtag { display: inline-block; padding: 1px 7px; border-radius: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; background: var(--accepted-soft); color: var(--accepted); }
.rcv-gtag.s-rejected { background: var(--rejected); color: var(--surface); }
.rcv-gtag.s-partly_rejected { background: var(--rejected-soft); color: var(--rejected); }
.rcv-gtag.s-hold { background: var(--hold-soft); color: var(--hold); }
.rcv-gsum { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; font-size: 12px; color: var(--ink-2); }
/* outlined, so it is never taken for the soft Photo / Reason buttons beside it */
.rcv-gdec.to-no { color: var(--rejected); border-color: color-mix(in srgb, var(--rejected) 55%, transparent); }
.rcv-gdec.to-ok { color: var(--accepted); border-color: color-mix(in srgb, var(--accepted) 55%, transparent); }
.rcv-gdec:disabled { opacity: .55; }
.rcv-plsum { padding: 10px 2px 0; }
.rcv-pltools { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 0 6px; }      /* a phone: the decision across, Photo and Reason under it */
.rcv-pltools .btn { gap: 6px; padding: 0 10px; }
.rcv-pltools .rcv-gdec { grid-column: 1 / -1; }
@media (min-width: 640px) { .rcv-pltools { display: flex; flex-wrap: wrap; } }
.rcv-plsum + .rcv-pltools { padding-top: 8px; }
.rcv-gword { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px; padding: 2px 2px 6px; font-size: 13px; color: var(--ink-2); white-space: pre-wrap; overflow-wrap: anywhere; }
.rcv-gword b { color: var(--ink); font-weight: 600; }
.rcv-strip { display: flex; gap: 6px; padding: 6px 2px 8px; overflow-x: auto; scrollbar-width: none; }
.rcv-strip::-webkit-scrollbar { display: none; }
.rcv-thumb { flex: none; width: 56px; height: 56px; padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface-2); cursor: pointer; }
.rcv-thumb img { width: 100%; height: 100%; object-fit: cover; }
.rcv-thumb.waiting { opacity: .6; border-style: dashed; cursor: default; }
.rcv-quick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
.rcv-quick .chip svg { width: 16px; height: 16px; }
.rcv-quick .chip.on.ok { background: var(--accepted); border-color: var(--accepted); color: var(--surface); }
.rcv-quick .chip.on.no { background: var(--rejected); border-color: var(--rejected); color: var(--surface); }
.rcv-tips { display: flex; gap: 6px; align-items: flex-start; margin-top: 8px; font-size: 12px; color: var(--muted); }
.rcv-tips svg { width: 14px; height: 14px; flex: none; margin-top: 2px; }

/* ---------- the master log: WIR · MIR · MST · ITP · SOR · NCR (the Ritz-Carlton, 2026-11-01) ---------- */
.status.ml-other { background: var(--surface-2); color: var(--muted); }
.ml-title { font-weight: 500; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ml-row .ncr-num { min-width: 92px; }
.ml-rev { margin-top: 8px; padding: 10px 12px; }
.ml-rev .field { margin-bottom: 4px; }
.ml-sum td, .ml-sum th { white-space: nowrap; }
.ml-sum tbody tr:active { background: var(--surface-2); }

/* ---------- damage reports: the pieces damaged on site (both projects, 2026-11-01) ---------- */
.dmg-seg { flex-wrap: wrap; }
.dmg-dims { gap: 6px; align-items: center; }
.dmg-dims .input { min-width: 0; flex: 1; text-align: center; }
.dmg-thumbs { display: flex; gap: 4px; margin-top: 6px; overflow: hidden; }
.dmg-thumbs img { width: 44px; height: 44px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); }
.dmg-thumbs img.waiting { opacity: .55; border-style: dashed; }
.dmg-piece .grow { display: flex; flex-direction: column; }
.dmg-piece::before { background: var(--open); }
