/* RM CRM - wygląd. Kolory z logo Rent Management (#237763 → #48cfae → #9cf9e2) i czarny tekst logo.
   Jasny motyw, białe tło. Font Mona Sans (nigdy Inter). Mobile-first. */
:root {
  --ink: #0f1412;
  --ink-2: #47524e;
  --ink-3: #7a8582;
  --line: #e3e9e7;
  --line-2: #eef2f1;
  --bg: #ffffff;
  --bg-2: #f5f8f7;
  --brand-900: #0f3a30;
  --brand-700: #1b5f4f;
  --brand: #237763;
  --brand-500: #2f9a7f;
  --brand-400: #48cfae;
  --brand-200: #9cf9e2;
  --brand-100: #dcf6ee;
  --brand-50: #f0fbf7;
  --brand-grad: linear-gradient(90deg, #237763 0%, #48cfae 55%, #9cf9e2 100%);
  --warn: #8a5a00;
  --warn-soft: #fff4dc;
  --danger: #a3261d;
  --danger-soft: #fdecea;
  --ring: 0 0 0 3px rgba(72, 207, 174, .35);
  --shadow-sm: 0 1px 2px rgba(15, 58, 48, .05);
  --shadow: 0 6px 24px rgba(15, 58, 48, .10);
  --font: 'Mona Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; font-weight: 700; letter-spacing: -.015em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.05rem; }
h3 { font-size: .98rem; }
p { margin: 0 0 .75em; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-700); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--ink-3); font-size: .9em; }
.sub { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

/* ===== Nagłówek ===== */
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(255,255,255,.96); backdrop-filter: saturate(1.4) blur(6px);
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; padding: 10px 16px; }
.topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--brand-grad); opacity: .9; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); }
.brand-logo { height: 26px; width: auto; display: block; }
.brand-tag { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 6px; background: var(--brand-100); color: var(--brand-700); font-size: 11px; font-weight: 800; letter-spacing: .1em; }
.topnav { order: 3; width: 100%; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; margin: 0 -6px; }
.topnav a { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 9px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.topnav a:hover { background: var(--bg-2); color: var(--ink); }
.topnav a.on { background: var(--brand-100); color: var(--brand-900); }
.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--brand); color: #fff; font-size: 11.5px; font-weight: 700; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.usermenu { position: relative; }
.usermenu summary { list-style: none; cursor: pointer; padding: 8px 8px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--ink-2); max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.usermenu summary::-webkit-details-marker { display: none; }
.usermenu summary:hover { background: var(--bg-2); }
.usermenu-pop { position: absolute; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; min-width: 180px; display: grid; }
.usermenu-pop a, .usermenu-pop button { display: block; text-align: left; padding: 9px 12px; border-radius: 8px; background: none; border: 0; cursor: pointer; text-decoration: none; color: var(--ink); font-size: 14px; width: 100%; }
.usermenu-pop a:hover, .usermenu-pop button:hover { background: var(--brand-50); }
@media (max-width: 899px) {
  .brand-logo { height: 24px; }
  .usermenu summary { max-width: 92px; padding: 8px 6px; }
}
@media (max-width: 479px) { .topbar .brand-tag { display: none; } }
@media (min-width: 900px) {
  .topbar { padding: 10px 24px; flex-wrap: nowrap; }
  .topnav { order: 0; width: auto; margin: 0; }
  .brand-logo { height: 30px; }
}

/* ===== Układ ===== */
.wrap { max-width: 1280px; margin: 0 auto; padding: 22px 16px 56px; }
@media (min-width: 768px) { .wrap { padding: 30px 24px 72px; } }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px 16px; margin-bottom: 20px; }
.page-head h1 { margin: 0; }
.page-intro { color: var(--ink-2); max-width: 720px; margin: 6px 0 0; font-size: 14.5px; }
.stack { display: grid; gap: 16px; align-content: start; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row .fld { min-width: 0; }
.row > .btn, .row > form > .btn { align-self: end; }
.grid-2 { display: grid; gap: 14px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } }
.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 16px; box-shadow: var(--shadow-sm); }
@media (min-width: 768px) { .card { padding: 20px; } }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.section-title h2 { margin: 0; }
.more { font-size: 13.5px; font-weight: 600; text-decoration: none; }
.empty { text-align: center; color: var(--ink-3); padding: 32px 16px; border: 1px dashed var(--line); border-radius: 12px; background: var(--bg-2); }
.empty-ok { border-style: solid; border-color: var(--brand-100); background: var(--brand-50); color: var(--brand-700); }
.empty-ok b { color: var(--brand-900); }

/* ===== Przyciski ===== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 9px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; color: var(--ink); font-weight: 600; font-size: 14px; text-decoration: none; cursor: pointer;
  transition: background .12s, border-color .12s, box-shadow .12s, color .12s; box-shadow: var(--shadow-sm); }
.btn:hover { background: var(--bg-2); border-color: #cfd8d5; color: var(--ink); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: 0 1px 2px rgba(15,58,48,.2), inset 0 1px 0 rgba(255,255,255,.12); }
.btn-primary:hover { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.btn-danger { color: var(--danger); border-color: #f0c9c5; }
.btn-danger:hover { background: var(--danger-soft); color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--bg-2); border-color: transparent; }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: 13.5px; border-radius: 9px; }
.btn-block { width: 100%; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--brand); cursor: pointer; text-decoration: underline; font-size: inherit; }

/* ===== Formularze ===== */
.fld { display: grid; gap: 6px; font-size: 13.5px; align-content: start; }
.fld > span, .fld > label { font-weight: 600; color: var(--ink-2); }
.fld input[type=text], .fld input[type=email], .fld input[type=tel], .fld input[type=password], .fld input[type=date], .fld input[type=search],
.fld textarea, .input {
  width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #d3dcd9; border-radius: 10px; background: #fff; font-size: 16px;
  transition: border-color .12s, box-shadow .12s; }
.fld textarea { min-height: 88px; resize: vertical; }
.fld input:hover, .fld textarea:hover, .input:hover { border-color: #b8c4c0; }
.fld input:focus, .fld textarea:focus, .input:focus { outline: none; border-color: var(--brand-400); box-shadow: var(--ring); }
.fld .err { color: var(--danger); font-size: 13px; font-weight: 600; }
.fld.has-err input, .fld.has-err .cs-btn { border-color: var(--danger); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14.5px; cursor: pointer; min-height: 44px; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); flex: 0 0 auto; }
.hint { color: var(--ink-3); font-size: 12.5px; font-weight: 400; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.honey { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

/* ===== Select: natywny (telefon) i własny dropdown (desktop, select.js) ===== */
select {
  -webkit-appearance: none; appearance: none; width: 100%;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2347524e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E") no-repeat right 12px center / 14px 14px;
  border: 1px solid #d3dcd9; border-radius: 10px; padding: 8px 38px 8px 12px; min-height: 44px; font-size: 16px; color: var(--ink); cursor: pointer; }
select:focus { outline: none; border-color: var(--brand-400); box-shadow: var(--ring); }
.cs { position: relative; display: inline-block; width: 100%; min-width: 0; max-width: 100%; vertical-align: middle; }
/* pełna szerokość najdłuższej opcji tylko tam, gdzie pole nie ma narzuconej szerokości (wiersze uprawnień, filtry tablicy) */
.tbl-stack .row .cs-btn, .board-filters .cs-btn { min-width: var(--cs-min, 0px); }
@media (max-width: 479px) { .board-filters .cs-btn { min-width: 0; } .board-filters .cs { width: 100%; } }
.fld .cs, .filters .cs { display: block; }
.cs-native { position: absolute !important; left: 0; bottom: 0; width: 1px !important; height: 1px !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; opacity: 0; pointer-events: none; }
.cs-btn { position: relative; width: 100%; min-width: 0; display: flex; align-items: center; min-height: 44px; padding: 9px 38px 9px 12px;
  border: 1px solid #d3dcd9; border-radius: 10px; background: #fff; color: var(--ink); font-size: 15px; text-align: left; cursor: pointer;
  transition: border-color .12s, box-shadow .12s, background .12s; box-shadow: var(--shadow-sm); }
.cs-btn::after { content: ''; position: absolute; right: 12px; top: 50%; width: 14px; height: 14px; margin-top: -7px; transition: transform .15s;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%2347524e' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E") no-repeat center / 14px; }
.cs-btn:hover { border-color: #b8c4c0; }
.cs-btn:focus-visible, .cs.open .cs-btn { outline: none; border-color: var(--brand-400); box-shadow: var(--ring); border-radius: 10px; }
.cs.open .cs-btn::after { transform: rotate(180deg); }
.cs-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs.is-empty .cs-val { color: var(--ink-2); }
.cs-list { position: fixed; z-index: 1000; margin: 0; padding: 6px; list-style: none; max-height: 280px; overflow-y: auto; max-width: min(92vw, 420px);
  background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(15, 58, 48, .16), 0 2px 6px rgba(15, 58, 48, .06);
  animation: cs-in .12s ease-out; }
@keyframes cs-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.cs-list li { position: relative; padding: 9px 34px 9px 12px; border-radius: 8px; font-size: 14.5px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cs-list li.active { background: var(--brand-50); }
.cs-list li[aria-selected=true] { font-weight: 700; color: var(--brand-900); }
.cs-list li[aria-selected=true]::after { content: ''; position: absolute; right: 12px; top: 50%; width: 14px; height: 14px; margin-top: -7px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%23237763' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3.5 8.5l3 3 6-7'/%3E%3C/svg%3E") no-repeat center / 14px; }
.cs-list li.cs-empty { color: var(--ink-3); }
.cs-list li[aria-disabled=true] { opacity: .45; cursor: default; }
.board-filters .cs-btn { min-height: 40px; font-size: 14.5px; }
.lcard .cs-btn { min-height: 38px; font-size: 14px; }

/* ===== Komunikaty ===== */
.flash { background: var(--brand-50); color: var(--brand-900); border: 1px solid var(--brand-100); border-left: 4px solid var(--brand-400); border-radius: 10px; padding: 11px 14px; margin-bottom: 16px; font-weight: 600; font-size: 14px; }
.err-box { background: var(--danger-soft); color: var(--danger); border: 1px solid #f0c9c5; border-radius: 10px; padding: 11px 14px; margin-bottom: 14px; font-size: 14px; font-weight: 600; }
.warn-box { background: var(--warn-soft); color: var(--warn); border: 1px solid #f2dca8; border-radius: 10px; padding: 11px 14px; font-size: 14px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 60; max-width: min(92vw, 520px);
  background: var(--brand-900); color: #fff; padding: 12px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); }

/* ===== Pille i awatary ===== */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; min-height: 24px; border-radius: 999px; font-size: 12.5px; font-weight: 600; background: var(--bg-2); color: var(--ink-2); white-space: nowrap; text-decoration: none; border: 1px solid transparent; }
.pill-accent { background: var(--brand-100); color: var(--brand-900); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-danger { background: var(--danger-soft); color: var(--danger); }
.pill-ghost { background: #fff; border-color: var(--line); color: var(--ink-2); }
.pill-link:hover { border-color: var(--brand-400); color: var(--brand-700); }
.pill-person { background: #fff; border-color: var(--line); color: var(--ink); padding-left: 3px; }
.pill-person .av { width: 18px; height: 18px; font-size: 8.5px; }
.muted-in { color: var(--ink-3); font-weight: 500; }
.stage-prospect { background: #eef2f1; color: #34433e; }
.stage-zakwalifikowany { background: var(--brand-100); color: var(--brand-900); }
.stage-oferta { background: #e1f3fa; color: #155a6e; }
.stage-umowa { background: var(--brand); color: #fff; }
.stage-utracony { background: #f1f1f1; color: #6f6f6f; }
.av, .initials { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: linear-gradient(135deg, var(--brand) 0%, var(--brand-500) 100%); color: #fff; font-size: 10px; font-weight: 700; letter-spacing: -.02em; flex: 0 0 auto; }
.initials { width: 24px; height: 24px; font-size: 9.5px; }
.av-empty { background: #eef2f1; color: var(--ink-3); }

/* ===== Logowanie ===== */
.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: radial-gradient(1200px 500px at 10% -10%, #e2f8f1 0%, transparent 60%), radial-gradient(900px 500px at 110% 110%, #eefcf7 0%, transparent 60%), #fff; }
.auth-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 30px 24px; box-shadow: var(--shadow); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.auth-brand img { height: 44px; width: auto; display: block; }
.auth-card h1 { margin-top: 8px; }
.auth-card > .muted { margin-bottom: 20px; }

/* ===== Tabele i lista ===== */
.filters { display: grid; gap: 10px; margin-bottom: 18px; padding: 14px; background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; }
@media (min-width: 640px) { .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; } .filters .fld-search { grid-column: 1 / -1; } }
@media (min-width: 1100px) { .filters { grid-template-columns: minmax(220px, 2fr) repeat(3, minmax(150px, 1fr)) auto; } .filters .fld-search { grid-column: auto; } }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: var(--shadow-sm); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th, .tbl td { text-align: left; padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl th { font-size: 12px; color: var(--ink-3); font-weight: 600; background: var(--bg-2); white-space: nowrap; text-transform: uppercase; letter-spacing: .04em; }
.tbl th a { color: inherit; text-decoration: none; }
.tbl th a.on { color: var(--brand-700); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td a.name { font-weight: 700; color: var(--ink); text-decoration: none; }
.rowlink { position: relative; }
.rowlink:hover td { background: var(--brand-50); }
.rowlink a.name::after { content: ''; position: absolute; inset: 0; }
.cell-stage { display: flex; align-items: center; gap: 6px; }
.who { display: inline-flex; align-items: center; gap: 8px; }
.cards-mobile { display: grid; gap: 10px; }
.lead-row { display: grid; gap: 6px; border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; text-decoration: none; color: var(--ink); background: #fff; box-shadow: var(--shadow-sm); }
.lead-row:hover { border-color: var(--brand-400); color: var(--ink); }
.lr-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.lead-row .meta { color: var(--ink-3); font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; }
@media (max-width: 767px) { .only-desktop { display: none !important; } }
@media (min-width: 768px) { .only-mobile { display: none !important; } }
.tbl-stack .row .fld { flex: 0 1 auto; }
@media (max-width: 767px) {
  .tbl-stack thead { display: none; }
  .tbl-stack tr { display: block; border-bottom: 1px solid var(--line); padding: 6px 0; }
  .tbl-stack tr:last-child { border-bottom: 0; }
  .tbl-stack td { display: block; border: 0; padding: 6px 14px; }
  .tbl-stack .row .fld { flex: 1 1 130px; }
}

/* ===== Karta leada ===== */
.lead-head { display: grid; gap: 8px; margin-bottom: 18px; }
.lead-head h1 { margin: 0; font-size: 1.7rem; }
.lead-head .row { gap: 8px; }
.lead-grid { display: grid; gap: 16px; }
@media (min-width: 1000px) { .lead-grid { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; } }
@media (max-width: 999px) { .lead-grid > :nth-child(2) { order: -1; } }
.dl { display: grid; grid-template-columns: max-content 1fr; gap: 7px 18px; font-size: 14.5px; margin: 0; }
.dl dt { color: var(--ink-3); }
.dl dd { margin: 0; word-break: break-word; }
.missing { border: 1px solid #f2dca8; border-left: 4px solid #e3a008; background: var(--warn-soft); padding: 12px 14px; border-radius: 12px; }
.missing ul { margin: 6px 0 0; padding-left: 18px; }
.missing.ok { border-color: var(--brand-100); border-left-color: var(--brand-400); background: var(--brand-50); color: var(--brand-900); }
.prop { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.prop + .prop { margin-top: 10px; }
.prop h3 { margin-bottom: 6px; }
details.edit > summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 14px; list-style: none; display: inline-flex; min-height: 36px; align-items: center; }
details.edit > summary::-webkit-details-marker { display: none; }
details.edit[open] > summary { margin-bottom: 10px; }
.copybox { display: flex; gap: 8px; }
.copybox input { flex: 1; min-width: 0; font-size: 13px; color: var(--ink-2); }
.card-tasks { border-color: var(--brand-100); background: linear-gradient(180deg, var(--brand-50) 0%, #fff 70%); }

/* ===== Oś czasu ===== */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 20px; border-left: 2px solid var(--line-2); margin-left: 5px; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #cfd8d5; border: 2px solid #fff; }
.timeline li.t-note::before { background: var(--brand); }
.timeline li.t-stage::before { background: var(--brand-400); }
.timeline li.t-client_form::before { background: #2c7fb8; }
.timeline li.t-duplicate::before { background: #e3a008; }
.timeline .when { font-size: 12.5px; color: var(--ink-3); }
.timeline .what { font-size: 14.5px; white-space: pre-wrap; word-break: break-word; }

/* ===== Zadania ===== */
.tgroup { margin-bottom: 22px; }
.tgroup h2 { display: flex; align-items: center; gap: 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); margin: 0 0 10px; }
.tgroup h2 .count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--bg-2); color: var(--ink-2); font-size: 12px; letter-spacing: 0; }
.tgroup-late h2 { color: var(--warn); }
.tgroup-late h2 .count { background: var(--warn-soft); color: var(--warn); }
.tgroup-done summary { list-style: none; cursor: pointer; }
.tgroup-done summary::-webkit-details-marker { display: none; }
.tgroup-done summary h2::after { content: '›'; font-size: 18px; transition: transform .15s; }
.tgroup-done[open] summary h2::after { transform: rotate(90deg); }
.trow { position: relative; display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s; }
.trow + .trow { margin-top: 8px; }
.trow:hover { border-color: var(--brand-400); box-shadow: 0 2px 10px rgba(15, 58, 48, .08); }
.tgroup-late .trow { border-left: 4px solid #e3a008; }
.trow.is-done { opacity: .7; box-shadow: none; }
.trow.is-done .t-title b { text-decoration: line-through; text-decoration-color: var(--ink-3); }
.t-body { flex: 1; min-width: 0; display: grid; gap: 6px; }
.t-title { font-size: 15px; line-height: 1.35; }
.t-sep { color: var(--ink-3); }
.t-link { color: var(--ink); font-weight: 600; text-decoration: none; }
.t-link::after { content: ''; position: absolute; inset: 0; border-radius: 14px; }
.trow:hover .t-link { color: var(--brand-700); }
.t-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.t-meta a, .t-done { position: relative; z-index: 1; }
.t-ic { flex: 0 0 auto; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--brand-100); color: var(--brand-700); }
.t-ic svg { width: 19px; height: 19px; }
.t-ic-offer { background: #fff2d9; color: #8a5a00; }
.t-ic-contract { background: #ece7ff; color: #4c37a3; }
.t-ic-assign_owner { background: #ffe9e6; color: #a3261d; }
.t-ic-new_property { background: #e1f3fa; color: #155a6e; }
.t-ic-client_reply { background: #e2f0ff; color: #1f57a8; }
@media (max-width: 559px) {
  .trow { flex-wrap: wrap; align-items: flex-start; }
  .t-done { width: 100%; }
  .t-done .btn { width: 100%; }
}

/* ===== Start ===== */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 18px; }
@media (min-width: 900px) { .tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.tile { position: relative; display: grid; gap: 2px; padding: 14px 16px 16px; background: #fff; border: 1px solid var(--line); border-radius: 14px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow-sm); overflow: hidden; }
.tile::before { content: ''; position: absolute; left: 0; top: 0; right: 0; height: 3px; background: var(--brand-grad); }
a.tile:hover { border-color: var(--brand-400); color: var(--ink); }
.tile-label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.tile-value { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.tile-sub { font-size: 12px; color: var(--ink-3); }
.dash-grid { display: grid; gap: 16px; }
@media (min-width: 1000px) { .dash-grid { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); align-items: start; } }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr 34px; align-items: center; gap: 10px; padding: 6px 6px; border-radius: 8px; text-decoration: none; color: var(--ink); }
a.bar-row:hover { background: var(--brand-50); color: var(--ink); }
.bar-label { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { position: relative; height: 12px; background: var(--line-2); border-radius: 0 4px 4px 0; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--brand); border-radius: 0 4px 4px 0; transition: width .3s; }
.bar-row:hover .bar-fill { background: var(--brand-700); }
.bar-val { font-size: 13.5px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.bar-tip { position: absolute; right: 0; bottom: calc(100% + 8px); z-index: 5; padding: 6px 10px; border-radius: 8px; background: var(--brand-900); color: #fff; font-size: 12.5px; white-space: nowrap; opacity: 0; pointer-events: none; transform: translateY(2px); transition: opacity .12s, transform .12s; }
.bar-row:hover .bar-tip, .bar-row:focus-visible .bar-tip { opacity: 1; transform: none; }
.alist, .feed { list-style: none; margin: 0; padding: 0; }
.arow { display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: 10px; text-decoration: none; color: var(--ink); }
.arow:hover { background: var(--brand-50); color: var(--ink); }
.alist li + li, .feed li + li { border-top: 1px solid var(--line-2); }
.arow-main { flex: 1; min-width: 0; display: grid; }
.arow-main b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed a { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: baseline; padding: 9px 8px; border-radius: 10px; text-decoration: none; color: var(--ink); font-size: 14px; }
.feed a:hover { background: var(--brand-50); color: var(--ink); }
.feed-who { font-weight: 700; }
.feed-what { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-when { color: var(--ink-3); font-size: 12.5px; white-space: nowrap; }

/* ===== Tablica ===== */
.board-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.board-filters .cs, .board-filters > select { width: auto; min-width: min(190px, 100%); }
.board-filters > select { min-height: 40px; font-size: 14.5px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; box-shadow: var(--shadow-sm); }
.seg a { display: inline-flex; align-items: center; min-height: 38px; padding: 8px 14px; text-decoration: none; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.seg a:hover { background: var(--bg-2); }
.seg a.on { background: var(--brand); color: #fff; }
.board-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; scrollbar-width: none; }
.board-tabs button { flex: 0 0 auto; border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 13.5px; cursor: pointer; min-height: 40px; }
.board-tabs button[aria-selected=true] { background: var(--brand); border-color: var(--brand); color: #fff; }
.board { display: grid; gap: 12px; }
.col { background: var(--bg-2); border: 1px solid var(--line-2); border-radius: 14px; padding: 10px; min-height: 120px; }
.col-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 6px 10px; font-weight: 700; font-size: 14px; }
.col-head .count { color: var(--ink-3); font-weight: 600; }
.col-body { display: grid; gap: 8px; min-height: 60px; align-content: start; }
.col.drop { outline: 2px dashed var(--brand-400); outline-offset: -2px; background: var(--brand-50); }
.col-empty { color: var(--ink-3); font-size: 13px; text-align: center; padding: 18px 6px; }
.lcard { position: relative; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 4px; cursor: pointer; box-shadow: var(--shadow-sm); transition: border-color .12s, box-shadow .12s; }
.lcard:hover { border-color: var(--brand-400); box-shadow: 0 2px 10px rgba(15, 58, 48, .08); }
.lcard:active { cursor: grabbing; }
.lcard.dragging { opacity: .5; }
.lcard a.name { font-weight: 700; color: var(--ink); text-decoration: none; }
.lcard a.name::after { content: ''; position: absolute; inset: 0; border-radius: 12px; }
.lcard .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 12.5px; color: var(--ink-3); align-items: center; }
.lcard .icons { display: inline-flex; gap: 4px; margin-left: auto; }
.lcard .icons, .lcard .cs, .lcard select { position: relative; z-index: 1; }
.lcard .cs, .lcard > select { margin-top: 4px; }
.ic { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 6px; }
.ic svg { width: 14px; height: 14px; }
.ic-missing { background: var(--warn-soft); color: var(--warn); }
.ic-paused { background: #eef2f1; color: #34433e; }
.ic-reply { background: var(--brand-100); color: var(--brand-700); }
@media (max-width: 767px) {
  .board .col { display: none; }
  .board .col.active { display: block; }
}
@media (min-width: 768px) {
  .board-tabs { display: none; }
  .board { grid-template-columns: repeat(4, minmax(200px, 1fr)) auto; overflow-x: auto; align-items: start; }
  .lcard .cs, .lcard > select { display: none; }
  .col.collapsed { width: 54px; min-width: 54px; padding: 10px 4px; cursor: pointer; }
  .col.collapsed:hover { background: var(--brand-50); }
  .col.collapsed .col-body { display: none; }
  .col.collapsed .col-head { writing-mode: vertical-rl; padding: 6px 0; justify-content: flex-start; }
  .col:not(.collapsed) { min-width: 200px; }
}
.col-toggle { background: none; border: 0; padding: 0; font: inherit; font-weight: 700; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.col-toggle .chev { transition: transform .15s; flex: 0 0 auto; }
.col:not(.collapsed) .col-toggle .chev { transform: rotate(90deg); }

/* ===== Dialog ===== */
dialog { border: 1px solid var(--line); border-radius: 16px; padding: 22px; max-width: min(92vw, 440px); box-shadow: 0 24px 64px rgba(15, 58, 48, .22); }
dialog::backdrop { background: rgba(15, 20, 18, .38); }
dialog h2 { font-size: 1.1rem; }
dialog .form-actions { margin-top: 16px; }

/* ===== Formularz klienta ===== */
.client-body { background: var(--bg-2); min-height: 100vh; }
.client-head { position: relative; display: flex; align-items: center; background: #fff; padding: 14px 16px; }
.client-head::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--brand-grad); }
.client-head img { height: 30px; width: auto; display: block; }
.client-wrap { max-width: 640px; margin: 0 auto; padding: 22px 16px 48px; }
.client-wrap h1 { font-size: 1.45rem; }
fieldset.client-card { margin: 0; min-width: 0; }
.client-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px 16px; box-shadow: var(--shadow-sm); }
.client-card + .client-card { margin-top: 14px; }
@media (min-width: 640px) { .client-card { padding: 24px; } }
.rodo { font-size: 12.5px; color: var(--ink-3); margin-top: 20px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
