@font-face {
  font-family: 'OCR A Regular';
  src: url('../fonts/OCRARegular.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

:root {
  --term-bg: #050505;
  --term-bg-raised: #0c0f0d;
  --term-green: #00ff88;
  --term-green-dim: #0a8f53;
  --term-green-muted: #4d9c79;
  --term-border: #114a30;
  --term-red: #ff4d6a;
  --term-amber: #ffcc66;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--term-bg);
  color: var(--term-green);
  font-family: 'JetBrains Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

a { color: inherit; }

.glow-text { text-shadow: 0 0 6px rgba(0, 255, 136, 0.35); }
.glow-border { box-shadow: 0 0 12px rgba(0, 255, 136, 0.12); }

.terminal-panel {
  background: var(--term-bg-raised);
  border: 1px solid var(--term-border);
  border-radius: 6px;
}

.blink-cursor::after {
  content: "_";
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }

@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.fade-in { animation: fade-in 0.4s ease-out; }

/* --- Auth pages --- */
.auth-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem;
  position: relative;
  overflow: hidden;
}
.auth-shell::before {
  content: '';
  position: fixed;
  left: 0; right: 0; bottom: 0;
  height: 60vh;
  background-image:
    linear-gradient(rgba(0,255,136,0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,255,136,0.35) 1px, transparent 1px);
  background-size: 48px 48px;
  transform: perspective(300px) rotateX(60deg) scale(2.2);
  transform-origin: center bottom;
  animation: auth-grid-scroll 1.8s linear infinite;
  opacity: 0.4;
  pointer-events: none;
  z-index: 0;
  mask-image: linear-gradient(to top, black 40%, transparent 100%);
}
@keyframes auth-grid-scroll { from { background-position: 0 0; } to { background-position: 0 48px; } }
.auth-card, .share-shell { position: relative; z-index: 1; }
.auth-card { width: 100%; max-width: 28rem; }
.auth-prompt { font-size: 0.875rem; color: var(--term-green-muted); margin-bottom: 1rem; }
.auth-panel { padding: 1.5rem; }
.auth-title { font-size: 1.1rem; font-weight: 700; margin: 0 0 1rem; }

.field { margin-bottom: 1rem; }
.field label {
  display: block; font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--term-green-muted); margin-bottom: 0.25rem;
}
.field input, .field select {
  width: 100%; background: rgba(0,0,0,0.4); border: 1px solid var(--term-border);
  color: var(--term-green); border-radius: 4px; padding: 0.5rem 0.75rem; font-size: 0.875rem;
  font-family: inherit;
}
.field input:focus, .field select:focus { outline: none; border-color: var(--term-green); }
.field input::placeholder { color: rgba(10, 143, 83, 0.6); }

/* Password field with show/hide eye toggle */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 2.5rem; }
.pw-toggle {
  position: absolute; top: 0; right: 0; height: 100%; width: 2.5rem;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer; padding: 0;
  color: var(--term-green-muted); transition: color 0.15s ease;
}
.pw-toggle:hover { color: var(--term-green); }
.pw-toggle:focus-visible { outline: 1px solid var(--term-green); border-radius: 4px; }
.pw-toggle .pw-eye-off { display: none; }
.pw-toggle.pw-shown .pw-eye-open { display: none; }
.pw-toggle.pw-shown .pw-eye-off { display: inline; }

.btn {
  display: inline-block; width: 100%; text-align: center; cursor: pointer;
  border: 1px solid var(--term-green); background: rgba(0,255,136,0.1); color: var(--term-green);
  border-radius: 4px; padding: 0.5rem; font-size: 0.875rem; font-weight: 500; font-family: inherit;
}
.btn:hover { background: rgba(0,255,136,0.2); }
.btn-danger { border-color: var(--term-red); color: var(--term-red); background: rgba(255,77,106,0.05); width: auto; padding: 0.25rem 0.75rem; }
.btn-danger:hover { background: rgba(255,77,106,0.1); }
.btn-small { width: auto; padding: 0.25rem 0.75rem; font-size: 0.8rem; }

.msg-error { color: var(--term-red); border: 1px solid rgba(255,77,106,0.4); background: rgba(255,77,106,0.05); border-radius: 4px; padding: 0.5rem 0.75rem; font-size: 0.875rem; margin-bottom: 1rem; }
.msg-success { color: var(--term-green); border: 1px solid rgba(0,255,136,0.4); background: rgba(0,255,136,0.05); border-radius: 4px; padding: 0.5rem 0.75rem; font-size: 0.875rem; margin-bottom: 1rem; }

.auth-links { display: flex; justify-content: space-between; margin-top: 1.25rem; font-size: 0.75rem; color: var(--term-green-muted); }
.auth-links a:hover { color: var(--term-green); text-decoration: underline; }


/* --- App shell --- */
.app-shell { display: flex; min-height: 100vh; }
.sidebar { width: 14rem; flex-shrink: 0; border-right: 1px solid var(--term-border); background: var(--term-bg-raised); display: flex; flex-direction: column; }
.sidebar-brand { padding: 1rem; border-bottom: 1px solid var(--term-border); }
.sidebar-brand strong { font-size: 0.875rem; font-family: 'OCR A Regular', 'Courier New', monospace; letter-spacing: 0.08em; font-weight: 400; }
.sidebar-brand small { display: block; color: var(--term-green-muted); font-size: 0.625rem; margin-top: 2px; }
.sidebar-nav { flex: 1; padding: 0.75rem 0; }
.sidebar-nav a { display: block; padding: 0.5rem 1rem; font-size: 0.875rem; color: var(--term-green-muted); text-decoration: none; }
.sidebar-nav a:hover, .sidebar-nav a.active { color: var(--term-green); background: rgba(0,255,136,0.05); }
.sidebar-footer { padding: 0.75rem 1rem; border-top: 1px solid var(--term-border); font-size: 0.625rem; color: var(--term-green-dim); }

.main-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--term-border); background: var(--term-bg-raised); padding: 0.75rem 1.5rem; gap: 1rem; }
.topbar input[type="search"], .topbar input[type="text"] { width: 16rem; background: rgba(0,0,0,0.3); border: 1px solid var(--term-border); border-radius: 4px; padding: 0.4rem 0.75rem; color: var(--term-green); font-family: inherit; font-size: 0.875rem; }
.topbar-user { display: flex; align-items: center; gap: 1rem; font-size: 0.875rem; color: var(--term-green-muted); }
.topbar-sysinfo { display: flex; align-items: center; gap: 0.75rem; font-size: 0.75rem; color: var(--term-green-dim); white-space: nowrap; }
.topbar-sysinfo #lc-sysinfo-clock { color: var(--term-green); font-weight: bold; letter-spacing: 0.05em; }
.topbar-sysinfo #lc-sysinfo-geo { color: var(--term-green-muted); }
@media (max-width: 900px) { .topbar-sysinfo { display: none; } }

.content { flex: 1; padding: 1.5rem; overflow-y: auto; }
.page-title { font-size: 1.1rem; font-weight: 700; margin: 0 0 1rem; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card { padding: 1rem; }
.stat-card .label { font-size: 0.7rem; text-transform: uppercase; color: var(--term-green-muted); letter-spacing: 0.05em; }
.stat-card .value { font-size: 1.5rem; font-weight: 700; margin-top: 0.25rem; }

/* display:block + overflow-x:auto turns a too-wide table (long share URLs,
   filenames, many columns) into a horizontally scrollable block in place —
   at ANY viewport width, not just mobile. Without this, columns past the
   content area's edge (Link, Stato, Azioni on the share-links page; AZIONI
   on the folder browser) were simply clipped with no way to reach them,
   which looked like the feature was broken rather than just badly laid out. */
table.data-table { width: 100%; max-width: 100%; display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; border-collapse: collapse; font-size: 0.875rem; }
table.data-table th { text-align: left; font-size: 0.7rem; text-transform: uppercase; color: var(--term-green-muted); border-bottom: 1px solid var(--term-border); padding: 0.5rem 0.5rem; }
table.data-table td { padding: 0.5rem; border-bottom: 1px solid rgba(17,74,48,0.4); }
table.data-table tr.draggable { cursor: grab; }
table.data-table tr.drag-over { background: rgba(0,255,136,0.1); }
tr.row-selected, .grid-item.row-selected { background: rgba(0,255,136,0.1); outline: 1px solid var(--term-green-dim); }
.row-actions { display: flex; gap: 0.5rem; font-size: 0.75rem; }
.row-actions button, .row-actions a { background: none; border: none; color: var(--term-green-muted); cursor: pointer; font-family: inherit; font-size: 0.75rem; padding: 0; }
.row-actions button:hover, .row-actions a:hover { color: var(--term-green); }
.row-actions .danger { color: var(--term-red); }
.row-actions .danger:hover { color: #ff8099; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 1rem; flex-wrap: wrap; }
.toolbar-actions { display: flex; gap: 0.5rem; align-items: center; }
.toolbar select { background: rgba(0,0,0,0.3); border: 1px solid var(--term-border); border-radius: 4px; color: var(--term-green); padding: 0.3rem 0.5rem; font-family: inherit; font-size: 0.75rem; }
.breadcrumb { font-size: 0.875rem; color: var(--term-green-muted); display: flex; gap: 0.25rem; flex-wrap: wrap; }
.breadcrumb a { text-decoration: none; }
.breadcrumb a:hover { color: var(--term-green); text-decoration: underline; }

.grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.75rem; }
.grid-item { padding: 0.75rem; text-align: center; cursor: pointer; }
.grid-item:hover { box-shadow: 0 0 12px rgba(0,255,136,0.12); }
.grid-item .icon { font-size: 1.5rem; }
.grid-item .name { font-size: 0.75rem; margin-top: 0.25rem; word-break: break-word; }
.grid-item .meta { font-size: 0.625rem; color: var(--term-green-muted); }

.upload-progress { font-size: 0.75rem; color: var(--term-green-muted); margin-bottom: 0.25rem; }
.upload-progress .bar-bg { height: 5px; background: rgba(0,0,0,0.4); border: 1px solid var(--term-border); border-radius: 3px; overflow: hidden; }
.upload-progress .bar-fill { height: 100%; background: var(--term-green); }

/* --- Preview modal --- */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.85); display: flex; align-items: center; justify-content: center; padding: 1.5rem; z-index: 50; }
.modal-box { background: var(--term-bg-raised); border: 1px solid var(--term-border); box-shadow: 0 0 12px rgba(0,255,136,0.12); border-radius: 6px; max-width: 64rem; width: 100%; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 0.5rem 1rem; border-bottom: 1px solid var(--term-border); }
.modal-header .title { font-size: 0.875rem; color: var(--term-green); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-header .actions { display: flex; gap: 0.75rem; font-size: 0.75rem; }
.modal-meta { display: flex; flex-wrap: wrap; gap: 0.25rem 1.25rem; padding: 0.4rem 1rem; border-bottom: 1px solid var(--term-border); font-size: 0.72rem; color: var(--term-green-muted); }
.modal-meta b { color: var(--term-green); font-weight: 600; }
.modal-body { flex: 1; overflow: auto; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.4); padding: 1rem; }
.modal-body img { max-height: 70vh; cursor: zoom-in; }
.modal-body img.zoomed { transform: scale(1.5); cursor: zoom-out; }
.modal-body video { max-height: 70vh; width: 100%; }
.modal-body iframe { width: 100%; height: 70vh; border: 0; background: #fff; }
.modal-body pre { width: 100%; height: 70vh; overflow: auto; background: rgba(0,0,0,0.6); border: 1px solid var(--term-border); border-radius: 4px; padding: 1rem; font-size: 0.75rem; white-space: pre-wrap; word-break: break-word; margin: 0; }
.modal-fallback { text-align: center; color: var(--term-green-muted); font-size: 0.875rem; }
.modal-fallback a { color: var(--term-green); text-decoration: underline; }

.office-toggle-btn { background: rgba(0,255,136,0.08); border: 1px solid var(--term-green-dim); color: var(--term-green); cursor: pointer; font-family: inherit; font-size: 0.78rem; padding: 0.25rem 0.7rem; border-radius: 4px; margin-right: 0.5rem; }
.office-toggle-btn:hover { background: rgba(0,255,136,0.18); }
.modal-body .office-frame { width: 100%; height: 78vh; border: 0; background: #fff; border-radius: 4px; }
.office-warn { width: 100%; box-sizing: border-box; background: rgba(255,170,0,0.08); border: 1px solid rgba(255,170,0,0.4); color: #ffb84d; font-size: 0.78rem; padding: 0.6rem 0.8rem; border-radius: 4px; margin-bottom: 0.6rem; line-height: 1.4; }
.modal-body:has(.office-frame), .modal-body:has(.office-warn) { flex-direction: column; align-items: stretch; }

.xlsx-tabs { display: flex; gap: 0.25rem; margin-bottom: 0.5rem; flex-wrap: wrap; }
.xlsx-tab { background: rgba(0,255,136,0.06); border: 1px solid var(--term-border); color: var(--term-green-muted); cursor: pointer; font-family: inherit; font-size: 0.75rem; padding: 0.3rem 0.6rem; border-radius: 4px; }
.xlsx-tab.active { color: var(--term-green); border-color: var(--term-green); background: rgba(0,255,136,0.12); }

.xlsx-table-wrap { max-height: 70vh; overflow: auto; border: 1px solid #444; border-radius: 4px; background: #fff; }
.xlsx-table { border-collapse: collapse; font-family: Calibri, Arial, sans-serif; font-size: 0.8rem; color: #1a1a1a; }
.xlsx-table th, .xlsx-table td {
  border: 1px solid #d4d4d4;
  padding: 0.3rem 0.6rem;
  white-space: nowrap;
  text-align: left;
}
.xlsx-table th {
  background: #f3f3f3;
  color: #444;
  font-weight: 600;
  text-align: center;
  position: sticky;
  z-index: 1;
}
.xlsx-table tr:first-child th { top: 0; }
.xlsx-table tr th:first-child { left: 0; }
.xlsx-table .xlsx-corner { background: #e8e8e8; }
.xlsx-table tr:nth-child(even) td { background: #fafafa; }
.xlsx-table td:hover { background: #eaf3ff; }

.pptx-preview { display: flex; flex-direction: column; flex: 1; width: 100%; min-width: 0; gap: 0.75rem; align-items: center; padding: 0.5rem 0; }
.pptx-nav { display: flex; align-items: center; gap: 1rem; }
.pptx-nav-btn { background: rgba(0,255,136,0.06); border: 1px solid var(--term-border); color: var(--term-green); cursor: pointer; font-family: inherit; font-size: 0.8rem; padding: 0.35rem 0.9rem; border-radius: 4px; }
.pptx-nav-btn:hover:not(:disabled) { background: rgba(0,255,136,0.15); }
.pptx-nav-btn:disabled { opacity: 0.35; cursor: default; }
.pptx-nav-counter { font-size: 0.75rem; color: var(--term-green-dim); text-transform: uppercase; }
.pptx-canvas {
  position: relative;
  /* Exact width/height are set in JS (see renderPptxPreview) — a flex item
     whose only content is absolutely-positioned shapes has no intrinsic
     size, and aspect-ratio sizing for such non-replaced elements collapses
     to 0 in flex layouts, so CSS alone can't size this reliably. */
  background: #fff;
  color: #1a1a1a;
  border-radius: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  font-family: Calibri, Arial, sans-serif;
  overflow: hidden;
}
.pptx-shape { position: absolute; overflow: hidden; }
.pptx-shape-text p { margin: 0; line-height: 1.2; }
.pptx-shape-text span { display: inline; word-break: break-word; }
.pptx-shape-image img { width: 100%; height: 100%; object-fit: contain; }
.pptx-canvas-empty { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); color: #999; font-size: 0.85rem; font-style: italic; }

.audio-player { width: 100%; max-width: 36rem; }
.audio-player .audio-waveform { width: 100%; height: 96px; display: block; background: rgba(0,0,0,0.6); border: 1px solid var(--term-border); border-radius: 4px; cursor: pointer; }
.audio-player .audio-controls { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.75rem; }
.audio-player .audio-playpause {
  flex-shrink: 0; width: 2.25rem; height: 2.25rem; border-radius: 50%;
  border: 1px solid var(--term-green); background: rgba(0,255,136,0.1); color: var(--term-green);
  font-family: inherit; font-size: 0.9rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.audio-player .audio-playpause svg { display: block; pointer-events: none; }
.audio-player .audio-playpause:hover { background: rgba(0,255,136,0.2); }
.audio-player .audio-seek-wrap { flex: 1; display: flex; align-items: center; gap: 0.5rem; font-size: 0.7rem; color: var(--term-green-muted); }
.audio-player .audio-seek {
  flex: 1; -webkit-appearance: none; appearance: none; height: 4px; background: var(--term-border);
  border-radius: 2px; outline: none; cursor: pointer;
}
.audio-player .audio-seek::-webkit-slider-thumb {
  -webkit-appearance: none; width: 0.8rem; height: 0.8rem; border-radius: 50%;
  background: var(--term-green); cursor: pointer; box-shadow: 0 0 6px rgba(0,255,136,0.6);
}
.audio-player .audio-seek::-moz-range-thumb {
  width: 0.8rem; height: 0.8rem; border-radius: 50%; border: none;
  background: var(--term-green); cursor: pointer; box-shadow: 0 0 6px rgba(0,255,136,0.6);
}
.audio-player .audio-time { white-space: nowrap; font-size: 0.7rem; color: var(--term-green-muted); min-width: 3.5rem; text-align: center; }

.lc-spinner-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.75rem; padding: 1.5rem; color: var(--term-green-muted); font-size: 0.8rem; }
.lc-spinner {
  width: 2rem; height: 2rem; border-radius: 50%;
  border: 2px solid var(--term-border); border-top-color: var(--term-green);
  animation: lc-spin 0.7s linear infinite;
  box-shadow: 0 0 8px rgba(0,255,136,0.25);
}
.lc-spinner-sm { width: 1rem; height: 1rem; border-width: 2px; display: inline-block; vertical-align: middle; margin-right: 0.4rem; }
@keyframes lc-spin { to { transform: rotate(360deg); } }

/* Global "still working" badge: shown by fetchJson() only once a request has
   been running for a while, so the user gets feedback during a slow
   operation (move, bulk delete, archive read, ...) without every quick
   request causing a flash. Top-left so it never collides with the music
   player (bottom) or the sidebar toggle (top-left only on mobile, where it
   sits just to the right of it at a higher position). */
.lc-global-spinner {
  position: fixed; top: 0.85rem; right: 0.85rem; z-index: 110;
  opacity: 0; pointer-events: none; transition: opacity 0.15s ease;
}
.lc-global-spinner.is-visible { opacity: 1; }
.lc-global-spinner .lc-spinner { width: 1.5rem; height: 1.5rem; border-width: 3px; }

/* Drag-from-the-OS upload overlay: dragging files over the folder browser
   already triggered an upload on drop, but with nothing on screen during
   the drag itself it was effectively invisible/undiscoverable. */
#folder-browser { position: relative; }
.lc-dropzone-overlay {
  position: absolute; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0, 20, 10, 0.85);
  border: 2px dashed var(--term-green);
  border-radius: 6px;
  pointer-events: none;
}
.lc-dropzone-msg {
  color: var(--term-green); font-size: 1.1rem; font-weight: 700;
  text-shadow: 0 0 10px rgba(0,255,136,0.6);
}

.lc-media-loading { position: relative; min-height: 6rem; display: flex; align-items: center; justify-content: center; width: 100%; }
.lc-media-loading .lc-spinner-wrap { position: absolute; inset: 0; align-items: center; justify-content: center; }
.lc-media-loading img, .lc-media-loading video { opacity: 0; transition: opacity 0.15s ease; }
.lc-media-loading.lc-media-ready img, .lc-media-loading.lc-media-ready video { opacity: 1; }
.lc-media-loading.lc-media-ready .lc-spinner-wrap { display: none; }

.lc-music-player {
  position: fixed; bottom: 1rem; right: 1rem; z-index: 100;
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--term-bg-raised); border: 1px solid var(--term-border);
  border-radius: 999px; padding: 0.4rem 0.75rem;
  box-shadow: 0 0 12px rgba(0,255,136,0.12);
}
.lc-music-btn {
  flex-shrink: 0; width: 1.75rem; height: 1.75rem; border-radius: 50%;
  border: 1px solid var(--term-green); background: rgba(0,255,136,0.1); color: var(--term-green);
  font-size: 0.9rem; cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-family: inherit; transition: background 0.15s, transform 0.1s;
}
.lc-music-btn svg { display: block; pointer-events: none; }
.lc-music-btn:hover { background: rgba(0,255,136,0.2); }
.lc-music-btn:active { transform: scale(0.92); }
.lc-music-btn.is-muted { color: var(--term-red); border-color: var(--term-red); background: rgba(255,77,106,0.08); }
.lc-music-track {
  flex-shrink: 0; max-width: 9rem; height: 1.6rem;
  background: rgba(0,255,136,0.08); color: var(--term-green);
  border: 1px solid var(--term-green-dim); border-radius: 999px;
  font-family: inherit; font-size: 0.72rem; padding: 0 0.55rem; cursor: pointer; outline: none;
}
.lc-music-track:hover { background: rgba(0,255,136,0.16); }
.lc-music-track option { background: var(--term-bg-raised); color: var(--term-green); }
.lc-music-volume {
  width: 5rem; -webkit-appearance: none; appearance: none; height: 4px;
  background: var(--term-border); border-radius: 2px; outline: none; cursor: pointer;
}
.lc-music-volume::-webkit-slider-thumb {
  -webkit-appearance: none; width: 0.7rem; height: 0.7rem; border-radius: 50%;
  background: var(--term-green); cursor: pointer; box-shadow: 0 0 6px rgba(0,255,136,0.6);
}
.lc-music-volume::-moz-range-thumb {
  width: 0.7rem; height: 0.7rem; border-radius: 50%; border: none;
  background: var(--term-green); cursor: pointer; box-shadow: 0 0 6px rgba(0,255,136,0.6);
}

/* Hamburger is desktop-hidden; the off-canvas drawer + backdrop only matter
   on mobile. Kept out of the mobile query itself so the button's base styling
   is defined once. */
.sidebar-toggle {
  display: none;
  flex-shrink: 0;
  background: rgba(0,255,136,0.08); border: 1px solid var(--term-green-dim);
  color: var(--term-green); border-radius: 4px; cursor: pointer;
  font-size: 1.1rem; line-height: 1; padding: 0.3rem 0.6rem; font-family: inherit;
  /* The padding above alone gave a touch target smaller than the ~44px
     Apple/Google both recommend — a thumb landing even slightly off it hit
     the bare topbar (no handler) instead, which is exactly what "certe volte
     fa cilecca" (sometimes doesn't register) looks like. min-width/height
     force a real minimum hit box regardless of the glyph's own size.
     touch-action:manipulation removes the ~300ms tap-delay-then-maybe-zoom
     behaviour mobile browsers apply by default, which can also eat a tap.
     position+z-index guards against ever sitting under another topbar
     element if the row wraps awkwardly on a very narrow screen. */
  min-width: 44px; min-height: 44px;
  position: relative; z-index: 20;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
}
.sidebar-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6); z-index: 40;
}

@media (max-width: 720px) {
  /* Sidebar becomes an off-canvas drawer slid in by the hamburger, instead
     of vanishing entirely (which left mobile users with no navigation). */
  .sidebar {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
    width: 15rem; max-width: 80vw;
    transform: translateX(-100%); transition: transform 0.22s ease;
  }
  .sidebar.is-open { transform: translateX(0); box-shadow: 0 0 24px rgba(0,0,0,0.6); }
  .sidebar-toggle { display: inline-flex; align-items: center; justify-content: center; }

  .topbar { flex-wrap: wrap; padding: 0.6rem 0.9rem; gap: 0.6rem; }
  .topbar input[type="search"] { flex: 1; min-width: 0; width: auto; }
  .topbar-user { gap: 0.6rem; font-size: 0.78rem; }

  .content { padding: 1rem 0.9rem; }

  /* The folder-browser toolbar (breadcrumb + search/sort/view/new buttons)
     has a fixed-width (9rem inline style) search box and several buttons in
     one un-wrapped flex row — on a narrow screen that row was wider than the
     viewport with no scroll, so "+cartella"/"+upload" were simply
     unreachable. Let the row wrap and let the search box shrink. */
  .toolbar-actions { flex-wrap: wrap; gap: 0.4rem; }
  .toolbar-actions input[type="text"] { width: 100% !important; max-width: 100%; }

  /* Centred at the bottom instead of bottom-right, and pinned below the
     sidebar drawer (z-index 50) and its backdrop (z-index 40) so opening the
     mobile menu doesn't leave the player floating on top of it. */
  .lc-music-player {
    bottom: 0.5rem; left: 50%; right: auto; transform: translateX(-50%);
    z-index: 30; padding: 0.3rem 0.5rem; gap: 0.35rem;
  }
  .lc-music-track { max-width: 6.5rem; }
}
