/* ============================================================
   MietFlow – additions on top of Baran's mockup stylesheet
   (base-from-mockup.css is kept verbatim; everything the real app
   needs beyond the mockup lives here)
   ============================================================ */

/* ---------- accessibility tweaks to the mockup palette ---------- */
:root { --muted: #5f6f75; }
.badge.b-gray { color: #55666b; }
.case-sub, .case-date, .task-meta, .stat-foot, .activity-time, .rent-table .subcell,
.doc-card small, .property-card p, .tenant-person small, .tenant-cell { font-size: 11px; }
.task-title, .activity-text, .rent-table td, .doc-card b, .tenant-person b { font-size: 12px; }
.badge { font-size: 10px; }
.rent-table th { font-size: 10px; color: #6b7a7e; }
a { color: inherit; }
:focus-visible { outline: 2px solid #147d68; outline-offset: 2px; }

/* links that look like the mockup's buttons */
a.btn-primary, a.btn-secondary, a.text-link { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; }
.nav a { color: #c6d8d3; width: 100%; padding: 11px 12px; border-radius: 10px; display: flex; align-items: center; gap: 12px; font-weight: 500; text-decoration: none; transition: .18s; }
.nav a:hover, .nav a.active { background: #28554e; color: #fff; }
.nav a.active { box-shadow: inset 3px 0 #a8ddbc; }
a.case, a.property-card, a.doc-card, a.tenant-row { text-decoration: none; color: inherit; }

.btn-danger { background: #fff; border: 1px solid #f0caca; color: #a23e3e; border-radius: 9px; padding: 9px 12px; font-size: 12px; font-weight: 600; }
.btn-danger:hover { background: #fdf3f3; }
.btn-primary, .btn-secondary { font-size: 13px; }
.btn-sm { padding: 6px 10px !important; font-size: 12px !important; }
.inline-form { display: inline; margin: 0; }

/* ---------- profile menu ---------- */
.profile { position: relative; }
.profile-menu { display: flex; gap: 6px; margin-left: auto; }
.profile-menu a, .profile-menu button { border: 0; background: transparent; color: #a9c0ba; font-size: 12px; padding: 4px 6px; border-radius: 6px; text-decoration: none; }
.profile-menu a:hover, .profile-menu button:hover { color: #fff; background: #28554e; }
.profile b, .profile span { max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- alerts / flash ---------- */
.alert { border-radius: 12px; padding: 12px 15px; font-size: 13px; margin-bottom: 16px; border: 1px solid; }
.alert-success { background: #e9f5ef; border-color: #cde6d9; color: #155f4f; }
.alert-error { background: #fdf1f1; border-color: #f2d0d0; color: #8f3333; }
.alert ul { margin: 6px 0 0 18px; padding: 0; }

/* ---------- forms ---------- */
.form-card { padding: 22px; max-width: 760px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field label { display: block; font-size: 12px; font-weight: 700; color: #3b5055; margin-bottom: 6px; }
.field .hint { font-size: 11px; color: var(--muted); margin-top: 5px; }
.field .req { color: #a23e3e; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid #d9e2e4; border-radius: 9px; background: #fff; color: var(--ink);
  padding: 10px 12px; font-size: 14px; outline: none; transition: border-color .15s, box-shadow .15s;
}
textarea.input { min-height: 96px; resize: vertical; }
.input:focus { border-color: #77b69c; box-shadow: 0 0 0 3px #147d681a; }
.input.is-invalid { border-color: #d98c8c; }
.field-error { color: #a23e3e; font-size: 12px; margin-top: 5px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #3b5055; }
.checkbox input { width: 16px; height: 16px; accent-color: #147d68; }

/* ---------- page header with actions ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .page-description { margin-bottom: 0; }
.page-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back-link { display: inline-flex; gap: 6px; color: var(--green); font-weight: 700; font-size: 12px; text-decoration: none; margin-bottom: 12px; }

/* ---------- generic list rows / detail ---------- */
.list-card { overflow: hidden; }
.row-actions { display: flex; gap: 6px; align-items: center; justify-content: flex-end; flex-wrap: wrap; }
.detail-grid-page { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.detail-grid-page .detail-box { background: #fff; border: 1px solid #e9eef0; border-radius: 12px; padding: 14px; }
.detail-box span { display: block; font-size: 10px; text-transform: uppercase; color: #6b7a7e; letter-spacing: .06em; }
.detail-box b { display: block; color: var(--ink); font-size: 14px; margin-top: 6px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); gap: 16px; align-items: start; }
.unit-row { display: grid; grid-template-columns: 1.2fr 1fr 1fr auto; gap: 12px; align-items: center; padding: 13px 16px; border-bottom: 1px solid #eff2f3; font-size: 12px; }
.unit-row:last-child { border-bottom: 0; }
.unit-row b { font-size: 13px; }
.muted { color: var(--muted); }
.empty-state { padding: 34px 20px; text-align: center; color: var(--muted); font-size: 13px; }
.empty-state .btn-primary { margin-top: 12px; }

/* tasks page: actions next to a task */
.task-actions { display: flex; gap: 4px; margin-left: 8px; }
.task-actions a, .task-actions button { border: 0; background: transparent; color: #7a8a8e; font-size: 12px; padding: 2px 5px; border-radius: 6px; text-decoration: none; }
.task-actions a:hover, .task-actions button:hover { background: #f1f5f5; color: var(--ink); }
.task form.check-form { margin: 0; }
.task button.check { padding: 0; background: #fff; cursor: pointer; }
.task.done button.check { background: var(--green); border-color: var(--green); }
.task-meta em.overdue { color: #a23e3e; }

/* rent toggle button */
.pay-toggle { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 10px; font-size: 12px; font-weight: 700; }
.pay-toggle.paid { color: var(--green); border-color: #cce4d8; background: #f2faf6; }
.pay-toggle.open { color: var(--amber); border-color: #f1dcb8; background: #fffaf0; }
.month-nav { display: flex; align-items: center; gap: 8px; }
.month-nav b { font-size: 14px; min-width: 130px; text-align: center; }

/* mietwechsel stages */
.stage-steps { display: flex; gap: 6px; flex-wrap: wrap; }
.stage-steps button { border: 1px solid var(--line); background: #fff; border-radius: 20px; padding: 6px 11px; font-size: 12px; font-weight: 600; color: #55666b; }
.stage-steps button.current { background: #e8f4f0; border-color: #cce4d8; color: var(--green); }

/* ---------- auth / landing ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 30px 16px; background: radial-gradient(1200px 500px at 10% -10%, #e3f1eb 0, transparent 60%), var(--canvas); }
.auth-card { width: min(440px, 100%); padding: 30px; }
.auth-brand { display: flex; align-items: center; gap: 11px; font: 800 22px Manrope, sans-serif; letter-spacing: -.06em; color: var(--nav); text-decoration: none; margin-bottom: 22px; }
.auth-brand .brandmark { background: var(--nav); color: #b7e0c6; }
.auth-card h1 { font-size: 22px; margin-bottom: 6px; }
.auth-card .lead { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .btn-primary { width: 100%; padding: 12px; font-size: 14px; justify-content: center; }
.auth-links { margin-top: 18px; font-size: 13px; color: var(--muted); text-align: center; }
.auth-links a { color: var(--green); font-weight: 700; text-decoration: none; }

.landing { min-height: 100vh; background: var(--canvas); }
.landing-nav { max-width: 1120px; margin: 0 auto; padding: 22px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.landing-nav .auth-brand { margin: 0; }
.landing-nav nav { display: flex; gap: 8px; align-items: center; }
.hero { max-width: 1120px; margin: 0 auto; padding: 40px 20px 30px; display: grid; grid-template-columns: 1.05fr .95fr; gap: 40px; align-items: center; }
.hero h1 { font-size: clamp(32px, 5vw, 50px); line-height: 1.05; letter-spacing: -.05em; }
.hero h1 span { color: var(--green); }
.hero p.lead { font-size: 17px; color: #4e6267; margin: 18px 0 24px; line-height: 1.55; max-width: 520px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-cta .btn-primary, .hero-cta .btn-secondary { padding: 13px 18px; font-size: 14px; }
.hero-shot { padding: 18px; }
.hero-shot .stats { grid-template-columns: 1fr 1fr; margin: 0; }
.features { max-width: 1120px; margin: 0 auto; padding: 30px 20px 60px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.feature { padding: 20px; }
.feature .stat-icon { margin-bottom: 12px; }
.feature h3 { font-size: 16px; margin-bottom: 6px; }
.feature p { font-size: 13px; color: var(--muted); line-height: 1.55; }
.landing-footer { border-top: 1px solid var(--line); padding: 22px 20px; text-align: center; font-size: 12px; color: var(--muted); }
.landing-footer a { color: var(--muted); margin: 0 8px; }
.legal { max-width: 760px; margin: 0 auto; padding: 20px 20px 60px; font-size: 14px; line-height: 1.65; color: #3b5055; }
.legal h1 { font-size: 28px; margin-bottom: 16px; }
.legal h2 { font-size: 17px; margin: 22px 0 8px; }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 16px; flex-wrap: wrap; }
.pagination a, .pagination span { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 6px 10px; font-size: 12px; text-decoration: none; color: #385057; }
.pagination .active span { background: var(--green); color: #fff; border-color: var(--green); }

.sidebar-backdrop { display: none; }

@media (max-width: 1050px) {
  .detail-grid-page { grid-template-columns: repeat(2, 1fr); }
  .two-col { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 1fr; }
  .features { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 700px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-card { padding: 16px; }
  .unit-row { grid-template-columns: 1fr auto; }
  .unit-row .hide-sm { display: none; }
  .features { grid-template-columns: 1fr; }
  .landing-nav .btn-secondary { display: none; }
  .page-head-actions { width: 100%; }
  .page-head-actions .btn-primary { flex: 1; justify-content: center; }
  .sidebar.open + .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(19,38,40,.3); z-index: 4; }
  .toolbar .btn-primary[style*="margin-left:auto"] { margin-left: 0 !important; }
  .month-nav b { min-width: 0; }
}

/* tasks are not clickable as a whole in the real app (only the checkbox) */
.task { cursor: default; }
.profile-menu a, .profile-menu button { font-size: 15px; padding: 6px 7px; color: #c6d8d3; }

/* ---------- contrast fixes (WCAG AA 4.5:1 for the small texts of the mockup) ---------- */
:root { --amber: #8a5410; }
.b-amber { color: #8a5410; }
.b-blue { color: #2f5f86; }
.filter { color: #55666b; }
.filter.active, .stage-steps button.current { color: #0f6e5b; }
.detail-box span, .rent-table th { color: #5b6a6e; }
.task-actions a, .task-actions button { color: #5b6a6e; }
.doc-icon { color: #3d6378; }

/* grid children must be allowed to shrink, otherwise wide tables push the page sideways on mobile */
.overview-grid > *, .lower-grid > *, .two-col > *, .property-grid > *, .document-grid > * { min-width: 0; }
.table-wrap { max-width: 100%; }
.table-wrap { position: relative; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.task.done .task-title { color: #6b787b; }
.activity-time { color: var(--muted); }
.doc-delete { border: 0; background: transparent; color: #5b6a6e; font-size: 14px; padding: 4px 6px; border-radius: 6px; }
.doc-delete:hover { background: #f1f5f5; color: #a23e3e; }

.show-sm { display: none; }
@media (max-width: 700px) {
  .show-sm { display: block; font-size: 12px; font-weight: 600; color: var(--ink); }
  /* rent list as cards on phones */
  .rent-table.stack thead { display: none; }
  .rent-table.stack, .rent-table.stack tbody { display: block; white-space: normal; }
  .rent-table.stack tr { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 14px; border-top: 1px solid #eff2f3; }
  .rent-table.stack tr:first-child { border-top: 0; }
  .rent-table.stack td { border: 0; padding: 0; font-size: 12px; }
  .rent-table.stack td[data-label="Mietpartei"] { font-size: 14px; }
  .rent-table.stack td[data-label="Wohnung"] { grid-column: 1; color: var(--muted); font-weight: 400; }
  .rent-table.stack td[data-label="Fällig am"] { display: none; }
  .rent-table.stack td.amount { grid-column: 2; grid-row: 1; text-align: right; font-size: 14px; }
  .rent-table.stack td[data-label="Status"] { grid-column: 1; }
  .rent-table.stack td.stack-action { grid-column: 2; grid-row: 2 / span 2; align-self: end; }
}
.checkbox input { margin: 0; flex: none; }

/* 2026-10-20: rents year view, date picker, export, property facts, logout */
.rent-tools{display:flex;gap:10px;align-items:center;flex-wrap:wrap;margin:0 0 14px}
.seg{display:inline-flex;background:#eef3f1;border-radius:10px;padding:3px}
.seg a{padding:7px 14px;border-radius:8px;font-size:13px;font-weight:700;color:#3b5055;text-decoration:none}
.seg a.seg-on{background:#fff;color:#183b38;box-shadow:0 1px 3px rgba(0,0,0,.08)}
.date-pick{display:flex;gap:6px;margin:0}
.date-pick .input{width:auto;min-width:150px;padding:8px 10px}
.export-btn{margin-left:auto}
.year-table{width:100%;min-width:900px}
.year-table th.ym,.year-table td.ym{text-align:center;padding-left:4px;padding-right:4px;width:44px}
.year-table th.ym a{color:inherit;text-decoration:none}
.year-table th.ym-now{color:#183b38;text-decoration:underline}
.year-table tfoot td{border-top:2px solid #dfe8e5}
.ym-paid{display:inline-grid;place-items:center;width:24px;height:24px;border-radius:50%;background:#d9efe2;color:#1e6a43;font-weight:800;font-size:12px}
.ym-open{display:inline-grid;place-items:center;width:24px;height:24px;border-radius:50%;background:#fff3d6;color:#8a5a00;font-size:12px}
.ym-late{display:inline-grid;place-items:center;width:24px;height:24px;border-radius:50%;background:#fde2e1;color:#a1261b;font-weight:800;font-size:12px}
.ym-none{color:#b9c6c2}
.facts{display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));gap:10px;margin:0}
.facts div{background:#f4f7f6;border-radius:10px;padding:10px 12px}
.facts dt{font-size:11px;color:#6b7f7a;font-weight:700;text-transform:uppercase;letter-spacing:.04em}
.facts dd{margin:3px 0 0;font-weight:700;color:#183b38}
.kind-hint{font-size:12px;color:#5d7470;margin-top:-6px}
.side-logout{margin:10px 0 0}
.side-logout button{width:100%;border:1px solid rgba(255,255,255,.18);background:transparent;color:#e3efe9;border-radius:10px;padding:9px 12px;font:700 13px 'DM Sans',sans-serif;cursor:pointer;text-align:left}
.side-logout button:hover{background:rgba(255,255,255,.08)}
.top-logout{border:1px solid #d6e2de;background:#fff;color:#183b38;border-radius:9px;padding:7px 12px;font:700 12px 'DM Sans',sans-serif;cursor:pointer;margin-left:10px}
.top-logout:hover{background:#eef3f1}
@media (max-width:700px){.export-btn{margin-left:0}.top-logout{padding:6px 9px}}
