/* 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}
}
