/* Opony Rower — wygląd aplikacji (wspólny z Garażem). Motyw jasny i ciemny (ustawienie systemu albo wybór w menu: html[data-theme]). */

:root {
    --bg: #f4f6fa;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --surface-3: #eef2f7;
    --border: #e3e8f0;
    --border-2: #d3dbe7;
    --text: #0f172a;
    --text-2: #475569;
    --text-3: #8592a6;
    --accent: #2457d6;
    --accent-2: #1c46b0;
    --accent-soft: #e9f0ff;
    --accent-text: #ffffff;
    --ok: #15803d;
    --ok-soft: #e6f6ec;
    --soon: #b45309;
    --soon-soft: #fdf2df;
    --bad: #dc2626;
    --bad-soft: #fdeaea;
    --info: #2457d6;
    --info-soft: #e9f0ff;
    --sb-bg: #0b1120;
    --sb-bg-2: #111a2e;
    --sb-text: #c9d3e3;
    --sb-muted: #6b7a93;
    --sb-line: rgba(255, 255, 255, .07);
    --sb-hover: rgba(255, 255, 255, .06);
    --sb-active: rgba(96, 140, 255, .18);
    --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05);
    --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 6px 20px -6px rgba(15, 23, 42, .08);
    --shadow-lg: 0 24px 60px -12px rgba(15, 23, 42, .35);
    --radius: 14px;
    --radius-sm: 10px;
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
    color-scheme: light;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --bg: #0c1222;
        --surface: #121a2c;
        --surface-2: #161f34;
        --surface-3: #1b2640;
        --border: #232f48;
        --border-2: #2f3c5a;
        --text: #e7ecf5;
        --text-2: #a6b2c7;
        --text-3: #6d7b95;
        --accent: #5d8dff;
        --accent-2: #7ba3ff;
        --accent-soft: rgba(93, 141, 255, .15);
        --accent-text: #0b1120;
        --ok: #4ade80;
        --ok-soft: rgba(74, 222, 128, .12);
        --soon: #fbbf24;
        --soon-soft: rgba(251, 191, 36, .13);
        --bad: #f87171;
        --bad-soft: rgba(248, 113, 113, .13);
        --info: #7ba3ff;
        --info-soft: rgba(93, 141, 255, .15);
        --sb-bg: #080d19;
        --sb-bg-2: #0e1526;
        --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .45);
        color-scheme: dark;
    }
}
:root[data-theme="dark"] {
    --bg: #0c1222;
    --surface: #121a2c;
    --surface-2: #161f34;
    --surface-3: #1b2640;
    --border: #232f48;
    --border-2: #2f3c5a;
    --text: #e7ecf5;
    --text-2: #a6b2c7;
    --text-3: #6d7b95;
    --accent: #5d8dff;
    --accent-2: #7ba3ff;
    --accent-soft: rgba(93, 141, 255, .15);
    --accent-text: #0b1120;
    --ok: #4ade80;
    --ok-soft: rgba(74, 222, 128, .12);
    --soon: #fbbf24;
    --soon-soft: rgba(251, 191, 36, .13);
    --bad: #f87171;
    --bad-soft: rgba(248, 113, 113, .13);
    --info: #7ba3ff;
    --info-soft: rgba(93, 141, 255, .15);
    --sb-bg: #080d19;
    --sb-bg-2: #0e1526;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px -8px rgba(0, 0, 0, .45);
    color-scheme: dark;
}

/* ------------------------------------------------------------ podstawy */

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 15px/1.5 var(--font);
    -webkit-font-smoothing: antialiased;
    font-variant-numeric: tabular-nums;
}
h1, h2, h3 { margin: 0; line-height: 1.25; letter-spacing: -.01em; }
h1 { font-size: 28px; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 15px; font-weight: 650; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); font-size: .86em; background: var(--surface-3); padding: 1px 6px; border-radius: 6px; color: var(--text-2); white-space: nowrap; }
code:empty { display: none; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.i { width: 18px; height: 18px; flex: none; }
.grow { flex: 1 1 auto; }
.muted { color: var(--text-3); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; color: var(--text-3); display: block; }
.block { display: block; }
.pad { padding: 16px 20px; }
.pad-x { padding: 0 20px 20px; }
.danger-text { color: var(--bad) !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sub { color: var(--text-2); font-size: 14px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------ przyciski */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 7px;
    height: 38px; padding: 0 15px; border-radius: 10px;
    border: 1px solid var(--border-2); background: var(--surface); color: var(--text);
    font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap;
    box-shadow: var(--shadow-sm); transition: background .15s, border-color .15s, transform .05s;
    text-decoration: none !important;
}
.btn:hover { background: var(--surface-2); border-color: var(--text-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn .i { width: 17px; height: 17px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.danger:hover { filter: brightness(.94); }
.btn.ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--text-2); }
.btn.ghost:hover { background: var(--surface-3); color: var(--text); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.wide { width: 100%; height: 44px; }
.btn-icon {
    display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 10px;
    border: 0; background: transparent; color: var(--text-2); cursor: pointer; flex: none;
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); }
.btn-icon.sm { width: 30px; height: 30px; border-radius: 8px; }
.btn-icon.sm .i { width: 16px; height: 16px; }
.link-btn { border: 0; background: none; padding: 0; color: var(--accent); font-size: 12.5px; font-weight: 600; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.seg { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--border); background: var(--surface); border-radius: 11px; padding: 2px; }
.seg .btn-icon { width: 32px; height: 32px; }

/* ------------------------------------------------------------ powłoka */

.shell { display: grid; grid-template-columns: 268px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.sidebar {
    position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto;
    background: linear-gradient(180deg, var(--sb-bg-2), var(--sb-bg) 40%);
    color: var(--sb-text); display: flex; flex-direction: column; padding: 18px 14px 14px;
    border-right: 1px solid var(--sb-line);
    padding-top: max(18px, env(safe-area-inset-top));
}
.sb-brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 18px; }
.sb-brand img { border-radius: 9px; }
.sb-brand strong { display: block; color: #fff; font-size: 17px; letter-spacing: -.01em; }
.sb-brand span { display: block; font-size: 11.5px; color: var(--sb-muted); }
.sb-brand .sb-close { margin-left: auto; color: var(--sb-text); display: none; }
.sb-link {
    display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 10px;
    color: var(--sb-text); text-decoration: none !important; font-weight: 550; font-size: 14px; position: relative;
}
.sb-link .i { color: var(--sb-muted); }
.sb-link:hover { background: var(--sb-hover); }
.sb-link.active { background: var(--sb-active); color: #fff; }
.sb-link.active .i { color: #8fb0ff; }
.sb-badge { margin-left: auto; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; font-size: 11.5px; font-weight: 700; display: grid; place-items: center; }
.sb-badge.overdue { background: #ef4444; color: #fff; }
.sb-badge.soon { background: #f59e0b; color: #1f1300; }
.sb-title { display: flex; align-items: center; justify-content: space-between; margin: 22px 8px 6px 10px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sb-muted); }
.sb-title .btn-icon { color: var(--sb-text); }
.sb-title .btn-icon:hover { background: var(--sb-hover); color: #fff; }
.sb-empty { color: var(--sb-muted); font-size: 13px; padding: 6px 10px; }
.sb-foot { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 2px; }
.sb-link .dot { margin-left: auto; }
.sb-user { display: flex; align-items: center; gap: 10px; padding: 12px 6px 2px 8px; margin-top: 8px; border-top: 1px solid var(--sb-line); }
.sb-user .btn-icon { color: var(--sb-muted); width: 32px; height: 32px; }
.sb-user .btn-icon:hover { background: var(--sb-hover); color: #fff; }
.sb-user-t { min-width: 0; flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.sb-user-t b { color: #fff; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; }
.sb-user-t small { color: var(--sb-muted); font-size: 12px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none; font-size: 12.5px; font-weight: 700; color: #fff; background: linear-gradient(135deg, #3b6ef5, #7c3aed); letter-spacing: .02em; }
.avatar.sm { width: 30px; height: 30px; font-size: 11px; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; background: var(--text-3); }
.dot.ok { background: #22c55e; }
.dot.soon { background: #f59e0b; }
.dot.overdue { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, .2); }
.scrim { display: none; }
.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: none; }
.page { width: 100%; max-width: 1320px; margin: 0 auto; padding: 30px 34px 60px; outline: none; transition: opacity .15s; }
.page.loading > * { opacity: .55; }

.skeleton-page { display: grid; gap: 18px; }
.sk { height: 110px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: sk 1.4s infinite linear; }
.sk.h { height: 54px; width: 46%; }
.sk.big { height: 320px; }
.sk-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ------------------------------------------------------------ nagłówki stron, karty, kafelki */

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 24px; flex-wrap: wrap; margin-bottom: 24px; }
.page-head h1 { margin-top: 4px; }
.page-head .sub { margin-top: 6px; }
.section-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 14px 24px; flex-wrap: wrap; margin: 4px 0 18px; }
.section-head h2 { font-size: 20px; font-weight: 700; }
.section-head .sub { margin-top: 4px; max-width: 760px; }
.list-title { font-size: 12.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--text-3); margin: 26px 0 10px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2 { display: flex; align-items: center; gap: 9px; }
.card-head h2 .i { color: var(--text-3); }
.card-head .sub { font-size: 13px; margin-top: 2px; }

.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tiles.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile {
    position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 16px 18px 16px; display: flex; flex-direction: column; gap: 2px; color: var(--text); text-decoration: none !important; overflow: hidden; min-width: 0;
}
a.tile:hover { border-color: var(--border-2); transform: translateY(-1px); transition: transform .15s, border-color .15s; }
.tile::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: transparent; }
.tile.overdue::before { background: var(--bad); }
.tile.soon::before { background: var(--soon); }
.tile.ok::before { background: var(--ok); }
.tile-ic { position: absolute; top: 14px; right: 14px; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-3); color: var(--text-2); }
.tile.overdue .tile-ic { background: var(--bad-soft); color: var(--bad); }
.tile.soon .tile-ic { background: var(--soon-soft); color: var(--soon); }
.tile.ok .tile-ic { background: var(--ok-soft); color: var(--ok); }
.tile small { font-size: 12.5px; font-weight: 600; color: var(--text-3); padding-right: 40px; }
.tile b { font-size: 24px; font-weight: 700; letter-spacing: -.02em; line-height: 1.2; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile > span:last-child, .tile > span:not(.tile-ic) { font-size: 13px; color: var(--text-2); }
.tile.overdue b { color: var(--bad); }

.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; background: var(--surface-3); color: var(--text-2); }
.chip .i { width: 13px; height: 13px; }
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.soon { background: var(--soon-soft); color: var(--soon); }
.chip.overdue { background: var(--bad-soft); color: var(--bad); }
.chip.info { background: var(--info-soft); color: var(--info); }
.chip.muted { background: var(--surface-3); color: var(--text-2); }
.tag { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 6px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }

.empty { text-align: center; padding: 34px 20px; color: var(--text-2); }
.empty-icon { width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 16px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty-icon .i { width: 24px; height: 24px; }
.empty h3 { color: var(--text); font-size: 16px; margin-bottom: 4px; }
.empty p { max-width: 460px; margin: 0 auto; font-size: 14px; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }

.banner { display: flex; gap: 14px; align-items: center; padding: 14px 18px; border-radius: var(--radius); margin-bottom: 18px; background: var(--info-soft); color: var(--info); border: 1px solid transparent; }
.banner .i { width: 26px; height: 26px; }
.banner b { display: block; color: var(--text); }
.banner span { font-size: 13.5px; color: var(--text-2); }
.banner.soon { background: var(--soon-soft); color: var(--soon); }
.banner.overdue { background: var(--bad-soft); color: var(--bad); }


.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; margin-top: 20px; align-items: start; }
.two-col:first-child { margin-top: 0; }
.tiles + .two-col { margin-top: 0; }
.stack { display: grid; gap: 20px; align-content: start; }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 20px; align-items: start; }

.tabs { display: flex; gap: 4px; margin: 20px 0 22px; border-bottom: 1px solid var(--border); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { display: inline-flex; align-items: center; gap: 8px; padding: 11px 14px; color: var(--text-2); font-weight: 600; font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; text-decoration: none !important; }
.tab .i { width: 17px; height: 17px; color: var(--text-3); }
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab.active .i { color: var(--accent); }

.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; background: var(--surface-2); }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--surface-2); }
.table .num { text-align: right; white-space: nowrap; }
.table td.act { width: 1%; white-space: nowrap; text-align: right; }
.table tfoot td { font-weight: 700; border-top: 1px solid var(--border-2); border-bottom: 0; }
.table .sub-row td { color: var(--text-2); }
.card > .table-wrap:last-child .table tr:last-child td:first-child { border-bottom-left-radius: var(--radius); }

.dl { margin: 0; padding: 8px 20px 16px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.dl > div { padding: 9px 0; border-bottom: 1px dashed var(--border); min-width: 0; }
.dl dt { font-size: 12px; color: var(--text-3); font-weight: 600; }
.dl dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.dl.compact { padding: 0; grid-template-columns: 1fr; }
.dl.compact > div { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; }
.dl.compact dd { text-align: right; font-size: 13.5px; }

/* ------------------------------------------------------------ formularze */

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid > .wide, .form-grid > .hint { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.wide { grid-column: 1 / -1; }
.field > label, .field > span { font-size: 13px; font-weight: 600; color: var(--text-2); }
input[type=text], input[type=email], input[type=tel], input[type=url], input[type=search], input[type=password], input[type=date], input[type=time], input[type=number], input:not([type]), select, textarea {
    width: 100%; height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border-2); background: var(--surface);
    color: var(--text); font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s; min-width: 0;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.45; }
select { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238592a6' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[readonly] { background: var(--surface-2); color: var(--text-2); }
input[type=date], input[type=time] { min-height: 40px; }
input::placeholder, textarea::placeholder { color: var(--text-3); }
.with-suffix { position: relative; display: flex; align-items: center; }
.with-suffix input { padding-right: 46px; }
.suffix { position: absolute; right: 12px; font-size: 13px; color: var(--text-3); pointer-events: none; }
.hint { font-size: 12.5px; color: var(--text-3); line-height: 1.4; }
.check { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; flex: none; }
.check.wide { grid-column: 1 / -1; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; }
.checks.inline { display: flex; flex-wrap: wrap; gap: 8px; }
.pill-check { padding: 0; }
.pill-check input { position: absolute; opacity: 0; pointer-events: none; }
.pill-check span { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border-2); font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.pill-check input:checked + span { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.pill-check input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.row-tools { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
.form-actions .form-msg { flex: 1; text-align: left; }
.form-msg { color: var(--bad); font-size: 13.5px; font-weight: 600; min-height: 0; }
.form-msg:empty { display: none; }
.inline { display: flex; gap: 8px; align-items: center; }
.inline input, .inline select { flex: 1; }
.user-cell { display: inline-flex; align-items: center; gap: 10px; }
ul.plain { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 5px; font-size: 14px; }

/* wybór rodzaju wpisu */

/* ------------------------------------------------------------ okna i powiadomienia */

dialog.modal {
    width: min(560px, calc(100vw - 24px)); max-height: calc(100dvh - 40px); padding: 0; border: 1px solid var(--border); border-radius: 18px;
    background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); overflow: hidden;
}
dialog.modal.wide { width: min(780px, calc(100vw - 24px)); }
dialog.modal[open] { animation: pop .18s ease-out; }
dialog.modal::backdrop { background: rgba(8, 13, 25, .55); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.985); } }
dialog.modal form { display: flex; flex-direction: column; max-height: calc(100dvh - 40px); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 16px 14px 22px; border-bottom: 1px solid var(--border); }
.modal-head h2 { font-size: 17px; }
.modal-body { padding: 20px 22px; overflow-y: auto; }
dialog.modal > form > .form-msg { padding: 0 22px 10px; }
.modal-foot { display: flex; gap: 10px; align-items: center; padding: 14px 22px; border-top: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.modal-body .hint { margin-top: 12px; display: block; }
.confirm-text { font-size: 15px; color: var(--text-2); }

.toasts { position: fixed; z-index: 100; right: 20px; bottom: 20px; display: grid; gap: 8px; pointer-events: none; }
.toast {
    display: flex; gap: 10px; align-items: center; min-width: 240px; max-width: 420px; padding: 12px 16px; border-radius: 12px;
    background: #0f172a; color: #f1f5f9; box-shadow: var(--shadow-lg); font-size: 14px; font-weight: 550; animation: pop .2s ease-out; transition: opacity .4s, transform .4s;
}
.toast .i { color: #4ade80; }
.toast.error .i { color: #f87171; }
.toast.out { opacity: 0; transform: translateY(6px); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .toast { background: #26324d; border: 1px solid #36456a; } }
:root[data-theme="dark"] .toast { background: #26324d; border: 1px solid #36456a; }


/* ------------------------------------------------------------ logowanie */

.login-page { min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.login { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(380px, 520px); }
.login-art {
    background:
        radial-gradient(80% 60% at 20% 100%, rgba(45, 212, 191, .22), transparent 60%),
        radial-gradient(70% 60% at 90% 10%, rgba(93, 141, 255, .35), transparent 60%),
        linear-gradient(160deg, #0f1a33, #080d19);
    color: #dbe4f3; display: flex; align-items: center; justify-content: center; padding: 60px;
}
.login-art-in { max-width: 460px; }
.login-art img { border-radius: 14px; box-shadow: 0 12px 30px rgba(0, 0, 0, .35); }
.login-art h2 { color: #fff; font-size: 30px; font-weight: 700; letter-spacing: -.02em; margin: 26px 0 20px; line-height: 1.2; }
.login-art ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.login-art li { display: flex; gap: 12px; align-items: center; font-size: 15.5px; }
.login-art li::before { content: ""; width: 20px; height: 20px; flex: none; border-radius: 50%; background: rgba(93, 141, 255, .25) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8c2ff' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 12px no-repeat; }
.login-card { align-self: center; justify-self: center; width: 100%; max-width: 400px; padding: 40px 32px; display: flex; flex-direction: column; gap: 14px; }
.login-mark { border-radius: 16px; box-shadow: var(--shadow); }
.login-card h1 { font-size: 30px; margin-top: 6px; }
.login-lead { color: var(--text-2); margin-top: -8px; margin-bottom: 8px; }
.login-card .field span { font-size: 13px; font-weight: 600; color: var(--text-2); }
.login-card input { height: 46px; }
.login-note { font-size: 13px; color: var(--text-3); text-align: center; }
.login-ver { font-size: 12px; color: var(--text-3); text-align: center; }
.login-noscript { text-align: center; color: var(--bad); }

/* ------------------------------------------------------------ układ responsywny */

@media (max-width: 1200px) {
    .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1024px) {
    .shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar {
        position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 50; transform: translateX(-102%);
        transition: transform .25s ease; box-shadow: var(--shadow-lg);
    }
    .sb-brand .sb-close { display: inline-grid; }
    body.nav-open .sidebar { transform: none; }
    body.nav-open .scrim { display: block; position: fixed; inset: 0; z-index: 40; background: rgba(8, 13, 25, .5); }
    body.nav-open { overflow: hidden; }
    .topbar {
        display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 30; height: 56px; padding: 0 10px;
        padding-top: env(safe-area-inset-top); height: calc(56px + env(safe-area-inset-top));
        background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(160%) blur(12px); -webkit-backdrop-filter: saturate(160%) blur(12px);
        border-bottom: 1px solid var(--border);
    }
    .topbar-brand { display: flex; align-items: center; gap: 9px; color: var(--text); font-size: 16px; text-decoration: none !important; }
    .topbar-brand img { border-radius: 7px; }
    .page { padding: 22px 20px 50px; }
    .two-col, .settings-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 760px) {
    body { font-size: 15px; }
    h1 { font-size: 24px; }
    .page { padding: 18px 16px 44px; }
    .page-head { margin-bottom: 18px; }
    .page-head .actions { width: 100%; }
    .page-head .actions .btn { flex: 1; }
    .tiles, .tiles.three, .tiles.two { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .tile { padding: 13px 14px; }
    .tile b { font-size: 19px; }
    .tile-ic { width: 28px; height: 28px; top: 11px; right: 11px; }
    .tile-ic .i { width: 15px; height: 15px; }
    .tile small { padding-right: 30px; }
    .tiles.three .tile:last-child { grid-column: 1 / -1; }
    .section-head .actions { width: 100%; }
    .section-head .actions .btn { flex: 1; }
    .form-grid { grid-template-columns: minmax(0, 1fr); }
    .dl { grid-template-columns: minmax(0, 1fr); }
    dialog.modal, dialog.modal.wide { width: 100vw; max-width: 100vw; max-height: 94dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; }
    dialog.modal form { max-height: 94dvh; }
    .modal-body { padding: 18px 16px; }
    .modal-head { padding: 14px 10px 12px 16px; }
    .modal-foot { padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); }
    .toasts { left: 12px; right: 12px; bottom: calc(14px + env(safe-area-inset-bottom)); }
    .toast { max-width: none; }
    .login { grid-template-columns: minmax(0, 1fr); }
    .login-art { display: none; }
    .login-card { padding: 32px 20px; }
    .table th, .table td { padding: 9px 10px; }
}


@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
}


/* ------------------------------------------------------------ Safari na iPhonie */
/* iOS przybliża stronę po stuknięciu w pole z czcionką mniejszą niż 16 px — i zostaje przybliżona */
@media (max-width: 760px), (pointer: coarse) {
    input[type=text], input[type=email], input[type=tel], input[type=url], input[type=search], input[type=password], input[type=date], input[type=time], input[type=number], input:not([type]), select, textarea { font-size: 16px; }
}
/* pole daty/godziny w Safari na iOS ma własną, sztywną szerokość i wychodzi poza formularz */
@supports (-webkit-touch-callout: none) {
    input[type=date], input[type=time] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; text-align: left; line-height: 38px; }
    input[type=date]::-webkit-date-and-time-value, input[type=time]::-webkit-date-and-time-value { text-align: left; margin: 0; }
}
/* schowane menu boczne rzucało cień na lewą krawędź strony — cień tylko przy otwartym menu */
@media (max-width: 1024px) {
    .sidebar { box-shadow: none; }
    body.nav-open .sidebar { box-shadow: var(--shadow-lg); }
}

/* tabele „m-cards” na telefonie (konta): zamiast kolumn — karta na wiersz z podpisami pól */
@media (max-width: 760px) {
    .table.m-cards thead { display: none; }
    .table.m-cards, .table.m-cards tbody { display: block; }
    .table.m-cards tr { display: grid; gap: 8px 14px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
    .table.m-cards tbody tr:last-child { border-bottom: 0; }
    .table.m-cards td { display: block; padding: 0; border: 0; background: none !important; text-align: left; white-space: normal; }
    .table.m-cards td.act { width: auto; align-self: start; }
    .table.m-cards td[data-label]::before { content: attr(data-label); display: block; font-size: 11px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
    .table.m-cards .chip { white-space: normal; height: auto; min-height: 24px; padding: 3px 10px; }
}

/* ============================================================ Opony Rower — wykresy, filtry, porównanie */

/* paleta wykresów (sprawdzona pod kątem daltonizmu): kolejność stała, kolor idzie za oponą/klasą, nie za miejscem w rankingu */
:root {
    --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s5: #e87ba4; --s6: #008300;
    --grid: #e6eaf0;
    --axis: #8592a6;
    --track: #eef2f7;
    --h0: #e3eefc; --h1: #cde2fb; --h2: #9ec5f4; --h3: #6da7ec; --h4: #3987e5; --h5: #256abf; --h6: #184f95;
    --hf-light: #0f172a; --hf-dark: #ffffff;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300;
        --grid: #222d44; --axis: #6d7b95; --track: #1b2640;
        --h0: #16233d; --h1: #173058; --h2: #184f95; --h3: #1c5cab; --h4: #2a78d6; --h5: #5598e7; --h6: #86b6ef;
        --hf-light: #e7ecf5; --hf-dark: #0b1120;
    }
}
:root[data-theme="dark"] {
    --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s5: #d55181; --s6: #008300;
    --grid: #222d44; --axis: #6d7b95; --track: #1b2640;
    --h0: #16233d; --h1: #173058; --h2: #184f95; --h3: #1c5cab; --h4: #2a78d6; --h5: #5598e7; --h6: #86b6ef;
    --hf-light: #e7ecf5; --hf-dark: #0b1120;
}
.c1 { --c: var(--s1); } .c2 { --c: var(--s2); } .c3 { --c: var(--s3); } .c4 { --c: var(--s4); } .c5 { --c: var(--s5); } .c6 { --c: var(--s6); }

/* ------------------------------------------------------------ pasek boczny: stan danych */
.sb-data { margin-top: 18px; padding: 12px 12px 12px; border-radius: 12px; background: var(--sb-hover); display: grid; gap: 8px; }
.sb-data small { color: var(--sb-muted); font-size: 12px; line-height: 1.35; }
.sb-data b { color: #fff; font-weight: 600; }
.sb-data .btn { width: 100%; background: rgba(93, 141, 255, .16); border-color: rgba(143, 176, 255, .28); color: #dbe6ff; box-shadow: none; }
.sb-data .btn:hover { background: rgba(93, 141, 255, .26); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.sb-badge.count { background: var(--s1); color: #fff; }

/* ------------------------------------------------------------ filtry (jeden wiersz nad wszystkim, czego dotyczą) */
.filters { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; margin-bottom: 18px; }
.filter { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.filter > span { font-size: 11.5px; font-weight: 650; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.filter select, .filter input { height: 36px; font-size: 14px; }
.filter.search { flex: 1 1 200px; max-width: 320px; }
.segs { display: inline-flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--border); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.segs::-webkit-scrollbar { display: none; }
.segs button { border: 0; background: transparent; height: 30px; padding: 0 12px; border-radius: 8px; font-size: 13.5px; font-weight: 600; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.segs button:hover { color: var(--text); }
.segs button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.filter-meta { margin-left: auto; font-size: 13px; color: var(--text-3); align-self: center; }

/* ------------------------------------------------------------ karty z wykresami */
.chart-card .card-head { gap: 10px 16px; }
.chart-body { padding: 16px 20px 18px; }
.legend-row { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--text-2); }
.key { display: inline-flex; align-items: center; gap: 7px; }
.key::before { content: ""; width: 12px; height: 12px; border-radius: 3px; background: var(--c); flex: none; }
.key.line::before { height: 3px; border-radius: 2px; width: 16px; }
.key.dot::before { border-radius: 50%; width: 10px; height: 10px; }
.chart-note { font-size: 12.5px; color: var(--text-3); margin-top: 12px; }
svg.chart { display: block; width: 100%; height: auto; overflow: visible; font-family: var(--font); }
svg.chart .gl { stroke: var(--grid); stroke-width: 1; shape-rendering: crispEdges; }
svg.chart .ax { fill: var(--axis); font-size: 11.5px; font-variant-numeric: tabular-nums; }
svg.chart .ax-t { fill: var(--text-3); font-size: 12px; font-weight: 600; }
svg.chart .lbl { fill: var(--text-2); font-size: 12px; }
svg.chart .lbl.strong { fill: var(--text); font-weight: 650; }
svg.chart .mark { fill: var(--c); transition: opacity .12s; }
svg.chart .ln { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
svg.chart .pt { fill: var(--c); stroke: var(--surface); stroke-width: 2; }
svg.chart .hit { fill: transparent; cursor: pointer; }
svg.chart .pt { pointer-events: none; }
svg.chart .dim-soft .pt { opacity: .3; }
svg.chart .xcol .xh { stroke: var(--text-3); stroke-width: 1; opacity: 0; pointer-events: none; }
svg.chart .xcol:hover .xh, svg.chart .xcol:focus-within .xh { opacity: .7; }
svg.chart rect.hit:focus-visible { stroke: var(--accent); stroke-width: 2; }
.onboarding .empty { padding: 56px 20px; }
.rank-head { padding-top: 12px; padding-bottom: 10px; }
.rank-head:empty { display: none; }
.updating [data-act="update"] { pointer-events: none; }
svg.chart .hit:focus { outline: none; }
svg.chart .hit:focus-visible + .pt, svg.chart g.on .pt { stroke: var(--text); }
svg.chart .dim { opacity: .18; }
svg.chart .ref { stroke: var(--text-3); stroke-width: 1; }

/* podpowiedź (wartość najpierw, nazwa pod nią) */
.tip {
    position: fixed; z-index: 90; pointer-events: none; min-width: 150px; max-width: 280px; padding: 9px 12px; border-radius: 10px;
    background: var(--surface); border: 1px solid var(--border-2); box-shadow: var(--shadow-lg); font-size: 13px; color: var(--text-2);
    opacity: 0; transform: translateY(4px); transition: opacity .1s, transform .1s;
}
.tip.on { opacity: 1; transform: none; }
.tip b { display: block; color: var(--text); font-size: 15px; font-weight: 700; }
.tip .t-row { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.tip .t-row i { width: 12px; height: 3px; border-radius: 2px; background: var(--c); flex: none; }
.tip .t-row span { flex: 1; }
.tip .t-row em { font-style: normal; font-weight: 650; color: var(--text); font-variant-numeric: tabular-nums; }
.tip small { display: block; color: var(--text-3); margin-top: 2px; }

/* ------------------------------------------------------------ ranking (poziome słupki w HTML) */
.rank-axis { display: grid; grid-template-columns: 34px minmax(160px, 300px) minmax(0, 1fr) 92px 40px; gap: 0 12px; padding: 0 20px 6px; }
.rank-axis .ticks { position: relative; height: 18px; }
.rank-axis .ticks span { position: absolute; transform: translateX(-50%); font-size: 11px; color: var(--axis); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank-list { list-style: none; margin: 0; padding: 0 0 8px; }
.rank-row {
    display: grid; grid-template-columns: 34px minmax(160px, 300px) minmax(0, 1fr) 92px 40px; gap: 0 12px; align-items: center;
    padding: 5px 20px; min-height: 40px; position: relative;
}
.rank-row:hover { background: var(--surface-2); }
.rank-row.sel { background: color-mix(in srgb, var(--accent-soft) 70%, transparent); }
.rank-pos { font-size: 12.5px; font-weight: 700; color: var(--text-3); text-align: right; font-variant-numeric: tabular-nums; }
.rank-pos.top { color: var(--text); }
.rank-name { min-width: 0; display: flex; flex-direction: column; line-height: 1.25; color: var(--text); text-decoration: none !important; }
.rank-name b { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-name small { color: var(--text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-name:hover b { color: var(--accent); }
.rank-track { position: relative; height: 22px; background-image: linear-gradient(to right, var(--grid) 1px, transparent 1px); background-size: var(--tick, 25%) 100%; }
.rank-bar { position: absolute; left: 0; top: 4px; height: 14px; border-radius: 0 4px 4px 0; background: var(--c); min-width: 2px; transition: width .25s ease; }
.rank-row:hover .rank-bar { filter: brightness(1.08); }
.rank-val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; font-size: 14px; white-space: nowrap; }
.rank-val small { display: block; font-weight: 500; font-size: 11.5px; color: var(--text-3); }
.cmp-toggle { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--border-2); background: var(--surface); color: var(--text-3); display: grid; place-items: center; cursor: pointer; }
.cmp-toggle .i { width: 16px; height: 16px; }
.cmp-toggle:hover { color: var(--accent); border-color: var(--accent); }
.cmp-toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.rank-missing { padding: 12px 20px 16px; font-size: 13px; color: var(--text-3); border-top: 1px solid var(--border); }

/* ------------------------------------------------------------ tabela cieplna */
.heat-wrap { overflow-x: auto; }
.table.heat td, .table.heat th { padding: 8px 10px; }
.table.heat th.sortable { cursor: pointer; user-select: none; }
.table.heat th.sortable:hover { color: var(--text); }
.table.heat th .arr { opacity: .4; margin-left: 3px; }
.table.heat th.sorted .arr { opacity: 1; color: var(--accent); }
.table.heat td.hc { text-align: center; font-variant-numeric: tabular-nums; font-weight: 600; font-size: 13.5px; min-width: 76px; border-left: 2px solid var(--surface); }
.table.heat td.hc.na { color: var(--text-3); font-weight: 400; }
.hc.h0 { background: var(--h0); color: var(--hf-light); } .hc.h1 { background: var(--h1); color: var(--hf-light); } .hc.h2 { background: var(--h2); color: var(--hf-light); }
.hc.h3 { background: var(--h3); color: var(--hf-dark); } .hc.h4 { background: var(--h4); color: var(--hf-dark); } .hc.h5 { background: var(--h5); color: var(--hf-dark); } .hc.h6 { background: var(--h6); color: var(--hf-dark); }
.table.heat tbody tr:hover td.hc { filter: brightness(1.04); }
.table.heat tbody tr:hover td:not(.hc) { background: var(--surface-2); }
.heat-scale { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 12.5px; color: var(--text-3); }
.heat-scale span.sw { display: flex; }
.heat-scale span.sw i { width: 22px; height: 10px; }
.heat-scale span.sw i:first-child { border-radius: 3px 0 0 3px; } .heat-scale span.sw i:last-child { border-radius: 0 3px 3px 0; }
.tname { display: flex; flex-direction: column; line-height: 1.25; min-width: 180px; }
.tname a { color: var(--text); font-weight: 600; }
.tname small { color: var(--text-3); font-size: 12px; }
.wclass { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-2); white-space: nowrap; }
.wclass::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); }

/* ------------------------------------------------------------ porównanie */
.cmp-pick { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cmp-chip { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 6px 0 12px; border-radius: 999px; border: 1px solid var(--border-2); background: var(--surface); font-size: 13.5px; font-weight: 600; }
.cmp-chip::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.cmp-chip button { border: 0; background: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: var(--text-3); cursor: pointer; }
.cmp-chip button:hover { background: var(--surface-3); color: var(--text); }
.cmp-chip button .i { width: 14px; height: 14px; }
.picker { position: relative; flex: 1 1 260px; max-width: 380px; }
.picker-list { position: absolute; z-index: 40; top: calc(100% + 4px); left: 0; right: 0; max-height: 320px; overflow-y: auto; background: var(--surface); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 4px; }
.picker-list button { display: flex; width: 100%; text-align: left; gap: 10px; align-items: center; border: 0; background: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; }
.picker-list button:hover, .picker-list button.act { background: var(--surface-3); }
.picker-list small { color: var(--text-3); margin-left: auto; white-space: nowrap; }
.picker-list .none { padding: 10px; color: var(--text-3); font-size: 13.5px; }
.cmp-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(400px, 1fr); gap: 20px; align-items: start; }
.cmp-grid + .card, .cmp-grid + .cmp-grid { margin-top: 20px; }
.power { display: grid; gap: 14px; }
.range { display: grid; grid-template-columns: 110px minmax(0, 1fr) 84px; gap: 12px; align-items: center; font-size: 14px; }
.range label { font-weight: 600; color: var(--text-2); font-size: 13px; }
.range input[type=range] { width: 100%; accent-color: var(--accent); }
.range output { text-align: right; font-weight: 650; font-variant-numeric: tabular-nums; }
.cmp-table td.best { font-weight: 700; }
.cmp-table td.best::after { content: " ★"; color: var(--soon); font-size: 11px; }
.delta { display: block; font-size: 12px; color: var(--text-3); font-weight: 500; }
.th-tire { display: flex; align-items: center; gap: 8px; text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--text); }
.th-tire::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }
.th-tire small { display: block; color: var(--text-3); font-weight: 500; }

/* pływający pasek „Porównaj” na dole */
.tray {
    position: fixed; z-index: 35; left: 50%; bottom: 18px; transform: translateX(calc(-50% + 134px)); display: flex; align-items: center; gap: 12px;
    padding: 8px 8px 8px 16px; border-radius: 14px; background: #0f172a; color: #e7ecf5; box-shadow: var(--shadow-lg); font-size: 14px; max-width: calc(100vw - 300px);
}
.tray .dots { display: flex; gap: 4px; }
body.has-tray .page { padding-bottom: 96px; }
.tray .dots i { width: 10px; height: 10px; border-radius: 3px; background: var(--c); }
.tray .btn { height: 34px; }
.tray .btn.ghost { color: #a6b2c7; }
.tray .btn.ghost:hover { background: rgba(255, 255, 255, .08); color: #fff; }

/* ------------------------------------------------------------ karta opony */
.tire-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 16px 24px; align-items: end; margin-bottom: 22px; }
.tire-hero h1 { font-size: 30px; }
.tire-hero .meta { display: flex; flex-wrap: wrap; gap: 6px 8px; margin-top: 10px; }
.strip-list { display: grid; gap: 4px; padding: 10px 20px 18px; }
.strip { display: grid; grid-template-columns: 150px minmax(0, 1fr) 160px; gap: 14px; align-items: center; min-height: 52px; }
.strip-l b { display: block; font-size: 14px; }
.strip-l small { color: var(--text-3); font-size: 12px; }
.strip-v { text-align: right; font-variant-numeric: tabular-nums; }
.strip-v b { font-size: 16px; }
.strip-v small { display: block; color: var(--text-3); font-size: 12px; }
.pct { position: relative; height: 6px; border-radius: 3px; background: var(--track); margin-top: 6px; overflow: hidden; }
.pct i { position: absolute; inset: 0 auto 0 0; background: var(--s1); border-radius: 3px; }
.names-list { display: grid; gap: 0; }
.names-list > div { display: flex; gap: 10px; align-items: baseline; justify-content: space-between; padding: 9px 0; border-bottom: 1px dashed var(--border); flex-wrap: wrap; }
.names-list > div:last-child { border-bottom: 0; }
.names-list code { white-space: normal; }
.how { font-size: 11.5px; font-weight: 650; padding: 2px 8px; border-radius: 999px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.how.brand, .how.model { background: var(--soon-soft); color: var(--soon); }
.how.subset, .how.manual { background: var(--info-soft); color: var(--info); }
.how.alias { background: var(--ok-soft); color: var(--ok); }
.ext { display: inline-flex; align-items: center; gap: 6px; }
.ext .i { width: 15px; height: 15px; }

/* ------------------------------------------------------------ dane i dziennik */
.log { display: grid; }
.log-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; gap: 12px; padding: 13px 20px; border-bottom: 1px solid var(--border); align-items: start; }
.log-row:last-child { border-bottom: 0; }
.log-row .st { width: 26px; height: 26px; border-radius: 8px; display: grid; place-items: center; }
.log-row .st .i { width: 15px; height: 15px; }
.log-row .st.ok { background: var(--ok-soft); color: var(--ok); }
.log-row .st.nochange { background: var(--surface-3); color: var(--text-3); }
.log-row .st.error { background: var(--bad-soft); color: var(--bad); }
.log-row p { font-size: 14px; }
.log-row small { color: var(--text-3); font-size: 12.5px; }
.log-row details { margin-top: 6px; font-size: 13px; color: var(--text-2); }
.log-row details summary { cursor: pointer; color: var(--accent); font-weight: 600; }
.log-row ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 3px; }
.src-link { overflow-wrap: anywhere; font-size: 13.5px; }

/* ------------------------------------------------------------ układ responsywny (Opony) */
@media (max-width: 1360px) {
    .cmp-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 1024px) {
    .tray { transform: translateX(-50%); max-width: calc(100vw - 24px); }
}
@media (max-width: 760px) {
    .filters { gap: 10px; }
    .filter { flex: 1 1 calc(50% - 10px); }
    .filter.surf, .filter.search { flex: 1 1 100%; max-width: none; }
    .filter-meta { margin-left: 0; width: 100%; }
    .rank-axis { display: none; }
    .rank-row { grid-template-columns: 26px minmax(0, 1fr) 80px 34px; grid-template-areas: "pos name val cmp" "pos bar bar cmp"; gap: 2px 10px; padding: 8px 14px; }
    .rank-pos { grid-area: pos; align-self: start; padding-top: 2px; }
    .rank-name { grid-area: name; }
    .rank-name b { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
    .rank-track { grid-area: bar; height: 16px; background-image: none; }
    .rank-bar { top: 3px; height: 10px; }
    .rank-val { grid-area: val; }
    .cmp-toggle { grid-area: cmp; align-self: center; }
    .chart-body { padding: 14px 14px 16px; }
    .strip { grid-template-columns: minmax(0, 1fr) 130px; grid-template-areas: "l v" "s s"; gap: 4px 12px; padding: 6px 0; }
    .strip-l { grid-area: l; } .strip-v { grid-area: v; } .strip > svg { grid-area: s; }
    .strip-list { padding: 8px 14px 14px; }
    .tire-hero { grid-template-columns: minmax(0, 1fr); }
    .tire-hero h1 { font-size: 24px; }
    .range { grid-template-columns: 90px minmax(0, 1fr) 72px; }
    .log-row { padding: 12px 14px; grid-template-columns: 26px minmax(0, 1fr); }
    .log-row > :last-child { grid-column: 2; }
    .tray { bottom: calc(12px + env(safe-area-inset-bottom)); left: 12px; right: 12px; transform: none; max-width: none; }
    .tray .lbl-long { display: none; }
}
