/* CRM sukcesyjny — style. Mobile-first, bez kroku budowania.
   Marka jak lewandowskijakub.pl (docs/STYL_MARKI.md): papier, zieleń butelkowa, złoto; Karla w pracy, Cormorant tylko w nagłówkach. */
@import url("../fonts/fonts.b9ece60cddb2.css");
:root {
  --bg: #F7F5EF;
  --surface: #FFFDF7;
  --surface-2: #EFEBE0;
  --border: #D9D2BF;
  --text: #17231E;
  --muted: #56615B;
  --gold: #9A7A33;
  --gold-soft: #C8AE6A;
  --on-gold: #FFFDF7;
  --deep: #14231C;
  --on-deep: #EDE7D6;
  --primary: #9A7A33;
  --accent: var(--gold); --accent-soft: rgba(154, 122, 51, .13);  /* karty „polecony”, „prezent”, „telefon” */
  --primary-soft: rgba(154, 122, 51, .12);
  --link: #6E5521;
  --danger: #A6463A;
  --danger-soft: rgba(166, 70, 58, .11);
  --warn: #B07A1E;
  --warn-soft: rgba(176, 122, 30, .11);
  --ok: #3E7A55;
  --ok-soft: rgba(62, 122, 85, .11);
  --radius: 2px;
  --shadow: none;
  --nav-h: 64px;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: Karla, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101A15;
    --surface: #16231C;
    --surface-2: #1C2B23;
    --border: #2C3B33;
    --text: #ECE6D5;
    --muted: #A9B0A6;
    --gold: #CDB06A;
    --gold-soft: #8F7740;
    --on-gold: #14140F;
    --deep: #0B130F;
    --on-deep: #ECE6D5;
    --primary: #CDB06A;
    --primary-soft: rgba(205, 176, 106, .14);
    --link: #D8BE7E;
    --danger: #E08A7E;
    --danger-soft: rgba(224, 138, 126, .14);
    --warn: #D9A64E;
    --warn-soft: rgba(217, 166, 78, .14);
    --ok: #7DBB93;
    --ok-soft: rgba(125, 187, 147, .14);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 16px/1.55 var(--sans);
  font-variant-numeric: lining-nums tabular-nums;
  background: var(--bg);
  color: var(--text);
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-decoration-color: var(--gold); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; font-variant-numeric: lining-nums; }
h1 { font: 600 30px/1.2 var(--serif); }
h2 { font: 700 1.1rem/1.3 var(--sans); }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
small, .muted { color: var(--muted); }
.small { font-size: .9rem; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ---------- układ ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .75rem;
  padding: .6rem 16px;
  background: var(--deep); color: var(--on-deep);
  border-bottom: 1px solid rgba(200, 174, 106, .3);
}
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--on-deep); white-space: nowrap;
  font: 600 20px/1 var(--serif); font-variant-numeric: lining-nums; }
.brand:hover { text-decoration: none; color: var(--on-deep); }
.brand .dab { width: 36px; height: 36px; color: #CDB06A; display: inline-flex; }
.brand .dab svg { width: 100%; height: 100%; }
.topbar .search { flex: 1; max-width: 480px; margin-left: auto; position: relative; }
.topbar .search input { width: 100%; padding: .5rem .75rem; }
.topnav { display: none; gap: .25rem; }
.topnav a { padding: .45rem .7rem; color: rgba(237, 231, 214, .8); font-weight: 700; border-bottom: 2px solid transparent; }
.topnav a.active { color: var(--on-deep); border-bottom-color: #CDB06A; }
.topnav a:hover { text-decoration: none; color: var(--on-deep); }
.topnav a .nav-count { display: inline-block; min-width: 1.35rem; padding: 0 .4rem; margin-left: .2rem; border-radius: 999px; background: #d92d20; color: #fff; font-size: .8rem; font-weight: 800; line-height: 1.35rem; text-align: center; vertical-align: 1px; }
.topbar .search input { background: rgba(255, 253, 247, .08); color: var(--on-deep); border-color: rgba(200, 174, 106, .45); }
.topbar .search input::placeholder { color: rgba(237, 231, 214, .6); }
.topbar .btn.ghost { color: var(--on-deep); }
.search-results {
  /* szeroki panel na środku ekranu, pod paskiem — czytelny także na pionowym monitorze i w telefonie */
  position: fixed; left: 50%; transform: translateX(-50%); top: 68px;
  width: min(860px, calc(100vw - 24px)); max-height: calc(100vh - 92px); overflow: auto; z-index: 60;
  background: var(--surface); border: 2px solid var(--accent, #c8ae6a); border-radius: var(--radius);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .35); font-size: 1.05rem;
}
.search-results .row { padding: 12px 16px; }
.search-results .title { font-size: 1.1rem; font-weight: 700; overflow-wrap: anywhere; }
.search-results .meta { font-size: .95rem; overflow-wrap: anywhere; }
.search-results .list li + li { border-top: 1px solid var(--border); }
.search-results:empty { display: none; }

main { max-width: none; margin: 0 auto; padding: 16px clamp(16px, 2.2vw, 48px); }  /* cały ekran, także poziomo na tablecie / monitorze */

.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 20;
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);  /* wszystkie ikony w jednym rzędzie */
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--surface); border-top: 1px solid var(--border);
}
.bottomnav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: .72rem; color: var(--muted); gap: 2px; min-width: 0; position: relative;
}
.bottomnav a .lbl { max-width: 100%; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; padding: 0 2px; }
.bottomnav a .dot { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 8px; background: #d92d20; color: #fff; font-weight: 800; font-size: .62rem; line-height: 16px; text-align: center; }
.bottomnav a .ico { font-size: 1.3rem; line-height: 1; }
.bottomnav a.active { color: var(--primary); }
.bottomnav a:hover { text-decoration: none; }
.bottomnav .add .ico {
  background: var(--primary); color: #fff; width: 40px; height: 40px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 1.5rem;
}

@media (min-width: 900px) {
  body { padding-bottom: 24px; }
  .bottomnav { display: none; }
  .topnav { display: flex; }
  .topbar { padding: .6rem 24px; }
  main { padding: 24px; }
}

.page-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-bottom: 1rem;
}
.page-head h1 { margin: 0; flex: 1 1 auto; }
.page-head .actions { display: flex; gap: .5rem; flex-wrap: wrap; }

.grid { display: grid; gap: 16px; }
@media (min-width: 900px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .grid-main { grid-template-columns: 2fr 1fr; align-items: start; }
}

.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px;
}
.card > h2:first-child, .card-head { margin-top: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .5rem; }
.card-head h2 { margin: 0; }
.card.flush { padding: 0; }
.card.flush .card-head { padding: 12px 16px 0; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 14px; color: var(--text);
}
.stat:hover { text-decoration: none; border-color: var(--primary); }
.stat .num { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.stat .lbl { font-size: .8rem; color: var(--muted); }
.stat.danger .num { color: var(--danger); }

/* ---------- listy ---------- */
.list { list-style: none; margin: 0; padding: 0; }
.list > li { border-top: 1px solid var(--border); }
.list > li:first-child { border-top: 0; }
.row {
  display: flex; align-items: center; gap: 12px; padding: 12px 16px; color: var(--text);
}
a.row:hover { background: var(--surface-2); text-decoration: none; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.row .meta { font-size: .85rem; color: var(--muted); }
.avatar {
  flex: none; width: 40px; height: 40px; border-radius: 50%;
  background: var(--primary-soft); color: var(--primary);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: .9rem;
}
.empty { padding: 16px; color: var(--muted); text-align: center; }
.section-label {
  font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted); padding: 12px 16px 4px;
}
.section-label.danger { color: var(--danger); }

/* zadania */
.task { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 4px 10px; padding: 10px 16px; }
.task.done .task-title { text-decoration: line-through; color: var(--muted); }
/* stan zadania: czerwone = nieruszone (nikt go nie podjął), niebieskie = w trakcie (jest komentarz) */
.task.untouched { box-shadow: inset 4px 0 0 var(--danger); }
.task.started { box-shadow: inset 4px 0 0 var(--primary); }
.task .meta .state-untouched { color: var(--danger); font-weight: 600; }
.task .meta .state-started { color: var(--primary); font-weight: 600; }
.task .check {
  flex: none; width: 28px; height: 28px; margin-top: 1px; border-radius: 50%;
  border: 2px solid var(--border); background: var(--surface); cursor: pointer;
  display: flex; align-items: center; justify-content: center; font-size: .9rem; color: transparent;
}
.task .check:hover { border-color: var(--ok); color: var(--ok); }
.task.done .check { background: var(--ok); border-color: var(--ok); color: #fff; }
.task .body { flex: 1 1 240px; min-width: 0; }
.task-title { font-weight: 500; color: var(--text); }
.task .meta { font-size: .82rem; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 10px; }
.task .meta .overdue { color: var(--danger); font-weight: 600; }
/* przyciski odkładania: obok tytułu, gdy jest miejsce; w wąskiej karcie spadają pod tytuł (zadanie zajmuje 1–2 linijki, nie pasek) */
.task .tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 4px; flex: 0 1 auto; margin-left: auto; }
.task .tools .btn.sm { padding: .15rem .45rem; font-size: .78rem; }
/* „⏰ Odłóż ▾”: jedno menu zamiast sześciu przycisków (godzina / 2 godziny / jutro / 3 dni / tydzień) */
.task .tools { align-items: center; flex-wrap: nowrap; }
.snooze { position: relative; }
.snooze > summary { list-style: none; cursor: pointer; white-space: nowrap; }
.snooze > summary::-webkit-details-marker { display: none; }
.snooze > summary::before, .snooze[open] > summary::before { content: none; }
.snooze-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 40; min-width: 190px; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.16); }
.snooze-menu form { margin: 0; }
.snooze-menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }
.snooze-item { display: block; width: 100%; text-align: left; background: none; border: 0; border-radius: var(--radius);
  padding: .45rem .6rem; font: inherit; font-size: .9rem; color: var(--text); cursor: pointer; }
.snooze-item:hover, .snooze-item:focus-visible { background: var(--primary-soft); outline: none; }
/* tytuł i dane zadania w jednej linii, gdy jest miejsce (w wąskiej karcie dane spadają pod tytuł) */
.task .body { display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 12px; }
.task .body .task-title { flex: 0 1 auto; }
.task .body .meta { flex: 0 1 auto; }
.task .body .tools, .task .body > div:not(.meta) { flex: 1 1 100%; }
.task .tools form { margin: 0; }

/* lista kontrolna */
.check-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 16px; }
.check-item .box {
  flex: none; width: 26px; height: 26px; border-radius: 2px; border: 2px solid var(--border);
  background: var(--surface); cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: transparent; font-weight: 700;
}
.check-item.done .box { background: var(--ok); border-color: var(--ok); color: #fff; }
.check-item.done .name, .check-item.na .name { color: var(--muted); text-decoration: line-through; }
.check-item .grow { flex: 1; min-width: 0; }
.check-item .hint { font-size: .82rem; color: var(--muted); }
.check-item .tools { display: flex; gap: 4px; }
.check-item .tools form { margin: 0; }
.check-item .hint span + span::before { content: " · "; }
@media (max-width: 600px) {
  .check-item { padding: 10px 12px; gap: 8px; }
  .check-item .tools { gap: 0; }
  .check-item .tools .btn.sm { padding: .25rem .4rem; }
}

.progress { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > span { display: block; height: 100%; background: var(--ok); }

/* etapy */
.stages { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; }
.stages form { margin: 0; flex: none; }
.stage-btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--muted);
  border-radius: 99px; padding: .35rem .8rem; font-size: .85rem; cursor: pointer; white-space: nowrap;
}
.stage-btn.past { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.stage-btn.current { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 600; }

/* oś czasu */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 10px 16px; border-top: 1px solid var(--border); }
.timeline li:first-child { border-top: 0; }
.timeline .ico { flex: none; width: 28px; text-align: center; }
.timeline .grow { flex: 1; min-width: 0; }
.timeline .body { white-space: pre-wrap; overflow-wrap: anywhere; margin-top: 2px; }
.timeline li.system { font-size: .88rem; color: var(--muted); padding-top: 6px; padding-bottom: 6px; }

/* ---------- etykiety ---------- */
.badge {
  display: inline-block; font-size: .75rem; font-weight: 600; padding: .1rem .5rem; border-radius: 99px;
  background: var(--surface-2); color: var(--muted); white-space: nowrap;
}
.badge.primary { background: var(--primary-soft); color: var(--primary); }
.badge.danger { background: var(--danger-soft); color: var(--danger); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: baseline; }

/* ---------- formularze ---------- */
input, select, textarea, button { font: inherit; color: inherit; }
input[type=text], input[type=email], input[type=tel], input[type=password], input[type=search], input[type=url],
input[type=date], input[type=time], input[type=datetime-local], input[type=number], select, textarea {
  width: 100%; padding: .6rem .75rem; border: 1px solid var(--border); border-radius: 2px;
  background: var(--surface); min-height: 44px;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; border-color: transparent; }
textarea { min-height: 80px; resize: vertical; }
input[type=checkbox] { width: 20px; height: 20px; vertical-align: middle; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 4px; }
.field.check label { display: flex; gap: 8px; align-items: center; font-weight: 500; }
.field .help { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.field .error, .errorlist { color: var(--danger); font-size: .85rem; margin: 4px 0 0; padding: 0; list-style: none; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--danger); }
.form-grid { display: grid; gap: 0 16px; }
@media (min-width: 700px) { .form-grid { grid-template-columns: 1fr 1fr; } .form-grid .full { grid-column: 1 / -1; } }
fieldset { border: 0; padding: 0; margin: 0 0 8px; }
legend { font-weight: 700; margin-bottom: 8px; font-size: 1rem; padding: 0; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.form-actions .spacer { flex: 1; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; }
.inline-form > * { flex: 1 1 140px; }
.inline-form > button { flex: 0 0 auto; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters input[type=search] { flex: 1 1 200px; width: auto; }
.filters select { width: auto; flex: 0 1 auto; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: .5rem 1rem; border-radius: 2px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; background: var(--surface-2); }
.btn.primary { background: var(--gold); border-color: var(--gold); color: var(--on-gold); font-weight: 700; }
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 6px 18px rgba(154, 122, 51, .28); }
/* „Johny po callu”: coś czeka na zatwierdzenie — ma być widać od razu */
.btn.phone-waiting, .btn.phone-waiting:hover { display: flex; justify-content: center; align-items: center; min-height: 52px;
  font-size: 1.05rem; font-weight: 700; background: #C62828; border-color: #C62828; color: #fff;
  box-shadow: 0 0 0 4px rgba(198, 40, 40, .25); }
.btn.phone-waiting:hover { background: #A91F1F; }
.btn.danger { color: var(--danger); }
.btn.sm { min-height: 34px; padding: .25rem .65rem; font-size: .85rem; }
.btn.icon { min-height: 34px; width: 34px; padding: 0; font-size: 1rem; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.quick-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 0; }

.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.tabs a { padding: .5rem .8rem; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a.active { color: var(--primary); border-color: var(--primary); font-weight: 600; }
.tabs a:hover { text-decoration: none; color: var(--text); }

dl.props { display: grid; grid-template-columns: max-content 1fr; gap: 6px 12px; margin: 0; }
dl.props dt { color: var(--muted); font-size: .9rem; }
dl.props dd { margin: 0; overflow-wrap: anywhere; }

.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 10px 14px; border-radius: 2px; margin-bottom: 8px; background: var(--primary-soft); }
.messages li.success { background: var(--ok-soft); color: var(--ok); }
.messages li.error { background: var(--danger-soft); color: var(--danger); }
.messages li.warning { background: var(--warn-soft); color: var(--warn); }

details > summary { cursor: pointer; font-weight: 600; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: "＋ "; color: var(--primary); }
details[open] > summary::before { content: "－ "; }

.auth-wrap { max-width: 420px; margin: 8vh auto 0; }
.qr svg { width: 220px; height: 220px; background: #fff; padding: 8px; border-radius: 2px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }
.pagination { display: flex; gap: 8px; justify-content: center; align-items: center; margin: 12px 0; }
.htmx-request.htmx-indicator, .htmx-request .htmx-indicator { opacity: 1; }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.hide-mobile { display: none; }
@media (min-width: 700px) { .hide-mobile { display: initial; } .hide-desktop { display: none; } }

/* ---------- tablica (lejek) ---------- */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x proximity; }
.board-col {
  flex: 0 0 260px; background: var(--surface-2); border-radius: var(--radius); padding: 10px;
  scroll-snap-align: start; max-height: 75vh; overflow-y: auto;
}
.board-col > header {
  display: flex; justify-content: space-between; align-items: center; gap: 6px;
  font-weight: 700; font-size: .9rem; margin-bottom: 8px; position: sticky; top: 0; background: var(--surface-2);
}
.board-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 2px; padding: 10px;
  margin-bottom: 8px; box-shadow: var(--shadow);
}
.board-card.warn { border-left: 4px solid var(--danger); }
.board-card .title { font-weight: 600; color: var(--text); display: block; margin-bottom: 2px; }
.board-card .meta { font-size: .8rem; color: var(--muted); display: flex; gap: 10px; margin-bottom: 4px; }
.board-card .badge { margin: 2px 0 4px; }
.board-card .overdue { color: var(--danger); font-weight: 600; }
.board-card .card-tools { display: flex; gap: 4px; justify-content: flex-end; margin-top: 6px; }
.board-card .card-tools form { margin: 0; }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.zone-states { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.zone-states form { margin: 0; }
.zone-btn { border: 1px solid var(--border); background: var(--surface); color: var(--muted); border-radius: 99px;
  padding: .2rem .6rem; font-size: .8rem; cursor: pointer; }
.zone-btn.on.discussed { background: var(--primary-soft); color: var(--primary); border-color: transparent; font-weight: 600; }
.zone-btn.on.need { background: var(--warn-soft); color: var(--warn); border-color: transparent; font-weight: 600; }
.zone-btn.on.secured { background: var(--ok-soft); color: var(--ok); border-color: transparent; font-weight: 600; }

/* obszary pracy (Jakub / Tomek / Asortio) */
.area-chips { display: flex; gap: 6px; flex-wrap: wrap; margin: -4px 0 14px; }
.area-chips .chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: .9rem; font-weight: 500; }
.area-chips .chip.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.area-chips .chip.active[style] { background: var(--area); border-color: var(--area); }
.area-chips .chip.active .area-dot { background: #fff !important; }
.area-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }

/* podgląd zadania: wyraźny status i przycisk zakończenia */
.eyebrow { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.status-card { border-left: 5px solid var(--border); }
.status-card.untouched { border-left-color: var(--danger); }
.status-card.started { border-left-color: var(--primary); }
.status-card.done { border-left-color: var(--ok); }
.status-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.status-pill { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 700; font-size: 1rem; }
.status-pill.untouched { background: var(--danger-soft); color: var(--danger); }
.status-pill.started { background: var(--primary-soft); color: var(--primary); }
.status-pill.done { background: var(--ok-soft); color: var(--ok); }
.btn.ok { border-color: var(--ok); color: var(--ok); background: var(--surface); font-weight: 600; }
.btn.ok:hover { background: var(--ok-soft); }

/* mapa stref po pierwszej rozmowie */
.zones { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.zones .zone-have, .zones .zone-gap { font-size: .9rem; margin-top: 2px; }
.zones .zone-have { color: var(--ok); }
.zones .zone-gap { color: var(--warn); }

/* Pole z podpowiedziami (osoba / firma) */
.lookup { position: relative; }
.lookup-list { position: absolute; z-index: 30; left: 0; right: 0; top: 100%; margin-top: 2px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 2px; box-shadow: 0 8px 24px rgba(0,0,0,.12); max-height: 280px; overflow: auto; }
.lookup-item { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; background: none; cursor: pointer; font: inherit; color: inherit; }
.lookup-item:hover, .lookup-item.active { background: var(--primary-soft); }
.lookup-add { color: var(--primary); font-weight: 600; border-top: 1px solid var(--border); }

/* Zadania z wysokim priorytetem — zawsze na górze, wyróżnione fioletem (magenta) z poświatą */
:root { --high: #a21caf; --high-soft: rgba(192, 38, 211, .10); --high-glow: rgba(192, 38, 211, .28); }
@media (prefers-color-scheme: dark) { :root { --high: #e879f9; --high-soft: rgba(232, 121, 249, .12); --high-glow: rgba(232, 121, 249, .30); } }
.task.high { background: linear-gradient(90deg, var(--high-soft), transparent 85%);
  box-shadow: inset 4px 0 0 var(--high), inset 0 0 18px var(--high-glow); }
.task.high .task-title { color: var(--high); font-weight: 700; }
.badge.high { background: var(--high-soft); color: var(--high); font-weight: 700; }

/* Nowe zgłoszenia (strona, portal, polecenie, LinkedIn): ognisty pomarańcz — na samej górze, mocniej niż „wysoki” */
:root { --fire: #c2410c; --fire-soft: rgba(249, 115, 22, .14); --fire-glow: rgba(249, 115, 22, .35); }
@media (prefers-color-scheme: dark) { :root { --fire: #fdba74; --fire-soft: rgba(251, 146, 60, .16); --fire-glow: rgba(251, 146, 60, .38); } }
.task.inbound { background: linear-gradient(90deg, var(--fire-soft), transparent 90%);
  box-shadow: inset 5px 0 0 var(--fire), inset 0 0 20px var(--fire-glow); }
.task.inbound .task-title { color: var(--fire); font-weight: 800; }
.badge.inbound { background: var(--fire-soft); color: var(--fire); font-weight: 800; }
.inbound-card { border-color: var(--fire); }

/* Załączniki do maili: lista plików z biblioteki */
.mail-files-list { display: grid; gap: 4px; padding: 4px 0 6px 12px; }
.mail-group { margin: 2px 0; }
.mail-group > summary { cursor: pointer; font-weight: 700; padding: 3px 0; }
.field .mail-file, .field label.small { font-weight: 400; }
.mail-file { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.mail-file > span:first-of-type { font-weight: 700; }
.mail-file input { width: auto; }

/* Kampania „Emerytura”: blok na samej górze Pulpitu — zieleń butelkowa i złoto (marka), duży napis wersalikami */
.emerytura-card { border: 2px solid var(--gold); overflow: hidden; }
.emerytura-head { background: var(--deep); color: var(--on-deep); padding: 14px 18px; display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 18px;
  border-bottom: 3px solid var(--gold); }
.emerytura-title { font-family: var(--serif); font-size: 2.6rem; line-height: 1; font-weight: 700; letter-spacing: .14em; color: #CDB06A; text-transform: uppercase; }
.emerytura-sub { font-size: .95rem; opacity: .9; }
.emerytura-prof { padding: 10px 18px 2px; font-weight: 800; font-size: 1.15rem; color: var(--link); letter-spacing: .02em; }
.emerytura-n { display: inline-block; min-width: 1.5em; text-align: center; margin-left: 4px; padding: 0 6px; background: var(--gold); color: var(--on-gold); border-radius: 10px; font-size: .85rem; }
.badge.campaign { background: var(--primary-soft); color: var(--link); font-weight: 700; }

/* Urodziny dzisiaj: błękit (inny niż pomarańcz zgłoszeń i fiolet „wysokiego”), duży tort */
:root { --bday: #1d6fd1; --bday-soft: rgba(56, 152, 236, .12); --bday-glow: rgba(56, 152, 236, .32); }
@media (prefers-color-scheme: dark) { :root { --bday: #7cc0ff; --bday-soft: rgba(96, 165, 250, .15); --bday-glow: rgba(96, 165, 250, .36); } }
.birthday-card { border: 2px solid var(--bday); background: linear-gradient(90deg, var(--bday-soft), transparent 85%);
  box-shadow: inset 6px 0 0 var(--bday), 0 0 22px var(--bday-glow); }
.birthday-card .section-label { color: var(--bday); font-size: 1.05rem; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.birthday-card .cake { font-size: 2.6rem; line-height: 1; filter: drop-shadow(0 2px 4px var(--bday-glow)); }
.birthday-card .cake.sm { font-size: 2rem; }
.birthday-card .list a strong { color: var(--bday); font-size: 1.12rem; }
.birthday-card .btn.primary { background: var(--bday); border-color: var(--bday); color: #fff; }
@media (prefers-color-scheme: dark) { .birthday-card .btn.primary { color: #0b2540; } }

/* Najważniejsze pola formularza (np. polisa: towarzystwo, produkt, składka, początek ochrony) */
.field.big label { font-size: 1.05rem; font-weight: 800; }
/* pola do wypełnienia / sprawdzenia w edycji polisy — na czerwono */
.field.must label { color: var(--danger); font-weight: 800; }
.field.must input, .field.must select, .field.must textarea { border: 2px solid var(--danger); }
.field.big input, .field.big select { font-size: 1.1rem; font-weight: 700; }

/* Polisa na etapie wniosku — wyróżniona fioletem (magenta) wśród polis klienta */
li.policy-app > .row { background: linear-gradient(90deg, var(--high-soft), transparent 90%);
  box-shadow: inset 5px 0 0 var(--high), inset 0 0 22px var(--high-glow); }
li.policy-app .title { color: var(--high); font-weight: 700; }
.badge.app { background: var(--high); color: var(--surface); font-size: .9rem; font-weight: 800; padding: 5px 12px;
  box-shadow: 0 0 10px var(--high-glow); }

/* Historia: treść wpisu zwinięta — widać tylko słowa klucze, szczegóły po rozwinięciu */
.act-more > summary { cursor: pointer; font-size: .8rem; color: var(--primary); list-style: none; margin: 2px 0; }
.act-more > summary::-webkit-details-marker { display: none; }
.act-more > summary::before { content: "▸ "; }
.act-more[open] > summary::before { content: "▾ "; }
.act-more[open] > summary { margin-bottom: 4px; }

/* Komentarze do zadań: kto pisze — moje po prawej stronie kolorem, innych osób zwykłe */
.timeline li.comment { align-items: flex-start; }
.timeline li.comment .avatar.sm { width: 28px; height: 28px; font-size: .8rem; flex: none; }
.timeline li.comment:not(.mine) .grow { background: var(--surface-2); border-radius: 2px; padding: 6px 10px; }
.timeline li.comment.mine .grow { background: var(--primary-soft); border-radius: 2px; padding: 6px 10px; }

/* Polisy na listach: na przemian jaśniejsze i ciemniejsze — łatwo odróżnić kolejne polisy */
li.policy-row:nth-child(even):not(.policy-app) > .row { background: var(--surface-2); }
li.policy-row + li.policy-row { border-top: 1px solid var(--border); }

/* Formularz polisy: wyróżniony blok ustawień Ergo Hestii */
.ergo-box { border: 2px solid var(--high); border-radius: 2px; padding: 12px 14px 0; margin-bottom: 14px;
  background: linear-gradient(180deg, var(--high-soft), transparent 70%); }
.ergo-head { font-weight: 800; color: var(--high); margin-bottom: 8px; }
/* Odnawianie i zmiana składki — dobrze widoczne na listach i w karcie polisy */
.badge.renew { background: var(--primary); color: var(--surface); font-weight: 700; }
.badge.step { background: var(--warn); color: var(--surface); font-weight: 700; }
.badge.imported { background: transparent; border: 1px solid var(--primary); color: var(--primary); font-weight: 700; }

/* Zielony ptaszek „sprawdzona” po lewej stronie polisy */
.verified-mark { width: 22px; height: 22px; border-radius: 50%; flex: none; display: inline-flex; align-items: center;
  justify-content: center; border: 2px dashed var(--border); font-size: .8rem; font-weight: 800; }
.verified-mark.on { background: var(--ok); border: 2px solid var(--ok); color: #fff; }

/* Numer polisy na liście klienta: 01, 02, 03… */
.policy-no { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--muted); min-width: 22px; text-align: right; }
.premium-split { display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0 16px 8px; }
.kids { list-style: none; margin: 8px 0; padding: 0; }
.kids > li { padding: 8px 0; border-top: 1px solid var(--border, #e5e7eb); }
.kid-slots { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.kid-slots .slot { font-size: .85rem; padding: 3px 8px; border-radius: 2px; border: 1px dashed var(--high); color: var(--high); }
.kid-slots .slot.ok { border-style: solid; border-color: var(--ok, #16a34a); color: inherit; }
.kid-add { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.kid-add input { flex: 1; min-width: 6em; }
.app-mail .app-tpl { display: block; border: 1px solid var(--border); border-radius: 2px; padding: 10px 12px; margin-top: 8px; color: inherit; text-decoration: none; }
.app-mail details.app-tpl > summary { cursor: pointer; }
.app-mail details.app-tpl[open] > summary { margin-bottom: 8px; }
.app-mail a.app-tpl:hover { border-color: var(--primary, #1d4ed8); }
.my-day { border-color: #f59e0b; }
.my-day .inline-form input[name=text] { flex: 1; }
.my-day-list { list-style: none; margin: 10px 0 0; padding: 0; }
.my-day-list li { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-top: 1px solid var(--border); }
.my-day-list li.done .grow { text-decoration: line-through; color: var(--muted, #6b7280); }
.my-day-list .check { width: 32px; height: 32px; border-radius: 50%; border: 2px solid var(--border); background: none; cursor: pointer; color: transparent; }
.my-day-list li.done .check { background: var(--ok); border-color: var(--ok); color: #fff; }
.my-day-list .grow { flex: 1; }
.import-item { border-top: 1px solid var(--border); padding: 10px 0; }
.import-changes { margin: 6px 0; border-collapse: collapse; }
.import-changes td { padding: 3px 8px 3px 0; vertical-align: top; }
.my-day-list .md-edit { display: flex; gap: 6px; }
.my-day-list .md-edit[hidden], .my-day-list .grow[hidden] { display: none; }
.my-day-list .md-edit input { flex: 1; }
.must-confirm { border: 2px solid var(--high); border-radius: 2px; padding: 8px 12px; background: var(--high-soft); }
.must-confirm label:first-child { font-weight: 800; }
.must-confirm .field ul, .must-confirm .field > div { display: flex; flex-wrap: wrap; gap: 4px 16px; font-weight: 700; }
.alert { padding: 10px 14px; border-radius: 2px; background: var(--danger-soft); color: var(--danger); font-weight: 600; }

/* Marka: pola, fokus, przyciski */
.btn { font-family: var(--sans); transition: transform .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 0; border-color: var(--gold); }
.bottomnav .add .ico { color: var(--on-gold); }
.older-activities { padding: 0 16px 12px; }
.older-activities > summary { cursor: pointer; color: var(--link); font-weight: 700; padding: 6px 0; }
.step-mail { margin: 0 0 8px 54px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
details.step-mail { display: block; }
details.step-mail > summary { list-style: none; display: inline-block; cursor: pointer; }
details.step-mail > summary::-webkit-details-marker { display: none; }
details.step-mail > summary::before { content: none; }
.meeting-tile { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; margin: 0 0 12px; padding: 14px 16px;
  border: 2px solid var(--primary); border-radius: 4px; background: var(--surface); color: var(--text); text-decoration: none; font-size: 1.05rem; }
.meeting-tile:hover { background: var(--primary-soft, var(--surface-2)); }
.meeting-tile.done { border-color: var(--border); }
.mail-thread { list-style: none; margin: 0; padding: 0 16px 12px; }
.mail-msg { border: 1px solid var(--border); border-radius: 4px; padding: 10px 12px; margin: 10px 0;
  background: var(--surface); color: var(--text); }
.mail-msg.in { border-left: 4px solid var(--primary); }
.mail-msg.out { margin-left: 24px; background: var(--surface-2); }  /* kolory z motywu — czytelne w jasnym i ciemnym */
.mail-msg.unread { box-shadow: 0 0 0 2px var(--high, #b45309) inset; }
.mail-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin-bottom: 6px; }
.mail-body { white-space: normal; overflow-wrap: anywhere; margin-bottom: 6px; }
/* telefon: przyciski „jutro / 3 dni / tydzień” pod zadaniem, żeby nie ściskały tytułu */
@media (max-width: 600px) {
  .task { flex-wrap: wrap; }
  .task .body { flex: 1 1 calc(100% - 60px); min-width: 0; }
  .task .tools { flex: 1 1 100%; justify-content: flex-end; flex-wrap: wrap; }
}
select.whose { width: auto; padding: 2px 6px; font-size: .85rem; display: inline-block; }

/* Zadanie: wyraźny powrót do karty klienta */
.client-back { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; padding: 12px 16px;
  background: var(--surface); border: 2px solid var(--primary); border-radius: 12px; color: var(--text);
  text-decoration: none; box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.client-back:hover { text-decoration: none; background: var(--surface-2, var(--surface)); }
.client-back .cb-arrow { font-size: 1.6rem; font-weight: 800; color: var(--primary); line-height: 1; }
.client-back .cb-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.client-back .cb-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.client-back strong { font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.client-back .cb-meta { font-size: .85rem; color: var(--muted); white-space: nowrap; }
.call-btn strong { font-variant-numeric: tabular-nums; letter-spacing: .02em; white-space: nowrap; }
.bulk-remind { padding: 8px 16px 12px; border-top: 1px solid var(--border); }
.bulk-remind summary { cursor: pointer; padding: 4px 0; }
/* Przypomnienia o składce przy polisie: zielony kalendarz — włączone, czerwony — wyłączone */
.remind-mark { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex: none;
  border-radius: 7px; font-size: .9rem; line-height: 1; }
.remind-mark.on { background: #dcfce7; box-shadow: inset 0 0 0 2px #16a34a; }
.remind-mark.off { background: #fee2e2; box-shadow: inset 0 0 0 2px #dc2626; filter: grayscale(.4); }
/* Lista klientów: telefon i e-mail zawsze widoczne */
.contact-line { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.contact-line span { overflow-wrap: anywhere; }
.contact-line .missing { color: var(--danger, #dc2626); }
/* Lista klientów: obok karty od razu „Edytuj” */
.person-row { display: flex; align-items: center; }
.person-row > .row { flex: 1; min-width: 0; }
.person-row .row-edit { flex: none; margin-right: 12px; }
@media (max-width: 600px) { .person-row .row-edit .lbl { display: none; } .person-row .row-edit { margin-right: 8px; } }
/* Lista klientów: zmiana dla kilku osób naraz */
.bulk-panel { position: sticky; bottom: calc(var(--nav-h, 0px) + env(safe-area-inset-bottom) + 8px); z-index: 15;
  box-shadow: 0 -4px 18px rgba(0,0,0,.15); border: 2px solid var(--primary); padding: 10px 14px; max-height: 70vh; overflow-y: auto; }
.bulk-panel summary { cursor: pointer; list-style: none; padding: 4px 0; }
.bulk-panel summary::-webkit-details-marker { display: none; }
@media (min-width: 900px) { .bulk-panel { bottom: 12px; } }
.person-row .row-check { display: flex; align-items: center; align-self: stretch; padding: 0 0 0 12px; cursor: pointer; }
.person-row .row-check input { width: 20px; height: 20px; accent-color: var(--primary); }
.bulk-fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.bulk-fields label { display: flex; flex-direction: column; gap: 4px; font-size: .8rem; font-weight: 700; }
/* Etykiety klientów */
.tag-line { display: flex; flex-wrap: wrap; gap: 4px 6px; }
.tag-chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 700;
  background: var(--surface-2); border: 1px solid var(--border); color: var(--text); text-decoration: none; }
a.tag-chip:hover { border-color: var(--primary); text-decoration: none; }
/* Johnny w CRM */
.jn-q-crm { margin: 14px 0 6px auto; max-width: 85%; width: fit-content; padding: 10px 14px; border-radius: 14px 14px 2px 14px;
  background: var(--primary); color: var(--surface); }
.guide h2 { margin-top: 0; } .guide h3 { margin: 18px 0 6px; } .guide ul { padding-left: 20px; } .guide li { margin: 4px 0; }


li.policy-group { display: flex; justify-content: space-between; gap: 8px; padding: 8px 16px; background: var(--accent-soft); border-top: 1px solid var(--border); font-size: .95rem; }
.policy-group-head { margin: 22px 0 8px; font-size: 1.15rem; }

.hh { margin: 6px 0; font-size: .92rem; line-height: 1.7; }
.hh .hh-m { margin-left: 8px; white-space: nowrap; }
.role { display: inline-block; padding: 0 7px; border-radius: 999px; background: var(--accent-soft); font-size: .78rem; font-weight: 700; color: var(--muted, #6b6455); vertical-align: 1px; }
.hh-edit { display: inline-block; margin-left: 6px; }
.hh-edit summary { cursor: pointer; list-style: none; display: inline; opacity: .7; }
.hh-edit[open] { display: block; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; }
.hh-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 2px 0; }
.hh-row select { width: auto; font-size: .85rem; padding: 2px 6px; }
.hh-name { min-width: 80px; font-weight: 700; }
li.kid-compact { padding: 4px 0; list-style: none; }
.hh .btn.link, .hh-row .btn.link { border: 0; background: none; padding: 0 4px; min-height: 0; box-shadow: none; text-decoration: underline; font-weight: 600; }

/* listy zwinięte: temat i dwa pierwsze wiersze treści, klik rozwija całość */
.clamp2 { display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
details[open] > summary .clamp2 { display: block; -webkit-line-clamp: unset; line-clamp: unset; overflow: visible; }
details.mail-more > summary, details.act-more > summary { cursor: pointer; list-style: none; }
details.mail-more > summary::-webkit-details-marker, details.act-more > summary::-webkit-details-marker { display: none; }
details.mail-more > summary .mail-head { margin-bottom: 2px; }
details.mail-more[open] > summary .mail-body { margin-bottom: 6px; }

/* delikatna czerwona poświata całego kafelka (np. „Sprawy bez ruchu”) */
.card.glow-red { border-color: rgba(217, 45, 32, .55); background-image: linear-gradient(rgba(217, 45, 32, .06), rgba(217, 45, 32, .06));
  box-shadow: 0 0 0 3px rgba(217, 45, 32, .10), 0 0 22px rgba(217, 45, 32, .22); }

/* pola daty i godziny nie wychodzą poza kartę na telefonie (iOS rozciąga je do własnej szerokości) */
input[type=time], input[type=date] { max-width: 100%; min-width: 0; box-sizing: border-box; }
