/* ═══════════════════════════════════════════════════════════
   OPENTECH Media — motyw biało-niebieski
   ═══════════════════════════════════════════════════════════ */
:root {
  --blue:       #0a63c9;
  --blue-dark:  #084a99;
  --blue-light: #e8f1fd;
  --blue-soft:  #cfe2fa;
  --accent:     var(--blue);

  --bg:      #f4f7fc;
  --surface: #ffffff;
  --surface2:#f7f9fd;
  --border:  #dde5f0;
  --border2: #c6d5e8;

  --txt:  #142033;
  --txt2: #5d6f88;

  --danger:      #d92d3a;
  --danger-dark: #b31f2b;
  --danger-soft: #fdecee;
  --ok:          #128a4d;

  --radius: 12px;
  --shadow:    0 6px 20px rgba(16, 48, 92, .10);
  --shadow-lg: 0 18px 48px rgba(16, 48, 92, .22);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--txt);
  font-family: 'Segoe UI', system-ui, sans-serif;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;      /* iOS nie skaluje tekstu przy obrocie */
  overscroll-behavior-y: contain;      /* brak "pull to refresh" przy przewijaniu siatki */
}

/* Płynne przewijanie palcem po siatce */
main { -webkit-overflow-scrolling: touch; }

/* Podgląd zdjęcia sam obsługuje gesty poziome — przeglądarka ich nie przechwytuje */


/* ── Logo ── */
.lg-mark { color: var(--blue); display: flex; align-items: center; }
/* Sam znak w pasku — napis OPENTECH stoi obok jako tekst, żeby nagłówek
   pozostał ostry i lekki niezależnie od gęstości ekranu. */
.lg-img { height: 30px; width: auto; display: block; flex-shrink: 0; }
.logo-text, .lg-text { font-size: 19px; font-weight: 500; letter-spacing: .5px; white-space: nowrap; }
.logo-text b, .lg-text b { font-weight: 800; color: var(--blue); }

/* ═══════════ Logowanie ═══════════ */
.login-body {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; padding: 20px;
  background:
    radial-gradient(1100px 620px at 8% -10%, #dceafb 0%, rgba(220,234,251,0) 60%),
    radial-gradient(900px 520px at 100% 110%, #d3e5fb 0%, rgba(211,229,251,0) 60%),
    var(--bg);
}
.login-wrap { width: 100%; max-width: 400px; }
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-lg);
  padding: 34px 30px 30px;
  border-top: 4px solid var(--blue);
}
.login-logo { display: flex; align-items: center; gap: 10px; justify-content: center; }
.login-logo .lg-text { font-size: 23px; }
/* Logo niesie już napis OPENTECH, więc nie dublujemy go tekstem obok.
   Wysokość zamiast szerokości: znak i napis mają stałe proporcje, a karta
   logowania jest wąska — tak logo nie rozpycha jej na małych telefonach. */
.login-mark { height: 118px; width: auto; max-width: 100%; display: block; }
.login-sub { text-align: center; color: var(--txt2); font-size: 13px; margin: 8px 0 22px; }
.login-error {
  background: var(--danger-soft); color: var(--danger-dark);
  border: 1px solid #f4c3c8; border-radius: 8px;
  padding: 9px 12px; font-size: 13px; margin-bottom: 16px;
}
.fld { display: block; margin-bottom: 14px; }
.fld span { display: block; font-size: 12.5px; font-weight: 600; color: var(--txt2); margin-bottom: 6px; }
.fld input {
  width: 100%; padding: 11px 13px;
  border: 1px solid var(--border2); border-radius: 9px;
  font-size: 15px; color: var(--txt); background: var(--surface2);
  outline: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
.fld input:focus {
  border-color: var(--blue); background: #fff;
  box-shadow: 0 0 0 3px rgba(10,99,201,.14);
}
.login-foot { text-align: center; font-size: 12.5px; color: var(--txt2); margin-top: 18px; line-height: 1.6; }
.login-foot b { color: var(--txt); font-weight: 700; }
.login-foot .foot-sub { font-size: 11.5px; opacity: .8; }

/* ── Przyciski ── */
.btn-primary {
  background: var(--blue); color: #fff; border: none;
  padding: 11px 20px; border-radius: 9px;
  font-size: 15px; font-weight: 600; cursor: pointer;
  transition: background .15s, transform .1s;
}
.btn-primary:hover  { background: var(--blue-dark); }
.btn-primary:active { transform: translateY(1px); }
.btn-block { width: 100%; margin-top: 6px; }

.btn-ghost {
  background: var(--surface); color: var(--txt2);
  border: 1px solid var(--border2); border-radius: 8px;
  padding: 6px 13px; font-size: 13px; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
  white-space: nowrap;
}
.btn-ghost:hover { background: var(--blue-light); color: var(--blue); border-color: var(--blue-soft); }
.btn-ghost.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-ghost.sm { padding: 5px 10px; font-size: 12.5px; }

.btn-danger {
  background: var(--danger); color: #fff; border: none;
  border-radius: 8px; padding: 7px 15px;
  font-size: 13px; font-weight: 600; cursor: pointer;
  transition: background .15s, opacity .15s; white-space: nowrap;
}
.btn-danger:hover:not(:disabled) { background: var(--danger-dark); }
.btn-danger:disabled { opacity: .45; cursor: not-allowed; }
.btn-danger.sm { padding: 5px 11px; font-size: 12.5px; }

/* ═══════════ Nagłówek ═══════════ */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 200;
  box-shadow: 0 1px 3px rgba(16,48,92,.05);
}
.header-inner {
  max-width: 1700px; margin: 0 auto;
  padding: 10px 20px;
  display: flex; align-items: center; gap: 14px;
}
.logo { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.search-wrap {
  flex: 1; max-width: 560px;
  transition: max-width .18s ease, flex-basis .18s ease;
}
/* Zwiniete: pole naprawde znika z ukladu (display:none), a nie jest tylko
   przezroczyste — dzieki temu przegladarka nie ma czego wypelnic loginem. */
.search-wrap.collapsed { flex: 0 0 0; max-width: 0; overflow: hidden; }
.search-wrap.collapsed input { display: none; }
/* Gdy w polu cos jest, lupka podswietla sie na niebiesko — widac, ze widok
   jest przefiltrowany, nawet po zwinieciu pola. */
#btnSearch.ma-fraze { background: var(--blue); color: #fff; border-color: var(--blue); }
.search-wrap input {
  width: 100%;
  background: var(--surface2);
  border: 1px solid var(--border2);
  color: var(--txt);
  padding: 9px 18px; border-radius: 22px;
  font-size: 14px; outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
/* Pole jest type="search" (menedżery haseł omijają takie pola), a przeglądarki
   dokładają do niego własny wygląd i krzyżyk — zdejmujemy to, żeby wyglądało
   dokładnie tak jak wcześniej. */
.search-wrap input { -webkit-appearance: none; appearance: none; }
.search-wrap input::-webkit-search-decoration,
.search-wrap input::-webkit-search-cancel-button,
.search-wrap input::-webkit-search-results-button { -webkit-appearance: none; display: none; }
.search-wrap input::placeholder { color: #93a3b8; }
.search-wrap input:focus {
  border-color: var(--blue); background: #fff;
  box-shadow: 0 0 0 3px rgba(10,99,201,.12);
}

.folder-label {
  font-size: 12px; color: var(--txt2);
  max-width: 220px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; flex-shrink: 0;
}

.verify-badge {
  font-size: 12px; color: var(--blue);
  background: var(--blue-light); border: 1px solid var(--blue-soft);
  padding: 4px 11px; border-radius: 12px;
  flex-shrink: 0; white-space: nowrap;
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.45} }

.icon-btn {
  position: relative;
  background: var(--surface2); border: 1px solid var(--border2);
  border-radius: 9px; padding: 6px 11px;
  font-size: 15px; cursor: pointer; flex-shrink: 0;
  transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--blue-light); border-color: var(--blue-soft); }
/* Podpis przy ikonie w nagłówku — na wąskim ekranie znika, zostaje sam znak */
.ib-label { font-size: 12.5px; color: var(--txt2); vertical-align: 1px; }
#btnUpload:hover .ib-label { color: var(--blue-dark); }
.pill {
  background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 700;
  border-radius: 9px; padding: 1px 6px; margin-left: 2px;
  vertical-align: 2px;
}

.user-box { display: flex; align-items: center; gap: 8px; flex-shrink: 0; position: relative; }
.user-name {
  font-size: 12.5px; font-weight: 600; color: var(--blue);
  background: var(--blue-light); border: 1px solid transparent;
  border-radius: 12px; padding: 4px 11px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.user-name:hover { background: var(--blue-soft); border-color: var(--blue-soft); }

.user-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 300;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 11px; box-shadow: var(--shadow-lg);
  min-width: 190px; overflow: hidden; padding: 4px;
}
.um-head {
  font-size: 11.5px; color: var(--txt2);
  padding: 8px 10px 9px; border-bottom: 1px solid var(--border); margin-bottom: 4px;
}
.um-head b { color: var(--blue); }
.um-item {
  display: block; width: 100%; text-align: left;
  background: transparent; border: none; border-radius: 8px;
  padding: 9px 10px; font-size: 13px; color: var(--txt);
  cursor: pointer; text-decoration: none; font-family: inherit;
  transition: background .15s, color .15s;
}
.um-item:hover { background: var(--blue-light); color: var(--blue); }

/* ── Ustawienia ── */
.settings-box {
  position: relative; z-index: 1;
  background: var(--surface); border-radius: 14px; overflow: hidden;
  width: min(560px, 94vw); max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.settings-body { overflow-y: auto; padding: 6px 18px 18px; }
.set-row {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 0; border-bottom: 1px solid var(--border);
}
.set-row:last-child { border-bottom: none; }
.set-info { flex: 1; min-width: 0; }
.set-name { font-size: 14.5px; font-weight: 600; margin-bottom: 4px; }
.set-desc { font-size: 12.5px; color: var(--txt2); line-height: 1.5; word-break: break-word; }
.dates-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.btn-primary.sm { padding: 7px 14px; font-size: 13px; }
.set-desc code {
  background: var(--blue-light); color: var(--blue-dark);
  padding: 1px 5px; border-radius: 4px; font-size: 12px;
}

/* Przełącznik */
.switch { position: relative; width: 46px; height: 26px; flex-shrink: 0; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute; inset: 0;
  background: #c3cede; border-radius: 26px; transition: background .18s;
}
.slider::before {
  content: ''; position: absolute;
  height: 20px; width: 20px; left: 3px; top: 3px;
  background: #fff; border-radius: 50%;
  transition: transform .18s; box-shadow: 0 1px 3px rgba(0,0,0,.28);
}
.switch input:checked + .slider { background: var(--blue); }
.switch input:checked + .slider::before { transform: translateX(20px); }
.switch input:focus-visible + .slider { box-shadow: 0 0 0 3px rgba(10,99,201,.25); }

/* Usuwanie wyłączone → ukryj wszystkie kontrolki kasowania */
body.no-delete .card-del,
body.no-delete #btnSelect,
body.no-delete #viewerDelete,
body.no-delete #liveDelete,
body.no-delete #liveSelectAll,
body.no-delete #trashEmpty,
body.no-delete .act-purge { display: none !important; }

/* Ostrzeżenie w menu admina, gdy usuwanie jest wyłączone */
.um-status {
  display: flex; align-items: center; gap: 7px;
  font-size: 11.5px; padding: 7px 10px; margin: 2px 0 4px;
  border-radius: 8px; background: var(--surface2); color: var(--txt2);
}
.um-status b { color: var(--ok); }
body.no-delete .um-status { background: var(--danger-soft); }
body.no-delete .um-status b { color: var(--danger-dark); }
.logout-link {
  font-size: 12.5px; color: var(--txt2); text-decoration: none;
  border: 1px solid var(--border2); border-radius: 8px; padding: 4px 10px;
  transition: background .15s, color .15s;
}
.logout-link:hover { background: var(--danger-soft); color: var(--danger-dark); border-color: #f0c2c7; }

/* ═══════════ Zakładki ═══════════ */
.tabs-wrap {
  max-width: 1700px; margin: 0 auto;
  padding: 10px 20px 0;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
}
.tabs { display: flex; gap: 4px; }
.tab {
  background: transparent; border: none;
  color: var(--txt2); padding: 8px 18px 10px;
  border-radius: 8px 8px 0 0;
  cursor: pointer; font-size: 14px; font-weight: 500;
  position: relative; transition: color .15s, background .15s;
}
.tab:hover { color: var(--blue); background: var(--blue-light); }
.tab.active { color: var(--blue); font-weight: 700; }
.tab.active::after {
  content: ''; position: absolute;
  bottom: -1px; left: 0; right: 0; height: 3px;
  background: var(--blue); border-radius: 3px 3px 0 0;
}

.controls-right { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.view-toggle {
  display: flex; gap: 2px;
  background: var(--surface2); border-radius: 9px; padding: 2px;
  border: 1px solid var(--border2);
}
.view-btn {
  background: transparent; border: none; color: var(--txt2);
  padding: 5px 12px; border-radius: 7px;
  cursor: pointer; font-size: 13px; white-space: nowrap;
  transition: background .15s, color .15s;
}
.view-btn:hover { color: var(--blue); }
.view-btn.active { background: var(--blue); color: #fff; font-weight: 600; }
#sortSelect {
  background: var(--surface); border: 1px solid var(--border2);
  color: var(--txt2); padding: 6px 12px;
  border-radius: 8px; font-size: 13px; cursor: pointer; outline: none;
}
#sortSelect:focus { border-color: var(--blue); }

/* ═══════════ Pasek zaznaczania ═══════════ */
.select-bar {
  position: sticky; top: 55px; z-index: 150;
  background: var(--blue); color: #fff;
  box-shadow: 0 3px 12px rgba(10,99,201,.28);
}
.sb-inner {
  max-width: 1700px; margin: 0 auto;
  padding: 9px 20px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.sb-count { font-size: 14px; }
.sb-count strong { font-size: 15px; }
.sb-spacer { flex: 1; }
.sb-size { font-size: 12.5px; opacity: .85; }
.select-bar .btn-ghost {
  background: rgba(255,255,255,.14); color: #fff;
  border-color: rgba(255,255,255,.4);
}
.select-bar .btn-ghost:hover { background: rgba(255,255,255,.28); color: #fff; }

/* ═══════════ Main ═══════════ */
main { max-width: 1700px; margin: 0 auto; padding: 18px 20px 48px; }

.breadcrumb {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 4px; margin-bottom: 14px; font-size: 13px;
}
.bc-item {
  background: transparent; border: none; color: var(--txt2);
  cursor: pointer; padding: 4px 9px; border-radius: 7px;
  font-size: 13px; transition: background .15s, color .15s;
}
.bc-item:hover { background: var(--blue-light); color: var(--blue); }
.bc-current { color: var(--txt); font-weight: 700; padding: 4px 8px; }
.bc-sep { color: var(--border2); font-size: 16px; line-height: 1; }

/* ═══════════ Panel Live Photo ═══════════ */
/* Pozycja "Usuwanie filmów Live Photo" w menu admina */
.um-item { display: flex; align-items: center; gap: 8px; }
.um-pill {
  margin-left: auto;
  background: var(--blue); color: #fff;
  font-size: 10.5px; font-weight: 700;
  border-radius: 9px; padding: 1px 7px;
}
.user-menu { min-width: 250px; }

.live-panel {
  background: linear-gradient(135deg, #eaf2fd, #f7fbff);
  border: 1px solid var(--blue-soft);
  border-left: 4px solid var(--blue);
  border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 16px;
}
.lp-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; flex-wrap: wrap;
}
.lp-title { font-size: 16px; font-weight: 700; color: var(--blue-dark); }
.lp-sub   { font-size: 13px; color: var(--txt2); margin-top: 3px; }
.lp-sub strong { color: var(--blue-dark); }
.lp-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lp-note {
  font-size: 12px; color: var(--txt2); line-height: 1.55;
  margin-top: 12px; padding-top: 11px; border-top: 1px solid var(--blue-soft);
}
.lp-note b { color: var(--txt); }
.lp-progress { margin-top: 12px; }
.lp-bar {
  height: 7px; background: #fff; border: 1px solid var(--blue-soft);
  border-radius: 5px; overflow: hidden;
}
.lp-bar-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--blue), #3b8ef0);
  transition: width .4s ease;
}
.lp-prog-txt { font-size: 12px; color: var(--txt2); margin-top: 5px; }

/* Kafelek Live Photo */
.card.live-card .card-check { display: flex; }
.card.live-card .card-thumb { background: #0f1a2b; }
.live-badge {
  position: absolute; left: 8px; bottom: 8px; z-index: 2;
  background: rgba(10,99,201,.94); color: #fff;
  font-size: 10px; font-weight: 700; letter-spacing: .4px;
  padding: 3px 8px; border-radius: 5px;
  display: flex; align-items: center; gap: 4px;
}
.live-dur {
  position: absolute; right: 8px; bottom: 8px; z-index: 2;
  background: rgba(12,26,45,.85); color: #fff;
  font-size: 11px; font-weight: 600;
  padding: 3px 7px; border-radius: 5px;
}
.live-file {
  font-size: 11.5px; color: var(--txt2);
  display: flex; align-items: center; gap: 5px;
  margin-top: 3px; word-break: break-all;
}
.live-file b { color: var(--danger-dark); font-weight: 600; }


.live-src {
  font-size: 11px; color: var(--txt2);
  margin-top: 3px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.live-src.warn { color: #9a6a00; }
.live-where {
  background: #fff4d9; color: #8a5a00;
  border-radius: 4px; padding: 1px 5px; font-size: 10px;
}
.lp-note code {
  background: #fff; border: 1px solid var(--blue-soft);
  border-radius: 4px; padding: 1px 5px; font-size: 11px; color: var(--blue-dark);
}

.stats-bar {
  font-size: 13px; color: var(--txt2);
  margin-bottom: 14px; display: flex; gap: 16px; flex-wrap: wrap;
}
.stats-bar strong { color: var(--blue); }

/* ═══════════ Siatka ═══════════ */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden; cursor: pointer; position: relative;
  transition: transform .18s, box-shadow .18s, border-color .18s;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow); border-color: var(--blue-soft); }
.card:active { transform: translateY(-1px); }
.card.selected {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(10,99,201,.22), var(--shadow);
}

/* Miniatura */
/* Kwadrat, nie 16:9. Zdjęcia z telefonu są pionowe (3:4) — w poziomym kaflu
   „cover" wycinał z nich środkowy pasek i ucinał głowy. W kwadracie pionowe
   tracą ~25% wysokości, a poziome ~25% szerokości: nikt nie jest pokrzywdzony.
   Telefon miał kwadrat już wcześniej (sekcja max-width: 640px). */
.card-thumb {
  width: 100%; aspect-ratio: 1 / 1;
  background: var(--blue-light); position: relative; overflow: hidden;
}
/* Kadr nieco powyżej środka — na zdjęciach z imprez twarze są w górnej
   połowie kadru, więc to one przetrwają przycięcie, a nie stół czy podłoga. */
.card-thumb img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  object-position: 50% 38%;
}
.thumb-ph {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 46px;
  background: linear-gradient(135deg, #e9f1fd, #d7e6fa);
  color: rgba(10,99,201,.3);
}
.play-ov {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(10,40,80,.22); opacity: 0; transition: opacity .18s;
}
.card:hover .play-ov { opacity: 1; }
.play-circle {
  width: 52px; height: 52px;
  background: rgba(255,255,255,.95); border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 19px; color: var(--blue); padding-left: 2px;
  box-shadow: 0 3px 14px rgba(0,0,0,.28);
}

/* Przycisk usuwania na karcie */
.card-del {
  position: absolute; top: 8px; right: 8px; z-index: 3;
  width: 30px; height: 30px; border-radius: 8px;
  background: rgba(255,255,255,.94); border: 1px solid var(--border2);
  color: var(--danger); font-size: 14px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transform: scale(.9);
  transition: opacity .15s, transform .15s, background .15s, color .15s;
}
.card:hover .card-del { opacity: 1; transform: scale(1); }
.card-del:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* Checkbox zaznaczenia */
.card-check {
  position: absolute; top: 8px; left: 8px; z-index: 3;
  width: 24px; height: 24px; border-radius: 6px;
  background: rgba(255,255,255,.94); border: 2px solid var(--border2);
  display: none; align-items: center; justify-content: center;
  font-size: 14px; color: transparent; font-weight: 700;
}
body.select-mode .card-check { display: flex; }
body.select-mode .card-del   { display: none; }
body.select-mode .card:hover .play-ov { opacity: 0; }
.card.selected .card-check {
  background: var(--blue); border-color: var(--blue); color: #fff;
}

/* Kolaż folderu */
/* Kwadrat jak kafle plików — inaczej w widoku Foldery rzędy byłyby różnej
   wysokości i siatka wyglądałaby na połamaną */
.folder-collage {
  width: 100%; aspect-ratio: 1 / 1;
  display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr;
  gap: 2px; background: var(--blue-soft);
  overflow: hidden; position: relative;
}
.folder-collage img {
  width: 100%; height: 100%; object-fit: cover; display: block;
  background: var(--blue-light);
}
.folder-collage.n0 .fc-ph,
.folder-collage.n1 img { grid-column: 1/3; grid-row: 1/3; }
.folder-collage.n2 img { grid-row: 1/3; }
.folder-collage.n3 img:nth-child(3) { grid-column: 1/3; }
.fc-ph {
  grid-column: 1/3; grid-row: 1/3;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; color: rgba(10,99,201,.35);
  background: linear-gradient(135deg, #e9f1fd, #d7e6fa);
}
.folder-collage::after {
  content: ''; position: absolute; inset: 0;
  background: rgba(10,40,80,.18); opacity: 0; transition: opacity .18s;
}
.card:hover .folder-collage::after { opacity: 1; }

/* ═══════════ Kafelek pliku: samo zdjęcie, opis po najechaniu ═══════════
   Kafelki plików to czyste miniatury — nazwa, rozmiar i folder wysuwają się
   z dołu dopiero po najechaniu. Karty folderów zostają z widocznym podpisem
   (bez niego nie wiadomo, dokąd się wchodzi), tak samo widok Live Photo,
   gdzie opis jest potrzebny do decyzji. */
.card.file-card { background: #0d1725; }
.card.file-card .card-info {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 2;
  padding: 30px 11px 10px;
  background: linear-gradient(to top,
              rgba(6,16,32,.94) 0%, rgba(6,16,32,.82) 55%, rgba(6,16,32,0) 100%);
  opacity: 0; transform: translateY(10px);
  transition: opacity .18s ease, transform .18s ease;
  pointer-events: none;
}
.card.file-card:hover .card-info { opacity: 1; transform: none; }

.card.file-card .card-title {
  color: #fff; margin-bottom: 4px;
  -webkit-line-clamp: 1; word-break: break-all;
  text-shadow: 0 1px 3px rgba(0,0,0,.7);
}
.card.file-card .card-meta { color: rgba(255,255,255,.9); }
.card.file-card .badge-v { background: rgba(255,255,255,.92); color: var(--blue-dark); }
.card.file-card .badge-i { background: rgba(190,246,214,.94); color: #0b5130; }

/* Na dotyku kafelki też zostają czyste — opis pokazuje się na przytrzymanie */
@media (hover: none) {
  .card.file-card .card-info { opacity: 0; transform: translateY(10px); }
  .card.file-card:active .card-info { opacity: 1; transform: none; transition: opacity .1s; }
}

/* Info karty */
.card-info { padding: 10px 12px 12px; }
.card-title {
  font-size: 13.5px; font-weight: 500; color: var(--txt);
  line-height: 1.35; margin-bottom: 6px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-all;
}
.folder-name {
  font-size: 14px; font-weight: 700; margin-bottom: 5px;
  display: flex; align-items: center; gap: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-meta {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  font-size: 11.5px; color: var(--txt2);
}
.folder-meta { font-size: 13px; color: var(--txt2); display: flex; gap: 14px; }
.folder-meta span { display: flex; align-items: center; gap: 4px; }

.badge {
  padding: 2px 7px; border-radius: 5px;
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .3px;
}
.badge-v { background: var(--blue-light); color: var(--blue-dark); }
.badge-i { background: #e2f6ea;           color: #0f6b3d; }

/* ── Ładowanie / puste ── */
.loading {
  display: flex; flex-direction: column; align-items: center;
  gap: 14px; padding: 80px 0; color: var(--txt2);
}
.spinner {
  width: 46px; height: 46px;
  border: 3px solid var(--blue-soft);
  border-top-color: var(--blue);
  border-radius: 50%; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.scan-count { font-size: 13px; color: var(--txt2); }
.empty-state { text-align: center; padding: 80px 0; color: var(--txt2); }
.empty-icon { font-size: 54px; margin-bottom: 14px; opacity: .55; }

/* ═══════════ Modale ═══════════ */
.modal {
  position: fixed; inset: 0; z-index: 500;
  display: flex; align-items: center; justify-content: center;
}
/* Potwierdzenie zawsze na wierzchu: wywołują je inne okna (kosz, ustawienia),
   a w HTML stoi PRZED nimi — przy równym z-index chowało się pod spodem
   i widać było tylko przyciemnione tło. */
#confirmModal { z-index: 700; }

.modal-bg {
  position: absolute; inset: 0;
  background: rgba(12, 32, 60, .55);
  backdrop-filter: blur(4px); cursor: pointer;
}
/* Tło podglądu zdjęć nie zamyka — kursor ustawia JS zależnie od strony */
.modal-bg.nav-zones { cursor: default; }

.modal-box {
  position: relative; z-index: 1;
  background: var(--surface); border-radius: 14px; overflow: hidden;
  width: min(980px, 94vw); max-height: 94vh;
  display: flex; flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-head {
  display: flex; align-items: center;
  padding: 11px 14px; border-bottom: 1px solid var(--border);
  gap: 10px; flex-shrink: 0; background: var(--surface2);
}
.modal-title {
  flex: 1; font-size: 14px; font-weight: 600; color: var(--txt);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.btn-close {
  background: var(--surface); border: 1px solid var(--border2); color: var(--txt2);
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer;
  font-size: 13px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, color .15s, border-color .15s;
}
.btn-close:hover { background: var(--danger); color: #fff; border-color: var(--danger); }

/* ═══════════ Podgląd: zdjęcia i filmy w jednym oknie ═══════════ */
.viewer-box {
  position: relative; z-index: 1;
  width: min(1280px, 96vw);
  height: 94vh;
  display: flex; flex-direction: column;
}

/* Górny pasek: nazwa, usuwanie, zamknięcie */
.v-top {
  display: flex; align-items: center; gap: 10px;
  padding: 2px 2px 10px; flex-shrink: 0;
}
.v-title {
  flex: 1; min-width: 0;
  color: #fff; font-size: 14px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
}
.v-top .btn-close {
  background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.35); color: #fff;
}
.v-top .btn-close:hover { background: var(--danger); border-color: var(--danger); }

/* Scena — to ona jedzie za palcem */
.v-stage {
  position: relative;
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  transition: transform .2s ease, opacity .2s ease;
  will-change: transform;
  /* Podgląd nie przewija strony — gest w pionie ma nic nie robić,
     a przeglądarka nie może go „przejąć" i przycinać animacji poziomej. */
  touch-action: none;
}

/* Kółko ładowania: zamiast pokazywać poprzednie zdjęcie do czasu,
   aż doładuje się następne (wyglądało to jak zacięcie przy szybkim
   przewijaniu), scena jest pusta z kręcącym się wskaźnikiem. */
.v-spin {
  position: absolute; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}
.v-spin-ring {
  width: 38px; height: 38px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.25);
  border-top-color: #fff;
  animation: vSpin .8s linear infinite;
}
@keyframes vSpin { to { transform: rotate(360deg); } }

/* Nowe zdjęcie pojawia się płynnie, nie „przeskokiem" */
#lightboxImg {
  transition: opacity .18s ease;
}
#lightboxImg.is-loading { opacity: 0; }

#lightboxImg, #player {
  max-width: 100%; max-height: 100%;
  object-fit: contain; display: block;
  border-radius: 10px; background: #000;
  box-shadow: var(--shadow-lg);
  user-select: none; -webkit-user-drag: none;
}
#player { width: auto; touch-action: auto; }   /* sterowanie odtwarzacza pod palcem */

/* Dolny pasek: transkodowanie, suwak, opis, licznik */
.v-bottom { flex-shrink: 0; padding-top: 10px; }
.v-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 2px 0;
  font-size: 12.5px; color: rgba(255,255,255,.85);
}
.v-meta {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.lb-counter {
  position: static; transform: none;
  color: #fff; white-space: nowrap; font-weight: 600;
}

.transcode-notice {
  padding: 6px 12px; font-size: 12px; color: #ffd479;
  background: rgba(255,180,0,.14);
  border: 1px solid rgba(255,180,0,.3); border-radius: 8px;
  margin-bottom: 8px;
}

/* Suwak dla filmów transkodowanych na żywo */
.seek-bar {
  padding: 10px 12px 8px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px;
  user-select: none;
}
.seek-track {
  width: 100%; height: 6px; background: rgba(255,255,255,.28);
  border-radius: 3px; position: relative; cursor: pointer; margin-bottom: 7px;
}
.seek-track:hover { height: 8px; margin-bottom: 5px; }
.seek-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  background: #fff; border-radius: 3px;
  pointer-events: none; transition: width .4s linear;
}
.seek-thumb {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 14px; height: 14px; background: #fff;
  border: 2px solid var(--blue); border-radius: 50%;
  pointer-events: none; box-shadow: 0 1px 4px rgba(0,0,0,.4);
  transition: left .4s linear;
}
.seek-times {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; color: rgba(255,255,255,.85);
}
.seek-loading { font-size: 12px; color: #ffd479; animation: pulse 1s ease-in-out infinite; }

/* Strzałki nawigacji */
.lb-nav {
  position: absolute; top: 50%; transform: translateY(-50%); z-index: 3;
  background: rgba(255,255,255,.92); border: 1px solid var(--border2);
  color: var(--blue); width: 44px; height: 44px; border-radius: 50%;
  font-size: 18px; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .15s, box-shadow .15s;
  box-shadow: var(--shadow);
}
.lb-nav:hover { background: #fff; }
/* Podświetlenie strzałki po tej stronie, po której kliknięcie przewinie */
.lb-nav.hint {
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255,255,255,.22), var(--shadow);
  transform: translateY(-50%) scale(1.08);
}
.lb-prev { left: -56px; }
.lb-next { right: -56px; }
.lb-nav:disabled { opacity: .25; cursor: default; }

@media (max-width: 1440px) {
  .lb-prev { left: 6px; }
  .lb-next { right: 6px; }
}


/* ═══════════ Kopia z telefonu ═══════════ */
.up-target {
  font-size: 12.5px; color: var(--txt2); margin: -6px 0 16px;
}
.up-target b { color: var(--blue-dark); }
.up-pick { text-align: center; padding: 16px 0 4px; }
.up-btn { display: inline-block; cursor: pointer; }
.up-link { display: inline-block; margin-top: 12px; text-decoration: none; }
.up-hint { font-size: 12px; color: var(--txt2); margin-top: 10px; line-height: 1.5; }
.up-summary {
  background: var(--blue-light); border: 1px solid var(--blue-soft);
  border-radius: 9px; padding: 10px 12px; margin-top: 14px;
  font-size: 13px; color: var(--blue-dark);
}
.up-progress { margin-top: 16px; }
.up-progress .lp-bar {
  height: 12px; border-radius: 7px;
  background: var(--surface2); border-color: var(--blue-soft);
}
.up-progress .lp-bar-fill {
  background: linear-gradient(90deg, var(--blue), #4b9bf5);
  transition: width .15s linear;          /* postęp ma płynąć, nie skakać */
}
.up-progress .lp-prog-txt {
  font-size: 13px; color: var(--txt); font-weight: 500;
  margin-top: 8px; line-height: 1.5;
}
.up-result {
  margin-top: 14px; border-radius: 9px; padding: 10px 12px; font-size: 13px;
  background: #e6f7ee; border: 1px solid #b7e5cc; color: #0d6b41;
}
.up-result.err { background: var(--danger-soft); border-color: #f4c3c8; color: var(--danger-dark); }
.up-result ul { margin: 6px 0 0 16px; font-size: 12px; }
#upToken {
  user-select: all; word-break: break-all;
  background: var(--blue-light); color: var(--blue-dark);
  padding: 2px 6px; border-radius: 4px; font-size: 11.5px;
}
body.no-upload #btnUpload { display: none !important; }

/* ═══════════ Okno potwierdzenia usunięcia ═══════════ */
/* position+z-index są tu obowiązkowe: bez nich tło modalu (.modal-bg,
   pozycjonowane absolutnie) nakrywa okienko i przechwytuje kliknięcia. */
.confirm-box {
  position: relative; z-index: 1;
  background: var(--surface); border-radius: 14px;
  width: min(460px, 92vw); padding: 24px;
  box-shadow: var(--shadow-lg);
  border-top: 4px solid var(--danger);
}
.confirm-box h3 { font-size: 18px; margin-bottom: 8px; }
.confirm-text { font-size: 13.5px; color: var(--txt2); margin-bottom: 12px; }
.confirm-list {
  list-style: none; max-height: 180px; overflow-y: auto;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 9px; padding: 8px 10px; margin-bottom: 14px;
  font-size: 12.5px; color: var(--txt2);
}
.confirm-list li { padding: 3px 0; word-break: break-all; }
.check-line {
  display: flex; align-items: flex-start; gap: 9px;
  font-size: 12.5px; color: var(--txt2);
  background: var(--danger-soft); border: 1px solid #f4d0d4;
  border-radius: 9px; padding: 10px 12px; cursor: pointer;
}
.check-line input { margin-top: 2px; accent-color: var(--danger); }
.check-line b { color: var(--danger-dark); }
.confirm-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.confirm-actions .btn-ghost, .confirm-actions .btn-danger { padding: 9px 18px; font-size: 14px; }

/* ═══════════ Kosz ═══════════ */
.trash-box {
  position: relative; z-index: 1;
  background: var(--surface); border-radius: 14px; overflow: hidden;
  width: min(720px, 94vw); max-height: 88vh;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
}
.trash-list { overflow-y: auto; padding: 8px 14px 16px; }
.trash-row {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 4px; border-bottom: 1px solid var(--border);
}
.trash-row:last-child { border-bottom: none; }
.tr-info { flex: 1; min-width: 0; }
.tr-name { font-size: 13.5px; font-weight: 500; word-break: break-all; }
.tr-meta { font-size: 11.5px; color: var(--txt2); margin-top: 2px; word-break: break-all; }
.trash-empty { text-align: center; color: var(--txt2); padding: 40px 0; font-size: 14px; }

/* ═══════════ Powiadomienia ═══════════ */
.toast {
  position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%);
  z-index: 900; background: var(--txt); color: #fff;
  padding: 11px 20px; border-radius: 10px; font-size: 13.5px;
  box-shadow: var(--shadow-lg); max-width: 90vw; text-align: center;
}
.toast { display: flex; align-items: center; gap: 14px; justify-content: center; }
.toast-btn {
  background: rgba(255,255,255,.18); color: #fff;
  border: 1px solid rgba(255,255,255,.5); border-radius: 8px;
  padding: 5px 13px; font-size: 13px; font-weight: 600; cursor: pointer;
  flex-shrink: 0; transition: background .15s;
}
.toast-btn:hover { background: rgba(255,255,255,.34); }
.toast.ok    { background: var(--ok); }
.toast.error { background: var(--danger); }


/* ═══════════ Konta użytkowników ═══════════ */
.pw-form { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.pw-form input {
  flex: 1; min-width: 150px;
  padding: 9px 12px; border: 1px solid var(--border2); border-radius: 8px;
  font-size: 13.5px; background: var(--surface2); color: var(--txt); outline: none;
}
.pw-form input:focus { border-color: var(--blue); background: #fff; }

.users-list { margin: 12px 0 4px; }
.user-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px; margin-bottom: 8px;
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: 9px;
}
.user-row.is-admin { border-left: 3px solid var(--blue); }
.ur-main { flex: 1; min-width: 140px; }
.ur-login { font-size: 13.5px; font-weight: 600; }
.ur-folder { font-size: 11.5px; color: var(--txt2); margin-top: 2px; word-break: break-all; }
.ur-rola {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  border-radius: 5px; padding: 2px 7px; letter-spacing: .3px;
}
.ur-rola.admin { background: var(--blue-light); color: var(--blue-dark); }
.ur-rola.user  { background: #e2f6ea; color: #0f6b3d; }
.ur-token {
  font-family: Consolas, monospace; font-size: 11px;
  background: #0d1725; color: #cfe4ff;
  padding: 4px 8px; border-radius: 6px;
  max-width: 100%; overflow-x: auto; white-space: nowrap; user-select: all;
}

.folder-edit {
  flex: 1; min-width: 140px;
  padding: 7px 10px; border: 1px solid var(--blue); border-radius: 7px;
  font-size: 13px; background: #fff; color: var(--txt); outline: none;
}

.user-add {
  margin-top: 14px; padding-top: 12px; border-top: 1px dashed var(--border2);
}
.ua-title { font-size: 12.5px; font-weight: 600; color: var(--txt2); margin-bottom: 8px; }
.ua-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ua-grid input {
  padding: 9px 12px; border: 1px solid var(--border2); border-radius: 8px;
  font-size: 13.5px; background: #fff; color: var(--txt); outline: none;
}
.ua-grid input:focus { border-color: var(--blue); }
.ua-grid button { grid-column: 1 / -1; }

/* Elementy tylko dla administratora */
body:not(.is-admin) .admin-only { display: none !important; }

@media (max-width: 640px) {
  .ua-grid { grid-template-columns: 1fr; }
  .pw-form input { min-width: 100%; }
}

/* ── Utility ── */
.hidden { display: none !important; }

/* ═══════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════ */
@media (max-width: 640px) {
  .header-inner {
    flex-wrap: wrap;
    padding: calc(8px + env(safe-area-inset-top)) 12px 6px;
    gap: 8px;
  }
  .icon-btn   { min-height: 38px; min-width: 42px; }
  .user-name  { min-height: 34px; }
  .btn-ghost, .btn-danger { min-height: 36px; }

  /* Panel Live Photo: przyciski w dwóch rzędach, nie ściśnięte w jeden */
  .live-panel  { padding: 12px 13px; }
  .lp-head     { flex-direction: column; align-items: stretch; gap: 10px; }
  .lp-actions  { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
  .lp-actions .btn-danger { grid-column: 1 / -1; }
  .lp-note     { font-size: 11.5px; }

  /* Kosz i ustawienia na całą szerokość */
  .settings-box { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  .set-row      { padding: 14px 0; }
  .trash-row    { flex-wrap: wrap; }
  .trash-row .btn-ghost, .trash-row .btn-danger { flex: 1; }

  /* Menu admina jako pełna szuflada u dołu ekranu */
  .user-menu {
    position: fixed; top: auto; bottom: 0; left: 0; right: 0;
    border-radius: 14px 14px 0 0; min-width: 0;
    padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  }
  .um-item { padding: 14px 12px; font-size: 15px; }
  .logo-text    { display: none; }
  .folder-label { display: none; }
  .logout-link  { display: none; }
  .user-name    { font-size: 11.5px; padding: 3px 8px; }
  .verify-badge { font-size: 11px; padding: 3px 8px; }
  .search-wrap  { order: 2; flex: 1 0 100%; max-width: 100%; }
  .search-wrap input { padding: 10px 16px; font-size: 15px; border-radius: 20px; }
  .icon-btn     { margin-left: auto; }
  /* Dwa przyciski w nagłówku: pierwszy odpycha się od lewej, drugi klei się
     do niego, żeby nie rozjechały się na dwa końce paska. */
  #btnUpload    { margin-left: 0; }
  .ib-label     { display: none; }

  .tabs-wrap  { flex-wrap: wrap; padding: 0; }
  .tabs       { width: 100%; gap: 0; padding: 0 12px; }
  .tab        { flex: 1; text-align: center; padding: 12px 4px; font-size: 13px; border-radius: 0; }
  .controls-right {
    width: 100%; justify-content: space-between;
    padding: 6px 12px 8px; margin-bottom: 0;
    border-top: 1px solid var(--border);
  }
  .view-btn   { padding: 7px 12px; font-size: 12px; }
  #sortSelect { font-size: 12px; padding: 6px 10px; }

  .select-bar { top: 0; }
  .sb-inner   { padding: 8px 12px; gap: 8px; }
  .sb-count   { font-size: 13px; }
  .sb-size    { display: none; }

  main       { padding: 10px 10px calc(60px + env(safe-area-inset-bottom)); }
  .stats-bar { font-size: 12px; margin-bottom: 10px; }

  /* Kwadratowe kafelki — pionowe zdjęcia z telefonu nie są ścinane w pół */
  .grid                        { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .card.file-card .card-thumb  { aspect-ratio: 1 / 1; }
  .card.file-card .card-info   { padding: 22px 8px 7px; }
  .card.file-card:active       { transform: none; }
  .card.file-card .card-title  { font-size: 11px; }

  .card                             { border-radius: 10px; }
  .card:hover                       { transform: none; box-shadow: none; border-color: var(--border); }
  .card:active                      { transform: scale(.97); transition: transform .08s; }
  .card:hover .folder-collage::after { opacity: 0; }
  .card-del                         { opacity: 1; transform: scale(1); width: 32px; height: 32px; }
  .card-check                       { width: 26px; height: 26px; }
  .thumb-ph                         { font-size: 32px; }
  .play-circle                      { width: 40px; height: 40px; font-size: 15px; }
  .play-ov                          { opacity: 1; background: rgba(10,40,80,.15); }
  .card-info    { padding: 7px 9px 9px; }
  .card-title   { font-size: 11.5px; }
  .card-meta    { font-size: 10px; gap: 3px; }
  .folder-name  { font-size: 12.5px; }
  .folder-meta  { font-size: 11px; gap: 8px; }

  .breadcrumb {
    flex-wrap: nowrap; overflow-x: auto;
    -webkit-overflow-scrolling: touch; scrollbar-width: none; margin-bottom: 10px;
  }
  .breadcrumb::-webkit-scrollbar { display: none; }
  .bc-item, .bc-current { white-space: nowrap; padding: 8px 10px; }

  .btn-close { width: 38px; height: 38px; font-size: 15px; }

  /* Podgląd na pełny ekran */
  #viewer { align-items: stretch; justify-content: stretch; }
  .viewer-box {
    width: 100%; height: 100dvh; max-height: 100dvh;
  }
  .v-top {
    position: absolute; top: 0; left: 0; right: 0; z-index: 4;
    padding: calc(8px + env(safe-area-inset-top)) 12px 22px;
    background: linear-gradient(to bottom, rgba(6,16,32,.85), rgba(6,16,32,0));
  }
  .v-title  { font-size: 13px; }
  .v-stage  { padding: 0; }
  #lightboxImg, #player { border-radius: 0; box-shadow: none; max-height: 100%; }
  .v-bottom {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 4;
    padding: 22px 12px calc(10px + env(safe-area-inset-bottom));
    background: linear-gradient(to top, rgba(6,16,32,.85), rgba(6,16,32,0));
  }
  .v-foot   { font-size: 12px; }
  .v-meta   { max-width: 60%; }

  /* Strzałki chowamy — na telefonie przewija się palcem */
  #viewer .lb-nav { display: none; }

  /* Suwak transkodowania: wyższy tor i większy uchwyt pod palec */
  .seek-bar         { padding: 10px 12px 6px; }
  .seek-track       { height: 10px; margin-bottom: 10px; touch-action: none; }
  .seek-track:hover { height: 10px; margin-bottom: 10px; }
  .seek-thumb       { width: 22px; height: 22px; }
  .seek-times       { font-size: 13px; }

  .trash-box  { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
}

@media (max-width: 360px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 5px; }
  .tab  { font-size: 12px; padding: 11px 2px; }
}

/* Tablet / duży telefon w poziomie */
@media (min-width: 641px) and (max-width: 900px) {
  .grid { grid-template-columns: repeat(3, 1fr); gap: 10px; }
}

@media (max-height: 480px) and (orientation: landscape) {
  header { position: relative; }
  .header-inner  { flex-wrap: nowrap; padding: 6px 12px; }
  .search-wrap   { order: 0; flex: 1; max-width: 360px; }
  .folder-label  { display: none; }
  .tabs-wrap      { flex-wrap: nowrap; padding: 0 12px; }
  .tabs           { width: auto; }
  .tab            { flex: none; border-radius: 8px 8px 0 0; padding: 8px 14px; }
  .controls-right { width: auto; border-top: none; padding: 0; margin-bottom: 6px; }
  .viewer-box { height: 100dvh; }
  #lightboxImg, #player { max-height: 100dvh; }
}
