/* BLDER & BRWN.co · Portal documental
   C-04: sistema industrial, Arial, colores de marca (C-01).
   C-05: ventanas flotantes; sin emojis, íconos mínimos.
   C-07: "Liquid Glass" estilo Apple + composición adaptable (sin desbordes, acceso sin scroll). */

:root {
  --navy: #0f2245;
  --navy-2: #1d3a6e;
  --navy-3: #3a5f9e;
  --copper: #9a6424;
  --copper-2: #c08a43;
  --ink: #101828;
  --text: #2f3747;
  --muted: #687089;
  --hair: rgba(16, 24, 40, .09);

  /* Liquid Glass */
  --lg-tint: rgba(255, 255, 255, .26);
  --lg-tint-strong: rgba(255, 255, 255, .48);
  --lg-sheen: linear-gradient(180deg, rgba(255,255,255,.42) 0%, rgba(255,255,255,.10) 42%, rgba(255,255,255,.16) 100%);
  --lg-rim:
    inset 0 1px 0 rgba(255,255,255,.95),
    inset 0 -1px 0 rgba(255,255,255,.35),
    inset 0 0 0 1px rgba(255,255,255,.42),
    inset 0 14px 22px -16px rgba(255,255,255,.95),
    inset 0 -16px 26px -18px rgba(96,104,150,.30);
  --lg-drop: 0 12px 32px -10px rgba(38,46,90,.26), 0 2px 6px rgba(38,46,90,.07);
  --blur: 22px;
  --sat: 190%;

  --ok: #157347;   --ok-bg: rgba(21, 115, 71, .12);
  --warn: #8a5a00; --warn-bg: rgba(214, 150, 20, .16);
  --bad: #b02a20;  --bad-bg: rgba(176, 42, 32, .11);
  --info: #1d4f9c; --info-bg: rgba(29, 79, 156, .10);

  --r-card: 26px;
  --r-inner: 18px;
  --spring: cubic-bezier(.32, .72, 0, 1);
  --spring-pop: cubic-bezier(.34, 1.4, .64, 1);
  --t-fast: 160ms;
  --t-med: 420ms;
  --gutter: clamp(12px, 3vw, 28px);
  --bar-h: 58px;
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
html, body { margin: 0; overflow-x: clip; }
body {
  min-height: 100dvh; display: flex; flex-direction: column;
  font-family: Arial, "Helvetica Neue", Helvetica, sans-serif;
  font-size: 14.5px; line-height: 1.45; color: var(--text);
  -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums;
  background-color: #eef0f7;
  background-image:
    radial-gradient(55vmax 45vmax at 8% -5%, rgba(178, 162, 232, .55), transparent 62%),
    radial-gradient(45vmax 40vmax at 100% 8%, rgba(246, 188, 206, .55), transparent 60%),
    radial-gradient(50vmax 40vmax at 85% 105%, rgba(192, 138, 67, .26), transparent 62%),
    radial-gradient(55vmax 45vmax at -5% 100%, rgba(58, 95, 158, .28), transparent 62%),
    linear-gradient(180deg, #f3f2f8 0%, #e9ebf4 100%);
  background-attachment: fixed;
}
body.modal-open { overflow: hidden; }
body::before {
  content: ""; position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background-image: linear-gradient(rgba(60,70,120,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(60,70,120,.07) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(120% 90% at 50% 0%, #000 30%, transparent 85%); mask-image: radial-gradient(120% 90% at 50% 0%, #000 30%, transparent 85%);
}

h1, h2, h3 { color: var(--ink); line-height: 1.15; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: clamp(1.3rem, 1.1rem + 1vw, 1.75rem); font-weight: 700; }
h2 { font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .13em; color: var(--navy-2); }
h3 { font-size: .95rem; font-weight: 700; }
a { color: var(--navy-2); }
p { margin: .25rem 0 .75rem; }
small, .muted { color: var(--muted); }
:focus-visible { outline: 2px solid var(--copper-2); outline-offset: 2px; }

/* ── Material Liquid Glass ── */
.lg, .card, .kpi, .list, .table-wrap, .doc, .topbar, .choice, .modal, .auth-card, .btn.ghost, .btn.bad, .nav, .facts, .dropzone {
  background-color: var(--lg-tint);
  background-image: var(--lg-sheen);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(var(--sat)) brightness(1.04);
  backdrop-filter: blur(var(--blur)) saturate(var(--sat)) brightness(1.04);
  box-shadow: var(--lg-rim), var(--lg-drop);
  border: 0;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  :root { --lg-tint: rgba(255,255,255,.88); --lg-tint-strong: rgba(255,255,255,.96); }
}
@media (max-width: 480px) { :root { --blur: 16px; } }
@media (prefers-reduced-transparency: reduce) { :root { --lg-tint: rgba(255,255,255,.94); --lg-tint-strong: #fff; --blur: 0px; } }

/* ── Barra superior: cápsula flotante ── */
.topbar {
  position: sticky; top: 10px; z-index: 20; flex: none;
  display: flex; align-items: center; gap: 12px;
  margin: 10px var(--gutter) 0; padding: 7px 7px 7px 18px; min-height: var(--bar-h);
  border-radius: 999px; background-color: rgba(255,255,255,.30);
  view-transition-name: topbar;
}
.brand { flex: none; font-weight: 700; letter-spacing: .04em; font-size: 1rem; color: var(--navy); text-decoration: none; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.brand::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #f2c48a, var(--copper)); box-shadow: 0 0 0 3px rgba(192,138,67,.22); }
.brand b { color: var(--copper); }
.nav {
  display: flex; gap: 2px; margin-left: auto; min-width: 0; overflow-x: auto; scrollbar-width: none;
  padding: 4px; border-radius: 999px; background-color: rgba(255,255,255,.18);
  box-shadow: inset 0 1px 2px rgba(60,70,120,.14), inset 0 0 0 1px rgba(255,255,255,.4);
}
.nav:empty { display: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--text); text-decoration: none; font-weight: 700; font-size: .68rem; text-transform: uppercase; letter-spacing: .08em;
  padding: 9px 14px; border-radius: 999px; white-space: nowrap;
  transition: background var(--t-fast) ease, color var(--t-fast) ease, transform var(--t-fast) var(--spring), box-shadow var(--t-fast) ease;
}
.nav a:hover { color: var(--navy); }
.nav a:active { transform: scale(.94); }
.nav a.active { color: var(--navy); background: rgba(255,255,255,.78); box-shadow: inset 0 1px 0 #fff, 0 1px 2px rgba(38,46,90,.12), 0 4px 12px -4px rgba(38,46,90,.25); }
@media (max-width: 480px) { .brand { font-size: .9rem; } .topbar { padding-left: 14px; } .nav a { padding: 8px 11px; font-size: .64rem; } }

/* ── Estructura ── */
main { flex: 1 0 auto; width: 100%; max-width: 1440px; margin: 0 auto; padding: 22px var(--gutter) 28px; }
.footer { flex: none; text-align: center; font-size: .64rem; color: var(--muted); padding: 10px 16px 16px; text-transform: uppercase; letter-spacing: .1em; }
.footer a { color: inherit; }

.card { border-radius: var(--r-card); padding: clamp(16px, 2.2vw, 22px); margin-bottom: 14px; }
.card > h2:first-child, .card > h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 12px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.accent-bar { position: relative; overflow: hidden; }
.accent-bar::before { content: ""; position: absolute; left: 0; top: 18px; bottom: 18px; width: 4px; border-radius: 0 4px 4px 0; background: linear-gradient(180deg, var(--copper-2), var(--copper)); }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } .grid-4 { grid-template-columns: repeat(4, 1fr); } }
@media (max-width: 719px) { .grid-4 { grid-template-columns: 1fr 1fr; } }

/* Expediente: dos columnas en escritorio ancho */
.exp-grid { display: grid; gap: 0 16px; }
@media (min-width: 1100px) {
  .exp-grid { grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); align-items: start; }
  .exp-side { position: sticky; top: calc(var(--bar-h) + 24px); }
}

/* Ficha de datos */
.facts { display: grid; gap: 1px; border-radius: var(--r-inner); overflow: hidden; background-color: rgba(255,255,255,.18); box-shadow: inset 0 0 0 1px rgba(255,255,255,.5), inset 0 1px 2px rgba(60,70,120,.08); }
@media (min-width: 560px) { .facts { grid-template-columns: 1fr 1fr; } }
.facts > div { background: rgba(255,255,255,.34); padding: 10px 14px; }
.facts small { display: block; font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 3px; }
.facts strong { color: var(--ink); font-weight: 700; word-break: break-word; }

/* ── Acceso: siempre cabe en pantalla, sin scroll de página ── */
body.auth main { display: grid; place-items: center; padding-top: 12px; padding-bottom: 8px; min-height: 0; }
.auth-wrap { width: 100%; display: grid; place-items: center; }
.auth-card {
  width: 100%; max-width: 440px; border-radius: 30px; overflow: hidden; display: flex; flex-direction: column;
  max-height: calc(100dvh - var(--bar-h) - 82px);
  background-color: rgba(255,255,255,.34);
}
.auth-hero { flex: none; padding: 22px 24px 16px; }
.auth-hero h1 { margin: 0; }
.auth-hero p { color: var(--muted); margin: .35rem 0 0; font-size: .9rem; }
.auth-hero .tag { display: inline-flex; align-items: center; gap: 6px; color: var(--copper); font-size: .64rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 8px; }
.auth-hero .tag::before { content: ""; width: 18px; height: 2px; border-radius: 2px; background: var(--copper); }
.auth-body { padding: 4px 24px 22px; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; }
@media (max-height: 720px) {
  .auth-hero { padding: 16px 20px 10px; } .auth-hero p { display: none; }
  .auth-body { padding: 2px 20px 16px; } .auth-body .field { margin-bottom: 10px; }
}

/* ── Formularios ── */
label { display: block; font-weight: 700; font-size: .64rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.field .hint { font-weight: 400; color: var(--muted); font-size: .78rem; margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=tel], input[type=number], input[type=date], input[type=search], select, textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: rgba(255,255,255,.42); border: 0; border-radius: 16px; padding: 12px 16px; min-height: 46px;
  box-shadow: inset 0 1px 3px rgba(60,70,120,.16), inset 0 0 0 1px rgba(255,255,255,.55), 0 1px 0 rgba(255,255,255,.7);
  -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px);
  transition: box-shadow var(--t-fast) ease, background var(--t-fast) ease;
}
textarea { border-radius: 18px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; background: rgba(255,255,255,.78); box-shadow: inset 0 1px 2px rgba(60,70,120,.12), 0 0 0 1px rgba(58,95,158,.55), 0 0 0 5px rgba(58,95,158,.16); }
input[readonly] { color: var(--muted); }
input.upper { text-transform: uppercase; letter-spacing: .04em; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 22px) 50%, calc(100% - 17px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 38px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; font-size: .85rem; text-transform: none; letter-spacing: 0; color: var(--text); }
.check input { width: 20px; height: 20px; margin-top: 1px; flex: none; accent-color: var(--navy); }

/* ── Botones en cápsula ──
   .btn: vidrio tintado azul marino. .copper: acción principal con relieve ("salido"). .ghost/.bad: vidrio claro. */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 700; font-size: .82rem; letter-spacing: .02em;
  border: 0; border-radius: 999px; padding: 11px 20px; min-height: 44px;
  cursor: pointer; text-decoration: none; white-space: nowrap; user-select: none; color: #fff;
  background:
    linear-gradient(180deg, rgba(255,255,255,.30) 0%, rgba(255,255,255,.04) 48%, rgba(255,255,255,0) 52%),
    linear-gradient(180deg, rgba(58,95,158,.94), rgba(15,34,69,.96));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), inset 0 0 0 1px rgba(255,255,255,.18), inset 0 -2px 6px rgba(0,0,0,.25), 0 8px 20px -8px rgba(15,34,69,.55), 0 2px 4px rgba(15,34,69,.15);
  transition: transform var(--t-fast) var(--spring), box-shadow var(--t-fast) var(--spring), filter var(--t-fast) ease;
}
.btn:hover { filter: brightness(1.08) saturate(1.05); }
.btn:active { transform: scale(.96); box-shadow: inset 0 1px 0 rgba(255,255,255,.4), inset 0 0 0 1px rgba(255,255,255,.15), inset 0 2px 8px rgba(0,0,0,.3), 0 3px 8px -4px rgba(15,34,69,.5); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; filter: grayscale(.3); }
.btn.copper {
  margin-bottom: 4px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.38) 0%, rgba(255,255,255,.06) 48%, rgba(255,255,255,0) 52%),
    linear-gradient(180deg, #d8a35d, var(--copper));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.7), inset 0 0 0 1px rgba(255,255,255,.2), 0 4px 0 #6f4415, 0 10px 22px -8px rgba(154,100,36,.6);
}
.btn.copper:active { transform: translateY(4px) scale(.985); box-shadow: inset 0 1px 0 rgba(255,255,255,.5), inset 0 2px 6px rgba(0,0,0,.2), 0 0 0 #6f4415, 0 3px 8px -4px rgba(154,100,36,.5); }
.btn.ok {
  background: linear-gradient(180deg, rgba(255,255,255,.3) 0%, rgba(255,255,255,.04) 48%, rgba(255,255,255,0) 52%), linear-gradient(180deg, #2fa36a, var(--ok));
  box-shadow: inset 0 1px 0 rgba(255,255,255,.55), inset 0 0 0 1px rgba(255,255,255,.18), 0 8px 18px -8px rgba(21,115,71,.6);
}
.btn.ghost, .btn.bad { color: var(--navy); background-color: rgba(255,255,255,.34); }
.btn.ghost:hover, .btn.bad:hover { background-color: rgba(255,255,255,.55); filter: none; }
.btn.ghost:active, .btn.bad:active { transform: scale(.95); }
.btn.bad { color: var(--bad); }
.btn.sm { min-height: 36px; padding: 7px 15px; font-size: .76rem; }
.btn.block { width: 100%; }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--navy-2); text-decoration: underline; cursor: pointer; }

/* Selector de tipo de registro (único lugar con íconos) */
.choices { display: grid; gap: 10px; }
.choice {
  display: flex; gap: 14px; align-items: center; text-align: left; width: 100%;
  border-radius: 22px; padding: 14px 16px; cursor: pointer; font: inherit; color: var(--text);
  transition: transform var(--t-med) var(--spring), background-color var(--t-fast) ease;
}
.choice:hover { transform: translateY(-2px); background-color: rgba(255,255,255,.5); }
.choice:active { transform: scale(.98); transition-duration: var(--t-fast); }
.choice .ico { width: 44px; height: 44px; border-radius: 50%; color: #fff; display: grid; place-items: center; flex: none; background: linear-gradient(180deg, rgba(255,255,255,.3), rgba(255,255,255,0) 50%), linear-gradient(180deg, var(--navy-3), var(--navy)); box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 6px 14px -6px rgba(15,34,69,.6); }
.choice strong { display: block; color: var(--ink); font-size: .95rem; margin-bottom: 2px; }

/* ── Estados ── */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; padding: 5px 10px; border-radius: 999px; white-space: nowrap; box-shadow: inset 0 0 0 1px currentColor, inset 0 1px 0 rgba(255,255,255,.6); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-aprobado, .b-activo { color: var(--ok); background: var(--ok-bg); }
.b-rechazado, .b-suspendido, .b-vencido { color: var(--bad); background: var(--bad-bg); }
.b-en_revision, .b-cargado, .b-pendiente { color: var(--warn); background: var(--warn-bg); }
.b-en_revision::before, .b-cargado::before, .b-pendiente::before { animation: pulse 1.6s ease-in-out infinite; }
.b-incompleto, .b-falta { color: var(--muted); background: rgba(104,112,137,.10); }
.b-info { color: var(--info); background: var(--info-bg); }
@keyframes pulse { 50% { opacity: .35; } }

.progress { height: 8px; background: rgba(60,70,120,.12); border-radius: 99px; overflow: hidden; box-shadow: inset 0 1px 2px rgba(60,70,120,.2); }
.progress > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(180deg, rgba(255,255,255,.45), rgba(255,255,255,0) 60%), linear-gradient(90deg, var(--copper), var(--copper-2)); transform-origin: left; animation: grow .9s var(--spring) both; }
@keyframes grow { from { transform: scaleX(0); } }

/* ── Indicadores ── */
.kpi { border-radius: 22px; padding: 16px 18px; position: relative; overflow: hidden; }
.kpi b { display: block; font-size: clamp(1.6rem, 1.3rem + 1vw, 2.1rem); color: var(--ink); line-height: 1; letter-spacing: -.02em; margin-bottom: 6px; }
.kpi span { font-size: .6rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .1em; }

/* ── Documentos ── */
.doc { border-radius: var(--r-inner); padding: 14px 16px; background-color: rgba(255,255,255,.2); box-shadow: var(--lg-rim), 0 4px 14px -8px rgba(38,46,90,.2); }
.doc + .doc { margin-top: 10px; }
.doc-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.doc-title { font-weight: 700; color: var(--ink); }
.doc-meta { font-size: .76rem; color: var(--muted); margin-top: 3px; }
.doc-note { position: relative; margin-top: 10px; padding-left: 16px; color: var(--bad); font-size: .82rem; }
.doc-note::before { content: ""; position: absolute; left: 0; top: .5em; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.doc-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: flex-start; }
.dropzone { padding: 16px; border-radius: 20px; background-color: rgba(255,255,255,.2); }
.preview { display: flex; gap: 12px; align-items: center; margin: 12px 0 0; animation: pop var(--t-med) var(--spring-pop) both; }
.preview img { width: 84px; height: 84px; object-fit: cover; border-radius: 16px; box-shadow: inset 0 0 0 1px rgba(255,255,255,.6), 0 6px 14px -6px rgba(38,46,90,.4); background: #fff; }
.preview .pdf { width: 84px; height: 84px; border-radius: 16px; background: linear-gradient(180deg, rgba(255,255,255,.28), rgba(255,255,255,0) 50%), linear-gradient(160deg, var(--navy-3), var(--navy)); color: #fff; display: grid; place-items: center; font-weight: 700; letter-spacing: .1em; box-shadow: 0 6px 14px -6px rgba(15,34,69,.6); }

/* ── Listas y tablas ── */
.list { border-radius: var(--r-inner); overflow: hidden; background-color: rgba(255,255,255,.2); }
.item { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.45); text-decoration: none; color: inherit; transition: background var(--t-fast) ease, transform var(--t-fast) var(--spring); }
.item:first-child { border-top: 0; }
a.item:hover { background: rgba(255,255,255,.4); }
a.item:active { transform: scale(.99); background: rgba(255,255,255,.55); }
a.item::after { content: "›"; color: var(--muted); font-size: 1.3rem; line-height: 1; margin-left: 4px; }
.item .grow { flex: 1; min-width: 0; }
.item .title { font-weight: 700; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .sub { font-size: .76rem; color: var(--muted); }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 700; font-size: .7rem; letter-spacing: .04em; color: #fff; background: linear-gradient(180deg, rgba(255,255,255,.3), rgba(255,255,255,0) 50%), linear-gradient(160deg, var(--navy-3), var(--navy)); box-shadow: inset 0 1px 0 rgba(255,255,255,.5), 0 4px 10px -4px rgba(15,34,69,.5); }
.avatar.unit { background: linear-gradient(180deg, rgba(255,255,255,.35), rgba(255,255,255,0) 50%), linear-gradient(160deg, var(--copper-2), var(--copper)); }
.table-wrap { overflow-x: auto; border-radius: var(--r-inner); background-color: rgba(255,255,255,.2); }
table { width: 100%; border-collapse: collapse; font-size: .82rem; }
th, td { text-align: left; padding: 11px 14px; border-top: 1px solid rgba(255,255,255,.45); vertical-align: top; }
th { border-top: 0; background: rgba(255,255,255,.25); color: var(--muted); font-weight: 700; font-size: .6rem; text-transform: uppercase; letter-spacing: .1em; white-space: nowrap; }
tbody tr { transition: background var(--t-fast) ease; }
tbody tr:hover { background: rgba(255,255,255,.35); }

.filters { display: grid; gap: 10px; grid-template-columns: 1fr; margin-bottom: 14px; }
@media (min-width: 720px) { .filters { grid-template-columns: 2fr 1fr 1fr auto; } }

.empty { text-align: center; padding: 30px 16px; color: var(--muted); }
/* Avisos: línea de texto sobria con punto de color, sin cajas de color (C-07) */
.notice { position: relative; padding: 0 0 0 16px; margin: 0 0 14px; font-size: .84rem; color: var(--info); background: none; box-shadow: none; }
.notice::before { content: ""; position: absolute; left: 0; top: .5em; width: 7px; height: 7px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 3px rgba(255,255,255,.6); }
.notice.warn { color: var(--warn); }
.notice.bad { color: var(--bad); }
.copybox { display: flex; gap: 8px; align-items: flex-start; }
.copybox input { font-size: .8rem; }
.crumbs { font-size: .68rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 10px; }
.crumbs a { text-decoration: none; }

/* ── Ventanas flotantes (C-05) ── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px;
  background: rgba(40, 46, 80, .16);
  -webkit-backdrop-filter: blur(18px) saturate(150%); backdrop-filter: blur(18px) saturate(150%);
  animation: fadeIn 280ms ease both;
}
.modal {
  width: min(580px, 100%); max-height: calc(100dvh - 40px); display: flex; flex-direction: column;
  border-radius: 30px; background-color: rgba(255,255,255,.52);
  --blur: 40px; --sat: 200%;
  box-shadow: var(--lg-rim), 0 30px 80px -20px rgba(38,46,90,.45), 0 8px 20px rgba(38,46,90,.12);
  animation: modalIn 520ms var(--spring-pop) both;
}
.modal > .modal-form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 16px 12px 24px; }
.modal-head h3 { margin: 0; font-size: 1.05rem; }
.modal-head small { display: block; font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .12em; color: var(--copper); margin-bottom: 3px; }
.modal-x { width: 32px; height: 32px; flex: none; border-radius: 50%; border: 0; cursor: pointer; font: inherit; font-size: 18px; line-height: 1; color: var(--muted); background: rgba(255,255,255,.45); box-shadow: inset 0 1px 0 #fff, inset 0 0 0 1px rgba(255,255,255,.5), 0 2px 6px -2px rgba(38,46,90,.25); transition: transform var(--t-fast) var(--spring); }
.modal-x:hover { color: var(--ink); }
.modal-x:active { transform: scale(.88); }
.modal-body { padding: 4px 24px 18px; overflow-y: auto; overscroll-behavior: contain; }
.modal-foot { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; padding: 12px 20px 18px; }
.modal-backdrop.out { animation: fadeOut 220ms ease both; }
.modal-backdrop.out .modal { animation: modalOut 220ms var(--spring) both; }
@media (max-width: 600px) {
  .modal-backdrop { place-items: end center; padding: 8px; }
  .modal { width: 100%; max-height: 90dvh; border-radius: 30px; animation-name: sheetIn; animation-timing-function: var(--spring); }
  .modal::before { content: ""; width: 40px; height: 5px; border-radius: 3px; background: rgba(60,70,120,.25); margin: 10px auto 0; flex: none; }
  .modal-foot { padding-bottom: max(16px, env(safe-area-inset-bottom)); }
  .modal-foot .btn { flex: 1; }
  .modal-backdrop.out .modal { animation-name: sheetOut; }
}
@keyframes fadeIn { from { opacity: 0; } }
@keyframes fadeOut { to { opacity: 0; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(18px) scale(.92); } }
@keyframes modalOut { to { opacity: 0; transform: scale(.95); } }
@keyframes sheetIn { from { transform: translateY(105%); } }
@keyframes sheetOut { to { transform: translateY(105%); } }

/* ── Avisos flotantes ── */
#toast { position: fixed; left: 50%; bottom: max(20px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; display: grid; gap: 8px; width: min(92vw, 440px); }
.toast { padding: 13px 20px; border-radius: 999px; font-size: .85rem; font-weight: 700; color: #fff; text-align: center;
  background: linear-gradient(180deg, rgba(255,255,255,.18), rgba(255,255,255,0) 50%), rgba(22, 28, 48, .72);
  -webkit-backdrop-filter: blur(20px) saturate(180%); backdrop-filter: blur(20px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), inset 0 0 0 1px rgba(255,255,255,.12), 0 14px 34px -10px rgba(20,24,48,.5);
  animation: toastIn var(--t-med) var(--spring-pop) both; }
.toast.err { background-color: rgba(150, 30, 22, .78); }
.toast.ok { background-color: rgba(14, 92, 56, .76); }
@keyframes toastIn { from { opacity: 0; transform: translateY(24px) scale(.92); } }

.spinner { width: 26px; height: 26px; border: 2.5px solid rgba(60,70,120,.18); border-top-color: var(--navy); border-radius: 50%; animation: spin .7s linear infinite; margin: 48px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.legal h2 { margin-top: 1.4rem; }

/* ── Movimiento estilo Apple ── */
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }
@keyframes pop { from { opacity: 0; transform: scale(.9); } }
main > *, .auth-card, .grid > .kpi, .list > .item, .doc { animation: rise var(--t-med) var(--spring) both; }
main > *:nth-child(2) { animation-delay: 40ms; }  main > *:nth-child(3) { animation-delay: 80ms; }
main > *:nth-child(4) { animation-delay: 120ms; } main > *:nth-child(n+5) { animation-delay: 160ms; }
.grid > .kpi:nth-child(2) { animation-delay: 60ms; } .grid > .kpi:nth-child(3) { animation-delay: 120ms; } .grid > .kpi:nth-child(4) { animation-delay: 180ms; }
.list > .item:nth-child(2) { animation-delay: 30ms; } .list > .item:nth-child(3) { animation-delay: 60ms; }
.list > .item:nth-child(4) { animation-delay: 90ms; } .list > .item:nth-child(n+5) { animation-delay: 120ms; }
.doc:nth-child(3) { animation-delay: 40ms; } .doc:nth-child(4) { animation-delay: 80ms; } .doc:nth-child(n+5) { animation-delay: 120ms; }

::view-transition-old(root) { animation: vtOut 200ms var(--spring) both; }
::view-transition-new(root) { animation: vtIn 420ms var(--spring) both; }
@keyframes vtOut { to { opacity: 0; transform: scale(.985); } }
@keyframes vtIn { from { opacity: 0; transform: scale(1.012); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after, ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; transition: none !important; }
}
@media print { .topbar, .doc-actions, .btn, .modal-backdrop { display: none !important; } body { background: #fff; } body::before { display: none; } }

/* ── Menú de hamburguesa (C-08) ── */
.menu-btn { display: none; }
@media (max-width: 859px) {
  .menu-btn:not([hidden]) {
    display: grid; place-items: center; gap: 0; margin-left: auto; flex: none;
    width: 44px; height: 44px; border: 0; border-radius: 50%; cursor: pointer; padding: 0;
    background: rgba(255,255,255,.45); box-shadow: inset 0 1px 0 #fff, inset 0 0 0 1px rgba(255,255,255,.5), 0 4px 12px -4px rgba(38,46,90,.3);
    transition: transform var(--t-fast) var(--spring), background var(--t-fast) ease;
  }
  .menu-btn:active { transform: scale(.9); }
  .menu-btn span { grid-area: 1 / 1; display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--navy); transition: transform var(--t-med) var(--spring), opacity var(--t-fast) ease; }
  .menu-btn span:nth-child(1) { transform: translateY(-6px); }
  .menu-btn span:nth-child(3) { transform: translateY(6px); }
  .topbar.open .menu-btn span:nth-child(1) { transform: rotate(45deg); }
  .topbar.open .menu-btn span:nth-child(2) { opacity: 0; transform: scaleX(.2); }
  .topbar.open .menu-btn span:nth-child(3) { transform: rotate(-45deg); }

  .nav {
    position: absolute; top: calc(100% + 10px); left: 0; right: 0; margin: 0;
    flex-direction: column; gap: 4px; padding: 10px; border-radius: 28px; overflow: visible;
    background-color: rgba(250,250,253,.86);
    -webkit-backdrop-filter: blur(40px) saturate(200%); backdrop-filter: blur(40px) saturate(200%);
    box-shadow: var(--lg-rim), 0 24px 60px -18px rgba(38,46,90,.45);
    opacity: 0; visibility: hidden; transform: translateY(-10px) scale(.96); transform-origin: top right;
    transition: opacity 220ms ease, transform var(--t-med) var(--spring), visibility 0s linear 220ms;
  }
  .topbar.open .nav { opacity: 1; visibility: visible; transform: none; transition: opacity 220ms ease, transform var(--t-med) var(--spring-pop), visibility 0s; }
  .nav a { padding: 15px 18px; font-size: .76rem; border-radius: 18px; }
  .nav a.active { background: rgba(255,255,255,.9); }
}

/* ── Tablas como tarjetas en celular (C-08) ── */
@media (max-width: 719px) {
  .table-wrap { overflow-x: visible; }
  table.stack thead { display: none; }
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
  table.stack tr { padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.5); }
  table.stack tbody tr:first-child { border-top: 0; }
  table.stack td { display: grid; grid-template-columns: minmax(72px, auto) minmax(0, 1fr); column-gap: 14px; align-items: start; padding: 5px 0; border: 0; text-align: right; }
  table.stack td > * { grid-column: 2; justify-self: end; }
  table.stack td::before { content: attr(data-label); grid-column: 1; grid-row: 1 / span 4; padding-top: 2px; text-align: left; font-size: .6rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
  table.stack td[data-label=""] { grid-template-columns: 1fr; text-align: left; padding-top: 10px; }
  table.stack td[data-label=""] > * { grid-column: 1; justify-self: stretch; }
  table.stack td[data-label=""]::before { display: none; }
  table.stack td .row { justify-content: flex-start; }
}
