/* =========================================================
   DATHIUM — sistema por rubro (menú de módulos + vistas)
   ========================================================= */
.rm { position: relative; overflow: hidden; border-radius: 24px; background: #fff; border: 1px solid #e1e8f2; box-shadow: 0 40px 80px -40px rgba(16, 29, 53, .5); }
.rm__win { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid #edf1f7; font-size: 14px; }
.rm__win b { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm__count { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 99px; background: color-mix(in srgb, var(--acc) 9%, #fff); color: var(--acc); font-size: 12px; font-weight: 700; white-space: nowrap; }
.rm__count .i { width: 14px; height: 14px; }
.rm__app { display: grid; grid-template-columns: 210px minmax(0, 1fr); min-height: 560px; }
.rm__nav { display: flex; flex-direction: column; gap: 4px; padding: 14px 10px; background: linear-gradient(180deg, #101d35, #0d2a5c); }
.rm__nav button { position: relative; display: flex; align-items: center; gap: 10px; padding: 11px 12px; border: 0; border-radius: 12px; background: none; color: #b8c6e0; font-size: 13.5px; font-weight: 600; text-align: left; transition: background .15s, color .15s; }
.rm__nav button .i { flex: none; width: 18px; height: 18px; }
.rm__nav button:hover { background: rgba(255, 255, 255, .07); color: #fff; }
.rm__nav button.is-on { background: #fff; color: var(--navy-900); box-shadow: 0 8px 20px -10px rgba(0, 0, 0, .5); }
.rm__nav button.is-on .i { color: var(--acc); }
.rm__nav button:first-child::after { content: "Principal"; margin-left: auto; padding: 2px 6px; border-radius: 8px; background: rgba(255, 255, 255, .12); font-size: 9.5px; letter-spacing: .04em; text-transform: uppercase; }
.rm__nav button.is-on:first-child::after { background: color-mix(in srgb, var(--acc) 12%, #fff); color: var(--acc); }
.rm__main { min-width: 0; background: #f6f8fc; }
.rm__view { animation: phIn .25s ease; }
.rm__view:not([data-v="main"]) { padding: 18px; }
.rm__view[hidden] { display: none; }
/* La demo principal pierde su marco propio dentro del sistema */
.rm .rbx { border: 0; border-radius: 0; box-shadow: none; background: transparent; }
.rm .rbx__bar { display: none; }
.rm .rbx__steps { background: #fff; }

.rm__head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.rm__head > span { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 12px; background: linear-gradient(135deg, var(--acc), color-mix(in srgb, var(--acc) 60%, #101d35)); color: #fff; box-shadow: 0 10px 20px -10px var(--acc); }
.rm__head b { display: block; font-family: var(--font-head); font-size: 17px; }
.rm__head small { color: var(--muted); font-size: 13px; }
.rm h6 { margin: 0 0 10px; font-family: var(--font); font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.rm h6.mt { margin-top: 16px; }
.rm__muted { margin: 0 0 10px; color: var(--muted); font-size: 13px; }
.rm__empty { padding: 20px; text-align: center; color: var(--muted); }
.rm__bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.rm__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.rm__chips button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 99px; background: #fff; font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.rm__chips button em { padding: 0 6px; border-radius: 99px; background: var(--bg-soft); font-style: normal; font-size: 11px; }
.rm__chips button.is-on { border-color: var(--acc); background: var(--acc); color: #fff; }
.rm__chips button.is-on em { background: rgba(255, 255, 255, .2); }
.rm__btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 14px; border: 0; border-radius: 12px; background: var(--acc); color: #fff; font-size: 13px; font-weight: 700; white-space: nowrap; box-shadow: 0 8px 16px -10px var(--acc); }
.rm__btn .i { width: 15px; height: 15px; }
.rm__btn--sm { padding: 6px 11px; font-size: 12px; }
.rm__btn--ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.rm__ico { display: grid; place-items: center; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: #16a34a; }
.rm__new { margin-top: 12px; }
.rm__pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border: 0; border-radius: 99px; font-size: 11.5px; font-weight: 700; white-space: nowrap; }
.rm__pill .i { width: 12px; height: 12px; }
.rm__pill.ok { background: var(--green-50); color: var(--green); }
.rm__pill.warn { background: var(--amber-50); color: var(--amber); }
.rm__pill.bad { background: var(--red-50); color: var(--red); }
.rm__pill.info { background: var(--blue-50); color: var(--blue-600); }
button.rm__pill { cursor: pointer; }
.rm__sbar { display: inline-block; width: 64px; height: 7px; margin-right: 8px; border-radius: 99px; background: #e8edf4; overflow: hidden; vertical-align: middle; }
.rm__sbar i { display: block; height: 100%; border-radius: inherit; background: var(--green); transition: width .4s; }
.rm__sbar i.warn { background: #f59e0b; }
.rm__sbar i.bad { background: var(--red); }
.rm__sbar i.info { background: var(--blue-600); }
.rm__sbar--w { width: 100%; margin: 0; }
.rm__tbl { overflow-x: auto; border-radius: 16px; background: #fff; border: 1px solid #e5eaf2; }
.rm__tbl table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rm__tbl th { padding: 10px 14px; background: #f8fafc; text-align: left; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); white-space: nowrap; }
.rm__tbl td { padding: 11px 14px; border-top: 1px solid #eef2f7; white-space: nowrap; }
.rm__kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.rm__kpis--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.rm__kpis > div { padding: 14px; border-radius: 16px; background: #fff; border: 1px solid #e5eaf2; min-width: 0; }
.rm__kpis small { display: block; color: var(--muted); font-size: 12px; }
.rm__kpis b { display: block; margin-top: 2px; font-family: var(--font-head); font-size: 20px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm__kpis em { font-style: normal; font-size: 11.5px; font-weight: 700; color: var(--green); }
.rm .neg { color: var(--red); }
.rm__2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.rm__box { padding: 16px; border-radius: 16px; background: #fff; border: 1px solid #e5eaf2; min-width: 0; }
.rm__mb { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 10px; padding: 7px 0; font-size: 13px; }
.rm__mb--2 { grid-template-columns: 1fr auto; border-bottom: 1px dashed #eef2f7; }
.rm__mb--rec { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto; border-bottom: 1px solid #f1f4f8; }
.rm__mb--rec small { display: block; color: var(--muted); font-size: 11.5px; }
.rm__mb--rec b { white-space: nowrap; }
.rm__arq { display: flex; gap: 10px; align-items: center; padding: 12px; margin-bottom: 10px; border-radius: 12px; }
.rm__arq.ok { background: var(--green-50); color: var(--green); }
.rm__arq.warn { background: var(--amber-50); color: var(--amber); }
.rm__arq small { display: block; color: var(--muted); }

/* Tablero */
.rm__board { display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 10px; }
.rm__col { display: grid; align-content: start; gap: 8px; min-height: 280px; padding: 10px; border-radius: 16px; background: #eef2f8; }
.rm__col h6 { display: flex; align-items: center; gap: 7px; margin: 0 0 2px; color: var(--ink-2); }
.rm__col h6 i { width: 8px; height: 8px; border-radius: 50%; }
.rm__col h6 em { margin-left: auto; padding: 1px 7px; border-radius: 99px; background: #fff; font-style: normal; }
.rm__card { padding: 12px; border-radius: 12px; background: #fff; border-left: 3px solid var(--c); box-shadow: 0 4px 12px -8px rgba(16, 29, 53, .35); font-size: 12.5px; animation: phIn .25s ease; }
.rm__card b { display: block; }
.rm__card small { display: block; margin-top: 2px; color: var(--muted); }
.rm__cfoot { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 10px; }
.rm__cfoot em { font-style: normal; font-weight: 700; }
.rm__cfoot button { display: inline-flex; align-items: center; gap: 3px; padding: 5px 9px; border: 0; border-radius: 8px; background: var(--c); color: #fff; font-size: 11.5px; font-weight: 700; }
.rm__cfoot button .i { width: 12px; height: 12px; }
.rm__none { margin: 6px 0; font-size: 12px; color: #94a3b8; text-align: center; }

/* Gráficos */
.rm__chart { display: flex; align-items: flex-end; gap: 8px; height: 170px; }
.rm__chart > div { flex: 1; display: grid; grid-template-rows: 1fr auto; height: 100%; text-align: center; }
.rm__chart i { align-self: end; display: block; border-radius: 6px 6px 0 0; background: linear-gradient(180deg, var(--acc), color-mix(in srgb, var(--acc) 35%, #fff)); animation: rxGrow .6s ease both; transition: height .4s; }
.rm__chart small { margin-top: 6px; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm__top { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.rm__top li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 12px; background: var(--bg-soft); font-size: 13px; }
.rm__top li span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 8px; background: var(--acc); color: #fff; font-size: 11.5px; font-weight: 800; }
.rm__top li b { flex: 1; font-weight: 600; }
.rm__top li em { font-style: normal; font-weight: 700; }

/* Listas (cobranzas y cotizaciones) */
.rm__list { display: grid; gap: 8px; }
.rm__row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; background: #fff; border: 1px solid #e5eaf2; font-size: 13px; animation: phIn .25s ease; }
.rm__row > span:nth-child(2) b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rm__row > span:nth-child(2) small { color: var(--muted); font-size: 12px; }
.rm__row > em { font-style: normal; font-weight: 800; white-space: nowrap; }
.rm__acts { display: flex; gap: 6px; }
.rm__av { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: color-mix(in srgb, var(--acc) 12%, #fff); color: var(--acc); font-style: normal; font-weight: 800; font-size: 12px; }
.rm__doc { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 12px; background: var(--bg-soft); color: var(--acc); }

/* Fichas */
.rm__sheet { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 12px; }
.rm__plist { display: grid; align-content: start; gap: 8px; }
.rm__plist button { display: grid; justify-items: start; gap: 2px; padding: 12px; border: 1px solid #e5eaf2; border-radius: 12px; background: #fff; text-align: left; font-size: 13px; transition: border-color .15s; }
.rm__plist button small { color: var(--muted); font-size: 12px; }
.rm__plist button .rm__pill { margin-top: 6px; }
.rm__plist button.is-on { border-color: var(--acc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 14%, transparent); }
.rm__fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.rm__fields label { padding: 9px 11px; border-radius: 12px; background: var(--bg-soft); border: 1px solid #e8edf4; }
.rm__fields small { display: block; color: var(--muted); font-size: 11px; }
.rm__fields span { font-weight: 600; font-size: 13px; }
.rm__toggles { display: grid; gap: 6px; margin-bottom: 12px; }
.rm__tg { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 4px; border: 0; background: none; font-size: 13px; text-align: left; color: var(--ink); }
.rm__tg i { position: relative; flex: none; width: 34px; height: 20px; border-radius: 99px; background: #d5dbe6; transition: background .2s; }
.rm__tg i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .2s; }
.rm__tg.is-on i { background: var(--acc); }
.rm__tg.is-on i::after { transform: translateX(14px); }
.rm__recfoot { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; font-size: 13px; }
.rm__gh { margin-top: 6px !important; }
.rm__cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.rm__fc { display: grid; justify-items: start; gap: 2px; padding: 14px; border-radius: 16px; background: #fff; border: 1px solid #e5eaf2; font-size: 13px; }
.rm__fcico { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 6px; border-radius: 12px; background: color-mix(in srgb, var(--acc) 10%, #fff); color: var(--acc); }
.rm__fc small { color: var(--muted); font-size: 12px; }
.rm__fc p { margin: 4px 0 0; font-size: 11.5px; color: var(--muted); }
.rm__fc .rm__pill { margin-top: 10px; }
.rm__plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.rm__plans > div { position: relative; padding: 16px; border-radius: 16px; background: #fff; border: 1px solid #e5eaf2; }
.rm__plans > div:nth-child(2) { border-color: var(--acc); box-shadow: 0 0 0 3px color-mix(in srgb, var(--acc) 12%, transparent); }
.rm__plans b { display: block; font-size: 13px; color: var(--muted); }
.rm__plans strong { display: block; font-family: var(--font-head); font-size: 22px; }
.rm__plans strong small { font-family: var(--font); font-size: 12px; font-weight: 500; color: var(--muted); }
.rm__plans span { font-size: 12px; }
.rm__plans em { position: absolute; top: 12px; right: 12px; padding: 2px 8px; border-radius: 99px; background: var(--amber-50); color: var(--amber); font-style: normal; font-size: 10.5px; font-weight: 700; }

.rm__toast { position: absolute; left: 50%; bottom: 16px; z-index: 5; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 12px; background: var(--navy-900); color: #fff; font-size: 13px; box-shadow: var(--shadow); transform: translateX(-50%); animation: fadeUp .3s ease; }
.rm__toast .i { flex: none; color: #4ade80; }

@media (max-width: 980px) {
  .rm__app { grid-template-columns: 1fr; }
  .rm__nav { flex-direction: row; overflow-x: auto; padding: 8px; scrollbar-width: none; }
  .rm__nav button { flex: none; padding: 9px 12px; }
  .rm__nav button:first-child::after { display: none; }
  .rm__count { display: none; }
  .rm__2, .rm__sheet { grid-template-columns: 1fr; }
  .rm__board { grid-template-columns: repeat(var(--cols), minmax(190px, 1fr)); overflow-x: auto; }
}
@media (max-width: 640px) {
  .rm__view:not([data-v="main"]) { padding: 12px; }
  .rm__kpis, .rm__kpis--3, .rm__plans { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rm__row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .rm__row > .rm__pill { grid-column: 2; justify-self: start; }
  .rm__row > em { grid-column: 3; grid-row: 1; }
  .rm__row > .rm__acts { grid-column: 3; grid-row: 2; }
  .rm__fields { grid-template-columns: 1fr; }
  .rm__mb { grid-template-columns: 90px 1fr auto; }
  .rm__app { min-height: 0; }
}
@keyframes rxGrow { from { height: 0; } }
