/* =========================================================
   SGP · Diseño sólido, dinámico y animado
   Variables personalizables en Mantenimiento: --primary, --secondary,
   --accent, --bg, --font, --text. El tono (claro/oscuro) se ajusta solo.
   ========================================================= */
@font-face { font-family: "Poppins"; src: url(../fonts/poppins-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Poppins"; src: url(../fonts/poppins-latin-600-normal.woff2) format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Poppins"; src: url(../fonts/poppins-latin-800-normal.woff2) format("woff2"); font-weight: 800 900; font-display: swap; }
@font-face { font-family: "Inter"; src: url(../fonts/inter-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Inter"; src: url(../fonts/inter-latin-600-normal.woff2) format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url(../fonts/inter-latin-800-normal.woff2) format("woff2"); font-weight: 800 900; font-display: swap; }
@font-face { font-family: "Nunito"; src: url(../fonts/nunito-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Nunito"; src: url(../fonts/nunito-latin-600-normal.woff2) format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Nunito"; src: url(../fonts/nunito-latin-800-normal.woff2) format("woff2"); font-weight: 800 900; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url(../fonts/montserrat-latin-400-normal.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url(../fonts/montserrat-latin-600-normal.woff2) format("woff2"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url(../fonts/montserrat-latin-800-normal.woff2) format("woff2"); font-weight: 800 900; font-display: swap; }

:root {
  --primary: #f0b57b; --secondary: #f1d5ca; --accent: #afcbbf; --mint: #d9efe2; --cream: #f4ede5;
  --bg: #ccc2c0;
  --font: "Poppins", "Segoe UI", system-ui, sans-serif;
  /* Tono claro (por defecto) */
  --text: #3f3a39; --text-2: color-mix(in srgb, var(--text) 82%, var(--primary));
  --muted: color-mix(in srgb, var(--text) 62%, transparent);
  --ink: 63 58 57;
  --surface: #faf6f2; --surface-2: #f2ebe5; --line: rgb(var(--ink) / .1);
  --field: #fffdfb; --field-focus: #fff; --option-bg: #faf6f2;
  --chip: rgb(var(--ink) / .07); --on-primary: #3f3a39;
  --link: color-mix(in srgb, var(--primary) 38%, #4a3a30);
  --ok: #3f8a63; --warn: #b7711f; --err: #c0505f; --info: #4f7fa8;
  --radius: 18px; --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(63, 48, 40, .06), 0 8px 24px -12px rgba(63, 48, 40, .28);
  --shadow-hover: 0 2px 4px rgba(63, 48, 40, .06), 0 18px 36px -14px rgba(63, 48, 40, .38);
  --ease: cubic-bezier(.2, .8, .2, 1); --spring: cubic-bezier(.34, 1.56, .64, 1);
  --band-h: 54px; --nav-w: 272px; --nav-w-min: 74px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font); color: var(--text); background: var(--bg);
  line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 .5em; font-weight: 700; }
code, .mono { font-family: ui-monospace, Consolas, monospace; }
.mono { letter-spacing: .03em; }
.muted { color: var(--muted); } .small { font-size: .85rem; } .center-text { text-align: center; }
.row { display: flex; align-items: center; flex-wrap: wrap; } .gap { gap: .75rem; }
.inline { display: inline; margin: 0; } .right { margin-left: auto; }
.hide, [hidden] { display: none !important; }
.m0 { margin: 0; } .mt { margin-top: 1rem; } .grow { flex: 1; min-width: 0; }
.pre { white-space: pre-wrap; } .txt-err { color: var(--err); } .span-all { grid-column: 1 / -1; }
.w-xs { max-width: 72px; } .w-sm { max-width: 150px; } .w-md { max-width: 260px; }

/* ---------- Superficies (antes "glass": ahora tarjetas sólidas) ---------- */
.glass {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: box-shadow .3s var(--ease), transform .3s var(--ease);
}
.card { padding: 1.3rem; }
.blobs { display: none; }

/* ---------- Animaciones ---------- */
.fade-up { animation: fadeup .55s var(--ease) both; }
@keyframes fadeup { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
.stagger > * { animation: pop .55s var(--spring) both; }
.stagger > *:nth-child(2) { animation-delay: .05s; } .stagger > *:nth-child(3) { animation-delay: .1s; }
.stagger > *:nth-child(4) { animation-delay: .15s; } .stagger > *:nth-child(5) { animation-delay: .2s; }
.stagger > *:nth-child(6) { animation-delay: .25s; } .stagger > *:nth-child(7) { animation-delay: .3s; }
.stagger > *:nth-child(8) { animation-delay: .35s; } .stagger > *:nth-child(n+9) { animation-delay: .4s; }

/* ---------- Banda superior: versículo · título · usuario ---------- */
.topband {
  position: fixed; inset: 0 0 auto 0; z-index: 60; height: var(--band-h);
  display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; gap: 1rem;
  padding: 0 1rem; color: var(--on-primary);
  background: linear-gradient(100deg, var(--primary), color-mix(in srgb, var(--primary) 55%, var(--secondary)), var(--primary));
  background-size: 220% 100%; animation: bandflow 22s linear infinite;
  box-shadow: 0 4px 18px -8px rgba(63, 48, 40, .45);
}
@keyframes bandflow { to { background-position: -220% 0; } }
.band-left { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.verse { display: flex; gap: .45rem; align-items: baseline; min-width: 0; font-size: .76rem; line-height: 1.25; }
.verse-text { font-style: italic; opacity: .92; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.verse-ref { flex: none; font-weight: 700; font-size: .7rem; padding: .05rem .5rem; border-radius: 999px; background: rgba(255, 255, 255, .45); white-space: nowrap; }
.band-title { margin: 0; font-size: 1.05rem; font-weight: 800; letter-spacing: .01em; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40vw; animation: fadein .5s var(--ease) both; }
.band-right { display: flex; justify-content: flex-end; align-items: center; gap: .5rem; min-width: 0; }
.user-chip { display: flex; align-items: center; gap: .5rem; min-width: 0; font-weight: 600; font-size: .9rem; }
.user-chip span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { flex: none; width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem; background: var(--surface); color: var(--text); box-shadow: 0 0 0 2px rgba(255, 255, 255, .6); }
.band-btn { display: inline-flex; align-items: center; gap: .35rem; border: 0; cursor: pointer; font: inherit; font-size: .85rem; font-weight: 600; color: inherit; padding: .4rem .8rem; border-radius: 999px; background: rgba(255, 255, 255, .4); transition: background .2s, transform .2s var(--spring); }
.band-btn:hover { background: rgba(255, 255, 255, .7); transform: translateY(-1px); }
#menuBtn { display: none; }

/* ---------- Menú lateral plegable ---------- */
.sidebar {
  position: fixed; top: var(--band-h); left: 0; bottom: 0; z-index: 50; width: var(--nav-w);
  display: flex; flex-direction: column; gap: .6rem; padding: .9rem .7rem; overflow-y: auto; overflow-x: hidden;
  background: var(--surface); border-right: 1px solid var(--line);
  transition: width .35s var(--ease), transform .35s var(--ease);
}
.side-head { display: flex; align-items: center; gap: .6rem; padding: .2rem .35rem .6rem; }
.brand { display: flex; align-items: center; gap: .65rem; color: var(--text); text-decoration: none !important; min-width: 0; }
.brand-mark { flex: none; width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; font-size: 1.1rem; color: var(--on-primary); background: linear-gradient(135deg, var(--primary), var(--accent)); box-shadow: 0 6px 16px -6px var(--primary); animation: spin-slow 16s linear infinite; }
@keyframes spin-slow { to { transform: rotate(360deg); } }
.brand-name { font-weight: 800; font-size: 1.02rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-toggle { margin-left: auto; flex: none; width: 32px; height: 32px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); cursor: pointer; display: grid; place-items: center; transition: transform .35s var(--ease), background .2s; }
.nav-toggle:hover { background: var(--chip); }
.nav { display: grid; gap: .15rem; }
.nav-item { display: flex; align-items: center; gap: .75rem; padding: .6rem .7rem; border-radius: 12px; color: var(--text); text-decoration: none !important; position: relative; white-space: nowrap; transition: background .2s, color .2s; font-weight: 500; }
.nav-item:hover { background: var(--chip); }
.nav-item:hover .nav-ico { transform: scale(1.18) rotate(-6deg); }
.nav-item.active { background: color-mix(in srgb, var(--primary) 30%, var(--surface)); font-weight: 700; }
.nav-item.active::before { content: ""; position: absolute; left: -.7rem; top: 18%; bottom: 18%; width: 4px; border-radius: 0 4px 4px 0; background: var(--primary); animation: grow .4s var(--spring) both; }
@keyframes grow { from { transform: scaleY(0); } }
.nav-ico { flex: none; width: 1.6rem; text-align: center; font-size: 1.12rem; transition: transform .3s var(--spring); }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity .2s; }
.subnav { display: grid; margin: .05rem 0 .35rem 2.25rem; border-left: 2px solid var(--line); animation: fadeup .35s var(--ease) both; }
.subnav a { color: var(--muted); padding: .28rem .7rem; font-size: .86rem; border-radius: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subnav a.active, .subnav a:hover { color: var(--text); background: var(--chip); text-decoration: none; }
.side-foot { margin-top: auto; display: grid; gap: .35rem; }
.side-foot .nav-item { font-size: .9rem; }
.side-meta { font-size: .72rem; color: var(--muted); padding: .2rem .7rem; white-space: nowrap; overflow: hidden; }
button.nav-item { width: 100%; border: 0; background: none; font: inherit; cursor: pointer; text-align: left; }

html.nav-collapsed .sidebar { width: var(--nav-w-min); }
html.nav-collapsed .nav-label, html.nav-collapsed .brand-name, html.nav-collapsed .subnav, html.nav-collapsed .side-meta { display: none; }
html.nav-collapsed .side-head { flex-direction: column; padding-inline: 0; }
html.nav-collapsed .nav-toggle { margin: 0; transform: rotate(180deg); }
html.nav-collapsed .nav-item { justify-content: center; padding-inline: 0; }

/* ---------- Estructura ---------- */
.shell { padding: calc(var(--band-h) + 1.1rem) 1.2rem 2rem calc(var(--nav-w) + 1.2rem); transition: padding .35s var(--ease); min-height: 100vh; }
html.nav-collapsed .shell { padding-left: calc(var(--nav-w-min) + 1.2rem); }
.main { min-width: 0; }
.content { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; min-width: 0; }

/* ---------- Botones y formularios ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .62rem 1.1rem; border-radius: 12px; border: 1px solid var(--line);
  font: inherit; font-weight: 600; color: var(--text); cursor: pointer; text-decoration: none !important;
  background: var(--surface-2); transition: transform .2s var(--spring), box-shadow .2s, background .2s;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); background: var(--surface); }
.btn:active { transform: translateY(0) scale(.97); }
.btn-primary { background: linear-gradient(135deg, var(--primary), color-mix(in srgb, var(--primary) 60%, var(--secondary))); border-color: transparent; color: var(--on-primary); }
.btn-primary:hover { background: linear-gradient(135deg, color-mix(in srgb, var(--primary) 90%, #000), var(--primary)); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-danger { background: linear-gradient(135deg, #c0505f, #8f2f3d); border-color: transparent; color: #fff; }
.btn-sm { padding: .34rem .75rem; font-size: .85rem; border-radius: 10px; }
.btn-block { width: 100%; }
.link-btn { background: none; border: 0; color: var(--link); cursor: pointer; font: inherit; padding: 0; }
.icon-btn { background: var(--surface-2); border: 1px solid var(--line); color: var(--text); border-radius: 10px; padding: .4rem .65rem; cursor: pointer; font: inherit; }
.form { display: grid; gap: 1rem; margin: 1rem 0; }
.form-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(210px, 100%), 1fr)); }
.field { display: grid; gap: .35rem; font-size: .9rem; }
.field > span { color: var(--text-2); font-weight: 600; }
input, select, textarea {
  width: 100%; padding: .62rem .85rem; border-radius: var(--radius-sm); font: inherit; color: var(--text);
  background: var(--field); border: 1px solid rgb(var(--ink) / .16); outline: none;
  transition: border-color .2s, box-shadow .2s, background .2s;
}
select option { background: var(--option-bg); color: var(--text); }
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 25%, transparent); background: var(--field-focus); }
input[type="color"] { padding: .2rem; height: 44px; cursor: pointer; }
input[type="checkbox"], input[type="radio"] { width: auto; accent-color: var(--primary); }
input[type="range"] { padding: 0; accent-color: var(--primary); }
.code-input { font-size: 1.5rem; letter-spacing: .35em; text-align: center; font-family: ui-monospace, Consolas, monospace; }
.pw-wrap { position: relative; display: block; }
.pw-wrap:not(.pw-tools) input { padding-right: 2.6rem; }
.pw-toggle { position: absolute; right: .5rem; top: 50%; transform: translateY(-50%); background: none; border: 0; cursor: pointer; font-size: 1.05rem; opacity: .7; }
.pw-tools input { padding-right: 4.6rem; }
.pw-tools .pw-toggle { right: 2.4rem; }
.pw-gen { position: absolute; right: .4rem; top: 50%; transform: translateY(-50%); background: none; border: 0; cursor: pointer; font-size: 1.05rem; opacity: .8; }
.pw-gen:hover, .pw-toggle:hover { opacity: 1; }

/* ---------- Acceso (login) ---------- */
.auth-body { background: linear-gradient(135deg, var(--primary), var(--secondary) 45%, var(--accent)); background-size: 300% 300%; animation: authbg 18s ease-in-out infinite; }
@keyframes authbg { 50% { background-position: 100% 100%; } }
.auth-body .verse-strip { position: fixed; inset: 0 0 auto 0; z-index: 5; padding: .45rem 1rem; text-align: center; font-size: .78rem; font-style: italic; color: var(--verse-fg); background: var(--verse-bg); box-shadow: 0 2px 12px -6px rgba(0, 0, 0, .3); }
.auth-split { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(380px, 1fr); }
.auth-img-right .auth-media { order: 2; }
.auth-media { position: relative; overflow: hidden; display: grid; place-items: end start; min-height: 100vh; }
.auth-media-blur { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(28px) saturate(1.1); opacity: .75; }
.auth-media-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; object-position: center; padding: 2.6rem 1.2rem 1.2rem; animation: fadein .8s var(--ease) both; }
.auth-hero-text { position: relative; z-index: 2; margin: 0 0 2.4rem 2.4rem; max-width: 34rem; padding: 1rem 1.3rem; border-radius: 18px; color: var(--hero-fg); background: rgba(0, 0, 0, .22); backdrop-filter: blur(4px); animation: fadeup .7s var(--ease) both; }
.auth-hero-title { margin: 0; font-size: clamp(1.6rem, 3vw, 2.6rem); font-weight: 800; line-height: 1.1; color: inherit; }
.auth-hero-sub { margin: .4rem 0 0; font-size: 1.05rem; opacity: .92; }
.auth-body:not(.has-bg) .auth-hero-text { background: transparent; backdrop-filter: none; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; align-content: center; padding: 3rem 1.5rem 2rem; gap: 1rem; background: color-mix(in srgb, var(--bg) 55%, transparent); }
@media (max-width: 860px) {
  .auth-split { grid-template-columns: minmax(0, 1fr); }
  .auth-img-right .auth-media { order: 0; }
  .auth-media { min-height: 34vh; }
  .auth-body .verse-strip { position: relative; }
  .auth-media-img { padding: .6rem; }
  .auth-hero-text { margin: 0 0 1rem 1rem; }
  .auth-wrap { min-height: auto; padding-top: 1.5rem; }
}
.auth-card { width: min(430px, 100%); padding: 2rem; animation: pop .6s var(--spring) both; box-shadow: 0 30px 60px -25px rgba(40, 30, 25, .5); }
.auth-title { font-size: 1.45rem; margin-top: .4rem; }
.auth-foot { color: var(--foot-fg); font-size: .8rem; background: var(--foot-bg); padding: .25rem .8rem; border-radius: 999px; }
.qr-box { display: grid; place-items: center; background: #fff; border-radius: 16px; padding: 12px; width: fit-content; margin: 1rem auto; }
.secret { display: block; margin: .5rem 0; padding: .6rem; border-radius: 10px; background: var(--surface-2); word-break: break-all; letter-spacing: .08em; }
.codes { columns: 2; padding-left: 1.4rem; font-size: 1.05rem; }
.codes li { margin: .3rem 0; }

/* ---------- KPIs y títulos ---------- */
.kpis { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); }
.kpi { padding: 1.05rem 1.2rem; position: relative; overflow: hidden; }
.kpi:hover, .item-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.kpi::after { content: ""; position: absolute; width: 110px; height: 110px; border-radius: 50%; right: -36px; top: -36px; background: color-mix(in srgb, var(--accent) 35%, transparent); transition: transform .5s var(--ease); }
.kpi:hover::after { transform: scale(1.35); }
.kpi-label { color: var(--text-2); font-size: .83rem; font-weight: 600; position: relative; }
.kpi-value { font-size: 1.6rem; font-weight: 800; margin: .15rem 0; letter-spacing: -.01em; position: relative; }
.kpi-sub { color: var(--muted); font-size: .82rem; position: relative; }
.kpi.pos .kpi-value { color: var(--ok); } .kpi.neg .kpi-value { color: var(--err); }
a.kpi { color: var(--text); text-decoration: none !important; }
.kpi-active { box-shadow: var(--shadow), 0 0 0 2px var(--primary); }
.section-title { display: flex; align-items: center; gap: .6rem; font-size: 1rem; margin: .3rem 0 0; color: var(--text-2); }
.sub-title { font-size: .9rem; margin: 1rem 0 .4rem; color: var(--text-2); }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { padding: .55rem .7rem; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { color: var(--text-2); font-weight: 700; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-2); position: sticky; top: 0; }
tbody tr { transition: background .15s; }
tbody tr:hover { background: var(--chip); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tfoot td { font-weight: 800; border-top: 2px solid rgb(var(--ink) / .2); }
td.wrap { white-space: normal; min-width: 180px; }
.zero { color: rgb(var(--ink) / .28); }
.badge { display: inline-block; padding: .12rem .6rem; border-radius: 999px; font-size: .76rem; font-weight: 700; background: var(--chip); }
.badge-ok { background: color-mix(in srgb, var(--ok) 20%, transparent); color: color-mix(in srgb, var(--ok) 70%, var(--text)); }
.badge-warn { background: color-mix(in srgb, var(--warn) 22%, transparent); color: color-mix(in srgb, var(--warn) 70%, var(--text)); }
.badge-err { background: color-mix(in srgb, var(--err) 20%, transparent); color: color-mix(in srgb, var(--err) 70%, var(--text)); }
.badge-info { background: color-mix(in srgb, var(--info) 20%, transparent); color: color-mix(in srgb, var(--info) 70%, var(--text)); }

/* ---------- Barras y gráficos ---------- */
.bars { display: grid; gap: .55rem; }
.bar-row { display: grid; grid-template-columns: minmax(110px, 190px) 1fr auto; gap: .7rem; align-items: center; font-size: .88rem; }
.bar { height: 10px; border-radius: 999px; background: rgb(var(--ink) / .08); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--accent)); transition: width 1.2s var(--ease); }
.chart-months { display: grid; grid-template-columns: repeat(12, 1fr); gap: .4rem; align-items: end; height: 180px; padding-top: .5rem; }
.chart-months .col { display: flex; gap: 3px; align-items: flex-end; justify-content: center; height: 100%; }
.chart-months .col i { width: 40%; max-width: 16px; border-radius: 6px 6px 2px 2px; height: 0; transition: height 1s var(--ease); }
.chart-months .col i.in { background: linear-gradient(180deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--ok))); }
.chart-months .col i.out { background: linear-gradient(180deg, var(--primary), color-mix(in srgb, var(--primary) 60%, var(--err))); }
.chart-labels { display: grid; grid-template-columns: repeat(12, 1fr); gap: .4rem; text-align: center; font-size: .72rem; color: var(--muted); }
.legend { display: flex; gap: 1rem; font-size: .82rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: .3rem; }
.legend .in { background: var(--accent); } .legend .out { background: var(--primary); }

/* ---------- Toolbar, pestañas, utilidades ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; padding: .7rem 1rem; }
.toolbar form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin: 0; }
.toolbar input, .toolbar select { width: auto; padding: .42rem .7rem; }
.tabs { display: flex; gap: .35rem; flex-wrap: wrap; }
.tabs a { padding: .42rem .9rem; border-radius: 999px; color: var(--text); background: var(--chip); font-size: .88rem; text-decoration: none; transition: background .2s, transform .2s var(--spring); }
.tabs a:hover { transform: translateY(-1px); }
.tabs a.active, .tabs a:hover { background: var(--primary); color: var(--on-primary); }
.grid-2 { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(min(320px, 100%), 1fr)); }
.actions { display: flex; gap: .35rem; justify-content: flex-end; }
.swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: middle; margin-right: .3rem; }
.empty { text-align: center; padding: 2.2rem 1rem; color: var(--muted); }
.big-emoji { font-size: 3rem; animation: bob 3s ease-in-out infinite; display: inline-block; }
@keyframes bob { 50% { transform: translateY(-6px); } }
.preview-img { max-width: 240px; max-height: 130px; border-radius: 12px; border: 1px solid var(--line); object-fit: cover; }

/* ---------- Avisos ---------- */
.toasts { position: fixed; right: 1rem; top: calc(var(--band-h) + .8rem); z-index: 100; display: grid; gap: .5rem; max-width: min(420px, calc(100vw - 2rem)); }
.toast { color: #fff; padding: .75rem 2.4rem .75rem 1rem; border-radius: 14px; position: relative; box-shadow: var(--shadow-hover); animation: slidein .5s var(--spring) both; }
.toast-success { background: #3f8a63; } .toast-error { background: #b2475a; } .toast-warning { background: #a8681f; } .toast-info { background: #4f6f9a; }
.toast-close { position: absolute; right: .5rem; top: .35rem; background: none; border: 0; color: #fff; font-size: 1.2rem; cursor: pointer; }
.toast.out { animation: slideout .4s var(--ease) forwards; }
@keyframes slidein { from { opacity: 0; transform: translateX(40px) scale(.95); } }
@keyframes slideout { to { opacity: 0; transform: translateX(40px); } }
.idle-warn { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); padding: .8rem 1.2rem; z-index: 120; display: flex; gap: .8rem; align-items: center; }

/* ---------- Tarjetas de listas (proyectos, documentos, cuentas) ---------- */
.cards-grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(min(270px, 100%), 1fr)); }
.item-card { display: grid; gap: .45rem; align-content: start; color: var(--text); text-decoration: none !important; position: relative; overflow: hidden; }
.item-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--primary), var(--accent)); transform: scaleX(0); transform-origin: left; transition: transform .4s var(--ease); }
.item-card:hover::before { transform: scaleX(1); }
.item-title { font-size: 1.03rem; }
.doc-big { font-size: 2rem; line-height: 1; }
.avatar-photo { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 0 0 3px var(--surface), 0 0 0 4px var(--line); }
.avatar-emoji { width: 44px; height: 44px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 1.5rem; background: var(--surface-2); flex: none; vertical-align: middle; }
.avatar-photo { vertical-align: middle; }
.avatar-photo.xs, .avatar-emoji.xs { width: 22px; height: 22px; font-size: .85rem; box-shadow: none; }
.avatar-photo.md, .avatar-emoji.md { width: 40px; height: 40px; }
.avatar-photo.lg, .avatar-emoji.lg { width: 76px; height: 76px; font-size: 2.2rem; }
.gap-xs { gap: 6px; }
.row.gap-xs { display: flex; align-items: center; }

/* Etapas del proyecto */
.stages { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: start; }
.stage { border-top: 4px solid var(--stage, var(--primary)); scroll-margin-top: calc(var(--band-h) + 1rem); }
.stage-antes { --stage: var(--primary); } .stage-durante { --stage: var(--accent); } .stage-despues { --stage: color-mix(in srgb, var(--ok) 60%, var(--accent)); }
.stage-head { display: flex; gap: .7rem; align-items: center; margin-bottom: .4rem; }
.stage-ico { font-size: 1.45rem; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: color-mix(in srgb, var(--stage) 30%, transparent); }
@media (max-width: 1150px) { .stages { grid-template-columns: minmax(0, 1fr); } }

/* Checklist */
.checklist { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.checklist li { display: flex; gap: .6rem; align-items: center; padding: .45rem .55rem; border-radius: 12px; background: var(--surface-2); transition: background .2s, transform .2s var(--ease); }
.checklist li:hover { transform: translateX(3px); }
.checklist li.done .grow { text-decoration: line-through; opacity: .55; }
.checklist li.late { box-shadow: inset 3px 0 0 var(--err); }
.check { flex: none; width: 22px; height: 22px; border-radius: 7px; border: 2px solid rgb(var(--ink) / .3); background: var(--field); cursor: pointer; position: relative; transition: background .2s, border-color .2s, transform .2s var(--spring); padding: 0; }
.check:hover { transform: scale(1.15); border-color: var(--primary); }
.check.on { background: var(--ok); border-color: var(--ok); animation: tick .35s var(--spring); }
.check.on::after { content: "✓"; position: absolute; inset: 0; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: .85rem; }
@keyframes tick { from { transform: scale(.6); } }
.add-row { display: flex; flex-wrap: wrap; gap: .4rem; margin-top: .6rem; }
.add-row input { padding: .45rem .7rem; flex: 1 1 100%; }
.add-row .w-date { flex: 1 1 8rem; }
.add-row input:only-of-type { flex: 1 1 60%; }

/* Documentos */
.doc-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .4rem; }
.doc-list li { display: flex; gap: .6rem; align-items: center; padding: .5rem .6rem; border-radius: 12px; background: var(--surface-2); }
.doc-ico { font-size: 1.35rem; flex: none; }
details.upload { margin-top: .8rem; }
details.upload summary { list-style: none; }
details.upload summary::-webkit-details-marker { display: none; }

/* Semáforo */
.sem { border-left: 6px solid var(--sem, rgb(var(--ink) / .2)); }
.sem-red { --sem: var(--err); } .sem-amber { --sem: var(--warn); } .sem-green { --sem: var(--ok); } .sem-gray { --sem: rgb(var(--ink) / .25); }
.sem-label { font-weight: 800; color: color-mix(in srgb, var(--sem) 75%, var(--text)); }
.sem-label.big { font-size: 1.25rem; margin-top: .6rem; }
.sem-red .sem-label { animation: pulse 2.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.sem-kpi.red .kpi-value { color: var(--err); } .sem-kpi.amber .kpi-value { color: var(--warn); } .sem-kpi.green .kpi-value { color: var(--ok); }

/* Bóveda */
.vault-lock { width: min(460px, 100%); margin: 2rem auto; text-align: center; }
.vault-lock .form { text-align: left; }
.vault-bar { padding: .5rem 1rem; }
.tips { padding-left: 0; list-style: none; display: grid; gap: .5rem; }
.code-card { border: 2px dashed var(--primary); }
.recovery-code { font-size: 1.2rem; font-weight: 800; padding: .8rem 1rem; border-radius: 12px; background: var(--surface-2); text-align: center; margin: .6rem 0; word-break: break-all; }
.secret-grid { display: grid; gap: .8rem; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); }
.secret-row { display: grid; gap: .3rem; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; }
.chip { padding: .32rem .8rem; border-radius: 999px; background: var(--chip); color: var(--text); font-size: .86rem; text-decoration: none !important; transition: background .2s, transform .2s var(--spring); }
.chip:hover { transform: translateY(-2px); background: rgb(var(--ink) / .13); }
.chip-warn { background: color-mix(in srgb, var(--warn) 25%, transparent); }

/* Listas de alertas */
.alert-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.alert-list li a { display: flex; gap: .6rem; align-items: center; padding: .45rem .6rem; border-radius: 12px; background: var(--surface-2); color: var(--text); text-decoration: none; transition: transform .2s var(--ease), background .2s; }
.alert-list li a:hover { transform: translateX(4px); background: var(--chip); }

/* ---------- Inicio: Bento Grid ---------- */
.bento { display: grid; gap: 1rem; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(118px, auto); grid-auto-flow: dense; }
.tile { padding: 1.05rem 1.15rem; position: relative; overflow: hidden; display: flex; flex-direction: column; gap: .35rem; min-width: 0; }
.tile:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.tile h3 { font-size: .95rem; margin: 0 0 .3rem; display: flex; align-items: center; gap: .45rem; }
.tile h3 a { margin-left: auto; font-size: .78rem; font-weight: 600; }
.t-2x1 { grid-column: span 2; } .t-2x2 { grid-column: span 2; grid-row: span 2; } .t-1x2 { grid-row: span 2; } .t-4 { grid-column: 1 / -1; }
.tile-hero { color: var(--on-primary); background: linear-gradient(130deg, var(--primary), color-mix(in srgb, var(--primary) 45%, var(--secondary)) 60%, var(--accent)); background-size: 200% 200%; animation: authbg 14s ease-in-out infinite, pop .55s var(--spring) both; border: 0; }
.tile-hero .hello { font-size: 1.35rem; font-weight: 800; margin: 0; }
.tile-hero .clock { font-size: 2.2rem; font-weight: 800; letter-spacing: -.02em; line-height: 1; margin-top: auto; font-variant-numeric: tabular-nums; }
.tile-hero .deco { position: absolute; right: -20px; bottom: -30px; font-size: 7rem; opacity: .18; animation: spin-slow 30s linear infinite; }
.tile .big-num { font-size: 1.65rem; font-weight: 800; letter-spacing: -.01em; line-height: 1.1; }
.tile .sub { font-size: .8rem; color: var(--muted); }
.tile.pos .big-num { color: var(--ok); } .tile.neg .big-num { color: var(--err); }
.tile .glow { position: absolute; width: 140px; height: 140px; border-radius: 50%; right: -50px; top: -50px; background: color-mix(in srgb, var(--tint, var(--accent)) 40%, transparent); transition: transform .6s var(--ease); }
.tile:hover .glow { transform: scale(1.4); }
.tile > *:not(.glow):not(.deco) { position: relative; }
.ring { --p: 0; width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; margin: auto; background: conic-gradient(var(--primary) calc(var(--p) * 1%), rgb(var(--ink) / .08) 0); transition: --p 1.2s; }
.ring::before { content: attr(data-label); width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); font-weight: 800; font-size: 1.05rem; }
.mini-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .3rem; font-size: .86rem; }
.mini-list li { display: flex; gap: .5rem; align-items: center; padding: .3rem .45rem; border-radius: 10px; background: var(--surface-2); min-width: 0; }
.mini-list li a { color: var(--text); text-decoration: none; display: flex; gap: .5rem; align-items: center; width: 100%; min-width: 0; }
.mini-list .grow { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-list .amt { margin-left: auto; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.tile-empty { margin: auto; text-align: center; color: var(--muted); font-size: .88rem; }
@media (max-width: 1200px) { .bento { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 600px) { .bento { grid-template-columns: minmax(0, 1fr); } .t-2x1, .t-2x2 { grid-column: auto; } .t-2x2, .t-1x2 { grid-row: auto; } }

/* ---------- Mantenimiento: vista previa de letra ---------- */
.font-grid { display: grid; gap: .6rem; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.font-opt { display: flex; flex-direction: column; gap: .2rem; padding: .7rem .8rem; border-radius: 12px; border: 2px solid var(--line); cursor: pointer; background: var(--surface-2); transition: border-color .2s, transform .2s var(--spring); }
.font-opt:hover { transform: translateY(-2px); }
.font-opt:has(input:checked) { border-color: var(--primary); background: color-mix(in srgb, var(--primary) 14%, var(--surface)); }
.font-opt input { display: none; }
.font-opt b { font-size: 1.15rem; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  :root { --band-h: 58px; }
  .topband { grid-template-columns: auto minmax(0, 1fr) auto; gap: .6rem; padding: 0 .6rem; }
  .band-left .verse { display: none; }
  #menuBtn { display: inline-grid; }
  .band-title { max-width: none; font-size: .98rem; text-align: left; }
  .user-chip .uname { display: none; }
  .band-btn .lbl { display: none; }
  .sidebar { width: var(--nav-w) !important; transform: translateX(-105%); box-shadow: var(--shadow-hover); }
  .sidebar.open { transform: none; }
  html.nav-collapsed .nav-label, html.nav-collapsed .brand-name, html.nav-collapsed .side-meta { display: initial; }
  html.nav-collapsed .nav-item { justify-content: flex-start; padding-inline: .7rem; }
  .nav-toggle { display: none; }
  .shell, html.nav-collapsed .shell { padding: calc(var(--band-h) + .8rem) .7rem 2rem; }
  .verse-mobile { display: block !important; }
  .bar-row { grid-template-columns: 100px 1fr auto; }
}
.verse-mobile { display: none; font-size: .78rem; font-style: italic; color: var(--muted); padding: 0 .2rem; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .topband, .sidebar, .btn, .toasts, .vault-bar, .toolbar, form { display: none !important; }
  .shell { padding: 0 !important; }
  body { background: #fff; color: #000; }
  .glass { box-shadow: none; border: 0; }
  .code-card { border: 2px dashed #000; }
}
.ff-poppins { font-family: "Poppins", sans-serif; } .ff-inter { font-family: "Inter", sans-serif; } .ff-nunito { font-family: "Nunito", sans-serif; }
.ff-montserrat { font-family: "Montserrat", sans-serif; } .ff-segoe { font-family: "Segoe UI", system-ui, sans-serif; } .ff-georgia { font-family: Georgia, serif; }
.nav-item .nav-label { font-size: .93rem; }

.tile-colors { border: 1px solid var(--line); border-radius: 14px; padding: .6rem .8rem; background: var(--surface-2); }
.tile-colors summary { cursor: pointer; }
.tile-color-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin-top: .7rem; }
.tile-color { display: grid; gap: .3rem; padding: .5rem; border-radius: 12px; background: var(--surface); }
.tile-color input[type=color] { width: 100%; height: 34px; }
.tile .sub, .tile .small.muted { color: var(--muted); }
