/* ==========================================================================
   Bóveda Privada — tema oscuro, mobile-first y responsive
   Puntos de quiebre: 480 (teléfonos grandes) · 720 (tablet vertical) ·
                      960 (tablet horizontal / notebook) · 1280 (escritorio)
   ========================================================================== */

:root {
  --bg: #0d0f14;
  --bg-2: #12151c;
  --surface: #171b24;
  --surface-2: #1e2330;
  --line: #2a3142;
  --line-soft: #222838;
  --text: #e9ecf2;
  --muted: #98a2b5;
  --faint: #6b7487;
  --accent: #ffa552;
  --accent-2: #f0743e;
  --accent-ink: #1a1007;
  --ok: #4ade80;
  --warn: #fbbf24;
  --danger: #f87171;
  --violet: #a99bff;
  --rose: #ff8fb6;
  --amber: #ffb35c;
  --green: #5eead4;
  --radius: 18px;
  --radius-sm: 12px;
  --shadow: 0 20px 50px -20px rgb(0 0 0 / .65);
  --gutter: clamp(16px, 4vw, 40px);
  --maxw: 1240px;
  --topbar-h: 64px;
  --font: "Segoe UI", system-ui, -apple-system, "SF Pro Text", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Code", "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

/* ---------- base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; scroll-behavior: smooth; overflow-x: clip; }
body {
  margin: 0;
  min-height: 100dvh;
  background:
    radial-gradient(900px 600px at 85% -10%, rgb(255 165 82 / .07), transparent 70%),
    radial-gradient(800px 600px at -10% 110%, rgb(94 234 212 / .05), transparent 70%),
    linear-gradient(rgb(255 255 255 / .022) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, rgb(255 255 255 / .022) 1px, transparent 1px) 0 0 / 44px 44px,
    var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font: 400 clamp(15px, .3vw + 14px, 16px)/1.55 var(--font);
  overflow-x: clip;
  -webkit-font-smoothing: antialiased;
}
html.lock { overflow: hidden; }
img, svg, iframe { display: block; max-width: 100%; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
h1, h2, h3, h4 { margin: 0; line-height: 1.15; letter-spacing: -.015em; text-wrap: balance; }
h1 { font-size: clamp(1.7rem, 3.4vw + .8rem, 3rem); font-weight: 750; }
h2 { font-size: clamp(1.15rem, 1vw + .9rem, 1.45rem); font-weight: 700; }
h3 { font-size: 1.12rem; font-weight: 700; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
b { font-weight: 650; }
code, .mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: .86rem; }
.center { text-align: center; }
.break { overflow-wrap: anywhere; word-break: break-word; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgb(255 165 82 / .35); }
.noscript { padding: 24px; text-align: center; }

.spin {
  width: 1em; height: 1em; flex: none;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.boot { min-height: 100dvh; display: grid; place-content: center; grid-auto-flow: column; gap: 12px; align-items: center; color: var(--muted); }

/* ---------- botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 46px; padding: 10px 18px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--surface-2); color: var(--text);
  font: 600 .95rem/1.2 var(--font); cursor: pointer;
  transition: background .2s, border-color .2s, transform .15s, box-shadow .2s;
  -webkit-tap-highlight-color: transparent; text-align: center;
}
.btn svg { width: 18px; height: 18px; }
.btn:hover { border-color: #3a4359; background: #232a39; text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .65; cursor: progress; }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent; color: var(--accent-ink);
  box-shadow: 0 10px 28px -12px rgb(240 116 62 / .8);
}
.btn.primary:hover { filter: brightness(1.06); }
.btn.danger { background: #b4363a; border-color: transparent; color: #fff; }
.btn.danger:hover { background: #c83f44; }
.btn.danger-ghost { color: var(--danger); border-color: rgb(248 113 113 / .4); background: transparent; }
.btn.danger-ghost:hover { background: rgb(248 113 113 / .1); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 38px; padding: 7px 13px; font-size: .88rem; }
.btn.block { width: 100%; }
.link { background: none; border: 0; color: var(--accent); font: inherit; cursor: pointer; padding: 6px; display: block; margin-inline: auto; }

.icon-btn {
  display: inline-grid; place-items: center; width: 42px; height: 42px; flex: none;
  border-radius: 11px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
  cursor: pointer; transition: background .2s, border-color .2s, color .2s;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { background: #262d3d; border-color: #3a4359; }
.icon-btn.danger:hover { color: var(--danger); border-color: rgb(248 113 113 / .5); }

/* ---------- formularios ---------- */
.stack { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.end { justify-content: flex-end; }
.row.between { justify-content: space-between; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > span:first-child { font-size: .86rem; color: var(--muted); font-weight: 550; }
input, select, textarea {
  width: 100%; min-width: 0;
  min-height: 48px; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg-2); color: var(--text);
  font: 400 16px/1.4 var(--font); /* 16px evita el zoom automático en iPhone */
  transition: border-color .2s, box-shadow .2s;
}
textarea { resize: vertical; min-height: 140px; font-family: var(--mono); font-size: 15px; }
select { appearance: none; padding-right: 40px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgb(255 165 82 / .18); }
input[readonly] { color: var(--muted); }
input::placeholder, textarea::placeholder { color: var(--faint); }
input.code { font-family: var(--mono); font-size: 1.35rem; letter-spacing: .35em; text-align: center; }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { padding-right: 54px; }
.eye {
  position: absolute; top: 50%; right: 5px; transform: translateY(-50%);
  width: 42px; height: 40px; display: grid; place-items: center;
  border: 0; border-radius: 9px; background: transparent; color: var(--muted); cursor: pointer;
}
.eye:hover, .eye[aria-pressed="true"] { color: var(--accent); background: rgb(255 255 255 / .05); }
.eye svg { width: 20px; height: 20px; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: .94rem; }
.check input { width: 20px; height: 20px; min-height: 0; margin-top: 2px; accent-color: var(--accent); flex: none; }
.hint { font-size: .82rem; color: var(--faint); }
.form-error { color: #ffd2d2; background: rgb(248 113 113 / .12); border: 1px solid rgb(248 113 113 / .35); padding: 10px 12px; border-radius: 10px; font-size: .9rem; }
.note-box { padding: 12px 14px; border-radius: 12px; font-size: .9rem; border: 1px solid var(--line); background: var(--surface-2); }
.note-box.warn { border-color: rgb(251 191 36 / .35); background: rgb(251 191 36 / .08); color: #fde7b0; }
.meter { height: 6px; border-radius: 99px; background: var(--line-soft); overflow: hidden; margin-top: -6px; }
.meter span { display: block; height: 100%; width: 0; border-radius: inherit; transition: width .3s, background .3s; }
.meter[data-level="1"] span { width: 20%; background: var(--danger); }
.meter[data-level="2"] span { width: 40%; background: #fb923c; }
.meter[data-level="3"] span { width: 60%; background: var(--warn); }
.meter[data-level="4"] span { width: 80%; background: #a3e635; }
.meter[data-level="5"] span { width: 100%; background: var(--ok); }

/* ---------- pantallas de acceso ---------- */
.auth-scene { position: relative; min-height: 100dvh; display: grid; place-items: center; overflow: hidden; isolation: isolate; }
.auth-bg { position: absolute; inset: 0; z-index: -2; }
.auth-bg img { width: 100%; height: 100%; object-fit: cover; object-position: 70% 40%; filter: brightness(.75); transform: scale(1.12); }
.auth-glow { position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(120% 80% at 50% 0%, rgb(13 15 20 / .2), var(--bg) 75%),
              linear-gradient(180deg, rgb(13 15 20 / .4), var(--bg)); }
.auth-main {
  width: 100%; max-width: 560px; padding: max(28px, env(safe-area-inset-top)) var(--gutter) max(28px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; align-items: center; gap: 18px;
}
.auth-brand { display: flex; align-items: center; gap: 10px; font-weight: 750; font-size: 1.15rem; letter-spacing: -.01em; }
.auth-brand svg { width: 30px; height: 30px; color: var(--accent); }
.auth-card {
  width: 100%; max-width: 440px;
  display: flex; flex-direction: column; gap: 16px;
  padding: clamp(22px, 5vw, 36px);
  background: rgb(23 27 36 / .78); border: 1px solid rgb(255 255 255 / .08);
  border-radius: 24px; box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
}
.auth-card.wide { max-width: 540px; }
.auth-card h1 { font-size: clamp(1.45rem, 2.4vw + .9rem, 1.9rem); }
.auth-foot { display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: .8rem; text-align: center; justify-content: center; }
.auth-foot svg { width: 16px; height: 16px; flex: none; }
.steps { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 14px; }
.steps li { padding-left: 4px; }
.qr { margin: 12px auto 8px; width: min(220px, 70vw); padding: 10px; background: #fff; border-radius: 16px; }
.qr img { width: 100%; height: auto; image-rendering: pixelated; }
details summary { cursor: pointer; color: var(--accent); }
details code { display: block; margin-top: 8px; padding: 10px; background: var(--bg-2); border-radius: 10px; font-size: .9rem; }
.recovery {
  margin: 10px 0 6px; padding: 14px; border-radius: 14px; text-align: center;
  font-size: clamp(.95rem, 2.6vw, 1.12rem); font-weight: 600; letter-spacing: .06em; line-height: 1.7;
  background: rgb(255 165 82 / .1); border: 1px dashed rgb(255 165 82 / .55); color: #ffd9b3;
  overflow-wrap: anywhere; user-select: all;
}

/* ---------- barra superior ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) var(--gutter) 0;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  border-bottom: 1px solid var(--line-soft);
  isolation: isolate;
}
/* El desenfoque va en un pseudo-elemento: así el menú móvil (position: fixed) se ubica respecto a la pantalla. */
.topbar::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: rgb(13 15 20 / .78);
  -webkit-backdrop-filter: blur(16px) saturate(1.4); backdrop-filter: blur(16px) saturate(1.4);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 750; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 26px; color: var(--accent); }
.nav { display: flex; align-items: center; gap: 4px; min-width: 0; }
.nav a {
  padding: 9px 12px; border-radius: 10px; color: var(--muted); font-weight: 550; font-size: .93rem; white-space: nowrap;
  transition: color .2s, background .2s;
}
.nav a:hover { color: var(--text); background: rgb(255 255 255 / .05); text-decoration: none; }
.nav a.on { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }
.nav-logout { margin-left: 8px; }
.menu-btn { display: none; width: 46px; height: 46px; place-items: center; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); cursor: pointer; }
.menu-btn svg { width: 22px; height: 22px; }

.idle-warning {
  position: sticky; top: calc(var(--topbar-h) + env(safe-area-inset-top)); z-index: 49;
  padding: 10px var(--gutter); text-align: center; font-size: .92rem;
  background: #3b2a0c; color: #ffe2a8; border-bottom: 1px solid #6b4a12;
}

.main { min-height: calc(100dvh - var(--topbar-h) - 70px); }
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding: clamp(24px, 4vw, 48px) var(--gutter) 40px; display: flex; flex-direction: column; gap: clamp(18px, 2.4vw, 28px); }
.site-foot {
  display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; text-align: center;
  padding: 22px var(--gutter) max(22px, env(safe-area-inset-bottom)); color: var(--faint); font-size: .82rem; border-top: 1px solid var(--line-soft);
}
.site-foot svg { width: 16px; height: 16px; color: var(--accent); }

/* ---------- héroe / banner con efecto de expansión ---------- */
.hero, .banner { position: relative; overflow: hidden; isolation: isolate; display: flex; align-items: flex-end; }
.hero { height: clamp(420px, 78vh, 760px); }
.banner { height: clamp(260px, 46vh, 440px); }
.hero-media { position: absolute; inset: 0; z-index: -2; overflow: hidden; will-change: clip-path; }
.hero-media img { width: 100%; height: 100%; object-fit: cover; object-position: 70% 40%; transform-origin: 70% 40%; will-change: transform; }
.banner .hero-media img { object-position: 50% 45%; transform-origin: 50% 45%; }
.hero-shade { position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(180deg, rgb(13 15 20 / .15) 0%, rgb(13 15 20 / .35) 45%, var(--bg) 100%),
              radial-gradient(90% 70% at 15% 100%, rgb(13 15 20 / .75), transparent 70%); }
.hero-copy, .banner-copy { width: 100%; max-width: var(--maxw); margin-inline: auto; padding: 0 var(--gutter) clamp(32px, 6vw, 72px); }
.hero-copy h1 { font-size: clamp(2rem, 5.2vw + .6rem, 4.4rem); font-weight: 800; letter-spacing: -.03em; margin: 8px 0 14px; text-shadow: 0 4px 30px rgb(0 0 0 / .4); }
.hero-copy h1 em { font-style: normal; background: linear-gradient(90deg, var(--accent), #ffd29e); -webkit-background-clip: text; background-clip: text; color: transparent; }
.hero-copy p { color: #cfd5e1; font-size: clamp(.95rem, .6vw + .8rem, 1.1rem); }
.banner-copy { display: flex; align-items: center; gap: 16px; }
.banner-copy h1 { text-shadow: 0 4px 30px rgb(0 0 0 / .45); }
.eyebrow { display: inline-block; font-size: .78rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--accent); }

.badge-icon { display: grid; place-items: center; width: 52px; height: 52px; flex: none; border-radius: 16px; background: rgb(13 15 20 / .55); border: 1px solid rgb(255 255 255 / .14); color: var(--tone, var(--accent)); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.badge-icon svg { width: 26px; height: 26px; }
.tone-violet { --tone: var(--violet); }
.tone-rose { --tone: var(--rose); }
.tone-amber { --tone: var(--amber); }
.tone-green { --tone: var(--green); }
.banner .eyebrow { color: var(--tone); }

/* ---------- inicio ---------- */
.section-head { display: flex; flex-direction: column; gap: 6px; }
.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 270px), 1fr)); gap: clamp(14px, 2vw, 22px); }
.panel-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden; color: var(--text);
  background: var(--surface); border: 1px solid var(--line-soft); border-radius: 22px;
  transition: transform .35s cubic-bezier(.2, .8, .2, 1), border-color .3s, box-shadow .35s;
}
.panel-card:hover { text-decoration: none; transform: translateY(-4px); border-color: color-mix(in srgb, var(--tone) 45%, transparent); box-shadow: 0 26px 60px -28px color-mix(in srgb, var(--tone) 60%, transparent); }
.panel-card-media { position: relative; aspect-ratio: 16 / 10; overflow: hidden; }
.panel-card-media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 40%, var(--surface)); }
.panel-card-media img { width: 100%; height: 100%; object-fit: cover; transform: scale(1.15); will-change: transform; }
.panel-card-body { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 0 20px 20px; margin-top: -30px; }
.panel-card .badge-icon { width: 48px; height: 48px; margin-bottom: 6px; background: var(--surface-2); }
.panel-card .eyebrow { color: var(--tone); }
.panel-card h3 { font-size: 1.3rem; }
.stats { display: flex; gap: 14px; color: var(--muted); font-size: .92rem; }
.stats b { color: var(--text); font-size: 1.05rem; }
.go { position: absolute; right: 18px; bottom: 18px; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--tone); transition: transform .3s, background .3s; }
.go svg { width: 20px; height: 20px; }
.panel-card:hover .go { transform: translateX(4px); background: color-mix(in srgb, var(--tone) 20%, var(--surface-2)); }
.trust { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); gap: 14px; margin-top: 10px; }
.trust > div { padding: 20px; border-radius: var(--radius); background: linear-gradient(160deg, var(--surface), var(--bg-2)); border: 1px solid var(--line-soft); }
.trust svg { width: 26px; height: 26px; color: var(--accent); margin-bottom: 10px; }
.trust h4 { margin-bottom: 6px; font-size: 1rem; }
.trust p { color: var(--muted); font-size: .92rem; }

/* ---------- tarjetas genéricas ---------- */
.card { background: var(--surface); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: clamp(16px, 2.5vw, 24px); min-width: 0; }
.page-head { display: flex; flex-direction: column; gap: 4px; }
.pill { display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 7px; border-radius: 99px; background: var(--line); color: var(--text); font-size: .76rem; font-weight: 700; }
.tag { display: inline-block; padding: 2px 9px; border-radius: 99px; background: color-mix(in srgb, var(--tone, var(--accent)) 14%, transparent); color: var(--tone, var(--accent)); font-size: .78rem; font-weight: 600; white-space: nowrap; }

/* ---------- pestañas ---------- */
.tabs { display: flex; gap: 6px; padding: 5px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line-soft); width: fit-content; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { display: flex; align-items: center; gap: 8px; padding: 10px 16px; border-radius: 10px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tabs a svg { width: 18px; height: 18px; }
.tabs a:hover { color: var(--text); text-decoration: none; }
.tabs a.on { background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
#panel-body { display: flex; flex-direction: column; gap: 18px; }

/* ---------- subida ---------- */
.upload { display: grid; grid-template-columns: 1fr; gap: 16px; }
.drop {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 150px; padding: 22px; text-align: center; cursor: pointer;
  border: 2px dashed var(--line); border-radius: 16px; background: var(--bg-2);
  transition: border-color .2s, background .2s;
}
.drop:hover, .drop.over { border-color: var(--accent); background: rgb(255 165 82 / .06); }
.drop.has-files { border-style: solid; border-color: rgb(255 165 82 / .5); }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; min-height: 0; }
.drop-icon { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: rgb(255 165 82 / .12); color: var(--accent); }
.drop-icon svg { width: 24px; height: 24px; }
.drop-files { max-width: 100%; overflow-wrap: anywhere; }
.upload-fields { display: grid; grid-template-columns: 1fr; gap: 12px; align-items: end; }
.progress { display: flex; flex-direction: column; gap: 6px; }
.bar { height: 8px; border-radius: 99px; background: var(--line-soft); overflow: hidden; }
.bar.thin { height: 6px; margin: 6px 0 2px; }
.bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .25s; }

/* ---------- filtros y lista de documentos ---------- */
.filters { display: flex; flex-direction: column; gap: 12px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.chip { flex: none; padding: 8px 14px; min-height: 38px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--muted); font: 600 .86rem var(--font); cursor: pointer; white-space: nowrap; }
.chip:hover { color: var(--text); }
.chip.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }

.doc-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.doc {
  display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px 14px; align-items: center;
  padding: 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line-soft);
  transition: border-color .2s, background .2s;
}
.doc:hover { border-color: var(--line); background: #1a1f2a; }
.doc.broken { border-color: rgb(248 113 113 / .4); }
.ext { display: grid; place-items: center; width: 50px; height: 56px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); font: 800 .7rem var(--mono); text-transform: uppercase; color: var(--muted); }
.ext-pdf { color: #ff8a80; } .ext-jpg, .ext-jpeg, .ext-png, .ext-webp, .ext-heic, .ext-gif { color: var(--green); }
.ext-doc, .ext-docx, .ext-odt, .ext-rtf, .ext-txt { color: #8ab4ff; } .ext-xls, .ext-xlsx, .ext-csv, .ext-ods { color: var(--ok); }
.doc-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.doc-name { overflow-wrap: anywhere; line-height: 1.3; }
.doc-desc { overflow-wrap: anywhere; }
.doc-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; color: var(--faint); font-size: .82rem; }
.doc-actions { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
.empty, .empty-filter { text-align: center; padding: 44px 20px; border: 1px dashed var(--line); border-radius: var(--radius); color: var(--muted); }
.empty svg { width: 38px; height: 38px; margin: 0 auto 12px; color: var(--faint); }

/* ---------- notas ---------- */
.notes-head { gap: 14px; }
.notes-head p { flex: 1 1 260px; }
.note-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 14px; }
.note { display: flex; flex-direction: column; gap: 12px; }
.note header { display: flex; flex-direction: column; gap: 2px; }
.note-body {
  margin: 0; padding: 12px; min-height: 64px; max-height: 260px; overflow: auto;
  border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line-soft);
  font: 14px/1.55 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
  transition: filter .25s;
}
.note-body.hidden-body { filter: blur(7px); user-select: none; pointer-events: none; max-height: 90px; overflow: hidden; }
.note-actions { display: flex; gap: 8px; align-items: center; margin-top: auto; }
.note-actions .btn { margin-right: auto; }

/* ---------- seguridad ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 210px), 1fr)); gap: 14px; }
.kpi { display: flex; flex-direction: column; gap: 4px; }
.kpi b { font-size: clamp(1.6rem, 2vw + 1rem, 2.1rem); line-height: 1.1; }
.kpi b.kpi-sm { font-size: 1.05rem; line-height: 1.3; }
.kpi.bad { border-color: rgb(248 113 113 / .45); } .kpi.bad b { color: var(--danger); }
.kpi.good b { color: var(--ok); }
.sec-grid { display: grid; grid-template-columns: 1fr; gap: 18px; align-items: start; }
.table-wrap { width: 100%; overflow-x: auto; margin-top: 12px; -webkit-overflow-scrolling: touch; }
.audit { width: 100%; border-collapse: collapse; font-size: .9rem; }
.audit th { text-align: left; color: var(--faint); font-weight: 600; font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.audit td { padding: 10px 12px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.audit tr.alert td:nth-child(2) { color: var(--danger); font-weight: 600; }

/* ---------- modales y avisos ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgb(5 6 9 / .72); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; transition: opacity .2s; overflow-y: auto;
}
.modal-backdrop.in { opacity: 1; }
.modal {
  position: relative; width: 100%; max-width: 460px; max-height: calc(100dvh - 32px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 14px; padding: clamp(20px, 4vw, 28px);
  background: var(--surface); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow);
  transform: translateY(14px) scale(.98); transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}
.modal.wide { max-width: 860px; }
.modal-backdrop.in .modal { transform: none; }
.modal h2 { padding-right: 44px; }
.modal-x { position: absolute; top: 12px; right: 12px; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 10px; background: transparent; color: var(--muted); cursor: pointer; }
.modal-x:hover { background: var(--surface-2); color: var(--text); }
.modal-x svg { width: 20px; height: 20px; }
.preview { border-radius: 14px; overflow: hidden; background: #000; display: grid; place-items: center; }
.preview img { max-height: 70dvh; width: auto; object-fit: contain; }
.preview.pdf { background: var(--bg-2); }
.preview iframe { width: 100%; height: 70dvh; border: 0; background: #fff; }

#toasts { position: fixed; z-index: 200; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 32px)); pointer-events: none; }
.toast { padding: 12px 16px; border-radius: 14px; background: #232938; border: 1px solid var(--line); box-shadow: var(--shadow); font-size: .92rem; animation: toast-in .3s ease-out; transition: opacity .4s, transform .4s; }
.toast.ok { border-color: rgb(74 222 128 / .45); }
.toast.warn { border-color: rgb(251 191 36 / .5); }
.toast.error { border-color: rgb(248 113 113 / .55); background: #2d1d22; }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ==========================================================================
   Responsive
   ========================================================================== */

/* Teléfonos y tablets verticales: menú desplegable */
@media (max-width: 1099px) {
  .menu-btn { display: grid; }
  .nav {
    position: fixed; left: 0; right: 0; top: calc(var(--topbar-h) + env(safe-area-inset-top)); bottom: 0;
    flex-direction: column; align-items: stretch; gap: 4px;
    padding: 16px var(--gutter) max(24px, env(safe-area-inset-bottom));
    background: rgb(13 15 20 / .97); -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    overflow-y: auto; visibility: hidden; opacity: 0; transform: translateY(-8px);
    transition: opacity .2s, transform .2s, visibility 0s .2s;
  }
  .nav.open { visibility: visible; opacity: 1; transform: none; transition: opacity .2s, transform .2s; }
  .nav a { padding: 14px 16px; font-size: 1.05rem; border-radius: 12px; }
  .nav-logout { margin: 12px 0 0; min-height: 50px; }
}

@media (min-width: 480px) {
  .doc { grid-template-columns: auto minmax(0, 1fr) auto; }
  .doc-actions { grid-column: auto; }
}

@media (min-width: 720px) {
  .upload-fields { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
  .filters { flex-direction: row; align-items: center; }
  .filters input { max-width: 340px; flex: none; }
  .chips { flex-wrap: wrap; overflow: visible; }
  .doc { padding: 14px 18px; }
}

@media (min-width: 960px) {
  .sec-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .panel-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
  .panel-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .panel-card-media { aspect-ratio: 4 / 5; }
}

/* Tabla de auditoría como tarjetas en pantallas pequeñas */
@media (max-width: 719px) {
  .audit thead { display: none; }
  .audit, .audit tbody, .audit tr, .audit td { display: block; width: 100%; }
  .audit tr { padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
  .audit td { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 10px; padding: 3px 0; border: 0; }
  .audit td::before { content: attr(data-label); color: var(--faint); font-size: .76rem; text-transform: uppercase; letter-spacing: .05em; padding-top: 2px; }
  .audit td:empty, .audit td[data-label="Detalle"]:empty { display: none; }
  .row.end .btn { flex: 1 1 auto; }
  .modal { border-radius: 20px; }
  .banner-copy { gap: 12px; }
  .badge-icon { width: 44px; height: 44px; border-radius: 13px; }
}

/* Pantallas bajas en horizontal (teléfonos girados) */
@media (max-height: 520px) and (orientation: landscape) {
  .hero { height: 100svh; min-height: 320px; }
  .banner { height: 70svh; min-height: 220px; }
  .auth-scene { place-items: start center; }
}

@media (hover: none) {
  .panel-card:hover { transform: none; }
}

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

/* ---------- app para iPhone ---------- */
.ios-btn { margin-inline: auto; }
.site-foot .ios-btn { margin: 0 0 0 8px; }
.ios-card h2 { display: flex; align-items: center; gap: 8px; }
.ios-card h2 svg, .modal h2 svg { width: 22px; height: 22px; color: var(--accent); flex: none; }
.modal h2 { display: flex; align-items: center; gap: 8px; }
.ios-steps li { line-height: 1.5; }
.ios-steps code { padding: 1px 6px; border-radius: 6px; background: var(--bg-2); font-size: .88em; }
html.native .topbar { padding-top: max(env(safe-area-inset-top), 12px); }

/* ---------- resultado de subida ---------- */
.drop.busy { opacity: .6; pointer-events: none; }
.upload-results { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.upload-results li { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 12px; font-size: .9rem; border: 1px solid var(--line); background: var(--bg-2); }
.upload-results li.ok { border-color: rgb(74 222 128 / .4); }
.upload-results li.ok span { color: var(--ok); }
.upload-results li.bad { border-color: rgb(248 113 113 / .45); background: rgb(248 113 113 / .08); }
.upload-results li.bad span { color: #ffc4c4; }
@media (hover: none) { .hide-touch { display: none; } }
