:root {
  --ink: #1d1d1b;
  --ink-2: #292927;
  --muted: #6f6f6e;
  --grey: #878787;
  --line: #e3e4e6;
  --bg: #f4f4f5;
  --panel: #ffffff;
  --hover: #f0f0f1;
  /* surfaces and lines (redefined for dark mode below) */
  --surface-2: #fafafa;
  --row-hover: #fafafb;
  --line-2: #efeff0;
  --input-border: #cfd0d3;
  --input-border-hover: #b9babd;
  --line-strong: #c2c3c6;
  --fill: #ececee;
  --thumb-bg: #eeeff0;
  --snippet-bg: #f7f7f8;
  --selected: #f1f1f2;
  --mark: #ffe58a;
  --match: #fffbe6;
  --danger-soft: #fbeceb;
  --ok-soft: #edf5ee;
  --warn-soft: #fdf6e3;
  --warn-line: #c99700;
  --warn-tag: #fdf0d0;
  --act-login: #eef2f7; --act-file: #eef6ef; --act-folder: #f6f1e8; --act-user: #efedf6; --act-mail: #eaf4f6;
  --guest-bg: linear-gradient(180deg, #edeeef 0%, #f7f7f8 100%);
  --shadow: rgba(0,0,0,.05);
  /* main colour: chosen by the admin (inline style in the layout), the ink colour otherwise */
  --primary: var(--ink);
  --on-primary: var(--panel);
  --primary-hover: color-mix(in oklab, var(--primary) 84%, var(--bg));
  --primary-soft: color-mix(in oklab, var(--primary) 9%, var(--panel));
  --danger: #b3261e;
  --ok: #2e7d32;
  --warn: #8a6100;
  --radius: 4px;
  --font: "Helvetica Neue", Helvetica, Arial, system-ui, -apple-system, "Segoe UI", sans-serif;
}
/* Dark mode: <html data-theme="dark">, or data-theme="auto" with a dark device setting */
html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"], html[data-theme="dark"] body {
  --ink: #ececea; --ink-2: #d7d7d4; --muted: #a3a3a0; --grey: #8e8e8b; --line: #30302e; --bg: #141413; --panel: #1c1c1b; --hover: #272726;
  --surface-2: #212120; --row-hover: #232322; --line-2: #2a2a28; --input-border: #3c3c3a; --input-border-hover: #50504d; --line-strong: #4b4b48;
  --fill: #2c2c2a; --thumb-bg: #252524; --snippet-bg: #262625; --selected: #2a2a28; --mark: #6e5c12; --match: #3a3417;
  --danger: #f0716a; --ok: #6cc070; --warn: #e3bd5a; --danger-soft: #3b1e1c; --ok-soft: #1c2f1e; --warn-soft: #332a10; --warn-line: #9c7a1c; --warn-tag: #3b3011;
  --act-login: #1f2836; --act-file: #1d2e20; --act-folder: #33291b; --act-user: #29243a; --act-mail: #1b2f33;
  --guest-bg: linear-gradient(180deg, #121211 0%, #1a1a19 100%); --shadow: rgba(0,0,0,.4);
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] { color-scheme: dark; }
  html[data-theme="auto"], html[data-theme="auto"] body {
    --ink: #ececea; --ink-2: #d7d7d4; --muted: #a3a3a0; --grey: #8e8e8b; --line: #30302e; --bg: #141413; --panel: #1c1c1b; --hover: #272726;
    --surface-2: #212120; --row-hover: #232322; --line-2: #2a2a28; --input-border: #3c3c3a; --input-border-hover: #50504d; --line-strong: #4b4b48;
    --fill: #2c2c2a; --thumb-bg: #252524; --snippet-bg: #262625; --selected: #2a2a28; --mark: #6e5c12; --match: #3a3417;
    --danger: #f0716a; --ok: #6cc070; --warn: #e3bd5a; --danger-soft: #3b1e1c; --ok-soft: #1c2f1e; --warn-soft: #332a10; --warn-line: #9c7a1c; --warn-tag: #3b3011;
    --act-login: #1f2836; --act-file: #1d2e20; --act-folder: #33291b; --act-user: #29243a; --act-mail: #1b2f33;
    --guest-bg: linear-gradient(180deg, #121211 0%, #1a1a19 100%); --shadow: rgba(0,0,0,.4);
  }
}
/* The old default GICO logo (installations made before URKA, see default_logo()) is black: lighten it in dark mode (an uploaded dark logo is used as is) */
html[data-theme="dark"] img.logo-default { filter: invert(1) hue-rotate(180deg) brightness(1.1); }
@media (prefers-color-scheme: dark) { html[data-theme="auto"] img.logo-default { filter: invert(1) hue-rotate(180deg) brightness(1.1); } }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 var(--font); color: var(--ink); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--ink); text-decoration-color: var(--grey); text-underline-offset: 2px; }
a:hover { text-decoration-color: var(--ink); }
h1, h2 { font-weight: 600; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 16px; }
.h1 { font-size: 24px; margin: 0; line-height: 1.25; word-break: break-word; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.xsmall { font-size: 12px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.break { word-break: break-word; }
.inline { display: inline; }
.spacer { flex: 1; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
.icon { flex-shrink: 0; vertical-align: middle; }

/* ---------- top bar ---------- */
.topbar { background: var(--panel); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-inner { max-width: 1280px; margin: 0 auto; padding: 0 24px; display: flex; align-items: center; gap: 24px; min-height: 68px; }
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; color: var(--ink); }
.brand img { display: block; height: 32px; width: auto; }
.brand span { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--grey); padding-left: 14px; border-left: 1px solid var(--line); white-space: nowrap; }
.mainnav { display: flex; align-items: center; gap: 4px; margin-left: auto; flex-wrap: nowrap; }
.mainnav a, .mainnav .linklike { white-space: nowrap; }
.mainnav a, .mainnav .linklike { font-size: 14px; padding: 8px 12px; text-decoration: none; color: var(--ink-2); border-radius: var(--radius); }
.mainnav a:hover, .mainnav .linklike:hover { background: var(--hover); }
.mainnav a.active { font-weight: 600; box-shadow: inset 0 -2px 0 var(--primary); border-radius: 0; }
.nav-sep { width: 1px; height: 22px; background: var(--line); margin: 0 6px; }
.linklike { background: none; border: 0; font: inherit; cursor: pointer; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 0; padding: 10px; cursor: pointer; }
.nav-toggle span { display: block; width: 22px; height: 2px; background: var(--ink); margin: 4px 0; }

.container { width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px 24px 48px; flex: 1; }
.footer { border-top: 1px solid var(--line); background: var(--panel); font-size: 12px; color: var(--grey); }
.footer .container { padding: 16px 24px; }

/* ---------- guest pages ---------- */
.guest-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 16px; background: var(--guest-bg); }
.guest-card { width: 100%; max-width: 420px; background: var(--panel); padding: 40px 36px; border-top: 3px solid var(--primary); box-shadow: 0 10px 40px rgba(0,0,0,.06); }
.guest-logo { text-align: center; margin-bottom: 28px; }
.guest-logo img { height: 46px; width: auto; }
.guest-title { font-size: 22px; text-align: center; margin: 0 0 6px; }
.guest-card .muted.center { margin: 0 0 24px; font-size: 14px; }
.lang-switch { margin-top: 20px; display: flex; gap: 4px; }
.lang-switch a { font-size: 12px; padding: 4px 8px; color: var(--grey); text-decoration: none; letter-spacing: .05em; }
.lang-switch a.active { color: var(--ink); font-weight: 600; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 16px; }
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.form label.check, label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=tel], input[type=url], input[type=number], input[type=date], select {
  font: inherit; font-size: 15px; font-weight: 400; color: var(--ink); background: var(--panel); border: 1px solid var(--input-border); border-radius: var(--radius); padding: 10px 12px; width: 100%; min-height: 42px;
}
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
input:disabled { background: var(--bg); color: var(--muted); }
.input-sm { min-height: 34px !important; padding: 6px 10px !important; font-size: 14px !important; width: auto; }
.hint { font-weight: 400; color: var(--muted); font-size: 12px; }
.err { font-weight: 400; color: var(--danger); font-size: 13px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
fieldset.checks { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; display: flex; flex-wrap: wrap; gap: 10px 22px; margin: 0; }
fieldset.checks legend { font-size: 13px; font-weight: 600; padding: 0 6px; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 44px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 36px; height: 34px; border: 0; background: none; cursor: pointer; opacity: .55; }
.pw-eye::before { content: ""; display: block; width: 20px; height: 20px; margin: auto; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center/contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M2.5 12S6 5.5 12 5.5 21.5 12 21.5 12 18 18.5 12 18.5 2.5 12 2.5 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E") center/contain no-repeat; }
.pw-eye.on { opacity: 1; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; font: inherit; font-size: 14px; font-weight: 500; padding: 9px 16px; min-height: 40px; border: 1px solid var(--input-border); background: var(--panel); color: var(--ink); border-radius: var(--radius); cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s; }
.btn:hover { background: var(--hover); border-color: var(--input-border-hover); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-danger { color: #fff; background: var(--danger); border-color: var(--danger); }
.btn-danger:hover { filter: brightness(1.08); }
.btn-danger-ghost { color: var(--danger); border-color: transparent; background: transparent; }
.btn-danger-ghost:hover { background: var(--danger-soft); border-color: transparent; }
.btn-sm { min-height: 32px; padding: 5px 10px; font-size: 13px; }
.btn-block { width: 100%; min-height: 46px; text-transform: uppercase; letter-spacing: .06em; font-weight: 600; font-size: 13px; }

/* ---------- alerts / tags ---------- */
.alert { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; border-left: 3px solid; }
.alert-success { background: var(--ok-soft); border-color: var(--ok); }
.alert-error { background: var(--danger-soft); border-color: var(--danger); }
.alert-warning { background: var(--warn-soft); border-color: var(--warn-line); }
.tag { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 99px; background: var(--hover); color: var(--ink-2); white-space: nowrap; }
.tag-dark { background: var(--primary); color: var(--on-primary); }
.tag-warn { background: var(--warn-tag); color: var(--warn); }
.tags { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.chip { display: inline-block; font-size: 12px; padding: 2px 8px; margin: 2px 0; background: var(--hover); border-radius: var(--radius); text-decoration: none; }
.act-login, .act-logout { background: var(--act-login); }
.act-file { background: var(--act-file); }
.act-folder, .act-share { background: var(--act-folder); }
.act-user, .act-group, .act-settings { background: var(--act-user); }
.act-mail { background: var(--act-mail); }

/* ---------- page heads / toolbar ---------- */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); flex: 1 1 auto; min-width: 0; white-space: nowrap; }
.crumbs a, .crumbs strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.crumbs a:not(.crumb-home) { display: block; max-width: 220px; }
.crumbs .crumb-home, .crumbs .sep { flex-shrink: 0; }
.crumbs strong { flex-shrink: 0.5; }
.crumbs a { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--ink); text-decoration: underline; }
.crumbs strong { color: var(--ink); font-weight: 600; }
.crumbs .sep { color: var(--line-strong); }
.search { position: relative; width: 320px; max-width: 100%; }
.search .icon { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--grey); }
.search input { padding-left: 38px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar-left { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; min-width: 0; }
.toolbar-right { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; margin-left: auto; }
.toolbar + .h1, h1.h1 { margin-bottom: 18px; }
.toolbar .h1 { margin-bottom: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.filters input, .filters select { width: auto; flex: 1 1 180px; min-height: 40px; }
.inline-label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.inline-label input { flex: 0 1 auto; }
.inline-form { display: flex; gap: 6px; align-items: center; }
.inline-form input[type=text] { width: auto; }

/* ---------- cards ---------- */
.card { background: var(--panel); border: 1px solid var(--line); padding: 24px; border-radius: var(--radius); }
.cards-2 { display: grid; grid-template-columns: 3fr 2fr; gap: 20px; align-items: start; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; font-size: 14px; margin: 0 0 20px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }

/* ---------- folders & files ---------- */
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 20px; margin-bottom: 32px; }
.folder-card { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 16px; row-gap: 4px; align-items: center; padding: 24px 22px; min-height: 104px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); transition: border-color .15s, box-shadow .15s; }
.folder-card:hover { border-color: var(--primary); box-shadow: 0 2px 10px var(--shadow); }
.folder-card .icon { grid-row: span 2; color: var(--ink-2); }
.folder-card .icon-folder { fill: var(--hover); }
.folder-name { font-weight: 600; font-size: 15px; word-break: break-word; line-height: 1.35; }
.folder-meta { font-size: 13px; color: var(--grey); }
.folder-card.up { grid-template-rows: auto; color: var(--muted); }
.folder-card.up .icon { grid-row: auto; }

.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--grey); font-weight: 600; padding: 12px 14px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: var(--row-hover); }
.table .num { text-align: right; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions > * { margin-left: 4px; }
.table .check { width: 36px; }
.row-off td { opacity: .5; }
.file-link { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 500; word-break: break-word; }
.file-link:hover span { text-decoration: underline; }
.icon-pdf { color: #b3261e; }
.icon-img { color: #2f6f8f; }
.icon-video { color: #6b4fa0; }

.empty-state { text-align: center; padding: 56px 16px; color: var(--muted); }
.empty-state h1 { color: var(--ink); font-size: 24px; }
.empty-state .icon { color: var(--line-strong); }

/* ---------- upload ---------- */
.dropzone { display: flex; align-items: center; justify-content: center; gap: 16px; text-align: left; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); padding: 18px; margin-bottom: 20px; background: var(--surface-2); color: var(--muted); transition: all .15s; }
.dropzone p { margin: 0; }
.dropzone strong { color: var(--ink); }
body.dragging .dropzone { border-color: var(--primary); background: var(--fill); color: var(--ink); transform: scale(1.005); }
body.dragging::after { content: ""; position: fixed; inset: 0; background: rgba(29,29,27,.04); pointer-events: none; z-index: 30; }
.upload-panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; margin-bottom: 20px; }
.upload-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.progress { height: 6px; background: var(--fill); border-radius: 99px; overflow: hidden; }
.progress .bar { height: 100%; width: 0; background: var(--primary); transition: width .2s; }
.progress-total { height: 8px; margin-bottom: 12px; }
.upload-list { list-style: none; padding: 0; margin: 0; }
.upload-more { margin: 8px 0 0; }
.upload-errors { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); color: var(--danger); }
.upload-errors .upload-list { margin-top: 4px; color: var(--ink); }
.upload-list li { display: grid; grid-template-columns: 1fr 160px 90px; gap: 12px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.upload-list .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-list .st { text-align: right; color: var(--muted); font-size: 12px; }
.upload-list li.done .bar { background: var(--ok); }
.upload-list li.done .st { color: var(--ok); }
.upload-list li.error .bar { background: var(--danger); }
.upload-list li.error .st { color: var(--danger); }
.upload-foot { margin-top: 12px; text-align: right; }

/* ---------- viewer ---------- */
.viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.viewer-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.viewer-title .h1 { font-size: 20px; margin: 0; }
.viewer-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.viewer { background: #525659; border-radius: var(--radius); overflow: hidden; }
.viewer iframe { display: block; width: 100%; height: calc(100vh - 230px); min-height: 520px; border: 0; background: #525659; }
.viewer-image, .viewer-video { display: flex; justify-content: center; align-items: center; background: #2b2b2a; padding: 16px; min-height: 400px; }
.viewer-image img { max-width: 100%; max-height: calc(100vh - 260px); object-fit: contain; display: block; background: #fff; }
.viewer-video video { max-width: 100%; max-height: calc(100vh - 260px); }
.viewer-audio { background: var(--panel); padding: 40px; text-align: center; border: 1px solid var(--line); }
.viewer-text iframe { background: #fff; }
.viewer-none { background: var(--panel); border: 1px solid var(--line); }

/* ---------- dialogs ---------- */
.dialog { border: 0; padding: 0; border-radius: var(--radius); width: 440px; max-width: calc(100vw - 32px); box-shadow: 0 20px 60px rgba(0,0,0,.2); }
.dialog::backdrop { background: rgba(29,29,27,.45); }
.dialog form { padding: 24px; }
.dialog h2 { margin: 0; }
.dialog-actions { display: flex; gap: 8px; justify-content: flex-end; align-items: center; }

/* ---------- shares ---------- */
.legend { display: flex; gap: 20px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.legend span { display: inline-flex; gap: 6px; align-items: center; }
.save-state { margin-left: auto; font-weight: 600; }
.shares-wrap { max-height: calc(100vh - 260px); overflow: auto; }
.shares-table thead th { position: sticky; top: 0; z-index: 2; }
.shares-table .sticky-col { position: sticky; left: 0; background: var(--panel); z-index: 1; min-width: 320px; }
.shares-table thead .sticky-col { z-index: 3; background: var(--surface-2); }
.shares-table .gcol { text-align: center; width: 90px; min-width: 80px; }
.shares-table th.gcol span { display: inline-block; white-space: normal; line-height: 1.2; }
.shares-table input[type=checkbox] { width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary); }
.shares-table input.inherited, .legend input.inherited { accent-color: #a9aaad; }
.shares-table tr.match td { background: var(--match); }
.tree { display: inline-flex; align-items: center; gap: 6px; padding-left: calc(var(--d) * 22px); }
.tree a { text-decoration: none; }
.tree a:hover { text-decoration: underline; }
.twisty, .twisty-sp { width: 20px; height: 20px; flex-shrink: 0; }
.twisty { border: 0; background: none; cursor: pointer; padding: 0; position: relative; }
.twisty::before { content: ""; position: absolute; inset: 0; margin: auto; width: 7px; height: 7px; border-right: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); transform: rotate(-45deg); transition: transform .15s; }
.twisty[aria-expanded=true]::before { transform: rotate(45deg); }

.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; }
.logs-table td { font-size: 13px; }

/* ---------- folder view: grid / list ---------- */
.page-tools { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.view-toggle { display: inline-flex; padding: 3px; background: var(--panel); border: 1px solid var(--input-border); border-radius: var(--radius); }
.view-toggle button { display: grid; place-items: center; width: 34px; height: 34px; border: 0; background: none; color: var(--muted); border-radius: 3px; cursor: pointer; }
.view-toggle button:hover { color: var(--ink); background: var(--hover); }
.view-toggle button[aria-pressed=true] { background: var(--primary); color: var(--on-primary); }
.folder-grid.is-list { grid-template-columns: 1fr; gap: 0; margin-bottom: 32px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.folder-grid.is-list .folder-card { grid-template-columns: auto 1fr auto; grid-template-rows: auto; column-gap: 18px; padding: 20px 24px; min-height: 0; border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0; }
.folder-grid.is-list .folder-card:last-child { border-bottom: 0; }
.folder-grid.is-list .folder-card:hover { box-shadow: none; background: var(--row-hover); }
.folder-grid.is-list .folder-card .icon { grid-row: auto; width: 26px; height: 26px; }
.folder-grid.is-list .folder-meta { text-align: right; white-space: nowrap; }
@media (max-width: 640px) {
  .page-head { flex-wrap: wrap; }
  .page-tools { width: 100%; }
  .page-tools .search { flex: 1; }
  .folder-grid.is-list .folder-card { grid-template-columns: auto 1fr; }
  .folder-grid.is-list .folder-meta { grid-column: 2; text-align: left; }
}

/* ---------- files: grid (cards with thumbnail) / list (rows) ---------- */
.file-tools { display: flex; align-items: center; gap: 14px; margin: 0 0 12px; min-height: 32px; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 20px; margin-bottom: 32px; }
.file-head { display: none; }
.file-card { position: relative; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; transition: border-color .15s, box-shadow .15s; }
.file-card:hover { border-color: var(--primary); box-shadow: 0 2px 10px var(--shadow); }
.fc-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; background: var(--thumb-bg); border-bottom: 1px solid var(--line); overflow: hidden; }
.fc-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 12px; opacity: 0; transition: opacity .25s; }
.fc-thumb img.loaded { opacity: 1; }
.fc-thumb img.loaded + .fc-icon { visibility: hidden; }
.fc-thumb:hover img { transform: scale(1.02); transition: transform .3s, opacity .25s; }
.fc-icon .icon { width: 44px; height: 44px; }
.fc-name { padding: 16px 18px 4px; font-size: 14px; font-weight: 600; line-height: 1.35; }
.fc-name > .icon { display: none; }
.fc-name span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.fc-meta { display: flex; gap: 8px; padding: 0 18px; font-size: 13px; color: var(--grey); }
.fc-meta .fc-date::before { content: "·"; margin-right: 8px; }
.fc-actions { display: flex; align-items: center; gap: 6px; padding: 14px 18px 18px; margin-top: auto; }
.fc-actions .btn:nth-child(2) { margin-left: auto; }
.fc-check { position: absolute; top: 10px; left: 10px; z-index: 2; display: grid; place-items: center; width: 30px; height: 30px; background: color-mix(in oklab, var(--panel) 92%, transparent); border: 1px solid var(--line); border-radius: var(--radius); cursor: pointer; }

.file-grid.is-list { display: block; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.file-grid.is-list .file-head, .file-grid.is-list .file-card { display: grid; grid-template-columns: minmax(0, 1fr) 110px 160px auto; align-items: center; column-gap: 20px; padding: 0 22px; }
.file-grid.is-list.has-check .file-head, .file-grid.is-list.has-check .file-card { grid-template-columns: 30px minmax(0, 1fr) 110px 160px auto; }
.file-grid.is-list .file-head { padding-top: 13px; padding-bottom: 13px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--grey); }
.file-grid.is-list .file-card { border: 0; border-bottom: 1px solid var(--line-2); border-radius: 0; min-height: 66px; }
.file-grid.is-list .file-card:last-child { border-bottom: 0; }
.file-grid.is-list .file-card:hover { box-shadow: none; background: var(--row-hover); }
.file-grid.is-list .fc-thumb { display: none; }
.file-grid.is-list .fc-check { position: static; width: auto; height: auto; background: none; border: 0; }
.file-grid.is-list .fc-name { display: inline-flex; align-items: center; gap: 12px; padding: 0; font-weight: 500; }
.file-grid.is-list .fc-name > .icon { display: inline; }
.file-grid.is-list .fc-name span { -webkit-line-clamp: 1; }
.file-grid.is-list .fc-meta { display: contents; }
.file-grid.is-list .fc-meta .fc-date::before { content: none; }
.file-grid.is-list .fc-num { text-align: right; font-variant-numeric: tabular-nums; }
.file-grid.is-list .fc-meta .fc-num { color: var(--ink); }
.file-grid.is-list .fc-actions { padding: 12px 0; margin: 0; }
.file-grid.is-list .fc-actions .btn:nth-child(2) { margin-left: 0; }
@media (max-width: 760px) {
  .file-grid.is-list .file-head { display: none; }
  .file-grid.is-list .file-card, .file-grid.is-list.has-check .file-card { grid-template-columns: auto minmax(0, 1fr) auto; column-gap: 12px; padding: 0 14px; }
  .file-grid.is-list:not(.has-check) .file-card { grid-template-columns: minmax(0, 1fr) auto; }
  .file-grid.is-list .fc-meta { display: none; }
  .fc-dl-label { display: none; }
  .file-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .fc-name { padding: 12px 12px 2px; }
  .fc-meta { padding: 0 12px; }
  .fc-meta .fc-date { display: none; }
  .fc-actions { padding: 10px 12px 12px; }
}

/* ---------- lightbox ---------- */
body.lb-open { overflow: hidden; }
.lightbox { position: fixed; inset: 0; z-index: 200; display: flex; flex-direction: column; background: #161615; color: #f4f4f5; animation: lb-in .18s ease-out; }
@keyframes lb-in { from { opacity: 0; } }
.lb-bar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 16px 10px 22px; border-bottom: 1px solid rgba(255,255,255,.08); flex-shrink: 0; }
.lb-title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.lb-title .icon { color: #d4d4d8; }
.lb-name { min-width: 0; display: flex; flex-direction: column; }
.lb-name strong { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-name span { font-size: 12px; color: #a1a1aa; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lb-actions { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.lb-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-width: 40px; height: 40px; padding: 0 10px; border: 0; border-radius: var(--radius); background: transparent; color: #e4e4e7; font: inherit; font-size: 14px; cursor: pointer; text-decoration: none; }
.lb-btn:hover { background: rgba(255,255,255,.1); color: #fff; }
.lb-btn[disabled] { opacity: .3; cursor: default; background: none; }
.lb-download { background: #fff; color: #1d1d1b; font-weight: 500; padding: 0 14px; margin: 0 6px; }
.lb-download:hover { background: #e4e4e7; color: #1d1d1b; }
.lb-count { font-size: 13px; color: #a1a1aa; padding: 0 8px; font-variant-numeric: tabular-nums; }
.lb-sep { width: 1px; height: 22px; background: rgba(255,255,255,.12); margin: 0 6px; }
.lb-body { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.lb-body .viewer-note { margin: 0; padding: 8px 22px; color: #a1a1aa; border-bottom: 1px solid rgba(255,255,255,.06); }
.lb-body .viewer-note a { color: #e4e4e7; }
.lb-body .viewer { flex: 1; min-height: 0; border-radius: 0; background: transparent; display: flex; }
.lb-body .viewer > * { flex: 1; }
.lb-body .viewer iframe { height: 100%; min-height: 0; background: #2b2b2a; }
.lb-body .viewer-image, .lb-body .viewer-video { background: transparent; padding: 20px; min-height: 0; }
.lb-body .viewer-image img, .lb-body .viewer-video video { max-height: 100%; }
.lb-body .viewer-image a { display: flex; align-items: center; justify-content: center; height: 100%; }
.lb-body .viewer-pages { max-height: none; min-height: 0; height: auto; background: transparent; }
.lb-body .viewer-none, .lb-body .viewer-audio { background: transparent; align-items: center; justify-content: center; }
.lb-body .viewer-none .empty-state, .lb-body .viewer-audio { color: #a1a1aa; }
.lb-loading { flex: 1; display: grid; place-items: center; }
.lb-loading::after { content: ""; width: 34px; height: 34px; border: 2px solid rgba(255,255,255,.2); border-top-color: #fff; border-radius: 50%; animation: spin .8s linear infinite; }
.lb-nav { position: absolute; top: 50%; transform: translateY(-50%); z-index: 3; width: 52px; height: 52px; border-radius: 50%; border: 0; background: rgba(255,255,255,.1); color: #fff; display: grid; place-items: center; cursor: pointer; }
.lb-nav:hover { background: rgba(255,255,255,.2); }
.lb-nav.prev { left: 18px; } .lb-nav.next { right: 18px; }
.lb-nav[hidden] { display: none; }
.lightbox:fullscreen { background: #121211; }
@media (max-width: 760px) {
  .lb-bar { padding: 8px 8px 8px 14px; }
  .lb-download span, .lb-sep, .lb-count, [data-lb-fullscreen], .lb-nav { display: none; }
  .lb-body .viewer-image, .lb-body .viewer-video { padding: 8px; }
}

/* ---------- search results: folder path on each file ---------- */
.fc-path { display: flex; align-items: center; gap: 6px; padding: 2px 18px 4px; font-size: 12px; color: var(--muted); text-decoration: none; min-width: 0; }
.fc-path span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fc-path:hover { color: var(--ink); text-decoration: underline; }
.fc-path .icon { flex-shrink: 0; }
.file-grid.is-list.with-path .file-head, .file-grid.is-list.with-path .file-card { grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 100px 150px auto; }
.file-grid.is-list .fc-path { padding: 0; font-size: 13px; }
@media (max-width: 760px) {
  .file-grid.is-list.with-path .file-card { grid-template-columns: minmax(0, 1fr) auto; }
  .file-grid.is-list .fc-path { display: none; }
  .fc-path { padding: 2px 12px 4px; }
}

/* ---------- back button, left of the folder title ---------- */
.back-btn { flex-shrink: 0; align-self: center; padding-left: 10px; }
.back-btn .icon { margin-right: -2px; }
.toolbar-left:has(.back-btn) { align-items: center; }
.title-row { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.title-row h1.h1 { margin: 0; }

/* ---------- search: text excerpt with the matched words ---------- */
.file-card > .fc-thumb { order: 0; } .file-card > .fc-name { order: 1; } .file-card > .fc-path { order: 2; }
.file-card > .fc-snippet { order: 3; } .file-card > .fc-meta { order: 4; } .file-card > .fc-actions { order: 5; }
.fc-snippet { display: block; margin: 8px 18px 0; padding: 8px 10px; font-size: 12.5px; line-height: 1.45; color: var(--ink-2); background: var(--snippet-bg); border-radius: var(--radius); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.fc-snippet mark { background: var(--mark); color: inherit; padding: 0 1px; border-radius: 2px; }
.fc-page { font-weight: 600; color: var(--ink); white-space: nowrap; }
.file-grid.is-list .file-card > * { order: 0; }
.file-grid.is-list .file-card > .fc-snippet { order: 10; grid-column: 1 / -1; margin: -4px 0 14px; -webkit-line-clamp: 2; }
.file-grid.is-list.has-check .file-card > .fc-snippet { grid-column: 2 / -1; }
@media (max-width: 760px) { .fc-snippet { margin: 6px 12px 0; } }

/* ---------- top bar: profile and logout as icons (labels in the phone menu) ---------- */
.mainnav .nav-icon { display: inline-flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 10px; }
.mainnav .nav-icon { gap: 8px; padding: 8px 12px; }
.mainnav a.nav-icon.active { box-shadow: none; background: var(--hover); border-radius: var(--radius); }
.mainnav .nav-icon:hover { background: var(--hover); border-radius: var(--radius); }
@media (max-width: 860px) {
  .mainnav .nav-icon { justify-content: flex-start; }
}

/* ---------- selection bar above the files ---------- */
.file-tools { flex-wrap: wrap; }
.file-tools-actions { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.file-tools-actions[hidden] { display: none; }
.fc-check input { width: 18px; height: 18px; cursor: pointer; accent-color: var(--primary); }

/* ---------- page viewer: thumbnail column + scrolling pages ---------- */
.viewer-pages { display: flex; padding: 0; overflow: hidden; }
.pv-main { flex: 1; min-width: 0; overflow-y: auto; padding: 20px 12px; }
.pv-thumbs { flex: 0 0 150px; overflow-y: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 14px; background: rgba(0,0,0,.22); border-right: 1px solid rgba(255,255,255,.08); }
.viewer-pages.thumbs-hidden .pv-thumbs { display: none; }
.pv-thumb { display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 0; border: 0; background: none; color: #d4d4d8; font: inherit; font-size: 11px; cursor: pointer; }
.pv-thumb-img { display: block; width: 100%; aspect-ratio: var(--ar, 0.707); background: #fff; border-radius: 2px; overflow: hidden; opacity: .55; outline: 3px solid transparent; outline-offset: 1px; transition: opacity .15s, outline-color .15s; }
.pv-thumb-img img { display: block; width: 100%; height: 100%; object-fit: contain; }
.pv-thumb:hover .pv-thumb-img { opacity: .85; }
.pv-thumb.active .pv-thumb-img { opacity: 1; outline-color: #fff; }
.pv-thumb.active .pv-thumb-num { color: #fff; font-weight: 600; }
.pv-toggle { display: inline-grid; place-items: center; width: 32px; height: 30px; margin: -4px 6px -4px -6px; padding: 0; border: 0; border-radius: var(--radius); background: none; color: inherit; cursor: pointer; opacity: .65; }
.pv-toggle:hover { opacity: 1; background: rgba(127,127,127,.18); }
.pv-toggle[aria-pressed=true] { opacity: 1; background: rgba(127,127,127,.22); }
.lb-body .viewer-pages { display: flex; overflow: hidden; }
.lb-body .viewer-pages > .pv-thumbs { flex: 0 0 150px; }
.lb-body .viewer-pages > .pv-main { flex: 1; }
@media (max-width: 760px) { .pv-thumbs { flex-basis: 96px; padding: 10px; } .lb-body .viewer-pages > .pv-thumbs { flex-basis: 96px; } }

/* ---------- top bar: icons on every main item ---------- */
.mainnav a.with-icon { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- upload window ---------- */
.dialog-upload { width: 620px; }
.upload-dialog { padding: 24px; display: flex; flex-direction: column; gap: 14px; }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dialog-head h2 { margin: 0; }
.upload-target { display: flex; align-items: center; gap: 6px; margin: 0; }
.dialog-upload .dropzone { flex-direction: column; text-align: center; gap: 10px; padding: 40px 20px; margin: 0; }
.dialog-upload .dropzone > .icon { color: var(--ink-2); }
.dropzone-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.dialog-upload p.xsmall { margin: 0; }
@media (max-width: 640px) { .dialog-upload .dropzone { display: flex; padding: 28px 14px; } }

/* ---------- rubber-band selection and selected files ---------- */
.marquee { position: absolute; z-index: 60; border: 1px solid var(--primary); background: color-mix(in oklab, var(--primary) 9%, transparent); border-radius: 2px; pointer-events: none; }
body.marquee-on { user-select: none; -webkit-user-select: none; cursor: crosshair; }
.file-card:has(.fc-check input:checked) { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); }
.file-grid.is-list .file-card:has(.fc-check input:checked) { box-shadow: none; background: var(--primary-soft); }

/* ---------- confirm / alert window ---------- */
.dialog-confirm { width: 460px; }
.confirm-body { padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.confirm-body h2 { margin: 0; font-size: 18px; }
.confirm-body p { margin: 0 0 8px; color: var(--ink-2); line-height: 1.5; white-space: pre-line; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #8f1d17; border-color: #8f1d17; }

/* ---------- floating upload status + summary (uploads.js) ---------- */
#fab-stack { position: fixed; right: 22px; bottom: 22px; z-index: 150; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.up-fab { display: inline-flex; align-items: center; gap: 10px; padding: 8px 16px 8px 8px; border: 0; border-radius: 99px; background: var(--primary); color: var(--on-primary); font: inherit; font-size: 14px; font-weight: 500; box-shadow: 0 8px 24px rgba(0,0,0,.22); cursor: pointer; }
.up-fab:hover { background: var(--primary-hover); }
.up-ring { width: 32px; height: 32px; transform: rotate(-90deg); }
.up-ring circle { fill: none; stroke: color-mix(in oklab, currentColor 25%, transparent); stroke-width: 3.2; }
.up-ring .up-ring-bar { stroke: currentColor; stroke-dasharray: 97.4; stroke-dashoffset: 97.4; stroke-linecap: round; transition: stroke-dashoffset .3s; }
.up-fab.is-done { background: var(--ok); }
.up-fab.has-errors { background: var(--danger); }
.up-panel { position: fixed; right: 22px; bottom: 82px; z-index: 150; width: 460px; max-width: calc(100vw - 32px); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 18px 50px rgba(0,0,0,.18); padding: 16px 18px 14px; }
.up-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.up-title { font-size: 15px; }
.up-sum { margin-left: auto; font-size: 12px; color: var(--muted); white-space: nowrap; }
.up-x { display: grid; place-items: center; width: 28px; height: 28px; border: 0; border-radius: var(--radius); background: none; color: var(--muted); cursor: pointer; }
.up-x:hover { background: var(--hover); color: var(--ink); }
.up-panel .upload-list li { grid-template-columns: 1fr 90px 64px; }
.up-panel .up-more { margin: 8px 0 0; }
.up-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.up-foot [hidden] { display: none; }
.up-fab[hidden], .up-panel[hidden] { display: none; }
body.lb-open #fab-stack, body.lb-open .up-panel { display: none; }
.up-panel { bottom: calc(34px + var(--fab-stack-h, 48px)); }
.dl-panel .upload-list li { grid-template-columns: 1fr 90px 54px 22px; }
.jobs-list li { grid-template-columns: 1fr 64px 104px 22px; }
.jobs-list a.name { color: inherit; text-decoration: none; }
.jobs-list a.name:hover { text-decoration: underline; }
.dl-x { width: 22px; height: 22px; border: 0; border-radius: 50%; background: none; color: var(--muted); font-size: 18px; line-height: 1; cursor: pointer; }
.dl-x:hover { background: var(--hover); color: var(--ink); }
@media (max-width: 640px) { #fab-stack { right: 12px; bottom: 12px; } .up-panel { right: 12px; } }

/* ---------- right-click menu ---------- */
.ctx-menu { position: fixed; z-index: 300; min-width: 230px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,.18); }
.ctx-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; border-radius: 6px; background: none; color: var(--ink); font: inherit; font-size: 14px; text-align: left; cursor: pointer; }
.ctx-menu button svg { color: var(--muted); flex-shrink: 0; }
.ctx-menu button:hover, .ctx-menu button:focus-visible { background: var(--hover); outline: none; }
.ctx-menu button.danger, .ctx-menu button.danger svg { color: var(--danger); }
.ctx-menu button.danger:hover { background: var(--danger-soft); }
.ctx-sep { height: 1px; margin: 5px 4px; background: var(--line); }
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 400; padding: 10px 16px; border-radius: 99px; background: var(--ink); color: var(--panel); font-size: 14px; box-shadow: 0 8px 24px rgba(0,0,0,.2); transition: opacity .3s; }
.toast.out { opacity: 0; }

/* ---------- inline edit ---------- */
.inline-edit-view { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; }
.inline-edit-view strong { font-weight: 600; }
.inline-edit-view[hidden], .inline-edit-form[hidden] { display: none; }
.inline-edit-form input { width: 220px; }

/* ---------- clickable table rows ---------- */
.table tr.row-link { cursor: pointer; }
.table tbody tr.row-link:hover td { background: var(--hover); }
.table tr.row-link a { color: inherit; text-decoration: none; font-weight: 500; }

/* ---------- move folder window ---------- */
.dialog-move { width: 560px; }
.move-tree { max-height: 52vh; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--radius); padding: 6px; }
.move-row { display: flex; align-items: center; gap: 6px; padding: 6px 8px 6px calc(8px + var(--d) * 20px); border-radius: 6px; cursor: pointer; font-size: 14px; }
.move-row[hidden] { display: none; }
.move-row:hover { background: var(--hover); }
.move-row.selected { background: var(--primary); color: var(--on-primary); }
.move-row.selected .twisty::before { border-color: var(--on-primary); }
.move-row.is-current { color: var(--muted); cursor: default; }
.move-row.match span { font-weight: 600; }
.move-row svg { flex-shrink: 0; }
.move-note { margin: 0; color: var(--warn); }

/* ---------- drag a folder onto another ---------- */
.folder-card[draggable="true"] { -webkit-user-drag: element; }
.folder-card.dragging, .file-card.dragging { opacity: .45; }
.move-row.is-disabled { color: var(--muted); cursor: default; opacity: .6; }
body.folder-dragging [data-drop-folder]:not(.dragging) { transition: outline-color .1s, background .1s; }
.drop-over { outline: 2px dashed var(--primary) !important; outline-offset: 3px; background: var(--primary-soft) !important; }
.crumbs a.drop-over { border-radius: 4px; }

/* ---------- logo and Settings → Appearance ---------- */
.site-logo { width: auto; max-width: 220px; object-fit: contain; display: block; }
.appearance { margin-top: 20px; }
.look-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.look-logo { display: flex; flex-direction: column; gap: 8px; }
.look-label, .look-colors legend, .look-theme legend { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.logo-preview { display: grid; place-items: center; height: 96px; border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.logo-preview.light { background: #ffffff; }
.logo-preview.dark { background: #1c1c1b; }
.logo-preview img { max-height: 56px; max-width: 100%; object-fit: contain; }
.logo-preview img.logo-default-dark { filter: invert(1) hue-rotate(180deg) brightness(1.1); }
.look-colors, .look-theme { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px 16px; margin: 0; display: flex; flex-direction: column; gap: 12px; }
.swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; font-size: 12px; color: var(--muted); }
.swatch em { font-style: normal; }
.swatch input[type=radio] { position: absolute; opacity: 0; pointer-events: none; }
.swatch span { width: 34px; height: 34px; border-radius: 50%; background: var(--sw); box-shadow: 0 0 0 1px var(--line-strong); }
.swatch input:checked + span, .swatch.custom input[type=radio]:checked ~ input[type=color] { box-shadow: 0 0 0 2px var(--panel), 0 0 0 4px var(--ink); }
.swatch.custom input[type=color] { width: 34px; height: 34px; padding: 0; border: 0; border-radius: 50%; background: none; cursor: pointer; box-shadow: 0 0 0 1px var(--line-strong); }
.swatch.custom input[type=color]::-webkit-color-swatch-wrapper { padding: 0; }
.swatch.custom input[type=color]::-webkit-color-swatch { border: 0; border-radius: 50%; }
.look-preview { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 14px; background: var(--surface-2); border-radius: var(--radius); }
.look-nav { display: inline-flex; align-items: center; gap: 8px; padding: 6px 4px; font-weight: 600; box-shadow: inset 0 -2px 0 var(--primary); }
@media (max-width: 640px) { .look-grid { grid-template-columns: 1fr; } }

/* ---------- undo in messages ---------- */
.alert-flex { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.alert-flex .btn { background: var(--panel); }

/* ---------- responsive ---------- */
@media (max-width: 960px) {
  .cards-2 { grid-template-columns: 1fr; }
}
/* The menu never wraps: when it does not fit (narrow window, long labels), app.js first hides the
   profile/logout labels (.nav-compact), then the "Area riservata" caption (.nav-tight), then switches
   to the phone menu (.nav-collapse). */
.topbar.nav-compact .mainnav .nav-label { display: none; }
.topbar.nav-tight .brand span { display: none; }
.topbar.nav-collapse .nav-toggle { display: block; }
.topbar.nav-collapse .mainnav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--panel); border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: 8px 16px 16px; }
body.nav-open .topbar.nav-collapse .mainnav { display: flex; }
.topbar.nav-collapse .mainnav a.active { box-shadow: inset 3px 0 0 var(--primary); }
.topbar.nav-collapse .nav-sep { width: auto; height: 1px; margin: 6px 0; }
.topbar.nav-collapse .mainnav .linklike { text-align: left; width: 100%; }
.topbar.nav-collapse .mainnav .nav-icon { justify-content: flex-start; }
.topbar.nav-collapse .mainnav .nav-label { display: inline; }
.topbar.nav-collapse .topbar-inner { position: relative; }
@media (max-width: 860px) {
  .nav-toggle { display: block; }
  .mainnav { display: none; position: absolute; top: 100%; left: 0; right: 0; background: var(--panel); border-bottom: 1px solid var(--line); flex-direction: column; align-items: stretch; padding: 8px 16px 16px; }
  body.nav-open .mainnav { display: flex; }
  .mainnav a.active { box-shadow: inset 3px 0 0 var(--primary); }
  .nav-sep { width: auto; height: 1px; margin: 6px 0; }
  .mainnav .linklike { text-align: left; width: 100%; }
  .topbar-inner { position: relative; padding: 0 16px; }
}
@media (max-width: 640px) {
  .container { padding: 20px 16px 40px; }
  .brand span { display: none; }
  .hide-sm { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .search { width: 100%; }
  .guest-card { padding: 32px 22px; }
  .folder-grid { grid-template-columns: 1fr; }
  .upload-list li { grid-template-columns: 1fr 70px; }
  .upload-list li .progress { grid-column: span 2; order: 3; }
  .viewer iframe { height: 70vh; min-height: 360px; }
  .dropzone { display: none; }
  .table th, .table td { padding: 10px 10px; }
}

/* ---------- lightweight page previews ---------- */
.viewer-note { display: flex; align-items: center; gap: 6px 10px; flex-wrap: wrap; margin: -6px 0 12px; }
.viewer-note .goto { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.viewer-note .goto input { width: 80px; }
.viewer-pages { background: #525659; max-height: calc(100vh - 220px); min-height: 480px; height: calc(100vh - 220px); }
.pages { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.page { position: relative; margin: 0; width: 100%; max-width: 900px; aspect-ratio: var(--ar, 0.707); background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.35); }
.page img { display: block; width: 100%; height: auto; }
.page.loaded { aspect-ratio: auto; }
.page:not(.loaded)::after { content: ""; position: absolute; inset: 0; margin: auto; width: 28px; height: 28px; border: 2px solid #ddd; border-top-color: var(--ink); border-radius: 50%; animation: spin 0.8s linear infinite; }
.page.failed::after { display: none; }
.page-num { position: absolute; right: 8px; bottom: 8px; font-size: 11px; background: rgba(29,29,27,.7); color: #fff; padding: 2px 8px; border-radius: 99px; z-index: 1; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 640px) { .viewer-pages { padding: 10px 6px; max-height: 75vh; } }

/* ---------- user form: role admin ---------- */
fieldset.checks .admin-note { display: none; width: 100%; margin: 0; }
fieldset.checks.is-admin .admin-note { display: block; }
fieldset.checks.is-admin label.check { opacity: .45; }
/* Settings → Updates */
.nav-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); margin-left: 2px; align-self: flex-start; }
.update-log { max-height: 280px; overflow: auto; margin: 8px 0; padding: 10px 12px; border-radius: var(--radius); background: var(--hover); font-size: 12px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
#updates .alert p { margin: 0 0 8px; }
#updates .alert ul { margin: 0 0 12px; padding-left: 20px; }

/* Licenses (distributor only) */
.license-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; letter-spacing: .03em; white-space: nowrap; }
.license-revoked td:not(.actions) { opacity: .55; }
.cmd { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cmd code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 6px 10px; overflow-x: auto; max-width: 100%; }
.license-new td { background: var(--match); }
.transfer-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; align-items: start; }
.transfer-grid > * { min-width: 0; }
.transfer-grid h3 { font-size: 15px; margin: 20px 0 6px; }
@media (max-width: 900px) { .transfer-grid { grid-template-columns: 1fr; } }
.field-label { font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: -10px; }
.pick-folder { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.pick-folder strong { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.license-expiry { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 6px; }
.footer-inner { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.powered-by { display: inline-flex; align-items: center; gap: 6px; color: var(--grey); text-decoration: none; font-size: 12px; white-space: nowrap; }
.powered-by img { height: 16px; width: auto; display: block; }
.powered-by:hover { color: var(--ink); }
.guest-powered { text-align: center; margin-top: 16px; }
[data-smtp-fields][hidden], [data-smtp-test][hidden] { display: none !important; }
.danger-zone { border-color: var(--danger); }
