/* =====================================================================
   Sistema de Gestión Documental — Tesorería · SGD v2.0
   Tema visual (complementa a Bulma). Basado en el prototipo
   sql-planning/SGD Sistema Gestion Documental.html
   Paleta: fondo #f3f5f9 · acento teal #0BA5C7 · CTA #16299c · dark #0F1725
   ===================================================================== */
:root {
  --dark: #0F1725;
  --navy: #16299c;
  --blue: #0BA5C7;
  --blue2: #0BA5C7;
  --blue-dark: #0893b0;
  --teal-soft: #D9F1F7;
  --bg: #f3f5f9;
  --line: #e4e8f0;
  --line2: #eef1f7;
  --muted: #8b91a8;
  --ink: #1f2333;
  --ink2: #4a5068;
  --ok-bg: #E0F3EC;
  --ok-tx: #237a41;
  --err-bg: #fdecec;
  --err-tx: #d64545;
  --warn-bg: #FCF3DC;
  --warn-tx: #a97a11;
}

* {
  box-sizing: border-box
}

html,
body {
  margin: 0;
  padding: 0
}

html {
  scroll-behavior: smooth
}

body.sgd-app {
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Tahoma, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}

@keyframes sgdIn {
  from {
    opacity: 0;
    transform: translateY(6px)
  }

  to {
    opacity: 1;
    transform: none
  }
}

@keyframes sgdPop {
  from {
    opacity: 0;
    transform: scale(.97)
  }

  to {
    opacity: 1;
    transform: scale(1)
  }
}

.sgd-icon {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -3px
}

.sgd-icon.sm {
  width: 14px;
  height: 14px
}

.sgd-icon.lg {
  width: 18px;
  height: 18px
}

/* ============================== SHELL ============================== */
.sgd-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch
}

.sgd-maincol {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column
}

.sgd-content-area {
  flex: 1 0 auto;
  padding: 22px 28px 12px
}

/* ============================== SIDEBAR ============================ */
.sgd-sidebar {
  width: 280px;
  flex: 0 0 280px;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  transition: margin-left .18s ease;
}

body.menu-hidden .sgd-sidebar {
  margin-left: -280px
}

.sgd-side-head {
  background: var(--dark);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: .5px;
  height: 62px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.sgd-logo {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: #1c2940;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: .3px;
  border: 1px solid #33415c;
  flex: 0 0 26px;
}

.sgd-side-user {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  margin: 12px;
  padding: 18px 14px 16px;
  border-bottom: 1px solid var(--line);
  /*border: 1px solid var(--line); border-radius: 12px;*/
  background: #fff;
  /*box-shadow: 0 1px 4px rgba(16, 24, 64, .05);*/
  flex-shrink: 0;
}

.sgd-side-avatar {
  width: 66px;
  height: 66px;
  border-radius: 50%;
  background: #edf0f5;
  border: 3px solid #EAB308;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex: 0 0 66px;
}

.sgd-icon-avatar {
  width: 54px;
  height: 54px;
  fill: #aeb6c4;
  stroke: none;
  margin-bottom: -6px
}

.sgd-side-name {
  font-size: 14px;
  font-weight: 700;
  color: #4a4a4a;
  line-height: 1.25
}

.sgd-side-role {
  font-size: 10.5px;
  font-weight: 700;
  color: #5c6480;
  letter-spacing: .5px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-top: 1px;
}

.sgd-role-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--navy);
  flex: 0 0 8px
}

/* Avatar del topbar (iniciales) */
.sgd-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #cfe9f2;
  color: #1b7d99;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  flex: 0 0 44px;
}

.sgd-avatar.sm {
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  font-size: 12px
}

.sgd-nav {
  padding: 6px 0 12px;
  flex: 1
}

.sgd-nav-group {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 16px 16px 6px;
  text-transform: uppercase;
}

.sgd-nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  font-size: 13.5px;
  color: var(--ink2);
  text-decoration: none;
  border-left: 3px solid transparent;
}

.sgd-nav-item .sgd-icon {
  color: #7F8D9E
}

.sgd-nav-item:hover {
  background: #f4f6fb;
  color: var(--blue);
  text-decoration: none
}

.sgd-nav-item:hover .sgd-icon {
  color: var(--blue)
}

.sgd-nav-item.is-active {
  background: var(--teal-soft);
  color: #0a8cab;
  font-weight: 600;
  border-left-color: var(--blue);
}

.sgd-nav-item.is-active .sgd-icon {
  color: #0a8cab
}

.sgd-badge-count {
  font-size: 10px;
  background: var(--blue);
  color: #fff;
  border-radius: 9px;
  padding: 1px 7px;
  margin-left: auto;
}

.sgd-side-foot {
  padding: 14px 16px 18px;
  flex-shrink: 0
}

.sgd-salir {
  width: 100%;
  height: 38px;
  background: var(--blue);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}

.sgd-salir:hover {
  background: var(--blue-dark)
}

/* ============================== TOPBAR ============================= */
.sgd-topbar {
  height: 62px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  flex-shrink: 0;
}

.sgd-iconbtn {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 8px;
  color: #5c6480;
  cursor: pointer;
  position: relative;
}

.sgd-iconbtn:hover {
  background: #f4f6fb;
  color: var(--ink)
}

.sgd-iconbtn .dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--err-tx);
  border: 1.5px solid #fff;
}

.sgd-pills {
  display: flex;
  gap: 8px;
  align-items: center
}

.sgd-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 13px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink2);
  background: #fff;
  white-space: nowrap;
}

.sgd-pill .pdot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block
}

.sgd-pill.is-active {
  background: var(--teal-soft);
  border-color: #9fdcea;
  color: #0a7d9b
}

.sgd-topuser {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 6px
}

.sgd-topuser b {
  font-size: 14px;
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap
}

/* Campana con contador */
.sgd-notif {
  position: absolute;
  top: 3px;
  right: 3px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  background: var(--err-tx);
  color: #fff;
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  border-radius: 9px;
  border: 1.5px solid #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Menú de usuario (dropdown) */
.sgd-usermenu {
  position: relative;
  margin-left: 6px
}

.sgd-usermenu-trigger {
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 8px;
  font-family: inherit;
}

.sgd-usermenu-trigger:hover {
  background: #f4f6fb
}

.sgd-usermenu-id {
  text-align: left;
  line-height: 1.2
}

.sgd-usermenu-id b {
  display: block;
  font-size: 13.5px;
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap
}

.sgd-usermenu-id small {
  display: block;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap
}

.sgd-chev {
  color: #8b91a8;
  transition: transform .18s ease
}

.sgd-usermenu.is-open .sgd-chev {
  transform: rotate(180deg)
}

.sgd-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 256px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 34px rgba(10, 15, 40, .16);
  padding: 6px;
  z-index: 80;
  display: none;
  animation: sgdPop .12s ease;
}

.sgd-usermenu.is-open .sgd-dropdown {
  display: block
}

.sgd-dd-head {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 10px 12px
}

.sgd-dd-name {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--ink)
}

.sgd-dd-mail {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 2px
}

.sgd-dd-sep {
  height: 1px;
  background: var(--line2);
  margin: 2px 0
}

.sgd-dd-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 7px;
  font-size: 13px;
  color: var(--ink2);
  text-align: left;
  text-decoration: none;
  background: none;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.sgd-dd-item:hover {
  background: #f4f6fb;
  color: var(--ink);
  text-decoration: none
}

.sgd-dd-item .sgd-icon {
  color: #7F8D9E
}

.sgd-dd-item.danger {
  color: var(--err-tx)
}

.sgd-dd-item.danger .sgd-icon {
  color: var(--err-tx)
}

.sgd-dd-item.danger:hover {
  background: #fdecec
}

.sgd-dd-badge {
  margin-left: auto;
  background: #fde7e7;
  color: var(--err-tx);
  font-size: 10px;
  font-weight: 700;
  border-radius: 9px;
  padding: 1px 8px;
}

/* ============================ BREADCRUMB =========================== */
.sgd-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #6C7791;
  margin-bottom: 16px;
}

.sgd-breadcrumb .sep {
  color: #b6bbcd
}

.sgd-breadcrumb .current {
  color: var(--blue);
  font-weight: 600
}

/* ============================== FOOTER ============================= */
.sgd-footer {
  text-align: center;
  padding: 22px 10px 20px;
  font-size: 12px;
  color: var(--muted);
  flex-shrink: 0;
}

.sgd-linkbtn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 11px;
  text-decoration: underline;
  padding: 0 0 0 8px;
  font-family: inherit;
}

/* ============================== PANELES ============================ */
.sgd-panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(16, 24, 64, .05);
  overflow: hidden;
  animation: sgdIn .25s ease;
}

.sgd-panel-head {
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  padding: 13px 18px;
  letter-spacing: .3px;
  border-bottom: 1px solid var(--line);
}

.sgd-toolbar {
  padding: 16px 18px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.sgd-field-label {
  font-size: 12px;
  color: var(--ink2);
  margin-bottom: 5px
}

.sgd-count {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap
}

/* Buscador con icono */
.sgd-search {
  position: relative;
  display: inline-flex;
  align-items: center
}

.sgd-search .sgd-icon {
  position: absolute;
  left: 11px;
  color: #a8aec2;
  pointer-events: none;
}

.sgd-search .sgd-input {
  padding-left: 34px
}

.sgd-input,
.sgd-select {
  height: 38px;
  border: 1px solid #d3d8e6;
  border-radius: 8px;
  padding: 0 11px;
  font-size: 13.5px;
  color: var(--ink);
  background: #fff;
  font-family: inherit;
}

.sgd-input:focus,
.sgd-select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(11, 165, 199, .15);
  outline: none;
}

.sgd-select {
  cursor: pointer
}

/* ============================== BOTONES ============================ */
.sgd-btn {
  height: 38px;
  padding: 0 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  border-radius: 8px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-content: center;
}

.sgd-btn-primary {
  background: var(--blue);
  color: #fff;
  border: none
}

.sgd-btn-primary:hover {
  background: var(--blue-dark)
}

.sgd-btn-ghost {
  background: #fff;
  color: var(--blue);
  border: 1px solid var(--blue)
}

.sgd-btn-ghost:hover {
  background: #eaf8fb
}

.sgd-btn-light {
  background: #f4f6fb;
  border: 1px solid var(--line);
  color: var(--ink2)
}

.sgd-btn-light:hover {
  background: #eaedf5
}

.sgd-btn-sm {
  height: 31px;
  padding: 0 13px;
  font-size: 12px;
  border-radius: 7px
}

/* ============================== TABLAS ============================= */
.sgd-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.sgd-table thead th {
  background: #f7f8fc;
  border-bottom: 1px solid var(--line);
  font-size: 12.5px;
  font-weight: 600;
  color: #3d465c;
  padding: 12px;
  text-align: left;
  white-space: nowrap;
}

.sgd-table tbody td {
  border-bottom: 1px solid var(--line2);
  padding: 13px 12px;
  color: var(--ink);
  vertical-align: middle;
}

.sgd-table tbody tr {
  cursor: pointer
}

.sgd-table tbody tr:hover {
  background: #fafbfe
}

.sgd-table .c-blue {
  color: var(--blue);
  font-weight: 600
}

.sgd-chip {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--blue);
  white-space: nowrap;
}

.sgd-estado {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .3px;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
}

.sgd-star {
  cursor: pointer;
  line-height: 1;
  font-size: 15px;
  font-family: inherit
}

.sgd-truncate {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

/* Iconos de acción de la tabla */
.sgd-act {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: none;
  padding: 0;
  font-family: inherit;
}

.sgd-act:hover {
  background: #f1f3f9
}

.sgd-act.teal {
  color: var(--blue)
}

.sgd-act.red {
  color: var(--err-tx)
}

.sgd-act.gray {
  color: #8b91a8
}

.sgd-act.dark {
  color: #3d465c
}

/* ============================ PAGINACIÓN =========================== */
.sgd-pagebar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-top: 1px solid var(--line2);
  font-size: 13px;
  color: var(--muted);
  flex-wrap: wrap;
}

.sgd-pages {
  display: flex;
  align-items: center;
  gap: 6px
}

.sgd-page {
  min-width: 30px;
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  cursor: pointer;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink2);
  background: #fff;
  text-decoration: none;
}

.sgd-page:hover {
  border-color: var(--blue);
  color: var(--blue)
}

.sgd-page.is-active {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
  font-weight: 600
}

.sgd-page.is-nav {
  border: none;
  background: none;
  color: var(--muted)
}

.sgd-page.is-nav:hover {
  color: var(--blue)
}

/* ====================== DETALLE DE EXPEDIENTE ====================== */
.sgd-detail {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(16, 24, 64, .05);
  overflow: hidden;
  margin-top: 16px;
  animation: sgdIn .25s ease;
}

.sgd-detail-bar {
  background: #f7f8fc;
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
}

.sgd-detail-grid {
  display: grid;
  grid-template-columns: 224px 1fr 300px;
  min-height: 390px;
}

.sgd-tree {
  border-right: 1px solid var(--line2);
  background: #fafbfe;
  padding: 10px 0
}

.sgd-tree-title {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: .8px;
  padding: 0 12px 8px;
}

.sgd-tree-node {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  cursor: pointer;
  padding: 6px 10px;
  border-left: 3px solid transparent;
  color: var(--ink2);
  text-decoration: none;
}

.sgd-tree-node:hover {
  background: #f1f3f9;
  text-decoration: none
}

.sgd-tree-node.is-active {
  background: var(--teal-soft);
  border-color: var(--blue);
  color: #0a7d9b;
  font-weight: 700;
}

.sgd-tree-count {
  margin-left: auto;
  font-size: 10px;
  color: #a8aec2
}

.sgd-files-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line2);
}

.sgd-frow {
  display: grid;
  grid-template-columns: 1fr 120px 116px 74px 96px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line2);
  align-items: center;
  font-size: 12px;
  color: var(--ink2);
  cursor: pointer;
}

.sgd-frow:hover {
  background: #fafbfe
}

.sgd-frow.is-head {
  background: #f7f8fc;
  font-weight: 700;
  color: #3d465c;
  cursor: default
}

.sgd-badge {
  font-size: 8.5px;
  font-weight: 700;
  color: #fff;
  padding: 2px 5px;
  border-radius: 3px
}

.sgd-fname {
  font-size: 12.5px;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sgd-preview {
  border-left: 1px solid var(--line2);
  background: #fafbfe;
  display: flex;
  flex-direction: column
}

.sgd-preview-head {
  background: #f1f8fa;
  border-bottom: 1px solid var(--line2);
  padding: 7px 11px;
  font-size: 10.5px;
  font-weight: 700;
  color: #0a7d9b;
  letter-spacing: .5px;
}

.sgd-preview-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  text-align: center;
  color: #a8aec2;
  font-size: 12px;
}

.sgd-doc-mock {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 12px;
  min-height: 170px;
  box-shadow: 0 1px 4px rgba(16, 24, 64, .07);
}

.sgd-doc-line {
  height: 5px;
  background: var(--line2);
  margin-bottom: 5px;
  border-radius: 2px
}

/* Panel inferior (comentarios / historial) */
.sgd-panel-tabs {
  display: flex;
  align-items: center;
  background: #f7f8fc;
  border-bottom: 1px solid var(--line2);
  padding: 0 12px;
}

.sgd-ptab {
  padding: 9px 16px;
  font-size: 12.5px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  color: var(--ink2);
  text-decoration: none;
}

.sgd-ptab.is-active {
  font-weight: 700;
  color: var(--blue);
  border-color: var(--blue)
}

.sgd-comment {
  border-left: 3px solid var(--blue);
  padding: 9px 12px;
  margin-bottom: 9px;
  background: #f8fafc;
  border-radius: 0 6px 6px 0;
}

.sgd-comment.is-obs {
  border-color: var(--err-tx);
  background: #fdf5f5
}

.sgd-reply {
  margin: 7px 0 0 14px;
  padding: 7px 10px;
  background: #fff;
  border: 1px solid var(--line2);
  border-radius: 6px;
}

.sgd-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px
}

/* ============================== MODALES ============================ */
.sgd-modal-card-head {
  background: var(--dark);
  color: #fff;
  padding: 11px 15px;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-radius: 10px 10px 0 0;
}

.modal-card {
  border-radius: 10px;
  overflow: hidden
}

.sgd-drop {
  border: 2px dashed #c4cbdd;
  background: #fafbfe;
  border-radius: 8px;
  padding: 26px;
  text-align: center;
  cursor: pointer;
}

.sgd-drop:hover {
  border-color: var(--blue);
  background: #f1f8fa
}

/* ============================== TOAST ============================== */
.sgd-toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--dark);
  color: #fff;
  padding: 11px 22px;
  font-size: 13px;
  border-radius: 8px;
  box-shadow: 0 6px 22px rgba(10, 15, 40, .35);
  z-index: 120;
  animation: sgdIn .18s ease;
}

/* ============= Filas genéricas (Documentos/Favoritos/Consultas) ==== */
.sgd-generic-row {
  display: grid;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line2);
  align-items: center;
  font-size: 12.5px;
}

.sgd-generic-row:hover {
  background: #fafbfe
}

.sgd-section-head {
  padding: 10px 16px;
  background: #f7f8fc;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--ink);
  display: flex;
  gap: 8px;
  align-items: center;
}

/* ================== DASHBOARD "MIS SISTEMAS" ======================= */
.sgd-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 18px;
}

.sgd-stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(16, 24, 64, .05);
  padding: 18px 22px;
  animation: sgdIn .25s ease;
}

.sgd-stat-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: var(--muted);
  text-transform: uppercase;
}

.sgd-stat-num {
  font-size: 30px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.2;
  margin: 4px 0 2px
}

.sgd-stat-sub {
  font-size: 12px;
  color: var(--muted)
}

.sgd-stat-sub.ok {
  color: var(--ok-tx)
}

.sgd-stat-sub.warn {
  color: var(--warn-tx)
}

.sgd-stat-sub.err {
  color: var(--err-tx)
}

.sgd-mods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  padding: 16px 22px 22px;
}

.sgd-mod {
  display: flex;
  align-items: center;
  gap: 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  text-decoration: none;
  color: inherit;
}

.sgd-mod:hover {
  border-color: var(--blue);
  background: #fafdfe;
  text-decoration: none
}

.sgd-mod-icon {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: #57c9e0;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 42px;
}

.sgd-mod-title {
  display: block;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink)
}

.sgd-mod-sub {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 1px
}

/* ============================ RESPONSIVE =========================== */
/* Backdrop del menú móvil y contenedor con scroll horizontal */
.sgd-overlay { display: none }
.sgd-scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch }

/* ---- Tablets / pantallas medianas ---- */
@media (max-width: 1100px) {
  .sgd-pills { display: none }
  .sgd-content-area { padding: 18px 18px 10px }
}

/* ---- Móvil: menú lateral tipo off-canvas ---- */
@media (max-width: 900px) {
  .sgd-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 60;
    margin-left: 0 !important;
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(10, 15, 40, .22);
  }
  body.menu-open .sgd-sidebar { transform: none }
  body.menu-open .sgd-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 37, .45);
    z-index: 55;
  }
  .sgd-content-area { padding: 14px }
  .sgd-topbar { padding: 0 14px; gap: 8px }
  .sgd-stats-grid { grid-template-columns: repeat(2, 1fr) }
  .sgd-mods { grid-template-columns: 1fr }
  .sgd-detail-grid { grid-template-columns: 1fr }
  .sgd-scroll-x .sgd-generic-row { min-width: 620px }
}

/* ---- Teléfonos ---- */
@media (max-width: 560px) {
  .sgd-usermenu-id { display: none }
  .sgd-breadcrumb { font-size: 13px }
  .sgd-content-area { padding: 12px }
  .sgd-stats-grid { grid-template-columns: 1fr }
  .sgd-dropdown { width: 240px }
  .sgd-panel-head { font-size: 13px; padding: 11px 14px }
  .sgd-toolbar { padding: 12px 12px 8px }
  .sgd-toolbar .sgd-input, .sgd-toolbar .sgd-select { width: 100% !important }
  .sgd-toolbar > * { flex: 1 1 100% }
}
/* ============= ABM administrativo (Configuración / Generalidades) ========= */
.sgd-admin-head { display: flex; align-items: center; gap: 12px; padding: 16px 18px 10px }
.sgd-admin-head .sgd-count { padding: 0 }
.sgd-badge-state { font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 4px; white-space: nowrap }
.sgd-badge-state.on { color: var(--ok-tx); background: var(--ok-bg) }
.sgd-badge-state.off { color: var(--muted); background: #eef1f7 }
.sgd-table tbody tr.is-off td { opacity: .55 }
.sgd-mfield { margin-bottom: 14px }
.sgd-mfield:last-child { margin-bottom: 0 }
.sgd-mfield > label { display: block; font-size: 12.5px; color: var(--ink2); font-weight: 600; margin-bottom: 6px }
.modal-card-body .sgd-input, .modal-card-body .sgd-select { width: 100% }
.sgd-check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink2); cursor: pointer }
.sgd-check input { accent-color: var(--blue); width: 16px; height: 16px }

/* Grid de filtros (Consultas) — responsivo */
.sgd-filtros { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 12px; align-items: end; padding: 16px 18px }
@media (max-width: 900px) { .sgd-filtros { grid-template-columns: 1fr 1fr } }
@media (max-width: 560px) { .sgd-filtros { grid-template-columns: 1fr } }
