/* Schedule (Grafik) view — read-only staff availability */

.schedule-day-view .schedule-day-block {
    margin-bottom: 16px;
    border: 1px solid #ddd;
    border-radius: 4px;
}
.schedule-day-header {
    background: #f7f7f7;
    padding: 8px 12px;
    font-weight: bold;
    border-bottom: 1px solid #ddd;
}
.schedule-day-header.schedule-today { background: #e8f4fd; color: #337ab7; }
.schedule-row {
    padding: 6px 12px;
    border-bottom: 1px solid #eee;
    cursor: pointer;
}
.schedule-row:last-child { border-bottom: none; }
.schedule-row:hover { background: #f5f5f5; }
.schedule-row.unavailable { background: #fbeded; }
.schedule-row.unavailable:hover { background: #f5dada; }

/* Week view */
.schedule-week-table th, .schedule-week-table td {
    vertical-align: middle;
    text-align: center;
}
.schedule-week-table .schedule-staff-col {
    text-align: left;
    width: 180px;
}
/* Naglowek dnia w tygodniu: nazwa dnia i data w jednym, duzym rozmiarze (2026-09-07). */
.schedule-week-table th.schedule-week-day-head { padding-top: 8px; padding-bottom: 8px; }
.schedule-week-day-name { font-size: 17px; font-weight: bold; }
.schedule-week-day-date { font-size: 17px; font-weight: 600; margin-left: 4px; }
.schedule-week-table th.schedule-today {
    background: #e8f4fd;
    color: #337ab7;
}
.schedule-cell-available { background: #eafbea; }
.schedule-cell-available:hover { background: #d5f4d5; }
.schedule-cell-busy { background: #fbeded; }
.schedule-cell-busy:hover { background: #f5dada; }

/* Month view */
.schedule-month-table {
    table-layout: fixed;
    width: 100%;
}
.schedule-month-table th, .schedule-month-table td {
    padding: 0;
    height: 92px;
    vertical-align: top;
    text-align: left;
}
/* Naglowek dni nie dziedziczy wysokosci komorek (92px nad „Pn / Wt / ..." wygladalo jak pusty
   wiersz). */
.schedule-month-table th {
    height: auto;
    padding: 8px 8px;
    vertical-align: middle;
    font-size: 15px;
}
/* Wyrazna granica miedzy dniami (jak w tygodniu): kolorowe polowki sasiednich dni nie moga sie
   zlewac przez 1px linie tabeli. */
.schedule-month-table td.schedule-month-cell { border: 2px solid #bfc4c9; }
.schedule-month-cell {
    cursor: pointer;
    padding: 4px 6px;
    position: relative;
    transition: filter 0.15s;
}
.schedule-month-cell:hover { filter: brightness(0.95); }
.schedule-month-day {
    font-size: 11px;
    color: #444;
}
.schedule-month-count {
    font-size: 22px;
    font-weight: bold;
    text-align: center;
    line-height: 1.1;
    margin-top: 8px;
    color: #2c3e50;
}
.schedule-other-month { opacity: 0.35; }
.schedule-today {
    box-shadow: inset 0 0 0 2px #337ab7;
}
/* Komorka miesiaca: polowki zmian (.schedule-cell-shifts, position:absolute) malowaly sie NAD
   wewnetrznym cieniem td i zaslanialy ramke „dzis" — ramka idzie wiec jako nakladka ::after
   ponad polowkami; pointer-events:none, zeby nie przechwytywala klikniec ani tooltipa. */
.schedule-month-cell.schedule-today { box-shadow: none; }
.schedule-month-cell.schedule-today::after {
    content: '';
    position: absolute;
    top: 0; right: 0; bottom: 0; left: 0;
    border: 2px solid #337ab7;
    pointer-events: none;
    z-index: 2;
}
.schedule-month-cell.schedule-today .schedule-month-day { color: #337ab7; font-weight: bold; }

/* Count-based palette (configurable thresholds: red / orange / yellow / green) */
.sched-red { background-color: #f5c6cb; }
.sched-orange { background-color: #ffdfa8; }
.sched-yellow { background-color: #fff3b0; }
.sched-green { background-color: #c8e6c9; }

.schedule-legend {
    margin-top: 12px;
    display: flex;
    gap: 16px;
    align-items: center;
    font-size: 12px;
    color: #666;
}
.schedule-legend .swatch {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 1px solid #ccc;
    border-radius: 2px;
    margin-right: 4px;
    vertical-align: middle;
}

/* Year view */
/* Rok: kafelki miesiecy w rzedzie flex — jako plywajace kolumny Bootstrapa zaczepialy sie o wyzszy
   miesiac (5 vs 6 tygodni) i zawijaly sie po jednym w rzedzie (2026-09-07). Szerokosci nadal z
   col-md-3 / col-sm-4 / col-xs-6 (float jest ignorowany dla elementow flex, width zostaje). */
.schedule-year-view .row {
    display: flex;
    flex-wrap: wrap;
}
.schedule-year-view .row > [class*="col-"] { float: none; display: flex; }
.schedule-year-month {
    background: #fafafa;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 6px;
    margin-bottom: 12px;
    width: 100%;
}
/* Telefon: miesiace jeden pod drugim (pelna szerokosc zamiast dwoch kolumn col-xs-6), kratki
   dni wyzsze pod dotyk (2026-09-07). */
@media (max-width: 767px) {
    .schedule-year-view .row > [class*="col-"] { width: 100%; }
    .schedule-year-month { padding: 8px 10px; }
    .schedule-year-header { font-size: 17px; }
    /* Wyzsza specyficznosc: regula ogolna .schedule-year-mini td stoi dalej w pliku. */
    .schedule-year-view .schedule-year-mini td { height: 38px; font-size: 15px; }
    .schedule-year-view .schedule-year-mini th { font-size: 13px; }
}
.schedule-year-header {
    font-weight: bold;
    text-align: center;
    color: #2c3e50;
    padding: 4px 0 6px 0;
    border-bottom: 1px solid #e0e0e0;
    margin-bottom: 4px;
}
/* Kratki dni w roku wieksze (2026-09-07): 13px zamiast 9px, wysokosc 30px, kafelek na cala
   szerokosc kolumny (4 miesiace w rzedzie na komputerze). */
.schedule-year-mini {
    width: 100%;
    font-size: 13px;
    table-layout: fixed;
    border-spacing: 2px;
    border-collapse: separate;
}
.schedule-year-mini th {
    text-align: center;
    color: #777;
    font-weight: normal;
    font-size: 12px;
    padding: 3px 0;
}
.schedule-year-mini td {
    text-align: center;
    height: 30px;
    padding: 0;
    cursor: pointer;
    border-radius: 3px;
    font-weight: 600;
}
.schedule-year-mini td:hover { filter: brightness(0.9); }
.schedule-other-month-mini { opacity: 0.25; }
.schedule-today-mini {
    outline: 2px solid #337ab7;
    outline-offset: -1px;
    font-weight: bold;
}

/* Filter bar: staff + team tiles arranged in horizontal rows above the navigation */
.schedule-filter-bar {
    background: #f9fafb;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 6px 10px;
    margin-bottom: 10px;
}
.schedule-filter-summary {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #444;
    flex-wrap: wrap;
}
.schedule-filter-toggle { padding: 1px 6px; }
.schedule-filter-actions {
    margin-left: auto;
    font-size: 12px;
}
.schedule-filter-actions a {
    color: #337ab7;
    text-decoration: underline;
}
.schedule-filter-section {
    margin-top: 6px;
    display: flex;
    align-items: flex-start;
    gap: 8px;
}
.schedule-filter-label {
    flex: 0 0 130px;
    font-size: 12px;
    color: #666;
    padding-top: 14px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.schedule-tile-row-wrap {
    flex: 1;
    min-width: 0;
}
.schedule-tile-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    min-width: 0;
}
/* „Wiecej (n)" / „Mniej" pod zwinietym rzedem kafelkow. */
.schedule-tile-row-toggle {
    display: inline-block;
    margin-top: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}
/* Kafelki filtrow (lekarze/technicy, zespoly, obiekty) — wieksze niz w kalendarzu (2026-09-07):
   awatar 38px, nazwa 14px, wysokosc ~58px; olowek edycji jest WIDOCZNY na stale w prawym gornym
   rogu (wczesniej tylko po najechaniu), kafelek z olowkiem rezerwuje na niego miejsce z prawej. */
.schedule-tile {
    margin-bottom: 0;
    cursor: pointer;
    min-width: 200px;
    max-width: 280px;
    min-height: 58px;
    padding: 9px 10px;
    gap: 10px;
    font-size: 13px;
}
.schedule-tile:has(.schedule-tile-edit:not(.ng-hide)) { padding-right: 36px; }
.schedule-tile .calendar-tile-avatar {
    flex: 0 0 38px;
    width: 38px;
    height: 38px;
    line-height: 38px;
    font-size: 13px;
}
.schedule-tile .calendar-tile-name { font-size: 14px; }
.schedule-tile .calendar-tile-sub { font-size: 12px; }

/* Custom tooltip class so newlines in getDayTooltip() render as breaks */
.schedule-day-tooltip .tooltip-inner {
    white-space: pre-line;
    text-align: left;
    max-width: 320px;
    line-height: 1.4;
    padding: 8px 10px;
}

@media (max-width: 768px) {
    .schedule-filter-section {
        flex-direction: column;
        gap: 4px;
    }
    .schedule-filter-label {
        flex: 0 0 auto;
        padding-top: 0;
    }
    .schedule-tile {
        flex: 1 1 45%;
        min-width: 150px;
        max-width: none;
    }
}

/* ===== Split day tile: two shift halves (rano / popołudnie) ===== */
.schedule-cell-shifts {
    position: absolute;
    top: 22px;
    /* Wciecie i zaokraglenie: kazdy dzien jest osobnym kafelkiem z bialym marginesem (2026-09-07). */
    left: 4px;
    right: 4px;
    bottom: 4px;
    border-radius: 5px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.schedule-shift-half {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-size: 17px;
    font-weight: bold;
    color: #2c3e50;
    border-top: 1px dashed rgba(0,0,0,0.12);
}
.schedule-shift-half:first-child { border-top: none; }
/* Ikony slonca / ksiezyca jak w tygodniu (2026-09-07). */
.schedule-shift-half .fa { font-size: 19px; opacity: 0.85; }

/* Person mode: month cell shows the selected person's day status */
/* Tryb jednej osoby (2026-09-07): blok stanu wypelnia komorke jak .schedule-cell-shifts —
   ikona 19px + etykieta 15px, dyzur 12px pod spodem; wczesniej 11px na pasku pod numerem dnia. */
.schedule-cell-person {
    position: absolute;
    top: 22px;
    left: 4px;
    right: 4px;
    bottom: 4px;
}
.schedule-person-status {
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 4px;
    border-radius: 5px;
    font-size: 15px;
    font-weight: bold;
    color: #2c3e50;
    text-align: center;
    overflow: hidden;
}
.schedule-person-icon { font-size: 19px; opacity: 0.85; }
.schedule-person-text { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.schedule-person-duty {
    font-size: 12px;
    font-weight: 600;
    color: #8a6d3b;
    white-space: nowrap;
}
@media (max-width: 767px) {
    .schedule-person-status { font-size: 11px; gap: 0; }
    .schedule-person-icon { font-size: 15px; }
    .schedule-person-duty { font-size: 10px; }
}
.person-work { background-color: #c8e6c9; }
.person-work-morning { background-color: #ffe9a8; }
.person-work-afternoon { background-color: #cfe2ff; }
.person-off { background-color: #e2e3e5; }
/* Urlop: pomarańcz — poprzedni blady turkus (#bee5eb) zlewał się z zielenią „obu zmian"
   i błękitem „popołudnia". Ten sam odcień w pędzlach (.brush-vacation) i komórkach edytora
   (.sday-vacation) niżej. */
.person-vacation { background-color: #ffb570; }
.person-l4 { background-color: #f5c6cb; }
.person-res { background-color: #e8d5f2; }

.schedule-person-banner {
    background: #f0f7ff;
    border: 1px solid #cfe2ff;
    border-radius: 4px;
    padding: 8px 12px;
    margin-bottom: 10px;
    font-size: 13px;
}

/* Week view: per-shift chips */
.schedule-th-counts {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 15px;
    font-weight: bold;
}
.schedule-th-count {
    padding: 3px 10px;
    border-radius: 10px;
    border: 1px solid rgba(0,0,0,0.08);
}
.schedule-th-count .fa { font-size: 14px; margin-right: 2px; }
/* Tydzien, wiersz pracownika (2026-09-07): komorka wypelniona stanem dnia jak w miesiacu —
   dwie polowki (rano | popoludnie), zielona = pracuje, szara = nie; nieobecnosc wypelnia cala
   komorke kolorem rodzaju (klasy .person-* z palety trybu osoby / edytora). */
/* Polowki i blok nieobecnosci sa pozycjonowane absolutnie w komorce (jak .schedule-cell-shifts w
   miesiacu): wysokosc wiersza nadaje kolumna „Pracownik", a wypelnienie ma siegac calej komorki
   niezaleznie od niej. height na td dziala jak minimum. */
.schedule-week-table td.schedule-week-cell {
    padding: 0;
    vertical-align: middle;
    position: relative;
    height: 60px;
    /* Wyrazna granica miedzy dniami: bez niej popoludnie jednego dnia zlewalo sie z rankiem
       nastepnego (dwa zielone bloki stykaly sie przez 1px linie tabeli). */
    border-left: 2px solid #bfc4c9;
    border-right: 2px solid #bfc4c9;
}
.schedule-week-halves {
    display: flex;
    position: absolute;
    /* Wciecie: kazdy dzien jest osobnym kafelkiem z bialym marginesem i zaokragleniem. */
    top: 4px; right: 4px; bottom: 4px; left: 4px;
    border-radius: 5px;
    overflow: hidden;
}
.schedule-week-half {
    flex: 1 1 0;
    min-width: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    font-size: 21px;
}
.schedule-week-half + .schedule-week-half { border-left: 1px dashed rgba(0, 0, 0, 0.15); }
.schedule-week-half.half-on { background: #c8e6c9; color: #1b5e20; }
.schedule-week-half.half-off { background: #f1f1f1; color: #b8b8b8; }
.schedule-week-half .schedule-duty-star { position: absolute; top: 4px; right: 5px; }
/* Nieobecnosc w tygodniu: jeden neutralny, kreskowany odcien (kolor = „niedostepny", rodzaj na
   ikonie i w podpisie). Cieple barwy naleza tu do progow dostepnosci w naglowku. */
.schedule-week-absent {
    background: repeating-linear-gradient(135deg, #d9dfe6 0 6px, #edf0f3 6px 12px);
    color: #3d4852;
}
.schedule-week-absent .fa { color: #2f3a45; }
.schedule-duty-star { color: #e6a817; font-size: 12px; }
.schedule-week-absent {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    position: absolute;
    top: 4px; right: 4px; bottom: 4px; left: 4px;
    border-radius: 5px;
    padding: 4px 6px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    text-align: center;
}
.schedule-week-absent .fa { font-size: 18px; }
/* Widok dnia (personel) = siatka tygodnia dla jednego dnia: dwie kolumny zmian. */
.schedule-day-table .schedule-staff-col { width: 260px; }
.schedule-day-table td.schedule-week-cell { height: 64px; }
.schedule-day-half-text { font-size: 15px; font-weight: 600; margin-left: 10px; }
.schedule-day-table .schedule-week-half { font-size: 22px; }
.schedule-day-table .schedule-week-absent { font-size: 16px; }
@media (max-width: 767px) {
    .schedule-day-table .schedule-staff-col { width: 40%; }
    .schedule-day-half-text { font-size: 13px; margin-left: 6px; }
}

/* Etykieta blokady w tygodniu OBIEKTOW (wiersz obiekt x dzien). */
.schedule-absent-label { font-size: 13px; font-weight: 600; }
.schedule-absent-label .fa { font-size: 15px; margin-right: 2px; }
.schedule-absence-note { display: block; color: #666; font-size: 12px; margin-top: 2px; }
.schedule-week-table td { vertical-align: middle; }
.schedule-staff-col .btn-link { padding: 0 4px; }

/* Day view: shift sections */
.schedule-shift-title {
    font-weight: bold;
    font-size: 12px;
    color: #555;
    padding: 6px 12px 4px 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}
.schedule-empty-note { padding: 4px 12px 8px 12px; font-size: 12px; }

/* Edit pencil on staff tiles — always visible in the top-right corner. */
.schedule-tile { position: relative; }
.schedule-tile-edit {
    position: absolute;
    top: 4px;
    right: 4px;
    padding: 3px 7px;
    font-size: 14px;
    line-height: 1;
    color: #337ab7;
    border-radius: 3px;
}
.schedule-tile-edit:hover { background: #e7f1fb; color: #23527c; }

/* ===== Staff schedule modal (grafik pracownika) ===== */
.schedule-modal-counters { margin-bottom: 10px; }
.schedule-modal-counters .label { margin-right: 6px; font-size: 13px; padding: 5px 8px; display: inline-block; }
/* Paleta stanow (2026-09-07): duze przyciski zamiast btn-xs — modal jest xl, wiec jest miejsce;
   aktywny pedzel: gruba niebieska ramka + znacznik w rogu. */
.schedule-brushes {
    background: #f7f7f7;
    border: 1px solid #e0e0e0;
    border-radius: 4px;
    padding: 10px 12px;
    margin-bottom: 12px;
}
.schedule-brushes-label { font-size: 13px; color: #555; margin-bottom: 8px; }
.schedule-brush-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.schedule-brush {
    position: relative;
    flex: 1 1 160px;
    max-width: 260px;
    min-height: 54px;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 30px 8px 12px;
    border: 2px solid #cfcfcf;
    border-radius: 6px;
    background: #fff;
    color: #333;
    font-size: 14px;
    text-align: left;
    white-space: normal;
    line-height: 1.2;
}
.schedule-brush:hover { filter: brightness(0.96); }
.schedule-brush-icon { font-size: 20px; width: 24px; text-align: center; flex: 0 0 24px; }
.schedule-brush-check {
    position: absolute;
    top: 5px;
    right: 7px;
    color: #337ab7;
    font-size: 15px;
}
.schedule-brush.brush-active {
    border-color: #337ab7;
    box-shadow: 0 0 0 3px rgba(51, 122, 183, 0.3);
    font-weight: bold;
}
@media (max-width: 767px) {
    .schedule-brush { flex-basis: 100%; max-width: none; min-height: 46px; }
}
.brush-work { background: #c8e6c9; }
.brush-work-m { background: #ffe9a8; }
.brush-work-a { background: #cfe2ff; }
.brush-off { background: #e2e3e5; }
.brush-vacation { background: #ffb570; }
.brush-l4 { background: #f5c6cb; }
.brush-duty { background: #fff3cd; }
.brush-clear { background: #fff; }

.schedule-modal-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin: 4px 0 10px;
    position: relative;
}
/* Duza strzalka nawigacji po okresach — wspolna dla ekranu grafiku i modalu edytora. */
.schedule-nav-btn {
    min-width: 52px;
    height: 44px;
    font-size: 22px;
    line-height: 1;
    padding: 0 14px;
}
.schedule-big-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin: 6px 0 12px;
    position: relative;
}
.schedule-big-nav-label {
    min-width: 260px;
    text-align: center;
    font-size: 18px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}
.schedule-big-nav-today { font-size: 12px; padding: 1px 10px; }
.schedule-big-nav-spin { position: absolute; right: 0; top: 14px; color: #666; }
@media (max-width: 767px) {
    .schedule-big-nav { gap: 8px; }
    .schedule-big-nav-label { min-width: 0; flex: 1 1 auto; font-size: 16px; }
}
.schedule-modal-nav-spin { position: absolute; right: 0; top: 14px; color: #666; }
.schedule-modal-month { min-width: 220px; text-align: center; }
.schedule-modal-grid { table-layout: fixed; margin-bottom: 6px; }
.schedule-modal-grid td {
    height: 84px;
    padding: 5px 7px;
    vertical-align: top;
    position: relative;
}
.schedule-modal-grid th { font-size: 13px; }
.schedule-modal-grid td.sday-editable { cursor: pointer; }
.schedule-modal-grid td.sday-editable:hover { filter: brightness(0.93); }
.schedule-modal-daynr { font-size: 12px; color: #444; }
.schedule-modal-state {
    font-size: 13px;
    font-weight: bold;
    margin-top: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.schedule-modal-duty { font-size: 11px; color: #8a6d3b; margin-top: 2px; }
.schedule-modal-month { font-size: 18px; }
@media (max-width: 767px) {
    .schedule-modal-grid td { height: 64px; padding: 3px 4px; }
    .schedule-modal-state { font-size: 11px; }
}
.schedule-undo { float: right; color: #337ab7; cursor: pointer; }

/* Resources mode (grafik obiektów) */
.schedule-res-badge {
    background: #5bc0de;
    margin-left: 6px;
    font-size: 10px;
}

/* Day-state backgrounds in the modal grid (match person-mode palette) */
.sday-work { background-color: #eaf6ea; }
.sday-work-m { background-color: #ffe9a8; }
.sday-work-a { background-color: #cfe2ff; }
.sday-off { background-color: #e2e3e5; }
.sday-vacation { background-color: #ffb570; }
.sday-l4 { background-color: #f5c6cb; }
.sday-res { background-color: #e8d5f2; }
.sday-staged { box-shadow: inset 0 0 0 2px #f0ad4e; }

/* Legenda pod grafikiem: pasek zakresów progów kolorów (2026-09-06). */
.schedule-legend-box {
    margin-top: 12px;
    padding: 8px 12px;
    border: 1px solid #e3e3e3;
    border-radius: 4px;
    background: #fafafa;
}
.schedule-legend-box .schedule-legend { margin-top: 0; }
.schedule-legend--cells { margin-top: 8px; flex-wrap: wrap; }
.schedule-legend .swatch-week-on { background: #c8e6c9; }
.schedule-legend .swatch-week-off { background: #f1f1f1; }
.schedule-legend .swatch-week-absent { background: repeating-linear-gradient(135deg, #d9dfe6 0 3px, #edf0f3 3px 6px); }
.schedule-legend--ranges {
    flex-wrap: wrap;
    gap: 10px 16px;
}
.schedule-legend-title { white-space: nowrap; }
.schedule-range-bar {
    display: flex;
    flex: 1 1 260px;
    min-width: 220px;
    max-width: 560px;
    height: 26px;
    border: 1px solid #ccc;
    border-radius: 4px;
    overflow: hidden;
}
.schedule-range-seg {
    flex: 1 1 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    color: #333;
    border-right: 1px solid rgba(0, 0, 0, 0.12);
}
.schedule-range-seg:last-child { border-right: 0; }
@media (max-width: 767px) {
    .schedule-range-bar { flex-basis: 100%; max-width: none; }
}
