/* TOMŻAL CRM 5.4.394 — poprawki spójności i czytelności (przegląd wszystkich zakładek na: 1920, 1366, 1280, tablet 1024/800, telefon 390).
   Plik ładowany jako ostatni — tylko poprawki wyglądu, bez zmian w działaniu. */

/* Kalendarz → „Plan na dziś”: na tablecie i małym laptopie przyciski zabierały całą szerokość, a nazwisko/adres klienta
   kurczyły się do 0 px i były zasłonięte przyciskami. Teraz przyciski są w osobnym wierszu pod danymi klienta. */
@media (min-width:701px) and (max-width:1280px){
 .today-plan-item{grid-template-columns:70px minmax(0,1fr)!important;align-items:start!important}
 .today-plan-actions{grid-column:1/-1!important;display:grid!important;grid-template-columns:repeat(auto-fill,minmax(150px,1fr))!important;gap:7px!important}
 .today-plan-actions .btn{width:100%!important;min-width:0!important;white-space:normal}
 .today-plan-actions .btn.gold,.today-plan-actions .btn.primary{grid-column:auto!important}
}

/* Umowy: na laptopach/tabletach przyciski w wierszu (Zaliczka, Podpisana, Potwierdzenie odbioru, Podgląd/PDF…) były w jednej
   linii na 550 px — tabela wychodziła poza kartę i „Podgląd / PDF” chował się za krawędzią. Teraz przyciski układają się w siatkę. */
@media (min-width:761px) and (max-width:1680px){
 #content .tablewrap .contract-row-actions{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;gap:6px!important;max-width:340px;min-width:240px;white-space:normal!important}
 #content .tablewrap .contract-row-actions>*{width:100%!important;min-width:0!important;justify-content:center;white-space:normal!important;text-align:center}
 #content .tablewrap .contract-row-actions .btn{padding-left:8px!important;padding-right:8px!important}
}

/* Zrealizowane: sztywne minimalne szerokości kolumn (razem ~1085 px) wypychały tabelę poza ekran na laptopach i tabletach */
@media (min-width:761px) and (max-width:1680px){
 .completed-workflow-card .completed-active-table td,.completed-workflow-card .completed-active-table th{min-width:0!important}
 .completed-workflow-card .completed-active-table td:nth-child(1),.completed-workflow-card .completed-active-table th:nth-child(1){min-width:140px!important}
 .completed-workflow-card .completed-active-table td:nth-child(2),.completed-workflow-card .completed-active-table th:nth-child(2){min-width:130px!important}
 .completed-workflow-card .completed-active-table td:last-child{white-space:normal!important;min-width:170px!important}
 .completed-workflow-card .completed-active-table td:last-child .row-actions{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:6px;white-space:normal!important}
 .completed-workflow-card .completed-active-table td:last-child .row-actions .btn{width:100%;min-width:0!important;white-space:normal}
 .completed-workflow-card .completed-active-table{min-width:0!important}
}
/* Zrealizowane na telefonie i tablecie w pionie: zamiast tabeli przewijanej w bok — karty (jak w Sprawach) */
@media (max-width:900px){
 .completed-workflow-card .completed-active-table,.completed-workflow-card .completed-active-table tbody,.completed-workflow-card .completed-active-table tr,.completed-workflow-card .completed-active-table td{display:block!important;width:auto!important;min-width:0!important;max-width:none!important;white-space:normal!important}
 .completed-workflow-card .completed-active-table thead{display:none!important}
 .completed-workflow-card .completed-active-table tr{border:1px solid #E3E8EF;border-radius:14px;background:#fff;margin:0 0 10px;padding:6px 0}
 .completed-workflow-card .completed-active-table td{border:0!important;padding:6px 12px!important}
 .completed-workflow-card .completed-active-table td:last-child .row-actions{display:grid!important;grid-template-columns:1fr 1fr;gap:6px}
 .completed-workflow-card .completed-active-table td:last-child .row-actions .btn{width:100%;min-width:0!important}
 .completed-workflow-card .tablewrap{overflow:visible!important}
}

/* Wyceny: na tabletach (pion i poziom, do 1100 px) karty zamiast ściśniętej tabeli */
@media (min-width:761px) and (max-width:1100px){
 #content .qd-page .qd-tablewrap{border:0!important;overflow:visible!important;margin:0 14px 14px!important}
 #content .qd-page .qd-table,#content .qd-page .qd-table tbody,#content .qd-page .qd-table tr,#content .qd-page .qd-table td{display:block;width:auto!important;min-width:0!important}
 #content .qd-page .qd-table thead{display:none}
 #content .qd-page .qd-table tr{border:1px solid #E3E8EF;border-radius:14px;background:#fff;margin:0 0 10px;padding:8px 2px}
 #content .qd-page .qd-table td{border:0!important;padding:5px 14px;display:grid;grid-template-columns:150px 1fr;gap:10px;align-items:start}
 #content .qd-page .qd-table td::before{content:attr(data-l);font-size:11.5px;font-weight:800;color:#64748B;text-transform:uppercase;letter-spacing:.03em;padding-top:2px}
 #content .qd-page .qd-table td.qd-c-quote{grid-template-columns:1fr}
 #content .qd-page .qd-table td.qd-c-quote::before{display:none}
 #content .qd-page .qd-table td>*{justify-self:start;grid-column:2}
 #content .qd-page .qd-table td.qd-c-quote>*{grid-column:1}
 #content .qd-page .qd-c-sum{text-align:left}
}
/* Wyceny: status nie może się uciąć (było „Przypisana do kli…”) */
.qd-table .qd-c-st .qd-badge{white-space:normal}
@media (min-width:761px) and (max-width:1680px){
 #content .completed-workflow-card .completed-active-table{min-width:0!important}
 #content .completed-workflow-card .completed-active-table td:nth-child(3),#content .completed-workflow-card .completed-active-table th:nth-child(3){min-width:130px!important}
 #content .completed-workflow-card .completed-active-table td:nth-child(4),#content .completed-workflow-card .completed-active-table th:nth-child(4){min-width:120px!important}
 #content .completed-workflow-card .completed-active-table td:nth-child(5),#content .completed-workflow-card .completed-active-table th:nth-child(5){min-width:110px!important}
 #content .completed-workflow-card .completed-active-table td:last-child .row-actions{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr))!important;flex-wrap:wrap!important}
}
@media (min-width:761px) and (max-width:900px){ #content .tablewrap table.table{min-width:0!important} }
@media (min-width:761px) and (max-width:900px){
 #content .tablewrap .contract-row-actions{grid-template-columns:1fr!important;min-width:150px!important;max-width:190px}
}
@media (min-width:761px) and (max-width:1280px){
 #content .completed-workflow-card .completed-active-table td:nth-child(1),#content .completed-workflow-card .completed-active-table th:nth-child(1){min-width:120px!important}
}
@media (min-width:761px) and (max-width:1280px){ #content .completed-workflow-card .completed-active-table td:last-child{min-width:150px!important} #content .completed-workflow-card .completed-active-table td,#content .completed-workflow-card .completed-active-table th{padding-left:10px!important;padding-right:10px!important} }

@media (min-width:761px) and (max-width:900px){
 #content .completed-workflow-card .completed-active-table td{display:block!important;min-width:0!important;width:auto!important}
 #content .completed-workflow-card .completed-active-table td:last-child .row-actions{display:grid!important;grid-template-columns:repeat(4,minmax(0,1fr))!important;width:100%!important}
 #content .completed-workflow-card .completed-active-table td:last-child .row-actions .btn{width:100%!important;white-space:normal!important}
}

/* Przełączniki zakładek na telefonie — wszędzie tak samo jak w Klientach: obok siebie, w jednym zaokrąglonym pasku
   (wcześniej w Umowach i Zrealizowanych „Aktywne / Archiwum” stały jeden pod drugim na całą szerokość) */
@media (max-width:760px){
 #content .contract-tabs,#content .customer-tabs{display:flex!important;flex-wrap:nowrap!important;gap:4px!important;padding:4px!important;border-radius:14px!important;background:#F1F4F8!important;width:100%!important;box-sizing:border-box}
 #content .contract-tabs>.btn,#content .customer-tabs>.btn{flex:1 1 auto!important;width:auto!important;min-width:0!important;min-height:40px!important;margin:0!important;padding:8px 8px!important;font-size:14px!important;white-space:nowrap!important;border-radius:10px!important;box-shadow:none!important;display:inline-flex!important;align-items:center;justify-content:center;gap:6px}
 #content .contract-tabs>.btn.soft,#content .customer-tabs>.btn.soft{background:transparent!important;border-color:transparent!important}
}

/* Sprawy / Zrealizowane: w wąskich kolumnach akcji napisy („📞 Zadzwoń”, „Usuń klienta”) były ucinane — teraz mogą się złamać */
#content .row-actions.workflow-actions .btn{white-space:normal!important;min-width:0!important;padding-left:6px!important;padding-right:6px!important;line-height:1.2!important;overflow-wrap:anywhere}

@media (min-width:761px) and (max-width:1100px){
 #content .qd-page .qd-table tbody{display:grid!important;grid-template-columns:repeat(auto-fill,minmax(340px,1fr));gap:10px}
 #content .qd-page .qd-table tr{margin:0!important}
}

/* 5.4.395: Klienci na TABLECIE (pion i poziom) — wcześniej kolumna Akcje przestawała być komórką tabeli:
   wiersze kończyły się w połowie szerokości, przyciski nie stały pod „AKCJE”, a „Mój klient” łamał nazwisko. */
@media (min-width:601px) and (max-width:1400px){
 html.crm-mobile-device .customer-list-card .table{width:100%!important;table-layout:auto}
 html.crm-mobile-device .customer-list-card .table tr[data-customer-id]>td{vertical-align:top!important;padding-top:14px!important;padding-bottom:14px!important}
 html.crm-mobile-device .customer-list-card .table tr[data-customer-id]>td:last-child,
 html.crm-mobile-device .customer-list-card .table thead th:last-child{display:table-cell!important;width:250px!important;min-width:230px!important;text-align:left!important;white-space:normal!important}
 html.crm-mobile-device .customer-list-card .table tr[data-customer-id]>td:last-child .customer-actions{width:100%!important}
 html.crm-mobile-device .customer-list-card .table tr[data-customer-id] .ui-row-actions{display:grid!important;grid-template-columns:1fr 1fr!important;gap:6px!important;width:100%!important}
 html.crm-mobile-device .customer-list-card .table tr[data-customer-id] .ui-row-actions>.btn.ui-act{width:100%!important;min-width:0!important;min-height:40px!important;justify-content:center}
 html.crm-mobile-device .customer-list-card .table tr[data-customer-id] .ui-row-actions>.ui-more-btn{grid-column:1/-1}
 /* nazwisko w jednej linii, „Mój klient” jako mała plakietka nad nim */
 html.crm-mobile-device .customer-list-card .table tr[data-customer-id]>td:first-child>b{display:block;font-size:15px;line-height:1.3}
 html.crm-mobile-device .customer-list-card .table tr[data-customer-id] .my-client-badge{display:inline-block;margin:0 0 5px;font-size:11px;padding:2px 8px}
 html.crm-mobile-device .customer-list-card .table tr[data-customer-id]>td:first-child .ui-status{margin-top:6px}
 html.crm-mobile-device .customer-list-card .table tr[data-customer-id]>td:nth-child(2){font-size:14px;line-height:1.4}
 /* pasek nad listą: wyszukiwarka z „Szukaj” w jednej linii, przyciski obok siebie */
 html.crm-mobile-device .customer-list-card .customer-toolbar{display:flex!important;flex-wrap:wrap!important;align-items:center;gap:10px!important}
 html.crm-mobile-device .customer-list-card .customer-toolbar>#search{order:1;flex:1 1 300px!important;width:auto!important;min-width:0}
 html.crm-mobile-device .customer-list-card .customer-toolbar>#customerSearchButton{order:2;flex:0 0 auto!important;width:auto!important}
 html.crm-mobile-device .customer-list-card .customer-toolbar>.customer-tabs{order:3;flex:0 0 auto!important;width:auto!important}
 html.crm-mobile-device .customer-list-card .customer-toolbar>.btn.primary{order:4;flex:0 0 auto!important;width:auto!important}
 html.crm-mobile-device .customer-list-card .customer-toolbar>.inne-sprawy-btn{order:5;flex:0 0 auto!important;width:auto!important}
 html.crm-mobile-device .customer-list-card .customer-toolbar>.customer-sort-field{order:6;flex:0 0 auto!important;margin-left:auto}
}
@media (min-width:601px) and (max-width:1400px){
 html.crm-mobile-device .customer-list-card .table tr[data-customer-id]>td:first-child,html.crm-mobile-device .customer-list-card .table thead th:first-child{width:auto!important;max-width:none!important;min-width:180px}
 html.crm-mobile-device .customer-list-card .table tr[data-customer-id]>td:nth-child(2),html.crm-mobile-device .customer-list-card .table thead th:nth-child(2){width:32%!important;max-width:none!important}
 html.crm-mobile-device .customer-list-card .table tr[data-customer-id]>td:last-child,html.crm-mobile-device .customer-list-card .table thead th:last-child{width:270px!important;min-width:240px!important;max-width:290px!important}
}
@media (min-width:601px) and (max-width:1400px){ html.crm-mobile-device .customer-list-card .table{table-layout:fixed!important} }
@media (min-width:601px) and (max-width:1400px){
 html.crm-tablet-device body[data-crm-view] #content .customer-list-card:not(.archive-mode) .table{table-layout:fixed!important;width:100%!important}
 html.crm-tablet-device body[data-crm-view] #content .customer-list-card:not(.archive-mode) .table th:nth-child(1),
 html.crm-tablet-device body[data-crm-view] #content .customer-list-card:not(.archive-mode) .table tr[data-customer-id]>td:nth-child(1){width:40%!important;min-width:0!important;max-width:none!important}
 html.crm-tablet-device body[data-crm-view] #content .customer-list-card:not(.archive-mode) .table th:nth-child(2),
 html.crm-tablet-device body[data-crm-view] #content .customer-list-card:not(.archive-mode) .table tr[data-customer-id]>td:nth-child(2){width:27%!important;min-width:0!important;max-width:none!important}
 html.crm-tablet-device body[data-crm-view] #content .customer-list-card:not(.archive-mode) .table th:last-child,
 html.crm-tablet-device body[data-crm-view] #content .customer-list-card:not(.archive-mode) .table tr[data-customer-id]>td:last-child{width:33%!important;min-width:0!important;max-width:none!important}
}
@media (min-width:1100px) and (max-width:1400px){
 html.crm-tablet-device body[data-crm-view] #content .customer-list-card:not(.archive-mode) .table th:nth-child(1),
 html.crm-tablet-device body[data-crm-view] #content .customer-list-card:not(.archive-mode) .table tr[data-customer-id]>td:nth-child(1){width:42%!important}
 html.crm-tablet-device body[data-crm-view] #content .customer-list-card:not(.archive-mode) .table th:last-child,
 html.crm-tablet-device body[data-crm-view] #content .customer-list-card:not(.archive-mode) .table tr[data-customer-id]>td:last-child{width:30%!important}
}
@media (min-width:601px) and (max-width:1400px){
 html.crm-tablet-device body[data-crm-view] #content .customer-list-card .customer-toolbar>#search{order:1!important;flex:1 1 320px!important;width:auto!important;max-width:none!important;min-width:0!important}
 html.crm-tablet-device body[data-crm-view] #content .customer-list-card .customer-toolbar>#customerSearchButton{order:2!important;flex:0 0 auto!important;width:auto!important}
 html.crm-tablet-device body[data-crm-view] #content .customer-list-card .customer-toolbar>.customer-tabs{order:3!important}
 html.crm-tablet-device body[data-crm-view] #content .customer-list-card .customer-toolbar>.btn.primary{order:4!important}
 html.crm-tablet-device body[data-crm-view] #content .customer-list-card .customer-toolbar>.inne-sprawy-btn{order:5!important}
 html.crm-tablet-device body[data-crm-view] #content .customer-list-card .customer-toolbar>.customer-sort-field{order:6!important;margin-left:auto!important}
}
@media (min-width:601px) and (max-width:1400px){
 html.crm-tablet-device body[data-crm-view] #content .customer-list-card .customer-toolbar>#search{flex:1 1 calc(100% - 130px)!important}
}

/* 5.4.402: Wyceny na tablecie — przycisk „Usuń” w sekcji Akcje ma wyglądać jak prawa kolumna,
   podobnie jak akcje na liście Klientów. Bez zmian działania i bez wpływu na komputery. */
@media (min-width:761px) and (max-width:1100px){
 #content .qd-page .qd-table td.qd-c-actions{display:grid!important;grid-template-columns:150px minmax(0,1fr)!important;gap:10px!important;align-items:center!important}
 #content .qd-page .qd-table td.qd-c-actions::before{align-self:center!important;padding-top:0!important}
 #content .qd-page .qd-table td.qd-c-actions .qd-remove-btn{grid-column:2!important;justify-self:end!important;min-width:108px!important}
}
@media (min-width:601px) and (max-width:760px){
 html.crm-tablet-device #content .qd-page .qd-table td.qd-c-actions{display:grid!important;grid-template-columns:118px minmax(0,1fr)!important;gap:8px!important;align-items:center!important}
 html.crm-tablet-device #content .qd-page .qd-table td.qd-c-actions::before{align-self:center!important;padding-top:0!important}
 html.crm-tablet-device #content .qd-page .qd-table td.qd-c-actions .qd-remove-btn{grid-column:2!important;justify-self:end!important;min-width:100px!important}
}
/* 6.0.0: wygląd Wyceny na tablecie przeniesiony do assets/wyceny-tablet-6.0.0.css */

/* 6.0.9: „＋ Dodaj kolejny produkt” (Notatka klienta, umowa) — zwykły przycisk pod listą produktów, nie przyklejony
   do dołu ekranu (zasłaniał pola „Uwagi wewnętrzne” i „Usuń” przy przewijaniu na telefonie). */
.contract-add-product,.contract-products-card .contract-add-product{position:static!important;bottom:auto!important;z-index:auto!important;box-shadow:none!important}
