/* ===== CRM v2 — jasny, czytelny, duży ===== */
:root {
  --bg: #f5f6f8; --card: #ffffff; --fg: #1a1d21; --muted: #6b7280;
  --accent: #2563eb; --accent-soft: #dbeafe; --ok: #16a34a; --warn: #d97706; --bad: #dc2626;
  --border: #e5e7eb; --border-strong: #cbd5e1; --radius: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 17px/1.5 -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; }
a { color: var(--accent); text-decoration: none; }
.wrap { max-width: 1100px; margin: 0 auto; padding: 0 16px 60px; }

/* nav */
.topnav { background: var(--card); border-bottom: 1px solid var(--border); padding: 0 12px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; position: sticky; top: 0; z-index: 20; }
.topnav .brand { font-weight: 700; padding: 12px 8px; font-size: 18px; }
.topnav a.nav { padding: 12px 14px; border-radius: 10px; font-size: 17px; color: var(--fg); }
.topnav a.nav:hover { background: var(--accent-soft); }
.topnav a.nav.on { background: var(--accent); color: #fff; }
.topnav .who { margin-left: auto; color: var(--muted); font-size: 14px; padding-right: 8px; }
.navdrop { position: relative; display: inline-block; }
.navdrop>button { background: none; border: none; font: inherit; padding: 12px 14px; cursor: pointer; color: var(--fg); }
.navdrop .menu { display: none; position: absolute; background: var(--card); border: 1px solid var(--border-strong); border-radius: 10px; min-width: 180px; box-shadow: 0 8px 24px rgba(0,0,0,.12); z-index: 30; }
.navdrop:hover .menu, .navdrop:focus-within .menu { display: block; }
.navdrop .menu a { display: block; padding: 10px 14px; }

h1 { font-size: 26px; margin: 20px 0 12px; }
h2 { font-size: 20px; margin: 18px 0 8px; }
.muted { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
@media (max-width: 760px){ .grid2,.grid3 { grid-template-columns: 1fr; } .cols { grid-template-columns: 1fr; } }

/* buttons */
.btn { display: inline-block; background: var(--card); border: 1.5px solid var(--border); color: var(--fg); padding: 10px 18px; border-radius: 12px; font-size: 17px; font-weight: 600; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.small { padding: 6px 12px; font-size: 14px; }
.btn.mic { background: #111827; border-color: #111827; color: #fff; border-radius: 999px; padding: 10px 16px; }
.btn.mic.rec { background: var(--bad); border-color: var(--bad); }

/* forms */
input, select, textarea { font: inherit; padding: 10px 12px; border: 1.5px solid var(--border); border-radius: 10px; width: 100%; background: #fff; }
label { display: block; font-size: 14px; color: var(--muted); margin: 10px 0 4px; font-weight: 600; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

/* chips / interests */
.chip { display: inline-block; background: var(--accent-soft); color: var(--accent); border-radius: 999px; padding: 5px 14px; font-size: 15px; margin: 2px 4px 2px 0; }
.chip.off { background: #eef0f3; color: var(--muted); }
.chip.click { cursor: pointer; border: 1px solid transparent; }
.chip.click:hover { border-color: var(--accent); }

/* Dziś listy */
.today-item { display: flex; gap: 12px; align-items: baseline; padding: 12px 0; border-bottom: 1px solid var(--border); }
.today-item:last-child { border-bottom: none; }
.today-item .time { font-weight: 700; min-width: 110px; }
.today-item .act { margin-left: auto; }
.today-item.overdue .time { color: var(--bad); }
.badge { display: inline-block; border-radius: 6px; padding: 2px 8px; font-size: 13px; font-weight: 600; }
.badge.red { background: #fee2e2; color: var(--bad); }
.badge.green { background: #dcfce7; color: var(--ok); }
.badge.gray { background: #eef0f3; color: var(--muted); }
.badge.amber { background: #fef3c7; color: var(--warn); }

/* kanban */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 20px; align-items: flex-start; scroll-snap-type: x proximity; }
.kcol { width: 270px; min-width: 270px; flex: 0 0 270px; background: #eef0f3; border-radius: var(--radius); padding: 10px; scroll-snap-align: start; }
.kcol-head { color: var(--fg); }
/* kolorowe oznaczenia etapów — zawsze z podpisem tekstowym */
.kcol[data-stage="1"] .kcol-head::before { content:'●'; color:#6b7280; margin-right:6px; }
.kcol[data-stage="2"] .kcol-head::before { content:'●'; color:#2563eb; margin-right:6px; }
.kcol[data-stage="3"] .kcol-head::before { content:'●'; color:#d97706; margin-right:6px; }
.kcol[data-stage="4"] .kcol-head::before { content:'●'; color:#7c3aed; margin-right:6px; }
.kcol[data-stage="5"] .kcol-head::before { content:'●'; color:#16a34a; margin-right:6px; }
.kcol[data-stage="6"] .kcol-head::before { content:'●'; color:#dc2626; margin-right:6px; }
.kcol-head { font-weight: 700; padding: 6px 4px 10px; display: flex; justify-content: space-between; }
.kcard { background: var(--card); border-radius: 10px; padding: 12px; margin-bottom: 8px; cursor: grab; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.kcard.drag { opacity: .5; }
.kcard b { display: block; }
.kcard .who { color: var(--muted); font-size: 14px; }
.kcard .due { font-size: 14px; margin-top: 4px; }
.kcard .lastnote { font-size: 14px; color: var(--muted); margin-top: 6px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.kstage-btns { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.kstage-btns button { text-align: left; }

/* kalendarz */
.cal { border: 1px solid var(--border); border-radius: var(--radius); background: var(--card); overflow: hidden; }
.cal-grid { display: grid; }
.cal-grid.m { grid-template-columns: repeat(7,1fr); }
.cal-head { background: #eef0f3; font-weight: 700; padding: 8px; text-align: center; font-size: 14px; }
.cal-cell { min-height: 84px; border: 1px solid var(--border); padding: 6px; font-size: 13px; position: relative; cursor: pointer; }
.cal-cell.today { background: #fffbeb; }
.cal-cell .ev { background: var(--accent-soft); color: var(--accent); border-radius: 6px; padding: 2px 6px; margin-top: 3px; font-size: 12px; cursor: grab; }
.cal-cell .ev-train { background: #fef3c7; color: var(--warn); }
.cal-cell .task { background: #f3f4f6; color: var(--muted); }
.cal-cell.over { outline: 2px solid var(--accent); }
.cal-week { display: grid; grid-template-columns: 60px repeat(7,1fr); }
.cal-week-head { font-size: 12px; font-weight: 700; padding: 6px; text-align: center; background: #eef0f3; }
.cal-hour { font-size: 12px; color: var(--muted); text-align: right; padding: 2px 6px; border-top: 1px solid var(--border); }
.cal-slot { border-top: 1px solid var(--border); border-left: 1px solid var(--border); min-height: 34px; position: relative; cursor: pointer; }
.cal-slot.over { outline: 2px solid var(--accent); }
.cal-slot .ev { position: absolute; inset: 2px; background: var(--accent-soft); border-radius: 6px; font-size: 12px; padding: 2px 6px; overflow: hidden; cursor: grab; }
.cal-slot .ev b { font-size: 12px; }
.cal-slot .ev-train { background: #fef3c7; color: #92400e; }

/* notes */
.note { border-left: 3px solid var(--accent); padding: 8px 12px; margin: 10px 0; background: #fafbfc; border-radius: 0 10px 10px 0; }
.note .meta { font-size: 13px; color: var(--muted); }
.note.ai { border-left-color: #7c3aed; }
.note.ai .tag { font-size: 12px; color: #7c3aed; font-weight: 700; }

/* voice panel */
#voicePanel { background: #fff; border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin: 12px 0; display: none; }
#voiceTranscript { width: 100%; min-height: 70px; font-size: 16px; }
#voiceSummary { background: #f5f3ff; border: 1px solid #ddd6fe; border-radius: 10px; padding: 12px; margin-top: 10px; }
#voiceSummary .src { font-size: 13px; color: #6d28d9; margin-top: 6px; font-style: italic; }

/* ambasadorzy tabela roczna */
.ambtab { width: 100%; border-collapse: collapse; font-size: 15px; }
.ambtab th, .ambtab td { border: 1px solid var(--border); padding: 8px 6px; text-align: center; }
.ambtab td.name { text-align: left; font-weight: 600; min-width: 160px; }
.ambtab .cur { background: #fffbeb; }
.cell-paid { background: #dcfce7 !important; color: var(--ok); font-weight: 700; cursor: pointer; }
.cell-open { color: var(--muted); cursor: pointer; }
.cell-na { background: #f3f4f6; color: #9ca3af; cursor: pointer; }
.cell-future { color: #cbd5e1; }

/* toast */
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 12px 22px; border-radius: 999px; font-size: 15px; z-index: 99; display: none; box-shadow: 0 4px 16px rgba(0,0,0,.25); }
#toast a { color: #93c5fd; margin-left: 10px; }

/* modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: none; align-items: center; justify-content: center; z-index: 50; }
.modal.open { display: flex; }
.modal .box { background: var(--card); border-radius: var(--radius); padding: 20px; max-width: 480px; width: 92%; max-height: 85vh; overflow: auto; }

/* contact card big layout */
.ccard-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.ccard-name { font-size: 24px; font-weight: 700; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.big-note textarea { min-height: 110px; font-size: 16px; }
.detail-toggle { background: none; border: none; color: var(--accent); cursor: pointer; font-size: 15px; padding: 0; }
#contactDetails { display: none; margin-top: 10px; }
#contactDetails.open { display: block; }
.linklike { background: none; border: none; padding: 0; font: inherit; color: var(--accent); cursor: pointer; }

#editContract { display: none; }
#editContract.open { display: block; }

.ev-mentor { background: #ede9fe; color: #5b21b6; }

/* ===== Kalendarz miesięczny (pełna siatka 6x7) ===== */
.cal-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-bottom: 1px solid var(--border); background: #fafbfc; }
.cal-toolbar .cal-title { font-weight: 700; font-size: 20px; margin-right: auto; }
.cal-cell.cal-blank { background: #fafbfc; cursor: default; }
.cal-cell.has-conv { background: var(--accent-soft); }
.cal-cell.today { background: #fffbeb; box-shadow: inset 0 0 0 2px var(--accent); }
.cal-daynum { font-size: 15px; }
.cal-todaytag { float: right; font-size: 11px; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .03em; }
.cal-cell .ev-conv { background: var(--accent); color: #fff; font-weight: 600; cursor: default; }
.cal-cell .ev-conv b { font-weight: 700; }
.cal-cell .task b { font-weight: 700; }
@media (max-width: 760px) {
  .cal-head { font-size: 11px; padding: 5px 2px; }
  .cal-cell { min-height: 64px; font-size: 11px; padding: 4px; }
  .cal-toolbar .cal-title { font-size: 17px; }
}

/* =========================================================================
   PRZEBIEG WYGLĄDU (design pass) — rytm odstępów, hierarchia typografii,
   czytelne listy i tabele, jedna akcja główna, telefon, dostępność.
   Zasady: wyłącznie reguły wyglądu (układ informacji i nazwy klas z PHP bez
   zmian), kolory i skala z istniejącej palety (--card/--border/--accent/
   --warn/--bad/--radius). Ciemniejsze odcienie badge (green-700/amber-800/
   blue-700) są już używane w tym arkuszu i poprawiają kontrast treści.
   ========================================================================= */
:root { --card-pad: 16px; --gap: 14px; }

/* --- 1. Rytm odstępów: jednolity padding kart i odstępy sekcji --- */
.card { padding: var(--card-pad); margin-bottom: var(--gap); }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.card > h2 { margin-bottom: 10px; }
.grid2, .grid3 { gap: var(--gap); }
h3 { font-size: 17px; font-weight: 700; margin: 16px 0 6px; }

/* --- 2. Hierarchia typografii: tytuł / etykieta / treść; liczby i daty czytelne --- */
h1 { letter-spacing: -0.01em; }
.today-item .time, .badge, .cal-daynum, .kcard .due,
.card table td, .card table th { font-variant-numeric: tabular-nums; }
.today-item .time { color: var(--fg); white-space: nowrap; }
.badge { white-space: nowrap; vertical-align: middle; }

/* --- 3. Karty: jedna akcja główna (primary), akcje drugorzędne ciche --- */
.btn { transition: background .12s ease, border-color .12s ease, color .12s ease; }
.btn:not(.primary):not(.danger):not(.mic):hover { border-color: var(--accent); color: var(--accent); background: #fff; }
.btn.primary { box-shadow: 0 1px 2px rgba(37, 99, 235, .25); }
.btn.danger { box-shadow: 0 1px 2px rgba(220, 38, 38, .25); }
.btn:active { transform: translateY(1px); }

/* --- 4. Stan „zaległe / uwaga” w kolorze ostrzeżenia z palety --- */
.today-item.overdue { background: rgba(220, 38, 38, .045); border-radius: 8px; padding-left: 10px; }
.today-item.overdue .time { font-weight: 700; }

/* --- 5. Listy (Dziś / Zadania / Do odzyskania): równa wysokość wierszy, czytelne kolumny --- */
.today-item { align-items: center; min-height: 44px; }
.today-item .act { display: inline-flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.today-item:hover { background: #fafbfc; }
/* telefon = wyraźny, klikalny element — bez konkurowania z akcją główną */
a[href^="tel:"] { color: var(--accent); font-weight: 600; text-decoration: underline;
  text-underline-offset: 2px; }
a.btn[href^="tel:"] { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent); }
a.btn[href^="tel:"]::before { content: "📞\00a0"; }
a[href^="tel:"]:hover { color: #1d4ed8; }

/* --- 6. Tabele: czytelne nagłówki, zebra bez „wibracji”, liczby wyrównane --- */
.card table { width: 100%; border-collapse: collapse; font-size: 15px; }
.card table th { background: #f3f4f6; color: var(--fg); font-weight: 700; text-align: left;
  padding: 9px 10px; border-bottom: 2px solid var(--border); white-space: nowrap; }
.card table td { padding: 9px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.card table tbody tr:nth-child(even) { background: #fafbfc; }
.card table tbody tr:hover { background: var(--accent-soft); }

/* --- 7. Widżet Mentora: spójny z kartami (nagłówek / dymek / pole pytania) --- */
.mc-compose .btn { min-height: 40px; }
.mc-body { font-size: 14.5px; }

/* --- 8. Dostępność: widoczny focus przy klawiaturze, kontrast, ograniczenie ruchu --- */
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
summary { cursor: pointer; }
.badge.blue { background: var(--accent-soft); color: #1d4ed8; }
.badge.green { color: #15803d; }
.badge.amber { color: #92400e; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* --- 9. Telefon (< 600 px): jednokolumnowo, bez poziomego przewijania, tabele jako bloki --- */
@media (max-width: 600px) {
  body { overflow-x: hidden; }
  .wrap { padding: 0 12px 48px; }
  h1 { font-size: 22px; }
  h2 { font-size: 18px; }
  .topnav { gap: 2px; padding: 0 8px; }
  .topnav .brand { font-size: 16px; padding: 10px 6px; }
  .topnav a.nav, .navdrop > button { min-height: 44px; display: inline-flex; align-items: center; padding: 10px 12px; }
  /* pola dotyku min. 44 x 44 px */
  .btn, .btn.small { min-height: 44px; display: inline-flex; align-items: center; padding: 10px 14px; }
  /* akcje schodzą pod treść wiersza i zajmują pełną szerokość */
  .today-item { align-items: flex-start; flex-wrap: wrap; }
  .today-item .time { flex: 0 0 auto; }
  .today-item .act { margin-left: 0; flex: 1 0 100%; justify-content: flex-start; }
  /* szerokie macierze (rok ambasadorów) — przewijanie tylko wewnątrz karty, strona bez ruchu */
  .ambtab { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; white-space: nowrap; }
  /* pozostałe tabele: układ karta-na-wiersz; nagłówki zostają dla czytników ekranu */
  .card table:not(.ambtab) { display: block; }
  .card table:not(.ambtab) thead { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); border: 0; }
  .card table:not(.ambtab) tbody tr { display: block; border: 1px solid var(--border); border-radius: 10px;
    padding: 8px 10px; margin-bottom: 8px; background: #fff; }
  .card table:not(.ambtab) tbody tr:nth-child(even) { background: #fff; }
  .card table:not(.ambtab) tbody td { display: flex; justify-content: space-between; gap: 12px;
    padding: 4px 0; border: none; text-align: right; }
  .card table:not(.ambtab) tbody td:first-child { font-weight: 700; text-align: left; }
  .card table:not(.ambtab) tbody td::before { content: attr(data-label); color: var(--muted);
    font-weight: 600; font-size: 13px; }
}

/* =========================================================================
   r64 (2026-10-08): tablica „Sprzedaż” — sekcje rozmów + ramki + naprawy
   ========================================================================= */
/* sekcje rozmów i karty */
.sales-h2 { font-size: 17px; font-weight: 700; margin: 18px 0 6px; }
.card.sales-menu, .card.sales-data { border-color: var(--border-strong); }
.sales-menu { box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.sales-menu .btn:not(.primary):not(.danger) { border: 1px solid var(--border-strong); }
.sales-data { box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.sales-list { display: flex; flex-direction: column; gap: 8px; }
.rcard { background: var(--card); border: 1px solid var(--border-strong); border-radius: 10px; padding: 10px 12px; box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.rc-main { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.rc-main b { font-size: 15px; }
.rc-main a { text-decoration: none; }
.rc-meta { margin-top: 4px; }
.rc-details { margin-left: auto; }
.badge.stage { background: var(--accent-soft); color: var(--accent); }
.badge.amber { background: #fef3c7; color: #92400e; }
.badge.red { background: #fee2e2; color: #991b1b; }
.badge.gray { background: #e5e7eb; color: #374151; }

/* kanban (stary widok): wyraźne ramki, nagłówek bez nachodzenia liczników */
.kcol .kcard { border: 1px solid var(--border-strong); box-shadow: 0 1px 2px rgba(0,0,0,.04); }
.kcol-head { gap: 8px; flex-wrap: wrap; }
.kcol-head .muted { margin-left: auto; white-space: nowrap; font-size: 13px; }
/* menu „Zmień etap”: zamiast długiej listy rozwijany szczegół — nie rozciąga karty */
.kstage-btns { flex-direction: column; align-items: stretch; gap: 4px; margin-top: 6px; }
.kstage-btns .btn { border: 1px solid var(--border-strong); }

/* nawigacja: mniejsza wysokość, nie zasłania treść */
.topnav a.nav { padding: 8px 12px; font-size: 15px; }
.topnav .brand { padding: 8px; font-size: 16px; }
body { padding-bottom: 84px; } /* widżet Mentora (fixed, prawy dolny róg) nie zasłania działań */
