/* Kocz Serwis – style aplikacji */
:root {
    --brand: #c8102e;
    --brand-dark: #9e0c24;
    --ink: #2b2f33;
    --sidebar: #1f2226;
    --sidebar-w: 236px;
    --bg: #f3f4f6;
    --st-zaplanowane: #6c8db5;
    --st-potwierdzone: #0d6efd;
    --st-przyjete: #0dcaf0;
    --st-w_trakcie: #ffc107;
    --st-czeka_czesci: #fd7e14;
    --st-gotowe: #198754;
    --st-wydane: #495057;
    --st-anulowane: #ced4da;
    --st-nie_stawil_sie: #dc3545;
}

body { background: var(--bg); color: var(--ink); font-size: .94rem; }
a { color: #0b5ed7; text-decoration: none; }
a:hover { text-decoration: underline; }
.text-brand { color: var(--brand) !important; }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover, .btn-brand:focus { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-xs { padding: .1rem .4rem; font-size: .75rem; border-radius: .25rem; }
.text-bg-orange { background: #fd7e14 !important; color: #fff !important; }
.label-sm { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: #6c757d; font-weight: 600; }
.card { border-color: #e3e6ea; box-shadow: 0 1px 2px rgba(0, 0, 0, .03); }
.card-header { background: #fafbfc; font-weight: 600; }
.border-dashed { border-style: dashed !important; }
.row-link { cursor: pointer; }
.table > :not(caption) > * > * { padding-top: .45rem; padding-bottom: .45rem; }

/* ------------------------------------------------------------ układ */
.sidebar { background: var(--sidebar) !important; color: #c9cdd2; width: var(--sidebar-w); display: flex; flex-direction: column; }
@media (min-width: 992px) {
    .sidebar { position: fixed; top: 0; bottom: 0; left: 0; z-index: 1030; }
    .main { margin-left: var(--sidebar-w); }
}
@media (max-width: 991.98px) { .sidebar.offcanvas-lg { --bs-offcanvas-width: var(--sidebar-w); background: var(--sidebar); } }
.sidebar-brand { background: #fff; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 3px solid var(--brand); }
.sidebar-brand img { height: 28px; max-width: 100%; }
.sidebar-brand .btn-close-white { filter: invert(1) grayscale(100%) brightness(0); }
.sidebar-nav { padding: 10px 8px; overflow-y: auto; flex: 1; }
.sidebar-nav .nav-link { color: #c9cdd2; display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 6px; margin-bottom: 2px; }
.sidebar-nav .nav-link i { font-size: 1.05rem; width: 20px; text-align: center; }
.sidebar-nav .nav-link:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.sidebar-nav .nav-link.active { background: var(--brand); color: #fff; }
.nav-section { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: #7b828a; padding: 14px 12px 4px; }
.sidebar-footer { padding: 8px 16px; color: #6c757d; }
.topbar { position: sticky; top: 0; z-index: 1020; background: #fff; border-bottom: 1px solid #e3e6ea; display: flex; align-items: center; gap: 12px; padding: 8px 20px; }
.topbar-search { position: relative; flex: 1; max-width: 520px; }
.topbar-search i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #8a9097; }
.topbar-search input { padding-left: 34px; background: #f3f4f6; border-color: transparent; }
.topbar-search input:focus { background: #fff; }
.content { padding: 20px; }
@media (max-width: 575.98px) { .content { padding: 12px; } .topbar { padding: 6px 10px; } }
.page-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 16px; }
.page-head h1 { font-size: 1.45rem; margin: 0; font-weight: 600; }
.filter-bar .form-label { margin-bottom: 2px; }

/* ------------------------------------------------------------ elementy */
.plate { display: inline-block; font-family: "Arial Narrow", Arial, sans-serif; font-weight: 700; letter-spacing: .06em; background: #fff; border: 1.5px solid #222; border-left: 9px solid #003399; border-radius: 3px; padding: 0 6px; line-height: 1.5; color: #111; white-space: nowrap; }
.plate-sm { font-size: .8rem; padding: 0 4px; border-left-width: 6px; }
.mech-chip { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: .66rem; font-weight: 700; vertical-align: middle; flex-shrink: 0; }
.mech-chip-lg { width: 36px; height: 36px; font-size: .9rem; }
.mech-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.mech-pick input { display: none; }
.mech-pick span { display: inline-block; padding: 4px 10px; border-radius: 20px; border: 1.5px solid var(--c); color: var(--ink); cursor: pointer; font-size: .85rem; user-select: none; }
.mech-pick input:checked + span { background: var(--c); color: #fff; }
.mech-pick input:disabled + span { opacity: .6; cursor: default; }
.selected-box { background: #f8f9fa; border: 1px solid #e3e6ea; border-radius: 6px; padding: 10px 12px; }
.search-results { position: absolute; z-index: 1050; left: 0; right: 0; top: 100%; max-height: 340px; overflow-y: auto; box-shadow: 0 8px 20px rgba(0, 0, 0, .12); }
.items-table input, .items-table select { min-width: 60px; }
.items-table .it-name { min-width: 180px; }
.blink { animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .45; } }

.stat-card { display: flex; align-items: center; gap: 14px; background: #fff; border: 1px solid #e3e6ea; border-radius: 10px; padding: 14px 16px; color: var(--ink); height: 100%; }
a.stat-card:hover { text-decoration: none; border-color: #c5cad0; }
.stat-card i { font-size: 1.7rem; color: var(--brand); }
.stat-val { font-size: clamp(1rem, 1.4vw, 1.45rem); font-weight: 700; line-height: 1.15; white-space: nowrap; }
.stat-label { font-size: .8rem; color: #6c757d; }
.stat-success i { color: #198754; }
.stat-danger { border-color: #f1aeb5; }
.stat-danger i, .stat-danger .stat-val { color: #dc3545; }
.time-col { width: 44px; text-align: center; line-height: 1.2; }

.bar-list { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 110px 1fr 120px; align-items: center; gap: 8px; font-size: .85rem; margin-bottom: 6px; }
.bar-track { background: #eef0f2; border-radius: 4px; height: 12px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; background: var(--brand); }
.bar-val { text-align: right; color: #6c757d; font-size: .8rem; }
.occ-bar { background: #e9ecef; height: 4px; border-radius: 2px; overflow: hidden; margin-top: 3px; }
.occ-bar > div { height: 100%; }

.timeline { padding: 8px 16px 8px 34px; position: relative; }
.timeline::before { content: ""; position: absolute; left: 21px; top: 14px; bottom: 14px; width: 2px; background: #e3e6ea; }
.timeline-item { position: relative; padding: 10px 0; border-bottom: 1px solid #f0f1f3; }
.timeline-item:last-child { border-bottom: 0; }
.timeline-dot { position: absolute; left: -18px; top: 15px; width: 12px; height: 12px; border-radius: 50%; background: var(--st-wydane); border: 2px solid #fff; box-shadow: 0 0 0 1px #ccc; }

.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.file-tile { display: flex; flex-direction: column; gap: 4px; color: inherit; }
.file-tile img, .file-icon { width: 100%; aspect-ratio: 4/3; object-fit: cover; border-radius: 6px; border: 1px solid #e3e6ea; background: #f8f9fa; }
.file-icon { display: flex; align-items: center; justify-content: center; font-size: 2rem; color: #6c757d; }

.audit-list .audit-changes td { padding: 1px 6px; font-size: .78rem; vertical-align: top; }
.audit-changes td:first-child { white-space: nowrap; width: 1%; }

/* ------------------------------------------------------------ statusy */
.cal-dot { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.cal-dot-off { background: repeating-linear-gradient(45deg, #e9ecef, #e9ecef 3px, #f8f9fa 3px, #f8f9fa 6px); border: 1px solid #dee2e6; }
.cal-legend { display: flex; flex-wrap: wrap; gap: 14px; color: #6c757d; }
.st-zaplanowane { --st: var(--st-zaplanowane); }
.st-potwierdzone { --st: var(--st-potwierdzone); }
.st-przyjete { --st: var(--st-przyjete); }
.st-w_trakcie { --st: var(--st-w_trakcie); }
.st-czeka_czesci { --st: var(--st-czeka_czesci); }
.st-gotowe { --st: var(--st-gotowe); }
.st-wydane { --st: var(--st-wydane); }
.st-anulowane { --st: var(--st-anulowane); }
.st-nie_stawil_sie { --st: var(--st-nie_stawil_sie); }
.cal-dot[class*="st-"], .timeline-dot[class*="st-"] { background: var(--st); }

/* ------------------------------------------------------------ kalendarz */
.cal-toolbar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.cal-scroll { overflow: auto; max-height: calc(100vh - 190px); min-height: 360px; }
.cal-grid { display: grid; position: relative; min-width: 100%; }
.cal-corner, .cal-colhead { position: sticky; top: 0; z-index: 5; background: #fff; border-bottom: 1px solid #dee2e6; }
.cal-colhead { padding: 8px 10px; border-left: 1px solid #e9ecef; border-top: 4px solid transparent; }
.cal-times { position: relative; }
.cal-hour { position: absolute; right: 6px; transform: translateY(-50%); font-size: .72rem; color: #8a9097; }
.cal-hour:first-child { transform: none; }
.cal-col { position: relative; border-left: 1px solid #e9ecef; background: #fff; }
.cal-clickable { cursor: copy; }
.cal-line { position: absolute; left: 0; right: 0; border-top: 1px solid #edf0f2; pointer-events: none; }
.cal-line.half { border-top-style: dashed; border-top-color: #f3f4f6; }
.cal-off { position: absolute; left: 0; right: 0; background: repeating-linear-gradient(45deg, rgba(233, 236, 239, .75), rgba(233, 236, 239, .75) 4px, rgba(248, 249, 250, .75) 4px, rgba(248, 249, 250, .75) 8px); pointer-events: none; display: flex; align-items: center; justify-content: center; }
.cal-off span { background: #fff; color: #dc3545; font-size: .8rem; padding: 2px 8px; border-radius: 10px; border: 1px solid #f1aeb5; }
.cal-now { position: absolute; left: 0; right: 0; border-top: 2px solid var(--brand); z-index: 3; pointer-events: none; }
.cal-now::before { content: ""; position: absolute; left: -4px; top: -5px; width: 8px; height: 8px; border-radius: 50%; background: var(--brand); }
.cal-ev { position: absolute; z-index: 2; overflow: hidden; border-radius: 6px; padding: 3px 6px; font-size: .78rem; line-height: 1.25; color: var(--ink);
    background: color-mix(in srgb, var(--st) 16%, #fff); border: 1px solid color-mix(in srgb, var(--st) 45%, #fff); border-left: 5px solid var(--st); box-shadow: 0 1px 2px rgba(0, 0, 0, .06); }
.cal-ev:hover { text-decoration: none; z-index: 4; box-shadow: 0 4px 12px rgba(0, 0, 0, .15); color: var(--ink); }
.cal-ev-time { font-size: .7rem; color: #555; }
.cal-ev-title { font-weight: 700; }
.cal-ev-sub { color: #555; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cal-ev-mech { position: absolute; right: 4px; bottom: 3px; display: flex; gap: 2px; }
.cal-ev.compact .cal-ev-sub, .cal-ev.compact .cal-ev-mech { display: none; }
.cal-ev.compact .cal-ev-time { display: inline; }
.cal-ev.compact .cal-ev-title { display: inline; margin-left: 4px; }
.st-anulowane.cal-ev, .st-nie_stawil_sie.cal-ev { opacity: .55; text-decoration: line-through; }

.cal-week th { text-align: center; vertical-align: top; min-width: 130px; background: #fff; }
.cal-week th.cal-week-res, .cal-week td.cal-week-res { min-width: 120px; width: 120px; text-align: left; background: #fafbfc; }
.cal-week td { vertical-align: top; padding: 4px !important; position: relative; min-height: 70px; height: 80px; }
.cal-week-closed { background: repeating-linear-gradient(45deg, #f6f7f8, #f6f7f8 4px, #fff 4px, #fff 8px) !important; }
.cal-week-absent { background: #fff5f5; }
.cal-today { box-shadow: inset 0 3px 0 var(--brand); }
.cal-chip { display: block; font-size: .76rem; line-height: 1.25; padding: 3px 5px; margin-bottom: 3px; border-radius: 5px; color: var(--ink);
    background: color-mix(in srgb, var(--st) 15%, #fff); border-left: 4px solid var(--st); }
.cal-chip:hover { text-decoration: none; filter: brightness(.96); color: var(--ink); }
.cal-chip-time { color: #555; margin-right: 3px; }
.cal-add { position: absolute; right: 3px; bottom: 2px; color: #adb5bd; font-size: 1.1rem; line-height: 1; opacity: 0; }
.cal-week-cell:hover .cal-add { opacity: 1; }
.cal-week-abs td { height: auto; background: #fafbfc; }

.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-month-dow { text-align: center; font-size: .75rem; text-transform: uppercase; color: #6c757d; padding: 6px; border-bottom: 1px solid #dee2e6; background: #fafbfc; }
.cal-month-day { min-height: 112px; border-right: 1px solid #edf0f2; border-bottom: 1px solid #edf0f2; padding: 5px 6px; display: flex; flex-direction: column; gap: 2px; color: var(--ink); background: #fff; }
.cal-month-day:hover { text-decoration: none; box-shadow: inset 0 0 0 2px #adb5bd; color: var(--ink); }
.cal-month-day.other { opacity: .45; }
.cal-month-day.closed { background: repeating-linear-gradient(45deg, #f6f7f8, #f6f7f8 4px, #fff 4px, #fff 8px); }
.cal-month-day.today .cal-month-num { background: var(--brand); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.cal-month-num { font-weight: 600; }
.cal-month-ev { font-size: .72rem; padding: 0 4px; border-radius: 3px; background: color-mix(in srgb, var(--st) 18%, #fff); border-left: 3px solid var(--st); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.heat-1 { background: #eaf6ee; } .heat-2 { background: #fff3cd; } .heat-3 { background: #ffe0c2; } .heat-4 { background: #f8d0d5; }
.heat-chip { display: inline-block; width: 14px; height: 10px; border-radius: 2px; vertical-align: middle; border: 1px solid #ddd; }
@media (max-width: 767.98px) { .cal-month-day { min-height: 72px; font-size: .8rem; } .cal-month-ev { display: none; } }

/* ------------------------------------------------------------ plan urlopów */
.abs-grid th, .abs-grid td { padding: 0 !important; text-align: center; font-size: .75rem; min-width: 26px; height: 30px; position: relative; vertical-align: middle; }
.abs-grid .abs-name { text-align: left; padding: 4px 8px !important; min-width: 170px; white-space: nowrap; font-size: .85rem; }
.abs-closed { background: #f1f3f5; }
.abs-today { box-shadow: inset 0 3px 0 var(--brand); }
.abs-none { background: repeating-linear-gradient(45deg, #eee, #eee 2px, #fff 2px, #fff 5px); }
.abs-urlop { background: #4dabf7 !important; } .abs-l4 { background: #ff8787 !important; } .abs-szkolenie { background: #b197fc !important; } .abs-inne { background: #ffd43b !important; }
.abs-planned { opacity: .5; background-image: repeating-linear-gradient(45deg, rgba(255, 255, 255, .6), rgba(255, 255, 255, .6) 3px, transparent 3px, transparent 6px) !important; }
.abs-sq { display: inline-block; width: 12px; height: 12px; border-radius: 2px; vertical-align: -1px; margin-right: 3px; }
.abs-sq.abs-planned { background: #4dabf7; }
.stretched { position: absolute; inset: 0; }
.abs-add:hover { background: rgba(13, 110, 253, .12); }

/* ------------------------------------------------------------ raporty */
.heatmap th, .heatmap td { text-align: center; font-size: .75rem; padding: 6px 4px !important; min-width: 42px; }

/* ------------------------------------------------------------ logowanie */
.auth-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
    background: linear-gradient(160deg, #2b2f33 0%, #1a1c1f 60%), #222; }
.auth-box { width: 100%; max-width: 420px; }
.auth-logo { background: #fff; border-radius: 10px 10px 0 0; padding: 22px 20px 16px; text-align: center; border-bottom: 4px solid var(--brand); }
.auth-logo img { max-width: 260px; width: 80%; }
.auth-sub { margin-top: 8px; font-size: .82rem; color: #6c757d; text-transform: uppercase; letter-spacing: .08em; }
.auth-box .card { border-radius: 0 0 10px 10px; border-top: 0; }

/* ------------------------------------------------------------ portal klienta */
.portal { background: #f5f6f7; }
.portal-nav { background: #fff; border-bottom: 3px solid var(--brand); }
.portal-nav .nav-link.active { color: var(--brand); font-weight: 600; }
.progress-steps { display: flex; gap: 4px; }
.progress-steps .step { flex: 1; text-align: center; font-size: .8rem; color: #8a9097; position: relative; padding-top: 34px; }
.progress-steps .step span { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 28px; height: 28px; border-radius: 50%; background: #e9ecef; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.progress-steps .step.done { color: var(--ink); }
.progress-steps .step.done span { background: #198754; color: #fff; }
.progress-steps .step.current span { box-shadow: 0 0 0 4px rgba(25, 135, 84, .25); }

@media print {
    .sidebar, .topbar, .btn, form { display: none !important; }
    .main { margin: 0 !important; }
}
