: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 { --gutter: 24px; width: 100%; max-width: 1280px; margin: 0 auto; padding: 28px var(--gutter) 48px; flex: 1; }
.footer { border-top: 1px solid var(--line); background: var(--panel); font-size: 12px; color: var(--grey); }
.footer .container { padding: 16px 24px; max-width: none; }   /* «Powered by» always at the right edge, on wide screens too */

/* ---------- 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-notice { width: 100%; max-width: 420px; margin-top: 16px; padding: 16px 20px; background: var(--panel); border-top: 3px solid var(--primary); box-shadow: 0 10px 40px rgba(0,0,0,.06); text-align: center; font-size: 15px; font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.guest-notice a { font-weight: 700; color: inherit; }
/* docs.urka.cloud/accedi: «Non ricordi l'indirizzo?» opens the email form */
.area-remind { margin-top: 12px; }
.area-remind summary { cursor: pointer; text-decoration: underline; list-style: none; }
.area-remind summary::-webkit-details-marker { display: none; }
.area-remind[open] summary { margin-bottom: 8px; }
.guest-logo { text-align: center; margin-bottom: 28px; }
.guest-logo img { height: 46px; width: auto; margin: 0 auto; }
.guest-title { font-size: 22px; text-align: center; margin: 0 0 6px; }
.login-or { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--grey); font-size: 13px; }
.login-or::before, .login-or::after { content: ""; flex: 1; border-top: 1px solid var(--input-border); }
.btn-google { gap: 10px; text-transform: none; letter-spacing: 0; font-size: 14px; }
.btn-google + .btn-google { margin-top: 10px; }
.google-guide, .microsoft-guide { margin-bottom: 16px; font-size: 14px; }
:is(.google-guide, .microsoft-guide) summary { cursor: pointer; font-weight: 600; }
:is(.google-guide, .microsoft-guide) :is(ol, ul) { padding-left: 22px; }
:is(.google-guide, .microsoft-guide) li { margin-bottom: 8px; }
.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, textarea {
  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;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea: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; }
/* PIN of the activation email: five digits, spaced like the email shows them */
.pin-input { font-size: 24px; letter-spacing: .5em; text-align: center; font-variant-numeric: tabular-nums; padding-left: .5em; }
.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; }
.pw-gen { align-self: flex-start; width: max-content; margin-top: 6px; }

/* ---------- 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[hidden] { display: none; }   /* a hidden button stays hidden (e.g. the actions of the selection bar that do not apply) */
.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); }
.tag-ok { background: var(--ok-soft); color: var(--ink-2); }
.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[hidden], .file-grid[hidden], .file-grid.is-list[hidden] { display: none; }   /* .is-list comes later and would show the empty table head */
.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: repeating-conic-gradient(#bdbdbd 0 25%, #8e8e8e 0 50%) 0 0 / 24px 24px; }   /* transparent areas: grey squares, so that white and black details both show */
.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; }

/* ---------- share dialog: groups as tags ---------- */
.dialog-share { width: 520px; overflow: visible; }
.share-body { padding: 24px; display: grid; gap: 12px; position: relative; }
.share-body p { margin: 0; }
.tag-input { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; border: 1px solid var(--input-border); border-radius: var(--radius); padding: 6px; background: var(--panel); cursor: text; }
.tag-input:focus-within { outline: 2px solid var(--primary); outline-offset: 1px; }
.tag-input input[type=text] { border: 0; outline: 0; flex: 1 1 160px; min-width: 120px; min-height: 30px; padding: 4px 6px; width: auto; background: transparent; }
.share-tags { display: contents; }
.share-tag { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 500; padding: 4px 4px 4px 10px; border-radius: 99px; background: var(--primary); color: var(--on-primary); white-space: nowrap; }
.share-tag button { display: grid; place-items: center; width: 20px; height: 20px; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; padding: 0; opacity: .75; }
.share-tag button:hover { opacity: 1; background: rgba(255,255,255,.18); }
.share-tag.inherited { background: var(--hover); color: var(--ink-2); padding-right: 10px; font-weight: 400; }
.share-tag.inherited small { color: var(--muted); }
[data-share-inherited] .share-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.share-sub { font-weight: 600; color: var(--ink-2); margin-bottom: 6px !important; }
/* The list of groups opens over the dialog: showing or hiding it never moves the tags */
.tag-combo { position: relative; }
.share-options { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5; list-style: none; margin: 0; padding: 4px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); max-height: 220px; overflow-y: auto; box-shadow: 0 8px 24px rgba(0,0,0,.08); }
.share-options li { padding: 8px 10px; border-radius: 3px; cursor: pointer; font-size: 14px; }
.share-options li.active, .share-options li:hover { background: var(--hover); }
.share-options li.empty { color: var(--muted); cursor: default; background: none; }
.share-options mark { background: none; font-weight: 700; color: inherit; }
.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; }
.folder-date { display: none; }
.folder-grid.is-list .folder-card { grid-template-columns: auto 1fr auto 150px; }
.folder-grid.is-list .folder-date { display: block; font-size: 13px; color: var(--grey); text-align: right; white-space: nowrap; }
.file-grid:not(.is-list) .fc-date { display: none; }   /* the date only in the list view */
@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; }
  .folder-grid.is-list .folder-date { display: none; }
}

/* ---------- 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(var(--card-w, 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-info { position: relative; }
.lb-info > summary { list-style: none; }
.lb-info > summary::-webkit-details-marker { display: none; }
.lb-info[open] > summary { background: rgba(255,255,255,.12); }
.lb-info-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 5; display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; width: max-content; max-width: min(420px, 90vw); margin: 0; padding: 14px 16px; background: #27272a; border: 1px solid rgba(255,255,255,.12); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.4); font-size: 13px; color: #d4d4d8; }
.lb-info-panel dt { color: #a1a1aa; }
.lb-info-panel dd { margin: 0; word-break: break-word; }
.lb-info-panel dd span { color: #a1a1aa; }
.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%; }
.viewer-image .viewer-pic { display: flex; justify-content: center; }
.lb-body .viewer-image .viewer-pic { 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.with-path.has-check .file-head, .file-grid.is-list.with-path.has-check .file-card { grid-template-columns: 30px 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.with-path.has-check .file-card { grid-template-columns: auto 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; width: 40px; padding: 0; justify-content: center; }
.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; }
/* With something selected the bar is tinted and stays in sight while scrolling: its buttons act on the selection, not on the folder */
.file-tools:has(.file-tools-actions:not([hidden])) { position: sticky; top: calc(var(--page-top-h, 0px) + 8px); z-index: 20; padding: 6px 10px; border-radius: 8px; background: var(--primary-soft); box-shadow: 0 0 0 1px color-mix(in oklab, var(--primary) 18%, transparent), 0 6px 18px var(--shadow); }
.file-tools-actions .sel-sep { width: 1px; align-self: stretch; margin: 4px 2px; background: color-mix(in oklab, var(--primary) 22%, transparent); }
.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); }
/* folder pages and search: a click selects, a double click opens (no text selected by the double click) */
[data-click-select] .folder-card, [data-click-select] .file-card { user-select: none; -webkit-user-select: none; cursor: default; }
[data-click-select] .fc-thumb, [data-click-select] .fc-name { cursor: default; }
.folder-card.is-selected, .file-card.is-selected, .folder-card.is-selected:hover, .file-card.is-selected:hover { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary); background: var(--primary-soft); }
.folder-grid.is-list .folder-card.is-selected, .file-grid.is-list .file-card.is-selected { box-shadow: inset 3px 0 0 var(--primary); background: var(--primary-soft); }
.file-card.is-selected .fc-thumb { background-color: color-mix(in oklab, var(--primary) 8%, var(--thumb-bg, var(--hover))); }

/* ---------- 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-panel .up-eta { margin: -4px 0 10px; font-variant-numeric: tabular-nums; }
.up-panel .up-eta[hidden] { display: none; }
.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); }
/* «⋯» menu of the folder next to its name: the same look as the right-click menu, opened under its button */
.menu-wrap { position: relative; align-self: center; }
.menu-panel { position: absolute; top: calc(100% + 4px); left: 0; }
.menu-panel[hidden] { display: none; }
.menu-panel a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 6px; color: var(--ink); font-size: 14px; text-decoration: none; }
.menu-panel a svg { color: var(--muted); flex-shrink: 0; }
.menu-panel a:hover, .menu-panel a:focus-visible { background: var(--hover); outline: none; }
.menu-panel form { margin: 0; }
.btn-icon { padding-left: 6px; padding-right: 6px; }
.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.favicon img { width: 48px; height: 48px; }
.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.is-admin { display: none; }   /* groups count only for guests and members */
.pw-field { display: flex; flex-direction: column; gap: 8px; }
.role-field { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.role-btn { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; min-height: 42px; padding: 10px 12px; font: inherit; font-size: 15px; font-weight: 400; color: var(--ink); text-align: left; background: var(--panel); border: 1px solid var(--input-border); border-radius: var(--radius); cursor: pointer; }
.role-btn .icon { color: var(--muted); flex: none; }
.dialog-roles { width: 720px; }
.dialog-roles .dialog-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.role-table td { vertical-align: top; }
.role-table tbody tr { cursor: pointer; }
.role-table tbody tr:hover { background: var(--hover); }
.role-table tbody tr.is-current { background: var(--hover); box-shadow: inset 3px 0 0 var(--primary); }
.role-table td:first-child { width: 36px; }
.role-table input[type=radio] { width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--primary); cursor: pointer; }
.role-table label, .form .role-table label { display: block; cursor: pointer; font-size: 14px; color: var(--ink); }
.role-table .role-name, .form .role-table .role-name { font-weight: 600; white-space: nowrap; }
.role-table .role-desc, .form .role-table .role-desc { font-weight: 400; color: var(--muted); font-size: 13px; line-height: 1.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-busy { display: flex; align-items: flex-start; gap: 10px; }
.update-spinner { flex: none; width: 16px; height: 16px; margin-top: 2px; border: 2px solid var(--warn-line); border-top-color: var(--ink); border-radius: 50%; animation: spin .8s linear infinite; }
.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%; }
.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; }
.footer-inner { display: flex; justify-content: flex-end; 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); }

/* ---------- admin: storage ---------- */
.stat-tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { display: flex; flex-direction: column; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; min-width: 0; }
.stat-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--grey); font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 600; line-height: 1.2; font-variant-numeric: tabular-nums; }
.storage-cards { grid-template-columns: 1fr 1fr; margin-bottom: 20px; }
.storage-section { margin-bottom: 20px; }
.meter { display: flex; height: 12px; background: var(--fill); border-radius: 99px; overflow: hidden; margin-bottom: 10px; }
.meter-stack .seg { height: 100%; min-width: 2px; }
.meter-stack .seg + .seg { border-left: 2px solid var(--panel); }
.seg-0 { background: var(--primary); }
.seg-1 { background: color-mix(in oklab, var(--primary) 70%, var(--panel)); }
.seg-2 { background: color-mix(in oklab, var(--primary) 50%, var(--panel)); }
.seg-3 { background: color-mix(in oklab, var(--primary) 34%, var(--panel)); }
.seg-4 { background: color-mix(in oklab, var(--primary) 22%, var(--panel)); }
.seg-5 { background: var(--line-strong); }
.usage-legend { list-style: none; margin: 0 0 8px; padding: 0; font-size: 14px; }
.usage-legend li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line-2); }
.usage-legend li:last-child { border-bottom: 0; }
.usage-legend .dot { width: 10px; height: 10px; border-radius: 2px; }
.hbars { list-style: none; margin: 0; padding: 0; }
.hbars li { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 7px 0; font-size: 14px; }
.hbar { height: 8px; background: var(--fill); border-radius: 99px; overflow: hidden; }
.hbar > span { display: block; height: 100%; background: var(--primary); border-radius: 99px; min-width: 2px; }
.month-chart { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; align-items: end; margin-bottom: 8px; }
.month { display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0; text-align: center; }
.month-value { color: var(--muted); white-space: nowrap; min-height: 16px; }
.month-bar { display: flex; align-items: flex-end; width: 100%; max-width: 44px; height: 140px; background: var(--fill); border-radius: 3px 3px 0 0; }
.month-bar > span { display: block; width: 100%; background: var(--primary); border-radius: 3px 3px 0 0; min-height: 0; }
.month-label { white-space: nowrap; text-transform: capitalize; }
.month-n { font-weight: 600; font-variant-numeric: tabular-nums; }
.storage-cards > section > h2 { margin-top: 4px; }
@media (max-width: 900px) {
  .stat-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .storage-cards { grid-template-columns: 1fr; }
}
@media (max-width: 640px) {
  .month-chart { gap: 3px; }
  .month-value { display: none; }
  .month-label { font-size: 10px; }
  .hbars li { grid-template-columns: 90px minmax(0, 1fr); }
  .hbars li > :last-child { grid-column: 2; }
}

/* ---------- administrators: menu in a side bar (open with labels, or closed to icons only);
   the round handle on its edge opens and closes it (on phones it stays at the screen edge) ---------- */
body.has-sidebar .topbar-inner { max-width: none; }
.shell { display: flex; flex: 1; min-width: 0; }
.shell-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sidebar-wrap { flex: 0 0 232px; width: 232px; position: sticky; top: 68px; align-self: flex-start; height: calc(100vh - 68px); z-index: 15; transition: flex-basis .18s, width .18s; }
.sidebar { height: 100%; overflow-y: auto; overflow-x: hidden; background: var(--panel); border-right: 1px solid var(--line); }
.sidebar-handle { position: absolute; top: 50%; margin-top: -13px; right: -13px; width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--panel); color: var(--ink-2); cursor: pointer; box-shadow: 0 1px 4px var(--shadow); }
.sidebar-handle:hover { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.sidebar-handle .icon { transition: transform .18s; }
.sidenav { display: flex; flex-direction: column; gap: 2px; padding: 14px 10px 24px; }
.sidenav a { position: relative; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: var(--radius); color: var(--ink-2); text-decoration: none; font-size: 14px; white-space: nowrap; }
.sidenav a:hover { background: var(--hover); }
.sidenav a.active { background: var(--primary-soft); color: var(--ink); font-weight: 600; box-shadow: inset 3px 0 0 var(--primary); }
.sidenav .nav-dot { align-self: center; margin-left: auto; }
.sidenav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--grey); font-weight: 600; padding: 18px 12px 6px; white-space: nowrap; }
.sidebar-backdrop { display: none; }
@media (min-width: 861px) {
  html.sidebar-closed .sidebar-wrap { flex-basis: 64px; width: 64px; }
  html.sidebar-closed .sidebar-handle .icon { transform: rotate(180deg); }
  html.sidebar-closed .sidenav-label { display: none; }
  html.sidebar-closed .sidenav a { justify-content: center; padding: 10px; }
  html.sidebar-closed .sidenav .nav-dot { position: absolute; top: 6px; right: 8px; }
  html.sidebar-closed .sidenav-group { font-size: 0; padding: 0; height: 1px; margin: 12px 8px; background: var(--line); }
}
@media (max-width: 860px) {
  /* phone and tablet: the side bar slides in over the page, the handle stays visible at the screen edge */
  .sidebar-wrap { position: fixed; top: 0; left: 0; bottom: 0; height: 100vh; height: 100dvh; width: 270px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .sidebar { box-shadow: 0 0 30px rgba(0,0,0,.15); }
  body:not(.sidebar-open) .sidebar { box-shadow: none; }
  .sidebar-handle { top: 50%; right: -22px; width: 22px; height: 52px; margin-top: -26px; border-radius: 0 12px 12px 0; border-left: 0; }
  body:not(.sidebar-open) .sidebar-handle .icon { transform: rotate(180deg); }
  body.sidebar-open .sidebar-wrap { transform: none; }
  body.sidebar-open .sidebar-handle { margin-top: -13px; right: -13px; width: 26px; height: 26px; border-radius: 50%; border-left: 1px solid var(--line-strong); }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; z-index: 39; background: rgba(0,0,0,.35); }
  body.has-sidebar .mainnav.mainnav-account { display: flex; position: static; flex-direction: row; padding: 0; border: 0; background: none; }
  body.has-sidebar .mainnav-account .nav-label, body.has-sidebar .mainnav-account .nav-sep { display: none; }
}

/* ---------- Media: all readable files, grouped by upload month ---------- */
.media-types { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }
.media-types a { display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); color: var(--ink-2); font-size: 14px; text-decoration: none; }
.media-types a:hover { border-color: var(--line-strong); }
.media-types a.active { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.media-count { font-size: 12px; color: var(--grey); font-variant-numeric: tabular-nums; }
.media-types a.active .media-count { color: inherit; opacity: .7; }
.media-month { margin-bottom: 28px; }
.media-month-title { margin: 0 0 12px; font-size: 16px; font-weight: 400; color: var(--muted); }
.media-month-title strong { color: var(--ink); font-weight: 600; text-transform: capitalize; }
.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(var(--media-w, 170px), 1fr)); gap: 6px; }
.media-tile.file-card { border: 0; border-radius: 4px; background: var(--thumb-bg); box-shadow: none; outline: 3px solid transparent; outline-offset: -3px; transition: outline-color .12s; }
.media-tile.file-card:hover { box-shadow: none; }
.media-tile:has(.fc-check input:checked) { outline-color: var(--primary); }
.media-tile.file-card.is-selected, .media-tile.file-card.is-selected:hover { border: 0; box-shadow: none; background: var(--thumb-bg); }
/* selected (click): a frame and a tick drawn over the thumbnail (an outline of the tile would stay under it) */
.media-tile.is-selected::after { content: ""; position: absolute; inset: 0; z-index: 3; border: 3px solid var(--primary); border-radius: inherit; background: color-mix(in oklab, var(--primary) 16%, transparent); pointer-events: none; }
.media-tile.is-selected::before { content: ""; position: absolute; top: 8px; right: 8px; z-index: 4; width: 24px; height: 24px; border-radius: 50%; pointer-events: none;
  background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 12.5 4 4 8-9'/%3E%3C/svg%3E") center / 16px no-repeat; box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
.mt-thumb { position: relative; display: grid; place-items: center; aspect-ratio: 1; overflow: hidden; color: var(--grey); text-decoration: none; }
.mt-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s, transform .3s; }
.mt-thumb.mt-doc img { object-fit: contain; padding: 10px; background: #fff; }
.mt-thumb img.loaded { opacity: 1; }
.mt-thumb img.loaded ~ .mt-icon, .mt-thumb img.loaded ~ .mt-name { visibility: hidden; }
.mt-thumb:hover img.loaded { transform: scale(1.03); }
.mt-icon { display: grid; justify-items: center; gap: 4px; margin-bottom: 22px; }
.mt-ext { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.mt-name { position: absolute; left: 0; right: 0; bottom: 0; padding: 8px 10px; font-size: 12px; line-height: 1.3; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: center; }
.mt-play { position: absolute; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: rgba(0, 0, 0, .55); color: #fff; }
.media-tile .fc-check { left: auto; right: 8px; top: 8px; opacity: 0; transition: opacity .12s; }
.media-tile:hover .fc-check, .media-tile .fc-check:focus-within, .media-tile:has(.fc-check input:checked) .fc-check, .media-list:has(.fc-check input:checked) .fc-check { opacity: 1; }
.media-list.is-real { --row-h: calc(var(--media-w, 170px) * 1.18); }
.media-list.is-real .media-grid { display: flex; flex-wrap: wrap; }
.media-list.is-real .media-grid::after { content: ""; flex-grow: 999999; }   /* the last row keeps its height */
/* --r: width / height of the photo (media.js, once its thumbnail is known); widths grow in proportion, so a row keeps one height */
.media-list.is-real .media-tile { --r: 1.333; flex: var(--r) 1 calc(var(--r) * var(--row-h)); min-width: 0; }
.media-list.is-real .mt-thumb { aspect-ratio: var(--r); }
.media-list.is-real .mt-thumb.mt-doc img { padding: 0; }
.media-more { display: grid; place-items: center; min-height: 80px; }
@media (hover: none) { .media-tile .fc-check { opacity: 1; } }
@media (max-width: 600px) { .media-grid { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 4px; } .media-list.is-real { --row-h: 110px; } }
.media-more .lb-loading::after { border-color: var(--line); border-top-color: var(--ink); }

/* ---------- user manual (Tools → Manual): a page of its own, index on the left ---------- */
.manual-page { margin: 0; background: var(--bg); color: var(--ink); }
.manual-side { position: fixed; inset: 0 auto 0 0; width: 280px; overflow-y: auto; padding: 26px 18px 24px; background: var(--panel); border-right: 1px solid var(--line); }
.manual-brand strong { display: block; font-size: 22px; letter-spacing: -.01em; }
.manual-brand span { display: block; margin-top: 2px; font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--grey); }
.manual-back { display: inline-flex; align-items: center; gap: 4px; margin: 14px 0 18px; font-size: 13px; color: var(--muted); text-decoration: none; }
.manual-back:hover { color: var(--ink); }
.manual-nav { font-size: 14px; }
.manual-nav ol, .manual-nav ul { list-style: none; margin: 0; padding: 0; }
.manual-nav ul { margin: 2px 0 6px 14px; padding-left: 0; font-size: 13px; }
.manual-nav a { display: block; padding: 5px 8px; border-radius: var(--radius); color: var(--ink-2); text-decoration: none; }
.manual-nav ul a { color: var(--muted); padding: 4px 8px; }
.manual-nav a:hover { background: var(--hover); color: var(--ink); }
.manual-nav a.active { background: color-mix(in oklab, var(--primary) 12%, transparent); color: var(--ink); font-weight: 600; }
.manual-updated { margin: 18px 0 0; padding-top: 14px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.5; color: var(--grey); }
.manual-menu { display: none; }
.manual { max-width: 1120px; margin: 0 0 0 280px; padding: 40px 56px 80px; }
.manual-head h1 { margin: 0; font-size: 34px; letter-spacing: -.02em; }
.manual-lead { margin: 10px 0 0; max-width: 640px; font-size: 16px; line-height: 1.55; color: var(--muted); }
.manual section { margin: 46px 0 0; scroll-margin-top: 20px; }
.manual h2 { margin: 0 0 6px; font-size: 26px; letter-spacing: -.01em; }
.manual h2 span { color: var(--grey); font-weight: 500; }
.manual h3 { margin: 30px 0 8px; font-size: 18px; scroll-margin-top: 20px; }
.manual-sub { margin: 0 0 14px; color: var(--muted); }
.manual p, .manual li, .manual dd { line-height: 1.65; }
.manual-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin: 12px 0; }
.manual-card { padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.manual-card p { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.manual-shots { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.manual-shot { margin: 16px 0 20px; }
.manual-shot img { display: block; width: 100%; height: auto; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 2px 12px var(--shadow); }
.manual-shot figcaption { margin-top: 8px; font-size: 13px; color: var(--grey); }
.manual-table { width: 100%; margin: 14px 0; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: 14px; }
.manual-table th { padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--grey); background: var(--surface-2); border-bottom: 1px solid var(--line); }
.manual-table td { padding: 10px 14px; vertical-align: top; border-bottom: 1px solid var(--line-2); line-height: 1.5; }
.manual-table tr:last-child td { border-bottom: 0; }
.manual-log { display: grid; grid-template-columns: auto 1fr; gap: 10px 18px; margin: 0; }
.manual-log dt { font-size: 13px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.manual-log dd { margin: 0; }
@media (max-width: 900px) {
  .manual-side { transform: translateX(-100%); transition: transform .2s; z-index: 50; box-shadow: 0 0 30px var(--shadow); }
  .manual-nav-open .manual-side { transform: none; }
  .manual { margin-left: 0; padding: 70px 18px 60px; }
  .manual-menu { display: inline-flex; align-items: center; gap: 6px; position: fixed; top: 12px; left: 12px; z-index: 60; padding: 8px 12px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--ink); font: inherit; font-size: 14px; }
  .manual-shots { grid-template-columns: 1fr; }
  .manual-head h1 { font-size: 28px; }
}
.zoom-box { align-items: center; justify-content: center; gap: 12px; padding: 24px 80px; background: rgba(12, 12, 11, .94); }
.zoom-box img { max-width: 100%; max-height: calc(100vh - 110px); border-radius: var(--radius); box-shadow: 0 10px 40px rgba(0,0,0,.5); background: #fff; }
.zoom-caption { font-size: 13px; color: #a1a1aa; text-align: center; }
.zoom-close { position: absolute; top: 14px; right: 18px; width: 44px; height: 44px; border: 0; border-radius: 50%; background: rgba(255,255,255,.1); color: #fff; font-size: 26px; line-height: 1; cursor: pointer; }
.zoom-close:hover { background: rgba(255,255,255,.2); }
.manual-shot a { cursor: zoom-in; }
@media (max-width: 760px) { .zoom-box { padding: 60px 10px 20px; } }
.manual-langs { gap: 6px; }
.manual-langs a { color: var(--muted); }
.manual-langs strong { color: var(--ink); font-weight: 600; }

/* Price list and plan of the licenses (distributor only) */
.license-col { display: grid; gap: 20px; align-content: start; min-width: 0; }
.license-col .card h2 { margin-top: 0; }
.license-col .dl { margin-bottom: 0; align-items: baseline; }
.license-col .dl + form { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.license-until { margin: 0 0 14px; display: grid; gap: 2px; justify-items: start; }
.license-plan-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.license-plan-form .span-all { grid-column: 1 / -1; }
.license-action { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.license-action:first-of-type { border-top: 0; padding-top: 0; }
.license-action:last-child { padding-bottom: 0; }
.license-action > form { flex: none; }
/* Domain of its own of a cloud site, on the license page (CustomDomains) */
.domain-actions { display: flex; gap: 8px; flex-wrap: wrap; margin: 4px 0 12px; }
.domain-set { display: flex; gap: 8px; margin-bottom: 16px; }
.domain-set input { flex: 1; min-width: 0; }
.licenses-table td { padding-top: 14px; padding-bottom: 14px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.plans-table .input-num { width: 90px; text-align: right; }
.plans-table input[name="name"] { min-width: 140px; }
.plans-table .plan-new-row td { background: var(--surface-2, transparent); }
/* Price list: the plans side by side, a click on a function switches it on or off in that plan */
.compare-table th, .compare-table td { text-align: center; white-space: nowrap; vertical-align: middle; }
.compare-table th[scope=row] { text-align: left; font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--ink); font-weight: 500; background: var(--panel); position: sticky; left: 0; z-index: 1; }
.compare-table .cmp-plan { vertical-align: top; text-transform: none; letter-spacing: 0; }
.compare-table .cmp-plan > * { display: block; margin: 0 auto 4px; width: max-content; }
.compare-table .cmp-plan-name { color: var(--ink); text-decoration: none; font-size: 16px; font-weight: 700; }
.compare-table .cmp-plan small { font-weight: 400; }
.compare-table .cmp-plan-off .cmp-plan-name { color: var(--grey); }
.compare-table .cmp-open { margin-top: 6px; }
.compare-table .cmp-section th { background: var(--surface-2); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--grey); font-weight: 600; }
.compare-table .cmp-licenses td, .compare-table .cmp-licenses th { color: var(--grey); }
.cmp-mark { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 32px; border-radius: 8px; border: 1px solid transparent; }
.cmp-mark.cmp-on { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.cmp-mark.cmp-off { background: none; border: 1px dashed var(--line); color: var(--grey); opacity: .7; }
.cmp-toggle { padding: 0; font: inherit; cursor: pointer; }
.cmp-mark.cmp-fixed { background: none; border-style: solid; cursor: default; }
.cmp-feature { display: inline-flex; align-items: center; gap: 8px; }
.compare-table th[scope=row] { white-space: normal; min-width: 260px; max-width: 360px; }
.cmp-feature-text a { color: var(--ink); text-decoration: none; font-weight: 600; }
.cmp-feature-text a svg { color: var(--grey); vertical-align: -1px; }
.cmp-feature-text small { display: block; color: var(--grey); font-weight: 400; font-size: 12px; line-height: 1.4; margin-top: 2px; }
.cmp-move { display: inline-flex; flex-direction: column; }
.cmp-move .btn { min-height: 0; height: 18px; padding: 0 6px; }
.cmp-move .btn:disabled { visibility: hidden; }
.cmp-toggle.cmp-on:hover { box-shadow: 0 0 0 3px var(--ok-soft); }
.cmp-toggle.cmp-off:hover { opacity: 1; border-style: solid; border-color: var(--ok); color: var(--ok); }
.quota-meter { margin: 6px 0 4px; }
.quota-meter .seg { height: 100%; }
.plain-list { list-style: none; padding: 0; margin: 0 0 12px; display: grid; gap: 6px; }

/* Shop of the distributor (/acquista) */
body.shop { display: block; }
.shop-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; max-width: 1180px; margin: 0 auto; padding: 18px 16px; }
.shop-nav { display: flex; align-items: center; gap: 16px; }
.shop-nav .lang-switch { position: static; display: flex; gap: 6px; margin-top: 0; }
body.shop { background: var(--guest-bg); }
.shop-wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px 48px; }
.shop-hero { margin: 8px 0 20px; }
.shop-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.shop-steps { display: grid; gap: 16px; min-width: 0; }
.shop-step h2 { margin-top: 0; display: flex; align-items: center; gap: 10px; }
.step-n { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--primary); color: #fff; font-size: 14px; flex: none; }
.choice-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.choice-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.choice { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice-body { display: grid; gap: 4px; height: 100%; padding: 14px 16px; border: 1px solid var(--line-strong, #ccc); border-radius: 10px; background: var(--panel); }
.choice input:checked + .choice-body { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in oklab, var(--primary) 35%, transparent); }
.choice input:focus-visible + .choice-body { outline: 2px solid var(--primary); outline-offset: 2px; }
.choice.is-disabled { opacity: .45; cursor: not-allowed; }
.plan-price { font-weight: 600; }
.addon-list { display: grid; gap: 8px; }
.addon-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-2, #eee); }
.addon-row:last-of-type { border-bottom: 0; }
.addon-qty { width: 80px; }
.input-suffix { display: flex; align-items: stretch; }
.input-suffix input { flex: 1; min-width: 0; border-top-right-radius: 0; border-bottom-right-radius: 0; }
.input-suffix input:focus { outline: none; }
.input-suffix span { display: flex; align-items: center; padding: 0 12px; border: 1px solid var(--input-border, #ccc); border-left: 0; border-radius: 0 8px 8px 0; background: var(--surface-2); white-space: nowrap; }
.grid-2 .span-2 { grid-column: 1 / -1; }
.shop-summary { position: sticky; top: 16px; display: grid; gap: 12px; }
.summary-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 14px; }
.summary-lines li { display: flex; justify-content: space-between; gap: 12px; }
.summary-total { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; margin: 0; padding-top: 10px; border-top: 1px solid var(--line-2, #eee); font-size: 14px; }
.summary-total dd { margin: 0; text-align: right; white-space: nowrap; }
.shop-narrow { max-width: 560px; margin: 24px auto; }
@media (max-width: 900px) {
  .shop-grid { grid-template-columns: 1fr; }
  .shop-summary { position: static; }
  .choice-grid-2 { grid-template-columns: 1fr; }
}
.shop [hidden], .form [hidden] { display: none !important; }
.dialog-user { width: 640px; }
.dialog-user .dialog-head { margin-bottom: 4px; }

/* Share dialog: who has access, with a role; link open to anyone */
.dialog-share { width: 560px; }
.share-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; max-height: 260px; overflow-y: auto; }
.share-list li, .share-options li { display: flex; align-items: center; gap: 10px; }
.share-list li { padding: 6px 0; }
.share-list .role-btn { margin-left: auto; width: auto; min-height: 34px; padding: 6px 10px; font-size: 14px; flex: none; }
.share-list li.inherited { opacity: .75; }
.share-inh-role { margin-left: auto; color: var(--muted); text-align: right; }
.share-avatar { flex: none; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-size: 13px; font-weight: 600; }
.share-avatar.is-group { background: var(--hover); color: var(--ink-2); }
.share-who { display: grid; min-width: 0; }
.share-who strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.share-who small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* As on Drive: the round icon centred on the block «choice + explanation», the explanation aligned with the choice */
.share-general-row { display: grid; grid-template-columns: 40px minmax(0, 1fr); column-gap: 12px; align-items: center; }
.share-general-row > div { display: grid; gap: 4px; justify-items: start; }
.share-general-row p { margin: 0; }
.share-general-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--hover); }
.share-general-icon.is-public { background: color-mix(in oklab, var(--primary) 18%, transparent); color: var(--primary); }
.tag-public { display: inline-flex; align-items: center; gap: 3px; margin-left: 6px; vertical-align: middle; }

/* Text and code in the viewer: a white sheet, monospaced, wrapped lines with their numbers */
.text-sheet { width: min(100%, 1100px); margin: 0 auto; max-height: 100%; overflow: auto; background: #fff; color: #1d1d1b; border-radius: 6px; box-shadow: 0 10px 40px rgba(0,0,0,.35); padding: 18px 0; }
.lb-body .viewer > .text-sheet { flex: 0 1 auto; align-self: stretch; }
.text-lines { margin: 0; padding: 0 24px 0 0; list-style: none; counter-reset: ln; font: 13px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.text-lines li { counter-increment: ln; display: grid; grid-template-columns: 4.5em minmax(0, 1fr); white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 4; }
.text-lines li::before { content: counter(ln); color: #a1a1a0; text-align: right; padding-right: 1.2em; user-select: none; }
.text-lines li:hover { background: #f6f6f4; }
.text-cut, .text-empty { margin: 14px 24px 0; color: #6b6b69; font-size: 13px; }
/* Grid view: only preview and name on the cards (click opens the viewer, right click the menu); the list view keeps size, date and buttons */
.file-grid:not(.is-list) .fc-actions { display: none; }
.file-grid:not(.is-list) .fc-meta { display: none; }
.file-grid:not(.is-list) .file-card { padding-bottom: 14px; }

/* Type of file: an icon before the name (grid and list) and in the empty preview, one colour per type */
.file-grid:not(.is-list) .fc-name { display: flex; align-items: flex-start; gap: 8px; }
.file-grid:not(.is-list) .fc-name > .icon { display: inline; flex: none; width: 18px; height: 18px; margin-top: 1px; }
.file-card .icon-pdf { color: #d93025; }
.file-card .icon-img { color: #e37400; }
.file-card .icon-video { color: #8430ce; }
.file-card .icon-audio { color: #c2185b; }
.file-card .icon-zip { color: #795548; }
.file-card .icon-sheet { color: #188038; }
.file-card .icon-slides { color: #e8710a; }
.file-card .icon-doc, .file-card .icon-text { color: #1a73e8; }
.file-card .icon-code { color: #5f6368; }
/* Selection box: shown on mouse over, when ticked, while something is selected, with the keyboard, and always on touch screens */
.fc-check { opacity: 0; transition: opacity .12s; }
.file-card:hover .fc-check, .fc-check:focus-within, .fc-check:has(input:checked), .file-grid:has(.fc-check input:checked) .fc-check { opacity: 1; }
@media (hover: none) { .fc-check { opacity: 1; } }
/* Legal pages (/legal/{page}) and their links in the footers */
.legal-links { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-right: auto; }
.legal-links a { color: var(--grey); text-decoration: none; font-size: 12px; }
.legal-links a:hover { color: var(--ink); text-decoration: underline; }
.guest-legal .legal-links { justify-content: center; margin: 10px 0 0; }
.shop-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; max-width: 1180px; margin: 0 auto; padding: 16px; border-top: 1px solid var(--line); }
.legal-page { max-width: 820px; margin: 8px auto 0; }
.prose { line-height: 1.6; overflow-wrap: anywhere; }
.prose h1 { font-size: 26px; margin: 0 0 16px; }
.prose h2 { font-size: 18px; margin: 28px 0 8px; }
.prose ul, .prose ol { padding-left: 22px; }
.prose li { margin: 4px 0; }
.prose table { width: 100%; border-collapse: collapse; margin: 12px 0; font-size: 14px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; }
.prose th { background: var(--hover); }
.prose code { font-size: .92em; }
.legal-updated { margin-top: 24px; }
.legal-modes { display: flex; flex-wrap: wrap; gap: 8px 20px; border: 0; padding: 0; margin: 0; }
.legal-texts textarea { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; line-height: 1.5; }
/* Two-step verification: QR code, code fields, recovery codes */
.tfa-steps { padding-left: 20px; display: grid; gap: 14px; }
.tfa-qr { margin: 10px 0; display: block; width: fit-content; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); line-height: 0; }
.tfa-qr svg { width: 192px; height: 192px; }
.tfa-secret { letter-spacing: .08em; user-select: all; }
.tfa-code { font-size: 20px; letter-spacing: .25em; text-align: center; max-width: 220px; }
.tfa-codes { columns: 2; list-style: none; padding: 0; margin: 12px 0; font-size: 16px; }
.tfa-codes li { padding: 4px 0; }
.tfa-codes-card { margin-bottom: 20px; }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
/* A step the account must take first (partials.account-step): a dialog that cannot be closed */
.dialog-step { width: 560px; max-height: calc(100vh - 32px); overflow: auto; }
.dialog-step::backdrop { background: rgba(29,29,27,.7); backdrop-filter: blur(2px); }
.step-body { padding: 28px; display: grid; gap: 16px; }
.step-body > * { margin: 0; }
.dialog-step form { padding: 0; }   /* not the padding of the other dialogs' forms */
.step-body .alert { margin: 0; }
.step-body .tfa-steps { margin: 0; }
.dialog-step .step-logout { display: flex; justify-content: flex-end; border-top: 1px solid var(--line); padding-top: 14px; margin-top: 4px; }
.btn-link { background: none; border: 0; padding: 0; color: var(--grey); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; font: inherit; }
.btn-link:hover { color: var(--ink); text-decoration: underline; }
/* Code asked at login: as wide as the button, the hint apart from it */
.tfa-code-wide { max-width: none; width: 100%; }
.tfa-hint { margin: 18px 0 6px; }
.row-actions { width: 1%; white-space: nowrap; text-align: right; }
/* Selects: our own arrow, with the same right margin as the text on the left (the browser's sits on the edge) */
select:not([multiple]):not([size]) {
  -webkit-appearance: none; appearance: none; padding-right: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none' stroke='%23878787' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; background-size: 12px 8px;
}
select::-ms-expand { display: none; }
select.input-sm:not([multiple]):not([size]) { padding-right: 32px !important; background-position: right 10px center; }
.folder-name .tag { font-weight: 400; }
/* «Avvisi» window of a folder or a file */
.alerts-events { display: grid; gap: 6px; margin: 4px 0 4px; }
.alerts-events label[hidden] { display: none; }
.alerts-when { border: 0; margin: 4px 0 0; padding: 0; display: grid; gap: 6px; }
.alerts-when legend { padding: 0; margin-bottom: 4px; }
.alerts-recur { display: grid; gap: 8px; margin: 2px 0 4px 28px; }
.alerts-recur[hidden], .alerts-row[hidden] { display: none; }
.alerts-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.alerts-num { width: 5em; }
.day-pill { position: relative; cursor: pointer; }
.day-pill input { position: absolute; opacity: 0; inset: 0; }
.day-pill span { display: grid; place-items: center; min-width: 34px; height: 34px; padding: 0 6px; border: 1px solid var(--line, #d0d3d6); border-radius: 17px; font-size: 13px; text-transform: capitalize; }
.day-pill input:checked + span { background: var(--primary); border-color: var(--primary); color: #fff; }
.day-pill input:focus-visible + span { outline: 2px solid var(--primary); outline-offset: 2px; }
.alerts-paused { margin: 0; padding: 8px 12px; border-radius: 6px; background: color-mix(in oklab, #e0a800 16%, transparent); }
.alerts-paused[hidden] { display: none; }
/* Legal pages in a dialog (app.js, data-legal) */
.dialog-legal { width: 820px; max-width: calc(100vw - 32px); max-height: calc(100vh - 48px); overflow: hidden; display: none; }
.dialog-legal[open] { display: flex; flex-direction: column; }
.legal-popup { overflow: auto; padding: 32px 36px; }
.legal-popup .prose h1 { padding-right: 32px; }
.legal-x { position: absolute; top: 12px; right: 12px; width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--panel); color: var(--ink); font-size: 24px; line-height: 1; cursor: pointer; z-index: 1; }
.legal-x:hover { background: var(--hover); }
@media (max-width: 640px) { .legal-popup { padding: 24px 18px; } }
[data-legal-for][hidden] { display: none; }
/* Visual editor of the legal pages (legal-editor.js, TOAST UI Editor) */
.legal-texts textarea[hidden] { display: none; }
.legal-wysiwyg { font-weight: 400; }
.legal-wysiwyg .toastui-editor-defaultUI { border-color: var(--input-border); border-radius: var(--radius); }
.lang-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.lang-tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: -1px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--grey); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.lang-tab:hover { color: var(--ink); }
.lang-tab[aria-selected=true] { color: var(--ink); border-bottom-color: var(--primary); }
.lang-tab .tag { font-weight: 400; }
.lang-panel[hidden] { display: none; }
/* Data to complete of a legal page: a field per placeholder */
.legal-fields { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px 20px; margin: 0; }
.legal-fields legend { font-weight: 600; padding: 0 6px; }
.legal-fields-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px 18px; }
.legal-fields input.is-empty { border-color: var(--warn-line); background: var(--warn-soft); }
.legal-fields[hidden] { display: none; }
.lang-panel-tools { display: flex; justify-content: flex-end; margin-bottom: 8px; }
.legal-lawyer { display: flex; gap: 6px; align-items: flex-start; margin: 16px 0 0; } .legal-lawyer .icon { flex: none; margin-top: 3px; }
/* Page of an alert email (/novita/…) */
.digest-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; }
.digest-filters .chip { padding: 5px 12px; border: 1px solid var(--line); border-radius: 16px; font-size: 13px; color: var(--ink); text-decoration: none; }
.digest-filters .chip.is-on { background: var(--primary); border-color: var(--primary); color: #fff; }
.digest-day { margin: 24px 0 8px; font-size: 15px; text-transform: capitalize; }
.digest-time { width: 4.5em; white-space: nowrap; vertical-align: top; }
.digest-table td { vertical-align: top; }
.digest-gone { text-decoration: line-through; }
/* Tabs of the profile (partials/profile-tabs) */
.tabs { display: flex; gap: 4px; margin: 0 0 20px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs .tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; margin-bottom: -1px; border-bottom: 2px solid transparent; color: var(--grey); text-decoration: none; font-weight: 500; white-space: nowrap; }
.tabs .tab:hover { color: var(--ink); }
.tabs .tab.is-active { color: var(--ink); border-bottom-color: var(--primary); }
.profile-pane { max-width: 760px; }
/* ---------- bottom of the side bar: the user (to the profile), logout, language ---------- */
.sidebar { display: flex; flex-direction: column; }
.sidebar .sidenav { flex: 1 0 auto; }
.side-user { position: sticky; bottom: 0; padding: 10px 10px 12px; border-top: 1px solid var(--line); background: var(--panel); }
.side-user-card { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px; border: 0; border-radius: var(--radius); background: none; color: var(--ink); font: inherit; text-align: left; text-decoration: none; min-width: 0; cursor: pointer; }
.side-user-card:hover, .side-user-card.active { background: var(--hover); }
.side-avatar { flex: 0 0 36px; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2, var(--hover)); color: var(--ink-2); font-size: 13px; font-weight: 600; letter-spacing: .02em; }
.side-user-text { flex: 1; display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.side-user-text strong { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-text small { font-size: 12px; color: var(--grey); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user-more { flex: none; display: grid; color: var(--grey); transform: rotate(180deg); }
@media (min-width: 861px) {
  html.sidebar-closed .side-user { padding: 10px 8px; }
  html.sidebar-closed .side-user-card { justify-content: center; padding: 6px 0; }
  html.sidebar-closed .side-user-text, html.sidebar-closed .side-user-more { display: none; }
}
/* ---------- logged in: no top bar on computers, the logo is at the top of the side bar ---------- */
.side-brand { display: flex; align-items: center; min-height: 68px; padding: 0 20px; border-bottom: 1px solid var(--line); text-decoration: none; }
.side-brand .site-logo { display: block; max-width: 180px; object-fit: contain; object-position: left center; }
.side-brand-mini { display: none; width: 28px; height: 28px; object-fit: contain; }
@media (min-width: 861px) {
  body.has-sidebar .topbar { display: none; }
  body.has-sidebar .sidebar-wrap { top: 0; height: 100vh; height: 100dvh; }
  html.sidebar-closed .side-brand { justify-content: center; padding: 0; }
  html.sidebar-closed .side-brand-full { display: none; }
  html.sidebar-closed .side-brand-mini { display: block; }
}
@media (max-width: 860px) {
  /* phones: the top bar stays, with the logo, and the side bar slides in with its own */
  .side-brand { min-height: 60px; }
}
/* Profile → Avvisi: what the user follows, in a table */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.alerts-heading { margin: 0; }
.alerts-sub { margin: 4px 0 0; max-width: 640px; }
.alerts-item { display: flex; align-items: flex-start; gap: 10px; }
.alerts-item .icon { flex: 0 0 auto; margin-top: 1px; color: var(--grey); }
.alerts-item a { color: var(--ink); text-decoration: none; }
.alerts-item a:hover { text-decoration: underline; }
.alerts-tags { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.alerts-table td { vertical-align: top; }
.alerts-table.is-paused tbody td { opacity: .55; }
.alerts-how { margin: 10px 2px 0; }
.alerts-empty { padding: 40px 16px; }
.alerts-empty p { max-width: 460px; margin: 12px auto 0; }
.alerts-pause-card { margin-top: 20px; padding: 18px 20px; }
.alerts-pause-card .check { margin: 0; }
.toolbar + .alerts-paused { margin-bottom: 12px; }
.share-notify { margin: -4px 0 0; }
.alerts-events-wrap[hidden] { display: none; }
.alerts-events-wrap .share-sub { margin: 8px 0 4px; }

/* «Versioni» of a file (files/_versions) */
.dialog-versions { width: 900px; max-height: calc(100vh - 32px); overflow: auto; }
.dialog-versions .dialog-body { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.dialog-versions form.versions-upload { padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface-2); }
.versions-upload h3 { margin: 0 0 2px; font-size: 15px; }
.versions-upload p { margin: 0 0 10px; }
.version-drop { display: flex !important; flex-direction: row !important; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; padding: 18px; border: 1.5px dashed var(--line-strong); border-radius: var(--radius); background: var(--panel); color: var(--muted); font-weight: 400 !important; cursor: pointer; text-align: center; transition: all .15s; }
.version-drop:hover, .version-drop.is-over { border-color: var(--primary); color: var(--ink); background: var(--primary-soft); }
.version-drop.is-picked { border-style: solid; border-color: var(--primary); color: var(--ink); font-weight: 600 !important; }
.version-drop u { color: var(--primary); }
.versions-upload-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.versions-upload-row input[type=text] { flex: 2 1 220px; min-width: 0; }
.versions-error { color: var(--danger); margin: 8px 0 0 !important; }
.versions-list .is-current td { background: var(--surface-2); }
/* «Confronta»: a bar of its own above the table, coloured once versions are ticked */
.versions-compare { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 10px 12px 10px 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); transition: background .15s, border-color .15s; }
.versions-compare-text { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--ink-2); }
.versions-compare-text .icon { color: var(--primary); flex: none; }
.versions-compare.is-active { background: var(--primary-soft); border-color: color-mix(in oklab, var(--primary) 35%, var(--line)); }
.versions-compare.is-active .versions-compare-text { color: var(--ink); font-weight: 600; }
.versions-compare .btn[disabled] { opacity: .45; }
.dialog-versions form.inline { padding: 0; display: inline; }
.dialog-versions .loading { padding: 24px; text-align: center; }
.lb-name .tag-old-version { margin-left: 6px; background: var(--warn-soft); color: #8a5a00; vertical-align: middle; }
.tag-updated { background: var(--primary-soft); color: var(--primary); }
/* «Aggiornato» in a card: not clamped like the name; in the grid a badge on the corner of the preview, in the list next to the name */
.fc-name .tag-updated { display: inline-block; flex: none; overflow: visible; -webkit-line-clamp: unset; margin-left: 6px; font-weight: 600; vertical-align: middle; }
.file-grid:not(.is-list) .fc-name .tag-updated { position: absolute; top: 10px; right: 10px; z-index: 2; margin: 0; box-shadow: 0 1px 3px rgba(0,0,0,.12); }

/* «File già presente»: room for three buttons (they wrap on narrow screens), and the texts close together */
.dialog-conflict { width: 560px; }
.dialog-conflict h2, .dialog-conflict p { margin: 0; }
.dialog-conflict [data-conflict-sizes] { margin-top: -8px; }
.dialog-conflict .dialog-actions { flex-wrap: wrap; }

/* Versions compared in the viewer (files/compare): a column per version, a row per page; two images also one over the other */
.cmp-side { flex: 1; min-height: 0; overflow: auto; }
.cmp-grid { display: grid; grid-template-columns: repeat(var(--cols), minmax(260px, 1fr)); gap: 0 16px; padding: 0 16px 24px; }
.cmp-head { position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 12px 4px 10px; background: #161615; border-bottom: 1px solid rgba(255,255,255,.08); }
.cmp-head strong { font-size: 15px; }
.cmp-head .tag { background: rgba(255,255,255,.12); color: #e4e4e7; }
.cmp-actions { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.cmp-actions form { display: contents; }
.cmp-head .cmp-dl { min-width: 32px; height: 32px; }
.lb-form { display: contents; }
.lb-make-current { border: 1px solid rgba(255,255,255,.25); }
.cmp-make-current { height: 32px; font-size: 13px; border: 1px solid rgba(255,255,255,.22) !important; }
.cmp-meta, .cmp-note { flex-basis: 100%; font-size: 12px; color: #a1a1aa; }
.cmp-note { color: #e4e4e7; }
.cmp-cell { padding-top: 16px; min-width: 0; }
.cmp-page { margin: 0; }
.cmp-page img { display: block; width: 100%; height: auto; background: #fff; box-shadow: 0 2px 12px rgba(0,0,0,.4); }
.cmp-page figcaption { padding-top: 6px; font-size: 12px; color: #a1a1aa; text-align: center; }
.cmp-missing { display: grid; place-items: center; min-height: 160px; margin: 0; border: 1px dashed rgba(255,255,255,.15); border-radius: var(--radius); color: #71717a; font-size: 13px; }
.cmp-pic img { display: block; max-width: 100%; max-height: calc(100vh - 170px); margin: 0 auto; object-fit: contain; }
.cmp-cell video, .cmp-cell audio { width: 100%; }
.cmp-text { max-height: calc(100vh - 170px); overflow: auto; }
.cmp-cell .empty-state { color: #a1a1aa; padding: 40px 12px; }
.cmp-modes { display: inline-flex; gap: 2px; padding: 2px; border-radius: var(--radius); background: rgba(255,255,255,.06); }
.cmp-modes .lb-btn { height: 34px; }
.cmp-modes .lb-btn[aria-pressed="true"] { background: rgba(255,255,255,.16); color: #fff; }
.cmp-overlay { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 12px; padding: 16px 22px 18px; }
.cmp-overlay[hidden] { display: none; }
.cmp-stage { position: relative; flex: 1; min-height: 0; cursor: ew-resize; touch-action: none; user-select: none; }
.cmp-stage img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; }
.cmp-over { clip-path: inset(0 0 0 var(--pos)); }
.cmp-line { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); pointer-events: none; }
.cmp-handle { position: absolute; top: 50%; left: 50%; display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; margin: -19px 0 0 -19px; border-radius: 50%; background: #fff; color: #18181b; box-shadow: 0 2px 8px rgba(0,0,0,.4); }
.cmp-label { position: absolute; top: 10px; padding: 3px 9px; border-radius: 99px; background: rgba(0,0,0,.6); color: #fff; font-size: 12px; pointer-events: none; }
.cmp-label-l { left: 10px; }
.cmp-label-r { right: 10px; }
.cmp-overlay input[type=range] { width: 100%; accent-color: var(--primary); }
@media (max-width: 700px) { .cmp-grid { grid-template-columns: repeat(var(--cols), minmax(220px, 80vw)); } }

/* ---------- file pages: all the width, and the optional side panel with the preview and details of the selected item ---------- */
.main-row { display: flex; flex: 1; min-width: 0; }
.main-row > main { min-width: 0; }
.container.is-wide { max-width: none; }
.details-toggle { width: 42px; height: 42px; padding: 0; align-items: center; justify-content: center; }
.details-toggle[aria-pressed=true] { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.details-panel { display: none; }
@media (min-width: 1100px) {
  html.details-open .details-panel { display: flex; }
}
.details-panel { flex: 0 0 340px; width: 340px; flex-direction: column; position: sticky; top: 0; align-self: flex-start; height: 100vh; overflow-y: auto; background: var(--panel); border-left: 1px solid var(--line); z-index: 10; }
.details-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 14px 20px; border-bottom: 1px solid var(--line); font-weight: 600; }
.details-hint { margin: 0; padding: 48px 24px; text-align: center; color: var(--muted); font-size: 14px; }
.details-wait { display: grid; place-items: center; min-height: 200px; }
.details-body[hidden] { display: none; }
.details-preview { display: grid; place-items: center; min-height: 200px; background: var(--surface-2); border-bottom: 1px solid var(--line); color: var(--muted); }
.details-preview[data-details-open] { cursor: pointer; }
.details-preview img { display: block; max-width: 100%; max-height: 360px; object-fit: contain; }
.details-preview video { display: block; width: 100%; max-height: 360px; background: #000; }
.details-preview audio { width: calc(100% - 24px); }
.details-preview pre { align-self: start; width: 100%; max-height: 360px; margin: 0; padding: 14px 16px; overflow: hidden; font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink-2); }
.details-name { margin: 0; padding: 16px 20px 0; font-size: 15px; font-weight: 600; overflow-wrap: anywhere; }
.details-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 14px 20px 0; }
.details-list { display: grid; grid-template-columns: 1fr; gap: 0; margin: 0; padding: 16px 20px 96px; font-size: 13px; }
.details-list dt { margin-top: 12px; color: var(--muted); font-size: 12px; }
.details-list dt:first-child { margin-top: 0; }
.details-list dd { margin: 1px 0 0; overflow-wrap: anywhere; }
.details-list dd small { color: var(--muted); }

/* ---------- messages after an action: floating at the bottom right, above the progress buttons (login and shop pages: in the page) ---------- */
body.app .flash-stack { position: fixed; right: 22px; bottom: 22px; z-index: 160; display: flex; flex-direction: column; gap: 8px; width: 440px; max-width: calc(100vw - 32px); }
body.app:has(#fab-stack > :not([hidden])) .flash-stack { bottom: 82px; }
body.app.lb-open .flash-stack { display: none; }
body.app .flash-stack .alert { display: flex; flex-wrap: nowrap; align-items: center; gap: 10px; margin: 0; background: var(--panel); box-shadow: 0 8px 28px rgba(0,0,0,.18); }
.flash-stack .alert > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.flash-stack .alert form { margin: 0; flex-shrink: 0; }
.flash-stack .alert .btn { flex-shrink: 0; }
.flash-close { padding-left: 6px; padding-right: 6px; }
.empty-state[hidden] { display: none; }
@media (max-width: 640px) { body.app .flash-stack { right: 16px; bottom: 16px; } }

/* ---------- size of the previews: slider in the page tools; not for the list view, nor on phones ---------- */
.size-slider { position: relative; display: inline-grid; place-items: center; width: 42px; height: 42px; color: var(--muted); background: var(--panel); border: 1px solid var(--input-border); border-radius: var(--radius); cursor: pointer; }
.size-slider:hover, .size-slider:focus-within { color: var(--ink); border-color: var(--input-border-hover); }
.size-slider:focus { outline: none; }
.size-pop { display: none; position: absolute; top: 100%; right: -1px; z-index: 30; padding-top: 6px; cursor: default; }
.size-slider:hover .size-pop, .size-slider:focus-within .size-pop { display: block; }
.size-box { display: flex; flex-direction: column; gap: 10px; width: 230px; margin: 0; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line-strong); border-radius: var(--radius); box-shadow: 0 6px 20px var(--shadow); color: var(--ink); font-size: 13px; font-weight: 600; white-space: nowrap; }
.size-box input[type=range] { display: block; width: 100%; margin: 0; padding: 0; border: 0; background: none; accent-color: var(--primary); cursor: pointer; }
.size-box input[type=range]:focus, .size-box input[type=range]:focus-visible { outline: none; }
.page-tools:has(.view-toggle [data-view=list][aria-pressed=true]) .size-slider { display: none; }
@media (max-width: 760px) { .size-slider { display: none; } }

/* ---------- side panel: the Dettagli / Attività tabs, the description of a folder, the events ---------- */
.details-tabs { display: flex; border-bottom: 1px solid var(--line); }
.details-tabs button { flex: 1; padding: 11px 8px; border: 0; border-bottom: 2px solid transparent; background: none; color: var(--muted); font: inherit; font-size: 14px; cursor: pointer; }
.details-tabs button:hover { color: var(--ink); background: var(--hover); }
.details-tabs button[aria-selected=true] { color: var(--ink); font-weight: 600; border-bottom-color: var(--primary); }
.details-pane[hidden] { display: none; }
.details-desc { padding: 14px 20px 0; font-size: 14px; }
.details-desc-text { margin: 0 0 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.details-desc-text[hidden], .details-desc form[hidden], .details-desc .btn[hidden] { display: none; }
.details-desc textarea { width: 100%; min-height: 110px; margin-bottom: 8px; resize: vertical; font: inherit; }
.details-desc-actions { display: flex; justify-content: flex-end; gap: 8px; }
.details-events { list-style: none; margin: 0; padding: 8px 0 96px; font-size: 13px; }
.details-events li { padding: 10px 20px; border-bottom: 1px solid var(--line-2); }
.details-events li:last-child { border-bottom: 0; }
.details-event-what { overflow-wrap: anywhere; }
.details-event-target { display: block; color: var(--ink-2); overflow-wrap: anywhere; }
.details-event-when { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; }

/* ---------- the page of a download link: a card on a full picture of the brand colour, nothing of the reserved area ---------- */
body.dl-page { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: row; align-items: center; padding: 32px 0 32px 8vw; color: #17181a;
  background: radial-gradient(60vw 60vw at 85% 15%, color-mix(in oklab, var(--primary) 55%, #fff) 0%, transparent 65%), radial-gradient(70vw 70vw at 70% 100%, color-mix(in oklab, var(--primary) 70%, #ff7a59) 0%, transparent 60%), linear-gradient(135deg, color-mix(in oklab, var(--primary) 85%, #000) 0%, var(--primary) 100%); background-attachment: fixed; }
.dl-card { width: 400px; max-width: 100%; display: flex; flex-direction: column; gap: 16px; padding: 28px; background: #fff; border-radius: 20px; box-shadow: 0 24px 70px rgba(0,0,0,.28); }
.dl-logo { display: flex; justify-content: center; }
.dl-center { text-align: center; }
.dl-badge { display: inline-grid; place-items: center; width: 60px; height: 60px; margin-bottom: 12px; border-radius: 50%; background: color-mix(in oklab, var(--primary) 12%, #fff); color: var(--primary); }
.dl-badge.is-off { background: #f0f0f1; color: #85868a; }
.dl-card h1 { margin: 0 0 6px; font-size: 22px; line-height: 1.25; font-weight: 700; overflow-wrap: anywhere; }
.dl-sub { margin: 0; font-size: 14px; color: #6a6b70; }
.dl-message { margin: 0; padding: 12px 14px; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; background: #f5f5f6; border-radius: 12px; }
.dl-files { list-style: none; margin: 0 -8px; padding: 0; max-height: 280px; overflow-y: auto; }
.dl-files li { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 12px; }
.dl-files li:hover { background: #f5f5f6; }
.dl-file-icon { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: #f0f0f1; color: #55565a; }
.dl-file-name { flex: 1; min-width: 0; font-size: 14px; }
.dl-file-name strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dl-file-name small { color: #6a6b70; font-size: 12px; }
.dl-file-get { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: #55565a; }
.dl-file-get:hover { background: #e7e7e9; color: #17181a; }
.dl-go { position: relative; overflow: hidden; display: block; width: 100%; padding: 15px 20px; border: 0; border-radius: 99px; background: var(--primary); color: var(--on-primary); font: inherit; font-size: 16px; font-weight: 600; text-align: center; text-decoration: none; cursor: pointer; transition: background .15s; }
.dl-go:hover { background: var(--primary-hover); }
.dl-go:disabled { cursor: progress; background: color-mix(in oklab, var(--primary) 55%, #fff); }
.dl-go > span { position: relative; }
.dl-go-bar { position: absolute !important; left: 0; top: 0; bottom: 0; width: 0; background: var(--primary); transition: width .3s; }
.dl-unlock { display: flex; flex-direction: column; gap: 12px; }
.dl-unlock input { width: 100%; padding: 13px 16px; border: 1px solid #d4d4d7; border-radius: 12px; font: inherit; }
.dl-error { margin: 0; color: #b3261e; font-size: 14px; text-align: center; }
.dl-error[hidden] { display: none; }
.dl-foot { position: fixed; right: 24px; bottom: 16px; display: flex; align-items: center; gap: 18px; font-size: 12px; color: #fff; }
.dl-foot a { color: inherit; }
.dl-foot .legal-links a:hover, .dl-foot .powered-by:hover { color: inherit; text-decoration-color: currentColor; }   /* stays white on the blue background */
@media (max-width: 640px) {
  body.dl-page { align-items: flex-start; justify-content: center; padding: 16px 16px 72px; }
  .dl-foot { left: 16px; right: 16px; justify-content: center; flex-wrap: wrap; gap: 10px; }
}
#dlg-link form[hidden] { display: none; }
#dlg-link [data-link-url] { width: 100%; }
.link-files { list-style: none; margin: 4px 0 0; padding: 0; font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.link-files-more { margin-top: 2px; font-size: 13px; color: var(--muted); }
.link-files-more summary { cursor: pointer; }
.link-files-more summary:hover { color: var(--ink); }
#dlg-extract [hidden] { display: none; }
#dlg-extract [data-extract-exists] { display: flex; flex-direction: column; gap: 10px; }
#dlg-extract [data-extract-exists][hidden] { display: none; }
.extract-warn { padding: 10px 12px; font-size: 14px; background: var(--warn-soft); border-left: 3px solid var(--warn); border-radius: var(--radius); }
#dlg-extract [data-extract-exists] .check { align-items: flex-start; }

/* ---------- panels at the bottom right (uploads, downloads, jobs): a small ring beside the name, the status under it with all the room it needs;
   the total is the ring of the round button ---------- */
.up-panel .upload-list li, .dl-panel .upload-list li { --ring: var(--primary); grid-template-columns: 26px minmax(0, 1fr) auto; gap: 1px 10px; padding: 8px 0; }
.up-panel .upload-list li.done, .dl-panel .upload-list li.done { --ring: var(--ok); }
.up-panel .upload-list li.error, .dl-panel .upload-list li.error { --ring: var(--danger); }
.up-panel .upload-list li .progress { grid-column: 1; grid-row: 1 / span 2; order: 0; align-self: center; width: 26px; height: 26px; border-radius: 50%; background: conic-gradient(var(--ring) calc(var(--p, 0) * 1%), var(--fill) 0); -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5.5px)); mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5.5px)); }
.up-panel .upload-list li.error .progress { background: var(--ring); }
.up-panel .upload-list li .bar { display: none; }
.up-panel .upload-list li .name { grid-column: 2; grid-row: 1; min-width: 0; }
.up-panel .upload-list li .st { grid-column: 2; grid-row: 2; text-align: left; overflow-wrap: anywhere; }
.up-panel .upload-list li .dl-x { grid-column: 3; grid-row: 1 / span 2; align-self: center; }
.up-panel > .progress-total { display: none; }
.dl-panel .up-title { margin-right: auto; }

/* ---------- phones and touch screens ---------- */
.topbar-menu, .card-more { display: none; }
.supplier-contact { min-width: 320px; }
.ctx-title { display: none; }
.ctx-backdrop { display: none; }
.details-toggle { display: inline-flex; }
/* Touch: larger targets, no double-tap delay, no text selection or link preview on a long press; 16 px in the fields, or iPhones zoom in on them */
@media (hover: none), (pointer: coarse), (max-width: 860px) {
  a, button, label, summary, select, .folder-card, .file-card { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
  .folder-card, .file-card, .file-card a { -webkit-touch-callout: none; }
  .folder-card[draggable="true"], .file-card[draggable="true"] { -webkit-user-drag: none; }
  input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=color]):not([type=file]):not(.pin-input):not(.tfa-code), select, textarea { font-size: 16px !important; }
  .btn-sm { min-height: 40px; }
  .btn-icon { min-width: 40px; justify-content: center; }
  .view-toggle button { width: 38px; height: 38px; }
  .sidenav a { padding: 12px; }
  .side-logout { padding: 10px 8px; }
  .lb-btn { min-width: 44px; height: 44px; }
  .up-x, .dl-x { width: 36px; height: 36px; }
  .share-tag button { width: 28px; height: 28px; }
  .twisty, .twisty-sp { width: 32px; height: 32px; }
  .move-row { padding-top: 9px; padding-bottom: 9px; }
  .day-pill span { min-width: 42px; height: 42px; border-radius: 21px; }
  .lang-switch a { padding: 8px 10px; }
  .legal-links a { padding: 4px 0; }
  .ctx-menu button, .menu-panel a { min-height: 44px; }
  .fc-check input { width: 22px; height: 22px; }
  /* «⋯» on the cards: right click and mouse over do not exist here */
  .card-more { position: absolute; top: 6px; right: 6px; z-index: 3; display: grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 50%; background: color-mix(in oklab, var(--panel) 82%, transparent); color: var(--ink-2); cursor: pointer; }
  .folder-card { position: relative; padding-right: 48px; }
  .folder-card .card-more { top: 50%; margin-top: -19px; background: none; }
  .file-grid:not(.is-list) .fc-name .tag-updated { right: auto; left: 10px; }
  .media-tile .card-more { width: 32px; height: 32px; top: 4px; right: 4px; }
  .file-grid.is-list .card-more { top: 50%; margin-top: -19px; right: 4px; background: none; }
  .file-grid.is-list .file-card { padding-right: 44px; }
}
@media (pointer: coarse) {
  /* choosing a whole folder and dragging do not exist on phones */
  .dropzone-actions .btn:has(input[webkitdirectory]), .dialog-upload .dropzone > strong, .dialog-upload .dropzone > .muted { display: none; }
}
@media (max-width: 1099px) {
  /* no room for the side panel: it opens over the page (app.js, «Dettagli» in the menu of a card or the button in the page tools) */
  html.details-sheet .details-panel { display: flex; position: fixed; top: 0; right: 0; bottom: 0; width: min(100%, 420px); height: auto; z-index: 45; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  html.details-sheet, html.details-sheet body { overflow: hidden; }
}
@media (max-width: 860px) {
  /* the menu opens from the button in the top bar */
  .topbar-menu { display: inline-grid; place-items: center; width: 44px; height: 44px; margin-left: -8px; padding: 0; border: 0; border-radius: var(--radius); background: none; color: var(--ink); cursor: pointer; flex: none; }
  .sidebar-handle { display: none; }
  .details-toggle { display: none; }   /* the details are in the «⋯» menu of each item */
  body.has-sidebar .topbar-inner { gap: 6px; padding: 0 12px; min-height: 56px; }
  body.has-sidebar .mainnav.mainnav-account:empty { display: none; }
  .brand img { height: 28px; }
  .side-brand { min-height: 56px; }
  .sidebar-wrap { visibility: hidden; transition: transform .2s, visibility .2s; }
  body.sidebar-open .sidebar-wrap { visibility: visible; }
  body.sidebar-open { overflow: hidden; }
  .sidebar { overscroll-behavior: contain; }
  /* selection bar: at the bottom of the screen, within reach of the thumb: how many on top, under it the actions, each an icon with a short label */
  .file-tools:not(:has(.file-tools-actions:not([hidden]))) { min-height: 0; margin: 0; }
  .file-tools:has(.file-tools-actions:not([hidden])) { position: fixed; top: auto; left: 8px; right: 8px; bottom: 8px; z-index: 30; margin: 0; padding: 4px 6px 6px; background: var(--panel); box-shadow: 0 0 0 1px var(--line-strong), 0 8px 28px rgba(0,0,0,.22); }
  .file-tools-actions { width: 100%; gap: 2px 4px; }
  .file-tools-actions .sel-sep { flex: 0 0 100%; height: 0; margin: 0; }
  [data-bulk-count] { margin-right: auto; white-space: nowrap; }
  .file-tools-actions > .btn:not([data-sel-clear]):not([data-sel-all]) { flex: 1 1 48px; flex-direction: column; gap: 2px; min-width: 0; min-height: 50px; padding: 4px 2px; font-size: 11px; line-height: 1.15; white-space: normal; text-align: center; }
  body:has(.file-tools-actions:not([hidden])) #fab-stack { bottom: 124px; }
  body.app:has(.file-tools-actions:not([hidden])) .flash-stack { bottom: 124px; }
  body:has(.file-tools-actions:not([hidden])) .footer { padding-bottom: 110px; }
  /* the side bar and dialogs measure the visible height, with the browser's own bars */
  .dialog-step, .dialog-versions { max-height: calc(100dvh - 16px); }
  .dialog-legal { max-height: calc(100dvh - 16px); }
}
@media (max-width: 760px) {
  /* the menus of a card and of a folder: a sheet at the bottom of the screen */
  .ctx-backdrop { display: block; position: fixed; inset: 0; z-index: 299; background: rgba(0,0,0,.4); }
  .ctx-menu { left: 0 !important; right: 0 !important; top: auto !important; bottom: 0 !important; width: auto; min-width: 0; max-height: 78dvh; overflow-y: auto; overscroll-behavior: contain; padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); border-width: 1px 0 0; border-radius: 16px 16px 0 0; }
  .menu-panel { position: fixed; }
  .menu-wrap:has(.menu-panel:not([hidden]))::before { content: ""; position: fixed; inset: 0; z-index: 299; background: rgba(0,0,0,.4); }
  .ctx-title { display: block; padding: 10px 10px 8px; margin-bottom: 4px; font-size: 13px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--line); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .ctx-menu button { padding: 11px 10px; font-size: 15px; }
  /* cards and rows closer together */
  .folder-grid { gap: 8px; margin-bottom: 16px; }
  .folder-card { min-height: 0; padding: 12px 48px 12px 14px; column-gap: 12px; row-gap: 0; }
  .folder-grid.is-list .folder-card { padding: 12px 48px 12px 14px; column-gap: 12px; }
  .folder-grid.is-list { margin-bottom: 16px; }
  .file-grid { gap: 8px; margin-bottom: 16px; }
  .file-grid:not(.is-list) .file-card { padding-bottom: 8px; }
  /* list view: name and, under it, size and date; the actions are in «⋯» */
  .file-grid.is-list .file-card, .file-grid.is-list.has-check .file-card, .file-grid.is-list:not(.has-check) .file-card, .file-grid.is-list.with-path .file-card { grid-template-columns: minmax(0, 1fr); min-height: 56px; padding: 8px 44px 8px 14px; align-content: center; }
  .file-grid.is-list .fc-actions { display: none; }
  .file-grid.is-list .fc-meta { display: flex; gap: 8px; padding: 0 0 0 30px; font-size: 12px; color: var(--grey); }
  .file-grid.is-list .fc-meta .fc-num { color: inherit; }
  .file-grid.is-list .fc-meta .fc-date { display: inline; }
  .file-grid.is-list .fc-meta .fc-date::before { content: "·"; margin-right: 8px; }
  .file-grid.is-list .fc-name span { -webkit-line-clamp: 2; }
  /* viewer: the name on a row of its own, the buttons under it */
  .lb-bar { flex-wrap: wrap; gap: 4px 8px; padding: 8px 8px 4px 12px; }
  .lb-title { flex: 1 1 100%; padding-right: 4px; }
  .lb-actions { flex: 1 1 100%; justify-content: space-between; gap: 0; }
  .lb-body .viewer-note { padding: 6px 12px; font-size: 12px; margin: 0; }
  .lb-make-current span { display: none; }
  .lb-info-panel { position: fixed; left: 8px; right: 8px; top: auto; width: auto; max-width: none; }
  .cmp-overlay { padding: 8px; }
}
@media (max-width: 640px) {
  .container { --gutter: 14px; padding: 12px var(--gutter) 32px; }
  .page-head { gap: 10px; margin-bottom: 12px; }
  .page-tools { gap: 8px; }
  .h1 { font-size: 20px; }
  .toolbar { gap: 8px; margin-bottom: 12px; }
  .toolbar-left { gap: 8px; }
  .toolbar-right { width: 100%; margin-left: 0; flex-wrap: nowrap; }
  .toolbar-right > .btn, .toolbar-right > form, .toolbar-right > form > .btn { flex: 1 1 0; min-width: 0; }
  .toolbar-right > .btn { padding-left: 8px; padding-right: 8px; white-space: normal; line-height: 1.2; text-align: center; }
  .card { padding: 16px; }
  .guest-card { padding: 28px 20px; }
  .filters > * { flex: 1 1 100%; }
  .filters .btn { flex: 1 1 0; }
  .inline-form { flex-wrap: wrap; }
  .inline-form input[type=text], .supplier-contact { width: 100%; min-width: 0; flex: 1 1 100%; }
  .inline-edit-form input { width: 100%; }
  .lang-tabs { overflow-x: auto; }
  .lang-tab { flex: none; white-space: nowrap; }
  .license-plan-form { grid-template-columns: 1fr; }
  .license-action { flex-wrap: wrap; }
  .legal-fields { padding: 12px; }
  .legal-fields-grid { grid-template-columns: minmax(0, 1fr); }
  .stat { padding: 12px 14px; }
  .stat-value { font-size: 20px; }
  .tfa-codes { columns: 1; }
  .shop-head { flex-wrap: wrap; }
  .addon-row { flex-wrap: wrap; }
  .shop-step .grid-2 { grid-template-columns: minmax(0, 1fr); }
  /* windows: nearly all the screen, and they scroll when they do not fit */
  .dialog, .dialog-share, .dialog-roles, .dialog-user, .dialog-move, .dialog-upload, .dialog-conflict, .dialog-versions, .dialog-step, .dialog-confirm { width: 100%; max-width: calc(100vw - 16px); max-height: calc(100dvh - 16px); overflow: auto; }
  .dialog form, .confirm-body, .share-body, .upload-dialog, .dialog-versions .dialog-body, .dialog-roles .dialog-body, .step-body { padding: 16px; }
  .dialog-step form, .dialog-versions form.inline { padding: 0; }
  .dialog-actions { flex-wrap: wrap; }
  .dialog-actions > .btn { flex: 1 1 auto; }
  .dialog-actions > .spacer { flex-basis: 100%; height: 0; }
  .dialog-upload .dropzone { padding: 20px 14px; }
  .move-tree { max-height: 42dvh; }
  .share-list { max-height: 34dvh; }
  /* tables: each row a block, each cell with the title of its column (app.js writes data-label) */
  .table[data-stacked] { display: block; }
  .table[data-stacked] thead { display: none; }
  .table[data-stacked] tbody { display: block; }
  .table[data-stacked] tr { display: block; padding: 10px 12px; border-bottom: 1px solid var(--line); }
  .table[data-stacked] tbody tr:last-child { border-bottom: 0; }
  .table[data-stacked] td, .table[data-stacked] td.hide-sm { display: block; width: auto; min-width: 0; padding: 3px 0; border: 0; text-align: right; white-space: normal; overflow-wrap: anywhere; word-break: normal; }
  .table[data-stacked] td::after { content: ""; display: block; clear: both; }
  .table[data-stacked] td[data-label]::before { content: attr(data-label); float: left; max-width: 45%; margin-right: 12px; font-size: 12px; line-height: 21px; color: var(--grey); text-align: left; }
  .table[data-stacked] td[colspan] { text-align: center; }
  .table[data-stacked] td.td-empty { display: none; }
  .table[data-stacked] .tags { justify-content: flex-end; }
  .table[data-stacked] .license-code { white-space: normal; overflow-wrap: anywhere; }
  .table[data-stacked] input:not([type=checkbox]):not([type=radio]), .table[data-stacked] select { width: 60%; min-width: 0; }
  .table[data-stacked] .actions, .table[data-stacked] .row-actions { padding-top: 6px; }
  .table-wrap { overflow-x: hidden; }
}

/* ---------- the menus of files and folders slide in and out (the closing is played by app.js, slideOut) ---------- */
@keyframes ctx-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes ctx-out { to { opacity: 0; transform: translateY(-8px); } }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }
@keyframes veil-in { from { opacity: 0; } }
@keyframes veil-out { to { opacity: 0; } }
.ctx-menu { animation: ctx-in .16s ease-out; }
.ctx-menu.is-closing { animation: ctx-out .13s ease-in forwards; pointer-events: none; }
@media (max-width: 760px) {
  .ctx-menu { animation: sheet-in .26s cubic-bezier(.22, .8, .3, 1); }
  .ctx-menu.is-closing { animation: sheet-out .2s ease-in forwards; }
  .ctx-backdrop, .menu-wrap:has(.menu-panel:not([hidden]))::before { animation: veil-in .26s ease-out; }
  .ctx-backdrop.is-closing, .menu-wrap:has(.menu-panel.is-closing)::before { animation: veil-out .2s ease-in forwards; pointer-events: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ctx-menu, .ctx-backdrop, .menu-wrap:has(.menu-panel:not([hidden]))::before { animation: none; }
}

/* ---------- viewer: swiping from a file to the next (app.js, initSwipe): sideways is ours, up and down and the pinch stay the browser's ---------- */
.lightbox { overflow: hidden; overscroll-behavior: contain; }
.lb-body { touch-action: pan-y pinch-zoom; }
.lb-body img { -webkit-user-drag: none; }
@keyframes lb-from-right { from { transform: translateX(100%); } }
@keyframes lb-from-left { from { transform: translateX(-100%); } }
.lb-in-next { animation: lb-from-right .2s ease-out; }
.lb-in-prev { animation: lb-from-left .2s ease-out; }
@media (prefers-reduced-motion: reduce) { .lb-in-next, .lb-in-prev { animation: none; } }

/* ---------- file pages: path, search, title and buttons stay fixed while the page scrolls (as in Google Drive);
   on small screens only the row with the search stays fixed, so the files keep the room ---------- */
html { scroll-padding-top: var(--page-top-h, 0px); }
.page-top { position: sticky; top: 0; z-index: 19; margin: -12px calc(-1 * var(--gutter)) 6px; padding: 12px var(--gutter); background: var(--bg); }
.page-top.is-stuck { box-shadow: 0 1px 0 var(--line), 0 6px 12px -8px var(--shadow); }
.page-top .page-head { margin-bottom: 12px; }
.page-top > :last-child { margin-bottom: 0; }
body.is-public .page-top { top: 68px; }
@media (max-width: 860px) {
  body.has-sidebar .page-top { top: 56px; }
}
@media (max-width: 760px), (max-height: 560px) {
  .page-top, .page-top .page-head { display: contents; }
  .page-top .crumbs { margin-bottom: 8px; }
  .page-top .page-tools { position: sticky; top: 0; z-index: 19; width: auto; margin: 0 calc(-1 * var(--gutter)) 6px; padding: 6px var(--gutter); background: var(--bg); }
  .page-top .page-tools .search { flex: 1; width: auto; }
  .page-top.is-stuck .page-tools { box-shadow: 0 1px 0 var(--line), 0 6px 12px -8px var(--shadow); }
  .page-top > :last-child { margin-bottom: 18px; }
  body.is-public .page-top .page-tools { top: 68px; }
}
@media (max-width: 860px) {
  body.has-sidebar .page-top .page-tools { top: 56px; }
}

/* ---------- file pages: one «Nuovo» button with new folder and upload (its menu opens to the left, inside the page) ---------- */
.menu-panel-end { left: auto; right: 0; }
.page-top:has(.menu-panel:not([hidden])) { z-index: 21; }   /* the open menu goes over the selection bar */
/* the back arrow goes before the path */
.page-path { display: flex; align-items: center; gap: 12px; flex: 1 1 auto; min-width: 0; }
.page-path .back-btn { flex: none; }
.page-top .page-path .crumbs { margin-bottom: 0; }
@media (max-width: 760px), (max-height: 560px) {
  .page-top .page-path { margin-bottom: 8px; }
}

/* ---------- small screens: the grid / list switch beside the path, out of the fixed bar (app.js) ---------- */
.page-path > .view-toggle, .crumbs > .view-toggle, .media-types > .view-toggle { flex: none; margin-left: auto; }

/* ---------- file pages, top row: path on the left, search in the centre, tools and «Nuovo» on the right;
   on small screens only the search stays fixed, «Nuovo» goes beside the path (app.js) ---------- */
.page-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.page-top .page-head { display: grid; grid-template-columns: minmax(0, 3fr) minmax(200px, 4fr) minmax(max-content, 3fr); gap: 16px; }
.page-top .page-tools { display: contents; }
.page-top .page-tools > .search { grid-column: 2; justify-self: center; width: 100%; max-width: 640px; }
.page-top .page-actions { grid-column: 3; justify-self: end; }
.page-top .page-head > .h1 { margin-bottom: 0; }
@media (max-width: 760px), (max-height: 560px) {
  .page-top .page-head { display: contents; }
  .page-top .page-head > .h1 { margin-bottom: 8px; }
  .page-top .page-tools { display: flex; gap: 8px; }
  .page-top .page-tools > .search { flex: 1; width: auto; max-width: none; min-width: 0; }
  .page-top .page-actions { gap: 8px; }
}
/* the path is also the title of the page: a little larger, followed by the «⋯» of the folder and its total */
.page-path .crumbs { flex: 0 1 auto; font-size: 15px; }
.page-path .crumbs a:only-child { color: var(--ink); font-weight: 600; }
.page-path [data-live-stats] { flex: none; white-space: nowrap; }
.page-path .menu-wrap { flex: none; }
@media (max-width: 760px), (max-height: 560px) {
  .page-path { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; grid-template-areas: "back path path path dots" "stats stats view new new"; gap: 6px 0; }
  .page-path .back-btn { grid-area: back; margin-right: 8px; }
  .page-path .crumbs { grid-area: path; }
  .page-path > .menu-wrap { grid-area: dots; justify-self: end; }
  .page-path > .view-toggle { grid-area: view; margin: 0; }
  .page-path > [data-new-menu] { grid-area: new; margin-left: 8px; }
  .page-path [data-live-stats] { grid-area: stats; align-self: center; }
  .page-path > [data-new-menu] .menu-panel { right: auto; }
}
@media (max-width: 760px) {
  .page-top .page-actions { display: none; }
}
/* the top row follows the room the page really has (side bar and details panel included): when tight the path goes on a row of its own */
.page-path .crumbs { overflow: hidden; }
.page-top { container-type: inline-size; }
@container (max-width: 1250px) {
  .page-top .page-head { grid-template-columns: minmax(0, 1fr) max-content; row-gap: 10px; }
  .page-top .page-head > :first-child { grid-column: 1 / -1; }
  .page-top .page-tools > .search { grid-column: 1; max-width: none; }
  .page-top .page-actions { grid-column: 2; }
}

/* ---------- tooltips of the buttons with only an icon (app.js) ---------- */
.tip { position: fixed; z-index: 500; max-width: 280px; padding: 5px 9px; border: 1px solid rgba(255,255,255,.18); border-radius: 6px; background: #1d1d1b; color: #fff; font-size: 12.5px; line-height: 1.35; pointer-events: none; box-shadow: 0 4px 14px rgba(0,0,0,.3); }

/* ---------- computers: the top row of the file pages is as tall as the logo area of the side bar, and their lines meet ---------- */
@media (min-width: 761px) and (min-height: 561px) {
  .container:has(> .page-top) { padding-top: 0; }
  .container:has(> .page-top) > .alert:first-of-type { margin-top: 16px; }
  .page-top { margin-top: 0; margin-bottom: 18px; padding-top: 0; padding-bottom: 0; }
  .page-top .page-head { align-items: center; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); border-bottom: 1px solid var(--line); }
  .page-top .page-head > :first-child { min-height: 67px; }
  .page-top .page-head > .h1 { display: flex; align-items: center; }
  .page-top .media-types { margin: 12px 0; }
  .page-top.is-stuck { box-shadow: 0 6px 12px -8px var(--shadow); }
}
@container (max-width: 1250px) {
  .page-top .page-head { padding-bottom: 10px; }
}
@media (max-width: 760px), (max-height: 560px) {
  .page-top .page-head { padding-bottom: 0; }
}

/* ---------- phones and small tablets: in the fixed top bar only the pictogram of the logo and the search (app.js moves it there) ---------- */
.brand .brand-mini { display: none; }
@media (max-width: 860px) {
  .brand .site-logo { display: none; }
  .brand .brand-mini { display: block; width: 32px; height: 32px; object-fit: contain; }
  .brand { flex: none; }
  .topbar-inner > .search { flex: 1 1 0; width: auto; max-width: none; min-width: 0; margin-left: 4px; }
  .topbar-inner > .search input { min-height: 40px; }
}
/* what stayed in the fixed bar under it has moved beside the path: no empty bar */
@media (max-width: 760px), (max-width: 860px) and (max-height: 560px) {
  .page-top .page-tools:not(:has(> .search)) { display: none; }
}

/* ---------- the menu of the folder («⋯» and right click): long, so it scrolls if the window is low; lines only between groups ---------- */
.menu-panel[data-folder-menu] [role=menuitem][hidden] { display: none; }
.menu-panel[data-folder-menu] .ctx-sep:first-child, .menu-panel[data-folder-menu] .ctx-sep:last-child, .menu-panel[data-folder-menu] .ctx-sep + .ctx-sep { display: none; }
@media (min-width: 761px) {
  .ctx-menu { max-height: calc(100vh - 16px); overflow-y: auto; }
  .menu-panel[data-folder-menu] { max-height: calc(100vh - 90px); }
}

/* ---------- download report ---------- */
.report-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.report-stat { display: block; padding: 12px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: inherit; }
.report-stat strong { display: block; font-size: 24px; line-height: 1.2; }
.report-stat.is-active { border-color: var(--primary); outline: 1px solid var(--primary); }
.report-when summary { cursor: pointer; }
.report-when ul { margin: 4px 0 0; padding: 0; list-style: none; }

/* File requests: the page for whoever has the link (on .dl-page) and the pages of whoever manages them */
body.rq-page { padding-top: 12px; padding-bottom: 12px; }
.dl-card.rq-card { width: 520px; gap: 10px; padding: 20px 24px; }
.rq-card h1 { margin-bottom: 2px; font-size: 20px; }
.rq-card .dl-sub { font-size: 13px; }
.rq-card .dl-message { max-height: 76px; overflow-y: auto; padding: 8px 12px; font-size: 13px; }
.rq-form { display: flex; flex-direction: column; gap: 10px; }
.rq-form label { display: flex; flex-direction: column; gap: 4px; min-width: 0; font-size: 13px; font-weight: 600; color: #3b3c40; }
.rq-form input[type=text], .rq-form input[type=email] { width: 100%; padding: 9px 12px; border: 1px solid #d4d4d7; border-radius: 12px; font: inherit; font-size: 16px; font-weight: 400; }
.rq-who { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.rq-note { margin: 0; font-size: 12px; line-height: 1.45; color: #6a6b70; }
.rq-note summary { cursor: pointer; }
.rq-drop { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 12px; border: 2px dashed #c9c9cd; border-radius: 14px; color: #55565a; font-size: 14px; text-align: center; cursor: pointer; }
.rq-drop:hover, .rq-drop:focus-visible, .rq-drop.is-over { border-color: var(--primary); background: color-mix(in oklab, var(--primary) 6%, #fff); }
.rq-count { font-weight: 600; color: #3b3c40; }
.rq-files { max-height: min(150px, 22vh); }
.rq-files:empty { display: none; }
.rq-files li { justify-content: space-between; padding: 4px 8px; }
.rq-files .dl-file-name { display: flex; align-items: baseline; gap: 8px; }
.rq-files .dl-file-name strong { flex: 1; min-width: 0; }
.rq-files .dl-file-name small { flex: none; }
.rq-files .rq-failed .dl-file-name { display: block; }
.rq-files .rq-failed small { color: #b3261e; }
/* The list says it scrolls, also where the system hides the scrollbars */
.rq-files::-webkit-scrollbar { width: 8px; }
.rq-files::-webkit-scrollbar-thumb { border-radius: 8px; background: #c9c9cd; }
/* The button stays in sight however long the page gets */
.rq-send { position: sticky; bottom: 0; z-index: 1; margin: 0 -24px -20px; padding: 8px 24px 20px; border-radius: 0 0 20px 20px; background: #fff; }
.rq-send .dl-go { padding: 12px 20px; }
@media (max-width: 640px) {
  body.dl-page.rq-page { flex-direction: column; align-items: center; justify-content: flex-start; gap: 12px; }
  .rq-page .dl-foot { position: static; }
  .rq-who { grid-template-columns: 1fr; }
  .dl-card.rq-card { padding: 16px; }
  .rq-send { margin: 0 -16px -16px; padding: 8px 16px 16px; }
}
.rq-intro { max-width: 720px; }
.rq-new { max-width: 720px; }
.rq-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.rq-slider output { display: block; font-weight: 400; font-variant-numeric: tabular-nums; }
.rq-slider input[type=range] { display: block; width: 100%; margin: 6px 0 0; padding: 0; border: 0; background: none; accent-color: var(--primary); cursor: pointer; }
.rq-types { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 0; padding: 0; border: 0; }
.rq-types legend { padding: 0 0 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.rq-head { margin-bottom: 16px; }
.rq-pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.rq-sub { margin-top: 12px; padding: 16px 20px; }
.rq-sub-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; overflow-wrap: anywhere; }
.rq-items { list-style: none; margin: 0; padding: 0; }
.rq-items li { display: flex; justify-content: space-between; align-items: center; gap: 8px 16px; flex-wrap: wrap; padding: 10px 0; border-top: 1px solid var(--line); }
.rq-item-name { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; min-width: 0; overflow-wrap: anywhere; }
.rq-items li.is-busy { opacity: .5; pointer-events: none; }
@media (max-width: 760px) { .rq-items .btn { min-height: 40px; } }

/* ---------- search box: suggestions while typing, as in Google Drive (search.js) ---------- */
.search input[type=search] { padding-right: 38px; }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; background: none; color: var(--muted); cursor: pointer; }
.search-clear:hover { background: var(--hover); color: var(--ink); }
.search-clear[hidden] { display: none; }
.search .search-clear .icon, .search .search-panel .icon { position: static; transform: none; color: inherit; }
.search-panel { position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 50; padding: 8px 0 0; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 40px rgba(0,0,0,.18); max-height: min(72vh, 560px); overflow-y: auto; }
.search-panel[hidden] { display: none; }
.page-top:has(.search-panel:not([hidden])) { z-index: 45; }
.search-panel ul { list-style: none; margin: 0; padding: 0 8px; }
.search-panel a { color: var(--ink); text-decoration: none; }
.ss-item { display: flex; align-items: center; gap: 14px; padding: 8px 10px; border-radius: 10px; }
.ss-item:hover, .ss-item.active, .ss-all:hover, .ss-all.active { background: var(--hover); }
.ss-icon { flex: none; display: grid; place-items: center; color: var(--muted); }
.ss-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ss-name, .ss-where { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss-name { font-size: 15px; }
.ss-name mark { background: none; color: inherit; font-weight: 700; }
.ss-where { font-size: 13px; color: var(--muted); }
.ss-where mark { background: none; color: var(--ink); font-weight: 700; }
.ss-date { flex: none; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ss-none { padding: 10px 18px 12px; font-size: 14px; color: var(--muted); }
.search-panel .ss-all { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 6px; padding: 12px 18px; border-top: 1px solid var(--line-2); font-size: 14px; color: var(--primary); }
.ss-enter { font-size: 16px; line-height: 1; }
@media (max-width: 860px) {
  .topbar-inner > .search .search-panel { position: fixed; left: 8px; right: 8px; top: 58px; max-height: calc(100vh - 76px); max-height: calc(100dvh - 76px); }
}

/* «Dal telefono»: the QR code in the upload window (phone-qr.js) and the page it opens on the phone (phone-upload.js) */
.dialog-phone[open] { width: 400px; padding: 24px; display: flex; flex-direction: column; gap: 12px; }
.dialog-phone p { margin: 0; }
.phone-qr { align-self: center; display: grid; place-items: center; width: 216px; height: 216px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); line-height: 0; }
.phone-qr:empty::after { content: ''; width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
.phone-qr svg { width: 200px; height: 200px; }
.phone-qr.is-off svg { opacity: .15; }
.phone-state { font-weight: 600; text-align: center; }
.phone-files { list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--ink-2); }
.phone-files:empty { display: none; }
.phone-files li { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.phone-files li::before { content: '✓ '; color: var(--primary); }
.phone-files li.muted::before { content: ''; }
@media (pointer: coarse) { [data-phone-qr] { display: none; } }
.ph-up { display: flex; flex-direction: column; gap: 10px; }
.ph-picks { display: grid; gap: 10px; }
.ph-picks .dl-go { display: flex; align-items: center; justify-content: center; gap: 8px; }
.ph-picks .dl-go.ph-alt { background: #fff; color: var(--primary); box-shadow: inset 0 0 0 1.5px var(--primary); }
.ph-picks .dl-go.ph-alt:hover { background: color-mix(in oklab, var(--primary) 6%, #fff); }
.ph-files { max-height: none; }
.ph-count { margin: 0; padding: 10px 12px; border-radius: 12px; background: #f5f5f6; font-size: 14px; font-weight: 600; color: #3b3c40; }
.ph-count.is-done { background: #e7f5ec; color: #17633a; }
.ph-count.is-done::before { content: '✓ '; }
.ph-up .rq-send { margin: 0 -24px -20px; }
.ph-up .rq-send[hidden] { display: none; }
.ph-end { display: flex !important; align-items: center; justify-content: center; gap: 8px; background: #17633a !important; }
@media (max-width: 1099px) { .ph-up .rq-send { margin: 0 -16px -16px; } }
/* ---------- account menu: opened by the user card (layouts/app #dlg-areas); linking areas (areas/confirm) ---------- */
.dialog-areas { width: 400px; }
.dialog-areas .dialog-body { padding: 12px 16px 16px; display: flex; flex-direction: column; gap: 12px; }
.dialog-areas form { padding: 0; }
.acc-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-left: 8px; }
.acc-site { font-size: 13px; color: var(--grey); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acc-me { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; padding-bottom: 4px; }
.acc-me strong { font-size: 17px; font-weight: 600; margin-top: 8px; }
.acc-me small { color: var(--grey); margin-bottom: 10px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.acc-avatar { display: grid; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: var(--hover); font-size: 22px; font-weight: 600; color: var(--ink-2); }
.acc-group { display: flex; flex-direction: column; padding: 4px; border: 1px solid var(--line); border-radius: calc(var(--radius) + 4px); }
.acc-row { display: flex; align-items: center; gap: 12px; width: 100%; min-width: 0; padding: 8px; border: 0; border-radius: var(--radius); background: none; color: var(--ink); font: inherit; text-align: left; text-decoration: none; cursor: pointer; list-style: none; }
.acc-row::-webkit-details-marker { display: none; }
a.acc-row:hover, button.acc-row:hover, summary.acc-row:hover { background: var(--hover); }
.acc-row .area-text strong { font-weight: 500; }
.acc-icon { flex: none; display: grid; place-items: center; width: 36px; height: 36px; color: var(--ink-2); }
.acc-lang { cursor: default; }
.acc-lang form { flex: none; }
.acc-lang select { width: auto; }
.area-section { padding: 6px 8px 2px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--grey); }
.area-row { display: flex; align-items: center; gap: 4px; }
.area-logo { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: #fff; object-fit: contain; padding: 4px; }
.area-initial { position: relative; display: grid; place-items: center; overflow: hidden; padding: 0; font-weight: 600; color: var(--ink-2); }
.area-initial img { position: absolute; inset: 0; width: 100%; height: 100%; padding: 4px; object-fit: contain; background: #fff; }
.area-text { flex: 1; display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.area-text strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.area-text small { font-size: 12px; color: var(--grey); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.area-add .form { padding: 4px 8px 8px; gap: 8px; }
.area-pair { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 8px 0 16px; }
.area-card { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; padding: 14px 10px; border: 1px solid var(--line); border-radius: var(--radius); text-align: center; }
.area-card small { font-size: 12px; color: var(--grey); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.area-card-logo { max-width: 120px; height: 36px; object-fit: contain; margin-bottom: 6px; }
.area-pair-link { flex: none; color: var(--grey); }
.area-actions { justify-content: center; }
.dialog-actions-wrap { flex-wrap: wrap; }
.account-back { display: flex; flex-direction: column; align-items: center; gap: 0; margin-top: 8px; }
.account-back small { font-size: 12px; }
.acc-row .area-text small.acc-hint { white-space: normal; }
