/* Willowdale Console – interface
   Colours, fonts and building blocks from the "Estate Console" design system.
   Fonts are self-hosted under /static/fonts (SIL Open Font License). */

@font-face { font-family: "Instrument Sans"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/instrument-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/instrument-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 600; font-style: normal; font-display: swap; src: url("../fonts/instrument-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/instrument-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Cormorant Garamond"; font-weight: 600; font-style: italic; font-display: swap; src: url("../fonts/cormorant-garamond-latin-600-italic.woff2") format("woff2"); }

/* ---- Tokens ------------------------------------------------------------ */
:root {
  --font-sans: "Instrument Sans", "Segoe UI", system-ui, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, Consolas, monospace;
  --font-wordmark: "Cormorant Garamond", Garamond, Georgia, serif;

  --bg: #f4f5f7; --surface: #ffffff; --surface-sunken: #eceef2; --line: #dde1e7;
  --ink: #141821; --ink-muted: #566070; --on-band: #ffffff; --on-accent: #ffffff;
  /* Input fields: border at least 3 : 1 against card and background */
  --field-line: #7d8696; --field-bg: #ffffff;

  --willowdale: #0d3a3e; --willowdale-accent: #0d3a3e; --willowdale-gold: #e2c27c;
  --all-estates: var(--willowdale); --all-accent: var(--willowdale-accent);   /* "ALL" = Willowdale */
  --test-estate: #6b4f1d; --test-accent: #6b4f1d;   /* test estate: amber, easy to tell from the real one */

  --overdue: #b42318; --overdue-bg: #fdeceb;
  --due: #8f5a00; --due-bg: #fff3d6;
  --paid: #1f7a46; --paid-bg: #e3f5e9;
  --review: #0b6a80; --review-bg: #e0f2f6;
  --focus: #2f62d8;

  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px;
  --radius-sm: 4px; --radius-md: 6px; --radius-lg: 10px; --radius-pill: 999px;
  --shadow-pop: 0 8px 24px rgba(20,24,33,.12), 0 1px 2px rgba(20,24,33,.08);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1116; --surface: #161a21; --surface-sunken: #1e232b; --line: #2b313b;
    --ink: #e7eaef; --ink-muted: #9aa3b1; --on-accent: #11141a;
    --field-line: #6b7486; --field-bg: #11141a;
    --willowdale-accent: #8ccbcf; --all-accent: #8ccbcf; --test-accent: #e2c27c;
    --overdue: #f47a6f; --overdue-bg: #3b1714; --due: #f2b84b; --due-bg: #352608;
    --paid: #5fcf8d; --paid-bg: #0f2f1d; --review: #63c6dc; --review-bg: #0b2b33; --focus: #8fb2ff;
    --shadow-pop: 0 8px 24px rgba(0,0,0,.5), 0 1px 2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1116; --surface: #161a21; --surface-sunken: #1e232b; --line: #2b313b;
  --ink: #e7eaef; --ink-muted: #9aa3b1; --on-accent: #11141a;
  --field-line: #6b7486; --field-bg: #11141a;
  --willowdale-accent: #8ccbcf; --all-accent: #8ccbcf; --test-accent: #e2c27c;
  --overdue: #f47a6f; --overdue-bg: #3b1714; --due: #f2b84b; --due-bg: #352608;
  --paid: #5fcf8d; --paid-bg: #0f2f1d; --review: #63c6dc; --review-bg: #0b2b33; --focus: #8fb2ff;
  --shadow-pop: 0 8px 24px rgba(0,0,0,.5), 0 1px 2px rgba(0,0,0,.4);
  color-scheme: dark;
}

/* Estate-Rahmen */
.ec-estate-willowdale  { --estate: var(--willowdale);  --estate-accent: var(--willowdale-accent); }
.ec-estate-all         { --estate: var(--all-estates); --estate-accent: var(--all-accent); }
.ec-estate-test        { --estate: var(--test-estate); --estate-accent: var(--test-accent); }

/* ---- Grundlagen -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 400 15px/22px var(--font-sans); -webkit-font-smoothing: antialiased; }
a { color: var(--estate-accent, var(--ink)); }
.mono { font-family: var(--font-mono); font-size: 14px; font-variant-numeric: tabular-nums; }
.muted { color: var(--ink-muted); }
.label { font: 600 12px/16px var(--font-sans); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* ---- Bausteine --------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); height: 38px; padding: 0 16px; border-radius: var(--radius-md); border: 1px solid transparent; font: 600 15px/1 var(--font-sans); cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn-primary { background: var(--estate-accent); color: var(--on-accent); }
.btn-primary:hover { filter: brightness(1.12); }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-sunken); }
.btn-ghost { background: transparent; color: var(--ink-muted); }
.btn-ghost:hover { background: var(--surface-sunken); color: var(--ink); }
.btn-block { width: 100%; }

.field { display: grid; gap: 6px; }
.field + .field { margin-top: var(--space-4); }
.field label { font: 600 14px/18px var(--font-sans); }
.field .hint { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.input { width: 100%; height: 40px; padding: 0 var(--space-3); border-radius: var(--radius-sm); border: 1px solid var(--field-line); background: var(--field-bg); color: var(--ink); font: 400 16px/1 var(--font-sans); }
.input:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.input-code { font: 500 22px/1 var(--font-mono); letter-spacing: .35em; text-align: center; height: 52px; }

.alert { display: flex; gap: var(--space-2); align-items: flex-start; padding: 10px var(--space-3); border-radius: var(--radius-md); font-size: 14px; line-height: 20px; margin-bottom: var(--space-4); }
.alert::before { content: ""; flex: none; width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: currentColor; }
.alert-error { color: var(--overdue); background: var(--overdue-bg); }
.alert-info { color: var(--review); background: var(--review-bg); }
.alert-ok { color: var(--paid); background: var(--paid-bg); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }

/* ---- Sign-in --------------------------------------------------------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 46%) 1fr; }
.auth-brand { background: var(--all-estates); color: var(--on-band); padding: 48px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; }
.auth-brand-title { font: 600 16px/22px var(--font-sans); letter-spacing: .14em; text-transform: uppercase; opacity: .9; }
.auth-marks { display: grid; grid-template-columns: 1fr; gap: 36px 32px; align-items: center; justify-items: center; max-width: 520px; width: 100%; margin: 0 auto; }
.auth-marks img { display: block; max-width: 100%; height: auto; }
.auth-marks .mark-crest { width: 240px; }
.auth-brand-foot { font-size: 13px; opacity: .65; }
.auth-main { display: grid; place-items: center; padding: 48px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h1 { font: 600 24px/30px var(--font-sans); letter-spacing: -.01em; margin: 0 0 6px; }
.auth-card .lead { margin: 0 0 var(--space-6); color: var(--ink-muted); }
.auth-card form .btn-block { margin-top: var(--space-6); }
.auth-card .after { margin-top: var(--space-6); font-size: 14px; color: var(--ink-muted); }
.auth-steps { display: flex; gap: 6px; margin-bottom: var(--space-4); }
.auth-steps span { height: 4px; flex: 1; border-radius: 2px; background: var(--line); }
.auth-steps span.on { background: var(--estate-accent); }
.qr { display: flex; gap: var(--space-4); align-items: center; padding: var(--space-4); margin-bottom: var(--space-4); }
.qr img { width: 148px; height: 148px; image-rendering: pixelated; background: #fff; padding: 6px; border-radius: var(--radius-sm); flex: none; }
.qr .secret { word-break: break-all; font: 500 13px/20px var(--font-mono); }
ol.steps { margin: 0 0 var(--space-4); padding-left: 20px; color: var(--ink); }
ol.steps li + li { margin-top: 4px; }

@media (max-width: 760px) {
  .auth { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .auth-brand { padding: 20px 16px; gap: 16px; }
  .auth-marks { grid-template-columns: repeat(4, 1fr); gap: 12px; }
  .auth-marks .mark-crest { width: auto; height: 120px; }
  .auth-brand-foot { display: none; }
  .auth-main { padding: 28px 16px; place-items: start center; }
}

/* ---- App frame ---------------------------------------------------- */
.app { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.bar { display: flex; align-items: center; gap: var(--space-4); min-height: 56px; padding: 0 var(--space-4); background: var(--estate); color: var(--on-band); position: sticky; top: 0; z-index: 10; }
.bar-logo { display: flex; align-items: center; height: 36px; flex: none; color: var(--on-band); text-decoration: none; }
.bar-logo img { height: 34px; width: auto; display: block; }
.bar-logo .wordmark { font: italic 600 26px/28px var(--font-wordmark); color: var(--willowdale-gold); letter-spacing: .01em; }
.bar-logo .wordmark-plain { font: 600 17px/20px var(--font-sans); letter-spacing: .04em; }
.bar-search { flex: 1; max-width: 420px; height: 34px; display: flex; align-items: center; gap: var(--space-2); padding: 0 var(--space-3); border-radius: var(--radius-md); background: rgba(255,255,255,.12); color: rgba(255,255,255,.78); font-size: 14px; }
.bar-search kbd { margin-left: auto; font: 500 12px/1 var(--font-mono); padding: 3px 5px; border-radius: var(--radius-sm); background: rgba(255,255,255,.14); }
.bar-spacer { flex: 1; }
.bar svg { width: 16px; height: 16px; flex: none; }

.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; }
.menu > summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; top: calc(100% + 6px); min-width: 220px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius-md); box-shadow: var(--shadow-pop); padding: 6px; z-index: 20; }
.menu-pop.right { right: 0; }
.menu-pop form { margin: 0; }
.menu-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: var(--radius-sm); background: none; color: inherit; font: 500 15px/20px var(--font-sans); text-align: left; cursor: pointer; text-decoration: none; }
.menu-item:hover { background: var(--surface-sunken); }
.menu-item[aria-current="true"] { font-weight: 600; }
/* Accent colour like the dots on the pages – otherwise hard to see in the dark */
.menu-item .swatch { width: 12px; height: 12px; border-radius: 3px; background: var(--estate-accent); flex: none; }
.menu-item .check { margin-left: auto; color: var(--ink-muted); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-meta { padding: 8px 10px 6px; font-size: 13px; color: var(--ink-muted); }
.menu-meta strong { display: block; color: var(--ink); font-size: 15px; }
/* Light/dark in the account menu */
.theme-pick { padding: 6px 10px 8px; }
.theme-pick .label { display: block; margin-bottom: 6px; }
.theme-seg { display: flex; gap: 2px; padding: 2px; border-radius: var(--radius-md); background: var(--surface-sunken); }
.theme-seg button { flex: 1; height: 30px; padding: 0 10px; border: 0; border-radius: var(--radius-sm); background: none; color: var(--ink-muted); font: 500 14px/1 var(--font-sans); cursor: pointer; }
.theme-seg button:hover { color: var(--ink); }
.theme-seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 0 0 1px var(--line), 0 1px 2px rgba(20,24,33,.12); }

.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.18); font: 600 13px/1 var(--font-sans); color: var(--on-band); }

.shell { display: grid; grid-template-columns: 208px 1fr; min-height: 0; }
.rail { border-right: 1px solid var(--line); background: var(--surface); padding: var(--space-4) var(--space-2); display: flex; flex-direction: column; gap: 2px; }
.rail a, .rail span { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px; border-radius: var(--radius-md); color: var(--ink); text-decoration: none; font-weight: 500; }
.rail a:hover { background: var(--surface-sunken); }
.rail a[aria-current="page"] { background: var(--surface-sunken); color: var(--estate-accent); font-weight: 600; box-shadow: inset 3px 0 0 var(--estate-accent); }
.rail span.soon { color: var(--ink-muted); cursor: default; }
.rail span.soon em { margin-left: auto; font-style: normal; font-size: 12px; }
.rail svg, .tabbar svg { width: 18px; height: 18px; flex: none; }

.content { padding: var(--space-6); min-width: 0; }
.page-head { display: flex; align-items: baseline; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-6); }
.page-head h1 { font: 600 24px/30px var(--font-sans); letter-spacing: -.01em; margin: 0; }
.page-head .meta { color: var(--ink-muted); font-size: 14px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--space-4); margin-bottom: var(--space-6); }
.stat { display: flex; flex-direction: column; gap: 6px; padding: var(--space-4); }
.stat-value { font: 600 28px/32px var(--font-sans); letter-spacing: -.02em; color: var(--ink-muted); }
.stat-foot { font-size: 13px; color: var(--ink-muted); }

.empty { padding: 40px var(--space-6); text-align: center; }
.empty h2 { font: 600 17px/24px var(--font-sans); margin: 0 0 6px; }
.empty p { margin: 0 auto; max-width: 460px; color: var(--ink-muted); }

.tabbar { display: none; }

@media (max-width: 760px) {
  .bar { gap: var(--space-2); padding: 0 var(--space-3); min-height: 52px; }
  .bar-logo img { height: 28px; }
  .bar-logo .wordmark { font-size: 22px; }
  .bar-search { display: none; }
  /* Phone top band: logo, clock and account button stay in place */
  /* (the logo gives way if needed) */
  .bar { min-width: 0; }   /* otherwise the grid column makes the band as wide as its content */
  .bar-logo, .bar-clock, .avatar { flex: none; }
  .bar-logo .wordmark-plain { font-size: 14px; letter-spacing: .03em; }
  .bar-spacer { min-width: 0; }
  .shell { grid-template-columns: 1fr; padding-bottom: 64px; }
  .rail { display: none; }
  .content { padding: var(--space-4); }
  .stats { grid-template-columns: 1fr 1fr; gap: var(--space-2); }
  .stat { padding: var(--space-3); }
  .stat-value { font-size: 22px; line-height: 26px; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; height: 60px; background: var(--surface); border-top: 1px solid var(--line); z-index: 10; }
  .tabbar a, .tabbar span { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 12px; font-weight: 500; color: var(--ink-muted); text-decoration: none; }
  .tabbar a[aria-current="page"] { color: var(--estate-accent); font-weight: 600; }
}

@media (max-width: 420px) {
  /* narrow phones and text size "Large": the wordmark on two lines */
  .bar-logo .wordmark-plain { display: block; width: min-content; font-size: 12px; line-height: 13px; }
  .bar-logo .wordmark { font-size: 19px; }
}

/* ---- Tables, pills, settings (design system) ------------------------- */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: 15px; }
.table th { text-align: left; padding: 9px var(--space-3); background: var(--surface-sunken); font: 600 12px/16px var(--font-sans); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); white-space: nowrap; border-bottom: 1px solid var(--line); }
.table td { padding: 10px var(--space-3); border-bottom: 1px solid var(--line); vertical-align: middle; white-space: nowrap; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-sunken); }
.table a.rowlink { color: var(--ink); font-weight: 600; text-decoration: none; }
.table a.rowlink:hover { text-decoration: underline; }
.table tr.is-inactive td { color: var(--ink-muted); }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px 0 7px; border-radius: var(--radius-pill); font: 600 13px/1 var(--font-sans); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.pill-ok { color: var(--paid); background: var(--paid-bg); }
.pill-due { color: var(--due); background: var(--due-bg); }
.pill-bad { color: var(--overdue); background: var(--overdue-bg); }
.pill-info { color: var(--review); background: var(--review-bg); }
.pill-off { color: var(--ink-muted); background: var(--surface-sunken); }
a.pill { text-decoration: none; }
/* Terminal payments: the finding may wrap */
.tp-table td { vertical-align: top; }
.table td.tp-finding { white-space: normal; min-width: 260px; max-width: 420px; }
.table td.tp-finding .pill { white-space: normal; height: auto; min-height: 22px; padding-top: 3px; padding-bottom: 3px; line-height: 1.25; }
@media (max-width: 760px) {   /* wide table → cards on every phone (like stack-narrow from 340 px) */
  .tp-table, .tp-table tbody { display: block; }
  .tp-table thead { display: none; }
  .tp-table tr { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 16px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .tp-table tr:last-child { border-bottom: 0; }
  .tp-table td { display: block; padding: 0; border: 0; white-space: normal; text-align: left; }
  .tp-table td:first-child { flex: 1 0 100%; }
  .table.tp-table td[data-label] { flex: 1 1 40%; min-width: 0; overflow-wrap: anywhere; }
  .table.tp-table td.num[data-label] { flex: 0 0 auto; text-align: left; }
  .table.tp-table td.stack-full, .table.tp-table td.tp-finding { flex: 1 0 100%; min-width: 0; max-width: none; }
  .tp-table td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; font: 600 11px/14px var(--font-sans); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
  .tp-table tbody tr:hover td { background: none; }
}
@media (max-width: 340px) { .table.tp-table td[data-label] { flex: 1 0 100%; } .table.tp-table td.num[data-label] { flex: 0 0 auto; } }
.chip { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: var(--radius-pill); font: 600 12px/1 var(--font-sans); letter-spacing: .02em; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
.chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }

.subtabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: -8px 0 var(--space-6); overflow-x: auto; }
.subtabs > a, .subtabs > span { padding: 10px 12px; font-weight: 500; color: var(--ink-muted); text-decoration: none; white-space: nowrap; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subtabs a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--estate-accent); }
.subtabs > span { opacity: .6; cursor: default; }   /* only blocked tabs, not the number in a tab */

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(280px, 1fr); gap: var(--space-6); align-items: start; }
.card { padding: var(--space-6); }
.card h2 { font: 600 17px/24px var(--font-sans); margin: 0 0 4px; }
.card > p.muted { margin: 0 0 var(--space-4); }
.card + .card { margin-top: var(--space-6); }
.select { appearance: none; width: 100%; height: 40px; padding: 0 36px 0 var(--space-3); border-radius: var(--radius-sm); border: 1px solid var(--field-line); background: var(--field-bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23566070' stroke-width='2.4'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 12px center; color: var(--ink); font: 400 16px/1 var(--font-sans); }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-3); }
.checks { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.check-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); cursor: pointer; font-weight: 500; }
.check-chip input { width: 16px; height: 16px; accent-color: var(--estate-accent); margin: 0; }
.check-chip.is-fixed { background: var(--surface-sunken); cursor: default; }
.actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.actions form { margin: 0; }
.btn-danger { background: var(--surface); color: var(--overdue); border-color: var(--line); }
.btn-danger:hover { background: var(--overdue-bg); }
.btn-sm { height: 32px; padding: 0 12px; font-size: 14px; }
.dl { display: grid; grid-template-columns: 140px 1fr; gap: 10px var(--space-4); margin: 0; }
.dl dt { color: var(--ink-muted); font-size: 14px; }
.dl dd { margin: 0; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--ink-muted); text-decoration: none; font-size: 14px; margin-bottom: var(--space-2); }
.back:hover { color: var(--ink); }
.history { list-style: none; margin: 0; padding: 0; }
.history li { display: grid; grid-template-columns: 1fr; gap: 2px; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.history li:first-child { border-top: 0; padding-top: 0; }
.history .when { color: var(--ink-muted); font-size: 13px; }

.secret-box { padding: var(--space-4); border-radius: var(--radius-md); background: var(--surface-sunken); border: 1px dashed var(--line); }
.secret-box .pw { font: 500 24px/30px var(--font-mono); letter-spacing: .04em; margin: 4px 0 0; user-select: all; }
.message-box { margin-top: var(--space-4); padding: var(--space-4); border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--surface); font-size: 14px; line-height: 19px; white-space: pre-wrap; user-select: all; }

@media (max-width: 960px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 760px) {
  .card { padding: var(--space-4); }
  .row-2 { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; gap: 2px var(--space-4); }
  .dl dd { margin-bottom: 8px; }
  .table .hide-phone { display: none; }
}

.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
p.label { margin-bottom: 0; }

.add-row { display: grid; grid-template-columns: minmax(200px, 1.4fr) 1fr 1fr auto; gap: var(--space-3); align-items: end; }
.add-row .field + .field { margin-top: 0; }
.add-row .btn { height: 40px; }
@media (max-width: 960px) { .add-row { grid-template-columns: 1fr 1fr; } .add-row .field:first-of-type { grid-column: 1 / -1; } .add-row .btn { grid-column: 1 / -1; } }

.phone-only { display: none; }
@media (max-width: 760px) { .table .phone-only { display: block; font-size: 13px; line-height: 18px; } .table td { white-space: normal; } .table .pill { white-space: nowrap; } }
.row-2 .field + .field { margin-top: 0; }

/* ---- Import (Settings → Import) --------------------------------------- */
.imp-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: var(--space-3) var(--space-6); }
.imp-head h2 { font: 600 19px/24px var(--font-sans); margin: 0; }
.imp-head p { margin: 4px 0 0; font-size: 15px; }
.steps { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 6px; list-style: none; margin: 0; padding: 0; font-size: 15px; }
.steps li { display: inline-flex; align-items: center; gap: 8px; color: var(--ink-muted); }
.steps li + li::before { content: ""; width: 24px; height: 1px; background: var(--line); margin-right: 2px; }
.steps i { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font: 600 13px/1 var(--font-mono); font-style: normal; background: var(--surface-sunken); color: var(--ink-muted); }
.steps .done i { background: var(--paid-bg); color: var(--paid); }
.steps .on { color: var(--ink); font-weight: 600; }
.steps .on i { background: var(--estate-accent); color: var(--on-accent); }
.figs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-4); margin-top: var(--space-4); padding-top: var(--space-4); border-top: 1px solid var(--line); }
.fig { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.fig b { font: 600 22px/1.1 var(--font-sans); font-variant-numeric: tabular-nums; }
.fig .muted { font-size: 13px; line-height: 18px; }
.stack { display: flex; flex-direction: column; gap: var(--space-6); min-width: 0; }
.ph { display: flex; justify-content: space-between; align-items: center; gap: var(--space-2); padding: 14px 20px; border-bottom: 1px solid var(--line); }
.ph h2 { margin: 0; font: 600 16px/22px var(--font-sans); }
.fd { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 14px; padding: 16px 20px; border-top: 1px solid var(--line); }
.ph + .fd { border-top: 0; }
.fd h3 { margin: 0; font: 600 16px/22px var(--font-sans); }
.fd p { margin: 4px 0 0; font-size: 15px; line-height: 22px; }
.fd .ex { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.fd-empty { margin: 0; padding: 16px 20px; }
.ic { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font: 700 14px/1 var(--font-sans); }
.ic-warn { background: var(--due-bg); color: var(--due); }
.ic-info { background: var(--review-bg); color: var(--review); }
.blockers { margin: 0; padding: 14px 20px 14px 38px; color: var(--overdue); font-size: 15px; line-height: 22px; }
.ready { padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.ready h2 { margin: 0; font: 600 16px/22px var(--font-sans); }
.ready p { margin: 0; font-size: 15px; }
.ready form { margin: 0; }
.btn-tall { height: 44px; }
.tablewrap.flush { border: 0; border-radius: 0; }
.table .num { text-align: right; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--estate); margin-right: 8px; vertical-align: 1px; }
.filename { display: block; font-size: 14px; word-break: break-word; }
.file-error { display: block; font-size: 13px; color: var(--overdue); }
.upload { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-3); align-items: end; }
.upload .btn { height: 40px; }
.input-file { height: auto; padding: 8px var(--space-3); }
.section-title { font: 600 16px/22px var(--font-sans); margin: 0 0 var(--space-2); }
@media (max-width: 960px) { .figs { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .figs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .upload { grid-template-columns: 1fr; }
  .fd { padding: 14px 16px; gap: 12px; }
  .ph { padding: 12px 16px; }
}
@media (max-width: 760px) {
  .steps { gap: 6px 14px; font-size: 14px; }
  .steps li + li::before { display: none; }
}

/* ---- Backups (Settings → Backups) ------------------------------------- */
.bk-top { display: flex; flex-wrap: wrap; gap: var(--space-4) var(--space-8); align-items: center; justify-content: space-between; }
.bk-last { display: flex; flex-direction: column; gap: 4px; flex: 999 1 360px; min-width: 0; }
.bk-last .muted { font-size: 14px; }
.bk-line { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.bk-when { font: 600 18px/24px var(--font-sans); }
.bk-now { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex: 1 1 200px; }
.bk-now form { margin: 0; }
.lock { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--ink-muted); }
/* Disabled buttons: a border instead of a fill – otherwise hard to tell from active ones in the dark */
.btn[disabled], .btn[disabled]:hover { background: transparent; color: var(--ink-muted); border: 1px dashed var(--field-line); box-shadow: none; opacity: 1; cursor: not-allowed; filter: none; }
.bk-test-due { border-color: var(--due); }
.bk-test-due .ph { background: var(--due-bg); }
.bk-test { display: flex; flex-wrap: wrap; gap: var(--space-3) var(--space-6); align-items: center; padding: 16px 20px; }
.bk-test p { margin: 0; flex: 999 1 420px; font-size: 15px; line-height: 22px; }
.bk-test form { margin: 0; flex: none; }
.set-form { padding: 16px 20px; display: flex; flex-direction: column; gap: var(--space-3); }
.set-form p { margin: 0; font-size: 15px; }
.small { font-size: 13px; line-height: 18px; }
.set { display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 8px 20px; padding: 14px 20px; border-top: 1px solid var(--line); align-items: start; }
form > .set:first-of-type { border-top: 0; }
.set > label, .set > .l { font: 600 15px/22px var(--font-sans); padding-top: 9px; }
.set small { display: block; font: 400 13px/18px var(--font-sans); color: var(--ink-muted); margin-top: 2px; }
.set .select, .set .input { max-width: 340px; }
.set .hint { display: block; margin-top: 6px; font-size: 13px; color: var(--ink-muted); }
.set-text { font-size: 15px; line-height: 22px; padding-top: 9px; }
.bk-note { margin: 0; padding: 12px 20px 16px; }
.bk-history { padding: 12px 20px 16px; }
.incl { list-style: none; margin: 0; padding: 14px 20px 0; display: flex; flex-direction: column; gap: 6px; font-size: 15px; }
.incl li { display: flex; gap: 8px; align-items: flex-start; }
.incl li::before { content: "✓"; color: var(--paid); font-weight: 700; flex: none; width: 16px; }
.table td .file-error { margin-top: 4px; }
@media (max-width: 760px) {
  .set { grid-template-columns: 1fr; padding: 12px 16px; }
  .set > label, .set > .l { padding-top: 0; }
  .set-text { padding-top: 0; }
  .set-actions > span { display: none; }
  .bk-now { align-items: stretch; }
  .bk-now .btn { width: 100%; }
}
.cell-sub { display: block; font-size: 13px; line-height: 18px; color: var(--ink-muted); margin-top: 2px; }

/* ---- Today: figures and work list ------------------ */
.mb-4 { margin-bottom: var(--space-4); }
.stat-value.is-set { color: var(--ink); }
.stat-value.is-bad { color: var(--overdue); }
.attn { list-style: none; margin: 0; padding: 0; }
.attn-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 12px 20px; border-top: 1px solid var(--line); }
.attn-row:first-child { border-top: 0; }
.attn-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.attn-title { font-weight: 600; }
.attn-hint { font-size: 14px; color: var(--ink-muted); }
.attn-empty { padding: 14px 20px; margin: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.estate-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--estate-accent); margin-right: 8px; vertical-align: 1px; }
@media (max-width: 760px) { .attn-row { padding: 12px 16px; } .attn-empty { padding: 12px 16px; } }
.today-sub { margin-top: var(--space-6); }
.table td.estate-cell { white-space: nowrap; }
@media (max-width: 760px) {
  .table-compact th, .table-compact td { padding-left: 8px; padding-right: 8px; }
  .table-compact th { letter-spacing: .02em; font-size: 10.5px; }
  .table-compact td { font-size: 14px; }
}

/* ---- Parcel list -------------------------------------- */
.bar-search input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: #fff; font: 400 14px/1 var(--font-sans); outline: none; }
.bar-search input::placeholder { color: rgba(255,255,255,.72); }
.bar-search:focus-within { background: rgba(255,255,255,.2); }
.list-search { display: flex; gap: var(--space-2); margin-bottom: var(--space-4); max-width: 640px; }
.list-search .input { flex: 1; }
.tab-count { font-size: 13px; color: var(--ink-muted); font-weight: 500; margin-left: 2px; }
.view-note { margin: calc(-1 * var(--space-3)) 0 var(--space-4); font-size: 15px; }
.view-note a { color: var(--ink-muted); }
.pname { font-weight: 600; }
.cell-sub.is-bad { color: var(--overdue); font-weight: 600; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: var(--space-4); }
a.attn-row { text-decoration: none; color: inherit; }
a.attn-row:hover { background: var(--surface-sunken); }
.attn-go { display: flex; align-items: center; gap: var(--space-2); }
.attn-go svg { width: 16px; height: 16px; color: var(--ink-muted); }
@media (max-width: 760px) {
  .list-search { max-width: none; }
  /* Search field with a choice (e.g. position): search field full width, choice below */
  .list-search:has(.select) { flex-wrap: wrap; }
  .list-search:has(.select) .input { flex: 1 0 100%; }
  .list-search:has(.select) .select { flex: 1 1 0; min-width: 0; max-width: none; }
  .parcels-table .phone-only { display: block; }
}
@media (max-width: 360px) {
  .list-search:has(.select) .select { flex: 1 0 100%; }
}
.cell-sub.phone-only { display: none; }
@media (max-width: 760px) { .parcels-table .cell-sub.phone-only { display: block; } }

/* ---- Parcel detail (side panel) ---------- */
.split.has-detail { display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 440px); gap: var(--space-6); align-items: start; }
.split-detail { position: sticky; top: 72px; max-height: calc(100vh - 88px); overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
.split.has-detail .hide-split { display: none; }
.table tr.is-clickable { cursor: pointer; }
.table tr.is-selected td { background: var(--surface-sunken); }
.table tr.is-selected td:first-child { box-shadow: inset 3px 0 0 var(--estate-accent); }
.table a.pname { color: var(--ink); text-decoration: none; }
.table a.pname:hover { text-decoration: underline; }
.detail-page { max-width: 640px; }
.detail { font-size: 15px; }
.detail-head { padding: 16px 20px 14px; border-bottom: 1px solid var(--line); }
.detail-nav { display: flex; align-items: center; gap: 4px; justify-content: flex-end; margin: -6px -8px 4px 0; }
.detail-nav:empty { display: none; }
.detail-pos { margin-right: auto; font-size: 13px; }
.icon-btn { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: var(--radius-md); color: var(--ink-muted); text-decoration: none; font-weight: 600; }
.icon-btn:hover { background: var(--surface-sunken); color: var(--ink); }
.icon-btn.is-off { opacity: .35; }
.detail-nav .icon-btn:first-child { order: 9; }
.detail-where { margin: 0; font-size: 14px; color: var(--ink-muted); }
.detail-title { margin: 2px 0 10px; font: 600 22px/28px var(--font-mono); letter-spacing: -.01em; word-break: break-word; }
.detail-chips { gap: 6px; }
.detail-note { margin: 10px 0 0; font-size: 13px; line-height: 18px; color: var(--review); }
.detail-sec { padding: 14px 20px 16px; border-top: 1px solid var(--line); }
.detail-head + .detail-sec { border-top: 0; }
.detail-sec .label { margin: 0 0 10px; }
.kv { display: grid; grid-template-columns: 104px minmax(0, 1fr); gap: 8px 14px; margin: 0; }
.kv dt { color: var(--ink-muted); font-size: 14px; line-height: 22px; }
.kv dd { margin: 0; line-height: 20px; min-width: 0; }
.break { word-break: break-all; }
.tx-list { list-style: none; margin: 0; padding: 0; }
.tx { padding: 9px 0; border-top: 1px solid var(--line); }
.tx:first-child { border-top: 0; padding-top: 0; }
.tx-main { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.tx-kind { font-weight: 600; min-width: 84px; }
.tx-change { font-variant-numeric: tabular-nums; }
.tx-payment .tx-amount { color: var(--paid); }
.tx-sub { font-size: 13px; line-height: 18px; color: var(--ink-muted); margin-top: 2px; }
.phone-only-inline { display: none; }
@media (max-width: 1100px) {
  .split.has-detail { grid-template-columns: minmax(0, 1fr) 360px; gap: var(--space-4); }
  .kv { grid-template-columns: 92px minmax(0, 1fr); }
}
@media (max-width: 760px) {
  /* Phone: detail full screen with a back arrow, list hidden */
  .split.has-detail { display: block; }
  .split.has-detail .split-list { display: none; }
  .split-detail { position: static; max-height: none; overflow: visible; margin: calc(-1 * var(--space-4)); border: 0; border-radius: 0; }
  .detail-head { padding: 12px 16px; }
  .detail-sec { padding: 12px 16px 14px; }
  .detail-nav { margin: 0 0 6px; }
  .detail-nav .icon-btn:first-child { order: -1; margin-right: auto; padding-left: 0; }
  .detail-pos { margin-right: 0; }
  .detail .hide-phone { display: none; }
  .phone-only-inline { display: inline; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dt { font-size: 13px; }
  .kv dd { margin-bottom: 8px; }
}

/* ---- Regions ------------------------------ */
.page-head .head-action { margin-left: auto; }
.sortbar { display: flex; flex-wrap: wrap; gap: 4px; align-items: baseline; margin: calc(-1 * var(--space-3)) 0 var(--space-3); font-size: 14px; }
.sortbar a { color: var(--ink-muted); }
.sortbar strong { font-weight: 600; }
.regions-table .chips { display: inline-flex; vertical-align: middle; }
.regions-table .chip { height: 18px; font-size: 10.5px; padding: 0 6px; }
.chip-due { color: var(--due); background: var(--due-bg); border-color: transparent; }
.chip-bad { color: var(--overdue); background: var(--overdue-bg); border-color: transparent; }
.occ { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.occ-bar { width: 64px; height: 6px; border-radius: 3px; background: var(--surface-sunken); overflow: hidden; display: inline-block; }
.occ-fill { display: block; height: 100%; background: var(--paid); width: 0; }
.occ-10 { width: 10%; } .occ-20 { width: 20%; } .occ-30 { width: 30%; } .occ-40 { width: 40%; } .occ-50 { width: 50%; }
.occ-60 { width: 60%; } .occ-70 { width: 70%; } .occ-80 { width: 80%; } .occ-90 { width: 90%; } .occ-100 { width: 100%; }
.occ-0 .occ-fill, .occ-0, .occ-10, .occ-20 { background: var(--overdue); }
.occ-30, .occ-40, .occ-50 { background: var(--due); }
.more-list .attn-row { color: var(--ink); }
.more-item { display: inline-flex; align-items: center; gap: 12px; font-weight: 500; }
.more-item svg { width: 18px; height: 18px; color: var(--ink-muted); }
.attn-row.is-soon .more-item { color: var(--ink-muted); }
@media (max-width: 760px) {
  .page-head .head-action { display: none; }
  .occ-bar { width: 28px; }
  .regions-table .occ, .regions-table .cell-sub.is-bad { white-space: nowrap; }
  .regions-table td { padding-left: 8px; padding-right: 8px; }
}

/* ---- Tenants --------------------- */
a.strong-link { font-weight: 600; color: var(--ink); }
a.tenant-link { color: var(--ink); text-decoration: none; }
a.tenant-link:hover { text-decoration: underline; }
.profile-head { display: flex; gap: var(--space-4); align-items: flex-start; margin: var(--space-2) 0 var(--space-4); }
.avatar-lg { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--estate-accent); color: var(--on-accent); font: 600 20px/1 var(--font-sans); }
.profile-title h1 { font: 600 24px/30px var(--font-sans); letter-spacing: -.01em; margin: 0 0 6px; word-break: break-word; }
.profile-title .chip .estate-dot { margin-right: 6px; }
.profile-title p { margin: 8px 0 0; }
.profile-stats .stat-foot { line-height: 16px; }
.kv.pad { padding: 14px 20px 16px; }
.tx-list.pad { padding: 14px 20px 6px; }
.pad-b { padding: 0 20px 16px; }
.is-bad-text { color: var(--overdue); font-weight: 600; }
.tenants-table .estate-dot { margin-right: 3px; }
.tenants-table .estate-dot:last-of-type { margin-right: 8px; }
@media (max-width: 760px) {
  .profile-head { gap: var(--space-3); }
  .avatar-lg { width: 44px; height: 44px; font-size: 16px; }
  .kv.pad { padding: 12px 16px; }
  .tx-list.pad { padding: 12px 16px 4px; }
  .pad-b { padding: 0 16px 12px; }
}
.detail-note.profile-note { margin: 0 0 var(--space-4); }

/* --- Tenant notes and flags --- */
.mt-2 { margin-top: 8px; }
form.pad, div.pad, .note-list.pad { padding: 14px 20px 16px; }
.textarea { width: 100%; min-height: 72px; padding: 10px var(--space-3); border-radius: var(--radius-sm); border: 1px solid var(--field-line); background: var(--field-bg); color: var(--ink); font: 400 15px/22px var(--font-sans); resize: vertical; display: block; }
.textarea:focus { outline: 2px solid var(--focus); outline-offset: 0; border-color: transparent; }
.note-new { border-bottom: 1px solid var(--line); }
.note-list { list-style: none; margin: 0; display: grid; gap: 14px; }
.note { display: grid; gap: 4px; }
.note + .note { border-top: 1px solid var(--line); padding-top: 14px; }
.note-meta { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.note-body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 15px; line-height: 22px; }
.note-actions { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 12px; font-size: 13px; }
.note-actions form { margin: 0; }
.note-edit[open] { flex: 1 1 100%; order: 2; }
.note-edit summary, .changes summary { cursor: pointer; color: var(--ink-muted); font-size: 13px; }
.note-edit[open] summary { margin-bottom: 6px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--ink-muted); font: inherit; font-size: 13px; cursor: pointer; text-decoration: underline; }
.linkbtn:hover { color: var(--overdue); }
.change-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; font-size: 13px; color: var(--ink-muted); }
.chip-note { color: var(--ink-muted); }
.chip-xs { height: 16px; padding: 0 5px; font-size: 11px; vertical-align: 1px; }
@media (max-width: 760px) {
  form.pad, div.pad, .note-list.pad { padding: 12px 16px; }
}

/* --- Lock reason in the parcel detail --- */
.lock-form { margin-top: 12px; display: grid; gap: 6px; }
.lock-row { display: flex; gap: 8px; align-items: center; }
.lock-label { display: flex; align-items: center; }
.lock-row .select { max-width: 240px; height: 32px; font-size: 14px; }

/* --- Extend rental in the parcel detail --- */
.ext { margin-top: 14px; }
.ext > summary { list-style: none; display: inline-flex; }
.ext > summary::-webkit-details-marker { display: none; }
.ext-form { margin-top: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-sunken); }
.ext-form .field + .field { margin-top: 12px; }
.ext-form .select { height: 36px; font-size: 15px; }
.ext-row { display: flex; gap: 8px; align-items: center; }
.ext-row .input { width: 84px; height: 36px; font-size: 15px; }
.ext-preview { margin-top: 14px; padding: 14px; border: 1px solid var(--estate-accent); border-radius: var(--radius-md); background: var(--surface); }
.ext-preview .kv { margin-top: 8px; }
.ext-confirm { display: flex; gap: 8px; align-items: center; margin-top: 12px; }
.ext-off { margin-top: 14px; display: flex; gap: 8px; align-items: center; }

/* --- Text size per person: Normal · Large --- */
/* "Large" enlarges the whole page by 12.5 % like the browser's zoom key; spacing grows with it. */
:root[data-text="large"] body { zoom: 1.125; }
.theme-pick .theme-label-2 { margin-top: 10px; }

/* Side panel open on narrower screens or with "Large": tenant below the parcel name
   instead of a column of its own, so "Paid until" and status stay visible */
@media (max-width: 1400px) {
  .split.has-detail .col-tenant { display: none; }
  .split.has-detail .parcels-table .cell-sub.phone-only { display: block; }
}
:root[data-text="large"] .split.has-detail .col-tenant { display: none; }
:root[data-text="large"] .split.has-detail .parcels-table .cell-sub.phone-only { display: block; }

/* --- Credits in the tenant profile --- */
.credit-sum { font-weight: 600; color: var(--paid); }
.credit-row { font-size: 15px; line-height: 22px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.credit-used .credit-row, .credit-cancelled .credit-row, .credit-expired .credit-row { color: var(--ink-muted); }
.credit-add > summary { list-style: none; display: inline-flex; }
.credit-add > summary::-webkit-details-marker { display: none; }
.credit-add .ext-form { margin-top: 12px; }
.credit-hints { margin: 4px 0 0; padding-left: 16px; display: grid; gap: 2px; }
.credit-date { max-width: 200px; height: 36px; font-size: 14px; }
.credit-how { margin: 12px 0 0; }

/* --- Refund --- */
.sent-check { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; line-height: 20px; }
.sent-check input { width: 16px; height: 16px; margin-top: 2px; accent-color: var(--estate-accent); flex: none; }
.ext-confirm-col { flex-direction: column; align-items: flex-start; }
.ext + .ext { margin-top: 8px; }

/* Add partner (14.11.2026) */
.ext-form .sent-check + .field { margin-top: 12px; }
.ext-form + .ext-form { margin-top: 8px; }
.ext-form input[name="name"] { width: 100%; max-width: 320px; height: 36px; font-size: 15px; }
.ext-form input[name="target"] { width: 100%; max-width: 320px; height: 36px; font-size: 15px; }
.credit-sum.is-bad { color: var(--overdue); }

/* Release checklist (14.11.2026) */
.release .check-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.check-item { display: flex; gap: 10px; align-items: flex-start; }
.check-item form { margin: 0; }
.check-box { width: 24px; height: 24px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--field-line); border-radius: 6px; background: var(--field-bg); color: var(--paid);
  font-weight: 700; font-size: 15px; line-height: 1; cursor: pointer; padding: 0; }
span.check-box { cursor: default; }
.check-item.is-done .check-box { border-color: var(--paid); }
.check-label { padding-top: 2px; }
.check-price { padding-left: 34px; }
.check-price .ext-row .muted { white-space: nowrap; }
.row-break { display: none; }
@media (max-width: 760px) {
  /* Phone: "Save price" on a line of its own */
  .check-price .ext-row { flex-wrap: wrap; }
  .check-price .row-break { display: block; flex-basis: 100%; height: 0; }
}
@media (max-width: 360px) { .check-price { padding-left: 0; } }
.check-price .ext-row .input { width: 84px; height: 34px; font-size: 15px; }

/* Open amounts */
.decide-bar { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin: 12px 0 16px;
  padding: 12px 16px; border-radius: var(--radius-md); background: #f9eeda; color: #5a3d00; border: 1px solid #ecd3a3; }
:root[data-theme="dark"] .decide-bar { background: #3a2f17; color: #f3dfb4; border-color: #5c4a22; }
@media (prefers-color-scheme: dark) { :root:not([data-theme]) .decide-bar { background: #3a2f17; color: #f3dfb4; border-color: #5c4a22; } }
.decide-bar .btn { margin-left: auto; }
.decide-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.decide-row form { margin: 0; }
.decide-paid { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

/* ---- Device list and check list ------------------ */
.report-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); white-space: normal; }
.inline-form { display: inline-flex; gap: var(--space-1); align-items: center; }
.input-sm { height: 32px; padding: 0 var(--space-2); font-size: 14px; width: 190px; }
.input-price { width: 110px; }
.kv.kv-wide { grid-template-columns: 240px minmax(0, 1fr); margin-bottom: var(--space-4); }
@media (max-width: 760px) { .kv.kv-wide { grid-template-columns: 1fr; } }
.panel-text { padding: 12px 20px; margin: 0; }
.set-form-tight { padding-top: 0; }
.input-key { max-width: 420px; }
.kv.kv-wide { margin-bottom: 0; }

/* Pay terminal: flag "Not renewing" */
.chip-warn { color: var(--due); background: var(--due-bg); border-color: transparent; }
.not-renewing-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }

/* Tier monitor */
.setup-row { flex-direction: row; flex-wrap: wrap; align-items: flex-end; border-top: 1px solid var(--line); padding-top: 14px; }
.setup-row .field { flex: 1 1 180px; margin: 0; }
.setup-row .setup-name { flex: 0 0 150px; display: flex; gap: 8px; align-items: center; padding-bottom: 10px; }
.setup-row .actions { margin: 0; }
.input-pos { max-width: 150px; }
.chip-monitor { font-weight: 600; }
.watch-list { list-style: none; margin: 0; padding: 0; }
.watch-list li { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--line); }
.watch-list li:first-child { border-top: 0; }

/* ---- Colour scheme "Midnight" ------------------------------
   Model: dark violet/night blue, neon green as accent, more rounded, a slight glow.
   Neon green (--glow) only for controls (focus, active navigation, chosen buttons) –
   status colours keep their own tones, "Paid" deliberately more yellow than the neon. */
:root[data-theme="midnight"] {
  --bg: #1b1740; --surface: #252056; --surface-sunken: #2e2866; --line: #3b3478;
  --ink: #f2f0fb; --ink-muted: #a8a2d2; --on-accent: #120f2c;
  --field-line: #7d76b8; --field-bg: #1f1a4a;
  --glow: #3df5a8; --glow-soft: rgba(61,245,168,.28);
  --willowdale-accent: #a6dde0; --all-accent: #a6dde0; --test-accent: #f0cd82;
  --overdue: #ff7f8e; --overdue-bg: #44193f; --due: #ffc45e; --due-bg: #3f2d2a;
  --paid: #c4ec6a; --paid-bg: #2c3a2a; --review: #74d3ff; --review-bg: #1d3463; --focus: #3df5a8;
  --radius-sm: 9px; --radius-md: 16px; --radius-lg: 22px;
  --shadow-pop: 0 14px 36px rgba(6,4,24,.6), 0 0 0 1px rgba(255,255,255,.04);
  --panel-glow: 0 10px 30px rgba(6,4,24,.45), 0 0 26px rgba(123,97,255,.14);
  color-scheme: dark;
}
:root[data-theme="midnight"] body {
  background: radial-gradient(1200px 600px at 85% -10%, #2c2470 0%, transparent 60%),
              radial-gradient(900px 500px at -10% 110%, #221c5a 0%, transparent 55%), var(--bg);
  background-attachment: fixed;
}
:root[data-theme="midnight"] .panel,
:root[data-theme="midnight"] .tablewrap,
:root[data-theme="midnight"] .split-detail { border-color: rgba(255,255,255,.06); box-shadow: var(--panel-glow); }
:root[data-theme="midnight"] .tablewrap.flush { box-shadow: none; }
:root[data-theme="midnight"] .table th { background: transparent; }
:root[data-theme="midnight"] .table td, :root[data-theme="midnight"] .table th { border-bottom-color: rgba(255,255,255,.07); }
:root[data-theme="midnight"] .bar { box-shadow: 0 1px 0 rgba(255,255,255,.06), 0 8px 26px rgba(6,4,24,.45); }
:root[data-theme="midnight"] .rail { background: rgba(20,16,52,.55); border-right-color: rgba(255,255,255,.06); }
:root[data-theme="midnight"] .rail a[aria-current="page"] { background: rgba(61,245,168,.10); color: var(--glow); box-shadow: inset 3px 0 0 var(--glow), 0 0 18px var(--glow-soft); }
:root[data-theme="midnight"] .tabbar { background: #1f1a4a; border-top-color: rgba(255,255,255,.06); }
:root[data-theme="midnight"] .tabbar a[aria-current="page"] { color: var(--glow); text-shadow: 0 0 12px var(--glow-soft); }
:root[data-theme="midnight"] .subtabs a[aria-current="page"] { border-bottom-color: var(--glow); }
:root[data-theme="midnight"] .btn-primary { box-shadow: 0 0 16px color-mix(in srgb, var(--estate-accent) 35%, transparent); }
:root[data-theme="midnight"] .btn-secondary { background: transparent; border-color: rgba(255,255,255,.16); }
:root[data-theme="midnight"] .theme-seg button[aria-pressed="true"] { background: var(--surface); color: var(--glow); box-shadow: 0 0 0 1px var(--glow-soft), 0 0 12px var(--glow-soft); }
:root[data-theme="midnight"] .input:focus, :root[data-theme="midnight"] .select:focus, :root[data-theme="midnight"] .textarea:focus { box-shadow: 0 0 0 4px var(--glow-soft); }
:root[data-theme="midnight"] .pill { box-shadow: inset 0 0 0 1px rgba(255,255,255,.05); }
:root[data-theme="midnight"] .decide-bar { background: #3f2d2a; color: #ffdca0; border-color: #6a4c35; }
:root[data-theme="midnight"] .menu-pop { background: #2a245e; }

/* Enroll tenant (15.11.2026) */
.en-when { display: flex; gap: 8px; flex-wrap: wrap; }
.en-time { max-width: 120px; height: 36px; font-size: 14px; }

/* ---- Tasks: tickets, GM ↔ owner, waiting list, archive ---- */
.task-new-btn { margin-left: auto; align-self: center; }
.task-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: calc(var(--space-6) * -1 + 10px) 0 var(--space-4); }
.task-filters .chip { height: 28px; padding: 0 11px; font-size: 13px; text-decoration: none; color: var(--ink-muted); }
.task-filters .chip:hover { color: var(--ink); }
.task-filters .chip.is-on { background: var(--estate-accent); color: var(--on-accent); border-color: transparent; }
.task-group { font: 600 15px/20px var(--font-sans); margin: 0 0 8px; }
.task-list + .task-group { margin-top: var(--space-6); }
.task-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); overflow: hidden; }
.task { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.task:last-child { border-bottom: 0; }
.task.is-urgent { box-shadow: inset 3px 0 0 var(--overdue); }
.task.is-done .task-main { opacity: .78; }
.task-main { flex: 1; min-width: 0; display: grid; gap: 3px; color: var(--ink); text-decoration: none; }
.task-main:hover strong { text-decoration: underline; }
.task-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.task-estate { font-size: 13px; color: var(--ink-muted); }
.task-estate .estate-dot { margin-right: 5px; }
.task-about { font-size: 14px; line-height: 20px; }
.task-note { white-space: normal; overflow-wrap: anywhere; font-size: 14px; line-height: 20px; }
.task-meta { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.task-quick { flex: none; margin: 0; }
.task-form { max-width: 720px; }
.task-form .field + .field, .task-form .row-2 + .field, .task-form .field + .row-2 { margin-top: var(--space-4); }
.task-form-foot { display: flex; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }
.seg-radio { display: grid; gap: 6px; }
.seg-radio label { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.task-checks { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.task-checks .hint { flex-basis: 100%; }
.task-detail { display: grid; gap: var(--space-4); max-width: 820px; }
.task-body { padding-top: 0; }
.task-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.task-done-form { display: flex; gap: 8px; flex: 1 1 320px; margin: 0; }
.task-done-form .input { height: 32px; font-size: 14px; }
.task-edit .field { margin-top: 10px; }
@media (max-width: 760px) {
  .task { padding: 12px; align-items: flex-start; }
  .task-form-foot { padding: 12px 16px; }
}

/* ---- SL clock in the top bar ---- */
.bar-clock { display: flex; align-items: baseline; gap: 6px; padding: 5px 10px; border-radius: var(--radius-md); background: rgba(255,255,255,.12); color: #fff; font: 600 15px/1 var(--font-mono); white-space: nowrap; }
.bar-clock-label { font: 700 11px/1 var(--font-sans); letter-spacing: .08em; color: rgba(255,255,255,.75); }
@media (max-width: 760px) { .bar-clock { font-size: 14px; padding: 4px 8px; } .clk-day { display: none; } }
@media (max-width: 420px) { .bar { gap: 6px; } .bar-clock { font-size: 13px; padding: 4px 6px; gap: 4px; } .bar-clock-label { font-size: 9px; } }

/* --- Help ---------------------------------------------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.help-search { margin-bottom: var(--space-6); max-width: 640px; }
.help-none { margin: var(--space-3) 0 0; }
.help-new { margin-bottom: var(--space-6); }
.help-new-list { list-style: none; margin: 0; padding: 6px 20px 10px; }
.help-new-list li { display: flex; gap: var(--space-3); padding: 6px 0; font-size: 15px; line-height: 21px; }
.help-new-date { flex: 0 0 172px; color: var(--ink-muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.help-new-list a { color: var(--ink); text-decoration: none; }
.help-new-list a:hover { text-decoration: underline; }
.help-new-more { border-top: 1px solid var(--line); }
.help-new-more > summary { cursor: pointer; padding: 10px 20px; color: var(--ink-muted); font-size: 14px; }
.help-group { margin-bottom: var(--space-6); }
.help-topic { border-top: 1px solid var(--line); scroll-margin-top: 80px; }
.help-topic:first-child { border-top: 0; }
.help-topic > summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 13px 20px; font-weight: 600; }
.help-topic > summary::-webkit-details-marker { display: none; }
.help-topic > summary::after { content: "+"; color: var(--ink-muted); font-weight: 400; font-size: 20px; line-height: 1; }
.help-topic[open] > summary::after { content: "–"; }
.help-topic > summary:hover { background: var(--surface-sunken); }
.help-topic.is-target > summary { box-shadow: inset 3px 0 0 var(--estate-accent); }
.help-body { padding: 0 20px 14px; font-size: 15px; line-height: 23px; max-width: 760px; }
.help-body p { margin: 0 0 10px; }
.help-body ul, .help-body ol { margin: 0 0 10px; padding-left: 22px; }
.help-body li { margin: 3px 0; }
.help-body li ul { margin: 4px 0 0; }
.help-body a { color: var(--estate-accent); }
.help-body kbd { font: 500 12px/1 var(--font-mono); padding: 2px 5px; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.help-body .table-wrap { overflow-x: auto; margin: 0 0 10px; }
.help-roles td { white-space: normal; font-size: 14px; }
.help-roles td:not(:first-child) { white-space: nowrap; }
.help-q, .help-q-demo { flex: none; aspect-ratio: 1; box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; margin-left: 6px; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink-muted); font: 600 11px/1 var(--font-sans); text-decoration: none; vertical-align: middle; text-transform: none; letter-spacing: 0; }
.help-q:hover { color: var(--ink); border-color: var(--ink-muted); }
.help-q:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.page-head .help-q { align-self: center; }
.help-pop { width: min(560px, calc(100vw - 24px)); max-height: min(80vh, 720px); padding: 0; border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); color: var(--ink); box-shadow: var(--shadow-pop); }
.help-pop::backdrop { background: rgba(10, 12, 18, .45); }
.help-pop-head { position: sticky; top: 0; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: 14px 20px 10px; background: var(--surface); }
.help-pop-head h2 { margin: 0; font: 600 17px/23px var(--font-sans); }
.help-pop-foot { margin: 0; padding: 10px 20px 14px; border-top: 1px solid var(--line); font-size: 14px; }
.help-pop-foot a { color: var(--estate-accent); }
@media (max-width: 760px) {
  .help-q { width: 22px; height: 22px; font-size: 12px; }
  .help-new-list li { flex-direction: column; gap: 0; }
  .help-new-date { flex: none; }
}
.help-line { display: flex; align-items: center; gap: 6px; margin: 10px 0 2px; color: var(--ink-muted); font-size: 13px; }
.help-line .help-q { margin-left: 0; }

/* ---- Log: daily record Sold/Back ---- */
.log-filters { margin-top: 0; }
.log-day { margin-bottom: var(--space-4); overflow: hidden; scroll-margin-top: 80px; }
.log-day.is-today { border-color: var(--estate-accent); }
.log-day-head { cursor: pointer; list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 13px 20px; }
.log-day-head::-webkit-details-marker { display: none; }
.log-day-head::after { content: "+"; margin-left: auto; color: var(--ink-muted); font-size: 20px; line-height: 1; }
.log-day[open] > .log-day-head::after { content: "–"; }
.log-day[open] > .log-day-head { border-bottom: 1px solid var(--line); }
.log-day-head:hover { background: var(--surface-sunken); }
.log-date { font-weight: 600; }
.log-counts { font-size: 14px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.log-counts strong { color: var(--ink); }
.log-checks { display: grid; gap: 8px; padding: 12px 20px; background: var(--surface-sunken); border-bottom: 1px solid var(--line); }
.log-today .log-checks { border-bottom: 0; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius-md) var(--radius-md); }
.log-check-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.log-check-estate { flex: 0 0 150px; font-size: 14px; font-weight: 600; }
.log-check-items { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.log-check-by { margin-right: 6px; }
.log-tick { display: inline-flex; align-items: center; height: 30px; padding: 0 11px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface); color: var(--ink-muted); font: 600 13px/1 var(--font-sans); cursor: pointer; white-space: nowrap; }
.log-tick:hover { color: var(--ink); border-color: var(--ink-muted); }
.log-tick.is-on { color: var(--paid); background: var(--paid-bg); border-color: transparent; }
.log-tick.is-missing { color: var(--due); background: var(--due-bg); border-color: transparent; }
.log-tick.is-fixed { cursor: default; }
.log-list { list-style: none; margin: 0; padding: 0; }
.log-entry { display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; gap: 4px 14px; align-items: start; padding: 12px 20px; border-top: 1px solid var(--line); scroll-margin-top: 80px; }
.log-entry:first-child { border-top: 0; }
.log-entry.is-back { background: color-mix(in srgb, var(--overdue-bg) 45%, transparent); }
.log-entry.is-missing { box-shadow: inset 3px 0 0 var(--due); }
.log-entry:target { box-shadow: inset 3px 0 0 var(--estate-accent); }
.log-time { padding-top: 2px; color: var(--ink-muted); }
.log-main { display: grid; gap: 3px; min-width: 0; }
.log-top { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.log-parcel { font-weight: 600; color: var(--ink); text-decoration: none; }
a.log-parcel:hover { text-decoration: underline; }
.log-region { font-size: 13px; color: var(--ink-muted); }
.log-region .estate-dot { margin-right: 5px; }
.log-tenant a { color: var(--ink); }
.log-meta { font-size: 13px; line-height: 18px; color: var(--ink-muted); overflow-wrap: anywhere; }
.log-comment { font-size: 14px; line-height: 20px; overflow-wrap: anywhere; white-space: normal; }
.log-comment::before { content: "“"; } .log-comment::after { content: "”"; }
.log-side { display: grid; justify-items: end; gap: 6px; }
.log-ticks { display: flex; gap: 6px; }
.log-edit > summary { list-style: none; }
.log-edit > summary::-webkit-details-marker { display: none; }
.log-edit[open] > summary { color: var(--ink); }
.log-edit-form { display: grid; gap: 10px; width: min(340px, 80vw); padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.log-edit-form .field + .field { margin-top: 0; }
.log-edit-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.log-empty { padding: 14px 20px; margin: 0; }
.log-today-counts { margin: 0; padding: 12px 20px; }
.log-today .ph h2 { display: flex; align-items: center; gap: 6px; }
@media (max-width: 760px) {
  .log-day-head, .log-checks, .log-entry { padding-left: 14px; padding-right: 14px; }
  .log-entry { grid-template-columns: 44px minmax(0, 1fr); }
  .log-side { grid-column: 2; justify-items: start; }
  .log-edit-form { width: 100%; }
  .log-today-counts { padding: 12px 16px; }
}
/* Manager's name in the log (team stats) */
.log-credit { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
.log-credit-form, .log-note-form { display: grid; gap: 10px; }
.log-credit-form { padding-bottom: 12px; border-bottom: 1px solid var(--line); }
@media (max-width: 760px) { .log-credit { justify-content: flex-start; } }

/* ---- Team stats ---- */
.stats-nav { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; margin-bottom: var(--space-4); }
.stats-nav .stats-label { font: 600 17px/24px var(--font-sans); min-width: 0; }
.stats-nav .btn-sm { min-width: 38px; }
.stats-export { margin-left: auto; }
.stats-table td.rank { width: 44px; color: var(--ink-muted); font-variant-numeric: tabular-nums; }
.stats-table tr.is-me td { background: color-mix(in srgb, var(--estate-accent) 9%, transparent); }
.stats-table tr.is-first td.rank { color: var(--due); font-weight: 700; }
.stats-table tr.is-extra td { color: var(--ink-muted); }
.stats-table tr.is-total td { font-weight: 700; border-top: 2px solid var(--line); }
.stats-table th.grp { text-align: center; border-left: 1px solid var(--line); }
.stats-table td.sep, .stats-table th.sep { border-left: 1px solid var(--line); }
.stats-note { margin-top: var(--space-4); font-size: 14px; line-height: 20px; max-width: 760px; }

/* ---- Alts: linked accounts ---- */
.alt-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.alt-actions .credit-add { width: 100%; }
.alt-form { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.alt-form .input { flex: 1 1 220px; }
.task-alt-link { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.task-alt-link .input { flex: 1 1 260px; }
/* Field "Possible alt" only for the kind "Alt suspicion" (without :has support it stays visible) */
.task-form:has(#t-kind) .task-alt { display: none; }
.task-form:has(#t-kind option[value="alt_suspicion"]:checked) .task-alt { display: block; }

/* ---- Suggestions for tenant names ---- */
.suggest-wrap { position: relative; display: block; flex: 1 1 220px; min-width: 0; }
.suggest-list { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px 0; list-style: none;
  max-height: 320px; overflow-y: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop); }
.suggest-list li[data-name] { display: grid; gap: 2px; padding: 8px 12px; cursor: pointer; }
.suggest-list li[data-name]:hover, .suggest-list li.is-active { background: var(--surface-sunken); }
.suggest-list li.is-active { outline: 2px solid var(--focus); outline-offset: -2px; }
.suggest-name { font: 600 15px/20px var(--font-sans); color: var(--ink); overflow-wrap: anywhere; }
.suggest-sub { font: 400 13px/17px var(--font-sans); color: var(--ink-muted); }
.suggest-none { padding: 8px 12px; color: var(--ink-muted); font-size: 14px; }

/* ---------------------------------------------------------------------------
   Closing regions: overview under Regions → Closing, switch page
   --------------------------------------------------------------------------- */
.closing-regions { display: grid; gap: var(--space-4); }
.closing-region .ph { justify-content: flex-start; flex-wrap: wrap; }
.closing-region .ph h2 { margin-right: auto; }
.closing-region .ph .head-action { margin-left: 0; }
.closing-region .pad p { margin: 0; }
.closing-region .pad p + p { margin-top: 6px; }
.closing-list summary { cursor: pointer; font-size: 14px; color: var(--ink-muted); }
.closing-list ul { margin: 8px 0 0; padding-left: 18px; font-size: 14px; line-height: 22px; }
.closing-form .ext-preview { margin-top: 0; }
.closing-region .pad { padding: 12px 20px 14px; }
.closing-form > .pad { padding: 16px 20px; }
.closing-region .pname { white-space: nowrap; }

.kv dd.is-bad { color: var(--overdue); }

/* Tier reminders */
.rem-list { border-top: 0; }
.rem-item { display: grid; gap: 2px; padding: 14px 20px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.rem-item:last-child { border-bottom: 0; }
.rem-item:target { background: color-mix(in srgb, var(--estate-accent) 8%, transparent); }
.rem-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
.rem-head .cell-sub { margin-top: 0; }
.rem-why { color: var(--ink); }
.rem-text summary { cursor: pointer; font-size: 13px; color: var(--ink-muted); margin-top: 4px; }
.rem-text p { white-space: pre-wrap; margin: 6px 0 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-sunken); font-size: 14px; line-height: 20px; }
.rem-stage { max-width: 190px; }
.pos-filter { max-width: 220px; }
.pays-on { display: flex; flex-wrap: wrap; gap: 8px; }
.pays-on .select, .pays-on .input { width: auto; min-width: 150px; flex: 1 1 150px; }
.pays-on [hidden] { display: none; }


/* ==== Design review part 2 ================= */

/* Magnifier in the top band (phone only): a tap opens the search field below the band.
   Without JavaScript the magnifier simply leads to the parcel list with its search field. */
.bar-find { display: none; }
@media (max-width: 760px) {
  .bar-find { display: grid; place-items: center; flex: none; position: relative; width: 34px; height: 34px;
    border-radius: var(--radius-md); border: 1px solid rgba(255,255,255,.28); background: rgba(255,255,255,.08); color: var(--on-band); }
  .bar-find svg { width: 18px; height: 18px; }
  .bar-find[aria-expanded="true"] { background: rgba(255,255,255,.24); }
  .bar-find::after { content: ""; position: absolute; inset: -5px; }   /* tap area 44 px */
  .bar-clock-label { display: none; }   /* leave out "SLT", the time stays (it's in the title) */
  .bar.is-finding .bar-search { display: flex; position: absolute; left: 0; right: 0; top: 100%; max-width: none; height: auto;
    padding: 0 var(--space-3) 10px; gap: 10px; border-radius: 0; background: var(--estate); color: var(--on-band);
    box-shadow: 0 6px 12px rgba(0,0,0,.18); }
  .bar.is-finding .bar-search svg { width: 18px; height: 18px; }
  .bar.is-finding .bar-search input { height: 42px; padding: 0 12px; border-radius: var(--radius-md); background: rgba(255,255,255,.16);
    font-size: 16px; }   /* 16 px: otherwise the iPhone zooms the page while typing */
  .bar.is-finding .bar-search input:focus { background: rgba(255,255,255,.24); outline: 2px solid rgba(255,255,255,.7); outline-offset: 0; }
  .bar.is-finding .bar-search kbd { display: none; }
}
@media (max-width: 420px) { .bar-find { width: 32px; height: 32px; } .bar-find::after { inset: -6px; } }
/* very narrow (320 px phones): magnifier without border, tighter spacing */
@media (max-width: 340px) {
  .bar { padding: 0 8px; gap: 4px; }
  .bar-find { width: 26px; border-color: transparent; background: none; }
  .bar-find::after { inset: -6px -9px; }
  .bar-clock { padding: 4px 5px; }
  :root[data-text="large"] .bar-logo .wordmark { font-size: 17px; }
  :root[data-text="large"] .bar-logo .wordmark-plain { font-size: 11px; line-height: 12px; }
}
/* Text size Large on 360 px phones behaves like 320 px */
@media (max-width: 380px) {
  :root[data-text="large"] .bar { padding: 0 8px; gap: 4px; }
  :root[data-text="large"] .bar-find { width: 26px; border-color: transparent; background: none; }
  :root[data-text="large"] .bar-find::after { inset: -6px -9px; }
  :root[data-text="large"] .bar-clock { padding: 4px 5px; }
}

/* Tap areas: invisibly larger ("a bigger doorbell"), visibly the same */
.help-q, .avatar { position: relative; }
.help-q::after { content: ""; position: absolute; inset: -12px; }
.avatar::after { content: ""; position: absolute; inset: -7px; border-radius: 50%; }
/* Release checklist: the whole row with its text can be tapped */
.check-item { position: relative; }
.check-item form .check-box::after { content: ""; position: absolute; inset: -6px 0; }
.check-item form + .check-label { cursor: pointer; }
.check-item .check-box:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
@media (max-width: 760px) {
  .btn-sm { height: 40px; padding: 0 14px; }
  .task-filters .chip { height: 40px; padding: 0 14px; font-size: 14px; }
  .task-filters { gap: 8px; }
  .log-check-link { display: inline-block; padding: 10px 8px; margin: -10px -4px; }
}

/* Parcel list as cards on a phone; the computer keeps the table */
@media (max-width: 760px) {
  .tablewrap.parcels-list { border: 0; background: none; overflow: visible; }
  .parcels-table, .parcels-table tbody { display: block; }
  .parcels-table thead { display: none; }
  .parcels-table tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "main state" "main paid";
    column-gap: 12px; row-gap: 4px; align-items: start; padding: 12px 14px; margin-bottom: 8px;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); }
  .parcels-table tbody tr:hover td { background: none; }
  .parcels-table tr.is-selected { box-shadow: inset 3px 0 0 var(--estate-accent); }
  .parcels-table tr.is-selected td, .parcels-table tr.is-selected td:first-child { background: none; box-shadow: none; }
  .parcels-table td { display: block; padding: 0; border: 0; }
  .parcels-table td.pcell { grid-area: main; min-width: 0; }
  .parcels-table td.col-paid { grid-area: paid; text-align: right; font-size: 14px; line-height: 19px; white-space: nowrap; }
  .parcels-table td.col-state { grid-area: state; text-align: right; }
  .parcels-table td.col-state .cell-sub { white-space: nowrap; }
  .parcels-table .pname { font-size: 16px; line-height: 22px; }
  .parcels-table td.col-paid .cell-sub { font-size: 13px; }
}

/* Tabs that don't fit on the screen: a soft edge hints you can swipe */
.subtabs.fade-r { -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, #000 calc(100% - 36px), transparent); }
.subtabs.fade-l { -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to left, #000 calc(100% - 36px), transparent); }
.subtabs.fade-l.fade-r { -webkit-mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); mask-image: linear-gradient(to right, transparent, #000 36px, #000 calc(100% - 36px), transparent); }

/* ==== Fixes for real phones (Brave with a large Android font ≈ 250 px band) ==== */
@media (max-width: 760px) {
  /* Only the logo may give way, so magnifier, clock and account button always fit */
  .bar .bar-logo { flex: 0 1 auto; min-width: 0; overflow: hidden; }
  .bar .bar-logo img { max-width: 100%; object-fit: contain; object-position: left center; }
}
@media (max-width: 300px) {
  :root[data-text="large"] .bar-logo .wordmark { font-size: 15px; }
  :root[data-text="large"] .bar-logo .wordmark-plain { font-size: 10px; line-height: 11px; }
}

/* ==== Review of all pages (250–390 px, Normal/Large, Midnight) ==== */
/* The page must never become wider than the screen */
.pays-on { min-width: 0; }
.pays-on .select, .pays-on .input { min-width: 0; max-width: 100%; }
.field > .pays-on, .field > label { min-width: 0; }
dd .mono { overflow-wrap: anywhere; }
.task-form-foot { flex-wrap: wrap; }
.check-chip.task-recurring { flex-wrap: wrap; height: auto; min-height: 36px; padding-top: 6px; padding-bottom: 6px; row-gap: 2px; max-width: 100%; }
.check-chip.task-recurring .muted { white-space: nowrap; }
.ph { flex-wrap: wrap; }
.ph h2 { min-width: 0; }
.auth-marks > * { min-width: 0; }
/* Two-step setup: the numbered steps accidentally inherited the look of the import steps */
ol.steps { display: block; padding-left: 20px; font-size: inherit; }
ol.steps li { display: list-item; color: var(--ink); }
ol.steps li + li::before { content: none; }
/* "?" stays next to the page title, even when the title wraps */
.page-head h1 { min-width: 0; overflow-wrap: break-word; }
.title-end { white-space: nowrap; }
.title-end .help-q { vertical-align: 3px; }
/* "?" in the tenant profile right next to the name */
.profile-name { display: flex; align-items: center; gap: 2px; margin: 0 0 6px; }
.profile-name h1 { margin: 0; min-width: 0; }
/* Fehlerseite */
.error-page h1 { font: 600 20px/26px var(--font-sans); margin: 0 0 8px; }
.error-page .error-actions { margin-top: var(--space-4); }
/* Daily checklist – short label on the phone, earlier days summarised */
.lt-short { display: none; }
.log-checks-fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 10px 20px; background: var(--surface-sunken); border-bottom: 1px solid var(--line); font-size: 14px; color: var(--ink-muted); }
.log-checks-fold > summary::-webkit-details-marker { display: none; }
.log-checks-fold > summary::before { content: "▸"; font-size: 12px; }
.log-checks-fold[open] > summary::before { content: "▾"; }
.log-checks-fold[open] > summary { border-bottom: 0; }
.log-tick { position: relative; }
@media (max-width: 760px) {
  .lt-long { display: none; }
  .lt-short { display: inline; }
  .log-check-by { display: none; }
  .log-check-row { flex-wrap: wrap; gap: 6px 10px; }
  .log-check-estate { flex: 1 1 88px; min-width: 0; }
  .log-tick { padding: 0 9px; }
  .log-check-items { gap: 6px; }
  .log-checks-fold > summary { padding-left: 14px; padding-right: 14px; }
  /* Tap areas */
  .log-tick { height: 34px; }
  .log-tick::after { content: ""; position: absolute; inset: -4px -3px; }
  .back { padding: 10px 0; margin: -10px 0 calc(var(--space-2) - 10px); }
  .help-pop-head .btn { min-width: 40px; height: 40px; }
  .help-pop-foot a { display: inline-block; padding: 10px 0; margin: -10px 0; }
  .sortbar a { display: inline-block; padding: 9px 0; margin: -9px 0; }
}
/* Narrow phones (up to 340 px, with text size Large up to 380 px) – e.g. Android with a large system font ≈ 250 px */
@media (max-width: 340px) {
  .parcels-table tr { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "main main" "state paid"; row-gap: 8px; align-items: center; }
  .parcels-table td.col-state { text-align: left; }
  .parcels-table td.col-paid { white-space: normal; }
  .stack-narrow, .stack-narrow tbody { display: block; }
  .stack-narrow thead { display: none; }
  .stack-narrow tr { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 16px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  .stack-narrow tr:last-child { border-bottom: 0; }
  .stack-narrow td { display: block; padding: 0; border: 0; white-space: normal; text-align: left; }
  .stack-narrow td:first-child { flex: 1 0 100%; }
  .stack-narrow td[data-label] { flex: 1 1 0; min-width: 0; }
  .stack-narrow td.num[data-label], .stack-narrow td.stack-auto { flex: 0 0 auto; }
  .stack-narrow td.stack-full { flex: 1 0 100%; }
  .table.stack-narrow td.num { text-align: left; }
  .stack-narrow td.hide-phone { display: none; }
  .stack-narrow td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; font: 600 11px/14px var(--font-sans); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
  .stack-narrow tbody tr:hover td { background: none; }
  .regions-table td { padding-left: 0; padding-right: 0; }
  .stats { grid-template-columns: minmax(0, 1fr); }
  .stat { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label value" "foot foot"; align-items: center; column-gap: 12px; row-gap: 2px; }
  .stat > .label { grid-area: label; }
  .stat > .stat-value { grid-area: value; text-align: right; }
  .stat > .stat-foot { grid-area: foot; }
  .list-search { flex-wrap: wrap; }
  .list-search .input { flex: 1 0 100%; }
  .list-search .select { flex: 1 1 0; min-width: 0; max-width: none; }
  .qr { flex-wrap: wrap; justify-content: center; }
  .qr > div, .qr .secret { flex: 1 0 100%; text-align: center; }
}
@media (max-width: 380px) {
  :root[data-text="large"] .parcels-table tr { grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "main main" "state paid"; row-gap: 8px; align-items: center; }
  :root[data-text="large"] .parcels-table td.col-state { text-align: left; }
  :root[data-text="large"] .parcels-table td.col-paid { white-space: normal; }
  :root[data-text="large"] .stack-narrow, :root[data-text="large"] .stack-narrow tbody { display: block; }
  :root[data-text="large"] .stack-narrow thead { display: none; }
  :root[data-text="large"] .stack-narrow tr { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 8px 16px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
  :root[data-text="large"] .stack-narrow tr:last-child { border-bottom: 0; }
  :root[data-text="large"] .stack-narrow td { display: block; padding: 0; border: 0; white-space: normal; text-align: left; }
  :root[data-text="large"] .stack-narrow td:first-child { flex: 1 0 100%; }
  :root[data-text="large"] .stack-narrow td[data-label] { flex: 1 1 0; min-width: 0; }
  :root[data-text="large"] .stack-narrow td.num[data-label], :root[data-text="large"] .stack-narrow td.stack-auto { flex: 0 0 auto; }
  :root[data-text="large"] .stack-narrow td.stack-full { flex: 1 0 100%; }
  :root[data-text="large"] .table.stack-narrow td.num { text-align: left; }
  :root[data-text="large"] .stack-narrow td.hide-phone { display: none; }
  :root[data-text="large"] .stack-narrow td[data-label]::before { content: attr(data-label); display: block; margin-bottom: 2px; font: 600 11px/14px var(--font-sans); letter-spacing: .06em; text-transform: uppercase; color: var(--ink-muted); }
  :root[data-text="large"] .stack-narrow tbody tr:hover td { background: none; }
  :root[data-text="large"] .regions-table td { padding-left: 0; padding-right: 0; }
  :root[data-text="large"] .stats { grid-template-columns: minmax(0, 1fr); }
  :root[data-text="large"] .stat { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label value" "foot foot"; align-items: center; column-gap: 12px; row-gap: 2px; }
  :root[data-text="large"] .stat > .label { grid-area: label; }
  :root[data-text="large"] .stat > .stat-value { grid-area: value; text-align: right; }
  :root[data-text="large"] .stat > .stat-foot { grid-area: foot; }
  :root[data-text="large"] .list-search { flex-wrap: wrap; }
  :root[data-text="large"] .list-search .input { flex: 1 0 100%; }
  :root[data-text="large"] .list-search .select { flex: 1 1 0; min-width: 0; max-width: none; }
  :root[data-text="large"] .qr { flex-wrap: wrap; justify-content: center; }
  :root[data-text="large"] .qr > div, :root[data-text="large"] .qr .secret { flex: 1 0 100%; text-align: center; }
}

/* Tenant profile on narrow phones: name and circle a bit smaller, so long names with "?" fit */
@media (max-width: 340px) {
  .profile-title h1 { font-size: 20px; line-height: 26px; }
  .profile-head .avatar-lg { width: 44px; height: 44px; font-size: 16px; }
}
@media (max-width: 380px) {
  :root[data-text="large"] .profile-title h1 { font-size: 20px; line-height: 26px; }
  :root[data-text="large"] .profile-head .avatar-lg { width: 44px; height: 44px; font-size: 16px; }
}

/* Move / tier transfer */
.text-warn { color: var(--due); }
a.chip { text-decoration: none; }
.log-move { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 6px; }
@media (max-width: 760px) { .log-move { justify-content: flex-start; } }
.log-move .log-tick { text-decoration: none; height: auto; min-height: 30px; padding-top: 6px; padding-bottom: 6px; white-space: normal; overflow-wrap: anywhere; line-height: 1.25; max-width: 100%; }
.log-move-pick { max-width: 100%; }

/* ---------------------------------------------------------------------------
   Store categories
   --------------------------------------------------------------------------- */
.cat-filter { max-width: 220px; }
.chip-off { opacity: .65; }
.bulk-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 12px; }
.bulk-bar.is-open { display: block; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); }
.bulk-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; }
.bulk-form .bulk-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.bulk-form .bulk-row .select { min-width: 0; max-width: 100%; }
.bulk-form .bulk-row > .label { margin: 0; }
.bulk-form p { flex-basis: 100%; margin: 0; }
.bulk-form [data-pick-hint][hidden] { display: none; }
.pick { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; margin: -4px 4px -4px -6px; vertical-align: middle; cursor: pointer; }
.pick input { width: 18px; height: 18px; margin: 0; accent-color: var(--estate-accent); }
.cat-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.cat-checks { min-width: 0; }
.cat-checks .check-chip { height: auto; min-height: 36px; padding-top: 6px; padding-bottom: 6px; max-width: 100%; overflow-wrap: anywhere; }
.cat-list { list-style: none; margin: 0; padding: 0; }
.cat-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "name actions" "counts actions"; gap: 2px 12px; align-items: center; padding: 10px 16px; border-top: 1px solid var(--line); }
.cat-item .cat-name { grid-area: name; min-width: 0; }
.cat-item .cat-counts { grid-area: counts; font-size: 13px; color: var(--ink-muted); }
.cat-item .cat-counts a { color: inherit; }
.cat-item .cat-actions { grid-area: actions; display: flex; flex-wrap: nowrap; gap: 2px; justify-content: flex-end; }
.cat-item.is-hidden .cat-name, .cat-item.is-hidden .cat-counts { color: var(--ink-muted); }
.cat-rename { display: flex; gap: 6px; align-items: center; min-width: 0; }
.cat-rename .input { min-width: 0; flex: 1 1 auto; max-width: 280px; }
.cat-actions .text-bad { color: var(--overdue); }
@media (max-width: 760px) {
  .cat-filter { max-width: none; }
  .bulk-form { display: block; }
  .bulk-form .bulk-row { margin-bottom: 10px; }
  .bulk-form .bulk-row .select { flex: 1 1 100%; }
  .cat-item { grid-template-columns: minmax(0, 1fr); grid-template-areas: "name" "counts" "actions"; }
  .cat-item .cat-actions { justify-content: flex-start; flex-wrap: wrap; margin-left: -8px; }
  .cat-rename .input { max-width: none; }
}

/* Test estate bar (owner only; Stage 1) */
.test-estate-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 0 16px; padding: 10px 14px; border-radius: 10px; background: var(--warn-bg, #fff4d6); color: var(--text, inherit); }
.more-button { width: 100%; background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
