/* =========================================================================
   NOVA Enterprise Design System (evolución del Incremento 1)
   Inspirado en SAP Fiori Horizon, sin recursos de SAP. #126A83 · #123647.
   ========================================================================= */
:root {
  --brand: #126A83; --brand-hover: #0f5a70; --brand-active: #0c4a5c; --brand-soft: #e4f1f5; --brand-soft-2: #cfe6ee;
  --nav: #123647; --nav-2: #1a4558; --nav-3: #23566c; --nav-text: #d6e3ea;
  --bg: #f4f6f8; --surface: #fff; --surface-2: #f8fafb; --border: #d7dee4; --border-strong: #b7c3cc;
  --text: #1c2b36; --text-2: #4f6474; --text-3: #7a8b98;
  --ok: #1f7a3d; --ok-bg: #e5f4ea; --warn: #9a4b00; --warn-bg: #fdf0e1; --err: #b0201a; --err-bg: #fbe9e8;
  --info: #126A83; --info-bg: #e4f1f5; --neutral-bg: #edf0f2; --sync: #5b4a9c; --sync-bg: #efecf8;
  --radius: 10px; --shadow-1: 0 0 0 1px rgba(18,54,71,.06), 0 1px 3px rgba(18,54,71,.08); --shadow-2: 0 10px 30px rgba(18,54,71,.22);
  --shell-h: 52px; --nav-w: 232px; --nav-w-c: 64px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--brand); text-decoration: none; } a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
[hidden] { display: none !important; }
.ic { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.ic-sm { width: 16px; height: 16px; }

/* ---------------------------------------------------------------- Shell */
.shellbar { position: fixed; inset: 0 0 auto 0; height: var(--shell-h); z-index: 40; display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--nav); color: #fff; box-shadow: 0 2px 6px rgba(0,0,0,.18); }
.sb-btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; min-width: 36px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: #fff; }
.sb-btn:hover { background: var(--nav-2); text-decoration: none; }
.sb-brand { display: flex; align-items: center; gap: 10px; color: #fff; min-width: 0; }
.sb-brand:hover { text-decoration: none; }
.sb-logo { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; background: var(--brand); flex: none; }
.sb-logo svg { width: 22px; height: 22px; }
.sb-title { font-size: 15px; white-space: nowrap; } .sb-title strong { font-weight: 650; }
.sb-badge { font-size: 11.5px; padding: 3px 8px; border-radius: 999px; background: rgba(255,255,255,.12); color: var(--nav-text); white-space: nowrap; }
.sb-spacer { flex: 1; }
.sb-persona { display: flex; align-items: center; gap: 6px; height: 36px; padding: 0 4px 0 10px; border-radius: 8px; background: var(--nav-2); color: var(--nav-text); }
.sb-persona select { background: transparent; border: 0; color: #fff; height: 34px; font-weight: 600; max-width: 240px; cursor: pointer; }
.sb-persona select option { color: var(--text); }
.sidenav { position: fixed; top: var(--shell-h); bottom: 0; left: 0; width: var(--nav-w); z-index: 30; background: var(--nav); color: var(--nav-text); display: flex; flex-direction: column; overflow-y: auto; }
.sidenav ul { list-style: none; margin: 0; padding: 10px 8px; }
.sidenav a, .sidenav .rc1-nav a { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 6px 12px; border-radius: 8px; color: var(--nav-text); white-space: normal; position: relative; text-transform: none; letter-spacing: normal; font-size: 14px; line-height: 1.3; }
.sidenav a:hover { background: var(--nav-2); color: #fff; text-decoration: none; }
.sidenav a:focus-visible { outline: 3px solid #5fc1dc; outline-offset: -3px; }
.sidenav a.active { background: var(--nav-3); color: #fff; font-weight: 600; }
.sidenav a.active::before { content: ""; position: absolute; left: 0; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: #5fc1dc; }
.sidenav .nav-enlaces, .sidenav .rc1-nav { padding: 4px 8px; }
.sidenav .rc1-nav h2 { font-size: 11px; color: #8fb0c0; padding: 8px 12px; }
.sidenav .ic { flex-shrink: 0; }
.sidenav .cnt { margin-left: auto; font-size: 11.5px; background: rgba(255,255,255,.14); padding: 0 7px; border-radius: 999px; }
.nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #8fb0c0; padding: 16px 12px 6px; }
.nav-foot { margin-top: auto; padding: 10px 16px 12px; border-top: 1px solid rgba(255,255,255,.08); font-size: 11.5px; color: #8fb0c0; }
.content { margin-left: var(--nav-w); padding-top: var(--shell-h); min-height: 100vh; }
.page-head { background: var(--surface); border-bottom: 1px solid var(--border); padding: 14px 28px 16px; }
.crumbs { font-size: 12.5px; color: var(--text-2); display: flex; gap: 6px; flex-wrap: wrap; }
.ph-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 6px; }
.ph-row h1 { margin: 0; font-size: 22px; font-weight: 650; }
.ph-actions { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; }
.ph-sub { margin: 4px 0 0; color: var(--text-2); }
.ph-facts { display: flex; flex-wrap: wrap; gap: 10px 32px; margin-top: 12px; }
.fact .k { font-size: 12px; color: var(--text-2); } .fact .v { font-size: 15px; font-weight: 600; margin-top: 2px; }
.page-body { padding: 20px 28px 40px; display: grid; gap: 18px; }

/* ---------------------------------------------------------------- Componentes */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px; border-radius: 8px; font-weight: 600; font-size: 13.5px; border: 1px solid var(--brand); background: var(--surface); color: var(--brand); white-space: nowrap; }
.btn:hover { background: var(--brand-soft); text-decoration: none; }
.btn-primary { background: var(--brand); color: #fff; } .btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { border-color: transparent; background: transparent; } .btn-ghost:hover { background: var(--brand-soft); }
.btn-danger { border-color: var(--err); color: var(--err); } .btn-danger:hover { background: var(--err-bg); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 12.5px; }
.btn[disabled], .btn.busy { opacity: .45; cursor: not-allowed; pointer-events: none; }
.btn .ic { width: 18px; height: 18px; }
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-1); min-width: 0; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px 10px; flex-wrap: wrap; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.card-head .sub { color: var(--text-2); font-size: 12.5px; } .card-head .right { margin-left: auto; display: flex; gap: 8px; }
.card-body { padding: 4px 18px 18px; } .card-body.flush { padding: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.kpi { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-1); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; color: inherit; min-height: 104px; }
a.kpi:hover { text-decoration: none; box-shadow: 0 0 0 2px var(--brand-soft-2), var(--shadow-1); }
.kpi .k { font-size: 12.5px; color: var(--text-2); display: flex; gap: 6px; align-items: center; } .kpi .k .ic { width: 16px; height: 16px; color: var(--brand); }
.kpi .v { font-size: 28px; font-weight: 650; line-height: 1.15; } .kpi .d { font-size: 12px; color: var(--text-2); margin-top: auto; }
.strip { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: 8px; background: var(--info-bg); color: #0d4d5f; border: 1px solid var(--brand-soft-2); font-size: 13px; }
.strip .ic { color: var(--brand); margin-top: 1px; }
.strip.warn { background: var(--warn-bg); border-color: #f2d3ad; color: #6d3600; } .strip.warn .ic { color: var(--warn); }
.strip.err { background: var(--err-bg); border-color: #f1c4c1; color: var(--err); } .strip.err .ic { color: var(--err); }
.strip.ok { background: var(--ok-bg); border-color: #bfe0c9; color: var(--ok); } .strip.ok .ic { color: var(--ok); }
.filterbar { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; padding: 14px 18px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 150px; } .field > span { font-size: 12px; color: var(--text-2); } .field.grow { flex: 1 1 220px; }
.input, .select, .textarea { height: 34px; border: 1px solid var(--border-strong); border-radius: 8px; padding: 0 10px; background: var(--surface); width: 100%; }
.textarea { height: auto; min-height: 64px; padding: 8px 10px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft-2); }
.input.num { text-align: right; width: 96px; }
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th, .tbl td { padding: 0 10px; height: 38px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl th { height: 36px; font-weight: 600; font-size: 12px; color: var(--text-2); background: var(--surface-2); }
.tbl td.num, .tbl th.num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.wrap { white-space: normal; min-width: 200px; }
.tbl tbody tr:hover { background: #f1f7f9; } .tbl tbody tr[data-href] { cursor: pointer; }
.tbl tfoot td { font-weight: 650; background: var(--surface-2); }
/* Arranque: cada control queda dentro de su columna; las presentaciones se apilan. */
.tbl.c04-arranque { min-width: 1040px; table-layout: fixed; }
.tbl.c04-arranque td { white-space: normal; vertical-align: top; padding: 10px 8px; }
.tbl.c04-arranque th { white-space: normal; }
.c04-arranque th:nth-child(1) { width: 17%; }
.c04-arranque th:nth-child(2) { width: 23%; }
.c04-arranque th:nth-child(3) { width: 15%; }
.c04-arranque th:nth-child(4) { width: 10%; }
.c04-arranque th:nth-child(5) { width: 26%; }
.c04-arranque th:nth-child(6) { width: 9%; }
.c04-arranque label { display: block; margin-bottom: 8px; }
.c04-arranque .input, .c04-arranque .select { display: block; min-width: 0; width: 100%; margin: 5px 0; }
.code { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.muted { color: var(--text-2); } .small { font-size: 12px; } .strong { font-weight: 600; }
.empty { padding: 32px 20px; text-align: center; color: var(--text-2); } .empty h3 { margin: 0 0 4px; color: var(--text); font-size: 15px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; line-height: 18px; white-space: nowrap; background: var(--neutral-bg); color: var(--text-2); }
.badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.badge.ok { background: var(--ok-bg); color: var(--ok); } .badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); } .badge.info { background: var(--info-bg); color: var(--info); }
.badge.sync { background: var(--sync-bg); color: var(--sync); }
.nv { display: inline-block; padding: 0 6px; border-radius: 4px; font-size: 11.5px; font-weight: 600; color: #6a4f8a; background: #f1ecf7; border: 1px dashed #c9b8de; }
.prov { display: inline-block; padding: 0 5px; border-radius: 4px; font-size: 11px; font-weight: 700; color: var(--warn); background: var(--warn-bg); margin-left: 4px; }
.neg { color: var(--err); font-weight: 650; }
.co-tag { display: inline-block; min-width: 50px; text-align: center; padding: 1px 6px; border-radius: 4px; font-size: 11.5px; font-weight: 700; background: var(--brand-soft); color: var(--brand); }
.dl { display: grid; grid-template-columns: 170px 1fr; gap: 8px 14px; margin: 0; } .dl dt { color: var(--text-2); } .dl dd { margin: 0; }
.hist { list-style: none; margin: 0; padding: 0; } .hist li { display: flex; gap: 12px; padding: 8px 18px; border-top: 1px solid var(--border); font-size: 13px; } .hist li:first-child { border-top: 0; } .hist .t { color: var(--text-2); min-width: 130px; }
.overlay { position: fixed; inset: 0; z-index: 80; background: rgba(12,32,43,.45); display: grid; place-items: center; padding: 16px; }
.dialog { background: var(--surface); border-radius: 12px; box-shadow: var(--shadow-2); width: min(560px, 100%); max-height: calc(100vh - 32px); overflow: auto; }
.dlg-head { display: flex; align-items: center; gap: 10px; padding: 16px 20px; border-bottom: 1px solid var(--border); } .dlg-head h2 { margin: 0; font-size: 17px; }
.dlg-body { padding: 16px 20px; display: grid; gap: 12px; }
/* AUD-CON02 D01: diálogos que no usan UI.dlg reciben márgenes internos */
.dialog:not(:has(> .dlg-head, > .dlg-body)) { padding: 16px 20px; display: grid; gap: 12px; align-content: start; }
.dialog:not(:has(> .dlg-head, > .dlg-body)) > h2 { margin: 0; font-size: 17px; } .dlg-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 20px; border-top: 1px solid var(--border); background: var(--surface-2); }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 30px); z-index: 90; background: var(--nav); color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: var(--shadow-2); opacity: 0; pointer-events: none; transition: all .2s; max-width: calc(100vw - 32px); display: flex; gap: 10px; align-items: flex-start; }
.toast.show { opacity: 1; transform: translate(-50%, 0); } .toast .ic { color: #7fd6a0; } .toast.err .ic { color: #ffaaa5; } .toast.sync .ic { color: #c9bdf2; }
.toast small { display: block; opacity: .8; }
.page-foot { padding: 0 28px 28px; color: var(--text-3); font-size: 12px; }
.firma-box { border: 2px dashed var(--border-strong); border-radius: 12px; background: #fff; touch-action: none; position: relative; }
.firma-box canvas { display: block; width: 100%; height: 160px; }
.firma-box .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--text-3); pointer-events: none; font-size: 14px; }
.firma-svg { width: 260px; height: 100px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }

@media (max-width: 1199px) {
  .sidenav { width: var(--nav-w-c); overflow-x: hidden; } .sidenav a span, .sidenav .nav-group, .nav-foot, .sidenav .cnt, .sidenav .rc1-nav h2 { display: none; }
  .sidenav a, .sidenav .rc1-nav a { justify-content: center; padding: 6px 0; } .content { margin-left: var(--nav-w-c); }
}
@media (max-width: 900px) { .grid-2 { grid-template-columns: 1fr; } .sb-badge { display: none; } }
@media (max-width: 767px) {
  .sidenav { display: none; } .content { margin-left: 0; } .sb-title { display: none; }
  .page-head { padding: 12px 16px; } .page-body { padding: 14px 16px 28px; } .ph-actions { margin-left: 0; }
  .dl { grid-template-columns: 1fr; }
}

/* =========================================================================
   NOVA Mobile (Directriz M-01 a M-12)
   ========================================================================= */
body.mode-mobile { background: #0d2834; }
body.mode-mobile .shellbar, body.mode-mobile .sidenav, body.mode-mobile .content { display: none; }
.mobile { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 16px; gap: 10px; }
.m-desk-hint { display: flex; gap: 16px; align-items: center; color: #a9c4d1; font-size: 13px; } .m-desk-hint a { color: #fff; font-weight: 600; }
.m-frame { width: 400px; max-width: 100%; height: min(820px, calc(100vh - 76px)); height: min(820px, calc(100dvh - 76px)); background: var(--bg); border-radius: 28px; overflow: hidden; box-shadow: 0 0 0 10px #071820, 0 20px 50px rgba(0,0,0,.5); display: flex; flex-direction: column; }
@media (max-width: 640px) {
  body.mode-mobile { background: var(--bg); } .mobile { padding: 0; } .m-desk-hint { display: none; }
  .m-frame { width: 100%; height: 100vh; height: 100dvh; border-radius: 0; box-shadow: none; }
}
.m-top { background: var(--nav); color: #fff; flex: none; padding: 6px 8px 8px; padding-top: max(6px, env(safe-area-inset-top)); }
.m-top-row { display: flex; align-items: center; gap: 4px; min-height: 48px; }
.m-top h1 { font-size: 18px; margin: 0; font-weight: 650; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-step { font-size: 13px; color: var(--nav-text); padding-right: 6px; white-space: nowrap; }
.m-iconbtn { width: 48px; height: 48px; border-radius: 12px; border: 0; background: transparent; color: #fff; display: grid; place-items: center; flex: none; }
.m-iconbtn:hover { background: var(--nav-2); } .m-iconbtn .ic { width: 26px; height: 26px; }
.m-who { display: flex; align-items: center; gap: 8px; padding: 0 6px; font-size: 13px; color: var(--nav-text); flex-wrap: wrap; }
.m-who b { color: #fff; font-weight: 600; }
.m-who a, .m-who button { min-height: 44px; min-width: 44px; display: inline-flex; align-items: center; justify-content: center; }
.m-pill { display: inline-flex; align-items: center; gap: 5px; border: 0; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 700; background: rgba(255,255,255,.14); color: #fff; min-height: 28px; }
.m-pill.off { background: #f2c38a; color: #4a2600; } .m-pill.sync { background: #c9bdf2; color: #2c1f63; } .m-pill.err { background: #ffb3ad; color: #5c0b06; }
.m-pill .ic { width: 15px; height: 15px; }
.m-tools { flex: none; display: grid; gap: 10px; padding: 12px 16px 10px; background: var(--bg); border-bottom: 1px solid var(--border); }
.m-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; overscroll-behavior: contain; scrollbar-width: thin; }
.m-body > * { flex-shrink: 0; }
.m-foot { flex: none; padding: 12px 16px; padding-bottom: max(12px, env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--border); display: grid; gap: 8px; }
.m-q { font-size: 20px; font-weight: 650; margin: 0; line-height: 1.25; }
.m-hint { color: var(--text-2); margin: 0; font-size: 14.5px; }
.m-label { font-size: 12.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); margin: 4px 0 -4px; }
.m-btn { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 58px; border-radius: 14px; border: 2px solid var(--brand); background: var(--surface); color: var(--brand); font-size: 18px; font-weight: 700; padding: 0 16px; }
.m-btn:hover { text-decoration: none; }
.m-btn.primary { background: var(--brand); color: #fff; } .m-btn.ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.m-btn.sec { min-height: 48px; font-size: 16px; }
.m-btn.danger { border-color: var(--err); color: var(--err); }
.m-btn[disabled], .m-btn.busy { background: #c9d3d9; border-color: #c9d3d9; color: #fff; cursor: not-allowed; }
/* Esperar confirmación sigue siendo un estado que debe poder leerse. */
.m-btn.busy[aria-busy="true"], .btn.busy[aria-busy="true"] { background: #edf3f5; border-color: #126a83; color: #123647; opacity: 1; cursor: progress; }
.b1-mobile .m-btn.primary.busy[aria-busy="true"] { background: #edf3f5; border-color: #126a83; color: #123647; }
.m-btn .ic { width: 24px; height: 24px; }
.m-tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.m-tile { min-height: 112px; border-radius: 16px; border: 0; background: var(--surface); box-shadow: var(--shadow-1); display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; padding: 14px; text-align: left; color: var(--text); position: relative; }
.m-tile:hover { text-decoration: none; } .m-tile b { font-size: 17px; }
.m-tile .ti { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); } .m-tile .ti .ic { width: 28px; height: 28px; }
.m-tile .n { position: absolute; top: 12px; right: 12px; min-width: 30px; height: 30px; border-radius: 15px; background: var(--brand); color: #fff; font-weight: 750; display: grid; place-items: center; padding: 0 8px; }
.m-tile.wide { grid-column: 1 / -1; min-height: 72px; flex-direction: row; align-items: center; justify-content: flex-start; gap: 14px; }
.m-list { display: grid; gap: 10px; }
.m-opt { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 66px; padding: 10px 12px; border-radius: 14px; border: 2px solid transparent; background: var(--surface); box-shadow: var(--shadow-1); text-align: left; color: var(--text); }
.m-opt:hover { text-decoration: none; } .m-opt.on { border-color: var(--brand); background: #f3fafc; }
.m-opt.done { border-color: #bfe0c9; background: #f6fbf7; } .m-opt.dif { border-color: #f2d3ad; background: #fffaf3; } .m-opt.pend-sync { border-color: #c9bdf2; background: #f8f6fd; }
.m-opt .oi { width: 42px; height: 42px; border-radius: 12px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; }
.m-opt .ot { flex: 1; min-width: 0; }
.m-opt .ot b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 16px; line-height: 1.25; }
.m-opt .ot span { display: block; color: var(--text-2); font-size: 13.5px; margin-top: 2px; }
.m-opt .oq { text-align: right; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; } .m-opt .oq small { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); }
.m-row { display: flex; align-items: center; gap: 10px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-1); padding: 10px 12px; border: 2px solid transparent; }
.m-row.on { border-color: var(--brand); }
.m-row .ot { flex: 1; min-width: 0; } .m-row .ot b { display: block; font-size: 15.5px; line-height: 1.25; } .m-row .ot span { display: block; color: var(--text-2); font-size: 13px; }
.m-step-ctl { display: flex; align-items: center; gap: 6px; flex: none; }
.m-step-ctl button { width: 48px; height: 48px; border-radius: 12px; border: 2px solid var(--brand); background: var(--surface); color: var(--brand); display: grid; place-items: center; }
.m-step-ctl button .ic { width: 24px; height: 24px; stroke-width: 2.4; }
.m-step-ctl input { width: 64px; height: 48px; border-radius: 12px; border: 2px solid var(--border-strong); text-align: center; font-size: 19px; font-weight: 700; -moz-appearance: textfield; }
.m-step-ctl input::-webkit-outer-spin-button, .m-step-ctl input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.m-qty { display: grid; grid-template-columns: 72px 1fr 72px; gap: 10px; align-items: center; }
.m-qty button { height: 72px; border-radius: 18px; border: 2px solid var(--brand); background: var(--surface); color: var(--brand); display: grid; place-items: center; }
.m-qty button .ic { width: 32px; height: 32px; stroke-width: 2.4; }
.m-qty input { height: 84px; width: 100%; text-align: center; font-size: 40px; font-weight: 700; border-radius: 18px; border: 2px solid var(--border-strong); background: var(--surface); -moz-appearance: textfield; }
.m-qty input::-webkit-outer-spin-button, .m-qty input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.m-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.m-chip { min-height: 48px; padding: 0 16px; border-radius: 999px; border: 2px solid var(--border-strong); background: var(--surface); font-size: 16px; font-weight: 700; color: var(--text-2); flex: 1 0 auto; }
.m-chip.on { background: var(--brand); border-color: var(--brand); color: #fff; }
.m-card { background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-1); padding: 14px 16px; }
.m-card h2 { margin: 0 0 4px; font-size: 18px; }
.m-sum div { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 15.5px; }
.m-sum div:last-child { border-bottom: 0; } .m-sum span { color: var(--text-2); } .m-sum b { text-align: right; }
.m-state { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 20px 8px 8px; }
.m-state .circle { width: 92px; height: 92px; border-radius: 50%; display: grid; place-items: center; background: var(--ok); color: #fff; }
.m-state .circle .ic { width: 52px; height: 52px; stroke-width: 2.6; }
.m-state.sync .circle { background: var(--sync); } .m-state.err .circle { background: var(--err); }
.m-state h2 { margin: 4px 0 0; font-size: 23px; } .m-state p { margin: 0; color: var(--text-2); font-size: 15.5px; }
.m-banner { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; font-size: 14.5px; background: var(--info-bg); color: #0d4d5f; }
.m-banner .ic { flex: none; } .m-banner.warn { background: var(--warn-bg); color: #6d3600; } .m-banner.err { background: var(--err-bg); color: var(--err); }
.m-banner.ok { background: var(--ok-bg); color: var(--ok); } .m-banner.sync { background: var(--sync-bg); color: var(--sync); }
.m-search { position: relative; } .m-search > .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 22px; height: 22px; }
.m-search input { width: 100%; height: 50px; border-radius: 14px; border: 2px solid var(--border-strong); padding: 0 14px 0 46px; font-size: 17px; background: var(--surface); }
.m-search input:focus { outline: none; border-color: var(--brand); }
.m-searchrow { display: flex; gap: 8px; } .m-searchrow .m-search { flex: 1; }
.m-scan { flex: none; width: 60px; height: 50px; border-radius: 14px; border: 2px dashed var(--border-strong); background: var(--surface-2); color: var(--text-3); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 10.5px; font-weight: 700; text-transform: uppercase; cursor: help; }
.m-textarea { width: 100%; min-height: 70px; border-radius: 12px; border: 2px solid var(--border-strong); padding: 10px 12px; font-size: 16px; }
.m-foot-note { text-align: center; color: var(--text-3); font-size: 12.5px; margin-top: auto; padding-top: 8px; }
@media (max-height: 720px) {
  .m-body { padding: 12px 14px; gap: 10px; } .m-btn { min-height: 54px; font-size: 17px; } .m-btn.sec { min-height: 46px; }
  .m-opt { min-height: 58px; } .m-tile { min-height: 92px; } .m-qty button { height: 64px; } .m-qty input { height: 72px; font-size: 34px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Estado de conexión visible también en la vista móvil, sin cambiar sus pantallas. */
#estadoConexion { position:fixed; z-index:100; left:0; right:0; bottom:0; padding:10px 16px; background:#fff0ce; color:#123647; border-top:2px solid #c58a16; font-size:14px; }
#estadoConexion[hidden] { display:none; }
.mode-mobile #modoConexion { display:inline; }

/* D4 usa las mismas superficies, colores y tamaños de NOVA. */
.d4-acceso { position:fixed; inset:0; z-index:90; overflow:auto; background:var(--bg); padding:20px 16px; }
.d4-acceso[hidden] { display:none; }
.d4-bloqueado .shellbar,.d4-bloqueado #sidenav,.d4-bloqueado #view,.d4-bloqueado #mobile { visibility:hidden; }
.d4-marca { color:var(--nav); text-align:center; font-size:20px; margin:12px 0 24px; }
.d4-marca strong { display:block; font-size:14px; }
.d4-tarjeta,.d4-admin { max-width:520px; margin:auto; background:var(--surface); padding:20px; border-radius:16px; box-shadow:var(--shadow-1); }
.d4-admin { max-width:850px; }
.d4-acceso h1 { font-size:24px; }.d4-acceso h2,.d4-confirmar h2 { font-size:20px; }
.d4-acceso form,.d4-confirmar form { display:grid; gap:14px; }
.d4-acceso label,.d4-confirmar label { display:grid; gap:6px; font-weight:600; }
.d4-acceso input:not([type=checkbox]),.d4-acceso select,.d4-acceso textarea,.d4-confirmar input { width:100%; min-height:52px; padding:10px 12px; border:2px solid var(--border-strong); border-radius:10px; font-size:18px; }
.d4-acceso input[type=password],.d4-confirmar input { font-size:28px; text-align:center; letter-spacing:.3em; }
.d4-personas { display:grid; gap:10px; }.d4-acceso [role=alert] { color:var(--err); }
.d4-confirmar { border:0; border-radius:16px; width:min(420px,calc(100vw - 24px)); padding:24px; color:var(--text); background:var(--surface); }
.d4-confirmar::backdrop { background:rgba(7,24,32,.65); }
.d4-usuario { display:flex; align-items:center; gap:8px; font-size:13px; }.d4-usuario small { display:block; }
.shellbar [hidden] { display:none !important; }
/* Cabecera estrecha: controles en una fila e identidad en otra, sin superponer contenido. */
@media (max-width:900px) {
  :root { --shell-h:106px; }
  .shellbar { flex-wrap:wrap; align-content:center; gap:6px 8px; padding:6px 12px; }
  .shellbar .sb-brand { flex-shrink:0; min-height:44px; min-width:44px; }
  .shellbar .sb-btn { flex-shrink:0; height:44px; min-width:44px; white-space:nowrap; }
  .shellbar .sb-spacer { display:none; }
  .shellbar>a:last-child { margin-left:auto; }
  .shellbar .sb-persona,.shellbar .d4-usuario { order:1; flex:0 0 100%; min-width:0; height:44px; }
  .shellbar .sb-persona select { min-width:0; max-width:none; width:100%; height:44px; }
  .shellbar .d4-usuario>span { flex:1; min-width:0; }
  .shellbar .d4-usuario b,.shellbar .d4-usuario small { display:block; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
}
.d4-admin details { margin-top:16px; }.d4-admin summary { padding:12px 0; cursor:pointer; font-size:18px; }
.d4-acceso label.d4-check { display:flex; align-items:center; min-height:44px; font-weight:400; }.d4-check input { width:22px; height:22px; }
.m-list { grid-template-columns:minmax(0,1fr); }

/* CON03: tablas accesibles sin cortar acciones, controles y ventanas en móvil. */
.table-wrap{max-width:100%;overflow-x:auto}.table-wrap .tbl td:last-child:has(a.btn),.table-wrap .tbl td:last-child:has(button){position:sticky;right:0;background:var(--surface,#fff);z-index:1}.oc-totales{display:block;max-width:290px;white-space:normal;margin-top:8px} .production-frame{width:100%;height:calc(100vh - 200px);min-height:560px;border:0;background:white} @media(max-width:480px){.dlg{max-width:calc(100vw - 16px)}.production-frame{height:calc(100dvh - 150px)}.oc-totales{max-width:100%}}
