/* Global Finanzas · interfaz v2
   Capa visual sobre la app PHP existente. No modifica la lógica del servidor. */

:root {
  color-scheme: dark;
  --bg: #050b15;
  --bg-2: #071120;
  --surface: #0b1626;
  --surface-2: #0f1e32;
  --surface-3: #13263d;
  --line: #1c2d45;
  --line-2: #27405f;
  --text: #e9f1fa;
  --muted: #8ea3bb;
  --muted-2: #6d829b;
  --accent: #18c99b;
  --accent-2: #3ce4b7;
  --accent-soft: rgba(24, 201, 155, .12);
  --blue: #5aa9f8;
  --amber: #f6b94a;
  --red: #ff6b86;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 18px 48px rgba(0, 0, 0, .34);
  --sidebar: 248px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.gf-v2 {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 620px at 78% -12%, rgba(24, 201, 155, .10), transparent 58%),
    radial-gradient(900px 520px at -10% 108%, rgba(90, 169, 248, .08), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
::selection { background: rgba(24, 201, 155, .32); color: #fff; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
h1, h2, h3, h4, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
body.gf-v2 ::-webkit-scrollbar { width: 10px; height: 10px; }
body.gf-v2 ::-webkit-scrollbar-thumb { background: #1d334e; border-radius: 10px; border: 2px solid transparent; background-clip: content-box; }
body.gf-v2 ::-webkit-scrollbar-track { background: transparent; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- Estructura ---------- */
.gf-app-shell { min-height: 100vh; }
.gf-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 20px 14px 18px;
  background: linear-gradient(180deg, #081526 0%, #060f1c 100%);
  border-right: 1px solid var(--line);
  overflow-y: auto;
}
.gf-sidebar .side-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px 16px;
  border-bottom: 1px solid rgba(28, 45, 69, .7);
}
.gf-sidebar .side-brand img {
  width: 40px; height: 40px; border-radius: 12px; object-fit: cover;
  border: 1px solid rgba(24, 201, 155, .32);
  box-shadow: 0 8px 20px rgba(0, 0, 0, .35);
}
.side-brand strong { display: block; font-size: 14.5px; letter-spacing: .01em; }
.side-brand small { display: block; color: var(--muted); font-size: 10.5px; margin-top: 2px; letter-spacing: .03em; }
.side-tag {
  margin-left: auto;
  font-size: 8.5px; font-weight: 800; letter-spacing: .11em;
  color: var(--accent-2); background: rgba(24, 201, 155, .10);
  border: 1px solid rgba(24, 201, 155, .28);
  border-radius: 6px; padding: 3px 5px;
}
.side-nav { display: flex; flex-direction: column; gap: 16px; }
.side-group { display: flex; flex-direction: column; gap: 3px; }
.side-label {
  padding: 0 10px 5px;
  color: var(--muted-2);
  font-size: 9.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
}
.side-link {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  color: #a8bad0;
  font-size: 13px; font-weight: 600;
  transition: background .16s ease, color .16s ease, transform .16s ease;
}
.side-link .ico { width: 17px; height: 17px; flex: 0 0 auto; opacity: .85; }
.side-link:hover { background: rgba(255, 255, 255, .035); color: var(--text); }
.side-link[aria-current="page"] {
  color: #eafff8;
  background: linear-gradient(90deg, rgba(24, 201, 155, .18), rgba(24, 201, 155, .045));
  box-shadow: inset 0 0 0 1px rgba(24, 201, 155, .20);
}
.side-link[aria-current="page"]::before {
  content: ""; position: absolute; left: -14px; top: 9px; bottom: 9px;
  width: 3px; border-radius: 0 4px 4px 0; background: var(--accent);
}
.side-link[aria-current="page"] .ico { opacity: 1; color: var(--accent-2); }
.side-badge {
  margin-left: auto; min-width: 20px; padding: 1px 6px;
  border-radius: 999px; background: rgba(246, 185, 74, .14);
  border: 1px solid rgba(246, 185, 74, .3);
  color: var(--amber); font-size: 10px; font-weight: 800; text-align: center;
}
.side-foot {
  margin-top: auto;
  display: flex; align-items: center; gap: 10px;
  padding: 12px 10px 2px;
  border-top: 1px solid rgba(28, 45, 69, .7);
}
.side-avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, rgba(24, 201, 155, .3), rgba(90, 169, 248, .2));
  border: 1px solid rgba(24, 201, 155, .35);
  color: #eafff8; font-size: 12px; font-weight: 800; text-transform: uppercase;
}
.side-user { min-width: 0; }
.side-user b { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user small { display: block; color: var(--muted); font-size: 10px; }
.side-logout { margin-left: auto; color: var(--muted); display: grid; place-items: center; padding: 6px; border-radius: 8px; }
.side-logout:hover { color: var(--red); background: rgba(255, 107, 134, .09); }
.side-logout .ico { width: 16px; height: 16px; }

.gf-main {
  margin-left: var(--sidebar);
  padding: 22px 28px 64px;
  min-height: 100vh;
}
.gf-content { display: flex; flex-direction: column; gap: 16px; max-width: 1440px; margin: 0 auto; }

/* ---------- Barra superior ---------- */
.gf-topbar {
  display: flex; align-items: center; gap: 14px;
  max-width: 1440px; margin: 0 auto 20px;
}
.mobile-brand { display: none; }
.gf-page-title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex: 1; min-width: 0; }
.gf-eyebrow { color: var(--accent-2); font-size: 9.5px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 3px; }
.gf-page-title-row h1 { font-size: 23px; line-height: 1.15; letter-spacing: -.02em; font-weight: 800; }
.gf-head-actions { display: flex; align-items: center; gap: 9px; }
.gf-date { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gf-user-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 11px 6px 7px; border-radius: 999px;
  border: 1px solid var(--line); background: rgba(11, 22, 38, .8);
  color: #c3d2e4; font-size: 11.5px; font-weight: 700;
  max-width: 190px; overflow: hidden; text-overflow: ellipsis;
}
.gf-user-pill::before {
  content: ""; width: 20px; height: 20px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #0f8f75);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .18);
}
.gf-icon-btn, .icon-btn {
  width: 36px; height: 36px; display: grid; place-items: center;
  border-radius: 10px; border: 1px solid var(--line);
  background: rgba(11, 22, 38, .8); color: #b7c8dc; cursor: pointer;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}
.gf-icon-btn:hover, .icon-btn:hover { border-color: var(--line-2); color: var(--text); background: var(--surface-2); }
.gf-icon-btn .ico, .icon-btn .ico { width: 17px; height: 17px; }

/* ---------- Navegación móvil ---------- */
.gf-bottom-nav {
  display: none;
  position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
  height: calc(64px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: rgba(7, 17, 32, .92);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}
.gf-bottom-nav .tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--muted); font-size: 9.5px; font-weight: 700; letter-spacing: .02em;
  border: 0; background: none; cursor: pointer; padding: 0;
}
.gf-bottom-nav .tab .ico { width: 20px; height: 20px; }
.gf-bottom-nav .tab[aria-current="page"] { color: var(--accent-2); }
.gf-bottom-nav .tab[aria-current="page"] .ico { filter: drop-shadow(0 0 8px rgba(24, 201, 155, .55)); }
.gf-bottom-nav .tab-fab { position: relative; }
.gf-bottom-nav .tab-fab .plus {
  display: grid; place-items: center;
  width: 48px; height: 48px; margin-top: -20px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), #0e9c7c);
  color: #042018;
  box-shadow: 0 10px 24px rgba(24, 201, 155, .35), inset 0 0 0 1px rgba(255, 255, 255, .22);
}
.gf-bottom-nav .tab-fab .plus .ico { width: 22px; height: 22px; }
.gf-bottom-nav .tab-fab span:last-child { color: var(--accent-2); }

/* ---------- Encabezados y textos ---------- */
.section-kicker { display: block; color: var(--muted-2); font-size: 9.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; margin-bottom: 4px; }
.muted { color: var(--muted); }
.tiny { font-size: 11px; }
.big { font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
.kpi-good { color: var(--accent-2); }
.kpi-warn { color: var(--amber); }
.good { color: var(--accent-2); }
.warn { color: var(--amber); }
.bad { color: var(--red); }

/* ---------- Hero ---------- */
.hero-balance {
  position: relative;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  padding: 22px 24px;
  border-radius: var(--radius);
  border: 1px solid rgba(24, 201, 155, .22);
  background:
    radial-gradient(120% 180% at 0% 0%, rgba(24, 201, 155, .16), transparent 55%),
    linear-gradient(135deg, #0d2033 0%, #0a1728 62%, #0b1a2c 100%);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.hero-balance::after {
  content: ""; position: absolute; right: -90px; top: -110px;
  width: 280px; height: 280px; border-radius: 50%;
  border: 1px solid rgba(24, 201, 155, .14);
  box-shadow: 0 0 0 38px rgba(24, 201, 155, .035), 0 0 0 84px rgba(24, 201, 155, .02);
  pointer-events: none;
}
.hero-balance.compact { padding: 18px 22px; }
.hero-kicker { color: var(--accent-2); font-size: 9.5px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; margin-bottom: 5px; }
.hero-copy h2 { font-size: 21px; line-height: 1.2; letter-spacing: -.02em; font-weight: 800; }
.hero-copy p { color: #a9bdd2; font-size: 12.5px; margin-top: 6px; max-width: 680px; }
.hero-action {
  position: relative; z-index: 1; flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px; border-radius: 10px;
  border: 1px solid rgba(24, 201, 155, .32);
  background: rgba(24, 201, 155, .10);
  color: var(--accent-2); font-size: 12px; font-weight: 800;
}
.hero-action:hover { background: rgba(24, 201, 155, .17); }

/* ---------- KPIs ---------- */
.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.dashboard-kpis.kpis-auto { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.mini-kpi, .mini-kpi-link {
  display: flex; align-items: center; gap: 11px;
  min-width: 0;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(15, 30, 50, .92), rgba(11, 22, 38, .92));
  box-shadow: 0 8px 22px rgba(0, 0, 0, .18);
}
.mini-kpi-link { text-decoration: none; color: inherit; cursor: pointer; transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease; }
.mini-kpi-link:hover { transform: translateY(-2px); border-color: rgba(24, 201, 155, .42); box-shadow: 0 12px 30px rgba(0, 0, 0, .26); background: rgba(18, 34, 55, .96); }
.mini-kpi-link:active { transform: translateY(0); }
.mini-kpi > div, .mini-kpi-link > div { min-width: 0; }
.mini-kpi small, .mini-kpi-link small { display: block; color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; margin-bottom: 2px; }
.mini-kpi b, .mini-kpi-link b { display: block; font-size: 14.5px; font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.mini-kpi span.muted, .mini-kpi-link span.muted { display: block; font-size: 10px; margin-top: 2px; }
.mini-kpi-icon {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(90, 169, 248, .10); border: 1px solid rgba(90, 169, 248, .20);
  color: var(--blue); font-size: 15px; font-weight: 800;
}
.mini-kpi-icon.good { background: rgba(24, 201, 155, .10); border-color: rgba(24, 201, 155, .22); color: var(--accent-2); }
.mini-kpi-icon.warn { background: rgba(246, 185, 74, .10); border-color: rgba(246, 185, 74, .22); color: var(--amber); }
.mini-kpi-icon.blue { background: rgba(90, 169, 248, .10); border-color: rgba(90, 169, 248, .22); color: var(--blue); }
.mini-kpi .ico, .mini-kpi-link .ico { width: 17px; height: 17px; }
.kpi-go { margin-left: auto; align-self: center; opacity: .45; font-size: 17px; }

/* ---------- Saldos por cuenta ---------- */
.country-balance-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(228px, 1fr)); gap: 12px; }
.country-balance-grid.full { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.country-balance-card {
  position: relative;
  padding: 15px;
  border-radius: 15px;
  border: 1px solid var(--line);
  background:
    radial-gradient(90% 130% at 100% 0%, rgba(24, 201, 155, .075), transparent 55%),
    linear-gradient(180deg, #0e1e33, #0b1728);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .2);
  transition: border-color .16s ease, transform .16s ease;
}
.country-balance-card:hover { border-color: rgba(24, 201, 155, .32); transform: translateY(-1px); }
.country-balance-top { display: flex; align-items: center; gap: 10px; }
.country-symbol {
  width: 36px; height: 36px; flex: 0 0 auto; border-radius: 11px;
  display: grid; place-items: center;
  background: rgba(24, 201, 155, .10);
  border: 1px solid rgba(24, 201, 155, .25);
  color: var(--accent-2); font-size: 14px; font-weight: 800;
}
.country-name { min-width: 0; }
.country-name span { display: block; font-size: 12.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.country-name small { display: block; color: var(--muted); font-size: 10px; margin-top: 1px; }
.live-dot {
  margin-left: auto; flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 5px;
  color: var(--accent-2); font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
}
.live-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(24, 201, 155, .13); }
.country-amount { margin-top: 13px; font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.country-amount small { color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.country-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; color: var(--muted-2); font-size: 10px; }
.mini-arrow { color: var(--muted); }

/* ---------- Paneles ---------- */
.panel {
  position: relative;
  padding: 18px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(12, 24, 41, .94), rgba(9, 19, 33, .94));
  box-shadow: 0 12px 34px rgba(0, 0, 0, .2);
}
.panel .panel { padding: 14px; box-shadow: none; background: rgba(8, 17, 30, .7); }
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  margin-bottom: 14px;
}
.panel-head h2 { font-size: 15.5px; line-height: 1.3; letter-spacing: -.01em; font-weight: 800; }
.panel-head > .muted, .panel-head > div > .muted { font-size: 11.5px; }
.panel-head .btn { flex: 0 0 auto; }
.featured-panel { border-color: rgba(24, 201, 155, .24); background: linear-gradient(180deg, rgba(15, 34, 50, .96), rgba(9, 19, 33, .96)); }
.info-panel { display: flex; gap: 12px; align-items: flex-start; border-color: rgba(90, 169, 248, .22); background: linear-gradient(180deg, rgba(14, 32, 53, .9), rgba(9, 19, 33, .92)); }
.info-icon {
  flex: 0 0 auto; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(90, 169, 248, .12); border: 1px solid rgba(90, 169, 248, .3);
  color: var(--blue); font-size: 12px; font-weight: 800; font-style: italic;
}
.info-panel b { display: block; font-size: 12.5px; margin-bottom: 2px; }
.info-panel p { color: var(--muted); font-size: 12px; }

/* ---------- Listas de actividad ---------- */
.activity-list { display: flex; flex-direction: column; }
.activity {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px solid rgba(28, 45, 69, .62);
}
.activity:last-child { border-bottom: 0; padding-bottom: 2px; }
.activity:first-child { padding-top: 2px; }
.activity-icon {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(90, 169, 248, .08); border: 1px solid rgba(90, 169, 248, .16);
  font-size: 14px;
}
.activity > div:nth-child(2) { min-width: 0; flex: 1; }
.activity-title { font-size: 12.5px; font-weight: 700; }
.activity-meta { color: var(--muted); font-size: 11px; margin-top: 2px; }
.activity-meta b { color: #c9d7e7; font-weight: 700; }
.activity-amount { margin-left: auto; text-align: right; font-size: 13.5px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.activity-amount small { display: block; color: var(--muted); font-size: 9.5px; font-weight: 700; letter-spacing: .04em; }

/* ---------- Grid de tarjetas ---------- */
.grid { display: grid; gap: 14px; }
.grid.cards { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid.two-col { grid-template-columns: minmax(0, 1.4fr) minmax(0, .9fr); align-items: start; }
.grid.two-col > div { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, #0e1e33, #0b1728);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .18);
}
.card .label { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.card .value { margin-top: 4px; font-size: 21px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 7px 13px;
  border-radius: 10px;
  border: 1px solid var(--line-2);
  background: rgba(19, 38, 61, .75);
  color: #d7e3f0;
  font-size: 12px; font-weight: 700; line-height: 1.2;
  text-decoration: none; cursor: pointer;
  transition: border-color .16s ease, background .16s ease, color .16s ease, transform .16s ease;
}
.btn:hover { border-color: #39577a; background: rgba(26, 48, 74, .85); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn.primary {
  border-color: rgba(24, 201, 155, .5);
  background: linear-gradient(135deg, #1bd8a7, #0fa985);
  color: #03231b;
  box-shadow: 0 8px 20px rgba(24, 201, 155, .18);
}
.btn.primary:hover { background: linear-gradient(135deg, #35e7ba, #14b992); color: #02241c; }
.btn.secondary { background: rgba(255, 255, 255, .025); }
.btn.danger { border-color: rgba(255, 107, 134, .34); background: rgba(255, 107, 134, .09); color: #ffa9b8; }
.btn.danger:hover { background: rgba(255, 107, 134, .16); color: #ffd2da; }
.btn.small { min-height: 30px; padding: 5px 9px; font-size: 11px; border-radius: 8px; }
.btn.full { width: 100%; }
.btn-glow { box-shadow: 0 0 0 1px rgba(24, 201, 155, .16), 0 10px 26px rgba(24, 201, 155, .2); }
.gf-mini-btn {
  min-height: 28px; padding: 4px 9px; border-radius: 8px;
  border: 1px solid var(--line-2); background: rgba(255, 255, 255, .025);
  color: #bcd0e4; font-size: 10.5px; font-weight: 700; cursor: pointer;
}
.gf-mini-btn:hover { border-color: rgba(24, 201, 155, .45); color: var(--accent-2); }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.actions .btn { min-height: 38px; padding-inline: 18px; }

/* ---------- Formularios ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid > div { min-width: 0; }
label {
  display: block; margin-bottom: 6px;
  color: #a9bcd2; font-size: 11.5px; font-weight: 700; letter-spacing: .02em;
}
label .muted { font-weight: 500; }
input[type="text"], input[type="password"], input[type="number"], input[type="tel"],
input[type="date"], input[type="datetime-local"], input[type="search"], input:not([type]),
select, textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: #0a1422;
  color: var(--text);
  font-size: 13px;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
select { padding-right: 34px; cursor: pointer; }
textarea { min-height: 84px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #5d7590; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(24, 201, 155, .65);
  box-shadow: 0 0 0 3px rgba(24, 201, 155, .12);
  background: #0b1728;
}
input[readonly] { color: var(--muted); background: #081220; cursor: default; }
input:disabled, select:disabled, textarea:disabled { opacity: .55; cursor: not-allowed; }
input[type="file"] {
  width: 100%; min-height: 42px; padding: 6px 8px;
  border: 1px dashed var(--line-2); border-radius: var(--radius-sm);
  background: #0a1422; color: var(--muted); font-size: 11.5px;
}
input[type="file"]::file-selector-button {
  margin-right: 9px; padding: 6px 10px;
  border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--surface-3); color: #d6e4f2;
  font-size: 11.5px; font-weight: 700; cursor: pointer;
}
small.muted, .form-grid small { display: block; margin-top: 5px; font-size: 10.5px; line-height: 1.4; }
.gf-check-row { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; color: #c0d0e2; font-weight: 600; cursor: pointer; }
.gf-check-row input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--accent); }
.gf-payment-note {
  margin-top: 14px; padding: 11px 13px;
  border-radius: 10px; border: 1px solid rgba(90, 169, 248, .22);
  background: rgba(90, 169, 248, .07);
  color: #a9c7e8; font-size: 11.5px;
}
.gf-payment-note.is-payment { border-color: rgba(24, 201, 155, .26); background: rgba(24, 201, 155, .07); color: #a9e6d6; }

/* Selector de cliente */
.gf-client-picker { position: relative; }
.gf-client-search { padding-right: 34px; }
.gf-client-results {
  position: absolute; z-index: 35; top: calc(100% + 6px); left: 0; right: 0;
  max-height: 268px; overflow-y: auto; padding: 5px;
  border-radius: 12px; border: 1px solid var(--line-2);
  background: #0e1d31; box-shadow: 0 20px 46px rgba(0, 0, 0, .5);
}
.gf-client-option {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  width: 100%; padding: 9px 10px;
  border: 0; border-radius: 8px; background: transparent;
  color: var(--text); text-align: left; cursor: pointer;
}
.gf-client-option:hover, .gf-client-option:focus-visible { background: rgba(24, 201, 155, .1); }
.gf-client-option strong { font-size: 12.5px; font-weight: 700; }
.gf-client-option small { color: var(--muted); font-size: 10.5px; }
.gf-client-empty { padding: 12px 10px; color: var(--muted); font-size: 11.5px; }
.gf-table-search {
  width: 220px; min-height: 34px !important;
  padding: 6px 11px !important; font-size: 12px !important;
}

/* ---------- Tablas ---------- */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  border-radius: 12px;
  border: 1px solid rgba(28, 45, 69, .75);
}
.table-wrap table { width: 100%; border-collapse: collapse; min-width: 660px; }
.table-wrap thead th {
  position: sticky; top: 0; z-index: 2;
  padding: 9px 11px;
  background: #0d1b2e;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 9.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  text-align: left; white-space: nowrap;
}
.table-wrap tbody td {
  padding: 10px 11px;
  border-bottom: 1px solid rgba(28, 45, 69, .58);
  color: #cfdbe8;
  font-size: 12px;
  vertical-align: middle;
}
.table-wrap tbody tr:last-child td { border-bottom: 0; }
.table-wrap tbody tr:hover { background: rgba(24, 201, 155, .035); }
.table-wrap tbody td strong { color: var(--text); font-weight: 700; }
.table-wrap tbody td .btn { white-space: nowrap; }
.table-wrap tbody td form { margin: 0; }
.gf-debt-row { cursor: pointer; transition: background .15s ease; }
.gf-debt-row:hover { background: rgba(24, 201, 155, .05); }
.gf-debt-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.gf-debt-actions .btn { min-height: 28px; padding: 4px 9px; font-size: 10.5px; }
.table-wrap + p { margin-top: 10px; font-size: 11px; }

/* ---------- Estados / badges ---------- */
.status, .badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px; border-radius: 999px;
  border: 1px solid rgba(90, 169, 248, .28);
  background: rgba(90, 169, 248, .09);
  color: #9dc6f5;
  font-size: 9.5px; font-weight: 800; letter-spacing: .04em; line-height: 1.4;
  white-space: nowrap;
}
.status::before, .badge::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; opacity: .9; }
.badge::before { display: none; }
.status.PAID, .status.CONFIRMED, .status.OPEN, .status.COMPLETED, .badge.ok {
  border-color: rgba(24, 201, 155, .35); background: rgba(24, 201, 155, .10); color: var(--accent-2);
}
.status.PARTIAL, .status.PENDING {
  border-color: rgba(246, 185, 74, .35); background: rgba(246, 185, 74, .10); color: var(--amber);
}
.status.VOID, .status.FAILED, .status.CANCELLED {
  border-color: rgba(255, 107, 134, .32); background: rgba(255, 107, 134, .09); color: #ff9caf;
}
.badge.ok { color: var(--accent-2); }
.status.paid, .status.pending { text-transform: none; }

/* ---------- Alertas y vacíos ---------- */
.alert {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 11px 13px; border-radius: 11px;
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--line);
}
.alert::before { content: ""; flex: 0 0 auto; width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: currentColor; }
.alert.success { border-color: rgba(24, 201, 155, .3); background: rgba(24, 201, 155, .08); color: #a9ecd9; }
.alert.error { border-color: rgba(255, 107, 134, .3); background: rgba(255, 107, 134, .08); color: #ffbdc9; }
.empty-state {
  display: flex; align-items: center; gap: 12px;
  padding: 20px;
  border: 1px dashed var(--line-2);
  border-radius: 12px;
  color: var(--muted);
}
.empty-state .empty-icon {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: rgba(255, 255, 255, .03); border: 1px solid var(--line);
  font-size: 16px; color: var(--muted);
}
.empty-state b { display: block; color: #cfdae7; font-size: 12.5px; }
.empty-state span { display: block; font-size: 11px; margin-top: 2px; }
.balance-empty { margin-bottom: 0; }

/* ---------- Cobranza ---------- */
.debt-alert {
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 107, 134, .28);
  background:
    radial-gradient(100% 150% at 100% 0%, rgba(255, 107, 134, .10), transparent 55%),
    linear-gradient(180deg, rgba(37, 18, 30, .92), rgba(17, 18, 30, .95));
  box-shadow: 0 12px 34px rgba(0, 0, 0, .22);
}
.debt-alert-head { display: flex; align-items: center; gap: 11px; }
.debt-alert-head h2 { font-size: 14.5px; font-weight: 800; }
.alert-icon {
  flex: 0 0 auto; width: 34px; height: 34px; border-radius: 10px;
  display: grid; place-items: center;
  background: rgba(255, 107, 134, .12); border: 1px solid rgba(255, 107, 134, .3);
  color: #ff9caf; font-size: 15px;
}
.danger-pill {
  margin-left: auto; padding: 3px 8px; border-radius: 999px;
  background: rgba(255, 107, 134, .12); border: 1px solid rgba(255, 107, 134, .32);
  color: #ffb3c1; font-size: 9px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase;
}
.summary-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; font-size: 11.5px; }
.summary-line .big { font-size: 16px; color: #ffd6dd; }
.debt-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 11px; }
.debt-item {
  padding: 13px;
  border-radius: 12px;
  border: 1px solid rgba(255, 107, 134, .18);
  background: rgba(9, 18, 31, .62);
}
.debt-item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.debt-item-top strong { font-size: 12.5px; }
.days-pill {
  flex: 0 0 auto; padding: 3px 7px; border-radius: 999px;
  background: rgba(246, 185, 74, .10); border: 1px solid rgba(246, 185, 74, .25);
  color: var(--amber); font-size: 9.5px; font-weight: 800; white-space: nowrap;
}
.debt-amount { margin-top: 9px; }
.debt-amount .big { font-size: 17px; }
.debt-amount .desc { margin-top: 5px; color: var(--muted); font-size: 11px; }
.debt-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.debt-actions .btn { min-height: 29px; padding: 4px 9px; font-size: 10.5px; }

/* ---------- Línea de tiempo ---------- */
.gf-timeline { position: relative; display: grid; gap: 10px; margin-top: 4px; }
.gf-timeline::before {
  content: ""; position: absolute; left: 21px; top: 10px; bottom: 10px; width: 1px;
  background: linear-gradient(180deg, rgba(24, 201, 155, .35), rgba(28, 45, 69, .5), transparent);
}
.gf-move {
  position: relative;
  display: grid; grid-template-columns: 42px minmax(0, 1fr) auto; gap: 11px; align-items: center;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(11, 23, 40, .82);
  color: inherit; text-decoration: none;
  transition: border-color .16s ease, transform .16s ease, background .16s ease;
}
.gf-move:hover { transform: translateY(-1px); border-color: rgba(24, 201, 155, .42); background: rgba(15, 34, 58, .95); }
.gf-move-icon {
  z-index: 1; width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center;
  background: #102c45; border: 1px solid rgba(57, 208, 174, .22);
  font-size: 16px;
}
.gf-move-main { min-width: 0; }
.gf-move-main b { display: block; font-size: 12.5px; font-weight: 700; }
.gf-move-meta { color: var(--muted); font-size: 10.5px; margin-top: 2px; }
.gf-move-detail { margin-top: 3px; color: #c6d2df; font-size: 11.5px; }
.gf-move-amount { text-align: right; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums; }
.gf-move-amount small { display: block; color: var(--muted); font-size: 9px; font-weight: 700; letter-spacing: .05em; margin-top: 2px; }

/* ---------- Hojas / diálogos ---------- */
dialog.sheet {
  position: fixed;
  inset: auto 0 0 0;
  width: min(560px, 100%);
  max-width: 100%;
  max-height: 92vh;
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}
dialog.sheet::backdrop { background: rgba(2, 7, 14, .68); backdrop-filter: blur(3px); }
.sheet-card {
  padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  border: 1px solid var(--line-2);
  border-bottom: 0;
  background: linear-gradient(180deg, #0e1d31, #081321);
  box-shadow: 0 -20px 60px rgba(0, 0, 0, .5);
  animation: sheet-in .22s ease both;
  max-height: 92vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
@keyframes sheet-in { from { transform: translateY(18px); opacity: .4; } to { transform: none; opacity: 1; } }
.sheet-handle { width: 40px; height: 4px; margin: 0 auto 14px; border-radius: 99px; background: #28415f; }
.sheet-card h3 { font-size: 15px; font-weight: 800; }
.sheet-card > p { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.sheet-card .panel-head { margin-bottom: 2px; align-items: flex-start; }
.sheet-card .panel-head h3 { font-size: 15.5px; }
.sheet-card .panel-head p { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.sheet-card .panel-head .icon-btn { flex: 0 0 auto; width: 32px; height: 32px; }
.sheet-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; margin-top: 14px; }
.sheet-grid a {
  display: flex; flex-direction: column; gap: 2px;
  padding: 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, .02);
}
.sheet-grid a:hover { border-color: rgba(24, 201, 155, .4); background: rgba(24, 201, 155, .06); }
.sheet-grid a > span { display: grid; place-items: center; width: 30px; height: 30px; margin-bottom: 4px; border-radius: 9px; background: rgba(24, 201, 155, .09); border: 1px solid rgba(24, 201, 155, .2); color: var(--accent-2); font-size: 17px; }
.sheet-grid a > span .ico { width: 16px; height: 16px; }
.sheet-grid a > b { font-size: 12.5px; }
.sheet-grid a > small { color: var(--muted); font-size: 10px; }
.gf-more-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.gf-more-head p { color: var(--muted); font-size: 10.5px; }
.gf-logout { color: #ff9caf; font-size: 11px; font-weight: 700; }
.gf-more-list { display: flex; flex-direction: column; margin-top: 6px; }
.gf-more-list a { display: flex; align-items: center; justify-content: space-between; padding: 10px 2px; border-bottom: 1px solid rgba(28, 45, 69, .55); font-size: 12.5px; font-weight: 600; }
.gf-more-list a:last-child { border-bottom: 0; }
.gf-more-list a span { color: var(--muted); }
body.gf-sheet-open { overflow: hidden; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; z-index: 80; left: 50%; bottom: 84px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  display: none;
  padding: 10px 15px;
  border-radius: 10px;
  border: 1px solid rgba(24, 201, 155, .4);
  background: rgba(9, 27, 24, .96);
  color: #b8f5e5; font-size: 12px; font-weight: 700;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .45);
}
.toast.is-visible { display: block; animation: toast-in .2s ease both; }
@keyframes toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ---------- Login ---------- */
body.auth-body {
  margin: 0; min-height: 100vh;
  display: grid; place-items: center; padding: 22px;
  background:
    radial-gradient(900px 600px at 50% -20%, rgba(24, 201, 155, .16), transparent 60%),
    radial-gradient(700px 500px at 100% 110%, rgba(90, 169, 248, .10), transparent 60%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  font-size: 14px; line-height: 1.5;
}
.auth-card {
  width: min(400px, 100%);
  padding: 26px 24px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(14, 29, 49, .97), rgba(8, 18, 31, .98));
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
}
.auth-logo { width: 64px; height: 64px; border-radius: 16px; object-fit: cover; border: 1px solid rgba(24, 201, 155, .3); margin-bottom: 14px; }
.auth-card h1 { font-size: 22px; font-weight: 800; letter-spacing: -.02em; }
.auth-card > p { color: var(--muted); font-size: 12px; margin-top: 3px; }
.auth-card form { display: flex; flex-direction: column; gap: 13px; margin-top: 20px; }
.auth-card label { margin: 0; }
.auth-card .btn { min-height: 42px; margin-top: 3px; }
.auth-pw { position: relative; }
.auth-pw input { padding-right: 44px; }
.auth-pw-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 32px; height: 32px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); cursor: pointer;
  display: grid; place-items: center;
}
.auth-pw-toggle:hover { color: var(--text); background: rgba(255, 255, 255, .05); }
.auth-pw-toggle .ico { width: 17px; height: 17px; }
.auth-help { margin-top: 14px; color: var(--muted-2); font-size: 10.5px; text-align: center; line-height: 1.5; }

/* Iconos */
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Utilidades ---------- */
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.text-center { text-align: center; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  :root { --sidebar: 224px; }
  .gf-main { padding: 20px 22px 60px; }
  .grid.two-col { grid-template-columns: minmax(0, 1.2fr) minmax(0, .85fr); }
}
@media (max-width: 1080px) {
  .gf-sidebar { display: none; }
  .gf-main { margin-left: 0; padding: 16px 16px calc(92px + env(safe-area-inset-bottom)); }
  .gf-topbar { margin-bottom: 14px; gap: 10px; }
  .mobile-brand {
    display: grid; place-items: center; flex: 0 0 auto;
    width: 36px; height: 36px; border-radius: 10px; overflow: hidden;
    border: 1px solid rgba(24, 201, 155, .3);
  }
  .mobile-brand img { width: 100%; height: 100%; object-fit: cover; }
  .gf-page-title-row h1 { font-size: 18px; }
  .gf-page-title-row { align-items: center; }
  .gf-eyebrow, .gf-date { display: none; }
  .gf-user-pill { display: none; }
  .gf-bottom-nav { display: grid; grid-template-columns: repeat(5, 1fr); }
  .country-balance-grid { grid-template-columns: repeat(auto-fit, minmax(196px, 1fr)); }
  .grid.two-col { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .hero-balance { flex-direction: column; align-items: flex-start; gap: 14px; }
  .hero-action { align-self: stretch; justify-content: center; }
  .panel { padding: 15px; }
  .panel-head { flex-wrap: wrap; }
  .panel-head .btn { margin-left: auto; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .table-wrap table { min-width: 0; }
  .table-wrap { border: 0; overflow: visible; }
  .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap tr, .table-wrap td { display: block; width: 100%; }
  .table-wrap thead { display: none; }
  .table-wrap tbody tr {
    margin-bottom: 10px;
    padding: 4px 13px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: rgba(11, 23, 40, .75);
  }
  .table-wrap tbody tr:last-child { margin-bottom: 0; }
  .table-wrap tbody td {
    display: flex; align-items: center; justify-content: space-between; gap: 14px;
    padding: 8px 0;
    border-bottom: 1px solid rgba(28, 45, 69, .5);
    text-align: right;
  }
  .table-wrap tbody td:last-child { border-bottom: 0; }
  .table-wrap tbody td::before {
    content: attr(data-label);
    flex: 0 0 42%;
    color: var(--muted-2);
    font-size: 9.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
    text-align: left;
  }
  .table-wrap tbody td[data-label=""]::before { display: none; }
  .table-wrap tbody td[data-label="Acciones"], .table-wrap tbody td[data-label="Cambio"] { flex-wrap: wrap; }
  .table-wrap tbody td .gf-debt-actions { justify-content: flex-end; }
  .gf-debt-row { cursor: default; }
  .gf-table-search { width: 100%; }
  .gf-move { grid-template-columns: 38px minmax(0, 1fr); }
  .gf-move-amount { grid-column: 2; text-align: left; }
  .gf-timeline::before { left: 19px; }
  .gf-move-icon { width: 36px; height: 36px; }
  .summary-line { flex-direction: column; align-items: flex-start; gap: 4px; }
}
@media (max-width: 620px) {
  .gf-main { padding: 13px 12px calc(88px + env(safe-area-inset-bottom)); }
  .gf-page-title-row h1 { font-size: 16.5px; }
  .gf-head-actions .btn.primary { width: 36px; min-height: 36px; padding: 0; }
  .gf-head-actions .btn.primary span { display: none; }
  .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mini-kpi, .mini-kpi-link { padding: 11px; gap: 9px; }
  .mini-kpi b, .mini-kpi-link b { font-size: 13px; }
  .mini-kpi-icon { width: 30px; height: 30px; }
  .country-balance-grid, .country-balance-grid.full { grid-template-columns: minmax(0, 1fr); }
  .country-amount { font-size: 20px; }
  .hero-copy h2 { font-size: 18px; }
  .activity { align-items: flex-start; }
  .activity-amount { font-size: 12.5px; }
  .debt-cards { grid-template-columns: minmax(0, 1fr); }
  .grid.cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card .value { font-size: 18px; }
  .panel-head h2 { font-size: 14.5px; }
}
@media (max-width: 900px) {
  .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 360px) {
  .dashboard-kpis { grid-template-columns: minmax(0, 1fr); }
  .grid.cards { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 420px) {
  .gf-topbar { gap: 8px; }
  .gf-head-actions { gap: 6px; }
  .gf-icon-btn { width: 34px; height: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
