/*
 * Rolly stylesheet. Palette and type follow wind-host (Quicksand, sage accent,
 * soft grey surfaces, light/dark toggle); layout follows the familiar photo
 * library pattern: top bar with search, left navigation, justified grid.
 */
@font-face { font-family: Quicksand; font-weight: 400; font-display: swap; src: url(/fonts/quicksand-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: Quicksand; font-weight: 500; font-display: swap; src: url(/fonts/quicksand-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: Quicksand; font-weight: 600; font-display: swap; src: url(/fonts/quicksand-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: Quicksand; font-weight: 700; font-display: swap; src: url(/fonts/quicksand-latin-700-normal.woff2) format("woff2"); }

:root {
  --bg: #ffffff;
  --bg-soft: #f5f6f7;
  --bg-sunk: #eceef0;
  --ink: #2f3337;
  --ink-strong: #1d2023;
  --muted: #6c757d;
  --line: #e3e6e9;
  --sage: #62847b;
  --sage-hover: #557369;
  --sage-soft: #e6efec;
  --online: #78b4a5;
  --amber: #f5b335;
  --danger: #c4474f;
  --danger-soft: #fbeaeb;
  --warn: #b7791f;
  --warn-soft: #fdf3e1;
  --focus: rgba(98, 132, 123, 0.45);
  --tile-bg: #eceef0;
  --radius: 0.5rem;
  --radius-lg: 0.75rem;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08), 0 4px 16px rgba(0, 0, 0, 0.06);
  --topbar: 64px;
  --sidebar: 256px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #212529; --bg-soft: #2b3035; --bg-sunk: #343a40; --ink: #dee2e6; --ink-strong: #f8f9fa;
    --muted: #a7adb3; --line: #3c434a; --sage: #78b4a5; --sage-hover: #8fc3b6; --sage-soft: #26332f;
    --online: #5f9f90; --danger: #ea868f; --danger-soft: #3a2326; --warn: #ffd27a; --warn-soft: #3a3020;
    --focus: rgba(120, 180, 165, 0.35); --tile-bg: #2b3035; --shadow: 0 1px 3px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #212529; --bg-soft: #2b3035; --bg-sunk: #343a40; --ink: #dee2e6; --ink-strong: #f8f9fa;
  --muted: #a7adb3; --line: #3c434a; --sage: #78b4a5; --sage-hover: #8fc3b6; --sage-soft: #26332f;
  --online: #5f9f90; --danger: #ea868f; --danger-soft: #3a2326; --warn: #ffd27a; --warn-soft: #3a3020;
  --focus: rgba(120, 180, 165, 0.35); --tile-bg: #2b3035; --shadow: 0 1px 3px rgba(0,0,0,.4), 0 6px 20px rgba(0,0,0,.35); color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 500 15px/1.5 Quicksand, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
img, svg, video { display: block; max-width: 100%; }
a { color: var(--sage); text-underline-offset: 3px; }
a:hover { color: var(--sage-hover); }
h1, h2, h3 { color: var(--ink-strong); line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.6rem; font-weight: 600; }
h2 { font-size: 1.2rem; font-weight: 700; }
p { margin: 0 0 1em; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.i { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.i-fill { fill: currentColor; stroke: none; }
.sprite { display: none; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: .95rem; line-height: 1.2; padding: .6rem 1.05rem;
  border-radius: var(--radius); border: 1px solid transparent; background: var(--sage); color: #fff;
  cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--sage-hover); color: #fff; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn .i { width: 18px; height: 18px; }
.btn-quiet { background: var(--bg-soft); color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { background: var(--bg-sunk); color: var(--ink-strong); }
.btn-ghost { background: transparent; color: var(--sage); border-color: var(--sage); }
.btn-ghost:hover { background: var(--sage); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger); filter: brightness(.92); color: #fff; }
.btn-sm { padding: .4rem .7rem; font-size: .88rem; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; display: grid; place-items: center;
  cursor: pointer; color: var(--ink); flex: none;
}
.icon-btn:hover { background: var(--bg-sunk); }
.icon-btn[aria-pressed="true"] { color: var(--sage); }
.theme-toggle { width: 40px; height: 40px; border: 0; border-radius: var(--radius); display: grid; place-items: center; background: var(--online); color: #fff; cursor: pointer; flex: none; }
.theme-toggle:hover { background: var(--sage); }
.theme-toggle .i { width: 18px; height: 18px; }

/* ------------------------------------------------------------ top bar */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar); z-index: 30; display: flex; align-items: center; gap: 12px;
  padding: 0 12px 0 8px; background: var(--bg); border-bottom: 1px solid transparent; transition: border-color .15s, box-shadow .15s;
}
body.scrolled .topbar { border-color: var(--line); box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink-strong); text-decoration: none; font-weight: 700; font-size: 1.3rem; width: 200px; flex: none; }
.brand img { width: 36px; height: 36px; border-radius: 10px; }
.brand:hover { color: var(--ink-strong); }
.search { flex: 1; max-width: 720px; position: relative; display: flex; align-items: center; }
.search .i { position: absolute; left: 14px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 46px; border-radius: 12px; border: 1px solid transparent; background: var(--bg-soft); color: var(--ink-strong);
  font: inherit; padding: 0 44px 0 48px; outline: none;
}
.search input:focus { background: var(--bg); border-color: var(--line); box-shadow: var(--shadow); }
.search .clear { position: absolute; right: 2px; }
.top-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.menu-btn { display: none; }

/* --------------------------------------------------------- selection bar */
.selbar {
  position: fixed; inset: 0 0 auto 0; height: var(--topbar); z-index: 35; display: flex; align-items: center; gap: 6px;
  padding: 0 12px 0 8px; background: var(--sage-soft); color: var(--ink-strong); box-shadow: 0 1px 3px rgba(0,0,0,.08);
}
.selbar .count { font-weight: 700; font-size: 1.1rem; margin-right: auto; padding-left: 6px; }
.selbar .icon-btn { color: var(--ink-strong); }
.selbar .icon-btn:hover { background: rgba(0,0,0,.06); }

/* ------------------------------------------------------------ sidebar */
.sidebar {
  position: fixed; top: var(--topbar); bottom: 0; left: 0; width: var(--sidebar); padding: 8px 12px 16px 0; overflow-y: auto;
  display: flex; flex-direction: column; z-index: 20; background: var(--bg);
}
.nav-item {
  display: flex; align-items: center; gap: 18px; height: 46px; padding: 0 24px; border-radius: 0 999px 999px 0;
  color: var(--ink); text-decoration: none; font-weight: 600;
}
.nav-item:hover { background: var(--bg-soft); color: var(--ink-strong); }
.nav-item[aria-current="page"] { background: var(--sage-soft); color: var(--sage); }
.nav-sep { height: 1px; background: var(--line); margin: 10px 0 10px 24px; }
.nav-label { font-size: .78rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 6px 24px; }
.meter { margin: auto 0 0 24px; padding-top: 18px; font-size: .88rem; color: var(--muted); text-decoration: none; display: block; }
.meter:hover { color: var(--ink); }
.meter .bar { height: 6px; border-radius: 4px; background: var(--bg-sunk); overflow: hidden; margin: 8px 0 6px; }
.meter .bar > span { display: block; height: 100%; width: 0; background: var(--sage); border-radius: 4px; transition: width .4s; }
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 19; }

/* ------------------------------------------------------------ main */
main { padding: calc(var(--topbar) + 4px) 28px 80px calc(var(--sidebar) + 4px); min-height: 100vh; }
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 18px; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); width: 100%; margin-top: -6px; }
.page-head .spacer { flex: 1; }
.banner { background: var(--bg-soft); border-radius: var(--radius-lg); padding: 14px 18px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.banner.warn { background: var(--warn-soft); color: var(--warn); }
.empty { text-align: center; padding: 72px 16px; color: var(--muted); max-width: 520px; margin: 0 auto; }
.empty .art { width: 120px; height: 120px; margin: 0 auto 18px; border-radius: 32px; background: var(--sage-soft); color: var(--sage); display: grid; place-items: center; }
.empty .art .i { width: 56px; height: 56px; stroke-width: 1.4; }
.empty h2 { color: var(--ink-strong); }
.empty .actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.loading { padding: 80px 0; display: grid; place-items: center; color: var(--muted); }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--bg-sunk); border-top-color: var(--sage); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ timeline */
.tl { position: relative; margin-right: 18px; user-select: none; -webkit-user-select: none; }
.tl-row { position: absolute; left: 0; right: 0; }
.tl-head { position: absolute; top: 0; bottom: 0; display: flex; align-items: flex-end; gap: 4px; padding-bottom: 10px; color: var(--ink-strong); font-weight: 600; font-size: .98rem; min-width: 0; }
.tl-head .lbl { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.tl-head .hcheck { width: 24px; height: 24px; border: 0; background: none; padding: 0; color: var(--muted); cursor: pointer; display: none; place-items: center; flex: none; }
.tl-head .hcheck .i { width: 22px; height: 22px; }
.tl-head:hover .hcheck, .tl.selecting .tl-head .hcheck, .tl-head .hcheck.on { display: grid; }
.tl-head .hcheck.on { color: var(--sage); }
.tl-head .place { color: var(--muted); font-weight: 500; font-size: .9rem; }
.tile { position: absolute; top: 0; overflow: hidden; background: var(--tile-bg); cursor: pointer; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .12s ease, opacity .25s; opacity: 0; }
.tile img.ok { opacity: 1; }
.tile::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to bottom, rgba(0,0,0,.28), transparent 32%); opacity: 0; transition: opacity .12s; pointer-events: none; }
.tile:hover::after, .tl.selecting .tile::after { opacity: 1; }
.tile .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.tile .ph .i { width: 34px; height: 34px; }
.tile-check {
  position: absolute; top: 6px; left: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0; padding: 0; z-index: 2;
  background: none; color: rgba(255,255,255,.92); display: grid; place-items: center; cursor: pointer; opacity: 0; transition: opacity .12s;
}
.tile-check .i { width: 24px; height: 24px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.35)); }
.tile:hover .tile-check, .tl.selecting .tile-check { opacity: 1; }
.tile.sel { background: var(--sage-soft); }
.tile.sel img { transform: scale(.86); border-radius: 6px; }
.tile.sel::after { opacity: 0; }
.tile.sel .tile-check { opacity: 1; color: var(--sage); }
.tile.sel .tile-check .i { filter: none; }
.tile.sel .tile-check::before { content: ""; position: absolute; inset: 3px; border-radius: 50%; background: #fff; z-index: -1; }
.tile-badge { position: absolute; top: 7px; right: 8px; z-index: 1; color: #fff; font-size: .82rem; font-weight: 700; display: flex; align-items: center; gap: 4px; text-shadow: 0 1px 2px rgba(0,0,0,.5); pointer-events: none; }
.tile-badge .i { width: 16px; height: 16px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.4)); }
.tile-fav { position: absolute; left: 8px; bottom: 6px; color: #fff; z-index: 1; pointer-events: none; }
.tile-fav .i { width: 18px; height: 18px; filter: drop-shadow(0 1px 1px rgba(0,0,0,.5)); }
.tile.sel .tile-badge, .tile.sel .tile-fav { display: none; }
.tile-days { position: absolute; left: 8px; bottom: 6px; color: #fff; font-size: .78rem; font-weight: 700; text-shadow: 0 1px 2px rgba(0,0,0,.6); pointer-events: none; }

/* scrubber */
.scrubber { position: fixed; right: 0; top: calc(var(--topbar) + 8px); bottom: 8px; width: 56px; z-index: 15; cursor: ns-resize; touch-action: none; }
.scrubber .yr { position: absolute; right: 10px; font-size: .74rem; font-weight: 700; color: var(--muted); transform: translateY(-50%); opacity: 0; transition: opacity .2s; pointer-events: none; }
.scrubber:hover .yr, .scrubber.active .yr, body.scrolling .scrubber .yr { opacity: 1; }
.scrubber .pos { position: absolute; right: 6px; width: 30px; height: 3px; border-radius: 2px; background: var(--sage); transform: translateY(-50%); pointer-events: none; }
.scrubber .tip {
  position: absolute; right: 44px; transform: translateY(-50%); background: var(--ink-strong); color: var(--bg); font-size: .82rem; font-weight: 700;
  padding: 4px 10px; border-radius: 6px; white-space: nowrap; pointer-events: none; opacity: 0;
}
.scrubber:hover .tip, .scrubber.active .tip { opacity: 1; }

/* ------------------------------------------------------------ albums */
.albums { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 22px 18px; }
.album-card { text-decoration: none; color: var(--ink-strong); display: block; min-width: 0; }
.album-card .cover { aspect-ratio: 1; border-radius: var(--radius-lg); overflow: hidden; background: var(--bg-soft); display: grid; place-items: center; color: var(--muted); }
.album-card .cover img { width: 100%; height: 100%; object-fit: cover; transition: transform .2s; }
.album-card:hover .cover img { transform: scale(1.03); }
.album-card .name { font-weight: 700; margin-top: 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.album-card .meta { color: var(--muted); font-size: .86rem; }
.album-card.new .cover { border: 2px dashed var(--line); background: transparent; }
.album-card.new .cover .i { width: 40px; height: 40px; }

/* ------------------------------------------------------------ cards / storage */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 26px; }
.card { background: var(--bg-soft); border-radius: var(--radius-lg); padding: 16px 18px; min-width: 0; }
.card .label { color: var(--muted); font-size: .86rem; font-weight: 600; }
.card .value { color: var(--ink-strong); font-size: 1.5rem; font-weight: 600; line-height: 1.3; }
.card .hint { color: var(--muted); font-size: .86rem; }
.node {
  display: grid; grid-template-columns: 48px minmax(0, 1.2fr) minmax(0, 1.6fr) 120px; gap: 16px; align-items: center;
  padding: 16px 0; border-bottom: 1px solid var(--line);
}
.node .ico { width: 48px; height: 48px; border-radius: 12px; background: var(--sage-soft); color: var(--sage); display: grid; place-items: center; }
.node .name { font-weight: 700; color: var(--ink-strong); font-size: 1.05rem; overflow-wrap: anywhere; }
.node .where { display: inline-flex; align-items: center; gap: 6px; background: var(--bg-soft); border-radius: var(--radius); padding: 3px 10px; font-size: .84rem; margin-top: 4px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.node .usage .bar { height: 8px; border-radius: 5px; background: var(--bg-sunk); overflow: hidden; margin: 6px 0 4px; }
.node .usage .bar > span { display: block; height: 100%; background: var(--sage); border-radius: 5px; }
.node .usage .nums { font-size: .86rem; color: var(--muted); }
.node .err { color: var(--danger); font-size: .84rem; margin-top: 4px; overflow-wrap: anywhere; }
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 6px; border-radius: .3rem; padding: 3px 10px; font-weight: 600; font-size: .88rem; white-space: nowrap; background: var(--online); color: #fff; }
.pill[data-state="offline"] { background: var(--danger-soft); color: var(--danger); }
.pill[data-state="drain"], .pill[data-state="readonly"] { background: var(--warn-soft); color: var(--warn); }
.tag { display: inline-flex; align-items: center; gap: 5px; background: var(--bg-soft); color: var(--ink-strong); font-size: .8rem; font-weight: 700; border-radius: .35rem; padding: 2px 8px; white-space: nowrap; }
.row-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 18px 0; }
.section { margin: 34px 0 0; max-width: 880px; }
.section h2 { margin-bottom: 10px; }
@media (max-width: 760px) {
  .node { grid-template-columns: 44px minmax(0, 1fr) auto; grid-template-areas: "ico name state" "usage usage usage"; }
  .node .ico { grid-area: ico; width: 44px; height: 44px; }
  .node .who { grid-area: name; }
  .node .usage { grid-area: usage; }
  .node .state { grid-area: state; }
}

/* ------------------------------------------------------------ sync page */
.steps { counter-reset: step; list-style: none; padding: 0; margin: 0; }
.steps > li { counter-increment: step; position: relative; padding: 0 0 18px 46px; }
.steps > li::before {
  content: counter(step); position: absolute; left: 0; top: -2px; width: 30px; height: 30px; border-radius: 50%;
  background: var(--sage-soft); color: var(--sage); font-weight: 700; display: grid; place-items: center;
}
.steps ul { margin: 6px 0 0; padding-left: 18px; }
.steps li li { margin: 4px 0; }
.kv { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 10px 14px; align-items: center; margin: 8px 0 4px; }
.kv .k { color: var(--muted); font-weight: 600; font-size: .9rem; }
.copyfield { display: flex; align-items: center; gap: 8px; background: var(--bg-soft); border-radius: var(--radius); padding: 8px 8px 8px 12px; min-width: 0; }
.copyfield code { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.copyfield .icon-btn { width: 32px; height: 32px; }
.copyfield .icon-btn .i { width: 18px; height: 18px; }
code.inline { background: var(--bg-soft); border-radius: 5px; padding: 1px 6px; font-size: .88em; }
.devices { width: 100%; border-collapse: collapse; font-size: .92rem; }
.devices th { text-align: left; color: var(--muted); font-weight: 600; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.devices td { padding: 10px 8px; border-bottom: 1px solid var(--line); }
details.more { background: var(--bg-soft); border-radius: var(--radius-lg); padding: 12px 16px; margin: 12px 0; }
details.more summary { cursor: pointer; font-weight: 700; color: var(--ink-strong); }
details.more[open] summary { margin-bottom: 10px; }
pre.code { background: var(--bg-sunk); border-radius: var(--radius); padding: 12px 14px; overflow-x: auto; font-size: .85rem; }
@media (max-width: 600px) { .kv { grid-template-columns: 1fr; gap: 2px 0; } .kv .k { margin-top: 8px; } }

/* ------------------------------------------------------------ viewer */
.viewer { position: fixed; inset: 0; z-index: 60; background: #000; color: #fff; display: flex; overscroll-behavior: contain; }
.viewer .stage { position: relative; flex: 1; min-width: 0; overflow: hidden; touch-action: none; }
.viewer .media { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; }
.viewer .media img, .viewer .media video { display: block; max-width: 100%; max-height: 100%; min-width: 0; min-height: 0; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.viewer .media video { width: 100%; height: 100%; }
.viewer .media img { transition: transform .2s ease; transform-origin: 0 0; cursor: zoom-in; }
.viewer .media.zoomed img { cursor: grab; transition: none; }
.viewer .media .ph { color: #9aa0a6; text-align: center; }
.viewer .media .ph .i { width: 64px; height: 64px; margin: 0 auto 12px; stroke-width: 1.3; }
.viewer .vbar {
  position: absolute; top: 0; left: 0; right: 0; height: 64px; display: flex; align-items: center; gap: 4px; padding: 0 8px; z-index: 3;
  background: linear-gradient(to bottom, rgba(0,0,0,.55), transparent); transition: opacity .2s;
}
.viewer .vbar .title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; opacity: .85; padding-left: 6px; }
.viewer .icon-btn { color: #fff; }
.viewer .icon-btn:hover { background: rgba(255,255,255,.12); }
.viewer .icon-btn[aria-pressed="true"] { color: var(--amber); }
.viewer .nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 2; width: 52px; height: 52px; background: rgba(0,0,0,.35); }
.viewer .nav.prev { left: 12px; } .viewer .nav.next { right: 12px; }
.viewer.idle .vbar, .viewer.idle .nav { opacity: 0; }
.viewer .info {
  width: 360px; flex: none; background: var(--bg); color: var(--ink); overflow-y: auto; padding: 0 20px 24px; border-left: 1px solid var(--line);
}
.viewer .info .ihead { display: flex; align-items: center; gap: 8px; height: 64px; }
.viewer .info .ihead h2 { margin: 0; flex: 1; }
.viewer .info .icon-btn { color: var(--ink); }
.viewer .info .icon-btn:hover { background: var(--bg-sunk); }
.irow { display: flex; gap: 18px; padding: 12px 0; }
.irow > .i { color: var(--muted); margin-top: 2px; }
.irow .main { color: var(--ink-strong); font-weight: 600; overflow-wrap: anywhere; }
.irow .sub { color: var(--muted); font-size: .88rem; overflow-wrap: anywhere; }
.irow .chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.ilabel { color: var(--muted); font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; margin: 14px 0 0; }
@media (max-width: 900px) {
  .viewer .info { position: absolute; inset: auto 0 0 0; width: auto; max-height: 62vh; border-radius: 16px 16px 0 0; border: 0; z-index: 5; box-shadow: var(--shadow); }
}

/* ------------------------------------------------------------ uploads */
.uploads {
  position: fixed; right: 20px; bottom: 20px; width: 360px; max-width: calc(100vw - 24px); z-index: 50; background: var(--bg);
  border-radius: var(--radius-lg); box-shadow: var(--shadow); border: 1px solid var(--line); overflow: hidden;
}
.uploads .uhead { display: flex; align-items: center; gap: 6px; padding: 10px 8px 10px 16px; }
.uploads .uhead .t { flex: 1; font-weight: 700; color: var(--ink-strong); }
.uploads .uhead .icon-btn { width: 36px; height: 36px; }
.uploads .ubar { height: 4px; background: var(--bg-sunk); }
.uploads .ubar > span { display: block; height: 100%; width: 0; background: var(--sage); transition: width .2s; }
.uploads .ulist { max-height: 260px; overflow-y: auto; padding: 4px 0; }
.uploads.collapsed .ulist { display: none; }
.uitem { display: flex; align-items: center; gap: 10px; padding: 6px 16px; font-size: .88rem; }
.uitem .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uitem .s { color: var(--muted); white-space: nowrap; }
.uitem .s.ok { color: var(--sage); } .uitem .s.err { color: var(--danger); }
.drop {
  position: fixed; inset: 0; z-index: 70; background: rgba(98,132,123,.18); border: 3px dashed var(--sage); display: grid; place-items: center;
  pointer-events: none; backdrop-filter: blur(2px);
}
.drop div { background: var(--bg); color: var(--ink-strong); font-weight: 700; font-size: 1.2rem; padding: 18px 26px; border-radius: var(--radius-lg); box-shadow: var(--shadow); display: flex; gap: 12px; align-items: center; }

/* ------------------------------------------------------------ dialogs, menus, toast */
dialog {
  border: 0; border-radius: 16px; padding: 22px 24px 18px; width: min(440px, calc(100vw - 32px)); background: var(--bg); color: var(--ink);
  box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog h2 { margin-bottom: 8px; }
dialog .dactions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.input {
  width: 100%; font: inherit; color: var(--ink-strong); background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .65rem .8rem; outline: none;
}
.input:focus { border-color: var(--sage); box-shadow: 0 0 0 3px var(--focus); }
.pick { max-height: 50vh; overflow-y: auto; margin: 6px -8px 0; }
.pick button { width: 100%; display: flex; align-items: center; gap: 14px; padding: 8px; border: 0; background: none; border-radius: var(--radius); cursor: pointer; text-align: left; }
.pick button:hover { background: var(--bg-soft); }
.pick .th { width: 48px; height: 48px; border-radius: 8px; background: var(--bg-soft); overflow: hidden; display: grid; place-items: center; flex: none; color: var(--muted); }
.pick .th img { width: 100%; height: 100%; object-fit: cover; }
.pick .nm { font-weight: 700; color: var(--ink-strong); }
.pick .ct { font-size: .84rem; color: var(--muted); }
.menu {
  position: fixed; z-index: 80; background: var(--bg); color: var(--ink); border-radius: 10px; box-shadow: var(--shadow); border: 1px solid var(--line);
  padding: 6px 0; min-width: 210px;
}
.menu button { display: flex; width: 100%; align-items: center; gap: 12px; padding: 9px 16px; border: 0; background: none; cursor: pointer; text-align: left; font-weight: 600; }
.menu button:hover { background: var(--bg-soft); }
.menu button .i { width: 20px; height: 20px; color: var(--muted); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); z-index: 90; background: var(--ink-strong); color: var(--bg);
  padding: 12px 14px 12px 18px; border-radius: 10px; display: flex; gap: 16px; align-items: center; font-weight: 600; opacity: 0;
  pointer-events: none; transition: opacity .2s, transform .2s; max-width: calc(100vw - 24px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast button { background: none; border: 0; color: var(--online); font-weight: 700; cursor: pointer; padding: 2px 4px; }

/* ------------------------------------------------------------ login */
.login-page { display: grid; place-items: center; min-height: 100vh; background: var(--bg-soft); padding: 16px; }
.login-card { width: min(400px, 100%); background: var(--bg); border-radius: 18px; padding: 34px 30px 28px; box-shadow: var(--shadow); }
.login-card .logo { width: 64px; height: 64px; border-radius: 16px; margin: 0 auto 14px; }
.login-card h1 { text-align: center; font-size: 1.5rem; margin-bottom: 4px; }
.login-card .lede { text-align: center; color: var(--muted); margin-bottom: 22px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: 5px; color: var(--ink-strong); }
.login-card .btn { width: 100%; padding: .8rem; margin-top: 6px; }
.login-card .error { background: var(--danger-soft); color: var(--danger); border-radius: var(--radius); padding: 9px 12px; margin-bottom: 14px; font-weight: 600; font-size: .9rem; }
.login-foot { position: fixed; top: 14px; right: 14px; }

/* ------------------------------------------------------------ mobile */
.bottom-nav { display: none; }
@media (max-width: 1000px) {
  .brand { width: auto; }
  .brand span { display: none; }
}
@media (max-width: 760px) {
  :root { --topbar: 58px; }
  .menu-btn { display: grid; }
  .brand { display: none; }
  .topbar { gap: 4px; padding: 0 6px; }
  .search input { height: 42px; padding-left: 42px; }
  .search .i { left: 12px; }
  .upload-btn span { display: none; }
  .upload-btn { padding: .55rem; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); width: 280px; padding-top: 8px; top: 0; z-index: 40; }
  .sidebar .sb-brand { display: flex; }
  body.drawer .sidebar { transform: none; }
  main { padding: calc(var(--topbar) + 2px) 2px 84px 2px; }
  .page-head, .banner, .albums, .cards, .section, .node-list, .empty { margin-left: 12px; margin-right: 12px; }
  .tl { margin-right: 0; }
  .tl-head { padding-left: 8px; font-size: .9rem; }
  .top-actions .theme-toggle, .top-actions [data-act="logout"] { display: none; }
  .sb-foot { display: flex; }
  .scrubber { width: 40px; }
  .bottom-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 25; background: var(--bg); border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 0 6px; color: var(--muted); text-decoration: none; font-size: .74rem; font-weight: 700; }
  .bottom-nav a[aria-current="page"] { color: var(--sage); }
  .bottom-nav a[aria-current="page"] .i { background: var(--sage-soft); border-radius: 999px; width: 54px; padding: 0 16px; }
  .uploads { right: 12px; bottom: 76px; }
  .toast { bottom: 80px; }
}
.sb-brand { display: none; align-items: center; gap: 10px; padding: 8px 20px 14px; font-weight: 700; font-size: 1.2rem; color: var(--ink-strong); }
.sb-brand img { width: 32px; height: 32px; border-radius: 9px; }
.selactions { display: contents; }

.sb-foot { display: none; gap: 10px; align-items: center; padding: 14px 0 0 24px; }
details.more { max-width: 880px; }
@media (hover: none) { .viewer .nav { display: none; } }
