:root {
  --accent: #2aabee;
  --accent-strong: #1c93d1;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --text: #1b2733;
  --muted: #6b7a88;
  --border: #dfe5ea;
  --danger: #d64545;
  --radius: 10px;
  --shadow: 0 8px 30px rgba(0,0,0,.06);
  color-scheme: light;
}
/* Tema oscuro: automático según el sistema, o forzado con el botón 🌙/☀️ (data-theme en <html>). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1621;
    --surface: #17212b;
    --surface-2: #202b36;
    --text: #e6edf3;
    --muted: #8696a6;
    --border: #2a3947;
    --accent-strong: #4fbcf5;
    --shadow: 0 8px 30px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1621;
  --surface: #17212b;
  --surface-2: #202b36;
  --text: #e6edf3;
  --muted: #8696a6;
  --border: #2a3947;
  --accent-strong: #4fbcf5;
  --shadow: 0 8px 30px rgba(0,0,0,.45);
  color-scheme: dark;
}
body, .topbar, .toolbar, .listing, .details, th, .btn, .filter, .card { transition: background-color .2s ease, border-color .2s ease, color .2s ease; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
}
.screen { min-height: 100%; }
.center { display: grid; place-items: center; padding: 24px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.btn {
  font: inherit; border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; text-decoration: none; display: inline-flex;
  align-items: center; justify-content: center; gap: 6px;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--accent-strong); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--surface-2); }
.btn.small { padding: 4px 10px; font-size: 13px; }
.btn.icon { width: 34px; height: 34px; padding: 0; font-size: 16px; }
.btn.wide { width: 100%; padding: 11px 14px; }

.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 32px; box-shadow: var(--shadow); }
.login-card { width: min(400px, 100%); text-align: center; }
.login-card h1 { margin: 12px 0 4px; font-size: 22px; }
.login-card .muted { margin: 0 0 22px; }
.brand-mark { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-size: 26px; }
.brand-mark.small { width: 26px; height: 26px; font-size: 13px; margin: 0; display: inline-grid; }
.steps { text-align: left; padding-left: 20px; margin: 0 0 18px; }
.steps li { margin-bottom: 6px; }
#login-wait .muted { margin: 14px 0 4px; }
.pulse { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); margin-right: 4px; animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; } }
.message { margin: 16px 0 0; padding: 10px 12px; border-radius: 8px; background: color-mix(in srgb, var(--danger) 12%, transparent); color: var(--danger); }

.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.user { display: flex; align-items: center; gap: 8px; color: var(--muted); }

.toolbar { display: flex; align-items: center; gap: 6px; padding: 8px 16px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.breadcrumb { list-style: none; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; margin: 0 8px; padding: 6px 10px; flex: 1 1 260px; min-width: 0; background: var(--surface-2); border-radius: 8px; }
.breadcrumb li { display: flex; align-items: center; min-width: 0; }
.breadcrumb li + li::before { content: "›"; color: var(--muted); margin: 0 4px; }
.breadcrumb a { color: var(--text); text-decoration: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 220px; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb li:last-child a { font-weight: 600; }
.filter { font: inherit; padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); width: 220px; }

.content { display: flex; align-items: flex-start; gap: 16px; padding: 16px; }
.listing { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: 12px; padding: 9px 12px; border-bottom: 1px solid var(--border); cursor: pointer; user-select: none; background: var(--surface); position: sticky; top: 0; }
th.sorted::after { content: " ▲"; font-size: 9px; }
th.sorted.desc::after { content: " ▼"; }
td { padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
tr:last-child td { border-bottom: none; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.selected { background: color-mix(in srgb, var(--accent) 16%, transparent); }
.col-type { width: 130px; } .col-size { width: 100px; } .col-date { width: 185px; }
td.col-size, th.col-size { text-align: right; }
.name-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.name-cell .icon { flex: none; width: 22px; text-align: center; font-size: 17px; position: relative; }
.name-cell .icon .badge { position: absolute; right: -4px; bottom: -4px; font-size: 10px; background: var(--surface); border-radius: 4px; line-height: 1; }
.name-cell .label { overflow: hidden; text-overflow: ellipsis; }
/* Banner de carpeta (folder_preview.jpg) */
.banner { position: relative; margin: 0; height: clamp(110px, 15vw, 220px); overflow: hidden; border-bottom: 1px solid var(--border);
  background: linear-gradient(100deg, var(--surface-2) 30%, var(--surface) 50%, var(--surface-2) 70%) 0 0 / 300% 100%; animation: shimmer 1.4s linear infinite; }
.banner img { position: relative; display: block; width: 100%; height: 100%; object-fit: contain; opacity: 0; transition: opacity .35s ease; }
/* La imagen completa al centro y, detrás, la misma imagen ampliada y difuminada para rellenar los lados. */
.banner .banner-bg { position: absolute; inset: -20px; width: calc(100% + 40px); height: calc(100% + 40px); object-fit: cover; filter: blur(22px) brightness(.55); }
.banner.loaded { animation: none; background: #000; }
.banner.loaded img { opacity: 1; }
@keyframes shimmer { to { background-position: -300% 0; } }

/* Iconos grandes */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 14px; }
.tile { border-radius: 10px; padding: 8px; cursor: pointer; outline: none; border: 1px solid transparent; min-width: 0; }
.tile:hover { background: var(--surface-2); }
.tile:focus-visible { border-color: var(--accent); }
.tile.selected { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.tile-thumb { position: relative; aspect-ratio: 4 / 3; border-radius: 8px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.tile-icon { font-size: 52px; line-height: 1; }
.tile-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity .25s ease; }
.tile-thumb.has-thumb img { opacity: 1; }
.tile-thumb.has-thumb .tile-icon { visibility: hidden; }
.tile-thumb.is-video.has-thumb::after { content: "▶"; position: absolute; left: 8px; bottom: 8px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 11px; color: #fff; background: rgba(0,0,0,.6); }
.tile-badge { position: absolute; right: 6px; bottom: 6px; z-index: 1; font-size: 12px; background: var(--surface); border-radius: 4px; padding: 0 3px; }
.tile-name { margin-top: 6px; font-size: 13px; text-align: center; line-height: 1.3; word-break: break-word;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Pill del usuario: tipo de acceso y vencimiento */
.pill { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; max-width: 46vw; overflow: hidden; text-overflow: ellipsis;
  color: var(--accent-strong); background: color-mix(in srgb, var(--accent) 14%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.pill.warn { color: #b7791f; background: color-mix(in srgb, #f6ad55 16%, transparent); border-color: color-mix(in srgb, #f6ad55 45%, transparent); }
.pill.bad { color: var(--danger); background: color-mix(in srgb, var(--danger) 12%, transparent); border-color: color-mix(in srgb, var(--danger) 40%, transparent); }

/* Reproductor de audio con carátula */
.audio-player { width: 100%; display: grid; justify-items: center; gap: 12px; padding: 16px; }
.preview .audio-player .cover { width: auto; max-width: 100%; max-height: 260px; border-radius: 8px; background: transparent; box-shadow: var(--shadow); }
.preview .audio-player audio { margin: 0; }

.empty { padding: 40px 16px; text-align: center; margin: 0; }
.statusbar { margin: 0; padding: 8px 12px; font-size: 12px; border-top: 1px solid var(--border); }

.details { order: -1; z-index: 2; width: clamp(320px, 38vw, 560px); flex: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; position: sticky; top: 16px; }
.details .close { position: absolute; top: 10px; right: 10px; width: 28px; height: 28px; font-size: 13px; }
.preview { margin: 26px 0 14px; border-radius: 8px; overflow: hidden; background: var(--surface-2); min-height: 120px; display: grid; place-items: center; }
.preview img, .preview video { display: block; width: 100%; max-height: 60vh; object-fit: contain; background: #000; }
.preview audio { width: 100%; margin: 16px; }
.preview iframe { width: 100%; height: 60vh; border: 0; background: #fff; }
.preview pre { margin: 0; padding: 12px; width: 100%; max-height: 50vh; overflow: auto; font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-word; text-align: left; }
.preview .preview-icon { font-size: 54px; padding: 18px 0 6px; }
.preview .preview-note { padding: 0 16px 16px; text-align: center; color: var(--muted); font-size: 13px; }
.preview .spinner { margin: 30px; }
.details-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin: 0 0 16px; }
.details h2 { font-size: 15px; margin: 0 0 14px; word-break: break-word; text-align: center; }
.details dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 13px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; word-break: break-word; white-space: pre-wrap; }

@media (max-width: 760px) {
  .col-type, .col-date { display: none; }
  .filter { width: 100%; }
  #user-name { display: none; }
  .content { flex-direction: column; padding: 8px; }
  .details { width: 100%; position: static; }
  .breadcrumb { margin: 0; flex-basis: 100%; order: 5; }
}

.qr { width: 240px; height: 240px; margin: 4px auto 16px; display: block; border-radius: 12px; background: #fff; padding: 8px; }
.login-note { margin: 12px 0 0 !important; }
.input { font: inherit; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); margin: 6px 0 10px; }
.input.wide { width: 100%; }
#login-progress { display: grid; place-items: center; gap: 4px; }
#login-progress .spinner { margin: 8px auto; }
.login-alt { margin-top: 10px; }
#login-code .message { margin: 0 0 10px; }

/* ---------- Panel administrativo ---------- */
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: color-mix(in srgb, var(--danger) 12%, transparent); }
.admin { display: flex; align-items: flex-start; gap: 16px; padding: 16px; }
.admin-nav { flex: none; width: 220px; display: grid; gap: 4px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; position: sticky; top: 16px; }
.admin-nav h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 2px 6px 6px; }
.admin-link { font: inherit; text-align: left; border: 0; background: transparent; color: var(--text); padding: 8px 10px; border-radius: 8px; cursor: pointer; }
.admin-link:hover { background: var(--surface-2); }
.admin-link.active { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent-strong); font-weight: 600; }
.admin-back { margin-top: 8px; justify-content: flex-start; }
.admin-section { flex: 1; min-width: 0; }
.admin-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.admin-head h1 { font-size: 20px; margin: 0 0 2px; }
.admin-head p { margin: 0; }
.admin-actions { display: flex; gap: 8px; }
.admin-body { display: flex; align-items: flex-start; gap: 16px; }
.admin-body .listing { flex: 1; }
.monitor-table th { cursor: default; }
.monitor-table .col-state { width: 110px; } .monitor-table .col-target { width: 190px; }
.monitor-table .col-types { width: 220px; } .monitor-table .col-count { width: 90px; text-align: right; }
.monitor-details { order: 0; width: clamp(280px, 30vw, 400px); }
.monitor-details h2 { margin-top: 0; }
.error-text { color: var(--danger); }

/* Diálogos */
.dialog { border: 1px solid var(--border); border-radius: 14px; padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
.dialog::backdrop { background: rgba(0,0,0,.45); }
.dialog form { padding: 22px; display: grid; gap: 4px; }
.dialog h2 { margin: 0 0 10px; font-size: 18px; }
.dialog label, .dialog .label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.dialog .input { margin: 2px 0 4px; }
.dialog select.input { width: 100%; }
.dialog .message { margin: 8px 0 0; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text) !important; cursor: pointer; }
.type-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 4px 12px; margin: 2px 0 4px; }
.type-grid .check { margin: 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.row2 .input { width: 100%; min-width: 0; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

@media (max-width: 760px) {
  .admin { flex-direction: column; padding: 8px; }
  .admin-nav { width: 100%; position: static; }
  .admin-body { flex-direction: column; }
  .monitor-details { width: 100%; }
  .monitor-table .col-target, .monitor-table .col-types { display: none; }
}

.collector-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
  padding: 10px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.collector-bar strong { margin-right: 8px; }

/* Tablas y paneles de las secciones de administración */
.admin-table th { cursor: default; }
.admin-table .col-w8 { width: 110px; } .admin-table .col-w10 { width: 140px; }
.admin-table .col-w12 { width: 160px; } .admin-table .col-w14 { width: 190px; }
.admin-details { order: 0; width: clamp(280px, 30vw, 420px); }
.admin-details h2 { margin-top: 0; }
.admin-section > .listing { width: 100%; }
.admin-actions { flex-wrap: wrap; align-items: center; }
.admin-actions .filter { width: 200px; }
.collector-error { margin: 6px 0 0; white-space: pre-wrap; max-height: 7em; overflow: auto; }
.bot-checks { display: grid; gap: 4px; margin: 2px 0 6px; max-height: 220px; overflow: auto; }
.dialog .label .btn { margin-left: 6px; vertical-align: middle; }
.form-grid { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; align-items: center; }
.form-grid label { margin: 0; }
.form-grid .input { margin: 0; width: 100%; min-width: 0; }
.dialog-wide { width: min(1000px, calc(100vw - 32px)); }
.log-text { margin: 0; height: 60vh; overflow: auto; padding: 12px; border-radius: 8px; background: var(--surface-2);
  font: 12px/1.5 ui-monospace, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }

@media (max-width: 760px) {
  .admin-table .col-hide { display: none; }
  .admin-details { width: 100%; }
  .admin-actions .filter { width: 100%; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ---------- Explorador: selección, operaciones, buscador ---------- */
.col-check { width: 38px; text-align: center; padding-left: 8px !important; padding-right: 0 !important; }
.col-check input, .tile-check { width: 16px; height: 16px; cursor: pointer; accent-color: var(--accent); }
.name-cell .label.with-location { flex: 0 1 auto; }
.name-cell .location { flex: 1 1 0; min-width: 0; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.name-cell .location::before { content: "· "; }
.tile { position: relative; }
.tile-check { position: absolute; top: 12px; left: 12px; z-index: 2; opacity: 0; transition: opacity .15s; }
.tile:hover .tile-check, .tile.selected .tile-check, .tile-check:focus-visible { opacity: 1; }
@media (hover: none) { .tile-check { opacity: 1; } }
tr[draggable="true"], .tile[draggable="true"] { -webkit-user-drag: element; }
.drop-target, tbody tr.drop-target { outline: 2px dashed var(--accent); outline-offset: -2px; background: color-mix(in srgb, var(--accent) 12%, transparent) !important; }
.breadcrumb a.drop-target { border-radius: 4px; }
body.dragging .breadcrumb a { outline: 1px dashed color-mix(in srgb, var(--accent) 40%, transparent); border-radius: 4px; }

.opsbar { display: flex; align-items: center; justify-content: space-between; gap: 8px 16px; flex-wrap: wrap; padding: 6px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.ops-actions, .ops-info { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.menu-wrap { position: relative; }
.menu { position: absolute; top: calc(100% + 4px); left: 0; z-index: 20; min-width: 240px; padding: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); display: grid; }
.menu button { font: inherit; text-align: left; border: 0; background: transparent; color: var(--text); padding: 8px 10px; border-radius: 6px; cursor: pointer; }
.menu button:hover:not(:disabled) { background: var(--surface-2); }
.menu button:disabled { opacity: .45; cursor: default; }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 2px; }

.searchbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.searchbar .input { margin: 0; padding: 7px 10px; }
#s-query { flex: 1 1 240px; min-width: 0; }
.type-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); font-size: 12px; cursor: pointer; user-select: none; }
.chip input { margin: 0; accent-color: var(--accent); }
.chip:has(input:checked) { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); }

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; display: flex; align-items: center; gap: 8px;
  max-width: min(640px, calc(100vw - 32px)); padding: 10px 12px 10px 16px; border-radius: 12px; background: var(--text); color: var(--bg); box-shadow: var(--shadow); }
.toast.error { background: var(--danger); color: #fff; }
.toast .btn { background: transparent; color: inherit; border-color: color-mix(in srgb, currentColor 40%, transparent); }
.toast .btn.ghost { border-color: transparent; }

.nz-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 20px; }
.nz-preview { max-height: 38vh; overflow: auto; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); font: 12px/1.6 ui-monospace, Consolas, monospace; }
.nz-line { white-space: pre-wrap; word-break: break-word; }
.nz-line.changed { color: var(--text); }
.nz-line:not(.changed):not(.problem) { color: var(--muted); }
.nz-line.problem { color: var(--danger); }
.history-list { display: grid; gap: 6px; max-height: 55vh; overflow: auto; }
.history-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; }
.history-row strong { font-weight: 600; }

@media (max-width: 760px) {
  .opsbar, .searchbar { padding: 6px 8px; }
  .ops-actions .btn { padding: 4px 8px; }
  .nz-grid { grid-template-columns: 1fr; }
  .name-cell .location { display: none; }
}

/* ---------- Permisos, ocultos, subidas y aportes ---------- */
.perm-badges { display: inline-flex; gap: 2px; font-size: 13px; color: var(--muted); }
.perm-badge { opacity: .22; filter: grayscale(1); cursor: help; }
.perm-badge.on { opacity: 1; filter: none; }
tr.is-hidden td, .tile.is-hidden { opacity: .55; }
tr.is-hidden .label::after, .tile.is-hidden .tile-name::after { content: " 🙈"; }
.btn:disabled[title] { cursor: not-allowed; }
.menu button:disabled { cursor: not-allowed; }

.listing { position: relative; }
.drop-hint { position: absolute; inset: 0; z-index: 5; display: grid; place-items: center; font-weight: 600; font-size: 16px;
  color: var(--accent-strong); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); border: 2px dashed var(--accent); border-radius: var(--radius); pointer-events: none; }

.uploads { position: fixed; right: 16px; bottom: 16px; z-index: 40; width: min(380px, calc(100vw - 32px)); max-height: 50vh; display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); overflow: hidden; }
.uploads-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 8px 8px 14px; border-bottom: 1px solid var(--border); }
.uploads-list { overflow: auto; padding: 6px 10px 10px; display: grid; gap: 8px; }
.upload-row { display: grid; grid-template-columns: 1fr auto; gap: 2px 6px; align-items: center; }
.upload-name { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upload-row .btn { padding: 0 6px; }
.upload-bar { grid-column: 1 / -1; height: 5px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.upload-bar span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.upload-row.done .upload-bar span { background: #2e9d5b; }
.upload-row.failed .upload-bar span { background: var(--danger); }
.upload-status { grid-column: 1 / -1; }
body:has(#uploads:not([hidden])) .toast { bottom: calc(16px + min(50vh, 260px)); }

.perms-box { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.perms-box h3 { margin: 0 0 4px; font-size: 14px; }
.perms-list { display: grid; gap: 4px; margin: 6px 0; max-height: 34vh; overflow: auto; }
.perm-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 8px; }
.perm-path { flex: 1; min-width: 0; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perm-chips { display: inline-flex; flex-wrap: wrap; gap: 3px; }
.perm-chip { font: 600 11px/1 system-ui, sans-serif; width: 24px; height: 24px; border-radius: 6px; border: 1px solid var(--border); background: var(--surface-2);
  color: var(--muted); cursor: pointer; }
.perm-chip.wide { width: auto; padding: 0 10px; height: 28px; }
.perm-chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.perm-chip:disabled { opacity: .45; cursor: not-allowed; }
.perms-add { display: flex; gap: 6px; }
.perms-add .input { flex: 1; min-width: 0; margin: 0; }
.settings-card { max-width: 620px; display: grid; gap: 6px; padding: 18px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.settings-card .label, .settings-card label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.settings-card .input { margin: 0; }

/* Instrucciones de aportes con estilo de chat de Telegram */
.tg-dialog { width: min(560px, calc(100vw - 32px)); }
.tg-dialog form { padding: 0; gap: 0; }
.tg-head { display: flex; align-items: center; gap: 12px; padding: 14px 18px; background: var(--accent); color: #fff; }
.tg-head .muted { color: rgba(255,255,255,.8); }
.tg-avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.22); font-size: 20px; }
.tg-chat { padding: 16px; display: grid; gap: 10px; max-height: 60vh; overflow: auto;
  background: color-mix(in srgb, var(--accent) 7%, var(--bg)); }
.tg-bubble { max-width: 94%; padding: 10px 14px; border-radius: 4px 14px 14px 14px; background: var(--surface); box-shadow: 0 1px 1px rgba(0,0,0,.08); font-size: 14px; }
.tg-bubble p { margin: 0 0 6px; }
.tg-bubble ol, .tg-bubble ul { margin: 4px 0 0; padding-left: 20px; display: grid; gap: 6px; }
.tg-bubble code { font-size: 12px; padding: 1px 5px; border-radius: 4px; background: var(--surface-2); }
.tg-dialog .dialog-actions { padding: 12px 16px; margin: 0; border-top: 1px solid var(--border); }
