/* RConta Panel — UI idéntica a open-pos-demo (MUI / OpenPOS) */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --pos-primary: #0d9488;
  --pos-primary-hover: #0f766e;
  --pos-primary-soft: rgba(13, 148, 136, 0.12);
  --pos-secondary: #f59e0b;
  --pos-bg: #f4f6f8;
  --pos-paper: #ffffff;
  --pos-text: rgba(0, 0, 0, 0.87);
  --pos-text-secondary: rgba(0, 0, 0, 0.6);
  --pos-divider: rgba(0, 0, 0, 0.12);
  --pos-radius: 12px;
  --pos-radius-card: 16px;
  --pos-radius-btn: 10px;
  --pos-drawer: 248px;
  --pos-appbar-h: 64px;
  --pos-shadow: 0px 2px 1px -1px rgba(0,0,0,0.2), 0px 1px 1px 0px rgba(0,0,0,0.14), 0px 1px 3px 0px rgba(0,0,0,0.12);
  --pos-shadow-3: 0px 3px 3px -2px rgba(0,0,0,0.2), 0px 3px 4px 0px rgba(0,0,0,0.14), 0px 1px 8px 0px rgba(0,0,0,0.12);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
html, body {
  margin: 0; min-height: 100%;
  background: var(--pos-bg);
  color: var(--pos-text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.43;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; text-transform: none; }
img { max-width: 100%; height: auto; display: block; }

[hidden] { display: none !important; }
#loginView, #mainView { display: none !important; }
#loginView.view-active {
  display: flex !important;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 24px 16px;
  background: var(--pos-bg);
}
#mainView.view-active {
  display: flex !important;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  background: var(--pos-bg);
}
/* Evita flash de login al refrescar con sesión */
html.session-restore #loginView,
html.session-restore #loginView.view-active { display: none !important; }
html.session-restore #mainView,
html.session-restore #mainView.view-active {
  display: flex !important;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  background: var(--pos-bg);
}

/* ——— Login (card centrada OpenPOS) ——— */
.login-frame {
  width: min(400px, 100%);
  background: var(--pos-paper);
  border-radius: var(--pos-radius-card);
  box-shadow: var(--pos-shadow-3);
  overflow: hidden;
}
.login-hero { display: none; } /* OpenPOS no usa hero lateral */
.login-box {
  padding: 32px;
  display: flex;
  flex-direction: column;
}
.login-box .brand-mini {
  display: none;
}
.login-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 4px;
  margin-bottom: 24px;
}
.login-brand img {
  height: 48px;
  width: auto;
  margin-bottom: 8px;
}
.login-brand .tag {
  display: none;
}
.login-box h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--pos-text);
}
.login-box .sub {
  margin: 4px 0 0;
  font-size: 0.875rem;
  color: var(--pos-text-secondary);
}
.login-box .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.login-box .field span {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--pos-text-secondary);
}
.login-box input {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border: 1px solid var(--pos-divider);
  border-radius: var(--pos-radius-btn);
  background: #fff;
  font-size: 16px;
  outline: none;
}
.login-box input:focus {
  border-color: var(--pos-primary);
  box-shadow: 0 0 0 3px var(--pos-primary-soft);
}
.login-box .btn-enter {
  width: 100%;
  min-height: 48px;
  margin-top: 4px;
  border: 0;
  border-radius: var(--pos-radius-btn);
  padding: 12px 18px;
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  background: var(--pos-primary);
}
.login-box .btn-enter:hover { background: var(--pos-primary-hover); }
.login-box .err {
  margin: 12px 0 0;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: #d32f2f;
  background: #fdecea;
}
.pwd-wrap { display: flex; gap: 8px; }
.pwd-wrap input { flex: 1; }
.pwd-toggle {
  min-width: 64px;
  border: 1px solid var(--pos-divider);
  border-radius: var(--pos-radius-btn);
  background: #fff;
  color: var(--pos-primary);
  font-weight: 600;
  font-size: 0.8125rem;
}
.login-note {
  margin: 20px 0 0;
  text-align: center;
  font-size: 0.75rem;
  color: var(--pos-text-secondary);
}
.debug-box {
  margin-top: 16px;
  border: 1px solid var(--pos-divider);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fafafa;
}
.debug-box summary {
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--pos-text-secondary);
}
.debug-log {
  margin: 8px 0;
  max-height: 120px;
  overflow: auto;
  font-family: var(--mono);
  font-size: 0.68rem;
  white-space: pre-wrap;
  word-break: break-word;
  color: #334155;
}
.debug-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ——— Shell: Drawer + AppBar ——— */
.sidebar {
  width: var(--pos-drawer);
  flex-shrink: 0;
  position: fixed;
  left: 0; top: 0; bottom: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  background: var(--pos-paper);
  border-right: 1px solid var(--pos-divider);
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: var(--pos-appbar-h);
  padding: 0 16px;
  border-bottom: 1px solid var(--pos-divider);
}
.sidebar-brand img.brand-logo {
  height: 36px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
}
.sidebar-brand strong {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--pos-text);
}
.sidebar-brand small {
  display: block;
  font-size: 0.7rem;
  color: var(--pos-text-secondary);
}
.sidebar-nav {
  display: flex !important;
  flex-direction: column !important;
  gap: 4px;
  flex: 1;
  overflow: auto;
  padding: 8px 10px;
  -webkit-overflow-scrolling: touch;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--pos-text);
  font-weight: 500;
  font-size: 0.9375rem;
  text-align: left;
}
.nav-item:hover { background: rgba(0, 0, 0, 0.04); }
.nav-item.is-on {
  background: var(--pos-primary-soft) !important;
  color: var(--pos-primary) !important;
}
.nav-ico {
  width: 24px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  color: inherit;
  opacity: 0.9;
  font-size: 1.1rem;
}
.nav-item.is-on .nav-ico { color: var(--pos-primary); }
.sidebar-foot {
  padding: 12px;
  border-top: 1px solid var(--pos-divider);
  display: grid;
  gap: 8px;
}
.sidebar-user {
  margin: 0;
  font-size: 0.75rem;
  color: var(--pos-text-secondary);
  padding: 0 4px;
}

.workspace {
  flex: 1;
  min-width: 0;
  margin-left: var(--pos-drawer);
  display: flex;
  flex-direction: column;
  background: var(--pos-bg);
}
.workspace-head {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: var(--pos-appbar-h);
  padding: 0 16px;
  padding-top: var(--safe-t);
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--pos-divider);
  backdrop-filter: blur(6px);
}
.workspace-titles { flex: 1; min-width: 0; }
.workspace-titles .eyebrow { display: none; }
.workspace-titles h1 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--pos-text);
}
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  padding: 8px;
}
.menu-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  background: var(--pos-text);
  border-radius: 1px;
}
.appbar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  border: 1px solid var(--pos-divider);
  border-radius: 999px;
  background: #fff;
  max-width: 220px;
}
.appbar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--pos-primary);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.85rem;
  flex-shrink: 0;
}
.appbar-user-text { min-width: 0; line-height: 1.15; }
.appbar-user-text strong {
  display: block;
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.appbar-user-text span {
  display: block;
  font-size: 0.7rem;
  color: var(--pos-text-secondary);
}

.workspace-main {
  flex: 1;
  padding: 24px;
  padding-bottom: calc(24px + var(--safe-b));
  width: 100%;
  max-width: 1200px;
}

/* ——— Tipografía módulos ——— */
.eyebrow {
  margin: 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--pos-primary);
  text-transform: none;
  letter-spacing: 0;
}
h1, h2, h3 { margin: 0; font-weight: 700; color: var(--pos-text); }
h2 { font-size: 1.5rem; font-weight: 700; }
h3 { font-size: 1.1rem; font-weight: 600; }
.muted { color: var(--pos-text-secondary); margin: 0; font-size: 0.875rem; }
.muted.tight { margin-top: 4px; }
.err {
  margin-top: 12px; padding: 8px 12px; border-radius: 8px;
  font-size: 0.8125rem; font-weight: 500;
  color: #d32f2f; background: #fdecea;
}
.ok-msg {
  margin-top: 12px; padding: 8px 12px; border-radius: 8px;
  font-size: 0.8125rem; font-weight: 500;
  color: #2e7d32; background: #edf7ed;
}
.mono { font-family: var(--mono); font-size: 0.8rem; word-break: break-all; }
code {
  font-family: var(--mono); font-size: 0.8em;
  background: #f5f5f5; border: 1px solid var(--pos-divider);
  padding: 1px 6px; border-radius: 4px;
}

/* ——— Botones MUI-like ——— */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 8px 18px;
  border: 1px solid transparent;
  border-radius: var(--pos-radius-btn);
  font-weight: 600;
  font-size: 0.875rem;
  white-space: nowrap;
}
.btn.primary {
  background: var(--pos-primary);
  color: #fff;
  border-color: var(--pos-primary);
}
.btn.primary:hover { background: var(--pos-primary-hover); }
.btn.ghost {
  background: transparent;
  border-color: var(--pos-divider);
  color: var(--pos-text);
}
.btn.ghost:hover { background: rgba(0, 0, 0, 0.04); border-color: rgba(0,0,0,0.23); }
.btn.danger { background: #d32f2f; color: #fff; border-color: #d32f2f; }
.btn.warn { background: var(--pos-secondary); color: #fff; border-color: var(--pos-secondary); }
.btn.ok { background: #2e7d32; color: #fff; border-color: #2e7d32; }
.btn.sm { min-height: 32px; padding: 4px 12px; font-size: 0.8125rem; border-radius: 8px; }
.btn-block { width: 100%; }
.btn-icon {
  width: 40px; height: 40px;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--pos-text);
  display: inline-grid; place-items: center; font-size: 1.25rem;
}
.btn-icon:hover { background: rgba(0, 0, 0, 0.04); }

/* ——— Campos ——— */
.field { display: flex; flex-direction: column; gap: 4px; }
.field--check {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: 8px 0 4px;
}
.field--check input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--pos-primary);
  flex-shrink: 0;
}
.field--check > span {
  font-size: 0.9rem;
  color: var(--pos-text);
}
.field > span, .checks legend {
  font-size: 0.72rem; font-weight: 600; color: var(--pos-text-secondary);
  letter-spacing: 0.01em;
}
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 38px;
  padding: 8px 11px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  background: #fff !important;
  color: var(--pos-text) !important;
  font-size: 0.9rem;
  outline: none;
  box-sizing: border-box;
}
.field textarea { min-height: 72px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--pos-primary);
  box-shadow: 0 0 0 3px rgba(0, 150, 136, 0.12);
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.form-stack { display: grid; gap: 12px; }
.form-row {
  display: grid;
  gap: 10px;
}
.form-row--2 { grid-template-columns: 1fr 1fr; }
.form-section {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--pos-divider, #e8ecf1);
}
.form-section:last-of-type { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.form-section__title {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pos-text-secondary, #64748b);
}
.form-details {
  border: 1px solid var(--pos-divider, #e2e8f0);
  border-radius: 10px;
  padding: 0 12px 10px;
  background: #fafbfc;
}
.form-details > summary {
  cursor: pointer;
  list-style: none;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 10px 0 8px;
  color: var(--pos-text);
  user-select: none;
}
.form-details > summary::-webkit-details-marker { display: none; }
.form-details > summary::before {
  content: "▸ ";
  color: var(--pos-primary);
  font-weight: 700;
}
.form-details[open] > summary::before { content: "▾ "; }
.form-details .dte-toolbar { margin-top: 0; margin-bottom: 8px; }
.form-details .dte-catalog { gap: 10px; }
.check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
  margin-top: 8px;
}
.check-grid label {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 8px 10px;
  border: 1px solid var(--pos-divider);
  border-radius: 8px;
  background: #fafafa;
  font-size: 0.8125rem;
  cursor: pointer;
}

/* Catálogo DTE / eventos (mismo orden que la app) */
.dte-fieldset {
  border: 1px solid var(--pos-divider);
  border-radius: 12px;
  padding: 14px 14px 10px;
  background: #fafbfc;
}
.dte-fieldset legend {
  padding: 0 6px;
  font-weight: 700;
  font-size: 0.875rem;
  color: var(--pos-text);
}
.dte-hint {
  margin: 0 0 10px;
  font-size: 0.8125rem;
  color: var(--pos-text-secondary);
  line-height: 1.4;
}
.dte-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.dte-catalog {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.dte-group-title {
  margin: 0 0 8px;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--pos-primary);
}
.dte-group-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}
.dte-card {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 10px;
  row-gap: 2px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--pos-divider);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
  min-height: 56px;
}
.dte-card input {
  grid-row: 1 / span 2;
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--pos-primary);
}
.dte-card .dte-code {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--pos-text-secondary);
  font-variant-numeric: tabular-nums;
}
.dte-card .dte-name {
  grid-column: 2;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1.3;
  color: var(--pos-text);
}
.dte-card.is-on {
  border-color: var(--pos-primary);
  background: var(--pos-primary-soft);
  box-shadow: inset 0 0 0 1px rgba(13, 148, 136, 0.25);
}
.dte-card:hover { border-color: rgba(13, 148, 136, 0.55); }
.dte-detail {
  font-weight: 500 !important;
  line-height: 1.45;
  white-space: normal;
}
.detail-grid .full { grid-column: 1 / -1; }
.pwd-wrap { display: flex; gap: 8px; }
.pwd-wrap input { flex: 1; }
.pwd-toggle {
  min-width: 70px; min-height: 48px;
  border: 1px solid rgba(0,0,0,0.23);
  border-radius: var(--pos-radius-btn);
  background: #fff;
  color: var(--pos-primary);
  font-weight: 600;
  font-size: 0.8125rem;
}

/* ——— Módulos (cabecera tipo CatalogPage) ——— */
.tab-panel { display: flex; flex-direction: column; gap: 16px; }
.module-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 0;
  padding: 0;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0;
}
.module-bar-text { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.module-bar-text h2 {
  margin: 0;
  font-size: 2.125rem;
  font-weight: 700;
  line-height: 1.2;
  color: var(--pos-text);
}
.module-bar-text p {
  width: 100%;
  margin: 0;
  font-size: 0.875rem;
  color: var(--pos-text-secondary);
}
.module-bar-ico {
  width: 40px; height: 40px;
  color: var(--pos-primary);
  font-size: 2rem;
  line-height: 1;
}
.module-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.panel-card,
.table-card,
.form-card,
.card,
.modal-body {
  background: var(--pos-paper) !important;
  color: var(--pos-text) !important;
  border: 1px solid var(--pos-divider) !important;
  border-radius: var(--pos-radius-card);
  box-shadow: none;
}
.form-card, .card, .panel-card { padding: 16px; }
.form-card h3, .panel-card h3, .card h3 {
  margin: 0 0 12px;
  padding: 0;
  border: 0;
  font-size: 1rem;
  font-weight: 600;
  color: var(--pos-text);
}

.module-grid {
  display: grid;
  grid-template-columns: minmax(280px, 380px) 1fr;
  gap: 16px;
  align-items: start;
}
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.profile-grid { max-width: 920px; }
.page-toolbar { display: none; }

/* ——— Tablas Paper outlined ——— */
.table-wrap {
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  background: #fff !important;
  border-radius: inherit;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
  background: #fff !important;
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 14px 16px;
  border-bottom: 1px solid var(--pos-divider);
  vertical-align: middle;
  font-size: 0.875rem;
  background: #fff !important;
  color: var(--pos-text) !important;
}
.data-table th {
  font-weight: 600;
  color: var(--pos-text-secondary) !important;
  background: #fafafa !important;
  font-size: 0.8125rem;
  text-transform: none;
  letter-spacing: 0;
}
.data-table tbody tr:hover td { background: rgba(0, 0, 0, 0.04) !important; }
.data-table td:has(.empty-state) {
  padding: 0 !important;
  border-bottom: none !important;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 40px 20px;
  text-align: center;
  color: var(--pos-text-secondary);
  background: #fff !important;
}
.empty-state strong { color: var(--pos-text); font-size: 1rem; }
.empty-state span { font-size: 0.875rem; }

.pill {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 16px;
  font-size: 0.75rem;
  font-weight: 600;
  height: 24px;
}
.pill.ok { background: #e8f5e9; color: #2e7d32; }
.pill.warn { background: #fff8e1; color: #f57c00; }
.pill.danger { background: #fdecea; color: #d32f2f; }
.pill.info { background: var(--pos-primary-soft); color: var(--pos-primary); }

.token-box {
  background: #fafafa !important;
  border: 1px solid var(--pos-divider);
  border-radius: 8px;
  padding: 12px;
  font-family: var(--mono);
  font-size: 0.7rem;
  word-break: break-all;
  max-height: 140px;
  overflow: auto;
}
.token-box.license-code-box {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-align: center;
  word-break: break-word;
  max-height: none;
  padding: 16px;
  color: var(--pos-text);
  background: var(--pos-primary-soft) !important;
  border-color: rgba(13, 148, 136, 0.35);
}
.license-code-display {
  font-size: 0.95rem;
  letter-spacing: 0.03em;
  font-weight: 700;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
  margin-bottom: 14px;
}
.detail-grid dt { color: var(--pos-text-secondary); font-size: 0.75rem; margin: 0; }
.detail-grid dd { margin: 2px 0 0; font-weight: 600; }

.modal {
  border: none; padding: 0; background: transparent;
  max-width: min(480px, calc(100vw - 16px)); width: 100%;
}
.modal.modal-md {
  max-width: min(560px, calc(100vw - 16px));
}
.modal.modal-lg {
  max-width: min(780px, calc(100vw - 16px));
}
.detail-actions {
  display: flex !important;
  flex-wrap: nowrap !important;
  justify-content: flex-end;
  gap: 8px;
  overflow-x: auto;
}
.detail-actions .btn {
  flex: 0 0 auto;
  white-space: nowrap;
}
.detail-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
}
.detail-summary__meta {
  font-size: 0.78rem;
  margin-left: auto;
}
.detail-block {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--pos-divider, #e8ecf1);
}
.detail-block:last-child { border-bottom: 0; }
.detail-block__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.detail-block h3 {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--pos-text-secondary, #64748b);
}
.slot-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--pos-border, #e2e8f0);
  border-radius: 10px;
  background: #fff;
}
.slot-card__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.slot-card__meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 180px;
}
.slot-card__name {
  font-weight: 700;
  color: var(--pos-text, #0f172a);
}
.slot-card__nit {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  color: #64748b;
}
.slot-card__amt {
  font-size: 0.85rem;
  color: #334155;
}
.slot-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.modal::backdrop { background: rgba(0, 0, 0, 0.5); }
.modal-body {
  max-height: min(88vh, 820px);
  overflow: auto;
  padding: 16px 18px 14px;
  border-radius: 14px !important;
  background: #fff;
  -webkit-overflow-scrolling: touch;
}
.lic-form .modal-actions { margin-top: 12px; }
.modal-body header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 12px;
  margin-bottom: 12px;
  position: sticky;
  top: -16px;
  z-index: 2;
  background: #fff;
  padding-top: 2px;
  padding-bottom: 6px;
  margin-top: -2px;
}
.modal-body header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
}
.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  flex-wrap: wrap;
  margin-top: 14px;
  position: sticky;
  bottom: -14px;
  background: linear-gradient(180deg, rgba(255,255,255,0), #fff 28%);
  padding-top: 12px;
  padding-bottom: 2px;
}
.modal-actions.wrap { justify-content: flex-start; }
.nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 35;
}

@media (max-width: 900px) {
  .sidebar {
    transform: translateX(-105%);
    transition: transform .2s ease;
    box-shadow: var(--pos-shadow-3);
    padding-left: var(--safe-l);
  }
  #mainView.view-active.nav-open .sidebar { transform: translateX(0); }
  #mainView.view-active.nav-open .nav-backdrop { display: block !important; }
  .workspace { margin-left: 0; }
  .menu-toggle { display: inline-flex; }
  .module-grid, .grid-2, .profile-grid { grid-template-columns: 1fr; }
  .module-bar-text h2 { font-size: 1.75rem; }
  .workspace-main { padding: 16px; padding-bottom: calc(16px + var(--safe-b)); }
  .module-actions { width: 100%; }
  .module-actions .btn { flex: 1; min-width: 0; }
  .appbar-user-text { display: none; }
  .dte-group-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .modal, .modal.modal-lg { max-width: calc(100vw - 12px); margin: 8px auto; }
  .modal-body { padding: 16px; max-height: calc(100dvh - 16px); }
}

.company-slots {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.company-slot {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 10px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
}
@media (min-width: 520px) {
  .company-slot {
    grid-template-columns: 1.5fr 1.1fr 0.7fr 0.75fr;
  }
}
.company-slot label.field {
  margin: 0;
}
.company-slot input {
  font-weight: 500;
  font-size: 0.88rem;
  min-height: 36px;
}
@media (max-width: 600px) {
  .form-grid, .detail-grid, .form-row--2 { grid-template-columns: 1fr; }
  .data-table { min-width: 620px; }
  .login-box { padding: 24px 20px; }
  .module-bar-text h2 { font-size: 1.5rem; }
  .dte-group-grid { grid-template-columns: 1fr; }
  .dte-toolbar .btn { flex: 1 1 calc(50% - 4px); }
  .workspace-head { padding-inline: 12px; }
  .table-wrap { margin-inline: -4px; border-radius: 10px; }
  .company-slot { grid-template-columns: 1fr; }
  .modal, .modal.modal-md, .modal.modal-lg { max-width: calc(100vw - 12px); margin: 8px auto; }
  .modal-body { padding: 14px; max-height: calc(100dvh - 16px); }
}

@media (max-width: 380px) {
  .dte-toolbar .btn { flex: 1 1 100%; }
  .modal-actions .btn { flex: 1; }
}

/* ——— Toasts / diálogos UI (reemplazo de alert/confirm/prompt) ——— */
.toast-host {
  position: fixed;
  top: calc(12px + var(--safe-t));
  right: calc(12px + var(--safe-r, 0px));
  z-index: 12000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: min(380px, calc(100vw - 24px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: 8px 1fr auto;
  align-items: start;
  gap: 0 12px;
  padding: 12px 12px 12px 0;
  background: var(--pos-paper);
  border-radius: var(--pos-radius);
  box-shadow: var(--pos-shadow-3);
  border: 1px solid var(--pos-divider);
  opacity: 0;
  transform: translateY(-8px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast--in { opacity: 1; transform: translateY(0) scale(1); }
.toast--out { opacity: 0; transform: translateY(-6px) scale(0.98); }
.toast__icon {
  width: 8px;
  align-self: stretch;
  border-radius: 12px 0 0 12px;
  background: var(--pos-primary);
}
.toast--success .toast__icon { background: #059669; }
.toast--error .toast__icon { background: #dc2626; }
.toast--warn .toast__icon { background: #d97706; }
.toast--info .toast__icon { background: var(--pos-primary); }
.toast__body { min-width: 0; padding-top: 2px; }
.toast__title {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--pos-text-secondary);
  margin-bottom: 2px;
}
.toast__msg {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 500;
  color: var(--pos-text);
  line-height: 1.4;
  word-break: break-word;
}
.toast__close {
  border: none;
  background: transparent;
  color: var(--pos-text-secondary);
  font-size: 1.25rem;
  line-height: 1;
  padding: 0 4px;
  border-radius: 6px;
}
.toast__close:hover { background: var(--pos-primary-soft); color: var(--pos-text); }

.ui-dialog {
  border: none;
  padding: 0;
  max-width: min(440px, calc(100vw - 24px));
  border-radius: var(--pos-radius-card);
  box-shadow: var(--pos-shadow-3);
}
.ui-dialog::backdrop {
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(2px);
}
.ui-dialog__form { padding: 22px 22px 18px; }
.ui-dialog__title {
  margin: 0 0 8px;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--pos-text);
}
.ui-dialog__msg {
  margin: 0 0 16px;
  color: var(--pos-text-secondary);
  font-size: 0.92rem;
  line-height: 1.45;
  white-space: pre-wrap;
}
.ui-dialog__fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}
.ui-dialog__fields .field { margin: 0; }
.ui-dialog .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}
@media (max-width: 420px) {
  .toast-host { left: 12px; right: 12px; width: auto; }
  .ui-dialog .modal-actions .btn { flex: 1; }
}

/* ——— Barra de progreso de carga (actualizaciones) ——— */
.upload-progress {
  margin: 4px 0 2px;
  padding: 12px 14px;
  border-radius: var(--pos-radius);
  border: 1px solid var(--pos-divider);
  background: linear-gradient(180deg, #f8fafb 0%, #fff 100%);
}
.upload-progress__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.upload-progress__label {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--pos-text);
}
.upload-progress__pct {
  font-size: 0.86rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--pos-primary);
}
.upload-progress__track {
  height: 10px;
  border-radius: 999px;
  background: rgba(13, 148, 136, 0.12);
  overflow: hidden;
}
.upload-progress__fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0d9488, #14b8a6);
  transition: width 0.15s ease-out;
}
.upload-progress__meta {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--pos-text-secondary);
}
.upload-progress--done .upload-progress__fill {
  background: linear-gradient(90deg, #059669, #10b981);
}
.upload-progress--done .upload-progress__pct {
  color: #059669;
}
.upload-progress--error {
  border-color: rgba(220, 38, 38, 0.35);
  background: #fff8f8;
}
.upload-progress--error .upload-progress__fill {
  background: linear-gradient(90deg, #dc2626, #f87171);
}
.upload-progress--error .upload-progress__pct,
.upload-progress--error .upload-progress__label {
  color: #dc2626;
}


