/* DriveToMega - estilo Material 3 (base: panel.css de Radio PWA) */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --primary: #3F51B5;
  --on-primary: #fff;
  --primary-c: #DEE0FF;
  --on-primary-c: #00105C;
  --sec-c: #E2E1EC;
  --surface: #FBF8FF;
  --surface-1: #F5F2FA;
  --surface-2: #EFEDF4;
  --surface-3: #E9E7EF;
  --card: #FFFFFF;
  --on-surface: #1B1B21;
  --on-surface-v: #46464F;
  --outline: #767680;
  --outline-v: #C6C5D0;
  --error: #BA1A1A;
  --error-c: #FFDAD6;
  --ok: #1B6C3A;
  --ok-c: #C9F0D2;
  --warn-c: #FFE08A;
  --shadow-1: 0 1px 2px rgba(0,0,0,.18), 0 1px 3px 1px rgba(0,0,0,.08);
  --shadow-2: 0 2px 6px 2px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.2);
  --ease: cubic-bezier(.2,0,0,1);
}
html, body { margin: 0; }
body { font-family: Roboto, "Segoe UI", system-ui, sans-serif; font-size: 14px; color: var(--on-surface); background: var(--surface); -webkit-font-smoothing: antialiased; }
a { color: var(--primary); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1 { font-size: 28px; line-height: 36px; font-weight: 400; margin: 0; }
h2 { font-size: 20px; line-height: 28px; font-weight: 500; margin: 0 0 4px; }
h3 { font-size: 16px; font-weight: 500; margin: 0 0 4px; }
.muted { color: var(--on-surface-v); }
.small { font-size: 12px; }

.ms { font-family: "Material Symbols Rounded"; font-weight: normal; font-style: normal; font-size: 22px; line-height: 1; display: inline-block; white-space: nowrap; direction: ltr; font-feature-settings: "liga"; font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24; width: 1em; overflow: hidden; flex: none; vertical-align: middle; }
.ms.fill { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }

/* Barra superior */
.bar { position: sticky; top: 0; z-index: 50; display: flex; align-items: center; gap: 16px; height: 64px; padding: 0 16px; background: var(--surface-2); }
.brand { display: flex; align-items: center; gap: 10px; font-size: 18px; font-weight: 500; color: var(--on-surface); }
.brand .ms { color: var(--primary); font-size: 28px; }
.nav { display: flex; gap: 4px; flex: 1; justify-content: center; }
.nav a { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 20px; color: var(--on-surface-v); font-weight: 500; }
.nav a:hover { background: rgba(0,0,0,.05); }
.nav a.on { background: var(--sec-c); color: var(--on-surface); }
.who { display: flex; align-items: center; gap: 10px; }
.who-name { display: flex; flex-direction: column; line-height: 16px; font-weight: 500; }
.who-name small { font-weight: 400; color: var(--on-surface-v); }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--primary); color: var(--on-primary); font-weight: 500; }
@media (max-width: 760px) {
  .bar { gap: 8px; padding: 0 8px; }
  .brand span:last-child, .who-name, .nav .t { display: none; }
  .nav { justify-content: flex-start; }
  .nav a { padding: 0 12px; }
}

/* Estructura */
.wrap { max-width: 1120px; margin: 0 auto; padding: 24px 16px 64px; }
.page-head { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head .grow { flex: 1; min-width: 200px; }
.card { background: var(--card); border-radius: 16px; box-shadow: var(--shadow-1); padding: 20px; }
.card + .card { margin-top: 16px; }
.grid > .card + .card { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid.apps { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 24px; border-radius: 20px; border: 0; font-weight: 500; letter-spacing: .1px; white-space: nowrap; text-decoration: none; transition: box-shadow .2s, background-color .2s; }
.btn .ms { font-size: 18px; margin-left: -6px; }
.btn.filled { background: var(--primary); color: var(--on-primary); }
.btn.filled:hover { box-shadow: var(--shadow-1); }
.btn.tonal { background: var(--sec-c); color: var(--on-surface); }
.btn.outlined { background: transparent; border: 1px solid var(--outline); color: var(--primary); }
.btn.text { background: transparent; color: var(--primary); padding: 0 12px; }
.btn.text:hover, .btn.outlined:hover, .btn.tonal:hover { background-color: rgba(63,81,181,.08); }
.btn.danger { color: var(--error); border-color: var(--error); }
.btn.danger.filled { background: var(--error); color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; color: var(--on-surface-v); flex: none; }
.icon-btn:hover { background: rgba(0,0,0,.06); }
.icon-btn.danger { color: var(--error); }
.icon-btn:disabled { opacity: .35; cursor: default; background: transparent; }

/* Formularios */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field > label, .label { font-size: 12px; font-weight: 500; color: var(--on-surface-v); letter-spacing: .3px; }
.field .hint { font-size: 12px; color: var(--on-surface-v); }
.input, select.input, textarea.input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--card);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
textarea.input { height: auto; min-height: 88px; padding: 12px 14px; resize: vertical; line-height: 20px; }
.input:focus { border-color: var(--primary); box-shadow: inset 0 0 0 1px var(--primary); }
.input.bad { border-color: var(--error); box-shadow: inset 0 0 0 1px var(--error); }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 16px; }
.input-group { display: flex; gap: 8px; align-items: center; }
.input-group .input { flex: 1; }
.check { display: flex; align-items: flex-start; gap: 12px; padding: 12px 0; cursor: pointer; }
.check input { display: none; }
.check .sw { position: relative; flex: none; width: 52px; height: 32px; border-radius: 16px; border: 2px solid var(--outline); background: var(--surface-3); transition: all .2s; margin-top: 2px; }
.check .sw::after { content: ""; position: absolute; top: 6px; left: 6px; width: 16px; height: 16px; border-radius: 50%; background: var(--outline); transition: all .25s var(--ease); }
.check input:checked + .sw { background: var(--primary); border-color: var(--primary); }
.check input:checked + .sw::after { left: 22px; top: 2px; width: 24px; height: 24px; background: #fff; }
.check b { display: block; font-weight: 500; font-size: 15px; }
.check span.d { color: var(--on-surface-v); font-size: 13px; }

/* Chips y estados */
.chip { display: inline-flex; align-items: center; gap: 4px; height: 24px; padding: 0 10px; border-radius: 8px; font-size: 12px; font-weight: 500; background: var(--surface-3); color: var(--on-surface-v); white-space: nowrap; }
.chip.ok { background: var(--ok-c); color: var(--ok); }
.chip.off { background: var(--error-c); color: var(--error); }
.chip .ms { font-size: 16px; }

/* Tarjetas de apps */
.app-card { display: flex; flex-direction: column; gap: 14px; padding: 0; overflow: hidden; }
.app-card .top { display: flex; gap: 14px; align-items: center; padding: 20px 20px 0; }
.app-card .logo { width: 64px; height: 64px; border-radius: 16px; object-fit: contain; background: var(--surface-2); flex: none; }
.app-card .info { min-width: 0; flex: 1; }
.app-card .info h2 { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin: 0; }
.app-card .meta { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px; }
.app-card .actions { display: flex; align-items: center; gap: 4px; padding: 8px 12px 12px; border-top: 1px solid var(--surface-3); }
.app-card .actions .grow { flex: 1; }
.app-card .stripe { height: 6px; }

/* Tablas */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 500; color: var(--on-surface-v); padding: 10px 12px; border-bottom: 1px solid var(--outline-v); }
.table td { padding: 12px; border-bottom: 1px solid var(--surface-3); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }

/* Mensajes */
.toast { position: fixed; left: 50%; bottom: 24px; z-index: 200; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; max-width: calc(100% - 32px); padding: 14px 20px; border-radius: 8px; background: #303036; color: #F2F0F7; box-shadow: var(--shadow-2); transition: opacity .3s, transform .3s; }
.toast.err .ms { color: #FFB4AB; }
.toast.ok .ms { color: #8CD6A0; }
.toast.hide { opacity: 0; transform: translate(-50%, 20px); pointer-events: none; }
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; margin-bottom: 16px; background: var(--error-c); color: #410002; }
.alert.info { background: var(--primary-c); color: var(--on-primary-c); }
.alert.ok { background: var(--ok-c); color: #00210C; }
.alert ul { margin: 4px 0 0; padding-left: 18px; }
.secret { font-family: Consolas, monospace; font-size: 15px; background: var(--surface-2); padding: 2px 8px; border-radius: 6px; user-select: all; }

/* Login / instalación */
.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: radial-gradient(circle at 20% 10%, #E6E8FF, transparent 50%), radial-gradient(circle at 90% 90%, #FFE1EC, transparent 45%), var(--surface); }
.auth .card { width: 100%; max-width: 420px; padding: 32px 28px; }
.auth .card.wide { max-width: 640px; }
.auth .logo { display: flex; align-items: center; gap: 10px; margin-bottom: 24px; font-size: 20px; font-weight: 500; }
.auth .logo .ms { font-size: 36px; color: var(--primary); }

/* Diálogo */
dialog { border: 0; border-radius: 28px; padding: 24px; max-width: min(560px, calc(100% - 32px)); width: 100%; background: var(--surface-1); color: var(--on-surface); box-shadow: var(--shadow-2); }
dialog::backdrop { background: rgba(0,0,0,.4); }
dialog h2 { margin-bottom: 12px; }
dialog .dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }

.empty-state { text-align: center; padding: 56px 16px; color: var(--on-surface-v); }
.empty-state .ms { font-size: 56px; width: auto; opacity: .45; display: block; margin: 0 auto 12px; }

/* Recuadro fijo con credenciales recién creadas */
.cred { position: sticky; top: 64px; z-index: 40; display: flex; align-items: center; gap: 14px; max-width: 1120px; margin: 16px auto 0; padding: 16px 16px 16px 20px; border-radius: 16px; background: var(--warn-c); color: #241A00; box-shadow: var(--shadow-2); }
.cred > .ms { font-size: 28px; }
.cred .grow { flex: 1; min-width: 0; }
.cred .secret { display: inline-block; margin: 6px 0; background: rgba(255,255,255,.6); white-space: normal; word-break: break-word; }
.cred small { display: block; }
@media (max-width: 760px) { .cred { margin: 12px; flex-wrap: wrap; } }

/* Campo de contraseña con botón para mostrarla (ojito) */
.pw-field { position: relative; }
.pw-field .input { padding-right: 52px; }
.pw-toggle { position: absolute; top: 4px; right: 4px; }
.pw-field .input::-ms-reveal { display: none; }

/* ==========================================================================
   DriveToMega — componentes propios
   ========================================================================== */
:root { --warn: #7A5900; }
body { min-height: 100vh; }
.nav { overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { flex: none; }
@media (max-width: 1240px) { .bar.admin .nav .t { display: none; } .bar.admin .nav a { padding: 0 12px; } }
.badge-dot { position: relative; }
.badge-dot::after { content: attr(data-n); position: absolute; top: 2px; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--error); color: #fff; font-size: 10px; line-height: 16px; text-align: center; font-family: Roboto, sans-serif; }
.wrap.wide { max-width: 1320px; }
.page-head h1 .ms { font-size: 30px; color: var(--primary); margin-right: 6px; }
.sub { margin: 4px 0 0; color: var(--on-surface-v); }

/* Chips extra */
.chip.warn { background: var(--warn-c); color: #3D2E00; }
.chip.info { background: var(--primary-c); color: var(--on-primary-c); }
.chip.new { background: var(--primary); color: #fff; }

/* Métricas */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 16px; margin-bottom: 16px; }
.stats > .card + .card { margin-top: 0; }
.stat { display: flex; flex-direction: column; gap: 6px; }
.stat .k { display: flex; align-items: center; gap: 8px; color: var(--on-surface-v); font-weight: 500; font-size: 13px; }
.stat .k .ms { color: var(--primary); font-size: 20px; }
.stat .v { font-size: 28px; line-height: 34px; }
.stat .d { font-size: 12px; color: var(--on-surface-v); }
.meter { height: 8px; border-radius: 4px; background: var(--surface-3); overflow: hidden; }
.meter > i { display: block; height: 100%; border-radius: 4px; background: var(--primary); transition: width .4s var(--ease); }
.meter.warn > i { background: #C98A00; }
.meter.bad > i { background: var(--error); }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.card-head h2 { flex: 1; margin: 0; display: flex; align-items: center; gap: 8px; }
.card-head h2 .ms { color: var(--primary); }

/* Listas simples */
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--surface-3); min-width: 0; }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.list .t1 { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .t2 { font-size: 12px; color: var(--on-surface-v); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .ico { width: 40px; height: 40px; border-radius: 12px; background: var(--surface-2); display: inline-flex; align-items: center; justify-content: center; color: var(--primary); flex: none; }
.list .ico.err { background: var(--error-c); color: var(--error); }
.list .ico.warn { background: var(--warn-c); color: var(--warn); }

/* Barra de herramientas y migas */
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.toolbar .grow { flex: 1; }
.search { position: relative; min-width: 200px; flex: 1; max-width: 380px; }
.search > .ms { position: absolute; left: 12px; top: 11px; color: var(--on-surface-v); }
.search .input { padding-left: 42px; height: 44px; border-radius: 22px; background: var(--surface-1); border-color: transparent; }
.search .input:focus { background: var(--card); }
.crumbs { display: flex; align-items: center; gap: 2px; flex-wrap: wrap; min-height: 40px; margin-bottom: 8px; }
.crumbs a, .crumbs span.cur { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 18px; color: var(--on-surface-v); font-weight: 500; }
.crumbs a:hover { background: rgba(0,0,0,.05); }
.crumbs a.drop { background: var(--primary-c); color: var(--on-primary-c); }
.crumbs span.cur { color: var(--on-surface); }
.crumbs .sep { color: var(--outline); font-size: 18px; }

/* Explorador */
.files { padding: 4px 0; overflow: hidden; }
.frow { display: grid; grid-template-columns: 40px 44px minmax(0, 1fr) 110px 150px 130px 48px; align-items: center; gap: 4px; min-height: 56px; padding: 0 8px; border-bottom: 1px solid var(--surface-3); user-select: none; }
.frow:last-child { border-bottom: 0; }
.frow:hover { background: var(--surface-1); }
.frow.sel { background: var(--primary-c); }
.frow.drop { background: var(--primary-c); box-shadow: inset 0 0 0 2px var(--primary); }
.frow.dragging { opacity: .4; }
.frow.head { min-height: 40px; font-size: 12px; font-weight: 500; color: var(--on-surface-v); }
.frow.head:hover { background: none; }
.frow .fi { width: 40px; height: 40px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--primary); }
.frow .fi.folder { background: var(--primary-c); color: var(--on-primary-c); }
.frow .fn { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.frow .fn a, .frow .fn b { font-weight: 500; color: var(--on-surface); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frow .fn a:hover { color: var(--primary); }
.frow .fn small { font-size: 12px; color: var(--on-surface-v); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frow .c { font-size: 13px; color: var(--on-surface-v); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cbx { width: 20px; height: 20px; accent-color: var(--primary); cursor: pointer; margin: 0 auto; display: block; }
.selbar { position: sticky; top: 72px; z-index: 30; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; padding: 6px 8px 6px 20px; margin-bottom: 12px; border-radius: 28px; background: var(--primary-c); color: var(--on-primary-c); box-shadow: var(--shadow-1); }
.selbar b { flex: 1; }
@media (max-width: 860px) {
  .frow { grid-template-columns: 32px 44px minmax(0, 1fr) 44px; }
  .frow .c { display: none; }
  .frow.head { display: none; }
}

/* Menú contextual */
.menu { position: fixed; z-index: 300; min-width: 210px; padding: 8px 0; border-radius: 16px; background: var(--surface-2); box-shadow: var(--shadow-2); }
.menu button, .menu a { display: flex; align-items: center; gap: 12px; width: 100%; height: 44px; padding: 0 16px; border: 0; background: none; color: var(--on-surface); text-align: left; font-size: 14px; }
.menu button:hover, .menu a:hover { background: rgba(0,0,0,.06); }
.menu .ms { color: var(--on-surface-v); font-size: 20px; }
.menu .danger, .menu .danger .ms { color: var(--error); }
.menu hr { border: 0; border-top: 1px solid var(--outline-v); margin: 6px 0; }

/* Selector de carpetas (mover) */
.picker { max-height: 360px; overflow: auto; border: 1px solid var(--outline-v); border-radius: 12px; background: var(--card); }
.picker button { display: flex; align-items: center; gap: 8px; width: 100%; min-height: 40px; padding: 0 12px; border: 0; background: none; text-align: left; }
.picker button:hover { background: var(--surface-1); }
.picker button.on { background: var(--primary-c); color: var(--on-primary-c); font-weight: 500; }
.picker button:disabled { opacity: .4; cursor: default; background: none; }
.picker .ms { color: var(--primary); font-size: 20px; }

/* Vista previa */
dialog.preview { max-width: min(960px, calc(100% - 24px)); padding: 16px; }
dialog.preview .pv-head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
dialog.preview .pv-head h2 { flex: 1; min-width: 0; margin: 0; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
dialog.preview .pv-body { display: flex; justify-content: center; align-items: center; min-height: 120px; border-radius: 16px; background: var(--surface-2); overflow: hidden; }
dialog.preview iframe { width: 100%; height: min(75vh, 900px); border: 0; background: #fff; }
dialog.preview video, dialog.preview img { max-width: 100%; max-height: 75vh; display: block; }
dialog.preview audio { width: 100%; margin: 24px; }

/* Pestañas verticales (editores) */
.ed-body { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 24px; align-items: start; }
.vtabs { position: sticky; top: 140px; display: flex; flex-direction: column; gap: 2px; }
.vtabs a { display: flex; align-items: center; gap: 12px; height: 52px; padding: 0 16px; border-radius: 26px; color: var(--on-surface-v); font-weight: 500; }
.vtabs a:hover { background: rgba(0,0,0,.05); }
.vtabs a.on { background: var(--sec-c); color: var(--on-surface); }
.vtabs .cnt { margin-left: auto; font-size: 12px; min-width: 22px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--error); color: #fff; display: inline-flex; align-items: center; justify-content: center; }
.save-head { position: sticky; top: 64px; z-index: 30; display: flex; align-items: center; gap: 8px; padding: 12px 0; margin-bottom: 8px; background: var(--surface); }
.save-head .grow { flex: 1; min-width: 0; }
.save-head h1 { font-size: 24px; line-height: 32px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 860px) {
  .ed-body { grid-template-columns: 1fr; gap: 12px; }
  .vtabs { position: sticky; top: 124px; z-index: 20; flex-direction: row; overflow-x: auto; background: var(--surface); padding-bottom: 6px; scrollbar-width: none; }
  .vtabs a { height: 40px; padding: 0 14px; flex: none; }
  .hide-sm { display: none !important; }
}

/* Chips seleccionables (tipos de archivo) */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.fchip { position: relative; }
.fchip input { position: absolute; opacity: 0; pointer-events: none; }
.fchip span { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 14px; border: 1px solid var(--outline); border-radius: 8px; font-weight: 500; font-size: 13px; color: var(--on-surface-v); cursor: pointer; user-select: none; }
.fchip input:checked + span { background: var(--sec-c); border-color: transparent; color: var(--on-surface); }
.fchip input:checked + span::before { content: "check"; font-family: "Material Symbols Rounded"; font-size: 18px; margin-left: -4px; }
.fchip input:focus-visible + span { box-shadow: 0 0 0 2px var(--primary); }
.type-group { margin-bottom: 14px; }
.type-group .label { display: block; margin-bottom: 8px; }

/* Segmentado (sin acceso / ver / descargar) */
.seg { display: inline-flex; border: 1px solid var(--outline); border-radius: 18px; overflow: hidden; flex: none; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label > span { display: inline-flex; align-items: center; gap: 4px; height: 34px; padding: 0 12px; font-size: 13px; font-weight: 500; cursor: pointer; border-left: 1px solid var(--outline); color: var(--on-surface-v); white-space: nowrap; }
.seg label:first-child > span { border-left: 0; }
.seg input:checked + span { background: var(--sec-c); color: var(--on-surface); }
.seg label:first-child input:checked + span { background: var(--surface-2); }
.perm-row[data-inh=view] .seg label:nth-child(2) > span, .perm-row[data-inh=download] .seg label:nth-child(3) > span { background: rgba(63,81,181,.07); color: var(--on-surface); }
.seg .ms { font-size: 18px; width: auto; }
.seg input:checked + span .ms { font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24; }
.seg input:focus-visible + span { box-shadow: inset 0 0 0 2px var(--primary); }
.perm-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--surface-3); }
.perm-row .grow { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; }
.perm-row .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perm-row .ms.f { color: var(--primary); }
.perm-row .inh { font-size: 12px; color: var(--on-surface-v); white-space: nowrap; }
@media (max-width: 600px) { .perm-row { flex-wrap: wrap; } .seg span .t { display: none; } .perm-row .inh { display: none; } }

/* Paginación */
.pager { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 16px; }

/* Invitado */
.g-list .frow { grid-template-columns: 44px minmax(0, 1fr) 100px 120px auto; cursor: pointer; }
.g-list .frow .acts { display: flex; gap: 2px; justify-content: flex-end; }
@media (max-width: 760px) { .g-list .frow { grid-template-columns: 44px minmax(0, 1fr) auto; } }
.g-roots { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.g-roots > .card + .card { margin-top: 0; }
.g-root { display: flex; align-items: center; gap: 14px; padding: 18px; color: var(--on-surface); transition: box-shadow .2s; min-width: 0; }
.g-root:hover { box-shadow: var(--shadow-2); }
.g-root .fi { width: 48px; height: 48px; border-radius: 14px; background: var(--primary-c); color: var(--on-primary-c); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.g-root .fi .ms { font-size: 26px; }
.g-root div { min-width: 0; }
.g-root b { display: block; font-weight: 500; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-root small { color: var(--on-surface-v); }

/* Reproductor fijo abajo */
.player { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 150; display: flex; align-items: center; gap: 4px; width: min(760px, calc(100% - 24px)); padding: 8px 12px 8px 20px; border-radius: 28px; background: var(--surface-3); box-shadow: var(--shadow-2); }
.player .grow { flex: 1; min-width: 0; }
.player .pt { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player audio { width: 100%; height: 36px; display: block; }
body.has-player .wrap { padding-bottom: 130px; }
body.has-player .toast { bottom: 110px; }

/* Varios */
.kv { display: grid; grid-template-columns: 180px 1fr; gap: 8px 16px; margin: 0; }
.kv dt { color: var(--on-surface-v); font-size: 13px; }
.kv dd { margin: 0; min-width: 0; word-break: break-word; }
@media (max-width: 600px) { .kv { grid-template-columns: 1fr; gap: 2px; } .kv dd { margin-bottom: 8px; } }
.mono { font-family: Consolas, monospace; font-size: 13px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.qr { width: 196px; height: 196px; padding: 8px; background: #fff; border-radius: 12px; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; align-items: end; }
.filters .field { margin-bottom: 12px; }
.actions-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.table td .t2 { font-size: 12px; color: var(--on-surface-v); }
.table tr.click { cursor: pointer; }
.table tr.click:hover td { background: var(--surface-1); }
.link-strong { font-weight: 500; color: var(--on-surface); }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Panel de subidas */
.uppanel { position: fixed; right: 16px; bottom: 16px; z-index: 160; width: min(420px, calc(100% - 32px)); border-radius: 16px; background: var(--card); box-shadow: var(--shadow-2); overflow: hidden; }
.uppanel .up-head { display: flex; align-items: center; gap: 4px; padding: 8px 8px 8px 16px; background: var(--surface-2); }
.uppanel .up-head b { flex: 1; }
.uppanel.min .up-list { display: none; }
.uppanel.min #upMin .ms { transform: rotate(180deg); }
.up-list { max-height: 320px; overflow: auto; }
.up-item { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; align-items: center; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--surface-3); }
.up-item:last-child { border-bottom: 0; }
.up-item .nm { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-item .st { grid-column: 1; font-size: 12px; color: var(--on-surface-v); }
.up-item .st.err { color: var(--error); }
.up-item .meter { grid-column: 1; }
.up-item .icon-btn { grid-row: 1 / span 3; grid-column: 2; width: 32px; height: 32px; }
#exList.updrop { box-shadow: inset 0 0 0 2px var(--primary); background: var(--primary-c); }
.chip.up { background: #E3F2E8; color: var(--ok); }
.frow .fn .desc { font-size: 12px; color: var(--on-surface-v); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-style: italic; }
.sha { font-family: Consolas, monospace; font-size: 12px; word-break: break-all; background: var(--surface-2); padding: 4px 8px; border-radius: 6px; display: inline-block; }

/* Gráficos (portado de VeeMedia) */
.chart-box { position: relative; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart .grid { stroke: var(--surface-3); stroke-width: 1; shape-rendering: crispEdges; }
.chart .tick { fill: var(--on-surface-v); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--primary); }
.chart .bar.over { fill: var(--error); }
.chart .ref { stroke: var(--error); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .ref-label { fill: var(--error); font-weight: 500; }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit.on { fill: rgba(63,81,181,.06); }
.chart-tip { position: absolute; z-index: 5; transform: translate(-50%, calc(-100% - 10px)); pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 10px; border-radius: 8px; background: #303036; color: #F2F0F7; font-size: 12px; white-space: nowrap; box-shadow: var(--shadow-2); }
.chart-tip b { font-size: 14px; font-weight: 500; }
