/* SGM Cerro Azul — interfaz compartida. Solo presentacion en pantalla. */
@media screen {
  :root:has(body.sgm-ui) {
    --sgm-bg: #f3f6fa;
    --sgm-surface: #ffffff;
    --sgm-soft: #eef3f9;
    --sgm-ink: #172b46;
    --sgm-muted: #62748c;
    --sgm-line: #dce4ef;
    --sgm-primary: #245bb5;
    --sgm-primary-hover: #19478f;
    --sgm-navy: #122d50;
    --sgm-success: #16734c;
    --sgm-warning: #996008;
    --sgm-danger: #b83242;
    --sgm-radius: 14px;
    --sgm-shadow: 0 3px 16px rgb(23 43 70 / 5%);
    /* Compatibilidad con los tokens de las pantallas anteriores. */
    --bg: var(--sgm-bg); --panel: var(--sgm-surface); --panel-2: var(--sgm-soft);
    --card: var(--sgm-surface); --text: var(--sgm-ink); --ink: var(--sgm-ink);
    --muted: var(--sgm-muted); --border: var(--sgm-line); --line: var(--sgm-line);
    --brand: var(--sgm-primary); --brand-deep: var(--sgm-primary-hover);
    --accent: var(--sgm-primary); --accent-2: var(--sgm-primary-hover);
    --success: var(--sgm-success); --ok: var(--sgm-success);
    --warn: var(--sgm-warning); --bad: var(--sgm-danger); --danger: var(--sgm-danger);
    --ca-primary: var(--sgm-primary); --ca-primary-dark: var(--sgm-primary-hover);
    --ca-text: var(--sgm-ink); --ca-muted: var(--sgm-muted); --ca-border: var(--sgm-line);
  }
  body.sgm-ui {
    margin: 0;
    background: var(--sgm-bg) !important;
    color: var(--sgm-ink) !important;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif !important;
    font-size: 14px;
    line-height: 1.55;
    min-height: 100vh;
    color-scheme: light;
    -webkit-font-smoothing: antialiased;
  }
  .sgm-ui *, .sgm-ui *::before, .sgm-ui *::after { box-sizing: border-box; }
  .sgm-ui :is(h1,h2,h3,h4,h5,h6) { color: var(--sgm-ink); font-weight: 650; line-height: 1.25; letter-spacing: -.025em; }
  .sgm-ui h1 { font-size: clamp(1.7rem, 3vw, 2.25rem); }
  .sgm-ui h2 { font-size: clamp(1.45rem, 2.5vw, 1.85rem); }
  .sgm-ui h3 { font-size: 1.35rem; }
  .sgm-ui h4 { font-size: 1.2rem; }
  .sgm-ui h5 { font-size: 1.05rem; }
  .sgm-ui p { line-height: 1.65; }
  .sgm-ui :is(.muted,.text-muted,.cell-sub,.table-meta,.form-text) { color: var(--sgm-muted) !important; }
  .sgm-ui a { text-underline-offset: 3px; }
  .sgm-ui a:not([class]) { color: var(--sgm-primary); }
  .sgm-ui :is(.container,.container-fluid,.page-shell,.page-container,.main-container) { min-width: 0; }
  .sgm-ui > :is(.container,.page-shell,.page-container,.main-container) { padding-left: 24px; padding-right: 24px; }
  .sgm-ui > .container { margin-top: 28px; margin-bottom: 32px; }
  .sgm-ui :is(.toolbar,.table-toolbar,.page-header,.form-actions) { gap: 12px; flex-wrap: wrap; }
  .sgm-ui :is(.card,.card-panel,.filter-card,.table-card,.hero-card,.stat-card,.summary,.panel,.ca-card,.ca-stat-card) {
    background: var(--sgm-surface) !important;
    color: var(--sgm-ink) !important;
    border: 1px solid var(--sgm-line) !important;
    border-radius: var(--sgm-radius) !important;
    box-shadow: var(--sgm-shadow) !important;
  }
  .sgm-ui :is(.card,.card-panel,.filter-card,.table-card,.hero-card,.stat-card,.summary,.panel,.ca-card) :is(h1,h2,h3,h4,h5,h6,label,strong,p) { color: inherit; }
  .sgm-ui .card :is(div,span):not([class]) { color: inherit; }
  .sgm-ui .card-body { padding: 22px; }
  .sgm-ui :is(.card-header,.card-footer) { background: var(--sgm-soft) !important; color: var(--sgm-ink) !important; border-color: var(--sgm-line) !important; padding: 14px 20px; }
  .sgm-ui .card-header { border-radius: 13px 13px 0 0 !important; }
  .sgm-ui .card-footer { border-radius: 0 0 13px 13px !important; }
  .sgm-ui :is(.dato,.pill,.activity-pill,.input-group-text) { background: var(--sgm-soft) !important; color: var(--sgm-ink) !important; border-color: var(--sgm-line) !important; border-radius: 8px; }
  .sgm-ui .summary { padding: 18px; }
  .sgm-ui fieldset { border: 1px solid var(--sgm-line); border-radius: var(--sgm-radius); padding: 20px; min-width: 0; }
  .sgm-ui legend { color: var(--sgm-ink); font-size: 1rem; font-weight: 650; padding: 0 8px; width: auto; }
  .sgm-ui label { font-weight: 600; }
  .sgm-ui :is(.form-control,.form-select,.custom-select,.ca-input,textarea,select,input:not([type]),input[type='text'],input[type='number'],input[type='email'],input[type='password'],input[type='search'],input[type='date'],input[type='datetime-local'],input[type='month'],input[type='tel'],input[type='file'],input[type='url']) {
    background-color: var(--sgm-surface) !important;
    color: var(--sgm-ink) !important;
    border: 1px solid #c7d3e3 !important;
    border-radius: 8px;
    min-height: 40px;
    padding: 8px 11px;
    font: inherit;
    box-shadow: none;
    max-width: 100%;
  }
  .sgm-ui .form-select { padding-right: 34px; }
  .sgm-ui :is(input,textarea)::placeholder { color: #77869a; opacity: 1; }
  .sgm-ui :is(input,textarea,select):focus { border-color: var(--sgm-primary) !important; outline: 3px solid rgb(36 91 181 / 16%); outline-offset: 1px; box-shadow: none !important; }
  .sgm-ui :is(input,textarea,select):disabled, .sgm-ui :is(input,textarea)[readonly] { background-color: #edf1f6 !important; color: #64748b !important; }
  .sgm-ui input:is([type='checkbox'],[type='radio']) { accent-color: var(--sgm-primary); min-width: 17px; min-height: 17px; cursor: pointer; }
  .sgm-ui .form-check-input:checked { background-color: var(--sgm-primary); border-color: var(--sgm-primary); }
  .sgm-ui .input-group > .form-control { min-width: 0; }
  .sgm-ui :is(.btn,.btn-back,.ca-btn,.ca-btn-primary,.actions-toggle,input[type='submit'],input[type='button'],button:not([class])) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 39px;
    padding: 8px 14px;
    border: 1px solid transparent;
    border-radius: 8px !important;
    font-family: inherit;
    font-size: 13px;
    font-weight: 650;
    line-height: 1.35;
    text-decoration: none;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
    box-shadow: none;
    white-space: normal;
    vertical-align: middle;
  }
  .sgm-ui :is(.btn-primary,.ca-btn-primary,input[type='submit'],button:not([class])) { background: var(--sgm-primary) !important; border-color: var(--sgm-primary) !important; color: #fff !important; }
  .sgm-ui :is(.btn-primary,.ca-btn-primary,input[type='submit'],button:not([class])):hover { background: var(--sgm-primary-hover) !important; }
  .sgm-ui :is(.btn-secondary,.btn-light,.btn-dark,.btn-outline,.btn-outline-secondary,.btn-outline-dark,.btn-outline-light,.btn-back,.actions-toggle) { background: #fff !important; border-color: #cbd6e5 !important; color: #344c6c !important; }
  .sgm-ui :is(.btn-secondary,.btn-light,.btn-outline,.btn-back,.actions-toggle):hover { background: var(--sgm-soft) !important; border-color: #96accb !important; }
  .sgm-ui .btn-success { background: var(--sgm-success) !important; border-color: var(--sgm-success) !important; color: #fff !important; }
  .sgm-ui .btn-success:hover { background: #105c3c !important; }
  .sgm-ui .btn-danger { background: var(--sgm-danger) !important; border-color: var(--sgm-danger) !important; color: #fff !important; }
  .sgm-ui .btn-danger:hover { background: #982838 !important; }
  .sgm-ui .btn-warning { background: #fff0ce !important; border-color: #ead393 !important; color: #774b0a !important; }
  .sgm-ui :is(.btn-info,.btn-pdf,.btn-pdf-2,.btn-outline-primary) { background: #eaf1fc !important; border-color: #cbdaf3 !important; color: var(--sgm-primary) !important; }
  .sgm-ui .btn-outline-success { color: var(--sgm-success) !important; border-color: #9dceb7 !important; background: #eff8f3 !important; }
  .sgm-ui .btn-outline-danger { color: var(--sgm-danger) !important; border-color: #e7b8bf !important; background: #fff4f5 !important; }
  .sgm-ui .btn-sm { padding: 5px 10px; min-height: 32px; font-size: 12px; }
  .sgm-ui .btn-lg { padding: 12px 20px; min-height: 46px; font-size: 15px; }
  .sgm-ui :is(.btn,button,input):disabled, .sgm-ui .btn.disabled { opacity: .55; cursor: not-allowed; }
  .sgm-ui :is(a,button,input,select,textarea,summary):focus-visible { outline: 3px solid #5590e7; outline-offset: 3px; }
  .sgm-ui :is(.table-wrap,.table-responsive) { border-color: var(--sgm-line) !important; border-radius: 10px; }
  .sgm-ui .table {
    --bs-table-bg: #fff; --bs-table-color: var(--sgm-ink); --bs-table-border-color: var(--sgm-line);
    --bs-table-striped-bg: #f8fafd; --bs-table-striped-color: var(--sgm-ink);
    --bs-table-hover-bg: #edf3fc; --bs-table-hover-color: var(--sgm-ink);
    --bs-table-active-bg: #e5edfa; --bs-table-active-color: var(--sgm-ink);
    width: 100%; background: #fff !important; color: var(--sgm-ink) !important; font-size: 13px; border-color: var(--sgm-line) !important;
  }
  .sgm-ui .table :is(th,td) { padding: 12px 14px; border-color: var(--sgm-line) !important; vertical-align: middle; }
  .sgm-ui .table :is(thead th,tfoot th,tfoot td) { background: var(--sgm-soft) !important; color: #435a78 !important; font-weight: 650; }
  .sgm-ui .table thead th { font-size: 11px; letter-spacing: .045em; text-transform: uppercase; }
  .sgm-ui .table tbody :is(th,td) { background-color: transparent; color: inherit; }
  .sgm-ui .table tbody tr { background: #fff; color: var(--sgm-ink); }
  .sgm-ui .table-striped tbody tr:nth-of-type(odd) { background: #f8fafd; }
  .sgm-ui .table tbody tr:hover { background: #edf3fc; }
  .sgm-ui .table-sm :is(th,td) { padding: 8px 10px; }
  .sgm-ui :is(.text-end,.text-right,.mono,.calc-cell) { font-variant-numeric: tabular-nums; }
  .sgm-ui :is(.badge,.status-chip) { display: inline-block; border-radius: 6px; padding: 5px 9px; font-size: 11px; font-weight: 650; letter-spacing: .01em; line-height: 1.4; }
  .sgm-ui .badge { background: #edf2f8; color: #526780; border: 1px solid transparent; }
  .sgm-ui :is(.alert-success,.badge-success,.badge.bg-success,.text-bg-success,.status-ok) { background: #edf8f1 !important; color: #17603e !important; border-color: #bfdfca !important; }
  .sgm-ui :is(.alert-danger,.badge-danger,.badge.bg-danger,.text-bg-danger,.status-no) { background: #fff0f2 !important; color: #9c2b3b !important; border-color: #ecc7cd !important; }
  .sgm-ui :is(.alert-warning,.badge-warning,.badge.bg-warning,.text-bg-warning) { background: #fff7e5 !important; color: #83540b !important; border-color: #eaddb5 !important; }
  .sgm-ui :is(.alert-info,.badge-info,.badge.bg-info,.text-bg-info) { background: #edf4ff !important; color: #28568e !important; border-color: #c7d9f3 !important; }
  .sgm-ui :is(.alert,.alert-info) { border: 1px solid; border-radius: 10px; padding: 14px 17px; }
  .sgm-ui .state-ok { color: var(--sgm-success) !important; }
  .sgm-ui .state-warn { color: var(--sgm-warning) !important; }
  .sgm-ui .state-bad { color: var(--sgm-danger) !important; }
  .sgm-ui .navbar {
    background: var(--sgm-navy) !important; color: #fff !important;
    border: 0; border-bottom: 3px solid #376dbb; padding: 12px 22px;
    box-shadow: 0 3px 12px rgb(15 35 62 / 10%);
  }
  .sgm-ui .navbar-brand { display: inline-flex; align-items: center; gap: 10px; color: #fff !important; font-weight: 750; letter-spacing: -.02em; font-size: 19px; margin-right: 22px; }
  .sgm-ui .navbar-brand::before { content: ''; width: 34px; height: 38px; flex: 0 0 34px; background: #fff url('../img/escudo_municipal.png') center / 26px auto no-repeat; border-radius: 8px; }
  .sgm-ui .navbar .nav-link { color: #dbe7f7 !important; font-size: 13px !important; font-weight: 500; padding: 9px 10px; border-radius: 7px; }
  .sgm-ui .navbar .nav-link:hover, .sgm-ui .navbar .nav-link:focus { background: #244365; color: #fff !important; }
  .sgm-ui .navbar .nav-link.active { background: #2a4e78; color: #fff !important; }
  .sgm-ui .navbar-nav .nav-item:hover { transform: none !important; }
  .sgm-ui .navbar-toggler { border: 1px solid #7890af; padding: 7px 9px; }
  .sgm-ui .dropdown-menu { background: #fff !important; color: var(--sgm-ink) !important; border: 1px solid var(--sgm-line); border-radius: 10px; padding: 6px; box-shadow: 0 10px 32px rgb(23 43 70 / 14%); }
  .sgm-ui .dropdown-item { color: var(--sgm-ink) !important; border-radius: 6px; padding: 9px 12px; font-size: 13px; }
  .sgm-ui .dropdown-item:hover, .sgm-ui .dropdown-item:focus { background: #edf3fc !important; color: var(--sgm-primary) !important; }
  .sgm-ui .dropdown-divider { border-color: var(--sgm-line); }
  .sgm-ui .modal-content { background: #fff !important; color: var(--sgm-ink) !important; border: 1px solid var(--sgm-line); border-radius: 16px; box-shadow: 0 20px 70px rgb(15 35 62 / 22%); }
  .sgm-ui :is(.modal-header,.modal-footer) { border-color: var(--sgm-line); padding: 17px 22px; }
  .sgm-ui .modal-body { padding: 22px; }
  .sgm-ui .page-link { color: var(--sgm-primary); border-color: var(--sgm-line); border-radius: 6px; margin: 0 2px; }
  .sgm-ui .page-item.active .page-link { color: #fff; background: var(--sgm-primary); border-color: var(--sgm-primary); }
  .sgm-ui :is(.topbar,.ca-header) { background: var(--sgm-navy) !important; color: #fff !important; border-radius: 14px; }
  .sgm-ui :is(.topbar,.ca-header) :is(h1,h2,h3,.ca-brand-title) { color: #fff !important; }
  .sgm-ui :is(.ca-bg-shape,#blur-logo) { display: none; }
  .sgm-ui .login-card { background: #fff !important; border: 1px solid var(--sgm-line) !important; border-radius: 18px; box-shadow: 0 18px 60px rgb(20 46 83 / 12%); }
  .sgm-ui:has(.login-wrapper)::before { background: transparent; backdrop-filter: none; }
  .sgm-ui .login-wrapper { max-width: 460px; }
  .sgm-ui .login-title { color: var(--sgm-ink); }
  .sgm-ui .municipio { color: var(--sgm-primary); }
  .sgm-ui .ca-panel-left { background: var(--sgm-navy); }
  .sgm-ui .card-gradient:hover { transform: none !important; }
  .sgm-ui.sgm-dashboard .animate__animated { animation: none !important; }
  .sgm-ui.sgm-dashboard > .row { max-width: 1200px; margin: 24px auto 40px; }
  .sgm-ui.sgm-dashboard .card-gradient { max-width: none !important; }
  .sgm-ui.sgm-dashboard #welcome-message { padding-top: 0; margin-top: 22px !important; }
  .sgm-ui.sgm-dashboard #welcome-message h1 { font-size: 1.25rem; }
  .sgm-ui.sgm-dashboard .weather-icon { font-size: 1.7rem !important; }
  .sgm-home { max-width: 1200px; padding: 36px 24px 0; margin: 0 auto; }
  .sgm-eyebrow { color: var(--sgm-primary); font-weight: 750; font-size: 11px; text-transform: uppercase; letter-spacing: .12em; margin-bottom: 8px; }
  .sgm-home-title { margin: 0 0 10px; }
  .sgm-home-description { color: var(--sgm-muted); margin: 0; max-width: 620px; }
  .sgm-shortcuts-title { font-size: .9rem; margin: 30px 0 12px; }
  .sgm-shortcuts { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 14px; }
  .sgm-shortcut { display: flex; flex-direction: column; align-items: flex-start; position: relative; min-height: 144px; padding: 20px; border-radius: 12px; border: 1px solid var(--sgm-line); background: #fff; color: var(--sgm-ink) !important; text-decoration: none !important; box-shadow: var(--sgm-shadow); }
  .sgm-shortcut:hover { border-color: #9bb9e4; background: #fafdff; box-shadow: 0 5px 20px rgb(36 91 181 / 8%); }
  .sgm-shortcut::after { content: '\2197'; position: absolute; right: 18px; top: 16px; color: #8a9eb8; font-size: 20px; }
  .sgm-shortcut-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: #edf3fc; color: var(--sgm-primary); margin-bottom: 14px; }
  .sgm-shortcut-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
  .sgm-shortcut-title { font-size: 14px; font-weight: 650; }
  .sgm-shortcut-description { color: var(--sgm-muted); font-size: 12px; margin-top: 3px; }
  .sgm-ui [hidden] { display: none !important; }
  @media (min-width: 992px) and (max-width: 1399px) {
    .sgm-ui .navbar-expand-lg { flex-wrap: wrap; }
    .sgm-ui .navbar-expand-lg .navbar-collapse { flex-wrap: wrap; }
    .sgm-ui .navbar-expand-lg .navbar-nav { flex-wrap: wrap; }
  }
  @media (max-width: 991px) {
    .sgm-ui .navbar { padding: 11px 16px; }
    .sgm-ui .navbar-collapse { padding-top: 12px; }
    .sgm-ui .navbar .dropdown-menu { margin: 4px 0 10px; }
    .sgm-shortcuts { grid-template-columns: repeat(2,minmax(0,1fr)); }
    .sgm-ui.sgm-page-planes_pago-ver_planes .grid { grid-template-columns: minmax(0,1fr); }
  }
  @media (max-width: 600px) {
    .sgm-ui > :is(.container,.page-shell,.page-container,.main-container) { padding-left: 12px; padding-right: 12px; }
    .sgm-ui .card-body { padding: 16px; }
    .sgm-ui .table :is(th,td) { padding: 9px 10px; }
    .sgm-ui :is(.toolbar,.page-header) { align-items: stretch; }
    .sgm-ui .table-wrap, .sgm-ui .table-responsive { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .sgm-ui .card-body > .d-flex { flex-wrap: wrap; gap: 12px; }
    .sgm-ui .card-body > .d-flex > .d-flex { flex-wrap: wrap; }
    .sgm-ui .sgm-scroll-table { display: block; overflow-x: auto; max-width: 100%; }
    .sgm-home { padding: 25px 16px 0; }
    .sgm-shortcuts { gap: 10px; }
    .sgm-shortcut { padding: 16px; min-height: 150px; }
  }
  @media (prefers-reduced-motion: reduce) {
    .sgm-ui *, .sgm-ui *::before, .sgm-ui *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  }
}
@media print { .sgm-screen-only { display: none !important; } }
@media screen {
  /* Contraste para utilidades oscuras heredadas de Bootstrap y Tailwind. */
  .sgm-ui :is(.card,.card-panel,.panel,.modal-content) :is(label,p,strong,h1,h2,h3,h4,h5,h6):is(.text-white,.text-light) { color: var(--sgm-ink) !important; }
  .sgm-ui :is(.card,.card-panel,.panel,.modal-content) :is(.text-white-50,.text-gray-400,.text-slate-400) { color: var(--sgm-muted) !important; }
  .sgm-ui :is(div,section,main).bg-dark:not(.navbar),
  .sgm-ui :is(div,section,main):is(.bg-gray-700,.bg-gray-800,.bg-gray-900,.bg-slate-700,.bg-slate-800) { background: var(--sgm-surface) !important; color: var(--sgm-ink) !important; border-color: var(--sgm-line) !important; }
  .sgm-ui :is(.text-success,.text-green-400) { color: var(--sgm-success) !important; }
  .sgm-ui .text-danger { color: var(--sgm-danger) !important; }
  .sgm-ui .text-warning { color: var(--sgm-warning) !important; }
  .sgm-ui .text-info { color: #246180 !important; }
  .sgm-ui .modal-content .btn-close-white { filter: none; }
  .sgm-ui :is(.ca-hero,.ca-menu-card,.glass-card) { background: #fff !important; color: var(--sgm-ink) !important; border: 1px solid var(--sgm-line) !important; border-radius: var(--sgm-radius) !important; box-shadow: var(--sgm-shadow) !important; }
  .sgm-ui :is(.ca-hero-title,.ca-menu-title) { color: var(--sgm-ink) !important; }
  .sgm-ui :is(.ca-hero-kicker,.ca-kicker) { color: var(--sgm-primary) !important; }
  .sgm-ui :is(.ca-hero-text,.ca-footer,.ca-menu-text) { color: var(--sgm-muted) !important; }
  .sgm-ui .ca-menu-card:hover { transform: translateY(-2px); border-color: #9bb9e4 !important; }
  .sgm-ui .ca-menu-icon { width: 46px; height: 46px; border-radius: 11px; background: #edf3fc; color: var(--sgm-primary); }
  .sgm-ui .ca-header { padding: 20px 24px; }
  .sgm-ui section.text-white { background: var(--sgm-navy); color: #fff; }
  .sgm-ui section.text-white :is(h1,h2,h3,h4) { color: #fff; }
  .sgm-ui.sgm-page-autogestion-index .shape { display: none; }
  .sgm-ui .table-wrap { background: #fff !important; }
  .sgm-ui .table .btn { white-space: nowrap; }
  .sgm-ui.sgm-page-comercio-liquidacion_excel .card-body > .d-flex { flex-wrap: wrap; gap: 12px; }
  .sgm-ui.sgm-page-comercio-liquidacion_excel .card-body > .d-flex > .d-flex { flex-wrap: wrap; }
  .sgm-ui .input-group > .input-group-text:first-child { border-radius: 8px 0 0 8px; }
  .sgm-ui .input-group > .form-control:last-child { border-radius: 0 8px 8px 0; }
  .sgm-ui .input-group > .form-control:not(:last-child) { border-radius: 0; }
}
/* Selector compartido y paleta nocturna. Las impresiones conservan su estilo. */
@media screen {
  .sgm-ui:has(> .sgm-theme-bar) { padding-top:49px !important; }
  .sgm-ui .sgm-nav-user-actions { display:flex; align-items:center; gap:8px; margin-left:auto; flex-shrink:0; }
  .sgm-ui .sgm-nav-user-actions .sgm-nav-account { margin-left:0; }
  .sgm-ui .sgm-nav-user-actions .sgm-theme-toggle { white-space:nowrap; flex-shrink:0; }
  @media (max-width:1100px) { .sgm-ui .sgm-nav-user-actions { margin-left:0; } }
  .sgm-ui .sgm-theme-bar { position:absolute; top:0; left:0; z-index:3; height:49px; display:flex; justify-content:flex-end; align-items:center; width:100%; padding:7px 22px; background:var(--sgm-bg); border-bottom:1px solid var(--sgm-line); }
  .sgm-ui .sgm-theme-toggle { display:inline-flex; align-items:center; justify-content:center; gap:8px; min-height:34px; padding:6px 12px; border:1px solid var(--sgm-line); border-radius:8px; background:var(--sgm-surface); color:var(--sgm-ink); font:600 13px/1.4 'Segoe UI',system-ui,sans-serif; cursor:pointer; }
  .sgm-ui .sgm-theme-toggle:hover { background:var(--sgm-soft); }
  .sgm-theme-toggle span { display:inline-flex; }
  .sgm-theme-toggle svg { width:18px; height:18px; fill:none; stroke:currentColor; stroke-width:1.8; stroke-linecap:round; stroke-linejoin:round; }
  /* Las pantallas de acceso centran su formulario: la barra queda arriba. */
  .sgm-ui:has(.login-wrapper) .sgm-theme-bar { position:absolute; top:0; left:0; z-index:3; }
  :root[data-sgm-theme='dark']:has(body.sgm-ui) {
    --sgm-bg:#101823; --sgm-surface:#192535; --sgm-soft:#223247;
    --sgm-ink:#e4ebf5; --sgm-muted:#a6b6cc; --sgm-line:#34465d;
    --sgm-primary:#8ab6ff; --sgm-primary-hover:#a9caff;
    --sgm-navy:#102138; --sgm-success:#7bd8aa; --sgm-warning:#f4cc7b;
    --sgm-danger:#ff9ca8; --sgm-shadow:0 3px 16px rgb(0 0 0 / 15%);
    --bs-body-color:#e4ebf5; --bs-body-bg:#101823; --bs-border-color:#34465d;
  }
  [data-sgm-theme='dark'] body.sgm-ui { color-scheme:dark; }
  [data-sgm-theme='dark'] .sgm-ui :is(.dropdown-menu,.modal-content,.login-card,.ca-hero,.ca-menu-card,.glass-card,.table-wrap,.sgm-shortcut,.bg-white,.actions-panel) { background:var(--sgm-surface) !important; color:var(--sgm-ink) !important; border-color:var(--sgm-line) !important; }
  [data-sgm-theme='dark'] .sgm-ui :is(.bg-light,.bg-slate-50,.bg-slate-100,.bg-slate-200,.activity-pill,.ca-menu-icon,.sgm-shortcut-icon) { background:var(--sgm-soft) !important; color:var(--sgm-ink) !important; }
  [data-sgm-theme='dark'] .sgm-ui :is(.text-dark,.text-slate-700,.text-slate-800,.text-slate-900,.cell-main,.login-title) { color:var(--sgm-ink) !important; }
  [data-sgm-theme='dark'] .sgm-ui :is(.text-slate-400,.text-slate-500,.text-slate-600,.text-gray-400,.preview-caption,.preview-label) { color:var(--sgm-muted) !important; }
  [data-sgm-theme='dark'] .sgm-ui :is(input,textarea,select,.input-group-text) { border-color:var(--sgm-line) !important; }
  [data-sgm-theme='dark'] .sgm-ui :is(input,textarea)::placeholder { color:#9cacc2; }
  [data-sgm-theme='dark'] .sgm-ui :is(input,textarea,select):disabled,
  [data-sgm-theme='dark'] .sgm-ui :is(input,textarea)[readonly] { background:#223043 !important; color:#a6b6cc !important; }
  [data-sgm-theme='dark'] .sgm-ui .table {
    --bs-table-bg:#192535; --bs-table-color:#e4ebf5; --bs-table-border-color:#34465d;
    --bs-table-striped-bg:#1d2c3e; --bs-table-striped-color:#e4ebf5;
    --bs-table-hover-bg:#293e58; --bs-table-hover-color:#e4ebf5;
    --bs-table-active-bg:#2c4563; --bs-table-active-color:#e4ebf5;
    background:var(--sgm-surface) !important;
  }
  [data-sgm-theme='dark'] .sgm-ui .table tbody tr { background:var(--sgm-surface); }
  [data-sgm-theme='dark'] .sgm-ui .table-striped tbody tr:nth-of-type(odd) { background:#1d2c3e; }
  [data-sgm-theme='dark'] .sgm-ui .table tbody tr:hover { background:#293e58; }
  [data-sgm-theme='dark'] .sgm-ui .table :is(thead th,tfoot th,tfoot td) { color:#c4d3e7 !important; }
  [data-sgm-theme='dark'] .sgm-ui :is(.btn-primary,.ca-btn-primary,input[type='submit'],button:not([class])) { background:#285eb2 !important; border-color:#477bc8 !important; color:#fff !important; }
  [data-sgm-theme='dark'] .sgm-ui :is(.btn-primary,.ca-btn-primary,input[type='submit'],button:not([class])):hover { background:#326dc6 !important; }
  [data-sgm-theme='dark'] .sgm-ui .btn-success { background:#176b47 !important; border-color:#388961 !important; }
  [data-sgm-theme='dark'] .sgm-ui .btn-danger { background:#a12e40 !important; border-color:#be5264 !important; }
  [data-sgm-theme='dark'] .sgm-ui :is(.btn-secondary,.btn-light,.btn-dark,.btn-outline,.btn-outline-secondary,.btn-outline-dark,.btn-outline-light,.btn-back,.actions-toggle,.page-link) { background:var(--sgm-soft) !important; color:var(--sgm-ink) !important; border-color:var(--sgm-line) !important; }
  [data-sgm-theme='dark'] .sgm-ui :is(.btn-secondary,.btn-light,.btn-outline,.btn-back,.actions-toggle):hover { background:#2d425d !important; }
  [data-sgm-theme='dark'] .sgm-ui :is(.btn-info,.btn-pdf,.btn-pdf-2,.btn-outline-primary) { background:#223d60 !important; color:#b3d1ff !important; border-color:#3b5b83 !important; }
  [data-sgm-theme='dark'] .sgm-ui :is(.btn-warning,.alert-warning,.badge-warning,.badge.bg-warning,.text-bg-warning) { background:#40341c !important; color:#f4cc7b !important; border-color:#6c582e !important; }
  [data-sgm-theme='dark'] .sgm-ui :is(.btn-outline-success,.alert-success,.badge-success,.badge.bg-success,.text-bg-success,.status-ok) { background:#193d30 !important; color:#8ae0b2 !important; border-color:#38644e !important; }
  [data-sgm-theme='dark'] .sgm-ui :is(.btn-outline-danger,.alert-danger,.badge-danger,.badge.bg-danger,.text-bg-danger,.status-no) { background:#462632 !important; color:#ffacb8 !important; border-color:#74404d !important; }
  [data-sgm-theme='dark'] .sgm-ui :is(.alert-info,.badge-info,.badge.bg-info,.text-bg-info) { background:#213955 !important; color:#afd3ff !important; border-color:#3e5c7e !important; }
  [data-sgm-theme='dark'] .sgm-ui .badge:not([class*='success']):not([class*='danger']):not([class*='warning']):not([class*='info']) { background:var(--sgm-soft) !important; color:var(--sgm-muted) !important; }
  [data-sgm-theme='dark'] .sgm-ui .text-info { color:#91cce8 !important; }
  [data-sgm-theme='dark'] .sgm-ui .dropdown-item:hover,
  [data-sgm-theme='dark'] .sgm-ui .dropdown-item:focus,
  [data-sgm-theme='dark'] .sgm-ui .sgm-shortcut:hover { background:#273b53 !important; }
  [data-sgm-theme='dark'] .sgm-ui .modal-content :is(.btn-close,.btn-close-white) { filter:invert(1); }
  @media (max-width:600px) { .sgm-ui .sgm-theme-bar { padding:7px 12px; } }
}
