/* =========================================================
   Geina File Manager — stile
   ========================================================= */
:root {
  --bg: #0b0f1a;
  --bg2: #11172a;
  --panel: rgba(22, 29, 51, .72);
  --panel-solid: #161d33;
  --panel-2: rgba(255, 255, 255, .04);
  --hover: rgba(255, 255, 255, .06);
  --border: rgba(255, 255, 255, .09);
  --border-strong: rgba(255, 255, 255, .16);
  --text: #e7eaf3;
  --muted: #8f98b3;
  --faint: #5d6684;
  --accent: #6366f1;
  --accent-2: #22d3ee;
  --accent-soft: rgba(99, 102, 241, .16);
  --grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 45%, #22d3ee 100%);
  --danger: #f43f5e;
  --danger-soft: rgba(244, 63, 94, .14);
  --ok: #10b981;
  --ok-soft: rgba(16, 185, 129, .14);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, .14);
  --shadow: 0 20px 50px -12px rgba(0, 0, 0, .55);
  --shadow-sm: 0 6px 18px -6px rgba(0, 0, 0, .45);
  --r: 16px;
  --r-sm: 10px;
  --orb-a: #4f46e5; --orb-b: #0891b2; --orb-c: #9333ea;
  --orb-op: .32;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #f3f5fb;
    --bg2: #e9edf7;
    --panel: rgba(255, 255, 255, .78);
    --panel-solid: #ffffff;
    --panel-2: rgba(15, 23, 42, .03);
    --hover: rgba(15, 23, 42, .05);
    --border: rgba(15, 23, 42, .09);
    --border-strong: rgba(15, 23, 42, .16);
    --text: #141a2e;
    --muted: #5c6683;
    --faint: #98a0b8;
    --accent-soft: rgba(99, 102, 241, .11);
    --shadow: 0 20px 50px -18px rgba(30, 41, 80, .28);
    --shadow-sm: 0 6px 18px -8px rgba(30, 41, 80, .25);
    --orb-op: .18;
    color-scheme: light;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14.5px/1.5 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
a { color: var(--accent-2); }
svg { width: 1.2em; height: 1.2em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
::selection { background: rgba(99, 102, 241, .35); }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }

/* ---------- sfondo animato ---------- */
.orbs { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.orbs span { position: absolute; width: 46vmax; height: 46vmax; border-radius: 50%; filter: blur(90px); opacity: var(--orb-op); animation: float 26s ease-in-out infinite alternate; }
.orbs span:nth-child(1) { background: var(--orb-a); top: -18vmax; left: -10vmax; }
.orbs span:nth-child(2) { background: var(--orb-b); bottom: -22vmax; right: -12vmax; animation-delay: -8s; }
.orbs span:nth-child(3) { background: var(--orb-c); top: 30%; left: 45%; width: 30vmax; height: 30vmax; animation-delay: -15s; opacity: calc(var(--orb-op) * .6); }
@keyframes float { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(6vmax, 4vmax) scale(1.08); } 100% { transform: translate(-4vmax, 7vmax) scale(.95); } }
@media (prefers-reduced-motion: reduce) { .orbs span { animation: none; } * { transition: none !important; animation-duration: .01ms !important; } }

/* ---------- bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  height: 38px; padding: 0 16px; border-radius: 11px;
  border: 1px solid var(--border); background: var(--panel-2);
  font-weight: 600; font-size: 14px; white-space: nowrap; text-decoration: none; color: var(--text);
  transition: transform .15s, background .2s, border-color .2s, box-shadow .2s, opacity .2s;
}
.btn:hover { background: var(--hover); border-color: var(--border-strong); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn.primary { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 8px 24px -8px rgba(99, 102, 241, .8); background-size: 140% 140%; }
.btn.primary:hover { background-position: 100% 0; box-shadow: 0 12px 30px -8px rgba(99, 102, 241, .95); }
.btn.ghost { background: transparent; }
.btn.danger { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.btn.danger:hover { background: var(--danger); color: #fff; }
.btn.big { height: 48px; font-size: 15px; border-radius: 13px; }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13px; border-radius: 9px; }
.btn.loading { position: relative; color: transparent !important; }
.btn.loading::after { content: ""; position: absolute; width: 18px; height: 18px; border: 2.5px solid rgba(255, 255, 255, .35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.w100 { width: 100%; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 11px; border: 1px solid transparent; background: transparent; color: var(--muted); transition: .2s; }
.icon-btn:hover { background: var(--hover); color: var(--text); }
.icon-btn.sm { width: 30px; height: 30px; border-radius: 8px; }
.icon-btn.on { color: var(--accent-2); }

.select, .input {
  height: 38px; border-radius: 11px; border: 1px solid var(--border); background: var(--panel-2); padding: 0 12px; outline: none; transition: border-color .2s, box-shadow .2s;
}
.select { padding-right: 30px; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238f98b3' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 9px center; background-size: 15px; }
.select option { background: var(--panel-solid); color: var(--text); }
.input { width: 100%; }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.input.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .12em; }

/* =========================================================
   AUTH / DOWNLOAD
   ========================================================= */
body.auth { display: grid; place-items: center; min-height: 100%; padding: 24px 16px; }
.auth-card {
  position: relative; z-index: 1; width: 100%; max-width: 400px; text-align: center;
  background: var(--panel); border: 1px solid var(--border); border-radius: 26px; padding: 36px 30px 22px;
  backdrop-filter: blur(22px) saturate(1.3); -webkit-backdrop-filter: blur(22px) saturate(1.3);
  box-shadow: var(--shadow); animation: rise .5s cubic-bezier(.2, .8, .2, 1);
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.auth-card h1 { margin: 6px 0 4px; font-size: 22px; letter-spacing: -.01em; }
.auth-card .sub { margin: 0 0 22px; color: var(--muted); }
.lock-badge {
  width: 76px; height: 76px; margin: 0 auto 14px; border-radius: 24px; display: grid; place-items: center;
  background: var(--grad); color: #fff; box-shadow: 0 16px 36px -10px rgba(99, 102, 241, .85); position: relative;
}
.lock-badge::after { content: ""; position: absolute; inset: -6px; border-radius: 28px; border: 1px solid rgba(99, 102, 241, .45); animation: pulse 2.4s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.92); opacity: 1; } 100% { transform: scale(1.25); opacity: 0; } }
.lock-badge svg { width: 36px; height: 36px; stroke-width: 1.7; }
.lock-badge .dot { fill: #fff; stroke: none; }
.lock-badge.is-locked { background: linear-gradient(135deg, #f43f5e, #f59e0b); box-shadow: 0 16px 36px -10px rgba(244, 63, 94, .7); }
.lock-badge.is-missing { background: linear-gradient(135deg, #475569, #1e293b); box-shadow: var(--shadow-sm); }
.lock-badge.is-missing::after { display: none; }

.pin-form { display: grid; gap: 14px; text-align: left; }
.lbl { font-size: 13.5px; color: var(--muted); text-align: center; }
.pin-field { position: relative; }
.pin-field input {
  width: 100%; height: 58px; border-radius: 15px; border: 1px solid var(--border-strong); background: var(--panel-2);
  text-align: center; font-size: 24px; letter-spacing: .32em; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  outline: none; padding: 0 48px; transition: border-color .2s, box-shadow .2s;
}
.pin-field input::placeholder { color: var(--faint); letter-spacing: .2em; font-size: 18px; }
.pin-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 5px var(--accent-soft); }
.pin-field .eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 40px; height: 40px; border: 0; background: none; color: var(--muted); border-radius: 10px; display: grid; place-items: center; }
.pin-field .eye:hover, .pin-field .eye.on { color: var(--accent-2); }

.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 4px 0 6px; }
.keypad button {
  height: 54px; border-radius: 15px; border: 1px solid var(--border); background: var(--panel-2); font-size: 21px; font-weight: 600;
  transition: background .15s, transform .1s;
}
.keypad button:hover { background: var(--hover); }
.keypad button.muted { color: var(--muted); font-size: 18px; }
.keypad button.tap { animation: tap .25s; }
@keyframes tap { 50% { transform: scale(.92); background: var(--accent-soft); } }
@media (pointer: coarse) and (max-width: 420px) { .keypad button { height: 58px; } }

.hint { margin: 0; font-size: 12.5px; color: var(--muted); text-align: center; }
.foot { margin: 22px 0 0; font-size: 12px; color: var(--faint); display: flex; gap: 6px; align-items: center; justify-content: center; }
.foot svg { width: 14px; height: 14px; }

.alert { border-radius: 12px; padding: 11px 14px; font-size: 13.5px; margin: 0 0 14px; text-align: center; }
.alert.error { background: var(--danger-soft); color: #fda4af; border: 1px solid rgba(244, 63, 94, .3); }
.alert.warn { background: var(--warn-soft); color: #fcd34d; border: 1px solid rgba(245, 158, 11, .3); }
.alert.ok { background: var(--ok-soft); color: #6ee7b7; border: 1px solid rgba(16, 185, 129, .3); }
@media (prefers-color-scheme: light) {
  .alert.error { color: #be123c; } .alert.warn { color: #b45309; } .alert.ok { color: #047857; }
}
.alert .cd { font-variant-numeric: tabular-nums; }
.shake { animation: shake .45s; }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }

/* pagina download */
.dl-card { max-width: 430px; }
.file-hero { position: relative; width: 104px; height: 120px; margin: 0 auto 18px; }
.file-hero .file-shape { width: 96px; height: 116px; }
.file-hero .file-shape span { font-size: 17px; }
.lock-mini { position: absolute; right: -8px; bottom: -6px; width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; background: var(--panel-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm); color: var(--accent-2); }
.lock-mini.open { color: var(--ok); }
.fname { word-break: break-word; overflow-wrap: anywhere; font-size: 20px !important; }

/* =========================================================
   FORME ICONA FILE
   ========================================================= */
.file-shape {
  --c1: #94a3b8; --c2: #64748b;
  position: relative; display: grid; place-items: end center; padding-bottom: 18%;
  background: linear-gradient(160deg, var(--c1), var(--c2));
  border-radius: 12% 28% 12% 12% / 10% 22% 10% 10%;
  box-shadow: inset 0 -10px 20px -12px rgba(0, 0, 0, .35), 0 10px 24px -12px var(--c2);
  clip-path: polygon(0 0, 70% 0, 100% 24%, 100% 100%, 0 100%);
}
.file-shape::before { content: ""; position: absolute; top: 0; right: 0; width: 30%; height: 24%; background: linear-gradient(225deg, transparent 50%, rgba(255, 255, 255, .45) 50%); border-bottom-left-radius: 22%; }
.file-shape span { color: #fff; font-weight: 800; letter-spacing: .04em; font-size: 11px; text-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.kind-archive .file-shape, .file-shape.kind-archive { --c1: #fbbf24; --c2: #f97316; }
.kind-image .file-shape, .file-shape.kind-image { --c1: #f472b6; --c2: #8b5cf6; }
.kind-video .file-shape, .file-shape.kind-video { --c1: #fb7185; --c2: #e11d48; }
.kind-audio .file-shape, .file-shape.kind-audio { --c1: #34d399; --c2: #0d9488; }
.kind-pdf .file-shape, .file-shape.kind-pdf { --c1: #f87171; --c2: #b91c1c; }
.kind-doc .file-shape, .file-shape.kind-doc { --c1: #60a5fa; --c2: #2563eb; }
.kind-sheet .file-shape, .file-shape.kind-sheet { --c1: #4ade80; --c2: #15803d; }
.kind-slide .file-shape, .file-shape.kind-slide { --c1: #fb923c; --c2: #c2410c; }
.kind-code .file-shape, .file-shape.kind-code { --c1: #94a3b8; --c2: #334155; }
.kind-app .file-shape, .file-shape.kind-app { --c1: #a78bfa; --c2: #4f46e5; }

.folder-shape { position: relative; width: 100%; height: 100%; }
.folder-shape::before { content: ""; position: absolute; left: 0; top: 4%; width: 44%; height: 24%; border-radius: 14% 30% 0 0; background: #4f46e5; }
.folder-shape::after { content: ""; position: absolute; inset: 14% 0 0 0; border-radius: 10%; background: linear-gradient(160deg, #818cf8 0%, #6366f1 45%, #06b6d4 100%); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .35), 0 12px 24px -12px rgba(99, 102, 241, .9); }

/* =========================================================
   APP LAYOUT
   ========================================================= */
body.app { display: grid; grid-template-columns: 272px 1fr; min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; z-index: 30; display: flex; flex-direction: column; gap: 18px;
  padding: 20px 16px; border-right: 1px solid var(--border);
  background: var(--panel); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 2px 6px; }
.brand .logo { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--grad); box-shadow: 0 10px 24px -8px rgba(99, 102, 241, .9); }
.brand .logo svg { fill: #fff; stroke: none; width: 24px; height: 24px; }
.brand strong { display: block; font-size: 15px; letter-spacing: -.01em; }
.brand small { color: var(--muted); font-size: 12px; }

.upload-wrap { position: relative; }
.upload-wrap .menu { left: 0; right: 0; top: calc(100% + 6px); }

.tree { flex: 1; overflow: auto; margin: 0 -6px; padding: 0 6px; }
.tree-item {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; text-align: left; color: var(--muted);
  height: 34px; padding: 0 10px; border-radius: 9px; font-size: 13.5px; transition: background .15s, color .15s;
}
.tree-item:hover { background: var(--hover); color: var(--text); }
.tree-item.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.tree-item.active > svg.fi { color: var(--accent-2); }
.tree-item .tw { width: 16px; height: 16px; display: grid; place-items: center; color: var(--faint); border-radius: 4px; transition: transform .2s; }
.tree-item .tw.open { transform: rotate(90deg); }
.tree-item .tw svg { width: 12px; height: 12px; stroke-width: 2.4; }
.tree-item .lbl2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.tree-item.drop-hover { background: var(--accent-soft); outline: 1.5px dashed var(--accent); }
.tree-title { font-size: 11px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin: 14px 10px 6px; }

.stats { border: 1px solid var(--border); border-radius: 14px; padding: 14px; background: var(--panel-2); font-size: 12.5px; color: var(--muted); }
.stats .row { display: flex; justify-content: space-between; margin-top: 6px; }
.stats .row b { color: var(--text); font-weight: 600; }
.stats .meter { height: 6px; border-radius: 6px; background: var(--hover); margin-top: 10px; overflow: hidden; }
.stats .meter i { display: block; height: 100%; background: var(--grad); border-radius: 6px; }

.main { position: relative; z-index: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; gap: 12px; align-items: center; padding: 14px 26px; background: color-mix(in srgb, var(--bg) 70%, transparent); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-bottom: 1px solid var(--border); }
.search { flex: 1; max-width: 520px; display: flex; align-items: center; gap: 10px; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--panel-2); color: var(--muted); transition: border-color .2s, box-shadow .2s; }
.search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.search input { flex: 1; border: 0; outline: 0; background: none; min-width: 0; }
.search input::-webkit-search-cancel-button { filter: grayscale(1); }
.search kbd { font: 11px ui-monospace, monospace; border: 1px solid var(--border-strong); border-radius: 5px; padding: 1px 6px; color: var(--faint); }
.top-actions { display: flex; gap: 10px; align-items: center; margin-left: auto; }
.seg { display: flex; padding: 3px; border-radius: 11px; border: 1px solid var(--border); background: var(--panel-2); }
.seg button { width: 32px; height: 30px; border: 0; background: none; border-radius: 8px; color: var(--muted); display: grid; place-items: center; }
.seg button.on { background: var(--accent-soft); color: var(--text); }
.avatar { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--grad); color: #fff; display: grid; place-items: center; }
.menu-wrap { position: relative; }

.menu {
  position: absolute; z-index: 60; top: calc(100% + 8px); min-width: 230px; padding: 6px; border-radius: 14px;
  background: var(--panel-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow);
  opacity: 0; transform: translateY(-6px) scale(.98); pointer-events: none; transition: .16s;
}
.menu.right { right: 0; }
.menu.open { opacity: 1; transform: none; pointer-events: auto; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border: 0; background: none; border-radius: 9px; text-align: left; font-size: 13.5px; color: var(--text); text-decoration: none; }
.menu button:hover, .menu a:hover { background: var(--hover); }
.menu button svg { color: var(--muted); }
.menu .danger { color: var(--danger); }
.menu .danger svg { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 4px; }
.ctx { position: fixed; }

.toolbar { display: flex; align-items: center; gap: 12px; padding: 18px 26px 6px; min-height: 58px; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; font-size: 15px; min-width: 0; }
.crumbs button { border: 0; background: none; padding: 5px 9px; border-radius: 8px; color: var(--muted); font-weight: 600; display: inline-flex; gap: 6px; align-items: center; max-width: 240px; }
.crumbs button span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs button:hover { background: var(--hover); color: var(--text); }
.crumbs button.cur { color: var(--text); font-size: 18px; }
.crumbs button.drop-hover { background: var(--accent-soft); }
.crumbs .sep { color: var(--faint); }
.crumbs .sep svg { width: 14px; height: 14px; }
.bulk { margin-left: auto; display: flex; align-items: center; gap: 8px; padding: 5px 6px 5px 14px; border-radius: 13px; background: var(--panel); border: 1px solid var(--border-strong); box-shadow: var(--shadow-sm); animation: rise .25s; flex-wrap: wrap; }
.bulk span { font-weight: 600; font-size: 13px; margin-right: 4px; }

.content { padding: 12px 26px 120px; flex: 1; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--faint); margin: 14px 2px 12px; font-weight: 600; }

/* ---------- griglia ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(178px, 1fr)); gap: 16px; }
.card {
  position: relative; border-radius: var(--r); border: 1px solid var(--border); background: var(--panel);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  padding: 14px; cursor: pointer; user-select: none; transition: transform .2s cubic-bezier(.2, .8, .2, 1), border-color .2s, box-shadow .2s, background .2s;
  animation: pop .35s cubic-bezier(.2, .8, .2, 1) both;
}
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.card:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.card.drop-hover { border-color: var(--accent-2); box-shadow: 0 0 0 4px rgba(34, 211, 238, .2); transform: scale(1.02); }
.card.dragging { opacity: .4; }
.card .thumb { height: 116px; border-radius: 12px; display: grid; place-items: center; margin-bottom: 12px; background: var(--panel-2); overflow: hidden; position: relative; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .thumb .file-shape { width: 62px; height: 76px; }
.card .thumb .folder-shape { width: 84px; height: 68px; }
.card.folder .thumb { background: linear-gradient(160deg, rgba(99, 102, 241, .1), rgba(34, 211, 238, .06)); }
.card .name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta { color: var(--muted); font-size: 12px; margin-top: 2px; display: flex; gap: 6px; align-items: center; overflow: hidden; white-space: nowrap; }
.card .meta .dot { opacity: .5; }
.card .check {
  position: absolute; top: 10px; left: 10px; z-index: 2; width: 24px; height: 24px; border-radius: 8px; border: 1.5px solid var(--border-strong);
  background: var(--panel-solid); display: grid; place-items: center; opacity: 0; transition: .15s; color: #fff;
}
.card .check svg { width: 14px; height: 14px; stroke-width: 3; opacity: 0; }
.card:hover .check, .has-selection .card .check { opacity: 1; }
.card.selected .check { background: var(--accent); border-color: var(--accent); opacity: 1; }
.card.selected .check svg { opacity: 1; }
.card .more { position: absolute; top: 8px; right: 8px; z-index: 2; opacity: 0; background: var(--panel-solid); border: 1px solid var(--border); }
.card:hover .more, .card .more.open { opacity: 1; }
.card .badges { position: absolute; left: 10px; bottom: 10px; display: flex; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 20px; font-size: 11.5px; font-weight: 600; background: var(--panel-solid); border: 1px solid var(--border); color: var(--muted); }
.chip svg { width: 12px; height: 12px; stroke-width: 2.2; }
.chip.lock { color: var(--accent-2); }
.card.file { container-type: inline-size; }
.card .quick { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.35fr); gap: 6px; margin-top: 10px; }
.card .quick .btn { min-width: 0; height: 30px; padding: 0 6px; gap: 5px; font-size: 12px; border-radius: 8px; white-space: nowrap; overflow: hidden; }
.card .quick .btn svg { width: 14px; height: 14px; flex: none; }
.card .quick .btn.curl { grid-column: 1 / -1; }
.card .quick .btn.curl i { font-style: normal; color: var(--faint); }
.btn.curl svg { color: #fbbf24; }
/* schede strette (telefono): niente icone in Link/Link+PIN, Curl senza descrizione */
@container (max-width: 150px) {
  .card .quick .btn:not(.curl) svg { display: none; }
  .card .quick .btn.curl i { display: none; }
}

/* ---------- elenco ---------- */
.list { border: 1px solid var(--border); border-radius: var(--r); background: var(--panel); backdrop-filter: blur(12px); overflow: hidden; }
.list .row { display: grid; grid-template-columns: 34px minmax(0, 1fr) 110px 150px 90px 176px; align-items: center; gap: 10px; padding: 9px 14px; border-top: 1px solid var(--border); cursor: pointer; transition: background .15s; }
.list .row:first-child { border-top: 0; }
.list .row.head { cursor: default; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--faint); font-weight: 600; background: var(--panel-2); }
.list .row:not(.head):hover { background: var(--hover); }
.list .row.selected { background: var(--accent-soft); }
.list .row.drop-hover { background: rgba(34, 211, 238, .12); }
.list .nm { display: flex; align-items: center; gap: 12px; min-width: 0; }
.list .nm .ic { width: 30px; height: 34px; flex: none; display: grid; place-items: center; }
.list .nm .ic .file-shape { width: 26px; height: 32px; padding-bottom: 3px; }
.list .nm .ic .file-shape span { font-size: 6.5px; }
.list .nm .ic .folder-shape { width: 30px; height: 25px; }
.list .nm b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .nm small { display: block; color: var(--faint); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .c { color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list .acts { display: flex; justify-content: flex-end; align-items: center; gap: 2px; }
.list .acts .btn.curl { height: 30px; padding: 0 9px; gap: 4px; font-size: 12px; border-radius: 8px; margin: 0 2px; }
.list .acts .btn.curl svg { width: 14px; height: 14px; }
.list .ck { width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--border-strong); display: grid; place-items: center; color: #fff; }
.list .ck svg { width: 12px; height: 12px; stroke-width: 3; opacity: 0; }
.list .row.selected .ck { background: var(--accent); border-color: var(--accent); }
.list .row.selected .ck svg { opacity: 1; }

/* ---------- vuoto ---------- */
.empty {
  margin: 20px auto; max-width: 640px; text-align: center; padding: 56px 24px; border-radius: 24px;
  border: 2px dashed var(--border-strong); background: var(--panel-2); transition: .2s;
}
.empty:hover { border-color: var(--accent); background: var(--accent-soft); }
.empty .ill { width: 120px; height: 100px; margin: 0 auto 18px; position: relative; }
.empty .ill .folder-shape { position: absolute; inset: 0; animation: bob 3.2s ease-in-out infinite; }
.empty .ill .arrow { position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%); color: #fff; z-index: 2; }
.empty .ill .arrow svg { width: 34px; height: 34px; stroke-width: 2.4; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.empty h3 { margin: 0 0 6px; font-size: 19px; }
.empty p { margin: 0 0 20px; color: var(--muted); }
.empty .row-btn { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

/* ---------- overlay trascinamento ---------- */
.drop-overlay { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; background: rgba(8, 11, 22, .55); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); opacity: 0; pointer-events: none; transition: opacity .2s; }
.drop-overlay.show { opacity: 1; }
.drop-overlay.passive { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; }
.drop-overlay.passive .drop-box { transform: translateY(calc(50vh - 120px)) scale(.75); }
.drop-box { text-align: center; padding: 46px 60px; border-radius: 28px; border: 2px dashed rgba(255, 255, 255, .55); background: rgba(99, 102, 241, .22); color: #fff; box-shadow: 0 30px 80px -20px rgba(99, 102, 241, .7); transition: transform .25s; pointer-events: none; }
.drop-overlay.show .drop-box { animation: breathe 1.6s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 30px 90px -10px rgba(34, 211, 238, .7); } }
.drop-icon { width: 74px; height: 74px; margin: 0 auto 14px; border-radius: 22px; display: grid; place-items: center; background: var(--grad); }
.drop-icon svg { width: 36px; height: 36px; stroke-width: 2.2; animation: up 1.2s ease-in-out infinite; }
@keyframes up { 50% { transform: translateY(-4px); } }
.drop-box h2 { margin: 0 0 4px; font-size: 24px; }
.drop-box p { margin: 0; opacity: .85; }

/* ---------- pannello upload ---------- */
.uploads {
  position: fixed; right: 22px; bottom: 22px; z-index: 70; width: 400px; max-width: calc(100vw - 24px);
  border-radius: 18px; background: var(--panel-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow); overflow: hidden; animation: rise .3s;
}
.uploads header { display: flex; align-items: center; gap: 4px; padding: 12px 10px 10px 16px; }
.uploads header div { flex: 1; min-width: 0; }
.uploads header strong { display: block; font-size: 14px; }
.uploads header small { color: var(--muted); font-size: 12px; }
.uploads.min ul { display: none; }
.uploads.min #upToggle svg { transform: rotate(180deg); }
.up-bar { height: 3px; background: var(--hover); }
.up-bar i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .3s; }
.uploads ul { list-style: none; margin: 0; padding: 6px; max-height: 340px; overflow: auto; }
.uploads li { display: grid; grid-template-columns: 30px 1fr auto; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; }
.uploads li:hover { background: var(--hover); }
.uploads li .file-shape { width: 24px; height: 30px; padding-bottom: 2px; }
.uploads li .file-shape span { font-size: 6px; }
.uploads li .n { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploads li .s { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uploads li .pb { height: 4px; border-radius: 4px; background: var(--hover); margin-top: 5px; overflow: hidden; }
.uploads li .pb i { display: block; height: 100%; width: 0; background: var(--grad); transition: width .2s; }
.uploads li.done .pb i { background: var(--ok); }
.uploads li.error .pb i { background: var(--danger); width: 100% !important; }
.uploads li.error .s { color: var(--danger); }
.uploads li .st { display: grid; place-items: center; color: var(--muted); }
.uploads li.done .st { color: var(--ok); }
.uploads li.error .st { color: var(--danger); }

/* ---------- modali ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 20px; background: rgba(5, 8, 18, .55); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.modal { width: 100%; max-width: 480px; max-height: calc(100vh - 40px); overflow: auto; border-radius: 22px; background: var(--panel-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow); animation: rise .28s cubic-bezier(.2, .8, .2, 1); }
.modal.wide { max-width: 640px; }
.modal-head { display: flex; align-items: flex-start; gap: 14px; padding: 22px 22px 0; }
.modal-head .mi { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-2); flex: none; }
.modal-head .mi.danger { background: var(--danger-soft); color: var(--danger); }
.modal-head .mi.ok { background: var(--ok-soft); color: var(--ok); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-head p { margin: 3px 0 0; color: var(--muted); font-size: 13.5px; word-break: break-word; }
.modal-head .x { margin-left: auto; }
.modal-body { padding: 18px 22px; display: grid; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 22px 22px; flex-wrap: wrap; }
.field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.field > span { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.field .err { color: var(--danger); font-size: 12.5px; }
.inline { display: flex; gap: 8px; }
.inline .input { flex: 1; }

.opts { display: grid; gap: 10px; }
.opt { display: flex; gap: 12px; align-items: flex-start; padding: 13px 14px; border-radius: 14px; border: 1.5px solid var(--border); cursor: pointer; transition: .15s; }
.opt:hover { border-color: var(--border-strong); }
.opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.opt input { accent-color: var(--accent); margin-top: 3px; }
.opt b { display: block; font-size: 14px; }
.opt small { color: var(--muted); font-size: 12.5px; }
.opt .extra { margin-top: 10px; display: none; }
.opt:has(input:checked) .extra { display: flex; }

.summary { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 14px; background: var(--panel-2); border: 1px solid var(--border); }
.summary .file-shape { width: 40px; height: 50px; padding-bottom: 5px; }
.summary .file-shape span { font-size: 8px; }
.summary .folder-shape { width: 46px; height: 38px; }
.summary b { display: block; }
.summary small { color: var(--muted); }

.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 14px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; word-break: break-word; }
.linkbox { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 12px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--panel-2); }
.linkbox code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 13px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--accent-2); }
.pinbox { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 12px; border: 1px solid var(--border-strong); background: linear-gradient(135deg, rgba(99, 102, 241, .12), rgba(34, 211, 238, .08)); }
.pinbox code { flex: 1; min-width: 0; overflow: hidden; font: 700 20px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .25em; }
.pinbox code.hidden-pin { color: var(--muted); letter-spacing: .3em; }

.results { border: 1px solid var(--border); border-radius: 14px; overflow: hidden; max-height: 320px; overflow-y: auto; }
.results .r { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 12px; border-top: 1px solid var(--border); font-size: 13px; }
.results .r:first-child { border-top: 0; }
.results .r .nm2 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.results .r .nm2 small { display: block; color: var(--faint); overflow: hidden; text-overflow: ellipsis; }
.results .r code { font: 700 14px ui-monospace, monospace; letter-spacing: .12em; color: var(--accent-2); }

.picker { border: 1px solid var(--border); border-radius: 14px; padding: 6px; max-height: 300px; overflow: auto; }
.picker .tree-item.active { background: var(--accent); color: #fff; }
.picker .tree-item.active svg { color: #fff; }
.picker .tree-item.disabled { opacity: .35; pointer-events: none; }

/* ---------- toast ---------- */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; justify-items: center; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 13px; background: var(--panel-solid); border: 1px solid var(--border-strong); box-shadow: var(--shadow); font-size: 13.5px; font-weight: 500; animation: toastIn .3s cubic-bezier(.2, .8, .2, 1); pointer-events: auto; max-width: min(520px, calc(100vw - 32px)); }
.toast.out { animation: toastOut .25s forwards; }
.toast .ti { color: var(--ok); }
.toast.error .ti { color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px) scale(.96); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(8px); } }

.scrim { display: none; }
.only-mobile { display: none; }
.skeleton { height: 180px; border-radius: var(--r); background: linear-gradient(90deg, var(--panel-2), var(--hover), var(--panel-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .list .row { grid-template-columns: 34px minmax(0, 1fr) 90px 80px 166px; }
  .list .row .c.date { display: none; }
}
@media (max-width: 860px) {
  body.app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: 284px; transform: translateX(-105%); transition: transform .3s cubic-bezier(.2, .8, .2, 1); background: var(--panel-solid); }
  .sidebar.open { transform: none; box-shadow: var(--shadow); }
  .scrim { position: fixed; inset: 0; z-index: 25; background: rgba(0, 0, 0, .45); }
  .sidebar.open + .scrim { display: block; }
  .only-mobile { display: inline-grid; }
  .topbar { padding: 12px 16px; gap: 8px; }
  .toolbar { padding: 14px 16px 4px; }
  .content { padding: 10px 16px 120px; }
  .hide-sm, .search kbd, #sort { display: none; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(146px, 1fr)); gap: 12px; }
  .card .thumb { height: 96px; }
  .card .check, .card .more { opacity: 1; }
  .bulk { width: 100%; margin-left: 0; }
  .list .row { grid-template-columns: 30px minmax(0, 1fr) 76px 44px; }
  .list .row .c.dl, .list .row .c.date { display: none; }
  .list .acts > :not([data-more]) { display: none; }  /* su telefono le azioni sono nel menu ⋯ */
  .kv { grid-template-columns: 1fr; gap: 2px; }
  .kv dd { margin-bottom: 8px; }
  .uploads { right: 12px; bottom: 12px; }
}

/* ---------- impostazioni ---------- */
.modal.settings { max-width: 760px; }
.tabs { width: max-content; max-width: 100%; }
.tabs button { width: auto; padding: 0 14px; font-size: 13px; font-weight: 600; }
.set-g + .set-g { margin-top: 4px; }
.set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px 16px; }
.set-h { color: var(--faint, var(--muted)); font-size: 11.5px; line-height: 1.4; }
.lnk { background: none; border: 0; padding: 0; color: var(--accent-2); font: inherit; text-decoration: underline dotted; cursor: pointer; }
.unit { display: flex; align-items: center; gap: 8px; }
.unit .input { flex: 1; min-width: 0; }
.unit em { font-style: normal; font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.sw { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 13.5px; min-height: 40px; }
.sw input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.sw i { width: 40px; height: 22px; border-radius: 99px; background: var(--border-strong); position: relative; transition: .15s; flex: none; }
.sw i::after { content: ''; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: .15s; }
.sw input:checked + i { background: var(--accent); }
.sw input:checked + i::after { left: 21px; }
.sw input:focus-visible + i { box-shadow: 0 0 0 4px var(--accent-soft); }
.kvs { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 8px; }
.kvs div { display: flex; justify-content: space-between; gap: 10px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; font-size: 13px; }
.kvs span { color: var(--muted); }
.kvs b { text-align: right; word-break: break-all; }
.sec-act { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; }
.sec-act + .sec-act { margin-top: 10px; }
.sec-act div { flex: 1; min-width: 0; }
.sec-act b { display: block; font-size: 14px; }
.sec-act small { color: var(--muted); font-size: 12.5px; }
.audit { border: 1px solid var(--border); border-radius: 12px; max-height: 380px; overflow: auto; }
.audit .a { display: grid; grid-template-columns: 112px 1fr auto; gap: 2px 12px; padding: 9px 12px; font-size: 12.5px; border-bottom: 1px solid var(--border); }
.audit .a:last-child { border-bottom: 0; }
.audit time { color: var(--muted); font-variant-numeric: tabular-nums; }
.audit .a span { grid-column: 2; color: var(--muted); word-break: break-word; }
.audit .a code { grid-row: 1; grid-column: 3; color: var(--muted); font-size: 11.5px; }
.audit .a.bad b { color: var(--danger); }
.confirm-pin { padding-top: 12px; border-top: 1px solid var(--border); }
@media (max-width: 560px) {
  .audit .a { grid-template-columns: 1fr auto; }
  .audit .a b, .audit .a span { grid-column: 1 / -1; }
  .sec-act { flex-direction: column; align-items: stretch; }
}
