/* ===== Przeglądy szybowców — style ===== */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --surface-2: #f6f8fa;
  --surface-3: #eceff3;
  --border: #dde3ea;
  --border-strong: #c7cfd9;
  --text: #16202b;
  --muted: #5c6a79;
  --primary: #1b5fd1;
  --primary-hover: #164fb0;
  --primary-contrast: #ffffff;
  --primary-soft: #e4edfc;
  --ok: #17803a;
  --ok-soft: #dff3e6;
  --warn: #9a5b00;
  --warn-soft: #fdefd2;
  --danger: #c22a2a;
  --danger-soft: #fce3e3;
  --neutral: #5c6a79;
  --neutral-soft: #eaeef2;
  --info: #6b46c1;
  --info-soft: #ece6fb;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06);
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 2px 8px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);
  --overlay: rgba(10, 16, 24, .5);
  --radius: 10px;
  --radius-sm: 7px;
  --sidebar: 236px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --bg: #0e1319;
  --surface: #151c24;
  --surface-2: #1a222c;
  --surface-3: #212b37;
  --border: #283340;
  --border-strong: #354352;
  --text: #e4ebf2;
  --muted: #92a0af;
  --primary: #5592ff;
  --primary-hover: #73a6ff;
  --primary-contrast: #08111f;
  --primary-soft: #19294a;
  --ok: #46c06a;
  --ok-soft: #14301e;
  --warn: #e0a43a;
  --warn-soft: #36290f;
  --danger: #ff6b63;
  --danger-soft: #3c1818;
  --neutral: #92a0af;
  --neutral-soft: #222c37;
  --info: #a68bf0;
  --info-soft: #2a2247;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .3);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 2px 8px rgba(0, 0, 0, .25);
  --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
  --overlay: rgba(0, 0, 0, .62);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-size: 24px; font-weight: 700; letter-spacing: -.01em; }
h2 { font-size: 18px; font-weight: 650; }
h3 { font-size: 15.5px; font-weight: 650; }
p { margin: 0; }
img { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--primary-soft); }
.boot { padding: 48px; text-align: center; color: var(--muted); }

/* ===== Układ ===== */
.layout { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; padding: 16px 12px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; font-weight: 700; font-size: 15.5px; color: var(--text); }
.brand img { width: 32px; height: 32px; border-radius: 8px; }
.brand small { display: block; font-weight: 500; font-size: 12px; color: var(--muted); }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius-sm);
  color: var(--muted); font-weight: 550; text-decoration: none;
}
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active { background: var(--primary-soft); color: var(--primary); }
.nav .count { margin-left: auto; }
.sidebar-foot { margin-top: auto; border-top: 1px solid var(--border); padding-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.user-chip:hover { background: var(--surface-2); text-decoration: none; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: 13px;
}
.user-chip .who { min-width: 0; }
.user-chip .who b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .who span { font-size: 12px; color: var(--muted); }

.main { min-width: 0; }
.page { max-width: 1240px; margin: 0 auto; padding: 28px 32px 64px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.back { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-weight: 550; margin-bottom: 10px; font-size: 14px; }
.back:hover { color: var(--text); text-decoration: none; }

.topbar, .bottomnav { display: none; }

/* ===== Elementy ===== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 18px 20px; }
.card + .card, .section + .section { margin-top: 18px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.section-head .title { display: flex; align-items: center; gap: 10px; }
.section-head .num {
  width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 13px;
  background: var(--primary-soft); color: var(--primary); flex: none;
}
.section-head .hint { color: var(--muted); font-size: 13px; font-weight: 400; }
.section-body { padding: 16px 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 38px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); font-weight: 600; font-size: 14px; cursor: pointer;
  white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s, box-shadow .12s;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:focus-visible, .icon-btn:focus-visible, .input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.btn.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--border)); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger.solid { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.sm { height: 32px; padding: 0 10px; font-size: 13.5px; }
.btn.block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: var(--radius-sm);
  border: 1px solid transparent; background: transparent; color: var(--muted); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }
.icon-btn.sm { width: 30px; height: 30px; }
.icon { width: 18px; height: 18px; flex: none; }
.icon.lg { width: 22px; height: 22px; }

.badge {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 999px;
  font-size: 12.5px; font-weight: 650; white-space: nowrap; background: var(--neutral-soft); color: var(--neutral);
}
.badge .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-soft); color: var(--ok); }
.badge.soon { background: var(--warn-soft); color: var(--warn); }
.badge.overdue { background: var(--danger-soft); color: var(--danger); }
.badge.info { background: var(--info-soft); color: var(--info); }
.badge.primary { background: var(--primary-soft); color: var(--primary); }
.count { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; display: inline-grid; place-items: center; font-size: 11.5px; font-weight: 700; background: var(--danger); color: #fff; }
.count.warn { background: var(--warn); }
.tag { display: inline-block; white-space: nowrap; padding: 1px 7px; border-radius: 5px; background: var(--surface-3); font-weight: 650; font-size: 13px; font-family: var(--mono); letter-spacing: .02em; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.spacer { flex: 1; }
.stack > * + * { margin-top: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.sep { height: 1px; background: var(--border); margin: 16px 0; border: 0; }

/* ===== Formularze ===== */
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field > label, .label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field .help { font-size: 12.5px; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; height: 40px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; min-height: 110px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input::placeholder { color: color-mix(in srgb, var(--muted) 70%, transparent); }
.input.invalid { border-color: var(--danger); }
.input-group { display: flex; align-items: stretch; }
.input-group .input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-group .suffix {
  display: grid; place-items: center; padding: 0 10px; border: 1px solid var(--border-strong); border-left: 0;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0; background: var(--surface-2); color: var(--muted); font-size: 13px; white-space: nowrap;
}
.check { display: flex; align-items: flex-start; gap: 9px; cursor: pointer; padding: 4px 0; }
.check input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--primary); flex: none; }
.segmented { display: inline-flex; padding: 3px; background: var(--surface-3); border-radius: 9px; gap: 2px; flex-wrap: wrap; }
.segmented button {
  border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; font-weight: 600; font-size: 13.5px; color: var(--muted); cursor: pointer;
}
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.form-error { background: var(--danger-soft); color: var(--danger); padding: 10px 12px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 550; }
.fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; }
.fieldset legend { padding: 0 6px; font-weight: 650; font-size: 14px; }

/* ===== Tabele ===== */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 12.5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
  padding: 10px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2);
}
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover td { background: var(--surface-2); }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 12px; }
.cell-main { font-weight: 650; }
.cell-sub { font-size: 12.5px; color: var(--muted); }
.due { display: flex; flex-direction: column; gap: 3px; }
.due-line { display: flex; align-items: baseline; flex-wrap: wrap; column-gap: 8px; }
.due-line b, .due-line span { white-space: nowrap; }

/* Karty listy (telefon) */
.list-cards { display: flex; flex-direction: column; }
.list-card { display: block; padding: 14px 16px; border-bottom: 1px solid var(--border); color: var(--text); position: relative; }
.list-card:last-child { border-bottom: 0; }
.list-card:hover { text-decoration: none; background: var(--surface-2); }
.list-card .lc-top { display: flex; align-items: flex-start; gap: 10px; }
.list-card .lc-title { font-weight: 650; }
.list-card .lc-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 13.5px; color: var(--muted); }
.list-card .lc-meta b { color: var(--text); font-weight: 600; }

/* ===== Szybowiec / fakty ===== */
.hero { padding: 20px 22px; display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.hero-main { flex: 1; min-width: 240px; }
.hero h1 { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.hero .ids { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); overflow: hidden; }
.fact { padding: 12px 20px; box-shadow: inset -1px 0 0 var(--border), inset 0 -1px 0 var(--border); margin-bottom: -1px; }
.fact .k { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.fact .v { font-weight: 650; margin-top: 2px; }
.fact .v small { font-weight: 500; color: var(--muted); }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); margin: 22px 0 18px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  display: inline-flex; align-items: center; gap: 7px; background: none; border: 0; border-bottom: 2px solid transparent;
  padding: 10px 14px; margin-bottom: -1px; font-weight: 600; color: var(--muted); cursor: pointer; white-space: nowrap;
}
.tabs button:hover { color: var(--text); }
.tabs button.on { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== Alerty ===== */
.alert-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px 16px; margin-bottom: 18px; }
.alert-bar.overdue { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 30%, transparent); }
.alert-bar.soon { background: var(--warn-soft); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.alert-list { margin: 0; padding: 0; list-style: none; width: 100%; }
.alert-list li { display: flex; gap: 10px; align-items: center; padding: 7px 0; border-top: 1px solid color-mix(in srgb, currentColor 12%, transparent); flex-wrap: wrap; }
.alert-list li:first-child { border-top: 0; }

/* ===== Licznik godzin ===== */
.hours-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: end; }
.summary-box {
  margin-top: 16px; padding: 16px 18px; border-radius: var(--radius); background: var(--primary-soft); color: var(--text);
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.summary-box .big { font-size: 28px; font-weight: 750; color: var(--primary); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.source-chip { font-size: 12px; font-weight: 600; }

/* ===== Dokumenty ===== */
.doc-list { display: flex; flex-direction: column; }
.doc { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.doc:first-child { border-top: 0; }
.doc-icon { width: 38px; height: 38px; border-radius: 8px; display: grid; place-items: center; background: var(--surface-3); color: var(--muted); flex: none; font-size: 10.5px; font-weight: 800; letter-spacing: .03em; }
.doc-icon.pdf { background: var(--danger-soft); color: var(--danger); }
.doc-icon.img { background: var(--ok-soft); color: var(--ok); }
.doc-main { flex: 1; min-width: 0; }
.doc-title { font-weight: 600; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.doc-title a { color: var(--text); }
.doc-meta { font-size: 12.5px; color: var(--muted); }
.doc.retired .doc-title a { text-decoration: line-through; color: var(--muted); }
.doc-change { font-size: 12.5px; margin-top: 3px; color: var(--muted); }
.versions { margin: 6px 0 0; padding: 8px 12px; background: var(--surface-2); border-radius: var(--radius-sm); font-size: 13px; }
.versions div { padding: 3px 0; }
.legend { display: flex; gap: 6px; flex-wrap: wrap; }

/* Historia (oś czasu) */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; }
.timeline li::before { content: ""; position: absolute; left: 5px; top: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--primary); }
.timeline li::after { content: ""; position: absolute; left: 9px; top: 18px; bottom: 0; width: 1px; background: var(--border); }
.timeline li:last-child::after { display: none; }
.timeline .t-head { font-weight: 600; }
.timeline .t-meta { font-size: 12.5px; color: var(--muted); }

/* ===== Galeria / slider ===== */
.slider { position: relative; }
.slider-track {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; scroll-behavior: smooth;
  padding: 2px 2px 10px; scrollbar-width: thin;
}
.thumb {
  flex: none; width: 116px; scroll-snap-align: start; border: 0; padding: 0; background: none; cursor: pointer; text-align: left; color: var(--text);
}
.thumb .img {
  width: 116px; height: 116px; border-radius: 9px; overflow: hidden; background: var(--surface-3);
  border: 1px solid var(--border); display: grid; place-items: center;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.thumb:hover img { transform: scale(1.04); }
.thumb .cap { font-size: 11.5px; color: var(--muted); margin-top: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb.uploading .img { opacity: .65; }
.slider-nav {
  position: absolute; top: 45px; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); box-shadow: var(--shadow); display: grid; place-items: center; cursor: pointer; color: var(--text); z-index: 2;
}
.slider-nav.prev { left: -12px; }
.slider-nav.next { right: -12px; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.empty .icon { width: 30px; height: 30px; margin-bottom: 6px; opacity: .6; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.chip {
  border: 1px solid var(--border-strong); background: var(--surface); border-radius: 999px; padding: 4px 12px; font-size: 13px; font-weight: 600; cursor: pointer; color: var(--muted);
}
.chip.on { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.progress { height: 4px; border-radius: 4px; background: var(--surface-3); overflow: hidden; margin-top: 6px; }
.progress > div { height: 100%; background: var(--primary); transition: width .2s; }

/* Lightbox */
.lightbox { position: fixed; inset: 0; z-index: 100; background: rgba(5, 8, 12, .94); display: flex; flex-direction: column; color: #eef2f6; }
.lb-top { display: flex; align-items: center; gap: 8px; padding: 10px 12px; padding-top: max(10px, env(safe-area-inset-top)); }
.lb-top .lb-title { flex: 1; min-width: 0; }
.lb-top .lb-title b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-top .lb-title span { font-size: 12.5px; color: #a9b4c0; }
.lightbox .icon-btn { color: #dfe6ee; }
.lightbox .icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.lb-stage { flex: 1; min-height: 0; position: relative; display: grid; place-items: center; overflow: hidden; touch-action: pan-y pinch-zoom; }
.lb-stage img { max-width: 100%; max-height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.lb-stage.zoomed { overflow: auto; place-items: start; touch-action: auto; }
.lb-stage.zoomed img { max-width: none; max-height: none; cursor: zoom-out; }
.lb-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 46px; height: 46px; border-radius: 50%; border: 0; background: rgba(255,255,255,.12); color: #fff; display: grid; place-items: center; cursor: pointer; }
.lb-arrow:hover { background: rgba(255,255,255,.22); }
.lb-arrow.prev { left: 14px; }
.lb-arrow.next { right: 14px; }
.lb-strip { display: flex; gap: 6px; overflow-x: auto; padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom)); justify-content: safe center; }
.lb-strip button { flex: none; width: 54px; height: 54px; border-radius: 6px; overflow: hidden; border: 2px solid transparent; padding: 0; background: #222; cursor: pointer; opacity: .6; }
.lb-strip button.on { border-color: #fff; opacity: 1; }
.lb-strip img { width: 100%; height: 100%; object-fit: cover; }

/* ===== Menu, okna, powiadomienia ===== */
.menu {
  position: fixed; z-index: 90; min-width: 210px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-lg); padding: 5px; animation: pop .12s ease-out;
}
.menu button {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border: 0; background: none; border-radius: 6px;
  text-align: left; cursor: pointer; font-weight: 550; color: var(--text); font-size: 14px;
}
.menu button:hover { background: var(--surface-2); }
.menu button.danger { color: var(--danger); }
.menu button:disabled { opacity: .5; cursor: not-allowed; }
.menu hr { border: 0; height: 1px; background: var(--border); margin: 4px 0; }
@keyframes pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }

.modal-back { position: fixed; inset: 0; z-index: 80; background: var(--overlay); display: grid; place-items: center; padding: 20px; animation: fade .12s; }
.modal {
  width: 100%; max-width: 560px; max-height: calc(100vh - 40px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); animation: pop .15s ease-out;
}
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.toasts { position: fixed; z-index: 200; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast {
  background: var(--text); color: var(--bg); padding: 11px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  font-weight: 550; font-size: 14px; animation: pop .15s ease-out; display: flex; gap: 8px; align-items: center;
}
.toast.error { background: var(--danger); color: #fff; }
.toast.ok { background: var(--ok); color: #fff; }
.saved { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.saved.ok { color: var(--ok); }

/* Logowanie */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 20px; background:
  radial-gradient(1200px 500px at 50% -10%, var(--primary-soft), transparent 70%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; padding: 30px 28px; }
.auth-card .brand { justify-content: center; padding: 0 0 6px; font-size: 18px; }
.auth-card .brand { flex-direction: column; gap: 12px; }
.auth-card .brand img { width: 96px; height: 96px; border-radius: 22px; box-shadow: 0 10px 30px rgba(27, 95, 209, .35); }
.auth-card .lead { text-align: center; color: var(--muted); margin-bottom: 22px; }
.auth-theme { position: fixed; top: 14px; right: 14px; }

.perm-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 16px; }
.glider-picks { max-height: 220px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 6px 10px; margin-top: 8px; }

/* ===== Mniejsze ekrany komputera / tablet ===== */
@media (max-width: 1200px) {
  :root { --sidebar: 212px; }
  .page { padding: 22px 22px 56px; }
  .table th, .table td { padding-left: 10px; padding-right: 10px; }
  .table th:first-child, .table td:first-child { padding-left: 16px; }
}

/* ===== Telefon ===== */
@media (max-width: 860px) {
  .layout { display: block; }
  .sidebar { display: none; }
  .topbar {
    display: flex; align-items: center; gap: 8px; position: sticky; top: 0; z-index: 50;
    padding: 8px 10px 8px 14px; padding-top: max(8px, env(safe-area-inset-top));
    background: color-mix(in srgb, var(--surface) 92%, transparent); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
  }
  .topbar .brand { padding: 0; font-size: 15px; flex: 1; min-width: 0; }
  .topbar .brand img { width: 28px; height: 28px; }
  .bottomnav {
    display: grid; grid-template-columns: repeat(var(--n, 4), 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(10px); border-top: 1px solid var(--border);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottomnav a {
    display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 4px 7px; font-size: 11.5px; font-weight: 600;
    color: var(--muted); text-decoration: none; position: relative;
  }
  .bottomnav a.active { color: var(--primary); }
  .bottomnav .count { position: absolute; top: 3px; left: calc(50% + 6px); height: 17px; min-width: 17px; font-size: 10.5px; }
  .page { padding: 16px 16px calc(84px + env(safe-area-inset-bottom)); }
  h1 { font-size: 21px; }
  .page-head { margin-bottom: 14px; }
  .page-head .actions { width: 100%; }
  .page-head .actions .btn { flex: 1; }
  .hero { padding: 16px; }
  .fact { padding: 10px 16px; }
  .facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .section-head { padding: 12px 16px; }
  .section-body { padding: 14px 16px; }
  .card-pad { padding: 16px; }
  .grid2, .grid3, .hours-grid, .perm-grid { grid-template-columns: minmax(0, 1fr); }
  .modal-back { padding: 0; place-items: end stretch; }
  .modal { max-width: none; max-height: 92vh; border-radius: 16px 16px 0 0; }
  .modal-foot { padding-bottom: max(14px, env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .toasts { left: 16px; right: 16px; bottom: calc(76px + env(safe-area-inset-bottom)); max-width: none; }
  .lb-arrow { display: none; }
  .slider-nav { display: none; }
  .tabs { margin: 16px -16px 14px; padding: 0 8px; }
  .table th:first-child, .table td:first-child { padding-left: 16px; }
  .input, select.input { height: 44px; font-size: 16px; }
  textarea.input { font-size: 16px; }
}

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