/* =====================================================================
   Panel Zarządu Ochrony — wygląd „tabletu służbowego”
   Kolor akcentu zmienisz w jednym miejscu: --accent (np. #3b82f6 dla niebieskiego).
   ===================================================================== */

@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/montserrat-latin-ext-500-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/montserrat-latin-500-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/montserrat-latin-ext-600-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/montserrat-latin-600-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/montserrat-latin-ext-700-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/montserrat-latin-700-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 800; font-display: swap; src: url(../fonts/montserrat-latin-ext-800-normal.woff2) format("woff2"); unicode-range: U+0100-02AF, U+0304, U+0308, U+0329, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Montserrat"; font-style: normal; font-weight: 800; font-display: swap; src: url(../fonts/montserrat-latin-800-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+2074, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
    --page: #0a0b0d;
    --device: #121316;
    --panel: #17181c;
    --panel-2: #1d1e23;
    --panel-3: #23242a;
    --line: #25262c;
    --line-2: #30313a;
    --text: #ececef;
    --text-2: #c4c5cc;
    --muted: #8a8c96;
    --dim: #5d5f69;
    --accent: #e8467c;
    --accent-2: #f06b98;
    --accent-soft: rgba(232, 70, 124, .13);
    --accent-line: rgba(232, 70, 124, .45);
    --gold: #e8b04a;
    --gold-soft: rgba(232, 176, 74, .14);
    --ok: #39c98a;
    --ok-soft: rgba(57, 201, 138, .13);
    --warn: #e8b04a;
    --err: #e5484d;
    --err-soft: rgba(229, 72, 77, .14);
    --info: #5aa9e6;
    --info-soft: rgba(90, 169, 230, .13);
    --r-lg: 16px;
    --r: 12px;
    --r-sm: 9px;
    --font: "Montserrat", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
    --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    --shadow: 0 30px 80px rgba(0, 0, 0, .55);
    color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
    margin: 0;
    font: 500 13.5px/1.5 var(--font);
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 15% -10%, rgba(232, 70, 124, .07), transparent 60%),
        radial-gradient(900px 500px at 110% 110%, rgba(90, 169, 230, .05), transparent 60%),
        var(--page);
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 800; letter-spacing: -.01em; }
p { margin: 0 0 10px; }
code { font-family: var(--mono); font-size: .92em; background: var(--panel-3); padding: 1px 5px; border-radius: 5px; }
small { font-size: 11.5px; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.gold { color: var(--gold); }
.accent { color: var(--accent); }
.nowrap { white-space: nowrap; }
.mono { font-family: var(--mono); }
.hidden, [hidden] { display: none !important; }
.ico { width: 18px; height: 18px; flex: none; }
.ico--sm { width: 15px; height: 15px; flex: none; }
.ico--lg { width: 22px; height: 22px; flex: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-soft); }

/* ------------------------------ Urządzenie ------------------------------ */
.device {
    display: flex; flex-direction: column;
    max-width: 1500px; height: calc(100vh - 36px); margin: 18px auto;
    background: var(--device);
    border: 1px solid var(--line-2);
    border-radius: 20px;
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .03);
    overflow: hidden;
}
.topbar {
    display: flex; align-items: center; gap: 14px;
    padding: 12px 18px;
    border-bottom: 1px solid var(--line);
    background: linear-gradient(180deg, rgba(255, 255, 255, .015), transparent);
    min-height: 66px;
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
    width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; flex: none;
    background: var(--panel-2); border: 1px solid var(--line-2); color: var(--accent);
}
.brand-logo { width: 24px; height: 24px; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-text small { font-size: 9.5px; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.brand-text strong { font-size: 16px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.whoami { display: flex; align-items: center; gap: 10px; padding: 0 6px; }
.whoami__text { display: flex; flex-direction: column; line-height: 1.2; }
.whoami__text strong { font-size: 13px; font-weight: 700; }
.whoami__text small { font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.avatar {
    --rank: var(--accent);
    width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; flex: none;
    font-weight: 800; font-size: 14px; color: #fff;
    background: var(--rank);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--rank) 25%, transparent);
}
.avatar--xl { width: 64px; height: 64px; font-size: 24px; border-radius: 18px; }
.inline-form { display: inline; margin: 0; }

.frame { flex: 1; display: flex; min-height: 0; position: relative; }
.sidebar {
    width: 228px; flex: none; display: flex; flex-direction: column;
    border-right: 1px solid var(--line); padding: 14px 10px; overflow-y: auto;
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
    display: flex; align-items: center; gap: 11px;
    padding: 9px 12px; border-radius: 10px;
    color: var(--text-2); font-weight: 600; font-size: 13px;
    border: 1px solid transparent; position: relative;
}
.nav a .ico { color: var(--muted); }
.nav a:hover { background: var(--panel-2); text-decoration: none; color: var(--text); }
.nav a.is-active {
    background: linear-gradient(90deg, var(--accent-soft), rgba(232, 70, 124, .04));
    border-color: rgba(232, 70, 124, .22); color: #fff;
}
.nav a.is-active::before { content: ""; position: absolute; left: -10px; top: 9px; bottom: 9px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.nav a.is-active .ico { color: var(--accent); }
.nav__label { margin: 16px 12px 6px; font-size: 10px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.sidebar__foot { margin-top: auto; padding: 14px 12px 2px; font-size: 11px; color: var(--dim); }
.sidebar-backdrop { display: none; }
.content { flex: 1; min-width: 0; overflow-y: auto; padding: 22px 26px 40px; outline: none; }
.icon-btn.menu-btn { display: none; }

/* ------------------------------- Elementy ------------------------------- */
.pill {
    display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px;
    font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; white-space: nowrap;
    background: var(--panel-3); color: var(--text-2); border: 1px solid var(--line-2);
}
.pill--status { background: var(--accent-soft); border-color: rgba(232, 70, 124, .35); color: var(--accent-2); }
.pill--rank {
    --rank: var(--gold);
    background: color-mix(in srgb, var(--rank) 14%, transparent);
    border-color: color-mix(in srgb, var(--rank) 45%, transparent);
    color: color-mix(in srgb, var(--rank) 75%, #fff);
}
.badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 7px;
    font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap;
    background: var(--panel-3); color: var(--text-2); border: 1px solid var(--line-2);
}
.badge--ok { background: var(--ok-soft); color: var(--ok); border-color: rgba(57, 201, 138, .3); }
.badge--err { background: var(--err-soft); color: #ff7b7f; border-color: rgba(229, 72, 77, .3); }
.badge--warn { background: var(--gold-soft); color: var(--gold); border-color: rgba(232, 176, 74, .3); }
.badge--info { background: var(--info-soft); color: var(--info); border-color: rgba(90, 169, 230, .3); }
.badge--accent { background: var(--accent-soft); color: var(--accent-2); border-color: rgba(232, 70, 124, .3); }
.badge--muted { color: var(--dim); }
.badge--rank {
    --rank: #8b8f98;
    background: color-mix(in srgb, var(--rank) 14%, transparent);
    color: color-mix(in srgb, var(--rank) 70%, #fff);
    border-color: color-mix(in srgb, var(--rank) 35%, transparent);
}
.count { display: inline-grid; place-items: center; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 999px; font-size: 10.5px; font-weight: 800; background: var(--panel-3); color: var(--text-2); }
.yn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 46px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 10.5px; font-weight: 800; letter-spacing: .06em; }
.yn--yes { background: var(--ok-soft); color: var(--ok); }
.yn--no { background: transparent; color: var(--dim); border: 1px dashed var(--line-2); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--dim); flex: none; }
.dot--ok { background: var(--ok); box-shadow: 0 0 0 3px var(--ok-soft); }
.dot--warn { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.dot--err { background: var(--err); box-shadow: 0 0 0 3px var(--err-soft); }
.dot--accent { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ------------------------------- Przyciski ------------------------------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 38px; padding: 0 15px; border-radius: 10px;
    border: 1px solid var(--line-2); background: var(--panel-2); color: var(--text);
    font: 700 12.5px/1 var(--font); cursor: pointer; white-space: nowrap; text-decoration: none;
    transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--panel-3); border-color: #3b3c46; text-decoration: none; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn--danger { background: #d83f4f; border-color: #d83f4f; color: #fff; }
.btn--danger:hover { background: #e5525f; border-color: #e5525f; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--panel-2); border-color: var(--line); }
.btn--sm { height: 30px; padding: 0 11px; font-size: 11.5px; border-radius: 8px; }
.btn--block { width: 100%; }
.btn .ico { width: 16px; height: 16px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.icon-btn {
    display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
    background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text-2); cursor: pointer; padding: 0;
}
.icon-btn:hover { background: var(--panel-3); color: #fff; }
.icon-btn--danger:hover { color: #ff7b7f; border-color: rgba(229, 72, 77, .5); }
.icon-btn--sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn--sm .ico { width: 15px; height: 15px; }

/* -------------------------------- Strona -------------------------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { font-size: 23px; }
.page-head p { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.back-link { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); margin-bottom: 10px; }
.back-link:hover { color: var(--text); text-decoration: none; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; min-width: 0; }
.stat__label { font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.stat__value { font-size: 26px; font-weight: 800; line-height: 1.15; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat__value--gold { color: var(--gold); }
.stat__value--accent { color: var(--accent); }
.stat__value--sm { font-size: 17px; line-height: 1.6; }
.stat__sub { font-size: 11.5px; color: var(--dim); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.stat:hover { border-color: var(--line-2); text-decoration: none; background: var(--panel-2); }
a.stat { color: inherit; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); margin-bottom: 16px; min-width: 0; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 18px; border-bottom: 1px solid var(--line); min-height: 52px; }
.card__head h2, .card__title { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.card__body { padding: 16px 18px; }
.card__body > :last-child { margin-bottom: 0; }
.card--flush .card__body { padding: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ------------------------------ Narzędzia ------------------------------ */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line); }
.search { position: relative; flex: 1 1 240px; min-width: 180px; }
.search .ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--dim); pointer-events: none; }
.search input[type=search] { padding-left: 38px; width: 100%; }
.toolbar select, .toolbar input[type=date] { width: auto; min-width: 140px; }
.toolbar__count { margin-left: auto; font-size: 11.5px; color: var(--dim); font-weight: 700; }

/* ------------------------------ Formularze ------------------------------ */
input[type=text], input[type=search], input[type=password], input[type=date], input[type=datetime-local], input[type=number], select, textarea {
    width: 100%; height: 40px; padding: 0 12px;
    background: var(--panel-2); color: var(--text);
    border: 1px solid var(--line-2); border-radius: 10px;
    font: 500 13.5px/1.4 var(--font);
    transition: border-color .12s, background .12s;
}
input[type=color] { width: 46px; height: 40px; padding: 3px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--panel-2); cursor: pointer; }
textarea { height: auto; min-height: 100px; padding: 10px 12px; resize: vertical; line-height: 1.55; }
textarea.code { font-family: var(--mono); font-size: 13px; min-height: 260px; tab-size: 4; }
input:hover, select:hover, textarea:hover { border-color: #3a3b45; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent-line); background: #202127; }
input::placeholder, textarea::placeholder { color: var(--dim); }
input:disabled, select:disabled, textarea:disabled, input[readonly] { opacity: .7; cursor: not-allowed; }
input[readonly] { background: var(--panel-3); }
select { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a8c96' stroke-width='2.4' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; }
.is-invalid { border-color: var(--err) !important; background: rgba(229, 72, 77, .07) !important; }
.field { display: block; margin-bottom: 14px; }
.field > span, .label { display: block; margin-bottom: 6px; font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.field > span small, .label small { text-transform: none; letter-spacing: 0; font-weight: 600; color: var(--dim); font-size: 11px; }
.field__hint { display: block; margin-top: 5px; font-size: 11.5px; color: var(--dim); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 14px; }
.form-grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-weight: 600; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; cursor: pointer; }
.check--box { display: flex; padding: 11px 13px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--panel-2); }
.check--box:hover { border-color: #3a3b45; }
.check--box:has(input:checked) { border-color: var(--accent-line); background: var(--accent-soft); }
.input-group { display: flex; align-items: stretch; }
.input-group > * { border-radius: 0 !important; }
.input-group > :first-child { border-radius: 10px 0 0 10px !important; }
.input-group > :last-child { border-radius: 0 10px 10px 0 !important; }
.input-group .btn, .input-group .icon-btn { height: 40px; }
.input-group input { text-align: center; }

/* Przełącznik segmentowy (np. Wydano / Oddano, zakładki) */
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin-bottom: 16px; }
.seg button, .seg a {
    display: flex; align-items: center; justify-content: center; gap: 9px; height: 46px;
    border-radius: 12px; border: 1px solid var(--line-2); background: var(--panel);
    color: var(--text-2); font: 800 11.5px/1 var(--font); letter-spacing: .1em; text-transform: uppercase; cursor: pointer;
}
.seg button:hover, .seg a:hover { background: var(--panel-2); text-decoration: none; }
.seg .is-active { border-color: var(--accent-line); background: var(--accent-soft); color: #fff; }
.seg .is-active .count { background: var(--accent); color: #fff; }
.seg--issue .is-active[data-op=wydano] { border-color: rgba(57, 201, 138, .5); background: var(--ok-soft); }
.seg--issue .is-active[data-op=oddano] { border-color: rgba(90, 169, 230, .5); background: var(--info-soft); }

/* -------------------------------- Tabele -------------------------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th {
    text-align: left; padding: 11px 14px; white-space: nowrap;
    font-size: 10px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted);
    border-bottom: 1px solid var(--line); background: var(--panel);
}
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { color: var(--text); }
th .sort-mark { color: var(--accent); margin-left: 3px; }
td { padding: 11px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(255, 255, 255, .015); }
tr.is-clickable { cursor: pointer; }
tr.is-clickable:hover td { background: var(--panel-2); }
tr.row-muted td { opacity: .55; }
tr.row-group td { background: var(--panel-2); font-size: 10.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--text-2); padding: 8px 14px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.center, th.center { text-align: center; }
td.actions { text-align: right; white-space: nowrap; }
.cell-name strong { font-weight: 700; display: block; }
.cell-name small { color: var(--dim); display: block; margin-top: 1px; }
.cell-person { display: flex; align-items: center; gap: 10px; }
.money { color: var(--gold); font-weight: 800; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 800; background: var(--panel-2); }
.sticky-col { position: sticky; left: 0; z-index: 1; background: var(--panel); }
tbody tr:hover .sticky-col { background: #19191d; }
tfoot .sticky-col { background: var(--panel-2); }
.settle-table td.cell-name { min-width: 150px; }

/* --------------------------- Stany i komunikaty --------------------------- */
.empty { text-align: center; padding: 46px 20px; color: var(--muted); }
.empty strong { display: block; color: var(--text); font-size: 14.5px; margin-bottom: 4px; }
.empty .btn { margin-top: 14px; }
.loading { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 50px; color: var(--muted); font-weight: 600; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-2); border-top-color: var(--accent); animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 11px 14px; border-radius: 11px; margin-bottom: 14px; font-weight: 600; font-size: 13px; border: 1px solid; }
.alert .ico { margin-top: 1px; }
.alert--info { background: var(--info-soft); border-color: rgba(90, 169, 230, .28); color: #a9d2f3; }
.alert--success { background: var(--ok-soft); border-color: rgba(57, 201, 138, .28); color: #8fe3bd; }
.alert--warn { background: var(--gold-soft); border-color: rgba(232, 176, 74, .3); color: #f1cf8d; }
.alert--error { background: var(--err-soft); border-color: rgba(229, 72, 77, .32); color: #ffa3a6; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert li { margin: 3px 0; }

.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 300; max-width: min(420px, calc(100vw - 36px)); }
.toast {
    display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-radius: 12px;
    background: #202127; border: 1px solid var(--line-2); box-shadow: 0 12px 30px rgba(0, 0, 0, .45);
    font-weight: 700; font-size: 13px; animation: toast-in .16s ease-out;
}
.toast--success { border-color: rgba(57, 201, 138, .45); }
.toast--success::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--ok); flex: none; }
.toast--error { border-color: rgba(229, 72, 77, .5); }
.toast--error::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--err); flex: none; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } }

/* --------------------------------- Modale --------------------------------- */
.modal-overlay { position: fixed; inset: 0; background: rgba(5, 5, 7, .72); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; z-index: 200; overflow-y: auto; }
.modal { width: 100%; max-width: 540px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 18px; box-shadow: var(--shadow); }
.modal--wide { max-width: 860px; }
.modal--xl { max-width: 1060px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal__head h2 { font-size: 16px; }
.modal__body { padding: 18px 20px; }
.modal__body > :last-child { margin-bottom: 0; }
.modal__foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); }

/* ----------------------------- Tekst do kopiowania ----------------------------- */
.copy-text {
    margin: 0; padding: 14px 16px; border-radius: 12px; background: #101114; border: 1px solid var(--line);
    font: 500 13px/1.6 var(--mono); color: var(--text-2); white-space: pre-wrap; word-break: break-word; max-height: 60vh; overflow: auto;
}
.lib-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; padding: 16px 18px; }
.lib-item { display: flex; flex-direction: column; gap: 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 13px; padding: 14px 15px; min-width: 0; }
.lib-item:hover { border-color: var(--line-2); }
.lib-item__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.lib-item__title { font-weight: 800; font-size: 14px; cursor: pointer; }
.lib-item__title:hover { color: var(--accent-2); }
.lib-item__preview { color: var(--muted); font-size: 12.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.lib-item__meta { font-size: 11px; color: var(--dim); margin-top: auto; }
.lib-item__actions { display: flex; gap: 6px; flex-wrap: wrap; }
.lib-group { padding: 16px 18px 0; font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--dim); }
.lib-group + .lib-list { padding-top: 10px; }
.btn.is-copied { border-color: rgba(57, 201, 138, .5); color: var(--ok); }

/* --------------------------------- Kartoteka --------------------------------- */
.profile-head { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; padding: 18px; }
.profile-head__main { flex: 1; min-width: 220px; }
.profile-head h1 { font-size: 22px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.profile-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.kv { display: grid; grid-template-columns: minmax(130px, 38%) 1fr; gap: 0; }
.kv > div { padding: 10px 0; border-bottom: 1px solid var(--line); min-width: 0; overflow-wrap: anywhere; }
.kv > div:nth-last-child(-n+2) { border-bottom: none; }
.kv dt, .kv .k { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.kv .v { font-weight: 600; }
.eq-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.eq-tile { border: 1px solid var(--line); background: var(--panel-2); border-radius: 12px; padding: 12px 13px; }
.eq-tile--yes { border-color: rgba(57, 201, 138, .35); background: linear-gradient(180deg, var(--ok-soft), transparent); }
.eq-tile__name { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.eq-tile__val { margin-top: 6px; font-weight: 800; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.eq-tile__sub { font-size: 11px; color: var(--dim); margin-top: 2px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 10px 0 10px 22px; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: none; }
.timeline li::before { content: ""; position: absolute; left: 4px; top: 17px; width: 7px; height: 7px; border-radius: 50%; background: var(--line-2); }
.timeline li.t-accent::before { background: var(--accent); }
.timeline li.t-ok::before { background: var(--ok); }
.timeline li.t-warn::before { background: var(--gold); }
.timeline__meta { font-size: 11px; color: var(--dim); margin-top: 2px; }
.note-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.note-item:last-child { border-bottom: none; }
.note-item__text { white-space: pre-wrap; overflow-wrap: anywhere; }
.note-item__meta { display: flex; justify-content: space-between; gap: 10px; align-items: center; font-size: 11px; color: var(--dim); margin-top: 5px; }
.cert-box { border: 1px solid var(--line); border-radius: 13px; padding: 14px; background: var(--panel-2); }
.cert-box--ok { border-color: rgba(57, 201, 138, .35); }
.cert-box--off { opacity: .7; }

/* -------------------------------- Rangi (DnD) -------------------------------- */
.rank-list { list-style: none; margin: 0; padding: 8px; }
.rank-item {
    display: flex; align-items: center; gap: 12px; padding: 10px 12px; margin-bottom: 6px;
    background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; touch-action: none;
}
.rank-item:last-child { margin-bottom: 0; }
.rank-item.is-dragging { border-color: var(--accent-line); background: #23202a; box-shadow: 0 12px 30px rgba(0, 0, 0, .45); position: relative; z-index: 5; }
.rank-item.is-selected { border-color: var(--accent-line); }
.rank-handle { cursor: grab; color: var(--dim); display: grid; place-items: center; width: 26px; height: 32px; border-radius: 7px; flex: none; touch-action: none; }
.rank-handle:hover { color: var(--text); background: var(--panel-3); }
.rank-pos { width: 26px; text-align: center; font-weight: 800; color: var(--dim); font-size: 12px; flex: none; }
.rank-swatch { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.rank-item__main { flex: 1; min-width: 0; }
.rank-item__main strong { display: block; }
.rank-item__main small { color: var(--dim); }
.perm-group { margin-bottom: 14px; }
.perm-group__title { font-size: 10.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); margin-bottom: 8px; }
.perm-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; }
.perm-list .check--box { font-size: 12.5px; }
.perm-list .check--box.is-locked { opacity: .5; cursor: not-allowed; }

/* -------------------------------- Wypłaty -------------------------------- */
.week-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.week-picker input[type=date] { width: 160px; }
.week-label { font-weight: 800; padding: 0 6px; }
.settle-table input.hours { width: 76px; height: 34px; text-align: right; padding: 0 9px; }
.settle-table input.note { min-width: 140px; height: 34px; }
.settle-table tr.is-done td { background: rgba(57, 201, 138, .04); }
.settle-table td.total { font-weight: 800; color: var(--gold); white-space: nowrap; }
.settle-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }
.sum-item { background: var(--panel-2); border: 1px solid var(--line); border-radius: 11px; padding: 10px 13px; }
.sum-item small { display: block; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.sum-item strong { display: block; font-size: 17px; font-weight: 800; margin-top: 3px; }
.sum-item--grand { border-color: rgba(232, 176, 74, .4); background: var(--gold-soft); }
.sum-item--grand strong { color: var(--gold); }
.report-preview { background: #0d0e10; border-radius: 12px; padding: 10px; overflow: auto; max-height: 64vh; text-align: center; }
.report-preview canvas { max-width: 100%; height: auto; border-radius: 6px; }

/* ---------------------------- Logowanie / instalator ---------------------------- */
.auth-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.auth-card { width: 100%; max-width: 420px; background: var(--device); border: 1px solid var(--line-2); border-radius: 20px; padding: 26px; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 20px; margin-bottom: 6px; }
.auth-card .muted { margin-bottom: 18px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.auth-alt { margin-top: 12px; text-align: center; }

/* -------------------------------- Responsywność -------------------------------- */
@media (max-width: 1100px) {
    .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .whoami__text { display: none; }
}
@media (max-width: 900px) {
    .device { margin: 0; height: 100vh; height: 100dvh; border-radius: 0; border: none; }
    .icon-btn.menu-btn { display: inline-grid; }
    .sidebar {
        position: absolute; top: 0; bottom: 0; left: 0; z-index: 60; background: var(--device);
        transform: translateX(-102%); transition: transform .18s ease; box-shadow: 20px 0 40px rgba(0, 0, 0, .4);
    }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .sidebar-backdrop { display: block; position: absolute; inset: 0; background: rgba(0, 0, 0, .55); z-index: 50; }
    .content { padding: 18px 16px 40px; }
    .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
    .pill--rank, #topSection { display: none; }
    .topbar { padding: 10px 12px; gap: 10px; }
}
@media (max-width: 680px) {
    .form-grid, .form-grid--3 { grid-template-columns: minmax(0, 1fr); }
    .form-grid .span-2 { grid-column: auto; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat__value { font-size: 21px; }
    .brand-text small { display: none; }
    .whoami { display: none; }
    .toolbar { padding: 12px; }
    .toolbar select, .toolbar input[type=date] { flex: 1 1 140px; }
    .page-head h1 { font-size: 20px; }
    .kv { grid-template-columns: minmax(0, 1fr); }
    .kv > div:nth-child(odd) { border-bottom: none; padding-bottom: 0; }
    .kv > div:nth-last-child(2) { border-bottom: none; }
    .modal-overlay { padding: 0; align-items: stretch; }
    .modal { border-radius: 0; min-height: 100%; border: none; }
    .lib-list { grid-template-columns: minmax(0, 1fr); padding: 12px; }
    /* Tabele jako karty na telefonie */
    table.table-stack thead { display: none; }
    table.table-stack, table.table-stack tbody, table.table-stack tr, table.table-stack td { display: block; width: 100%; }
    table.table-stack tr { border-bottom: 1px solid var(--line); padding: 10px 14px; }
    table.table-stack tr.row-group { padding: 0; }
    table.table-stack td { border: none; padding: 4px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
    table.table-stack td::before { content: attr(data-label); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); text-align: left; flex: none; padding-top: 2px; }
    table.table-stack td[data-label=""]::before { content: none; }
    table.table-stack td.cell-name { display: block; text-align: left; padding-bottom: 6px; }
    table.table-stack tr.row-group td { display: block; text-align: left; padding: 8px 14px; }
    table.table-stack tr.row-group td::before { content: none; }
    table.table-stack td::before { font-family: var(--font); }
    .seg { overflow-x: auto; grid-auto-columns: minmax(max-content, 1fr); scrollbar-width: none; }
    .seg button, .seg a { padding: 0 14px; letter-spacing: .06em; font-size: 10.5px; }
    .rank-item { flex-wrap: wrap; }
    .rank-item > .btn-row { width: 100%; justify-content: flex-end; }
    table.table-stack td.cell-name::before { content: none; }
    table.table-stack td.actions { justify-content: flex-end; padding-top: 8px; }
    table.table-stack tfoot { display: block; }
    table.table-stack tfoot tr { display: block; }
    .settle-table input.hours, .settle-table input.note { width: 55%; }
}

/* ---------------------------------- Druk ---------------------------------- */
.print-only { display: none; }
@media print {
    :root { --panel: #fff; --panel-2: #fff; --line: #ccc; --text: #000; --muted: #444; --dim: #555; }
    body { background: #fff !important; color: #000; font-size: 11px; }
    .device { height: auto; margin: 0; border: none; box-shadow: none; background: #fff; display: block; overflow: visible; }
    .topbar, .sidebar, .toolbar, .btn, .icon-btn, .toasts, .seg, .no-print, .page-head .btn-row { display: none !important; }
    .frame { display: block; }
    .content { overflow: visible; padding: 0; }
    .card { border: none; }
    th { background: #fff; color: #000; border-bottom: 2px solid #000; }
    td { border-bottom: 1px solid #ccc; }
    .yn--yes { color: #000; background: none; }
    .yn--no { color: #777; border: none; }
    .badge, .badge--rank { background: none !important; border: 1px solid #999 !important; color: #000 !important; }
    .print-only { display: block; }
    .table-wrap { overflow: visible; }
    tr { break-inside: avoid; }
}
