/* ============================================================
   Panel Gómez Apac & Co.
   Paleta: #000000 + #DD0426
   ============================================================ */

:root {
  --hga-black: #000000;
  --hga-red: #DD0426;
  --hga-red-hover: #b80320;
  --hga-red-soft: rgba(221, 4, 38, 0.08);
  --hga-text: #0a0a0a;
  --hga-muted: #6b6b6b;
  --hga-border: #e5e5e5;
  --hga-border-soft: #f0f0f0;
  --hga-bg: #fafafa;
  --hga-card: #ffffff;
  --hga-shadow-sm: 0 1px 2px rgba(0,0,0,.04);
  --hga-shadow: 0 4px 18px rgba(0,0,0,.06);
  --hga-shadow-lg: 0 24px 60px rgba(0,0,0,.12);
  --hga-radius: 12px;
  --hga-radius-sm: 8px;
  --hga-radius-lg: 18px;
  --hga-sidebar-w: 248px;
  --hga-topbar-h: 60px;
  --hga-font: 'Helvetica Neue', Helvetica, Arial, system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  font-family: var(--hga-font);
  color: var(--hga-text);
  background: var(--hga-bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }
a:hover { color: var(--hga-red); }

img { max-width: 100%; height: auto; display: block; }

/* ===== ICONOS (SVG) =====
   Por defecto los SVG inline tomarían el 100% del contenedor.
   Aplicamos un tamaño base y luego override por contexto.
   IMPORTANTE: excluimos el árbol de TinyMCE (.tox) que trae sus propios SVGs. */
svg:not(.tox svg) {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}

.sidebar svg            { width: 18px; height: 18px; }
.sidebar__close svg     { width: 22px; height: 22px; }

.topbar svg             { width: 18px; height: 18px; }
.topbar__menu-btn svg   { width: 24px; height: 24px; }

.btn svg                { width: 16px; height: 16px; }
.btn-sm svg             { width: 13px; height: 13px; }
.btn-lg svg             { width: 18px; height: 18px; }
.btn-icon svg           { width: 18px; height: 18px; }

.stat-card__icon svg    { width: 22px; height: 22px; }

.alert svg              { width: 18px; height: 18px; }

.actions__btn svg       { width: 16px; height: 16px; }
.actions__item svg      { width: 14px; height: 14px; }

.table-toolbar__search svg { width: 16px; height: 16px; }
.table-empty svg        { width: 56px; height: 56px; opacity: .25; }

.profile-box svg        { width: 16px; height: 16px; }

.file-upload svg        { width: 22px; height: 22px; opacity: .6; }

.form-help svg, .form-error svg { width: 13px; height: 13px; }

/* ===================== AUTH ===================== */

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr;
  background: linear-gradient(135deg, #000 0%, #1a1a1a 50%, #000 100%);
}

@media (min-width: 1024px) {
  .auth-shell {
    grid-template-columns: 1fr 1fr;
  }
}

.auth-hero {
  display: none;
  position: relative;
  background: var(--hga-black);
  color: #fff;
  padding: 60px;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
}

@media (min-width: 1024px) {
  .auth-hero { display: flex; }
}

.auth-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 80%, rgba(221,4,38,.18), transparent 50%),
    radial-gradient(ellipse at 80% 20%, rgba(221,4,38,.08), transparent 50%);
  pointer-events: none;
}

.auth-hero__brand {
  position: relative;
  z-index: 1;
}

.auth-hero__brand img {
  height: 80px;
  filter: brightness(0) invert(1);
}

.auth-hero__content {
  position: relative;
  z-index: 1;
}

.auth-hero__content h1 {
  font-size: 42px;
  line-height: 1.1;
  font-weight: 800;
  margin: 0 0 16px;
  letter-spacing: -0.02em;
}

.auth-hero__content p {
  font-size: 16px;
  color: rgba(255,255,255,0.7);
  max-width: 460px;
  line-height: 1.6;
}

.auth-hero__footer {
  position: relative;
  z-index: 1;
  font-size: 12px;
  color: rgba(255,255,255,0.4);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.auth-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  background: #fff;
}

.auth-card__inner {
  width: 100%;
  max-width: 420px;
}

.auth-card__brand {
  display: flex;
  justify-content: center;
  margin-bottom: 32px;
}

.auth-card__brand img { height: 70px; }

@media (min-width: 1024px) {
  .auth-card__brand { display: none; }
}

.auth-card h2 {
  font-size: 28px;
  font-weight: 800;
  margin: 0 0 8px;
  letter-spacing: -0.02em;
}

.auth-card .subtitle {
  color: var(--hga-muted);
  margin-bottom: 32px;
  font-size: 14px;
}

.auth-card .form-link {
  font-size: 13px;
  color: var(--hga-muted);
  text-align: center;
  margin-top: 24px;
}

.auth-card .form-link a {
  color: var(--hga-red);
  font-weight: 600;
}

/* ===================== LAYOUT APP ===================== */

.app-shell {
  display: grid;
  grid-template-columns: var(--hga-sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--hga-black);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; bottom: 0; left: 0;
  width: var(--hga-sidebar-w);
  z-index: 50;
  transform: translateX(0);
  transition: transform .25s ease;
}

.sidebar__brand {
  padding: 22px 22px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: var(--hga-topbar-h);
}

.sidebar__brand a {
  display: inline-flex;
  align-items: center;
}

.sidebar__brand img {
  height: 36px;
  width: auto;
  max-width: 180px;
  filter: brightness(0) invert(1);
}

.sidebar__close {
  background: none;
  border: 0;
  color: #fff;
  cursor: pointer;
  display: none;
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px;
}

.sidebar__section {
  margin-top: 18px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255,255,255,0.35);
  padding: 0 14px 8px;
}

.sidebar__link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: var(--hga-radius-sm);
  color: rgba(255,255,255,0.75);
  font-size: 13.5px;
  font-weight: 500;
  margin: 2px 0;
  transition: background .15s, color .15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__link:hover {
  background: rgba(255,255,255,0.06);
  color: #fff;
}

.sidebar__link.is-active {
  background: var(--hga-red);
  color: #fff;
}

.sidebar__link.is-active:hover {
  background: var(--hga-red-hover);
}

.sidebar__link svg {
  flex-shrink: 0;
  opacity: .9;
}

.sidebar__footer {
  padding: 16px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--hga-radius-sm);
}

.sidebar__user img,
.sidebar__user .avatar-placeholder {
  width: 36px; height: 36px;
  min-width: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--hga-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #fff;
  flex-shrink: 0;
}

.sidebar__user-info {
  flex: 1;
  min-width: 0;
}

.sidebar__user-name {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar__user-role {
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.app-main {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  margin-left: 0;
}

.topbar {
  height: var(--hga-topbar-h);
  background: var(--hga-card);
  border-bottom: 1px solid var(--hga-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 30;
}

.topbar__left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar__menu-btn {
  background: none;
  border: 0;
  cursor: pointer;
  display: none;
  padding: 4px;
  color: var(--hga-text);
}

.topbar__title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

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

.topbar__action {
  background: none;
  border: 1px solid var(--hga-border);
  width: 38px; height: 38px;
  border-radius: var(--hga-radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--hga-text);
  cursor: pointer;
  transition: all .15s;
}

.topbar__action:hover {
  background: var(--hga-red-soft);
  border-color: var(--hga-red);
  color: var(--hga-red);
}

.app-content {
  flex: 1;
  padding: 24px 28px 40px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
  min-width: 0;
}

/* ===================== RESPONSIVE LAYOUT ===================== */

@media (max-width: 1023px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .app-main { grid-column: 1; }

  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.is-open {
    transform: translateX(0);
    box-shadow: var(--hga-shadow-lg);
  }
  .sidebar__close,
  .topbar__menu-btn { display: inline-flex; }

  .sidebar-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 40;
    display: none;
  }
  .sidebar-overlay.is-active { display: block; }

  .app-content { padding: 20px 16px; }
}

/* ===================== PAGE HEADER ===================== */

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.page-header h1 {
  font-size: 24px;
  font-weight: 800;
  margin: 0 0 4px;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.page-header__sub {
  color: var(--hga-muted);
  font-size: 13.5px;
}

.page-header__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===================== BUTTONS ===================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--hga-radius-sm);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .15s;
  text-decoration: none;
  font-family: inherit;
  line-height: 1;
  white-space: nowrap;
}

.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
  background: var(--hga-red);
  color: #fff;
}
.btn-primary:hover:not(:disabled) {
  background: var(--hga-red-hover);
  color: #fff;
}

.btn-dark {
  background: var(--hga-black);
  color: #fff;
}
.btn-dark:hover:not(:disabled) {
  background: #1f1f1f;
  color: #fff;
}

.btn-outline {
  background: #fff;
  color: var(--hga-text);
  border-color: var(--hga-border);
}
.btn-outline:hover:not(:disabled) {
  border-color: var(--hga-red);
  color: var(--hga-red);
}

.btn-ghost {
  background: transparent;
  color: var(--hga-text);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--hga-red-soft);
  color: var(--hga-red);
}

.btn-danger {
  background: #fff;
  color: var(--hga-red);
  border-color: rgba(221,4,38,0.3);
}
.btn-danger:hover:not(:disabled) {
  background: var(--hga-red);
  color: #fff;
  border-color: var(--hga-red);
}

.btn-sm {
  padding: 7px 12px;
  font-size: 12px;
  gap: 6px;
}

.btn-lg {
  padding: 14px 28px;
  font-size: 14px;
}

.btn-icon {
  width: 36px; height: 36px;
  padding: 0;
  border-radius: var(--hga-radius-sm);
}

/* ===================== CARDS ===================== */

.card {
  background: var(--hga-card);
  border: 1px solid var(--hga-border);
  border-radius: var(--hga-radius);
  box-shadow: var(--hga-shadow-sm);
}

.card-body { padding: 24px; }
.card-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--hga-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.card-header h3 {
  font-size: 15px; font-weight: 700; margin: 0;
}
.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--hga-border-soft);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

/* ===================== STAT CARDS (Dashboard) ===================== */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--hga-card);
  border: 1px solid var(--hga-border);
  border-radius: var(--hga-radius);
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  position: relative;
  overflow: hidden;
  transition: all .2s;
  min-width: 0;
}

.stat-card:hover {
  border-color: var(--hga-red);
  box-shadow: var(--hga-shadow);
  transform: translateY(-2px);
}

.stat-card--link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.stat-card--link:hover .stat-card__value { color: var(--hga-red); }

.stat-card__icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--hga-red-soft);
  color: var(--hga-red);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card__icon.is-dark {
  background: var(--hga-black);
  color: #fff;
}

.stat-card__body { min-width: 0; flex: 1; }

.stat-card__value {
  font-size: 26px;
  font-weight: 800;
  color: var(--hga-text);
  line-height: 1;
  letter-spacing: -0.02em;
}

.stat-card__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--hga-muted);
  margin-top: 6px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stat-card__sub {
  font-size: 11px;
  color: var(--hga-muted);
  margin-top: 3px;
}

/* ===================== PROFILE BOX ===================== */

.profile-box {
  background: linear-gradient(135deg, #0a0a0a 0%, #1d1d1d 100%);
  color: #fff;
  border-radius: var(--hga-radius);
  padding: 22px 26px;
  display: flex;
  align-items: center;
  gap: 18px;
  position: relative;
  overflow: hidden;
}

.profile-box::before {
  content: '';
  position: absolute;
  width: 240px; height: 240px;
  right: -100px; top: -100px;
  background: var(--hga-red);
  border-radius: 50%;
  opacity: .12;
}

.profile-box::after {
  content: '';
  position: absolute;
  width: 160px; height: 160px;
  left: 40%; bottom: -100px;
  background: var(--hga-red);
  border-radius: 50%;
  opacity: .06;
}

.profile-box__avatar {
  width: 64px; height: 64px;
  min-width: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 2.5px solid var(--hga-red);
  background: var(--hga-red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 800;
  color: #fff;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
}

.profile-box__info {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}

.profile-box__name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.01em;
  margin: 0 0 2px;
}

.profile-box__email {
  color: rgba(255,255,255,0.55);
  font-size: 12.5px;
}

.profile-box__role {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 9px;
  background: var(--hga-red);
  border-radius: 4px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.profile-box__action {
  position: relative;
  z-index: 1;
}

@media (max-width: 600px) {
  .profile-box { flex-direction: column; align-items: flex-start; text-align: left; }
}

/* ===================== TABLE ===================== */

.table-wrapper {
  background: var(--hga-card);
  border: 1px solid var(--hga-border);
  border-radius: var(--hga-radius);
  overflow: hidden;
}

.table-toolbar {
  padding: 16px 20px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--hga-border);
  flex-wrap: wrap;
}

.table-toolbar__search {
  position: relative;
  flex: 1;
  max-width: 360px;
}

.table-toolbar__search input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border: 1px solid var(--hga-border);
  border-radius: var(--hga-radius-sm);
  font-size: 13px;
  font-family: inherit;
  background: var(--hga-bg);
  transition: all .15s;
}
.table-toolbar__search input:focus {
  outline: none;
  border-color: var(--hga-red);
  background: #fff;
  box-shadow: 0 0 0 3px var(--hga-red-soft);
}
.table-toolbar__search svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--hga-muted);
  width: 16px; height: 16px;
}

.table-scroll {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}

.table th {
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--hga-muted);
  padding: 14px 20px;
  background: var(--hga-bg);
  border-bottom: 1px solid var(--hga-border);
  white-space: nowrap;
}

/* Encabezados ordenables */
.th-sort .th-sort__link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
}
.th-sort .th-sort__link:hover { color: var(--hga-red); }
.th-sort.is-sorted .th-sort__link { color: var(--hga-red); }

/* Fila "mía" en listados de artículos/libros para no-admin */
.table tr.row-mine td:first-child {
  border-left: 3px solid var(--hga-red);
}
.table tr.row-mine {
  background: var(--hga-red-soft);
}
.table tr.row-mine:hover {
  background: rgba(221, 4, 38, 0.12);
}

.table td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--hga-border-soft);
  vertical-align: middle;
}

.table tbody tr {
  transition: background .12s;
}

.table tbody tr:hover {
  background: var(--hga-bg);
}

.table tbody tr:last-child td { border-bottom: 0; }

.table .col-actions {
  width: 80px;
  text-align: right;
}

.table .col-img { width: 60px; }

.table-thumb {
  width: 40px; height: 40px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--hga-bg);
}
.table-thumb--empty {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px dashed var(--hga-border);
  color: var(--hga-muted);
}

.table-empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--hga-muted);
}

.table-empty svg {
  width: 48px; height: 48px;
  margin: 0 auto 16px;
  opacity: .3;
}

/* ===================== BADGES ===================== */

.badge {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 12px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  background: var(--hga-bg);
  color: var(--hga-muted);
  border: 1px solid var(--hga-border);
}

.badge-success { background: rgba(34,197,94,.1); color: #16a34a; border-color: rgba(34,197,94,.2); }
.badge-warning { background: rgba(245,158,11,.1); color: #d97706; border-color: rgba(245,158,11,.2); }
.badge-danger  { background: var(--hga-red-soft); color: var(--hga-red); border-color: rgba(221,4,38,.2); }
.badge-info    { background: rgba(59,130,246,.1); color: #2563eb; border-color: rgba(59,130,246,.2); }
.badge-dark    { background: #1a1a1a; color: #fff; border-color: #1a1a1a; }
.badge-muted   { background: #f5f5f5; color: #555; }

/* ===================== ACTIONS DROPDOWN ===================== */

.actions {
  position: relative;
  display: inline-block;
}

.actions__btn {
  background: transparent;
  border: 1px solid transparent;
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--hga-muted);
}
.actions__btn:hover {
  background: var(--hga-red-soft);
  color: var(--hga-red);
}

.actions__menu {
  position: fixed;
  left: 0;
  top: 0;
  background: #fff;
  border: 1px solid var(--hga-border);
  border-radius: var(--hga-radius-sm);
  box-shadow: 0 12px 32px rgba(0,0,0,.14), 0 4px 12px rgba(0,0,0,.06);
  min-width: 200px;
  padding: 6px;
  z-index: 1000;
  display: none;
  animation: hga-dropdown-in .12s ease-out;
}
.actions__menu.is-open { display: block; }

@keyframes hga-dropdown-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.actions__item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--hga-text);
  background: none;
  border: 0;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
}

.actions__item:hover {
  background: var(--hga-red-soft);
  color: var(--hga-red);
}

.actions__item--danger { color: var(--hga-red); }
.actions__item--danger:hover { background: var(--hga-red); color: #fff; }

.actions__item svg { width: 14px; height: 14px; flex-shrink: 0; }

.actions__divider {
  height: 1px;
  background: var(--hga-border-soft);
  margin: 4px 0;
}

/* ===================== FORMS ===================== */

.form-grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}

.form-group {
  grid-column: span 12;
  min-width: 0;
}

/* Prefijo + número (equipo, etc.): una sola línea sin solapar columnas del grid */
.form-tel-row {
  display: flex;
  flex-direction: row;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.form-tel-prefix {
  box-sizing: border-box;
  flex: 0 0 auto;
  padding: 10px 12px;
  border: 1px solid var(--hga-border);
  border-radius: var(--hga-radius-sm);
  font-size: 14px;
  line-height: 1.4;
  font-family: inherit;
  text-align: center;
  background: var(--hga-bg);
  color: var(--hga-text);
  white-space: nowrap;
  min-width: 3rem;
  user-select: none;
  pointer-events: none;
}

.form-tel-prefix--ec {
  min-width: 4.5rem;
}

.form-tel-row .form-tel-input {
  flex: 1 1 0;
  min-width: 0;
  width: auto;
}

.form-group--6 { grid-column: span 12; }
.form-group--4 { grid-column: span 12; }
.form-group--3 { grid-column: span 12; }

@media (min-width: 768px) {
  .form-group--6 { grid-column: span 6; }
  .form-group--4 { grid-column: span 4; }
  .form-group--3 { grid-column: span 3; }
}

/* Contenedor extra dentro de .form-grid (p. ej. SEO artículos): sin esto el grid lo trata como 1 columna de 12 */
.form-grid > .articulo-meta-extra {
  grid-column: 1 / -1;
  min-width: 0;
}

.form-label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--hga-text);
  margin-bottom: 6px;
  letter-spacing: 0.01em;
}

.form-label .required {
  color: var(--hga-red);
}

.form-control,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--hga-border);
  border-radius: var(--hga-radius-sm);
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--hga-text);
  transition: all .15s;
}

.form-textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.5;
}

.form-control:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--hga-red);
  box-shadow: 0 0 0 3px var(--hga-red-soft);
}

.form-control:disabled,
.form-select:disabled {
  background: var(--hga-bg);
  cursor: not-allowed;
  opacity: .7;
}

.form-help {
  font-size: 12px;
  color: var(--hga-muted);
  margin-top: 5px;
}

.form-error {
  font-size: 12px;
  color: var(--hga-red);
  margin-top: 5px;
  font-weight: 500;
}

/* Multi-select pretty */
.multi-select {
  border: 1px solid var(--hga-border);
  border-radius: var(--hga-radius-sm);
  padding: 8px;
  background: #fff;
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.multi-select__option {
  padding: 5px 12px;
  border: 1px solid var(--hga-border);
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  background: #fff;
  user-select: none;
  transition: all .12s;
}

.multi-select__option:hover {
  border-color: var(--hga-red);
  color: var(--hga-red);
}

.multi-select__option.is-selected {
  background: var(--hga-red);
  color: #fff;
  border-color: var(--hga-red);
}

/* File upload — toda la zona discontinua es clicable (input cubre el label) */
.file-upload__zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 140px;
  margin: 0;
  border: 2px dashed var(--hga-border);
  border-radius: var(--hga-radius-sm);
  padding: 24px;
  text-align: center;
  background: var(--hga-bg);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}

.file-upload__zone:hover {
  border-color: var(--hga-red);
  background: var(--hga-red-soft);
}

.file-upload__zone:has(.file-upload__input:focus-visible) {
  outline: 2px solid var(--hga-red);
  outline-offset: 2px;
}

.file-upload__input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}

.file-upload__stack {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  pointer-events: none;
}

.file-upload__label {
  font-size: 13px;
  color: var(--hga-muted);
  font-weight: 500;
}

.file-upload__preview {
  margin-top: 12px;
}

.file-upload__preview img {
  max-height: 140px;
  border-radius: var(--hga-radius-sm);
  display: inline-block;
}

.file-current {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--hga-border);
  border-radius: var(--hga-radius-sm);
  font-size: 12.5px;
  margin-top: 6px;
  background: #fff;
}

/* ===================== ALERTS ===================== */

.alert {
  padding: 13px 16px;
  border-radius: var(--hga-radius-sm);
  font-size: 13.5px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid transparent;
}

.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }

.alert-success {
  background: rgba(34,197,94,.08);
  color: #15803d;
  border-color: rgba(34,197,94,.2);
}

.alert-error {
  background: var(--hga-red-soft);
  color: var(--hga-red);
  border-color: rgba(221,4,38,.2);
}

.alert-info {
  background: rgba(59,130,246,.08);
  color: #1d4ed8;
  border-color: rgba(59,130,246,.2);
}

/* ===================== PAGINATION ===================== */

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  border-top: 1px solid var(--hga-border);
}

.pagination a,
.pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: var(--hga-radius-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--hga-text);
  background: #fff;
  border: 1px solid var(--hga-border);
  text-decoration: none;
  transition: all .15s;
}

.pagination a:hover {
  border-color: var(--hga-red);
  color: var(--hga-red);
}

.pagination .is-active {
  background: var(--hga-black);
  color: #fff;
  border-color: var(--hga-black);
}

.pagination .is-disabled {
  opacity: .4;
  cursor: not-allowed;
}

/* ===================== UTILITIES ===================== */

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mt-6 { margin-top: 24px; }
.mb-4 { margin-bottom: 16px; }
.text-muted { color: var(--hga-muted); }
.text-sm { font-size: 12.5px; }
.font-bold { font-weight: 700; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.w-full { width: 100%; }

.grid-2 { display: grid; grid-template-columns: 1fr; gap: 20px; min-width: 0; }
.grid-2 > * { min-width: 0; }
@media (min-width: 1024px) {
  .grid-2 { grid-template-columns: minmax(0,2fr) minmax(0,1fr); }
}

.grid-form { display: grid; grid-template-columns: 1fr; gap: 20px; min-width: 0; }
.grid-form > * { min-width: 0; }
@media (min-width: 1024px) {
  .grid-form { grid-template-columns: minmax(0,2fr) minmax(0,1fr); }
}

.divider {
  height: 1px;
  background: var(--hga-border);
  margin: 24px 0;
}

/* === Small spinner for forms === */
.spinner {
  width: 14px; height: 14px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ===================== REPEATER (JetEngine-style) ===================== */

.repeater {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.repeater__items {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.repeater__empty {
  padding: 18px;
  background: var(--hga-bg);
  border: 1px dashed var(--hga-border);
  border-radius: var(--hga-radius-sm);
  margin: 0;
}

.repeater__item {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr 36px;
  gap: 12px;
  align-items: start;
  padding: 14px;
  background: var(--hga-bg);
  border: 1px solid var(--hga-border);
  border-radius: var(--hga-radius-sm);
  transition: border-color .15s, box-shadow .15s;
}

.repeater__item:hover {
  border-color: var(--hga-border);
  box-shadow: 0 2px 6px rgba(0,0,0,.04);
}

.repeater__handle {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  color: var(--hga-muted);
  cursor: grab;
  user-select: none;
}
.repeater__handle svg { width: 18px; height: 18px; }

.repeater__fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.repeater__fields--libro-autor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

@media (max-width: 640px) {
  .repeater__fields--libro-autor {
    grid-template-columns: 1fr;
  }
}

.repeater__remove {
  background: transparent;
  border: 1px solid transparent;
  color: var(--hga-muted);
  width: 32px; height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all .12s;
}
.repeater__remove svg { width: 16px; height: 16px; }
.repeater__remove:hover {
  background: var(--hga-red);
  color: #fff;
  border-color: var(--hga-red);
}

[data-repeater-add] {
  align-self: flex-start;
}

/* Libros: PDF vs enlace digital (exclusivos) */
.libro-doc-choice {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.libro-doc-choice__opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1.35;
  color: var(--hga-text);
}

.libro-doc-choice__opt input {
  margin-top: 3px;
  flex-shrink: 0;
}

.libro-doc-panel[hidden] {
  display: none !important;
}

/* ===================== TINYMCE ===================== */

/* TinyMCE oculta el textarea original; nos aseguramos de no dejar gaps. */
textarea.tinymce-init { visibility: hidden; height: 0 !important; min-height: 0 !important; padding: 0 !important; border: 0 !important; }

/* Reset duro de los SVG que vienen dentro de TinyMCE (sus propios íconos).
   Sin esto, las reglas globales del panel los hacen 16x16 y quedan enormes
   por el viewBox interno de TinyMCE. Los dejamos a 20x20 estilo toolbar. */
.tox svg,
.tox-tinymce svg,
.tox-dialog svg,
.tox-pop svg {
  width: auto !important;
  height: auto !important;
  flex-shrink: initial !important;
  display: inline !important;
  vertical-align: baseline !important;
}
.tox .tox-icon svg,
.tox .tox-tbtn svg {
  width: 18px !important;
  height: 18px !important;
}

/* El contenedor del editor (lo monta TinyMCE) hereda el min-height del textarea. */
.tox-tinymce {
  border: 1px solid var(--hga-border) !important;
  border-radius: var(--hga-radius-sm) !important;
  overflow: hidden;
}

.tox-tinymce:focus-within {
  border-color: var(--hga-red) !important;
  box-shadow: 0 0 0 3px var(--hga-red-soft) !important;
}

.tox .tox-toolbar,
.tox .tox-toolbar__primary {
  background: var(--hga-bg) !important;
  border-bottom: 1px solid var(--hga-border) !important;
}

.tox .tox-tbtn { color: var(--hga-text) !important; }
.tox .tox-tbtn:hover { background: var(--hga-red-soft) !important; color: var(--hga-red) !important; }
.tox .tox-tbtn--enabled { background: var(--hga-red-soft) !important; color: var(--hga-red) !important; }

/* ===================== BUTTONS extra ===================== */
.btn.btn-sm { padding: 6px 12px; font-size: 12.5px; }

/* ===================== PASSWORD FIELD ===================== */
.password-field {
  position: relative;
  display: flex;
  align-items: stretch;
}
.password-field input {
  flex: 1;
  padding-right: 44px;
  font-family: Menlo, Consolas, monospace;
  letter-spacing: 0.5px;
}
.password-field__toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: 0;
  width: 36px; height: 36px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--hga-muted);
  cursor: pointer;
  transition: all .12s;
}
.password-field__toggle:hover { color: var(--hga-red); background: var(--hga-red-soft); }
.password-field__toggle.is-visible { color: var(--hga-red); }

/* ===================== CHECKBOX (bonito) ===================== */
.form-checkbox {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  font-size: 13.5px;
  color: var(--hga-text);
  font-weight: 500;
}
.form-checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border: 1.5px solid var(--hga-border);
  border-radius: 4px;
  background: #fff;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all .12s;
}
.form-checkbox input[type="checkbox"]:checked {
  background: var(--hga-red);
  border-color: var(--hga-red);
}
.form-checkbox input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 1px;
  width: 5px;
  height: 10px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.form-checkbox input[type="checkbox"]:focus-visible {
  outline: 2px solid var(--hga-red-soft);
  outline-offset: 2px;
}

/* === Print === */
@media print {
  .sidebar, .topbar, .page-header__actions, .actions { display: none !important; }
  .app-shell { grid-template-columns: 1fr !important; }
  .app-content { padding: 0 !important; }
}
