/* Wartownik – ciemny motyw */

:root {
    --bg: #0d0f14;
    --surface: #151821;
    --surface-2: #1b1f2a;
    --surface-3: #232836;
    --border: #262b38;
    --border-strong: #343a4b;
    --text: #e4e7ef;
    --text-2: #b4bacb;
    --muted: #7d8498;
    --accent: #7c8cff;
    --accent-2: #5d6cf0;
    --accent-soft: rgba(124, 140, 255, .14);

    --fatal: #ff4f73;
    --error: #ff7b54;
    --warning: #f2b544;
    --info: #4cb8ff;
    --debug: #8a91a6;
    --success: #34c98a;

    --radius: 10px;
    --radius-sm: 6px;
    --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
    --sans: "Segoe UI Variable", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 15px; margin-bottom: 12px; }

pre, code, .mono { font-family: var(--mono); font-size: 12.5px; }
pre { margin: 0; white-space: pre-wrap; word-break: break-word; }

.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.inline { display: inline; margin: 0; }
.spacer { flex: 1; }

/* ---------- Układ ---------- */

.container { max-width: 1280px; margin: 0 auto; padding: 24px; }

.topbar {
    position: sticky; top: 0; z-index: 10;
    /* Trzy kolumny: logo | menu (wyśrodkowane względem strony) | użytkownik. Boczne kolumny mają równą szerokość. */
    display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 24px;
    height: 56px; padding: 0 24px;
    background: rgba(13, 15, 20, .85);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 650; font-size: 15px; }
.brand:hover { text-decoration: none; }
.brand svg, .auth-brand svg { width: 22px; height: 22px; fill: var(--accent); }

.brand { justify-self: start; }
.nav { display: flex; gap: 4px; justify-self: center; }
.topbar-right { display: flex; align-items: center; gap: 14px; justify-self: end; }
.nav a {
    color: var(--text-2); padding: 6px 12px; border-radius: var(--radius-sm);
}
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-soft); color: var(--text); }

.topbar-user { color: var(--muted); font-size: 13px; }

.page-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 18px; }

/* ---------- Przyciski i formularze ---------- */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 34px; padding: 0 14px;
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface-2); color: var(--text);
    font: inherit; font-weight: 500; cursor: pointer;
    transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn-block { width: 100%; }
.btn-primary { background: var(--accent-2); border-color: var(--accent-2); color: #fff; }
.btn-primary:hover { background: var(--accent); }
.btn-ghost { background: transparent; }
.btn-success { background: rgba(52, 201, 138, .15); border-color: rgba(52, 201, 138, .45); color: var(--success); }
.btn-success:hover { background: rgba(52, 201, 138, .25); }
.btn-danger-ghost { background: transparent; border-color: transparent; color: var(--fatal); }
.btn-danger-ghost:hover { background: rgba(255, 79, 115, .12); }

input, select {
    height: 34px; padding: 0 10px;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    font: inherit; outline: none;
}
input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select { padding-right: 28px; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field span { color: var(--text-2); font-size: 13px; }
.field input { height: 40px; }
.stack { display: flex; flex-direction: column; gap: 14px; }

.alert { padding: 10px 14px; border-radius: var(--radius-sm); margin-bottom: 16px; border: 1px solid; }
.alert-error { background: rgba(255, 79, 115, .1); border-color: rgba(255, 79, 115, .35); color: #ff9db0; }
.alert-success { background: rgba(52, 201, 138, .1); border-color: rgba(52, 201, 138, .35); color: #7fe0b5; }

/* ---------- Logowanie ---------- */

.auth-page {
    min-height: 100vh; display: grid; place-items: center; padding: 24px;
    background: radial-gradient(800px 400px at 50% -10%, rgba(124, 140, 255, .14), transparent 70%);
}
.auth-card {
    width: 100%; max-width: 360px; padding: 32px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, .45);
}
.auth-brand { text-align: center; margin-bottom: 24px; }
.auth-brand svg { width: 40px; height: 40px; }
.auth-brand h1 { margin-top: 8px; font-size: 20px; }
.auth-brand p { margin: 4px 0 0; color: var(--muted); }

/* ---------- Karty, chipy, odznaki ---------- */

.card {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    padding: 18px; margin-bottom: 16px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; }

.chip {
    display: inline-flex; align-items: center; height: 20px; padding: 0 8px;
    background: var(--surface-3); color: var(--text-2); border-radius: 999px; font-size: 11.5px;
}

.badge {
    display: inline-flex; align-items: center; height: 20px; padding: 0 8px;
    border-radius: 999px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
    background: var(--surface-3); color: var(--text-2);
}
.badge-warning { background: rgba(242, 181, 68, .15); color: var(--warning); }
.badge-success { background: rgba(52, 201, 138, .15); color: var(--success); }
.badge-danger { background: rgba(255, 79, 115, .15); color: var(--fatal); }
.badge-open { background: var(--accent-soft); color: var(--accent); }
.badge-muted { background: var(--surface-3); color: var(--muted); }

/* Kolory poziomów – ustawiają zmienną --lvl używaną przez paski, kropki i odznaki. */
.level-fatal { --lvl: var(--fatal); }
.level-error { --lvl: var(--error); }
.level-warning { --lvl: var(--warning); }
.level-info { --lvl: var(--info); }
.level-debug { --lvl: var(--debug); }

.level-badge { background: color-mix(in srgb, var(--lvl, var(--muted)) 18%, transparent); color: var(--lvl, var(--muted)); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; background: var(--lvl, var(--muted)); }

/* ---------- Lista błędów ---------- */

.filters { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.search { position: relative; flex: 1; min-width: 240px; }
.search svg {
    position: absolute; left: 10px; top: 9px; width: 16px; height: 16px;
    fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round;
}
.search input { width: 100%; padding-left: 34px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.tab {
    padding: 8px 14px; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }
.tab .count {
    display: inline-block; min-width: 20px; padding: 0 6px; margin-left: 6px;
    background: var(--surface-3); border-radius: 999px; font-size: 11.5px; text-align: center; color: var(--text-2);
}

.issue-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.issue-list-head, .issue-row {
    display: grid; grid-template-columns: 4px 1fr 90px 130px; align-items: center; column-gap: 14px;
}
.issue-list-head {
    padding: 8px 16px 8px 0; color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
    border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.issue-list-head span:first-child { grid-column: 2; }

.issue-row { padding: 12px 16px 12px 0; color: var(--text); border-bottom: 1px solid var(--border); }
.issue-row:last-child { border-bottom: 0; }
.issue-row:hover { background: var(--surface-2); text-decoration: none; }

.level-bar { align-self: stretch; border-radius: 0 3px 3px 0; background: var(--lvl, var(--muted)); }

.issue-main { min-width: 0; }
.issue-title { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.issue-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 4px; color: var(--muted); font-size: 12.5px; }
.issue-meta .mono { color: var(--text-2); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 420px; }

.issue-count { font-size: 15px; font-weight: 600; }
.issue-time { display: flex; flex-direction: column; color: var(--text-2); }
.issue-time small { color: var(--muted); font-size: 11.5px; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 16px; }

.empty {
    text-align: center; padding: 56px 24px; color: var(--muted);
    border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.empty svg { width: 44px; height: 44px; fill: none; stroke: var(--success); stroke-width: 1.6; stroke-linejoin: round; stroke-linecap: round; }
.empty h2 { color: var(--text); margin: 10px 0 4px; }
.empty p { margin: 0; }

/* ---------- Szczegóły błędu ---------- */

.back { display: inline-block; color: var(--muted); margin-bottom: 14px; }
.back:hover { color: var(--text); }

.issue-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 18px; }
.issue-header-main { min-width: 0; }
.issue-header-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.issue-heading { font-size: 20px; word-break: break-word; margin-bottom: 6px; }
.issue-actions { display: flex; gap: 8px; flex-shrink: 0; }
.issue-actions form { display: flex; gap: 8px; }

.stats {
    display: grid; grid-template-columns: repeat(6, 1fr); gap: 1px;
    background: var(--border); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
    margin-bottom: 18px;
}
.stat { background: var(--surface); padding: 14px 16px; display: flex; flex-direction: column; }
.stat-value { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.stat-value.sm { font-size: 14px; padding-top: 5px; padding-bottom: 4px; }
.stat-label { color: var(--muted); font-size: 12px; }

.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }

.event-bar {
    display: flex; flex-wrap: wrap; align-items: center; gap: 12px;
    padding: 10px 14px; margin-bottom: 16px;
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-2);
}
.event-bar strong { color: var(--text); }

.toggle { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12.5px; cursor: pointer; user-select: none; }
.toggle input { height: auto; width: 14px; accent-color: var(--accent); }

.exception { margin-left: calc(var(--depth, 0) * 16px); }
.exception + .exception { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border-strong); }
.exception-cause { color: var(--muted); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.exception-type { font-family: var(--mono); color: var(--error); font-weight: 600; font-size: 13.5px; }
.exception-message { margin: 4px 0 12px; font-size: 14.5px; word-break: break-word; }

.frames {
    list-style: none; margin: 0; padding: 0;
    border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
    font-family: var(--mono); font-size: 12.5px;
}
.frame {
    display: flex; justify-content: space-between; gap: 16px;
    padding: 7px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.frame:last-child { border-bottom: 0; }
.frame-symbol { word-break: break-all; }
.frame-symbol strong { color: var(--text); font-weight: 600; }
.frame-dot { color: var(--muted); }
.frame-file { color: var(--muted); white-space: nowrap; }
.frame-app { background: var(--surface-3); box-shadow: inset 3px 0 0 var(--accent); }
.frame-app .frame-symbol { color: var(--text-2); }
.frame-sys { color: var(--muted); }
.frame-sys .frame-symbol strong { color: var(--text-2); font-weight: 500; }
.hide-sys .frame-sys { display: none; }

details.raw { margin-top: 10px; }
details.raw summary { cursor: pointer; color: var(--text-2); font-size: 12.5px; padding: 4px 0; }
details.raw summary:hover { color: var(--text); }
details.raw pre, pre.message {
    margin-top: 8px; padding: 12px; max-height: 480px; overflow: auto;
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-2);
}
details.raw .btn { margin-top: 8px; }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
.table th { color: var(--muted); font-weight: 500; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; }
.table tr:last-child td { border-bottom: 0; }
.crumbs td:nth-child(2) { color: var(--text-2); }
.crumbs td:nth-child(3) { white-space: nowrap; color: var(--text-2); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }

.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; font-size: 12px; }
.tag-key { padding: 2px 8px; background: var(--surface-3); color: var(--muted); }
.tag-value { padding: 2px 8px; color: var(--text); }

.event-list { list-style: none; margin: 0 -8px; padding: 0; }
.event-list a {
    display: grid; grid-template-columns: 14px auto; column-gap: 4px; align-items: center;
    padding: 6px 8px; border-radius: var(--radius-sm); color: var(--text-2);
}
.event-list a:hover { background: var(--surface-2); text-decoration: none; }
.event-list a.active { background: var(--accent-soft); color: var(--text); }
.event-list .dot { margin: 0; }
.event-list-time { font-family: var(--mono); font-size: 12.5px; }
.event-list-meta { grid-column: 2; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Projekty ---------- */

.row-form { display: flex; gap: 10px; }
.row-form input { flex: 1; }

.project-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; }
.project-head h2 { margin-bottom: 2px; }
.project-head h2 a { color: var(--text); }
.project-actions { display: flex; gap: 6px; }

.key-row {
    display: flex; align-items: center; gap: 12px; padding: 8px 12px;
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
}
.key-label { color: var(--muted); font-size: 12px; white-space: nowrap; }
.key { flex: 1; color: var(--accent); overflow-x: auto; white-space: nowrap; }

/* ---------- Responsywność ---------- */

@media (max-width: 960px) {
    .detail-grid { grid-template-columns: 1fr; }
    .stats { grid-template-columns: repeat(3, 1fr); }
    .issue-header { flex-direction: column; }
}

@media (max-width: 640px) {
    .container { padding: 16px; }
    .topbar { padding: 0 12px; gap: 8px; grid-template-columns: auto minmax(0, 1fr) auto; }
    .brand span { display: none; }
    /* Na telefonie menu przewija się w poziomie zamiast rozpychać stronę. */
    .nav { position: relative; justify-self: stretch; justify-content: safe center; overflow-x: auto; scrollbar-width: none; }
    .nav::-webkit-scrollbar { display: none; }
    /* Delikatne wygaszenie krawędzi – widać, że menu da się przesunąć. */
    .nav { -webkit-mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent); mask-image: linear-gradient(to right, transparent, #000 14px, #000 calc(100% - 14px), transparent); }
    .nav a { padding: 6px 8px; white-space: nowrap; }
    .topbar-user { display: none; }
    .issue-list-head, .issue-row { grid-template-columns: 4px 1fr 70px; }
    .issue-list-head span:last-child, .issue-time { display: none; }
    .stats { grid-template-columns: repeat(2, 1fr); }
    .row-form { flex-direction: column; }
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 10px; border: 2px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Usuwanie (strona potwierdzenia) ---------- */

.btn-danger { background: var(--fatal); border-color: var(--fatal); color: #fff; }
.btn-danger:hover { background: #ff6a88; }

.danger-card {
    max-width: 640px; padding: 24px;
    background: var(--surface); border: 1px solid rgba(255, 79, 115, .4); border-radius: var(--radius);
}
.danger-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.danger-head h1 { font-size: 19px; word-break: break-word; }
.danger-head svg {
    flex-shrink: 0; width: 28px; height: 28px;
    fill: none; stroke: var(--fatal); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round;
}
.danger-card p { margin: 0 0 12px; color: var(--text-2); }
.danger-card code { color: var(--text); }
.danger-list { margin: 0 0 14px; padding-left: 20px; color: var(--text-2); }
.danger-list li { margin: 3px 0; }
.danger-note { color: var(--fatal) !important; font-weight: 600; }
.danger-actions { display: flex; justify-content: flex-end; gap: 10px; }

/* ---------- Dokumentacja ---------- */

.docs { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 24px; align-items: start; }
.docs-toc {
    position: sticky; top: 76px;
    display: flex; flex-direction: column; gap: 2px;
}
.docs-toc a { color: var(--text-2); padding: 5px 10px; border-radius: var(--radius-sm); font-size: 13px; }
.docs-toc a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.docs-body section { scroll-margin-top: 72px; }
.docs-body h3 { font-size: 13px; font-weight: 600; color: var(--text-2); margin: 16px 0 6px; }
.docs-body p { margin: 0 0 10px; color: var(--text-2); }
.docs-body p code, .docs-body td code, .docs-body li code, .docs-body h2 code {
    background: var(--surface-3); color: var(--text); padding: 1px 5px; border-radius: 4px; font-size: 12px;
}
.docs-body pre.code {
    margin: 8px 0 10px; padding: 12px 14px; overflow: auto;
    background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text);
}
.docs-body pre.code + .btn { margin: -2px 0 8px; }
.docs-body .note {
    padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--accent-soft);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-2);
}
.docs-table { margin-top: 4px; }
.docs-table td:first-child { white-space: nowrap; }
.docs-table td { color: var(--text-2); }
.docs-list { margin: 0; padding-left: 20px; color: var(--text-2); }
.docs-list li { margin: 4px 0; }

@media (max-width: 960px) {
    /* minmax(0, 1fr) – inaczej szerokie tabele i bloki kodu rozpychają kolumnę poza ekran. */
    .docs { grid-template-columns: minmax(0, 1fr); }
    .docs-toc { position: static; flex-direction: row; flex-wrap: wrap; }
    .docs-table td:first-child { white-space: normal; }
    .docs-table { display: block; overflow-x: auto; }
}

/* ---------- Opis od użytkownika ---------- */

.badge-comment { background: rgba(76, 184, 255, .14); color: var(--info); }

.user-comment { border-color: rgba(76, 184, 255, .35); }
.user-comment blockquote {
    margin: 0 0 10px; padding: 10px 14px;
    border-left: 3px solid var(--info); border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: var(--surface-2); color: var(--text);
    white-space: pre-wrap; word-break: break-word; font-size: 14.5px;
}

.comment-mark {
    display: inline-block; margin-left: 8px; padding: 0 6px; height: 16px; line-height: 16px;
    border-radius: 999px; background: rgba(76, 184, 255, .14); color: var(--info);
    font-family: var(--sans); font-size: 10.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
    vertical-align: 1px;
}

/* ---------- Powiadomienia ---------- */

.notif-intro { max-width: 860px; margin: -6px 0 18px; }
.notif-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.notif-card { margin-bottom: 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; margin-bottom: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid input, .form-grid select { width: 100%; height: 36px; }
.form-grid input[type=checkbox] { width: 14px; height: auto; }
.form-grid .toggle { margin-top: -6px; }
textarea {
    width: 100%; padding: 8px 10px; resize: vertical;
    background: var(--surface); color: var(--text);
    border: 1px solid var(--border-strong); border-radius: var(--radius-sm); font: inherit; outline: none;
}
textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.form-actions { display: flex; justify-content: flex-end; gap: 10px; }

.status-line { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 6px; color: var(--text-2); word-break: break-word; }
.status-line .dot { flex-shrink: 0; margin: 6px 0 0; }
.dot.ok { background: var(--success); }
.dot.fail { background: var(--fatal); }

.channel-list { list-style: none; margin: 0 0 10px; padding: 0; }
.channel-list li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.channel-list li:last-child { border-bottom: 0; }

.channel-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 10px; padding: 0 12px; }
.channel-row select { height: 30px; }
.channel-warn { color: var(--warning); font-size: 12.5px; }

@media (max-width: 960px) {
    .notif-grid { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-grid .span-2 { grid-column: auto; }
}

/* ---------- Telefon: zakładki statusów przewijane w poziomie ---------- */

@media (max-width: 640px) {
    .tabs { overflow-x: auto; scrollbar-width: none; }
    .tabs::-webkit-scrollbar { display: none; }
    .tab { white-space: nowrap; flex-shrink: 0; padding: 8px 10px; }
    .page-head { flex-wrap: wrap; row-gap: 4px; }
}

/* ---------- Menu użytkownika ---------- */

.avatar {
    display: inline-grid; place-items: center; flex-shrink: 0;
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--accent-soft); color: var(--accent);
    font-size: 11.5px; font-weight: 650; letter-spacing: .02em;
}
.avatar-lg { width: 48px; height: 48px; font-size: 17px; }

.user-menu { position: relative; }
.user-menu-trigger {
    display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 8px 0 4px;
    border-radius: 999px; cursor: pointer; list-style: none; user-select: none;
    border: 1px solid transparent; transition: background .12s, border-color .12s;
}
.user-menu-trigger::-webkit-details-marker { display: none; }
.user-menu-trigger:hover, .user-menu[open] .user-menu-trigger { background: var(--surface-2); border-color: var(--border); }
.user-menu-trigger.active .avatar { box-shadow: 0 0 0 2px var(--accent); }
.user-menu-trigger .topbar-user { color: var(--text-2); max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-trigger .caret { width: 14px; height: 14px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.user-menu[open] .caret { transform: rotate(180deg); }
.user-menu-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.user-menu-panel {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 20;
    min-width: 230px; padding: 6px;
    background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
    box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
}
.user-menu-head { display: flex; flex-direction: column; padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.user-menu-head strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-panel a, .user-menu-panel button {
    display: flex; align-items: center; gap: 10px; width: 100%;
    padding: 7px 10px; border: 0; border-radius: var(--radius-sm);
    background: transparent; color: var(--text-2); font: inherit; text-align: left; cursor: pointer;
}
.user-menu-panel a:hover, .user-menu-panel button:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.user-menu-panel a.active { background: var(--accent-soft); color: var(--text); }
.user-menu-panel svg { width: 16px; height: 16px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.user-menu-panel hr { margin: 4px 0; border: 0; border-top: 1px solid var(--border); }
.user-menu-panel form { margin: 0; }
.user-menu-panel button:hover { color: var(--fatal); }

/* ---------- Użytkownicy ---------- */

.icon { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.users-intro { max-width: 760px; margin: -6px 0 18px; }

.user-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.user-row {
    display: grid; grid-template-columns: 36px minmax(0, 1fr) 110px 190px 70px; align-items: center; column-gap: 14px;
    padding: 12px 16px; color: var(--text); border-bottom: 1px solid var(--border);
}
.user-row:last-child { border-bottom: 0; }
.user-row:hover { background: var(--surface-2); text-decoration: none; }
.user-row .avatar { width: 34px; height: 34px; font-size: 12.5px; }
.user-row.is-off .avatar { background: var(--surface-3); color: var(--muted); }
.user-row.is-off .user-name { color: var(--text-2); }
.user-main { min-width: 0; display: flex; flex-direction: column; }
.user-name { display: flex; align-items: center; gap: 8px; font-weight: 550; }
.user-meta { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta .mono { color: var(--text-2); font-size: 12px; }
.user-edit { color: var(--muted); font-size: 12.5px; text-align: right; }
.user-row:hover .user-edit { color: var(--accent); }

.user-edit-grid, .account-grid { display: grid; gap: 16px; align-items: start; }
.user-edit-grid { grid-template-columns: minmax(0, 1fr) 300px; max-width: 1040px; }
.account-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); max-width: 1040px; }
.account-grid .card, .user-edit-grid > .card { margin-bottom: 0; }
.section-title { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--border); }
.danger-zone { border-color: rgba(255, 79, 115, .3); }
.danger-zone p { margin: 0 0 10px; }
.account-head { align-items: center; gap: 14px; }

@media (max-width: 960px) {
    .user-edit-grid, .account-grid { grid-template-columns: 1fr; }
    .user-row { grid-template-columns: 36px minmax(0, 1fr) 110px; }
    .user-login, .user-edit { display: none; }
}
@media (max-width: 640px) {
    .user-menu-trigger { padding: 0 4px; }
    .user-menu-trigger .caret { display: none; }
    .user-row { grid-template-columns: 36px minmax(0, 1fr) auto; padding: 12px; }
}

/* Przycisk po prawej stronie paska zdarzenia (np. "Kopiuj jako Markdown"). */
.event-bar-action { margin-left: auto; }
