/* gumsgi data – same palette as gumsgi mail: warm paper neutrals, one deep green accent for
   primary actions, folders and the current location. Follows the system light/dark setting. */
:root {
  --bg: #f4f4f1;
  --panel: #ffffff;
  --sunken: #ecebe6;
  --hover: #f0efea;
  --line: #e3e2dc;
  --line-strong: #cfcdc4;
  --text: #1d1d1b;
  --muted: #6b6a64;
  --accent: #1f6f5c;
  --accent-ink: #ffffff;
  --accent-soft: #e2eee8;
  --danger: #b3261e;
  --danger-soft: #f7e2df;
  --warn: #9a5b00;
  --shadow: 0 10px 30px rgba(29, 29, 27, .14), 0 2px 6px rgba(29, 29, 27, .08);
  --r-s: 6px;
  --r: 8px;
  --r-l: 12px;
  --side: 248px;
  --top: 56px;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121312;
    --panel: #1a1b1a;
    --sunken: #151615;
    --hover: #222422;
    --line: #2d2e2c;
    --line-strong: #3d3f3c;
    --text: #ecebe6;
    --muted: #9a9993;
    --accent: #5cc2a6;
    --accent-ink: #0d1a16;
    --accent-soft: #1d3530;
    --danger: #f2857d;
    --danger-soft: #3a1f1d;
    --warn: #e5a54a;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.ic { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--panel); cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--line)); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.block { width: 100%; justify-content: center; height: 40px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; flex: none;
  border: 0; border-radius: var(--r); background: transparent; cursor: pointer; color: var(--muted);
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn[aria-pressed="true"] { background: var(--panel); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }

/* ---------- app shell ---------- */
.app {
  display: grid; height: 100%;
  grid-template-columns: var(--side) minmax(0, 1fr);
  grid-template-rows: var(--top) 1fr;
  grid-template-areas: "top top" "side main";
}
.topbar {
  grid-area: top; display: flex; align-items: center; gap: 12px;
  padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--panel);
}
.nav-toggle { display: none; }
.brand { display: flex; align-items: center; gap: 9px; width: calc(var(--side) - 28px); font-size: 16px; text-decoration: none; white-space: nowrap; }
.brand b, .auth .brand b { color: var(--accent); }
.brand-mark { width: 24px; height: 24px; border-radius: 6px; background: url("icon.svg") center / cover no-repeat; flex: none; }
.search {
  flex: 1; min-width: 0; max-width: 640px; display: flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--bg); color: var(--muted);
}
.search:focus-within { border-color: var(--accent); background: var(--panel); }
.search input { flex: 1; min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; color: var(--text); }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.search kbd { font: 12px ui-monospace, monospace; padding: 1px 6px; border: 1px solid var(--line-strong); border-radius: 4px; }
.search:focus-within kbd { display: none; }
#accountBtn { margin-left: auto; }

/* ---------- sidebar ---------- */
.sidebar {
  grid-area: side; display: flex; flex-direction: column; min-height: 0;
  border-right: 1px solid var(--line); background: var(--panel); overflow: hidden;
}
.nav { display: grid; gap: 1px; padding: 10px 10px 4px; }
.nav a {
  display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 10px;
  border-radius: var(--r); text-decoration: none; color: var(--text);
}
.nav a .ic { color: var(--muted); }
.nav a:hover { background: var(--hover); }
.nav a[aria-current="page"] { background: var(--accent-soft); font-weight: 600; }
.nav a[aria-current="page"] .ic { color: var(--accent); }
.nav .count { margin-left: auto; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.side-section { padding: 6px 0 0; }
.side-section h2 { margin: 10px 20px 2px; font-size: 12px; font-weight: 600; color: var(--muted); }
.side-section .nav { padding-top: 2px; }
.side-section.grow { flex: 1; min-height: 80px; display: flex; flex-direction: column; }
.tree { flex: 1; overflow: auto; padding: 2px 10px 10px; }
.tree ul { list-style: none; margin: 0; padding: 0 0 0 14px; }
.tree > ul { padding-left: 0; }
.tnode { display: flex; align-items: center; min-height: 30px; border-radius: var(--r-s); }
.tnode:hover { background: var(--hover); }
.tnode.current { background: var(--accent-soft); }
.tnode.current a { font-weight: 600; }
.tnode .caret { width: 22px; height: 26px; display: grid; place-items: center; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 4px; padding: 0; }
.tnode .caret .ic { width: 14px; height: 14px; transition: transform .12s; }
.tnode .caret[aria-expanded="true"] .ic { transform: rotate(90deg); }
.tnode .caret.none { visibility: hidden; }
.tnode a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 7px; padding: 4px 6px 4px 0; text-decoration: none; }
.tnode a .ic { width: 16px; height: 16px; color: var(--accent); }
.tnode a span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree .tmsg { margin: 4px 10px; font-size: 13px; color: var(--muted); }

.storage { padding: 14px 20px 16px; border-top: 1px solid var(--line); }
.meter { height: 6px; border-radius: 3px; background: var(--sunken); overflow: hidden; box-shadow: inset 0 0 0 1px var(--line); }
.meter span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .3s; }
.meter.warn span { background: var(--warn); }
.meter.full span { background: var(--danger); }
.storage-main { margin: 8px 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }
.storage-sub { margin: 2px 0 0; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- main ---------- */
.main { grid-area: main; container-type: inline-size; position: relative; min-width: 0; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.toolbar {
  position: sticky; top: 0; z-index: 3; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px;
  padding: 14px 20px 12px; background: var(--bg);
}
.where { min-width: 0; flex: 1 1 280px; }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: 18px; font-weight: 600; min-width: 0; }
.crumbs a { text-decoration: none; padding: 1px 5px; border-radius: var(--r-s); color: var(--muted); max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs a:hover { background: var(--hover); color: var(--text); }
.crumbs [aria-current] { color: var(--text); padding: 1px 5px; overflow-wrap: anywhere; }
.crumbs .sep { width: 14px; height: 14px; color: var(--line-strong); }
.crumbs a.drop-ok { background: var(--accent-soft); color: var(--text); }
.summary { margin: 2px 0 0 5px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tools { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.sort select {
  height: 34px; padding: 0 30px 0 10px; border: 1px solid var(--line-strong); border-radius: var(--r);
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236b6a64' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M7 10l5 5 5-5'/%3E%3C/svg%3E") right 8px center / 16px no-repeat;
  appearance: none; cursor: pointer;
}
.seg { display: inline-flex; padding: 2px; gap: 2px; border-radius: 10px; background: var(--sunken); box-shadow: inset 0 0 0 1px var(--line); }
.seg .icon-btn { width: 32px; height: 30px; }

.selbar {
  position: sticky; top: 0; z-index: 4; display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 20px 8px; padding: 6px 8px 6px 14px; border-radius: var(--r-l);
  background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent);
}
.selcount { font-weight: 600; font-variant-numeric: tabular-nums; }
.selactions { display: flex; flex-wrap: wrap; gap: 6px; margin-left: auto; }
.selactions .btn { height: 32px; }

/* list layout */
.listhead, .items.list .entry {
  display: grid; align-items: center; column-gap: 12px;
  grid-template-columns: 28px 36px minmax(0, 1fr) 96px 150px 34px;
}
.listhead [data-sort="name"] { grid-column: 2 / span 2; }
.listhead { margin: 0 20px; padding: 0 8px 6px; border-bottom: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.listhead button { justify-self: start; border: 0; background: none; padding: 2px 0; color: inherit; cursor: pointer; font-weight: 600; }
.listhead button:hover, .listhead button.on { color: var(--text); }
.listhead .lh-size { justify-self: end; }
.listhead .lh-check { display: grid; place-items: center; }
.items { padding: 4px 20px 40px; }
.items.list .entry { min-height: 50px; padding: 4px 8px; border-bottom: 1px solid var(--line); cursor: default; user-select: none; }
.items.list .entry:hover { background: var(--hover); }
.items.list .entry.sel { background: var(--accent-soft); }
.entry.drop-ok { outline: 2px dashed var(--accent); outline-offset: -2px; }
.checkwrap { display: grid; place-items: center; width: 28px; height: 28px; cursor: pointer; }
.check, #selAll { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.vis { position: relative; }
.items.list .vis { display: grid; place-items: center; width: 36px; height: 36px; flex: none; border-radius: var(--r-s); background: var(--sunken); color: var(--muted); overflow: hidden; }
.items.list .vis.folder { background: var(--accent-soft); color: var(--accent); }
.items.list .vis img { width: 100%; height: 100%; object-fit: cover; }
.vis .ic { width: 20px; height: 20px; }
.txt { display: grid; min-width: 0; }
.title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: inherit; text-decoration: none; }
a.title:hover { text-decoration: underline; text-underline-offset: 2px; }
.entry[data-type="folder"] .title { font-weight: 600; }
.sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; color: var(--muted); }
.sub a { color: inherit; }
.sz, .dt { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sz { text-align: right; }
.more { color: var(--muted); }
.entry .ext { display: none; }
.rowbtns { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.items.list .entry.plain { grid-template-columns: minmax(0, 1fr) 96px 150px auto; padding-left: 14px; }

/* grid layout */
.items.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); align-content: start; }
.items.grid .entry {
  position: relative; display: flex; flex-direction: column; border-radius: var(--r-l);
  background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; user-select: none;
}
.items.grid .entry:hover { box-shadow: inset 0 0 0 1px var(--line-strong); }
.items.grid .entry.sel { box-shadow: inset 0 0 0 2px var(--accent); }
.items.grid .vis { display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--sunken); color: var(--muted); }
.items.grid .vis img { width: 100%; height: 100%; object-fit: cover; }
.items.grid .vis .ic { width: 38px; height: 38px; stroke-width: 1.4; }
.items.grid .vis.folder { color: var(--accent); background: var(--accent-soft); }
.items.grid .vis .ext { display: block; position: absolute; left: 8px; bottom: 8px; font: 600 10px/1 system-ui, sans-serif; letter-spacing: .02em; padding: 3px 5px; border-radius: 4px; background: var(--panel); color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); }
.items.grid .txt { padding: 8px 10px 10px; }
.items.grid .checkwrap { position: absolute; top: 6px; left: 6px; z-index: 1; border-radius: 6px; background: color-mix(in srgb, var(--panel) 85%, transparent); opacity: 0; }
.items.grid .entry:hover .checkwrap, .items.grid .entry.sel .checkwrap, .items.grid.selecting .checkwrap { opacity: 1; }
.items.grid .more { position: absolute; top: 6px; right: 6px; z-index: 1; background: color-mix(in srgb, var(--panel) 85%, transparent); opacity: 0; }
.items.grid .entry:hover .more, .items.grid .more:focus-visible { opacity: 1; }
.items.grid .sz, .items.grid .dt { display: none; }
.items.grid .sub { display: block; }
@media (hover: none) {
  .items.grid .checkwrap, .items.grid .more { opacity: 1; }
}

.sentinel { height: 1px; }
.state { display: grid; justify-items: start; gap: 10px; max-width: 520px; margin: 48px auto; padding: 0 20px; color: var(--muted); }
.state h3 { margin: 0; color: var(--text); font-size: 16px; }
.state p { margin: 0; }
.state.error h3 { color: var(--danger); }

/* drag & drop overlay */
.drop { position: fixed; inset: var(--top) 0 0 var(--side); z-index: 20; display: grid; place-items: center; padding: 20px; background: color-mix(in srgb, var(--bg) 82%, transparent); pointer-events: none; }
.drop-inner { display: grid; justify-items: center; gap: 10px; padding: 34px 40px; border: 2px dashed var(--accent); border-radius: 16px; background: var(--panel); text-align: center; }
.drop-inner .ic { width: 32px; height: 32px; color: var(--accent); }
.drop-inner p { margin: 0; font-size: 16px; }

/* ---------- uploads panel ---------- */
.uploads {
  position: fixed; right: 16px; bottom: 16px; z-index: 30; width: min(400px, calc(100vw - 32px));
  border-radius: var(--r-l); background: var(--panel); box-shadow: var(--shadow), inset 0 0 0 1px var(--line); overflow: hidden;
}
.up-head { display: flex; align-items: center; gap: 4px; padding: 10px 8px 10px 14px; }
.up-head > div { flex: 1; min-width: 0; }
.up-title { margin: 0 0 6px; font-weight: 600; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter.small { height: 4px; }
#upToggle .ic { transform: rotate(90deg); transition: transform .15s; }
#upToggle[aria-expanded="false"] .ic { transform: rotate(-90deg); }
.up-list { list-style: none; margin: 0; padding: 0 0 6px; max-height: 300px; overflow: auto; border-top: 1px solid var(--line); }
.up-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; padding: 8px 14px; }
.up-list li + li { border-top: 1px solid var(--line); }
.up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-meta { grid-column: 1; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-list li.error .up-meta { color: var(--danger); }
.up-list li.done .up-meta { color: var(--accent); }
.up-list .icon-btn { grid-row: 1 / span 2; grid-column: 2; }
.up-bar { grid-column: 1; height: 3px; border-radius: 2px; background: var(--sunken); overflow: hidden; }
.up-bar span { display: block; height: 100%; width: 0; background: var(--accent); }

/* ---------- menu, toasts ---------- */
.menu {
  position: fixed; z-index: 50; min-width: 220px; max-width: calc(100vw - 16px); padding: 6px;
  border-radius: var(--r-l); background: var(--panel); box-shadow: var(--shadow), inset 0 0 0 1px var(--line);
}
.menu button, .menu .mlabel {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 0 10px;
  border: 0; border-radius: var(--r-s); background: none; text-align: left; cursor: pointer;
}
.menu .mlabel { cursor: default; color: var(--muted); font-size: 12px; min-height: 26px; }
.menu button .ic { color: var(--muted); }
.menu button:hover, .menu button:focus-visible { background: var(--hover); outline: none; }
.menu button.danger, .menu button.danger .ic { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 4px; }

.toasts { position: fixed; left: 50%; bottom: 20px; z-index: 60; display: grid; gap: 8px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 16px; border-radius: var(--r-l);
  background: var(--text); color: var(--bg); box-shadow: var(--shadow); animation: toast-in .16s ease-out;
}
.toast.error { background: var(--danger); color: #fff; }
.toast button { border: 0; background: none; color: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; padding: 2px 4px; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- dialogs ---------- */
dialog {
  width: min(460px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 0; border-radius: 14px;
  background: var(--panel); color: var(--text); box-shadow: var(--shadow);
}
dialog::backdrop { background: rgba(10, 12, 11, .45); }
.dlg { display: grid; gap: 14px; padding: 20px; }
.dlg h2 { margin: 0; font-size: 17px; }
.dlg p { margin: 0; color: var(--muted); }
.dlg .actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; }
.field input, .field select {
  height: 40px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--panel); width: 100%;
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.field input[readonly] { background: var(--sunken); }
.hint { font-size: 12px; color: var(--muted); }
.warnbox { padding: 10px 12px; border-radius: var(--r); background: var(--danger-soft); color: var(--text); font-size: 13px; }
.codebox { display: flex; gap: 8px; }
.codebox input { flex: 1; min-width: 0; font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; }
.pick { max-height: 300px; overflow: auto; padding: 6px; border: 1px solid var(--line); border-radius: var(--r); }
.pick .tnode a { cursor: pointer; }
.pick .tnode.chosen { background: var(--accent-soft); }
.steps { margin: 0; padding-left: 20px; color: var(--muted); display: grid; gap: 6px; }
.steps code, .dlg code { font: 12.5px ui-monospace, SFMono-Regular, Menlo, monospace; background: var(--sunken); padding: 1px 5px; border-radius: 4px; color: var(--text); overflow-wrap: anywhere; }

/* preview */
dialog.preview { width: min(1100px, calc(100vw - 24px)); height: min(860px, calc(100vh - 24px)); max-height: none; }
.pv { display: grid; grid-template-rows: auto 1fr auto; height: 100%; }
.pv-head { display: flex; align-items: center; gap: 10px; padding: 10px 10px 10px 18px; border-bottom: 1px solid var(--line); }
.pv-head .txt { flex: 1; }
.pv-head .title { font-weight: 600; font-size: 15px; }
.pv-body { position: relative; min-height: 0; display: grid; grid-template: minmax(0, 1fr) / minmax(0, 1fr); place-items: center; background: var(--sunken); overflow: auto; }
.pv-body img { max-width: 100%; max-height: 100%; object-fit: contain; }
.pv-body video { max-width: 100%; max-height: 100%; background: #000; }
.pv-body audio { width: min(520px, 90%); }
.pv-body iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.pv-body pre { align-self: stretch; justify-self: stretch; margin: 0; padding: 16px 18px; overflow: auto; font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre-wrap; overflow-wrap: anywhere; background: var(--panel); }
.pv-none { display: grid; justify-items: center; gap: 12px; color: var(--muted); text-align: center; padding: 20px; }
.pv-none .ic { width: 48px; height: 48px; stroke-width: 1.3; }
.pv-nav { position: absolute; top: 50%; transform: translateY(-50%); width: 40px; height: 56px; border: 0; border-radius: var(--r); background: color-mix(in srgb, var(--panel) 80%, transparent); color: var(--text); cursor: pointer; display: grid; place-items: center; }
.pv-nav.prev { left: 10px; }
.pv-nav.next { right: 10px; }
.pv-nav .ic { width: 22px; height: 22px; }
.pv-foot { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px 14px; border-top: 1px solid var(--line); }
.pv-foot .spacer { flex: 1; }

/* ---------- login / message pages ---------- */
body.auth { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.auth-card { width: 100%; max-width: 380px; display: grid; gap: 14px; padding: 28px; border-radius: 14px; background: var(--panel); box-shadow: inset 0 0 0 1px var(--line); }
.auth .brand { width: auto; }
.auth h1 { margin: 6px 0 0; font-size: 21px; }
.auth p { margin: 0; }
.auth .muted, .muted { color: var(--muted); }
.auth .small { font-size: 13px; }
.auth .err { color: var(--danger); font-weight: 600; }
.auth-form { display: grid; gap: 12px; }

/* ---------- small screens ---------- */
@container (max-width: 980px) {
  .tools .btn:not(.primary) span { display: none; }
  .tools .btn:not(.primary) { padding: 0 9px; }
}
@container (max-width: 700px) {
  .tools .btn.primary span { display: none; }
  .tools .btn.primary { padding: 0 10px; }
}
@media (max-width: 760px) {
  :root { --top: 54px; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "top" "main"; }
  .topbar { gap: 6px; padding: 0 8px; }
  .nav-toggle { display: inline-grid; }
  .brand { width: auto; font-size: 15px; }
  .brand-mark { display: none; }
  .search kbd { display: none; }
  .sidebar {
    position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: min(300px, 86vw);
    transform: translateX(-102%); transition: transform .18s ease-out; box-shadow: var(--shadow);
  }
  body.nav-open .sidebar { transform: none; }
  .backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(10, 12, 11, .45); }
  .toolbar { padding: 12px 16px 10px; }
  .crumbs { font-size: 16px; }
  .tools { width: 100%; }
  .tools .sort { flex: 1; }
  .tools .sort select { width: 100%; }
  .listhead { display: none; }
  .items { padding: 2px 8px 90px; }
  .items.list .entry { grid-template-columns: 28px 36px minmax(0, 1fr) 34px; padding: 6px 4px; column-gap: 10px; }
  .items.list .entry .sz, .items.list .entry .dt { display: none; }
  .items.list .entry .sub.mob { display: block; }
  .items.list .entry.plain { grid-template-columns: minmax(0, 1fr); }
  .items.list .entry.plain .rowbtns { justify-content: flex-start; }
  .items.grid { gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .selbar { position: fixed; top: auto; bottom: 12px; left: 8px; right: 8px; z-index: 25; margin: 0; box-shadow: var(--shadow), inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); background: var(--panel); }
  .selactions .btn span { display: none; }
  .drop { inset: var(--top) 0 0 0; }
  dialog.preview { width: 100vw; height: 100dvh; max-width: 100vw; border-radius: 0; }
  .pv-foot .btn span { display: none; }
}
.sub.mob { display: none; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
