:root {
  --ink: #25272c; --ink-2: #6b7280; --ink-3: #64748b; --line: #e5e7eb; --line-2: #d1d5db;
  --bg: #f7f8f8; --card: #fff; --band: #e4e5e9; --hover: #f1f2f4;
  --primary: #25272c; --blue: #3b5bdb; --blue-bg: #c7d7fe; --blue-ink: #1e3a8a;
  --red: #e11d48; --red-bg: #ffe4e6; --green: #16a34a; --green-bg: #dcfce7; --paid: #4ade80;
  --overdue-row: #fdecec;
  --top: 56px; --rail: 68px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px; color: var(--ink); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* Barra superior */
.topbar { position: fixed; inset: 0 0 auto 0; height: var(--top); background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 16px 0 10px; z-index: 30; }
.tb-icon { display: grid; place-items: center; width: 36px; height: 36px; border: 0; background: none; border-radius: 50%; color: var(--ink-2); cursor: pointer; position: relative; text-decoration: none; }
.tb-icon:hover { background: var(--hover); color: var(--ink); }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; font-weight: 800; font-size: 21px; letter-spacing: -.03em; }
.tb-spacer { flex: 1; }
.tb-search { display: flex; align-items: center; gap: 8px; width: 210px; height: 34px; border: 1px solid var(--line-2); border-radius: 999px; padding: 0 10px; color: var(--ink-2); }
.tb-search input { border: 0; outline: 0; flex: 1; min-width: 0; font: inherit; color: var(--ink); background: none; padding: 0; }
.tb-search button { border: 0; background: none; color: var(--ink-2); cursor: pointer; }
.tb-company { display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 4px; text-decoration: none; background: #f9fafb; white-space: nowrap; }
.tb-company svg { width: 16px; height: 16px; color: var(--ink-2); }
.tb-bell span { position: absolute; top: 0; right: -2px; background: #dc2626; color: #fff; font-size: 10px; font-weight: 700; border-radius: 999px; padding: 1px 5px; border: 2px solid #fff; }
.tb-avatar { width: 40px; height: 40px; border-radius: 50%; background: #e5e7eb; display: grid; place-items: center; color: var(--ink); }

/* Menú lateral (como .mainLeftMenu de Contasimple): desplegado 230 px con «+ Crear», grupos en acordeón y pie;
   plegado 68 px con solo iconos y submenú flotante al pasar el ratón; en móvil, cajón sobre la página */
:root { --nav: 230px; }
body.nav-collapsed { --nav: var(--rail); }
.rail { position: fixed; top: var(--top); left: 0; bottom: 0; width: var(--nav); background: #fff; border-right: 1px solid var(--line); box-shadow: 0 2px 4px rgb(0 0 0 / .1); display: flex; flex-direction: column; padding: 20px 14px 0; z-index: 25; overflow: hidden auto; transition: width .3s; }
.crear-wrap { margin-bottom: 14px; }
.crear { width: 100%; height: 42px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); font: inherit; font-size: 15px; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
.crear svg { width: 16px; height: 16px; }
.crear:hover, .crear.pressed { background: var(--hover); }
.menu-list, .msub { list-style: none; margin: 0; padding: 0; }
.menu-list { display: grid; gap: 5px; }
.mh { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 6px; border-radius: 6px; text-decoration: none; font-weight: 600; color: var(--ink); white-space: nowrap; }
.mh svg { width: 20px; height: 20px; color: #4b5563; }
.mh .ml { flex: 1; overflow: hidden; text-overflow: ellipsis; }
.mh .mchev { width: 16px; height: 16px; color: var(--ink); transition: transform .2s; }
.mh:hover, .mg.hover > .mh { background: var(--hover); }
.mg.active > .mh { background: #e9eaec; }
.mg.open > .mh .mchev { transform: rotate(90deg); }
.msub { display: none; padding: 4px 0 2px; }
.mg.open .msub { display: grid; gap: 2px; }
.msub a { display: block; padding: 8px 10px 8px 30px; border-radius: 6px; text-decoration: none; font-weight: 600; font-size: 14px; color: var(--ink); }
.msub a:hover { background: var(--hover); }
.msub a.on { background: #e9eaec; }
.rail hr { width: 100%; border: 0; border-top: 1px solid var(--line-2); margin: 10px 0; }
.mh.ext { font-weight: 600; }
.nav-foot { margin-top: auto; border-top: 1px solid var(--line-2); margin-inline: -4px; padding: 16px 0 14px; display: grid; gap: 4px; font-size: 13px; }
.nav-foot span { color: var(--ink-2); }
.nav-foot .btn { margin-top: 8px; justify-content: center; }
/* plegado */
body.nav-collapsed .rail { padding-inline: 14px; }
body.nav-collapsed .crear { width: 40px; height: 40px; padding: 0; }
body.nav-collapsed .crear span, body.nav-collapsed .ml, body.nav-collapsed .mchev, body.nav-collapsed .msub, body.nav-collapsed .nav-foot { display: none !important; }
body.nav-collapsed .mh { justify-content: center; width: 40px; padding: 0; }
.flyout { position: fixed; top: var(--top); left: var(--rail); bottom: 0; width: 250px; background: #fff; border-right: 1px solid var(--line); box-shadow: 8px 0 24px rgb(0 0 0 / .06); padding: 18px 10px; z-index: 24; overflow-y: auto; }
.flyout[style*="top"] { bottom: auto; padding: 6px; border: 1px solid var(--line); border-radius: 6px; }
.flyout h3 { margin: 0 10px 12px; font-size: 15px; }
.flyout a { display: flex; justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: 6px; text-decoration: none; font-weight: 600; }
.flyout a:hover, .flyout a.active { background: var(--hover); }
.flyout a .plus { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; color: var(--ink-2); }
.flyout a .plus:hover { background: #e5e7eb; color: var(--ink); }
.flyout .soon { color: var(--ink-2); font-size: 11px; }
.nav-overlay { display: none; }

/* Menús desplegables (Crear, Opciones, avisos, perfil) */
.dd-wrap { position: fixed; z-index: 60; }
.dd { background: #fff; border-radius: 8px; box-shadow: 0 4px 16px rgb(0 0 0 / .14), 0 0 0 1px rgb(0 0 0 / .04); padding: 8px 0; min-width: 200px; max-height: calc(100vh - 80px); overflow-y: auto; animation: dd-in .12s ease-out; }
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px); } }
.dd a, .dd button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 20px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--ink); text-decoration: none; text-align: left; cursor: pointer; }
.dd a:hover, .dd button:hover { background: var(--hover); }
.dd svg { width: 16px; height: 16px; color: #4b5563; }
.dd hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }
.dd h3 { margin: 4px 20px 8px; font-size: 15px; }
.dd .muted { padding: 6px 20px 10px; margin: 0; }
.notif-dd { width: 340px; }
.notif-dd a { display: grid; gap: 2px; font-weight: 400; }
.notif-dd a b { font-weight: 600; }
.notif-dd a span { color: var(--ink-2); font-size: 13px; }
.profile-dd { min-width: 240px; }
.profile-dd .who { padding: 8px 20px 10px; color: var(--ink-2); border-bottom: 1px solid var(--line); margin-bottom: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.tb-avatar { border: 0; cursor: pointer; padding: 0; }
button.tb-avatar:hover, button.tb-avatar.pressed { box-shadow: 0 0 0 3px #e5e7eb; }
.tb-icon.pressed { background: var(--hover); color: var(--ink); }

/* Página */
.page { margin: var(--top) 0 0 var(--nav); transition: margin-left .3s; min-height: calc(100vh - var(--top)); }
.page-head { background: #fff; border-bottom: 1px solid var(--line); padding: 12px 15px 12px 15px; display: flex; align-items: flex-end; gap: 10px; min-height: 78px; }
.page-head .ph-left { flex: 1; min-width: 0; }
.crumbs { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); margin-bottom: 6px; }
.crumbs a { text-decoration: none; color: var(--ink); }
.crumbs svg { width: 15px; height: 15px; }
.crumbs .sep { width: 12px; height: 12px; color: var(--ink-2); }
.page-head h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.01em; }
.ph-actions { display: flex; gap: 8px; align-items: center; margin-bottom: 0; }
#view { padding: 16px 15px 60px; outline: none; }
#view.narrow { padding: 16px 34px 60px; }

/* Botones */
.btn { display: inline-flex; align-items: center; gap: 7px; height: 40px; padding: 0 16px; border-radius: 999px; border: 0; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; background: #e9eaec; color: var(--ink); }
.btn:hover { background: #dfe1e4; }
.btn.primary { background: var(--primary); color: #fff; }
.btn.primary:hover { background: #000; }
.btn.blue { background: var(--blue); color: #fff; width: 100%; justify-content: center; }
.btn.blue:hover { background: #2f4ac0; }
.btn.danger { color: var(--red); }
.btn.sm { height: 30px; padding: 0 12px; font-size: 13px; }
.btn svg { width: 17px; height: 17px; }
.split { display: inline-flex; }
.split .btn.primary:first-child { border-radius: 999px 0 0 999px; padding-right: 12px; }
.split .btn.primary.caret { border-radius: 0 999px 999px 0; padding: 0 12px; border-left: 1px solid #4b4d52; }
.circle { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line-2); background: #fff; display: grid; place-items: center; cursor: pointer; color: var(--ink); text-decoration: none; }
.circle:hover { background: var(--hover); }
.ghost-icon { border: 0; background: none; cursor: pointer; color: var(--ink); padding: 4px; display: inline-grid; place-items: center; }
.ghost-icon:hover { color: #000; }
.link-btn { border: 0; background: none; padding: 0; font: inherit; text-decoration: underline; cursor: pointer; color: var(--ink); }

/* Franja de período */
.band { background: var(--band); border-radius: 2px; padding: 12px 13px; display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-bottom: 36px; }
.band select { width: 120px; height: 40px; }

/* Tarjetas y listados */
.card { background: #fff; border: 1px solid var(--line); border-radius: 6px; }
.card.pad { padding: 20px 24px; }
.list-card { background: #fff; border: 1px solid var(--line); margin-bottom: 24px; }
.list-head { display: flex; align-items: center; gap: 14px; padding: 0 12px 0 10px; height: 48px; border-bottom: 1px solid var(--line); }
.list-head h2 { flex: 1; margin: 0; font-size: 14px; font-weight: 700; }
.list-empty { text-align: center; padding: 12px; line-height: 1.5; }
.filters { padding: 12px; border-bottom: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; background: #fafafa; }
.filters input, .filters select { width: auto; min-width: 180px; height: 36px; }
table { width: 100%; border-collapse: collapse; }
.grid-table th { font-weight: 500; padding: 5px; height: 56px; border: 1px solid #d8dbdf; text-align: center; white-space: nowrap; }
.grid-table th.sortable { text-decoration: underline; cursor: pointer; }
.grid-table th .help { width: 14px; height: 14px; color: var(--ink-2); vertical-align: -2px; }
.grid-table td { padding: 5px 10px; height: 52px; border: 1px solid #d8dbdf; text-align: center; vertical-align: middle; }
.grid-table td.l { text-align: left; overflow-wrap: anywhere; min-width: 150px; }
.num-cell .doc-link { white-space: nowrap; }
.lights .light { min-width: max-content; }
.grid-table tr.overdue td { background: var(--overdue-row); }
.grid-table tr.total td { font-weight: 700; padding: 5px 10px; height: 44px; }
.grid-table a.doc-link { text-decoration: underline; }
.grid-table tbody tr:hover td { background: #fafafa; }
.grid-table tbody tr.overdue:hover td { background: #fbe1e1; }
.ops { display: inline-flex; gap: 10px; align-items: center; }
.num-cell { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.num-cell svg { width: 16px; height: 16px; color: var(--ink); }
.ops .caret svg { width: 16px; height: 16px; color: var(--blue); }
.ops svg { width: 18px; height: 18px; }
.num { white-space: nowrap; font-variant-numeric: tabular-nums; }
.legend-card { background: #fff; padding: 24px; margin-bottom: 24px; }
.legend-card h2 { margin: 0 0 18px; font-size: 20px; font-weight: 600; }
.legend-card .sw { display: inline-block; width: 15px; height: 19px; background: var(--overdue-row); border: 1px solid #f6caca; vertical-align: -4px; margin-right: 8px; }

/* Etiquetas */
.tag { display: inline-block; padding: 3px 6px; border-radius: 3px; font-size: 14px; color: #fff; font-weight: 500; }
.tag.paid { background: var(--paid); }
.tag.pending { background: #f59e0b; }
.tag.overdue { background: #ef4444; }
.tag.draft { background: #9ca3af; }
.tag.blue { background: #60a5fa; }
.delta { display: inline-flex; align-items: center; gap: 3px; padding: 3px 7px; border-radius: 3px; font-size: 13px; font-weight: 600; vertical-align: middle; }
.delta.down { background: var(--red-bg); color: var(--red); }
.delta.up { background: var(--green-bg); color: var(--green); }
.delta svg { width: 14px; height: 14px; }

/* Inicio */
.section-title { font-size: 20px; font-weight: 600; margin: 4px 0 20px; display: flex; align-items: center; justify-content: space-between; }
.section-title.sm { font-size: 17px; margin: 34px 0 14px; }
.section-title select { width: 156px; height: 40px; font-size: 15px; }
.kpi-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 24px; box-shadow: 0 1px 2px rgb(0 0 0 / .04); }
.kpi h3 { margin: 0 0 14px; font-size: 16px; font-weight: 600; }
.kpi .big { font-size: 36px; font-weight: 700; letter-spacing: -.03em; display: flex; align-items: center; gap: 12px; font-variant-numeric: tabular-nums; }
.kpi .meta { margin-top: 26px; font-size: 13px; color: var(--ink-3); line-height: 1.7; text-transform: uppercase; }
.kpi .meta b { color: var(--ink); }
.chart-card { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 14px 20px 20px; }
.chart-legend { display: flex; justify-content: center; gap: 16px; font-size: 13px; margin-bottom: 8px; }
.chart-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: -1px; }
.chart-card svg { width: 100%; height: auto; stroke: none; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.mini-card { background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 22px 24px; }
.mini-card .mc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.mini-card h3 { margin: 0; font-size: 16px; font-weight: 600; }
.mini-card table td { padding: 9px 0; border-bottom: 1px solid var(--line); }
.mini-card table tr:last-child td { border-bottom: 0; }
.mini-card .r { text-align: right; }
.pill-tabs { display: inline-flex; background: #eef0f2; border-radius: 999px; padding: 3px; }
.pill-tabs button { border: 0; background: none; padding: 6px 14px; border-radius: 999px; font: inherit; cursor: pointer; color: var(--ink-2); }
.pill-tabs button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / .08); }

/* Formularios */
label.f { display: block; margin-bottom: 8px; font-size: 14px; color: var(--ink); }
label.f .req { color: var(--red); }
input, select, textarea { width: 100%; height: 40px; font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line-2); border-radius: 4px; padding: 0 10px; }
textarea { height: auto; padding: 8px 10px; min-height: 40px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #93c5fd; outline-offset: 0; border-color: #60a5fa; }
input[type=checkbox] { width: 16px; height: 16px; vertical-align: -3px; margin-right: 6px; }
.fsec { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 20px 15px 24px; margin-bottom: 16px; }
.fsec > summary { list-style: none; cursor: pointer; font-size: 17px; display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.fsec > summary::-webkit-details-marker { display: none; }
.fsec > summary svg { width: 16px; height: 16px; transition: transform .15s; }
.fsec:not([open]) > summary svg { transform: rotate(180deg); }
.fsec:not([open]) > summary { margin-bottom: 0; }
.fgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px 24px; margin-top: 22px; }
.fgrid .s2 { grid-column: span 2; }
.fgrid .full { grid-column: 1 / -1; }
.seg { display: flex; border: 1px solid var(--line-2); border-radius: 4px 999px 999px 4px; overflow: hidden; height: 40px; }
.seg input { border: 0; border-radius: 0; flex: 1; min-width: 120px; }
.seg .cs-date { border: 0; border-radius: 0; flex: 1 1 auto; min-width: 118px; height: 100%; box-shadow: none; }
.seg .cs-date:focus-within { box-shadow: inset 0 0 0 1px #3b5bdb; }
.seg button { border: 0; border-left: 1px solid var(--line-2); background: #f3f4f6; padding: 0 9px; font: inherit; color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.seg button.on { background: #e0e7ff; color: var(--blue-ink); font-weight: 600; }
.lab-row { display: flex; gap: 10px; align-items: baseline; }
.lab-row .link-btn { font-size: 13px; }
.concept-head, .concept-row { display: grid; grid-template-columns: 30px 1fr 90px 110px 78px 78px 86px 52px; gap: 10px; align-items: center; }
.concept-head { font-size: 14px; margin: 24px 0 8px; }
.concept-row { margin-bottom: 10px; }
.concept-row textarea { height: 40px; }
.affix { display: flex; border: 1px solid var(--line-2); border-radius: 4px; height: 40px; overflow: hidden; }
.affix span, .affix button { display: grid; place-items: center; min-width: 26px; background: #f3f4f6; border: 0; color: var(--ink); font: inherit; }
.affix button { cursor: pointer; }
.affix input { border: 0; border-radius: 0; text-align: right; padding: 0 6px; min-width: 0; }
.affix input:focus { outline: 0; }
.add-concept { margin-top: 20px; display: flex; justify-content: space-between; align-items: center; }
.totals-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.tot { background: #fff; border: 1px solid var(--line); border-radius: 4px; padding: 18px 15px; }
.tot .tl { font-size: 17px; }
.tot .tv { text-align: right; font-size: 20px; font-weight: 700; margin-top: 10px; font-variant-numeric: tabular-nums; }
.tot.grand { background: #e9eaec; }
.check-row { margin: 14px 0 0; }

/* Impuestos */
.info-blue { background: var(--blue-bg); padding: 14px 15px; border-radius: 2px; margin: 50px 0 52px; font-size: 13px; }
.tax-grid { display: grid; grid-template-columns: repeat(auto-fill, 260px); gap: 16px; }
.tax-card { background: #fff; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.tax-art { height: 150px; padding-top: 30px; position: relative; display: grid; place-items: center; text-align: center; }
.tax-art .chip { position: absolute; top: 14px; left: 14px; background: #fff; border-radius: 999px; padding: 4px 8px; font-size: 11px; font-weight: 600; letter-spacing: .04em; }
.tax-art .t1 { font-size: 21px; }
.tax-art .t2 { font-size: 40px; font-weight: 800; line-height: 1.05; }
.tax-body { padding: 16px; display: flex; flex-direction: column; gap: 9px; }
.tax-body p { margin: 0 0 8px; font-size: 15px; min-height: 38px; }
.tax-body .muted { font-size: 13px; }
.def-list { display: grid; grid-template-columns: 130px 1fr; gap: 18px 0; line-height: 1.6; }
.def-list dt { font-weight: 700; }
.def-list dd { margin: 0; }
.plain-table th { font-weight: 500; background: #f3f4f6; }
.plain-table th, .plain-table td { border: 1px solid var(--line-2); padding: 9px 10px; text-align: left; }
.calc-table td, .calc-table th { border: 1px solid var(--line); padding: 10px 12px; }
.calc-table th { background: #f9fafb; text-align: left; font-weight: 600; }
.calc-table td.box { width: 70px; color: var(--ink-2); text-align: center; }
.calc-table td.amt { text-align: right; width: 160px; font-variant-numeric: tabular-nums; }
.calc-table tr.res td { font-weight: 700; background: #f3f4f6; }

/* Configuración */
.cfg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.cfg-grid a { display: flex; align-items: center; gap: 12px; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; }
.cfg-grid a:hover { background: var(--hover); }

/* Documentos: plantillas propias (factura, rectificativa, presupuesto, albarán) */
.doc { background: #fff; max-width: 860px; margin: 0 auto; padding: 44px 48px; border: 1px solid var(--line); color: #1f2328; font-size: 13px; line-height: 1.45; --accent: #25272c; }
.doc h1 { margin: 0; font-size: 26px; letter-spacing: -.01em; }
.doc .d-h { font-size: 10px; text-transform: uppercase; letter-spacing: .09em; color: #6b7280; margin-bottom: 4px; font-weight: 600; }
.doc .d-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 24px; margin-bottom: 26px; }
.doc .d-row { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; margin-bottom: 22px; }
.doc .d-end { align-items: start; margin-top: 18px; }
.doc .d-brand { display: flex; flex-direction: column; gap: 10px; }
.doc .d-logo { display: block; max-width: 220px; object-fit: contain; }
.doc .d-qr { text-align: center; flex: none; }
.doc .d-qr-l { font-size: 9px; font-weight: 700; letter-spacing: .05em; }
.doc .qr { width: 110px; height: 110px; display: block; margin: 2px auto; }
.doc .d-meta { border-collapse: collapse; font-size: 12px; }
.doc .d-meta th { text-align: left; font-weight: 600; color: #6b7280; padding: 3px 14px 3px 0; white-space: nowrap; }
.doc .d-meta td { padding: 3px 0; font-weight: 600; }
.doc .d-lines { width: 100%; border-collapse: collapse; margin-top: 6px; }
.doc .d-lines th { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; padding: 9px 8px; text-align: right; white-space: nowrap; }
.doc .d-lines td { padding: 9px 8px; text-align: right; vertical-align: top; font-variant-numeric: tabular-nums; white-space: nowrap; }
.doc .d-lines .l { text-align: left; white-space: normal; width: 55%; }
.doc .d-totals { margin-left: auto; width: 300px; font-variant-numeric: tabular-nums; }
.doc .d-totals > div { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; }
.doc .d-grand { font-size: 17px; font-weight: 700; margin-top: 6px; padding-top: 9px !important; }
.doc .d-notes { font-size: 12px; color: #374151; margin-bottom: 12px; }
.doc .d-pay { font-size: 12px; }
.doc .d-mono { font-family: ui-monospace, Menlo, monospace; }
.doc .d-foot { margin-top: 34px; padding-top: 10px; font-size: 10px; color: #6b7280; border-top: 1px solid #e5e7eb; }
.doc .d-hash { font-family: ui-monospace, Menlo, monospace; word-break: break-all; margin-bottom: 4px; }
.doc a { color: inherit; }
/* Clásica: líneas sobrias en tinta */
/* Plantilla «Contasimple»: medidas tomadas del PDF original (A4 595 pt = 860 px; Tahoma; gris #555; filetes cian #00faff) */
.d-contasimple { position: relative; font-family: Tahoma, Verdana, "DejaVu Sans", sans-serif; color: #555; font-size: 13px; line-height: 1.33; padding: 72px 58px 40px; min-height: 1180px; display: flex; flex-direction: column; }
.d-contasimple strong { font-weight: 700; }
.d-contasimple .cs-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.d-contasimple .d-logo { max-width: 260px; }
.d-contasimple .cs-parties { display: grid; grid-template-columns: 55% 45%; margin-bottom: 44px; }
.d-contasimple .cs-titlerow { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 36px; }
.d-contasimple h1 { font-size: 46px; font-weight: 700; line-height: 1; letter-spacing: 0; color: #555; margin: 0; }
.d-contasimple .cs-meta { width: auto; border-collapse: collapse; font-size: 14px; margin-right: -2px; }
.d-contasimple .cs-meta td { padding: 0 0 1px; } .d-contasimple .cs-meta td + td { text-align: right; padding-left: 6px; }
.d-contasimple .cs-lines { width: 100%; border-collapse: collapse; border-bottom: 2px solid #00faff; }
.d-contasimple .cs-lines th { font-weight: 400; font-size: 14px; text-align: right; padding: 3px 3px 5px; border-bottom: 2px solid #00faff; white-space: nowrap; }
.d-contasimple .cs-lines td { text-align: right; vertical-align: top; padding: 8px 3px 10px; white-space: nowrap; font-size: 13px; }
.d-contasimple .cs-lines td + td, .d-contasimple .cs-lines th + th { padding-left: 26px; }
.d-contasimple .cs-lines .l { text-align: left; white-space: normal; width: 100%; }
.d-contasimple .cs-tot { width: auto; margin: 8px -2px 0 auto; border-collapse: collapse; font-size: 14px; }
.d-contasimple .cs-tot td { padding: 2px 3px 4px; text-align: right; }
.d-contasimple .cs-tot td + td { padding-left: 26px; }
.d-contasimple .cs-grand td { font-size: 21px; font-weight: 700; padding-top: 6px; } .d-contasimple .cs-grand td + td { padding-left: 8px; }
.d-contasimple .cs-info { margin-top: 26px; }
.d-contasimple .cs-info h2 { font-size: 19px; font-weight: 700; color: #555; margin: 0 0 10px; }
.d-contasimple .cs-info p { margin: 0 0 12px; }
.d-contasimple .cs-side { position: absolute; left: 14px; top: 540px; transform: rotate(-90deg) translateX(-100%); transform-origin: 0 0; font-size: 8px; letter-spacing: .02em; white-space: nowrap; }
.d-contasimple .cs-foot { margin-top: auto; padding-top: 30px; text-align: center; font-size: 10px; font-style: italic; }
.d-contasimple .cs-foot .d-hash { font-style: normal; font-family: ui-monospace, Menlo, monospace; word-break: break-all; margin-bottom: 4px; }
.d-clasica .d-title { text-align: right; } .d-clasica .d-title h1 { text-transform: uppercase; margin-bottom: 8px; } .d-clasica .d-title .d-meta { margin-left: auto; }
.d-clasica .d-client { border: 1px solid #d1d5db; padding: 12px 14px; margin-bottom: 20px; width: 55%; }
.d-clasica .d-lines th { border-top: 2px solid #1f2328; border-bottom: 1px solid #1f2328; } .d-clasica .d-lines td { border-bottom: 1px solid #e5e7eb; }
.d-clasica .d-grand { border-top: 2px solid #1f2328; }
/* Clásica II: banda gris con el título */
.d-clasica2 .d-band { background: #eef0f2; text-transform: uppercase; letter-spacing: .25em; font-weight: 700; text-align: center; padding: 9px; margin: 0 0 20px; font-size: 15px; }
.d-clasica2 .d-party, .d-clasica2 .d-meta { border: 1px solid #d1d5db; padding: 12px 14px; }
.d-clasica2 .d-lines th { background: #eef0f2; } .d-clasica2 .d-lines td { border-bottom: 1px dotted #c4c9cf; }
.d-clasica2 .d-totals { border: 1px solid #d1d5db; padding: 8px 12px; } .d-clasica2 .d-grand { background: #eef0f2; margin: 6px -12px -8px; padding: 9px 12px !important; }
/* Moderna: acento lateral y tabla aireada */
.d-moderna { border-left: 8px solid var(--accent); }
.d-moderna h1 { color: var(--accent); font-size: 30px; }
.d-moderna .d-lines th { color: var(--accent); border-bottom: 2px solid var(--accent); }
.d-moderna .d-lines tbody tr:nth-child(even) td { background: #f6f7f9; }
.d-moderna .d-grand { color: #fff; background: var(--accent); padding: 9px 12px !important; border-radius: 4px; }
/* Moderna II: cabecera a color */
.d-moderna2 { padding-top: 0; }
.d-moderna2 .d-top { margin: 0 -48px 26px; padding: 26px 48px; background: var(--accent); color: #fff; align-items: center; }
.d-moderna2 .d-hero { display: flex; flex: 1; justify-content: space-between; align-items: flex-end; gap: 20px; }
.d-moderna2 .d-hero .d-meta th { color: rgb(255 255 255 / .75); } .d-moderna2 .d-hero .d-meta td { color: #fff; }
.d-moderna2 .d-qr { background: #fff; color: #1f2328; padding: 6px; border-radius: 4px; }
.d-moderna2 .d-lines th { background: #f1f3f5; } .d-moderna2 .d-lines td { border-bottom: 1px solid #eceef1; }
.d-moderna2 .d-grand { border-top: 3px solid var(--accent); }
/* Elegante: serif centrada y filetes finos */
.d-elegante, .d-elegante2 { font-family: Georgia, "Times New Roman", serif; }
.d-elegante .d-center, .d-elegante2 .d-center { flex-direction: column; align-items: center; text-align: center; gap: 6px; }
.d-elegante h1, .d-elegante2 h1 { font-weight: 400; font-size: 30px; letter-spacing: .12em; text-transform: uppercase; }
.d-elegante .d-sub, .d-elegante2 .d-sub { color: #6b7280; font-style: italic; }
.d-elegante .d-meta, .d-elegante2 .d-meta { margin: 0 0 18px; }
.d-elegante .d-lines th, .d-elegante2 .d-lines th { font-weight: 400; border-top: 1px solid #9ca3af; border-bottom: 1px solid #9ca3af; }
.d-elegante .d-lines td { border-bottom: 1px solid #f0f1f3; }
.d-elegante .d-grand { border-top: 1px solid #1f2328; border-bottom: 3px double #1f2328; }
/* Elegante II: totales destacados en color */
.d-elegante2 .d-top { border-bottom: 1px solid var(--accent); padding-bottom: 16px; }
.d-elegante2 .d-totals { background: #f7f7f5; padding: 10px 14px; border-top: 2px solid var(--accent); }
.d-elegante2 .d-grand { color: var(--accent); }
/* Vanguardista: tipografía grande y bloque oscuro */
.d-vanguardista h1 { font-size: 44px; font-weight: 800; text-transform: uppercase; letter-spacing: -.03em; line-height: .95; margin-bottom: 14px; }
.d-vanguardista .d-right { display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
.d-vanguardista .d-party { border-top: 4px solid #1f2328; padding-top: 8px; }
.d-vanguardista .d-lines th { background: #1f2328; color: #fff; } .d-vanguardista .d-lines td { border-bottom: 1px solid #e5e7eb; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
.d-vanguardista .d-lines td.l { font-family: inherit; font-size: 13px; }
.d-vanguardista .d-totals { background: #1f2328; color: #fff; padding: 12px 16px; } .d-vanguardista .d-grand { font-size: 22px; border-top: 1px solid #6b7280; }
/* Galería de plantillas */
.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, 150px); gap: 14px; }
.tpl-card { border: 2px solid transparent; background: #eef0f2; border-radius: 6px; padding: 8px; cursor: pointer; text-align: center; font: inherit; }
.tpl-card.on { border-color: var(--blue); background: #e0e7ff; }
.tpl-thumb { height: 190px; overflow: hidden; background: #fff; position: relative; pointer-events: none; }
.tpl-thumb .doc { transform: scale(.155); transform-origin: top left; width: 860px; max-width: none; position: absolute; top: 0; left: 0; border: 0; }
.tpl-card span { display: block; margin-top: 6px; font-weight: 600; }
.mono { font-family: ui-monospace, Menlo, monospace; font-size: 11px; word-break: break-all; }
.notice { padding: 12px 15px; background: var(--blue-bg); margin-bottom: 16px; border-radius: 2px; }
.notice.warn { background: #fef3c7; }
.muted { color: var(--ink-2); }
.placeholder { background: #fff; border: 1px solid var(--line); padding: 40px; text-align: center; color: var(--ink-2); }

#toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 6px; opacity: 0; transition: .2s; pointer-events: none; z-index: 60; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--red); }
dialog { border: 0; border-radius: 8px; padding: 0; width: min(500px, 92vw); box-shadow: 0 20px 60px rgb(0 0 0 / .25); }
dialog::backdrop { background: rgb(0 0 0 / .4); }
#modal-body { padding: 22px; }
#modal-body h3 { margin: 0 0 12px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

/* Móvil (como Contasimple a 390 px): sin logo ni empresa, buscador en la barra, menú como cajón con velo */
@media (max-width: 767px) {
  :root { --nav: 0px; }
  .brand, .tb-company { display: none !important; }
  .tb-search { display: flex !important; flex: 1; width: auto; }
  .tb-spacer { display: none; }
  .topbar { gap: 6px; padding: 0 8px; }
  .rail { width: 270px; transform: translateX(-100%); transition: transform .25s; box-shadow: none; }
  body.nav-open .rail { transform: none; box-shadow: 8px 0 24px rgb(0 0 0 / .18); }
  .nav-overlay { display: block; position: fixed; inset: var(--top) 0 0 0; background: rgb(0 0 0 / .35); z-index: 24; opacity: 0; pointer-events: none; transition: opacity .25s; }
  body.nav-open .nav-overlay { opacity: 1; pointer-events: auto; }
  .flyout { display: none !important; }
  .page-head { flex-wrap: wrap; align-items: center; min-height: 0; }
  .ph-actions { flex-wrap: wrap; justify-content: flex-end; max-width: 100%; }
  #sync-now { display: none; }
  .seg button { padding: 0 6px; font-size: 13px; }
  .acc-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .report-grid { grid-template-columns: 1fr; }
  .report-card { min-height: 0; }
  .acc-card { min-height: 0; padding: 14px 12px; }
  .acc-bal { font-size: 17px; }
  .pie { width: 140px; height: 140px; }
  .tb-search { min-width: 0; }
  .notif-dd { width: calc(100vw - 16px); }
  .dd-wrap { right: 8px !important; }
}
@media (max-width: 1000px) {
  .kpi-row, .two-col, .totals-row { grid-template-columns: 1fr; }
  .fgrid { grid-template-columns: 1fr; } .fgrid .s2 { grid-column: auto; }
  .tb-company { display: none; }
  .concept-head { display: none; } .concept-row { grid-template-columns: 1fr 1fr; }
}
@media print {
  .topbar, .rail, .flyout, .page-head, .no-print { display: none !important; }
  .page { margin: 0; } #view { padding: 0; } html, body, .page, #view { background: #fff !important; }
  .doc { border: 0; padding: 0; max-width: none; }
  .qr { width: 35mm !important; height: 35mm !important; }
  .doc.d-contasimple { padding: 6mm 0 0 !important; zoom: .817; min-height: 300mm; }
  .page { min-height: 0 !important; }
  .d-contasimple .cs-lines, .d-contasimple .cs-lines th { border-bottom-width: 2.6px; }
  .d-contasimple .cs-side { left: -9mm; }
  @page { size: A4; margin: 12mm; }
  .doc .d-lines tr, .doc .d-totals { break-inside: avoid; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

[hidden] { display: none !important; }

#login { position: fixed; inset: 0; background: var(--bg); display: grid; place-items: center; z-index: 100; padding: 20px; }
.login-card { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 32px; width: min(380px, 100%); box-shadow: 0 10px 40px rgb(0 0 0 / .08); }
#sync-now.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.status-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: 0; }

/* Semáforo de seguimiento (banco · factura · contabilizada · Biloop); colores con contraste ≥ 4,5:1 sobre texto blanco */
.lights { display: inline-flex; gap: 3px; white-space: nowrap; }
.light { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 3px; border-radius: 10px; font-size: 10px; font-weight: 700; color: #fff; cursor: help; }
.light.ok { background: #15803d; }
.light.warn { background: #b45309; }
.light.no { background: #b91c1c; }
.light.na { background: #6b7280; }
.light.personal { background: #1d4ed8; } /* pagado desde una cuenta personal del socio */
.lights { display: inline-grid; grid-template-columns: auto auto; gap: 2px; justify-content: center; white-space: nowrap; }
.list-card { overflow-x: auto; }
.light { font-size: 10.5px; font-weight: 600; padding: 0 6px; height: 17px; justify-content: flex-start; }
.lights-panel .light, .legend .light { height: 20px; font-size: 11px; }
.lights-panel ul { list-style: none; margin: 0; padding: 12px 20px 16px; display: grid; gap: 8px; }
.lights-panel li { display: flex; gap: 10px; align-items: center; }
.lights-panel .light { min-width: 120px; justify-content: flex-start; }

/* Desplegables con buscador in situ (como select2 en Contasimple): al abrir aparece un buscador encima de la lista,
   la opción resaltada en azul claro y, en clientes y proveedores, nombre en negrita con el NIF debajo en gris */
.cs-native { position: absolute !important; width: 1px !important; height: 1px !important; opacity: 0; pointer-events: none; }
.fgrid > *, .cs-date { min-width: 0; }
.cs-select { position: relative; display: flex; min-width: 0; align-items: center; width: 100%; height: 40px; background: #fff; border: 1px solid var(--line-2); border-radius: 4px; padding: 0 28px 0 12px; cursor: pointer; user-select: none; }
.cs-select:focus, .cs-select.open { outline: 0; border-color: #3b5bdb; box-shadow: 0 0 0 1px #3b5bdb; }
.cs-select.disabled { background: #f3f4f6; color: var(--ink-2); cursor: not-allowed; }
.cs-val { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cs-val.ph { color: var(--ink); }
.cs-caret { position: absolute; right: 10px; top: 50%; margin-top: -2px; border: 4px solid transparent; border-top-color: #6b7280; border-bottom: 0; }
.cs-select.open .cs-caret { border-top: 0; border-bottom: 4px solid #6b7280; }
.cs-drop { position: fixed; z-index: 70; background: #fff; border: 1px solid #aaa; border-radius: 0 0 4px 4px; box-shadow: 0 4px 12px rgb(0 0 0 / .12); display: flex; flex-direction: column; max-height: 300px; }
.cs-drop .cs-search { margin: 4px; width: calc(100% - 8px); height: 40px; border: 1px solid #aaa; border-radius: 2px; padding: 0 6px; flex: none; }
.cs-drop .cs-search:focus { outline: 0; border-color: #3b5bdb; box-shadow: 0 0 0 1px #3b5bdb; }
.cs-drop ul { list-style: none; margin: 0; padding: 0; overflow-y: auto; }
.cs-drop li { padding: 7px 6px; cursor: pointer; line-height: 1.45; }
.cs-drop li b, .cs-drop li strong { font-weight: 700; }
.cs-drop li:has(small) { font-weight: 700; }
.cs-drop li small { display: block; font-weight: 400; color: #6b7280; font-size: 14px; }
.cs-drop li.ph { color: var(--blue-ink); }
.cs-drop li.hi { background: #dfe6ff; }
.cs-drop li[aria-selected="true"] { font-weight: 600; }
.cs-drop .none { padding: 8px 6px; color: var(--ink-2); cursor: default; }

/* Calendario (como el de Contasimple): cabecera «mes, año» con flechas, semana L–D, hoy en círculo azul y botón «Hoy» */
.cs-date { position: relative; display: flex; align-items: center; gap: 6px; width: 100%; height: 40px; background: #fff; border: 1px solid var(--line-2); border-radius: 4px; padding: 0 10px; }
.cs-date:focus-within { border-color: #3b5bdb; box-shadow: 0 0 0 1px #3b5bdb; }
.cs-date svg { width: 16px; height: 16px; color: var(--ink); cursor: pointer; }
.cs-date input { border: 0; height: 100%; padding: 0; outline: 0 !important; background: none; min-width: 0; }
.cs-cal { position: fixed; z-index: 70; width: 326px; background: #fff; border-radius: 8px; box-shadow: 0 6px 24px rgb(0 0 0 / .15); padding: 14px 20px 18px; animation: dd-in .12s ease-out; }
.cal-h { display: flex; align-items: center; justify-content: space-between; font-weight: 700; font-size: 16px; margin-bottom: 10px; }
.cal-h button { border: 0; background: none; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; color: var(--ink); font-size: 18px; display: grid; place-items: center; }
.cal-h button:hover { background: var(--hover); }
.cal-w, .cal-d { display: grid; grid-template-columns: repeat(7, 1fr); text-align: center; }
.cal-w span { font-weight: 700; font-size: 14px; padding: 6px 0; }
.cal-d button { border: 0; background: none; height: 36px; font: inherit; font-size: 12px; cursor: pointer; border-radius: 50%; width: 32px; margin: 0 auto; color: var(--ink); }
.cal-d button:hover { background: var(--hover); }
.cal-d button.out { color: #9ca3af; }
.cal-d button.today { background: #3b5bdb; color: #fff; font-weight: 700; }
.cal-d button.sel:not(.today) { box-shadow: inset 0 0 0 2px #3b5bdb; font-weight: 700; }
.cal-today { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; margin-top: 12px; height: 36px; border: 1px solid var(--line-2); border-radius: 999px; background: #fff; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.cal-today:hover { background: var(--hover); }

/* Ayudas (?) */
.cs-tip { position: fixed; z-index: 80; max-width: 280px; background: #25272c; color: #fff; font-size: 12px; line-height: 1.45; padding: 8px 10px; border-radius: 6px; pointer-events: none; }
[data-help] { cursor: help; }

/* Celda de cliente o proveedor con icono de estadísticas */
.ent-cell { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ent-cell a { color: var(--blue); display: inline-grid; }
.ent-cell svg { width: 16px; height: 16px; }

/* Resumen de tesorería: pestañas subrayadas, tarjetas de cuenta y gráfico de barras */
.ul-tab { border-bottom: 1px solid var(--line-2); margin: 8px 0 16px; }
.ul-tab span { display: inline-block; padding: 10px 12px; font-weight: 600; border-bottom: 3px solid #3b5bdb; margin-bottom: -1px; }
.acc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; margin-bottom: 32px; }
.acc-card { display: flex; flex-direction: column; gap: 4px; min-height: 164px; padding: 18px 16px; background: #fff; border: 1px solid var(--line-2); border-radius: 8px; text-decoration: none; color: var(--ink); }
.acc-card:hover { border-color: #9ca3af; box-shadow: 0 2px 8px rgb(0 0 0 / .06); }
.acc-card > svg { width: 20px; height: 20px; margin-bottom: 10px; }
.acc-card b { font-size: 15px; font-weight: 600; }
.acc-card .mono { font-size: 13px; }
.acc-bal { font-size: 20px; font-weight: 700; margin-top: 8px; }
.acc-bal.neg { color: var(--red); }
.chart-card { background: #fff; border: 1px solid var(--line-2); padding: 24px; margin-bottom: 24px; }
svg.bars { width: 100%; height: auto; display: block; stroke: none; fill: var(--ink); }
svg.bars text { font-size: 11px; stroke: none; fill: var(--ink); }
svg.bars line.grid { stroke: #e5e7eb; stroke-width: 1; }

/* Zona para soltar la factura (como el OCR de Contasimple) */
.drop-zone { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 142px; margin-bottom: 16px; border: 1px dashed #6b7280; border-radius: 2px; background: #fff; text-align: center; padding: 20px; cursor: pointer; }
.drop-zone .up-arrow { width: 26px; height: 26px; stroke-width: 2.4; }
.drop-zone b { font-size: 16px; font-weight: 600; }
.drop-zone small { font-size: 11px; }
.drop-zone.over { background: #eef2ff; border-color: #3b5bdb; }
.drop-zone.busy { cursor: progress; opacity: .8; }
.drop-zone.busy .up-arrow { animation: spin 1.2s linear infinite; }
.drop-zone.has { min-height: 0; flex-direction: row; justify-content: space-between; cursor: default; border-style: solid; border-color: var(--line); }
.drop-zone.has a { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
/* Campo con sufijo (100 %) y ayuda (?) junto a la etiqueta */
.suffix { display: flex; align-items: center; gap: 8px; }
.suffix input { width: 80px; }
.qhelp { display: inline-grid; place-items: center; width: 15px; height: 15px; border: 1.3px solid var(--ink-2); border-radius: 50%; font-size: 10px; font-weight: 700; color: var(--ink-2); vertical-align: 1px; margin-left: 4px; }
.fsec .check-row { display: flex; align-items: center; gap: 4px; margin: 14px 0 0; }

/* Tartas del resumen de clientes y proveedores */
.pie-box { text-align: center; }
.pie-box h3 { font-size: 20px; font-weight: 600; margin: 10px 0 24px; }
.pie-row { display: flex; align-items: center; justify-content: center; gap: 28px; flex-wrap: wrap; }
.pie { width: 184px; height: 184px; border-radius: 50%; flex: none; }
.pie-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; text-align: left; font-size: 13px; max-width: 280px; }
.pie-legend li { display: grid; grid-template-columns: 12px 1fr auto; gap: 2px 8px; align-items: center; }
.pie-legend i { width: 12px; height: 12px; border-radius: 50%; }
.pie-legend span { grid-column: 2 / 4; font-size: 12px; }

/* Subgrupo del menú lateral («Recibos y remesas») */
.msub2-h { display: flex; align-items: center; justify-content: space-between; width: 100%; padding: 8px 10px 8px 30px; border: 0; background: none; border-radius: 6px; font: inherit; font-weight: 600; color: var(--ink); cursor: pointer; }
.msub2-h:hover { background: var(--hover); }
.msub2-h svg { width: 16px; height: 16px; transition: transform .2s; }
.msub2 > ul { display: none; list-style: none; margin: 0; padding: 0; }
.msub2.open > ul { display: grid; gap: 2px; }
.msub2.open > .msub2-h svg { transform: rotate(90deg); }
.msub2 > ul a { padding-left: 44px; font-weight: 500; }
.fly-sub { display: block; margin: 10px 10px 4px; color: var(--ink-2); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
/* Movimientos: modo con icono e importe en negrita */
.mode-ic { display: inline-grid; place-items: center; color: var(--ink); }
.mode-ic svg { width: 18px; height: 18px; }
.grid-table td.amt { font-weight: 600; }
.grid-table td.amt.neg { color: #dc2626; }
.grid-table td.amt.pos { color: #16a34a; }
/* Índice de informes con ilustraciones */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 260px)); gap: 16px; }
.report-card { display: flex; flex-direction: column; background: #fff; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; text-decoration: none; color: var(--ink); min-height: 300px; transition: box-shadow .15s; }
.report-card:hover { box-shadow: 0 4px 14px rgb(0 0 0 / .08); }
.report-card svg { width: 100%; height: 150px; stroke: none; flex: none; }
.report-card b { font-size: 15px; font-weight: 600; margin: 16px 16px 4px; }
.report-card span { margin: 0 16px 16px; color: var(--ink-2); font-size: 13px; line-height: 1.5; }

/* Conexiones bancarias */
.notice.ok { background: #dcfce7; color: #14532d; }
.notice.err { background: #ffe4e6; color: #881337; }
.preset-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin-bottom: 8px; }
.acc-card.preset { min-height: 0; font: inherit; text-align: left; cursor: pointer; }
.acc-card.preset.on { border-color: #3b5bdb; box-shadow: 0 0 0 1px #3b5bdb; }
.kpi .big.neg { color: var(--red); }

/* Finanzas personales */
table.kv { width: 100%; border-collapse: collapse; }
table.kv td { padding: 6px 0; border-bottom: 1px solid var(--line); }
table.kv tr.total td { border-bottom: 0; padding-top: 10px; }
.grid-table tr.hl td { background: #eef2ff; }

/* Categorías del gasto personal */
.cat-table { width: 100%; border-collapse: collapse; }
.cat-table td { padding: 5px 6px 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.cat-table td:nth-child(2) { width: 38%; }
.cat-table .bar { height: 10px; background: #eef0f2; border-radius: 5px; overflow: hidden; }
.cat-table .bar i { display: block; height: 100%; background: #3b5bdb; border-radius: 5px; }
.cat-sel { height: 30px; font-size: 12px; padding: 0 4px; width: 190px; }

/* Pagos recurrentes */
.rec-sub { margin: 6px 0 0; color: var(--ink-2); font-size: 13px; }
.rec-cal, .card.pad + .card.pad { margin-top: 16px; }
.rec-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.rec-bar h3 { margin: 0; font-size: 16px; font-weight: 600; text-transform: capitalize; }
.rec-bar .btn:disabled { opacity: .4; cursor: default; }
.rec-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--line); border-top: 1px solid var(--line); }
.rec-grid > div { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-width: 0; }
.rec-h { padding: 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-2); background: var(--bg); }
.rec-day { min-height: 92px; padding: 5px 6px; background: var(--card); }
.rec-day.today { background: var(--blue-bg); }
.rec-n { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rec-day.today .rec-n { color: var(--blue-ink); font-weight: 700; }
.rec-chip { display: block; margin-top: 3px; padding: 2px 5px; border-radius: 3px; font-size: 12px; line-height: 1.25; background: var(--green-bg); color: #14532d; overflow-wrap: anywhere; }
.rec-chip.alt { background: #fef3c7; color: #78350f; }
.rec-chip b { display: block; font-weight: 600; } .rec-chip i { display: block; font-style: normal; font-variant-numeric: tabular-nums; }
.rec-t { margin: 0 0 8px; font-size: 16px; font-weight: 600; }
.rec-agenda { list-style: none; margin: 0; padding: 0; }
.rec-agenda li { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.rec-agenda li:last-child { border-bottom: 0; } .rec-d { color: var(--ink-2); }
@media (max-width: 767px) { .rec-grid { display: block; border: 0; } .rec-h, .rec-out { display: none; } .rec-day { min-height: 0; border: 0; border-bottom: 1px solid var(--line); } .rec-day:not(:has(.rec-chip)) { display: none; } .rec-day .rec-n::after { content: ' ·'; } }
