/* Home NAS — same design language as the smm project (Social Manager):
   ink on white, #f5f5f7 surfaces, hairline borders, frosted sticky nav, big bold titles. */

@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-display: swap;
  font-weight: 100 900;
  src: url(/inter-latin-wght.woff2) format("woff2-variations");
}

:root {
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ground: #ffffff;
  --surface: #f5f5f7;
  --line: #d2d2d7;
  --line-2: #e8e8ed;
  --link: #0066cc;
  --on-ink: #ffffff;
  --danger: #d70015;
  --ok: #248a3d;

  --font: "Inter Variable", Inter, -apple-system, "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
  --fs-display: 40px; --fs-title: 32px; --fs-h3: 21px; --fs-body-l: 17px; --fs-body: 15px; --fs-caption: 13px; --fs-micro: 12px;

  --gutter: 32px;
  --content-max: 1200px;
  --r-pill: 999px; --r-card: 18px; --r-tile: 14px; --r-input: 12px; --r-thumb: 10px;
  --sh-thumb: 0 1px 3px rgba(0,0,0,.12);
  --sh-pop: 0 12px 32px rgba(0,0,0,.12);
  --focus-ring: 0 0 0 3px rgba(0,0,0,.08);
  --t-fast: 150ms ease-out;
  --h-nav: 52px; --h-tabbar: 58px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100dvh; background: var(--ground); color: var(--ink);
  font-family: var(--font); font-size: var(--fs-body); line-height: 1.4; -webkit-font-smoothing: antialiased;
}
body:has(.lightbox:not([hidden])) { overflow: hidden; }
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
i[data-icon] { display: inline-flex; width: 18px; height: 18px; flex: none; }
i[data-icon] svg { width: 100%; height: 100%; display: block; }

.t-display { margin: 0; font-size: var(--fs-display); line-height: 1.1; font-weight: 700; letter-spacing: -0.025em; }
.t-h3 { margin: 0; font-size: var(--fs-h3); line-height: 1.25; font-weight: 600; letter-spacing: -0.015em; }
.t-lead { margin: 0; font-size: var(--fs-body-l); color: var(--ink-2); }
.t-caption { font-size: var(--fs-caption); }
.t-micro { font-size: var(--fs-micro); }
.t-muted, .muted { color: var(--ink-2); }
.small { font-size: var(--fs-micro); }
.error { margin: 0; min-height: 1.3em; color: var(--danger); font-size: var(--fs-caption); }

/* ---------- logo ---------- */
.logo {
  display: inline-block; flex: none; width: 24px; height: 24px; border-radius: 7px;
  background: var(--ink) url(/logo-mark.svg) center / 58% no-repeat;
}
.logo--72 { width: 72px; height: 72px; border-radius: 20px; box-shadow: var(--sh-pop); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 48px; padding: 0 22px; border-radius: var(--r-input); border: 0;
  background: var(--ink); color: var(--on-ink); font-size: var(--fs-body-l); font-weight: 500; white-space: nowrap;
  transition: opacity var(--t-fast);
}
.btn:hover { opacity: .88; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .35; cursor: not-allowed; }
.btn--xs, .btn.btn--xs { height: 40px; padding: 0 16px; font-size: var(--fs-body); }
.btn--secondary { background: var(--ground); color: var(--ink); border: 1px solid var(--line); }
.btn--secondary:hover { opacity: 1; background: var(--surface); }
.btn--block { width: 100%; }
.btn.danger { background: var(--ground); color: var(--danger); border: 1px solid var(--line); }
.btn.danger:hover { background: #fff1f2; opacity: 1; }
#dlgOk.danger { background: var(--danger); color: #fff; border: 0; }
#dlgOk.danger:hover { opacity: .88; background: var(--danger); }
.btn i[data-icon] { width: 17px; height: 17px; }

.select {
  height: 40px; padding: 0 12px; border-radius: var(--r-input); border: 1px solid var(--line);
  background: var(--ground); font-size: var(--fs-caption); font-weight: 500;
}
.select:focus, .input:focus { outline: none; border-color: var(--ink); box-shadow: var(--focus-ring); }

/* segmented control */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-input); background: var(--surface); }
.seg > button {
  display: inline-grid; place-items: center; width: 40px; height: 34px; padding: 0; border: 0; border-radius: var(--r-thumb);
  background: transparent; color: var(--ink-2); transition: background var(--t-fast), color var(--t-fast), box-shadow var(--t-fast);
}
.seg > button.active { background: var(--ground); color: var(--ink); box-shadow: var(--sh-thumb); }

/* inputs */
.field { display: flex; flex-direction: column; gap: 8px; }
.field > label { font-size: var(--fs-caption); font-weight: 500; }
.input {
  width: 100%; height: 48px; padding: 0 16px; border-radius: var(--r-input); border: 1px solid var(--line);
  background: var(--ground); font-size: var(--fs-body);
}
.input--l { font-size: var(--fs-body-l); }

/* ---------- nav (web chrome) ---------- */
.nav {
  position: sticky; top: 0; z-index: 20; height: var(--h-nav);
  display: flex; align-items: center; gap: 28px; padding: 0 var(--gutter);
  padding-top: env(safe-area-inset-top); height: calc(var(--h-nav) + env(safe-area-inset-top));
  background: rgba(255,255,255,.92); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.nav--center { justify-content: center; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand .name { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.brand .space { font-size: var(--fs-caption); color: var(--ink-2); padding-left: 10px; border-left: 1px solid var(--line); }
.brand .space:empty { display: none; }
.links { display: flex; align-items: center; gap: 28px; font-size: var(--fs-caption); align-self: stretch; }
.links a { display: inline-flex; align-items: center; gap: 7px; color: var(--ink-2); border-bottom: 2px solid transparent; padding-top: 2px; }
.links a i[data-icon] { width: 16px; height: 16px; }
.links a:hover { color: var(--ink); }
.links a.active { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.nav-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.search { position: relative; width: min(280px, 32vw); }
.search i { position: absolute; left: 11px; top: 9px; width: 16px; height: 16px; color: var(--ink-2); pointer-events: none; }
.search input {
  width: 100%; height: 34px; padding: 0 12px 0 34px; border: 1px solid transparent; border-radius: var(--r-pill);
  background: var(--surface); font-size: var(--fs-caption); outline: none; -webkit-appearance: none; appearance: none;
}
.search input:focus { background: var(--ground); border-color: var(--line); box-shadow: var(--focus-ring); }
.logout { border: 0; background: none; padding: 0; display: inline-flex; align-items: center; color: var(--ink-2); font-size: var(--fs-caption); }
.logout:hover { color: var(--ink); }

/* ---------- page ---------- */
.page {
  width: 100%; max-width: var(--content-max); margin: 0 auto;
  padding: 44px var(--gutter) 120px; display: flex; flex-direction: column; gap: 24px;
}
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; flex-wrap: wrap; }

/* breadcrumbs: parents small on top, current folder as the big title */
.crumbs { flex: 1 1 320px; min-width: 0; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 6px; row-gap: 6px; font-size: var(--fs-caption); }
.crumbs a { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; border-radius: 6px; }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { font-size: 0; color: var(--line); }
.crumbs .sep::before { content: "›"; font-size: var(--fs-caption); }
.crumbs .sep:nth-last-child(2) { display: none; }
.crumbs a:last-child {
  flex-basis: 100%; color: var(--ink); font-size: var(--fs-display); line-height: 1.1; font-weight: 700; letter-spacing: -0.025em;
  white-space: normal; word-break: break-word;
}
.crumbs a:only-child { margin-top: 0; }
.crumbs a.drop-target { background: var(--surface); color: var(--ink); outline: 2px solid var(--ink); }

/* storage tile */
.storage { width: 260px; padding: 14px 16px; border-radius: var(--r-tile); background: var(--surface); display: grid; gap: 8px; }
.storage-head { display: flex; gap: 8px; align-items: center; font-size: var(--fs-caption); font-weight: 600; }
.storage-head i { width: 16px; height: 16px; }
.meter { height: 4px; border-radius: 2px; background: var(--line-2); overflow: hidden; }
.meter > div { height: 100%; width: 0; border-radius: inherit; background: var(--ink); transition: width .3s; }
.storage.offline .storage-head { color: var(--danger); }

/* toolbar + selection bar */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-bottom: 20px; border-bottom: 1px solid var(--line-2); }
.tool-group { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tool-group.right { margin-left: auto; }
.selbar {
  position: sticky; top: calc(var(--h-nav) + env(safe-area-inset-top) + 12px); z-index: 15;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 8px 8px 18px; border-radius: var(--r-input); background: var(--ink); color: var(--on-ink);
  font-size: var(--fs-caption); font-weight: 600; box-shadow: var(--sh-pop);
}
.selbar .tool-group { gap: 2px; }
.sel-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 0; border-radius: var(--r-thumb);
  background: transparent; color: var(--on-ink); font-size: var(--fs-caption); font-weight: 500;
}
.sel-btn:hover { background: rgba(255,255,255,.14); }
.sel-btn i[data-icon] { width: 16px; height: 16px; }
#selDelete { color: #ff8a8a; }

/* ---------- content ---------- */
.content.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); grid-auto-rows: max-content; gap: 24px 16px; }
.content > * { flex: none; }

.card { position: relative; cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; border-radius: var(--r-tile); }
.thumb {
  position: relative; aspect-ratio: 1 / 1; display: grid; place-items: center; overflow: hidden;
  border-radius: var(--r-tile); background: var(--surface); transition: filter var(--t-fast), transform var(--t-fast), box-shadow var(--t-fast);
}
.card:hover .thumb { filter: brightness(.97); }
.card:active .thumb { transform: scale(.98); }
.thumb img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s; }
.thumb img.loaded { opacity: 1; }
.thumb .big-icon { position: absolute; width: 42px; height: 42px; color: var(--ink-2); }
.thumb.dir .big-icon { width: 56px; height: 56px; color: var(--ink); }
.thumb.dir .big-icon svg { stroke-width: 1.4; }
.thumb .badge {
  position: absolute; left: 8px; bottom: 8px; display: flex; align-items: center; gap: 4px;
  height: 22px; padding: 0 8px 0 6px; border-radius: var(--r-pill); background: rgba(29,29,31,.72); color: #fff;
  font-size: 11px; font-weight: 600; backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.thumb .badge i { width: 11px; height: 11px; }
.card .info { padding: 10px 2px 0; min-width: 0; }
.card .name { font-size: var(--fs-caption); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card .meta { color: var(--ink-2); font-size: var(--fs-micro); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card.selected .thumb { box-shadow: 0 0 0 3px var(--ground), 0 0 0 5px var(--ink); }
.card.drop-target .thumb { box-shadow: 0 0 0 3px var(--ink); background: var(--line-2); }

.check {
  position: absolute; top: 8px; left: 8px; z-index: 2; width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center; border: 1.5px solid #fff; background: rgba(0,0,0,.18); color: #fff;
  opacity: 0; transition: opacity var(--t-fast); cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.check i { width: 14px; height: 14px; opacity: 0; }
.card:hover .check, .content.selecting .check, .card.selected .check { opacity: 1; }
.card.selected .check { background: var(--ink); border-color: #fff; }
.card.selected .check i { opacity: 1; }
@media (hover: none) { .content.selecting .check { opacity: 1; } }

/* list view: grouped rows with hairline dividers */
.content.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--r-tile); overflow: hidden; }
.content.list .section-title { padding: 14px 18px 6px; margin: 0; }
.content.list .card {
  display: grid; grid-template-columns: 40px minmax(0,1fr) auto; align-items: center; gap: 14px;
  padding: 10px 18px 10px 52px; border-radius: 0; background: var(--ground);
}
.content.list .card + .card { border-top: 1px solid var(--line-2); }
.content.list .card:hover { background: var(--surface); }
.content.list .card:hover .thumb { filter: none; }
.content.list .card.selected { background: var(--surface); }
.content.list .card.selected .thumb { box-shadow: none; }
.content.list .thumb { width: 40px; height: 40px; border-radius: var(--r-thumb); aspect-ratio: auto; }
.content.list .thumb .big-icon { width: 22px; height: 22px; }
.content.list .thumb .badge { display: none; }
.content.list .info { padding: 0; display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.content.list .name { font-size: var(--fs-body); }
.content.list .meta { text-align: right; flex: none; max-width: 45%; }
.content.list .check { top: 50%; left: 16px; transform: translateY(-50%); border-color: var(--line); background: var(--ground); box-shadow: none; }
.content.list .card.selected .check { border-color: var(--ink); background: var(--ink); }
.trash-actions { display: flex; gap: 6px; }
.content.grid .trash-actions { padding: 8px 0 0; }
.content.grid .trash-actions .btn { flex: 1 1 0; min-width: 0; padding: 0 6px; gap: 4px; }
.trash-actions .btn { height: 32px; padding: 0 12px; font-size: var(--fs-micro); border-radius: var(--r-thumb); background: var(--ground); color: var(--ink); border: 1px solid var(--line); }
.trash-actions .btn.danger { color: var(--danger); }
.trash-actions .btn i { width: 14px; height: 14px; }

.section-title { grid-column: 1 / -1; margin: 8px 0 -8px; font-size: var(--fs-micro); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 56px 24px; text-align: center;
  border: 1px dashed var(--line); border-radius: var(--r-card); color: var(--ink-2);
}
.empty i { width: 44px; height: 44px; padding: 11px; margin-bottom: 8px; border-radius: 50%; background: var(--surface); color: var(--ink); box-sizing: content-box; }
.empty h3 { margin: 0; color: var(--ink); font-size: var(--fs-body-l); font-weight: 600; }
.empty p { margin: 0; font-size: var(--fs-caption); }

.skeleton .thumb { background: linear-gradient(90deg, var(--surface), var(--line-2), var(--surface)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- sign in ---------- */
.shell { min-height: 100dvh; display: flex; flex-direction: column; }
.shell main { flex: 1 1 auto; display: flex; align-items: center; justify-content: center; padding: 64px 24px; }
.signin { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 32px; }
.signin-head { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.signin-foot { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.signin-foot p { margin: 0; }
.shell footer { padding: 20px 24px calc(20px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); display: flex; justify-content: center; font-size: var(--fs-micro); color: var(--ink-2); }

/* ---------- viewer ---------- */
.lightbox { position: fixed; inset: 0; z-index: 50; background: #000; display: grid; grid-template-rows: auto 1fr; color: #fff; }
.lb-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; z-index: 2;
  padding: 10px 16px; padding-top: max(10px, env(safe-area-inset-top));
}
.lb-title { min-width: 0; display: grid; }
.lb-title span:first-child { font-size: var(--fs-caption); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-title span:last-child { color: rgba(255,255,255,.6); }
.lb-actions { display: flex; gap: 8px; }
.lb-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer;
  background: rgba(255,255,255,.14); color: #fff; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
}
.lb-btn:hover { background: rgba(255,255,255,.24); }
.lb-btn i { width: 17px; height: 17px; }
.lb-stage { position: relative; display: grid; place-items: center; min-height: 0; padding: 0 72px 24px; touch-action: pan-y; }
.lb-stage img, .lb-stage video { max-width: 100%; max-height: 100%; object-fit: contain; }
.lb-stage img { transition: opacity .2s; }
.lb-stage .spinner { position: absolute; width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid rgba(255,255,255,.2); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.lb-nav {
  position: absolute; top: 50%; z-index: 3; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: rgba(255,255,255,.14); color: #fff; transform: translateY(-50%);
}
.lb-nav:hover { background: rgba(255,255,255,.24); }
.lb-nav.prev { left: 16px; } .lb-nav.next { right: 16px; }
.lb-nav i { width: 22px; height: 22px; }
.lb-file { display: grid; gap: 12px; justify-items: center; text-align: center; }
.lb-file > i { width: 56px; height: 56px; opacity: .8; }
.lb-file .muted { color: rgba(255,255,255,.6); }
.lb-file .btn { background: #fff; color: var(--ink); height: 44px; font-size: var(--fs-body); }

/* ---------- uploads / drop / dialog / toast ---------- */
.uploads {
  position: fixed; right: 24px; bottom: 24px; z-index: 40; width: min(360px, calc(100vw - 32px)); max-height: 50vh;
  display: flex; flex-direction: column; gap: 12px; padding: 16px 18px; border-radius: var(--r-card);
  background: var(--ground); border: 1px solid var(--line); box-shadow: var(--sh-pop);
}
.uploads-head { display: flex; justify-content: space-between; align-items: center; font-size: var(--fs-body); }
.x-btn { display: inline-grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: 50%; background: var(--surface); color: var(--ink-2); }
.x-btn i { width: 14px; height: 14px; }
.uploads ul { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: grid; gap: 10px; }
.uploads li { display: grid; gap: 5px; font-size: var(--fs-micro); }
.uploads li .row { display: flex; justify-content: space-between; gap: 8px; }
.uploads li .row span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploads li .row span:last-child { color: var(--ink-2); flex: none; }
.uploads li.error .row span:last-child { color: var(--danger); }
.uploads li.done .row span:last-child { color: var(--ok); }
.uploads li .meter { height: 3px; }

.dropzone { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; background: rgba(255,255,255,.7); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); pointer-events: none; }
.dropzone > div { display: grid; justify-items: center; gap: 4px; padding: 36px 56px; border: 1.5px dashed var(--ink); border-radius: var(--r-card); background: var(--ground); font-weight: 600; }
.dropzone i { width: 32px; height: 32px; }
.dropzone p { margin: 0; }

dialog {
  border: 0; padding: 0; border-radius: var(--r-card); background: var(--ground); color: var(--ink);
  box-shadow: 0 24px 64px rgba(0,0,0,.18); width: min(420px, calc(100vw - 32px));
}
dialog::backdrop { background: rgba(0,0,0,.32); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.dialog { display: flex; flex-direction: column; gap: 16px; padding: 28px; }
.dialog p { margin: -6px 0 0; font-size: var(--fs-caption); }
.dialog p:empty { display: none; }
.dialog .select { width: 100%; height: 48px; font-size: var(--fs-body); font-weight: 400; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 60; transform: translate(-50%, 16px); opacity: 0; pointer-events: none;
  padding: 11px 18px; border-radius: var(--r-pill); background: var(--ink); color: var(--on-ink);
  font-size: var(--fs-caption); font-weight: 500; transition: opacity .2s, transform .2s; max-width: calc(100vw - 32px); box-shadow: var(--sh-pop);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--danger); }

.only-mobile { display: none !important; }

/* ---------- tablet ---------- */
@media (max-width: 900px) {
  .storage { width: 100%; }
}

/* ---------- phone: tab bar at the bottom, like the smm mobile app ---------- */
@media (max-width: 760px) {
  :root { --gutter: 20px; }
  .only-mobile { display: inline-flex !important; }
  .logo--72.only-mobile { display: inline-block !important; }
  .hide-mobile { display: none !important; }

  /* no blur on the phone nav: backdrop-filter would trap the fixed tab bar inside it */
  .nav { gap: 14px; background: rgba(255,255,255,.97); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .nav--center { display: none; }
  .nav-right { flex: 1; gap: 14px; }
  .search { width: auto; flex: 1; }
  .logout i[data-icon] { width: 20px; height: 20px; }

  .links {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; align-self: auto;
    display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
    padding: 6px 12px calc(env(safe-area-inset-bottom) + 8px);
    background: rgba(255,255,255,.94); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
    border-top: 1px solid var(--line-2);
  }
  .links a { flex-direction: column; justify-content: center; gap: 3px; padding: 6px 0 0; border: 0; font-size: 10px; font-weight: 500; }
  .links a i[data-icon] { width: 24px; height: 24px; }
  .links a.active { border: 0; font-weight: 600; }

  .page { padding: 24px var(--gutter) calc(var(--h-tabbar) + env(safe-area-inset-bottom) + 96px); gap: 18px; }
  .crumbs a:last-child { font-size: var(--fs-title); }
  .storage { grid-template-columns: auto 1fr; align-items: center; column-gap: 10px; row-gap: 8px; padding: 10px 14px; border-radius: 12px; }
  .storage .meter { grid-column: 1 / -1; grid-row: 2; }
  #storageText { text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .toolbar { padding-bottom: 16px; gap: 8px; }
  .toolbar .btn span { display: none; }
  .toolbar .btn { width: 40px; padding: 0; }
  .selbar { top: calc(var(--h-nav) + env(safe-area-inset-top) + 8px); padding-left: 14px; }
  .sel-btn span { display: none; }
  .sel-btn { width: 38px; padding: 0; justify-content: center; }

  .content.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 8px; }
  .content.grid .thumb { border-radius: 12px; }
  .content.grid .meta { display: none; }
  .content.grid .info { padding-top: 6px; }
  .content.grid .name { font-size: var(--fs-micro); }
  .check { width: 22px; height: 22px; top: 6px; left: 6px; }
  .content.list { border-radius: var(--r-tile); }
  .content.list .card { padding: 10px 14px 10px 46px; gap: 12px; }
  .content.list .check { left: 13px; }
  .content.list .info { flex-direction: column; align-items: flex-start; gap: 1px; }
  .content.list .name { max-width: 100%; }
  .content.list .meta { text-align: left; max-width: 100%; }
  .content.list .card { grid-template-columns: 40px minmax(0,1fr); }
  .content.list .trash-actions { grid-column: 2; }

  .signin { gap: 28px; }
  .shell main { align-items: flex-start; padding: calc(env(safe-area-inset-top) + 72px) 24px 40px; }
  .t-display { font-size: var(--fs-title); }
  .input--l { height: 50px; border-radius: 14px; background: var(--surface); border-color: transparent; }
  .signin .btn { height: 50px; border-radius: 14px; font-size: 16px; }

  .lb-stage { padding: 0 0 16px; }
  .lb-nav { display: none; }
  .uploads { right: 16px; left: 16px; width: auto; bottom: calc(var(--h-tabbar) + env(safe-area-inset-bottom) + 12px); }
  .toast { bottom: calc(var(--h-tabbar) + env(safe-area-inset-bottom) + 16px); }
  .dialog { padding: 24px; }
}
@media (max-width: 380px) {
  .content.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
/* iOS zooms into inputs under 16px — keep them at 16px on phones */
@media (max-width: 760px) { .search input, .input, .dialog .select { font-size: 16px; } }
