/* ============================================================
   Core — sistema visual
   Acento de marca: #1de9b6 (UI). Series de datos: tokens --viz-*
   ============================================================ */

* { box-sizing: border-box; }

:root {
  --accent: #1de9b6;
  --accent-ink: #04302a;
  --radius: 18px;
  --radius-sm: 12px;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, monospace;
  --speed: .22s;
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f14;
  --bg-2: #0e141b;
  --surface: #11161c;
  --glass: rgba(255, 255, 255, 0.045);
  --glass-strong: rgba(20, 27, 35, 0.72);
  --border: rgba(255, 255, 255, 0.085);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e8edf2;
  --text-2: #9aa7b4;
  --text-3: #5c6773;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --accent-soft: rgba(29, 233, 182, 0.12);
  --accent-border: rgba(29, 233, 182, 0.35);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, 0.12);
  /* viz (validado sobre #11161c) */
  --viz-series: #0da77f;
  --viz-grid: rgba(255, 255, 255, 0.07);
  --viz-axis: rgba(255, 255, 255, 0.16);
  --viz-spark: #4a5561;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #f0f4f5;
  --bg-2: #e8eef0;
  --surface: #f6f8f9;
  --glass: rgba(255, 255, 255, 0.6);
  --glass-strong: rgba(255, 255, 255, 0.85);
  --border: rgba(10, 30, 28, 0.1);
  --border-strong: rgba(10, 30, 28, 0.2);
  --text: #10181d;
  --text-2: #48555f;
  --text-3: #8494a0;
  --shadow: 0 20px 50px rgba(30, 60, 55, 0.14);
  --accent-soft: rgba(29, 233, 182, 0.16);
  --accent-border: rgba(13, 148, 118, 0.45);
  --danger: #d64545;
  --danger-soft: rgba(214, 69, 69, 0.1);
  /* viz (validado sobre #f6f8f9) */
  --viz-series: #0b8f6d;
  --viz-grid: rgba(10, 30, 28, 0.08);
  --viz-axis: rgba(10, 30, 28, 0.18);
  --viz-spark: #a8b6bf;
}

html { height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  transition: background var(--speed), color var(--speed);
  overflow-x: hidden;
}

::selection { background: var(--accent-soft); }

/* ---------- fondo ambiental ---------- */
.orbs { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; }
.orbs i {
  position: absolute; border-radius: 50%; filter: blur(90px); opacity: .25;
  animation: drift 26s ease-in-out infinite alternate;
}
.orbs i:nth-child(1) { width: 480px; height: 480px; background: #1de9b6; top: -180px; right: -120px; opacity: .15; }
.orbs i:nth-child(2) { width: 380px; height: 380px; background: #0d6e5a; bottom: -160px; left: -100px; animation-delay: -8s; }
.orbs i:nth-child(3) { width: 260px; height: 260px; background: #1a8f77; top: 46%; left: 38%; opacity: .12; animation-delay: -16s; }
html[data-theme="light"] .orbs i { opacity: .14; }
html[data-theme="light"] .orbs i:nth-child(1) { opacity: .11; }
html[data-theme="light"] .orbs i:nth-child(3) { opacity: .1; }
@keyframes drift {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(-60px, 50px) scale(1.15); }
}

/* ---------- boot loader ---------- */
.boot {
  position: fixed; inset: 0; z-index: 100; display: grid; place-content: center;
  gap: 20px; justify-items: center; background: #0b0f14;
  transition: opacity .5s, visibility .5s;
}
.boot.done { opacity: 0; visibility: hidden; }
.boot-logo { position: relative; width: 74px; height: 74px; }
.boot-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 3px solid rgba(29, 233, 182, .15); border-top-color: #1de9b6;
  animation: spin 1s cubic-bezier(.6,.15,.4,.85) infinite;
}
.boot-core {
  position: absolute; inset: 27px; border-radius: 50%; background: #1de9b6;
  box-shadow: 0 0 24px rgba(29, 233, 182, .8);
  animation: pulse 1.6s ease-in-out infinite;
}
.boot-word { font-size: 22px; font-weight: 700; letter-spacing: .28em; color: #e8edf2; padding-left: .28em; }
.boot-bar { width: 150px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.08); overflow: hidden; }
.boot-bar span { display: block; height: 100%; width: 40%; border-radius: 3px; background: #1de9b6; animation: slide 1.1s ease-in-out infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { transform: scale(.82); opacity: .75; } }
@keyframes slide { 0% { transform: translateX(-150%); } 100% { transform: translateX(400%); } }

/* ---------- layout ---------- */
.shell { position: relative; z-index: 1; display: flex; min-height: 100vh; }

.glass {
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  border: 1px solid var(--border);
}

.sidebar {
  position: sticky; top: 16px; align-self: flex-start;
  width: 232px; margin: 16px 0 16px 16px; padding: 20px 14px;
  min-height: calc(100vh - 32px);
  border-radius: var(--radius);
  display: flex; flex-direction: column; gap: 26px;
  box-shadow: var(--shadow);
}

.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--text); padding: 4px 8px; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(29,233,182,.25), rgba(29,233,182,.05));
  border: 1px solid var(--accent-border);
}
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 14px var(--accent); }
.brand-name { font-size: 20px; font-weight: 700; letter-spacing: .04em; }

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: var(--radius-sm);
  color: var(--text-2); text-decoration: none; font-size: 14.5px; font-weight: 550;
  transition: background var(--speed), color var(--speed);
  border: 1px solid transparent;
}
.nav-item svg { width: 19px; height: 19px; fill: currentColor; flex: none; }
.nav-item:hover { background: var(--glass); color: var(--text); }
.nav-item.active {
  background: var(--accent-soft); color: var(--accent);
  border-color: var(--accent-border);
}
html[data-theme="light"] .nav-item.active { color: #0a7a5e; }

.sidebar-foot { border-top: 1px solid var(--border); padding-top: 16px; }

/* toggle de tema */
.theme-toggle {
  display: flex; align-items: center; gap: 12px; width: 100%;
  background: none; border: 0; cursor: pointer; color: var(--text-2);
  font: inherit; font-size: 14px; padding: 6px 8px; border-radius: var(--radius-sm);
}
.theme-toggle:hover { color: var(--text); }
.tt-track {
  width: 46px; height: 26px; border-radius: 13px; position: relative; flex: none;
  background: var(--glass); border: 1px solid var(--border-strong);
  transition: background var(--speed);
}
.tt-thumb {
  position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent); display: grid; place-items: center;
  transition: transform .3s cubic-bezier(.5, 1.6, .4, 1);
  box-shadow: 0 0 10px rgba(29, 233, 182, .5);
}
html[data-theme="light"] .tt-thumb { transform: translateX(20px); }
.tt-thumb svg { width: 12px; height: 12px; fill: var(--accent-ink); color: var(--accent-ink); position: absolute; transition: opacity .2s; }
.tt-sun { opacity: 0; }
html[data-theme="light"] .tt-sun { opacity: 1; }
html[data-theme="light"] .tt-moon { opacity: 0; }

.main { flex: 1; padding: 30px 34px 60px; min-width: 0; outline: none; }

/* ---------- encabezados de vista ---------- */
.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; margin-bottom: 26px; flex-wrap: wrap; }
.view-head h1 { margin: 0 0 6px; font-size: 26px; font-weight: 700; letter-spacing: -0.01em; }
.view-head .sub { margin: 0; color: var(--text-2); font-size: 14px; }
.head-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 18px; border-radius: var(--radius-sm);
  font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--glass); color: var(--text);
  transition: all var(--speed);
  backdrop-filter: blur(8px);
}
.btn:hover { border-color: var(--accent-border); transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn svg { width: 16px; height: 16px; fill: currentColor; }
.btn.primary {
  background: var(--accent); color: var(--accent-ink); border-color: transparent;
  box-shadow: 0 6px 22px rgba(29, 233, 182, .35);
}
.btn.primary:hover { box-shadow: 0 8px 28px rgba(29, 233, 182, .5); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { border-color: var(--danger); background: var(--danger-soft); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 10px; }
.btn.icon { padding: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }

/* ---------- cards ---------- */
.card {
  background: var(--glass);
  backdrop-filter: blur(22px) saturate(1.4);
  -webkit-backdrop-filter: blur(22px) saturate(1.4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow);
}
.card h2 { margin: 0 0 4px; font-size: 15px; font-weight: 650; }
.card .hint { color: var(--text-3); font-size: 12.5px; margin: 0 0 14px; }

/* ---------- stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 22px; }
.tile { padding: 18px 20px; position: relative; overflow: hidden; }
.tile .t-label { font-size: 12.5px; color: var(--text-2); font-weight: 550; margin-bottom: 8px; }
.tile .t-value { font-size: 30px; font-weight: 650; line-height: 1.1; letter-spacing: -0.01em; }
.tile .t-delta { font-size: 12.5px; margin-top: 7px; font-weight: 600; max-width: calc(100% - 88px); }
.tile .t-delta.up { color: #17b890; }
html[data-theme="light"] .tile .t-delta.up { color: #0a7a5e; }
.tile .t-delta.down { color: var(--danger); }
.tile .t-delta.flat { color: var(--text-3); font-weight: 500; }
.tile .t-spark { position: absolute; right: 14px; bottom: 14px; opacity: .9; }

/* ---------- grid del dashboard ---------- */
.dash-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: 14px; align-items: start; }
@media (max-width: 980px) { .dash-grid { grid-template-columns: 1fr; } }
.side-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.top-item .ti-sub { font-size: 11px; color: var(--text-3); display: block; margin-top: 1px; }

/* ---------- gráfica ---------- */
.chart-card .chart-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.chart-wrap { position: relative; margin-top: 10px; }
.chart-wrap svg { display: block; width: 100%; height: auto; }
.chart-tip {
  position: absolute; pointer-events: none; z-index: 5;
  background: var(--glass-strong); border: 1px solid var(--border-strong);
  backdrop-filter: blur(14px);
  border-radius: 10px; padding: 8px 12px; font-size: 12.5px;
  box-shadow: 0 10px 26px rgba(0,0,0,.3);
  opacity: 0; transition: opacity .12s;
  white-space: nowrap; transform: translate(-50%, calc(-100% - 12px));
}
.chart-tip .tip-date { color: var(--text-2); margin-bottom: 2px; }
.chart-tip .tip-val { font-weight: 650; font-size: 14px; }
.chart-tip.on { opacity: 1; }

.seg { display: inline-flex; background: var(--glass); border: 1px solid var(--border); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: none; color: var(--text-2); font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 6px 12px; border-radius: 8px; cursor: pointer; transition: all var(--speed);
}
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--accent-soft); color: var(--accent); }
html[data-theme="light"] .seg button.active { color: #0a7a5e; }

.data-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.data-table th { text-align: left; color: var(--text-3); font-weight: 600; padding: 7px 10px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 7px 10px; border-bottom: 1px solid var(--border); color: var(--text-2); }
.data-table td.num { font-variant-numeric: tabular-nums; text-align: right; color: var(--text); }
.data-table tr:last-child td { border-bottom: 0; }
.table-scroll { max-height: 300px; overflow: auto; }

/* top list */
.top-list { display: flex; flex-direction: column; gap: 4px; margin-top: 10px; }
.top-item {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: var(--radius-sm);
  text-decoration: none; color: var(--text); transition: background var(--speed);
}
.top-item:hover { background: var(--glass); }
.top-rank {
  width: 26px; height: 26px; flex: none; border-radius: 8px; display: grid; place-items: center;
  font-size: 12px; font-weight: 700; background: var(--accent-soft); color: var(--accent);
}
html[data-theme="light"] .top-rank { color: #0a7a5e; }
.top-item .ti-name { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top-item .ti-n { font-size: 13px; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* ---------- vacío / skeleton ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--text-2); }
.empty .e-icon { width: 64px; height: 64px; margin: 0 auto 18px; border-radius: 20px; display: grid; place-items: center; background: var(--accent-soft); }
.empty .e-icon svg { width: 30px; height: 30px; fill: var(--accent); }
.empty h3 { color: var(--text); margin: 0 0 6px; font-size: 17px; }
.empty p { margin: 0 0 18px; font-size: 14px; }

.skeleton { border-radius: var(--radius); background: var(--glass); border: 1px solid var(--border); position: relative; overflow: hidden; }
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.06) 50%, transparent 70%);
  animation: shimmer 1.4s infinite;
}
html[data-theme="light"] .skeleton::after { background: linear-gradient(100deg, transparent 30%, rgba(255,255,255,.7) 50%, transparent 70%); }
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }
.sk-row { display: grid; gap: 14px; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%; flex: none;
  border: 2.5px solid var(--accent-soft); border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}

/* ---------- dropzone ---------- */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  padding: 44px 24px; text-align: center; cursor: pointer;
  transition: all var(--speed); background: var(--glass);
  backdrop-filter: blur(14px); margin-bottom: 20px;
}
.dropzone:hover, .dropzone.drag { border-color: var(--accent); background: var(--accent-soft); }
.dropzone .dz-icon {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 18px;
  display: grid; place-items: center; background: var(--accent-soft);
  transition: transform var(--speed);
}
.dropzone.drag .dz-icon { transform: scale(1.12); }
.dropzone .dz-icon svg { width: 26px; height: 26px; fill: var(--accent); }
.dropzone p { margin: 0; font-size: 15px; font-weight: 600; }
.dropzone small { color: var(--text-2); display: block; margin-top: 6px; font-size: 12.5px; }

.upload-progress { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.up-item { display: flex; align-items: center; gap: 12px; padding: 12px 16px; font-size: 13px; }
.up-item .up-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.up-bar { flex: 2; height: 5px; border-radius: 4px; background: var(--glass); border: 1px solid var(--border); overflow: hidden; }
.up-bar span { display: block; height: 100%; background: var(--accent); border-radius: 4px; transition: width .2s; box-shadow: 0 0 8px rgba(29,233,182,.6); }

/* ---------- carpetas ---------- */
.folder-bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
.folder-chip {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px; border-radius: 12px; cursor: pointer;
  font: inherit; font-size: 13px; font-weight: 600;
  background: var(--glass); border: 1px solid var(--border); color: var(--text-2);
  transition: all var(--speed); backdrop-filter: blur(8px);
}
.folder-chip svg { width: 15px; height: 15px; fill: currentColor; flex: none; }
.folder-chip:hover { color: var(--text); border-color: var(--border-strong); }
.folder-chip.active { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }
html[data-theme="light"] .folder-chip.active { color: #0a7a5e; }
.folder-chip .fc-n {
  font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 8px;
  background: var(--glass); border: 1px solid var(--border); color: var(--text-3);
  font-variant-numeric: tabular-nums;
}
.folder-chip.active .fc-n { color: inherit; border-color: var(--accent-border); }
.folder-chip .fc-x {
  display: none; width: 16px; height: 16px; border-radius: 50%; border: 0; padding: 0;
  background: var(--glass); color: var(--text-3); cursor: pointer; place-items: center; font-size: 11px; line-height: 1;
}
.folder-chip:hover .fc-x { display: grid; }
.folder-chip .fc-x:hover { color: var(--danger); background: var(--danger-soft); }
.folder-chip.new { border-style: dashed; color: var(--text-3); }
.folder-chip.new:hover { color: var(--accent); border-color: var(--accent-border); }
.file-folder-badge {
  font-size: 10.5px; font-weight: 650; color: var(--text-3);
  display: inline-flex; align-items: center; gap: 4px;
}
.file-folder-badge svg { width: 11px; height: 11px; fill: currentColor; }

/* ---------- lista de archivos ---------- */
.files-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.file-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; transition: transform var(--speed), border-color var(--speed); }
.file-card:hover { transform: translateY(-2px); border-color: var(--accent-border); }
.file-thumb {
  height: 120px; display: grid; place-items: center; position: relative;
  background: linear-gradient(160deg, var(--accent-soft), transparent 70%);
  border-bottom: 1px solid var(--border);
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.file-thumb .f-ext {
  font-size: 13px; font-weight: 700; letter-spacing: .08em; color: var(--accent);
  border: 1.5px solid var(--accent-border); border-radius: 10px; padding: 8px 14px;
  background: var(--glass-strong);
  text-transform: uppercase;
}
html[data-theme="light"] .file-thumb .f-ext { color: #0a7a5e; }
.file-body { padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.file-name { font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-meta { font-size: 12px; color: var(--text-3); display: flex; gap: 10px; }
.file-actions { display: flex; gap: 6px; margin-top: auto; }
.file-actions .btn { flex: 1; justify-content: center; }

.searchbar { position: relative; }
.searchbar input { padding-left: 38px; }
.searchbar svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; fill: var(--text-3); pointer-events: none; }

/* ---------- QRs ---------- */
.qrs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.qr-card { display: flex; gap: 16px; padding: 18px; transition: transform var(--speed), border-color var(--speed); cursor: pointer; }
.qr-card:hover { transform: translateY(-2px); border-color: var(--accent-border); }
.qr-thumb {
  width: 88px; height: 88px; flex: none; border-radius: 12px; overflow: hidden;
  border: 1px solid var(--border); background: #fff;
}
.qr-thumb img { width: 100%; height: 100%; display: block; }
.qr-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.qr-name { font-size: 14.5px; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qr-target { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); }
.qr-badges { display: flex; gap: 6px; flex-wrap: wrap; }
.badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 6px; background: var(--glass); border: 1px solid var(--border);
  color: var(--text-2);
}
.badge.dyn { background: var(--accent-soft); border-color: var(--accent-border); color: var(--accent); }
html[data-theme="light"] .badge.dyn { color: #0a7a5e; }
.qr-scans { margin-top: auto; font-size: 12.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.qr-scans b { color: var(--text); font-variant-numeric: tabular-nums; }

/* ---------- detalle QR ---------- */
.qr-detail { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .qr-detail { grid-template-columns: 1fr; } }
.qr-hero { text-align: center; }
.qr-hero .qr-big { width: 220px; height: 220px; border-radius: 16px; border: 1px solid var(--border); background: #fff; margin: 8px auto 16px; display: block; }
.qr-hero .scan-link {
  font-family: var(--mono); font-size: 12px; color: var(--text-2);
  background: var(--glass); border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 12px; display: block; word-break: break-all; white-space: normal;
  margin-bottom: 14px; cursor: pointer; transition: border-color var(--speed);
}
.qr-hero .scan-link:hover { border-color: var(--accent-border); color: var(--text); }
.dl-row { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.short-url-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.short-url-label { font-size: 10.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); white-space: nowrap; flex-shrink: 0; }
html[data-theme="light"] .short-url-label { color: #0a7a5e; }
.short-url-chip {
  flex: 1; min-width: 0; font-family: var(--mono); font-size: 11.5px;
  background: var(--accent-soft); border: 1px solid var(--accent-border); border-radius: 8px;
  color: var(--accent); padding: 6px 10px; cursor: pointer; text-align: left;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  transition: border-color var(--speed), box-shadow var(--speed);
}
html[data-theme="light"] .short-url-chip { color: #0a7a5e; }
.short-url-chip:hover { box-shadow: 0 0 0 3px var(--accent-soft); border-color: var(--accent); }
.scan-compat-note {
  display: flex; align-items: flex-start; gap: 7px;
  font-size: 11.5px; color: var(--text-3); line-height: 1.5;
  background: var(--glass); border: 1px solid var(--border); border-radius: 9px;
  padding: 8px 10px; margin-bottom: 14px; text-align: left;
}
.scan-compat-note svg { width: 14px; height: 14px; fill: var(--text-3); flex-shrink: 0; margin-top: 1px; }

.device-list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.device-row { display: grid; grid-template-columns: 90px 1fr 44px; align-items: center; gap: 12px; font-size: 13px; }
.device-row .d-name { color: var(--text-2); text-transform: capitalize; }
.device-row .d-bar { height: 8px; border-radius: 5px; background: var(--glass); border: 1px solid var(--border); overflow: hidden; }
.device-row .d-bar span { display: block; height: 100%; background: var(--viz-series); border-radius: 5px; }
.device-row .d-n { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; }

/* ---------- formularios ---------- */
.field { margin-bottom: 18px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 7px; }
.field .f-help { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.field .f-name-warn { font-size: 12px; color: #e8a13c; margin-top: 6px; }
input[type="text"], input[type="url"], input[type="search"], textarea, select {
  width: 100%; padding: 11px 14px; font: inherit; font-size: 14px;
  background: var(--glass); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  outline: none; transition: border-color var(--speed), box-shadow var(--speed);
  backdrop-filter: blur(8px);
}
textarea { resize: vertical; min-height: 90px; }
input:focus, textarea:focus, select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
input::placeholder, textarea::placeholder { color: var(--text-3); }

.type-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.type-seg button {
  padding: 12px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--glass); color: var(--text-2); font: inherit; font-size: 13px; font-weight: 600;
  cursor: pointer; transition: all var(--speed); display: flex; flex-direction: column; gap: 6px; align-items: center;
}
.type-seg button svg { width: 20px; height: 20px; fill: currentColor; }
.type-seg button:hover { color: var(--text); }
.type-seg button.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
html[data-theme="light"] .type-seg button.active { color: #0a7a5e; }

.mode-switch { display: flex; gap: 8px; }
.mode-switch .mode-opt {
  flex: 1; padding: 12px 14px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--border-strong); background: var(--glass); transition: all var(--speed);
}
.mode-switch .mode-opt.active { border-color: var(--accent); background: var(--accent-soft); }
.mode-opt .m-title { font-size: 13.5px; font-weight: 650; display: flex; align-items: center; gap: 7px; }
.mode-opt .m-title .m-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); }
.mode-opt.active .m-title .m-dot { background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.mode-opt .m-desc { font-size: 11.5px; color: var(--text-3); margin-top: 4px; line-height: 1.45; }

/* selector de color: presets + personalizado */
.swatch-group { margin-bottom: 12px; }
.swatch-group .sg-label {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; font-weight: 600; color: var(--text-2); margin-bottom: 8px;
}
.swatch-group .sg-hex { font-family: var(--mono); font-size: 11px; color: var(--text-3); text-transform: uppercase; }
.swatch-row { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch {
  width: 30px; height: 30px; border-radius: 50%; cursor: pointer; padding: 0;
  border: 1px solid var(--border-strong); position: relative;
  transition: transform var(--speed), box-shadow var(--speed);
}
.swatch:hover { transform: scale(1.12); }
.swatch.active {
  box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
  transform: scale(1.08);
}
.swatch.custom {
  background: conic-gradient(#ff5f5f, #ffc44d, #57e690, #4dc4ff, #b18cff, #ff5f5f);
  display: grid; place-items: center; overflow: hidden;
}
.swatch.custom::after {
  content: "+"; color: #fff; font-weight: 700; font-size: 15px; line-height: 1;
  text-shadow: 0 1px 3px rgba(0,0,0,.5); pointer-events: none;
}
.swatch.custom.active::after { content: ""; }
.swatch.custom input[type="color"] {
  position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%;
}
.contrast-note { font-size: 11.5px; color: var(--text-3); margin-top: 4px; line-height: 1.5; }
.contrast-note.warn { color: #e8a13c; }

/* ---------- modal ---------- */
.modal-back {
  position: fixed; inset: 0; z-index: 50; display: flex; padding: 20px;
  background: rgba(5, 10, 14, .55); backdrop-filter: blur(6px);
  animation: fadeIn .18s ease-out;
  overflow-y: auto;
}
.modal {
  width: 100%; max-width: 560px; border-radius: 22px; padding: 24px 26px 20px;
  background: var(--glass-strong);
  backdrop-filter: blur(28px) saturate(1.5);
  border: 1px solid var(--border-strong);
  box-shadow: 0 30px 80px rgba(0,0,0,.5);
  animation: popIn .22s cubic-bezier(.3, 1.4, .5, 1);
  /* margin auto + flex: centrado cuando cabe, scroll del fondo cuando no */
  margin: auto;
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  overscroll-behavior: contain;
}
.modal.wide { max-width: 720px; }
.modal.preview { max-width: min(1040px, 94vw); }

/* ---------- vista previa de archivos ---------- */
.preview-body {
  display: flex; overflow: auto; max-height: 70vh; min-height: 120px;
  border-radius: 14px; border: 1px solid var(--border);
  background: rgba(0, 0, 0, 0.25);
}
html[data-theme="light"] .preview-body { background: rgba(10, 30, 28, 0.06); }
.preview-body > * { margin: auto; }
.preview-body img { display: block; }
.preview-body img.fit { max-width: 100%; max-height: 68vh; }
.preview-body img.real { max-width: none; max-height: none; }
.preview-body iframe { width: 100%; height: 70vh; border: 0; display: block; margin: 0; }
.preview-body video { max-width: 100%; max-height: 68vh; display: block; outline: none; }
.preview-body audio { width: min(480px, 90%); margin: 40px auto; }
.preview-body pre {
  margin: 0; padding: 18px 20px; width: 100%; box-sizing: border-box;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.6; color: var(--text-2);
  white-space: pre-wrap; word-break: break-word;
}
.preview-empty { text-align: center; padding: 48px 20px; color: var(--text-2); font-size: 14px; }
.preview-meta {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  font-size: 12px; color: var(--text-3); margin-top: 12px;
  font-variant-numeric: tabular-nums;
}
.preview-meta .pm-sep { opacity: .5; }
.preview-url-edit { margin-top: 16px; }
.preview-url-edit label { display: block; font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.url-edit-row { display: flex; align-items: center; gap: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.url-prefix { padding: 0 8px 0 12px; font-size: 13px; color: var(--text-3); white-space: nowrap; font-family: var(--mono, monospace); flex-shrink: 0; }
.url-edit-row input { flex: 1; min-width: 0; background: transparent; border: none; outline: none; font-size: 13px; font-family: var(--mono, monospace); color: var(--text); padding: 8px 6px; }
.url-edit-row .btn { border-radius: 0 9px 9px 0; flex-shrink: 0; margin: 0; border: none; border-left: 1px solid var(--border); }
.url-edit-msg { font-size: 12px; margin-top: 5px; min-height: 16px; }
.url-edit-msg.err { color: #f87171; }
.url-edit-msg.ok  { color: var(--accent); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-head h2 { margin: 0; font-size: 18px; }
.modal-close { background: none; border: 0; color: var(--text-2); cursor: pointer; padding: 6px; border-radius: 8px; display: grid; place-items: center; }
.modal-close:hover { color: var(--text); background: var(--glass); }
.modal-close svg { width: 18px; height: 18px; fill: currentColor; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: scale(.94) translateY(10px); } }

.qr-form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 22px; }
@media (max-width: 640px) { .qr-form-grid { grid-template-columns: 1fr; } }
.qr-preview { text-align: center; }
.qr-preview .qp-frame {
  width: 170px; height: 170px; margin: 0 auto 10px; border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border-strong); background: #fff; display: grid; place-items: center;
}
.qr-preview img { width: 100%; height: 100%; display: block; }
.qr-preview .qp-label { font-size: 11.5px; color: var(--text-3); }

/* ---------- toasts ---------- */
.toasts { position: fixed; bottom: 22px; right: 22px; z-index: 90; display: flex; flex-direction: column; gap: 10px; }
.toast {
  display: flex; align-items: center; gap: 11px; min-width: 240px; max-width: 380px;
  padding: 13px 16px; border-radius: 14px; font-size: 13.5px; font-weight: 550;
  background: var(--glass-strong); border: 1px solid var(--border-strong);
  backdrop-filter: blur(20px); box-shadow: var(--shadow);
  animation: toastIn .28s cubic-bezier(.3, 1.3, .5, 1);
}
.toast.out { animation: toastOut .25s forwards; }
.toast .t-ico { width: 22px; height: 22px; border-radius: 50%; flex: none; display: grid; place-items: center; }
.toast.ok .t-ico { background: var(--accent-soft); }
.toast.err .t-ico { background: var(--danger-soft); }
.toast .t-ico svg { width: 12px; height: 12px; }
.toast.ok .t-ico svg { fill: var(--accent); }
.toast.err .t-ico svg { fill: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .sidebar {
    position: sticky; top: 0; z-index: 20; width: auto; min-height: 0;
    margin: 10px; padding: 10px 12px;
    flex-direction: row; align-items: center; gap: 12px;
  }
  .brand-name { display: none; }
  .nav { flex-direction: row; }
  .nav-item span { display: none; }
  .sidebar-foot { border: 0; padding: 0; margin-left: auto; }
  .tt-label { display: none; }
  .main { padding: 18px 16px 50px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
