/* Obecność na żywo – tablica zespołu */
.pr-board {
    --pr-attention: #dc2626;
    --pr-working: #059669;
    --pr-break: #d97706;
    --pr-finished: #2563eb;
    --pr-off: #94a3b8;
    display: grid;
    gap: 14px;
    padding: 16px 18px 18px;
}

.pr-board .is-attention { --pr-color: var(--pr-attention); --pr-soft: #fef2f2; }
.pr-board .is-working { --pr-color: var(--pr-working); --pr-soft: #ecfdf5; }
.pr-board .is-break { --pr-color: var(--pr-break); --pr-soft: #fffbeb; }
.pr-board .is-finished { --pr-color: var(--pr-finished); --pr-soft: #eff6ff; }
.pr-board .is-off { --pr-color: var(--pr-off); --pr-soft: #f8fafc; }

/* Liczniki stanów */
.pr-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    gap: 8px;
}

.pr-stat {
    position: relative;
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 0 10px;
    align-items: center;
    padding: 11px 13px;
    overflow: hidden;
    border: 1px solid #e3eaf3;
    border-radius: 14px;
    background: #fff;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}

.pr-stat::after {
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    height: 3px;
    content: "";
    background: var(--pr-color);
    opacity: .8;
}

.pr-stat:hover {
    border-color: color-mix(in srgb, var(--pr-color) 40%, #e3eaf3);
    box-shadow: 0 10px 22px rgba(15, 23, 42, .07);
    transform: translateY(-1px);
}

.pr-stat.is-empty { opacity: .55; }
.pr-stat.is-empty::after { opacity: .25; }

.pr-stat-icon {
    display: grid;
    grid-row: span 2;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 11px;
    color: var(--pr-color);
    background: var(--pr-soft);
}

.pr-stat-icon .icon { width: 16px; height: 16px; }

.pr-stat strong {
    color: #0f172a;
    font-size: 20px;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.pr-stat small {
    color: #64748b;
    font-size: 9.5px;
    font-weight: 700;
}

.pr-stat.is-attention:not(.is-empty) {
    border-color: #fecaca;
    background: linear-gradient(145deg, #fff5f5, #fff);
}

.pr-stat.is-attention:not(.is-empty) strong { color: #b91c1c; }

/* Wyszukiwarka */
.pr-search {
    position: relative;
    display: block;
    margin: 0;
}

.pr-search .icon {
    position: absolute;
    top: 50%;
    left: 13px;
    width: 15px;
    height: 15px;
    color: #94a3b8;
    transform: translateY(-50%);
}

.module-screen .pr-search input,
.pr-search input {
    width: 100%;
    min-height: 40px;
    padding: 0 14px 0 36px;
    border: 1px solid #dce5f1;
    border-radius: 12px;
    background: #f8fafc;
    font: inherit;
    font-size: 11px;
}

.pr-search input:focus {
    border-color: #60a5fa;
    outline: 0;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(37, 99, 235, .1);
}

/* Grupy */
.pr-group {
    border: 1px solid #e8eef6;
    border-radius: 16px;
    background: #fff;
    scroll-margin-top: 90px;
}

.pr-group[hidden] { display: none; }

.pr-group > summary {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 11px 14px;
    list-style: none;
    cursor: pointer;
}

.pr-group > summary::-webkit-details-marker { display: none; }

.pr-group-icon {
    display: grid;
    flex: 0 0 28px;
    place-items: center;
    width: 28px;
    height: 28px;
    border-radius: 9px;
    color: var(--pr-color);
    background: var(--pr-soft);
}

.pr-group-icon .icon { width: 14px; height: 14px; }

.pr-group-title {
    display: grid;
    flex: 1 1 auto;
    min-width: 0;
}

.pr-group-title strong { color: #0f172a; font-size: 12px; }
.pr-group-title small { color: #94a3b8; font-size: 9px; }

.pr-group > summary em {
    min-width: 24px;
    padding: 2px 8px;
    border-radius: 999px;
    color: var(--pr-color);
    background: var(--pr-soft);
    font-size: 10px;
    font-style: normal;
    font-weight: 800;
    text-align: center;
}

.pr-group > summary > .icon {
    width: 15px;
    height: 15px;
    color: #94a3b8;
    transition: transform .2s ease;
}

.pr-group[open] > summary { border-bottom: 1px solid #eef2f7; }
.pr-group[open] > summary > .icon { transform: rotate(180deg); }

.pr-group.is-attention { border-color: #fecaca; }
.pr-group.is-attention > summary { background: linear-gradient(90deg, #fff5f5, #fff 60%); border-radius: 16px 16px 0 0; }

/* Karty osób w pracy */
.pr-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 10px;
    padding: 12px;
}

.pr-person {
    position: relative;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    min-width: 0;
    padding: 12px;
    border: 1px solid #e8eef6;
    border-radius: 14px;
    background: #fff;
    transition: border-color .15s ease, box-shadow .15s ease;
}

.pr-person[hidden] { display: none; }

.pr-person:hover {
    border-color: #cfdcee;
    box-shadow: 0 8px 20px rgba(26, 56, 101, .07);
}

.pr-person.has-alert {
    border-color: #fecaca;
    background: linear-gradient(160deg, #fff7f7, #fff 55%);
}

.pr-avatar {
    position: relative;
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 12px;
    color: #fff;
    background: linear-gradient(145deg, #3b82f6, #6366f1);
    font-size: 11.5px;
    font-weight: 800;
}

.pr-avatar i {
    position: absolute;
    right: -3px;
    bottom: -3px;
    width: 12px;
    height: 12px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: #cbd5e1;
}

.pr-person.is-working .pr-avatar i { background: var(--pr-working); animation: pr-pulse 1.8s ease-out infinite; }
.pr-person.is-on_break .pr-avatar i { background: var(--pr-break); }
.pr-person.is-shift_finished .pr-avatar i { background: var(--pr-finished); }
.pr-person.has-alert .pr-avatar i { background: var(--pr-attention); animation: none; }
.pr-person.is-off_work .pr-avatar,
.pr-person.is-absent .pr-avatar,
.pr-person.is-shift_finished .pr-avatar { color: #475569; background: #e2e8f0; }

.pr-person-main { min-width: 0; }

.pr-person-main strong {
    display: block;
    overflow: hidden;
    color: #0f172a;
    font-size: 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pr-person-main small {
    display: block;
    overflow: hidden;
    color: #94a3b8;
    font-size: 9.5px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.pr-status {
    padding: 3px 8px;
    border-radius: 999px;
    color: #475569;
    background: #f1f5f9;
    font-size: 9px;
    font-weight: 800;
    white-space: nowrap;
}

.pr-status.is-working { color: #047857; background: #ecfdf5; }
.pr-status.is-on_break { color: #b45309; background: #fffbeb; }
.pr-status.is-shift_finished { color: #1d4ed8; background: #eff6ff; }
.pr-status.is-pending_correction { color: #b91c1c; background: #fef2f2; }
.pr-status.is-leave { color: #6d28d9; background: #f5f3ff; }

.pr-timer {
    display: flex;
    grid-column: 1 / -1;
    gap: 8px;
    align-items: baseline;
    padding: 9px 12px;
    border-radius: 11px;
    background: var(--pr-soft, #f8fafc);
}

.pr-grid .is-working .pr-timer { background: #f0fdf4; }
.pr-grid .is-on_break .pr-timer { background: #fffbeb; }

.pr-board .pr-timer .presence-live-duration {
    padding: 0;
    border: 0;
    color: #0f172a;
    background: none;
    box-shadow: none;
    font-size: 18px;
    font-weight: 800;
    letter-spacing: -.01em;
    font-variant-numeric: tabular-nums;
}

.pr-board .pr-timer .presence-live-duration.is-anomaly { color: #b91c1c; }

.pr-board .pr-timer .presence-live-start {
    color: #64748b;
    font-size: 10px;
}

.pr-board .pr-alert {
    display: flex;
    grid-column: 1 / -1;
    gap: 6px;
    align-items: center;
    margin: 0;
    color: #b91c1c;
    font-size: 10px;
    font-weight: 700;
}

.pr-board .pr-alert .icon { width: 13px; height: 13px; }

.pr-action {
    display: inline-flex;
    grid-column: 1 / -1;
    gap: 5px;
    align-items: center;
    justify-content: center;
    min-height: 32px;
    border: 1px solid #dce5f1;
    border-radius: 10px;
    color: #334155;
    background: #fff;
    font-size: 10.5px;
    font-weight: 750;
    text-decoration: none;
    transition: .15s ease;
}

.pr-action:hover { border-color: #93c5fd; color: #1d4ed8; background: #f5f9ff; }
.pr-action .icon { width: 13px; height: 13px; }

.pr-person.has-alert .pr-action {
    border-color: transparent;
    color: #fff;
    background: #dc2626;
}

.pr-person.has-alert .pr-action:hover { background: #b91c1c; }

/* Zwarta lista dla osób poza pracą */
.pr-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 0 14px;
    padding: 4px 12px 8px;
}

.pr-list .pr-person {
    grid-template-columns: auto minmax(0, 1fr) auto auto;
    padding: 8px 4px;
    border: 0;
    border-bottom: 1px solid #f1f5f9;
    border-radius: 0;
    background: none;
}

.pr-list .pr-person:hover { box-shadow: none; background: #fafcff; }

.pr-list .pr-avatar {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    font-size: 9.5px;
}

.pr-list .pr-avatar i { width: 10px; height: 10px; }
.pr-list .pr-status { display: none; }

.pr-list .pr-action {
    grid-column: auto;
    min-height: 28px;
    padding: 0 9px;
    border-color: transparent;
    color: #2563eb;
    background: transparent;
    font-size: 10px;
}

.pr-list .pr-action:hover { border-color: #bfdbfe; background: #eff6ff; }

.pr-empty {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
    padding: 24px;
    border: 1px dashed #cfdcee;
    border-radius: 14px;
    color: #64748b;
    font-size: 11px;
}

.pr-empty[hidden] { display: none; }
.pr-empty .icon { width: 15px; height: 15px; }

@keyframes pr-pulse {
    0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, .45); }
    70%, 100% { box-shadow: 0 0 0 7px rgba(5, 150, 105, 0); }
}

@media (max-width: 1100px) {
    .pr-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
    .pr-board { padding: 12px; }
    .pr-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pr-grid, .pr-list { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
    .pr-person.is-working .pr-avatar i { animation: none; }
}
