/* A Finance : UI basada en arc.pe (paleta y lenguaje visual reales del sitio) */
:root {
  --ink: #101425;
  --sec: #60677c;
  --line: #e8eaf3;
  --soft: #f8f9fc;
  --softer: #fafafc;
  --white: #fff;
  --electric: #675bff;
  --lilac: #d56cff;
  --royal: #347cf6;
  --cy: #20c6ee;
  --green: #0ca678;
  --red: #e5484d;
  --grad: linear-gradient(100deg, var(--lilac), var(--electric) 45%, var(--royal) 75%, var(--cy));
  --radius: 16px;
  --shadow: 0 18px 40px -24px rgba(16, 20, 37, .18);
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { color-scheme: light; }
body {
  background: var(--soft);
  color: var(--ink);
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  min-height: 100vh;
}
.hidden { display: none !important; }
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }

/* login */
.login { display: flex; align-items: center; justify-content: center; min-height: 100vh;
  background:
    radial-gradient(600px 300px at 20% 0%, rgba(213,108,255,.10), transparent 60%),
    radial-gradient(600px 300px at 80% 100%, rgba(32,198,238,.10), transparent 60%),
    var(--soft); }
.login-box { width: 330px; display: flex; flex-direction: column; gap: 14px; padding: 44px 34px;
  background: var(--white); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.login-box .brand { font-size: 27px; text-align: center; margin-bottom: 8px; }
.brand { font-weight: 700; letter-spacing: -0.03em; font-size: 19px; white-space: nowrap; }

input, select, textarea {
  background: var(--white); border: 1px solid var(--line); color: var(--ink);
  border-radius: 12px; padding: 10px 14px; font-size: 14px; font-family: inherit; outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--electric); box-shadow: 0 0 0 3px rgba(103,91,255,.12); }
input::placeholder { color: #a0a6b8; }
button { cursor: pointer; font-family: inherit; font-size: 14px; border: none; border-radius: 999px; }
.btn-primary { background: var(--grad); color: #fff; font-weight: 600; padding: 11px 22px;
  transition: transform .2s, box-shadow .2s; }
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 24px -12px rgba(103,91,255,.55); }
.btn-ghost { background: transparent; color: var(--sec); border: 1px solid var(--line); padding: 8px 16px; }
.btn-ghost:hover { color: var(--ink); border-color: var(--electric); }
.btn-mini { background: var(--white); color: var(--sec); border: 1px solid var(--line); padding: 5px 12px; font-size: 12px; }
.btn-mini:hover { color: var(--electric); border-color: var(--electric); }
.btn-danger { background: transparent; color: var(--red); border: 1px solid var(--line); padding: 5px 11px; font-size: 12px; }
.btn-danger:hover { border-color: var(--red); }
.msg { font-size: 13px; color: var(--red); text-align: center; min-height: 18px; }

/* nav */
nav { display: flex; align-items: center; gap: 24px; padding: 14px 28px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(248,249,252,.86); backdrop-filter: blur(12px); z-index: 10; }
nav::after { content: ""; position: absolute; inset-x: 0; bottom: -1px; height: 1px; background: var(--grad); opacity: .35; }
.nav-links { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.nav-links a { color: var(--sec); text-decoration: none; padding: 7px 13px; border-radius: 999px; font-size: 14px; white-space: nowrap; transition: color .15s; }
.nav-links a:hover { color: var(--ink); }
.nav-links a.active { color: var(--electric); background: rgba(103,91,255,.08); font-weight: 600; }

main { max-width: 1180px; margin: 0 auto; padding: 30px 24px 90px; }

/* layout */
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: 1fr 1fr; }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) { .g2, .g3, .g4 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 560px) { .g2, .g3, .g4 { grid-template-columns: 1fr; } nav { padding: 12px 14px; } main { padding: 18px 14px 60px; } }

.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px;
  transition: box-shadow .25s, transform .25s; }
.card:hover { box-shadow: var(--shadow); }
.card h3 { font-size: 11px; font-weight: 600; color: var(--sec); text-transform: uppercase; letter-spacing: .14em; margin-bottom: 12px; }
.stat { font-size: 27px; font-weight: 650; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; }
.stat small { font-size: 13px; color: var(--sec); font-weight: 500; }
.pos { color: var(--green); } .neg { color: var(--red); }
.sub { color: var(--sec); font-size: 13px; margin-top: 4px; }
.row { display: flex; align-items: center; gap: 10px; }
.spread { justify-content: space-between; }
.mt { margin-top: 16px; } .mb { margin-bottom: 16px; }

/* tablas */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; color: var(--sec); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 600; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--softer); }
.table-wrap { overflow-x: auto; }

/* formularios inline */
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.form-row input, .form-row select { width: auto; flex: 1; min-width: 110px; }

/* checks de cobro */
.check {
  width: 23px; height: 23px; border-radius: 8px; border: 1.5px solid var(--line);
  background: var(--white); cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px; color: transparent; flex-shrink: 0; transition: all .15s;
}
.check:hover { border-color: var(--electric); }
.check.on { background: var(--grad); border-color: transparent; color: #fff; font-weight: 700; }

/* barras de progreso */
.bar { height: 8px; background: var(--line); border-radius: 6px; overflow: hidden; }
.bar > div { height: 100%; background: var(--grad); border-radius: 6px; transition: width .4s; }

/* chat */
.chat-box { display: flex; flex-direction: column; height: calc(100vh - 230px); min-height: 400px; }
.chat-msgs { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; padding: 6px 2px 16px; }
.bubble { max-width: 78%; padding: 11px 16px; border-radius: 18px; font-size: 14px; line-height: 1.55; white-space: pre-wrap; }
.bubble.user { align-self: flex-end; background: var(--grad); color: #fff; }
.bubble.assistant { align-self: flex-start; background: var(--softer); border: 1px solid var(--line); }

/* toast */
#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--ink);
  color: #fff; padding: 11px 22px; border-radius: 999px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity .25s; z-index: 100; box-shadow: var(--shadow); }
#toast.show { opacity: 1; }

/* charts svg */
.chart-svg { width: 100%; height: auto; display: block; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12px; color: var(--sec); margin-top: 10px; }
.legend .dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; margin-right: 5px; }

.pill { font-size: 11px; padding: 3px 10px; border-radius: 999px; background: var(--softer); border: 1px solid var(--line); color: var(--sec); white-space: nowrap; }
.pill.ok { color: var(--green); border-color: rgba(12,166,120,.3); background: rgba(12,166,120,.06); }
.pill.warn { color: var(--red); border-color: rgba(229,72,77,.3); background: rgba(229,72,77,.06); }
.pill.due { color: var(--electric); border-color: rgba(103,91,255,.3); background: rgba(103,91,255,.06); }

.mono { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; }
code.keybox { display: block; background: var(--softer); border: 1px solid var(--electric); border-radius: 12px; padding: 12px; word-break: break-all; margin: 10px 0; font-size: 13px; font-family: ui-monospace, Consolas, monospace; }
h2.section { font-size: 23px; font-weight: 650; letter-spacing: -0.03em; margin-bottom: 18px; }
