/* otadrive — estilos */
:root {
  --bg: #f6f7f9;
  --panel: #ffffff;
  --side: #eef1f6;
  --ink: #18212f;
  --ink-2: #4a5568;
  --ink-3: #8592a6;
  --line: #e3e7ee;
  --hover: #f0f3f8;
  --sel: #e5edff;
  --accent: #2b59e8;
  --accent-ink: #ffffff;
  --accent-soft: #e5edff;
  --danger: #d63b3b;
  --ok: #1f9d63;
  --warn: #d98a09;
  --shadow: 0 10px 30px rgba(20, 30, 50, .12), 0 2px 6px rgba(20, 30, 50, .06);
  --radius: 10px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #12161d; --panel: #181d26; --side: #141920; --ink: #e8ecf3; --ink-2: #b2bccb; --ink-3: #7c889b;
    --line: #262d39; --hover: #1f2531; --sel: #1d2a4d; --accent: #5b82ff; --accent-soft: #1d2a4d;
    --shadow: 0 10px 30px rgba(0,0,0,.5); color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
.hidden { display: none !important; }
svg.i { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- botones y campos */
.btn { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel); cursor: pointer; font-weight: 500; white-space: nowrap; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.danger { color: var(--danger); }
.btn.danger.solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.icon { width: 36px; padding: 0; justify-content: center; }
.btn:disabled { opacity: .5; cursor: default; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field small { color: var(--ink-3); font-size: 12px; }
.input { height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); outline: none; width: 100%; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; margin-bottom: 12px; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ---------- login */
#login { min-height: 100%; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(1200px 600px at 10% -10%, rgba(43,89,232,.16), transparent 60%), radial-gradient(900px 500px at 110% 110%, rgba(31,157,99,.12), transparent 60%), var(--bg); }
.login-card { width: 100%; max-width: 380px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 36px 32px 28px; box-shadow: var(--shadow); }
.login-card .logo { justify-content: center; margin-bottom: 6px; font-size: 26px; }
.login-card p.sub { text-align: center; color: var(--ink-3); margin: 0 0 26px; }
.login-card .btn { width: 100%; justify-content: center; height: 42px; margin-top: 6px; }
.login-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 4px; }

.logo { display: flex; align-items: center; gap: 10px; font-weight: 750; letter-spacing: -.02em; font-size: 19px; color: var(--ink); }
.logo svg { width: 1.6em; height: 1.6em; }
.logo b { color: var(--accent); font-weight: 750; }

/* ---------- estructura */
#app { display: grid; grid-template-columns: 248px 1fr; grid-template-rows: 60px 1fr; height: 100%; }
header.top { grid-column: 1 / -1; display: flex; align-items: center; gap: 16px; padding: 0 16px 0 20px; background: var(--panel); border-bottom: 1px solid var(--line); }
header.top .logo { width: 212px; }
.search { flex: 1; max-width: 620px; position: relative; }
.search svg { position: absolute; left: 12px; top: 10px; color: var(--ink-3); }
.search input { width: 100%; height: 40px; border-radius: 20px; border: 1px solid transparent; background: var(--bg); padding: 0 16px 0 40px; outline: none; }
.search input:focus { background: var(--panel); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; cursor: pointer; border: 0; text-transform: uppercase; }
#menuToggle { display: none; }

aside.side { background: var(--side); border-right: 1px solid var(--line); padding: 14px 12px; display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.side .new { margin: 0 4px 14px; height: 44px; border-radius: 12px; justify-content: center; font-size: 15px; box-shadow: 0 2px 8px rgba(43,89,232,.25); }
.nav { display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 12px; border-radius: 8px; color: var(--ink-2); cursor: pointer; font-weight: 500; }
.nav:hover { background: var(--hover); color: var(--ink); }
.nav.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav-sep { height: 1px; background: var(--line); margin: 10px 8px; }
.quota { margin-top: auto; padding: 16px 12px 6px; font-size: 12.5px; color: var(--ink-2); }
.bar { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 8px 0 6px; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.bar.warn > i { background: var(--warn); } .bar.full > i { background: var(--danger); }

main { overflow: auto; position: relative; background: var(--panel); }
.view { padding: 18px 28px 80px; min-height: 100%; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; min-height: 40px; }
.crumbs { display: flex; align-items: center; gap: 2px; font-size: 20px; font-weight: 650; letter-spacing: -.01em; flex-wrap: wrap; flex: 1; min-width: 200px; }
.crumbs a { color: var(--ink-2); padding: 2px 6px; border-radius: 6px; cursor: pointer; }
.crumbs a:hover { background: var(--hover); color: var(--ink); }
.crumbs a:last-child { color: var(--ink); }
.crumbs .sep { color: var(--ink-3); font-weight: 400; }
.tools { display: flex; gap: 6px; align-items: center; }
.selbar { display: flex; align-items: center; gap: 4px; padding: 6px 8px; margin: -4px 0 12px; background: var(--accent-soft); border-radius: 10px; flex-wrap: wrap; }
.selbar .count { font-weight: 600; padding: 0 10px; color: var(--accent); margin-right: auto; }
.selbar .btn { background: transparent; border-color: transparent; height: 32px; }
.selbar .btn:hover { background: var(--panel); }

/* ---------- lista */
.list { width: 100%; border-collapse: collapse; }
.list th { text-align: left; font-weight: 600; font-size: 12.5px; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); cursor: pointer; user-select: none; white-space: nowrap; }
.list th:hover { color: var(--ink); }
.list td { padding: 0 10px; height: 48px; border-bottom: 1px solid var(--line); white-space: nowrap; color: var(--ink-2); }
.list tr.row { cursor: default; }
.list tr.row:hover td { background: var(--hover); }
.list tr.row.selected td { background: var(--sel); }
.list tr.row.drop td { background: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.list td.name { color: var(--ink); width: 100%; max-width: 0; }
.list .nm { display: flex; align-items: center; gap: 12px; min-width: 0; }
.list .nm span { overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.list .nm span:hover { text-decoration: underline; }
.list td.cb, .list th.cb { width: 36px; padding-right: 0; }
.cbx { width: 18px; height: 18px; accent-color: var(--accent); cursor: pointer; opacity: .35; }
tr.row:hover .cbx, tr.row.selected .cbx, .anysel .cbx, th .cbx { opacity: 1; }
.list td.more { width: 44px; }
.ficon { width: 32px; height: 32px; display: grid; place-items: center; flex: none; border-radius: 6px; overflow: hidden; }
.ficon img { width: 32px; height: 32px; object-fit: cover; border-radius: 4px; }
.ficon svg { width: 28px; height: 28px; }

/* ---------- cuadrícula */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--panel); cursor: pointer; position: relative; transition: box-shadow .12s, border-color .12s; }
.card:hover { box-shadow: var(--shadow); }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.card.drop { border-color: var(--accent); background: var(--accent-soft); }
.card .thumb { aspect-ratio: 4/3; background: var(--bg); display: grid; place-items: center; overflow: hidden; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .thumb svg { width: 56px; height: 56px; }
.card .meta { padding: 9px 12px 10px; }
.card .meta div { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card .meta small { color: var(--ink-3); font-size: 12px; }
.card .cbx { position: absolute; top: 8px; left: 8px; opacity: 0; }
.card:hover .cbx, .card.selected .cbx, .anysel .card .cbx { opacity: 1; }
.card .vbadge { position: absolute; right: 8px; top: 8px; background: rgba(0,0,0,.6); color: #fff; border-radius: 12px; padding: 2px 8px; font-size: 11px; display: flex; gap: 4px; align-items: center; }
.card .vbadge svg { width: 12px; height: 12px; }

/* ---------- fotos */
.photos h3 { font-size: 14px; color: var(--ink-2); margin: 22px 0 10px; font-weight: 650; }
.pgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px; }
.ph { aspect-ratio: 1; background: var(--bg); overflow: hidden; cursor: pointer; position: relative; border-radius: 4px; }
.ph img { width: 100%; height: 100%; object-fit: cover; transition: transform .25s; }
.ph:hover img { transform: scale(1.04); }
.ph .vbadge { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.6); color: #fff; border-radius: 12px; padding: 2px 8px; font-size: 11px; }
.ph.video { display: grid; place-items: center; color: var(--ink-3); }

/* ---------- vacío */
.empty { text-align: center; padding: 80px 20px; color: var(--ink-3); }
.empty svg { width: 84px; height: 84px; stroke-width: 1.2; color: var(--line); margin-bottom: 10px; }
.empty h2 { color: var(--ink); font-size: 18px; margin: 0 0 6px; }
.empty p { margin: 0 0 18px; }

/* ---------- menús */
.menu { position: fixed; z-index: 60; min-width: 200px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; }
.menu button { display: flex; width: 100%; align-items: center; gap: 12px; padding: 8px 12px; border: 0; background: transparent; border-radius: 6px; cursor: pointer; text-align: left; }
.menu button:hover { background: var(--hover); }
.menu button.danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.menu .who { padding: 8px 12px 10px; color: var(--ink-3); font-size: 12.5px; }
.menu .who b { display: block; color: var(--ink); font-size: 14px; }

/* ---------- modales */
.backdrop { position: fixed; inset: 0; background: rgba(15,20,30,.45); z-index: 70; display: grid; place-items: center; padding: 16px; animation: fade .12s; }
.modal { background: var(--panel); border-radius: 14px; box-shadow: var(--shadow); width: 100%; max-width: 440px; max-height: calc(100vh - 32px); display: flex; flex-direction: column; animation: pop .14s; }
.modal.wide { max-width: 600px; }
.modal h2 { font-size: 18px; margin: 0; padding: 20px 24px 6px; }
.modal .body { padding: 12px 24px; overflow: auto; }
.modal .body p { margin: 0 0 12px; color: var(--ink-2); }
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 24px 20px; }
.modal .err { color: var(--danger); font-size: 13px; min-height: 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(.97); opacity: 0; } }

.picker { border: 1px solid var(--line); border-radius: 8px; max-height: 280px; overflow: auto; }
.picker .ph-head { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--ink-2); background: var(--bg); position: sticky; top: 0; word-break: break-all; }
.picker .it { display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer; }
.picker .it:hover { background: var(--hover); }
.picker .it svg { color: #e8a92c; }
.picker .none { padding: 14px; color: var(--ink-3); font-size: 13px; }
.linkbox { display: flex; gap: 8px; }
.linkbox input { flex: 1; }

/* ---------- visor */
.viewer { position: fixed; inset: 0; z-index: 80; background: rgba(8,10,14,.96); display: flex; flex-direction: column; color: #fff; animation: fade .12s; }
.viewer .vh { display: flex; align-items: center; gap: 10px; padding: 10px 14px; }
.viewer .vh .t { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.viewer .vh .btn { background: transparent; border-color: transparent; color: #fff; }
.viewer .vh .btn:hover { background: rgba(255,255,255,.1); }
.viewer .stage { flex: 1; display: flex; align-items: center; justify-content: center; min-height: 0; position: relative; padding: 0 64px 20px; overflow: hidden; }
.viewer .stage img, .viewer .stage video { max-width: 100%; max-height: calc(100vh - 90px); object-fit: contain; border-radius: 4px; }
.viewer .stage iframe { width: 100%; height: 100%; border: 0; background: #fff; border-radius: 6px; }
.viewer .stage pre { width: 100%; max-width: 980px; height: 100%; overflow: auto; background: #12161d; color: #dfe6f0; padding: 20px; border-radius: 8px; margin: 0; font: 13px/1.55 ui-monospace, Menlo, Consolas, monospace; white-space: pre-wrap; }
.viewer .nav-arrow { position: absolute; top: 50%; transform: translateY(-50%); width: 48px; height: 48px; border-radius: 50%; border: 0; background: rgba(255,255,255,.1); color: #fff; cursor: pointer; display: grid; place-items: center; }
.viewer .nav-arrow:hover { background: rgba(255,255,255,.2); }
.viewer .nav-arrow.l { left: 10px; } .viewer .nav-arrow.r { right: 10px; }
.viewer .nofile { text-align: center; color: #aab; }
.viewer .nofile svg { width: 80px; height: 80px; }

/* ---------- subida */
.drop-overlay { position: fixed; inset: 0; z-index: 75; background: rgba(43,89,232,.12); border: 3px dashed var(--accent); display: grid; place-items: center; pointer-events: none; }
.drop-overlay div { background: var(--accent); color: #fff; padding: 16px 26px; border-radius: 12px; font-weight: 600; font-size: 16px; box-shadow: var(--shadow); display: flex; align-items: center; gap: 10px; }
.uploads { position: fixed; right: 20px; bottom: 20px; width: 360px; max-width: calc(100vw - 40px); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); z-index: 65; overflow: hidden; }
.uploads .uh { display: flex; align-items: center; gap: 8px; padding: 12px 10px 12px 16px; font-weight: 650; border-bottom: 1px solid var(--line); }
.uploads .uh span { flex: 1; }
.uploads .ul { max-height: 260px; overflow: auto; }
.uploads.min .ul { display: none; }
.uitem { padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
.uitem .un { display: flex; justify-content: space-between; gap: 10px; }
.uitem .un span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.uitem .un span:last-child { color: var(--ink-3); flex: none; }
.uitem .bar { margin: 6px 0 0; height: 4px; }
.uitem.done .bar > i { background: var(--ok); }
.uitem.error .bar > i { background: var(--danger); }
.uitem.error .un span:last-child { color: var(--danger); }

/* ---------- avisos */
.toasts { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: #1d2430; color: #fff; padding: 10px 18px; border-radius: 8px; box-shadow: var(--shadow); font-size: 13.5px; animation: pop .15s; max-width: 90vw; }
.toast.err { background: var(--danger); }

/* ---------- admin */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat { border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; background: var(--panel); }
.stat .k { color: var(--ink-3); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat .v { font-size: 22px; font-weight: 700; margin-top: 4px; letter-spacing: -.01em; }
.stat .s { color: var(--ink-3); font-size: 12.5px; margin-top: 2px; word-break: break-all; }
h2.sec { font-size: 16px; margin: 6px 0 12px; display: flex; align-items: center; gap: 10px; }
h2.sec .btn { margin-left: auto; }
.tag { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.tag.off { background: #fde8e8; color: var(--danger); }
.utable td { height: 58px; }
.utable .path { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; color: var(--ink-3); max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.utable .usage { min-width: 150px; font-size: 12px; }
.utable .usage .bar { margin: 4px 0 0; }

/* ---------- móvil */
@media (max-width: 820px) {
  #app { grid-template-columns: 1fr; }
  header.top { padding: 0 10px; gap: 8px; }
  header.top .logo { width: auto; } header.top .logo span { display: none; }
  #menuToggle { display: inline-flex; }
  aside.side { position: fixed; top: 60px; bottom: 0; left: 0; width: 260px; z-index: 50; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow); }
  aside.side.open { transform: none; }
  .view { padding: 14px 12px 80px; }
  .list .hide-m { display: none; }
  .crumbs { font-size: 17px; }
  .viewer .stage { padding: 0 6px 10px; }
  .viewer .nav-arrow { display: none; }
  .tools .lbl { display: none; }
}
