/* v60: una base tranquila y consistente para todas las pantallas. */
:root {
  --brand: #18745a;
  --brand-dark: #125840;
  --brand-rgb: 24, 116, 90;
  --brand-light: #eaf4ef;
  --bg: #f5f7fa;
  --surface: #fff;
  --surface-subtle: #f4f6f8;
  --text: #192e42;
  --muted: #5e6e7e;
  --border: #e1e7ec;
  --input-bg: #fff;
  --ems-ink: var(--text);
  --ems-slate: var(--muted);
  --ingreso: #18745a;
  --gasto: #bc4049;
  --radius: 1rem;
  --radius-sm: .65rem;
  --shadow: 0 2px 5px rgba(25, 46, 66, .025);
  --shadow-hover: 0 5px 16px rgba(25, 46, 66, .06);
  --sidebar-width: 244px;
}
[data-theme="dark"] {
  --brand: #7fd5b5;
  --brand-dark: #9be2c7;
  --brand-rgb: 127, 213, 181;
  --brand-light: #1b3633;
  --bg: #111c27;
  --surface: #192735;
  --surface-subtle: #203140;
  --text: #e5edf5;
  --muted: #adbdcc;
  --border: #354656;
  --input-bg: #192735;
  --ems-ink: var(--text);
  --ems-slate: var(--muted);
  --ingreso: #7fd5b5;
  --gasto: #ff949b;
  --shadow: none;
  --shadow-hover: none;
}
body, .app-body, .auth-wrapper {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
}
html { overflow-x: clip; overflow-y: visible; }
.app-body { font-size: .9375rem; overflow-x: clip; overflow-y: visible; }
.app-body::before, .app-body::after, .app-content::before { display: none; }
.app-content { background: none; }
.app-container { max-width: 1480px; padding: clamp(20px, 2.7vw, 40px); }
.app-sidebar { background: #192e42; border-right: 0; box-shadow: none; }
.sidebar-brand { height: 90px; padding: 24px 20px; }
.brand-mark {
  flex: 0 0 38px; width: 38px; height: 38px;
  border: 1px solid #789b9d; border-radius: 12px;
  background: #214a4b; box-shadow: none;
}
.sidebar-brand strong { font-size: 1rem; font-weight: 650; letter-spacing: -.02em; }
.sidebar-brand small { color: #b1c0cd; font-size: .7rem; }
.sidebar-nav { padding: 12px; scrollbar-width: thin; scrollbar-color: #496071 transparent; }
.sidebar-label { color: #aabdcf; font-size: .68rem; font-weight: 600; letter-spacing: .075em; margin: 8px 12px 12px; }
.sidebar-link {
  min-height: 45px; margin: 3px 0; padding: 10px 13px;
  gap: 12px; color: #cbd7e2; font-weight: 500; font-size: .86rem;
  border-radius: 9px; box-shadow: none;
}
.sidebar-link > i, .sidebar-group summary > span > i {
  display: inline-flex; align-items: center; justify-content: center;
  flex: 0 0 20px; width: 20px; height: 22px;
  color: inherit; background: none; border: 0; border-radius: 0;
  font-size: 1.05rem; box-shadow: none;
}
.sidebar-link.active {
  color: #fff; background: #2b504f; box-shadow: inset 3px 0 #91d8bb;
  font-weight: 600;
}
.sidebar-link:hover { transform: none; color: #fff; background: #294156; }
.sidebar-link:hover > i, .sidebar-link.active > i { background: none; color: inherit; box-shadow: none; transform: none; }
.sidebar-badge { background: #e8f4ed; color: #245240; font-size: .7rem; min-width: 22px; }
.sidebar-more { margin-top: 20px; padding-top: 12px; border-top: 1px solid #354b5d; }
.sidebar-more > summary, .sidebar-group > summary {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px; list-style: none; color: #cbd7e2; cursor: pointer;
  font-size: .8rem; font-weight: 500; border-radius: 9px;
}
.sidebar-more > summary::-webkit-details-marker { display: none; }
.sidebar-more > summary > span { display: flex; gap: 12px; align-items: center; }
.sidebar-more > summary:hover { background: #294156; color: #fff; }
.sidebar-more > summary .group-chevron { font-size: .7rem; }
.sidebar-more[open] > summary > .group-chevron { transform: rotate(180deg); }
.sidebar-group[open] > summary > .group-chevron { transform: rotate(180deg); }
.sidebar-group:not([open]) > summary > .group-chevron { transform: none; }
.sidebar-group > div { padding-left: 5px; }
.sidebar-group > div .sidebar-link { font-size: .77rem; padding: 9px 11px; }
.sidebar-profile { border-color: #354b5d; padding: 14px 18px; }
.sidebar-profile .avatar { width: 36px; height: 36px; border-radius: 50%; background: #314c60; }
.sidebar-profile .profile-copy strong { font-size: .78rem; font-weight: 600; }
.sidebar-profile .profile-copy small { color: #b1c0cd; }
.app-topbar { height: 72px; background: var(--surface); border-color: var(--border); backdrop-filter: none; box-shadow: none; }
[data-theme="dark"] body.app-body, [data-theme="dark"] .app-content { background: var(--bg); }
[data-theme="dark"] .app-topbar { background: var(--surface); }
.topbar-title > span { color: var(--text); font-size: .95rem; font-weight: 600; }
.topbar-title > small { color: var(--muted); font-size: .73rem; }
.topbar-actions { gap: 9px; }
.icon-button { width: 39px; height: 39px; min-width: 39px; border: 1px solid var(--border); border-radius: 10px; box-shadow: none; background: var(--surface); color: var(--muted); }
.command-k-button { width: auto; padding: 0 12px; }
.command-k-button kbd { background: var(--surface-subtle); color: var(--muted); border-color: var(--border); }
.topbar-add, .btn-brand, .btn-primary {
  background: #18745a; border-color: #18745a; color: #fff;
  border-radius: 10px; box-shadow: none; font-weight: 600;
}
.topbar-add { min-height: 40px; padding: 10px 16px; }
.topbar-add:hover, .btn-brand:hover, .btn-primary:hover { color: #fff; background: #125840; border-color: #125840; transform: none; box-shadow: none; }
.btn { border-radius: 10px; font-size: .86rem; font-weight: 550; box-shadow: none; }
.btn-outline-secondary { color: var(--text); border-color: var(--border); background: var(--surface); }
.btn-outline-secondary:hover { background: var(--surface-subtle); border-color: var(--muted); color: var(--text); }
.page-heading { align-items: center; margin-bottom: 24px; gap: 18px; }
.page-heading h1 { font-weight: 650; letter-spacing: -.035em; line-height: 1.2; }
.page-heading p { max-width: 65ch; font-size: .9rem; line-height: 1.6; }
.eyebrow { color: var(--muted); font-size: .7rem; font-weight: 600; letter-spacing: .07em; margin-bottom: 6px; }
.card { border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); }
.section-title h2 { font-size: 1.05rem; font-weight: 650; }
.form-control, .form-select, .input-group-text { border-color: var(--border); background-color: var(--input-bg); color: var(--text); border-radius: 10px; box-shadow: none; min-height: 44px; font-size: .94rem; }
.form-control:focus, .form-select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(var(--brand-rgb), .12); }
.form-label { font-size: .83rem; font-weight: 600; margin-bottom: 7px; }
.form-text, .text-muted { color: var(--muted) !important; }
.text-success { color: var(--ingreso) !important; }
.text-danger { color: var(--gasto) !important; }
.table { --bs-table-color: var(--text); --bs-table-bg: var(--surface); --bs-table-border-color: var(--border); font-size: .88rem; }
.table > :not(caption) > * > * { padding: 13px 14px; }
.table thead th { color: var(--muted); font-weight: 600; font-size: .73rem; letter-spacing: .035em; background: var(--surface-subtle); }
.table td { font-variant-numeric: tabular-nums; }
.status-pill { font-weight: 600; font-size: .72rem; }
.alert { border-radius: 12px; font-size: .9rem; }
.empty-state { padding: 28px 20px; border: 0; color: var(--muted); line-height: 1.6; }
.app-footer { color: var(--muted); font-size: .72rem; border-color: var(--border); }
/* Las herramientas detalladas comparten un acabado visual discreto. */
.experience-simple :is(.legacy-hero, .today-guide, .insight-command, .bank-onboarding, .review-panel, .report-library, .monthly-report-mini, .subscription-insight-card, .transaction-reading-card, .weekly-intelligence-card, .data-trust-card, .savings-coach-card) {
  background: var(--surface); border-color: var(--border); box-shadow: var(--shadow);
}
.experience-simple :is(.today-guide, .insight-command, .bank-onboarding)::before { display: none; }
.experience-simple :is(.metric-card, .subscription-stat, .legacy-hero-grid > div, .report-library-item, .bank-provider-card, .setup-step-card) { box-shadow: none; border-color: var(--border); }
.experience-simple :is(.mini-icon, .stat-icon, .cat-icon) { box-shadow: none; }
.experience-simple :is(.card, .movement-item, .metric-card, .sidebar-link, .btn, .topbar-add):hover { transform: none; }
.experience-simple .ok-reveal { animation: none !important; opacity: 1 !important; transform: none !important; }
.experience-simple .ok-ripple { display: none; }
[hidden] { display: none !important; }
details > summary { cursor: pointer; }
details > summary:focus-visible, a:focus-visible, button:focus-visible { outline: 3px solid var(--brand); outline-offset: 3px; }
.app-sidebar :focus-visible { outline-color: #91d8bb; }
.command-dialog { border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 16px 56px #071d3533; }
.command-dialog-head h2 { font-size: 1rem; }
.command-foot { font-size: .72rem; }
.auth-wrapper { background: var(--bg); }
.auth-wrapper::before, .auth-wrapper::after { display: none; }
.auth-card { background: var(--surface); border: 1px solid var(--border); box-shadow: 0 12px 48px #192e4210; border-radius: 22px; }
.auth-logo { box-shadow: none; }
.auth-card .btn { min-height: 46px; }
.auth-privacy { color: var(--muted); }
@media (max-width: 1199.98px) { :root { --sidebar-width: 232px; } }
@media (max-width: 991.98px) {
  .app-content { margin-left: 0; }
  .app-sidebar { width: min(300px, 88vw); }
  .app-topbar { padding: 0 16px; }
  .app-container { padding: 22px 18px; }
  .mobile-nav { background: var(--surface); border-color: var(--border); backdrop-filter: none; box-shadow: none; }
  .mobile-nav a, .mobile-nav button { min-height: 48px; color: var(--muted); }
  .mobile-nav .mobile-add { color: #fff; background: #18745a; box-shadow: none; }
}
@media (max-width: 575.98px) {
  .app-topbar { gap: 8px; height: 64px; padding: 0 12px; }
  .topbar-leading { gap: 8px; min-width: 0; }
  .topbar-title { min-width: 0; }
  .topbar-title > span { font-size: .82rem; line-height: 1.2; }
  .topbar-title > small { font-size: .65rem; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .icon-button, .topbar-add { width: 36px; min-width: 36px; height: 38px; padding: 8px; }
  .topbar-actions > a[href="alertas.php"] { display: none; }
  .app-container { padding: 22px 14px; }
  .page-heading { gap: 16px; }
  .page-heading h1 { font-size: 1.5rem; }
  .command-foot { flex-wrap: wrap; gap: 8px; }
  .command-dialog { width: calc(100% - 24px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
@media print {
  .app-container { padding: 0; max-width: none; }
  .card { box-shadow: none; }
}
