/* The property app, in Pronto's look (app/public/app.css): white cards on a light green-grey, green for what one does,
   lime only for where one is. On a computer a column of sections on the left and room for tables; on a phone the sections
   at the foot, where the thumb is, and every form one column. Light and dark follow the system. */
:root {
  --bg: #EDF1EE; --card: #fff; --ink: #121614; --text: #2B3530; --label: #4B5751; --muted: #59655F;
  --line: #D8E0DA; --line-soft: #E6ECE8; --green: #0B6B4C; --green-deep: #08513A; --green-bg: #E3F1EA; --on-green: #fff;
  --lime: #D6F26A; --lime-bg: #F4F9E3; --warn: #8A5300; --warn-bg: #FFF1D6; --warn-line: #F0D49A;
  --danger: #A3281D; --danger-bg: #FDF1EF; --danger-line: #F1C6BE; --focus: rgba(11, 107, 76, 0.45);
  --shadow: 0 1px 2px rgba(18, 22, 20, 0.06), 0 2px 10px rgba(18, 22, 20, 0.04);
  --input: #fff; --hover: #F3F6F4; --paper: #fff;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1412; --card: #171E1B; --ink: #EEF3F0; --text: #D4DDD8; --label: #B3BFB8; --muted: #93A099;
    --line: #2C3833; --line-soft: #232D29; --green: #3DBE8B; --green-deep: #2FA577; --green-bg: #183A2C; --on-green: #06140E;
    --lime: #C5E35A; --lime-bg: #24301A; --warn: #F2C26B; --warn-bg: #3A2D12; --warn-line: #6B5420;
    --danger: #F08A7E; --danger-bg: #3A1D19; --danger-line: #6E3129; --focus: rgba(61, 190, 139, 0.55);
    --shadow: none; --input: #121816; --hover: #1D2622; --paper: #fff;
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
h1, h2, h3, p { margin: 0; }
a { color: var(--green); }
.loading { padding: 80px 16px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }

/* ---------- the frame ---------- */
.shell { min-height: 100vh; }
.side { display: none; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px; min-height: 52px; padding: max(6px, env(safe-area-inset-top)) 16px 6px; background: var(--bg); border-bottom: 1px solid var(--line-soft); }
.top .house { min-width: 0; flex: 1; font-size: 12px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; color: var(--green); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 50%; border: 0; background: var(--green-bg); color: var(--green); font-weight: 700; }
.main { padding: 16px 16px calc(96px + env(safe-area-inset-bottom)); max-width: 1180px; }
.tabs { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(5, 1fr); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); background: var(--card); border-top: 1px solid var(--line); }
.tabs a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; border-radius: 12px; color: var(--muted); font-size: 11.5px; font-weight: 600; text-decoration: none; min-width: 0; }
.tabs a svg { width: 24px; height: 24px; }
.tabs a.on { color: var(--green); }
.tabs a.on svg { background: var(--lime); border-radius: 10px; color: #13311F; padding: 2px; width: 34px; height: 26px; }
.tabs .badge, .nav .badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); font-size: 11px; line-height: 16px; text-align: center; }
.tabs a { position: relative; }
.tabs .badge { position: absolute; top: 0; left: calc(50% + 8px); }
.testbar { margin: 0 0 14px; padding: 9px 12px; border: 1px dashed var(--warn-line); border-radius: 12px; background: var(--warn-bg); color: var(--warn); font-size: 13px; }

@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: 240px 1fr; background: linear-gradient(90deg, var(--card) 0 239px, var(--line) 239px 240px, transparent 240px); }
  .field textarea { min-height: 330px; }
  .side { display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; padding: 20px 12px; border-right: 1px solid var(--line); background: var(--card); }
  .side .brand { padding: 4px 10px 18px; }
  .side .brand b { display: block; font-size: 12px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--green); }
  .side .brand span { display: block; margin-top: 4px; font-size: 14px; color: var(--muted); }
  .nav { display: flex; flex-direction: column; gap: 2px; }
  .nav a { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; color: var(--text); text-decoration: none; font-weight: 600; }
  .nav a svg { width: 20px; height: 20px; color: var(--muted); }
  .nav a:hover { background: var(--hover); }
  .nav a.on { background: var(--lime-bg); color: var(--ink); box-shadow: inset 3px 0 0 var(--green); }
  .nav a.on svg { color: var(--green); }
  .nav .badge { margin-left: auto; }
  .side .who { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 10px; border: 0; border-radius: 12px; background: none; text-align: left; }
  .side .who:hover { background: var(--hover); }
  .side .who small { display: block; color: var(--muted); }
  .top, .tabs { display: none; }
  .main { padding: 28px 36px 60px; }
}

/* ---------- headings and cards ---------- */
.head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 16px; margin: 0 0 16px; }
.head h1 { font-size: 26px; line-height: 1.15; letter-spacing: -0.02em; }
.head p { margin-top: 4px; color: var(--muted); }
.head .acts { display: flex; flex-wrap: wrap; gap: 8px; }
.card { background: var(--card); border: 1px solid var(--line-soft); border-radius: 16px; box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h2 { font-size: 17px; margin-bottom: 10px; }
.card h3 { font-size: 15px; margin: 14px 0 8px; }
.card > p + p { margin-top: 8px; }
.grid2 { display: grid; gap: 14px; }
.grid3 { display: grid; gap: 8px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (min-width: 720px) { .grid2 { grid-template-columns: 1fr 1fr; } .grid3 { gap: 10px; } }
.stat { padding: 12px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line-soft); }
.stat b { display: block; font-size: clamp(15px, 4.3vw, 20px); font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat span { display: block; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 520px) { .stat { padding: 9px 10px; } .stat span { font-size: 12px; } }
.grid3 + .note, .grid3 + p { margin-top: 12px; }
@media (max-width: 520px) { .grid3.two-on-phone { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat span { color: var(--muted); font-size: 13px; }
.stat.open b { color: var(--warn); }
.stat.ok b { color: var(--green); }
.bar { height: 8px; border-radius: 4px; background: var(--line-soft); overflow: hidden; margin: 10px 0 6px; }
.bar i { display: block; height: 100%; background: var(--green); border-radius: 4px; }
.note { padding: 10px 12px; border-radius: 12px; background: var(--lime-bg); color: var(--text); font-size: 14px; }
.note.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid var(--warn-line); }
.empty { padding: 26px 12px; text-align: center; color: var(--muted); }

/* ---------- buttons and forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 9px 16px; border-radius: 12px; border: 1px solid transparent; background: var(--green); color: var(--on-green); font-weight: 700; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--green-deep); }
.btn.ghost { background: transparent; color: var(--green); border-color: var(--line); }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger-line); }
.btn.small { min-height: 34px; padding: 6px 12px; font-size: 14px; border-radius: 10px; }
.btn svg { width: 18px; height: 18px; }
.btn[disabled] { opacity: 0.55; cursor: default; }
.link { padding: 0; border: 0; background: none; color: var(--green); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.form { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.row2 { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.row3 { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 520px) { .row3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
.field { display: grid; gap: 4px; min-width: 0; grid-template-columns: minmax(0, 1fr); }
.field select { text-overflow: ellipsis; max-width: 100%; overflow: hidden; }
.field > span { font-size: 13px; font-weight: 600; color: var(--label); }
.field input, .field select, .field textarea { width: 100%; min-height: 44px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--input); }
.field textarea { min-height: 220px; line-height: 1.5; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px var(--focus); }
.field.check input, .field.check select { border-color: var(--warn-line); background: var(--warn-bg); }
.field.check > span::after { content: " · Bitte prüfen"; color: var(--warn); font-weight: 700; }
html[lang="en"] .field.check > span::after { content: " · Please check"; }
.field.bad input, .field.bad select { border-color: var(--danger); }
.field small { color: var(--muted); font-size: 12.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 38px; padding: 7px 13px; border-radius: 19px; border: 1px solid var(--line); background: var(--card); color: var(--text); font-weight: 600; font-size: 14px; }
.chip.on { background: var(--green); border-color: var(--green); color: var(--on-green); }
.chip.add { border-style: dashed; color: var(--green); }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.check-row input { width: 20px; height: 20px; accent-color: var(--green); }
.copy { display: flex; gap: 8px; align-items: center; min-width: 0; }
.copy code { flex: 1; min-width: 0; padding: 9px 11px; border-radius: 10px; background: var(--line-soft); font: 13.5px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; color: var(--text); }

/* ---------- lists and tables ---------- */
.list { display: grid; }
.item { display: flex; align-items: center; gap: 12px; padding: 12px 4px; border-bottom: 1px solid var(--line-soft); color: inherit; text-decoration: none; min-width: 0; }
.item:last-child { border-bottom: 0; }
a.item:hover { background: var(--hover); }
.item .main-t { flex: 1; min-width: 0; }
.item .main-t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .main-t span { display: block; color: var(--muted); font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 8px; background: var(--line-soft); color: var(--label); font-size: 12px; font-weight: 700; white-space: nowrap; }
.tag.new { background: var(--warn-bg); color: var(--warn); }
.tag.ok { background: var(--green-bg); color: var(--green); }
.tag.nk { background: var(--lime-bg); color: var(--text); }
.ico { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--green-bg); color: var(--green); }
.ico svg { width: 22px; height: 22px; }
.ico.warn { background: var(--warn-bg); color: var(--warn); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -16px; padding: 0 16px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 12.5px; color: var(--muted); font-weight: 700; padding: 8px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--hover); }
tfoot td { font-weight: 700; border-bottom: 0; }
td input.cell { width: 110px; min-height: 36px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--input); text-align: right; }

/* ---------- rents ---------- */
.month-nav { display: flex; align-items: center; gap: 6px; }
.month-nav b { min-width: 150px; text-align: center; font-size: 17px; }
.icon-btn { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); }
.icon-btn svg { width: 20px; height: 20px; }
.rent { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px 10px; padding: 11px 2px; border-bottom: 1px solid var(--line-soft); }
.rent:last-child { border-bottom: 0; }
.rent .who b { display: block; }
.rent .who span { display: block; color: var(--muted); font-size: 13px; }
.tick { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 92px; padding: 6px 6px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--card); color: var(--muted); font-size: 12px; font-weight: 700; }
.tick .box { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--line); background: var(--input); }
.tick .box svg { width: 16px; height: 16px; opacity: 0; }
.tick .val { font-size: 13px; color: var(--text); font-variant-numeric: tabular-nums; }
.tick.paid { border-color: var(--green); background: var(--green-bg); color: var(--green); }
.tick.paid .box { background: var(--green); border-color: var(--green); color: var(--on-green); }
.tick.paid .box svg { opacity: 1; }
.tick.none { visibility: hidden; }
.tick:disabled { opacity: 0.6; }
.rent-head { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; padding: 0 2px 6px; color: var(--muted); font-size: 12.5px; font-weight: 700; }
.rent-head span { min-width: 92px; text-align: center; }
.year { border-collapse: separate; border-spacing: 0; }
.year td, .year th { padding: 6px 4px; text-align: center; }
.year td:first-child, .year th:first-child { text-align: left; position: sticky; left: 0; background: var(--card); min-width: 150px; }
.dots { display: inline-flex; gap: 3px; }
.dots i { width: 12px; height: 12px; border-radius: 3px; background: var(--line-soft); }
.dots i.p { background: var(--green); }
.dots i.o { background: var(--warn-bg); border: 1.5px solid var(--warn); }
.year a { text-decoration: none; }

/* ---------- invoices ---------- */
.inv-layout { display: grid; gap: 16px; }
.inv-layout > *, .letter-layout > *, .grid2 > *, .row2 > *, .row3 > * { min-width: 0; }
.danger-link { color: var(--danger); font-size: 14px; }
@media (min-width: 1100px) { .inv-layout { grid-template-columns: minmax(0, 1.05fr) minmax(380px, 0.95fr); align-items: start; } .inv-doc { position: sticky; top: 20px; } }
.inv-doc { background: var(--line-soft); border-radius: 16px; padding: 10px; min-height: 200px; max-height: calc(100vh - 60px); overflow: auto; }
.inv-doc canvas, .inv-doc img { display: block; width: 100%; height: auto; background: var(--paper); border-radius: 6px; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.12); }
.inv-doc canvas + canvas { margin-top: 10px; }
@media (max-width: 1099px) { .inv-doc { max-height: 46vh; } .inv-doc.open { max-height: none; } }
.doc-acts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.read-note { margin-bottom: 12px; }
.sticky-acts { position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); z-index: 5; display: flex; gap: 8px; padding: 12px 0 2px; background: linear-gradient(transparent, var(--card) 30%); }
.sticky-acts .btn { flex: 1 1 0; min-width: 0; }
@media (min-width: 960px) { .sticky-acts { bottom: 0; } }
.drop { display: grid; place-items: center; gap: 6px; padding: 22px; border: 2px dashed var(--line); border-radius: 16px; text-align: center; color: var(--muted); background: var(--card); }
.drop.over { border-color: var(--green); background: var(--green-bg); }
.ways { display: grid; gap: 12px; }
@media (min-width: 900px) { .ways { grid-template-columns: repeat(3, 1fr); } }
.way { padding: 14px; border-radius: 14px; border: 1px solid var(--line-soft); background: var(--card); }
.way h3 { margin: 0 0 6px; font-size: 15px; }
.way ol { margin: 8px 0 0; padding-left: 20px; color: var(--text); font-size: 14px; }
.way ol li + li { margin-top: 3px; }
.seg { display: inline-flex; padding: 3px; border-radius: 12px; background: var(--line-soft); gap: 2px; }
.seg button { min-height: 36px; padding: 6px 14px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-weight: 700; }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: var(--shadow); }

/* ---------- letters ---------- */
.letter-layout { display: grid; gap: 16px; }
@media (min-width: 1100px) { .letter-layout { grid-template-columns: 260px minmax(0, 1fr); align-items: start; } }
.tpl { display: block; width: 100%; padding: 11px 12px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--card); text-align: left; font-weight: 600; color: var(--text); }
.tpl + .tpl { margin-top: 8px; }
.tpl.on { border-color: var(--green); box-shadow: inset 3px 0 0 var(--green); background: var(--lime-bg); color: var(--ink); }
.ph { min-height: 30px; padding: 4px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--line-soft); font-size: 12.5px; font-weight: 600; color: var(--text); }
.recip { max-height: 340px; overflow: auto; border: 1px solid var(--line-soft); border-radius: 12px; padding: 4px 10px; }
.recip label { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
.recip label:last-child { border-bottom: 0; }
.recip input { width: 18px; height: 18px; accent-color: var(--green); flex: none; }
.recip span { min-width: 0; }
.recip small { display: block; color: var(--muted); }

/* ---------- dialogs ---------- */
.veil { position: fixed; inset: 0; z-index: 60; display: grid; align-items: end; justify-items: center; background: rgba(10, 14, 12, 0.45); }
.sheet { width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; background: var(--card); }
.sheet h2 { font-size: 19px; margin-bottom: 10px; }
.sheet .acts { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-top: 16px; }
@media (min-width: 720px) { .veil { align-items: center; } .sheet { border-radius: 20px; padding: 22px; } }
.sheet.wide { max-width: 980px; }
.pdf-view canvas { display: block; width: 100%; height: auto; background: var(--paper); box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15); }
.pdf-view canvas + canvas { margin-top: 12px; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(86px + env(safe-area-inset-bottom)); transform: translateX(-50%); max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 12px; background: var(--ink); color: var(--bg); font-weight: 600; font-size: 14px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.25); }
@media (min-width: 960px) { .toast { bottom: 28px; } }

/* ---------- the way in ---------- */
.login { max-width: 420px; margin: 0 auto; padding: max(48px, env(safe-area-inset-top)) 20px 40px; }
.login .logo { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--green); color: var(--on-green); margin-bottom: 18px; }
.login .logo svg { width: 30px; height: 30px; }
.login h1 { font-size: 26px; margin-bottom: 6px; }
.login p.lead { color: var(--muted); margin-bottom: 20px; }
.lang { display: flex; justify-content: flex-end; gap: 6px; margin-bottom: 8px; }
