/* ==========================================================================
   TEPREK — Sistema de diseño
   Marca: azul obturador #0092CA + grafito #393E46 (del logo oficial).
   Construido sobre Bootstrap 5: los tokens alimentan las variables --bs-*.
   ========================================================================== */

/* ---------- Tipografía: Plus Jakarta Sans (variable 200–800, servida localmente) ---------- */
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("../vendor/fonts/plus-jakarta-sans-latin-wght.13d1b429e990.woff2") format("woff2-variations"),
       url("../vendor/fonts/plus-jakarta-sans-latin-wght.13d1b429e990.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Plus Jakarta Sans";
  src: url("../vendor/fonts/plus-jakarta-sans-latin-ext-wght.cc2090cafea0.woff2") format("woff2-variations"),
       url("../vendor/fonts/plus-jakarta-sans-latin-ext-wght.cc2090cafea0.woff2") format("woff2");
  font-weight: 200 800; font-style: normal; font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

/* ---------- Tokens ---------- */
:root {
  /* Marca */
  --tp-brand-50: #eef8fc;
  --tp-brand-100: #d6eef8;
  --tp-brand-200: #acdcf0;
  --tp-brand-300: #6fc2e4;
  --tp-brand-500: #0092ca;   /* color del logo */
  --tp-brand-600: #007cad;   /* acciones (contraste AA con texto blanco) */
  --tp-brand-700: #00668f;
  --tp-brand-800: #0b4f6c;

  /* Neutros (familia del grafito del logo) */
  --tp-gray-0: #ffffff;
  --tp-gray-25: #fafbfc;
  --tp-gray-50: #f5f6f8;
  --tp-gray-100: #eceef1;
  --tp-gray-200: #e1e4e8;
  --tp-gray-300: #ccd1d8;
  --tp-gray-400: #9aa1ab;
  --tp-gray-500: #6b727d;
  --tp-gray-600: #4b525c;
  --tp-gray-700: #393e46;    /* grafito del logo */
  --tp-gray-800: #262a30;
  --tp-gray-900: #16191d;

  /* Semánticos */
  --tp-success: #0f8a5f;   --tp-success-bg: #e9f6f0;   --tp-success-border: #b9e2cf;
  --tp-warning: #a8650a;   --tp-warning-bg: #fdf4e4;   --tp-warning-border: #f2d9a8;
  --tp-danger: #c8323e;    --tp-danger-bg: #fcedee;    --tp-danger-border: #f3c2c6;
  --tp-info: var(--tp-brand-700); --tp-info-bg: var(--tp-brand-50); --tp-info-border: var(--tp-brand-200);

  /* Roles */
  --tp-bg: var(--tp-gray-50);
  --tp-surface: var(--tp-gray-0);
  --tp-surface-muted: var(--tp-gray-25);
  --tp-surface-sunken: var(--tp-gray-50);
  --tp-border: var(--tp-gray-200);
  --tp-border-strong: var(--tp-gray-300);
  --tp-text: var(--tp-gray-900);
  --tp-text-secondary: var(--tp-gray-500);
  --tp-text-tertiary: var(--tp-gray-400);
  --tp-accent: var(--tp-brand-600);
  --tp-income: var(--tp-brand-500);
  --tp-expense: var(--tp-gray-700);

  /* Tipografía */
  --tp-font: "Plus Jakarta Sans", ui-sans-serif, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --tp-text-xs: .75rem;     /* 12 */
  --tp-text-sm: .8125rem;   /* 13 */
  --tp-text-base: .875rem;  /* 14 */
  --tp-text-md: .9375rem;   /* 15 */
  --tp-text-lg: 1.125rem;   /* 18 */
  --tp-text-xl: 1.375rem;   /* 22 */
  --tp-text-2xl: 1.75rem;   /* 28 */

  /* Espaciado (base 4px) */
  --tp-space-1: 4px; --tp-space-2: 8px; --tp-space-3: 12px; --tp-space-4: 16px;
  --tp-space-5: 20px; --tp-space-6: 24px; --tp-space-8: 32px; --tp-space-10: 40px;

  /* Radios, sombras, controles */
  --tp-radius-sm: 6px;
  --tp-radius: 8px;
  --tp-radius-lg: 12px;
  --tp-radius-full: 999px;
  --tp-shadow-xs: 0 1px 2px rgba(22, 25, 29, .05);
  --tp-shadow-sm: 0 1px 2px rgba(22, 25, 29, .04), 0 1px 3px rgba(22, 25, 29, .06);
  --tp-shadow-lg: 0 12px 32px -8px rgba(22, 25, 29, .18), 0 2px 6px rgba(22, 25, 29, .06);
  --tp-ring: 0 0 0 3px rgba(0, 146, 202, .22);
  --tp-control-sm: 32px;
  --tp-control: 38px;
  --tp-control-lg: 44px;
  --tp-sidebar-w: 240px;
  --tp-topbar-h: 60px;

  /* Puente con Bootstrap */
  --bs-font-sans-serif: var(--tp-font);
  --bs-body-font-family: var(--tp-font);
  --bs-body-font-size: var(--tp-text-base);
  --bs-body-line-height: 1.5;
  --bs-body-color: var(--tp-text);
  --bs-body-bg: var(--tp-bg);
  --bs-secondary-color: var(--tp-text-secondary);
  --bs-border-color: var(--tp-border);
  --bs-border-radius: var(--tp-radius);
  --bs-border-radius-sm: var(--tp-radius-sm);
  --bs-border-radius-lg: var(--tp-radius-lg);
  --bs-primary: var(--tp-brand-600);
  --bs-primary-rgb: 0, 124, 173;
  --bs-link-color: var(--tp-brand-600);
  --bs-link-color-rgb: 0, 124, 173;
  --bs-link-hover-color: var(--tp-brand-700);
  --bs-link-hover-color-rgb: 0, 102, 143;
  --bs-danger: var(--tp-danger);
  --bs-danger-rgb: 200, 50, 62;
  --bs-success: var(--tp-success);
  --bs-success-rgb: 15, 138, 95;
  --bs-focus-ring-color: rgba(0, 146, 202, .25);
  --bs-heading-color: var(--tp-text);
  --bs-emphasis-color: var(--tp-text);
}

/* ---------- Base ---------- */
html { -webkit-text-size-adjust: 100%; }
body { font-family: var(--tp-font); background: var(--tp-bg); color: var(--tp-text);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; font-feature-settings: "ss01" off; }
h1, h2, h3, h4, h5, h6 { font-weight: 650; letter-spacing: -.012em; color: var(--tp-text); }
a { text-decoration: none; }
a:hover { text-decoration: none; }
::selection { background: var(--tp-brand-100); }
.text-muted, .form-text { color: var(--tp-text-secondary) !important; }
.text-secondary { color: var(--tp-text-secondary) !important; }
.text-tertiary { color: var(--tp-text-tertiary) !important; }
.fw-medium { font-weight: 500 !important; }
.fw-semibold { font-weight: 600 !important; }
.tabular, .num { font-variant-numeric: tabular-nums; }
.text-income { color: var(--tp-brand-600) !important; }
.text-expense { color: var(--tp-gray-700) !important; }
.text-positive { color: var(--tp-success) !important; }
.text-negative { color: var(--tp-danger) !important; }
.text-xs { font-size: var(--tp-text-xs) !important; }
.text-sm { font-size: var(--tp-text-sm) !important; }
.min-w-0 { min-width: 0; }
:focus-visible { outline: none; box-shadow: var(--tp-ring); border-radius: var(--tp-radius-sm); }

/* ---------- Botones: primary · secondary · tertiary · ghost · danger ---------- */
.btn {
  --bs-btn-font-weight: 550; --bs-btn-font-size: var(--tp-text-base); --bs-btn-padding-x: 14px;
  --bs-btn-padding-y: 0; --bs-btn-border-radius: var(--tp-radius); --bs-btn-focus-box-shadow: var(--tp-ring);
  height: var(--tp-control); display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap; transition: background-color .12s, border-color .12s, color .12s, box-shadow .12s;
}
.btn i.bi { font-size: 1rem; line-height: 1; }
.btn-sm { --bs-btn-padding-x: 10px; --bs-btn-font-size: var(--tp-text-sm); --bs-btn-border-radius: var(--tp-radius-sm); height: var(--tp-control-sm); gap: 5px; }
.btn-sm i.bi { font-size: .9rem; }
.btn-lg { height: var(--tp-control-lg); --bs-btn-padding-x: 18px; --bs-btn-font-size: var(--tp-text-md); }
.btn-primary {
  --bs-btn-color: #fff; --bs-btn-bg: var(--tp-brand-600); --bs-btn-border-color: var(--tp-brand-600);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: var(--tp-brand-700); --bs-btn-hover-border-color: var(--tp-brand-700);
  --bs-btn-active-color: #fff; --bs-btn-active-bg: var(--tp-brand-800); --bs-btn-active-border-color: var(--tp-brand-800);
  --bs-btn-disabled-color: #fff; --bs-btn-disabled-bg: var(--tp-brand-600); --bs-btn-disabled-border-color: var(--tp-brand-600);
  box-shadow: var(--tp-shadow-xs), inset 0 1px 0 rgba(255, 255, 255, .08);
}
.btn-secondary {
  --bs-btn-color: var(--tp-text); --bs-btn-bg: var(--tp-surface); --bs-btn-border-color: var(--tp-border-strong);
  --bs-btn-hover-color: var(--tp-text); --bs-btn-hover-bg: var(--tp-gray-50); --bs-btn-hover-border-color: var(--tp-gray-300);
  --bs-btn-active-color: var(--tp-text); --bs-btn-active-bg: var(--tp-gray-100); --bs-btn-active-border-color: var(--tp-gray-300);
  --bs-btn-disabled-color: var(--tp-text-tertiary); --bs-btn-disabled-bg: var(--tp-surface); --bs-btn-disabled-border-color: var(--tp-border);
  box-shadow: var(--tp-shadow-xs);
}
.btn-tertiary {
  --bs-btn-color: var(--tp-brand-700); --bs-btn-bg: var(--tp-brand-50); --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--tp-brand-800); --bs-btn-hover-bg: var(--tp-brand-100); --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: var(--tp-brand-800); --bs-btn-active-bg: var(--tp-brand-200); --bs-btn-active-border-color: transparent;
}
.btn-ghost {
  --bs-btn-color: var(--tp-gray-600); --bs-btn-bg: transparent; --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--tp-text); --bs-btn-hover-bg: var(--tp-gray-100); --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: var(--tp-text); --bs-btn-active-bg: var(--tp-gray-200); --bs-btn-active-border-color: transparent;
}
.btn-danger {
  --bs-btn-color: #fff; --bs-btn-bg: var(--tp-danger); --bs-btn-border-color: var(--tp-danger);
  --bs-btn-hover-color: #fff; --bs-btn-hover-bg: #ad2833; --bs-btn-hover-border-color: #ad2833;
  --bs-btn-active-color: #fff; --bs-btn-active-bg: #95222c; --bs-btn-active-border-color: #95222c;
  --bs-btn-focus-box-shadow: 0 0 0 3px rgba(200, 50, 62, .25);
}
.btn-ghost-danger {
  --bs-btn-color: var(--tp-danger); --bs-btn-bg: transparent; --bs-btn-border-color: transparent;
  --bs-btn-hover-color: var(--tp-danger); --bs-btn-hover-bg: var(--tp-danger-bg); --bs-btn-hover-border-color: transparent;
  --bs-btn-active-color: var(--tp-danger); --bs-btn-active-bg: var(--tp-danger-border);
}
.btn-icon { width: var(--tp-control); padding: 0 !important; }
.btn-icon.btn-sm { width: var(--tp-control-sm); }
.btn-link { --bs-btn-color: var(--tp-brand-600); --bs-btn-hover-color: var(--tp-brand-700); height: auto; padding: 0; font-weight: 550; }
.btn .spinner-border { width: 14px; height: 14px; border-width: 2px; }

/* ---------- Layout ---------- */
.tp-sidebar { width: var(--tp-sidebar-w); background: var(--tp-surface); border-right: 1px solid var(--tp-border); }
@media (min-width: 992px) {
  .tp-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1030; display: flex; flex-direction: column; }
  .tp-main { margin-left: var(--tp-sidebar-w); }
}
.tp-sidebar .offcanvas-body { display: flex; flex-direction: column; padding: 0; height: 100%; }
.tp-sidebar-head { padding: 18px 16px 12px 20px; display: flex; align-items: center; justify-content: space-between; }
/* El SVG oficial incluye margen interno (~8 %): la altura compensa ese aire sin alterar proporciones */
.tp-logo { display: block; height: 38px; width: auto; margin-left: -4px; }
.tp-logo-sm { height: 30px; margin-left: 0; }
.tp-workspace { margin: 4px 12px 8px; padding: 8px 10px; border: 1px solid var(--tp-border); border-radius: var(--tp-radius);
  display: flex; align-items: center; gap: 10px; background: var(--tp-surface-muted); }
.tp-workspace-mark { width: 26px; height: 26px; border-radius: 6px; background: var(--tp-gray-700); color: #fff;
  display: grid; place-items: center; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.tp-workspace-name { font-size: var(--tp-text-sm); font-weight: 600; line-height: 1.2; }
.tp-workspace-sub { font-size: 11px; color: var(--tp-text-secondary); }

.tp-nav { padding: 6px 12px; flex: 1; overflow-y: auto; }
.tp-nav-section { font-size: 11px; font-weight: 600; color: var(--tp-text-tertiary); padding: 16px 10px 6px; letter-spacing: .02em; }
.tp-nav-link { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; margin-bottom: 1px;
  border-radius: var(--tp-radius); color: var(--tp-gray-600); font-weight: 500; font-size: var(--tp-text-base); position: relative; }
.tp-nav-link i { font-size: 1.05rem; color: var(--tp-gray-400); width: 18px; text-align: center; transition: color .12s; }
.tp-nav-link:hover { background: var(--tp-gray-50); color: var(--tp-text); }
.tp-nav-link:hover i { color: var(--tp-gray-600); }
.tp-nav-link.active { background: var(--tp-brand-50); color: var(--tp-brand-700); font-weight: 600; }
.tp-nav-link.active i { color: var(--tp-brand-600); }
.tp-sidebar-foot { border-top: 1px solid var(--tp-border); padding: 10px 12px; }
/* Tipo de cambio (dólar observado) */
.tp-fx { margin: 0 12px 10px; padding: 9px 10px; border: 1px solid var(--tp-border); border-radius: var(--tp-radius);
  background: var(--tp-surface-muted); font-size: 11px; color: var(--tp-text-secondary); line-height: 1.35; }
.tp-fx-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.tp-fx-label { font-weight: 600; color: var(--tp-gray-600); display: inline-flex; align-items: center; gap: 5px; }
.tp-fx-value { font-size: var(--tp-text-sm); font-weight: 700; color: var(--tp-text); font-variant-numeric: tabular-nums; }
.tp-fx-meta { margin-top: 2px; }
.tp-fx-meta a { color: var(--tp-text-secondary); text-decoration: underline; text-decoration-color: var(--tp-border-strong); }
.tp-fx-meta a:hover { color: var(--tp-brand-700); }
.tp-fx.stale .tp-fx-meta { color: var(--tp-warning); }
.tp-user { display: flex; align-items: center; gap: 10px; width: 100%; padding: 6px 8px; border: 0; background: none;
  border-radius: var(--tp-radius); text-align: left; color: var(--tp-text); }
.tp-user:hover { background: var(--tp-gray-50); }
.tp-user.active { background: var(--tp-brand-50); }
.tp-user-menu { max-height: calc(100vh - 120px); overflow-y: auto; }
.tp-user-menu-head { padding: 6px 16px 8px; border-bottom: 1px solid var(--tp-border); margin-bottom: 4px; max-width: 100%; }
.tp-user-menu .dropdown-item.active, .tp-user-menu .dropdown-item:active { background: var(--tp-brand-50); color: var(--tp-brand-800); }
.tp-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--tp-brand-100); color: var(--tp-brand-800);
  display: grid; place-items: center; font-weight: 650; font-size: 11px; flex-shrink: 0; letter-spacing: .02em; }
.tp-avatar-lg { width: 36px; height: 36px; font-size: 12px; }

.tp-topbar { position: sticky; top: 0; z-index: 1020; background: rgba(245, 246, 248, .86);
  backdrop-filter: saturate(180%) blur(10px); -webkit-backdrop-filter: saturate(180%) blur(10px); border-bottom: 1px solid transparent; transition: border-color .15s; }
.tp-topbar.scrolled { border-bottom-color: var(--tp-border); }
.tp-topbar-inner { display: flex; align-items: center; gap: 12px; padding: 14px 32px; min-height: var(--tp-topbar-h); max-width: 1400px; }
.tp-content { padding: 4px 32px 48px; max-width: 1400px; }
.tp-page-title { font-size: var(--tp-text-xl); font-weight: 700; letter-spacing: -.02em; margin: 0; line-height: 1.25; }
.tp-page-desc { color: var(--tp-text-secondary); font-size: var(--tp-text-base); margin: 2px 0 0; }
.tp-back { display: inline-flex; align-items: center; gap: 4px; font-size: var(--tp-text-sm); color: var(--tp-text-secondary); font-weight: 500; margin-bottom: 2px; }
.tp-back:hover { color: var(--tp-text); }
.tp-mobilebar { display: none; }
.tp-search-global { position: relative; width: 260px; }
.tp-search-global input { padding-left: 34px; padding-right: 44px; background: var(--tp-surface); }
.tp-search-global .bi-search { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--tp-text-tertiary); font-size: .9rem; pointer-events: none; }
.tp-kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 600; color: var(--tp-text-tertiary);
  border: 1px solid var(--tp-border); border-radius: 5px; padding: 1px 6px; background: var(--tp-surface-muted); pointer-events: none; }

@media (max-width: 991.98px) {
  .tp-mobilebar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 16px;
    background: var(--tp-surface); border-bottom: 1px solid var(--tp-border); position: sticky; top: 0; z-index: 1025; }
  .tp-topbar { position: static; background: transparent; backdrop-filter: none; }
  .tp-topbar-inner { padding: 20px 20px 12px; min-height: 0; flex-wrap: wrap; }
  .tp-content { padding: 0 20px 96px; }
}
@media (max-width: 575.98px) {
  .tp-topbar-inner { padding: 16px 16px 10px; }
  .tp-content { padding: 0 16px 96px; }
  .tp-page-title { font-size: var(--tp-text-lg); }
}

/* Barra de progreso de navegación HTMX */
#tp-progress { position: fixed; top: 0; left: 0; height: 2px; width: 0; background: var(--tp-brand-500); z-index: 2000; opacity: 0;
  transition: width .4s ease, opacity .3s ease; }
#tp-progress.active { opacity: 1; width: 70%; transition: width 6s cubic-bezier(.1, .7, .2, 1), opacity .1s; }
#tp-progress.done { opacity: 0; width: 100%; transition: width .2s ease, opacity .35s ease .15s; }

/* ---------- Superficies ---------- */
.card { --bs-card-border-color: var(--tp-border); --bs-card-border-radius: var(--tp-radius-lg); --bs-card-inner-border-radius: calc(var(--tp-radius-lg) - 1px);
  --bs-card-bg: var(--tp-surface); box-shadow: var(--tp-shadow-xs); }
.card-header { background: transparent; border-bottom: 1px solid var(--tp-border); padding: 14px 20px; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 52px; }
.card-body { padding: 20px; }
.card-footer { background: var(--tp-surface-muted); border-top: 1px solid var(--tp-border); padding: 12px 20px; }
.tp-card-title { font-size: var(--tp-text-md); font-weight: 650; margin: 0; letter-spacing: -.01em; }
.tp-card-sub { font-size: var(--tp-text-sm); color: var(--tp-text-secondary); font-weight: 400; }
.tp-section-title { font-size: var(--tp-text-md); font-weight: 650; margin: 0 0 4px; }
.tp-section-desc { font-size: var(--tp-text-sm); color: var(--tp-text-secondary); margin: 0 0 16px; }
.tp-divider { border: 0; border-top: 1px solid var(--tp-border); margin: 24px 0; opacity: 1; }

/* ---------- Métricas ---------- */
.tp-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.tp-metric { padding: 20px 24px; min-width: 0; }
.tp-metric + .tp-metric { border-left: 1px solid var(--tp-border); }
.tp-metric-label { font-size: var(--tp-text-sm); color: var(--tp-text-secondary); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.tp-metric-value { font-size: var(--tp-text-2xl); font-weight: 700; letter-spacing: -.03em; margin-top: 6px; line-height: 1.15;
  font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-metric-foot { font-size: var(--tp-text-sm); color: var(--tp-text-secondary); margin-top: 6px; }
.tp-dot { width: 8px; height: 8px; border-radius: 2px; display: inline-block; flex-shrink: 0; }
.tp-dot.income { background: var(--tp-income); }
.tp-dot.expense { background: var(--tp-expense); }
.tp-dot.neutral { background: var(--tp-gray-300); }
@media (max-width: 1199.98px) {
  .tp-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tp-metric:nth-child(3) { border-left: 0; }
  .tp-metric:nth-child(n+3) { border-top: 1px solid var(--tp-border); }
}
@media (max-width: 575.98px) {
  .tp-metric { padding: 16px; }
  .tp-metric-value { font-size: 1.3rem; }
}

.tp-chart { position: relative; height: 300px; }
@media (max-width: 575.98px) { .tp-chart { height: 240px; } }
.tp-legend { display: flex; gap: 16px; font-size: var(--tp-text-sm); color: var(--tp-text-secondary); }
.tp-legend span { display: inline-flex; align-items: center; gap: 6px; }

/* Lista de barras por categoría */
.tp-bars { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.tp-bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; font-size: var(--tp-text-sm); }
.tp-bar-name { color: var(--tp-text); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-bar-value { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.tp-bar-value small { color: var(--tp-text-tertiary); font-weight: 500; margin-left: 6px; }
.tp-bar-track { grid-column: 1 / -1; height: 6px; background: var(--tp-gray-100); border-radius: var(--tp-radius-full); overflow: hidden; }
.tp-bar-fill { height: 100%; border-radius: inherit; background: var(--tp-income); }
.tp-bar-fill.expense { background: var(--tp-expense); }
.tp-bar-fill.other { background: var(--tp-gray-300); }

/* ---------- Estadísticas de sección ---------- */
.tp-stats .card-header { row-gap: 10px; }
.tp-metrics-sm .tp-metric { padding: 14px 20px; }
.tp-metrics-sm .tp-metric-value { font-size: var(--tp-text-xl); margin-top: 4px; }
.tp-metrics-sm .tp-metric-foot { margin-top: 4px; }
.tp-metrics-sm .tp-metric-foot a { color: var(--tp-text-secondary); text-decoration: underline; text-decoration-color: var(--tp-border-strong); }
.tp-metrics-sm { border-top: 1px solid var(--tp-border); }
.tp-stats-title { font-size: var(--tp-text-sm); font-weight: 650; color: var(--tp-text); margin: 0 0 12px; }
.tp-chart-sm { height: 220px; }
.tp-bars-sm { gap: 10px; }
.tp-bars-sm .tp-bar-row { font-size: var(--tp-text-xs); }
.tp-bars-sm .tp-bar-track { height: 5px; }

/* ---------- Encabezados con orden y filtro ---------- */
.tp-th-inner { display: flex; align-items: center; gap: 2px; }
.text-end .tp-th-inner, .tp-th.text-end .tp-th-inner { justify-content: flex-end; }
.tp-sort { border: 0; background: none; padding: 2px 4px; margin: -2px -4px; border-radius: var(--tp-radius-sm); font: inherit;
  color: inherit; letter-spacing: inherit; text-transform: inherit; display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; text-decoration: none; }
.tp-sort i { font-size: .8em; color: var(--tp-gray-300); transition: color .12s; }
/* La flecha sólo ocupa espacio en la columna ordenada: tablas más angostas y sin saltos al pasar
   el mouse (el título se resalta y el cursor indica que es clicable) */
.tp-sort:not(.active) i { display: none; }
.tp-sort { cursor: pointer; }
.tp-sort:hover { text-decoration: underline; text-decoration-color: var(--tp-gray-300); text-underline-offset: 3px; }
.tp-sort:hover { background: var(--tp-gray-100); color: var(--tp-text); }
.tp-sort:hover i { color: var(--tp-gray-500); }
.tp-sort.active { color: var(--tp-text); }
.tp-sort.active i { color: var(--tp-brand-600); }
.tp-th-filter { border: 0; background: none; width: 22px; height: 22px; border-radius: var(--tp-radius-sm); display: inline-grid; place-items: center;
  color: var(--tp-gray-300); font-size: .78rem; margin-left: 2px; }
.tp-th:hover .tp-th-filter, .tp-th-filter:focus-visible, .tp-th-filter[aria-expanded=true] { color: var(--tp-gray-500); }
.tp-th-filter:hover { background: var(--tp-gray-100); color: var(--tp-text); }
.tp-th-filter.active { color: var(--tp-brand-600); background: var(--tp-brand-50); }

/* Menú de filtro con casillas (selección múltiple) */
.tp-mf-menu { width: 260px; max-width: calc(100vw - 32px); font-size: var(--tp-text-sm); text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--tp-text); }
.tp-mf-title { padding: 10px 12px 2px; font-size: var(--tp-text-xs); font-weight: 650; color: var(--tp-text-secondary); }
.tp-mf-search { position: relative; padding: 10px 10px 4px; }
.tp-mf-search i { position: absolute; left: 20px; top: 50%; transform: translateY(-30%); color: var(--tp-text-tertiary); font-size: .8rem; pointer-events: none; }
.tp-mf-search input { padding-left: 28px; }
.tp-mf-list { max-height: 260px; overflow-y: auto; overflow-x: hidden; padding: 6px; }
.tp-mf-item { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px; border-radius: var(--tp-radius-sm); cursor: pointer; line-height: 1.3;
  white-space: normal; }
.tp-mf-item span { min-width: 0; overflow-wrap: anywhere; }
.tp-mf-item:hover { background: var(--tp-gray-50); }
.tp-mf-item input { margin-top: 1px; flex-shrink: 0; }
.tp-mf-item[hidden] { display: none; }
.tp-mf-range { display: grid; gap: 8px; padding: 12px; }
.tp-mf-range label { display: grid; gap: 4px; font-size: var(--tp-text-xs); color: var(--tp-text-secondary); font-weight: 550; }
.tp-mf-actions { display: flex; justify-content: space-between; gap: 8px; padding: 8px 10px; border-top: 1px solid var(--tp-border); background: var(--tp-surface-muted); }
[data-mf-summary].is-filtered { border-color: var(--tp-brand-500); color: var(--tp-brand-800); background-color: var(--tp-brand-50); }

/* ---------- Tabla compacta (listados de gastos e ingresos) ---------- */
.tp-table.compact { font-size: var(--tp-text-sm); }
.tp-table.compact th { padding: 8px 12px; }
.tp-table.compact td { padding: 6px 12px; }
.tp-table.compact th:first-child, .tp-table.compact td:first-child { padding-left: 16px; }
.tp-table.compact th:last-child, .tp-table.compact td:last-child { padding-right: 12px; }
.tp-table.compact .tp-badge { height: 20px; padding: 0 7px; font-size: 11px; }
.tp-table.compact .tp-cell-sub { font-size: 11px; }
.tp-table.compact .btn-icon.btn-sm { width: 26px; height: 26px; }
.tp-table.compact .tp-cell-main { font-weight: 550; white-space: nowrap; }
.tp-table.compact .tp-counterparty { max-width: 180px !important; }
.tp-table.compact .tp-doc-name { display: inline-block; max-width: 190px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.tp-table.compact .tp-cat { display: inline-block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; line-height: 18px; }
@media (min-width: 1500px) {  /* pantallas anchas: más texto visible */
  .tp-table.compact .tp-counterparty { max-width: 260px !important; }
  .tp-table.compact .tp-doc-name { max-width: 260px; }
  .tp-table.compact .tp-cat { max-width: 220px; }
}

/* Pendientes */
.tp-pending { display: flex; align-items: center; gap: 14px; padding: 16px 20px; color: var(--tp-text); }
.tp-pending + .tp-pending { border-top: 1px solid var(--tp-border); }
.tp-pending:hover { background: var(--tp-surface-muted); color: var(--tp-text); }
.tp-pending-icon { width: 36px; height: 36px; border-radius: var(--tp-radius); display: grid; place-items: center; font-size: 1.05rem; flex-shrink: 0; }
.tp-pending-icon.income { background: var(--tp-brand-50); color: var(--tp-brand-600); }
.tp-pending-icon.expense { background: var(--tp-gray-100); color: var(--tp-gray-700); }
.tp-pending-amount { font-weight: 700; font-size: var(--tp-text-md); font-variant-numeric: tabular-nums; }

/* ---------- Control segmentado (períodos, tabs compactas) ---------- */
.tp-segmented { display: inline-flex; padding: 3px; gap: 2px; background: var(--tp-gray-100); border-radius: var(--tp-radius); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.tp-segmented::-webkit-scrollbar { display: none; }
.tp-segmented a, .tp-segmented button { border: 0; background: none; height: 28px; padding: 0 12px; border-radius: 6px; font-size: var(--tp-text-sm);
  font-weight: 550; color: var(--tp-gray-600); white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tp-segmented a:hover, .tp-segmented button:hover { color: var(--tp-text); }
.tp-segmented .active { background: var(--tp-surface); color: var(--tp-text); box-shadow: var(--tp-shadow-sm); }

/* Tabs subrayadas */
.tp-tabs { display: flex; gap: 24px; border-bottom: 1px solid var(--tp-border); overflow-x: auto; scrollbar-width: none; margin-bottom: 20px; }
.tp-tabs::-webkit-scrollbar { display: none; }
.tp-tabs a { padding: 10px 0; color: var(--tp-text-secondary); font-weight: 550; font-size: var(--tp-text-base); white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tp-tabs a:hover { color: var(--tp-text); }
.tp-tabs a.active { color: var(--tp-text); border-bottom-color: var(--tp-brand-500); }

/* ---------- Tablas ---------- */
.tp-table { width: 100%; margin: 0; font-size: var(--tp-text-base); border-collapse: separate; border-spacing: 0; }
.tp-table th { font-size: var(--tp-text-xs); font-weight: 600; color: var(--tp-text-secondary); background: var(--tp-surface-muted);
  padding: 10px 16px; border-bottom: 1px solid var(--tp-border); white-space: nowrap; text-align: left; }
.tp-table td { padding: 12px 16px; border-bottom: 1px solid var(--tp-gray-100); vertical-align: middle; }
.tp-table th:first-child, .tp-table td:first-child { padding-left: 20px; }
.tp-table th:last-child, .tp-table td:last-child { padding-right: 20px; }
.tp-table tbody tr { transition: background-color .1s; }
.tp-table tbody tr:hover { background: var(--tp-surface-muted); }
.tp-table tbody tr:last-child td { border-bottom: 0; }
.tp-table tfoot td { font-weight: 700; background: var(--tp-surface-muted); border-top: 1px solid var(--tp-border); border-bottom: 0; }
.tp-table .text-end { text-align: right; }
.tp-row-link { cursor: pointer; }
.tp-cell-main { font-weight: 550; color: var(--tp-text); }
a.tp-cell-main:hover { color: var(--tp-brand-700); }
.tp-cell-sub { color: var(--tp-text-secondary); font-size: var(--tp-text-sm); }
.tp-cell-amount { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.tp-row-actions { opacity: .55; transition: opacity .12s; }
tr:hover .tp-row-actions, .tp-row-actions:focus-within, .tp-row-actions .show { opacity: 1; }
@media (hover: none) { .tp-row-actions { opacity: 1; } }

/* ---------- Toolbar de filtros ---------- */
.tp-toolbar { padding: 12px 16px; border-bottom: 1px solid var(--tp-border); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tp-search { position: relative; flex: 1 1 260px; max-width: 460px; min-width: 0; }
.tp-search input { width: 100%; }
@media (max-width: 575.98px) {
  .tp-table th, .tp-table td { padding: 12px 10px; }
  .tp-table th:first-child, .tp-table td:first-child { padding-left: 16px; }
  .tp-table th:last-child, .tp-table td:last-child { padding-right: 8px; }
}
.tp-search .bi-search { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--tp-text-tertiary); pointer-events: none; }
.tp-search input { padding-left: 36px; }
.tp-filters-panel { padding: 16px; border-bottom: 1px solid var(--tp-border); background: var(--tp-surface-muted); }
.tp-filters-panel .form-label { font-size: var(--tp-text-xs); }
.tp-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 10px 16px; border-bottom: 1px solid var(--tp-border); }
.tp-chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 6px 0 10px; border-radius: var(--tp-radius-full);
  background: var(--tp-brand-50); color: var(--tp-brand-800); font-size: var(--tp-text-xs); font-weight: 550; border: 1px solid var(--tp-brand-100); }
.tp-chip span { color: var(--tp-brand-700); font-weight: 500; }
.tp-chip a { color: var(--tp-brand-700); display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; }
.tp-chip a:hover { background: var(--tp-brand-100); }
.tp-count { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--tp-radius-full);
  background: var(--tp-brand-600); color: #fff; font-size: 11px; font-weight: 700; }

/* ---------- Badges ---------- */
.tp-badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: var(--tp-radius-full);
  font-size: var(--tp-text-xs); font-weight: 600; white-space: nowrap; border: 1px solid transparent; line-height: 1; }
.tp-badge-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tp-badge.status-PENDING { background: var(--tp-warning-bg); color: var(--tp-warning); border-color: var(--tp-warning-border); }
.tp-badge.status-PAID { background: var(--tp-success-bg); color: var(--tp-success); border-color: var(--tp-success-border); }
.tp-badge.status-PARTIAL { background: var(--tp-info-bg); color: var(--tp-info); border-color: var(--tp-info-border); }
.tp-badge.neutral { background: var(--tp-gray-50); color: var(--tp-gray-600); border-color: var(--tp-border); font-weight: 550; }
.tp-badge.inactive { background: var(--tp-gray-50); color: var(--tp-text-tertiary); border-color: var(--tp-border); }
.tp-badge.active { background: var(--tp-success-bg); color: var(--tp-success); border-color: var(--tp-success-border); }
.tp-dir { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 650; padding: 2px 6px; border-radius: 5px; letter-spacing: .01em; }
.tp-dir.INCOME { background: var(--tp-brand-50); color: var(--tp-brand-700); }
.tp-dir.EXPENSE { background: var(--tp-gray-100); color: var(--tp-gray-700); }

/* ---------- Formularios ---------- */
.form-label { font-size: var(--tp-text-sm); font-weight: 550; color: var(--tp-gray-700); margin-bottom: 6px; }
.form-control, .form-select { min-height: var(--tp-control); font-size: var(--tp-text-base); color: var(--tp-text); background-color: var(--tp-surface);
  border: 1px solid var(--tp-border-strong); border-radius: var(--tp-radius); padding: 7px 12px; box-shadow: var(--tp-shadow-xs);
  transition: border-color .12s, box-shadow .12s; }
.form-select { padding-right: 34px; background-position: right 10px center; }
.form-control-sm, .form-select-sm { min-height: var(--tp-control-sm); font-size: var(--tp-text-sm); padding-top: 4px; padding-bottom: 4px; border-radius: var(--tp-radius-sm); }
textarea.form-control { min-height: 76px; }
.form-control:hover:not(:focus):not(:disabled), .form-select:hover:not(:focus):not(:disabled) { border-color: var(--tp-gray-400); }
.form-control:focus, .form-select:focus { border-color: var(--tp-brand-500); box-shadow: var(--tp-ring); }
.form-control::placeholder { color: var(--tp-text-tertiary); }
.form-control:disabled, .form-select:disabled, .form-control[readonly] { background-color: var(--tp-gray-50); color: var(--tp-text-tertiary); box-shadow: none; }
.form-control.is-invalid, .form-select.is-invalid { border-color: var(--tp-danger); background-image: none; padding-right: 12px; }
.form-control.is-invalid:focus, .form-select.is-invalid:focus { box-shadow: 0 0 0 3px rgba(200, 50, 62, .18); }
.invalid-feedback { font-size: var(--tp-text-sm); color: var(--tp-danger); margin-top: 6px; display: flex; gap: 5px; align-items: flex-start; }
.form-text { font-size: var(--tp-text-sm); margin-top: 6px; }
.form-text ul { padding-left: 18px; margin: 4px 0 0; }
.required-mark { color: var(--tp-danger); margin-left: 2px; }
.form-check-input { width: 1.05em; height: 1.05em; border-color: var(--tp-border-strong); }
.form-check-input:checked { background-color: var(--tp-brand-600); border-color: var(--tp-brand-600); }
.form-check-input:focus { box-shadow: var(--tp-ring); border-color: var(--tp-brand-500); }
.form-switch .form-check-input { width: 2.1em; height: 1.2em; }
.input-group-text { background: var(--tp-surface-muted); border-color: var(--tp-border-strong); color: var(--tp-text-secondary); font-size: var(--tp-text-sm); }
.tp-form-section { padding: 24px; }
.tp-form-section + .tp-form-section { border-top: 1px solid var(--tp-border); }
.tp-form-actions { position: sticky; bottom: 0; z-index: 10; display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: center;
  padding: 12px 0; margin-top: 16px; background: linear-gradient(to top, var(--tp-bg) 70%, rgba(245, 246, 248, 0)); }
.tp-form-actions .tp-form-hint { margin-right: auto; color: var(--tp-text-secondary); font-size: var(--tp-text-sm); }
@media (max-width: 575.98px) {
  .tp-form-actions { margin: 16px -16px 0; padding: 12px 16px; background: var(--tp-surface); border-top: 1px solid var(--tp-border); }
  .tp-form-actions .btn { flex: 1 1 auto; }
  .tp-form-actions .tp-form-hint { display: none; }
}

/* Zona de archivos */
.tp-drop { position: relative; border: 1.5px dashed var(--tp-border-strong); border-radius: var(--tp-radius-lg); background: var(--tp-surface-muted);
  padding: 20px; text-align: center; transition: border-color .12s, background-color .12s; }
.tp-drop:hover, .tp-drop.dragover { border-color: var(--tp-brand-500); background: var(--tp-brand-50); }
.tp-drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.tp-drop-icon { width: 40px; height: 40px; border-radius: 50%; background: var(--tp-surface); border: 1px solid var(--tp-border); display: inline-grid;
  place-items: center; color: var(--tp-brand-600); font-size: 1.15rem; margin-bottom: 8px; box-shadow: var(--tp-shadow-xs); }
.tp-drop-title { font-weight: 600; font-size: var(--tp-text-base); }
.tp-drop-title u { color: var(--tp-brand-600); text-decoration: none; }
.tp-drop-hint { font-size: var(--tp-text-sm); color: var(--tp-text-secondary); margin-top: 2px; }
.tp-drop-list { list-style: none; padding: 0; margin: 10px 0 0; text-align: left; font-size: var(--tp-text-sm); }
.tp-drop-list li { display: flex; align-items: center; gap: 8px; padding: 6px 10px; background: var(--tp-surface); border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-sm); margin-top: 6px; }
.tp-drop-list li span:last-child { margin-left: auto; color: var(--tp-text-tertiary); }
.tp-drop-list:empty { display: none; }
.tp-drop-list li span.text-truncate { min-width: 0; flex: 1 1 auto; }
.tp-drop-list li span + span { margin-left: auto; color: var(--tp-text-tertiary); white-space: nowrap; }
.tp-drop-list li .btn-icon { width: 24px; height: 24px; flex-shrink: 0; }
.tp-drop-list li.is-invalid { border-color: var(--tp-danger); color: var(--tp-danger); }
.tp-drop-list li.is-invalid span + span { color: var(--tp-danger); }

/* Archivos adjuntos */
.tp-file { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--tp-gray-100); }
.tp-file:last-child { border-bottom: 0; }
.tp-file-icon { width: 36px; height: 36px; border-radius: var(--tp-radius); display: grid; place-items: center; font-size: 1.15rem; flex-shrink: 0;
  background: var(--tp-gray-50); border: 1px solid var(--tp-border); }
.tp-file-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-file-name:hover { color: var(--tp-brand-700); }

/* ---------- Detalle ---------- */
.tp-props { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 20px 24px; margin: 0; }
.tp-props dt { font-size: var(--tp-text-sm); color: var(--tp-text-secondary); font-weight: 500; margin-bottom: 4px; }
.tp-props dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.tp-amounts { margin: 0; }
.tp-amounts div { display: flex; justify-content: space-between; padding: 7px 0; font-variant-numeric: tabular-nums; }
.tp-amounts dt { font-weight: 400; color: var(--tp-text-secondary); }
.tp-amounts dd { margin: 0; font-weight: 550; }
.tp-amounts .total { border-top: 1px solid var(--tp-border); margin-top: 6px; padding-top: 12px; }
.tp-amounts .total dt { color: var(--tp-text); font-weight: 600; }
.tp-amounts .total dd { font-size: var(--tp-text-lg); font-weight: 700; letter-spacing: -.02em; }
.tp-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tp-timeline { list-style: none; padding: 0; margin: 0; font-size: var(--tp-text-sm); }
.tp-timeline li { display: flex; gap: 10px; padding: 6px 0; }
.tp-timeline i { color: var(--tp-text-tertiary); }
.tp-pdf-frame { width: 100%; height: 78vh; border: 0; display: block; background: var(--tp-gray-100); }

/* ---------- Vista previa permanente (detalle de documento) ---------- */
.tp-preview { overflow: hidden; }
.tp-preview-head { min-height: 48px; padding-top: 8px; padding-bottom: 8px; }
.tp-preview-nav { display: inline-flex; align-items: center; gap: 2px; margin-right: 4px; }
.tp-preview-nav[hidden] { display: none; }
.tp-preview-body { height: 70vh; min-height: 420px; background: var(--tp-gray-100); }
.tp-preview-frame { width: 100%; height: 100%; border: 0; display: block; }
.tp-preview-img { height: 100%; overflow: auto; display: flex; align-items: flex-start; justify-content: center; padding: 16px; }
.tp-preview-img img { max-width: 100%; height: auto; border-radius: var(--tp-radius-sm); box-shadow: var(--tp-shadow-sm); background: #fff; }
.tp-preview-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; padding: 24px; background: var(--tp-surface-muted); }
.tp-preview-empty .tp-cell-sub { max-width: 340px; }
@media (min-width: 1200px) {
  .tp-preview { position: sticky; top: var(--tp-preview-top, calc(var(--tp-topbar-h) + 12px)); }
  /* 64px encabezado de la tarjeta + 48px margen inferior de la página: al llegar al final no se desplaza */
  .tp-preview-body { height: calc(100vh - var(--tp-preview-top, calc(var(--tp-topbar-h) + 12px)) - 112px); min-height: 360px; }
}
.tp-file.active { background: var(--tp-brand-50); box-shadow: inset 3px 0 0 var(--tp-brand-500); }
.tp-file.active .tp-file-name { color: var(--tp-brand-800) !important; }
/* Información en dos columnas dentro de la columna izquierda */
.tp-props-2 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
@media (max-width: 399.98px) { .tp-props-2 { grid-template-columns: 1fr !important; } }

/* ---------- Lista de navegación (configuración) ---------- */
.tp-list-item { display: flex; align-items: center; gap: 14px; padding: 16px 20px; color: var(--tp-text); }
.tp-list-item + .tp-list-item { border-top: 1px solid var(--tp-border); }
.tp-list-item:hover { background: var(--tp-surface-muted); color: var(--tp-text); }
.tp-list-icon { width: 38px; height: 38px; border-radius: var(--tp-radius); display: grid; place-items: center; background: var(--tp-brand-50);
  color: var(--tp-brand-600); font-size: 1.1rem; flex-shrink: 0; }
.tp-list-title { font-weight: 600; }
.tp-list-desc { font-size: var(--tp-text-sm); color: var(--tp-text-secondary); }
.tp-list-meta { margin-left: auto; color: var(--tp-text-secondary); font-size: var(--tp-text-sm); display: flex; align-items: center; gap: 10px; white-space: nowrap; }

/* ---------- Estados vacíos y carga ---------- */
.tp-empty { text-align: center; padding: 48px 20px; }
.tp-empty-icon { width: 48px; height: 48px; border-radius: 12px; background: var(--tp-gray-50); border: 1px solid var(--tp-border); display: inline-grid;
  place-items: center; font-size: 1.3rem; color: var(--tp-text-tertiary); margin-bottom: 12px; }
.tp-empty-title { font-weight: 650; font-size: var(--tp-text-md); margin-bottom: 4px; }
.tp-empty-desc { color: var(--tp-text-secondary); font-size: var(--tp-text-sm); max-width: 360px; margin: 0 auto; }
.tp-empty.sm { padding: 28px 16px; }
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.btn .htmx-indicator { display: none; }
.htmx-request .btn .htmx-indicator, .htmx-request.btn .htmx-indicator { display: inline-block; }
.htmx-request .htmx-indicator, .htmx-request.htmx-indicator { opacity: 1; }
.htmx-request .tp-dim, .htmx-request.tp-dim { opacity: .5; transition: opacity .2s; pointer-events: none; }
.spinner-border { --bs-spinner-border-width: 2px; }

/* ---------- Dropdowns, modales, tooltips, toasts, alertas, paginación ---------- */
.dropdown-menu { --bs-dropdown-border-color: var(--tp-border); --bs-dropdown-border-radius: var(--tp-radius-lg); --bs-dropdown-font-size: var(--tp-text-base);
  --bs-dropdown-link-active-bg: var(--tp-brand-50); --bs-dropdown-link-active-color: var(--tp-brand-800); --bs-dropdown-link-hover-bg: var(--tp-gray-50);
  --bs-dropdown-padding-y: 6px; --bs-dropdown-padding-x: 6px; box-shadow: var(--tp-shadow-lg); min-width: 200px; }
.dropdown-item { border-radius: var(--tp-radius-sm); padding: 7px 10px; display: flex; align-items: center; gap: 10px; color: var(--tp-text); font-weight: 500; }
.dropdown-item i { color: var(--tp-text-secondary); font-size: 1rem; }
.dropdown-item.text-danger, .dropdown-item.text-danger i { color: var(--tp-danger) !important; }
.dropdown-item.text-danger:hover { background: var(--tp-danger-bg); }
.dropdown-divider { margin: 6px 0; border-color: var(--tp-border); }
.dropdown-header { font-size: 11px; font-weight: 600; color: var(--tp-text-tertiary); padding: 6px 10px 4px; }
.tp-menu-item { align-items: flex-start; padding: 9px 10px; }
.tp-menu-item i { font-size: 1.1rem; margin-top: 1px; }
.tp-menu-item small { display: block; color: var(--tp-text-secondary); font-weight: 400; font-size: var(--tp-text-xs); }
.dropdown-toggle::after { border: 0; content: "\F282"; font-family: "bootstrap-icons"; font-size: .7rem; margin-left: 2px; vertical-align: 0; opacity: .8; }

.modal { --bs-modal-border-radius: var(--tp-radius-lg); --bs-modal-border-color: var(--tp-border); --bs-modal-header-border-color: var(--tp-border);
  --bs-modal-footer-border-color: var(--tp-border); --bs-modal-padding: 20px; }
.modal-content { box-shadow: var(--tp-shadow-lg); }
.modal-backdrop { --bs-backdrop-bg: #16191d; --bs-backdrop-opacity: .4; }
.modal-header { padding: 14px 20px; }
.modal-title { font-weight: 650; font-size: var(--tp-text-md); }
.modal-footer { padding: 12px 20px; background: var(--tp-surface-muted); border-radius: 0 0 var(--tp-radius-lg) var(--tp-radius-lg); gap: 8px; }
.modal-footer > * { margin: 0; }
.tp-confirm-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--tp-danger-bg); color: var(--tp-danger); font-size: 1.15rem; flex-shrink: 0; }

.tooltip { --bs-tooltip-bg: var(--tp-gray-800); --bs-tooltip-font-size: var(--tp-text-xs); --bs-tooltip-border-radius: var(--tp-radius-sm); --bs-tooltip-padding-x: 8px; --bs-tooltip-padding-y: 5px; font-family: var(--tp-font); }

.toast-container { z-index: 1090; }
.tp-toast { display: flex; align-items: flex-start; gap: 10px; width: 360px; max-width: calc(100vw - 32px); background: var(--tp-surface); border: 1px solid var(--tp-border);
  border-radius: var(--tp-radius-lg); box-shadow: var(--tp-shadow-lg); padding: 12px 12px 12px 14px; font-size: var(--tp-text-base); }
.tp-toast-icon { font-size: 1.1rem; line-height: 1.3; }
.tp-toast.success .tp-toast-icon { color: var(--tp-success); }
.tp-toast.error .tp-toast-icon { color: var(--tp-danger); }
.tp-toast.warning .tp-toast-icon { color: var(--tp-warning); }
.tp-toast.info .tp-toast-icon { color: var(--tp-brand-600); }
.tp-toast .btn-close { width: 8px; height: 8px; margin-left: auto; padding: 6px; opacity: .45; }

.alert { --bs-alert-border-radius: var(--tp-radius); font-size: var(--tp-text-base); padding: 12px 14px; display: flex; gap: 10px; align-items: flex-start; }
.alert-danger { --bs-alert-bg: var(--tp-danger-bg); --bs-alert-color: #8f1f29; --bs-alert-border-color: var(--tp-danger-border); }
.alert-info { --bs-alert-bg: var(--tp-info-bg); --bs-alert-color: var(--tp-brand-800); --bs-alert-border-color: var(--tp-info-border); }
.alert-warning { --bs-alert-bg: var(--tp-warning-bg); --bs-alert-color: #7a4807; --bs-alert-border-color: var(--tp-warning-border); }
.alert-neutral { background: var(--tp-surface-muted); border: 1px solid var(--tp-border); color: var(--tp-text-secondary); }

.tp-pagination { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--tp-border); }
.tp-pages { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.tp-pages a, .tp-pages span { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 8px; border-radius: var(--tp-radius-sm);
  font-size: var(--tp-text-sm); font-weight: 550; color: var(--tp-gray-600); border: 1px solid transparent; }
.tp-pages a:hover { background: var(--tp-gray-100); color: var(--tp-text); }
.tp-pages .current { background: var(--tp-surface); border-color: var(--tp-border-strong); color: var(--tp-text); box-shadow: var(--tp-shadow-xs); }
.tp-pages .disabled { color: var(--tp-gray-300); }

/* ---------- Autenticación y errores ---------- */
.tp-auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); background: var(--tp-surface); }
.tp-auth-brand { background: var(--tp-gray-800); color: #fff; padding: 40px 48px; display: flex; flex-direction: column; justify-content: space-between; align-items: flex-start; }
.tp-auth-brand .tp-logo { height: 44px; }
.tp-auth-box .tp-logo, .tp-error-box .tp-logo { align-self: center; }
.tp-auth-claim { font-size: 1.75rem; font-weight: 650; letter-spacing: -.025em; line-height: 1.25; max-width: 420px; color: #fff; }
.tp-auth-points { list-style: none; padding: 0; margin: 24px 0 0; color: rgba(255, 255, 255, .72); display: grid; gap: 10px; }
.tp-auth-points i { color: var(--tp-brand-300); margin-right: 8px; }
.tp-auth-legal { font-size: var(--tp-text-xs); color: rgba(255, 255, 255, .45); }
.tp-auth-form { display: grid; place-items: center; padding: 40px 24px; }
.tp-auth-box { width: 100%; max-width: 380px; }
@media (max-width: 991.98px) {
  .tp-auth { grid-template-columns: 1fr; background: var(--tp-bg); }
  .tp-auth-brand { display: none; }
  .tp-auth-box { background: var(--tp-surface); border: 1px solid var(--tp-border); border-radius: var(--tp-radius-lg); padding: 28px 24px; box-shadow: var(--tp-shadow-sm); }
}
.tp-error { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--tp-bg); }
.tp-error-box { max-width: 440px; text-align: center; }
.tp-error-code { font-size: 3rem; font-weight: 750; letter-spacing: -.04em; color: var(--tp-gray-300); line-height: 1; margin: 28px 0 8px; }
