/* Usuarios → Mis grupos y Etiquetas (S090-078c / S090-088a)
   Mismo lenguaje que el roster de Mis clientes (mc-roster.css): lista tipo
   Linear/Attio con hairlines, una acción visible + «⋯», avatares apilados y
   chips de color legibles en claro/oscuro (el color del chip se mezcla con
   --text, así contrasta en ambos temas). ≤900 px: tarjetas y hojas inferiores.
   Objetivos ≥44 px (50 px CSS ≈ 44 reales con zoom 0.875). Prefijo `mgt-`. */

.mgt-panel {
  --dur-fast: 150ms;
  --dur-base: 180ms;
  --mgt-hover: color-mix(in srgb, var(--text) 4%, transparent);
  --mgt-row-h: 62px;
  overflow: visible !important;
  max-width: 100%;
  min-width: 0;
}
.mgt-workspace {
  display: flex !important;
  flex-direction: column;
  gap: 12px;
  padding: 0 !important;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  min-width: 0;
}

/* ── Intro ─────────────────────────────────────────────────────── */
.mgt-intro {
  padding: 4px 0 0;
}
.mgt-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}
.mgt-sub {
  margin: 2px 0 0;
  max-width: min(72ch, 100%);
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  text-wrap: pretty;
}
.mgt-count {
  display: inline-grid;
  place-items: center;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.mgt-count[hidden] {
  display: none;
}

/* ── Toolbar ───────────────────────────────────────────────────── */
.mgt-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 0;
}
.mgt-spacer {
  flex: 1 1 0;
}
.mgt-search {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 320px;
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  transition: border-color var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.mgt-search:focus-within {
  border-color: color-mix(in srgb, var(--tenant-primary) 55%, var(--hairline));
  box-shadow: 0 0 0 3px var(--tenant-primary-soft);
}
.mgt-search .nav-ico {
  flex: none;
  width: 16px;
  height: 16px;
}
.mgt-search input {
  flex: 1;
  min-width: 0;
  height: 100% !important;
  padding: 0 !important;
  border: 0 !important;
  outline: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--text);
  font-size: 14px;
}
.mgt-search-block {
  flex: none !important;
  width: 100%;
}
.mgt-filter {
  display: inline-flex !important;
  align-items: center;
  gap: 6px;
  width: auto !important;
  height: 38px !important;
  min-width: 0 !important;
  padding: 0 12px !important;
  border: 1px solid var(--hairline) !important;
  border-radius: 10px !important;
  background: var(--surface) !important;
  color: var(--text) !important;
  font-size: 13px !important;
  font-weight: 550;
  box-shadow: none !important;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}
.mgt-filter .nav-ico {
  width: 15px;
  height: 15px;
  color: var(--muted);
}
.mgt-filter:hover {
  background: var(--surface-2) !important;
}
.mgt-filter-val {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-weight: 500;
}
.mgt-filter.is-active {
  border-color: color-mix(in srgb, var(--tenant-primary) 45%, var(--hairline)) !important;
  background: var(--tenant-primary-soft) !important;
}
.mgt-filter.is-active .mgt-filter-val,
.mgt-filter.is-active .nav-ico {
  color: var(--tenant-primary);
}
.mgt-link {
  height: 32px;
  padding: 0 8px !important;
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--muted) !important;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.mgt-link:hover {
  color: var(--text) !important;
}
.mgt-link[hidden] {
  display: none !important;
}
.mgt-primary {
  display: inline-flex !important;
  flex: none !important;
  align-items: center;
  gap: 6px;
  width: auto !important;
  margin: 0 !important;
  height: 38px !important;
  padding: 0 14px 0 12px !important;
  border-radius: 10px !important;
  font-size: 13.5px !important;
  font-weight: 650 !important;
  white-space: nowrap;
}
.mgt-primary .nav-ico {
  width: 16px;
  height: 16px;
}
.mgt-alert {
  margin: 0;
  padding: 10px 12px;
  border: 1px solid color-mix(in srgb, var(--sys-warn) 40%, var(--hairline));
  border-radius: 10px;
  background: color-mix(in srgb, var(--sys-warn) 9%, var(--surface));
  color: var(--text);
  font-size: 13px;
}
.mgt-alert.hidden {
  display: none;
}
.mgt-note {
  margin: 0;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.45;
}
.mgt-note[hidden] {
  display: none;
}

/* ── Lista ─────────────────────────────────────────────────────── */
.mgt-wrap {
  overflow-x: auto;
  overflow-y: visible;
  max-width: 100%;
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  background: var(--surface);
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}
.mgt-cols-groups {
  grid-template-columns: minmax(0, 2.4fr) minmax(140px, 1.1fr) minmax(120px, 1fr) 108px minmax(148px, auto);
}
.mgt-cols-tags {
  grid-template-columns: minmax(0, 1.6fr) minmax(100px, 1fr) minmax(150px, 1.2fr) 108px minmax(160px, auto);
}
.mgt-head {
  display: grid;
  align-items: center;
  height: 40px;
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 600;
}
.mgt-head > span {
  padding: 0 8px 0 0;
}
.mgt-list {
  display: flex;
  flex-direction: column;
}
.mgt-row {
  display: grid;
  align-items: center;
  min-height: var(--mgt-row-h);
  padding: 0 8px 0 16px;
  border-bottom: 1px solid var(--hairline);
  color: var(--text);
  font-size: 13.5px;
  cursor: pointer;
  outline: none;
  transition: background var(--dur-fast) var(--ease-out);
  animation: mgt-fade var(--dur-base) var(--ease-out) both;
}
.mgt-row:last-child {
  border-bottom: 0;
}
.mgt-row:hover {
  background: var(--mgt-hover);
}
.mgt-row:focus-visible {
  box-shadow: inset 0 0 0 2px var(--tenant-primary);
}
.mgt-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding-right: 8px;
}
.mgt-main {
  gap: 12px;
}
.mgt-main-copy {
  display: grid;
  min-width: 0;
}
.mgt-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}
.mgt-desc,
.mgt-trunc {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mgt-desc {
  font-size: 12.5px;
  color: var(--muted);
}
.mgt-date,
.mgt-cat {
  color: var(--muted);
  font-size: 13px;
}
.mgt-date {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.mgt-num {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.mgt-muted,
.mgt-empty-line {
  color: color-mix(in srgb, var(--muted) 85%, transparent);
  font-size: 13px;
}
.mgt-empty-line {
  margin: 0;
  padding: 12px 4px;
}
.mgt-actions {
  justify-content: flex-end;
  gap: 4px;
  padding-right: 0;
}
.mgt-group-avatar {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
}
.mgt-group-avatar.is-ph {
  display: inline-grid;
  place-items: center;
  background: var(--tenant-primary-soft);
  color: var(--tenant-primary);
  font-size: 13px;
  font-weight: 700;
}

/* Avatares */
.mgt-avatar {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--tenant-primary) 12%, var(--surface));
  border: 1px solid color-mix(in srgb, var(--tenant-primary) 18%, var(--hairline));
  color: color-mix(in srgb, var(--tenant-primary) 70%, var(--text));
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
html[data-theme="dark"] .mgt-avatar:not(.is-more),
html[data-theme="dark"] .mgt-group-avatar.is-ph {
  background: color-mix(in srgb, var(--tenant-primary) 26%, var(--surface));
  color: color-mix(in srgb, var(--tenant-primary) 30%, var(--text));
}
.mgt-avatar.is-sm {
  width: 24px;
  height: 24px;
  font-size: 10px;
}
.mgt-stack {
  display: inline-flex;
  align-items: center;
}
.mgt-stack .mgt-avatar {
  width: 26px;
  height: 26px;
  margin-left: -8px;
  border: 2px solid var(--surface);
  font-size: 10px;
}
.mgt-stack .mgt-avatar:first-child {
  margin-left: 0;
}
.mgt-stack .mgt-avatar.is-more {
  background: var(--surface);
  border-color: var(--hairline);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.mgt-row:hover .mgt-stack .mgt-avatar:not(.is-more) {
  border-color: color-mix(in srgb, var(--surface) 92%, var(--text));
}
.mgt-stack-slot:empty {
  display: none;
}

/* Chip de etiqueta */
.mgt-tag {
  --mgt-c: var(--mgt-tag, #64748b);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  height: 26px;
  padding: 0 10px 0 8px;
  border: 1px solid color-mix(in srgb, var(--mgt-c) 34%, var(--hairline));
  border-radius: 999px;
  background: color-mix(in srgb, var(--mgt-c) 13%, var(--surface));
  color: color-mix(in srgb, var(--mgt-c) 42%, var(--text));
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  vertical-align: middle;
}
.mgt-tag-dot {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--mgt-c);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--mgt-c) 22%, transparent);
}
.mgt-tag-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mgt-badge {
  flex: none;
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  cursor: help;
}

/* Botones de fila */
.mgt-btn {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: auto !important;
  height: 36px !important;
  min-width: 0 !important;
  min-height: 36px !important;
  padding: 0 12px !important;
  border: 1px solid var(--hairline) !important;
  border-radius: 8px !important;
  background: var(--surface) !important;
  box-shadow: none !important;
  color: var(--text) !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  white-space: nowrap;
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.mgt-btn .nav-ico {
  width: 15px;
  height: 15px;
  color: var(--muted);
}
.mgt-btn:hover {
  background: var(--surface-2) !important;
}
.mgt-btn:active {
  transform: scale(0.97);
}
.mgt-btn:disabled {
  opacity: 0.55;
  cursor: progress;
}
.mgt-btn:focus-visible,
.mgt-more:focus-visible,
.mgt-filter:focus-visible,
.mgt-icon-btn:focus-visible {
  outline: 2px solid var(--tenant-primary) !important;
  outline-offset: 1px;
}
.mgt-btn.is-quiet {
  border-color: transparent !important;
  background: transparent !important;
  color: var(--muted) !important;
}
.mgt-btn.is-quiet:hover {
  background: color-mix(in srgb, var(--sys-err) 9%, transparent) !important;
  color: var(--sys-err) !important;
}
.mgt-more {
  display: inline-grid !important;
  place-items: center;
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 8px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--muted) !important;
}
.mgt-more .nav-ico {
  width: 18px;
  height: 18px;
  fill: currentColor;
  stroke: none;
}
.mgt-more:hover,
.mgt-more[aria-expanded="true"] {
  background: var(--surface-2) !important;
  color: var(--text) !important;
}
.mgt-icon-btn {
  display: inline-grid !important;
  place-items: center;
  flex: none;
  width: 36px !important;
  height: 36px !important;
  min-width: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 9px !important;
  background: transparent !important;
  box-shadow: none !important;
  color: var(--muted) !important;
  cursor: pointer;
}
.mgt-icon-btn:hover {
  background: var(--surface-2) !important;
  color: var(--text) !important;
}
.mgt-icon-btn .nav-ico {
  width: 18px;
  height: 18px;
}

/* Estados */
.mgt-row-skel {
  display: flex;
  gap: 14px;
  cursor: default;
  animation: none;
}
.mgt-skel {
  display: block;
  height: 12px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--surface-2) 0%,
    color-mix(in srgb, var(--surface-2) 55%, var(--surface)) 50%,
    var(--surface-2) 100%
  );
  background-size: 200% 100%;
  animation: mgt-shimmer 1.3s linear infinite;
}
.mgt-skel.is-avatar {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
}
.mgt-skel.is-short {
  width: 12%;
  margin-left: auto;
  margin-right: 12px;
}
.mgt-state {
  padding: 28px 16px;
  min-height: 180px;
}
.mgt-state .empty-block {
  margin: 0 auto;
  border: 0 !important;
  background: transparent !important;
}
.mgt-state .empty-block-actions .btn-primary {
  min-height: 44px;
  padding-inline: 16px;
}
.mgt-state.is-error {
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
}
.mgt-state.is-error strong {
  font-size: 14px;
}
.mgt-state.is-error p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
}
.mgt-pager {
  margin-top: 0 !important;
}

/* Personas (drawer de grupo y diálogo de etiqueta) */
.mgt-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 8px 0 0;
  font-size: 13px;
  font-weight: 650;
  color: var(--text);
}
.mgt-people-list {
  display: flex;
  flex-direction: column;
  margin: 0;
  padding: 0;
  list-style: none;
}
.mgt-people-list[hidden] {
  display: none;
}
#grupo-add-member-results,
#mgt-tag-clients-results {
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 4px;
  background: var(--surface);
  box-shadow: var(--elev-1);
  animation: mgt-fade var(--dur-fast) var(--ease-out);
}
.mgt-person {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 6px 6px 6px 8px;
  border-radius: 8px;
  transition: background var(--dur-fast) var(--ease-out);
}
.mgt-people-list > .mgt-person + .mgt-person {
  border-top: 1px solid var(--hairline);
  border-radius: 0;
}
#grupo-add-member-results .mgt-person,
#mgt-tag-clients-results .mgt-person {
  border-top: 0 !important;
  border-radius: 8px !important;
}
#grupo-add-member-results .mgt-person:hover,
#mgt-tag-clients-results .mgt-person:hover {
  background: var(--surface-2);
}
.mgt-person .mgt-avatar {
  width: 32px;
  height: 32px;
  font-size: 11.5px;
}
.mgt-person-copy {
  display: grid;
  flex: 1;
  min-width: 0;
}
.mgt-person-name,
.mgt-person-mail {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mgt-person-name {
  font-size: 13.5px;
  font-weight: 600;
}
.mgt-person-mail {
  font-size: 12px;
  color: var(--muted);
}
.mgt-person-mail:empty {
  display: none;
}

/* ── Diálogo «Clientes con la etiqueta» ───────────────────────── */
dialog.mgt-sheet {
  width: min(560px, calc(100vw - 24px)) !important;
  max-width: none !important;
  max-height: min(86vh, 760px);
  padding: 0 !important;
  border: 1px solid var(--hairline) !important;
  border-radius: var(--radius-lg) !important;
  background: var(--surface) !important;
  color: var(--text);
  box-shadow: var(--elev-2) !important;
  overflow: hidden;
}
dialog.mgt-sheet[open] {
  display: flex !important;
  flex-direction: column;
  animation: mgt-pop var(--dur-base) var(--ease-out);
}
dialog.mgt-sheet::backdrop {
  background: rgba(8, 12, 10, 0.42);
}
.mgt-sheet-head {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 16px 10px 20px;
}
.mgt-sheet-head-copy {
  flex: 1;
  min-width: 0;
}
.mgt-sheet-head h3 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  font-size: 16px;
  font-weight: 700;
}
.mgt-sheet-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.mgt-sheet-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-height: 0;
  padding: 4px 20px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.mgt-sheet-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px 16px;
  border-top: 1px solid var(--hairline);
}
.mgt-sheet-foot > button {
  width: auto !important;
  height: 38px !important;
  margin: 0 !important;
  padding: 0 16px !important;
  border-radius: 9px !important;
}

/* ── Modal de etiqueta: vista previa + muestras ───────────────── */
#tag-edit-dialog .tag-edit-lede {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}
#tag-edit-dialog .tag-edit-field {
  display: block !important;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
}
#tag-edit-dialog .tag-edit-field > :is(input, select, textarea) {
  display: block;
  width: 100% !important;
  margin-top: 6px;
}
#tag-edit-dialog .tag-edit-field > div {
  margin-top: 6px;
}
#tag-edit-dialog .tag-edit-field > .req {
  margin-left: 2px;
  color: var(--sys-err);
}
#tag-edit-dialog .tag-color-picker-row {
  display: flex !important;
  align-items: center;
  gap: 8px;
}
#tag-edit-dialog .tag-color-picker-row > input[type="text"] {
  flex: 1;
  min-width: 0;
}
#tag-edit-dialog .tag-edit-field > .hint {
  font-weight: 400;
}
.mgt-tag-preview {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px dashed var(--hairline);
  border-radius: 10px;
  background: var(--surface-2);
}
.mgt-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.mgt-swatch {
  width: 26px !important;
  height: 26px !important;
  min-width: 0 !important;
  padding: 0 !important;
  border: 2px solid var(--surface) !important;
  border-radius: 999px !important;
  background: var(--mgt-tag) !important;
  box-shadow: 0 0 0 1px var(--hairline) !important;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), box-shadow var(--dur-fast) var(--ease-out);
}
.mgt-swatch:hover {
  transform: scale(1.08);
}
.mgt-swatch[aria-checked="true"] {
  box-shadow: 0 0 0 2px var(--text) !important;
}
.mgt-swatch:focus-visible {
  outline: 2px solid var(--tenant-primary);
  outline-offset: 2px;
}

/* ── Drawer de grupo ───────────────────────────────────────────── */
.usuarios-grupo-drawer .mgt-search-block {
  margin-top: 4px;
}
.usuarios-grupo-drawer .grupo-member-row .badge {
  margin-left: 4px;
}

/* ── Tablet estrecha / celular: tarjetas ──────────────────────── */
@media (max-width: 900px) {
  .mgt-panel {
    --mgt-row-h: auto;
  }
  .mgt-toolbar {
    gap: 8px;
  }
  .mgt-search {
    height: 50px;
  }
  .mgt-toolbar .mgt-search {
    flex: 1 1 100%;
  }
  .mgt-search input {
    font-size: 16px;
  }
  .mgt-filter,
  .mgt-primary {
    height: 50px !important;
  }
  .mgt-primary {
    flex: 1 1 auto !important;
    justify-content: center;
  }
  .mgt-link {
    height: 50px;
  }
  .mgt-spacer {
    display: none;
  }
  .mgt-wrap {
    overflow: visible;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .mgt-head {
    display: none;
  }
  .mgt-list {
    gap: 8px;
  }
  .mgt-row {
    grid-template-columns: minmax(0, 1fr) auto !important;
    grid-template-areas:
      "main actions"
      "members members"
      "meta meta";
    row-gap: 10px;
    padding: 14px 10px 14px 14px;
    border: 1px solid var(--hairline);
    border-radius: var(--radius);
    background: var(--surface);
  }
  .mgt-row:last-child {
    border-bottom: 1px solid var(--hairline);
  }
  .mgt-row-skel {
    display: flex;
  }
  .mgt-main {
    grid-area: main;
  }
  .mgt-actions {
    grid-area: actions;
    align-self: start;
  }
  .mgt-members {
    grid-area: members;
  }
  .mgt-cols-groups .mgt-coach,
  .mgt-cols-tags .mgt-cat {
    grid-area: meta;
  }
  .mgt-coach::before,
  .mgt-cat::before {
    content: attr(data-label) ":";
    color: var(--muted);
    font-size: 12.5px;
  }
  .mgt-date {
    display: none;
  }
  .mgt-btn {
    height: 50px !important;
    padding: 0 14px !important;
  }
  .mgt-more {
    width: 50px !important;
    height: 50px !important;
  }
  .mgt-icon-btn {
    width: 50px !important;
    height: 50px !important;
  }
  .mgt-group-chat {
    width: 50px !important;
    padding: 0 !important;
  }
  .mgt-group-chat span {
    display: none;
  }
  .mgt-group-chat .nav-ico {
    width: 18px;
    height: 18px;
  }
  .mgt-person {
    min-height: 60px;
  }
  .mgt-person .mgt-btn {
    height: 44px !important;
  }

  dialog.mgt-sheet {
    width: 100vw !important;
    height: 100dvh !important;
    max-height: none !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
  }
  .mgt-sheet-head {
    padding-top: max(18px, env(safe-area-inset-top));
  }
  .mgt-sheet-foot {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
  dialog.mgt-sheet[open] {
    animation: mgt-sheet-in var(--dur-base) var(--ease-out);
  }
  .mgt-sheet-foot > button {
    height: 50px !important;
  }
  .mgt-sheet-foot .btn-primary {
    flex: 1;
  }
  .mgt-swatch {
    width: 36px !important;
    height: 36px !important;
  }
  #tag-edit-dialog .tag-edit-field > :is(input, select),
  #tag-edit-dialog .tag-color-picker-row > input {
    min-height: 50px;
    font-size: 16px !important;
  }
}

@media (max-width: 1180px) {
  .mgt-cols-groups {
    grid-template-columns: minmax(0, 2fr) minmax(120px, 1fr) minmax(110px, 0.9fr) minmax(140px, auto);
  }
  /* 4ª col = Actualizado (head span o .mgt-date) */
  .mgt-cols-groups > :nth-child(4) {
    display: none;
  }
  .mgt-cols-tags {
    grid-template-columns: minmax(0, 1.5fr) minmax(90px, 0.8fr) minmax(130px, 1fr) minmax(148px, auto);
  }
  .mgt-cols-tags > :nth-child(4) {
    display: none;
  }
}

@media (min-width: 600px) and (max-width: 900px) {
  .mgt-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mgt-list > .mgt-state {
    grid-column: 1 / -1;
  }
  .mgt-primary {
    flex: 0 0 auto !important;
    margin-left: auto !important;
  }
}

/* ── Automatizaciones en backend (S090-079b) ───────────────────── */
.mgt-cols-tags .mgt-main-copy {
  justify-items: start;
  gap: 3px;
}
.mgt-run-line {
  overflow: hidden;
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.mgt-run-line-block {
  margin: 0 0 6px;
  padding: 8px 10px;
  border: 1px solid var(--hairline);
  border-radius: 10px;
  background: var(--surface-2);
  white-space: normal;
}
.mgt-run-line[hidden] {
  display: none;
}
.mgt-soon {
  flex: none;
  margin-left: auto;
  padding: 1px 7px;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.tag-autos-cond #tag-auto-cond-days {
  font-variant-numeric: tabular-nums;
}
.tag-autos-cond #tag-auto-cond-run {
  align-self: flex-start;
  min-height: 44px;
}
.tag-autos-cond #tag-auto-cond-run[hidden],
.tag-autos-cond #tag-auto-cond-days-wrap[hidden] {
  display: none !important;
}
.tag-autos-cond .hint {
  margin: -4px 0 0;
  font-size: 12px;
}

/* ── Movimiento ────────────────────────────────────────────────── */
@keyframes mgt-fade {
  from { opacity: 0; transform: translateY(2px); }
  to { opacity: 1; transform: none; }
}
@keyframes mgt-pop {
  from { opacity: 0; transform: scale(0.98) translateY(4px); }
  to { opacity: 1; transform: none; }
}
@keyframes mgt-sheet-in {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: none; }
}
@keyframes mgt-shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .mgt-panel *,
  dialog.mgt-sheet,
  .mgt-swatch {
    animation: none !important;
    transition: none !important;
  }
}
