/* iSanPro Contabilidad — tema oscuro de marca */
/* Paleta de marca: #FF2D2D · #FF8A00 · #FFC107 · #0F172A · #374151 · #D1D5DB — tipografía Inter */
:root {
  --bg: #0a0d14;
  --bg-2: #0f1420;
  --card: #121826;
  --card-2: #1a2131;
  --line: #232b3b;
  --text: #f3f4f6;
  --muted: #9aa3b2;
  --light: #D1D5DB;
  --slate: #374151;
  --navy: #0F172A;
  --red: #FF2D2D;
  --orange: #FF8A00;
  --yellow: #FFC107;
  --orange-2: #FFA51F;
  --grad: linear-gradient(135deg, #FFA51F 0%, #FF6A14 55%, #FF2D2D 100%);
  --grad-brand: linear-gradient(135deg, #FFC107 0%, #FF8A00 45%, #FF2D2D 100%);
  --green: #22c55e;
  --blue: #3b82f6;
  --purple: #8b5cf6;
  --empresa: #3b82f6;
  --casa: #22c55e;
  --pos: #34d672;
  --danger: #ff5a5a;
  --radius: 18px;
  --nav-h: 74px;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--text);
  background: radial-gradient(1100px 560px at 85% -12%, rgb(255 138 0 / .12), transparent 60%),
              radial-gradient(900px 500px at -10% 110%, rgb(255 45 45 / .07), transparent 60%), var(--bg);
  background-attachment: fixed;
  font: 400 15px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-feature-settings: "cv11", "ss01";
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.01em; }
h1 { font-size: 1.9rem; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 1.05rem; font-weight: 600; }
h3 { font-size: 1.15rem; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .8rem; }
.grow { flex: 1; min-width: 0; }
.error { color: var(--danger); min-height: 1.1em; margin: .6rem 0 0; font-size: .88rem; }
.neg { color: var(--red); }
.pos { color: var(--pos); }
.ico { width: 1.15em; height: 1.15em; flex: none; vertical-align: -.2em; }

input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  width: 100%; padding: .7rem .85rem; border-radius: 12px; outline: none;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text);
}
input:focus, select:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgb(255 138 0 / .2); }
input[type=color] { width: 2.6rem; height: 2.6rem; padding: 3px; flex: none; cursor: pointer; }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--orange); }
label { display: flex; flex-direction: column; gap: .35rem; font-size: .82rem; color: var(--muted); }
label > input, label > select, label > textarea { font-size: 1rem; }
.lbl { font-size: .82rem; color: var(--muted); margin-bottom: .45rem; }

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .65rem 1rem; border-radius: 12px; border: 1px solid var(--line);
  background: var(--card-2); cursor: pointer; text-decoration: none; white-space: nowrap; font-size: .92rem; font-weight: 550;
}
.btn:hover { background: #24242c; }
.btn.small { padding: .4rem .7rem; font-size: .82rem; }
.btn.primary { background: var(--grad); border: 0; color: #fff; box-shadow: 0 8px 24px rgb(255 60 20 / .3); }
.btn.primary:hover { filter: brightness(1.07); }
.btn.big { padding: .95rem 1.2rem; font-size: 1rem; border-radius: 14px; }
.btn.wide { width: 100%; }
.btn.danger { color: var(--danger); }
.btn.danger-fill { background: #e5383b; border-color: #e5383b; color: #fff; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { border: 0; background: none; cursor: pointer; padding: .4rem; border-radius: 10px; color: var(--muted); display: inline-flex; }
.icon-btn:hover { background: var(--card-2); color: var(--text); }
.round-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line); background: var(--card);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; position: relative; flex: none;
}
.round-btn:hover { background: var(--card-2); }
.round-btn.on { border-color: var(--orange); color: var(--orange); }
.dot-badge { position: absolute; top: 7px; right: 8px; width: 9px; height: 9px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 2px var(--card); }
.link { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: .85rem; display: inline-flex; align-items: center; gap: .2rem; padding: .2rem; }
.link.orange { color: var(--orange); font-weight: 600; }
.link.small { font-size: .78rem; }

/* Marca */
.brand { display: flex; align-items: center; gap: .55rem; }
.logo-sym { height: 44px; width: auto; flex: none; }
.logo-word { height: 34px; width: auto; flex: none; }
.ico.grad { stroke: url(#igrad); }
.gtile {
  width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; flex: none;
  background: linear-gradient(160deg, #1c2436, #111726); border: 1px solid #2a3346;
  box-shadow: inset 0 1px 0 rgb(255 255 255 / .04), 0 8px 18px rgb(0 0 0 / .35);
}
.gtile .ico { width: 24px; height: 24px; stroke-width: 2.2; }
.gtile.sm { width: 38px; height: 38px; border-radius: 11px; }
.gtile.sm .ico { width: 20px; height: 20px; }

.avatar {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid rgb(255 154 31 / .5); cursor: pointer;
  background: var(--grad-brand); color: #fff; font-weight: 700; font-size: 1.05rem; display: grid; place-items: center; flex: none;
}
.avatar.big { width: 64px; height: 64px; font-size: 1.5rem; cursor: default; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card {
  text-align: center;
  width: 100%; max-width: 360px; background: var(--card); padding: 2rem 1.5rem; border-radius: 24px;
  border: 1px solid var(--line); display: flex; flex-direction: column; gap: .9rem;
  box-shadow: 0 30px 80px rgb(0 0 0 / .5);
}
.login-logo { width: 150px; margin: 0 auto -.4rem; }
.login-word { width: 250px; max-width: 100%; margin: 0 auto .6rem; }

/* Estructura: barra inferior en el móvil, lateral en pantallas grandes */
.content { padding: 0 16px calc(var(--nav-h) + 28px + env(safe-area-inset-bottom)); max-width: 1120px; margin: 0 auto; }
.view { display: flex; flex-direction: column; gap: 1rem; padding-top: max(18px, env(safe-area-inset-top)); }
.nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: rgb(14 14 18 / .92); backdrop-filter: blur(16px); border-top: 1px solid var(--line);
}
.nav-brand { display: none; }
.nav button {
  flex: 1; border: 0; background: none; cursor: pointer; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .3rem; font-size: .72rem;
}
.nav button .ico { width: 24px; height: 24px; }
.nav button.on { color: var(--orange); font-weight: 600; }
.nav button.on .ico { stroke: url(#igrad); filter: drop-shadow(0 0 8px rgb(255 120 0 / .5)); }

@media (min-width: 900px) {
  .nav {
    top: 0; right: auto; width: 240px; height: auto; flex-direction: column; justify-content: flex-start; gap: .3rem;
    padding: 22px 14px; border-top: 0; border-right: 1px solid var(--line);
  }
  .nav-brand { display: block; padding: 0 .2rem 1.6rem; }
  .nav-brand .logo-sym { height: 38px; }
  .nav-brand .logo-word { height: 30px; }
  .nav button { flex: none; flex-direction: row; justify-content: flex-start; gap: .8rem; padding: .8rem 1rem; border-radius: 14px; font-size: .95rem; }
  .nav button.on { background: rgb(255 138 0 / .12); }
  .content { margin-left: 240px; padding: 8px 36px 48px; }
  .home-head .brand { visibility: hidden; }
}

/* Cabeceras */
.view-head { display: flex; align-items: center; gap: .7rem; justify-content: space-between; flex-wrap: wrap; }
.head-actions { display: flex; align-items: center; gap: .5rem; }
.home-head { display: flex; justify-content: space-between; align-items: center; }
.hello-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.hello { font-size: 2rem; margin-bottom: .25rem; }
.chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip {
  position: relative; flex-direction: row; align-items: center; gap: .4rem; color: var(--text);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 0 .6rem; height: 40px; font-size: .88rem;
}
.chip select { border: 0; background: none; padding: 0 1.2rem 0 0; appearance: none; -webkit-appearance: none; font-size: .88rem; cursor: pointer; box-shadow: none; }
.chip .chev { position: absolute; right: .55rem; pointer-events: none; color: var(--muted); }
.chip > .ico:first-child { color: var(--muted); }
.sec-title { font-size: 1.15rem; }
.sec-row { display: flex; justify-content: space-between; align-items: center; }

/* Tarjetas */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; min-width: 0; }
.card.flush { padding: 0; overflow: hidden; }
.card-title { display: flex; justify-content: space-between; align-items: center; gap: .6rem; margin-bottom: .9rem; flex-wrap: wrap; }
.card-title h2 { display: flex; align-items: center; gap: .4rem; }

/* KPI ingresos / gastos */
.kpi2 { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.kpi-card {
  position: relative; overflow: hidden; border-radius: var(--radius); padding: 1rem 1rem .9rem; border: 1px solid var(--line);
  display: flex; flex-direction: column; gap: .15rem; min-height: 132px;
}
.kpi-card.in { background: linear-gradient(160deg, rgb(34 197 94 / .16), rgb(34 197 94 / .03) 70%), var(--card); border-color: rgb(34 197 94 / .22); }
.kpi-card.out { background: linear-gradient(160deg, rgb(255 69 69 / .18), rgb(255 69 69 / .03) 70%), var(--card); border-color: rgb(255 69 69 / .24); }
.kpi-card .k-head { display: flex; align-items: center; gap: .45rem; font-size: .92rem; color: #e6e6ea; }
.k-badge { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.in .k-badge { background: var(--green); }
.out .k-badge { background: var(--red); }
.k-badge .ico { width: 14px; height: 14px; stroke-width: 3; }
.kpi-card .k-value { font-size: 1.85rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: .25rem; }
.in .k-value { color: #4ade80; }
.out .k-value { color: #ff6b6b; }
.kpi-card .k-delta { font-size: .8rem; color: var(--muted); display: flex; gap: .3rem; align-items: center; padding-right: 58px; }
.k-delta b { font-weight: 700; }
.k-delta .up, .k-delta .down { display: inline-flex; align-items: center; gap: .1rem; }
.kpi-card .spark { position: absolute; right: 12px; bottom: 12px; width: 58px; height: 40px; }
.kpi2.small .kpi-card { min-height: 108px; }
.kpi2.small .k-value { font-size: 1.5rem; }

/* Saldo actual */
.saldo-card {
  width: 100%; text-align: left; cursor: pointer; display: grid; grid-template-columns: auto 1fr auto; gap: .2rem .9rem; align-items: center;
  background: linear-gradient(160deg, rgb(255 154 31 / .10), transparent 60%), var(--card); color: var(--text);
}
.saldo-card .s-icon { width: 54px; height: 54px; border-radius: 15px; background: linear-gradient(135deg, #ffd34d, #ff9a1f); display: grid; place-items: center; color: #3a2400; grid-row: span 2; }
.saldo-card .s-icon .ico { width: 28px; height: 28px; }
.saldo-card .s-label { font-size: .9rem; color: #e6e6ea; }
.saldo-card .s-value { font-size: 1.9rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.saldo-card .s-delta { grid-row: span 2; align-self: center; }
.saldo-card .s-chart { grid-column: 1 / -1; margin-top: .6rem; height: 92px; }
.saldo-card .s-chart svg { width: 100%; height: 100%; display: block; }
.pct { font-size: .78rem; font-weight: 700; padding: .25rem .5rem; border-radius: 99px; display: inline-flex; align-items: center; gap: .15rem; white-space: nowrap; }
.pct.good { color: #4ade80; background: rgb(34 197 94 / .14); }
.pct.bad { color: #ff7a7a; background: rgb(255 69 69 / .14); }
.pct.flat { color: var(--muted); background: var(--card-2); }
.pct .ico { width: 12px; height: 12px; stroke-width: 3; }

/* Acciones rápidas */
.quick { display: grid; grid-template-columns: repeat(4, 1fr); gap: .6rem; }
.quick button {
  border: 1px solid var(--line); background: var(--card); border-radius: 16px; padding: .85rem .3rem .75rem; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: .5rem; font-size: .76rem; font-weight: 500; color: var(--light); text-align: center; line-height: 1.2;
}
.quick button:hover { background: var(--card-2); }
.qi { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; flex: none; }
.qi .ico { width: 21px; height: 21px; }

/* Beneficio neto, saldo y avisos */
.net-card { display: grid; grid-template-columns: 1fr auto; gap: .15rem .8rem; align-items: center;
  background: linear-gradient(160deg, rgb(255 138 0 / .12), transparent 60%), var(--card); }
.net-card .n-label { font-size: .92rem; color: var(--light); }
.net-card .n-value { font-size: 2rem; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.net-card .n-chart { grid-column: 1 / -1; height: 96px; margin-top: .5rem; }
.net-card .n-chart svg { width: 100%; height: 100%; display: block; }
.saldo-strip, .alert-strip { width: 100%; display: flex; align-items: center; gap: .8rem; padding: .8rem 1rem; text-align: left; cursor: pointer; color: var(--text); }
.saldo-strip:hover, .alert-strip:hover { background: var(--card-2); }
.saldo-strip b, .alert-strip b { font-variant-numeric: tabular-nums; }
.alert-strip { border-color: rgb(255 138 0 / .35); background: rgb(255 138 0 / .07); }

/* Inicio en dos columnas en pantallas grandes */
.home-grid { display: grid; gap: 1rem; }
.home-main, .home-side { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }
@media (min-width: 1100px) { .home-grid { grid-template-columns: 1.1fr 1fr; align-items: start; } }

/* Listas de movimientos */
.list { display: flex; flex-direction: column; }
.row {
  display: grid; grid-template-columns: auto 1fr auto; gap: .8rem; align-items: center;
  padding: .75rem 1rem; border-bottom: 1px solid var(--line); cursor: pointer; text-align: left; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%;
}
.row:last-child { border-bottom: 0; }
.row:hover { background: var(--card-2); }
.tile {
  width: 44px; height: 44px; border-radius: 13px; display: grid; place-items: center; color: #fff; flex: none;
  background: linear-gradient(135deg, color-mix(in srgb, var(--c) 92%, #fff 8%), color-mix(in srgb, var(--c) 70%, #000 30%));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--c) 30%, transparent);
}
.tile .ico { width: 22px; height: 22px; }
.tile.big { width: 56px; height: 56px; border-radius: 16px; }
.tile.big .ico { width: 28px; height: 28px; }
.row .r-main { min-width: 0; }
.row .r-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .r-sub { font-size: .8rem; color: var(--muted); display: flex; gap: .4rem; align-items: center; white-space: nowrap; overflow: hidden; }
.row .r-amt { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.row .r-amt small { display: block; font-weight: 400; font-size: .76rem; color: var(--muted); margin-top: .1rem; }
.month-head { font-weight: 650; font-size: 1.05rem; margin: .6rem .1rem .55rem; display: flex; justify-content: space-between; align-items: baseline; }
.month-head span { font-size: .8rem; color: var(--muted); font-weight: 500; }
#mov-list .list { margin-bottom: .6rem; }
.list-sum { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); padding: 0 .2rem; }
.empty { padding: 2rem 1rem; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: .8rem; }
.search { border-radius: 14px; padding: .8rem 1rem; }
.filters { display: flex; flex-wrap: wrap; gap: .7rem; align-items: flex-end; }
.filters label { flex: 1; min-width: 140px; }
.filter-actions { display: flex; gap: .4rem; flex-wrap: wrap; }

/* Segmentado */
.seg { display: inline-flex; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 4px; gap: 4px; }
.seg button { border: 0; background: none; padding: .55rem 1rem; border-radius: 10px; cursor: pointer; color: var(--muted); font-size: .92rem; font-weight: 550; }
.seg button.on { background: var(--grad); color: #fff; font-weight: 600; box-shadow: 0 6px 18px rgb(255 60 20 / .32); }
.seg.pill { display: flex; }
.seg.pill button { flex: 1; }
.seg.full { display: flex; margin-bottom: 1rem; }
.seg.full button { flex: 1; }

/* Facturas */
.inv-sum { display: flex; gap: .6rem; flex-wrap: wrap; }
.inv-sum .sum-chip { flex: 1; min-width: 140px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .7rem .9rem; }
.inv-sum .sum-chip span { display: block; font-size: .76rem; color: var(--muted); }
.inv-sum .sum-chip b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.st { font-size: .74rem; font-weight: 600; }
.st.pagada { color: #4ade80; }
.st.pendiente { color: var(--orange); }
.st.borrador { color: var(--muted); }
.st.vencida { color: var(--red); }
.sticky-cta { position: sticky; bottom: calc(var(--nav-h) + 14px + env(safe-area-inset-bottom)); z-index: 5; }
@media (min-width: 900px) { .sticky-cta { bottom: 20px; } }
.inv-total { background: var(--bg-2); border: 1px solid var(--line); border-radius: 12px; padding: .7rem .9rem; font-size: .88rem; color: var(--muted); display: grid; grid-template-columns: 1fr auto; gap: .2rem .8rem; font-variant-numeric: tabular-nums; }
.inv-total b { color: var(--text); text-align: right; }
.inv-total .tot { font-size: 1.05rem; color: var(--text); font-weight: 700; }
.repeat-box { display: flex; align-items: center; gap: .8rem; }
.repeat-box select { width: auto; flex: 1; }

/* Categorías */
.cat-grid { display: grid; gap: .7rem; }
@media (min-width: 700px) { .cat-grid { grid-template-columns: 1fr 1fr; } }
.cat-card {
  display: grid; grid-template-columns: auto 1fr auto; gap: .25rem .9rem; align-items: center; text-align: left; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: .95rem 1rem; color: var(--text); width: 100%;
}
.cat-card:hover { background: var(--card-2); }
.cat-card .tile { grid-row: span 2; }
.cat-card .c-name { font-weight: 600; display: flex; gap: .4rem; align-items: center; min-width: 0; }
.cat-card .c-name span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-card .c-amt { font-size: .95rem; font-variant-numeric: tabular-nums; color: #e6e6ea; }
.cat-card .c-pct { grid-row: span 2; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.cat-card .c-bar { grid-column: 2 / -1; height: 7px; background: var(--card-2); border-radius: 99px; overflow: hidden; margin-top: .3rem; }
.cat-card .c-bar i { display: block; height: 100%; border-radius: 99px; background: var(--c); }
.cat-card.zero { opacity: .55; }
.cat-sep { font-size: .82rem; color: var(--muted); margin: .4rem .2rem 0; }
.amb-tag { font-size: .66rem; padding: .08rem .4rem; border-radius: 99px; background: var(--card-2); color: var(--muted); font-weight: 600; flex: none; }
.period-nav { display: flex; align-items: center; justify-content: space-between; gap: .5rem; padding: .35rem; }
.period-nav span { font-weight: 650; }
.period-nav button { border: 0; background: none; cursor: pointer; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--text); }
.period-nav button:hover { background: var(--card-2); }

.cat-preview { display: flex; align-items: center; gap: .9rem; margin-bottom: 1rem; }
.swatches { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.swatches button { width: 32px; height: 32px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; background: var(--c); }
.swatches button.on { border-color: #fff; box-shadow: 0 0 0 2px var(--c); }
.icon-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(42px, 1fr)); gap: .4rem; }
.icon-pick button { height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; display: grid; place-items: center; color: var(--muted); }
.icon-pick button.on { border-color: var(--orange); color: var(--orange); background: rgb(255 106 16 / .1); }

/* Gráficos */
.chart svg { width: 100%; height: auto; display: block; }
.chart text, .donut-wrap text { fill: var(--muted); font-size: 11px; }
.chart .grid { stroke: #24242b; }
.legend { display: flex; gap: 1.1rem; font-size: .82rem; color: var(--muted); margin-bottom: .6rem; justify-content: center; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .35rem; vertical-align: -1px; }
.donut-wrap { display: grid; grid-template-columns: 168px 1fr; gap: 1rem; align-items: center; }
.donut-wrap svg { width: 168px; height: 168px; }
.donut-wrap text.d-total { font-size: 21px; font-weight: 750; fill: var(--text); }
.d-legend { display: flex; flex-direction: column; gap: .5rem; font-size: .86rem; min-width: 0; }
.d-legend div { display: grid; grid-template-columns: 10px 1fr auto auto; gap: .55rem; align-items: center; }
.d-legend i { width: 10px; height: 10px; border-radius: 50%; }
.d-legend span:nth-child(2) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.d-legend .pc { color: var(--muted); font-variant-numeric: tabular-nums; }
.d-legend .am { font-variant-numeric: tabular-nums; text-align: right; min-width: 4.5rem; }
@media (max-width: 420px) {
  .donut-wrap { grid-template-columns: 1fr; justify-items: center; }
  .d-legend { width: 100%; }
}

/* Informes */
.inf-grid { display: grid; gap: 1rem; }
@media (min-width: 1000px) { .inf-grid { grid-template-columns: 1fr 1fr; } }
.compare { display: flex; flex-direction: column; }
.compare .cmp { display: grid; grid-template-columns: 1fr auto auto; gap: .8rem; align-items: center; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.compare .cmp:last-child { border-bottom: 0; }
.compare .cmp b { font-variant-numeric: tabular-nums; }
.compare .cmp small { display: block; color: var(--muted); font-size: .76rem; }
.tbl { width: 100%; border-collapse: collapse; font-size: .9rem; font-variant-numeric: tabular-nums; }
.tbl th, .tbl td { padding: .5rem .3rem; text-align: right; border-bottom: 1px solid var(--line); }
.tbl th:first-child, .tbl td:first-child { text-align: left; }
.tbl th { color: var(--muted); font-weight: 500; font-size: .8rem; }
.tbl tr:last-child td { border-bottom: 0; font-weight: 700; }

/* Más */
.profile { display: flex; gap: 1rem; align-items: center; }
.menu { display: flex; flex-direction: column; }
.menu > * {
  display: flex; align-items: center; gap: .9rem; padding: .85rem 1rem; border: 0; border-bottom: 1px solid var(--line);
  background: none; cursor: pointer; text-align: left; text-decoration: none; color: var(--text); font-size: .98rem; width: 100%;
}
.menu > *:last-child { border-bottom: 0; }
.menu > *:hover { background: var(--card-2); }
.menu small { display: block; font-size: .78rem; color: var(--muted); margin-top: .1rem; }
.menu > * > .ico { color: var(--muted); }

/* Cuentas */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .8rem; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; }
.kpi .label { color: var(--muted); font-size: .8rem; }
.kpi .value { font-size: 1.4rem; font-weight: 750; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.kpi .value.neg { color: var(--red); }
.kpi .sub { color: var(--muted); font-size: .76rem; margin-top: .1rem; }
.acc-list { display: flex; flex-direction: column; }
.acc { display: grid; grid-template-columns: auto 1fr auto; gap: .9rem; align-items: center; padding: .75rem .2rem; border-top: 1px solid var(--line); cursor: pointer; border-radius: 10px; }
.acc:first-child { border-top: 0; }
.acc:hover { background: var(--card-2); }
.acc .acc-color { width: 6px; height: 2.4rem; border-radius: 3px; }
.acc .concept, .led .concept { font-weight: 600; }
.acc .meta, .led .meta { font-size: .8rem; color: var(--muted); }
.acc .amount, .led .amount { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.acc .amount { font-size: 1.1rem; }
.acc-color { display: inline-block; width: 6px; height: 1.1rem; border-radius: 3px; margin-right: .5rem; vertical-align: -2px; }
.pill { font-size: .68rem; padding: .12rem .5rem; border-radius: 99px; font-weight: 700; }
.pill.empresa { background: rgb(59 130 246 / .16); color: #60a5fa; }
.pill.casa { background: rgb(34 197 94 / .16); color: #4ade80; }
.pill.ahorro { background: rgb(255 194 26 / .16); color: var(--yellow); }

/* Extracto de cuenta */
.ledger-saldo { font-size: 1.7rem; font-weight: 750; margin-top: .2rem; font-variant-numeric: tabular-nums; }
.ledger-actions { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: 1rem; }
.ledger { max-height: 55vh; overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
.led { display: grid; grid-template-columns: 5.6rem 1fr auto 2rem; gap: .7rem; align-items: center; padding: .6rem .8rem; border-bottom: 1px solid var(--line); }
.led:last-child { border-bottom: 0; }
.led[data-kind=expense] { cursor: pointer; }
.led[data-kind=expense]:hover { background: var(--card-2); }
.led.start { background: var(--card-2); }
.led .date { font-size: .8rem; color: var(--muted); }
.led .amount small { display: block; font-weight: 400; font-size: .75rem; color: var(--muted); }

/* Diálogos: hoja inferior en el móvil, ventana centrada en escritorio */
dialog {
  border: 1px solid var(--line); border-radius: 22px; padding: 0; width: min(560px, calc(100vw - 24px));
  max-height: calc(100vh - 24px); background: var(--card); color: var(--text); box-shadow: 0 30px 80px rgb(0 0 0 / .6);
}
dialog::backdrop { background: rgb(0 0 0 / .7); backdrop-filter: blur(3px); }
dialog.wide { width: min(760px, calc(100vw - 24px)); }
dialog.xl { width: min(1000px, calc(100vw - 24px)); }
dialog.confirm { width: min(420px, calc(100vw - 24px)); }
dialog.confirm p { line-height: 1.5; }
@media (max-width: 640px) {
  dialog:not(.confirm) {
    width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 24px 24px 0 0; border-bottom: 0;
    max-height: 92vh; max-height: 92dvh; padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  }
}
#exp-form, .dlg-body { padding: 1.2rem; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; gap: .5rem; }
.dlg-head h3 { margin: 0; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.span2 { grid-column: span 2; }
label.check { flex-direction: row; align-items: center; gap: .55rem; color: var(--text); font-size: .9rem; }
.ticket-box { display: flex; flex-direction: column; gap: .4rem; font-size: .85rem; color: var(--muted); }
.ticket-box a { color: var(--orange); }
#iva-preview { margin: -.3rem 0 0; }
.dlg-foot { display: flex; gap: .5rem; margin-top: 1rem; align-items: center; flex-wrap: wrap; }
#form-ambito button.on[data-ambito=empresa], #form-ambito button.on[data-ambito=casa] { color: #fff; }

/* Importar extracto */
.dropzone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .4rem; text-align: center;
  padding: 2.5rem 1rem; border: 2px dashed var(--line); border-radius: 16px; cursor: pointer; color: var(--text); }
.dropzone:hover, .dropzone.over { border-color: var(--orange); background: rgb(255 106 16 / .07); }
.dropzone input { display: none; }
.imp-mapping { border: 1px solid var(--line); border-radius: 14px; padding: .6rem .9rem; margin-bottom: .8rem; }
.imp-mapping summary { cursor: pointer; font-weight: 600; font-size: .9rem; }
.map-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; margin-top: .8rem; }
.imp-sample { margin-top: .7rem; font-size: .75rem; color: var(--muted); overflow-x: auto; white-space: nowrap; }
.imp-bar { display: flex; justify-content: space-between; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .6rem; }
.imp-filter button { padding: .4rem .7rem; font-size: .82rem; }
.imp-list { max-height: 48vh; overflow: auto; border: 1px solid var(--line); border-radius: 14px; }
.imp-row { display: grid; grid-template-columns: 5.4rem minmax(0, 1fr) 6.5rem 8.5rem minmax(0, 11rem); gap: .6rem; align-items: center;
  padding: .5rem .7rem; border-bottom: 1px solid var(--line); font-size: .88rem; }
.imp-row:last-child { border-bottom: 0; }
.imp-row.off { opacity: .45; }
.imp-row .date { color: var(--muted); font-size: .8rem; }
.imp-row .conc { min-width: 0; }
.imp-row .conc input, .imp-row select { padding: .35rem .5rem; font-size: .85rem; border-radius: 9px; }
.imp-row .flags { display: flex; gap: .3rem; margin-top: .2rem; flex-wrap: wrap; }
.imp-row .amt { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.flag { font-size: .68rem; padding: .05rem .4rem; border-radius: 99px; background: var(--card-2); color: var(--muted); }
.flag.dup { background: rgb(255 194 26 / .16); color: var(--yellow); }
.imp-saldo { margin-top: .8rem; display: flex; flex-direction: column; gap: .35rem; font-size: .88rem; }
.imp-saldo label { flex-direction: row; align-items: center; gap: .5rem; color: var(--text); font-size: .88rem; }
.imp-totals { margin-top: .6rem; display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: .88rem; color: var(--muted); }
.imp-totals b { color: var(--text); }

/* Botón flotante y aviso */
.fab {
  position: fixed; right: max(18px, env(safe-area-inset-right)); bottom: calc(var(--nav-h) + 18px + env(safe-area-inset-bottom));
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer; z-index: 15;
  background: var(--grad); color: #fff; display: grid; place-items: center; box-shadow: 0 10px 28px rgb(255 60 20 / .45);
}
.fab .ico { width: 26px; height: 26px; stroke-width: 2.6; }
@media (min-width: 900px) { .fab { bottom: 28px; right: 32px; } }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px); transform: translateX(-50%) translateY(20px);
  background: #fff; color: #111; padding: .65rem 1rem; border-radius: 12px; font-weight: 550;
  opacity: 0; pointer-events: none; transition: .2s; font-size: .9rem; z-index: 50; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast[popover] { inset: auto; margin: 0; border: 0; overflow: visible; left: 50%; bottom: calc(var(--nav-h) + 24px); }
/* Con una ventana abierta (que en el móvil sale desde abajo), el aviso va arriba para que se vea */
.toast.sobre-dlg { top: calc(env(safe-area-inset-top, 0px) + 16px); bottom: auto; }

@media (max-width: 560px) {
  h1 { font-size: 1.75rem; }
  .hello { font-size: 1.75rem; }
  .kpi-card .k-value { font-size: 1.5rem; }
  .kpi-card .spark { width: 40px; height: 28px; right: 10px; bottom: 10px; }
  .kpi-card .k-delta { padding-right: 42px; }
  .saldo-card .s-value { font-size: 1.6rem; }
  .form-grid { grid-template-columns: 1fr; }
  .span2 { grid-column: span 1; }
  .quick { gap: .45rem; }
  .quick button { font-size: .72rem; padding: .75rem .2rem .65rem; }
  .led { grid-template-columns: 4.6rem 1fr auto 1.6rem; gap: .5rem; padding: .55rem .6rem; }
  .imp-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .imp-row .date { grid-column: 1 / -1; margin-bottom: -.4rem; }
  .imp-filter { max-width: 100%; overflow-x: auto; }
  .view-head .chip.scope { order: 5; }
}

.row.static { cursor: default; }
.row.static:hover { background: none; }
.row.off { opacity: .5; }
.r-main .c-bar { height: 6px; background: var(--card-2); border-radius: 99px; overflow: hidden; margin-top: .4rem; }
.r-main .c-bar i { display: block; height: 100%; border-radius: 99px; background: var(--c); }
.home-head .brand .logo-word { height: 32px; }
@media (max-width: 560px) {
  .logo-sym { height: 38px; }
  .home-head .brand .logo-word { height: 28px; }
  .net-card .n-value { font-size: 1.7rem; }
}

/* Usuarios */
.readonly [data-w] { display: none !important; }
body:not(.is-admin) .admin-only { display: none !important; }
.p-name { font-weight: 700; font-size: 1.1rem; }
.p-tags { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .35rem; }
.chk-row { display: flex; gap: 1.2rem; flex-wrap: wrap; }
.mini-av { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; font-size: .62rem; font-weight: 700; color: #fff; background: var(--slate); flex: none; }
#setup-form h2 { font-size: 1.2rem; }
#setup-form input, #login-form input { text-align: left; }

/* Asistente de IA */
.ia-banner { background: rgb(255 138 0 / .1); border: 1px solid rgb(255 138 0 / .35); border-radius: 12px; padding: .65rem .8rem; margin-bottom: .9rem; font-size: .86rem; color: var(--light); }
.ia-banner b { color: var(--orange); }
.ia-photo { position: relative; margin: .9rem 0 .6rem; }
.ia-shot { flex-direction: row; align-items: center; gap: .8rem; padding: .8rem; border: 2px dashed var(--line); border-radius: 14px; cursor: pointer; color: var(--text); font-size: .95rem; }
.ia-shot:hover { border-color: var(--orange); }
.ia-shot input { display: none; }
#ia-preview { display: block; width: 100%; max-height: 260px; object-fit: contain; border-radius: 14px; background: var(--bg-2); border: 1px solid var(--line); }
#ia-photo-x { position: absolute; top: 6px; right: 6px; background: rgb(0 0 0 / .6); color: #fff; }
.ia-text { display: flex; gap: .5rem; align-items: flex-start; }
.ia-text textarea { flex: 1; }
#ia-mic.rec { border-color: var(--red); color: var(--red); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgb(255 45 45 / .25); } }
.dlg-head h3 { display: flex; align-items: center; gap: .4rem; }
.spin { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--orange); border-radius: 50%; animation: sp .8s linear infinite; vertical-align: -2px; margin-right: .35rem; }
@keyframes sp { to { transform: rotate(360deg); } }

/* Inicio: elegir Casa, Empresa o Todo con botones grandes */
.scope-big { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .6rem; }
.scope-big button {
  display: flex; align-items: center; justify-content: center; gap: .6rem; min-height: 64px; padding: .7rem .6rem;
  border-radius: 18px; border: 1px solid var(--line); background: var(--card); color: var(--light);
  font-size: 1.02rem; font-weight: 600; cursor: pointer; transition: background .15s, transform .1s;
}
.scope-big button:active { transform: scale(.98); }
.scope-big button:hover { background: var(--card-2); }
.scope-big .sb-ico { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; background: var(--bg-2); border: 1px solid var(--line); flex: none; }
.scope-big .sb-ico .ico { width: 19px; height: 19px; stroke: url(#igrad); }
.scope-big button.on { background: var(--grad); border-color: transparent; color: #fff; box-shadow: 0 10px 26px rgb(255 60 20 / .35); }
.scope-big button.on .sb-ico { background: rgb(255 255 255 / .18); border-color: rgb(255 255 255 / .25); }
.scope-big button.on .sb-ico .ico { stroke: #fff; }
@media (max-width: 420px) {
  .scope-big button { flex-direction: column; gap: .35rem; min-height: 78px; font-size: .92rem; }
}

/* Movimientos del banco por foto (IA) */
.imp-acc { margin-bottom: .9rem; }
.imp-ia { border: 1px solid var(--line); border-radius: 16px; padding: .9rem; display: flex; flex-direction: column; gap: .7rem;
  background: linear-gradient(160deg, rgb(255 106 16 / .08), transparent 60%); }
.imp-ia-head { display: flex; gap: .7rem; align-items: center; }
.imp-ia-head > div { display: flex; flex-direction: column; gap: .15rem; }
.imp-ia-btns { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.imp-ia-btns .btn { justify-content: center; cursor: pointer; }
.imp-thumbs { display: flex; gap: .5rem; overflow-x: auto; }
.imp-thumbs:empty { display: none; }
.imp-thumbs .thumb { position: relative; flex: 0 0 auto; }
.imp-thumbs img { height: 92px; width: auto; max-width: 140px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); display: block; }
.imp-thumbs button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; display: grid; place-items: center;
  background: rgb(0 0 0 / .7); color: #fff; cursor: pointer; padding: 0; }
.imp-thumbs button svg { width: 14px; height: 14px; }
.imp-ia-status:empty, #imp-ia-status:empty { display: none; }
.imp-or { display: flex; align-items: center; gap: .6rem; color: var(--muted); font-size: .8rem; margin: .9rem 0 .6rem; }
.imp-or::before, .imp-or::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.imp-saldo .saldo-edit { flex-wrap: wrap; }
.imp-saldo .saldo-edit #imp-saldo-val { width: 8.5rem; padding: .35rem .5rem; font-size: .9rem; text-align: right; }
.ia-dudas { margin: 0 0 .7rem; padding: .6rem .8rem; border-radius: 12px; font-size: .85rem; line-height: 1.45;
  background: rgb(255 193 7 / .1); border: 1px solid rgb(255 193 7 / .35); color: var(--text); }

/* Móvil: el iPhone amplía la página al tocar un campo con letra de menos de 16 px y ya no cabe en la pantalla */
@media (pointer: coarse), (max-width: 640px) {
  input:not([type=radio]):not([type=checkbox]):not([type=color]), select, textarea { font-size: 16px !important; }
}
html, body { overflow-x: hidden; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
.quick button.q-wide { grid-column: 1 / -1; flex-direction: row; justify-content: flex-start; gap: .8rem; padding: .7rem .9rem; text-align: left; font-size: .9rem; font-weight: 600; }
.quick button.q-wide small { display: block; font-weight: 400; font-size: .76rem; color: var(--muted); margin-top: .15rem; }
.imp-saldo label { align-items: flex-start; line-height: 1.4; }
.imp-saldo label input[type=radio] { margin-top: .25rem; }
.imp-saldo .saldo-edit { align-items: center; }
@media (max-width: 640px) {
  /* Fila del extracto en el móvil: fecha e importe arriba, concepto entero y debajo qué es */
  .imp-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "date amt" "conc conc" "tipo extra"; gap: .45rem .5rem; padding: .7rem .75rem; }
  .imp-row .date { grid-area: date; margin: 0; }
  .imp-row .amt { grid-area: amt; }
  .imp-row .conc { grid-area: conc; }
  .imp-row > select[data-k=tipo] { grid-area: tipo; }
  .imp-row > :last-child { grid-area: extra; }
  .imp-list { max-height: none; }
  .imp-filter button { padding: .4rem .55rem; font-size: .78rem; }
  /* Los botones de guardar siempre a mano, aunque el formulario sea largo */
  dialog .dlg-foot { position: sticky; bottom: calc(-1 * env(safe-area-inset-bottom)); background: var(--card); margin: 1rem -1.2rem -1.2rem; padding: .8rem 1.2rem calc(.8rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); z-index: 2; }
}
@media (max-width: 640px) {
  dialog .dlg-foot .grow { display: none; }
  dialog .dlg-foot .btn { flex: 1 1 0; justify-content: center; }
  dialog .dlg-foot .btn.primary { flex: 1 1 100%; order: -1; }
}

/* Dictado: barra de grabación con contador y botón Parar */
.ia-rec { display: flex; align-items: center; gap: .6rem; margin-top: .6rem; padding: .55rem .6rem .55rem .9rem; border-radius: 14px;
  background: rgb(255 45 45 / .1); border: 1px solid rgb(255 45 45 / .4); font-size: .95rem; }
.ia-rec[hidden] { display: none; }
.ia-rec b { font-variant-numeric: tabular-nums; }
.ia-rec .btn { margin-left: auto; border-color: var(--red); color: var(--red); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); animation: blink 1s infinite; flex: none; }
@keyframes blink { 50% { opacity: .25; } }
#ia-mic.rec { background: var(--red); color: #fff; border-color: var(--red); }
/* Espera de la IA con los segundos */
.ia-wait { margin: .6rem 0 0; font-size: .92rem; display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .35rem; }
.ia-wait:empty { display: none; }
.ia-wait b { font-variant-numeric: tabular-nums; color: var(--orange); }
.ia-wait .muted { flex-basis: 100%; }
#ia-mic.rec .ico { width: 22px; height: 22px; fill: currentColor; }

/* Botón «Asistente IA» junto al perfil */
.head-actions { display: flex; align-items: center; gap: .6rem; }
.ia-pill { display: inline-flex; align-items: center; gap: .45rem; height: 42px; padding: 0 1rem 0 .8rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); font-weight: 700; font-size: .95rem; cursor: pointer; white-space: nowrap; }
.ia-pill:hover { background: var(--card-2); border-color: rgb(255 138 0 / .5); }
.ia-pill .ico { width: 20px; height: 20px; }
@media (max-width: 380px) { .ia-pill { padding: 0 .75rem 0 .6rem; font-size: .88rem; } }
.ia-menu { display: flex; flex-direction: column; gap: .6rem; }
.ia-menu button { display: flex; align-items: center; gap: .8rem; padding: .8rem; border-radius: 16px; border: 1px solid var(--line);
  background: var(--card-2); color: var(--text); text-align: left; cursor: pointer; }
.ia-menu button:hover { border-color: var(--orange); }
.ia-menu button > span:nth-child(2) { flex: 1; display: flex; flex-direction: column; gap: .15rem; }
.ia-menu small { color: var(--muted); font-size: .8rem; }
.ia-menu button > .ico { color: var(--muted); width: 18px; height: 18px; }
.home-head { gap: .5rem; }
.home-head .brand { min-width: 0; flex: 0 1 auto; }
@media (max-width: 400px) {
  .home-head .logo-sym { height: 32px; }
  .home-head .brand .logo-word { height: 22px; }
  .head-actions { gap: .45rem; }
}

/* Deslizar hacia abajo para recargar */
html, body { overscroll-behavior-y: contain; }  /* sin el gesto propio del navegador: así funciona igual en todos */
.ptr { position: fixed; left: 50%; top: calc(env(safe-area-inset-top) + 8px); z-index: 60; transform: translate(-50%, -56px); opacity: 0;
  display: flex; align-items: center; gap: .5rem; padding: .45rem .9rem .45rem .5rem; border-radius: 999px; pointer-events: none;
  background: var(--card); border: 1px solid var(--line); box-shadow: 0 10px 30px rgb(0 0 0 / .5); font-size: .85rem; color: var(--light); }
.ptr.vuelve { transition: transform .25s, opacity .25s; }
.ptr-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--card-2); color: var(--orange); }
.ptr-ico .ico { width: 18px; height: 18px; }
.ptr.listo .ptr-ico { background: var(--grad); color: #fff; }
.ptr.girando .ptr-ico { animation: sp .7s linear infinite; }
.ptr-txt { white-space: nowrap; }

/* iPhone: nada debajo del reloj, la batería ni la isla. Una franja opaca tapa esa zona al desplazar
   y el contenido empieza siempre por debajo, con aire para pulsar cómodo los botones de arriba. */
:root { --sat: env(safe-area-inset-top, 0px); }
.view { padding-top: calc(var(--sat) + 18px); }
body::before { content: ""; position: fixed; top: 0; left: 0; right: 0; height: var(--sat); background: var(--bg); z-index: 40; pointer-events: none; }
.ptr { top: calc(var(--sat) + 8px); }
@media (max-width: 640px) {
  dialog:not(.confirm) { max-height: calc(100dvh - var(--sat) - 12px); }
}

/* Portada: dos aplicaciones en una */
.en-portada .nav { display: none; }
.en-portada .content { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
@media (min-width: 900px) { .en-portada .content { margin-left: auto; } }
.portada-head { display: flex; justify-content: space-between; align-items: center; }
.portada-sub { margin: -.6rem 0 .2rem; }
.portada-apps { display: grid; gap: .9rem; }
@media (min-width: 700px) { .portada-apps { grid-template-columns: 1fr 1fr; } }
.app-card { position: relative; overflow: hidden; display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; text-align: left;
  padding: 1.3rem 1.2rem 1.1rem; border-radius: 24px; border: 1px solid var(--line); color: var(--text); cursor: pointer; min-height: 190px;
  background: var(--card); transition: transform .1s, border-color .15s; }
.app-card:active { transform: scale(.985); }
.app-card:hover { border-color: rgb(255 138 0 / .5); }
.app-card.casa { background: radial-gradient(420px 220px at 100% 0%, rgb(255 193 7 / .16), transparent 70%), var(--card); }
.app-card.empresa { background: radial-gradient(420px 220px at 100% 0%, rgb(255 45 45 / .2), transparent 70%), var(--card); }
.app-ico { width: 52px; height: 52px; border-radius: 16px; display: grid; place-items: center; background: var(--grad); color: #fff; margin-bottom: .3rem;
  box-shadow: 0 10px 26px rgb(255 60 20 / .35); }
.app-ico .ico { width: 26px; height: 26px; }
.app-name { font-size: 1.5rem; font-weight: 800; letter-spacing: -.01em; }
.app-desc { color: var(--muted); font-size: .88rem; line-height: 1.35; }
.app-stats { display: flex; flex-direction: column; gap: .15rem; margin-top: .5rem; font-size: .88rem; color: var(--light); }
.app-stats .ps b { font-variant-numeric: tabular-nums; }
.app-stats .ps.warn b { color: var(--orange); }
.app-stats b.pos { color: #4ade80; } .app-stats b.neg { color: #f87171; }
.portada-todo { margin-top: .2rem; }
.app-switch { display: inline-flex; align-items: center; gap: .4rem; margin-top: .25rem; padding: .3rem .7rem .3rem .45rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--light); font-weight: 600; font-size: .88rem; cursor: pointer; }
.app-switch[hidden] { display: none; }
.app-switch .sw-ico { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--grad); color: #fff; }
.app-switch .sw-ico .ico { width: 15px; height: 15px; }
.app-switch .sw-cambiar { display: inline-flex; align-items: center; gap: .2rem; color: var(--orange); font-size: .8rem; margin-left: .2rem; }
.app-switch .sw-cambiar .ico { width: 14px; height: 14px; }

/* Colaboraciones */
.col-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.col-kpis .sum-chip { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: .75rem .9rem; min-width: 0; }
.col-kpis .sum-chip span { display: block; font-size: .76rem; color: var(--muted); }
.col-kpis .sum-chip b { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.col-kpis .sum-chip b.pos { color: #4ade80; }
.col-kpis .sum-chip.big { grid-column: 1 / -1; }
.col-kpis .sum-chip.big b { font-size: 1.7rem; }
.col-kpis .sum-chip.warn { border-color: rgb(255 138 0 / .45); background: linear-gradient(160deg, rgb(255 138 0 / .12), transparent 70%), var(--card); }
.col-kpis .sum-chip.warn b { color: var(--orange); }
#col-seg button { white-space: nowrap; padding: .55rem .3rem; font-size: .86rem; }
.tile.prod { object-fit: cover; padding: 0; background: var(--card-2); }
.col-steps { display: grid; grid-template-columns: repeat(4, 1fr); gap: .3rem; margin-bottom: 1rem; }
.col-steps button { position: relative; padding: .55rem .2rem; border-radius: 12px; border: 1px solid var(--line); background: var(--card-2); color: var(--muted);
  font-weight: 600; font-size: .8rem; cursor: pointer; }
.col-steps button.done { color: var(--light); border-color: rgb(255 138 0 / .35); }
.col-steps button.on { background: var(--grad); color: #fff; border-color: transparent; }
.col-sec { font-weight: 700; font-size: .95rem; margin-top: .4rem; padding-top: .7rem; border-top: 1px solid var(--line); }
.col-ent { display: flex; flex-direction: column; gap: .45rem; }
.ent-row { display: grid; grid-template-columns: auto 1fr 9.5rem auto; gap: .4rem; align-items: center; }
.ent-row [data-k=enlace] { grid-column: 2 / 4; }
.ent-row input[type=checkbox] { width: 20px; height: 20px; }
.chip-btn { padding: .4rem .7rem; border-radius: 999px; border: 1px dashed var(--line); background: none; color: var(--light); font-size: .82rem; cursor: pointer; }
.chip-btn:hover { border-color: var(--orange); color: var(--orange); }
.col-ent-add { display: flex; flex-wrap: wrap; gap: .4rem; }
.col-ia { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.col-ia[hidden] { display: none; }
.col-ia .btn { justify-content: center; cursor: pointer; font-size: .88rem; }
.col-foto:empty { display: none; }
.col-foto { display: flex; align-items: center; gap: .8rem; }
.col-foto img { width: 96px; height: 96px; object-fit: cover; border-radius: 14px; border: 1px solid var(--line); }
@media (max-width: 640px) {
  .ent-row { grid-template-columns: auto 9.4rem minmax(0, 1fr) auto; padding-bottom: .45rem; border-bottom: 1px solid var(--line); }
  .ent-row [data-k=nombre] { grid-column: 2 / 4; grid-row: 1; }
  .ent-row [data-x] { grid-column: 4; grid-row: 1; }
  .ent-row [data-k=fecha] { grid-column: 2; grid-row: 2; }
  .ent-row [data-k=enlace] { grid-column: 3 / 5; grid-row: 2; }
  .col-steps button { font-size: .74rem; }
}
@media (max-width: 640px) {
  .col-kpis .sum-chip { padding: .6rem .65rem; }
  .col-kpis .sum-chip:not(.big) b { font-size: 1rem; white-space: nowrap; }
  .col-kpis .sum-chip span { font-size: .7rem; }
}

/* Previsión del mes */
.prev-card { display: flex; flex-direction: column; gap: .7rem; text-align: left; cursor: pointer; color: var(--text); width: 100%; }
.prev-card[hidden] { display: none; }
.prev-top { display: flex; align-items: center; gap: .7rem; }
.prev-top .grow b { display: block; font-size: .98rem; }
.prev-top .grow small { display: block; color: var(--muted); font-size: .78rem; margin-top: .1rem; }
.prev-top > .ico { color: var(--muted); width: 18px; height: 18px; }
.prev-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .5rem; }
.prev-nums span { background: var(--card-2); border-radius: 12px; padding: .5rem .6rem; min-width: 0; }
.prev-nums small { display: block; color: var(--muted); font-size: .7rem; }
.prev-nums b { font-size: .98rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prev-nums.big { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: .4rem; }
.prev-nums.big b { font-size: 1.15rem; }
.prev-nums b.pos, .prev-row .pos { color: #4ade80; }
.prev-nums b.neg, .prev-row .neg { color: #f87171; }
.prev-h { display: flex; justify-content: space-between; margin: 1.1rem 0 .3rem; font-size: .92rem; }
.prev-h span { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.prev-row { display: flex; justify-content: space-between; align-items: center; gap: .8rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.prev-row > div { min-width: 0; }
.prev-row b { display: block; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prev-row small { color: var(--muted); font-size: .76rem; }
.prev-row > span { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.prev-nota { margin-top: .9rem; }
/* Preguntar al asistente */
.ask-sug { display: flex; flex-wrap: wrap; gap: .4rem; margin-bottom: .8rem; }
.ask-sug button { padding: .45rem .75rem; border-radius: 999px; border: 1px solid var(--line); background: var(--card-2); color: var(--light); font-size: .82rem; cursor: pointer; text-align: left; }
.ask-sug button:hover { border-color: var(--orange); }
.ask-resp { margin-top: .8rem; padding: .9rem 1rem; border-radius: 14px; background: var(--card-2); border: 1px solid var(--line); line-height: 1.55; font-size: .94rem; }
.ask-resp[hidden] { display: none; }
.ask-resp b { color: var(--orange); }
.prev-card { cursor: default; }
.prev-top { background: none; border: 0; padding: 0; color: inherit; text-align: left; cursor: pointer; width: 100%; font: inherit; }
.prev-top .grow small + small { margin-top: .15rem; color: var(--light); }
.prev-nums button { background: var(--card-2); border: 1px solid transparent; border-radius: 12px; padding: .5rem .6rem; min-width: 0; text-align: left; color: var(--text); cursor: pointer; font: inherit; }
.prev-nums button:hover, .prev-nums button:active { border-color: rgb(255 138 0 / .5); }
.prev-nums button i { display: block; font-style: normal; font-size: .68rem; color: var(--orange); margin-top: .1rem; }
/* Lo que falta: lista sencilla */
.falta { margin-bottom: 1rem; }
.falta h4 { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 .4rem; font-size: 1rem; }
.falta h4 b { font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.falta-row { display: grid; grid-template-columns: 34px minmax(0, 1fr) auto auto; align-items: center; gap: .6rem; padding: .55rem 0; border-bottom: 1px solid var(--line); }
.falta-row:last-child { border-bottom: 0; }
.falta-row b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.falta-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--card-2); }
.falta-ico .ico { width: 18px; height: 18px; }
.falta-ico.neg { color: #f87171; } .falta-ico.pos { color: #4ade80; }
.falta-dia { color: var(--muted); font-size: .82rem; white-space: nowrap; }
.falta-imp { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 5.5rem; text-align: right; }
.falta-imp.neg, .falta h4 b.neg { color: #f87171; } .falta-imp.pos, .falta h4 b.pos { color: #4ade80; }
.falta-vacio { color: var(--muted); font-size: .88rem; margin: .2rem 0; }
.falta-extra { font-size: .85rem; color: var(--muted); margin: -.4rem 0 1rem; }
.falta-extra b { color: var(--light); }
.falta-fin { display: flex; justify-content: space-between; align-items: center; padding: .8rem .9rem; border-radius: 14px; background: var(--card-2); margin-bottom: 1rem; }
.falta-fin b { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.falta.prox { opacity: .75; }
.falta.prox h4 { font-size: .9rem; color: var(--muted); }
.prev-nums.dos { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.prev-nums button.aviso { border-color: rgb(255 45 45 / .35); }
.prev-nums button.aviso i { color: var(--muted); }
.falta-fin.aviso { background: rgb(255 45 45 / .08); border: 1px solid rgb(255 45 45 / .3); font-size: .9rem; line-height: 1.45; }
.falta-fin.aviso b { font-size: 1rem; color: #f87171; }

/* Revisar datos */
.flag.tras { background: rgb(14 165 233 / .16); color: #7dd3fc; }
.badge { min-width: 22px; height: 22px; padding: 0 .4rem; border-radius: 999px; background: var(--grad); color: #fff; font-size: .75rem; font-weight: 700; display: inline-grid; place-items: center; }
.badge[hidden] { display: none; }
.rv { margin-bottom: 1.2rem; }
.rv h4 { margin: 0 0 .2rem; font-size: .98rem; }
.rv > p { margin: 0 0 .5rem; line-height: 1.4; }
.rv-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .6rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--line);
  flex-direction: row; color: var(--text); font-size: .86rem; cursor: pointer; }
.rv-row input { width: 20px; height: 20px; }
.rv-txt { display: flex; flex-wrap: wrap; align-items: center; gap: .15rem .35rem; min-width: 0; }
.rv-txt > .ico { width: 14px; height: 14px; color: var(--orange); }
.rv-mov { color: var(--muted); min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.rv-mov b { color: var(--text); font-weight: 600; }
.rv-cat { color: var(--orange); font-weight: 600; }
.rv-imp { font-variant-numeric: tabular-nums; white-space: nowrap; }
.rv-txt b { font-weight: 600; }
.rv-txt small { flex-basis: 100%; color: var(--muted); font-size: .78rem; }
.rv-row { font-size: .92rem; }
