/* ============================================================
   Sigain - hoja de estilos principal
   ============================================================ */

[hidden] { display: none !important; }

:root {
  --brand-50: #f0fdfa;
  --brand-100: #ccfbf1;
  --brand-200: #99f6e4;
  --brand-400: #2dd4bf;
  --brand-500: #14b8a6;
  --brand-600: #0d9488;
  --brand-700: #0f766e;
  --brand-800: #115e59;
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #526176;
  --muted-light: #5f6f82;
  --line: #e5eaf1;
  --line-soft: #f1f5f9;
  --bg: #f4f7fb;
  --white: #ffffff;
  --income: #047857;
  --income-soft: #ecfdf5;
  --expense: #be123c;
  --expense-soft: #fff1f2;
  --amber: #d97706;
  --sidebar: #0b1727;
  --sidebar-soft: #122033;
  --radius: 16px;
  --radius-lg: 22px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 10px 30px rgba(15, 23, 42, .05);
  --bs-body-font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --bs-body-color: #0f172a;
  --bs-border-color: #e5eaf1;
  --bs-primary: #0f766e;
  --bs-primary-rgb: 15, 118, 110;
  --bs-link-color: #0f766e;
  --bs-link-hover-color: #115e59;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--bs-body-font-family);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand-700); text-decoration: none; }
a:hover { color: var(--brand-800); }

h1, h2, h3, h4, p { margin-top: 0; }

::selection { background: var(--brand-100); color: var(--brand-800); }

:focus-visible {
  outline: 3px solid rgba(13, 148, 136, .25);
  outline-offset: 2px;
}

/* ------------------------------ Botones ------------------------------ */

.btn {
  --bs-btn-font-size: .875rem;
  --bs-btn-font-weight: 600;
  --bs-btn-padding-y: .58rem;
  --bs-btn-padding-x: .95rem;
  --bs-btn-border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  white-space: nowrap;
}

.btn-primary {
  --bs-btn-bg: var(--brand-700);
  --bs-btn-border-color: var(--brand-700);
  --bs-btn-hover-bg: var(--brand-800);
  --bs-btn-hover-border-color: var(--brand-800);
  --bs-btn-active-bg: #0b4f4a;
  --bs-btn-active-border-color: #0b4f4a;
  --bs-btn-focus-shadow-rgb: 15, 118, 110;
  --bs-btn-box-shadow: 0 8px 18px rgba(15, 118, 110, .16);
}

.btn-sm {
  --bs-btn-padding-y: .4rem;
  --bs-btn-padding-x: .7rem;
  --bs-btn-font-size: .8rem;
  --bs-btn-border-radius: 8px;
}

.btn-lg {
  --bs-btn-padding-y: .8rem;
  --bs-btn-padding-x: 1.15rem;
  --bs-btn-font-size: .95rem;
}

.btn-outline-secondary {
  --bs-btn-color: #475569;
  --bs-btn-border-color: #dbe3ec;
  --bs-btn-hover-bg: #f8fafc;
  --bs-btn-hover-color: var(--ink);
  --bs-btn-hover-border-color: #cbd5e1;
  --bs-btn-active-bg: #f1f5f9;
  --bs-btn-active-color: var(--ink);
  background: #fff;
}

.btn-outline-danger {
  --bs-btn-color: #be123c;
  --bs-btn-border-color: #fecdd3;
  --bs-btn-hover-bg: #fff1f2;
  --bs-btn-hover-color: #9f1239;
  --bs-btn-hover-border-color: #fda4af;
  --bs-btn-active-bg: #ffe4e6;
  --bs-btn-active-color: #9f1239;
  background: #fff;
}

.btn-outline-success {
  --bs-btn-color: #047857;
  --bs-btn-border-color: #a7f3d0;
  --bs-btn-hover-bg: #ecfdf5;
  --bs-btn-hover-color: #065f46;
  --bs-btn-hover-border-color: #6ee7b7;
  background: #fff;
}

.btn-ghost {
  color: #475569;
  background: transparent;
  border: 1px solid transparent;
}
.btn-ghost:hover { background: #f1f5f9; color: var(--ink); }

.icon-btn {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: #475569;
  font-size: 15px;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.icon-btn:hover { background: #f8fafc; color: var(--ink); border-color: #cbd5e1; }
.icon-btn-sm { width: 31px; height: 31px; border-radius: 8px; font-size: 13px; }
.icon-btn-danger:hover { background: var(--expense-soft); color: var(--expense); border-color: #fecdd3; }
.icon-btn.is-disabled { background: #f8fafc; color: #cbd5e1; border-color: #eef2f7; cursor: not-allowed; }

.inline-form { display: inline-flex; margin: 0; }
.row-actions { display: flex; align-items: center; gap: 5px; }

.text-income { color: var(--income) !important; }
.text-expense { color: var(--expense) !important; }
.text-muted { color: var(--muted) !important; }

/* --------------------------- Formularios ---------------------------- */

.form-label {
  font-size: .78rem;
  font-weight: 650;
  color: var(--ink-soft);
  margin-bottom: .35rem;
  letter-spacing: .005em;
}

.form-control,
.form-select {
  border: 1px solid #dbe3ec;
  border-radius: 10px;
  padding: .62rem .78rem;
  font-size: .88rem;
  color: var(--ink);
  background-color: #fff;
  box-shadow: none;
}
.form-control::placeholder { color: #a5b4c4; }
.form-control:focus,
.form-select:focus {
  border-color: var(--brand-500);
  box-shadow: 0 0 0 4px rgba(13, 148, 136, .11);
}
.form-control.is-invalid,
.form-select.is-invalid {
  border-color: #fb7185;
  box-shadow: 0 0 0 4px rgba(225, 29, 72, .07);
}
.form-control:disabled { background: #f8fafc; color: var(--muted); }
.form-text, .form-hint {
  font-size: .74rem;
  color: var(--muted);
  margin-top: .35rem;
}
.invalid-feedback { font-size: .76rem; font-weight: 500; }
.form-select-sm { font-size: .78rem; padding: .38rem 1.9rem .38rem .6rem; }
.form-control-color { width: 52px; height: 42px; padding: .2rem; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-field { margin-bottom: 18px; }
.label-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.label-optional { color: var(--muted-light); font-weight: 400; }

.input-with-icon { position: relative; }
.input-with-icon .form-control { padding-right: 2.4rem; }
.input-with-icon > i {
  position: absolute;
  right: .85rem;
  top: 50%;
  transform: translateY(-50%);
  color: #9aa8ba;
  font-size: 15px;
  pointer-events: none;
}

.password-field { position: relative; }
.password-field .form-control { padding-right: 2.8rem; }
.password-toggle {
  position: absolute;
  right: .35rem;
  top: 50%;
  transform: translateY(-50%);
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #8b9aad;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.password-toggle:hover { background: #f1f5f9; color: var(--ink); }

.input-group-text {
  background: #f8fafc;
  border-color: #dbe3ec;
  color: #64748b;
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .02em;
}
.money-input .input-group-text { border-radius: 10px 0 0 10px; }
.money-input .form-control { border-radius: 0 10px 10px 0; font-weight: 650; }

.app-form { padding: 4px 24px 24px; }
.form-card > .card-head { padding-bottom: 12px; }
.form-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--line-soft);
}
.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, .72fr);
  gap: 20px;
  align-items: start;
}
.form-stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.form-aside { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.aside-card {
  padding: 24px;
  position: relative;
  overflow: hidden;
}
.aside-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.aside-card p {
  color: var(--muted);
  font-size: .83rem;
  line-height: 1.65;
  margin-bottom: 0;
}
.aside-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: 18px;
  margin-bottom: 14px;
}
.aside-icon-amber { background: #fffbeb; color: var(--amber); }
.aside-icon-green { background: #ecfdf5; color: var(--income); }
.aside-icon-danger { background: var(--expense-soft); color: var(--expense); }
.aside-card-soft { background: linear-gradient(160deg, #f8fafc, #fff); }
.aside-card-danger { border-color: #fecdd3; background: #fffafa; }
.aside-card-danger h3 { color: #9f1239; }
.aside-card-meta { padding: 20px 24px; }
.aside-card-meta .meta-label {
  display: block;
  font-size: .68rem;
  text-transform: uppercase;
  letter-spacing: .09em;
  color: var(--muted-light);
  margin: 10px 0 2px;
}
.aside-card-meta .meta-label:first-child { margin-top: 0; }
.aside-card-meta strong { font-size: .8rem; font-weight: 600; color: var(--ink-soft); }

.inline-warning {
  margin-top: 9px;
  padding: .55rem .7rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 8px;
  color: #92400e;
  font-size: .76rem;
  line-height: 1.5;
}
.inline-warning a { color: #92400e; font-weight: 700; text-decoration: underline; }

.color-field { display: flex; align-items: center; gap: 10px; }
.color-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: .75rem;
  color: var(--muted);
  background: #f8fafc;
  border: 1px solid var(--line);
  padding: .3rem .5rem;
  border-radius: 7px;
}

/* ------------------------ Selector de tipo -------------------------- */

.type-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.type-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.type-option:hover { border-color: #cbd5e1; background: #fbfdff; }
.type-radio {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.type-icon {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
}
.type-option-income .type-icon { background: var(--income-soft); color: var(--income); }
.type-option-expense .type-icon { background: var(--expense-soft); color: var(--expense); }
.type-copy { display: flex; flex-direction: column; line-height: 1.25; }
.type-copy strong { font-size: .88rem; font-weight: 700; }
.type-copy small { font-size: .71rem; color: var(--muted); margin-top: 3px; }
.type-check { margin-left: auto; opacity: 0; color: var(--brand-600); font-size: 18px; }
.type-option-income:has(.type-radio:checked) { border-color: #34d399; background: #f6fef9; box-shadow: 0 0 0 3px rgba(16, 185, 129, .08); }
.type-option-expense:has(.type-radio:checked) { border-color: #fb7185; background: #fff8f9; box-shadow: 0 0 0 3px rgba(225, 29, 72, .07); }
.type-option:has(.type-radio:checked) .type-check { opacity: 1; }
.type-option-income:has(.type-radio:checked) .type-check { color: var(--income); }
.type-option-expense:has(.type-radio:checked) .type-check { color: var(--expense); }
.type-switch-compact .type-option { padding: 11px 12px; }
.type-switch-compact .type-icon { width: 35px; height: 35px; flex-basis: 35px; font-size: 15px; }
.type-switch-compact .type-copy small { display: none; }

/* ----------------------------- Estructura ----------------------------- */

.app-shell { min-height: 100vh; }
.app-main {
  margin-left: 266px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.app-content {
  width: 100%;
  max-width: 1580px;
  margin: 0 auto;
  padding: 26px 32px 36px;
  flex: 1;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 15px 32px;
  background: rgba(244, 247, 251, .86);
  border-bottom: 1px solid rgba(229, 234, 241, .85);
  backdrop-filter: blur(14px);
}
.topbar-heading { flex: 1; min-width: 0; }
.eyebrow {
  display: block;
  font-size: .66rem;
  font-weight: 700;
  letter-spacing: .11em;
  text-transform: uppercase;
  color: var(--brand-700);
  margin-bottom: 1px;
}
.topbar-heading h1 {
  font-size: 1.42rem;
  font-weight: 740;
  letter-spacing: -.025em;
  color: var(--ink);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.topbar-user {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 9px 5px 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
}
.topbar-user:hover { background: #fbfdff; border-color: #cbd5e1; color: var(--ink); }
.topbar-user-text { display: flex; flex-direction: column; line-height: 1.15; max-width: 125px; }
.topbar-user-text strong { font-size: .76rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar-user-text small { font-size: .65rem; color: var(--muted); }
.avatar {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--brand-500), var(--brand-700));
  color: #fff;
  font-size: .72rem;
  font-weight: 750;
  letter-spacing: .03em;
}
.avatar-dark { background: rgba(255, 255, 255, .09); color: var(--brand-200); }
.avatar-xl { width: 64px; height: 64px; flex-basis: 64px; border-radius: 18px; font-size: 1.15rem; }

.app-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 32px 22px;
  font-size: .7rem;
  color: var(--muted-light);
}

/* ------------------------------ Sidebar ------------------------------- */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 1045;
  width: 266px;
  display: flex;
  flex-direction: column;
  padding: 20px 14px 16px;
  background:
    radial-gradient(120% 55% at 0% 0%, rgba(20, 184, 166, .14) 0%, transparent 55%),
    linear-gradient(180deg, #0b1727 0%, #0c1a2c 55%, #0a1523 100%);
  color: #cbd5e1;
  overflow-y: auto;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 22px;
  color: #fff;
}
.sidebar-brand:hover { color: #fff; }
.sidebar-brand .brand-text strong { color: #fff; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); }
.brand:hover { color: var(--ink); }
.brand-mark {
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--brand-500), var(--brand-700));
  color: #fff;
  font-size: 19px;
  box-shadow: 0 6px 16px rgba(13, 148, 136, .25);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-size: 1.1rem; font-weight: 760; letter-spacing: -.03em; }
.brand-text small { font-size: .63rem; font-weight: 500; color: #7f91a8; margin-top: 3px; letter-spacing: .02em; }
.brand-light .brand-text strong { color: #fff; }
.brand-light .brand-text small { color: #8fa0b5; }

.sidebar-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.nav-heading {
  padding: 18px 12px 7px;
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #5f7188;
}
.sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #a9b8ca;
  font-size: .82rem;
  font-weight: 520;
  transition: background .15s ease, color .15s ease;
}
.sidebar-link i { font-size: 16px; width: 19px; text-align: center; color: #7f91a8; transition: color .15s ease; }
.sidebar-link:hover { background: rgba(255, 255, 255, .05); color: #e2e8f0; }
.sidebar-link:hover i { color: #cbd5e1; }
.sidebar-link.active {
  background: linear-gradient(90deg, rgba(20, 184, 166, .17), rgba(20, 184, 166, .06));
  color: #5eead4;
}
.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: #2dd4bf;
}
.sidebar-link.active i { color: #5eead4; }
.nav-badge {
  margin-left: auto;
  font-size: .58rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: #5eead4;
  background: rgba(20, 184, 166, .12);
  border: 1px solid rgba(45, 212, 191, .18);
  padding: 2px 6px;
  border-radius: 5px;
}

.sidebar-footer { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .07); }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border-radius: 10px;
  color: #e2e8f0;
  min-width: 0;
}
.sidebar-user:hover { background: rgba(255, 255, 255, .05); color: #fff; }
.sidebar-user-text { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.sidebar-user-text strong { font-size: .76rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-text small { font-size: .65rem; color: #7f91a8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.sidebar-logout-form { margin-top: 6px; }
.sidebar-logout {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 11px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: #8fa0b5;
  font-size: .76rem;
  font-weight: 500;
  text-align: left;
}
.sidebar-logout:hover { background: rgba(225, 29, 72, .1); color: #fda4af; }
.sidebar-logout i { font-size: 15px; width: 19px; text-align: center; }

.sidebar-install {
  width: 100%;
  margin-top: 14px;
  border: 1px solid rgba(45, 212, 191, .22);
  background: rgba(20, 184, 166, .09);
  color: #99f6e4;
  font-family: inherit;
  cursor: pointer;
  text-align: left;
}
.sidebar-install:hover { background: rgba(20, 184, 166, .17); color: #fff; }
.sidebar-install i { color: #5eead4; }
.sidebar-mobile-head { display: none; }

.business-switcher {
  margin: 0 4px 8px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 12px;
  background: rgba(255, 255, 255, .035);
}
.business-switcher-label {
  display: block;
  margin-bottom: 7px;
  font-size: .6rem;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #7f91a8;
}
.business-switcher-form { display: flex; align-items: stretch; gap: 6px; }
.business-switcher-select {
  position: relative;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  flex: 1;
  padding: 0 8px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 9px;
  background: rgba(8, 20, 34, .72);
  color: #5eead4;
}
.business-switcher-select > i { font-size: 14px; flex: 0 0 auto; }
.business-switcher-select select {
  width: 100%;
  min-width: 0;
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: #e2e8f0;
  font-size: .78rem;
  font-weight: 600;
  outline: none;
}
.business-switcher-select select option { color: #0f172a; background: #fff; }
.business-switcher-go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  flex: 0 0 34px;
  border: 1px solid rgba(45, 212, 191, .22);
  border-radius: 9px;
  background: rgba(20, 184, 166, .14);
  color: #5eead4;
  font-size: 14px;
}
.business-switcher-go:hover { background: rgba(20, 184, 166, .24); color: #99f6e4; }
.business-switcher-manage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 9px;
  font-size: .68rem;
  font-weight: 600;
  color: #8fa0b5;
}
.business-switcher-manage:hover { color: #5eead4; }

.business-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 190px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  color: var(--brand-700);
  font-size: .7rem;
  font-weight: 650;
  white-space: nowrap;
}
.business-chip span { overflow: hidden; text-overflow: ellipsis; }
.business-chip i { font-size: 13px; }

.business-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 18px;
}
.business-card { padding: 22px; display: flex; flex-direction: column; gap: 18px; }
.business-card-active { border-color: rgba(13, 148, 136, .35); box-shadow: 0 10px 24px rgba(15, 118, 110, .08); }
.business-card-top { display: flex; gap: 14px; align-items: flex-start; }
.business-avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(145deg, var(--brand-500), var(--brand-700));
  color: #fff;
  font-size: .86rem;
  font-weight: 750;
  letter-spacing: .03em;
  box-shadow: 0 7px 16px rgba(13, 148, 136, .2);
}
.business-card-copy { min-width: 0; }
.business-title-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.business-title-row h2 { margin: 0; font-size: 1rem; font-weight: 740; letter-spacing: -.02em; }
.business-card-copy p { margin: 5px 0 0; color: var(--muted); font-size: .76rem; line-height: 1.45; }
.business-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 13px 0;
  border-top: 1px solid var(--line-soft);
  border-bottom: 1px solid var(--line-soft);
}
.business-meta div { display: flex; flex-direction: column; gap: 3px; }
.business-meta span { color: var(--muted); font-size: .64rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.business-meta strong { font-size: .82rem; font-weight: 700; }
.business-card-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.business-card-actions form { margin: 0; }
.business-active-note {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-right: auto;
  color: var(--income);
  font-size: .72rem;
  font-weight: 650;
}
.business-delete-blocked {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted-light);
  font-size: .68rem;
  font-weight: 600;
}

/* ------------------------------- Tarjetas ------------------------------ */

.card {
  --bs-card-bg: #fff;
  --bs-card-border-color: var(--line);
  --bs-card-border-radius: var(--radius);
  --bs-card-spacer-x: 24px;
  --bs-card-spacer-y: 20px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  background: #fff;
  margin: 0;
}
.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px 14px;
}
.card-head h2 { font-size: 1.01rem; font-weight: 720; letter-spacing: -.015em; margin: 0 0 3px; }
.card-head p { font-size: .78rem; color: var(--muted); margin: 0; }
.card-head-copy { flex: 1; }
.card-head-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}
.card-head-income { background: var(--income-soft); color: var(--income); }
.card-head-expense { background: var(--expense-soft); color: var(--expense); }
.card-foot { padding: 14px 24px; border-top: 1px solid var(--line-soft); }
.card-table .card-head { padding-bottom: 8px; }
.soft-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 7px;
  background: #f6f8fb;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .67rem;
  font-weight: 650;
  letter-spacing: .02em;
  white-space: nowrap;
}
.soft-badge-income { background: var(--income-soft); border-color: #d1fae5; color: var(--income); }
.soft-badge-expense { background: var(--expense-soft); border-color: #ffe4e6; color: var(--expense); }
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .75rem;
  font-weight: 650;
  color: var(--brand-700);
  white-space: nowrap;
}
.text-link i { font-size: .68rem; transition: transform .15s ease; }
.text-link:hover i { transform: translateX(2px); }

/* ------------------------------ Métricas ------------------------------- */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 15px;
  margin-bottom: 20px;
}
.metric-card {
  position: relative;
  padding: 18px 19px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.metric-card-highlight {
  border-color: transparent;
  background:
    radial-gradient(100% 120% at 100% 0%, rgba(45, 212, 191, .22), transparent 55%),
    linear-gradient(145deg, #0f766e 0%, #0b4a46 100%);
  color: #fff;
  box-shadow: 0 12px 28px rgba(15, 118, 110, .18);
}
.metric-top { display: flex; align-items: center; gap: 10px; margin-bottom: 13px; }
.metric-icon {
  width: 35px;
  height: 35px;
  flex: 0 0 35px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
}
.metric-icon-income { background: var(--income-soft); color: var(--income); }
.metric-icon-expense { background: var(--expense-soft); color: var(--expense); }
.metric-icon-balance { background: var(--brand-50); color: var(--brand-700); }
.metric-icon-history { background: #eef2ff; color: #4f46e5; }
.metric-label { font-size: .73rem; font-weight: 620; color: var(--muted); }
.metric-value {
  display: block;
  font-size: 1.62rem;
  font-weight: 760;
  letter-spacing: -.035em;
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  margin-bottom: 8px;
}
.metric-foot {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  font-size: .66rem;
  color: var(--muted-light);
  min-height: 18px;
}
.metric-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: .65rem;
  font-weight: 700;
}
.metric-delta.is-good { background: var(--income-soft); color: var(--income); }
.metric-delta.is-bad { background: var(--expense-soft); color: var(--expense); }
.metric-muted { color: var(--muted-light); }
.metric-card-highlight .metric-label { color: rgba(240, 253, 250, .72); }
.metric-card-highlight .metric-icon { background: rgba(255, 255, 255, .13); color: #ccfbf1; }
.metric-card-highlight .metric-value { color: #fff; }
.metric-card-highlight .metric-value.text-expense { color: #fecdd3 !important; }
.metric-card-highlight .metric-foot { color: rgba(240, 253, 250, .55); }
.metric-card-highlight .metric-muted { color: rgba(240, 253, 250, .55); }
.metric-card-highlight .metric-delta.is-good { background: rgba(16, 185, 129, .18); color: #a7f3d0; }
.metric-card-highlight .metric-delta.is-bad { background: rgba(244, 63, 94, .18); color: #fecdd3; }

/* ------------------------------ Dashboard ------------------------------ */

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.62fr) minmax(310px, .9fr);
  gap: 18px;
  margin-bottom: 18px;
  align-items: start;
}
.dashboard-grid-bottom { align-items: stretch; }
.chart-card { overflow: hidden; }
.chart-card-wide { margin-bottom: 18px; }
.chart-box {
  position: relative;
  height: 290px;
  padding: 2px 14px 14px;
}
.chart-box-lg { height: 300px; }
.chart-box-doughnut { height: 215px; padding: 0 12px; }
.chart-box canvas { width: 100% !important; height: 100% !important; }
.doughnut-wrap { position: relative; }
.doughnut-center {
  position: absolute;
  inset: 0 0 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
}
.doughnut-center span { font-size: .64rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted-light); font-weight: 650; }
.doughnut-center strong { font-size: 1.22rem; letter-spacing: -.03em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.category-breakdown { display: flex; flex-direction: column; gap: 10px; padding: 4px 24px 22px; }
.category-line { display: flex; align-items: flex-start; gap: 9px; }
.category-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 8px; margin-top: 5px; }
.category-line-main { flex: 1; min-width: 0; }
.category-line-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.category-line-top span { font-size: .75rem; color: var(--ink-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.category-line-top strong { font-size: .73rem; font-weight: 650; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress {
  height: 6px;
  background: #f1f5f9;
  border-radius: 999px;
  overflow: hidden;
}
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--brand-500); }
.progress.slim { height: 4px; }

.insight-card { display: flex; flex-direction: column; }
.insight-list { padding: 2px 24px 8px; display: flex; flex-direction: column; }
.insight-item { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-soft); }
.insight-item:last-child { border-bottom: 0; }
.insight-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #eef2ff;
  color: #4f46e5;
  font-size: 16px;
}
.insight-icon-green { background: var(--income-soft); color: var(--income); }
.insight-icon-amber { background: #fffbeb; color: var(--amber); }
.insight-copy { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.insight-copy small { font-size: .68rem; color: var(--muted-light); font-weight: 550; }
.insight-copy strong { font-size: .93rem; font-weight: 720; letter-spacing: -.01em; }
.insight-copy span { font-size: .68rem; color: var(--muted); margin-top: 1px; }
.insight-note {
  display: flex;
  gap: 10px;
  margin: auto 24px 22px;
  padding: 12px 13px;
  border-radius: 11px;
  font-size: .72rem;
  line-height: 1.5;
}
.insight-note i { font-size: 16px; margin-top: 1px; }
.insight-note div { display: flex; flex-direction: column; }
.insight-note strong { font-size: .74rem; font-weight: 700; }
.insight-note span { color: inherit; }
.insight-note.is-positive { background: #f0fdfa; color: #0f766e; border: 1px solid #ccfbf1; }
.insight-note.is-negative { background: #fff7f8; color: #be123c; border: 1px solid #ffe4e6; }

/* -------------------------------- Tablas ------------------------------- */

.app-table {
  --bs-table-bg: transparent;
  --bs-table-hover-bg: #fbfdff;
  margin: 0;
  color: var(--ink);
  font-size: .8rem;
}
.app-table > :not(caption) > * > * { padding: 12px 20px; border-bottom-color: var(--line-soft); }
.app-table thead th {
  font-size: .61rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  background: #fbfcfe;
  border-bottom: 1px solid var(--line);
  padding-top: 10px;
  padding-bottom: 10px;
  white-space: nowrap;
}
.app-table tbody tr:last-child td { border-bottom: 0; }
.app-table tbody tr { transition: background .12s ease; }
.app-table tbody tr:hover { background: #fbfdff; }
.app-table tfoot td { font-weight: 700; border-top: 1px solid var(--line); background: #fbfcfe; }
.tx-main { display: flex; align-items: center; gap: 11px; min-width: 0; }
.tx-icon {
  width: 37px;
  height: 37px;
  flex: 0 0 37px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  background: #f1f5f9;
  background: color-mix(in srgb, var(--cat-color, #0f766e) 13%, #ffffff);
  color: var(--cat-color, #0f766e);
}
.tx-copy { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.tx-copy strong { font-size: .8rem; font-weight: 620; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px; }
.tx-copy small { font-size: .68rem; color: var(--muted-light); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 340px; }
.category-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px 3px 7px;
  background: #f8fafc;
  border: 1px solid var(--line-soft);
  border-radius: 999px;
  font-size: .68rem;
  color: var(--ink-soft);
  white-space: nowrap;
}
.category-pill .category-dot { margin-top: 0; width: 6px; height: 6px; flex-basis: 6px; }
.amount-cell {
  font-weight: 720;
  font-variant-numeric: tabular-nums;
  letter-spacing: -.01em;
  white-space: nowrap;
}
.amount-cell.is-income { color: var(--income); }
.amount-cell.is-expense { color: var(--expense); }
.row-muted { opacity: .52; }
.total-row td { font-weight: 750 !important; }

/* ------------------------------ Filtros -------------------------------- */

.filter-card { padding: 18px 20px 14px; margin-bottom: 15px; }
.filter-grid {
  display: grid;
  grid-template-columns: minmax(160px, 1.7fr) minmax(105px, .65fr) minmax(150px, 1fr) 135px 135px auto;
  gap: 11px;
  align-items: end;
}
.filter-field .form-label { font-size: .7rem; color: var(--muted); margin-bottom: .28rem; }
.filter-actions { display: flex; align-items: center; gap: 7px; }
.filter-actions .btn { padding: .58rem .8rem; }
.quick-filters {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  padding-top: 12px;
  margin-top: 13px;
  border-top: 1px solid var(--line-soft);
  font-size: .68rem;
  color: var(--muted-light);
}
.filter-chip {
  padding: 3px 8px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: .68rem;
  font-weight: 550;
}
.filter-chip:hover { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-200); }
.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  margin-bottom: 15px;
  overflow: hidden;
}
.summary-strip-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.summary-item { padding: 12px 18px; border-right: 1px solid var(--line-soft); display: flex; flex-direction: column; gap: 1px; }
.summary-item:last-child { border-right: 0; }
.summary-label { font-size: .64rem; color: var(--muted-light); font-weight: 600; text-transform: uppercase; letter-spacing: .07em; }
.summary-item strong { font-size: .95rem; font-weight: 720; letter-spacing: -.015em; font-variant-numeric: tabular-nums; }

.pagination-wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.pagination-info { font-size: .72rem; color: var(--muted-light); }
.pagination {
  --bs-pagination-border-color: var(--line);
  --bs-pagination-hover-bg: #f8fafc;
  --bs-pagination-hover-color: var(--brand-700);
  --bs-pagination-focus-box-shadow: none;
  --bs-pagination-active-bg: var(--brand-700);
  --bs-pagination-active-border-color: var(--brand-700);
  --bs-pagination-color: #64748b;
  gap: 3px;
}
.pagination .page-link { border-radius: 7px !important; font-size: .73rem; padding: .34rem .58rem; }

/* ------------------------------ Categorías ----------------------------- */

.category-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}
.category-group { padding-bottom: 8px; }
.category-list { display: flex; flex-direction: column; padding: 0 12px 8px; }
.category-row {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 11px;
  border-radius: 11px;
  transition: background .12s ease;
}
.category-row:hover { background: #fbfdff; }
.category-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  background: #f1f5f9;
  background: color-mix(in srgb, var(--cat-color, #0f766e) 13%, #ffffff);
  color: var(--cat-color, #0f766e);
}
.category-icon-lg { width: 50px; height: 50px; flex-basis: 50px; border-radius: 14px; font-size: 21px; }
.category-info { display: flex; flex-direction: column; min-width: 0; flex: 1; line-height: 1.3; }
.category-info strong { font-size: .82rem; font-weight: 620; }
.category-info small { font-size: .68rem; color: var(--muted-light); margin-top: 1px; }
.preview-card {
  padding: 22px;
  background: linear-gradient(160deg, #fff, #fbfdff);
}
.preview-kicker {
  font-size: .62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
  color: var(--muted-light);
  display: block;
  margin-bottom: 16px;
}
.preview-category { display: flex; align-items: center; gap: 13px; margin-bottom: 15px; }
.preview-category strong { display: block; font-size: 1rem; font-weight: 700; letter-spacing: -.015em; }
.preview-category small { font-size: .7rem; color: var(--muted); }
.preview-card p { font-size: .76rem; color: var(--muted); line-height: 1.6; margin: 0; }

/* ------------------------------- Reportes ------------------------------ */

.year-form { display: flex; align-items: center; gap: 6px; }
.year-form .form-select { width: 92px; }
.report-category-block { padding: 4px 24px 18px; }
.report-category-block + .report-category-block { padding-top: 16px; border-top: 1px solid var(--line-soft); }
.report-category-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: .73rem;
  margin-bottom: 10px;
}
.report-category-head span { display: inline-flex; align-items: center; gap: 5px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-size: .65rem; }
.report-category-head strong { font-size: .78rem; font-weight: 720; }
.report-category-block .category-line { margin-bottom: 9px; }
.muted-note { color: var(--muted-light); font-size: .75rem; margin: 0; }

/* ------------------------------- Ajustes ------------------------------- */

.settings-tabs {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  background: #eef2f7;
  border-radius: 11px;
  margin-bottom: 18px;
}
.settings-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 8px;
  font-size: .76rem;
  font-weight: 600;
  color: var(--muted);
}
.settings-tab:hover { color: var(--ink); }
.settings-tab.active { background: #fff; color: var(--ink); box-shadow: var(--shadow-sm); }
.settings-tab i { font-size: 14px; }

.install-body { padding: 0 24px 24px; }
.install-lead {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.65;
}
.install-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: #f8fafc;
}
.install-status {
  max-width: 40ch;
  color: var(--muted);
  font-size: .73rem;
  line-height: 1.5;
}
.install-installed {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 11px 13px;
  border: 1px solid #d1fae5;
  border-radius: 10px;
  background: var(--income-soft);
  color: var(--income);
  font-size: .76rem;
  font-weight: 600;
}
.install-installed i { font-size: 16px; }
.install-steps { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.install-step {
  display: flex;
  gap: 13px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.install-step-number {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: 17px;
}
.install-step strong { display: block; margin-bottom: 3px; font-size: .8rem; font-weight: 700; }
.install-step p { margin: 0; color: var(--muted); font-size: .76rem; line-height: 1.6; }
.install-key {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 3px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #f8fafc;
  color: var(--ink-soft);
  font-size: .7rem;
  line-height: 1;
}
.account-card { padding: 26px 22px; text-align: center; }
.account-card .avatar { margin-bottom: 12px; }
.account-card h3 { font-size: 1rem; font-weight: 720; margin-bottom: 2px; }
.account-card > p { font-size: .74rem; color: var(--muted); margin-bottom: 18px; }
.account-meta { display: flex; flex-direction: column; text-align: left; border-top: 1px solid var(--line-soft); padding-top: 8px; }
.account-meta > div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line-soft); font-size: .72rem; }
.account-meta > div:last-child { border-bottom: 0; }
.account-meta span { color: var(--muted); }
.account-meta strong { font-weight: 600; font-size: .73rem; text-align: right; }
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: .66rem;
  font-weight: 650;
  white-space: nowrap;
}
.status-badge.is-on { background: var(--income-soft); color: #047857; border: 1px solid #d1fae5; }
.status-badge.is-off { background: #f8fafc; color: var(--muted); border: 1px solid var(--line); }
.status-badge-soft { background: var(--brand-50); color: var(--brand-700); border: 1px solid var(--brand-100); }
.twofa-copy { display: flex; gap: 12px; margin: 0 24px 16px; padding: 14px; background: #f8fafc; border: 1px solid var(--line-soft); border-radius: 11px; }
.twofa-icon {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: var(--brand-700);
  border: 1px solid var(--line);
  font-size: 16px;
}
.twofa-copy strong { display: block; font-size: .76rem; font-weight: 650; margin-bottom: 2px; word-break: break-all; }
.twofa-copy p { margin: 0; font-size: .72rem; color: var(--muted); line-height: 1.55; }
.twofa-form { padding: 0 24px 24px; }
.twofa-form .form-field { max-width: 420px; }
.twofa-form .form-actions { justify-content: flex-start; }
.twofa-form-danger .form-actions { border-top: 0; padding-top: 0; }

/* -------------------------------- Sesiones ----------------------------- */

.sessions-card { overflow: hidden; }
.session-list { display: flex; flex-direction: column; padding: 0 12px 10px; }
.session-row {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 15px 12px;
  border-bottom: 1px solid var(--line-soft);
}
.session-row:last-child { border-bottom: 0; }
.session-icon {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f4f7fb;
  color: #475569;
  font-size: 18px;
}
.session-main { flex: 1; min-width: 0; }
.session-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 2px; }
.session-title strong { font-size: .82rem; font-weight: 650; }
.session-ua { display: block; color: var(--muted-light); font-size: .66rem; margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.session-meta { display: flex; align-items: center; gap: 10px 16px; flex-wrap: wrap; font-size: .68rem; color: var(--muted); }
.session-meta span { display: inline-flex; align-items: center; gap: 4px; }
.session-meta i { color: #a3b1c2; font-size: .72rem; }
.session-action { flex: 0 0 auto; padding-top: 3px; }
.info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }

/* ------------------------------- Admin --------------------------------- */

.app-table-users { font-size: .76rem; }
.app-table-users > :not(caption) > * > * { padding: 11px 14px; }
.user-cell { display: flex; align-items: center; gap: 10px; min-width: 190px; }
.user-cell > div { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.user-cell strong { font-size: .78rem; font-weight: 650; white-space: nowrap; }
.user-cell small { font-size: .67rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; max-width: 210px; }
.user-cell-meta { font-size: .62rem; color: var(--muted-light); margin-top: 1px; }
.mini-badge {
  font-size: .56rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  vertical-align: 1px;
  color: var(--brand-700);
  background: var(--brand-50);
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid var(--brand-100);
}
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 6px;
  font-size: .65rem;
  font-weight: 650;
  background: #eef2ff;
  color: #4f46e5;
  border: 1px solid #e0e7ff;
}
.role-admin { background: var(--brand-50); color: var(--brand-700); border-color: var(--brand-100); }
.role-form { display: flex; align-items: center; gap: 4px; }
.role-form .form-select { min-width: 86px; }
.security-line { display: inline-flex; align-items: center; gap: 5px; font-size: .7rem; color: var(--muted); white-space: nowrap; }
.activity-cell { display: flex; flex-direction: column; line-height: 1.35; }
.activity-cell strong { font-size: .71rem; font-weight: 620; }
.activity-cell small { font-size: .63rem; color: var(--muted-light); }
.app-table-users .row-actions { flex-wrap: nowrap; }

/* ------------------------------- Callouts ------------------------------ */

.callout {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: .78rem;
  line-height: 1.55;
}
.callout > i { font-size: 18px; margin-top: 1px; flex: 0 0 auto; }
.callout div { display: flex; flex-direction: column; }
.callout strong { font-weight: 700; }
.callout span { opacity: .82; }
.callout-info { background: #f0f9ff; border: 1px solid #e0f2fe; color: #075985; }
.callout-warning { background: #fffbeb; border: 1px solid #fef3c7; color: #92400e; }

/* ---------------------------- Estados vacíos --------------------------- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 46px 24px 42px;
}
.empty-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f4f7fb;
  color: #94a3b8;
  font-size: 23px;
  margin-bottom: 13px;
}
.empty-state h3 { font-size: .95rem; font-weight: 700; margin-bottom: 4px; }
.empty-state p { font-size: .77rem; color: var(--muted); max-width: 360px; margin-bottom: 15px; }
.empty-state-compact { padding: 30px 20px 34px; }
.empty-state-compact .empty-icon { width: 48px; height: 48px; border-radius: 14px; font-size: 20px; }
.empty-state-compact h3 { font-size: .88rem; }
.empty-state-compact p { font-size: .73rem; }

/* ------------------------------- Alerts -------------------------------- */

.flash-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 1085;
  width: min(420px, calc(100vw - 32px));
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.app-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 40px 12px 13px;
  margin: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: 12px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, .12);
  color: var(--ink);
  font-size: .78rem;
}
.app-alert.alert-success { border-left-color: #10b981; }
.app-alert.alert-danger { border-left-color: #f43f5e; }
.app-alert.alert-warning { border-left-color: #f59e0b; }
.app-alert.alert-info { border-left-color: #0ea5e9; }
.alert-icon { font-size: 17px; flex: 0 0 auto; margin-top: 1px; }
.alert-success .alert-icon { color: #059669; }
.alert-danger .alert-icon { color: #e11d48; }
.alert-warning .alert-icon { color: #d97706; }
.alert-info .alert-icon { color: #0284c7; }
.alert-text { flex: 1; line-height: 1.5; }
.app-alert .btn-close { position: absolute; top: 10px; right: 10px; width: .65rem; height: .65rem; font-size: .65rem; opacity: .45; }
.app-alert .btn-close:hover { opacity: .8; }

/* ------------------------------ Errores -------------------------------- */

.error-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(60% 55% at 15% 0%, rgba(20, 184, 166, .12), transparent 60%),
    radial-gradient(50% 50% at 100% 100%, rgba(99, 102, 241, .1), transparent 60%),
    var(--bg);
  padding: 24px;
}
.error-page {
  position: relative;
  width: min(540px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 46px 42px;
  text-align: center;
  overflow: hidden;
}
.error-code {
  position: absolute;
  top: -28px;
  right: 18px;
  font-size: 7.5rem;
  font-weight: 800;
  letter-spacing: -.06em;
  color: #f1f5f9;
  line-height: 1;
  pointer-events: none;
}
.error-icon {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 17px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: 25px;
  margin-bottom: 16px;
}
.error-page h1 { position: relative; font-size: 1.4rem; font-weight: 750; letter-spacing: -.025em; margin-bottom: 8px; }
.error-page p { position: relative; color: var(--muted); font-size: .85rem; line-height: 1.65; max-width: 390px; margin: 0 auto 22px; }
.error-actions { position: relative; display: flex; justify-content: center; gap: 8px; }

/* -------------------------------- Auth --------------------------------- */

.auth-body {
  background:
    radial-gradient(70% 60% at 100% 0%, rgba(20, 184, 166, .1), transparent 60%),
    radial-gradient(50% 50% at 0% 100%, rgba(99, 102, 241, .08), transparent 60%),
    #f4f7fb;
}
.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(0, .94fr);
}
.auth-showcase {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 42px 54px;
  overflow: hidden;
  color: #dbe6f2;
  background:
    radial-gradient(80% 60% at 10% 0%, rgba(20, 184, 166, .25), transparent 55%),
    radial-gradient(70% 60% at 100% 100%, rgba(56, 189, 248, .13), transparent 60%),
    linear-gradient(155deg, #08131f 0%, #0b1c2d 55%, #0a1726 100%);
}
.auth-showcase::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255, 255, 255, .055) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.55), transparent 70%);
  pointer-events: none;
}
.auth-showcase > * { position: relative; z-index: 1; }
.auth-showcase .brand { color: #fff; padding: 0; }
.showcase-copy { margin-top: clamp(40px, 8vh, 88px); max-width: 520px; }
.showcase-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(94, 234, 212, .22);
  background: rgba(20, 184, 166, .1);
  color: #5eead4;
  font-size: .66rem;
  font-weight: 650;
  letter-spacing: .03em;
  margin-bottom: 20px;
}
.showcase-copy h1 {
  font-size: clamp(2.2rem, 3.5vw, 3.25rem);
  line-height: 1.04;
  letter-spacing: -.045em;
  font-weight: 760;
  color: #f8fafc;
  margin-bottom: 18px;
}
.showcase-copy h1 span {
  background: linear-gradient(100deg, #5eead4, #38bdf8);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.showcase-copy p { color: #98a9bc; font-size: .92rem; line-height: 1.7; max-width: 430px; margin: 0; }
.showcase-card {
  width: min(440px, 100%);
  margin-top: 38px;
  padding: 20px 21px;
  border-radius: 18px;
  border: 1px solid rgba(255, 255, 255, .1);
  background: linear-gradient(160deg, rgba(255, 255, 255, .09), rgba(255, 255, 255, .035));
  box-shadow: 0 24px 50px rgba(0, 0, 0, .2);
  backdrop-filter: blur(8px);
}
.showcase-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.showcase-card-head span { display: block; color: #8fa3b8; font-size: .68rem; }
.showcase-card-head strong { display: block; color: #f8fafc; font-size: 1.55rem; letter-spacing: -.03em; margin-top: 2px; font-variant-numeric: tabular-nums; }
.showcase-chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(16, 185, 129, .13);
  border: 1px solid rgba(52, 211, 153, .18);
  color: #6ee7b7 !important;
  font-size: .63rem !important;
  font-weight: 650;
}
.showcase-bars {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 76px;
  margin: 20px 0 18px;
  padding-top: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
}
.showcase-bars span {
  flex: 1;
  height: var(--h);
  min-height: 8px;
  border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, #2dd4bf, rgba(13, 148, 136, .5));
  opacity: .9;
}
.showcase-bars span:nth-child(even) { background: linear-gradient(180deg, #38bdf8, rgba(14, 116, 144, .42)); opacity: .65; }
.showcase-lines { display: flex; flex-direction: column; gap: 8px; }
.showcase-lines span {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #9fb1c4;
  font-size: .69rem;
}
.showcase-lines i { color: #64748b; font-size: .8rem; }
.showcase-lines b { margin-left: auto; color: #e2e8f0; font-weight: 650; font-size: .7rem; }
.showcase-lines b.positive { color: #6ee7b7; }
.showcase-features { list-style: none; padding: 0; margin: 30px 0 0; display: flex; flex-direction: column; gap: 10px; }
.showcase-features li { display: flex; align-items: center; gap: 9px; color: #a9b8ca; font-size: .75rem; }
.showcase-features i { color: #2dd4bf; font-size: 15px; }
.showcase-foot { margin: auto 0 0; padding-top: 26px; color: #61758c; font-size: .66rem; display: flex; align-items: center; gap: 6px; }

.auth-main {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 38px 24px;
  min-width: 0;
}
.auth-brand-mobile { display: none; margin-bottom: 22px; }
.auth-card {
  width: min(440px, 100%);
  background: rgba(255, 255, 255, .94);
  border: 1px solid rgba(229, 234, 241, .95);
  border-radius: 22px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .09);
  padding: 36px 36px 32px;
  backdrop-filter: blur(10px);
}
.auth-head { text-align: center; margin-bottom: 26px; }
.auth-icon {
  width: 50px;
  height: 50px;
  border-radius: 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(145deg, var(--brand-50), #e6fffb);
  color: var(--brand-700);
  border: 1px solid var(--brand-100);
  font-size: 22px;
  margin-bottom: 14px;
  box-shadow: 0 8px 20px rgba(13, 148, 136, .09);
}
.auth-icon-soft { background: #f5f3ff; color: #6d28d9; border-color: #ede9fe; box-shadow: 0 8px 20px rgba(109, 40, 217, .09); }
.auth-head h2 { font-size: 1.42rem; font-weight: 760; letter-spacing: -.03em; margin-bottom: 5px; }
.auth-head p { font-size: .79rem; color: var(--muted); line-height: 1.55; margin: 0; max-width: 330px; margin-inline: auto; }
.auth-head p strong { color: var(--ink-soft); font-weight: 650; word-break: break-all; }
.auth-card .form-field { margin-bottom: 16px; }
.auth-card .form-label { font-size: .75rem; }
.auth-card .form-control { padding: .68rem .8rem; font-size: .86rem; }
.auth-submit { margin-top: 6px; height: 48px; font-size: .87rem; }
.auth-submit i { font-size: 16px; }
.tiny-link { font-size: .69rem; font-weight: 600; color: var(--brand-700); }
.tiny-link:hover { text-decoration: underline; }
.auth-note {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin-top: 18px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--brand-50);
  border: 1px solid #d5fbf3;
  color: #0f766e;
  font-size: .68rem;
  line-height: 1.5;
}
.auth-note i { flex: 0 0 auto; font-size: 14px; margin-top: 1px; }
.auth-note-muted { background: #f8fafc; border-color: var(--line-soft); color: var(--muted); }
.auth-switch { text-align: center; margin: 20px 0 0; font-size: .74rem; color: var(--muted); }
.auth-switch a { font-weight: 650; color: var(--brand-700); }
.auth-switch a:hover { text-decoration: underline; }
.auth-switch-quiet { margin-top: 16px; }
.auth-copyright { margin: 22px 0 0; font-size: .65rem; color: #a5b4c4; text-align: center; }
.password-strength { margin-top: 6px; }
.strength-track { height: 4px; border-radius: 999px; background: #eef2f7; overflow: hidden; }
.strength-track span { display: block; height: 100%; width: 0; border-radius: inherit; background: #f43f5e; transition: width .2s ease, background .2s ease; }
.password-strength small { display: block; margin-top: 4px; font-size: .64rem; color: var(--muted-light); }
.otp-form { margin-top: 2px; }
.otp-input {
  height: 58px;
  text-align: center;
  font-size: 1.65rem !important;
  font-weight: 700;
  letter-spacing: .55em;
  padding-left: 1.1rem !important;
  font-variant-numeric: tabular-nums;
}
.otp-input::placeholder { letter-spacing: .45em; color: #cbd5e1; }
.resend-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 18px;
  font-size: .71rem;
  color: var(--muted);
}
.resend-form { display: inline-flex; margin: 0; }
.link-button {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--brand-700);
  font-weight: 650;
  font-size: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.link-button:hover { text-decoration: underline; }
.link-button:disabled { color: var(--muted-light); cursor: not-allowed; text-decoration: none; }

/* ------------------------------- Responsive ---------------------------- */

@media (max-width: 1240px) {
  .filter-grid { grid-template-columns: minmax(170px, 1.6fr) 110px 160px 130px 130px; }
  .filter-actions { grid-column: 1 / -1; justify-content: flex-end; padding-top: 2px; }
  .metric-value { font-size: 1.45rem; }
}

@media (max-width: 1180px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .insight-card .insight-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 18px; }
  .insight-card .insight-item { border-bottom: 0; }
  .insight-note { margin-top: 8px; }
  .metrics-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .category-columns { grid-template-columns: 1fr; }
}

@media (max-width: 991.98px) {
  .app-main { margin-left: 0; }
  .sidebar { width: 280px; }
  .sidebar.offcanvas-lg { width: 280px; }
  .sidebar-footer { margin-top: auto; }
  .sidebar-mobile-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px 12px;
    color: #fff;
  }
  .sidebar-mobile-title { font-size: .75rem; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: #8fa0b5; }
  .topbar { padding: 13px 18px; }
  .app-content { padding: 20px 18px 30px; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-showcase { display: none; }
  .auth-main { min-height: 100vh; padding: 30px 18px; }
  .auth-brand-mobile { display: inline-flex; }
  .auth-card { box-shadow: 0 18px 50px rgba(15, 23, 42, .09); }
}

@media (max-width: 800px) {
  .form-layout { grid-template-columns: 1fr; }
  .form-aside { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .form-aside .aside-card:last-child:nth-child(odd) { grid-column: 1 / -1; }
  .info-grid { grid-template-columns: 1fr; }
  .insight-card .insight-list { grid-template-columns: 1fr; }
  .insight-card .insight-item { border-bottom: 1px solid var(--line-soft); }
  .insight-card .insight-item:last-child { border-bottom: 0; }
  .topbar-user-text { display: none; }
  .filter-grid { grid-template-columns: 1fr 1fr 1fr; }
  .filter-field-search { grid-column: 1 / -1; }
  .filter-actions { grid-column: 1 / -1; }
  .summary-strip { grid-template-columns: 1fr 1fr; }
  .summary-item { border-bottom: 1px solid var(--line-soft); }
  .summary-item:nth-child(2n) { border-right: 0; }
  .summary-item:nth-last-child(-n+2) { border-bottom: 0; }
  .summary-strip-3 { grid-template-columns: 1fr 1fr 1fr; }
  .summary-strip-3 .summary-item { border-bottom: 0; }
  .summary-strip-3 .summary-item:nth-child(2n) { border-right: 1px solid var(--line-soft); }
  .summary-strip-3 .summary-item:last-child { border-right: 0; }
  .dashboard-grid-bottom { align-items: start; }
}

@media (max-width: 767.98px) {
  .topbar { flex-wrap: wrap; }
  .topbar-heading { flex: 1 1 100%; order: 2; }
  .topbar > .icon-btn { order: 1; }
  .topbar-actions { order: 3; width: 100%; justify-content: flex-start; }
  .topbar-user { margin-left: auto; }
  .topbar-heading h1 { font-size: 1.24rem; white-space: normal; }
  .page-title-hide { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .type-switch { grid-template-columns: 1fr; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 11px; }
  .metric-card { padding: 15px; }
  .metric-value { font-size: 1.3rem; }
  .metric-label { font-size: .68rem; }
  .metric-icon { width: 32px; height: 32px; flex-basis: 32px; font-size: 14px; }
  .card-head { padding: 17px 18px 12px; }
  .chart-box { height: 245px; padding: 0 8px 12px; }
  .chart-box-lg { height: 250px; }
  .category-breakdown { padding-inline: 18px; }
  .insight-list { padding-inline: 18px; }
  .insight-note { margin-inline: 18px; }
  .app-table > :not(caption) > * > * { padding: 10px 14px; }
  .tx-copy strong, .tx-copy small { max-width: 190px; }
  .form-card .card-head { padding-inline: 18px; }
  .app-form { padding: 4px 18px 20px; }
  .filter-card { padding: 15px; }
  .filter-grid { grid-template-columns: 1fr 1fr; }
  .filter-field-search { grid-column: 1 / -1; }
  .filter-actions { grid-column: 1 / -1; }
  .demo-none { display: none; }
  .session-row { flex-wrap: wrap; }
  .session-action { width: 100%; padding-left: 55px; }
  .form-aside { grid-template-columns: 1fr; }
  .auth-card { padding: 28px 22px 26px; }
  .auth-head h2 { font-size: 1.25rem; }
  .settings-tabs { display: flex; width: 100%; }
  .settings-tab { flex: 1; justify-content: center; }
  .install-body { padding-inline: 18px; }
  .install-actions { align-items: flex-start; }
  .app-table-users .d-none.d-xl-inline { display: none !important; }
  .business-grid { grid-template-columns: 1fr; }
}

@media (max-width: 520px) {
  .business-meta { grid-template-columns: 1fr 1fr; }
  .business-card-actions .btn { flex: 1 1 auto; }
  .business-chip { max-width: 140px; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-value { font-size: 1.45rem; }
  .topbar-actions .btn-action span { display: none; }
  .topbar-actions .btn-action { width: 38px; padding-inline: 0; }
  .filter-grid { grid-template-columns: 1fr; }
  .summary-strip, .summary-strip-3 { grid-template-columns: 1fr 1fr; }
  .summary-item { padding: 10px 14px; }
  .summary-item:nth-child(2n) { border-right: 0; }
  .summary-item:nth-last-child(-n+2) { border-bottom: 0; }
  .summary-item:nth-child(3) { border-bottom: 1px solid var(--line-soft); }
  .month-label { font-size: .72rem; }
  .month-switcher { padding: 2px; }
  .month-today { display: none; }
  .pagination-wrap { justify-content: center; }
  .pagination-info { width: 100%; text-align: center; }
  .session-meta { flex-direction: column; align-items: flex-start; gap: 3px; }
  .form-actions { flex-direction: column-reverse; align-items: stretch; }
  .form-actions .btn { width: 100%; }
  .app-footer { flex-wrap: wrap; }
  .callout { font-size: .73rem; }
  .error-page { padding: 36px 24px; }
  .error-code { font-size: 6rem; }
  .user-cell { min-width: 150px; }
  .user-cell small { max-width: 160px; }
}

/* Movimiento del mes */
.month-switcher {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.month-arrow {
  width: 27px;
  height: 29px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
}
.month-arrow:hover { background: #f1f5f9; color: var(--ink); }
.month-label { padding: 0 7px; font-size: .76rem; font-weight: 650; white-space: nowrap; color: var(--ink-soft); }
.month-today {
  margin-left: 2px;
  padding: 3px 7px;
  border-radius: 6px;
  background: var(--brand-50);
  color: var(--brand-700);
  font-size: .63rem;
  font-weight: 650;
}
.month-today:hover { background: var(--brand-100); }

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

/* Utilidades pequeñas */
.justify-content-end { justify-content: flex-end; }
.text-nowrap { white-space: nowrap; }
.fw-semibold { font-weight: 600 !important; }
.w-100 { width: 100% !important; }
