/* Atelier – Artisti Informatici
   Impostazione coerente con il Server Gestione Licenze: barra scura con logo bianco, menù laterale a gruppi. */
:root {
  --accent: #2563eb;
  --bar: #1b2130;
  --bar-2: #262e40;
  --bar-text: #e8ebf2;
  --bg: #f4f5f8;
  --card: #fff;
  --text: #1c2230;
  --muted: #6b7385;
  --line: #e3e6ec;
  --danger: #c2372f;
  --ok: #1d7a46;
  --warn: #a85d00;
  --radius: 10px;
  --side: 236px;
  --soft: color-mix(in srgb, var(--accent) 10%, transparent);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", sans-serif; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.5rem; margin: 0 0 .2rem; letter-spacing: -.01em; }
h2 { font-size: 1.02rem; margin: 1.4rem 0 .7rem; display: flex; align-items: center; gap: 8px; }
.card > h2:first-child, form > h2:first-of-type, .card > form:first-child > h2:first-of-type { margin-top: 0; }
small, .muted { color: var(--muted); }
.small { font-size: .86rem; }
.nowrap { white-space: nowrap; }
.mono, code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
code { background: #eef0f3; padding: 1px 5px; border-radius: 4px; font-size: .9em; }
.ic { width: 18px; height: 18px; flex: none; vertical-align: -3px; }

/* ---------- Barra superiore scura ---------- */
.topbar { display: flex; align-items: center; gap: 14px; height: 58px; padding: 0 20px; background: var(--bar); color: var(--bar-text); position: sticky; top: 0; z-index: 30; }
.topbar .spacer { flex: 1; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; }
.brand:hover { text-decoration: none; }
.brand .logo { height: 30px; max-width: 190px; display: block; }
.brand .wordmark { font-weight: 700; letter-spacing: .02em; font-size: .98rem; color: #fff; white-space: nowrap; }
.brand .appname { padding-left: 12px; border-left: 1px solid rgba(255,255,255,.25); font-weight: 500; color: rgba(255,255,255,.85); }
.burger { display: none; background: none; border: 0; color: #fff; padding: 6px; margin-left: -6px; cursor: pointer; border-radius: 8px; }
.burger .ic { width: 22px; height: 22px; }
.who { display: flex; align-items: center; gap: 9px; color: var(--bar-text); padding: 4px 8px 4px 4px; border-radius: 30px; }
.who:hover { background: var(--bar-2); text-decoration: none; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent); color: #fff; font-size: .8rem; font-weight: 650; letter-spacing: .02em; flex: none; }
.avatar.sm { width: 26px; height: 26px; font-size: .7rem; background: #e7eaf0; color: var(--text); }
.logout { margin: 0; }
.logout button { background: none; border: 1px solid rgba(255,255,255,.22); color: var(--bar-text); border-radius: 8px; padding: 6px 12px; font: inherit; font-size: .9rem; cursor: pointer; }
.logout button:hover { background: var(--bar-2); }

/* ---------- Struttura con menù laterale ---------- */
.shell { display: flex; min-height: calc(100vh - 58px); }
.sidebar { width: var(--side); flex: none; background: var(--card); border-right: 1px solid var(--line); padding: 16px 12px; position: sticky; top: 58px; height: calc(100vh - 58px); overflow-y: auto; }
.sidebar .group + .group { margin-top: 18px; }
.sidebar .glabel { font-size: .72rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; padding: 0 10px 6px; }
.sidebar a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: var(--text); font-weight: 500; font-size: .94rem; }
.sidebar a .ic { color: var(--muted); }
.sidebar a:hover { background: var(--bg); text-decoration: none; }
.sidebar a.on { background: var(--soft); color: var(--accent); }
.sidebar a.on .ic { color: var(--accent); }
.scrim { display: none; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wrap { width: 100%; max-width: 1100px; margin: 0 auto; padding: 28px 28px 36px; flex: 1; }
body:not(.has-side) .wrap { max-width: 1000px; }
.narrow { max-width: 720px; }
.foot { text-align: center; color: var(--muted); font-size: .84rem; padding: 10px 0 26px; }

/* ---------- Testata pagina ---------- */
.pagehead { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.pagehead p { margin: .2rem 0 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; }
.crumbs { font-size: .9rem; margin-bottom: 4px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumbs span { color: var(--muted); }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 6px; }

/* ---------- Bottoni ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--card); color: var(--text); font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #c4c9d2; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); }
.btn.block { width: 100%; padding: 11px; }
.btn.big { padding: 13px 28px; font-size: 1.05rem; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn:disabled { color: var(--muted); cursor: default; text-decoration: none; }
.ib { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; border-radius: 8px; border: 0; background: none; color: var(--muted); cursor: pointer; }
.ib:hover { background: var(--bg); color: var(--text); text-decoration: none; }
.ib.danger:hover { color: var(--danger); background: #fdeeee; }
form.inline { display: inline; margin: 0; }

/* ---------- Card e moduli ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 18px; }
.form label { display: block; margin-bottom: 14px; font-weight: 500; font-size: .93rem; }
.form label small { display: block; font-weight: 400; margin-top: 4px; }
input, select, textarea { display: block; width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid #d1d5dd; border-radius: 8px; font: inherit; background: #fff; color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--soft); border-color: var(--accent); }
input[type=checkbox], input[type=radio] { display: inline; width: auto; margin: 0; accent-color: var(--accent); }
input[type=color] { padding: 3px; height: 40px; }
.check { display: flex !important; align-items: center; gap: 9px; font-weight: 400 !important; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.inputgroup { display: flex; gap: 8px; margin-top: 5px; }
.inputgroup input { margin: 0; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input { width: 150px; margin: 0; }
textarea.code { font-family: ui-monospace, Menlo, monospace; font-size: .85rem; }
.code-input { font-family: ui-monospace, Menlo, monospace; font-size: 1.25rem; letter-spacing: .22em; text-align: center; }
.search input { margin: 0; width: 240px; }

/* Campo password con occhio */
.pw { position: relative; display: block; margin-top: 5px; }
.pw input { margin: 0; padding-right: 42px; }
.pw .eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 34px; height: 34px; border: 0; background: none; color: var(--muted); cursor: pointer; border-radius: 6px; display: flex; align-items: center; justify-content: center; }
.pw .eye:hover { color: var(--text); background: var(--bg); }
.pw .eye.on { color: var(--accent); }

/* ---------- Messaggi e etichette ---------- */
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; background: #e8f5ee; color: var(--ok); border: 1px solid #c4e6d2; }
.flash.err { background: #fdeeee; color: var(--danger); border-color: #f4cccc; }
.flash.warn { background: #fff5e6; color: var(--warn); border-color: #f5ddb4; }
.tag { display: inline-flex; align-items: center; gap: 4px; font-size: .75rem; padding: 1px 8px; border-radius: 20px; background: var(--soft); color: var(--accent); font-weight: 550; vertical-align: 1px; }
.tag .ic { width: 13px; height: 13px; }
.tag.off { background: #eef0f3; color: var(--muted); }
.tag.on { background: #e8f5ee; color: var(--ok); }
.tag.warn { background: #fff5e6; color: var(--warn); }

/* ---------- Schede (impostazioni) ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { display: flex; align-items: center; gap: 7px; padding: 9px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { color: var(--accent); border-bottom-color: var(--accent); }
.radio-card { display: flex !important; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 8px !important; cursor: pointer; font-weight: 400 !important; }
.radio-card input { margin-top: 4px; }
.radio-card small { display: block; margin-top: 2px !important; }
.radio-card:has(input:checked) { border-color: var(--accent); background: var(--soft); }
.reqs { list-style: none; padding: 0; margin: 0; columns: 2; }
.reqs li { padding: 3px 0; }
.reqs .ok { color: var(--ok); }
.reqs .ko { color: var(--danger); font-weight: 600; }

/* ---------- Elenchi ---------- */
.list { width: 100%; border-collapse: collapse; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.card .list { border: 0; border-radius: 0; }
.list th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; }
.list td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.list tr:last-child td { border-bottom: 0; }
.list tbody tr:hover { background: #fafbfc; }
.list .chk { width: 34px; padding-right: 0; }
.list .name { word-break: break-word; }
.list.log td { vertical-align: top; font-size: .92rem; }
.list tr.bad td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
.item { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 500; }
.item .ic { width: 22px; height: 22px; color: var(--muted); }
.item.folder .ic { color: var(--accent); fill: var(--soft); }
.sub { font-size: .82rem; color: var(--muted); margin: 2px 0 0 32px; }
.sub.nomargin { margin-left: 0; }
.row-actions { text-align: right; white-space: nowrap; width: 1%; }
tr.inactive .item, tr.inactive td { opacity: .6; }
.bulk { display: flex; align-items: center; gap: 12px; justify-content: flex-end; margin-top: 12px; }
.empty { text-align: center; padding: 50px 20px; background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.show-sm { display: none; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.filters select, .filters input { width: auto; margin: 0; min-width: 160px; }
.filters input[type=search] { flex: 1; min-width: 200px; }
.pager { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 16px; }

/* ---------- Upload ---------- */
.dropzone { border: 2px dashed #cdd2db; border-radius: var(--radius); background: var(--card); margin-bottom: 20px; transition: .15s; }
.dropzone.over { border-color: var(--accent); background: var(--soft); }
.dz-inner { text-align: center; padding: 22px 16px; }
.dz-inner > .ic { width: 30px; height: 30px; color: var(--accent); }
.dz-inner p { margin: 6px 0 2px; }
.uplist { list-style: none; margin: 0; padding: 0 16px; }
.uplist:not(:empty) { padding-bottom: 14px; }
.uplist li { padding: 9px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.uplist .row { display: flex; justify-content: space-between; gap: 12px; }
.uplist .fn { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.uplist .st { color: var(--muted); white-space: nowrap; }
.uplist li.done .st { color: var(--ok); }
.uplist li.error .st { color: var(--danger); white-space: normal; text-align: right; }
.bar { height: 6px; background: #eef0f3; border-radius: 4px; overflow: hidden; margin-top: 6px; }
.bar span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.uplist li.done .bar span { background: var(--ok); }

/* ---------- Condivisioni, link, sicurezza ---------- */
.sharerow { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; padding: 12px 0; border-top: 1px solid var(--line); margin: 0; }
.sharerow > div { flex: 1; min-width: 180px; }
.sharerow .sub { margin-left: 0; }
.sharerow label { margin: 0; }
.plain { list-style: none; padding: 0; margin: 0; }
.plain li { padding: 6px 0; }
.target { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 12px 14px; background: var(--bg); border-radius: 8px; }
.newlink { border-color: var(--accent); box-shadow: 0 0 0 3px var(--soft); }
.steps { padding-left: 20px; }
.steps li { margin-bottom: 12px; }
.qr { width: 196px; height: 196px; margin: 12px 0 8px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.qr svg, .qr img { width: 100%; height: 100%; display: block; }
.secret { letter-spacing: .08em; }
.backup { background: #fffbea; border: 1px solid #f1e3a6; border-radius: 8px; padding: 14px 16px; margin-bottom: 16px; }
.codes { columns: 2; padding-left: 26px; margin: 10px 0; }
.codes code { font-size: 1rem; background: #fff; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice-btn { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; text-align: left; padding: 14px 16px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; color: var(--text); cursor: pointer; }
.choice-btn:hover { border-color: var(--accent); background: var(--soft); }
.choice-btn .ic { width: 24px; height: 24px; color: var(--accent); margin-bottom: 4px; }
.choice-btn small { color: var(--muted); }
details.more summary { cursor: pointer; color: var(--accent); font-weight: 500; margin-bottom: 10px; }

/* ---------- Aggiornamento ---------- */
.update-preview h3 { font-size: .95rem; margin: 16px 0 6px; }
.notes { background: var(--bg); border-radius: 8px; padding: 10px 16px; margin-bottom: 12px; }
.notes h4 { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 10px 0 4px; }
.notes ul { margin: 0 0 6px; padding-left: 20px; }
.notes li { margin: 3px 0; }

/* ---------- Pagine di accesso e pubbliche ---------- */
body.auth { min-height: 100vh; display: flex; flex-direction: column; }
.topbar.plain { justify-content: center; }
.auth-wrap { width: 100%; max-width: 440px; margin: 0 auto; padding: 7vh 16px 30px; flex: 1; }
.auth-wrap .public { max-width: 640px; }
.auth-wrap:has(.public) { max-width: 680px; }
.auth-card { padding: 30px 30px 24px; }
.auth-card h1 { margin-bottom: 4px; }
.auth-card > .muted { margin-top: 0; }
.logo-light { display: block; max-height: 44px; margin: 0 auto 18px; }
.center { text-align: center; }
.bigicon .ic { width: 46px; height: 46px; color: var(--accent); margin-bottom: 4px; }
.download { padding: 36px 24px; }
.download .fname { word-break: break-word; }
.download .btn.big { margin-top: 14px; }

/* ---------- Schermi stretti ---------- */
@media (max-width: 960px) {
  .burger { display: block; }
  .sidebar { position: fixed; top: 58px; left: 0; bottom: 0; height: auto; z-index: 25; transform: translateX(-100%); transition: transform .2s; box-shadow: 4px 0 20px rgba(0,0,0,.08); }
  body.menu-open .sidebar { transform: none; }
  body.menu-open .scrim { display: block; position: fixed; inset: 58px 0 0 0; background: rgba(15,20,30,.35); z-index: 20; }
}
@media (max-width: 720px) {
  .topbar { padding: 0 12px; gap: 8px; }
  .brand .appname { display: none; }
  .uname { display: none; }
  .brand .logo { height: 26px; max-width: 150px; }
  .wrap { padding: 20px 14px 30px; }
  .grid2, .choice { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .show-sm { display: block; }
  .card { padding: 18px 16px; }
  .pagehead .actions { width: 100%; }
  .pagehead .actions .btn { flex: 1; }
  .search, .search input { width: 100%; }
  .row-actions .ib { width: 30px; }
  .row-actions [data-rename] { display: none; }
  .reqs, .codes { columns: 1; }
  .filters select, .filters input { flex: 1; min-width: 0; }
}
