/* Administrace galerií – rozložení a komponenty nad design systémem Nocturne (nocturne.css).
   Barvy, mezery a stíny jen z proměnných. Breakpoint mobil/desktop: 760 px. */

:root {
  /* Jediná barva navíc proti Nocturne: chybové texty (nesmí splývat s akcentem). */
  --color-danger: #e8939b;
  --color-muted: color-mix(in srgb, var(--color-text) 55%, transparent);
  --rule: linear-gradient(to right, transparent, color-mix(in srgb, var(--color-text) 8%, transparent) 48px,
    color-mix(in srgb, var(--color-text) 8%, transparent) calc(100% - 48px), transparent);
  --hover: color-mix(in srgb, var(--color-text) 6%, transparent);
  --badge-bg: color-mix(in srgb, var(--color-neutral-900) 82%, transparent);
  --sidebar-w: 236px;
  --tabbar-h: 62px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; min-height: 100dvh; font-size: 14px; }
body.no-scroll { overflow: hidden; }
button { font: inherit; color: inherit; }
a { color: var(--color-accent); }
a:hover { color: var(--color-accent-300); }
[hidden] { display: none !important; }

.icon { width: 1em; height: 1em; flex: none; fill: currentColor; display: inline-block; vertical-align: -0.125em; }
.muted { color: var(--color-muted); }
.small { font-size: 12px; }
.brand { font-weight: 500; color: var(--color-text); }
.brand span { color: var(--color-accent); }
.kicker { font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--color-muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: 0.35; } }
.spin { animation: spin 1s linear infinite; }

/* --- tlačítka a formuláře (doplňky k Nocturne) ------------------------------ */

.btn { min-height: 36px; white-space: nowrap; }
.btn .icon { font-size: 16px; }
.btn-icon .icon { font-size: 18px; }
.btn-plain:hover { background: color-mix(in srgb, var(--color-text) 8%, transparent); }
.btn-plain:active { background: color-mix(in srgb, var(--color-text) 14%, transparent); }
.btn[data-armed] { color: var(--color-danger); border-color: var(--color-danger); }
a.btn:hover { color: inherit; }
a.btn-primary:hover { color: var(--color-accent); }
.btn-lg { min-height: 40px; }

.field { display: flex; flex-direction: column; }
.field-hint { font-size: 12px; margin-top: 5px; color: var(--color-muted); overflow-wrap: anywhere; }
.field-hint.warn { color: var(--color-accent-300); }
.field-error { font-size: 13px; margin-top: 6px; color: var(--color-danger); }
.input.mono { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
select.input {
  width: auto; min-height: 36px; padding: 4px 30px 4px 10px; cursor: pointer;
  appearance: none; -webkit-appearance: none;
  background: var(--color-surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 256 256' fill='%23e9e9ed'%3E%3Cpath d='M213.66,101.66l-80,80a8,8,0,0,1-11.32,0l-80-80A8,8,0,0,1,53.66,90.34L128,164.69l74.34-74.35a8,8,0,0,1,11.32,11.32Z'/%3E%3C/svg%3E") no-repeat right 10px center / 12px;
}
input[type="search"]::-webkit-search-cancel-button { filter: grayscale(1); }
.seg-opt { min-height: 34px; }
.seg-count { font-size: 11px; color: var(--color-muted); }
.seg-opt:has(input:checked) .seg-count { color: var(--color-accent-300); }
.seg-icon .seg-opt { padding: 7px 10px; }
.seg-icon .icon { font-size: 16px; }

.switch {
  width: 34px; height: 20px; flex: none; border-radius: 10px; border: 0; padding: 2px; cursor: pointer;
  display: flex; justify-content: flex-start; background: var(--color-neutral-800); transition: background 0.15s;
}
.switch span { width: 16px; height: 16px; border-radius: 50%; background: var(--color-neutral-100); }
.switch[aria-checked="true"] { background: var(--color-accent-600); justify-content: flex-end; }
.switch-row { display: flex; align-items: center; gap: 12px; cursor: pointer; min-height: 36px; }
.switch-text { display: flex; flex-direction: column; font-size: 14px; line-height: 1.35; }
.switch-hint { font-size: 12px; color: var(--color-muted); }
.switch-inline { gap: 8px; }
.switch-inline .switch-text { font-size: 13px; }

.meter { height: 3px; border-radius: 2px; background: var(--color-neutral-800); overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--color-accent); }

.tag { gap: 5px; white-space: nowrap; }

/* --- rozložení --------------------------------------------------------------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  grid-template-areas: "side main";
  min-height: 100vh;
  min-height: 100dvh;
}
.sidebar { grid-area: side; }
.main { grid-area: main; min-width: 0; padding: 28px 36px 96px; }
.page { max-width: 1320px; display: flex; flex-direction: column; gap: 20px; }
.topbar, .tabbar { display: none; }
.page > :empty { display: none; }

body.logged-out .app { display: block; }
body.logged-out .sidebar, body.logged-out .topbar, body.logged-out .tabbar { display: none; }
body.logged-out .main { padding: 0; }

/* levý panel: vždy přesně na výšku okna. Když se nevejde, scrolluje se jen seznam
   posledních galerií a patička (úložiště, pydemo.cz, Odhlásit) zůstává vidět.
   Scroll celého panelu je jen pojistka pro extrémně nízké okno. */
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 24px; padding: 20px 12px 16px;
  background: linear-gradient(180deg, var(--color-surface), var(--color-bg) 85%);
  box-shadow: 1px 0 0 var(--color-divider);
}
.sidebar a { text-decoration: none; }
.sidebar-brand { font-size: 18px; padding: 0 10px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-md);
  font-size: 14px; color: var(--color-text);
}
.side-link .icon { font-size: 18px; }
.side-link:hover { background: var(--hover); color: var(--color-text); }
.side-link.active { background: var(--color-accent-900); color: var(--color-accent-300); }
.side-count { margin-left: auto; font-size: 12px; color: var(--color-muted); }
.sidebar-brand, .side-nav, .side-foot { flex: none; }
/* seznam se smí zmenšit až na nadpis + jednu galerii (57 px), pak teprve scrolluje celý panel */
.side-recent { display: flex; flex-direction: column; flex: 0 1 auto; min-height: 57px; }
.side-recent .kicker { padding: 0 10px 6px; flex: none; }
.recent-list {
  display: flex; flex-direction: column; gap: 1px; flex: 0 1 auto; min-height: 0;
  overflow-y: auto; overscroll-behavior: contain;
}
.recent-link {
  display: flex; align-items: center; gap: 10px; padding: 5px 10px; border-radius: var(--radius-md);
  color: var(--color-text); font-size: 13px;
}
.recent-link:hover { background: var(--hover); color: var(--color-text); }
.recent-link.active { background: var(--color-accent-900); }
.recent-thumb { width: 26px; height: 26px; flex: none; border-radius: var(--radius-sm); overflow: hidden; background: var(--color-neutral-900); }
.recent-thumb img { width: 100%; height: 100%; object-fit: cover; }
.recent-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent-hidden { color: var(--color-muted); font-size: 13px; display: flex; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 0 10px; }
.side-storage { display: flex; flex-direction: column; gap: 8px; }
.side-storage-row { display: flex; justify-content: space-between; font-size: 12px; }
.side-storage .small { font-size: 11px; line-height: 1.4; }
.side-links { display: flex; flex-direction: column; gap: 2px; margin-top: 8px; }
.side-mini {
  display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--color-text);
  background: none; border: 0; padding: 5px 0; cursor: pointer; text-align: left;
}
.side-mini .icon { font-size: 15px; }
.side-mini:hover { color: var(--color-accent); }

/* mobil */
@media (max-width: 759.98px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; grid-template-rows: auto 1fr; }
  .sidebar { display: none; }
  .topbar {
    grid-area: top; position: sticky; top: 0; z-index: 10;
    display: flex; align-items: center; gap: 4px; height: 52px; padding: 0 6px 0 8px;
    background: var(--color-bg); box-shadow: 0 1px 0 var(--color-divider);
  }
  .topbar .btn-icon { width: 40px; height: 40px; color: var(--color-text); }
  .topbar .btn-icon .icon { font-size: 19px; }
  .topbar-brand { flex: 1; font-size: 17px; padding-left: 6px; text-decoration: none; }
  .topbar-title { flex: 1; min-width: 0; font-size: 15px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    display: grid; grid-template-columns: repeat(3, 1fr);
    height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
    background: var(--color-surface); box-shadow: 0 -1px 0 var(--color-divider);
  }
  .tab {
    border: 0; background: transparent; color: var(--color-text); cursor: pointer; text-decoration: none;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px;
  }
  .tab .icon { font-size: 22px; }
  .tab.active, .tab.active:hover { color: var(--color-accent); }
  .tab:hover { color: var(--color-text); }
  .main { padding: 14px 12px calc(96px + var(--safe-bottom)); }
  .desktop-only { display: none !important; }
  .btn { min-height: 40px; }
  .btn-icon { width: 40px; height: 40px; }
  .seg-opt { min-height: 38px; }
  select.input { min-height: 40px; }
  .input { min-height: 40px; font-size: 16px; } /* 16 px: iOS pak při psaní nezoomuje */
  .input.mono { font-size: 15px; }
}
@media (min-width: 760px) {
  .mobile-only { display: none !important; }
}

/* --- hlavička stránky a lišty ---------------------------------------------- */

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-title { font-size: 32px; margin: 0; }
.page-sub { font-size: 13px; margin: 6px 0 0; color: var(--color-muted); max-width: 56ch; }
@media (max-width: 759.98px) { .page-title { font-size: 24px; } }

.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search { position: relative; flex: 1 1 220px; max-width: 360px; }
.search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font-size: 16px; opacity: 0.6; pointer-events: none; }
.search .input { padding-left: 32px; }
@media (max-width: 759.98px) { .search { flex-basis: 100%; max-width: none; } }

/* --- seznam galerií ------------------------------------------------------------- */

.year-head { display: flex; align-items: baseline; gap: 10px; padding-top: 4px; }
.year-label { font-size: 13px; font-weight: 500; letter-spacing: 0.06em; }
.year-count { font-size: 12px; color: var(--color-muted); }
.year-line { flex: 1; height: 1px; align-self: center; background: linear-gradient(to right, var(--color-divider), transparent); }
.year-group { display: flex; flex-direction: column; gap: 12px; }
.results { display: flex; flex-direction: column; gap: 20px; }

.ggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px 14px; }
@media (max-width: 759.98px) { .ggrid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 10px; } }
.gcard { display: flex; flex-direction: column; gap: 8px; min-width: 0; color: var(--color-text); text-decoration: none; border-radius: var(--radius-md); }
.gcard:hover { color: var(--color-text); }
.gcard-cover {
  position: relative; aspect-ratio: 3 / 2; border-radius: var(--radius-md); overflow: hidden;
  background: var(--color-surface); box-shadow: var(--shadow-sm); transition: box-shadow 0.15s;
}
.gcard:hover .gcard-cover {
  box-shadow: 0 0 0 1px var(--color-accent), 0 0 18px color-mix(in srgb, var(--color-accent) 30%, transparent);
}
.gcard-cover img { width: 100%; height: 100%; object-fit: cover; }
.gcard.is-hidden .gcard-cover img, .grow.is-hidden .grow-thumb img { opacity: 0.5; }
.gcard-cover .tag { position: absolute; left: 8px; top: 8px; }
.gcard-count {
  position: absolute; right: 8px; bottom: 8px; font-size: 11px; padding: 2px 7px; border-radius: 6px;
  background: var(--badge-bg); color: var(--color-neutral-100);
}
.gcard-empty { position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; color: var(--color-muted); }
.gcard-title { font-size: 15px; font-weight: 500; line-height: 1.25; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcard-date { font-size: 12px; margin-top: 2px; color: var(--color-muted); }

.glist { display: flex; flex-direction: column; }
.grow {
  display: grid; grid-template-columns: 60px minmax(0, 1fr) 150px 90px 80px 100px; align-items: center; gap: 14px;
  padding: 8px 6px; border-radius: 6px; color: var(--color-text); text-decoration: none;
  background: var(--rule) no-repeat bottom / 100% 1px;
}
.grow:hover { color: var(--color-text); background-color: color-mix(in srgb, var(--color-text) 4%, transparent); }
.grow-thumb { width: 60px; height: 40px; border-radius: var(--radius-sm); overflow: hidden; background: var(--color-surface); }
.grow-thumb img { width: 100%; height: 100%; object-fit: cover; }
.grow-title { font-size: 14px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grow-cell { font-size: 13px; }
@media (max-width: 759.98px) {
  .grow { grid-template-columns: 60px minmax(0, 1fr) auto; }
}

.skeletons .sk { display: flex; flex-direction: column; gap: 8px; opacity: 0.6; animation: pulse 1.4s ease-in-out infinite; }
.sk-cover { aspect-ratio: 3 / 2; border-radius: var(--radius-md); background: var(--color-surface); }
.sk-line { height: 10px; width: 60%; border-radius: 4px; background: var(--color-surface); }
.load-state { font-size: 12px; color: var(--color-muted); display: flex; align-items: center; gap: 8px; padding: 4px 0 12px; }
.sentinel { height: 1px; }

.empty-state { padding: 48px 0; display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.empty-state > .icon { font-size: 28px; color: var(--color-muted); }
.empty-state-title { font-size: 16px; }

/* --- detail galerie -------------------------------------------------------------- */

.back { color: var(--color-text); align-self: flex-start; padding-inline: 6px; margin-left: -6px; }
.back:hover { color: var(--color-text); }
.detail-head { display: flex; flex-wrap: wrap; gap: 14px; align-items: flex-end; justify-content: space-between; }
.detail-info { min-width: 0; flex: 1 1 320px; }
.detail-title { font-size: 32px; margin: 0 0 8px; overflow-wrap: anywhere; }
.meta-row { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13px; color: var(--color-muted); }
.detail-desc { max-width: 62ch; margin: 10px 0 0; font-size: 13px; color: var(--color-muted); text-wrap: pretty; white-space: pre-line; }
.detail-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.detail-actions a.btn-secondary { color: var(--color-text); }

.dropzone {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; cursor: pointer;
  border: 1px dashed var(--color-divider); border-radius: var(--radius-md); background: transparent;
  color: var(--color-text); text-align: left; transition: border-color 0.15s, background 0.15s;
}
.dropzone:hover { border-color: var(--color-accent); }
.dropzone.over, body.dragging-files .dropzone { border-color: var(--color-accent); background: var(--color-accent-900); }
.dropzone > .icon { font-size: 22px; color: var(--color-accent); }
.dz-text { display: flex; flex-direction: column; gap: 2px; }
.dz-title { font-size: 14px; }
.dz-hint { font-size: 12px; color: var(--color-muted); }
.dropzone.big { flex-direction: column; text-align: center; padding: 48px 20px; }
.dropzone.big > .icon { font-size: 30px; }
@media (max-width: 759.98px) { #d-zone:has(.dropzone:not(.big)) { display: none; } }

.drop-overlay {
  position: fixed; inset: 10px; z-index: 45; pointer-events: none; display: none; place-items: center;
  border: 2px dashed var(--color-accent); border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--color-bg) 70%, transparent);
}
.drop-overlay span { padding: 10px 16px; border-radius: var(--radius-md); background: var(--color-surface); box-shadow: var(--shadow-md); font-size: 15px; }
body.dragging-files .drop-overlay { display: grid; }

.queue { display: flex; flex-direction: column; gap: 8px; max-width: 640px; }
.qrow { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; font-size: 13px; align-items: center; }
.qname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qstate { color: color-mix(in srgb, var(--color-text) 60%, transparent); display: flex; align-items: center; gap: 6px; }
.qrow.done .qstate { color: var(--color-accent-300); }
.qrow.error .qstate { color: var(--color-danger); white-space: normal; }
.qrow .btn-icon { width: 28px; height: 28px; min-height: 28px; }
.qbar { grid-column: 1 / -1; height: 2px; border-radius: 1px; background: var(--color-neutral-800); overflow: hidden; }
.qbar span { display: block; height: 100%; background: var(--color-accent); transition: width 0.12s; }
.qrow.error .qbar span { background: var(--color-danger); }

.ptoolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.ptool-left { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.ptool-right { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.hint { font-size: 12px; color: var(--color-muted); padding-left: 4px; }

.pgrid { --tile-min: 170px; display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(var(--tile-min), 1fr)); }
.pgrid.density-s { --tile-min: 120px; }
.pgrid.density-l { --tile-min: 250px; }
@media (max-width: 759.98px) {
  .pgrid { --cols: 3; gap: 3px; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); margin-inline: -6px; }
  .pgrid.density-s { --cols: 4; }
  .pgrid.density-l { --cols: 2; }
}
.tile {
  position: relative; aspect-ratio: 1; border-radius: var(--radius-md); overflow: hidden; cursor: pointer;
  background: var(--color-surface); outline-offset: 2px;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.pgrid.can-drag .tile { cursor: grab; }
@media (max-width: 759.98px) { .tile { border-radius: 3px; outline-offset: -2px; } }
.tile img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.tile.is-hidden img { opacity: 0.35; }
.tile.is-selected, .tile.drop-target { outline: 2px solid var(--color-accent); }
.tile.dragging { opacity: 0.35; }
.tile-missing { position: absolute; inset: 0; display: grid; place-items: center; padding: 8px; text-align: center; font-size: 12px; color: var(--color-muted); }
.tile-badges { position: absolute; top: 6px; right: 6px; display: flex; gap: 4px; }
.badge {
  width: 22px; height: 22px; border-radius: 6px; display: grid; place-items: center; font-size: 12px;
  background: var(--badge-bg); color: var(--color-neutral-100);
}
.badge-cover { color: var(--color-accent-300); }
.tile-check {
  position: absolute; top: 6px; left: 6px; width: 22px; height: 22px; padding: 0; border-radius: 50%;
  border: 1.5px solid var(--color-neutral-100); cursor: pointer; display: none; place-items: center;
  background: color-mix(in srgb, var(--color-neutral-900) 50%, transparent); color: var(--color-bg);
}
.tile-check .icon { font-size: 13px; opacity: 0; }
.tile.is-selected .tile-check { background: var(--color-accent); border-color: var(--color-accent); }
.tile.is-selected .tile-check .icon { opacity: 1; }
.pgrid.select-mode .tile-check, .tile.is-selected .tile-check { display: grid; }
.tile-actions {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 6px 6px; display: none; gap: 2px; justify-content: flex-end;
  background: linear-gradient(to top, color-mix(in srgb, var(--color-neutral-900) 88%, transparent), transparent);
}
.tile-actions button {
  width: 30px; height: 30px; border: 0; border-radius: 6px; padding: 0; cursor: pointer; font-size: 16px;
  display: grid; place-items: center; background: transparent; color: var(--color-neutral-100);
}
.tile-actions button:hover { background: color-mix(in srgb, var(--color-neutral-100) 16%, transparent); }
@media (hover: hover) and (min-width: 760px) {
  .pgrid:not(.is-dragging) .tile:hover .tile-check { display: grid; }
  .pgrid:not(.select-mode):not(.is-dragging) .tile:hover .tile-actions,
  .pgrid:not(.select-mode) .tile:focus-within .tile-actions { display: flex; }
}
.tile-busy { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; color: var(--color-neutral-100); background: color-mix(in srgb, var(--color-neutral-900) 55%, transparent); }
.drag-ghost {
  position: fixed; left: 0; top: 0; z-index: 50; width: 76px; height: 76px; border-radius: var(--radius-md); overflow: hidden;
  pointer-events: none; box-shadow: var(--shadow-md); opacity: 0.9;
}
.drag-ghost img { width: 100%; height: 100%; object-fit: cover; }
body.dragging-photo, body.dragging-photo * { cursor: grabbing !important; }

.bulkbar {
  position: fixed; left: calc(50% + var(--sidebar-w) / 2); transform: translateX(-50%); bottom: 20px; z-index: 15;
  display: flex; align-items: center; gap: 2px; padding: 6px; border-radius: var(--radius-lg); flex-wrap: wrap; justify-content: center;
  background: var(--color-surface); box-shadow: var(--shadow-md);
  width: max-content; max-width: calc(100% - var(--sidebar-w) - 20px);
}
.bulk-count { font-size: 13px; padding: 0 10px 0 8px; white-space: nowrap; }
.bulkbar .btn { padding: 7px 10px; }
@media (max-width: 759.98px) {
  .bulkbar { left: 50%; bottom: calc(var(--tabbar-h) + 12px + var(--safe-bottom)); max-width: calc(100% - 20px); flex-wrap: nowrap; }
  .bulkbar .btn { padding: 7px 9px; }
  .bulkbar .btn .label { display: none; }
}

/* --- detail fotky ------------------------------------------------------------------ */

.drawer-backdrop { position: fixed; inset: 0; z-index: 20; background: color-mix(in srgb, var(--color-neutral-900) 50%, transparent); }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 21; width: 420px; max-width: 100%;
  display: flex; flex-direction: column; background: var(--color-surface); box-shadow: var(--shadow-lg);
}
@media (max-width: 759.98px) { .drawer { width: 100%; } }
.drawer-head { display: flex; align-items: center; gap: 4px; padding: 8px 10px; flex: none; }
.drawer-pos { flex: 1; font-size: 13px; color: var(--color-muted); }
.drawer-body {
  flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 20px; padding: 0 18px 20px;
}
.drawer-preview {
  position: relative; aspect-ratio: 4 / 3; flex: none; border-radius: var(--radius-md); overflow: hidden;
  display: grid; place-items: center; background: var(--color-bg);
}
.drawer-preview img { width: 100%; height: 100%; object-fit: contain; }
.drawer-preview.is-hidden img { opacity: 0.5; }
.drawer-tags { position: absolute; left: 8px; top: 8px; display: flex; gap: 4px; }
.drawer-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.drawer-fields { display: flex; flex-direction: column; gap: 12px; }
.drawer-fields textarea.input { min-height: 72px; }
.drawer-section { display: flex; flex-direction: column; gap: 8px; }
.kv { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 5px 12px; font-size: 13px; margin: 0; }
.kv dt { color: var(--color-muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.note { font-size: 13px; color: var(--color-muted); margin: 0; }
.gps-box { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: var(--radius-md); background: var(--color-accent-900); margin-top: 4px; }
.gps-text { display: flex; gap: 8px; font-size: 13px; color: var(--color-accent-100); }
.gps-text .icon { font-size: 16px; margin-top: 2px; }
.gps-text a { color: var(--color-accent-300); }
.gps-box .btn { font-size: 13px; }
.drawer-foot {
  display: flex; gap: 6px; flex-wrap: wrap; flex: none; padding: 12px 18px calc(12px + var(--safe-bottom));
  box-shadow: 0 -1px 0 var(--color-divider);
}
.drawer-foot .push { margin-left: auto; }

/* --- dialogy ------------------------------------------------------------------------- */

.dialog-backdrop { z-index: 30; }
.dialog { max-height: calc(100vh - 24px); max-height: calc(100dvh - 24px); overflow-y: auto; }
.dialog.wide { width: min(520px, 100%); }
.dialog:focus, .drawer:focus { outline: none; }
.dialog-title { margin: 0; }
.dialog-actions .btn { min-width: 80px; }
.dialog-split { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.dialog-split .dialog-actions { margin-top: 0; }
.switches { display: flex; flex-direction: column; gap: 6px; padding: 4px 0; }
.dialog .search { flex: none; max-width: none; }
.move-list { display: flex; flex-direction: column; max-height: 260px; overflow-y: auto; margin: 0 -6px; }
.move-item {
  display: flex; align-items: center; gap: 10px; padding: 6px; min-height: 44px; border: 0; border-radius: 6px;
  text-align: left; cursor: pointer; background: transparent; color: var(--color-text);
}
.move-item:hover { background: var(--hover); }
.move-item.active { background: var(--color-accent-900); }
.move-thumb { width: 32px; height: 32px; flex: none; border-radius: var(--radius-sm); overflow: hidden; background: var(--color-neutral-900); }
.move-thumb img { width: 100%; height: 100%; object-fit: cover; }
.move-text { flex: 1; min-width: 0; }
.move-title { display: block; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.move-meta { font-size: 12px; color: var(--color-muted); }

/* --- koš ------------------------------------------------------------------------------- */

.storage-card { padding: 16px; gap: 12px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 12px; }
.stat-label { font-size: 12px; color: var(--color-muted); }
.stat-value { font-size: 20px; font-weight: 500; }
.trash-list { display: flex; flex-direction: column; }
.trow {
  display: grid; grid-template-columns: 48px minmax(0, 1fr) 150px 80px auto; align-items: center; gap: 14px;
  padding: 10px 6px; background: var(--rule) no-repeat bottom / 100% 1px;
}
.trow-thumb { width: 48px; height: 48px; border-radius: var(--radius-sm); overflow: hidden; background: var(--color-surface); display: grid; place-items: center; color: var(--color-muted); }
.trow-thumb img { width: 100%; height: 100%; object-fit: cover; opacity: 0.7; }
.trow-title { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow-sub { font-size: 12px; color: var(--color-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.trow-cell { font-size: 13px; color: var(--color-muted); }
@media (max-width: 759.98px) {
  .trow { grid-template-columns: 48px minmax(0, 1fr) auto; gap: 10px; }
}

/* --- toasty -------------------------------------------------------------------------- */

.toasts {
  position: fixed; right: 16px; bottom: 20px; z-index: 40; max-width: calc(100% - 32px);
  display: flex; flex-direction: column; align-items: flex-end; gap: 8px; pointer-events: none;
}
@media (max-width: 759.98px) { .toasts { bottom: calc(var(--tabbar-h) + 12px + var(--safe-bottom)); } }
body.logged-out .toasts { bottom: 20px; }
.toast {
  display: flex; gap: 10px; align-items: center; padding: 8px 14px; border-radius: var(--radius-md); pointer-events: auto;
  background: var(--color-surface); box-shadow: var(--shadow-md); font-size: 13px; transition: opacity 0.15s, transform 0.15s;
}
.toast:has(.toast-undo) { padding-right: 8px; }
.toast.leaving { opacity: 0; transform: translateY(6px); }
.toast-icon { color: var(--color-accent); font-size: 16px; }
.toast-error .toast-icon { color: var(--color-danger); }
.toast-text { padding: 4px 0; }
.toast-undo { padding-inline: 8px; min-height: 30px; }

/* --- přihlášení --------------------------------------------------------------------- */

.login {
  min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; padding: 24px;
  background: radial-gradient(ellipse at 15% 0%, var(--color-accent-900), transparent 65%), var(--color-bg);
}
.login form { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 18px; margin-left: 12%; }
.login .brand { font-size: 20px; }
.login h1 { font-size: 25px; margin: 0 0 4px; }
.login p { font-size: 13px; margin: 0; }
.login .btn { min-height: 40px; }
.login-note { font-size: 12px; color: var(--color-muted); }
@media (max-width: 759.98px) { .login form { margin: 0 auto; } }

.page-error { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: 24px 0; }
