/* ── Reset & tokens ────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #0b0b14;
  --surface:  rgba(255,255,255,0.04);
  --border:   rgba(255,255,255,0.08);
  --accent:   #7c3aed;
  --accent2:  #a855f7;
  --text:     #f0edf8;
  --muted:    #7a7a9a;
  --ok:       #7ee2c1;
  --err:      #ff7a90;
  --hover:    rgba(255,255,255,0.06);
  --radius:   14px;
  --r-sm:     8px;
  --font:     system-ui, -apple-system, 'Segoe UI', sans-serif;
}

html { font-size: 15px; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overflow-x: hidden;
}

/* ── Aurora background ─────────────────────────────────────────────────── */
.aurora { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: .18;
  animation: drift 18s ease-in-out infinite alternate;
}
.blob-a { width: 500px; height: 500px; background: #7c3aed; top: -120px; left: -100px; animation-duration: 20s; }
.blob-b { width: 400px; height: 400px; background: #2563eb; bottom: -80px; right: -80px; animation-duration: 24s; animation-delay: -6s; }
.blob-c { width: 350px; height: 350px; background: #a855f7; top: 50%; left: 50%; transform: translate(-50%,-50%); animation-duration: 16s; animation-delay: -12s; }
@keyframes drift { to { transform: translate(40px, 30px); } }
.blob-c { animation: drift2 16s ease-in-out infinite alternate; }
@keyframes drift2 { to { transform: translate(calc(-50% + 30px), calc(-50% - 40px)); } }

/* ── Layout ────────────────────────────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 24px;
  background: rgba(11,11,20,.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 1.15rem; color: var(--text); }
.brand-icon { width: 22px; height: 22px; color: var(--accent2); }
.top-actions { display: flex; gap: 8px; }

main {
  position: relative; z-index: 1;
  max-width: 960px; margin: 0 auto;
  padding: 20px 20px 80px;
}

/* ── Breadcrumb ─────────────────────────────────────────────────────────── */
.crumbs {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 4px; padding: 10px 0 16px;
  font-size: .85rem; color: var(--muted);
}
.crumb {
  background: none; border: none; cursor: pointer;
  color: var(--accent2); padding: 2px 4px; border-radius: 4px;
  font: inherit;
}
.crumb:hover { background: var(--hover); }
.sep { color: var(--muted); user-select: none; }
.current { color: var(--text); font-weight: 600; }

/* ── Bulk bar ────────────────────────────────────────────────────────────── */
.bulk-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; margin-bottom: 10px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-sm);
}
.bulk-bar[hidden] { display: none !important; }
.bulk-check-all { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: .9rem; }
.bulk-actions { display: flex; gap: 6px; margin-left: auto; }
.muted { color: var(--muted); }

/* ── Browser ─────────────────────────────────────────────────────────────── */
.browser { position: relative; }
.file-list { list-style: none; }

.file-list li.row {
  display: grid;
  grid-template-columns: 64px 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .12s, border-color .12s, box-shadow .12s;
  border: 1px solid transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.file-list li.row .row-check { display: none; }
.file-list.selection-mode li.row { grid-template-columns: 28px 64px 1fr auto auto; }
.file-list.selection-mode li.row .row-check { display: block; }
.file-list li.row:hover { background: var(--hover); }
.file-list li.row.is-selected {
  background: rgba(124,58,237,.12);
  border-color: rgba(124,58,237,.3);
}
.file-list li.row .row-check { cursor: pointer; }
.row-icon {
  width: 56px; height: 56px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border-radius: 10px; flex-shrink: 0;
  color: var(--muted);
}
.row-icon svg { width: 28px; height: 28px; }
.row-main { min-width: 0; }
.row-name { font-size: .98rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-sub  { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.row-meta { font-size: .82rem; color: var(--muted); white-space: nowrap; }
.row-actions {
  display: flex; gap: 4px; opacity: .55;
  transition: opacity .12s;
}
.file-list li.row:hover .row-actions,
.file-list li.row.is-selected .row-actions { opacity: 1; }

.empty { padding: 40px 0; text-align: center; color: var(--muted); font-size: .95rem; }
.browser-status { font-size: .82rem; color: var(--muted); margin-top: 10px; }

/* ── Login screen ────────────────────────────────────────────────────────── */
.login-screen {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.login-screen[hidden] { display: none; }

.login-card {
  position: relative; z-index: 1;
  background: #14101f; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 36px 40px;
  width: 100%; max-width: 380px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
}
.login-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.4rem; font-weight: 800; margin-bottom: 28px;
  color: var(--accent2);
}
.login-brand svg { width: 28px; height: 28px; }
.login-title { font-size: 1.2rem; font-weight: 700; margin-bottom: 24px; color: var(--text); }

.login-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: .82rem; font-weight: 600; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.field input, .chpass-form .field input {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text); font: inherit; font-size: .95rem;
  padding: 10px 14px;
  transition: border-color .15s, background .15s;
  outline: none;
}
.field input:focus, .chpass-form .field input:focus {
  border-color: var(--accent2);
  background: rgba(255,255,255,.08);
}
.login-submit { margin-top: 4px; padding: 11px; font-size: 1rem; font-weight: 700; border-radius: var(--r-sm); }
.login-error {
  background: rgba(255,122,144,.1); border: 1px solid rgba(255,122,144,.3);
  color: var(--err); border-radius: var(--r-sm); padding: 8px 12px;
  font-size: .85rem; margin-top: 2px;
}

/* ── User chip & dropdown ────────────────────────────────────────────────── */
.top-sep { width: 1px; height: 22px; background: var(--border); flex-shrink: 0; }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 99px; padding: 4px 12px 4px 4px;
  cursor: pointer; font: inherit; color: var(--text);
  transition: background .12s;
}
.user-chip:hover { background: var(--hover); }
.user-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; flex-shrink: 0;
}
.user-caret { color: var(--muted); font-size: .75rem; }

.user-dropdown {
  position: fixed; top: 60px; right: 20px; z-index: 100;
  background: #1a1428; border: 1px solid var(--border);
  border-radius: var(--r-sm); min-width: 180px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  overflow: hidden;
}
.user-dropdown[hidden] { display: none; }
.dropdown-item {
  display: block; width: 100%; text-align: left;
  background: none; border: none; padding: 11px 16px;
  color: var(--text); font: inherit; font-size: .9rem;
  cursor: pointer; transition: background .1s;
}
.dropdown-item:hover { background: var(--hover); }
.dropdown-danger { color: var(--err); }
.dropdown-sep { border: none; border-top: 1px solid var(--border); margin: 0; }

.btn-icon { padding: 6px 10px !important; }


/* ── Cambiar contraseña ────────────────────────────────────────────────────── */
.chpass-card { max-width: 360px; }
.chpass-form { display: flex; flex-direction: column; gap: 16px; padding: 20px 18px; }

/* ── Thumb en la lista ────────────────────────────────────────────────────── */
.row-thumb {
  width: 56px; height: 56px; object-fit: cover;
  border-radius: 10px; background: var(--surface);
  flex-shrink: 0;
  transition: transform .15s;
}
.file-list li.row:hover .row-thumb { transform: scale(1.05); }

/* ── Nav bar (botones atrás/adelante/inicio + crumbs) ─────────────────────── */
.nav-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 0 16px;
  flex-wrap: wrap;
}
.nav-buttons { display: flex; gap: 4px; flex-shrink: 0; align-items: center; }
.nav-btn {
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  padding: 0; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  transition: background .12s, transform .12s, border-color .12s;
}
.nav-btn:hover {
  background: var(--accent); color: #fff;
  border-color: var(--accent);
  transform: translateY(-1px);
}
.nav-btn:active  { transform: translateY(0) scale(.96); }
.nav-btn:disabled { opacity: .35; cursor: default; pointer-events: none; }
.nav-btn-home { background: var(--accent); color: #fff; border-color: var(--accent); }
.nav-btn-home:hover { background: var(--accent-hover, #6d28d9); border-color: var(--accent-hover, #6d28d9); }
.nav-bar .crumbs { padding: 0; flex: 1; min-width: 80px; }
.nav-upload-actions { display: flex; gap: 6px; align-items: center; flex-shrink: 0; flex-wrap: wrap; }

/* ── Search bar ─────────────────────────────────────────────────────────── */
[hidden] { display: none !important; }
.search-bar {
  display: flex; align-items: center;
  flex: 1; min-width: 0; gap: 6px;
}
.search-input {
  flex: 1; min-width: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font: inherit; font-size: .9rem;
  padding: 6px 12px;
  outline: none;
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--accent2); }
.search-input::placeholder { color: var(--muted); }
.search-close-btn {
  background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 6px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: color .12s, background .12s;
}
.search-close-btn:hover { color: var(--text); background: var(--hover); }
.srch-path {
  font-size: .78rem; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 2px;
}
.srch-row { cursor: pointer; }

@media (max-width: 600px) {
  .nav-bar { row-gap: 8px; padding: 8px 0 12px; }
  .nav-btn { width: 40px; height: 40px; }
  .nav-upload-actions { width: 100%; justify-content: center; order: 4; }
  #search-bar { flex: none; width: 100%; min-width: 0; order: 3; }
}

/* ── Drop overlay ─────────────────────────────────────────────────────────── */
.drop-overlay {
  position: absolute; inset: 0; z-index: 20;
  background: rgba(124,58,237,.18);
  border: 2px dashed var(--accent2);
  border-radius: var(--radius);
  align-items: center; justify-content: center;
  pointer-events: none;
}
.drop-overlay:not([hidden]) { display: flex; }
.drop-content { text-align: center; pointer-events: none; }
.drop-icon { margin-bottom: 8px; color: var(--muted); opacity: .8; }

/* ── Drop target (mover archivos arrastrando) ───────────────────────────── */
.file-list li.row.drop-target {
  background: rgba(124,58,237,.18);
  border-color: var(--accent2);
  outline: 2px dashed var(--accent2);
  outline-offset: -2px;
}
.crumb.drop-target {
  background: rgba(124,58,237,.2);
  outline: 2px dashed var(--accent2);
}
.file-list li.row.dragging { opacity: .35; box-shadow: 0 2px 12px rgba(0,0,0,.25); }
.file-list li.row.pressing {
  border-color: rgba(124,58,237,.5);
  box-shadow: 0 0 0 3px rgba(124,58,237,.2);
}

/* ── Ghost de drag táctil ────────────────────────────────────────────────── */
/* Inline-button icon sizing */
.btn-primary svg, .btn-ghost svg, .btn-danger svg,
.dropdown-item svg, .wiz-link-btn svg, .cfg-ext-link svg {
  width: 13px; height: 13px; flex-shrink: 0; vertical-align: middle;
}
.btn-icon-only { min-width: 0; padding: 4px 8px; }
.tdg-icon { display: flex; align-items: center; }
.tdg-icon svg { width: 16px; height: 16px; }

.touch-drag-ghost {
  position: fixed;
  top: 0; left: 0;
  transform: translate(0,0);
  z-index: 9999;
  pointer-events: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--card);
  border: 1.5px solid var(--accent2);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
  font-size: .9rem;
  font-weight: 500;
  white-space: nowrap;
  max-width: 220px;
  overflow: hidden;
  opacity: .93;
  transition: transform .05s linear;
}
.tdg-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tdg-multi { border-color: var(--accent); }
.tdg-badge {
  background: var(--accent);
  color: #fff;
  border-radius: 99px;
  padding: 1px 7px;
  font-size: .75rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── Botones ──────────────────────────────────────────────────────────────── */
button { font: inherit; cursor: pointer; border: none; outline: none; }

.btn-primary {
  background: var(--accent); color: #fff;
  padding: 7px 16px; border-radius: var(--r-sm); font-size: .9rem; font-weight: 600;
  transition: background .12s;
}
.btn-primary:hover { background: var(--accent2); }
.btn-primary:disabled { opacity: .5; cursor: default; }

.btn-ghost {
  background: transparent; color: var(--text);
  border: 1px solid var(--border); padding: 6px 14px;
  border-radius: var(--r-sm); font-size: .9rem;
  transition: background .12s, border-color .12s;
}
.btn-ghost:hover { background: var(--hover); border-color: rgba(255,255,255,.16); }

.btn-danger {
  background: transparent; color: var(--err);
  border: 1px solid rgba(255,122,144,.35); padding: 6px 14px;
  border-radius: var(--r-sm); font-size: .9rem;
}
.btn-danger:hover { background: rgba(255,122,144,.12); }

.btn-sm { padding: 5px 10px !important; font-size: .82rem !important; }

.iconbtn {
  background: transparent; color: var(--muted);
  padding: 0; border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; min-height: 34px;
  transition: background .15s, color .15s, transform .12s, box-shadow .15s;
}
.iconbtn svg { width: 17px; height: 17px; }
.iconbtn:hover {
  background: var(--hover); color: var(--text);
  transform: scale(1.08);
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.iconbtn:active { transform: scale(.94); }

/* ── Modales ──────────────────────────────────────────────────────────────── */
.modal {
  position: fixed; inset: 0; z-index: 200;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.72);
  backdrop-filter: blur(4px);
}
.modal-card {
  position: relative; z-index: 1;
  background: #14101f; border: 1px solid var(--border);
  border-radius: var(--radius); width: 100%;
  display: flex; flex-direction: column;
  max-height: calc(100dvh - 32px);
  overflow: hidden;
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 14px 18px;
  border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.modal-title { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.modal-head-actions { display: flex; gap: 6px; flex-shrink: 0; }
.modal-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; padding: 10px 18px;
  border-top: 1px solid var(--border); flex-shrink: 0;
  font-size: .82rem;
}
.actions { display: flex; gap: 8px; }

/* ── Preview modal ────────────────────────────────────────────────────────── */
.preview-card { max-width: 900px; }
.preview-body {
  flex: 1; overflow: auto; display: flex;
  align-items: center; justify-content: center;
  min-height: 200px; padding: 16px; background: #0b0b14;
}
.preview-body img {
  max-width: 100%; max-height: calc(100dvh - 200px);
  border-radius: 8px; display: block; margin: auto;
}
.preview-body video { max-width: 100%; width: 100%; border-radius: 8px; max-height: calc(100dvh - 200px); }
.preview-file-info { text-align: center; padding: 24px; }
.preview-file-icon { margin-bottom: 12px; color: var(--muted); }
.preview-file-icon svg { width: 64px; height: 64px; }
.preview-file-name { font-size: 1.1rem; font-weight: 600; margin-bottom: 4px; }
.preview-file-size { color: var(--muted); font-size: .9rem; }

.preview-text {
  width: 100%; max-height: calc(100dvh - 200px);
  overflow: auto; margin: 0;
  padding: 16px 20px;
  font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  font-size: .85rem; line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
  color: var(--text); background: #0b0b14;
  text-align: left; align-self: stretch;
}
.preview-truncated {
  width: 100%; padding: 8px 20px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,.02); text-align: center;
}
/* ── Custom Audio Player ─────────────────────────────────────────────────── */
.ap {
  display: flex; flex-direction: column; align-items: center;
  gap: 20px; padding: 32px 28px;
  width: 100%; max-width: 420px; margin: 0 auto;
}
.ap-disc-wrap {
  position: relative; width: 136px; height: 136px; flex-shrink: 0;
}
.ap-disc {
  width: 100%; height: 100%; border-radius: 50%; overflow: hidden;
  background: conic-gradient(#4c1d95, #7c3aed, #a78bfa, #6366f1, #4c1d95);
  box-shadow: 0 8px 36px rgba(124,58,237,.35);
  transition: box-shadow .4s;
}
.ap-disc.playing {
  animation: ap-spin 4s linear infinite;
  box-shadow: 0 12px 52px rgba(124,58,237,.6);
}
@keyframes ap-spin { to { transform: rotate(360deg); } }
.ap-cover {
  width: 100%; height: 100%; object-fit: cover; display: block;
}
.ap-disc-center {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%,-50%);
  width: 46px; height: 46px; border-radius: 50%;
  background: #0d0d1a; display: flex; align-items: center;
  justify-content: center; color: #a78bfa;
  box-shadow: inset 0 2px 8px rgba(0,0,0,.7), 0 0 0 2px rgba(255,255,255,.06);
  pointer-events: none;
}
.ap-disc-center svg { width: 20px; height: 20px; }
.ap-info { text-align: center; width: 100%; }
.ap-name {
  font-size: 1rem; font-weight: 600; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.ap-size { color: var(--muted); font-size: .8rem; margin-top: 4px; }
.ap-seek-row { display: flex; align-items: center; gap: 8px; width: 100%; }
.ap-time {
  font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums;
  flex-shrink: 0; width: 36px;
}
.ap-time.ap-time-r { text-align: right; }
.ap-range {
  -webkit-appearance: none; -moz-appearance: none; appearance: none;
  flex: 1; height: 4px; border-radius: 99px; outline: none; cursor: pointer;
  --val: 0%;
  background: linear-gradient(to right, #7c3aed var(--val), rgba(255,255,255,.14) var(--val));
}
.ap-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px; border-radius: 50%; background: #a78bfa;
  box-shadow: 0 0 8px rgba(124,58,237,.7); transition: transform .1s;
}
.ap-range:hover::-webkit-slider-thumb { transform: scale(1.35); }
.ap-range::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #a78bfa; border: none; }
.ap-range::-moz-range-track { background: rgba(255,255,255,.14); height: 4px; border-radius: 99px; }
.ap-range::-moz-range-progress { background: #7c3aed; height: 4px; border-radius: 99px; }
.ap-btns { display: flex; align-items: center; justify-content: center; }
.ap-play-btn {
  width: 64px; height: 64px; border-radius: 50%;
  background: #7c3aed; border: none; color: #fff;
  font-size: 1.5rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .15s, transform .12s, box-shadow .15s;
  box-shadow: 0 4px 24px rgba(124,58,237,.45);
}
.ap-play-btn:hover { background: #6d28d9; transform: scale(1.07); box-shadow: 0 6px 32px rgba(124,58,237,.6); }
.ap-play-btn:active { transform: scale(0.94); }
.ap-vol-row {
  display: flex; align-items: center; gap: 8px;
  width: 60%; opacity: .65; transition: opacity .2s;
}
.ap-vol-row:hover { opacity: 1; }
.ap-vol-icon { flex-shrink: 0; color: var(--muted); display: flex; align-items: center; }
.ap-vol-icon svg { width: 14px; height: 14px; }
.ap-vol-range { height: 3px !important; }
.ap-vol-range::-webkit-slider-thumb { width: 10px !important; height: 10px !important; }
.ap-vol-range::-moz-range-thumb { width: 10px !important; height: 10px !important; }
@media (max-width: 480px) {
  .ap { padding: 24px 16px; gap: 16px; }
  .ap-disc-wrap { width: 112px; height: 112px; }
  .ap-disc-center { width: 38px; height: 38px; }
  .ap-disc-center svg { width: 17px; height: 17px; }
  .ap-play-btn { width: 56px; height: 56px; font-size: 1.3rem; }
  .ap-vol-row { width: 75%; }
}

.preview-foot { flex-wrap: wrap; gap: 12px; }
.preview-foot .actions { flex-wrap: wrap; gap: 6px; }
.preview-foot .btn-primary,
.preview-foot .btn-ghost,
.preview-foot .btn-danger {
  padding: 8px 14px !important; font-size: .88rem !important;
  font-weight: 600;
  transition: transform .12s, background .12s;
}
.preview-foot .btn-primary:hover,
.preview-foot .btn-ghost:hover,
.preview-foot .btn-danger:hover { transform: translateY(-1px); }

.preview-body embed,
.preview-body iframe {
  width: 100%; height: calc(100dvh - 240px);
  min-height: 480px; border: 0; background: #fff;
  border-radius: 8px;
}

/* ── Upload modal ─────────────────────────────────────────────────────────── */
.upload-card { max-width: 560px; }
.upload-body { flex: 1; overflow: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.drop-zone {
  border: 2px dashed var(--border); border-radius: var(--radius);
  padding: 32px 16px; text-align: center; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.drop-zone.drag-over { border-color: var(--accent2); background: rgba(124,58,237,.08); }
.drop-zone-content { pointer-events: none; }
.drop-zone-icon { margin-bottom: 8px; color: var(--accent2); opacity: .75; }
.small { font-size: .82rem; }
.upload-btns { display: flex; gap: 8px; }
.upload-queue { list-style: none; display: flex; flex-direction: column; gap: 6px; max-height: 240px; overflow-y: auto; }
.upload-queue li {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px;
  padding: 6px 10px; background: var(--surface);
  border-radius: var(--r-sm); font-size: .85rem;
}
.upload-queue li .q-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.upload-queue li .q-size { color: var(--muted); flex-shrink: 0; }
.upload-queue li .q-status { flex-shrink: 0; display: flex; align-items: center; }
.q-status svg { width: 14px; height: 14px; }
.q-status.ok   { color: var(--ok); }
.q-status.err  { color: var(--err); }
.q-status.busy { color: var(--accent2); }
.q-status.skip { color: var(--muted); }
.q-remove {
  background: none; border: none; cursor: pointer; flex-shrink: 0;
  color: var(--muted); padding: 2px 4px; border-radius: 4px;
  font-size: .78rem; line-height: 1; transition: color .12s;
}
.q-remove:hover { color: var(--err); }
.upload-progress { flex-basis: 100%; height: 5px; background: rgba(255,255,255,.07); border-radius: 3px; overflow: hidden; margin: 0; }
.upload-progress-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); width: 0%; transition: width .2s; }

/* ── Upload dedup switch ─────────────────────────────────────────────────── */
.upload-dedup-row { display: flex; align-items: center; }
.dedup-toggle {
  display: flex; align-items: center; gap: 8px;
  cursor: pointer; font-size: .82rem; color: var(--muted);
  user-select: none;
}
.dedup-toggle input { display: none; }
.dedup-slider {
  width: 34px; height: 18px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 9px; position: relative; flex-shrink: 0;
  transition: background .2s, border-color .2s;
}
.dedup-slider::after {
  content: ''; position: absolute;
  width: 12px; height: 12px;
  background: var(--muted); border-radius: 50%;
  top: 2px; left: 2px;
  transition: transform .2s, background .2s;
}
.dedup-toggle input:checked + .dedup-slider { background: rgba(124,58,237,.3); border-color: var(--accent); }
.dedup-toggle input:checked + .dedup-slider::after { background: var(--accent2); transform: translateX(16px); }
.dedup-toggle input:checked ~ span:last-child { color: var(--accent2); }

/* ── Dedup scan bar ──────────────────────────────────────────────────────── */
.dedup-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; margin-bottom: 10px;
  background: rgba(234,179,8,.07); border: 1px solid rgba(234,179,8,.22);
  border-radius: var(--r-sm); font-size: .82rem; flex-wrap: wrap;
}
.dedup-bar[hidden] { display: none !important; }
.dedup-bar.dedup-ok { background: rgba(126,226,193,.07); border-color: rgba(126,226,193,.25); }
.dedup-bar-icon { flex-shrink: 0; color: #fbbf24; display: flex; align-items: center; }
.dedup-bar.dedup-ok .dedup-bar-icon { color: var(--ok); }
.dedup-bar > #dedup-msg { flex: 1; color: #fde68a; min-width: 160px; }
.dedup-bar.dedup-ok > #dedup-msg { color: var(--ok); }
.dedup-bar-actions { display: flex; gap: 6px; flex-shrink: 0; }
.row.dup-highlight { background: rgba(234,179,8,.07) !important; border-left: 2px solid rgba(251,191,36,.45); }

/* ── Global upload progress bar ──────────────────────────────────────────── */
.upload-foot { flex-direction: column; align-items: stretch; gap: 0; padding: 12px 18px; }
.upload-overall-wrap { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.upload-overall-wrap[hidden] { display: none; }
.upload-overall-bar-wrap { flex: 1; height: 8px; background: var(--surface); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.upload-overall-bar { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); width: 0%; transition: width .25s; }
.upload-overall-pct { font-size: .8rem; color: var(--accent2); font-weight: 700; min-width: 38px; text-align: right; flex-shrink: 0; }
.upload-foot-bottom { display: flex; align-items: center; justify-content: space-between; gap: 10px; }

/* ── Floating upload bubble ────────────────────────────────────────────────── */
.upload-bubble {
  position: fixed; bottom: 20px; right: 20px; z-index: 150;
  width: 340px;
  background: #1a1428;
  border: 1px solid rgba(124,58,237,.4);
  border-radius: var(--radius);
  box-shadow: 0 8px 32px rgba(0,0,0,.55), 0 0 0 1px rgba(124,58,237,.15);
  overflow: hidden;
}
.upload-bubble[hidden] { display: none; }
.upload-bubble-track { height: 4px; background: var(--surface); }
.upload-bubble-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .25s; }
.upload-bubble-body { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; }
.upload-bubble-left { display: flex; align-items: center; gap: 10px; min-width: 0; flex: 1; }
.upload-bubble-icon { color: var(--accent2); flex-shrink: 0; display: flex; align-items: center; animation: bob .9s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(-3px); } }
.upload-bubble-text { display: flex; flex-direction: column; min-width: 0; }
#upload-bubble-info { font-size: .82rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
#upload-bubble-pct  { font-size: .75rem; color: var(--accent2); font-weight: 700; }
.upload-bubble-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ── First-run & login subtitle ──────────────────────────────────────────── */
.login-subtitle { font-size: .88rem; color: var(--muted); margin: -14px 0 18px; line-height: 1.5; }

/* ── Settings modal ──────────────────────────────────────────────────────── */
.settings-card { max-width: 540px; }
.settings-body {
  flex: 1; overflow-y: auto; padding: 4px 0;
}
.settings-section {
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 12px;
}
.settings-section:last-child { border-bottom: none; }
.settings-section-title {
  font-size: .75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted);
}
.settings-hint {
  font-size: .82rem; color: var(--muted); line-height: 1.5;
}
.settings-hint a { color: var(--accent2); text-decoration: none; }
.settings-hint a:hover { text-decoration: underline; }
.settings-hint code { background: rgba(255,255,255,.07); padding: 1px 5px; border-radius: 4px; font-size: .8rem; }
.settings-err {
  background: rgba(255,122,144,.1); border: 1px solid rgba(255,122,144,.3);
  color: var(--err); border-radius: var(--r-sm); padding: 7px 12px;
  font-size: .82rem; word-break: break-word;
}
/* reuse .field styles from login — settings inputs */
.settings-section .field input {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text); font: inherit; font-size: .92rem;
  padding: 9px 13px; width: 100%;
  outline: none; transition: border-color .15s, background .15s;
}
.settings-section .field input:focus {
  border-color: var(--accent2);
  background: rgba(255,255,255,.09);
}

/* field inline (TTL days) */
.field-inline { display: flex; align-items: center; gap: 10px; }
.field-inline input { width: 90px !important; }
.field-inline-label { color: var(--muted); font-size: .9rem; }

.sync-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 4px; }
.sync-row .small { font-size: .82rem; }

/* ── Status dot ─────────────────────────────────────────────────────────── */
.tg-status-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.status-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  transition: background .3s;
}
.dot-ok   { background: var(--ok); box-shadow: 0 0 6px var(--ok); }
.dot-warn { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; }
.dot-err  { background: var(--err); box-shadow: 0 0 6px var(--err); }
.dot-off  { background: var(--muted); }
.status-text { flex: 1; font-size: .9rem; }

/* ── Session status ──────────────────────────────────────────────────────── */
.session-status-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
}
.session-status-label { font-size: .9rem; flex: 1; }
.session-status-label.ok   { color: var(--ok); }
.session-status-label.warn { color: #f59e0b; }

/* ── OTP Wizard ──────────────────────────────────────────────────────────── */
.otp-wizard {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 12px;
  margin-top: 4px;
}
.otp-step { display: flex; flex-direction: column; gap: 10px; }
.otp-step .field input {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text); font: inherit; font-size: .92rem;
  padding: 9px 13px; width: 100%; outline: none;
  transition: border-color .15s;
}
.otp-step .field input:focus { border-color: var(--accent2); }
.otp-actions { display: flex; gap: 8px; }
.otp-ok {
  flex-direction: row; align-items: center; gap: 10px;
  color: var(--ok); font-weight: 600;
}
.ok-icon { font-size: 1.3rem; }

/* ── Channel picker ───────────────────────────────────────────────────────── */
.channel-picker {
  display: flex; flex-direction: column; gap: 8px;
  margin-top: 10px;
}
.channel-picker-head { display: flex; align-items: center; gap: 8px; }
.channel-list {
  list-style: none;
  display: flex; flex-direction: column; gap: 4px;
  max-height: 200px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 4px;
}
.channel-item {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 10px; border-radius: 6px; cursor: pointer;
  transition: background .12s; border: 1px solid transparent;
  font-size: .88rem;
}
.channel-item:hover    { background: var(--hover); }
.channel-item.selected {
  background: rgba(124,58,237,.15);
  border-color: rgba(124,58,237,.4);
}
.channel-badge {
  font-size: .7rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 2px 6px; border-radius: 99px; flex-shrink: 0;
}
.channel-badge-canal { background: rgba(37,99,235,.25); color: #60a5fa; }
.channel-badge-grupo { background: rgba(124,58,237,.25); color: var(--accent2); }
.channel-name { flex: 1; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.channel-username { color: var(--muted); font-size: .82rem; flex-shrink: 0; }
.channel-id {
  background: rgba(255,255,255,.07); padding: 2px 6px;
  border-radius: 4px; font-size: .75rem; color: var(--muted);
  flex-shrink: 0; font-family: monospace;
}

/* ── Wizard ──────────────────────────────────────────────────────────────── */
.wizard-screen {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; overflow-y: auto;
}
.wizard-screen[hidden] { display: none; }
.wizard-card {
  position: relative; z-index: 1;
  background: #14101f; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 32px;
  width: 100%; max-width: 540px;
  box-shadow: 0 24px 80px rgba(0,0,0,.6);
  display: flex; flex-direction: column; gap: 18px;
}
.wizard-brand {
  display: flex; align-items: center; gap: 10px;
  font-size: 1.5rem; font-weight: 800; color: var(--accent2);
}
.wizard-brand svg { width: 30px; height: 30px; }

.wizard-steps {
  display: flex; gap: 6px; flex-wrap: wrap;
  list-style: none; padding: 0; margin: 0;
  font-size: .72rem; text-transform: uppercase; letter-spacing: .04em;
  color: var(--muted);
}
.wizard-steps li {
  padding: 4px 10px; border-radius: 99px;
  background: rgba(255,255,255,.04); border: 1px solid var(--border);
}
.wizard-steps li.current { background: var(--accent); color: #fff; border-color: var(--accent); }
.wizard-steps li.done { color: var(--ok); border-color: rgba(126,226,193,.3); }
.wizard-steps li.optional { opacity: .55; }

.wiz-step { display: flex; flex-direction: column; gap: 14px; }
.wiz-step[hidden] { display: none !important; }
.otp-step[hidden] { display: none !important; }
.chat-pane[hidden] { display: none !important; }
.wiz-title { font-size: 1.4rem; font-weight: 700; color: var(--text); margin: 0; }
.wiz-sub  { font-size: .92rem; color: var(--muted); line-height: 1.5; margin: 0; }
.wiz-sub  code { background: rgba(255,255,255,.07); padding: 1px 5px; border-radius: 4px; font-size: .85em; }
.wiz-sub  a    { color: var(--accent2); }
.wiz-info {
  background: rgba(124,58,237,.08); border: 1px solid rgba(124,58,237,.3);
  color: var(--text); padding: 8px 12px; border-radius: var(--r-sm);
  font-size: .85rem; line-height: 1.5; margin: 0;
}
.wiz-err {
  background: rgba(255,122,144,.1); border: 1px solid rgba(255,122,144,.3);
  color: var(--err); padding: 8px 12px; border-radius: var(--r-sm); font-size: .85rem;
}
.wiz-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px; }
.wiz-step .field input {
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text); font: inherit; font-size: 1rem;
  padding: 11px 14px; width: 100%; outline: none;
  transition: border-color .15s, background .15s;
}
.wiz-step .field input:focus { border-color: var(--accent2); background: rgba(255,255,255,.09); }

/* ── PIN input boxes ──────────────────────────────────────────────────── */
.pin-inputs { display: flex; gap: 10px; justify-content: center; margin: 4px 0; }
.pin-box {
  width: 54px; height: 62px; text-align: center;
  font-size: 1.6rem; font-weight: 700; letter-spacing: 2px;
  background: rgba(255,255,255,.06);
  border: 2px solid var(--border);
  border-radius: 12px; color: var(--text); outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
  -webkit-text-security: disc;
}
.pin-box:focus {
  border-color: var(--accent2);
  background: rgba(124,58,237,.12);
  box-shadow: 0 0 0 3px rgba(168,85,247,.25);
}
.pin-box.filled { border-color: var(--accent); }
.pin-set-label { font-size: .82rem; color: var(--muted); text-align: center; margin-bottom: -4px; }
.pin-hint { font-size: .82rem; color: #fbbf24; text-align: center; padding: 4px 0; }
.wiz-remember { display: flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--muted); cursor: pointer; justify-content: center; margin: 8px 0 2px; }
.wiz-remember input[type=checkbox] { accent-color: var(--accent2); width: 16px; height: 16px; cursor: pointer; }

/* Tabs select / create chat */
.chat-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); }
.chat-tab {
  background: transparent; color: var(--muted);
  padding: 8px 14px; border-radius: 0; font: inherit;
  border-bottom: 2px solid transparent;
  transition: color .12s, border-color .12s;
}
.chat-tab:hover { color: var(--text); }
.chat-tab.active { color: var(--accent2); border-bottom-color: var(--accent2); }

/* Lista chats picker */
.chat-picker-list {
  list-style: none;
  display: flex; flex-direction: column; gap: 4px;
  max-height: 280px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 4px;
}
.chat-pick {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 6px; cursor: pointer;
  transition: background .12s; border: 1px solid transparent;
  font-size: .88rem; flex-wrap: wrap;
}
.chat-pick:hover    { background: var(--hover); }
.chat-pick.selected {
  background: rgba(124,58,237,.18);
  border-color: rgba(124,58,237,.5);
}
.chat-pick-badge {
  font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 6px; border-radius: 99px; flex-shrink: 0;
}
.chat-pick-canal { background: rgba(37,99,235,.25); color: #60a5fa; }
.chat-pick-grupo { background: rgba(124,58,237,.25); color: var(--accent2); }
.chat-pick-name  { flex: 1; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-pick-username { color: var(--muted); font-size: .82rem; flex-shrink: 0; }
.chat-pick-id {
  background: rgba(255,255,255,.07); padding: 2px 6px;
  border-radius: 4px; font-size: .72rem; color: var(--muted);
  font-family: monospace; flex-shrink: 0;
}

/* Sync progress */
.sync-box { display: flex; flex-direction: column; gap: 10px; }
.sync-progress-wrap {
  height: 8px; background: var(--surface); border-radius: 4px;
  overflow: hidden; border: 1px solid var(--border);
}
.sync-progress-bar {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2));
  width: 0%; transition: width .4s ease;
}
.sync-stats { font-size: .88rem; color: var(--muted); text-align: center; }

.current-chat-row { display: flex; align-items: center; gap: 8px; font-size: .85rem; }
.current-chat-row code {
  background: rgba(255,255,255,.07); padding: 3px 8px; border-radius: 4px;
  font-family: monospace; color: var(--text);
}

/* Wizard: progreso minimal + botón link prominente */
.wiz-progress {
  font-size: .72rem; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: -8px 0 4px;
}
.wiz-link-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 16px; border-radius: var(--r-sm);
  background: rgba(124,58,237,.12); border: 1px solid rgba(124,58,237,.4);
  color: var(--accent2); font-weight: 600; font-size: .92rem;
  text-decoration: none; transition: background .12s, transform .12s;
  align-self: flex-start;
}
.wiz-link-btn:hover { background: rgba(124,58,237,.22); transform: translateY(-1px); }

/* Ocultar la lista vieja de pasos por si queda en algún sitio */
.wizard-steps { display: none !important; }

/* ── Verify-method step ───────────────────────────────────────────────────── */
.method-cards {
  display: flex; gap: 14px; margin: 4px 0;
}
.method-card {
  flex: 1; border-radius: 14px; padding: 18px 14px; text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  position: relative; border: 2px solid transparent;
  transition: border-color .15s, transform .12s, box-shadow .15s;
}
.method-card-icon { font-size: 1.8rem; line-height: 1; }
.method-card-name { font-size: .9rem; font-weight: 700; color: var(--text); }
.method-card-sub  { font-size: .78rem; color: var(--muted); }
.method-card-flood { font-size: .78rem; color: #ff7a90; margin-top: 2px; }
.method-card--off {
  background: rgba(255,255,255,.03); border-color: var(--border);
  opacity: .55; cursor: not-allowed;
}
.method-card--on {
  background: rgba(124,58,237,.1); border-color: rgba(124,58,237,.45);
  cursor: pointer;
}
.method-card--on:hover  { border-color: var(--accent2); transform: translateY(-2px); box-shadow: 0 6px 20px rgba(124,58,237,.25); }
.method-card--on:active { transform: translateY(0); }
.method-card--busy { opacity: .6; pointer-events: none; }
.method-badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  background: var(--accent); color: #fff;
  font-size: .65rem; font-weight: 700; text-transform: uppercase; letter-spacing: .07em;
  padding: 3px 10px; border-radius: 20px; white-space: nowrap;
}

/* ── QR login step ────────────────────────────────────────────────────────── */
.qr-frame {
  position: relative; width: 200px; height: 200px; margin: 4px auto;
  border-radius: 16px; overflow: hidden;
  border: 2px solid var(--border); background: #fff;
}
.qr-frame img {
  width: 100%; height: 100%; object-fit: contain; display: block;
  transition: opacity .2s;
}
.qr-spinner {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  background: rgba(255,255,255,.92);
}
.qr-spinner[hidden] { display: none; }
.qr-spinner span { font-size: .8rem; color: var(--muted); }
.spinner-ring {
  width: 36px; height: 36px; border-radius: 50%;
  border: 3px solid rgba(124,58,237,.2);
  border-top-color: var(--accent2);
  animation: ap-spin .7s linear infinite;
}
.wiz-hint { text-align: center; }

/* ── Settings page (pantalla completa) ──────────────────────────────────── */
.settings-screen {
  position: fixed; inset: 0; z-index: 150;
  background: var(--bg);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.settings-screen[hidden] { display: none; }

/* Header */
.cfg-header {
  display: flex; align-items: center;
  height: 54px; flex-shrink: 0;
  padding: 0 16px;
  background: rgba(11,11,20,.9);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--border);
  position: relative;
}
.cfg-back {
  display: flex; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer;
  color: var(--accent2); font: inherit; font-size: .9rem; font-weight: 600;
  padding: 6px 8px 6px 2px; border-radius: 8px;
  transition: opacity .15s;
  flex-shrink: 0;
}
.cfg-back:hover { opacity: .75; }
.cfg-back svg { flex-shrink: 0; }
.cfg-header-title {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-weight: 700; font-size: .95rem;
  white-space: nowrap; pointer-events: none;
}
.cfg-header-end { flex: 1; }

/* Scroll + lista */
.cfg-scroll {
  flex: 1; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.cfg-list {
  max-width: 620px; margin: 0 auto;
  padding: 20px 16px 80px;
  display: flex; flex-direction: column; gap: 12px;
}

/* Tarjeta base */
.cfg-card {
  background: rgba(255,255,255,.035);
  border: 1px solid var(--border);
  border-radius: 18px;
  overflow: hidden;
}

/* Cabecera de tarjeta */
.cfg-card-head {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
}
.cfg-icon {
  width: 44px; height: 44px; border-radius: 13px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.cfg-icon-blue   { background: rgba(37,99,235,.18);  border: 1px solid rgba(37,99,235,.3);  color: #60a5fa; }
.cfg-icon-purple { background: rgba(124,58,237,.18); border: 1px solid rgba(124,58,237,.3); color: #c084fc; }
.cfg-icon-teal   { background: rgba(20,184,166,.18); border: 1px solid rgba(20,184,166,.3); color: #2dd4bf; }
.cfg-icon-amber  { background: rgba(245,158,11,.15); border: 1px solid rgba(245,158,11,.25); color: #fbbf24; }
.cfg-icon-green  { background: rgba(34,197,94,.15);  border: 1px solid rgba(34,197,94,.25);  color: #4ade80; }

.cfg-card-info { flex: 1; min-width: 0; }
.cfg-card-title { font-size: .93rem; font-weight: 700; color: var(--text); margin-bottom: 3px; }
.cfg-card-desc  { font-size: .8rem; color: var(--muted); line-height: 1.4; }

/* Cuerpo de tarjeta */
.cfg-card-body {
  padding: 18px 20px;
  display: flex; flex-direction: column; gap: 14px;
}

/* Pill de estado */
.cfg-status-pill {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.cfg-status-label { flex: 1; font-size: .88rem; }

/* Canal activo */
.cfg-current-chat {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 14px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.cfg-label { font-size: .78rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; flex-shrink: 0; }
.cfg-code  { background: rgba(255,255,255,.08); padding: 3px 8px; border-radius: 6px; font-family: monospace; font-size: .82rem; color: var(--text); word-break: break-all; }

/* Fila con texto + botón */
.cfg-row-between {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
}
.cfg-hint { font-size: .85rem; color: var(--muted); line-height: 1.4; flex: 1; }

/* Dos campos en fila (api id + hash) */
.cfg-fields-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
@media (max-width: 440px) { .cfg-fields-row { grid-template-columns: 1fr; } }

/* Link externo */
.cfg-ext-link {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 10px;
  background: rgba(124,58,237,.1); border: 1px solid rgba(124,58,237,.3);
  color: var(--accent2); font-size: .88rem; font-weight: 600;
  text-decoration: none; transition: background .12s;
  align-self: flex-start;
}
.cfg-ext-link:hover { background: rgba(124,58,237,.2); }

/* TTL row */
.cfg-ttl-row { display: flex; align-items: center; gap: 10px; }
.cfg-ttl-input {
  width: 76px !important; text-align: center;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font: inherit; font-size: .95rem;
  padding: 9px 10px; outline: none;
  transition: border-color .15s, background .15s;
}
.cfg-ttl-input:focus { border-color: var(--accent2); background: rgba(255,255,255,.09); }

/* Mensaje de confirmación/error */
.cfg-msg {
  font-size: .82rem; color: var(--ok); display: block;
}
.cfg-msg[hidden] { display: none; }

/* Inputs dentro de cfg-card-body */
.cfg-card-body .field { display: flex; flex-direction: column; gap: 6px; }
.cfg-card-body .field label {
  font-size: .75rem; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .05em;
}
.cfg-card-body .field input {
  background: rgba(255,255,255,.06); border: 1px solid var(--border);
  border-radius: 10px; color: var(--text); font: inherit;
  font-size: .93rem; padding: 11px 14px; width: 100%; outline: none;
  transition: border-color .15s, background .15s;
}

/* ── Language switcher ──────────────────────────────────────────────────── */
.lang-switcher {
  display: flex; gap: 2px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 3px; flex-shrink: 0;
}
.lang-btn {
  background: transparent; border: none;
  color: var(--muted); font: inherit; font-size: .78rem; font-weight: 600;
  padding: 4px 8px; border-radius: 6px; cursor: pointer;
  letter-spacing: .04em; text-transform: uppercase;
  transition: background .12s, color .12s;
}
.lang-btn:hover { background: var(--hover); color: var(--text); }
.lang-btn.active {
  background: var(--accent); color: #fff;
}
.lang-switcher-wiz {
  align-self: flex-end;
}
.cfg-card-body .field input:focus {
  border-color: var(--accent2); background: rgba(255,255,255,.09);
}

/* Tarjeta de advertencia (credenciales) */
.cfg-card-warn { border-color: rgba(245,158,11,.2); }
.cfg-card-warn .cfg-card-head { border-bottom-color: rgba(245,158,11,.15); }

/* Mobile */
@media (max-width: 480px) {
  .cfg-list { padding: 14px 12px 80px; gap: 10px; }
  .cfg-card-head { padding: 14px 16px; gap: 12px; }
  .cfg-card-body { padding: 14px 16px; gap: 12px; }
  .cfg-icon { width: 40px; height: 40px; border-radius: 11px; }
}

/* ── Move modal ──────────────────────────────────────────────────────────── */
.move-card { max-width: 460px; }
.move-body { flex: 1; overflow-y: auto; padding: 8px 16px 12px; display: flex; flex-direction: column; gap: 6px; }
.move-folder-list { list-style: none; display: flex; flex-direction: column; gap: 2px; min-height: 120px; }
.move-folder-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent;
  transition: background .12s, border-color .12s;
}
.move-folder-item:hover { background: var(--hover); border-color: var(--border); }
.move-folder-root { border-color: var(--border); background: var(--surface-alt, var(--surface)); font-style: italic; }
.move-folder-icon { flex-shrink: 0; display: flex; align-items: center; color: var(--muted); }
.move-folder-icon svg { width: 20px; height: 20px; }
.move-folder-name { flex: 1; font-size: .92rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.move-folder-arrow { color: var(--muted); flex-shrink: 0; display: flex; align-items: center; }
.move-folder-arrow svg { width: 14px; height: 14px; }

/* ── Share modal ─────────────────────────────────────────────────────────── */
.share-card { max-width: 460px; }
.share-body { padding: 20px 24px; display: flex; flex-direction: column; gap: 16px; }
.share-file-name { font-weight: 600; font-size: .95rem; word-break: break-all; color: var(--text); padding: 10px 14px; background: var(--surface); border-radius: 10px; border: 1px solid var(--border); }
.share-section-label { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.share-dur-row { display: flex; align-items: center; gap: 10px; }
.share-dur-row label { font-size: .78rem; color: var(--muted); white-space: nowrap; }
.share-dur-select {
  flex: 1; background: rgba(255,255,255,.06); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); font: inherit; font-size: .9rem;
  padding: 8px 12px; outline: none; cursor: pointer;
  transition: border-color .15s, background .15s;
  appearance: none; -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%237a7a9a' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
  padding-right: 28px;
}
.share-dur-select:focus { border-color: var(--accent2); background-color: rgba(255,255,255,.09); }
.share-dur-select option { background: #1a1428; color: var(--text); }
.share-result { display: flex; flex-direction: column; gap: 12px; }
.share-result[hidden] { display: none !important; }
.share-link-row { display: flex; gap: 8px; align-items: center; }
.share-link-input { flex: 1; min-width: 0; background: rgba(255,255,255,.05); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; color: var(--text); font-size: .8rem; font-family: monospace; }
.share-qr-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.share-qr-img { width: 176px; height: 176px; border-radius: 12px; background: #fff; padding: 8px; display: block; }
.share-expiry-label { text-align: center; }
.share-badge {
  display: inline-flex; align-items: center;
  background: rgba(124,58,237,.22); color: #c4b5fd;
  border: 1px solid rgba(124,58,237,.45);
  border-radius: 99px; padding: 1px 8px;
  font-size: .68rem; font-weight: 700;
  margin-left: 7px; vertical-align: middle;
  letter-spacing: .03em; white-space: nowrap;
}
.file-list li.row.is-shared {
  border-color: rgba(124,58,237,.35);
  background: rgba(124,58,237,.06);
}
.file-list li.row.is-shared:hover {
  background: rgba(124,58,237,.12);
  border-color: rgba(124,58,237,.5);
}
.file-list li.row.is-shared .row-name { color: #d8b4fe; }
.file-list li.row.is-shared .row-icon { box-shadow: 0 0 0 2px rgba(124,58,237,.4); }
