/* DMS Cloud — one stylesheet for the app, the sign-in pages and public links. */

:root {
  --bg: #f6f6f7;
  --surface: #ffffff;
  --surface-2: #f0f1f3;
  --border: #e2e3e8;
  --text: #1b1c21;
  --text-2: #565966;
  --muted: #868996;
  /* Brand colours. These are the defaults (orange & black); app/Branding.php overrides them per installation. */
  --accent: #f88525;
  --accent-hover: #da7521;
  --accent-soft: #feefe3;
  --on-accent: #1b1c21;
  --accent-ink: #a15618;          /* the accent, darkened enough to read as text */
  --side-bg: #111111;
  --side-text: #f3f3f5;
  --side-text-2: #b8b8ba;
  --side-muted: #8d8d8e;
  --side-hover: #252526;
  --side-border: #313131;
  --side-active: #442b15;
  --side-accent: #f88525;
  --hover: #f1f2f4;
  --sel: #feefe3;
  --ok: #17854f;
  --warn: #a86400;
  --warn-soft: #fff4dc;
  --danger: #cf2a1f;
  --shadow: 0 10px 34px rgba(18, 20, 30, .16);
  --shadow-sm: 0 1px 3px rgba(18, 20, 30, .08);
  --radius: 10px;
  --sidebar-w: 264px;
  --topbar-h: 60px;
  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #141519;
  --surface: #1c1d23;
  --surface-2: #25262e;
  --border: #32343d;
  --text: #f0f0f3;
  --text-2: #b3b5c0;
  --muted: #8a8d99;
  --accent: #f88525;
  --accent-hover: #f99746;
  --accent-soft: #443023;
  --on-accent: #1b1c21;
  --accent-ink: #f88525;
  --hover: #272830;
  --sel: #443023;
  --ok: #46c487;
  --warn: #f0b24a;
  --warn-soft: #3a2f18;
  --danger: #f4665d;
  --shadow: 0 12px 38px rgba(0, 0, 0, .5);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, .4);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; font-weight: 600; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

.ic { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.fill { fill: currentColor; }
.ic.sm { width: 14px; height: 14px; }
.ic.lg { width: 22px; height: 22px; }

/* ---- controls ---------------------------------------------------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; cursor: pointer; white-space: nowrap;
  transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--hover); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 8px;
  background: transparent; color: var(--text-2); cursor: pointer; flex: none;
}
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.on { color: var(--accent-ink); background: var(--accent-soft); }

.input, .select, textarea.input {
  width: 100%; height: 38px; padding: 0 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text); outline: none;
}
textarea.input { height: auto; padding: 10px 12px; resize: vertical; }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input[readonly] { background: var(--surface-2); }
.pw-wrap { position: relative; display: block; }
.pw-wrap > .input { padding-right: 42px; }
.pw-toggle {
  position: absolute; top: 50%; right: 4px; transform: translateY(-50%); display: grid; place-items: center;
  width: 32px; height: 30px; border: 0; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; padding: 0;
}
.pw-toggle:hover, .pw-toggle[aria-pressed="true"] { color: var(--text); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); }
.inline > .pw-wrap { flex: 1; min-width: 0; }
/* The browser's own reveal button would sit on top of ours. */
input[type="password"]::-ms-reveal, input[type="password"]::-ms-clear { display: none; }
.field { display: block; margin-bottom: 14px; }
.field > span, .field > label { display: block; margin-bottom: 6px; font-weight: 600; font-size: 13px; }
.field small, .hint { display: block; margin-top: 5px; color: var(--muted); font-size: 12.5px; }
.row-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.check { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; padding: 6px 0; }
.check input { width: 17px; height: 17px; margin: 2px 0 0; accent-color: var(--accent); flex: none; }
.check small { display: block; color: var(--muted); }

.badge {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--text-2); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.badge.ok { background: color-mix(in srgb, var(--ok) 14%, transparent); color: var(--ok); }
.badge.warn { background: var(--warn-soft); color: var(--warn); }
.badge.accent { background: var(--accent-soft); color: var(--accent-ink); }

.avatar {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  color: #fff; font-size: 12px; font-weight: 700; flex: none; letter-spacing: .02em;
}
.avatar.lg { width: 72px; height: 72px; font-size: 24px; }
img.avatar { object-fit: cover; background: var(--surface-2); }
.pic-host { flex: none; line-height: 0; }

.ficon { display: inline-block; width: 32px; height: 32px; flex: none; }
.ficon svg { width: 100%; height: 100%; display: block; }

/* ---- shell -------------------------------------------------------------------------------- */

.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); height: 100vh; height: 100dvh; transition: grid-template-columns .18s ease; }

/* The sidebar wears the secondary brand colour. Re-pointing the shared tokens here re-colours everything inside it. */
.sidebar {
  --text: var(--side-text); --text-2: var(--side-text-2); --muted: var(--side-muted);
  --hover: var(--side-hover); --border: var(--side-border); --surface-2: var(--side-hover);
  --accent-soft: var(--side-active); --accent-ink: var(--side-accent);
  display: flex; flex-direction: column; min-height: 0;
  background: var(--side-bg); color: var(--text); border-right: 1px solid var(--border);
}
.sidebar { position: relative; }
.collapse-btn {
  position: absolute; top: 18px; right: -12px; z-index: 8; display: grid; place-items: center; width: 24px; height: 24px; padding: 0;
  border: 1px solid var(--border); border-radius: 50%; background: var(--side-bg); color: var(--text-2); cursor: pointer;
}
.collapse-btn:hover { color: var(--text); background: var(--side-hover); }
.collapse-btn .ic { transition: transform .18s ease; }
.brand { display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 18px; flex: none; }
.brand img { width: 30px; height: 30px; object-fit: contain; }
.brand b { font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav { flex: 1; overflow-y: auto; padding: 6px 10px 12px; }
.nav-section { margin: 16px 10px 6px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; height: 38px; padding: 0 10px;
  border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-weight: 600; cursor: pointer; text-align: left;
}
.nav-item:hover { background: var(--hover); color: var(--text); text-decoration: none; }
.nav-item.active { background: var(--accent-soft); color: var(--accent-ink); }
.nav-item.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.nav-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tree { margin: 2px 0 6px; }
.tree-item {
  display: flex; align-items: center; gap: 4px; height: 30px; padding-right: 8px; border-radius: 6px;
  color: var(--text-2); cursor: pointer; font-size: 13px;
}
.tree-item:hover { background: var(--hover); color: var(--text); }
.tree-item.active { color: var(--accent-ink); font-weight: 600; }
.tree-item.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.tree-item .tw { display: grid; place-items: center; width: 18px; height: 18px; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0; flex: none; }
.tree-item .tw.open .ic { transform: rotate(90deg); }
.tree-item .tw:empty { visibility: hidden; }
.tree-item .ficon { width: 18px; height: 18px; }
.tree-item span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.side-foot { flex: none; padding: 14px 18px 12px; border-top: 1px solid var(--border); }
.meter { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 99px; background: var(--accent); min-width: 2px; }
.meter.warn > i { background: var(--warn); }
.meter-text { display: flex; justify-content: space-between; margin-bottom: 7px; font-size: 12.5px; color: var(--text-2); }
.meter-text b { color: var(--text); }
.copyright { margin-top: 12px; font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.copyright a { color: var(--text-2); font-weight: 600; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  display: flex; align-items: center; gap: 10px; height: var(--topbar-h); padding: 0 18px; flex: none;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar .menu-btn { display: none; }
.search { position: relative; flex: 1; max-width: 560px; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; height: 38px; padding: 0 12px 0 38px; border: 1px solid transparent; border-radius: 99px;
  background: var(--surface-2); outline: none;
}
.search input:focus { border-color: var(--accent); background: var(--surface); }
.topbar .spacer { flex: 1; }
.user-btn { display: flex; align-items: center; gap: 9px; padding: 4px 8px 4px 4px; border: 0; border-radius: 99px; background: transparent; cursor: pointer; }
.user-btn:hover { background: var(--hover); }
.user-btn .who { text-align: left; line-height: 1.2; }
.user-btn .who b { display: block; font-size: 13px; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-btn .who small { color: var(--muted); font-size: 11.5px; }

.view { flex: 1; min-height: 0; overflow-y: auto; position: relative; }
.backdrop { display: none; }

/* ---- file browser ------------------------------------------------------------------------- */

.toolbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 12px;
  min-height: 56px; padding: 8px 18px; background: var(--bg);
}
.crumbs { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; overflow: hidden; }
.crumb {
  display: inline-flex; align-items: center; gap: 8px; padding: 5px 8px; border: 0; border-radius: 7px; background: none;
  color: var(--text-2); font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap; min-width: 0;
}
.crumb span { overflow: hidden; text-overflow: ellipsis; }
.crumb:hover { background: var(--hover); color: var(--text); }
.crumb.cur { color: var(--text); cursor: default; flex-shrink: 1; }
.crumb.cur:hover { background: none; }
.crumb.drop { outline: 2px dashed var(--accent); }
.crumbs > .ic { color: var(--muted); }
.tools { display: flex; align-items: center; gap: 6px; flex: none; }

.banner {
  display: flex; align-items: center; gap: 10px; margin: 4px 18px 10px; padding: 10px 14px; border-radius: var(--radius);
  background: var(--warn-soft); color: var(--warn); font-weight: 600; font-size: 13px;
}
.banner.info { background: var(--accent-soft); color: var(--accent-ink); }
.banner .btn { margin-left: auto; }

.selbar {
  position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 4px;
  min-height: 56px; padding: 8px 18px; background: var(--bg);
}
.selbar .count { font-weight: 700; margin: 0 10px 0 4px; white-space: nowrap; }
.selbar .btn.ghost { padding: 0 10px; }

.files { padding: 0 18px 110px; }
.files.list { --cols: 34px minmax(0, 1fr) 110px 150px 130px 40px; }
.row {
  display: grid; grid-template-columns: var(--cols); align-items: center; gap: 0 8px;
  min-height: 48px; padding: 0 8px; border-radius: 8px; cursor: default; user-select: none;
}
.row.head {
  min-height: 34px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .03em;
  border-bottom: 1px solid var(--border); border-radius: 0; margin-bottom: 4px;
}
.row.head button { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: inherit; font: inherit; cursor: pointer; padding: 4px 0; }
.row.head button:hover { color: var(--text); }
.row:not(.head):hover { background: var(--hover); }
.row.sel, .row.sel:hover { background: var(--sel); }
.row.drop { outline: 2px dashed var(--accent); outline-offset: -2px; }
.row.cut { opacity: .5; }
.cb {
  display: grid; place-items: center; width: 18px; height: 18px; border: 1.5px solid var(--border); border-radius: 5px;
  background: var(--surface); color: transparent; cursor: pointer; padding: 0; opacity: 0;
}
.cb .ic { width: 12px; height: 12px; stroke-width: 3.2; }
.row:hover .cb, .row.sel .cb, .tile:hover .cb, .tile.sel .cb, .files.picking .cb, .row.head .cb { opacity: 1; }
.sel > .cb, .sel .cb, .cb.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); opacity: 1; }
.name-cell { display: flex; align-items: center; gap: 12px; min-width: 0; }
.name-cell .txt { min-width: 0; }
.name-cell .nm { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-cell .meta { display: none; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-cell .marks { display: flex; align-items: center; gap: 6px; margin-left: 4px; color: var(--muted); flex: none; }
.name-cell .marks .fav { color: #e8a317; }
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex: none; }
.cell { color: var(--text-2); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thumb-sm { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; background: var(--surface-2); flex: none; }
.row .more { opacity: 0; }
.row:hover .more, .row.sel .more { opacity: 1; }

.files.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 12px; padding-top: 4px; }
.files.grid .group { grid-column: 1 / -1; margin: 10px 2px 0; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.tile {
  position: relative; display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); overflow: hidden; cursor: default; user-select: none;
}
.tile:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.tile.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); background: var(--sel); }
.tile.drop { outline: 2px dashed var(--accent); }
.tile .thumb { display: grid; place-items: center; height: 124px; background: var(--surface-2); overflow: hidden; }
.tile .thumb img { width: 100%; height: 100%; object-fit: cover; }
.tile .thumb .ficon { width: 60px; height: 60px; }
.tile .cb { position: absolute; top: 8px; left: 8px; }
.tile .more { position: absolute; top: 4px; right: 4px; width: 30px; height: 30px; background: var(--surface); box-shadow: var(--shadow-sm); opacity: 0; }
.tile:hover .more { opacity: 1; }
.tile .tbody { padding: 9px 11px 10px; min-width: 0; }
.tile .tname { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile .tmeta { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; }
.tile .tmeta .fav { color: #e8a317; }
.tile.folder .thumb { height: 84px; }

.empty { display: grid; place-items: center; text-align: center; padding: 70px 20px; color: var(--muted); }
.empty .big { width: 84px; height: 84px; margin: 0 auto 16px; opacity: .55; }
.empty .big .ic { width: 84px; height: 84px; stroke-width: 1.1; }
.empty h3 { color: var(--text); font-size: 17px; margin-bottom: 6px; }
.empty p { margin: 0 0 16px; max-width: 380px; }

.dropzone {
  position: absolute; inset: 8px; z-index: 20; display: none; place-items: center; border: 2.5px dashed var(--accent);
  border-radius: 14px; background: color-mix(in srgb, var(--accent-soft) 88%, transparent); color: var(--accent-ink);
  font-size: 18px; font-weight: 700; pointer-events: none;
}
.dragging .dropzone { display: grid; }

.fab {
  display: none; position: fixed; right: 18px; bottom: 18px; z-index: 30; width: 56px; height: 56px; border: 0; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); box-shadow: var(--shadow); cursor: pointer; place-items: center;
}
.fab .ic { width: 26px; height: 26px; }

/* ---- menus, dialogs, toasts --------------------------------------------------------------- */

.menu {
  position: fixed; z-index: 100; min-width: 210px; max-width: 300px; max-height: calc(100vh - 16px); overflow-y: auto; padding: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.mi {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 36px; padding: 0 10px; border: 0; border-radius: 7px;
  background: none; color: var(--text); cursor: pointer; text-align: left; font-weight: 500;
}
.mi:hover { background: var(--hover); text-decoration: none; }
.mi .ic { color: var(--text-2); }
.mi.danger, .mi.danger .ic { color: var(--danger); }
.menu .sep { height: 1px; margin: 6px 4px; background: var(--border); }
.menu .title { padding: 6px 10px 4px; color: var(--muted); font-size: 12px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu .labels { display: flex; align-items: center; gap: 9px; padding: 8px 10px; }
.menu .labels button { width: 20px; height: 20px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; }
.menu .labels button.on { border-color: var(--text); }
.menu .labels button.none { background: none; border: 1.5px solid var(--border); position: relative; }
.menu-shade { position: fixed; inset: 0; z-index: 99; }

.modal-wrap {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 16px;
  background: rgba(15, 16, 22, .5); overflow-y: auto;
}
.modal { width: 100%; max-width: 460px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; max-height: calc(100dvh - 32px); }
.modal.wide { max-width: 620px; }
.modal-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 6px 22px; }
.modal-head h2 { flex: 1; font-size: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 10px 22px 6px; overflow-y: auto; }
.modal-body p { margin: 0 0 12px; color: var(--text-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px 20px; flex-wrap: wrap; }
.modal-foot .left { margin-right: auto; }
.form-error { margin: 0 0 12px; padding: 9px 12px; border-radius: 8px; background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); font-weight: 600; font-size: 13px; }

.toasts { position: fixed; left: 50%; bottom: 22px; z-index: 200; transform: translateX(-50%); display: grid; gap: 8px; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 10px; background: #23242b; color: #fff; box-shadow: var(--shadow); font-weight: 500; animation: rise .18s ease-out; }
.toast.err { background: #b3261e; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.picker { border: 1px solid var(--border); border-radius: 10px; max-height: 320px; overflow-y: auto; padding: 6px; }
.picker .tree-item { height: 34px; font-size: 14px; }
.picker .tree-item.active { background: var(--accent-soft); }
.picker .ptitle { margin: 6px 8px 4px; color: var(--muted); font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }

.people { display: grid; gap: 4px; margin: 4px 0 14px; }
.person { display: flex; align-items: center; gap: 12px; padding: 6px 4px; }
.person .who { flex: 1; min-width: 0; }
.person .who b, .person .who small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person .who small { color: var(--muted); }
.person .select { width: auto; height: 32px; padding: 0 8px; }
.suggest { border: 1px solid var(--border); border-radius: 8px; margin-top: 4px; overflow: hidden; }
.suggest button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 10px; border: 0; background: var(--surface); cursor: pointer; text-align: left; }
.suggest button:hover { background: var(--hover); }
.inline { display: flex; gap: 8px; align-items: center; }
.inline .input { flex: 1; min-width: 0; }

.kv { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 9px 14px; margin: 4px 0 10px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
.info-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.info-head .ficon { width: 48px; height: 48px; }
.info-head b { font-size: 15px; overflow-wrap: anywhere; }

/* ---- transfers ---------------------------------------------------------------------------- */

.transfers {
  position: fixed; right: 18px; bottom: 18px; z-index: 60; width: 370px; max-width: calc(100vw - 24px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden;
}
.transfers header { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 16px; cursor: pointer; }
.transfers header b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfers .overall { height: 3px; background: var(--surface-2); }
.transfers .overall i { display: block; height: 100%; background: var(--accent); transition: width .2s; }
.transfers ul { list-style: none; margin: 0; padding: 4px 0; max-height: 260px; overflow-y: auto; }
.transfers.collapsed ul { display: none; }
.transfers.collapsed header .ic.chev { transform: rotate(180deg); }
.transfers li { display: flex; align-items: center; gap: 10px; padding: 7px 8px 7px 16px; }
.transfers li .ficon { width: 26px; height: 26px; }
.transfers li .t { flex: 1; min-width: 0; }
.transfers li .t b { display: block; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.transfers li .t small { color: var(--muted); font-size: 12px; }
.transfers li.error .t small { color: var(--danger); }
.transfers li.done .t small { color: var(--ok); }
.transfers li .bar { height: 3px; margin-top: 4px; border-radius: 9px; background: var(--surface-2); overflow: hidden; }
.transfers li .bar i { display: block; height: 100%; background: var(--accent); }
.transfers li .icon-btn { width: 30px; height: 30px; }

/* ---- preview ------------------------------------------------------------------------------ */

.preview { position: fixed; inset: 0; z-index: 90; display: flex; flex-direction: column; background: rgba(12, 12, 16, .95); color: #fff; }
.preview header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; flex: none; }
.preview header b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.preview header small { color: #b9bbc6; white-space: nowrap; }
.preview .icon-btn { color: #e6e6ea; }
.preview .icon-btn:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.preview .stage { flex: 1; min-height: 0; display: grid; place-items: center; padding: 0 56px 18px; position: relative; }
.preview .stage img, .preview .stage video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.preview .stage iframe { width: min(1100px, 100%); height: 100%; border: 0; border-radius: 6px; background: #fff; }
.preview .stage pre { width: min(1000px, 100%); height: 100%; margin: 0; padding: 18px; overflow: auto; background: #1b1c22; border-radius: 8px; font: 13px/1.5 Consolas, "Cascadia Mono", monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.preview .stage .nopreview { text-align: center; color: #c9cad3; }
.preview .stage .nopreview .ficon { width: 84px; height: 84px; margin-bottom: 12px; }
.preview .nav-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 44px; height: 44px; border-radius: 50%; background: rgba(255, 255, 255, .1); }
.preview .nav-btn.prev { left: 8px; }
.preview .nav-btn.next { right: 8px; }

/* ---- pages (admin, account) --------------------------------------------------------------- */

.page { padding: 22px 24px 60px; max-width: 1180px; }
.page.narrow { max-width: 900px; }
.tabs { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 16px; border-radius: 11px; background: var(--surface-2); }
.tab { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 16px; border-radius: 8px; color: var(--text-2); font-weight: 600; }
.tab:hover { color: var(--text); text-decoration: none; }
.tab.on { background: var(--surface); color: var(--accent-ink); box-shadow: var(--shadow-sm); }
.card.doc > h2 { display: flex; align-items: center; gap: 10px; font-size: 16px; margin-bottom: 10px; }
.doc h2 .ic { color: var(--accent-ink); }
.doc p { margin: 0 0 10px; color: var(--text-2); line-height: 1.6; }
.doc ul, .doc ol { margin: 0 0 10px; padding-left: 22px; color: var(--text-2); line-height: 1.6; }
.doc li { margin-bottom: 5px; }
.doc b { color: var(--text); font-weight: 600; }
.doc > :last-child { margin-bottom: 0; }
kbd { display: inline-block; padding: 1px 6px; border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 5px; background: var(--surface-2); font: 12px Consolas, "Cascadia Mono", monospace; color: var(--text); }
.faq details { border-bottom: 1px solid var(--border); }
.faq details:last-child { border-bottom: 0; }
.faq summary { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 2px; cursor: pointer; font-weight: 600; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary .ic { color: var(--muted); transition: transform .15s; }
.faq details[open] summary .ic { transform: rotate(180deg); }
.faq details[open] summary { color: var(--accent-ink); }
.faq details p { margin: 0 2px 16px; color: var(--text-2); line-height: 1.6; }
.about { text-align: center; padding: 30px 20px; }
.about img { width: 220px; max-width: 70%; height: auto; padding: 14px; border-radius: 16px; background: #fff; }
.card.about > h2 { font-size: 22px; margin: 14px 0 6px; }
.about .ver { margin: 0 0 12px; }
.about p { max-width: 520px; margin: 0 auto; color: var(--text-2); line-height: 1.6; }
.scan { display: grid; gap: 2px; }
.scan-row { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 10px; align-items: start; padding: 7px 0; border-bottom: 1px solid var(--border); }
.scan-row:last-child { border-bottom: 0; }
.scan-row .badge { justify-content: center; }
.scan-row small { display: block; color: var(--text-2); }
.storage-tool { margin-top: 6px; padding-top: 4px; border-top: 1px solid var(--border); }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.swatch { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 6px; border: 1px solid var(--border); border-radius: 99px; background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13px; }
.swatch:hover { background: var(--hover); }
.swatch.on { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.swatch i { display: block; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--border); }
.color-field { display: flex; align-items: center; gap: 10px; }
.color-field input[type="color"] { width: 46px; height: 38px; padding: 2px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); cursor: pointer; flex: none; }
.theme-preview { display: flex; align-items: stretch; height: 74px; margin: 4px 0 14px; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; font-size: 12.5px; font-weight: 600; }
.theme-preview .side { width: 34%; padding: 10px; display: flex; flex-direction: column; gap: 6px; }
.theme-preview .side span { padding: 3px 8px; border-radius: 6px; }
.theme-preview .body { flex: 1; display: flex; align-items: center; gap: 10px; padding: 0 14px; background: var(--surface); }
.theme-preview .body b { padding: 7px 14px; border-radius: 8px; }
.danger-zone { border-color: color-mix(in srgb, var(--danger) 45%, var(--border)); }
.danger-zone h2 { color: var(--danger); }
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 21px; flex: 1; }
.page-head p { flex-basis: 100%; margin: -6px 0 0; color: var(--text-2); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 18px 20px; margin-bottom: 16px; }
.card > h2 { font-size: 15px; margin-bottom: 14px; }
.card > .sub { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.card > h2 + .sub { margin-top: -10px; }
.show-sm { display: none !important; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.cols > .card { margin-bottom: 0; }
.cols + .cols, .cols + .card, .stats + .cols { margin-top: 16px; }
.cols.split { grid-template-columns: minmax(0, 1.85fr) minmax(0, 1fr); align-items: start; }
.stack > .card:last-child { margin-bottom: 0; }
.stack > .card { margin-bottom: 16px; }
.card-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 14px; }
.card-title h2 { font-size: 15px; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }
.btn.busy { opacity: .6; cursor: progress; }
.log-head { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; padding-top: 16px; border-top: 1px solid var(--border); flex-wrap: wrap; }
.log { margin: 0; padding: 12px 14px; border-radius: 9px; background: var(--surface-2); color: var(--text); font: 12.5px/1.6 Consolas, "Cascadia Mono", monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.difflist { margin-top: 6px; }
.difflist summary { cursor: pointer; font-weight: 600; }
.difflist ul { margin: 6px 0 4px; padding-left: 20px; max-height: 190px; overflow-y: auto; font: 12.5px/1.6 Consolas, "Cascadia Mono", monospace; }
code { padding: 1px 5px; border-radius: 5px; background: var(--surface-2); font: 12.5px Consolas, "Cascadia Mono", monospace; overflow-wrap: anywhere; }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 99px; background: var(--warn-soft); color: var(--warn); font-size: 12.5px; font-weight: 700; white-space: nowrap; }
.pill:hover { text-decoration: none; filter: brightness(.97); }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; }
.stat .k { display: flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.stat .v { font-size: 25px; font-weight: 700; margin-top: 6px; letter-spacing: -.01em; }
.stat .s { color: var(--muted); font-size: 12.5px; margin-top: 1px; }

.chart { display: flex; align-items: flex-end; gap: 6px; height: 160px; border-bottom: 1px solid var(--border); }
.chart .col { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; min-width: 0; }
.chart .col i { display: block; width: min(22px, 70%); min-height: 2px; border-radius: 4px 4px 0 0; background: var(--accent); }
.chart .col.zero i { background: var(--border); }
.chart .col:hover i { background: var(--accent-hover); }
.chart .col .n { font-size: 12px; font-weight: 700; color: var(--text); line-height: 20px; }
.chart .col .tip {
  display: none; position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%); z-index: 3; padding: 6px 9px;
  border-radius: 7px; background: #23242b; color: #fff; font-size: 12px; white-space: nowrap; pointer-events: none;
}
.chart .col:hover .tip { display: block; }
.chart-x { display: flex; gap: 6px; margin-top: 6px; }
.chart-x span { flex: 1; display: flex; justify-content: center; color: var(--muted); font-size: 11px; min-width: 0; white-space: nowrap; }

.bars { display: grid; gap: 11px; }
.bars .b .top { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; font-size: 13px; }
.bars .b .top b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bars .b .top span { color: var(--text-2); white-space: nowrap; }

.table-wrap { overflow-x: auto; margin: 0 -20px -18px; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; padding: 9px 12px; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .03em; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table th:first-child, .table td:first-child { padding-left: 20px; }
.table th:last-child, .table td:last-child { padding-right: 20px; }
.table .who { display: flex; align-items: center; gap: 11px; min-width: 180px; }
.table .who b { display: block; }
.table .who small { color: var(--muted); }
.table .acts { display: flex; justify-content: flex-end; gap: 2px; white-space: nowrap; }
.table .num { white-space: nowrap; color: var(--text-2); }
.table td.wrap { overflow-wrap: anywhere; min-width: 160px; }
.usage { min-width: 110px; }
.usage small { display: block; margin-bottom: 4px; color: var(--text-2); white-space: nowrap; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters .input, .filters .select { width: auto; min-width: 180px; flex: 1; max-width: 320px; }
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-top: 14px; color: var(--text-2); }

.perm-group { margin: 12px 0 2px; color: var(--muted); font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.steps { margin: 0 0 14px; padding-left: 20px; color: var(--text-2); }
.steps li { margin-bottom: 6px; }
.avatar.logo { border-radius: 8px; }
img.avatar.logo { object-fit: contain; background: #fff; border: 1px solid var(--border); }
.avatar.xs { width: 20px; height: 20px; font-size: 9px; vertical-align: middle; }
.avatar.md { width: 44px; height: 44px; font-size: 15px; }
.logo-btn { position: relative; display: inline-grid; padding: 0; border: 0; background: none; border-radius: 9px; cursor: pointer; flex: none; }
.logo-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.logo-btn .cam { position: absolute; right: -5px; bottom: -5px; display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); color: var(--text-2); border: 1px solid var(--border); }
.logo-btn .cam svg { width: 11px; height: 11px; }
.org-cell { display: flex; align-items: center; gap: 9px; }
.org-cell .avatar { width: 26px; height: 26px; font-size: 10px; }
.org-cell b { display: block; font-weight: 600; white-space: nowrap; }
.org-cell small { color: var(--muted); }
.org-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.org-head h2 { flex: 1; min-width: 140px; margin: 0; font-size: 16px; }
.org-line { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }
.org-line > b { min-width: 150px; flex: 1; overflow-wrap: anywhere; }
.org-line > .label { color: var(--muted); font-size: 13px; min-width: 150px; flex: 1; }
.chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex: 2; min-width: 200px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 3px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 12.5px; font-weight: 600; }
.chip .avatar { width: 22px; height: 22px; font-size: 10px; }
.chip button { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.chip button:hover { background: var(--line); color: var(--text); }
.chip.plain { padding: 2px 9px; }
.note { padding: 10px 14px; border-radius: 9px; background: var(--surface-2); color: var(--text-2); font-size: 13px; margin-bottom: 14px; }
.profile { display: flex; align-items: center; gap: 16px; margin-bottom: 6px; }
.profile b { display: block; font-size: 17px; }
.profile span { color: var(--text-2); }

/* ---- sign-in, installer, public links ----------------------------------------------------- */

.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 28px 16px; }
.auth-card { width: 100%; max-width: 410px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 30px 28px 26px; box-shadow: var(--shadow-sm); }
.auth-card.wide { max-width: 560px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 22px; text-align: center; }
.auth-brand img { width: 88px; height: 88px; object-fit: contain; }
.auth-brand b { font-size: 22px; overflow-wrap: anywhere; }
.auth-card h1 { font-size: 19px; margin-bottom: 4px; text-align: center; }
.auth-card .lead { color: var(--text-2); margin: 0 0 20px; text-align: center; }
.auth-card.wide h1, .auth-card.wide .lead { text-align: left; }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: -2px 0 14px; }
.auth-row .check { padding: 0; align-items: center; }
.auth-row .check input { margin: 0; }
.auth-row a { font-weight: 600; white-space: nowrap; }
.captcha { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.captcha img { height: 56px; width: auto; max-width: 100%; border: 1px solid var(--border); border-radius: 8px; background: #f6f6f7; cursor: pointer; }
.field > label { cursor: default; }
.auth-card h2 { font-size: 14px; margin: 22px 0 12px; padding-top: 18px; border-top: 1px solid var(--border); }
.auth-alt { margin: 18px 0 0; text-align: center; color: var(--text-2); }
.install-box { margin-top: 16px; text-align: center; }
.install-box ol { margin: 10px auto 0; padding-left: 20px; max-width: 320px; text-align: left; color: var(--text-2); font-size: 13px; }
.net-pill { position: fixed; left: 50%; top: 10px; z-index: 210; transform: translateX(-50%); display: flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
  background: #23242b; color: #fff; font-size: 13px; font-weight: 600; box-shadow: var(--shadow); max-width: calc(100vw - 24px); }
.net-pill.ok { background: var(--ok); }
.banner .btn + .btn { margin-left: 0; }
.auth-foot { margin-top: 20px; color: var(--muted); font-size: 12.5px; text-align: center; }
.auth-foot a { color: var(--text-2); font-weight: 600; }

.pub { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.pub-top { display: flex; align-items: center; gap: 12px; height: 60px; padding: 0 20px; background: var(--surface); border-bottom: 1px solid var(--border); }
.pub-top img { width: 30px; height: 30px; object-fit: contain; }
.pub-top b { flex: 1; font-size: 16px; }
.pub-main { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 26px 18px; }
.pub-file { max-width: 520px; margin: 4vh auto 0; text-align: center; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 34px 26px; }
.pub-file .ficon { width: 84px; height: 84px; }
.pub-file .shot { max-width: 100%; max-height: 300px; border-radius: 10px; margin-bottom: 8px; }
.pub-file h1 { font-size: 18px; margin: 14px 0 4px; overflow-wrap: anywhere; }
.pub-file p { margin: 0 0 20px; color: var(--text-2); }
.pub-folder { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; overflow: hidden; }
.pub-folder .toolbar { position: static; background: none; border-bottom: 1px solid var(--border); padding: 10px 14px; }
.pub-folder .files { padding: 6px 6px 10px; }
.pub-folder .files.list { --cols: minmax(0, 1fr) 110px 130px 44px; }
.pub-foot { padding: 18px; text-align: center; color: var(--muted); font-size: 12.5px; }
.pub-foot a { color: var(--text-2); font-weight: 600; }

/* ---- minimised menu: icons only ----------------------------------------------------------- */

@media (min-width: 761px) {
  body.nav-mini { --sidebar-w: 68px; }
  .nav-mini .collapse-btn .ic { transform: rotate(180deg); }
  .nav-mini .brand { justify-content: center; padding: 0; }
  .nav-mini .brand b, .nav-mini .nav-item span, .nav-mini .tree, .nav-mini .side-foot { display: none; }
  .nav-mini .nav { padding: 6px 12px 12px; overflow-x: hidden; }
  .nav-mini .nav-item { justify-content: center; padding: 0; height: 42px; }
  .nav-mini .nav-item .ic { width: 20px; height: 20px; }
  /* a section title becomes a thin divider */
  .nav-mini .nav-section { height: 1px; margin: 10px 8px; padding: 0; overflow: hidden; background: var(--border); font-size: 0; }
}

/* ---- tablets ------------------------------------------------------------------------------ */

@media (max-width: 1100px) {
  :root { --sidebar-w: 228px; }
  .files.list { --cols: 34px minmax(0, 1fr) 96px 120px 40px; }
  .files.list .c-kind { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-btn .who { display: none; }
  .cols.split { grid-template-columns: minmax(0, 1fr); }
}

/* ---- phones ------------------------------------------------------------------------------- */

@media (max-width: 760px) {
  :root { --topbar-h: 56px; }
  .app { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; inset: 0 auto 0 0; z-index: 70; width: min(300px, 86vw);
    transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow);
  }
  .nav-open .sidebar { transform: none; }
  .nav-open .backdrop { display: block; position: fixed; inset: 0; z-index: 65; background: rgba(15, 16, 22, .5); }
  .topbar { padding: 0 8px 0 6px; gap: 4px; }
  .topbar .menu-btn { display: inline-grid; }
  .collapse-btn { display: none; }
  .topbar .spacer { display: none; }
  .pill span { display: none; }
  .pill { padding: 0 9px; }
  .search { max-width: none; }
  .toolbar, .selbar { padding: 6px 10px; min-height: 50px; }
  .toolbar .hide-sm { display: none; }
  .crumb { font-size: 14px; padding: 5px 6px; }
  .banner { margin: 4px 10px 8px; flex-wrap: wrap; }
  .files { padding: 0 6px 120px; }
  .files.list { --cols: 26px minmax(0, 1fr) 40px; }
  .files.list .c-size, .files.list .c-kind, .files.list .c-date { display: none; }
  .files.list .row { min-height: 56px; }
  .name-cell .meta { display: block; }
  .row .more, .tile .more, .cb { opacity: 1; }
  .files.grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 9px; padding-left: 10px; padding-right: 10px; }
  .tile .thumb { height: 104px; }
  .fab { display: grid; }
  .has-transfers .fab { bottom: 84px; }
  .selbar { position: fixed; top: auto; bottom: 0; left: 0; right: 0; z-index: 40; background: var(--surface); border-top: 1px solid var(--border); justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  .selbar .btn span { display: none; }
  .selbar .count { margin: 0 4px; font-size: 13px; }
  .transfers { right: 8px; left: 8px; bottom: 8px; width: auto; max-width: none; }
  .menu.sheet { left: 0 !important; right: 0; top: auto !important; bottom: 0; max-width: none; width: 100%; border-radius: 16px 16px 0 0; padding: 10px 10px calc(12px + env(safe-area-inset-bottom)); max-height: 78dvh; animation: rise .16s ease-out; }
  .menu.sheet .mi { min-height: 46px; font-size: 15px; }
  .menu-shade.dim { background: rgba(15, 16, 22, .45); }
  .modal-wrap { padding: 0; place-items: end center; }
  .modal, .modal.wide { max-width: none; border-radius: 16px 16px 0 0; max-height: 92dvh; }
  .modal-foot { padding-bottom: calc(18px + env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .row-fields { grid-template-columns: 1fr; gap: 0; }
  .row-fields > div:not(:last-child) { margin-bottom: 12px; }
  .page { padding: 16px 12px 60px; }
  .cols { grid-template-columns: minmax(0, 1fr); }
  .stats { gap: 9px; }
  .stat .v { font-size: 21px; }
  .card { padding: 16px; }
  .table-wrap { margin: 0 -16px -16px; }
  .table th:first-child, .table td:first-child { padding-left: 16px; }
  .table .hide-sm { display: none; }
  .show-sm { display: block !important; }
  .table td.wrap, .table .who { min-width: 0; }
  .table th, .table td { padding-left: 8px; padding-right: 8px; }
  .preview .stage { padding: 0 6px 10px; }
  .preview .nav-btn { background: rgba(0, 0, 0, .45); }
  .preview header small { display: none; }
  .kv { grid-template-columns: 96px minmax(0, 1fr); }
  .auth-card { padding: 24px 20px; }
  .pub-main { padding: 14px 10px; }
  .pub-folder .files.list { --cols: minmax(0, 1fr) 44px; }
}

/* Touch screens have no hover, so the per-item controls are always visible. */
@media (pointer: coarse) {
  .row .more, .tile .more, .cb { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
