/* GoodSense Files */
:root {
  --bg: #f5f6f8; --panel: #fff; --panel2: #f0f2f5; --ink: #141821; --muted: #6a7080; --line: #e4e7ec;
  --accent: #2457e6; --accent-soft: #e8eefd; --accent-ink: #fff; --danger: #d63939; --ok: #12a150;
  --shadow: 0 10px 30px rgba(16, 24, 40, .12); --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115; --panel: #171a21; --panel2: #1f232c; --ink: #e9ecf2; --muted: #9399a8; --line: #2a2f3a;
    --accent: #5b84ff; --accent-soft: #1d2747; --danger: #ff6b6b; --shadow: 0 10px 30px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html.no-scroll { overflow: hidden; }
body { background: var(--bg); color: var(--ink); font: 15px/1.45 Inter, system-ui, -apple-system, "Segoe UI", sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
input, textarea, select, button { font: inherit; color: inherit; }
input[type=text], input[type=password], input[type=search], input[type=date], input[type=email], input[type=number], textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel); outline: none;
}
input:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- pulsanti */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); color: var(--ink); font-weight: 600; cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--panel2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-text { color: var(--danger); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--panel2); }
.btn.small { padding: 6px 11px; font-size: 13.5px; border-radius: 8px; }
.btn.wide { width: 100%; padding: 12px; }
.btn small { font-weight: 500; opacity: .8; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border: 0; border-radius: 9px; background: transparent; color: inherit; cursor: pointer; }
.icon-btn:hover { background: var(--panel2); }
.link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-weight: 600; }
.link.small { font-size: 12.5px; font-weight: 500; margin-top: 8px; text-align: left; }

/* ---------- marchio */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
.brand b { font-weight: 800; }
.brand-mark svg { width: 30px; height: 30px; display: block; stroke: none; }
.brand-mark rect { fill: var(--accent); }
.brand-mark path { fill: #fff; }

/* ---------- pagine semplici (accesso, configurazione, password) */
body.simple { display: grid; place-items: center; min-height: 100%; padding: 24px 16px; }
.box { width: 100%; max-width: 400px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; padding: 32px 28px; box-shadow: var(--shadow); }
.box-brand { margin-bottom: 26px; }
.box h1 { font-size: 24px; margin: 0 0 6px; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; }
.form { display: grid; gap: 14px; margin-top: 20px; }
.form label, .field { display: grid; gap: 6px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.form input, .field input { color: var(--ink); font-weight: 400; font-size: 15px; }
.alert { background: #fdecec; color: #a32020; padding: 10px 12px; border-radius: 10px; font-size: 14px; margin: 12px 0 0; }
@media (prefers-color-scheme: dark) { .alert { background: #3a1717; color: #ffb4b4; } }

/* ---------- area del proprietario */
body.app { overflow: hidden; }
#app { display: grid; grid-template-columns: 240px 1fr 330px; height: 100vh; height: 100dvh; }
.side { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 18px 12px; gap: 22px; min-height: 0; }
.side .brand { padding: 0 8px; }
.side-nav { display: grid; gap: 2px; }
.side-nav a { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; color: var(--ink); font-weight: 500; }
.side-nav a:hover { background: var(--panel2); }
.side-nav a.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-bottom { margin-top: auto; display: grid; gap: 4px; }
.side-bottom .btn { justify-content: flex-start; color: var(--muted); }
.usage { padding: 0 10px 10px; font-size: 12.5px; color: var(--muted); display: grid; gap: 6px; }
.usage-bar { height: 6px; background: var(--panel2); border-radius: 9px; overflow: hidden; }
.usage-bar i { display: block; height: 100%; background: var(--accent); border-radius: 9px; }
.side-shade { display: none; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--panel); }
.crumbs { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 17px; white-space: nowrap; overflow: hidden; }
.crumbs a { color: var(--muted); font-weight: 500; }
.crumbs a:hover { color: var(--ink); }
.crumbs b { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.crumbs span { color: var(--line); }
.crumbs small { color: var(--muted); font-size: 13px; margin-left: 6px; }
.search { position: relative; width: 260px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 36px; background: var(--panel2); border-color: transparent; }
.toolbar { display: flex; align-items: center; gap: 8px; padding: 10px 20px; min-height: 54px; flex-wrap: wrap; }
.toolbar .grow { flex: 1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13.5px; color: var(--muted); }
.check input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.listing { flex: 1; overflow: auto; padding: 0 20px 110px; outline: none; }
.folder-desc { margin: 0 0 14px; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; color: var(--muted); white-space: pre-line; }

.row { display: grid; grid-template-columns: 28px 44px minmax(0, 1fr) 80px 120px 140px 40px; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; cursor: default; user-select: none; }
.row.head { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding-top: 0; }
.row:not(.head):hover { background: var(--panel); }
.row.sel, .row.sel:hover { background: var(--accent-soft); }
.row .name { min-width: 0; display: grid; }
.row .name b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .name small { display: none; color: var(--muted); font-size: 12.5px; }
.row .size, .row .date { font-size: 13.5px; color: var(--muted); }
.row .size small { display: block; font-size: 12px; }
.row .access { display: flex; gap: 6px; color: var(--accent); }
.row .access small { color: var(--muted); font-size: 12px; }
.row .more { opacity: 0; }
.row:hover .more, .row.sel .more, .card:hover .more, .card.sel .more { opacity: 1; }
.thumb { display: grid; place-items: center; overflow: hidden; background: var(--panel2); color: var(--muted); position: relative; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb.mini { width: 40px; height: 40px; border-radius: 8px; }
.thumb.k-folder { background: #fff3d6; color: #e0a100; }
.thumb.k-folder svg { fill: #ffd25e; stroke: #e0a100; width: 24px; height: 24px; }
@media (prefers-color-scheme: dark) { .thumb.k-folder { background: #3a3220; } }
.thumb.k-video { color: #7c4dff; } .thumb.k-audio { color: #e8590c; } .thumb.k-pdf { color: #e03131; } .thumb.k-image { color: #2b8a3e; }
.folder-tag { position: absolute; left: 8px; bottom: 8px; background: rgba(0, 0, 0, .55); color: #fff; border-radius: 7px; padding: 4px; display: grid; }
.folder-tag svg { width: 16px; height: 16px; stroke: #fff; fill: none; }

.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.card { position: relative; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; user-select: none; }
.card.sel { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.card .thumb.big { aspect-ratio: 4 / 3; }
.card .thumb.big > svg { width: 44px; height: 44px; }
.card .check { position: absolute; top: 8px; left: 8px; background: var(--panel); border-radius: 6px; padding: 4px; opacity: 0; }
.card:hover .check, .card.sel .check { opacity: 1; }
.card .more { position: absolute; top: 6px; right: 6px; background: var(--panel); opacity: 0; width: 30px; height: 30px; }
.card-name { padding: 9px 11px 11px; display: grid; gap: 2px; }
.card-name b { font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-name small { color: var(--muted); font-size: 12.5px; display: flex; align-items: center; gap: 4px; }
.badge { width: 15px; height: 15px; color: var(--accent); }

.empty { display: grid; justify-items: center; gap: 8px; padding: 80px 20px; color: var(--muted); text-align: center; }
.empty > svg { width: 52px; height: 52px; stroke-width: 1.3; }
.empty b { color: var(--ink); font-size: 17px; }
.empty.drop-target { border: 2px dashed var(--line); border-radius: 18px; margin-top: 10px; }

/* pannello dettagli */
.details { background: var(--panel); border-left: 1px solid var(--line); overflow: auto; padding: 20px; position: relative; }
.d-empty { display: grid; justify-items: center; text-align: center; gap: 10px; color: var(--muted); padding-top: 80px; font-size: 14px; }
.d-empty svg { width: 48px; height: 48px; stroke-width: 1.3; }
.d-preview { border-radius: var(--r); overflow: hidden; background: var(--panel2); aspect-ratio: 16 / 10; display: grid; place-items: center; color: var(--muted); }
.d-preview img { width: 100%; height: 100%; object-fit: cover; }
.d-preview svg { width: 54px; height: 54px; stroke-width: 1.4; }
.d-preview.k-folder svg { fill: #ffd25e; stroke: #e0a100; }
.d-name { display: flex; align-items: flex-start; gap: 4px; font-size: 17px; margin: 14px 0 4px; word-break: break-word; }
.d-name .icon-btn { width: 28px; height: 28px; margin-top: -3px; color: var(--muted); }
.d-meta { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.d-desc { resize: vertical; font-size: 14px; min-height: 44px; }
.d-sec { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; display: grid; gap: 10px; }
.d-row { display: flex; align-items: center; gap: 10px; justify-content: space-between; font-size: 14px; min-height: 30px; }
.d-row b { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.d-row b svg { color: var(--accent); }
.d-row.muted b { color: var(--ink); }
.d-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.copybox { display: flex; gap: 6px; }
.copybox input { font-size: 13px; padding: 7px 9px; background: var(--panel2); }
.date-in { width: auto !important; padding: 5px 8px !important; font-size: 13px; }
.pill { background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 99px; margin-left: auto; }
.embed { font-size: 13px; }
.embed summary { cursor: pointer; color: var(--muted); }
.embed label { display: grid; gap: 4px; margin-top: 8px; color: var(--muted); }
.embed input { font-size: 12px; padding: 6px 8px; }
.d-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 18px; }
.d-actions .btn { font-size: 13.5px; padding: 8px 10px; }
.switch { position: relative; display: inline-block; width: 40px; height: 23px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch i { position: absolute; inset: 0; background: var(--line); border-radius: 99px; transition: .2s; cursor: pointer; }
.switch i::after { content: ""; position: absolute; width: 17px; height: 17px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.switch input:checked + i { background: var(--ok); }
.switch input:checked + i::after { transform: translateX(17px); }
.only-mobile, .only-narrow { display: none !important; }

/* pulsante + */
.fab { position: fixed; right: 360px; bottom: 26px; width: 58px; height: 58px; border-radius: 50%; border: 0; background: var(--accent); color: #fff; box-shadow: 0 8px 24px rgba(36, 87, 230, .45); cursor: pointer; display: grid; place-items: center; z-index: 20; }
.fab svg { width: 26px; height: 26px; stroke-width: 2.4; }
.fab-menu { position: fixed; right: 360px; bottom: 96px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; display: grid; z-index: 21; min-width: 210px; }
.fab-menu button, .ctx button { display: flex; align-items: center; gap: 12px; border: 0; background: none; padding: 10px 12px; border-radius: 9px; cursor: pointer; text-align: left; font-weight: 500; }
.fab-menu button:hover, .ctx button:hover { background: var(--panel2); }
.ctx { position: fixed; z-index: 60; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 5px; display: grid; min-width: 200px; }
.ctx button { padding: 8px 12px; font-size: 14px; }
.ctx button.danger { color: var(--danger); }
.ctx hr { border: 0; border-top: 1px solid var(--line); margin: 4px 0; }

.drop-hint { position: fixed; inset: 0; z-index: 70; background: rgba(36, 87, 230, .12); border: 3px dashed var(--accent); display: grid; place-items: center; pointer-events: none; opacity: 0; transition: opacity .15s; }
.drop-hint.on { opacity: 1; }
.drop-hint div { background: var(--panel); padding: 26px 34px; border-radius: 18px; box-shadow: var(--shadow); display: grid; justify-items: center; gap: 6px; }
.drop-hint svg { width: 40px; height: 40px; color: var(--accent); }
.drop-hint span { color: var(--muted); font-size: 14px; }

/* avanzamento caricamenti */
.uploads { position: fixed; left: 20px; bottom: 20px; width: 360px; max-width: calc(100vw - 32px); background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); z-index: 40; overflow: hidden; }
body.app .uploads { left: 260px; }
.up-head { display: flex; align-items: center; gap: 8px; padding: 10px 8px 10px 14px; }
.up-title { flex: 1; font-size: 14px; }
.up-pct { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.up-head .icon-btn { width: 30px; height: 30px; }
.up-bar { height: 3px; background: var(--panel2); }
.up-bar i, .up-mini i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.uploads.finished .up-bar i { background: var(--ok); }
.up-list { max-height: 260px; overflow: auto; padding: 4px 0; }
.uploads.collapsed .up-list { display: none; }
.up-row { display: grid; grid-template-columns: 1fr auto 28px; align-items: center; gap: 6px; padding: 5px 8px 5px 14px; font-size: 13px; }
.up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-state { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.up-row .icon-btn { width: 26px; height: 26px; }
.up-row .icon-btn svg { width: 14px; height: 14px; }
.up-mini { grid-column: 1 / -1; height: 2px; background: var(--panel2); border-radius: 2px; overflow: hidden; }
.up-row[data-state=done] .up-mini i { background: var(--ok); }
.up-row[data-state=done] .up-x, .up-row[data-state=error] .up-x { visibility: hidden; }
.up-row[data-state=error] .up-state { color: var(--danger); }

.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); background: #1d2230; color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 14px; z-index: 90; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.toast.bad { background: var(--danger); }

/* finestre */
.modal-wrap { position: fixed; inset: 0; z-index: 80; background: rgba(10, 14, 22, .45); display: grid; place-items: center; padding: 16px; }
.modal { width: 100%; max-width: 440px; background: var(--panel); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); }
.modal h2 { margin: 0 0 14px; font-size: 19px; }
.modal-body { display: grid; gap: 12px; }
.modal-body p { margin: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.picker-path { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.picker-path a { cursor: pointer; }
.picker-list { border: 1px solid var(--line); border-radius: 10px; max-height: 280px; overflow: auto; padding: 4px; }
.picker-list button { display: flex; width: 100%; align-items: center; gap: 10px; border: 0; background: none; padding: 9px 10px; border-radius: 8px; cursor: pointer; text-align: left; }
.picker-list button:hover { background: var(--panel2); }
.picker-list svg { color: #e0a100; fill: #ffd25e; }
.picker-list p { padding: 10px; margin: 0; }

/* ---------- visualizzatore */
.viewer { position: fixed; inset: 0; z-index: 100; background: rgba(8, 9, 12, .96); color: #fff; display: grid; grid-template-rows: auto 1fr; }
.v-top { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 18px; }
.v-count { color: #9aa0ad; font-size: 13px; font-variant-numeric: tabular-nums; }
.v-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.viewer .icon-btn { color: #fff; }
.viewer .icon-btn:hover { background: rgba(255, 255, 255, .12); }
.v-stage { display: grid; place-items: center; min-height: 0; overflow: auto; padding: 0 64px 20px; }
.v-stage img { max-width: 100%; max-height: calc(100vh - 80px); max-height: calc(100dvh - 80px); object-fit: contain; cursor: zoom-in; border-radius: 4px; }
.v-stage img.zoom { max-width: none; max-height: none; cursor: zoom-out; }
.v-stage video { max-width: 100%; max-height: calc(100dvh - 90px); background: #000; border-radius: 6px; }
.v-stage iframe { width: min(1000px, 100%); height: calc(100dvh - 90px); border: 0; background: #fff; border-radius: 6px; }
.v-card { display: grid; justify-items: center; gap: 12px; background: #1b1e26; padding: 34px; border-radius: 16px; text-align: center; max-width: 420px; }
.v-card > svg { width: 56px; height: 56px; stroke-width: 1.3; }
.v-card span { color: #9aa0ad; }
.v-nav { position: fixed; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .1); color: #fff; cursor: pointer; display: grid; place-items: center; }
.v-nav:hover { background: rgba(255, 255, 255, .2); }
.v-prev { left: 10px; } .v-next { right: 10px; }

/* ---------- pagine pubbliche */
body.public { min-height: 100%; }
.pub-top { padding: 16px 24px; background: var(--panel); border-bottom: 1px solid var(--line); }
.hero { position: relative; overflow: hidden; background: #1c2331; color: #fff; }
.hero-bg { position: absolute; inset: -30px; background-size: cover; background-position: center; filter: blur(14px) brightness(.55); transform: scale(1.06); }
.hero-in { position: relative; max-width: 1400px; margin: 0 auto; padding: 46px 24px 40px; }
.hero h1 { font-size: clamp(30px, 5vw, 52px); line-height: 1.05; margin: 10px 0 10px; letter-spacing: -.03em; word-break: break-word; }
.hero-desc { margin: 0 0 12px; max-width: 760px; color: #e3e6ee; }
.hero-meta { margin: 0; color: #c8cdd8; font-size: 14px; }
.owner { display: flex; align-items: center; gap: 10px; font-weight: 600; margin: 0; font-size: 14.5px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 14px; }
.pub-crumbs { display: flex; gap: 8px; font-size: 14px; flex-wrap: wrap; margin-bottom: 14px; }
.pub-crumbs a { color: #cfd5e2; } .pub-crumbs span { color: #7c8496; }
.pub-bar { max-width: 1400px; margin: 0 auto; padding: 16px 24px; display: flex; gap: 10px; flex-wrap: wrap; }
.pub-main { max-width: 1400px; margin: 0 auto; padding: 0 24px 40px; }
.pub-folders { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.pub-folder { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; color: var(--ink); display: grid; }
.pub-folder:hover { border-color: var(--accent); }
.pf-img { aspect-ratio: 4 / 3; background: #fff3d6; display: grid; place-items: center; overflow: hidden; }
.pf-img img { width: 100%; height: 100%; object-fit: cover; }
.pf-img svg { width: 48px; height: 48px; fill: #ffd25e; stroke: #e0a100; }
.pub-folder b { padding: 10px 12px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-folder small { padding: 0 12px 11px; color: var(--muted); }
.jgrid { --rh: 230px; display: flex; flex-wrap: wrap; gap: 5px; }
.jgrid::after { content: ""; flex-grow: 999999; }
.jtile { position: relative; display: block; width: calc(var(--r) * var(--rh)); background: var(--panel2); overflow: hidden; border-radius: 4px; }
.jtile i { display: block; }
.jtile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.jtile:hover img { transform: scale(1.03); }
.jtile .vid { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 8px; background: linear-gradient(135deg, #222838, #3b2a55); color: #fff; padding: 10px; text-align: center; }
.jtile .vid svg { width: 46px; height: 46px; background: rgba(255, 255, 255, .18); border-radius: 50%; padding: 11px; stroke: none; }
.jtile .vid small { font-size: 12px; opacity: .85; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.pub-files { margin-top: 22px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.pub-file { display: grid; grid-template-columns: 28px 1fr auto 36px; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line); }
.pub-file:first-child { border-top: 0; }
.pub-file a[data-i] { color: var(--ink); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pub-file small { color: var(--muted); }
.pub-file .ic { color: var(--muted); }
.pub-foot { text-align: center; color: var(--muted); font-size: 13px; padding: 10px 0 30px; }
.h-ic { width: 24px; height: 24px; color: var(--accent); }

.recv { max-width: 620px; margin: 0 auto; padding: 40px 20px 140px; display: grid; gap: 14px; }
.recv h1 { margin: 6px 0 0; font-size: 34px; letter-spacing: -.02em; }
.recv .muted { margin: 0; }
.dropzone { border: 2px dashed var(--line); border-radius: 18px; background: var(--panel); padding: 44px 20px; display: grid; justify-items: center; gap: 12px; text-align: center; transition: .15s; }
.dropzone.on { border-color: var(--accent); background: var(--accent-soft); }
.dropzone > svg { width: 44px; height: 44px; color: var(--accent); }
.dz-btns { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.thanks { background: #e7f7ee; color: #0b6b35; padding: 14px 16px; border-radius: 12px; font-weight: 600; margin: 0; }
@media (prefers-color-scheme: dark) { .thanks { background: #10301f; color: #8be3ad; } }

/* selezione nella galleria pubblica */
body.picking .jtile::before { content: ""; position: absolute; z-index: 2; top: 8px; left: 8px; width: 24px; height: 24px; border-radius: 50%; border: 2px solid #fff; background: rgba(0, 0, 0, .25); box-shadow: 0 1px 4px rgba(0, 0, 0, .3); }
body.picking .jtile.picked::before { background: var(--accent) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m6 12 4 4 8-8' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 16px no-repeat; border-color: var(--accent); }
body.picking .jtile.picked { outline: 3px solid var(--accent); outline-offset: -3px; }
body.picking .jtile.picked img { transform: scale(.94); }
body.picking .pub-file a[data-i] { cursor: pointer; }
body.picking .pub-file.picked { background: var(--accent-soft); }
body.picking #pick-btn { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
.selbar { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 8px 8px 8px 16px; max-width: calc(100vw - 24px); }
.selbar b { margin-right: 8px; white-space: nowrap; font-size: 14px; }
body.picking .pub-main { padding-bottom: 100px; }


/* vendita */
.notice { background: #fff6e0; color: #7a5400; border-radius: 10px; padding: 10px 12px; margin: 0 0 14px; font-size: 14px; }
.notice.small { font-size: 13px; margin: 0; }
@media (prefers-color-scheme: dark) { .notice { background: #3a2e10; color: #ffd27a; } }
.pill.ok { background: #e3f6ea; color: #0b6b35; margin: 0; }
@media (prefers-color-scheme: dark) { .pill.ok { background: #10301f; color: #8be3ad; } }
.sale-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sale-grid label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.sale-grid input, .sale-grid select { width: 100%; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-size: 14px; }
.sale-sec textarea { font-size: 13px; }
.sale-sec .field { font-weight: 600; }
.mh { font-size: 14px; margin: 10px 0 0; padding-top: 12px; border-top: 1px solid var(--line); }
.modal { max-height: calc(100dvh - 32px); overflow: auto; }
.modal code, .d-sec code { font-size: 12px; background: var(--panel2); padding: 1px 5px; border-radius: 5px; word-break: break-all; }
.sales { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.srow { display: grid; grid-template-columns: 130px minmax(0, 1.3fr) minmax(0, 1fr) 140px 100px 220px; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); align-items: center; font-size: 14px; }
.srow.head { border-top: 0; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.srow small { color: var(--muted); }
.ell { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-info { max-width: 1400px; margin: 0 auto; padding: 0 24px 14px; color: var(--muted); font-size: 14px; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.shop-info b { color: var(--ink); }
.shop-info svg { color: var(--accent); }
.price-tag { position: absolute; z-index: 1; right: 6px; bottom: 6px; background: rgba(0, 0, 0, .62); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 8px; border-radius: 99px; pointer-events: none; }
.buy-what { margin: -6px 0 4px; color: var(--muted); }
.buy-res { display: grid; gap: 8px; }
.radio { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: pointer; }
.radio:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.radio input { margin-top: 3px; accent-color: var(--accent); }
.radio span { display: grid; }
.radio small { color: var(--muted); }
.buy-total { font-size: 17px; margin: 4px 0 0; }
.buy-total s { color: var(--muted); font-size: 14px; }
.license { font-size: 13px; color: var(--muted); }
.license summary { cursor: pointer; font-weight: 600; }
.license p { white-space: normal; margin: 6px 0 0; }
.order .btn.wide { margin-top: 4px; }
.order-list { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.order-item { display: grid; grid-template-columns: 40px 1fr auto; gap: 12px; align-items: center; padding: 8px 12px; border-top: 1px solid var(--line); }
.order-item:first-child { border-top: 0; }
.oi-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- schermi stretti */
@media (max-width: 1100px) {
  #app { grid-template-columns: 240px 1fr; }
  .details { position: fixed; inset: 0 0 0 auto; width: min(400px, 100vw); z-index: 50; transform: translateX(100%); transition: transform .2s; box-shadow: var(--shadow); }
  .details.open { transform: none; }
  .only-narrow { display: inline-grid !important; }
  .d-close { position: absolute; top: 10px; right: 10px; z-index: 2; background: var(--panel); }
  .fab, .fab-menu { right: 26px; }
}
@media (max-width: 760px) {
  #app { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 55; transform: translateX(-100%); transition: transform .2s; }
  body.side-open .side { transform: none; box-shadow: var(--shadow); }
  body.side-open .side-shade { display: block; position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 54; }
  .only-mobile { display: inline-grid !important; }
  .topbar { padding: 10px 12px; flex-wrap: wrap; gap: 8px; }
  .crumbs { order: 2; flex-basis: 100%; font-size: 15px; }
  .search { flex: 1; width: auto; }
  .toolbar, .listing { padding-left: 12px; padding-right: 12px; }
  .row { grid-template-columns: 26px 44px minmax(0, 1fr) 36px; }
  .row.head { display: none; }
  .row .access, .row .size, .row .date { display: none; }
  .row .name small { display: block; }
  .row .more { opacity: 1; }
  .cards { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .card .check, .card .more { opacity: 1; }
  body.app .uploads { left: 16px; right: 16px; width: auto; bottom: 16px; }
  .v-stage { padding: 0 6px 12px; }
  .v-nav { top: auto; bottom: 18px; transform: none; }
  .jgrid { --rh: 120px; gap: 3px; }
  .hero-in { padding: 30px 16px 26px; }
  .pub-bar, .pub-main { padding-left: 16px; padding-right: 16px; }
  .pub-top { padding: 12px 16px; }
  .pub-folders { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .selbar { left: 12px; right: 12px; transform: none; padding-left: 12px; }
  .srow { grid-template-columns: 1fr auto; gap: 2px 10px; }
  .srow.head { display: none; }
  .srow > span:nth-child(3), .srow > span:nth-child(4) { grid-column: 1; font-size: 13px; color: var(--muted); }
  .shop-info { padding: 0 16px 12px; font-size: 13px; }
  .selbar b { flex: 1; font-size: 13px; }
}
