:root {
  --bg-header: rgba(33, 71, 116, 0.94);
  --bg-footer: #214774;
  --bg-main: linear-gradient(90deg, #000000 0%, #120e4e 44%, #25238e 74%, #3a36d1 100%);
  --panel: rgba(7, 12, 38, 0.72);
  --panel-border: rgba(255, 160, 175, 0.58);
  --text-main: #eef3ff;
  --text-soft: #c8d3f1;
  --text-muted: #a5b3d9;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --card-income: #7dd351;
  --card-expense: #ff5757;
  --card-balance: #07c25f;
  --card-saving: #24b7d4;
  --button: #ff8fa3;
  --button-hover: #ff7b92;
  --input-bg: rgba(255, 255, 255, 0.08);
  --surface: rgba(16, 23, 62, 0.55);
  --border-soft: rgba(255, 255, 255, 0.12);
  --danger: #ff7a8e;
  --success: #6ce2a0;
  --warning: #ffd877;
  --overlay: rgba(5, 8, 20, 0.68);
  --table-head: rgba(33, 71, 116, 0.78);
  --icon: currentColor;
  --header-height: 104px;
  --official-rate-note-height: 38px;
}

:root[data-theme="light"] {
  --bg-header: rgba(220, 232, 247, 0.92);
  --bg-footer: #dce8f7;
  --bg-main: linear-gradient(90deg, #eef5ff 0%, #e6ecff 52%, #dfe5ff 100%);
  --panel: rgba(255, 255, 255, 0.82);
  --panel-border: rgba(230, 143, 165, 0.62);
  --text-main: #193155;
  --text-soft: #375076;
  --text-muted: #58759e;
  --shadow: 0 18px 35px rgba(42, 70, 120, 0.12);
  --input-bg: rgba(42, 70, 120, 0.05);
  --surface: rgba(255, 255, 255, 0.88);
  --border-soft: rgba(42, 70, 120, 0.12);
  --overlay: rgba(30, 45, 82, 0.28);
  --table-head: rgba(33, 71, 116, 0.12);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Inter", system-ui, sans-serif;
  background: #0f1630;
  color: var(--text-main);
}
body { overflow-x: hidden; }
button, input, select, textarea { font: inherit; }
button { border: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
.hidden { display: none !important; }
.screen { display: none; min-height: 100vh; }
.screen--active { display: block; }
textarea { resize: vertical; }

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(76, 212, 255, 0.18), transparent 25%),
    radial-gradient(circle at bottom right, rgba(255, 143, 163, 0.18), transparent 24%),
    linear-gradient(135deg, #101631 0%, #161b5f 50%, #2228a0 100%);
}

.login-card,
.filters-panel,
.table-card,
.modal-card {
  background: var(--panel);
  backdrop-filter: blur(12px);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
}

.login-card {
  width: min(100%, 460px);
  padding: 28px;
  border-radius: 26px;
}

.login-brand, .brand, .filters-title, .header-actions, .profile-box {
  display: flex;
  align-items: center;
}

.login-brand { gap: 16px; margin-bottom: 28px; }
.login-brand h1, .brand-copy h2 { margin: 0; font-size: clamp(1.55rem, 2vw, 1.9rem); }
.login-brand p, .brand-copy p, .filters-title p, .table-toolbar p, .modal-head p, .modal-note, .login-help, .form-message, .stat-mini, .profile-label, .exchange-note, .row-meta {
  margin: 4px 0 0;
  color: var(--text-soft);
  font-size: 0.95rem;
}
.login-logo, .brand-logo, .profile-image {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 0 0 4px rgba(76, 212, 255, 0.16);
}
.profile-image { width: 48px; height: 48px; }

.login-form, .filters-form, .record-form { display: grid; gap: 16px; }
.login-form label, .filters-form label, .record-form label {
  display: grid;
  gap: 8px;
  font-weight: 600;
  color: var(--text-soft);
  font-size: 0.94rem;
}

input, select, textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border-soft);
  background: var(--input-bg);
  color: var(--text-main);
  padding: 13px 14px;
  outline: none;
  transition: border-color .25s ease, transform .2s ease, background .25s ease;
}
select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) calc(50% - 2px), calc(100% - 14px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
  padding-right: 42px;
}
:root:not([data-theme="light"]) { color-scheme: dark; }
:root[data-theme="light"] { color-scheme: light; }
:root:not([data-theme="light"]) select,
:root:not([data-theme="light"]) option,
:root:not([data-theme="light"]) optgroup {
  background-color: #162243;
  color: #eef3ff;
}
:root[data-theme="light"] select,
:root[data-theme="light"] option,
:root[data-theme="light"] optgroup {
  background-color: #ffffff;
  color: #193155;
}
input::placeholder, textarea::placeholder { color: var(--text-muted); }
input:focus, select:focus, textarea:focus { border-color: rgba(76,212,255,.7); transform: translateY(-1px); }

.primary-button, .secondary-button, .icon-button, .fab, .filters-fab, .header-icon-button, .profile-image-button, .logout-button {
  transition: transform .2s ease, box-shadow .25s ease, background .25s ease;
}
.primary-button {
  padding: 14px 18px;
  border-radius: 14px;
  background: var(--button);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 10px 20px rgba(255, 143, 163, 0.22);
}
.primary-button:hover { background: var(--button-hover); transform: translateY(-1px); }
.secondary-button, .header-icon-button, .logout-button, .profile-image-button, .icon-button {
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,.08);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
}
.secondary-button:hover, .icon-button:hover, .filters-fab:hover, .header-icon-button:hover, .logout-button:hover, .profile-image-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 24px rgba(0,0,0,.16);
}
.icon-button--small { width: 40px; height: 40px; padding: 0; display: grid; place-items: center; }
.form-message { min-height: 18px; }
.form-message--error { color: var(--danger); }
.form-message--success { color: var(--success); }
.login-help {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
  flex-wrap: wrap;
}

.app-header, .app-footer {
  background: var(--bg-header);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px clamp(18px, 3vw, 36px);
}
.app-header {
  min-height: var(--header-height);
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.app-footer {
  background: var(--bg-footer);
  min-height: auto;
  padding-block: 18px;
  flex-direction: column;
  gap: 4px;
  text-align: center;
}
.app-footer p { margin: 0; color: var(--text-soft); }

.brand { gap: 14px; }
.header-actions { gap: 12px; flex-wrap: wrap; justify-content: flex-end; }
.profile-box {
  gap: 12px;
  padding: 8px 10px 8px 8px;
  border-radius: 18px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}
.profile-image-button {
  padding: 0;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  overflow: hidden;
  flex: 0 0 auto;
}
.profile-copy { display: grid; gap: 2px; min-width: 120px; }
.profile-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; }
#profileName { font-size: .96rem; line-height: 1.1; }
.logout-button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  padding-inline: 14px;
}

.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: rgba(255,255,255,.12);
  border-radius: 999px;
  color: var(--text-main);
  border: 1px solid rgba(255,255,255,.16);
}
.toggle-track {
  position: relative;
  width: 62px;
  height: 30px;
  border-radius: 999px;
  background: rgba(5,8,20,.28);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12);
}
.toggle-thumb {
  position: absolute;
  left: 4px;
  top: 4px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  transition: transform .26s ease;
  box-shadow: 0 5px 14px rgba(0,0,0,.18);
}
:root[data-theme="light"] .toggle-thumb { transform: translateX(32px); }
.toggle-icon, .filters-icon, .stat-icon, .header-icon-button, .logout-button svg, .filters-fab svg { display: grid; place-items: center; }
.toggle-icon svg, .filters-icon svg, .icon-button svg, .actions svg, .filters-fab svg, .header-icon-button svg, .logout-button svg, .stat-icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--icon);
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.header-icon-button { width: 48px; height: 48px; padding: 0; border-radius: 14px; }
.header-icon-button svg { width: 20px; height: 20px; }
.logout-button svg, .icon-button svg { width: 18px; height: 18px; }

.dashboard-shell {
  position: relative;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 20px;
  min-height: calc(100vh - var(--header-height));
  padding: 20px;
  background: var(--bg-main);
}
.filters-panel {
  border-radius: 28px;
  padding: 22px;
  align-self: start;
  position: sticky;
  top: calc(var(--header-height) + 20px);
}
.filters-head { margin-bottom: 20px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.filters-title { gap: 14px; }
.filters-title h3, .table-toolbar h3, .modal-head h3 { margin: 0; font-size: 1.15rem; }
.filters-icon, .stat-icon {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  color: var(--text-main);
  background: rgba(255,255,255,.08);
}
.filters-actions, .actions, .modal-actions, .toolbar-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.content-panel { display: grid; gap: 20px; align-content: start; }
.content-topbar {
  display: flex;
  justify-content: flex-start;
  min-height: 0;
}
.desktop-filters-reveal {
  display: none;
  align-items: center;
  gap: 8px;
}
.desktop-filters-reveal svg,
.desktop-filter-toggle svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; align-items: start; }
.stat-card {
  min-height: 168px;
  height: 200px;
  border-radius: 28px;
  padding: 18px;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 14px;
  color: #0f1837;
  box-shadow: 0 16px 26px rgba(0,0,0,.16);
  overflow: hidden;
}
.stat-card--income { background: var(--card-income); }
.stat-card--expense { background: var(--card-expense); }
.stat-card--balance { background: var(--card-balance); }
.stat-card--saving { background: var(--card-saving); }
.stat-topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.stat-label { font-weight: 800; font-size: 1rem; display: block; }
.stat-mini { color: rgba(15,24,55,.75); font-size: .8rem; }
.stat-icon { flex: 0 0 auto; }
.stat-icon svg { width: 22px; height: 22px; }
.stat-currencies { display: grid; gap: 8px; min-height: 0; }
.currency-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  
  border-top: 1px solid rgba(15,24,55,.18);
}
.currency-line--stacked { display: grid; gap: 6px; align-content: start; }
.currency-line-main { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; min-width: 0; }
.currency-label { font-size: .82rem; font-weight: 800; letter-spacing: .08em; }
.stat-value { font-size: 1.24rem; font-weight: 800; }
.stat-value--secondary { font-size: 1.14rem; min-width: 0; }
.exchange-note {
  color: rgba(15,24,55,.82);
  font-size: .72rem;
  line-height: 1.2;
  display: grid;
  gap: 1px;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
  white-space: normal;
  word-break: break-word;
  min-height: var(--official-rate-note-height);
}
.exchange-line {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-card {
  border-radius: 28px;
  padding: 20px;
}

.modal-card--wide {
  width: min(100%, 1180px);
}

.charts-sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.charts-content-topbar {
  display: flex;
  justify-content: flex-start;
}

.charts-sidebar-reveal {
  display: none;
  align-items: center;
  gap: 8px;
}
.charts-sidebar-reveal svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.modal-card--wide.charts-filters-collapsed .charts-layout {
  grid-template-columns: minmax(0, 1fr);
}

.modal-card--wide.charts-filters-collapsed .charts-sidebar {
  display: none;
}

.modal-card--wide.charts-filters-collapsed .charts-sidebar-reveal {
  display: inline-flex;
}

.charts-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 18px;
}

.charts-sidebar {
  border: 1px solid var(--border-soft);
  border-radius: 22px;
  padding: 16px;
  background: rgba(255,255,255,.04);
  align-self: start;
  min-width: 0;
}

.charts-content {
  display: grid;
  gap: 16px;
  min-width: 0;
}

.chart-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.chart-stat-card {
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border-soft);
  display: grid;
  gap: 8px;
}

.chart-stat-card span {
  color: var(--text-soft);
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}

.chart-stat-card strong {
  font-size: 1.02rem;
}

.chart-panel {
  border-radius: 24px;
  border: 1px solid var(--border-soft);
  background: rgba(255,255,255,.04);
  padding: 16px;
  display: grid;
  gap: 16px;
  min-width: 0;
}

.chart-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.chart-summary-text {
  color: var(--text-soft);
  font-weight: 700;
}

.chart-canvas {
  min-height: 320px;
  display: grid;
  align-items: center;
  min-width: 0;
}

.chart-scroll {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-bottom: 8px;
}

.chart-svg {
  width: 100%;
  min-width: 640px;
  height: auto;
}

.chart-svg--pie {
  min-width: 320px;
  max-width: 420px;
}

.chart-axis {
  stroke: rgba(255,255,255,.25);
  stroke-width: 1.6;
}

.chart-svg-label,
.chart-svg-value,
.chart-svg-center-label,
.chart-svg-center-value {
  fill: currentColor;
  font-family: "Inter", system-ui, sans-serif;
}

.chart-svg-label { font-size: 12px; }
.chart-svg-value { font-size: 12px; font-weight: 700; }
.chart-svg-center-label { font-size: 14px; opacity: .8; }
.chart-svg-center-value { font-size: 18px; font-weight: 800; }

.chart-center {
  display: grid;
  place-items: center;
  width: 100%;
  min-width: 0;
  overflow: hidden;
}

.chart-legend {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
  min-width: 0;
}

.chart-legend-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border-soft);
}

.chart-legend-item small {
  color: var(--text-soft);
}

.chart-legend-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-top: 4px;
  flex: 0 0 auto;
}

.chart-empty {
  min-height: 280px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text-soft);
  border: 1px dashed var(--border-soft);
  border-radius: 18px;
}
.table-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.table-pagination {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.pagination-size {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text-soft);
  font-size: .92rem;
  font-weight: 700;
}
.pagination-size select {
  min-width: 82px;
  padding-right: 38px;
}
.pagination-controls {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.pagination-info {
  min-width: 108px;
  text-align: center;
  font-weight: 700;
  color: var(--text-soft);
}
.icon-button:disabled,
.secondary-button:disabled,
.primary-button:disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}
.mobile-fab-group {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: none;
  align-items: center;
  gap: 12px;
  z-index: 60;
}
.filters-fab {
  position: static;
}
.filters-fab--add {
  background: linear-gradient(135deg, #ff7aa6, #ff92b7);
}
.record-form--readonly input,
.record-form--readonly textarea,
.record-form--readonly select {
  cursor: default;
}

.table-wrap { overflow: auto; }
.records-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 980px;
}
.records-table th,
.records-table td {
  padding: 14px 12px;
  text-align: left;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}
.records-table thead th {
  position: sticky;
  top: 0;
  background: var(--table-head);
  backdrop-filter: blur(8px);
  z-index: 2;
}
.records-table tbody tr:hover { background: rgba(255,255,255,.03); }
.empty-state { text-align: center; color: var(--text-soft); padding: 32px 14px; }
.accounts-flow { display: inline-flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.accounts-flow span { opacity: .7; }

.sub-tag {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: .78rem;
  font-weight: 700;
}
.sub-tag--ingreso { background: rgba(125, 211, 81, .22); color: #1f4d0f; }
.sub-tag--egreso { background: rgba(255, 87, 87, .22); color: #7d1414; }
.sub-tag--transferencia { background: rgba(76, 212, 255, .22); color: #0a4f65; }
.sub-tag--ajuste { background: rgba(255, 216, 119, .3); color: #654500; }
:root:not([data-theme="light"]) .sub-tag--ingreso { background: rgba(76, 211, 124, .2); color: #8cf2b0; }
:root:not([data-theme="light"]) .sub-tag--egreso { background: rgba(255, 87, 87, .2); color: #ff9e9e; }
:root:not([data-theme="light"]) .sub-tag--transferencia { background: rgba(76, 212, 255, .18); color: #95ebff; }
:root:not([data-theme="light"]) .sub-tag--ajuste { background: rgba(255, 216, 119, .18); color: #ffe29a; }

.filters-fab {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  display: none;
  place-items: center;
  background: var(--button);
  color: #fff;
  box-shadow: 0 12px 24px rgba(0,0,0,.22);
  z-index: 60;
}
.filters-fab svg { width: 24px; height: 24px; stroke: currentColor; }

.modal {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: grid;
  align-items: start;
  justify-items: center;
  padding: 12px;
  overflow-y: auto;
  z-index: 70;
}
.modal-card {
  width: min(100%, 860px);
  border-radius: 28px;
  padding: 22px;
  max-height: calc(100dvh - 24px);
  overflow: auto;
  margin: 4px 0 24px;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
.form-grid { display: grid; gap: 16px; }
.form-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid--three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.category-input-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.category-input-row .icon-button--small {
  width: 46px;
  height: 46px;
  border-radius: 14px;
}


@media (min-width: 1081px) {
  body.filters-collapsed .dashboard-shell {
    grid-template-columns: minmax(0, 1fr);
  }

  body.filters-collapsed .filters-panel {
    display: none;
  }

  body.filters-collapsed .desktop-filters-reveal {
    display: inline-flex;
  }
}

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 1080px) {
  .desktop-filter-toggle,
  .desktop-filters-reveal { display: none !important; }
  .dashboard-shell { grid-template-columns: 1fr; }
  .filters-panel {
    position: fixed;
    inset: calc(var(--header-height) + 10px) 14px auto 14px;
    top: calc(var(--header-height) + 10px);
    z-index: 55;
    transform: translateY(-140%);
    transition: transform .25s ease;
  }
  body.filters-open .filters-panel { transform: translateY(0); }
  .mobile-fab-group { display: flex; }
  .filters-fab { display: grid; }
}

@media (max-width: 840px) {
  .app-header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 14px;
    align-items: start;
  }
  .brand { min-width: 0; }
  .brand-copy p { font-size: .88rem; }
  .header-actions {
    width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    gap: 8px;
    align-items: center;
  }
  .theme-toggle { min-width: 0; justify-self: stretch; }
  .profile-box {
    background: transparent;
    border: 0;
    padding: 0;
    gap: 0;
    width: auto;
  }
  .profile-copy { display: none; }
  .profile-image-button,
  .logout-button,
  .header-icon-button { width: 46px; height: 46px; }
  .logout-button { padding: 0; display: grid; place-items: center; }
  .logout-button span { display: none; }
  .stats-grid, .form-grid--two, .form-grid--three { grid-template-columns: 1fr; }
  .records-table { min-width: 100%; }
}

@media (max-width: 640px) {
  .login-card, .table-card, .modal-card, .filters-panel { padding: 18px; border-radius: 22px; }
  .dashboard-shell { padding: 14px; gap: 14px; }
  .filters-panel {
    inset: calc(var(--header-height) + 8px) 10px auto 10px;
    max-height: calc(100dvh - var(--header-height) - 26px);
    overflow: auto;
  }
  .table-wrap { overflow: visible; }
  .records-table,
  .records-table thead,
  .records-table tbody,
  .records-table th,
  .records-table td,
  .records-table tr { display: block; }
  .records-table { min-width: 100%; }
  .records-table thead { display: none; }
  .records-table tbody { display: grid; gap: 12px; }
  .records-table tr {
    border: 1px solid var(--border-soft);
    border-radius: 20px;
    padding: 14px;
    background: rgba(8, 16, 46, .5);
  }
  :root[data-theme="light"] .records-table tr { background: rgba(255,255,255,.78); }
  .records-table td {
    border: 0;
    padding: 8px 0;
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 12px;
    align-items: start;
  }
  .records-table td::before {
    content: attr(data-label);
    color: var(--text-soft);
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
  }
  .records-table td:last-child { padding-bottom: 0; }
  .actions { justify-content: flex-start; }
  .accounts-flow { display: flex; }
  .modal { padding: 8px; }
  .modal-card {
    width: calc(100vw - 16px);
    max-height: calc(100dvh - 16px);
    padding-bottom: 28px;
    overscroll-behavior: contain;
  }
  .record-form { padding-bottom: 8px; }
  .modal-actions {
    position: sticky;
    bottom: 0;
    padding-top: 12px;
    background: linear-gradient(180deg, rgba(5, 8, 20, 0), rgba(5, 8, 20, .86) 30%);
  }
  :root[data-theme="light"] .modal-actions {
    background: linear-gradient(180deg, rgba(255,255,255,0), rgba(255,255,255,.95) 30%);
  }
  .toolbar-actions { width: 100%; }
  .table-pagination { width: 100%; justify-content: space-between; }
  .toolbar-actions button,
  .modal-actions button { flex: 1 1 auto; }
  .category-input-row { grid-template-columns: minmax(0, 1fr) 46px; }
}

@media (max-width: 520px) {
  .pagination-controls { width: 100%; justify-content: space-between; }
  .pagination-info { min-width: 0; flex: 1 1 auto; }
}

@media (max-width: 420px) {
  .brand-copy h2 { font-size: 1.4rem; }
  .theme-toggle { padding-inline: 10px; gap: 8px; }
  .toggle-track { width: 56px; }
  .toggle-thumb { width: 20px; height: 20px; }
  :root[data-theme="light"] .toggle-thumb { transform: translateX(28px); }
  .records-table td { grid-template-columns: 82px minmax(0, 1fr); gap: 10px; }
}


.input-with-action {
  display: flex;
  gap: 8px;
}

#addCategoryBtn {
  min-width: 42px;
  border-radius: 12px;
  background: var(--button);
  color: white;
  font-weight: bold;
}

#recordCategory {
  appearance: none;
  background: var(--input-bg);
  color: var(--text-main);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.12);
  white-space: nowrap;
  font-size: 0.92rem;
  font-weight: 600;
}

.record-created-by {
  margin-bottom: 0.5rem;
}

.record-created-by input {
  background: rgba(255,255,255,0.08);
}

@media (max-width: 1100px) {
  .charts-layout { grid-template-columns: 1fr; }
  .chart-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .chart-stats-grid { grid-template-columns: 1fr; }
  .chart-panel-head { align-items: flex-start; }
  .chart-svg { min-width: 520px; }
  .chart-svg--pie { min-width: 0; max-width: min(100%, 290px); }
  .chart-legend { grid-template-columns: 1fr; }
  .chart-legend-item { min-width: 0; }
  .exchange-note { font-size: .68rem; }
  .stat-card { min-height: 176px; height: 176px; }
}


.profile-copy-button {
  border: 0;
  background: transparent;
  padding: 0;
  text-align: left;
  color: inherit;
  cursor: pointer;
}
.profile-copy-button:hover #profileName,
.profile-copy-button:focus-visible #profileName {
  text-decoration: underline;
}
.profile-copy-button:focus-visible {
  outline: 2px solid rgba(76,212,255,.65);
  outline-offset: 4px;
  border-radius: 12px;
}
.profile-form .modal-note {
  margin-top: -4px;
}
@media (max-width: 720px) {
  .profile-copy-button { display: none; }
}

@media (max-width: 420px) {
  .chart-svg--pie { max-width: min(100%, 250px); }
  .exchange-note { font-size: .64rem; min-height: 34px; }
  .currency-line-main { gap: 8px; }
  .stat-value { font-size: 1.1rem; }
  .stat-value--secondary { font-size: 1rem; }
}

.main-view { display: grid; gap: 20px; }
.content-topbar { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.toolbar-actions--views { align-items:center; }
.view-switch-button.is-active {
  background: rgba(255, 143, 163, 0.2);
  border-color: var(--panel-border);
  box-shadow: 0 8px 18px rgba(255, 143, 163, 0.16);
}
.account-status-badge {
  display:inline-flex; align-items:center; gap:10px; padding:10px 14px; border-radius:999px;
  background: rgba(255,255,255,.08); border:1px solid var(--border-soft); color:var(--text-main);
}
.account-status-badge strong { font-size:.92rem; }
.account-status-badge span { color:var(--text-soft); font-size:.88rem; }
.users-summary-grid, .admin-panels-grid {
  display:grid; gap:18px;
}
.users-summary-grid { grid-template-columns: repeat(3, minmax(0,1fr)); }
.admin-summary-grid { grid-template-columns: repeat(4, minmax(0,1fr)); }
.admin-panels-grid { grid-template-columns: 1.4fr 1fr; }
.mini-stat-card {
  background: var(--panel); backdrop-filter: blur(12px); border:1px solid var(--panel-border);
  border-radius: 24px; box-shadow: var(--shadow); padding: 20px;
  display:grid; gap:8px;
}
.mini-stat-label { color: var(--text-soft); font-size:.9rem; }
.mini-stat-value { font-size: 1.8rem; line-height:1; }
.mini-stat-detail { color: var(--text-muted); }
.permission-pill {
  display:inline-flex; margin:2px 6px 2px 0; padding:6px 10px; border-radius:999px;
  background: rgba(76,212,255,.12); border:1px solid rgba(76,212,255,.22); font-size:.8rem;
}
.permissions-grid { display:grid; gap:14px; margin-top:10px; }
.permission-group {
  padding:14px; border-radius:18px; background: var(--surface); border:1px solid var(--border-soft);
  display:grid; gap:12px;
}
.permission-options { display:grid; gap:10px; grid-template-columns: repeat(2, minmax(0,1fr)); }
.permission-option {
  display:flex; gap:10px; align-items:flex-start; background: rgba(255,255,255,.04);
  border:1px solid var(--border-soft); border-radius:14px; padding:10px 12px; font-weight:500;
}
.permission-option input { width:auto; margin-top:2px; }
.users-table td, .admin-accounts-table td, .admin-users-table td { vertical-align: top; }

@media (max-width: 1100px) {
  .users-summary-grid, .admin-summary-grid, .admin-panels-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 760px) {
  .users-summary-grid, .admin-summary-grid, .admin-panels-grid, .permission-options { grid-template-columns: 1fr; }
  .account-status-badge { width:100%; justify-content:center; }
}

/* Ajustes Fase 1 cierre A+B */
.content-panel,
.table-card,
.admin-panels-grid,
.admin-panels-grid > section,
.table-wrap {
  min-width: 0;
}

.admin-panels-grid--stacked {
  grid-template-columns: 1fr;
}

.records-table.admin-accounts-table,
.records-table.admin-users-table,
.records-table.admin-managed-users-table {
  min-width: 0;
  table-layout: fixed;
}

.admin-accounts-table th,
.admin-accounts-table td,
.admin-users-table th,
.admin-users-table td,
.admin-managed-users-table th,
.admin-managed-users-table td {
  word-break: break-word;
}

.secondary-button--compact {
  padding: 8px 12px;
  min-height: 38px;
}

.row-selected {
  background: rgba(255, 143, 163, 0.09);
}

.section-note {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(76, 212, 255, 0.08);
  border: 1px solid rgba(76, 212, 255, 0.16);
  color: var(--text-soft);
}

.admin-owner-fields {
  display: grid;
  gap: 14px;
}

@media (max-width: 1500px) {
  .dashboard-shell {
    grid-template-columns: 260px minmax(0, 1fr);
  }
}

.admin-panels-grid > .table-card,
.admin-panels-grid > section,
#adminView .table-card {
  min-width: 0;
}

#adminView .table-wrap {
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
}

#adminView .records-table {
  width: 100%;
}

@media (max-width: 1320px) {
  .admin-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-panels-grid,
  .admin-panels-grid--stacked {
    grid-template-columns: 1fr;
  }

  .records-table.admin-accounts-table,
  .records-table.admin-users-table,
  .records-table.admin-managed-users-table {
    min-width: 760px;
  }
}

@media (max-width: 1080px) {
  .records-table.admin-accounts-table,
  .records-table.admin-users-table,
  .records-table.admin-managed-users-table {
    min-width: 680px;
  }
}

@media (max-width: 760px) {
  .admin-summary-grid,
  .admin-managed-summary-grid {
    grid-template-columns: 1fr;
  }
}


.view-locked {
  position: relative;
  overflow: hidden;
  min-height: 420px;
}

.view-locked > *:not(.subscription-lock-overlay) {
  filter: blur(7px) saturate(0.72);
  opacity: 0.38;
  pointer-events: none;
  user-select: none;
}

.subscription-lock-overlay {
  position: absolute;
  inset: 0;
  z-index: 6;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.view-locked > .subscription-lock-overlay {
  display: flex;
}

.subscription-lock-overlay--compact {
  align-items: flex-start;
  padding-top: 42px;
}

.subscription-lock-card {
  width: min(100%, 560px);
  padding: 24px;
  border-radius: 24px;
  background: rgba(9, 15, 46, 0.9);
  border: 1px solid rgba(255, 143, 163, 0.58);
  box-shadow: 0 24px 50px rgba(0, 0, 0, 0.35);
  text-align: center;
  backdrop-filter: blur(10px);
}

.subscription-lock-card h3 {
  margin: 0 0 10px;
  font-size: clamp(1.2rem, 2vw, 1.55rem);
}

.subscription-lock-card p {
  margin: 0;
  color: var(--text-soft);
  line-height: 1.5;
}

.subscription-lock-chip {
  display: inline-flex;
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 143, 163, 0.14);
  border: 1px solid rgba(255, 143, 163, 0.4);
  color: #ffd9e0;
  font-weight: 700;
}

.view-toggle.is-disabled,
.primary-button:disabled,
.secondary-button:disabled,
.icon-button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 1080px) {
  .view-locked {
    min-height: 360px;
  }

  .subscription-lock-card {
    padding: 20px;
    border-radius: 20px;
  }
}


.gd-swal-popup{border:1px solid rgba(255,143,163,.45)!important;border-radius:24px!important;box-shadow:0 24px 70px rgba(0,0,0,.35)!important}.gd-swal-confirm,.gd-swal-cancel{border-radius:999px!important;padding:.75rem 1.25rem!important;font-weight:700!important}.gd-swal-confirm:focus,.gd-swal-cancel:focus{box-shadow:none!important}

/* V7 responsive hardening */
@media (max-width: 760px) {
  .dashboard-shell {
    padding: 10px;
    gap: 12px;
  }

  .content-panel,
  .main-view,
  .stats-grid,
  .users-summary-grid,
  .admin-summary-grid,
  .admin-panels-grid,
  .admin-managed-summary-grid,
  .table-card,
  .table-wrap,
  .records-table,
  .records-table tbody,
  .records-table tr,
  .records-table td {
    min-width: 0 !important;
    max-width: 100%;
  }

  .content-topbar {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
  }

  .toolbar-actions--views {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 8px;
  }

  .toolbar-actions--views > .secondary-button,
  .toolbar-actions--views > .primary-button,
  .toolbar-actions--views > .view-switch-button,
  .toolbar-actions--views > .desktop-filters-reveal {
    width: 100%;
    justify-content: center;
  }

  .account-status-badge {
    width: 100%;
    justify-content: center;
    text-align: center;
    flex-wrap: wrap;
    padding: 10px 12px;
  }

  .stats-grid,
  .users-summary-grid,
  .admin-summary-grid,
  .admin-panels-grid,
  .admin-managed-summary-grid,
  .permission-options {
    grid-template-columns: 1fr !important;
  }

  .stat-card,
  .mini-stat-card {
    min-height: unset;
    height: auto;
  }

  .table-card {
    padding: 14px;
    border-radius: 22px;
  }

  .table-toolbar,
  .toolbar-actions,
  .table-pagination,
  .pagination-controls {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
    gap: 10px;
  }

  .pagination-size {
    width: 100%;
    justify-content: space-between;
  }

  .pagination-size select {
    min-width: 0;
    width: 96px;
  }

  .toolbar-actions > button,
  .toolbar-actions > .table-pagination,
  .toolbar-actions > .pagination-size,
  .toolbar-actions > .pagination-controls,
  .table-pagination > *,
  .pagination-controls > * {
    width: 100%;
  }

  .pagination-info {
    min-width: 0;
    text-align: center;
  }

  .records-table,
  .records-table.users-table,
  .records-table.admin-accounts-table,
  .records-table.admin-users-table,
  .records-table.admin-managed-users-table {
    width: 100%;
    min-width: 0 !important;
    table-layout: auto;
  }

  .records-table td {
    grid-template-columns: 82px minmax(0, 1fr);
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .records-table td > *,
  .records-table td strong,
  .records-table td div,
  .records-table td span,
  .records-table td small {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }

  .permission-pill,
  .user-chip,
  .sub-tag {
    max-width: 100%;
    white-space: normal;
    overflow-wrap: anywhere;
  }

  .actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .actions .icon-button,
  .actions .secondary-button,
  .actions .primary-button,
  .actions .secondary-button--compact {
    flex: 0 0 auto;
  }

  .section-note {
    padding: 10px 12px;
  }

  #adminManagedAccountSubtitle,
  #adminManagedAccountTitle {
    overflow-wrap: anywhere;
  }
}

@media (max-width: 520px) {
  .app-header {
    padding: 14px 12px;
  }

  .brand {
    min-width: 0;
    gap: 10px;
  }

  .brand-logo {
    width: 46px;
    height: 46px;
  }

  .brand-copy h2 {
    font-size: 1.25rem;
    line-height: 1.1;
  }

  .brand-copy p {
    font-size: .82rem;
    line-height: 1.25;
  }

  .header-actions {
    grid-template-columns: minmax(0, 1fr) auto auto auto;
    gap: 6px;
  }

  .theme-toggle {
    padding: 8px 10px;
  }

  .toggle-track {
    width: 52px;
  }

  .toggle-thumb {
    width: 18px;
    height: 18px;
  }

  :root[data-theme="light"] .toggle-thumb {
    transform: translateX(26px);
  }

  .records-table td {
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 8px;
    font-size: .92rem;
  }

  .records-table td::before {
    font-size: .72rem;
  }

  .mini-stat-value,
  .stat-value {
    font-size: 1.06rem;
  }

  .stat-label {
    font-size: .94rem;
  }

  .subscription-lock-card {
    padding: 16px;
    border-radius: 18px;
  }
}


/* V8 mobile fit patch */
@media (max-width: 760px) {
  html, body, #app, .screen, #dashboardScreen {
    width: 100%;
    max-width: 100%;
    overflow-x: hidden;
  }

  .app-header,
  .dashboard-shell,
  .content-panel,
  .main-view,
  #panelClienteView,
  #usersPermissionsView,
  #adminView,
  #superAdminManagedAccountPanel {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .app-header {
    padding: 12px;
    gap: 10px;
  }

  .brand,
  .brand-copy,
  .header-actions,
  .profile-box,
  .profile-copy,
  .content-topbar,
  .toolbar-actions--views,
  .table-toolbar,
  .toolbar-actions,
  .filters-actions,
  .actions {
    min-width: 0;
    max-width: 100%;
  }

  .brand-copy {
    overflow: hidden;
  }

  .brand-copy h2,
  .brand-copy p,
  #adminManagedAccountTitle,
  #adminManagedAccountSubtitle {
    overflow-wrap: anywhere;
    word-break: break-word;
  }

  .dashboard-shell {
    padding: 12px;
    gap: 12px;
  }

  .stats-grid > *,
  .users-summary-grid > *,
  .admin-summary-grid > *,
  .admin-panels-grid > *,
  .admin-managed-summary-grid > * {
    min-width: 0;
    width: 100%;
    max-width: 100%;
  }

  .table-card,
  .mini-stat-card,
  .stat-card,
  .section-note,
  .subscription-lock-card,
  .profile-box,
  .account-status-badge,
  .filters-panel,
  .records-table tr,
  .records-table td {
    width: 100%;
    max-width: 100%;
    min-width: 0;
  }

  .table-card,
  .mini-stat-card,
  .section-note,
  .subscription-lock-card,
  .records-table tr {
    overflow: hidden;
  }

  .records-table,
  .records-table tbody,
  .records-table tr,
  .records-table td {
    min-width: 0 !important;
    max-width: 100% !important;
  }

  .records-table td {
    grid-template-columns: minmax(72px, 84px) minmax(0, 1fr) !important;
    gap: 8px;
  }

  .records-table td > *,
  .records-table td strong,
  .records-table td div,
  .records-table td span,
  .records-table td small,
  .permission-pill,
  .user-chip,
  .sub-tag {
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
    white-space: normal;
  }

  .actions {
    justify-content: flex-start;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 8px;
  }

  .actions .icon-button,
  .actions .secondary-button,
  .actions .primary-button,
  .actions .secondary-button--compact {
    max-width: 100%;
  }

  .mobile-fab-group {
    right: 12px;
    bottom: 12px;
    gap: 10px;
  }

  .filters-fab {
    width: 54px;
    height: 54px;
  }
}

@media (max-width: 420px) {
  .app-header {
    padding: 10px;
  }

  .dashboard-shell {
    padding: 10px;
  }

  .brand-logo,
  .profile-image,
  .header-icon-button,
  .logout-button {
    flex-shrink: 0;
  }

  .records-table td {
    grid-template-columns: 68px minmax(0, 1fr) !important;
  }

  .table-card,
  .mini-stat-card,
  .stat-card,
  .filters-panel {
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* V9 definitive mobile width fix */
@media (max-width: 1080px) {
  .dashboard-shell {
    grid-template-columns: minmax(0, 1fr) !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .content-panel {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .filters-panel {
    display: none;
    position: fixed !important;
    inset: calc(var(--header-height) + 10px) 14px auto 14px;
    width: auto !important;
    max-width: calc(100vw - 28px) !important;
    min-width: 0 !important;
    margin: 0 !important;
  }

  body.filters-open .filters-panel {
    display: block;
  }
}

@media (max-width: 760px) {
  html, body, #app, .screen, #dashboardScreen {
    width: 100vw !important;
    max-width: 100vw !important;
    min-width: 0 !important;
    overflow-x: hidden !important;
  }

  .app-header,
  .dashboard-shell,
  .content-panel,
  .main-view,
  #recordsView,
  #usersView,
  #adminView,
  #superAdminManagedAccountPanel,
  .stats-grid,
  .users-summary-grid,
  .admin-summary-grid,
  .admin-panels-grid,
  .admin-managed-summary-grid,
  .table-card,
  .table-wrap,
  .records-table,
  .records-table tbody,
  .records-table tr,
  .records-table td {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
  }

  .dashboard-shell {
    grid-template-columns: minmax(0, 1fr) !important;
    padding: 10px !important;
    gap: 12px !important;
  }

  .content-panel,
  .main-view {
    display: grid;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px !important;
  }

  .stats-grid,
  .users-summary-grid,
  .admin-summary-grid,
  .admin-panels-grid,
  .admin-managed-summary-grid,
  .permission-options,
  .form-grid--two,
  .form-grid--three {
    display: grid;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .records-table tbody {
    gap: 10px !important;
  }

  .records-table tr {
    display: block !important;
    overflow: hidden;
  }

  .records-table td {
    display: grid !important;
    grid-template-columns: 76px minmax(0, 1fr) !important;
    align-items: start;
    gap: 8px !important;
    padding-inline: 12px !important;
    word-break: break-word;
    overflow-wrap: anywhere;
  }

  .records-table td::before,
  .records-table td > *,
  .records-table td strong,
  .records-table td div,
  .records-table td span,
  .records-table td small,
  .permission-pill,
  .user-chip,
  .sub-tag,
  .account-status-badge {
    min-width: 0 !important;
    max-width: 100% !important;
    white-space: normal !important;
    overflow-wrap: anywhere !important;
    word-break: break-word !important;
  }

  .actions,
  .toolbar-actions,
  .table-pagination,
  .pagination-controls,
  .toolbar-actions--views {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex-wrap: wrap !important;
  }

  .actions > *,
  .toolbar-actions > *,
  .table-pagination > *,
  .pagination-controls > * {
    max-width: 100%;
  }

  .mobile-fab-group {
    right: 12px !important;
    bottom: 12px !important;
  }
}

@media (max-width: 420px) {
  .app-header {
    padding: 10px !important;
  }

  .brand-copy h2 {
    font-size: 1.1rem !important;
  }

  .brand-copy p {
    font-size: 0.78rem !important;
  }

  .records-table td {
    grid-template-columns: 70px minmax(0, 1fr) !important;
    font-size: 0.9rem !important;
  }
}

/* ===================== Extensiones v12 ===================== */
.notifications-wrap{position:relative;display:inline-flex}.notification-badge{position:absolute;top:-4px;right:-4px;min-width:18px;height:18px;border-radius:999px;background:#ff8fa3;color:#081033;font-size:11px;font-weight:800;display:grid;place-items:center}.notifications-panel{position:absolute;right:0;top:calc(100% + 12px);width:min(380px,92vw);background:linear-gradient(155deg,rgba(12,18,62,.98),rgba(10,15,45,.98));border:1px solid rgba(255,143,163,.35);box-shadow:0 24px 80px rgba(0,0,0,.35);border-radius:22px;padding:14px;z-index:80;opacity:0;visibility:hidden;transform:translateY(-6px);transition:.18s ease}.notifications-wrap:hover .notifications-panel,.notifications-wrap:focus-within .notifications-panel{opacity:1;visibility:visible;transform:translateY(0)}.notifications-panel-head{display:flex;justify-content:space-between;align-items:center;margin-bottom:10px;color:#eef3ff}.notifications-panel-head button{background:transparent;border:0;color:#8fd3ff;cursor:pointer}.notifications-list{display:grid;gap:8px;max-height:280px;overflow:auto}.notification-item{border:1px solid rgba(255,255,255,.08);border-radius:14px;padding:10px;background:rgba(255,255,255,.04)}.notification-item strong{display:block;color:#fff}.notification-item p{margin:4px 0;color:#c8d4ff;font-size:13px}.notification-item small{color:#8ea0d4}.internal-notification-box{display:grid;gap:8px;margin-top:12px}.primary-button--small{padding:.55rem .85rem;font-size:.85rem}.toolbar-actions--export{display:inline-flex;gap:8px;flex-wrap:wrap}.record-extra-grid .field-hint{display:block;margin-top:6px;color:#aab6df;font-size:12px}.receipt-link{display:inline-block;margin-top:7px;color:#8fd3ff;font-weight:700}.alias-row{display:grid;grid-template-columns:1fr auto;gap:8px}.calculator-widget{position:fixed;right:22px;bottom:22px;z-index:70}.calculator-fab{width:58px;height:58px;border-radius:50%;border:1px solid rgba(255,143,163,.55);background:linear-gradient(135deg,#ff8fa3,#4cd4ff);color:#071033;font-size:26px;box-shadow:0 18px 45px rgba(0,0,0,.38);cursor:pointer}.calculator-panel{position:absolute;right:0;bottom:76px;width:min(360px,92vw);padding:16px;border-radius:26px;background:rgba(245,248,255,.98);color:#333;box-shadow:0 24px 80px rgba(0,0,0,.42);border:1px solid rgba(16,25,65,.12)}.calc-display{height:150px;border-radius:18px;background:#edf2fb;border:1px solid #dce4f2;margin-bottom:14px;padding:16px;display:grid;align-content:space-between;text-align:right}.calc-expression{font-size:28px;color:#555;word-break:break-all}.calc-result{font-size:42px;color:#333;font-weight:700}.calc-extra{display:grid;grid-template-columns:1fr 1fr;gap:10px;margin-bottom:12px}.calc-extra button{border:1px solid #ead5da;border-radius:14px;background:#fff1f4;color:#e85f78;font-weight:800;padding:12px;cursor:pointer}.calc-extra button+button{background:#eaf2ff;color:#4999c8;border-color:#d7e4f8}.calc-grid{display:grid;grid-template-columns:repeat(5,1fr);gap:9px}.calc-grid button{min-height:54px;border-radius:14px;border:1px solid #e8e8e8;background:#fff;color:#555;font-size:24px;cursor:pointer;box-shadow:inset 0 -2px 0 rgba(0,0,0,.04)}.calc-grid button[data-calc='=']{color:#e06172;font-weight:800}.install-invite{position:fixed;left:22px;bottom:22px;z-index:90;display:grid;gap:8px;max-width:330px;padding:16px;border-radius:20px;background:linear-gradient(145deg,rgba(12,18,62,.97),rgba(18,33,92,.97));border:1px solid rgba(255,143,163,.4);box-shadow:0 24px 60px rgba(0,0,0,.38);color:#eef3ff}.install-invite span{color:#b9c6f1}.install-invite div{display:flex;gap:8px}.secondary-button--compact{padding:.5rem .75rem;font-size:.84rem}@media (max-width:720px){.calculator-widget{right:16px;bottom:88px}.notifications-panel{right:-70px}.toolbar-actions--export{width:100%;margin:8px 0}.install-invite{left:12px;right:12px;bottom:12px;max-width:none}.calculator-panel{width:calc(100vw - 28px);right:-2px}.calc-display{height:125px}.calc-grid button{min-height:48px}}


/* V13 Enhancements */
.calculator-fab{
position:fixed;right:20px;bottom:20px;width:64px;height:64px;border-radius:50%;
background:#ff8fa3;border:none;display:flex;align-items:center;justify-content:center;
box-shadow:0 10px 25px rgba(255,143,163,.35);z-index:9999;cursor:pointer;
}
.calculator-fab svg{width:30px;height:30px;stroke:#fff;fill:none;stroke-width:1.8}
.notification-footer{display:flex;flex-direction:column;gap:8px;margin-top:10px}
.notification-secondary{background:#243b6b;color:#fff;border:none;padding:10px;border-radius:12px;cursor:pointer}
.notifications-modal{position:fixed;inset:0;background:rgba(3,5,20,.72);display:none;align-items:center;justify-content:center;z-index:10000}
.notifications-modal.active{display:flex}
.notifications-card{width:min(1100px,96vw);max-height:90vh;overflow:auto;background:#0b123d;border:1px solid rgba(255,143,163,.25);border-radius:24px;padding:20px;color:#fff}
.notifications-toolbar{display:flex;justify-content:space-between;align-items:center;gap:10px;flex-wrap:wrap;margin-bottom:16px}
.notifications-table{width:100%;border-collapse:collapse}
.notifications-table th,.notifications-table td{padding:12px;border-bottom:1px solid rgba(255,255,255,.08)}
.pagination-bar{display:flex;justify-content:space-between;align-items:center;margin:14px 0}
.bank-extra-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(180px,1fr));gap:12px}

/* Correcciones V14 */
.calculator-fab{background:#ff8fa3!important;color:#071033!important;display:grid;place-items:center}
.calculator-fab svg{width:30px;height:30px;stroke:#071033!important;fill:none;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.login-screen .calculator-widget{display:none!important}
.record-extra-stack{display:grid;gap:14px;margin:4px 0 12px}.bank-account-box{border:1px solid rgba(255,143,163,.34);border-radius:18px;padding:14px;background:rgba(255,255,255,.035);display:grid;gap:12px}.bank-account-box legend{padding:0 8px;color:#eef3ff;font-weight:800}.bank-status-pill{display:inline-flex;align-items:center;justify-content:center;width:max-content;padding:6px 12px;border-radius:999px;font-weight:900;font-size:12px;border:1px solid transparent}.bank-status-pendiente{background:rgba(255,216,119,.18);color:#ffd877;border-color:rgba(255,216,119,.45)}.bank-status-transferido{background:rgba(125,211,81,.18);color:#7dd351;border-color:rgba(125,211,81,.45)}.bank-status-rechazado{background:rgba(255,95,120,.18);color:#ff8fa3;border-color:rgba(255,143,163,.55)}.bank-destination-summary{display:grid;gap:5px;margin-top:6px;padding:12px;border-radius:14px;background:rgba(0,0,0,.14);color:#dfe7ff}.notifications-card{max-width:min(980px,96vw)!important}.notifications-toolbar{display:flex;justify-content:flex-end;align-items:center;margin:8px 0 10px}.notifications-toolbar label{display:flex;align-items:center;gap:8px}.pagination-bar{display:flex;gap:10px;align-items:center;justify-content:flex-end;margin:10px 0;color:#e8ecff}.notifications-table{width:100%;border-collapse:collapse}.notifications-table th,.notifications-table td{padding:10px;border-bottom:1px solid rgba(255,255,255,.09);text-align:left;vertical-align:top}.notifications-table th{color:#eef3ff;background:rgba(255,255,255,.06)}.notifications-table tr.is-read{opacity:.72}.notifications-table tr.is-unread td:first-child{color:#ff8fa3;font-weight:900}.notification-secondary{border:1px solid rgba(255,255,255,.16);background:rgba(255,255,255,.06);color:#eef3ff;border-radius:10px;padding:8px 10px;cursor:pointer}.notification-secondary.danger{border-color:rgba(255,143,163,.38);color:#ff8fa3}.notification-secondary:disabled{opacity:.45;cursor:not-allowed}.notification-item.is-read{opacity:.72}@media(max-width:720px){.bank-account-box{padding:12px}.notifications-table{min-width:720px}.calculator-fab{width:56px;height:56px}}


/* Correcciones V15: calculadora modal %, buscador PDO y estilo */
.calculator-fab{background:#ff8fa3!important;color:#fff!important;display:grid;place-items:center}
.calculator-fab svg{stroke:#fff!important;fill:none!important;color:#fff!important}
.calc-window-actions{display:flex;justify-content:flex-end;gap:6px;margin:-6px -4px 8px 0}
.calc-window-actions button{width:28px;height:28px;border:0;border-radius:999px;background:rgba(8,16,51,.08);color:#5b6478;font-weight:900;font-size:18px;cursor:pointer}
.calc-window-actions button:hover{background:rgba(255,143,163,.25);color:#d74d66}
.calc-percent-overlay{position:fixed;inset:0;z-index:9999;background:rgba(0,0,0,.55);display:grid;place-items:center;padding:20px}
.calc-percent-modal{width:min(560px,92vw);background:#fff;border-radius:8px;padding:28px;box-shadow:0 28px 80px rgba(0,0,0,.45)}
.calc-percent-input{width:100%;height:92px;border:1px solid #dfe7f7;border-radius:12px;background:#eef4ff;color:#666;font-size:54px;text-align:right;padding:0 18px;margin-bottom:26px;box-shadow:inset 0 2px 8px rgba(0,0,0,.06)}
.calc-percent-input::placeholder{text-align:left;font-size:28px;color:#a8b0c0}
.calc-percent-keypad{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}
.calc-percent-keypad button{min-height:78px;border:1px solid #ececec;border-radius:10px;background:#fff;color:#555;font-size:34px;box-shadow:0 3px 10px rgba(0,0,0,.08);cursor:pointer}
.calc-percent-keypad button.ok{grid-row:3 / span 2;grid-column:4;color:#d75b68;font-size:30px}
@media(max-width:720px){.calc-percent-modal{padding:24px}.calc-percent-input{height:96px;font-size:52px}.calc-percent-keypad button{min-height:84px}.calc-window-actions{margin-top:0}}

/* Correcciones V16 */
.calculator-fab{background:#ff8fa3!important;color:#fff!important;display:grid;place-items:center}
.calculator-fab svg{width:28px;height:28px;stroke:#fff!important;color:#fff!important;fill:none!important}
.calc-window-actions{position:absolute;top:8px;right:10px;display:flex;gap:6px;z-index:2}.calc-window-actions button{width:30px;height:30px;border-radius:10px;border:1px solid rgba(0,0,0,.08);background:#fff;color:#596070;font-weight:900;cursor:pointer}
.gd-pct-input{background:#eef3fb!important;text-align:right!important;font-size:42px!important;color:#666!important;height:82px!important}
.gd-pct-keypad{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-top:18px}.gd-pct-keypad button{min-height:62px;border:1px solid #e9e9e9;border-radius:14px;background:#fff;color:#555;font-size:28px;box-shadow:inset 0 -2px 0 rgba(0,0,0,.04);cursor:pointer}.gd-pct-keypad button:nth-child(4n),.gd-pct-keypad button[data-pct-key='OK']{color:#d86370;font-weight:800}
@media (max-width:720px){.calculator-widget{right:88px!important;bottom:20px!important}.calculator-panel{right:-78px!important;bottom:72px!important;width:calc(100vw - 28px)!important}.install-invite{bottom:86px!important}}

/* V17: ajuste mobile de calculadora y popup porcentaje */
@media (max-width:720px){
  .calculator-widget{right:14px!important;bottom:112px!important;z-index:72!important}
  .calculator-panel{right:0!important;bottom:72px!important;width:calc(100vw - 28px)!important;max-height:calc(100vh - 160px);overflow:auto}
  .mobile-fab-group{right:14px!important;bottom:18px!important}
  .filters-fab{z-index:71!important}
  .swal2-popup{width:min(540px,94vw)!important}
  .gd-pct-input{height:92px!important;font-size:52px!important;text-align:right!important;background:#eef3fb!important;color:#555!important}
  .gd-pct-keypad{grid-template-columns:repeat(4,1fr)!important;gap:10px!important}
  .gd-pct-keypad button{min-height:74px!important;font-size:30px!important;border-radius:14px!important}
}

/* V18: soporte WhatsApp, flotantes mobile y cierre notificaciones */
.support-fab{
  position:fixed;right:92px;bottom:22px;width:58px;height:58px;border-radius:50%;
  display:grid;place-items:center;background:#25D366;color:#fff;border:0;text-decoration:none;
  box-shadow:0 18px 45px rgba(0,0,0,.38);z-index:73;transition:transform .18s ease, box-shadow .18s ease;
}
.support-fab:hover{transform:translateY(-2px);box-shadow:0 22px 55px rgba(0,0,0,.42)}
.support-fab svg{width:28px;height:28px;fill:currentColor}
.notifications-card{position:relative!important;padding-top:30px!important}
.notifications-card .modal-header{display:flex!important;align-items:flex-start!important;justify-content:space-between!important;gap:16px!important;margin-bottom:12px!important;padding-right:52px!important}
.notifications-card .modal-close-button{position:absolute!important;top:14px!important;right:14px!important;width:38px!important;height:38px!important;border-radius:14px!important;border:1px solid rgba(255,143,163,.45)!important;background:rgba(255,143,163,.14)!important;color:#ff8fa3!important;font-size:24px!important;font-weight:900!important;line-height:1!important;display:grid!important;place-items:center!important;cursor:pointer!important}
.notifications-card .modal-close-button:hover{background:#ff8fa3!important;color:#081033!important}
@media(max-width:720px){
  .mobile-fab-group{right:14px!important;bottom:18px!important;z-index:71!important}
  .support-fab{right:150px!important;bottom:18px!important;width:56px!important;height:56px!important;z-index:73!important}
  .calculator-widget{right:14px!important;bottom:152px!important;z-index:74!important}
  .calculator-panel{right:0!important;bottom:72px!important;width:calc(100vw - 28px)!important;max-height:calc(100vh - 190px)!important;overflow:auto!important}
}

/* V19: ajuste final flotantes mobile y modal porcentajes calculadora */
@media (max-width:720px){
  body.is-authenticated .mobile-fab-group{right:14px!important;bottom:18px!important;z-index:71!important;display:flex!important}
  body.is-authenticated .calculator-widget{right:14px!important;bottom:96px!important;z-index:80!important;position:fixed!important}
  body.is-authenticated .calculator-panel{right:0!important;bottom:72px!important;width:calc(100vw - 28px)!important;max-height:calc(100vh - 180px)!important;overflow:auto!important}
  body.is-authenticated .support-fab{right:150px!important;bottom:18px!important;width:56px!important;height:56px!important;z-index:73!important}
}
.gd-calc-pct-overlay{position:fixed;inset:0;z-index:21000;background:rgba(0,0,0,.62);backdrop-filter:blur(4px);display:grid;place-items:center;padding:18px}
.gd-calc-pct-modal{width:min(520px,94vw);background:#fff;border-radius:10px;padding:26px;box-shadow:0 28px 80px rgba(0,0,0,.45)}
.gd-calc-pct-screen{width:100%;height:94px;border:1px solid #dfe7f7;border-radius:12px;background:#eef4ff;display:grid;grid-template-columns:1fr auto;align-items:center;gap:10px;padding:0 16px;margin-bottom:26px;box-shadow:inset 0 2px 8px rgba(0,0,0,.06);box-sizing:border-box}
.gd-calc-pct-placeholder{font-size:28px;color:#a8b0c0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.gd-calc-pct-value{font-size:54px;color:#666;background:#f4b9c4;padding:0 4px;min-width:1ch;text-align:right}
.gd-calc-pct-keys{display:grid;grid-template-columns:repeat(4,1fr);gap:12px}.gd-calc-pct-keys button{min-height:78px;border:1px solid #ececec;border-radius:12px;background:#fff;color:#555;font-size:34px;box-shadow:0 3px 10px rgba(0,0,0,.08);cursor:pointer}.gd-calc-pct-keys button[data-k='C'],.gd-calc-pct-keys button[data-k='⌫'],.gd-calc-pct-keys button[data-k='OK']{color:#d75b68}.gd-calc-pct-keys button[data-k='OK']{grid-row:3/span 2;grid-column:4;font-size:30px}
@media(max-width:720px){.gd-calc-pct-modal{padding:24px}.gd-calc-pct-screen{height:96px}.gd-calc-pct-placeholder{font-size:25px}.gd-calc-pct-value{font-size:52px}.gd-calc-pct-keys button{min-height:84px}}


/* V20: calculadora arriba del filtro en mobile y sin confirmación en cálculos */
@media (max-width:720px){
  body.is-authenticated .mobile-fab-group{right:14px!important;bottom:18px!important;z-index:71!important;display:flex!important}
  body.is-authenticated .calculator-widget{right:14px!important;bottom:164px!important;z-index:80!important;position:fixed!important}
  body.is-authenticated .calculator-panel{right:0!important;bottom:72px!important;width:calc(100vw - 28px)!important;max-height:calc(100vh - 230px)!important;overflow:auto!important}
  body.is-authenticated .support-fab{right:150px!important;bottom:18px!important;width:56px!important;height:56px!important;z-index:73!important}
}

/* ===================== V21: corrección final Header + flotantes ===================== */
/* Restablece el header para que las notificaciones no rompan el layout y los botones floten correctamente. */
.app-header{
  box-sizing:border-box!important;
  width:100%!important;
  display:flex!important;
  align-items:center!important;
  justify-content:space-between!important;
  gap:16px!important;
}
.header-actions{
  display:flex!important;
  align-items:center!important;
  justify-content:flex-end!important;
  gap:12px!important;
  flex-wrap:nowrap!important;
}
.notifications-wrap{position:relative!important;display:inline-flex!important;flex:0 0 auto!important}
.notifications-panel{box-sizing:border-box!important;position:absolute!important;right:0!important;top:calc(100% + 12px)!important;z-index:9990!important;max-width:92vw!important}
.profile-box{flex:0 0 auto!important;width:auto!important;max-width:none!important}

@media (max-width:720px){
  .app-header{
    position:sticky!important;
    top:0!important;
    display:grid!important;
    grid-template-columns:minmax(0,1fr) auto!important;
    grid-auto-rows:auto!important;
    align-items:center!important;
    gap:10px 12px!important;
    padding:12px 14px!important;
    min-height:96px!important;
    max-height:none!important;
    overflow:visible!important;
  }
  .brand{
    grid-column:1 / 2!important;
    display:flex!important;
    align-items:center!important;
    gap:10px!important;
    min-width:0!important;
    width:auto!important;
    max-width:100%!important;
  }
  .brand-logo{width:52px!important;height:52px!important;flex:0 0 52px!important}
  .brand-copy{min-width:0!important;overflow:hidden!important}
  .brand-copy h2{font-size:1.32rem!important;line-height:1.05!important;white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;margin:0!important}
  .brand-copy p{font-size:.83rem!important;line-height:1.2!important;display:-webkit-box!important;-webkit-line-clamp:2!important;-webkit-box-orient:vertical!important;overflow:hidden!important;margin:2px 0 0!important}
  .header-actions{
    grid-column:2 / 3!important;
    display:flex!important;
    align-items:center!important;
    justify-content:flex-end!important;
    gap:7px!important;
    flex-wrap:nowrap!important;
    width:auto!important;
    max-width:100%!important;
    min-width:0!important;
  }
  .theme-toggle{height:42px!important;padding:7px 8px!important;gap:6px!important;flex:0 0 auto!important}
  .toggle-track{width:44px!important;height:24px!important}
  .toggle-thumb{width:16px!important;height:16px!important;top:4px!important;left:4px!important}
  :root[data-theme="light"] .toggle-thumb{transform:translateX(20px)!important}
  .header-icon-button{width:42px!important;height:42px!important;border-radius:14px!important;flex:0 0 42px!important}
  .profile-box{display:flex!important;align-items:center!important;gap:6px!important;padding:5px!important;border-radius:16px!important;width:auto!important;flex:0 0 auto!important;max-width:none!important}
  .profile-image-button,.profile-image{width:42px!important;height:42px!important;flex:0 0 42px!important}
  .profile-copy{display:none!important}
  .logout-button{width:42px!important;height:42px!important;padding:0!important;justify-content:center!important;flex:0 0 42px!important;border-radius:14px!important}
  .logout-button span{display:none!important}
  .notifications-panel{
    position:fixed!important;
    top:82px!important;
    left:12px!important;
    right:12px!important;
    width:auto!important;
    max-width:none!important;
    max-height:calc(100dvh - 100px)!important;
    overflow:auto!important;
    z-index:12000!important;
  }
  .notifications-wrap:not(:hover):not(:focus-within) .notifications-panel{opacity:0!important;visibility:hidden!important;transform:translateY(-6px)!important}
  .notifications-wrap:hover .notifications-panel,.notifications-wrap:focus-within .notifications-panel{opacity:1!important;visibility:visible!important;transform:translateY(0)!important}

  /* Flotantes: soporte + nuevo + filtro abajo, calculadora siempre arriba del filtro. */
  body .mobile-fab-group,
  body.is-authenticated .mobile-fab-group{
    position:fixed!important;
    right:14px!important;
    bottom:18px!important;
    display:flex!important;
    flex-direction:row!important;
    gap:10px!important;
    z-index:9000!important;
  }
  body .support-fab,
  body.is-authenticated .support-fab{
    right:150px!important;
    bottom:18px!important;
    width:56px!important;
    height:56px!important;
    z-index:9001!important;
  }
  body .calculator-widget,
  body.is-authenticated .calculator-widget{
    position:fixed!important;
    right:14px!important;
    bottom:96px!important;
    z-index:9002!important;
  }
  body .calculator-fab,
  body.is-authenticated .calculator-fab{
    width:56px!important;
    height:56px!important;
  }
  body .calculator-panel,
  body.is-authenticated .calculator-panel{
    right:0!important;
    bottom:72px!important;
    width:calc(100vw - 28px)!important;
    max-height:calc(100dvh - 180px)!important;
    overflow:auto!important;
  }
}

@media (max-width:420px){
  .app-header{grid-template-columns:minmax(0,1fr) auto!important;padding:10px 12px!important;gap:8px!important}
  .brand-logo{width:48px!important;height:48px!important;flex-basis:48px!important}
  .brand-copy h2{font-size:1.18rem!important}
  .brand-copy p{font-size:.76rem!important}
  .header-actions{gap:5px!important}
  .theme-toggle{width:74px!important;overflow:hidden!important}
  .header-icon-button{width:40px!important;height:40px!important;flex-basis:40px!important}
  .profile-image-button,.profile-image{width:40px!important;height:40px!important;flex-basis:40px!important}
  .logout-button{width:40px!important;height:40px!important;flex-basis:40px!important}
  body .calculator-widget,body.is-authenticated .calculator-widget{right:14px!important;bottom:94px!important}
}

/* ===================== V22: flotantes mobile ordenados y calculadora/filtro sin superposición ===================== */
@media (max-width:720px){
  body.is-authenticated .mobile-fab-group,
  body .mobile-fab-group{
    position:fixed!important;
    right:14px!important;
    bottom:18px!important;
    display:block!important;
    width:56px!important;
    height:56px!important;
    z-index:9000!important;
    pointer-events:none!important;
  }
  body.is-authenticated #mobileAddBtn,
  body #mobileAddBtn{
    position:fixed!important;
    right:78px!important;
    bottom:18px!important;
    width:56px!important;
    height:56px!important;
    display:grid!important;
    pointer-events:auto!important;
    z-index:9010!important;
  }
  body.is-authenticated #filtersToggleBtn,
  body #filtersToggleBtn{
    position:fixed!important;
    right:14px!important;
    bottom:166px!important;
    width:56px!important;
    height:56px!important;
    display:grid!important;
    pointer-events:auto!important;
    z-index:9030!important;
  }
  body.is-authenticated .calculator-widget,
  body .calculator-widget{
    position:fixed!important;
    right:14px!important;
    bottom:92px!important;
    z-index:9020!important;
  }
  body.is-authenticated .support-fab,
  body .support-fab{
    position:fixed!important;
    right:142px!important;
    bottom:18px!important;
    width:56px!important;
    height:56px!important;
    z-index:9011!important;
  }
  body.is-authenticated .calculator-panel,
  body .calculator-panel{
    right:0!important;
    bottom:72px!important;
    width:calc(100vw - 28px)!important;
    max-height:calc(100dvh - 250px)!important;
    overflow:auto!important;
  }
}
