@font-face { font-family: 'Public Sans'; font-style: normal; font-weight: 300 800; font-display: swap;
  src: url(fonts/public-sans-latin.woff2) format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Public Sans'; font-style: normal; font-weight: 300 800; font-display: swap;
  src: url(fonts/public-sans-latin-ext.woff2) format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  --bg: #EEF1F4; --surface: #FFFFFF; --surface-2: #F6F8FA; --ink: #18202E; --muted: #5B6576; --line: #D5DBE3;
  --ok: #1E7A55; --ok-soft: #E2F2EA; --bad: #B3364A; --bad-soft: #F8E4E7; --warn: #8F6310; --warn-soft: #F7EDD6;
  --accent: #2B4ACB; --accent-ink: #FFFFFF; --accent-soft: #E3E8F9;
  --radius: 12px; --shadow: 0 1px 2px rgba(20, 30, 50, .06), 0 4px 16px rgba(20, 30, 50, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161D; --surface: #1B212B; --surface-2: #161B23; --ink: #E7EBF1; --muted: #98A2B3; --line: #2C3441;
    --ok: #4CC08D; --ok-soft: #173328; --bad: #F0798A; --bad-soft: #3A1E24; --warn: #E0B04F; --warn-soft: #3A2F17;
    --accent: #8198FF; --accent-ink: #0E1320; --accent-soft: #232C48; --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 'Public Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; }
a { color: var(--accent); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
.wrap { max-width: 860px; margin: 0 auto; padding: 16px 16px 64px; }
.top { display: flex; align-items: center; gap: 12px; padding: 14px 16px; max-width: 860px; margin: 0 auto; }
.top .logo { font-weight: 800; font-size: 1.1rem; letter-spacing: -.01em; display: flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.top .logo svg { color: var(--accent); }
.top .spacer { flex: 1; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 14px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.stack > * + * { margin-top: 12px; }
.hidden { display: none !important; }

button, .btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 10px;
  padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; line-height: 1.3; white-space: nowrap; }
button:hover, .btn:hover { border-color: var(--muted); }
button:disabled { opacity: .5; cursor: default; }
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
button.danger { color: var(--bad); }
button.ghost, .btn.ghost { background: transparent; border-color: transparent; padding: 6px 8px; }
button.ghost:hover, .btn.ghost:hover { background: var(--surface-2); }
button.big, .btn.big { padding: 12px 20px; font-size: 1rem; }
label { display: block; font-weight: 600; font-size: .88rem; margin-bottom: 4px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; }
input[type=text], input[type=password], input[type=number], input[type=datetime-local], select, textarea {
  font: inherit; width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--ink); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
textarea { min-height: 76px; resize: vertical; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.hint { font-size: .8rem; color: var(--muted); margin-top: 4px; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; }

.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge.attivo { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.scaduto, .badge.esaurito, .badge.eliminato { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.badge.disattivato { background: var(--warn-soft); color: var(--warn); border-color: transparent; }

.tabs { display: flex; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 4px; margin-bottom: 14px; }
.tabs button { flex: 1; border: 0; background: transparent; justify-content: center; }
.tabs button.on { background: var(--surface); box-shadow: var(--shadow); color: var(--accent); }

.drop { border: 2px dashed var(--line); border-radius: var(--radius); padding: 28px 16px; text-align: center; cursor: pointer; background: var(--surface-2); transition: .15s; }
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop svg { color: var(--accent); }
.drop strong { display: block; font-size: 1.05rem; margin: 6px 0 2px; }

.files { list-style: none; margin: 0; padding: 0; }
.files li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.files li:first-child { border-top: 0; }
.files .name { font-weight: 600; overflow-wrap: anywhere; }
.files .meta { font-size: .8rem; color: var(--muted); }
.thumb { width: 48px; height: 48px; border-radius: 8px; flex: none; background: var(--surface-2); border: 1px solid var(--line);
  display: grid; place-items: center; overflow: hidden; color: var(--muted); font-size: .65rem; font-weight: 800; text-transform: uppercase; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
button.thumb { padding: 0; cursor: zoom-in; }
.bar { height: 6px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin-top: 6px; border: 1px solid var(--line); }
.bar > div { height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.bar.done > div { background: var(--ok); }
.bar.err > div { background: var(--bad); }

.links { list-style: none; margin: 0; padding: 0; }
.links li { display: block; }
.links a { display: flex; gap: 12px; align-items: center; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  margin-bottom: 8px; color: var(--ink); text-decoration: none; box-shadow: var(--shadow); }
.links a:hover { border-color: var(--accent); }
.links .title { font-weight: 700; overflow-wrap: anywhere; }

.linkbox { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 8px 8px 12px; }
.linkbox .mono { flex: 1; min-width: 0; overflow-wrap: anywhere; font-size: .9rem; }
.usage { min-width: 140px; }
.usage .bar { margin-top: 2px; }
.notice { padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: .9rem; }
.notice.ok { background: var(--ok-soft); color: var(--ok); }
.notice.bad { background: var(--bad-soft); color: var(--bad); }
.events { list-style: none; padding: 0; margin: 0; font-size: .88rem; }
.events li { padding: 6px 0; border-top: 1px solid var(--line); display: flex; gap: 10px; }
.events li:first-child { border-top: 0; }
.events time { color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
details > summary { cursor: pointer; font-weight: 700; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: '▸ '; color: var(--muted); }
details[open] > summary::before { content: '▾ '; }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 10px;
  font-weight: 600; opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 50; max-width: calc(100% - 32px); }
#toast.on { opacity: 1; }

/* anteprima a tutto schermo */
.viewer { position: fixed; inset: 0; background: rgba(8, 10, 14, .92); z-index: 40; display: flex; flex-direction: column; color: #eee; }
.viewer header { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.viewer header .grow { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer header button, .viewer header .btn { background: rgba(255, 255, 255, .1); color: #fff; border-color: transparent; }
.viewer .body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 0 12px 12px; position: relative; }
.viewer img, .viewer video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.viewer audio { width: min(520px, 100%); }
.viewer pre { background: #0f1319; color: #dde3ea; margin: 0; padding: 16px; border-radius: 8px; width: min(900px, 100%); max-height: 100%; overflow: auto;
  font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.viewer .nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255, 255, 255, .12); color: #fff; border: 0; font-size: 1.6rem; padding: 8px 14px; }
.viewer .nav.prev { left: 12px; } .viewer .nav.next { right: 12px; }

@media (max-width: 600px) {
  .wrap { padding: 8px 12px 64px; }
  .card { padding: 14px; }
  .files .actions .lbl { display: none; }
  .hide-sm { display: none; }
}
