/* FastShare - stile allineato al Portale Gestione Offerte (blu notte + oro, pulsanti a pillola) */
:root {
    --navy: #2b3561;
    --navy-dark: #1f2749;
    --gold: #c9962e;
    --gold-dark: #b07f1f;
    --gold-light: #f8f1dc;
    --bg: #f4f5f9;
    --text: #2a2f45;
    --muted: #7a8099;
    --line: #e1e4ec;
    --field: #c8cde0;
    --ok: #2f7d46;
    --red: #b3261e;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: "Nunito", "Segoe UI", Arial, sans-serif; color: var(--text); background: var(--bg); font-size: 14px; }
a { color: var(--navy); }
.page { padding: 0 20px; }

/* Barra superiore */
.topbar { background: #fff; border-bottom: 3px solid var(--gold); }
.topbar-inner { display: flex; align-items: center; justify-content: space-between; min-height: 60px; padding: 0 12px 0 14px; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 16px; text-decoration: none; }
.brand img { height: 44px; display: block; }
.brand-title { color: var(--navy); font-size: 20px; font-weight: 700; }
.infobar { padding: 14px 24px; color: var(--muted); font-size: 13px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }

/* Selettore lingua: segmentato come "Solo mie | Tutte" */
.lang { display: inline-flex; border: 1px solid var(--navy); border-radius: 20px; overflow: hidden; }
.lang a { text-decoration: none; padding: 5px 14px; color: var(--navy); font-weight: 700; font-size: 13px; }
.lang a.on { background: var(--navy); color: #fff; }

/* Menu amministrazione */
.adminnav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.adminnav a { text-decoration: none; padding: 7px 14px; color: var(--navy); font-weight: 600; border-radius: 20px; }
.adminnav a:hover, .adminnav a.on { background: var(--gold-light); }
.adminnav a:last-child { background: var(--navy); color: #fff; font-weight: 700; margin-left: 8px; }
.adminnav a:last-child:hover { background: var(--navy-dark); }

/* Titoli */
h1 { color: var(--navy); font-size: 22px; font-weight: 700; margin: 0 0 6px; }
h2 { font-size: 13px; margin: 0; padding: 12px 18px; color: var(--gold); text-transform: uppercase; letter-spacing: .04em; font-weight: 800; }
.intro { color: var(--muted); margin: 0 0 20px; }
.empty { padding: 24px; background: #fff; border: 1px solid var(--line); border-radius: 10px; color: var(--muted); text-align: center; }

/* Categorie come i riquadri della dashboard */
.cat { margin-bottom: 22px; background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }

/* Tabelle: intestazione blu notte */
table.files { width: 100%; border-collapse: collapse; background: #fff; }
table.files th { text-align: left; background: var(--navy); color: #fff; font-weight: 700; padding: 10px 14px; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; }
table.files td { padding: 9px 14px; border-top: 1px solid var(--line); vertical-align: middle; }
table.files tr:hover td { background: var(--gold-light); }
.num { text-align: right; white-space: nowrap; }
a.dl { font-weight: 700; text-decoration: none; color: var(--navy); word-break: break-all; }
a.dl::before { content: "\2193"; display: inline-block; margin-right: 10px; color: #fff; background: var(--gold); border-radius: 50%; width: 22px; height: 22px; text-align: center; line-height: 22px; font-size: 13px; }
a.dl:hover { text-decoration: underline; }
.sub { color: var(--muted); font-size: .9em; margin-top: 2px; }
input.copy { width: 100%; min-width: 220px; font-size: .85em; padding: 5px 12px; border: 1px solid var(--field); border-radius: 16px; background: #fafbfd; color: var(--muted); }

/* Badge stato */
.tag { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tag.on { background: #e4f2e8; color: var(--ok); }
.tag.off { background: #eceef4; color: var(--muted); }
.tag.exp { background: var(--gold-light); color: var(--gold-dark); }

/* Riquadri e form */
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 22px 24px; margin-bottom: 20px; }
.card h2 { padding: 0 0 6px; }
.card.narrow { max-width: 420px; margin: 40px auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 24px; }
label { display: block; font-weight: 700; margin: 14px 0 5px; color: var(--navy); }
label small { font-weight: normal; color: var(--muted); }
.input { width: 100%; padding: 8px 16px; border: 1px solid var(--field); border-radius: 20px; font: inherit; background: #fff; }
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201,150,46,.2); }
.input.date { width: auto; display: inline-block; margin-left: 8px; }
.radios label { display: inline-block; font-weight: normal; color: var(--text); margin: 0 18px 0 4px; }
.date-row { margin-top: 10px; color: var(--muted); }
dl.info { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 16px 0; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; font-weight: 700; word-break: break-all; }

/* Pulsanti a pillola: oro (principale), contorno blu, contorno rosso */
.buttons { margin-top: 20px; display: flex; gap: 10px; flex-wrap: wrap; }
.btn { display: inline-block; background: var(--gold); color: var(--navy-dark); border: 0; padding: 9px 26px; border-radius: 22px; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; text-align: center; }
.btn:hover { background: var(--gold-dark); color: #fff; }
.btn.small { padding: 5px 16px; font-size: 13px; }
.btn.ghost { background: #fff; color: var(--navy); border: 1px solid var(--navy); }
.btn.ghost:hover { background: var(--navy); color: #fff; }
.btn.danger { background: #fff; color: var(--red); border: 1.5px solid var(--red); }
.btn.danger:hover { background: #fbeaea; color: var(--red); }

.msg { padding: 10px 16px; border-radius: 10px; margin: 0 0 16px; }
.msg.ok { background: #e4f2e8; color: var(--ok); }
.msg.error { background: #fbeaea; color: var(--red); }
code { background: #eceef4; padding: 2px 8px; border-radius: 10px; }
.footer { color: var(--muted); font-size: 12px; padding-top: 10px; padding-bottom: 24px; text-align: center; }

/* Esplora file (area admin) */
.crumbs { background: #fff; border: 1px solid var(--line); border-radius: 20px; padding: 8px 18px; margin-bottom: 12px; font-weight: 700; }
.crumbs a { text-decoration: none; color: var(--navy); }
.crumbs a:hover { color: var(--gold-dark); }
.crumbs a:first-child::before { content: "\2302"; margin-right: 6px; color: var(--gold); }
.crumbs .sep { color: var(--muted); margin: 0 4px; }
.toolbar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 12px; }
.toolbar .tool { display: flex; align-items: center; gap: 8px; }
.toolbar .tool .input { width: 220px; padding: 6px 14px; }
.toolbar .tool .input.file { width: 260px; padding: 4px 10px; font-size: 13px; }
.toolbar .check, label.check { display: inline-flex; align-items: center; gap: 4px; font-weight: normal; margin: 0; color: var(--text); white-space: nowrap; }
table.explorer td.actions, table.explorer th.actions { text-align: right; white-space: nowrap; }
table.explorer td.actions .btn { margin-left: 6px; }
table.explorer tr.folder td { background: #fcfaf3; }
a.fold { font-weight: 700; text-decoration: none; color: var(--navy); }
a.fold::before { content: ""; display: inline-block; width: 22px; height: 22px; margin-right: 10px; vertical-align: -5px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23c9962e' d='M2 6.5A2.5 2.5 0 0 1 4.5 4h4.2c.6 0 1.2.3 1.6.7L12 6.5h7.5A2.5 2.5 0 0 1 22 9v8.5a2.5 2.5 0 0 1-2.5 2.5h-15A2.5 2.5 0 0 1 2 17.5z'/%3E%3Cpath fill='%23e0b456' d='M2 9.5h20v8a2.5 2.5 0 0 1-2.5 2.5h-15A2.5 2.5 0 0 1 2 17.5z'/%3E%3C/svg%3E") no-repeat center / contain; }
a.fold:hover { text-decoration: underline; }
.fname { font-weight: 600; word-break: break-all; }
.fname::before { content: ""; display: inline-block; width: 20px; height: 20px; margin-right: 11px; vertical-align: -4px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffffff' stroke='%232b3561' stroke-width='1.6' stroke-linejoin='round' d='M6 2.8h8l5 5v12.4a1 1 0 0 1-1 1H6a1 1 0 0 1-1-1V3.8a1 1 0 0 1 1-1z'/%3E%3Cpath fill='none' stroke='%232b3561' stroke-width='1.6' stroke-linejoin='round' d='M14 2.8v5h5'/%3E%3Cpath stroke='%23c9962e' stroke-width='1.6' stroke-linecap='round' d='M8 12.5h8M8 15.5h8M8 18.5h5'/%3E%3C/svg%3E") no-repeat center / contain; }
.empty-row { text-align: center; color: var(--muted); padding: 24px !important; }

/* Pagina pubblica */
.title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
h2.fold-title { display: flex; align-items: center; }
h2.fold-title::before { content: ""; display: inline-block; width: 20px; height: 20px; margin-right: 10px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23c9962e' d='M2 6.5A2.5 2.5 0 0 1 4.5 4h4.2c.6 0 1.2.3 1.6.7L12 6.5h7.5A2.5 2.5 0 0 1 22 9v8.5a2.5 2.5 0 0 1-2.5 2.5h-15A2.5 2.5 0 0 1 2 17.5z'/%3E%3Cpath fill='%23e0b456' d='M2 9.5h20v8a2.5 2.5 0 0 1-2.5 2.5h-15A2.5 2.5 0 0 1 2 17.5z'/%3E%3C/svg%3E") no-repeat center / contain; }
.cat-empty { margin: 0; padding: 14px 18px; border-top: 1px solid var(--line); color: var(--muted); font-style: italic; }
table.files td.actions, table.files th.actions, table.files th.num { text-align: right; white-space: nowrap; }

/* Albero stile Esplora risorse - pagina pubblica (sempre aperto) */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.hero .intro { margin-bottom: 6px; }
.hero .summary { margin: 0; font-size: 13px; color: var(--navy); font-weight: 600; }
.hero-tools { display: flex; gap: 10px; align-items: center; }
.input.search { width: 300px; padding-left: 38px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5' fill='none' stroke='%237a8099' stroke-width='2'/%3E%3Cpath d='m15.5 15.5 5 5' stroke='%237a8099' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat 14px center / 16px; }
.xtree { background: #fff; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; box-shadow: 0 2px 10px rgba(43,53,97,.06); }
.xtree .xhead, .xtree .xrow { display: grid; grid-template-columns: minmax(300px, 2.4fr) minmax(160px, 2fr) 90px 150px 230px; column-gap: 14px; padding: 0 16px 0 0; }
.xtree .xhead { background: var(--navy); color: #fff; font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; height: 42px; align-items: center; white-space: nowrap; }
.xtree .xhead span:first-child { padding-left: 18px; }
.xtree .xrow { min-height: 44px; border-top: 1px solid #eef0f5; }
.xtree .xrow > span { display: flex; align-items: center; min-width: 0; }
.xtree .xrow:hover { background: #f3f7fd; }
.xtree .num { justify-content: flex-end; text-align: right; }
.xtree .act { justify-content: flex-end; gap: 6px; }
/* nome con connettori dell'albero (├ └ │) */
.xtree .xname { padding-left: 14px; align-self: stretch; }
.xtree .xname .g, .xtree .xname .e { flex: none; width: 26px; align-self: stretch; position: relative; }
.xtree .xname .g.v::before, .xtree .xname .e::before { content: ""; position: absolute; left: 11px; top: 0; bottom: 0; border-left: 1.5px solid #9aa5c2; }
.xtree .xname .e.last::before { bottom: 50%; }
.xtree .xname .e::after { content: ""; position: absolute; left: 11px; right: 4px; top: 50%; border-top: 1.5px solid #9aa5c2; }
.xtree .xfolder { background: #fcfbf7; }
.xtree .xfolder:hover { background: #f8f3e3; }
.xtree .xfolder .xname { grid-column: 1 / -1; }
.xtree .xfolder > span:not(.xname) { display: none; }
.xtree .xfold { display: inline-flex; align-items: center; font-weight: 700; color: var(--navy); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xtree .xfold::before { content: ""; flex: none; width: 22px; height: 22px; margin-right: 10px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23e8a92b' d='M1.5 5.5A1.5 1.5 0 0 1 3 4h5.6l2 2H21a1.5 1.5 0 0 1 1.5 1.5V9h-21z'/%3E%3Cpath fill='%23ffc83d' d='M1.5 8.5h21v10A1.5 1.5 0 0 1 21 20H3a1.5 1.5 0 0 1-1.5-1.5z'/%3E%3C/svg%3E") no-repeat center / contain; }
.xtree .xcount { margin-left: 12px; font-size: 11.5px; font-weight: 700; color: var(--ok); background: #e4f2e8; border-radius: 10px; padding: 1px 9px; white-space: nowrap; }
.xtree .xfolder.zero .xfold { color: var(--muted); }
.xtree .xfolder.zero .xcount { color: var(--muted); background: #eceef4; }
.xtree .ficon { flex: none; display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 22px; margin-right: 10px; border-radius: 5px; color: #fff; font-size: 9.5px; font-weight: 800; letter-spacing: .03em; background: #7a8099; }
.xtree .ficon.pdf { background: #d93025; } .xtree .ficon.exe { background: #2b3561; } .xtree .ficon.zip { background: #c9962e; }
.xtree .ficon.doc { background: #2b579a; } .xtree .ficon.xls { background: #217346; } .xtree .ficon.ppt { background: #d24726; }
.xtree .ficon.cad { background: #6a4fb3; } .xtree .ficon.img { background: #0f9d58; }
.xtree a.xdl { color: var(--text); text-decoration: none; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xtree a.xdl:hover { color: var(--navy); text-decoration: underline; }
.xtree .xdesc { color: var(--muted); font-size: 13px; }
.xtree .xsize { color: var(--muted); font-size: 13px; }

.xtree .xroot { background: #f1f3f8; }
.xtree .xroot:hover { background: #eaedf5; }
.xtree .xroot .xfold { font-weight: 800; }
.xtree .xroot .xfold::before { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='2' y='4' width='20' height='13' rx='2' fill='%232b3561'/%3E%3Crect x='4' y='6' width='16' height='9' fill='%2390a4d4'/%3E%3Crect x='7' y='18.5' width='10' height='2' rx='1' fill='%232b3561'/%3E%3C/svg%3E") no-repeat center / contain; }
/* Albero in area admin: colonna azioni con pulsanti su ogni riga */
.xtree.admin .xhead, .xtree.admin .xrow { grid-template-columns: minmax(260px, 2fr) minmax(120px, 1.4fr) 85px 120px 390px; }
.xtree.admin .xfolder .xname { grid-column: auto; }
.xtree .xhead .act { text-align: right; }
.xtree.admin .xfolder > span { display: flex; }
.xtree.admin .act { gap: 5px; flex-wrap: nowrap; }
.xtree.admin .act .btn.small { padding: 4px 12px; font-size: 12px; white-space: nowrap; }
.btn:disabled, .btn[disabled] { opacity: .35; cursor: not-allowed; pointer-events: auto; }
.btn.danger:disabled:hover { background: #fff; }
.admin-opts { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.header-tools { display: flex; align-items: center; gap: 10px; }
/* Pagina pubblica: 4 colonne, pulsanti accanto al nome del file */
.xtree:not(.admin) .xhead, .xtree:not(.admin) .xrow { grid-template-columns: minmax(420px, 3fr) minmax(160px, 2fr) 90px 150px; }
.xtree .xbtns { display: inline-flex; gap: 6px; flex: none; margin-left: 14px; }
.xtree .xbtns .btn.small { padding: 3px 12px; font-size: 12px; white-space: nowrap; }
.xtree a.xdl { min-width: 0; }
.staffbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #eef3fb; border: 1px solid #cfdcf0; color: var(--navy); border-radius: 10px; padding: 8px 10px 8px 16px; margin-bottom: 14px; }
.xtree .xfile.unpub a.xdl { color: var(--muted); font-style: italic; }
.xtree .xfile.unpub { background: repeating-linear-gradient(135deg, #fff 0 10px, #f7f8fb 10px 20px); }

/* Albero cartelle - area admin (stile Esplora risorse) */
.explorer-wrap { display: grid; grid-template-columns: 260px 1fr; gap: 18px; align-items: start; }
.tree-panel { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 8px 6px; position: sticky; top: 10px; max-height: calc(100vh - 20px); overflow: auto; font-size: 14px; }
.ftree ul { list-style: none; margin: 0; padding-left: 18px; }
.ftree > ul { padding-left: 0; }
.ftree li { margin: 0; }
.ftree summary { list-style: none; cursor: pointer; display: flex; align-items: center; }
.ftree summary::-webkit-details-marker { display: none; }
.ftree summary::before { content: ""; flex: none; width: 18px; height: 18px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath fill='none' stroke='%23555b70' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M6 3.5 10.5 8 6 12.5'/%3E%3C/svg%3E") no-repeat center / 14px; transition: transform .12s; }
.ftree details[open] > summary::before { transform: rotate(90deg); }
.ftree .leaf { display: flex; align-items: center; padding-left: 18px; }
.ftree a.tlink { flex: 1; display: flex; align-items: center; padding: 4px 6px; border-radius: 3px; text-decoration: none; color: var(--text); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ftree a.tlink::before { content: ""; flex: none; width: 18px; height: 18px; margin-right: 7px; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23e8a92b' d='M1.5 5.5A1.5 1.5 0 0 1 3 4h5.6l2 2H21a1.5 1.5 0 0 1 1.5 1.5V9h-21z'/%3E%3Cpath fill='%23ffc83d' d='M1.5 8.5h21v10A1.5 1.5 0 0 1 21 20H3a1.5 1.5 0 0 1-1.5-1.5z'/%3E%3C/svg%3E") no-repeat center / contain; }
.ftree a.tlink.home { font-weight: 600; padding-left: 24px; }
.ftree a.tlink.home::before { background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Crect x='2' y='5' width='20' height='13' rx='2' fill='%232b3561'/%3E%3Crect x='4' y='7' width='16' height='9' fill='%2390a4d4'/%3E%3Crect x='8' y='19' width='8' height='2' rx='1' fill='%232b3561'/%3E%3C/svg%3E") no-repeat center / contain; }
.ftree a.tlink:hover { background: #eef3fb; }
.ftree a.tlink.current { background: #cce4f7; color: var(--text); font-weight: 600; }

/* ===== Restyling v2: pagina centrata, icone, descrizione sotto il nome ===== */
.page { max-width: 1320px; margin: 0 auto; padding-top: 22px; }
.topbar-inner { max-width: 1352px; margin: 0 auto; }
.hero-tools .check { font-size: 13px; color: var(--muted); padding: 0 4px; }
.hero-tools { margin-left: auto; }

/* colonne: admin = nome | dimensione | stato | azioni ; pubblica = nome | dimensione | scadenza */
.xtree.admin .xhead, .xtree.admin .xrow { grid-template-columns: minmax(440px, 1fr) 90px 190px 150px; }
.xtree:not(.admin) .xhead, .xtree:not(.admin) .xrow { grid-template-columns: minmax(420px, 1fr) 100px 180px; }
.xtree.admin .xfolder .xname { grid-column: 1 / 4; }
.xtree.admin .xfolder > span.act { display: flex; grid-column: 4; }
.xtree .xrow { min-height: 48px; }

/* nome + descrizione sotto */
.xtree .xlabel { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.xtree .xlabel a.xdl { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xtree .xsub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }

/* cartelle un po' piu' grandi */
.xtree .xfold { font-size: 15px; }
.xtree .xfold::before { width: 24px; height: 24px; }

/* file non pubblicati: niente sfondo rigato, solo testo attenuato + barra laterale */
.xtree .xfile.unpub { background: #fff; box-shadow: none; }
.xtree .xfile.unpub .ficon { opacity: .6; }
.xtree .xfile.unpub:hover { background: #f3f7fd; }
.xtree .xfile.softdel { background: #fdf6f5; }
.xtree .xfile.softdel:hover { background: #fbeeec; }
.xtree .xfile.softdel a.xdl { color: var(--muted); text-decoration: line-through; }
.xtree .xfile.softdel .ficon { opacity: .5; }

/* badge scadenza */
.msg.linkbox { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.msg.linkbox input.copy { flex: 1; min-width: 260px; background: #fff; color: var(--text); }
.tag.hid { background: #e8ecf8; color: var(--navy); margin-left: 6px; }
.xtree .xstate { gap: 0; flex-wrap: wrap; row-gap: 3px; }
label.hide-opt { margin-top: 16px; font-weight: 600; color: var(--navy); }
.tag.bad { background: #fbeaea; color: var(--red); }

/* pulsanti a icona */
.ibtn { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid transparent; background: transparent; color: var(--navy); cursor: pointer; padding: 0; text-decoration: none; transition: background .12s, border-color .12s; }
.ibtn:hover { background: #e8eef7; border-color: #cfd8ea; }
.ibtn.danger { color: var(--red); }
.ibtn.danger:hover { background: #fbeaea; border-color: #f1c7c4; }
.ibtn.ok { background: #e4f2e8; color: var(--ok); border-color: #bfe0c8; }
.xtree.admin .act { gap: 2px; align-items: center; }
.xtree.admin .act .btn.small { margin-right: 4px; }
.xtree.admin .xroot .act .btn.small { display: inline-flex; align-items: center; gap: 6px; margin: 0 0 0 6px; }
/* azioni leggermente attenuate finche' non si passa sulla riga */
.xtree.admin .xrow .ibtn { opacity: .55; }
.xtree.admin .xrow:hover .ibtn, .xtree.admin .ibtn:focus { opacity: 1; }

/* Pagina unica: barra avanzamento caricamento e menu nell'intestazione */
.upload-wait { display: flex; align-items: center; gap: 14px; }
.upload-wait .progress { flex: 1; height: 8px; background: #fff; border-radius: 4px; overflow: hidden; }
.upload-wait #uploadBar { height: 100%; width: 0; background: var(--ok); transition: width .2s; }
.header-tools .adminnav { margin-right: 6px; }
.header-tools .adminnav a:last-child { margin-left: 4px; }

/* Finestra di caricamento */
.modal-bg { position: fixed; inset: 0; background: rgba(31,39,73,.45); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px; }
.modal { background: #fff; border-radius: 12px; box-shadow: 0 10px 40px rgba(0,0,0,.25); width: 560px; max-width: 100%; max-height: 90vh; overflow: auto; padding: 22px 26px; }
.modal h2 { padding: 0 0 8px; font-size: 15px; }
.modal .mfile { border: 1px solid var(--line); border-radius: 10px; padding: 4px 14px 14px; margin-bottom: 12px; }
.modal .mname { font-weight: 700; color: var(--navy); margin-top: 10px; word-break: break-all; }
.modal .radios { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 4px; }
.modal .radios label { font-weight: normal; margin: 0 14px 0 0; display: inline-flex; align-items: center; gap: 5px; color: var(--text); }
.modal .adminonly { display: inline-flex; align-items: center; flex-wrap: wrap; }
.modal .input.date { margin-left: 0; padding: 5px 12px; }

/* Finestre guidate (passi numerati, scelte grandi) */
.modal { width: 640px; padding: 20px 26px 18px; }
.mhead { display: flex; align-items: center; justify-content: space-between; }
.mhead h2 { font-size: 18px; color: var(--navy); text-transform: none; letter-spacing: 0; padding: 0; }
.mclose { border: 0; background: transparent; font-size: 28px; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 4px; }
.mclose:hover { color: var(--navy); }
.mwhere { margin: 6px 0 14px; color: var(--muted); font-size: 13px; }
.mwhere b { color: var(--navy); }
.step { display: flex; gap: 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.step .num { flex: none; width: 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fff; font-weight: 800; display: flex; align-items: center; justify-content: center; }
.step .sbody { flex: 1; min-width: 0; }
.step .sbody > b { font-size: 15px; color: var(--navy); }
.step .hint { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.step label { margin-top: 10px; }
.choices { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.choice { margin: 0 !important; cursor: pointer; }
.choice > input { position: absolute; opacity: 0; pointer-events: none; }
.choice > span { display: flex; flex-direction: column; min-width: 120px; padding: 10px 16px; border: 2px solid var(--field); border-radius: 12px; background: #fff; transition: border-color .12s, background .12s; }
.choice > span b { color: var(--navy); font-size: 15px; }
.choice > span small { color: var(--muted); font-weight: normal; margin-top: 2px; }
.choice:hover > span { border-color: var(--gold); }
.choice > input:checked + span { border-color: var(--gold); background: var(--gold-light); box-shadow: 0 0 0 3px rgba(201,150,46,.18); }
.choice > input:focus-visible + span { outline: 2px solid var(--navy); }
.choice .input.date { margin: 4px 0 0; padding: 4px 10px; font-size: 13px; }
.choice.wide { flex: 1 1 240px; }
.choice.wide > span { min-width: 0; height: 100%; }
.modal .mfile.exists { border-color: #e7b54c; background: #fffaf0; }
.mwarn { margin: 6px 0 2px; padding: 8px 12px; border-radius: 8px; background: #fdf0dc; color: #7a4b00; font-size: 13px; }
.mwarn label.check { display: flex; margin: 6px 0 2px; font-weight: 700; color: var(--navy); font-size: 14px; gap: 8px; }
.mwarn label.check input { width: 18px; height: 18px; }
.mwarn small { display: block; color: #8a6a2d; }
.summary-box { margin: 8px 0 0; padding: 12px 14px; background: #eef3fb; border-radius: 10px; color: var(--text); line-height: 1.55; }
.mfoot { margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line); }
.btn.big { padding: 12px 30px; font-size: 16px; }
.mextra { margin-top: 12px; font-size: 13px; color: var(--muted); }
.linkbtn { border: 0; background: none; padding: 0; color: var(--navy); font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.linkbtn.danger { color: var(--red); }

/* Finestre guidate in versione compatta: tutto in una schermata */
.modal { width: 720px; padding: 14px 22px 14px; max-height: 96vh; }
.mwhere { margin: 2px 0 8px; }
.step { padding: 9px 0; gap: 12px; }
.step .num { width: 26px; height: 26px; font-size: 13px; }
.step .sbody > b { font-size: 14px; }
.step .hint { font-size: 12px; margin-top: 1px; }
.step label { margin: 6px 0 3px; font-size: 13px; }
.step .input { padding: 6px 14px; }
.modal .mfile { padding: 2px 12px 10px; margin: 6px 0 0; }
.modal .mfile + .mfile { margin-top: 8px; }
.modal .mname { margin-top: 7px; font-size: 13px; }
.mgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.choices { gap: 8px; margin-top: 6px; }
.choice > span { padding: 6px 14px; border-radius: 10px; }
.choice > span b { font-size: 14px; }
.choice > span small { font-size: 12px; margin-top: 0; }
.summary-box { margin-top: 5px; padding: 8px 12px; font-size: 13px; line-height: 1.45; }
.mfoot { margin-top: 2px; padding-top: 10px; }
.btn.big { padding: 9px 26px; font-size: 15px; }
.mextra { margin-top: 8px; }
@media (max-width: 700px) { .mgrid { grid-template-columns: 1fr; } }

/* Visibilita' (colonna dedicata + legenda) */
.xtree.admin .xhead, .xtree.admin .xrow { grid-template-columns: minmax(380px, 1fr) 80px 150px 150px 140px; }
.xtree.admin .xfolder .xname { grid-column: 1 / 5; }
.xtree.admin .xfolder > span.act { grid-column: 5; }
.vis { display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: 12px; font-size: 12.5px; font-weight: 700; white-space: nowrap; border: 1px solid transparent; }
.vis.pub { background: #e4f2e8; color: #1f6b38; border-color: #bfe0c8; }
.vis.priv { background: #e6edfb; color: #23408e; border-color: #c5d3f2; }
.vis.none { background: #eceef4; color: #5b6275; border-color: #d8dce6; }
.vis.exp { background: #fbeaea; color: var(--red); border-color: #f1c7c4; }
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 18px; margin: -6px 0 14px; padding: 9px 14px; background: #fff; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; color: var(--muted); }
.legend b { color: var(--navy); }
.legend > span { display: inline-flex; align-items: center; gap: 6px; }
.muted-dash { color: #c2c7d3; }

.previewbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff7e0; border: 2px dashed var(--gold); color: var(--navy); border-radius: 10px; padding: 10px 12px 10px 16px; margin-bottom: 14px; }

/* Pulsanti Scarica / Copia link: colonna fissa a destra, stile coordinato */
.xtree:not(.admin) .xhead, .xtree:not(.admin) .xrow { grid-template-columns: minmax(340px, 1fr) 90px 170px 240px; }
.xtree.admin .xhead, .xtree.admin .xrow { grid-template-columns: minmax(280px, 1fr) 72px 140px 150px 230px 110px; }
.xtree.admin .xfolder .xname { grid-column: 1 / 6; }
.xtree.admin .xfolder > span.act { grid-column: 6; }
.xtree .dl { display: flex; justify-content: flex-end; gap: 6px; }
.dlbtn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px solid #c9d0e0; border-radius: 15px; background: #fff; color: var(--navy); font: inherit; font-size: 12.5px; font-weight: 600; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, color .12s; }
.dlbtn svg { width: 15px; height: 15px; flex: none; }
.dlbtn:hover { border-color: var(--navy); background: #eef2fa; }
.dlbtn.primary { border-color: var(--navy); }
.dlbtn.primary:hover { background: var(--navy); color: #fff; }
.dlbtn.done { background: #e4f2e8; border-color: #9fd0ad; color: var(--ok); }

/* Smartphone: tabelle in formato scheda */
@media (max-width: 700px) {
    .xtree .dl { grid-column: 1 / -1; justify-content: flex-start; padding-left: 40px; }
    .xtree.admin .xrow, .xtree:not(.admin) .xrow { grid-template-columns: 1fr auto; }
    .xtree.admin .xfolder .xname { grid-column: 1; }
    .xtree.admin .xfolder > span.act { grid-column: 2; }
    .xtree .xbtns { margin-left: 8px; }
    .explorer-wrap { grid-template-columns: 1fr; }
    .tree-panel { position: static; max-height: none; }
    .xtree .xhead { display: none; }
    .xtree .xrow { grid-template-columns: 1fr auto; row-gap: 4px; padding: 8px 10px 8px 0; }
    .xtree .xfile .act { grid-column: 1 / -1; justify-content: flex-start; padding-left: 64px; }
    .hero-tools { width: 100%; } .input.search { flex: 1; width: auto; }
    .grid2 { grid-template-columns: 1fr; }
    .brand-title { font-size: 16px; }
    table.files thead { display: none; }
    table.files, table.files tbody, table.files tr, table.files td { display: block; width: 100%; }
    table.files tr { border-top: 1px solid var(--line); padding: 8px 0; }
    table.files td { border: 0; padding: 4px 14px; text-align: left; }
    table.files td[data-label]::before { content: attr(data-label) ": "; color: var(--muted); font-size: .85em; }
    table.files td:first-child::before { content: none; }
}
