/* Cifra ERP · basado en el diseño de las páginas de Cifra (azul marino #0B1F33, azul #2F6BFF, Manrope). */
:root { --ink: #0B1F33; --blue: #2F6BFF; --blue-soft: #EAF0FF; --line: #E6EEF8; --line2: #CBD6E6; --paper: #F4F7FB; --muted: #5C6B80; --ok: #157347; --warn: #9A5B00; --bad: #B42318; }
* { box-sizing: border-box; }
html { color: var(--ink); background: var(--paper); font-family: Manrope, "Segoe UI", system-ui, sans-serif; font-size: 15px; }
body { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--blue); }
[hidden] { display: none !important; }
.boot { min-height: 100vh; display: grid; place-items: center; color: var(--muted); }
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; background: linear-gradient(160deg, var(--ink) 0 42%, var(--paper) 42%); }
.panel { width: min(480px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 18px; padding: 24px; display: grid; gap: 10px; box-shadow: 0 30px 60px -30px rgba(11,31,51,.45); }
.brandline { display: flex; align-items: center; gap: 10px; }
.brandline img { width: 34px; height: 34px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 12px; }
.tabs button, .tabs a { border: 1px solid var(--line2); background: #F7F9FC; color: var(--ink); border-radius: 999px; min-height: 38px; padding: 0 14px; font-weight: 800; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.tabs .on { background: var(--ink); color: #fff; border-color: var(--ink); }
h1 { margin: 0; letter-spacing: -0.03em; font-size: 26px; }
h2 { margin: 0 0 10px; letter-spacing: -0.02em; font-size: 20px; }
h3 { margin: 0 0 6px; font-size: 16px; }
.kicker { color: var(--blue); font-weight: 800; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 1.55; }
.err { background: #FFF1F2; color: #9F1239; border-radius: 10px; padding: 8px 10px; margin: 0; }
.ok { background: #ECFDF5; color: #065F46; border-radius: 10px; padding: 8px 10px; margin: 0; }
.warn { background: #FFF7E6; color: #6B4100; border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; border: 1px solid #F5D9A8; }
.info { background: var(--blue-soft); border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; }
.internal { background: #FFF1F2; color: #9F1239; border: 1px solid #FECDD3; border-radius: 12px; padding: 8px 12px; font-weight: 700; margin: 0 0 12px; }
label { display: grid; gap: 4px; font-weight: 700; font-size: 13px; }
label.check { display: flex; gap: 8px; align-items: center; font-weight: 600; }
label.check input { width: auto; min-height: 0; }
input, textarea, select { min-height: 42px; border: 1px solid var(--line2); border-radius: 10px; padding: 8px 10px; background: #fff; width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: var(--blue); }
textarea { min-height: 70px; resize: vertical; }
.btn { background: var(--blue); color: #fff; border: 0; border-radius: 10px; min-height: 42px; padding: 0 16px; font-weight: 800; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn.dark { background: var(--ink); }
.btn.wa { background: #1A7F37; }
.btn.danger { background: #BE123C; }
.btn:disabled { opacity: .6; cursor: wait; }
.ghost { background: #fff; border: 1px solid var(--line2); border-radius: 10px; min-height: 38px; padding: 0 12px; cursor: pointer; font-weight: 700; text-decoration: none; display: inline-flex; align-items: center; gap: 6px; color: var(--ink); white-space: nowrap; }
.ghost.sm { min-height: 30px; padding: 0 9px; font-size: 12.5px; }
.linkish { background: none; border: 0; padding: 0; color: var(--blue); cursor: pointer; font-weight: 700; text-align: left; }
header#top { display: flex; gap: 8px; align-items: center; padding: 8px 14px; background: var(--ink); color: #fff; position: sticky; top: 0; z-index: 10; flex-wrap: wrap; }
header#top .logo { color: #fff; font-weight: 800; font-size: 19px; text-decoration: none; display: flex; align-items: center; gap: 8px; }
header#top .logo img { width: 26px; height: 26px; }
header#top .ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.3); }
#menu { display: none; }
.grow { flex: 1; }
.pill { background: rgba(255,255,255,.12); color: #fff; border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 800; white-space: nowrap; text-decoration: none; }
.pill.off { background: #FDE7C8; color: #7A4300; }
.pill.trial { background: #DCE7FF; color: #1D3FA8; }
.shell { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 54px); }
nav#nav { display: flex; flex-direction: column; gap: 2px; padding: 10px; background: #fff; border-right: 1px solid var(--line); }
nav#nav a { text-decoration: none; color: var(--ink); border-radius: 10px; min-height: 38px; padding: 0 12px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
nav#nav a.on { background: var(--blue-soft); color: var(--blue); }
nav#nav a .lock { margin-left: auto; font-size: 11px; opacity: .65; }
nav#nav .sep { height: 1px; background: var(--line); margin: 6px 0; }
nav#nav .grp { font-size: 11px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 8px 12px 2px; }
main { padding: 16px; min-width: 0; max-width: 1280px; }
.box { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px; }
.box + .box, .box + .grid, .grid + .box, .kpis + .box, .kpis + .grid, .grid + .grid { margin-top: 12px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid2 { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }
.kpis { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi { display: grid; gap: 2px; }
.kpi span { color: var(--muted); font-size: 13px; font-weight: 700; }
.kpi b { font-size: 24px; letter-spacing: -0.02em; }
.kpi small { color: var(--muted); }
.head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.head h1 { margin-right: auto; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.row > * { flex: 1 1 170px; }
.row > button, .row > .btn, .row > .ghost, .row > .shrink { flex: 0 0 auto; }
.form-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
td, th { text-align: left; padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
td.r, th.r, .r { text-align: right; }
td.nw { white-space: nowrap; }
tr.click { cursor: pointer; }
tr.click:hover td { background: #F8FAFF; }
tfoot td { font-weight: 800; border-top: 2px solid var(--ink); }
.tag { display: inline-block; border-radius: 999px; padding: 2px 8px; font-size: 12px; font-weight: 800; background: var(--blue-soft); color: #1D3FA8; white-space: nowrap; }
.tag.green { background: #DCFCE7; color: #166534; } .tag.red { background: #FFE4E6; color: #9F1239; } .tag.gray { background: #EEF2F6; color: #475569; } .tag.amber { background: #FEF3C7; color: #92400E; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 60; max-width: 92vw; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.toast.bad { background: #9F1239; }
.drawer-bg { position: fixed; inset: 0; background: rgba(11,31,51,.45); z-index: 40; display: flex; justify-content: flex-end; }
.drawer { width: min(620px, 100%); height: 100%; overflow-y: auto; background: var(--paper); padding: 16px; display: grid; gap: 12px; align-content: start; }
.drawer .dh { display: flex; align-items: center; gap: 8px; }
.drawer .dh h2 { margin: 0 auto 0 0; }
.bars { display: flex; align-items: flex-end; gap: 10px; height: 170px; padding-top: 10px; }
.bars .b { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; justify-content: flex-end; font-size: 12px; }
.bars .b i { display: block; width: 100%; max-width: 54px; background: var(--blue); border-radius: 8px 8px 2px 2px; min-height: 2px; }
.bars .b small { color: var(--muted); }
.lines-ed { display: grid; gap: 8px; }
.line-ed { display: grid; grid-template-columns: 2.2fr 2fr .8fr 1fr .9fr 1fr auto; gap: 6px; align-items: end; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 8px; }
.line-ed .tot { font-weight: 800; text-align: right; padding-bottom: 10px; }
.line-ed .hint { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.totals { margin-left: auto; width: min(340px, 100%); }
.totals td { padding: 5px 8px; }
.totals tr.g td { font-size: 18px; font-weight: 800; border-top: 2px solid var(--ink); }
.board { display: grid; grid-template-columns: repeat(6, minmax(200px, 1fr)); gap: 10px; overflow-x: auto; padding-bottom: 6px; }
.lane { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 10px; min-height: 200px; }
.lane .lh { display: flex; justify-content: space-between; font-weight: 800; font-size: 13px; margin-bottom: 6px; }
.deal { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 8px 0; display: grid; gap: 4px; }
.deal select { min-height: 32px; padding: 2px 6px; font-size: 13px; }
.code { font-family: ui-monospace, Menlo, monospace; background: #0B1F33; color: #DCE7FF; padding: 12px; border-radius: 12px; font-size: 12px; overflow: auto; max-height: 420px; white-space: pre; }
.empty { text-align: center; color: var(--muted); padding: 24px; }
.plans { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.plan { border: 2px solid var(--line); border-radius: 16px; padding: 14px; background: #fff; display: grid; gap: 6px; align-content: start; }
.plan.cur { border-color: var(--blue); }
.plan .price { font-size: 26px; font-weight: 800; }
.plan ul { margin: 0; padding-left: 18px; font-size: 13px; }
.plans-mini { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; display: grid; gap: 6px; }
.plans-mini ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.plans-mini li { display: flex; justify-content: space-between; gap: 8px; }
.steps { display: grid; gap: 6px; padding-left: 20px; margin: 0; }
@media (max-width: 1000px) { .line-ed { grid-template-columns: 1fr 1fr 1fr; } .line-ed .desc { grid-column: span 2; } }
@media (max-width: 860px) {
  #menu { display: inline-flex; }
  .shell { grid-template-columns: 1fr; }
  nav#nav { display: none; position: fixed; top: 54px; left: 0; bottom: 0; width: min(280px, 85vw); z-index: 30; overflow-y: auto; box-shadow: 10px 0 30px rgba(0,0,0,.2); }
  nav#nav.open { display: flex; }
  .hide-sm { display: none !important; }
  main { padding: 10px; }
  .grid2 { grid-template-columns: 1fr; }
  .kpi b { font-size: 20px; }
  h1 { font-size: 22px; }
  .board { grid-template-columns: repeat(6, 82vw); }
}
@media (max-width: 560px) { .line-ed { grid-template-columns: 1fr 1fr; } .line-ed .desc, .line-ed .prod { grid-column: span 2; } td, th { padding: 6px; } }
/* Multiempresa: selector de empresa en la barra superior */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.pill.co-sw { padding: 2px 6px; }
.pill.co-sw select { background: transparent; color: inherit; border: 0; font: inherit; font-weight: 800; max-width: 230px; cursor: pointer; }
.pill.co-sw select option { color: #111; }
/* Libros electrónicos y conciliación bancaria */
.pos { color: #0a7a3d; font-variant-numeric: tabular-nums; }
.neg { color: #b42318; font-variant-numeric: tabular-nums; }
button.link { background: none; border: 0; padding: 0; color: var(--blue); cursor: pointer; font-weight: 700; font-size: 12px; text-align: left; min-height: 0; }
button.link:hover { text-decoration: underline; }
.warn-t { color: #6B4100; }
#rc-lines tr.conciliado td { background: #F3FBF6; }
#rc-lines tr.ignorado td { color: #6b7385; }
.rc-grid { align-items: start; }
.rc-grid .table-wrap { max-height: 560px; overflow: auto; }
#books code { word-break: break-all; }
