/* ==========================================================
   P-Drive theme for copyparty (v3: touch-friendly, English)
   Loaded after copyparty's own CSS via --html-head
   ========================================================== */

html {
  --font-main: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Inter, Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --radius: 14px;
  --radius-s: 10px;
  --tap: 44px;                       /* minimum touch target */
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 1px 3px rgba(16,24,40,.06);
  --shadow-l: 0 12px 32px rgba(16,24,40,.14);
  text-shadow: none !important;
  -webkit-font-smoothing: antialiased;
}

/* ---------- light palette (theme 3, class "by") ---------- */
html.by, html.y {
  --accent: #1d4ed8; --accent-h: #1e40af; --accent-soft: #e8efff;
  --surface: #ffffff; --line: #e3e6ea; --line-2: #cfd4db;
  --bg: #f4f5f7; --bgg: #f4f5f7; --bg-max: #ffffff;
  --bg-u1: #ffffff; --bg-u2: #ffffff; --bg-u3: #eef0f3; --bg-u4: #e6e9ed; --bg-u5: #e3e6ea;
  --bg-d1: #e6e9ed; --bg-d2: #e3e6ea; --bg-d3: #cfd4db;
  --fg: #16181d; --fg-max: #000; --fg-weak: #4b5563; --fg2-max: #000;
  --a: var(--accent); --a-b: var(--accent); --a-hil: var(--accent-h);
  --row-alt: #ffffff;
  --btn-bg: #ffffff; --btn-fg: #16181d; --btn-h-bg: #eef0f3; --btn-h-fg: #000;
  --btn-1-bg: var(--accent); --btn-1-fg: #fff; --btn-1h-bg: var(--accent-h); --btn-1h-fg: #fff;
  --btn-bs: none; --btn-1-bs: none;
  --op-aa-bg: #ffffff; --op-aa-fg: var(--accent); --op-aa-sh: none; --op-a-sh: transparent;
  --txt-bg: #ffffff; --txt-sh: transparent;
  --tree-bg: #ffffff;
  --g-bg: #ffffff; --g-b1: var(--line); --g-b2: var(--line); --g-sh: rgba(0,0,0,.04);
  --g-fg: #16181d; --g-dfg: var(--accent);
  --g-sel-bg: #dbe5ff; --g-sel-fg: #1e3a8a; --g-fsel-bg: #c3d3ff;
  --u2-btn-b1: #c3c9d2; --u2-txt-bg: #fff;
  --u2-tab-bg: #fff; --u2-tab-b1: var(--line);
  --u2-tab-1-bg: #fff; --u2-tab-1-fg: var(--accent); --u2-tab-1-b1: var(--line); --u2-tab-1-b2: var(--line);
  --u2-b1-bg: #eef0f3; --u2-b2-bg: #eef0f3; --u2-b-fg: #16181d;
  --u2-ok-bg: #ecfdf5; --u2-ok-b1: #34d399;
  --u2-err-bg: #fef2f2; --u2-err-b1: #f87171;
  --u2-inf-bg: #eff6ff; --u2-inf-b1: #93c5fd;
  --srv-1: #4b5563; --scroll: #c3c9d2;
  --sel-bg: #dbe5ff; --sel-fg: #1e3a8a;
  --sz-b: #6b7280; --sz-k: #4b5563; --sz-m: #16181d; --sz-g: #16181d; --sz-t: #16181d;
}

/* ---------- dark palette (theme 2, class "bz") ---------- */
html.bz {
  --accent: #7aaeff; --accent-h: #a3c4ff; --accent-soft: #182640;
  --surface: #17191e; --line: #2a2e36; --line-2: #3a3f49;
  --bg: #0f1114; --bgg: #0f1114; --bg-max: #000;
  --bg-u1: #17191e; --bg-u2: #17191e; --bg-u3: #1d2026; --bg-u4: #23272e; --bg-u5: #2a2e36;
  --bg-d1: #1d2026; --bg-d2: #2a2e36; --bg-d3: #3a3f49;
  --fg: #eceef1; --fg-max: #fff; --fg-weak: #aab1bc;
  --a: var(--accent); --a-b: var(--accent); --a-hil: var(--accent-h);
  --row-alt: #17191e;
  --btn-bg: #1d2026; --btn-fg: #eceef1; --btn-h-bg: #23272e;
  --btn-1-bg: #3b82f6; --btn-1-fg: #fff; --btn-1h-bg: #60a5fa; --btn-1h-fg: #fff;
  --btn-bs: none; --btn-1-bs: none;
  --op-aa-bg: #17191e; --op-aa-fg: var(--accent); --op-aa-sh: none;
  --txt-bg: #1d2026; --tree-bg: #17191e;
  --g-bg: #17191e; --g-b1: var(--line); --g-b2: var(--line); --g-sh: rgba(0,0,0,.4);
  --g-sel-bg: #1e3a8a; --g-fsel-bg: #1d4ed8;
  --u2-btn-b1: #3f4653;
  --u2-tab-bg: #17191e; --u2-tab-b1: var(--line);
  --u2-tab-1-bg: #17191e; --u2-tab-1-fg: var(--accent);
  --u2-b1-bg: #23272e; --u2-b2-bg: #23272e;
  --srv-1: #aab1bc;
  --sz-b: #8b93a1; --sz-k: #aab1bc; --sz-m: #eceef1; --sz-g: #eceef1; --sz-t: #eceef1;
  --shadow: 0 1px 2px rgba(0,0,0,.4);
  --shadow-l: 0 12px 32px rgba(0,0,0,.6);
}

/* ---------- base typography ---------- */
body { font-size: 16px; line-height: 1.55; }
a { text-decoration: none; }
#wrap { padding-bottom: 8em; }
html.b .opview { margin: .7em 1.5em; }
#js_bork { display: none; }

/* ---------- header (inserted by custom.js) ---------- */
#ap-head {
  margin: 2.8em 0 .5em 0;
  padding: 0 1.5em;
  display: flex; align-items: center; gap: 1em;
}
#ap-head .ap-avatar {
  width: 3em; height: 3em; flex: 0 0 auto;
  border-radius: 50%;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff; font-weight: 700; font-size: 1em; letter-spacing: .03em;
  display: flex; align-items: center; justify-content: center;
}
#ap-head .ap-brand { font-size: 1.25em; font-weight: 700; color: var(--fg); line-height: 1.2; }
#ap-head .ap-brand small { display: block; font-weight: 400; font-size: .72em; color: var(--fg-weak); margin-top: .1em; }
#ap-head .ap-hint { margin: .25em 0 0 0; color: var(--fg-weak); font-size: .95em; }
#ap-head > div:nth-child(2) { flex: 1 1 auto; min-width: 0; }
#ap-theme {
  flex: 0 0 auto; box-sizing: border-box; align-self: flex-start;
  min-height: 40px; line-height: 38px; padding: 0 1em;
  border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
  color: var(--fg); font-size: 15px; box-shadow: var(--shadow);
}
#ap-theme span { margin-left: .4em; }
#ap-theme:hover { color: var(--accent); border-color: var(--accent); }

/* account row, top right: only the sign in / sign out button */
#acc_info { font-size: 0; top: .8em; right: 1.5em; background: transparent; }
#acc_info > span { display: none !important; }
#acc_info form { display: inline; }
#acc_info input#blogout, #acc_info a {
  display: inline-block; box-sizing: border-box;
  font-size: 15px; font-family: inherit; cursor: pointer;
  min-height: 40px; line-height: 38px; padding: 0 1.1em;
  color: var(--fg); border: 1px solid var(--line); border-radius: 999px; background: var(--surface);
}
#acc_info input#blogout:hover, #acc_info a:hover { color: var(--accent); border-color: var(--accent); }
#srv_info, #srv_info2 { display: none !important; }

/* ---------- action bar ---------- */
html.b #ops { max-width: none; margin: 0 0 .4em 0; }
#ops {
  padding: .4em 1.5em;
  display: flex; gap: .5em; flex-wrap: wrap; align-items: center;
}
#ops a {
  box-sizing: border-box;
  min-height: var(--tap); line-height: calc(var(--tap) - 2px);
  font-size: 1em;
  padding: 0 1.1em;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface) !important;
  color: var(--fg);
  box-shadow: var(--shadow);
  transition: background .12s, border-color .12s;
}
#ops a:hover { border-color: var(--line-2); background: var(--bg-u3) !important; }
#ops a.act {
  color: var(--accent); border-color: var(--accent);
  background: var(--accent-soft) !important;
  border-bottom-width: 1px; box-shadow: none;
}
#ops a::after { margin-left: .5em; font-weight: 500; }
#opa_srch::after { content: "Search"; }
#opa_up::after   { content: "Upload"; }
#opa_mkd::after  { content: "New folder"; }
#opa_del::after  { content: "Undo uploads"; }
#opa_cfg::after  { content: "Settings"; }
#opdesc { display: none !important; }
#opa_x, #opa_msg, #op_msg, #opa_bup, #op_bup, #opa_md, #op_new_md, #opa_auc, #op_player, #bbsw, #repl { display: none !important; }

.opbox, #op_up2k, #op_cfg, #op_search {
  padding: 1.1em 1.25em; box-sizing: border-box;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  max-width: none;
}

/* ---------- inputs and buttons (touch size) ---------- */
.opview input[type=text], .opview input[type=password], .opview select, #modali,
#shui input[type="text"], #rui input[type="text"] {
  box-sizing: border-box; min-height: var(--tap);
  border: 1px solid var(--line-2); border-radius: var(--radius-s);
  padding: .5em .8em; box-shadow: none;
  font-family: inherit; font-size: 1em;
  background: var(--txt-bg); color: var(--fg);
}
.opview input[type=text]:focus, #modali:focus, #shui input[type="text"]:focus {
  outline: 3px solid var(--accent-soft); border-color: var(--accent);
}
.opview input[type=submit], #shui button, #rui button, #modalb a, #ht_spl #ls {
  box-sizing: border-box; min-height: var(--tap);
  font-family: inherit; font-size: 1em; cursor: pointer;
  padding: 0 1.2em; line-height: calc(var(--tap) - 2px);
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--fg); box-shadow: none;
}
.opview input[type=submit] { background: var(--btn-1-bg); color: var(--btn-1-fg); border-color: transparent; }

/* ---------- breadcrumb ---------- */
html.b #path, #path {
  margin: .3em 0 0 0; padding: .3em 1.5em;
  font-size: 1.1em; font-weight: 500; display: block;
}
#path a {
  display: inline-block; min-height: 40px; line-height: 40px;
  padding: 0 .6em; border-radius: var(--radius-s);
  color: var(--fg-weak); background: transparent; border: none;
}
#path a:hover { background: var(--bg-u4); color: var(--fg); }
#path a:last-child { color: var(--fg); font-weight: 700; }
#path #entree { font-size: .9em; }
#path i {
  width: .5em; height: .5em; margin: 0 .5em 0 .2em;
  border-color: var(--line-2); border-width: 2px 2px 0 0; background: none;
  vertical-align: middle; position: relative; top: -.1em;
}

/* ---------- file table ---------- */
#files {
  width: 100%; border-collapse: separate; border-spacing: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  margin-top: .6em;
}
#files thead th {
  background: var(--bg-u3); color: var(--fg-weak);
  font-weight: 600; font-size: .8em; text-transform: uppercase; letter-spacing: .05em;
  padding: .9em 1em; border: none; border-bottom: 1px solid var(--line); text-align: left;
}
#files thead th:after { display: none; }
#files thead th .cfg { display: none; }
#files thead th span { font-size: 0; }
#files thead th span::after { font-size: 12px; }
#files thead th[name="href"] span::after { content: "Name"; }
#files thead th[name="sz"] span::after { content: "Size"; }
#files thead th[name="tags/.files"] span::after { content: "Items"; }
#files thead th[name="ext"] span::after { content: "Type"; }
#files thead th[name="ts"] span::after { content: "Date"; }
#files thead th[name="lead"], #files tbody td:first-child { display: none; }
#files thead th[name="tags/W"], #files td.ap-w { display: none; }
#files thead th.s0 span::after, #files thead th.s1 span::after { color: var(--accent); }
#files thead th.s0 span::before { content: "↑ "; font-size: 12px; color: var(--accent); }
#files thead th.s1 span::before { content: "↓ "; font-size: 12px; color: var(--accent); }

#files td, #files td+td, #files tr:nth-child(2n) td, #files tr:nth-child(2n+1) td+td {
  background: transparent; border: none; border-bottom: 1px solid var(--line);
  padding: 0 1em; height: 52px; vertical-align: middle;
}
#files tbody tr:last-child td { border-bottom: none; }
#files tbody tr:hover td, #files tbody tr:hover td+td { background: var(--bg-u3); }
#files tbody tr.sel td, #files tbody tr.sel td+td { background: var(--sel-bg); }
#files tbody a { color: var(--fg); }
#files tbody td:nth-child(2) a { display: block; font-weight: 500; font-size: 1.02em; line-height: 52px; }
#files tbody td:nth-child(2) a[href$="/"]::before { content: "📁"; margin-right: .55em; }
#files tbody a:hover { color: var(--accent); }
#files tbody td:nth-child(n+3) { color: var(--fg-weak); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ---------- grid toolbar ---------- */
#ghead {
  margin: .7em 0 .3em 0; padding: 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: .5em;
  background: transparent; border: none;
  font-size: .95em; color: var(--fg-weak);
}
#gridvau, #gridcrop, #grid3x, #ghead > span:nth-of-type(2) { display: none !important; }
#ghead .btn, #ghead a {
  box-sizing: border-box; display: inline-block;
  min-height: 40px; line-height: 38px; padding: 0 .9em;
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--line); border-radius: 999px; font-size: 1em; box-shadow: none;
}
#ghead .btn.on, #ghead a.s0, #ghead a.s1 { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
#ghead span { margin-left: .3em; }
#ghead span a { padding: 0 .8em; }

/* ---------- thumbnail grid ---------- */
#ggrid { margin: .4em 0 0 0; display: flex; flex-wrap: wrap; gap: 1em; }
#ggrid>a {
  margin: 0; padding: .6em;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow);
  transition: transform .12s, box-shadow .12s, border-color .12s;
}
#ggrid>a:hover { transform: translateY(-2px); box-shadow: var(--shadow-l); border-color: var(--line-2); }
#ggrid>a img { border-radius: var(--radius-s); object-fit: cover; }
#ggrid>a>span { display: block; text-align: center; font-size: .95em; line-height: 1.35; padding: .2em 0; }
#ggrid>a.sel { border-color: var(--accent); background: var(--accent-soft); }
/* neutralise copyparty's floating corner icon */
#ggrid>a::before, #ggrid>a:before {
  position: static; margin: 0; padding: 0; font-size: 1em;
  background: none; text-shadow: none; transition: none;
}
#ggrid>a:hover::before, #ggrid>a:focus::before { font-size: 1em; margin: 0; }
#ggrid>a.au::before, #ggrid>a.vid::before { display: none; }
/* folders */
#ggrid>a.dir img { display: none; }
#ggrid>a.dir::before {
  content: "📁"; display: block;
  font-size: 3.2em; line-height: 1; text-align: center;
  padding: .5em 0 .35em 0; margin: 0 0 .45em 0;
  background: var(--bg-u3); border-radius: var(--radius-s);
}
#ggrid>a:hover.dir::before, #ggrid>a:focus.dir::before { font-size: 3.2em; }
#ggrid>a.dir>span { color: var(--fg); font-weight: 500; }
/* documents: type badge instead of a fake thumbnail */
#ggrid>a[href$=".txt"] img, #ggrid>a[href$=".pdf"] img, #ggrid>a[href$=".doc"] img, #ggrid>a[href$=".docx"] img,
#ggrid>a[href$=".xls"] img, #ggrid>a[href$=".xlsx"] img, #ggrid>a[href$=".ppt"] img, #ggrid>a[href$=".pptx"] img,
#ggrid>a[href$=".zip"] img, #ggrid>a[href$=".rar"] img, #ggrid>a[href$=".7z"] img, #ggrid>a[href$=".csv"] img,
#ggrid>a[href$=".md"] img, #ggrid>a[href$=".json"] img, #ggrid>a[href$=".srt"] img, #ggrid>a[href$=".prproj"] img,
#ggrid>a[href$=".drp"] img, #ggrid>a[href$=".aep"] img, #ggrid>a[href$=".psd"] img, #ggrid>a[href$=".ai"] img,
#ggrid>a[href$=".xml"] img, #ggrid>a[href$=".fcpxml"] img, #ggrid>a[href$=".dmg"] img, #ggrid>a[href$=".pkg"] img,
#ggrid>a[href$=".key"] img, #ggrid>a[href$=".pages"] img, #ggrid>a[href$=".numbers"] img { display: none; }
#ggrid>a[href$=".txt"]::before, #ggrid>a[href$=".pdf"]::before, #ggrid>a[href$=".doc"]::before, #ggrid>a[href$=".docx"]::before,
#ggrid>a[href$=".xls"]::before, #ggrid>a[href$=".xlsx"]::before, #ggrid>a[href$=".ppt"]::before, #ggrid>a[href$=".pptx"]::before,
#ggrid>a[href$=".zip"]::before, #ggrid>a[href$=".rar"]::before, #ggrid>a[href$=".7z"]::before, #ggrid>a[href$=".csv"]::before,
#ggrid>a[href$=".md"]::before, #ggrid>a[href$=".json"]::before, #ggrid>a[href$=".srt"]::before, #ggrid>a[href$=".prproj"]::before,
#ggrid>a[href$=".drp"]::before, #ggrid>a[href$=".aep"]::before, #ggrid>a[href$=".psd"]::before, #ggrid>a[href$=".ai"]::before,
#ggrid>a[href$=".xml"]::before, #ggrid>a[href$=".fcpxml"]::before, #ggrid>a[href$=".dmg"]::before, #ggrid>a[href$=".pkg"]::before,
#ggrid>a[href$=".key"]::before, #ggrid>a[href$=".pages"]::before, #ggrid>a[href$=".numbers"]::before {
  position: static; display: block; width: auto; margin: 0 0 .45em 0;
  padding: 2.4em 0; font-size: .9em; line-height: 1; text-align: center;
  font-weight: 700; letter-spacing: .08em; color: var(--fg-weak);
  background: var(--bg-u3); border-radius: var(--radius-s);
}
#ggrid>a[href$=".txt"]::before { content: "TXT"; }   #ggrid>a[href$=".pdf"]::before { content: "PDF"; color: #dc2626; }
#ggrid>a[href$=".doc"]::before { content: "DOC"; color: #2563eb; }  #ggrid>a[href$=".docx"]::before { content: "DOCX"; color: #2563eb; }
#ggrid>a[href$=".xls"]::before { content: "XLS"; color: #16a34a; }  #ggrid>a[href$=".xlsx"]::before { content: "XLSX"; color: #16a34a; }
#ggrid>a[href$=".ppt"]::before { content: "PPT"; color: #ea580c; }  #ggrid>a[href$=".pptx"]::before { content: "PPTX"; color: #ea580c; }
#ggrid>a[href$=".zip"]::before { content: "ZIP"; }   #ggrid>a[href$=".rar"]::before { content: "RAR"; }  #ggrid>a[href$=".7z"]::before { content: "7Z"; }
#ggrid>a[href$=".csv"]::before { content: "CSV"; }   #ggrid>a[href$=".md"]::before { content: "MD"; }    #ggrid>a[href$=".json"]::before { content: "JSON"; }
#ggrid>a[href$=".srt"]::before { content: "SRT"; }   #ggrid>a[href$=".prproj"]::before { content: "PREMIERE"; color: #7c3aed; }
#ggrid>a[href$=".drp"]::before { content: "RESOLVE"; color: #7c3aed; } #ggrid>a[href$=".aep"]::before { content: "AFTER EFFECTS"; color: #7c3aed; }
#ggrid>a[href$=".psd"]::before { content: "PSD"; color: #2563eb; } #ggrid>a[href$=".ai"]::before { content: "AI"; color: #ea580c; }
#ggrid>a[href$=".xml"]::before { content: "XML"; }   #ggrid>a[href$=".fcpxml"]::before { content: "FCPXML"; }
#ggrid>a[href$=".dmg"]::before { content: "DMG"; }   #ggrid>a[href$=".pkg"]::before { content: "PKG"; }
#ggrid>a[href$=".key"]::before { content: "KEYNOTE"; color: #2563eb; } #ggrid>a[href$=".pages"]::before { content: "PAGES"; color: #ea580c; }
#ggrid>a[href$=".numbers"]::before { content: "NUMBERS"; color: #16a34a; }

/* ---------- upload panel ---------- */
#u2conf td.c { display: none !important; }
#u2conf { width: 100%; margin: 0; }
#u2conf #u2btn_cw { text-align: center; padding: 0; }
#u2conf #u2btn, #u2btn {
  display: block; width: auto; max-width: none;
  margin: .2em 0 1em 0; padding: 2.2em 1em;
  border: 2px dashed var(--u2-btn-b1); border-radius: var(--radius);
  background: var(--bg-u3); font-size: 1.15em; line-height: 1.5;
  transition: background .12s, border-color .12s;
}
#u2btn:hover, #u2btn.drag, #u2btn:focus { background: var(--accent-soft); border-color: var(--accent); outline: none; }
#u2btn #u2bm { display: block; color: var(--accent); font-weight: 700; margin-bottom: .25em; }
#u2btn #u2bm sup { vertical-align: baseline; font-size: 1em; letter-spacing: .12em; }
#u2cards { margin-top: .5em; }
#u2cards a {
  box-sizing: border-box; display: inline-block; min-height: 40px; line-height: 38px;
  border-radius: 999px; padding: 0 1em; margin: 0 .25em .35em 0;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg-weak);
  font-size: .95em; box-shadow: none;
}
#u2cards a.act { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
#u2cards a span { color: inherit; }
#u2foot, #u2etaw, #u2etas, #u2etat { font-family: var(--font-main); color: var(--fg-weak); font-size: .95em; }
#u2tab { width: 100%; }
#u2tab td { padding: .5em .6em; border-bottom: 1px solid var(--line); }

/* ---------- floating bottom bar ---------- */
#widget { font-size: 16px; }
#wtoggle {
  font-size: 16px; top: -64px; height: 52px; padding: 0 6px;
  right: 1.2em;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 999px; box-shadow: var(--shadow-l); color: var(--fg);
}
#wtoggle, #wtoggle * { line-height: 52px; }
#wfm a, #wnp a, #wm3u a, #zip1, #wzip a, #wtoggle a {
  font-size: 18px; padding: 0 12px; margin: 0; position: static;
  display: inline-block; vertical-align: top; color: var(--fg);
}
#wtoggle a:hover, #wtoggle a:hover span { color: var(--accent); }
#wtoggle a span { display: inline !important; font-size: 15px; margin-left: 6px; vertical-align: top; color: var(--fg); }
#wfs, #wzip, #wnp, #wm3u { border-color: var(--line); margin-right: 4px; padding-right: 4px; }
#wzip a, #wzip a.l1 { font-size: 15px; padding: 0 9px; }
#wzip a.l1, #wzip1 a { color: var(--accent); }
#wtoggle a#wtgrid { font-size: 0 !important; }
#wtgrid::before { content: "☷"; font-size: 20px; vertical-align: top; }
#wtgrid::after { content: "View"; font-size: 15px; margin-left: 6px; vertical-align: top; }
#wtico, #wnp, #wm3u { display: none !important; }
/* i gruppi di pulsanti stanno sulla stessa riga; le voci su due righe (dimensione
   della selezione, "sel. all", "sel. inv.") restano alte quanto la barra */
#wtoggle > span { vertical-align: top; }
#wtoggle #wfs, #wtoggle #selall, #wtoggle #selinv {
  line-height: 1.15; height: 52px; box-sizing: border-box; padding-top: 9px; font-size: 13px;
}
#wtoggle #wfs * { line-height: 1.15; }
#wtoggle.sel #wzip a.l1 { top: 0; margin: 0; padding: 0 9px; height: 52px; }
#wtoggle a#seldl { font-size: 0 !important; }
#seldl::before { content: "⬇"; font-size: 18px; vertical-align: top; }
#seldl::after { content: "download"; font-size: 15px; margin-left: 6px; vertical-align: top; }

/* ---------- navigation tree (admin only) ---------- */
#tree { box-shadow: none; border-right: 1px solid var(--line); background: var(--tree-bg); font-size: 1.05em; }
#treeh { border-bottom: 1px solid var(--line); background: var(--tree-bg); padding: 0 .3em; }
#treeh .btn { display: none; }
#treeh #detree { color: var(--fg-weak); font-size: .95em; }
#treeul a, #treepar a { border-radius: var(--radius-s); }
#treeul a.hl { background: var(--accent); color: #fff; }
#tree ul { border-left: 1px solid var(--line); }

/* ---------- footer ---------- */
#wfp { font-size: .9em; font-weight: 400; margin-top: 3em; }
#wfp a { color: var(--fg-weak); display: inline-block; min-height: 40px; line-height: 40px; }
#goh+span { border-left: 1px solid var(--line); color: var(--fg-weak); }
#pro.logue, #epi.logue { margin: 1em 0; }

/* ---------- dialogs and toasts ---------- */
#modalc {
  background: var(--surface); color: var(--fg);
  border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow-l); padding: 1.5em 1.6em;
  font-family: var(--font-main); font-size: 1em;
}
#modalc h6 { font-size: 1em; font-weight: 700; margin: .8em 0 .3em 0; }
#modalc td { padding: .4em .5em; }
#modalb { margin-top: .8em; }
#modalb a { margin-left: .4em; }
#modalb a:hover { background: var(--bg-u3); }
#modalb a#modal-ok, #modalb a.ok { background: var(--btn-1-bg); color: var(--btn-1-fg); border-color: transparent; }
#modalb a#modal-ok:hover, #modalb a.ok:hover { background: var(--btn-1h-bg); }
#modali { width: 100%; }
#toast {
  border-radius: var(--radius) 0 0 var(--radius); border-width: 0 0 0 .35em;
  box-shadow: var(--shadow-l); font-family: var(--font-main); font-size: 1em;
}
#tt { border-radius: var(--radius-s); font-family: var(--font-main); }

/* ---------- share / rename dialogs ---------- */
#shui, #rui {
  box-sizing: border-box; width: 100%; max-height: 100%;
  background: var(--surface); border-bottom: 1px solid var(--line);
  box-shadow: var(--shadow-l); padding: 1.2em 1.5em 1.4em 1.5em;
  font-family: var(--font-main); color: var(--fg);
}
#shui table { table-layout: auto; }
#shui tr + tr td:first-child { width: 7em; white-space: nowrap; color: var(--fg-weak); font-size: .95em; }
#shui td { padding: .45em 0; }
#shui td+td input[type="text"] { width: 100%; }
#shui input[readonly] { color: var(--fg-weak); background: var(--bg-u3); }
#shui td.exs input[type="text"] { width: 4.5em; text-align: center; margin-right: .3em; }
#shui button, #rui button { margin: 0 .5em .5em 0; }
#shui button:hover { background: var(--bg-u3); }
#shui #sh_apply { background: var(--btn-1-bg); color: var(--btn-1-fg); border-color: transparent; }
#shui #sh_apply:hover { background: var(--btn-1h-bg); }
#shui #sh_abrt { color: var(--fg-weak); }
#shui td.exs button { min-height: 40px; line-height: 38px; padding: 0 .9em; margin: 0; }
#shui .sh_axs .btn {
  box-sizing: border-box; display: inline-block; min-height: 40px; line-height: 38px;
  border-radius: 999px; padding: 0 1em; margin: 0 .3em .3em 0;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); box-shadow: none;
}
#shui .sh_axs .btn.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ---------- settings and search panels ---------- */
#op_cfg { font-size: 1em; }
#op_cfg h3 { font-size: .8em; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-weak); margin: 1em 0 .4em .3em; }
#op_cfg a.tgl, #op_cfg .btn, #op_search .btn {
  box-sizing: border-box; display: inline-block; min-height: 40px; line-height: 38px;
  border-radius: 999px; padding: 0 .9em; margin: .15em;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); box-shadow: none; font-size: 1em;
}
#op_cfg a.tgl.on { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
#op_cfg select { font-family: inherit; min-height: 40px; }
#op_search table td { padding: .3em .4em; }
#op_search input[type=text] { width: 100%; }

/* generic buttons */
input[type=submit], input[type=button], button, .btn { font-family: inherit; border-radius: var(--radius-s); }

/* ---------- guest mode (not signed in) ---------- */
html.ap-guest #tree { display: none !important; }
html.ap-guest #wrap { margin-left: 1.5em !important; }
html.ap-guest #entree, html.ap-guest #detree, html.ap-guest #entree + i { display: none !important; }
html.ap-guest #opa_cfg, html.ap-guest #wfp { display: none !important; }
html.ap-guest #path { display: block !important; padding-top: .5em; }
html.ap-guest #path > a[href="/"], html.ap-guest #path > a[href="/"] + i,
html.ap-guest #path > a[href="/s/"], html.ap-guest #path > a[href="/s/"] + i { display: none !important; }
/* non-admin users: same simplified layout as guests (no tree, no control panel) */
html.ap-noadmin #tree { display: none !important; }
html.ap-noadmin #wrap { margin-left: 1.5em !important; }
html.ap-noadmin #entree, html.ap-noadmin #entree + i { display: none !important; }
html.ap-noadmin #path { display: block !important; padding-top: .5em; }
html.ap-noadmin #path > a[href="/"], html.ap-noadmin #path > a[href="/"] + i,
html.ap-noadmin #path > a[href="/shared/"], html.ap-noadmin #path > a[href="/shared/"] + i { display: none !important; }
html.ap-noadmin #wfp { display: none !important; }
/* non-admin: no settings panel, no zip downloads (disabled server-side too) */
html.ap-noadmin #opa_cfg, html.ap-noadmin #op_cfg,
html.ap-noadmin #wzip1, html.ap-noadmin #selzip, html.ap-noadmin #fshr { display: none !important; }
/* chi non può scrivere (Students) non ha dove incollare: niente "copy" (era l’unico pulsante del gruppo #wfm rimasto a loro) */
html.ap-noup #fcpy, html.ap-noup #wfm { display: none !important; }
html.ap-noup #wfm.act + #wzip1 + #wzip { margin-left: 0; padding-left: 0; border-left-width: 0; }
/* no write permission: no upload button */
html.ap-noup #opa_up, html.ap-noup #op_up2k { display: none !important; }
html.ap-noup.ap-guest #ops { display: none; }

/* ---------- sign-in page ---------- */
#ht_spl body { font-size: 16px; }
#ht_spl #wrap {
  max-width: 420px; margin: 10vh auto 0 auto;
  padding: 2em 2em 1.8em 2em;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; box-shadow: var(--shadow-l); min-height: 0;
}
#ht_spl #wrap::before { content: "P-Drive"; display: block; font-size: 1.5em; font-weight: 700; margin-bottom: .1em; }
#ht_spl #b { color: var(--fg-weak); font-size: 1em; margin: 0 0 1.2em 0; }
#ht_spl #b small { display: none; }
#ht_spl h1 { font-size: .8em; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--fg-weak); margin: 1.2em 0 .5em 0; border: none; }
#ht_spl #lp {
  width: 100%; box-sizing: border-box; min-height: 48px;
  padding: .7em 1em; margin: 0 0 .6em 0;
  border: 1px solid var(--line-2); border-radius: var(--radius-s);
  font-size: 1.05em; font-family: inherit; font-style: normal;
  background: var(--txt-bg); color: var(--fg);
}
#ht_spl #lp::placeholder { color: var(--fg-weak); font-style: normal; }
#ht_spl #lp:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent); }
#ht_spl #ls {
  width: 100%; min-height: 48px; line-height: 46px; margin: 0;
  border-radius: var(--radius-s); border: none;
  background: var(--btn-1-bg); color: var(--btn-1-fg); font-size: 1.05em;
}
#ht_spl #ls:hover { background: var(--btn-1h-bg); }
#ht_spl #a, #ht_spl #v, #ht_spl #w, #ht_spl #wb, #ht_spl #pb, #ht_spl #cc, #ht_spl .agr, #ht_spl #lm:empty { display: none; }
#ht_spl #wrap ul { padding-left: 1.2em; margin: 0; }
#ht_spl #wrap ul li { margin: .3em 0; line-height: 40px; }
#ht_spl #wrap h1#l { margin-top: 0; }
#ht_spl #wrap a.af, #ht_spl #wrap ul a { color: var(--accent); }
#ht_spl #wrap #x { color: var(--fg-weak); }

/* ---------- shares page ---------- */
#ht_shr body { font-size: 15px; }
#ht_shr #wrap { margin: 2em 1.5em; padding: 0; min-height: 0; }
#ht_shr table {
  border-collapse: separate; border-spacing: 0;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
}
#ht_shr th { background: var(--bg-u3); color: var(--fg-weak); font-weight: 600; font-size: .8em; text-transform: uppercase; letter-spacing: .04em; padding: .8em .9em; border-bottom: 1px solid var(--line); text-align: left; }
#ht_shr td { padding: .6em .9em; border-bottom: 1px solid var(--line); height: 44px; }
#ht_shr tr:last-child td { border-bottom: none; }
#ht_shr a.af, #ht_shr a.r { color: var(--accent); }
#ht_shr a.r { color: #dc2626; }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  body { font-size: 16px; }
  #ops, #path, #ap-head, html.b .opview, html.ap-guest #wrap, html.ap-noadmin #wrap { padding-left: .8em; padding-right: .8em; margin-left: 0 !important; margin-right: 0; }
  #ap-head { margin-top: 3.4em; }
  #ap-head .ap-hint { display: none; }
  #ap-theme span { display: none; }
  #ap-theme { padding: 0 .7em; }
  #ops a { padding: 0 .9em; }
  #files thead th[name="tags/.files"], #files td.ap-files,
  #files thead th[name="ext"], #files td.ap-ext,
  #files thead th[name="ts"], #files td.ap-ts { display: none; }
  #wtoggle { right: .6em; top: -60px; height: 50px; }
  #wtoggle, #wtoggle * { line-height: 50px; }
  /* barra della selezione: solo icone, e se non ci sta scorre di lato invece di uscire dallo schermo */
  #wtoggle.sel { max-width: calc(100vw - 1.2em); box-sizing: border-box; overflow-x: auto; overflow-y: hidden; white-space: nowrap; scrollbar-width: none; }
  #wtoggle.sel::-webkit-scrollbar { display: none; }
  #wtoggle.sel a span, #seldl::after, #wtoggle.sel #wtgrid::after { display: none !important; }
  #wtoggle.sel a { padding: 0 10px; }
  #wtoggle #wfs, #wtoggle #selall, #wtoggle #selinv, #wtoggle.sel #wzip a.l1 { height: 50px; }
  #ghead > span:nth-of-type(3) { flex-basis: 100%; margin-left: 0; }
  #shui tr + tr td:first-child { width: 5.5em; }
}
