/* SOW Buildings Manager */
:root {
  --brand: #2d5a27;
  --brand-2: #4b8a3f;
  --brand-soft: #e7f1e3;
  --gold: #c99a1e;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-2: #f1f3ee;
  --text: #1c2219;
  --muted: #667063;
  --border: #e1e5dc;
  --danger: #c0392b;
  --danger-soft: #fbe9e7;
  --warn: #b7791f;
  --warn-soft: #fdf3dc;
  --ok: #2f7d32;
  --ok-soft: #e5f3e6;
  --info: #2f6690;
  --info-soft: #e4eef6;
  --income: #3f8a35;
  --expense: #d0753a;
  --shadow: 0 1px 2px rgba(20, 30, 15, .06), 0 2px 8px rgba(20, 30, 15, .05);
  --radius: 14px;
  --nav-h: 64px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --brand: #8cc47e; --brand-2: #6da25e; --brand-soft: #1f2e1b; --gold: #e2b84a;
    --bg: #0f140d; --surface: #171e14; --surface-2: #1d2619; --text: #e8eee4; --muted: #9aa794;
    --border: #2a3525; --danger: #ef7b6c; --danger-soft: #3a1d19; --warn: #e8b357; --warn-soft: #33290f;
    --ok: #7fcf83; --ok-soft: #17301a; --info: #7fb4dd; --info-soft: #172735;
    --income: #7fcf72; --expense: #f0a06a; --shadow: 0 1px 2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --brand: #8cc47e; --brand-2: #6da25e; --brand-soft: #1f2e1b; --gold: #e2b84a;
  --bg: #0f140d; --surface: #171e14; --surface-2: #1d2619; --text: #e8eee4; --muted: #9aa794;
  --border: #2a3525; --danger: #ef7b6c; --danger-soft: #3a1d19; --warn: #e8b357; --warn-soft: #33290f;
  --ok: #7fcf83; --ok-soft: #17301a; --info: #7fb4dd; --info-soft: #172735;
  --income: #7fcf72; --expense: #f0a06a; --shadow: 0 1px 2px rgba(0,0,0,.4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; font-weight: 650; }
h2 { font-size: 16px; font-weight: 620; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }

/* boot / spinner */
.boot { display: grid; place-items: center; height: 100vh; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- layout ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 236px; flex: none; background: var(--surface); border-right: 1px solid var(--border);
  padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; }
.brand img { width: 36px; height: 36px; border-radius: 9px; }
.brand b { display: block; font-size: 15px; letter-spacing: .2px; }
.brand span { font-size: 12px; color: var(--muted); }
.nav-link {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px;
  color: var(--text); font-weight: 520;
}
.nav-link svg { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; opacity: .85; }
.nav-link:hover { background: var(--surface-2); }
.nav-link.active { background: var(--brand-soft); color: var(--brand); }
.sidebar .spacer { flex: 1; }
.main { flex: 1; min-width: 0; padding: 24px 28px 40px; max-width: 1280px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.topbar .actions { display: flex; gap: 8px; flex-wrap: wrap; }

.bottom-nav { display: none; }
.more-sheet { display: none; }

@media (max-width: 899px) {
  .sidebar { display: none; }
  .main { padding: calc(14px + env(safe-area-inset-top)) 16px calc(var(--nav-h) + 24px + env(safe-area-inset-bottom)); }
  h1 { font-size: 20px; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--surface); border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom); height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  }
  .bottom-nav a, .bottom-nav button {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    font-size: 11px; color: var(--muted); background: none; border: 0; cursor: pointer; padding: 0;
  }
  .bottom-nav svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .bottom-nav .active { color: var(--brand); font-weight: 600; }
  .more-sheet.open {
    display: block; position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.35);
  }
  .more-sheet .panel {
    position: absolute; left: 0; right: 0; bottom: 0; background: var(--surface); border-radius: 18px 18px 0 0;
    padding: 10px 12px calc(16px + env(safe-area-inset-bottom));
  }
  .more-sheet .grip { width: 40px; height: 4px; border-radius: 4px; background: var(--border); margin: 4px auto 10px; }
}

/* ---------- components ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 16px 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 18px 0; }
.card-head + .card-body { padding-top: 10px; }
.card-body { padding: 14px 18px 16px; }
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.cols-2 { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.cols-2e { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 1100px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } .cols-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 899px) { .cols-2, .cols-2e { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 560px) { .cols-3 { grid-template-columns: minmax(0, 1fr); } .kpis { gap: 10px; } }
.stack { display: flex; flex-direction: column; gap: 14px; }

.kpi { padding: 14px 16px; }
.kpi .label { font-size: 12.5px; color: var(--muted); font-weight: 540; display: flex; justify-content: space-between; gap: 6px; }
.kpi .value { font-size: 23px; font-weight: 680; margin-top: 4px; letter-spacing: -.3px; overflow-wrap: anywhere; }
.kpi .sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
@media (max-width: 560px) { .kpi .value { font-size: 19px; } .kpi { padding: 12px 13px; } }
.pos { color: var(--ok); } .neg { color: var(--danger); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font-weight: 560;
  white-space: nowrap; color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
:root[data-theme="dark"] .btn.primary { color: #0f140d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn.primary { color: #0f140d; } }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); }
.btn.sm { height: 31px; padding: 0 10px; font-size: 13px; border-radius: 8px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn svg { width: 17px; height: 17px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.icon-btn { width: 36px; padding: 0; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.neutral { background: var(--surface-2); color: var(--muted); }

/* lists & tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 600; background: var(--surface-2); }
tr:last-child td { border-bottom: 0; }
td.r, th.r { text-align: right; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover { background: var(--surface-2); }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .title { font-weight: 560; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .sub { font-size: 12.5px; color: var(--muted); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none; font-weight: 650; font-size: 13px; background: var(--brand-soft); color: var(--brand); }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* responsive table -> cards when its card is narrow (phones, small windows) */
.card:has(> .table-wrap table.responsive), .card:has(table.responsive) { container-type: inline-size; }
@container (max-width: 720px) {
  table.responsive thead { display: none; }
  table.responsive, table.responsive tbody, table.responsive tr, table.responsive td { display: block; width: 100%; }
  table.responsive tr { padding: 10px 14px; border-bottom: 1px solid var(--border); display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; }
  table.responsive td { border: 0; padding: 0; }
  table.responsive td[data-m="hide"] { display: none; }
  table.responsive td[data-m="title"] { font-weight: 600; grid-column: 1; }
  table.responsive td[data-m="right"] { grid-column: 2; grid-row: 1; text-align: right; font-weight: 650; }
  table.responsive td[data-m="sub"] { grid-column: 1 / -1; font-size: 13px; color: var(--muted); }
  table.responsive td[data-m="actions"] { grid-column: 1 / -1; padding-top: 6px; }
}

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.toolbar .search { flex: 1; min-width: 160px; }
.empty { text-align: center; padding: 36px 16px; color: var(--muted); }
.empty b { display: block; color: var(--text); font-size: 15px; margin-bottom: 4px; }

/* forms */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label { font-size: 13px; font-weight: 560; color: var(--muted); }
.input, select.input, textarea.input {
  height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); width: 100%;
  outline: none; min-width: 0;
}
textarea.input { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; }
.input:focus { border-color: var(--brand-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand-2) 22%, transparent); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 14px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }
.err { color: var(--danger); font-size: 12.5px; }
.form-error { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: 10px; font-size: 13.5px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }

/* modal */
dialog#modal {
  border: 0; padding: 0; border-radius: 18px; width: min(620px, calc(100vw - 24px)); max-height: calc(100vh - 32px);
  background: var(--surface); color: var(--text); box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
dialog#modal::backdrop { background: rgba(10, 15, 8, .45); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-body { padding: 16px 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; border-top: 1px solid var(--border); position: sticky; bottom: 0; background: var(--surface); }
@media (max-width: 560px) {
  dialog#modal { width: 100vw; max-width: 100vw; max-height: 92vh; margin: auto 0 0; border-radius: 18px 18px 0 0; }
  .modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
}

/* toast */
#toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-weight: 540; opacity: 0;
  transition: .2s; pointer-events: none; z-index: 100; max-width: calc(100vw - 32px);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.error { background: var(--danger); color: #fff; }
@media (max-width: 899px) { #toast { bottom: calc(var(--nav-h) + 16px + env(safe-area-inset-bottom)); } }

/* charts */
.chart { width: 100%; height: auto; display: block; }
.chart .axis { stroke: var(--border); }
.chart text { fill: var(--muted); font-size: 11px; }
.legend { display: flex; gap: 14px; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 120px) minmax(48px, 1fr) auto; gap: 10px; align-items: center; font-size: 13.5px; padding: 5px 0; }
.bar-track { height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--expense); }
.meter { height: 8px; border-radius: 6px; background: var(--surface-2); overflow: hidden; margin-top: 8px; }
.meter > div { height: 100%; background: var(--brand-2); border-radius: 6px; }

/* login */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login { width: min(400px, 100%); padding: 28px 24px; }
.login .brand { justify-content: center; flex-direction: column; text-align: center; padding-bottom: 20px; }
.login .brand img { width: 64px; height: 64px; border-radius: 16px; }
.login .brand b { font-size: 19px; }

/* tabs */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 11px; width: max-content; max-width: 100%; overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 7px 14px; border-radius: 8px; cursor: pointer; font-weight: 560; color: var(--muted); white-space: nowrap; }
.tabs button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }

.install-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 14px; background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 25%, transparent); border-radius: var(--radius); }
.install-banner img { width: 36px; height: 36px; border-radius: 9px; }
.install-banner .grow { flex: 1; }
.offline-pill { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); z-index: 50; }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.section-title { display: flex; justify-content: space-between; align-items: center; margin: 4px 0 10px; }

/* ---------- family budget ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span { display: inline-block; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 13.5px; cursor: pointer; user-select: none; }
.chip input:checked + span { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.chip input:focus-visible + span { outline: 2px solid var(--brand-2); outline-offset: 2px; }
:root[data-theme="dark"] .chip input:checked + span { color: #0f140d; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .chip input:checked + span { color: #0f140d; } }
.period-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; padding: 14px 18px 0; }
.period-nav { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.period-label { text-transform: capitalize; min-width: 120px; text-align: center; }
.fam-total { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; }
.budget-row { padding: 8px 0; border-bottom: 1px solid var(--border); }
.budget-row:last-child { border-bottom: 0; }
.budget-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; }
.budget-row .meter { margin: 6px 0 4px; }
.day-group + .day-group { margin-top: 10px; }
.day-head { display: flex; justify-content: space-between; font-size: 13px; color: var(--muted); padding: 6px 0; border-bottom: 1px solid var(--border); text-transform: capitalize; }
.list li.click { cursor: pointer; }
.list li.click:hover { background: var(--surface-2); }
.family-strip { display: flex; align-items: center; gap: 12px; padding: 12px 16px; margin-bottom: 14px; color: inherit; }
.fs-icon { width: 38px; height: 38px; border-radius: 10px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.fs-icon svg { width: 20px; height: 20px; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.fab { display: none; }
@media (max-width: 899px) {
  .fab { display: grid; place-items: center; position: fixed; right: 18px; bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom)); width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; box-shadow: 0 6px 18px rgba(0,0,0,.25); z-index: 15; cursor: pointer; }
  .fab svg { width: 26px; height: 26px; stroke: currentColor; fill: none; stroke-width: 2.4; stroke-linecap: round; }
  .period-bar { padding: 12px 12px 0; }
}

.placeholders { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.placeholders code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

/* ---------- reminders ---------- */
.reminder.done { opacity: .75; }
.rem-top { display: flex; gap: 12px; align-items: flex-start; }
.rem-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.reminder details { margin-top: 8px; }
.reminder summary { cursor: pointer; color: var(--brand); }
pre.msg { white-space: pre-wrap; font: inherit; font-size: 13.5px; background: var(--surface-2); border-radius: 10px; padding: 10px 12px; margin: 8px 0 0; }
/* ---------- inspection checklist ---------- */
.insp-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: 0 2px 10px; flex-wrap: wrap; }
.insp-row { padding: 10px 0; border-bottom: 1px solid var(--border); display: grid; gap: 6px; }
.insp-row:last-child { border-bottom: 0; }
.chips.cond .chip span { padding: 6px 11px; }
.chips.cond .c-good input:checked + span, .chips.cond .c-new input:checked + span { background: var(--ok); border-color: var(--ok); }
.chips.cond .c-fair input:checked + span { background: var(--warn); border-color: var(--warn); }
.chips.cond .c-bad input:checked + span { background: var(--danger); border-color: var(--danger); }
.chips.cond .c-na input:checked + span { background: var(--muted); border-color: var(--muted); }
.insp-comment { height: 34px; font-size: 13.5px; }
.insp-save { position: sticky; bottom: 0; padding: 10px 0; background: linear-gradient(transparent, var(--bg) 30%); }
@media (max-width: 899px) { .insp-save { bottom: calc(var(--nav-h) + env(safe-area-inset-bottom)); } }
.btn-pair { display: inline-flex; gap: 2px; }

.chips.cond .c-missing input:checked + span { background: var(--danger); border-color: var(--danger); }
.chips.cond .c-na input:checked + span { background: var(--surface-2); border-color: var(--muted); color: var(--text); font-style: italic; }
a.btn[aria-disabled="true"] { opacity: .5; pointer-events: none; }

/* ---------- family monthly budget ---------- */
.budget-card { border-left: 5px solid var(--border); }
.budget-card.status-ok, .family-strip.status-ok { border-left: 5px solid var(--ok); }
.budget-card.status-warn, .family-strip.status-warn { border-left: 5px solid var(--warn); }
.budget-card.status-over, .family-strip.status-over { border-left: 5px solid var(--danger); }
.budget-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.budget-big { font-size: 26px; letter-spacing: -.3px; margin-top: 2px; }
.budget-big .muted { font-size: 17px; }
.meter.big { height: 14px; border-radius: 8px; position: relative; overflow: visible; margin-top: 12px; }
.meter.big > div { border-radius: 8px; }
.today-mark { position: absolute; top: -4px; width: 2px; height: 22px; background: var(--text); opacity: .55; border-radius: 1px; }
.budget-status { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.advice { margin: 10px 0 8px; padding-left: 18px; font-size: 14px; }
.advice li { margin: 3px 0; }
.week-box { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; display: grid; gap: 4px; justify-items: start; }
.family-strip .meter { margin-top: 6px; }
@media (max-width: 560px) { .budget-big { font-size: 22px; } }

/* ---------- signatures ---------- */
.pad-wrap { position: relative; border: 2px dashed var(--border); border-radius: 12px; background: #fbfcfa; height: 200px; }
.pad-wrap canvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; border-radius: 12px; }
.pad-hint { position: absolute; inset: 0; display: grid; place-items: center; color: #9aa794; pointer-events: none; font-size: 18px; }
.sig-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 0; border-bottom: 1px solid var(--border); }
.sig-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sig-settings { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.stamp-preview svg { width: 130px; height: 130px; display: block; }
.sig-preview { max-width: 220px; max-height: 80px; background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 4px; }

/* ---------- documents ---------- */
.doc-list li { flex-wrap: wrap; }
.doc-list .sub .badge { margin-left: 6px; }
.doc-actions { display: flex; gap: 6px; }
.doc-list .fs-icon { width: 34px; height: 34px; }
@media (max-width: 560px) { .doc-actions { width: 100%; justify-content: flex-end; } }

/* ---------- façade de l'immeuble ---------- */
.facade { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 16px; padding: 14px; margin-bottom: 14px; align-items: start; }
.facade-draw { background: #1b2533; border-radius: 12px; padding: 12px 10px 10px; }
.facade-svg { display: block; width: 100%; height: auto; max-height: 78vh; }
.facade-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 8px 4px 0; font-size: 12.5px; color: #d3dae4; }
.facade-legend i { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; border: 1px solid #5a6b84; }
.fg-floor { transform-box: fill-box; transform-origin: bottom; animation: fg-rise .5s ease-out both; }
@keyframes fg-rise { from { transform: scaleY(0); opacity: 0; } to { transform: scaleY(1); opacity: 1; } }
.fw { cursor: pointer; outline: none; }
.fw .glass { transition: stroke .15s, filter .15s; }
.fw:hover .glass, .fw:focus-visible .glass { filter: brightness(1.18); stroke: #c9d4e2; }
.fw.sel .glass { stroke: #ffe7a3; stroke-width: 3.5; }
.fw.st-ok .glass, .fw.st-due .glass { filter: drop-shadow(0 0 5px rgba(255, 220, 140, .35)); }
.fc-title { font-size: 18px; font-weight: 680; }
.fc-dot { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; }
.fc-tenant { display: flex; gap: 10px; align-items: center; }
.fc-tenant .avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; font-weight: 650; flex: none; }
.fc-rows { display: grid; gap: 8px; }
.fc-rows > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 14px; padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.fc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.fc-stats > div { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; display: flex; flex-direction: column; }
.fc-stats span { font-size: 12.5px; color: var(--muted); } .fc-stats b { font-size: 21px; }
.fc-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.tiny { font-size: 12px; }
@media (max-width: 860px) { .facade { grid-template-columns: 1fr; padding: 10px; } .facade-svg { max-height: none; } }
@media (prefers-reduced-motion: reduce) { .fg-floor { animation: none; } }

/* ---------- the page behind an open window stays still ---------- */
html.scroll-locked { overflow: hidden; }
dialog#modal { overscroll-behavior: contain; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.more-sheet, .more-sheet .panel { overscroll-behavior: contain; }
.more-sheet.open { touch-action: none; }
.more-sheet.open .panel { touch-action: pan-y; }

/* ---------- internet ---------- */
.note { border: 1px solid var(--border); border-radius: 12px; padding: 10px 14px; margin-bottom: 12px; font-size: 14px; font-weight: 560; }
.note.danger-note { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.note.warn-note { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.net-list li { flex-wrap: wrap; }
.net-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.fs-icon.net-ok { color: var(--ok); } .fs-icon.net-late, .fs-icon.net-cut { color: var(--danger); } .fs-icon.net-reconnect, .fs-icon.net-due { color: var(--warn); }
.net-steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; font-size: 14px; }
.net-wifi code { font-size: 15px; letter-spacing: .5px; }
@media (max-width: 560px) { .net-actions { width: 100%; } }
