/* Riguel new-app theme — OUR OWN CSS reproducing the old app's look on top of
   Bootstrap 5. Palette black-box-observed from the old Mojito app (bootstrap
   3.4.1 + horizontalNew theme). We do not copy their stylesheet, only the look. */

:root {
  --bar:        #4E5D74;   /* dark slate sub-header */
  --green:      #4a9f3f;   /* title chip / primary green */
  --green-save: #5cb85c;   /* save button */
  --green-dark: #4e9a3d;   /* confirm/check button */
  --red:        #DC4E41;   /* cancel / danger */
  --field-border: #E2E5EC;
  --field-text:   #495057;
  --readonly-bg:  #eeeeee;
  --bs-border-radius: .15rem;   /* squarer corners, like BS3 */
}

body {
  background: #f6f6f8;
  font-size: 13px;
  color: #333;
}

/* ---- top bar ---- */
.topbar {
  height: 46px;
  background: #fff;
  border-bottom: 1px solid #e3e3e3;
}
.brand {
  font-weight: 700;
  color: #2c3e50;
  font-size: 20px;
  letter-spacing: .5px;
  text-decoration: none;
}
.brand small { color: var(--green); font-size: 9px; vertical-align: super; }
.topbar-icons a { color: #6b7b90; font-size: 17px; text-decoration: none; }
.topbar-icons a:hover { color: var(--bar); }
.topbar-search { width: 170px; }
.topbar-searchbox { position: relative; }
.topbar-suggest {
  display: none; position: absolute; top: 100%; right: 0; z-index: 1080;
  width: 420px; max-height: 60vh; overflow-y: auto; margin-top: 4px;
  background: #fff; border: 1px solid #d6dde6; border-radius: 4px; box-shadow: 0 6px 18px rgba(0,0,0,.13);
}
.topbar-suggest.open { display: block; }
.topbar-suggest .sg-item, .topbar-suggest .sg-more, .topbar-suggest .sg-empty {
  display: block; padding: 7px 12px; font-size: 13px; color: #33414f; text-decoration: none;
}
.topbar-suggest .sg-item + .sg-item { border-top: 1px solid #eef2f6; }
.topbar-suggest a.sg-item:hover, .topbar-suggest a.sg-active { background: #eef4fb; }
.topbar-suggest .sg-off, .topbar-suggest .sg-empty { color: #8c98a6; }
.topbar-suggest .sg-more { border-top: 1px solid #d6dde6; background: #f7f9fc; font-weight: 600; }

/* ---- dark sub-header ---- */
.subbar {
  height: 38px;
  background: var(--bar);
  color: #fff;
  font-size: 13px;
}
.title-chip {
  background: var(--green);
  color: #fff;
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
  letter-spacing: .4px;
  padding: 0 14px;
  height: 38px;
  display: flex;
  align-items: center;
}
.subbar .crumb { color: #d2d9e2; text-decoration: none; }
.subbar .crumb:hover { color: #fff; }
.subbar .bi { color: #d2d9e2; font-size: 15px; }

/* ============================================================
   APP SHELL — like the old Riguel app: a persistent TOP menu bar +
   dark sub-header, then a full-width content area that holds either a
   native screen or an embedded (iframe) old Mojito screen. NO sidebar.
   Full-height flex so the iframe can fill.
   ============================================================ */
html, body { height: 100%; }
body.app-shell { height: 100vh; margin: 0; display: flex; flex-direction: column; overflow: hidden; }
.app-shell .topbar { flex: 0 0 46px; }
.app-shell .subbar { flex: 0 0 38px; }
.shell-body { flex: 1 1 auto; display: flex; min-height: 0; }
.app-shell .content-host { flex: 1 1 auto; min-width: 0; min-height: 0; overflow: auto; padding: 14px 16px; }

/* ---- top horizontal menu (the single navigation, mimics the old principal-menu) ---- */
.main-nav .nav-item {
  display: flex; align-items: center; gap: 6px; height: 46px;
  padding: 0 13px; color: #5b6b80; font-size: 13px; font-weight: 600;
  text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap;
}
.main-nav .nav-item .bi { font-size: 15px; color: #8b99ad; }
.main-nav .nav-item:hover { color: var(--bar); background: #f5f6f8; }
.main-nav .nav-item.active { color: var(--bar); border-bottom-color: var(--green); background: #f7f9f7; }
.main-nav .nav-item.active .bi { color: var(--green); }
.main-nav .dropdown-toggle::after { margin-left: 6px; }
/* the top bar must paint ABOVE the embedded iframe so dropdowns overlay it */
.app-shell .topbar { position: relative; z-index: 1050; }
.shell-menu.dropdown-menu { max-height: 76vh; overflow-y: auto; font-size: 13px;
  border-radius: .15rem; box-shadow: 0 6px 22px rgba(0,0,0,.18); }
.shell-menu .dropdown-item { padding: .32rem .9rem; }
.shell-menu .dropdown-item.active { background: var(--green); color: #fff; }
.shell-menu .dropdown-item:active { background: var(--green); }
/* "NUEVO" badge on already-migrated menu items (native new screen) */
.badge-nuevo { background: var(--green); color: #fff; font-size: 8.5px; font-weight: 700;
  letter-spacing: .5px; padding: 1px 6px; border-radius: 9px; line-height: 1.5; }
.shell-menu .dropdown-item.active .badge-nuevo { background: #fff; color: var(--green); }

/* ---- hamburger ---- */
.hamburger { border: 0; background: none; color: #6b7b90; font-size: 20px; line-height: 1;
  padding: 0 10px 0 0; cursor: pointer; }
.hamburger:hover { color: var(--bar); }

/* ---- hideable left PUSH sidebar (hidden by default; the hamburger reveals it).
       In-flow flex item: when open it occupies width and pushes the content right,
       it does NOT overlay the screen. ---- */
.sidebar {
  flex: 0 0 auto; width: 0; overflow: hidden; white-space: nowrap;
  background: var(--bar); color: #cdd5e0;
  display: flex; flex-direction: column;
  transition: width .18s ease;
}
body.sidebar-open .sidebar { width: 256px; overflow-y: auto; }
/* nice slim scrollbar */
.sidebar::-webkit-scrollbar { width: 8px; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,.14); border-radius: 4px; }

.sidebar .sb-head { display: flex; align-items: center; gap: 9px; padding: 13px 16px;
  font-size: 13px; font-weight: 700; color: #fff; letter-spacing: .3px;
  border-bottom: 1px solid rgba(255,255,255,.08); background: rgba(0,0,0,.12); }
.sidebar .sb-head .bi { color: var(--green); font-size: 16px; }

.sidebar .nav-section { display: flex; align-items: center; gap: 8px;
  font-size: 10px; text-transform: uppercase; letter-spacing: .7px;
  color: #8b99ad; padding: 12px 16px 5px; }
.sb-pill { background: var(--green); color: #fff; font-size: 8.5px; font-weight: 700;
  letter-spacing: .5px; padding: 1px 6px; border-radius: 10px; }

.sidebar a.nav-link { display: flex; align-items: center; gap: 10px; color: #d7deea;
  font-size: 13px; font-weight: 500; padding: 8px 16px; border-left: 3px solid transparent;
  border-radius: 0; transition: background .12s; }
.sidebar a.nav-link .bi { font-size: 15px; width: 18px; text-align: center; color: #aab6c6; }
.sidebar a.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; }
.sidebar a.nav-link.active { background: rgba(74,159,63,.18); border-left-color: var(--green); color: #fff; }
.sidebar a.nav-link.active .bi { color: var(--green); }
.sidebar a.nav-link.is-new .bi { color: var(--green); }

/* collapsible group header */
.sidebar .sb-group { width: 100%; display: flex; align-items: center; gap: 10px;
  background: none; border: 0; color: #cdd5e0; font-size: 12.5px; font-weight: 600;
  padding: 9px 14px; text-align: left; cursor: pointer; }
.sidebar .sb-group:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar .sb-group > .bi:first-child { color: #aab6c6; font-size: 15px; width: 18px; text-align: center; }
.sidebar .sb-group .sb-count { margin-left: auto; background: rgba(255,255,255,.12);
  color: #cdd5e0; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 9px; }
.sidebar .sb-group .sb-caret { color: #8b99ad; font-size: 12px; transition: transform .15s; margin-left: 6px; }
.sidebar .sb-group[aria-expanded="true"] .sb-caret { transform: rotate(180deg); }
.sidebar .sb-group[aria-expanded="true"] { color: #fff; }

/* sub-items inside a group */
.sidebar a.nav-link.sb-sub { padding: 6px 16px 6px 22px; font-size: 12.5px; font-weight: 400; color: #b9c2d0; }
.sidebar a.nav-link.sb-sub .bi { font-size: 16px; color: #6f7d92; width: 14px; }
.sidebar a.nav-link.sb-sub:hover { color: #fff; }
.sidebar a.nav-link.sb-sub.active { background: rgba(74,159,63,.20); color: #fff; }
.sidebar a.nav-link.sb-sub.active .bi { color: var(--green); }

/* ---- breadcrumb in the dark sub-header (like the old app) ---- */
.subbar .crumbs { display: inline-flex; align-items: center; flex-wrap: wrap; }
.subbar .crumb { color: #d2d9e2; text-decoration: none; font-size: 13px; cursor: pointer; }
.subbar .crumb:hover { color: #fff; text-decoration: underline; }
.subbar .crumbs > .bi { color: #8f9bad; font-size: 12px; }
.subbar .crumb .bi { font-size: 13px; }

/* ---- embedded old screen: iframe fills the host, no card, no gutter ---- */
.content-host:has(.embed-frame) { padding: 0; overflow: hidden; }
.content-card:has(.embed-frame) { padding: 0; border: 0; border-radius: 0; height: 100%; background: #fff; }
/* definite viewport height (not %) so the embedded Mojito grid sizes its page to
   the full height from the first paint — a % height resolves a beat after :has()
   applies, and Mojito reads window.innerHeight too early -> tiny grid.
   84px = topbar(46) + subbar(38). */
.embed-frame { width: 100%; height: calc(100vh - 84px); border: 0; display: block; }

/* ---- dashboard (home) ---- */
.stat-card { background:#fff; border:1px solid #e3e6ea; border-radius:4px; padding:14px 16px; height:100%; }
.stat-card .stat-num { font-size:30px; font-weight:700; line-height:1; color:#2c3e50; }
.stat-card .stat-lbl { font-size:12px; color:#6b7b90; margin-top:4px; }
.stat-card .bi { font-size:20px; }
.stat-hero { background: linear-gradient(180deg,#fff, #fbf3f2); border-left:4px solid var(--red); }
.stat-hero .stat-num { color: var(--red); font-size:38px; }
.stat-open  { border-top:3px solid #4a9f3f; }
.stat-proc  { border-top:3px solid #e0a800; }
.stat-close { border-top:3px solid #6c757d; }

/* ---- content card ---- */
.content-card {
  background: #fff;
  border: 1px solid #e3e6ea;
  border-radius: 3px;
  padding: 18px 20px;
}

/* ---- forms (compact, like the old app) ---- */
.form-label {
  font-size: 12px;
  font-weight: 700;
  color: #3a4654;
  margin-bottom: 2px;
}
.form-control, .form-select {
  font-size: 12.5px;
  border-color: var(--field-border);
  color: var(--field-text);
  padding: .3rem .5rem;
}
.form-control[readonly], .form-control:disabled, .form-select:disabled {
  background: var(--readonly-bg);
}
.input-group-text { background: #f3f5f8; border-color: var(--field-border); color: #6b7b90; }

/* ---- buttons ---- */
.btn-save   { background: var(--green-save); border-color: var(--green-save); color: #fff; }
.btn-save:hover   { background: #4cae4c; color: #fff; }
.btn-confirm{ background: var(--green-dark); border-color: var(--green-dark); color: #fff; }
.btn-confirm:hover{ background: #43862f; color: #fff; }
.btn-cancel { background: var(--red); border-color: var(--red); color: #fff; }
.btn-cancel:hover { background: #c63d31; color: #fff; }

/* ---- tables ---- */
.table { font-size: 12.5px; }
.table > thead { background: #f4f6f8; }
.badge-type { background: #eef; color: #3a4654; font-weight: 600; }

a { text-decoration: none; }

/* ============================================================
   LISTA DE PERSONAS dense grid (scoped: .lp-grid / .lp-tabs / .lp-card)
   Matches the old Bootstrap-3.4 build's compact density.
   ============================================================ */
.lp-grid { font-size: .8125rem; line-height: 1.25; }
.lp-grid table { width: 100%; margin-bottom: 0; }
.lp-grid thead th, .lp-grid tbody td {
  padding: .3rem .5rem; vertical-align: middle; border: 0;
  border-bottom: 1px solid var(--bs-border-color, #e3e6ea);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.lp-grid thead th { background: #3e4b5b; color: #fff; font-weight: 600; border-bottom: 0; }
.lp-grid tbody tr:nth-child(even) { background: #f6f7f9; }
.lp-grid tbody tr:hover { background: #eef1f4; }
.lp-grid td.col-domicilio { max-width: 320px; }
.lp-grid tr.filter-row td { padding: .15rem .4rem; background: #fafbfc; }
.lp-grid tr.filter-row input {
  width: 100%; font-size: .75rem; padding: .1rem .35rem;
  border: 1px solid transparent; border-bottom: 1px solid #d7dbe0; background: transparent;
}
.lp-grid tr.filter-row input:focus { border-color: #86b7fe; outline: 0; }
.lp-grid td a { color: #2c3e50; text-decoration: none; font-weight: 500; }
.lp-grid td a:hover { color: #0d6efd; text-decoration: underline; }

.lp-tabs.nav-tabs { border-bottom: 1px solid #d7dbe0; }
.lp-tabs .nav-link { padding: .35rem .75rem; font-size: .8125rem; color: #495057; border-radius: 0; border: 1px solid transparent; }
.lp-tabs .nav-link.active { background: #fff; color: #212529; font-weight: 600; border-color: #d7dbe0 #d7dbe0 #fff; }
.lp-tabs .badge { font-size: .7rem; font-weight: 600; background: #6c757d; }

.lp-card { border-radius: 0; box-shadow: none; }
.lp-card .card-body { padding: .5rem; }

/* --- glue the seed doesn't cover --- */
/* white, quiet sort links on the dark header */
.lp-grid thead th a { color: #fff; text-decoration: none; }
.lp-grid thead th a:hover { text-decoration: underline; }
/* let the grid live edge-to-edge: drop the outer content-card padding/border on this page */
.content-card:has(.lp-card) { padding: 0; border: 0; background: transparent; }
/* compact toolbar buttons */
.lp-toolbar .btn { padding: .15rem .4rem; font-size: .8125rem; }

/* ---- "total / míos" on the dashboard ---- */
.stat-mine { color: var(--bar); opacity: .62; font-weight: 600; }
.stat-num .stat-mine { font-size: .62em; }
.stat-legend { white-space: nowrap; }
