/* ===== Bandeja · Estudio Jurídico ===== */

:root {
  --bg: #f3f4f7;
  --surface: #ffffff;
  --surface-2: #eceef3;
  --text: #121c33;
  --muted: #5d6a82;
  --border: #dfe3ea;
  --primary: #1b3a6b;
  --primary-hover: #234a87;
  --on-primary: #ffffff;
  --accent: #b88a2b;
  --accent-soft: #f6ecd3;
  --danger: #b3261e;
  --ok: #1f7a4d;
  --shadow: 0 1px 2px rgba(18, 28, 51, .06), 0 4px 14px rgba(18, 28, 51, .06);
  --shadow-lg: 0 12px 40px rgba(18, 28, 51, .22);
  --radius: 14px;
  --side-w: 288px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1322;
    --surface: #131d33;
    --surface-2: #1b2744;
    --text: #e9edf6;
    --muted: #9aa8c2;
    --border: #26345a;
    --primary: #d9b657;
    --primary-hover: #e6c56e;
    --on-primary: #14203a;
    --accent: #d9b657;
    --accent-soft: #2c2a22;
    --danger: #ff7b72;
    --ok: #5fd39a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 14px rgba(0, 0, 0, .25);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, .55);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body { height: 100%; }
body {
  margin: 0;
  font: 15px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3, p { margin: 0; }
.muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 8px; }
@media (prefers-color-scheme: dark) { :focus-visible { outline-color: var(--accent); } }

.ic { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- layout ---------- */

.app { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); height: 100dvh; overflow: hidden; }
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.content { flex: 1; overflow-y: auto; padding: 4px 24px calc(120px + var(--safe-b)); -webkit-overflow-scrolling: touch; scroll-padding-bottom: 120px; }

.side {
  display: flex; flex-direction: column; gap: 6px;
  padding: calc(18px + var(--safe-t)) 12px 12px calc(14px + var(--safe-l));
  background: var(--surface); border-right: 1px solid var(--border);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 16px; }
.brand strong { display: block; font-size: 17px; letter-spacing: .1px; }
.brand small { color: var(--muted); font-size: 12px; }
.brand img, .brand-m img { border-radius: 9px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; min-height: 0; }
.nav-label { display: flex; align-items: center; justify-content: space-between; margin: 14px 8px 4px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 40px;
  padding: 8px 10px; border: 0; border-radius: 10px; background: none; text-align: left; color: var(--text);
}
.nav-item .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item:hover { background: var(--surface-2); }
.nav-item.active { background: var(--primary); color: var(--on-primary); font-weight: 600; }
.nav-item .count { font-size: 12px; opacity: .75; font-variant-numeric: tabular-nums; }
.nav-item .linked { color: var(--accent); }
.nav-item.active .linked { color: inherit; }
.nav-add { border: 0; background: none; color: var(--muted); border-radius: 8px; padding: 4px; display: grid; place-items: center; }
.nav-add:hover { background: var(--surface-2); color: var(--text); }
.side-foot { border-top: 1px solid var(--border); padding-top: 8px; display: flex; flex-direction: column; gap: 2px; }

.top {
  display: flex; align-items: center; gap: 10px;
  padding: calc(14px + var(--safe-t)) 24px 10px;
}
.brand-m { display: none; align-items: center; gap: 8px; }
.search {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 44px; max-width: 640px;
  padding: 0 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; color: var(--muted);
}
.search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: 0; color: var(--text); font-size: 16px; }
.search input::-webkit-search-cancel-button { cursor: pointer; }
.hint-key { font: 12px var(--font); padding: 1px 7px; border: 1px solid var(--border); border-radius: 6px; color: var(--muted); }
.top #btnScan { margin-left: auto; }

/* ---------- botones ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px; border-radius: 12px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-weight: 600; white-space: nowrap;
  transition: background .12s, transform .06s, border-color .12s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn.primary:hover { background: var(--primary-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.small { min-height: 36px; padding: 0 12px; border-radius: 10px; font-size: 14px; }
.btn.ghost { border-color: transparent; background: none; }
.icon-btn {
  display: inline-grid; place-items: center; width: 44px; height: 44px; flex: none;
  border: 0; border-radius: 12px; background: none; color: inherit;
}
.icon-btn:hover { background: var(--surface-2); }
.only-mobile { display: none; }

/* ---------- chips (móvil) y filtros ---------- */

.chips { display: none; gap: 8px; padding: 2px 16px 8px; overflow-x: auto; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 14px; flex: none;
  border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text); font-weight: 500; font-size: 14px;
}
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--on-primary); font-weight: 600; }
.chip .count { font-size: 12px; opacity: .7; }
.chip.ghost { border-style: dashed; color: var(--muted); }

.view-head { display: flex; align-items: center; gap: 12px; padding: 14px 0 6px; min-height: 64px; }
.view-head h1 { font-size: 22px; line-height: 1.2; letter-spacing: -.01em; }
.view-head .sub { color: var(--muted); font-size: 13px; margin-top: 2px; }
.view-head .grow { flex: 1; min-width: 0; }
.view-head .grow h1 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.view-head .actions { display: flex; gap: 6px; align-items: center; }
.seg { display: inline-flex; padding: 3px; background: var(--surface-2); border-radius: 10px; }
.seg button { border: 0; background: none; width: 36px; height: 32px; border-radius: 8px; display: grid; place-items: center; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.badge-folder { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); margin-left: 8px; vertical-align: middle; }
.badge-folder.off { background: var(--surface-2); color: var(--muted); }

.filters { display: flex; gap: 6px; overflow-x: auto; padding: 4px 0 12px; scrollbar-width: none; }
.filters::-webkit-scrollbar { display: none; }
.filters .chip { min-height: 32px; font-size: 13px; padding: 0 12px; }

/* ---------- aviso de archivos recién recibidos ---------- */

.triage {
  display: flex; flex-direction: column; gap: 12px; margin: 14px 0 6px; padding: 16px 18px;
  background: linear-gradient(135deg, var(--accent-soft), var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--border));
  border-radius: var(--radius); box-shadow: var(--shadow);
  animation: pop .25s ease-out;
}
.triage.still { animation: none; }
.triage-head { display: flex; align-items: center; gap: 12px; }
.triage-head .ic { color: var(--accent); width: 28px; height: 28px; }
.triage-head strong { font-size: 16px; display: block; }
.triage-head small { color: var(--muted); }
.triage-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.triage .chip { min-height: 40px; background: var(--surface); }
.triage .chip:hover { border-color: var(--primary); }
.triage .chip.main { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
@keyframes pop { from { transform: translateY(-6px); opacity: 0; } }

/* ---------- archivos ---------- */

.files.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 14px; }
.card {
  position: relative; display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; cursor: pointer;
  content-visibility: auto; contain-intrinsic-size: 176px 220px;
  transition: box-shadow .15s, border-color .15s, transform .08s; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.card:hover { box-shadow: var(--shadow); border-color: color-mix(in srgb, var(--primary) 35%, var(--border)); }
.card:active { transform: scale(.985); }
.card.selected { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary); }
.card.fresh::after { content: ""; position: absolute; top: 10px; right: 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--surface); }
.thumb { position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center; background: var(--surface-2); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .play { position: absolute; inset: auto 8px 8px auto; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .55); color: #fff; }
.thumb .play .ic { width: 14px; height: 14px; fill: #fff; }

.ftype { display: grid; place-items: center; width: 56px; height: 68px; border-radius: 8px 14px 8px 8px; position: relative; color: #fff; font-weight: 800; font-size: 12px; letter-spacing: .04em; background: var(--k, #64748b); }
.ftype::before { content: ""; position: absolute; top: 0; right: 0; width: 16px; height: 16px; background: rgba(255, 255, 255, .35); border-radius: 0 14px 0 8px; }
.ftype.pdf { --k: #d93f3a; } .ftype.word { --k: #2b6cd9; } .ftype.excel { --k: #1f8a52; } .ftype.ppt { --k: #dd6b20; }
.ftype.image { --k: #8a4bd6; } .ftype.video { --k: #d6336c; } .ftype.audio { --k: #c78a00; } .ftype.text { --k: #566174; }
.ftype.archive { --k: #6b7280; } .ftype.other { --k: #64748b; }

.meta { padding: 10px 12px 12px; min-width: 0; flex: 1; }
.name { font-weight: 600; font-size: 14px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; word-break: break-word; }
.sub { margin-top: 3px; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 8px; }
.sub .client { color: var(--primary); font-weight: 600; }
@media (prefers-color-scheme: dark) { .sub .client { color: var(--accent); } }
.saved { display: inline-flex; align-items: center; gap: 3px; color: var(--ok); font-weight: 600; }
.saved .ic { width: 13px; height: 13px; stroke-width: 2.6; }

.check {
  position: absolute; top: 8px; left: 8px; z-index: 2; width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center; border: 2px solid rgba(255, 255, 255, .95); background: rgba(0, 0, 0, .28); color: transparent;
  opacity: 0; transition: opacity .12s;
}
.card:hover .check, .selecting .check, .card:focus-within .check { opacity: 1; }
.card.selected .check { background: var(--primary); border-color: var(--primary); color: var(--on-primary); opacity: 1; }
.check .ic { width: 16px; height: 16px; stroke-width: 3; }
.quick { position: absolute; top: 8px; right: 8px; z-index: 2; display: none; gap: 4px; }
.card:hover .quick { display: flex; }
.quick button { width: 32px; height: 32px; display: grid; place-items: center; border: 0; border-radius: 9px; background: rgba(15, 23, 42, .78); color: #fff; backdrop-filter: blur(6px); }
.quick button:hover { background: rgba(15, 23, 42, .95); }
.card.fresh:hover::after { display: none; }
@media (hover: none) { .quick { display: none !important; } .check { opacity: 1; background: rgba(0, 0, 0, .35); } }

/* vista de lista */
.files.list { display: flex; flex-direction: column; gap: 6px; }
.files.list .card { flex-direction: row; align-items: center; contain-intrinsic-size: auto 64px; }
.files.list .thumb { width: 64px; aspect-ratio: auto; height: 64px; flex: none; }
.files.list .ftype { width: 34px; height: 42px; font-size: 9px; border-radius: 5px 9px 5px 5px; }
.files.list .ftype::before { width: 10px; height: 10px; border-radius: 0 9px 0 5px; }
.files.list .meta { padding: 8px 14px; }
.files.list .name { -webkit-line-clamp: 1; }
.files.list .check { top: 50%; left: 18px; transform: translateY(-50%); width: 24px; height: 24px; }
.files.list .quick { top: 50%; right: 12px; transform: translateY(-50%); }
.files.list .card.fresh::after { top: 50%; right: 14px; transform: translateY(-50%); }
.files.list .play { display: none; }

/* ---------- barra de selección ---------- */

.selbar {
  position: fixed; z-index: 30; left: calc(var(--side-w) + 24px); right: 24px; bottom: calc(18px + var(--safe-b));
  display: flex; align-items: center; gap: 6px; padding: 8px 10px 8px 16px;
  background: var(--text); color: var(--bg); border-radius: 16px; box-shadow: var(--shadow-lg);
  animation: rise .18s ease-out; max-width: 920px; margin-inline: auto;
}
@keyframes rise { from { transform: translateY(14px); opacity: 0; } }
.selbar .n { font-weight: 700; margin-right: auto; white-space: nowrap; }
.selbar button { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 11px; background: none; color: inherit; font-weight: 600; }
.selbar button:hover { background: color-mix(in srgb, var(--bg) 18%, transparent); }
.selbar button.primary { background: var(--bg); color: var(--text); }
.selbar button.danger { color: #ff9b94; }
@media (prefers-color-scheme: dark) { .selbar { background: #e9edf6; color: #121c33; } .selbar button.primary { background: #13294b; color: #fff; } .selbar button.danger { color: #b3261e; } }

.fab {
  position: fixed; z-index: 20; right: calc(18px + var(--safe-r)); bottom: calc(20px + var(--safe-b)); display: none;
  width: 60px; height: 60px; border: 0; border-radius: 20px; place-items: center;
  background: var(--primary); color: var(--on-primary); box-shadow: var(--shadow-lg);
}
.fab .ic { width: 28px; height: 28px; stroke-width: 2.4; }
.fab:active { transform: scale(.94); }
.selecting .fab { display: none !important; }
.selecting .toasts { bottom: calc(96px + var(--safe-b)); }

/* ---------- estado vacío ---------- */

.empty { max-width: 560px; margin: 28px auto 0; text-align: center; padding: 8px 12px; }
.empty .big { width: 84px; height: 84px; margin: 0 auto 14px; border-radius: 26px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.empty .big .ic { width: 40px; height: 40px; stroke-width: 1.8; }
.empty h2 { font-size: 20px; margin-bottom: 6px; }
.empty p { color: var(--muted); }
.steps { text-align: left; margin: 22px 0 0; padding: 0; list-style: none; counter-reset: s; display: grid; gap: 10px; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; }
.steps li::before { content: counter(s); flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: var(--on-primary); font-weight: 700; font-size: 13px; }
.empty .btn { margin-top: 18px; }

/* ---------- arrastrar y soltar ---------- */

.dropzone { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: color-mix(in srgb, var(--primary) 72%, transparent); backdrop-filter: blur(3px); pointer-events: none; }
.dropzone > div { display: grid; gap: 6px; justify-items: center; padding: 48px 64px; border: 3px dashed rgba(255, 255, 255, .85); border-radius: 28px; color: #fff; text-align: center; }
.dropzone .ic { width: 52px; height: 52px; }
.dropzone strong { font-size: 24px; }

/* ---------- avisos ---------- */

.toasts { position: fixed; z-index: 100; left: 50%; bottom: calc(24px + var(--safe-b)); transform: translateX(-50%); display: grid; gap: 8px; width: min(94vw, 460px); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-radius: 12px; background: #1c2540; color: #fff; box-shadow: var(--shadow-lg); animation: rise .2s ease-out; font-size: 14px; }
.toast.error { background: #8e1d17; }
.toast.success { background: #17613c; }
.toast.out { opacity: 0; transform: translateY(8px); transition: .2s; }
.toast-msg { flex: 1; }
.toast-action { border: 0; background: none; color: #ffd978; font-weight: 700; padding: 6px 4px; }

/* ---------- diálogos ---------- */

dialog { color: var(--text); }
.modal { border: 0; padding: 0; border-radius: 20px; background: var(--surface); box-shadow: var(--shadow-lg); width: min(92vw, 460px); max-height: 88dvh; overflow: auto; }
.modal::backdrop { background: rgba(8, 14, 28, .55); backdrop-filter: blur(2px); }
.modal-body { padding: 22px; display: grid; gap: 14px; }
.modal-body h2 { font-size: 19px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.field { display: grid; gap: 6px; font-weight: 600; font-size: 13px; }
.field input[type="text"] { min-height: 46px; padding: 0 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); font-size: 16px; font-weight: 400; }
.field input[type="text"]:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 22%, transparent); }
.row-box { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.row-box > div { flex: 1; min-width: 0; }
.row-box strong { display: block; font-size: 14px; }
.row-box small { color: var(--muted); display: block; overflow: hidden; text-overflow: ellipsis; }
.switch { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); cursor: pointer; }
.switch > div { flex: 1; }
.switch strong { display: block; font-size: 14px; }
.switch small { color: var(--muted); }
.switch input { width: 22px; height: 22px; accent-color: var(--primary); flex: none; }
.note { padding: 12px 14px; border-radius: 12px; background: var(--accent-soft); color: var(--text); font-size: 13.5px; }
.note strong { color: var(--accent); }
.meter { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--primary); border-radius: inherit; }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; }
.tabs button { flex: 1; min-height: 38px; border: 0; border-radius: 9px; background: none; font-weight: 600; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.help-panel { display: grid; gap: 10px; }
.help-panel ol { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.help-panel .warn { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border: 1px solid color-mix(in srgb, var(--danger) 35%, var(--border)); border-radius: 12px; padding: 10px 12px; font-size: 13.5px; }

/* hoja inferior para elegir cliente */
.modal.sheet { width: min(94vw, 480px); }
.sheet-body { gap: 10px; padding: 16px 16px 12px; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-search { max-width: none; min-height: 44px; background: var(--bg); }
.sheet-list { display: grid; gap: 2px; max-height: 50dvh; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.sheet-row { display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 8px 12px; border: 0; background: none; border-radius: 12px; text-align: left; }
.sheet-row:hover, .sheet-row:focus-visible { background: var(--surface-2); }
.sheet-row.current { background: var(--accent-soft); }
.sheet-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.sheet-row .count { color: var(--muted); font-size: 13px; }

/* ---------- visor ---------- */

.viewer { border: 0; padding: 0; width: 100vw; max-width: none; height: 100dvh; max-height: none; background: #0a0f1c; color: #fff; }
.viewer[open] { display: flex; flex-direction: column; }
.viewer::backdrop { background: #000; }
.v-top { display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) calc(10px + var(--safe-r)) 8px calc(10px + var(--safe-l)); background: rgba(255, 255, 255, .05); }
.v-top .icon-btn:hover { background: rgba(255, 255, 255, .12); }
.v-title { flex: 1; min-width: 0; display: grid; }
.v-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 15px; }
.v-title small { color: #aab6d0; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v-nav { display: flex; align-items: center; gap: 2px; font-size: 13px; color: #aab6d0; font-variant-numeric: tabular-nums; }
.v-stage { flex: 1; min-height: 0; display: grid; place-items: center; overflow: auto; padding: 8px; }
.v-stage > img, .v-stage > video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }
.v-stage > iframe { width: 100%; height: 100%; border: 0; background: #fff; border-radius: 6px; }
.v-stage > audio { width: min(560px, 92vw); }
.v-stage > pre { align-self: start; justify-self: stretch; margin: 0; padding: 16px; white-space: pre-wrap; word-break: break-word; font: 13.5px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; background: #fff; color: #111; border-radius: 8px; max-width: 900px; margin-inline: auto; width: 100%; }
.v-card { display: grid; justify-items: center; gap: 16px; text-align: center; padding: 24px; max-width: 420px; }
.v-card .ftype { width: 84px; height: 102px; font-size: 17px; border-radius: 12px 20px 12px 12px; }
.v-card .ftype::before { width: 24px; height: 24px; border-radius: 0 20px 0 12px; }
.v-card p { color: #aab6d0; }
.v-card .btn { background: #fff; color: #13294b; border-color: #fff; }
.v-actions { display: flex; gap: 6px; padding: 10px calc(12px + var(--safe-r)) calc(10px + var(--safe-b)) calc(12px + var(--safe-l)); overflow-x: auto; background: rgba(255, 255, 255, .05); scrollbar-width: none; justify-content: center; }
.v-actions::-webkit-scrollbar { display: none; }
.v-actions button { display: grid; justify-items: center; gap: 3px; flex: none; min-width: 74px; padding: 8px 10px; border: 0; border-radius: 12px; background: none; color: #e7ecf8; font-size: 12px; font-weight: 600; }
.v-actions button:hover { background: rgba(255, 255, 255, .12); }
.v-actions button.primary { background: #fff; color: #13294b; }
.v-actions button.danger { color: #ff9b94; }
.v-actions .ic { width: 22px; height: 22px; }

/* ---------- móvil ---------- */

@media (max-width: 899px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { display: none; }
  .brand-m { display: flex; }
  .top { padding: calc(10px + var(--safe-t)) 14px 8px; gap: 8px; }
  .top .add-btn, .hint-key { display: none; }
  .selbar [data-sel=all] { display: none; }
  .selbar .n .w { display: none; }
  .search { max-width: none; }
  .only-mobile { display: inline-grid; }
  .chips { display: flex; }
  .content { padding: 0 14px calc(150px + var(--safe-b)); }
  .files.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .fab { display: grid; }
  .selbar { left: 10px; right: 10px; bottom: calc(10px + var(--safe-b)); padding: 6px 6px 6px 14px; gap: 0; }
  .selbar button { padding: 0; width: 46px; justify-content: center; }
  .selbar button span { display: none; }
  .view-head { padding-top: 8px; min-height: 56px; }
  .view-head h1 { font-size: 20px; }
  .toasts { bottom: calc(86px + var(--safe-b)); }
  .modal { width: 94vw; }
  .modal.sheet { margin-bottom: 0; margin-top: auto; width: 100vw; max-width: none; border-radius: 22px 22px 0 0; max-height: 82dvh; }
  .triage { padding: 14px; }
}
@media (max-width: 380px) { .brand-m strong { display: none; } }
@media (min-width: 900px) and (max-width: 1100px) { :root { --side-w: 248px; } }

@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }


/* ---------- escáner ---------- */
.scanner { border: 0; padding: 0; width: 100vw; max-width: none; height: 100dvh; max-height: none; background: #0a0f1c; color: #fff; }
.scanner[open] { display: flex; flex-direction: column; }
.scanner::backdrop { background: #000; }
.sc-top { display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) calc(10px + var(--safe-r)) 8px calc(10px + var(--safe-l)); background: rgba(255, 255, 255, .05); }
.sc-top .icon-btn:hover { background: rgba(255, 255, 255, .12); }
.sc-stage { flex: 1; min-height: 0; display: grid; place-items: center; overflow: hidden; padding: 8px; position: relative; }
.sc-start { display: grid; justify-items: center; gap: 12px; text-align: center; max-width: 420px; padding: 16px; }
.sc-start .big { width: 84px; height: 84px; border-radius: 26px; display: grid; place-items: center; background: rgba(217, 182, 87, .16); color: #d9b657; }
.sc-start .big .ic { width: 40px; height: 40px; stroke-width: 1.8; }
.sc-start p { color: #aab6d0; }
.big-btn { width: 100%; max-width: 320px; min-height: 52px; font-size: 16px; }
.sc-start .btn:not(.primary) { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .2); }
.sc-start .btn.primary { background: #d9b657; border-color: #d9b657; color: #14203a; }
.sc-crop { position: relative; touch-action: none; user-select: none; -webkit-user-select: none; }
.sc-crop canvas { display: block; border-radius: 4px; }
.sc-svg { position: absolute; inset: 0; overflow: visible; }
.sc-poly { fill: rgba(217, 182, 87, .16); stroke: #d9b657; stroke-width: 2.5; stroke-linejoin: round; }
.sc-h { cursor: grab; }
.sc-hit { fill: transparent; }
.sc-dot { fill: #d9b657; stroke: #fff; stroke-width: 3; }
.sc-review { position: relative; width: 100%; height: 100%; }
.sc-result { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; filter: drop-shadow(0 6px 24px rgba(0, 0, 0, .55)); }
.sc-strip { display: flex; gap: 8px; padding: 8px 12px; overflow-x: auto; background: rgba(255, 255, 255, .05); scrollbar-width: none; align-items: center; }
.sc-strip::-webkit-scrollbar { display: none; }
.sc-thumb { position: relative; flex: none; height: 64px; border-radius: 6px; overflow: hidden; border: 2px solid transparent; cursor: pointer; background: #fff; }
.sc-thumb.on { border-color: #d9b657; }
.sc-thumb img { height: 100%; display: block; }
.sc-thumb span { position: absolute; left: 3px; bottom: 3px; background: rgba(0, 0, 0, .65); font-size: 11px; padding: 0 5px; border-radius: 6px; }
.sc-thumb button { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border: 0; border-radius: 50%; background: rgba(0, 0, 0, .7); color: #fff; display: grid; place-items: center; padding: 0; }
.sc-thumb button .ic { width: 12px; height: 12px; }
.sc-add { flex: none; width: 64px; height: 64px; border-radius: 8px; border: 2px dashed rgba(255, 255, 255, .4); background: none; color: #fff; display: grid; place-items: center; }
.sc-actions { display: grid; gap: 8px; padding: 8px calc(10px + var(--safe-r)) calc(10px + var(--safe-b)) calc(10px + var(--safe-l)); background: rgba(255, 255, 255, .05); }
.sc-filters { display: flex; gap: 6px; justify-content: center; }
.sc-filters .chip { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .2); color: #fff; }
.sc-filters .chip.active { background: #d9b657; border-color: #d9b657; color: #14203a; }
.sc-row, .sc-actions:not(:has(.sc-row)) { display: flex; gap: 6px; justify-content: center; }
.sc-actions button:not(.chip) { display: grid; justify-items: center; gap: 3px; flex: 1; max-width: 120px; min-width: 64px; padding: 8px 6px; border: 0; border-radius: 12px; background: none; color: #e7ecf8; font-size: 12px; font-weight: 600; }
.sc-actions button:not(.chip):not(.primary):hover { background: rgba(255, 255, 255, .12); }
.sc-actions button.primary { background: #d9b657; color: #14203a; }
.sc-actions .ic { width: 22px; height: 22px; }
.sc-busy { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(5, 10, 20, .6); backdrop-filter: blur(2px); z-index: 5; }
.sc-busy span { background: #fff; color: #13294b; padding: 14px 22px; border-radius: 14px; font-weight: 600; box-shadow: var(--shadow-lg); }
.sc-dest { display: grid; gap: 8px; }
.seg.wide { display: flex; } .seg.wide button { flex: 1; width: auto; font-weight: 600; }
.btn-row { width: 100%; text-align: left; cursor: pointer; }
.btn-row > .ic:last-child { color: var(--muted); }
.crumbs { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 13px; }
.crumb { border: 0; background: var(--surface-2); border-radius: 8px; padding: 4px 9px; font-weight: 600; }

.linklike { border: 0; background: none; color: var(--primary); text-decoration: underline; padding: 0; font-size: inherit; }
code { background: var(--surface-2); padding: 1px 6px; border-radius: 6px; font-size: .9em; word-break: break-all; }
