/* reset mínimo */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
p, h1, h2, h3, ul, figure { margin: 0; }
button, input, select { font: inherit; }
[hidden] { display: none !important; }

      :root {
        --x-bg: #0d111c; --x-side: #070a12; --x-card: #151b2b; --x-line: #232b40; --x-line2: #1c2336;
        --x-text: #f2f5ff; --x-muted: #8a93ad;
        --x-green: #39ff88; --x-pink: #ff2e88; --x-yellow: #f5ff3b; --x-cyan: #00e5ff; --x-violet: #b14bff; --x-violet-ink: #c98bff;
        --x-r: 14px; --x-font: "Space Grotesk", system-ui, sans-serif;
      }
      html, body { background: var(--x-bg); }
      body { color: var(--x-text); font-family: var(--x-font); font-size: 15px; line-height: 1.45; }
      .x-app { max-width: none; margin: 0; padding: 0; display: grid; grid-template-columns: 248px minmax(0, 1fr); gap: 0; min-height: 100vh; }
      .x-app, .x-app * { font-family: var(--x-font); }

      /* sidebar */
      .x-side { background: var(--x-side); border-right: 1px solid var(--x-line2); padding: 24px 16px; display: flex; flex-direction: column; gap: 28px; position: sticky; top: 0; height: 100vh; }
      .x-brand { display: flex; gap: 12px; align-items: center; padding: 0 8px; }
      .x-logo { width: 40px; height: 40px; border-radius: 12px; background: linear-gradient(135deg, var(--x-violet), var(--x-pink)); display: grid; place-items: center; font-weight: 700; font-size: 16px; color: #fff; box-shadow: 0 0 18px rgba(177, 75, 255, 0.45); flex: none; }
      .x-brand b { display: block; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; }
      .x-brand span { display: block; font-size: 12px; color: var(--x-muted); }
      .x-nav { display: flex; flex-direction: column; gap: 4px; }
      .x-nav button { all: unset; box-sizing: border-box; cursor: pointer; display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 10px; color: var(--x-muted); font-weight: 500; font-size: 14px; }
      .x-nav button svg { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
      .x-nav button:hover { color: var(--x-text); background: #10162a; }
      .x-nav button[aria-current="page"] { color: var(--x-text); background: #151b2b; box-shadow: inset 3px 0 0 var(--x-violet); }
      .x-nav button[aria-current="page"] svg { stroke: var(--x-violet); }
      .x-nav button:focus-visible { outline: 2px solid var(--x-cyan); }
      .x-sidefoot { margin-top: auto; font-size: 12px; color: var(--x-muted); padding: 0 8px; }

      /* main */
      .x-main { padding: 24px clamp(16px, 3vw, 40px) 48px; min-width: 0; display: flex; flex-direction: column; gap: 20px; }
      .x-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
      .x-top h1 { font-size: clamp(22px, 2.4vw, 30px); font-weight: 700; letter-spacing: -0.02em; }
      .x-top p { color: var(--x-muted); font-size: 13px; margin-top: 2px; }
      .x-month { display: flex; align-items: center; gap: 4px; background: var(--x-card); border: 1px solid var(--x-line); border-radius: 999px; padding: 4px; }
      .x-month button { all: unset; cursor: pointer; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; color: var(--x-cyan); font-size: 14px; }
      .x-month button:hover { background: #1d2540; }
      .x-month button:focus-visible { outline: 2px solid var(--x-cyan); }
      .x-month span { min-width: 140px; text-align: center; font-weight: 600; text-transform: capitalize; }
      .x-view[hidden] { display: none; }
      .x-view { display: flex; flex-direction: column; gap: 20px; }

      /* cards */
      .x-card { background: var(--x-card); border: 1px solid var(--x-line); border-radius: var(--x-r); padding: 20px; min-width: 0; }
      .x-card h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
      .x-card h3 { font-size: 13px; font-weight: 500; color: var(--x-muted); }
      .x-cardhead { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
      .x-grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
      .x-grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
      .x-split { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 16px; }
      .x-formsplit { display: grid; grid-template-columns: minmax(300px, 420px) minmax(0, 1fr); gap: 16px; align-items: start; }
      .x-big { font-size: clamp(26px, 2.6vw, 34px); font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; margin-top: 8px; font-variant-numeric: tabular-nums; }
      .x-sub { color: var(--x-muted); font-size: 13px; margin-top: 6px; }
      .x-g { color: var(--x-green); } .x-p { color: var(--x-pink); } .x-y { color: var(--x-yellow); } .x-c { color: var(--x-cyan); } .x-v { color: var(--x-violet-ink); } .x-m { color: var(--x-muted); }
      .x-badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; }
      .x-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; box-shadow: 0 0 8px currentColor; }

      /* semáforo */
      .x-sema { display: grid; grid-template-columns: auto minmax(0, 1fr) minmax(260px, 0.9fr); gap: 32px; align-items: center; padding: 24px 28px; }
      .x-lights { display: flex; flex-direction: column; gap: 10px; background: #0a0e18; border: 1px solid var(--x-line); padding: 12px; border-radius: 40px; }
      .x-light { width: 40px; height: 40px; border-radius: 50%; background: #1b2132; border: 1px solid #262e45; transition: all 0.3s; }
      .x-light.is-on[data-c="r"] { background: var(--x-pink); box-shadow: 0 0 22px var(--x-pink), 0 0 6px var(--x-pink); }
      .x-light.is-on[data-c="y"] { background: var(--x-yellow); box-shadow: 0 0 22px var(--x-yellow), 0 0 6px var(--x-yellow); }
      .x-light.is-on[data-c="g"] { background: var(--x-green); box-shadow: 0 0 22px var(--x-green), 0 0 6px var(--x-green); }
      .x-pct { font-size: clamp(48px, 6vw, 76px); font-weight: 700; letter-spacing: -0.04em; line-height: 1; margin: 10px 0 12px; font-variant-numeric: tabular-nums; }
      .x-semafig { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
      .x-semafig div { background: #0f1424; border: 1px solid var(--x-line); border-radius: 12px; padding: 14px; }
      .x-semafig b { display: block; font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
      .x-bar { position: relative; height: 14px; border-radius: 999px; display: flex; overflow: visible; margin: 34px 0 8px; }
      .x-bar i { display: block; height: 100%; }
      .x-bar i:nth-child(1) { width: 60%; background: rgba(57, 255, 136, 0.55); border-radius: 999px 0 0 999px; }
      .x-bar i:nth-child(2) { width: 10%; background: rgba(245, 255, 59, 0.6); }
      .x-bar i:nth-child(3) { width: 30%; background: rgba(255, 46, 136, 0.55); border-radius: 0 999px 999px 0; }
      .x-limit { position: absolute; left: 60%; top: -8px; bottom: -8px; width: 2px; background: #fff; }
      .x-limit span { position: absolute; bottom: calc(100% + 2px); left: 50%; transform: translateX(-50%); font-size: 12px; white-space: nowrap; color: #fff; font-weight: 600; background: var(--x-card); padding: 0 4px; border-radius: 4px; }
      .x-marker { position: absolute; top: 50%; width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 4px solid var(--x-bg); transform: translate(-50%, -50%); box-shadow: 0 0 12px #fff; transition: left 0.5s; }
      .x-scale { display: flex; justify-content: space-between; font-size: 12px; color: var(--x-muted); }
      .x-msg { margin-top: 16px; padding: 12px 14px; border-radius: 10px; background: #0f1424; border: 1px solid var(--x-line); font-size: 14px; }

      /* chart */
      .x-chart { position: relative; height: 300px; }
      .x-legend { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; margin-top: 14px; font-size: 12px; }
      .x-legend div { display: flex; align-items: center; gap: 8px; min-width: 0; }
      .x-legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
      .x-legend span { flex: 1; color: var(--x-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
      .x-legend b { font-weight: 600; font-variant-numeric: tabular-nums; }

      /* table */
      .x-tablewrap { overflow-x: auto; }
      .x-table { width: 100%; border-collapse: collapse; font-size: 14px; font-family: var(--x-font); }
      .x-table th, .x-table td { padding: 11px 12px; border-bottom: 1px solid var(--x-line2); text-align: left; vertical-align: middle; }
      .x-table thead th { color: var(--x-muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; border-bottom: 1px solid var(--x-line); }
      .x-table th:first-child, .x-table td:first-child { padding-left: 4px; }
      .x-table td.x-num, .x-table th.x-num { text-align: right; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
      .x-table td small { display: block; color: var(--x-muted); font-size: 12px; }
      .x-table tbody tr:hover { background: #10162a; }
      .x-empty { color: var(--x-muted); text-align: center; padding: 28px 0 !important; }
      .x-cat { display: inline-block; font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px; white-space: nowrap; border: 1px solid; }
      .x-acts { display: flex; gap: 6px; justify-content: flex-end; }

      /* forms */
      .x-form { display: grid; gap: 14px; }
      .x-field { display: grid; gap: 6px; }
      .x-field label, .x-lab { font-size: 12px; color: var(--x-muted); font-weight: 500; }
      .x-input { width: 100%; min-height: 44px; background: #0d1220; border: 1px solid var(--x-line); border-radius: 10px; color: var(--x-text); padding: 0 12px; font-size: 15px; color-scheme: dark; }
      .x-input:focus { outline: none; border-color: var(--x-cyan); box-shadow: 0 0 0 3px rgba(0, 229, 255, 0.15); }
      .x-input.x-money { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
      .x-row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
      .x-seg { display: flex; background: #0d1220; border: 1px solid var(--x-line); border-radius: 10px; padding: 3px; gap: 3px; }
      .x-seg button { all: unset; flex: 1; text-align: center; min-height: 38px; border-radius: 8px; cursor: pointer; font-size: 13px; color: var(--x-muted); font-weight: 500; }
      .x-seg button[aria-pressed="true"] { background: #1d2540; color: var(--x-text); }
      .x-seg button:focus-visible { outline: 2px solid var(--x-cyan); }
      .x-btn { all: unset; box-sizing: border-box; cursor: pointer; min-height: 44px; padding: 0 18px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 600; font-size: 14px; background: var(--x-cyan); color: #04121a; }
      .x-btn:hover { filter: brightness(1.1); box-shadow: 0 0 16px rgba(0, 229, 255, 0.4); }
      .x-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
      .x-btn[disabled] { opacity: 0.4; cursor: not-allowed; box-shadow: none; filter: none; }
      .x-btn--ghost { background: transparent; color: var(--x-text); border: 1px solid var(--x-line); }
      .x-btn--pink { background: var(--x-pink); color: #fff; }
      .x-icon { all: unset; cursor: pointer; width: 36px; height: 36px; display: grid; place-items: center; border-radius: 8px; color: var(--x-muted); border: 1px solid transparent; }
      .x-icon:hover { color: var(--x-text); border-color: var(--x-line); }
      .x-icon.x-del:hover { color: var(--x-pink); border-color: var(--x-pink); }
      .x-icon:focus-visible { outline: 2px solid var(--x-cyan); }
      .x-icon svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
      .x-alert { border: 1px solid var(--x-pink); background: rgba(255, 46, 136, 0.1); color: var(--x-text); border-radius: 10px; padding: 12px 14px; display: grid; gap: 10px; }
      .x-alert b { color: var(--x-pink); }
      .x-breakdown { background: #0f1424; border: 1px solid var(--x-line); border-radius: 12px; padding: 14px; display: grid; gap: 10px; }
      .x-taxes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
      .x-total { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding-top: 12px; border-top: 1px dashed var(--x-line); }
      .x-total b { font-size: 22px; color: var(--x-cyan); font-variant-numeric: tabular-nums; }
      .x-kv { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; }
      .x-kv b { font-variant-numeric: tabular-nums; }
      .x-search { max-width: 260px; min-height: 40px; }
      .x-rutok { font-size: 13px; font-weight: 600; min-height: 18px; }
      .x-note { font-size: 13px; color: var(--x-muted); }
      .x-f29total { background: linear-gradient(135deg, rgba(177, 75, 255, 0.18), rgba(0, 229, 255, 0.08)); border-color: rgba(177, 75, 255, 0.5); }
      .x-toast { position: fixed; right: 24px; bottom: 24px; background: #1d2540; border: 1px solid var(--x-green); color: var(--x-text); padding: 12px 16px; border-radius: 10px; font-size: 14px; z-index: 50; opacity: 0; transform: translateY(10px); transition: all 0.25s; pointer-events: none; }
      .x-toast.is-on { opacity: 1; transform: none; }

      @media (max-width: 1180px) {
        .x-grid4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
        .x-sema { grid-template-columns: auto minmax(0, 1fr); }
        .x-sema > .x-semaright { grid-column: 1 / -1; }
        .x-split, .x-formsplit { grid-template-columns: minmax(0, 1fr); }
      }
      @media (max-width: 860px) {
        .x-app { grid-template-columns: minmax(0, 1fr); }
        .x-side { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; z-index: 40; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--x-line); flex-direction: row; gap: 0; }
        .x-brand, .x-sidefoot { display: none; }
        .x-nav { flex-direction: row; overflow-x: auto; width: 100%; gap: 2px; scrollbar-width: none; }
        .x-nav button { flex-direction: column; justify-content: center; gap: 2px; min-width: 76px; min-height: 52px; padding: 4px 6px; font-size: 12px; }
        .x-month button { width: 44px; height: 44px; }
        .x-nav button[aria-current="page"] { box-shadow: inset 0 -2px 0 var(--x-violet); }
        .x-main { padding-bottom: 96px; }
        .x-mbrand { display: flex !important; }
        .x-grid3 { grid-template-columns: minmax(0, 1fr); }
        .x-toast { bottom: 84px; right: 16px; left: 16px; }
      }
      @media (max-width: 560px) {
        .x-grid4 { grid-template-columns: minmax(0, 1fr); }
        .x-sema { grid-template-columns: minmax(0, 1fr); padding: 20px; gap: 20px; }
        .x-lights { flex-direction: row; justify-self: start; }
        .x-semafig { grid-template-columns: minmax(0, 1fr); }
        .x-taxes, .x-row2 { grid-template-columns: minmax(0, 1fr); }
        .x-month span { min-width: 120px; }
        .x-top { flex-direction: column; align-items: stretch; }
        .x-month { justify-content: space-between; }
        .x-search { max-width: none; width: 100%; }
        .x-table thead { display: none; }
        .x-table tr { display: grid; grid-template-columns: 1fr auto; padding: 10px 0; border-bottom: 1px solid var(--x-line2); }
        .x-table td { border: 0; padding: 3px 4px !important; }
        .x-table td.x-num { text-align: right; }
      }
    
/* ---------- agregado: app real ---------- */
.x-sidefoot { display: grid; gap: 8px; }
.x-sidefoot .x-user { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.x-logout { all: unset; box-sizing: border-box; cursor: pointer; min-height: 40px; padding: 0 12px; border-radius: 10px; border: 1px solid var(--x-line); color: var(--x-text); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.x-logout:hover { border-color: var(--x-pink); color: var(--x-pink); }
.x-logout:focus-visible { outline: 2px solid var(--x-cyan); }
.x-mbrand { justify-content: space-between; }
.x-mbrand .x-logout { min-height: 36px; padding: 0 10px; }
.x-toast.is-err { border-color: var(--x-pink); }
.x-loading { position: fixed; top: 0; left: 0; right: 0; height: 3px; background: linear-gradient(90deg, var(--x-violet), var(--x-cyan)); z-index: 60; animation: xload 1s linear infinite; transform-origin: left; }
@keyframes xload { 0% { transform: scaleX(0.1); opacity: 1; } 100% { transform: scaleX(1); opacity: 0.2; } }
.x-pay { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.x-banner { border: 1px solid var(--x-yellow); background: rgba(245,255,59,0.07); border-radius: 10px; padding: 10px 14px; font-size: 13px; }

/* login */
.x-auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(circle at 20% 10%, rgba(177,75,255,0.18), transparent 45%), radial-gradient(circle at 85% 90%, rgba(0,229,255,0.10), transparent 40%), var(--x-bg); font-family: var(--x-font); color: var(--x-text); }
.x-auth * { font-family: var(--x-font); }
.x-authcard { width: 100%; max-width: 400px; display: grid; gap: 18px; padding: 28px 24px; }
.x-authcard .x-brand { padding: 0; }
.x-authcard h2 { font-size: 20px; }
.x-authlinks { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; font-size: 13px; }
.x-link { all: unset; cursor: pointer; color: var(--x-cyan); font-weight: 500; min-height: 32px; display: inline-flex; align-items: center; }
.x-link:hover { text-decoration: underline; }
.x-link:focus-visible { outline: 2px solid var(--x-cyan); border-radius: 4px; }
.x-ok { color: var(--x-green); font-size: 14px; }
.x-authmsg { font-size: 14px; min-height: 0; }
.x-authmsg:empty { display: none; }
.x-authmsg.is-err { color: var(--x-pink); }
.x-authmsg.is-ok { color: var(--x-green); border: 1px solid rgba(57,255,136,0.4); background: rgba(57,255,136,0.07); padding: 10px 12px; border-radius: 10px; }
.x-boot { min-height: 100vh; display: grid; place-items: center; color: var(--x-muted); font-family: var(--x-font); background: var(--x-bg); }

/* chips legibles en tablet (~768px) y móvil */
@media (max-width: 1180px) {
  .x-cat { font-size: 12.5px; padding: 4px 10px; }
}
@media (max-width: 560px) {
  .x-pay { grid-template-columns: 1fr 1fr; }
}
.x-mbrandin { display: flex; gap: 12px; align-items: center; }
