/* EMTEC Node — design system */
@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap");

:root {
  --emtec-primary: #1a56c4;
  --emtec-primary-dark: #0f3d8c;
  --emtec-primary-light: #3b7ddd;
  --emtec-accent: #0ea5e9;
  --emtec-bg: #eef2f8;
  --emtec-surface: #ffffff;
  --emtec-surface-2: #f8fafc;
  --emtec-border: #e2e8f0;
  --emtec-text: #0f172a;
  --emtec-muted: #64748b;
  --emtec-success: #16a34a;
  --emtec-success-bg: #dcfce7;
  --emtec-warning: #d97706;
  --emtec-warning-bg: #fef3c7;
  --emtec-danger: #dc2626;
  --emtec-danger-bg: #fee2e2;
  --emtec-info-bg: #dbeafe;
  --emtec-sidebar-w: 260px;
  --emtec-sidebar-w-mini: 72px;
  --emtec-sidebar-w-current: var(--emtec-sidebar-w);
  --emtec-radius: 14px;
  --emtec-radius-sm: 10px;
  --emtec-shadow: 0 4px 24px rgba(15, 23, 42, 0.06);
  --emtec-shadow-lg: 0 12px 40px rgba(15, 23, 42, 0.1);
  --space-2xs: 6px;
  --space-xs: 10px;
  --space-sm: 14px;
  --space-md: 20px;
  --space-lg: 28px;
  --space-xl: 36px;
  --space-2xl: 48px;
  --pad-page-x: 0;
  --pad-page-y: clamp(12px, 1.5vw, 24px);
  --emtec-table-viewport-offset: 11.5rem;
  --emtec-table-head-bg: #ffffff;
  --emtec-table-head-color: #475569;
  --emtec-table-row-bg: #ffffff;
  --emtec-table-row-hover: #f8fafc;
  --emtec-table-row-border: #eef2f6;
  --emtec-table-accent: rgba(26, 86, 196, 0.08);
  --emtec-table-radius: 12px;
  --emtec-scrollbar-size: 10px;
  --emtec-scrollbar-track: #f1f5f9;
  --emtec-scrollbar-thumb: #ffffff;
  --emtec-scrollbar-thumb-border: #e2e8f0;
  --emtec-scrollbar-thumb-hover: #ffffff;
  --emtec-scrollbar-dark-track: rgba(255, 255, 255, 0.06);
  --emtec-scrollbar-dark-thumb: rgba(255, 255, 255, 0.32);
  --emtec-scrollbar-dark-thumb-hover: rgba(255, 255, 255, 0.5);
}

/* Scrollbars claros (Firefox + WebKit) */

.emtec-app,
.emtec-app * {
  scrollbar-width: thin;
  scrollbar-color: var(--emtec-scrollbar-thumb) var(--emtec-scrollbar-track);
}

.emtec-app ::-webkit-scrollbar,
.emtec-auth ::-webkit-scrollbar {
  width: var(--emtec-scrollbar-size);
  height: var(--emtec-scrollbar-size);
}

.emtec-app ::-webkit-scrollbar-track,
.emtec-auth ::-webkit-scrollbar-track {
  background: var(--emtec-scrollbar-track);
  border-radius: 999px;
}

.emtec-app ::-webkit-scrollbar-thumb,
.emtec-auth ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
  border: 1px solid var(--emtec-scrollbar-thumb-border);
  border-radius: 999px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.05),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.emtec-app ::-webkit-scrollbar-thumb:hover,
.emtec-auth ::-webkit-scrollbar-thumb:hover {
  background: var(--emtec-scrollbar-thumb-hover);
  border-color: #cbd5e1;
  box-shadow:
    0 2px 8px rgba(15, 23, 42, 0.08),
    inset 0 1px 0 #ffffff;
}

.emtec-app ::-webkit-scrollbar-thumb:active,
.emtec-auth ::-webkit-scrollbar-thumb:active {
  background: #f8fafc;
  border-color: #94a3b8;
}

.emtec-app ::-webkit-scrollbar-corner,
.emtec-auth ::-webkit-scrollbar-corner {
  background: transparent;
}

/* Sidebar oscuro: thumb blanco semitransparente */
.emtec-sidebar,
.emtec-sidebar * {
  scrollbar-color: var(--emtec-scrollbar-dark-thumb) var(--emtec-scrollbar-dark-track);
}

.emtec-sidebar ::-webkit-scrollbar-track {
  background: var(--emtec-scrollbar-dark-track);
  border-radius: 999px;
}

.emtec-sidebar ::-webkit-scrollbar-thumb {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.42) 0%,
    rgba(255, 255, 255, 0.28) 100%
  );
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}

.emtec-sidebar ::-webkit-scrollbar-thumb:hover {
  background: var(--emtec-scrollbar-dark-thumb-hover);
  border-color: rgba(255, 255, 255, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  scrollbar-width: thin;
  scrollbar-color: var(--emtec-scrollbar-thumb) var(--emtec-scrollbar-track);
}

html {
  font-size: var(--emtec-root-font-size, 15px);
}

html,
body {
  margin: 0;
  padding: 0;
}

body.emtec-app {
  min-height: 100vh;
  min-height: 100dvh;
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-size: 1rem;
  line-height: 1.5;
  color: var(--emtec-text);
  background: var(--emtec-bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* —— Auth pages —— */
body.emtec-auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  font-family: Inter, "Segoe UI", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--emtec-text);
  -webkit-font-smoothing: antialiased;
  background: var(
    --emtec-auth-gradient,
    linear-gradient(155deg, #0c2f6e 0%, #1a56c4 42%, #2563eb 72%, #38bdf8 100%)
  );
  position: relative;
  overflow: hidden;
}

.emtec-auth-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}

.emtec-auth-orb {
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  filter: blur(2px);
  will-change: transform, opacity;
}

.emtec-auth-orb--1 {
  width: min(420px, 75vw);
  height: min(420px, 75vw);
  top: -14%;
  right: -10%;
  animation: emtec-auth-orb-drift-a 18s ease-in-out infinite;
}

.emtec-auth-orb--2 {
  width: min(300px, 55vw);
  height: min(300px, 55vw);
  bottom: 6%;
  left: -8%;
  background: rgba(255, 255, 255, 0.07);
  animation: emtec-auth-orb-drift-b 22s ease-in-out infinite;
}

.emtec-auth-orb--3 {
  width: min(180px, 38vw);
  height: min(180px, 38vw);
  bottom: 26%;
  right: 16%;
  background: rgba(var(--emtec-primary-rgb, 26, 86, 196), 0.28);
  animation: emtec-auth-orb-drift-c 14s ease-in-out infinite;
}

@keyframes emtec-auth-orb-drift-a {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.85;
  }
  50% {
    transform: translate(-28px, 22px) scale(1.08);
    opacity: 1;
  }
}

@keyframes emtec-auth-orb-drift-b {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.75;
  }
  50% {
    transform: translate(32px, -24px) scale(1.12);
    opacity: 0.95;
  }
}

@keyframes emtec-auth-orb-drift-c {
  0%,
  100% {
    transform: translate(0, 0) scale(1);
    opacity: 0.7;
  }
  50% {
    transform: translate(-18px, -20px) scale(0.92);
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .emtec-auth-orb {
    animation: none !important;
  }
}

.emtec-auth-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: var(--emtec-auth-card-max-width, min(420px, 100%));
  background: var(--emtec-surface);
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: clamp(16px, 3vw, 20px);
  padding: clamp(28px, 5vw, 40px) clamp(22px, 4vw, 36px);
  box-shadow:
    0 24px 48px rgba(15, 23, 42, 0.2),
    0 0 0 1px rgba(255, 255, 255, 0.12) inset;
  text-align: center;
  margin: 0 auto;
}

.emtec-auth-logo {
  width: 160px;
  max-width: 80%;
  height: auto;
  margin: 0 auto 20px;
  display: block;
}

.emtec-auth-title {
  margin: 0 0 6px;
  font-size: calc(1.5rem * var(--emtec-login-font-scale, 1));
  font-weight: 700;
  color: var(--emtec-text);
}

.emtec-auth-sub {
  margin: 0 0 28px;
  font-size: 0.9rem;
  color: var(--emtec-muted);
}

.emtec-auth-notice {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--emtec-radius-sm);
  text-align: left;
  font-size: 0.88rem;
  line-height: 1.45;
}

.emtec-auth-notice--success {
  background: var(--emtec-success-bg);
  border: 1px solid #86efac;
  color: #166534;
}

.emtec-auth-notice--success > i {
  margin-top: 2px;
  font-size: 1.1rem;
}

.emtec-auth-notice p {
  margin: 4px 0 0;
  font-size: 0.85rem;
}

.emtec-auth-notice--error {
  background: var(--emtec-danger-bg, #fef2f2);
  border: 1px solid #fecaca;
  color: #991b1b;
}

.emtec-auth-notice--error > i {
  margin-top: 2px;
  font-size: 1.1rem;
}

.emtec-login-form {
  text-align: left;
}

.emtec-login-error {
  margin: 0 0 14px;
  padding: 10px 12px;
  border-radius: var(--emtec-radius-sm);
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  font-size: 0.88rem;
  line-height: 1.4;
  text-align: center;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.emtec-login-error.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.emtec-login-form.is-error .emtec-field.is-error .emtec-input {
  border-color: #dc2626;
  background: #fff5f5;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.emtec-login-form.is-error .emtec-field.is-error .emtec-input-wrap > i {
  color: #dc2626;
}

.emtec-login-form.is-error .emtec-field.is-error .emtec-label {
  color: #b91c1c;
}

@keyframes emtec-login-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  12% {
    transform: translateX(-9px);
  }
  24% {
    transform: translateX(9px);
  }
  36% {
    transform: translateX(-7px);
  }
  48% {
    transform: translateX(7px);
  }
  60% {
    transform: translateX(-4px);
  }
  72% {
    transform: translateX(4px);
  }
  84% {
    transform: translateX(-2px);
  }
}

.emtec-login-form.is-shake {
  animation: emtec-login-shake 0.5s ease;
}

@media (prefers-reduced-motion: reduce) {
  .emtec-login-form.is-shake {
    animation: none;
  }
}

.emtec-auth-card--wide {
  max-width: 440px;
}

.emtec-auth--db-setup .emtec-auth-card {
  text-align: left;
}

.emtec-db-config-form .emtec-field {
  margin-bottom: var(--space-md);
}

.emtec-db-config-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
  margin-top: var(--space-md);
}

.emtec-db-test-result {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  margin-top: var(--space-md);
  padding: 0.75rem 1rem;
  border-radius: var(--emtec-radius-md);
  font-size: 0.9rem;
  line-height: 1.45;
}

.emtec-db-test-result > i {
  margin-top: 0.15rem;
  flex-shrink: 0;
}

.emtec-db-test-result p {
  margin: 0.25rem 0 0;
}

.emtec-db-test-result--ok {
  background: rgba(22, 163, 74, 0.1);
  border: 1px solid rgba(22, 163, 74, 0.25);
  color: #166534;
}

.emtec-db-test-result--ok > i {
  color: #16a34a;
}

.emtec-db-test-result--error {
  background: rgba(220, 38, 38, 0.08);
  border: 1px solid rgba(220, 38, 38, 0.22);
  color: #991b1b;
}

.emtec-db-test-result--error > i {
  color: #dc2626;
}

.emtec-db-test-result--loading {
  background: rgba(37, 99, 235, 0.08);
  border: 1px solid rgba(37, 99, 235, 0.18);
  color: var(--emtec-text);
}

.emtec-field-hint {
  margin: 6px 0 0;
  font-size: 0.8rem;
  color: var(--emtec-muted);
  line-height: 1.4;
}

.emtec-field {
  margin-bottom: 18px;
  text-align: left;
}

.emtec-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--emtec-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.emtec-label--icon {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.emtec-label--icon > i {
  flex-shrink: 0;
  width: 1rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--emtec-primary);
  opacity: 0.92;
}

.emtec-label--icon > span {
  line-height: 1.2;
}

.emtec-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.emtec-input-wrap > i {
  position: absolute;
  left: 14px;
  color: var(--emtec-muted);
  font-size: 0.95rem;
  pointer-events: none;
}

.emtec-input {
  width: 100%;
  padding: 12px 14px 12px 42px;
  border: 1px solid var(--emtec-border);
  border-radius: var(--emtec-radius-sm);
  font: inherit;
  color: var(--emtec-text);
  background: var(--emtec-surface-2);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.emtec-input:focus {
  outline: none;
  border-color: var(--emtec-primary);
  box-shadow: 0 0 0 3px var(--emtec-focus-ring, rgba(26, 86, 196, 0.15));
  background: #fff;
}

.emtec-input-wrap--password .emtec-input {
  padding-right: 44px;
}

.emtec-input-toggle {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--emtec-muted);
  cursor: pointer;
  transition: color 0.15s, background 0.15s;
}

.emtec-input-toggle:hover {
  color: var(--emtec-primary);
  background: rgba(26, 86, 196, 0.08);
}

.emtec-input-toggle:focus-visible {
  outline: 2px solid var(--emtec-primary);
  outline-offset: 1px;
}

.emtec-input.no-icon {
  padding-left: 14px;
}

select.emtec-input {
  padding-left: 14px;
  cursor: pointer;
}

/* Select personalizado (UI custom + native oculto para el formulario) */
.emtec-select-wrap {
  position: relative;
  display: block;
  width: 100%;
  z-index: 1;
}

.emtec-select-wrap.is-open {
  z-index: 10040;
  position: relative;
}

.emtec-select-native {
  position: absolute;
  left: -9999px;
  top: auto;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
  appearance: none;
}

.emtec-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--emtec-border);
  border-radius: var(--emtec-radius-sm);
  font: inherit;
  font-weight: 500;
  color: var(--emtec-text);
  background: var(--emtec-surface-2);
  cursor: pointer;
  text-align: left;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

.emtec-select-trigger:hover {
  border-color: #cbd5e1;
  background: #fff;
}

.emtec-select-trigger:focus {
  outline: none;
  border-color: var(--emtec-primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 196, 0.18);
  background: #fff;
}

.emtec-select-wrap.is-open .emtec-select-trigger {
  border-color: var(--emtec-primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 196, 0.18);
  background: #fff;
}

.emtec-select-value {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.emtec-select-value-text,
.emtec-select-option-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.emtec-select-option-icon {
  flex-shrink: 0;
  width: 1.1rem;
  text-align: center;
  color: var(--emtec-primary);
  opacity: 0.9;
}

.emtec-select-option.is-selected .emtec-select-option-icon {
  color: var(--emtec-primary-dark);
}

.emtec-select-option[data-value="1"] .emtec-select-option-icon,
.emtec-select-value .fa-circle-check {
  color: var(--emtec-success);
}

.emtec-select-option[data-value="0"] .emtec-select-option-icon,
.emtec-select-value .fa-circle-xmark {
  color: var(--emtec-danger);
}

.emtec-select-chevron {
  flex-shrink: 0;
  color: var(--emtec-muted);
  font-size: 0.75rem;
  transition: transform 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}

.emtec-select-wrap.is-open .emtec-select-chevron {
  transform: rotate(180deg);
  color: var(--emtec-primary);
}

.emtec-select-menu {
  margin: 0;
  padding: 6px;
  list-style: none;
  background: #fff;
  border: 1px solid var(--emtec-border);
  border-radius: var(--emtec-radius-sm);
  box-shadow:
    0 4px 6px rgba(15, 23, 42, 0.04),
    0 16px 40px rgba(15, 23, 42, 0.12);
  max-height: 260px;
  overflow-x: hidden;
  overflow-y: auto;
  box-sizing: border-box;
}

.emtec-select-menu[hidden] {
  display: none !important;
}

.emtec-select-menu.emtec-select-menu--open {
  display: block;
  opacity: 1;
  visibility: visible;
  animation: emtecMenuIn 0.2s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes emtecMenuIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.emtec-select-menu::-webkit-scrollbar {
  width: 8px;
}

.emtec-select-option {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 14px;
  margin: 2px 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  font: inherit;
  font-weight: 500;
  color: var(--emtec-text);
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}

.emtec-select-option-text {
  flex: 1;
  min-width: 0;
}

.emtec-select-option-check {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--emtec-primary);
  opacity: 0;
  transition: opacity 0.12s ease;
}

.emtec-select-option:hover,
.emtec-select-option:focus {
  outline: none;
  background: #eff6ff;
  color: var(--emtec-primary-dark);
}

.emtec-select-option.is-selected {
  background: linear-gradient(135deg, #dbeafe 0%, #eff6ff 100%);
  color: var(--emtec-primary-dark);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(26, 86, 196, 0.15);
}

.emtec-select-option.is-selected .emtec-select-option-check {
  opacity: 1;
}

/* Animaciones globales */
@keyframes emtecFadeInUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes emtecToastIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.92);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes emtecToastOut {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(-12px) scale(0.94);
  }
}

@keyframes emtecEditTitleIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

[data-emtec-toast] {
  animation: emtecToastIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

[data-emtec-toast]:nth-child(2) {
  animation-delay: 0.08s;
}

[data-emtec-toast]:nth-child(3) {
  animation-delay: 0.14s;
}

/* Formulario en rejilla (no una sola línea) */
.emtec-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md) var(--space-lg);
  width: 100%;
}

.emtec-form-grid .emtec-field {
  margin-bottom: 0;
  min-width: 0;
}

.emtec-form-grid .emtec-field--full {
  grid-column: 1 / -1;
}

.emtec-form-grid .emtec-field--narrow {
  grid-column: 1 / -1;
  max-width: 320px;
}

.emtec-form-grid--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.emtec-form-grid--create {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.emtec-form-grid--create .emtec-field-action {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  padding-top: var(--space-xs);
}

/* Filas CRUD: vista / edición con animación */
.emtec-crud-block .emtec-row-edit {
  display: none;
}

.emtec-crud-block.is-editing .emtec-row-edit {
  display: table-row;
}

.emtec-crud-block:not(.is-editing) .emtec-row-edit > td {
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  line-height: 0;
  height: 0;
  overflow: hidden;
}

.emtec-crud-block .emtec-row-view td {
  transition: background 0.25s ease;
}

.emtec-crud-block.is-editing .emtec-row-view td {
  background: #e8f1fd;
  border-bottom-color: transparent;
}

.emtec-crud-block.is-editing .emtec-row-view {
  box-shadow: inset 3px 0 0 var(--emtec-primary);
}

.emtec-row-edit > td {
  padding: 0 !important;
  vertical-align: top;
}

.emtec-edit-panel {
  overflow: hidden;
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
  padding: 0 var(--space-lg);
  background: linear-gradient(180deg, #e8f1fd 0%, #f8fafc 55%, #fff 100%);
  border-bottom: 2px solid var(--emtec-primary-light);
  transition:
    max-height 0.45s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.32s ease,
    transform 0.38s cubic-bezier(0.22, 1, 0.36, 1),
    padding 0.38s ease;
}

.emtec-crud-block.is-editing .emtec-edit-panel {
  max-height: 680px;
  opacity: 1;
  transform: translateY(0);
  padding: var(--space-md) var(--space-lg) var(--space-lg);
  overflow: visible;
}

.emtec-card:has(.emtec-select-wrap.is-open) {
  overflow: visible;
  z-index: 50;
}

.emtec-datatable__body:has(.emtec-select-wrap.is-open) {
  overflow: visible;
}

.emtec-edit-panel-title {
  margin: 0 0 var(--space-md);
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--emtec-primary-dark);
  display: flex;
  align-items: center;
  gap: 8px;
  opacity: 0;
}

.emtec-crud-block.is-editing .emtec-edit-panel-title {
  animation: emtecEditTitleIn 0.35s ease 0.08s both;
}

.emtec-crud-block.is-editing .emtec-form-grid .emtec-field {
  animation: emtecFadeInUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.emtec-crud-block.is-editing .emtec-form-grid .emtec-field:nth-child(1) {
  animation-delay: 0.1s;
}

.emtec-crud-block.is-editing .emtec-form-grid .emtec-field:nth-child(2) {
  animation-delay: 0.14s;
}

.emtec-crud-block.is-editing .emtec-form-grid .emtec-field:nth-child(3) {
  animation-delay: 0.18s;
}

.emtec-crud-block.is-editing .emtec-form-grid .emtec-field:nth-child(4) {
  animation-delay: 0.22s;
}

.emtec-crud-block.is-editing .emtec-form-grid .emtec-field:nth-child(5) {
  animation-delay: 0.26s;
}

.emtec-crud-block.is-editing .emtec-form-grid .emtec-field:nth-child(6) {
  animation-delay: 0.3s;
}

.emtec-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-top: var(--space-lg);
  padding-top: var(--space-md);
  border-top: 1px solid var(--emtec-border);
  opacity: 0;
  position: relative;
  z-index: 1;
}

.emtec-form-grid:has(.emtec-select-wrap.is-open) {
  position: relative;
  z-index: 10030;
}

.emtec-crud-block.is-editing .emtec-edit-actions {
  animation: emtecFadeInUp 0.4s cubic-bezier(0.22, 1, 0.36, 1) 0.28s both;
}

@media (prefers-reduced-motion: reduce) {
  .emtec-edit-panel,
  .emtec-crud-block .emtec-row-view td,
  [data-emtec-toast],
  .emtec-toolbar-clear.is-resetting i,
  .emtec-crud-block.is-editing .emtec-form-grid .emtec-field,
  .emtec-crud-block.is-editing .emtec-edit-actions,
  .emtec-crud-block.is-editing .emtec-edit-panel-title {
    animation: none !important;
    transition: none !important;
  }

  .emtec-crud-block.is-editing .emtec-edit-panel {
    max-height: none;
    opacity: 1;
    transform: none;
  }
}

/* Modal etiqueta / código de barras */
.emtec-modal--barcode {
  z-index: 11040;
}

.emtec-modal--barcode .emtec-modal-backdrop {
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(4px);
}

.emtec-barcode-dialog {
  position: relative;
  max-width: min(440px, calc(100% - 24px));
  border-radius: var(--emtec-radius);
  border: 1px solid var(--emtec-border);
  box-shadow: var(--emtec-shadow-lg);
  overflow: hidden;
}

.emtec-barcode-dialog-head .emtec-barcode-dialog-close,
.emtec-barcode-dialog-head .emtec-dialog-close,
.emtec-modal-header .emtec-modal-close {
  position: static;
  top: auto;
  right: auto;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  margin-left: auto;
}

.emtec-barcode-dialog-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: calc(var(--space-lg) + 2px) var(--space-lg) var(--space-md);
}

.emtec-barcode-dialog-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: var(--emtec-info-bg);
  color: var(--emtec-primary);
  font-size: 1.05rem;
  box-shadow: none;
}

.emtec-barcode-dialog-icon i {
  color: inherit;
}

.emtec-barcode-dialog-title {
  margin: 0 0 4px;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.25;
  color: var(--emtec-text);
}

.emtec-barcode-dialog-desc {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.45;
  color: var(--emtec-muted);
}

.emtec-barcode-dialog-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: 0 var(--space-lg) var(--space-md);
}

.emtec-barcode-preview-panel {
  position: relative;
  display: flex;
  justify-content: center;
  padding: var(--space-md) var(--space-sm) var(--space-sm);
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border: 1px solid var(--emtec-border);
  border-radius: var(--emtec-radius);
}

.emtec-barcode-preview-tag {
  position: absolute;
  top: 10px;
  left: 12px;
  padding: 3px 8px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--emtec-muted);
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--emtec-border);
  border-radius: 999px;
}

.emtec-barcode-settings-title {
  margin: 0 0 var(--space-xs);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--emtec-muted);
}

.emtec-barcode-toggle-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.emtec-barcode-toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: 10px 12px;
  background: var(--emtec-surface);
  border: 1px solid var(--emtec-border);
  border-radius: var(--emtec-radius-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.emtec-barcode-toggle-card:hover:not(.is-disabled) {
  border-color: #cbd5e1;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05);
}

.emtec-barcode-toggle-card-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.emtec-barcode-toggle-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: color-mix(in srgb, var(--emtec-primary) 12%, #ffffff);
  color: var(--emtec-primary-dark, var(--emtec-primary));
  border: 1px solid color-mix(in srgb, var(--emtec-primary) 20%, #e2e8f0);
  font-size: 0.95rem;
}

.emtec-barcode-toggle-icon i {
  color: inherit;
  opacity: 1;
}

.emtec-barcode-toggle-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.emtec-barcode-toggle-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--emtec-text);
  line-height: 1.2;
}

.emtec-barcode-toggle-hint {
  font-size: 0.75rem;
  color: var(--emtec-muted);
  line-height: 1.2;
}

.emtec-ios-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
}

.emtec-ios-switch-row.is-disabled {
  opacity: 0.5;
}

.emtec-ios-switch-row.is-disabled .emtec-ios-switch-track {
  cursor: not-allowed;
}

.emtec-ios-switch-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--emtec-text);
}

.emtec-ios-switch-label i {
  width: 16px;
  color: var(--emtec-primary);
  font-size: 0.85rem;
  text-align: center;
}

.emtec-ios-switch {
  position: relative;
  display: inline-block;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
}

.emtec-ios-switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}

.emtec-ios-switch-track {
  position: absolute;
  inset: 0;
  cursor: pointer;
  background: #e2e8f0;
  border-radius: 31px;
  transition: background 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.emtec-ios-switch-track::before {
  content: "";
  position: absolute;
  width: 27px;
  height: 27px;
  left: 2px;
  top: 2px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.22);
  transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
}

.emtec-ios-switch input:checked + .emtec-ios-switch-track {
  background: #34c759;
}

.emtec-ios-switch input:checked + .emtec-ios-switch-track::before {
  transform: translateX(20px);
}

.emtec-ios-switch input:focus-visible + .emtec-ios-switch-track {
  outline: 2px solid var(--emtec-primary);
  outline-offset: 2px;
}

.emtec-barcode-label-sheet {
  width: 100%;
  max-width: 200px;
  margin-top: 6px;
  padding: 14px 12px 10px;
  background: #fff;
  border-radius: 8px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 8px 24px rgba(15, 23, 42, 0.1);
  text-align: center;
}

.emtec-barcode-line {
  margin: 0 0 3px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.3;
  word-break: break-word;
  color: var(--emtec-text);
}

.emtec-barcode-line--muted {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--emtec-muted);
}

.emtec-barcode-line[hidden] {
  display: none !important;
}

.emtec-barcode-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 6px;
}

.emtec-barcode-preview svg {
  max-width: 100%;
  height: auto;
  max-height: 68px;
}

.emtec-barcode-codigo {
  margin: 4px 0 0;
  font-size: 0.82rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.12em;
  line-height: 1.2;
  color: var(--emtec-text);
}

.emtec-barcode-codigo[hidden] {
  display: none !important;
}

.emtec-barcode-dialog-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--emtec-border);
  background: var(--emtec-surface-2);
}

.emtec-barcode-dialog-btn {
  justify-content: center;
  min-height: 42px;
}

@media (max-width: 576px) {
  .emtec-barcode-dialog-head {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .emtec-barcode-dialog-body,
  .emtec-barcode-dialog-footer {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .emtec-barcode-label-sheet {
    max-width: min(100%, 220px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .emtec-ios-switch-track,
  .emtec-ios-switch-track::before {
    transition: none;
  }
}

.emtec-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  justify-content: flex-end;
  align-items: center;
}

.emtec-table .emtec-row-actions {
  flex-wrap: nowrap;
  gap: 6px;
  justify-content: center;
}

.emtec-table .emtec-row-view td:last-child {
  white-space: nowrap;
}

.emtec-table th.text-end,
.emtec-table td .emtec-row-actions {
  text-align: center;
}

@media (max-width: 992px) {
  .emtec-form-grid,
  .emtec-form-grid--3,
  .emtec-form-grid--create {
    grid-template-columns: 1fr;
  }

  .emtec-form-grid--create .emtec-field-action {
    justify-content: stretch;
  }

  .emtec-form-grid--create .emtec-field-action .emtec-btn {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .emtec-row-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .emtec-row-actions .emtec-btn,
  .emtec-row-actions form {
    width: 100%;
  }

  .emtec-row-actions form .emtec-btn {
    width: 100%;
  }

  .emtec-datatable--cards .emtec-table .emtec-row-actions {
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
  }

  .emtec-datatable--cards .emtec-table .emtec-row-actions .emtec-btn,
  .emtec-datatable--cards .emtec-table .emtec-row-actions form,
  .emtec-datatable--cards .emtec-table .emtec-row-actions form .emtec-btn {
    width: auto;
  }

  .emtec-edit-actions {
    flex-direction: column-reverse;
  }

  .emtec-edit-actions .emtec-btn {
    width: 100%;
  }

  .emtec-crud-block.is-editing .emtec-edit-panel {
    padding: var(--space-md);
  }
}

.emtec-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 22px;
  border: none;
  border-radius: var(--emtec-radius-sm);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s, box-shadow 0.12s, background 0.12s;
}

.emtec-btn:active {
  transform: scale(0.98);
}

.emtec-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.emtec-btn-block {
  width: 100%;
}

.emtec-btn-primary {
  background: linear-gradient(180deg, var(--emtec-primary-light), var(--emtec-primary));
  color: #fff;
  box-shadow: 0 4px 14px var(--emtec-btn-shadow, rgba(26, 86, 196, 0.35));
}

.emtec-btn-primary:hover {
  box-shadow: 0 6px 20px var(--emtec-btn-shadow-hover, rgba(26, 86, 196, 0.45));
  color: #fff;
}

.emtec-btn-secondary {
  background: var(--emtec-surface-2);
  color: var(--emtec-text);
  border: 1px solid var(--emtec-border);
}

.emtec-btn-secondary:hover {
  background: #fff;
  color: var(--emtec-text);
}

.emtec-btn-danger {
  background: var(--emtec-danger);
  color: #fff;
}

.emtec-btn-danger:hover {
  color: #fff;
  filter: brightness(1.05);
}

.emtec-btn-danger:disabled,
.emtec-btn-danger[aria-disabled="true"] {
  opacity: 1;
  background: #334155;
  color: #fff;
  filter: none;
  cursor: not-allowed;
}

.emtec-btn-danger:disabled:hover,
.emtec-btn-danger[aria-disabled="true"]:hover {
  background: #334155;
  filter: none;
}

.emtec-btn-tip-wrap {
  display: inline-flex;
  vertical-align: middle;
  cursor: not-allowed;
}

.emtec-btn-tip-wrap .emtec-btn:disabled {
  pointer-events: none;
}

.emtec-btn-warning {
  background: var(--emtec-warning);
  color: #fff;
}

.emtec-btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.emtec-btn-ghost {
  background: transparent;
  border: 1px solid var(--emtec-border);
  color: var(--emtec-muted);
}

.emtec-btn-ghost:hover {
  background: #fef2f2;
  border-color: #fecaca;
  color: var(--emtec-danger);
}

.emtec-btn-icon {
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
}

.emtec-auth-actions {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.emtec-auth-actions .emtec-btn {
  flex: 1;
}

/* —— Sidebar —— */
html.emtec-sidebar-collapsed {
  --emtec-sidebar-w-current: var(--emtec-sidebar-w-mini);
}

.emtec-sidebar {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 1040;
  width: var(--emtec-sidebar-w-current);
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  background: linear-gradient(
    180deg,
    var(--emtec-sidebar-top, #0d3d94) 0%,
    var(--emtec-sidebar-bottom, #0a2f6e) 100%
  );
  border-right: 1px solid var(--emtec-sidebar-border, rgba(255, 255, 255, 0.1));
  transition: transform 0.25s ease;
}

.emtec-sidebar-head {
  flex-shrink: 0;
  padding: 0 0 14px;
  margin: 0 0 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.emtec-sidebar-head-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.emtec-sidebar-head-row .emtec-sidebar-brand {
  flex: 1;
  min-width: 0;
}

.emtec-sidebar-close {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  margin-top: 2px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  font-size: 1.15rem;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.emtec-sidebar-close:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.35);
}

.emtec-sidebar-close:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.85);
  outline-offset: 2px;
}

.emtec-sidebar-head .emtec-sidebar-brand {
  padding: 6px 8px 0;
  margin: 0;
  border-bottom: none;
}

.emtec-sidebar-foot {
  flex-shrink: 0;
  margin-top: auto;
  padding: 12px 2px 2px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.emtec-sidebar-foot .emtec-sidebar-toggle {
  width: 100%;
  max-width: none;
  height: 36px;
  margin: 0;
  border-radius: 10px;
}

.emtec-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px 18px;
  margin: 0 0 6px;
  background: transparent;
  border: none;
  border-radius: 0;
  box-shadow: none;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.emtec-sidebar-brand img,
.emtec-sidebar-brand-img {
  display: block;
  flex-shrink: 0;
  max-width: 100%;
  width: auto;
  max-height: 44px;
  height: auto;
  object-fit: contain;
}

.emtec-sidebar-brand--logo {
  justify-content: flex-start;
}

.emtec-sidebar-brand--text {
  justify-content: flex-start;
}

.emtec-sidebar-brand-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  text-align: left;
  min-width: 0;
}

.emtec-sidebar-brand-title {
  font-size: calc(0.78rem * var(--emtec-sidebar-font-scale, 1));
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #fff;
  line-height: 1.3;
  text-transform: uppercase;
  word-break: break-word;
}

.emtec-sidebar-brand-sub {
  font-size: calc(0.65rem * var(--emtec-sidebar-font-scale, 1));
}

.emtec-sidebar-brand-sub {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.3;
}

.emtec-sidebar-brand--logo-text {
  flex-direction: row;
  align-items: center;
}

.emtec-sidebar-brand--logo-text .emtec-sidebar-brand-img {
  max-height: 38px;
}

.emtec-nav {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.emtec-nav-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.emtec-nav-group:first-of-type {
  margin-top: 12px;
  padding-top: 14px;
}

.emtec-nav-link--solo {
  margin-bottom: 4px;
}

.emtec-nav-label {
  padding: 0 12px 6px;
  font-size: calc(0.68rem * var(--emtec-sidebar-font-scale, 1));
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.45);
}

.emtec-nav-group .emtec-nav-link {
  padding-left: 12px;
  font-size: 0.9rem;
}

.emtec-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: var(--emtec-radius-sm);
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-weight: 500;
  font-size: calc(0.92rem * var(--emtec-sidebar-font-scale, 1));
  transition: background 0.15s, color 0.15s;
}

.emtec-nav-link i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  opacity: 0.9;
}

.emtec-nav-link:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.emtec-nav-link.active {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.15);
}

.emtec-sidebar-user {
  margin-top: auto;
  flex-shrink: 0;
  padding: 12px 10px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.emtec-sidebar-user-inner {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.emtec-sidebar-user-avatar {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
  color: #fff;
  background: rgba(255, 255, 255, 0.15);
}

.emtec-sidebar-user-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.emtec-sidebar-user-name {
  color: #fff;
  font-weight: 600;
  font-size: calc(0.84rem * var(--emtec-sidebar-font-scale, 1));
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.emtec-sidebar-user-role {
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.72rem;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.emtec-sidebar-logout {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.7);
  background: transparent;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.15s ease, background 0.15s ease;
}

.emtec-sidebar-logout:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.emtec-sidebar-logout:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

.emtec-sidebar-brand-mark {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: 800;
  color: #fff;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.emtec-sidebar-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  margin: 2px 0 0;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.2);
  color: rgba(255, 255, 255, 0.92);
  font-size: 0.72rem;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.emtec-sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.28);
}

.emtec-sidebar-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.35);
}

html.emtec-sidebar-collapsed .emtec-sidebar-toggle i {
  transform: rotate(180deg);
}

html.emtec-sidebar-collapsed .emtec-sidebar {
  padding: 14px 8px;
  align-items: center;
}

html.emtec-sidebar-collapsed .emtec-sidebar-head {
  padding: 0 0 10px;
  margin-bottom: 4px;
}

html.emtec-sidebar-collapsed .emtec-sidebar-head .emtec-sidebar-brand {
  justify-content: center;
  padding: 0;
  margin-bottom: 0;
  width: 100%;
}

html.emtec-sidebar-collapsed .emtec-sidebar-foot {
  padding: 10px 0 2px;
  width: 100%;
}

html.emtec-sidebar-collapsed .emtec-sidebar-foot .emtec-sidebar-toggle {
  width: 40px;
  max-width: 40px;
  height: 32px;
  margin: 0 auto;
}

html.emtec-sidebar-collapsed .emtec-sidebar-brand-text {
  display: none !important;
}

html.emtec-sidebar-collapsed .emtec-sidebar-brand-img {
  display: none !important;
}

html.emtec-sidebar-collapsed .emtec-sidebar-brand--logo .emtec-sidebar-brand-img,
html.emtec-sidebar-collapsed .emtec-sidebar-brand--logo-text .emtec-sidebar-brand-img {
  display: block !important;
  width: 38px;
  max-height: 38px;
  margin: 0 auto;
  object-fit: contain;
}

html.emtec-sidebar-collapsed .emtec-sidebar-brand--logo .emtec-sidebar-brand-mark,
html.emtec-sidebar-collapsed .emtec-sidebar-brand--logo-text .emtec-sidebar-brand-mark {
  display: none;
}

html.emtec-sidebar-collapsed .emtec-sidebar-brand-mark {
  display: inline-flex;
}

html.emtec-sidebar-collapsed .emtec-nav {
  width: 100%;
  align-items: center;
}

html.emtec-sidebar-collapsed .emtec-nav-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

html.emtec-sidebar-collapsed .emtec-nav-group {
  width: 100%;
  padding-top: 8px;
  margin-top: 6px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

html.emtec-sidebar-collapsed .emtec-nav-group:first-of-type {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}

html.emtec-sidebar-collapsed .emtec-nav-link {
  justify-content: center;
  gap: 0;
  width: 48px;
  max-width: 100%;
  margin: 0 auto 4px;
  padding: 12px;
  font-size: 0;
  border-radius: 14px;
}

html.emtec-sidebar-collapsed .emtec-nav-link i {
  width: auto;
  margin: 0;
  font-size: 1.05rem;
  opacity: 1;
}

html.emtec-sidebar-collapsed .emtec-nav-link:hover {
  background: rgba(255, 255, 255, 0.12);
}

html.emtec-sidebar-collapsed .emtec-nav-link.active {
  background: #fff;
  color: var(--emtec-primary, #1a56c4);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
  font-weight: 600;
}

html.emtec-sidebar-collapsed .emtec-nav-link.active i {
  color: var(--emtec-primary, #1a56c4);
}

html.emtec-sidebar-collapsed .emtec-sidebar-user {
  padding: 10px 6px 12px;
}

html.emtec-sidebar-collapsed .emtec-sidebar-user-inner {
  flex-direction: column;
  gap: 6px;
}

html.emtec-sidebar-collapsed .emtec-sidebar-user-text {
  display: none;
}

html.emtec-sidebar-collapsed .emtec-sidebar-logout {
  width: 32px;
  height: 32px;
}

@media (max-width: 991px) {
  .emtec-sidebar-toggle {
    display: none;
  }

  html.emtec-sidebar-collapsed {
    --emtec-sidebar-w-current: var(--emtec-sidebar-w);
  }
}

@media (prefers-reduced-motion: reduce) {
  .emtec-sidebar,
  .emtec-main {
    transition: none;
  }
}

/* —— Layout —— */
.emtec-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 1035;
}

.emtec-overlay.show {
  display: block;
}

.emtec-main {
  margin-left: var(--emtec-sidebar-w-current);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  width: calc(100% - var(--emtec-sidebar-w-current));
  max-width: 100%;
  transition:
    margin-left 0.22s ease,
    width 0.22s ease;
}

.emtec-sidebar {
  transition: width 0.22s ease, padding 0.22s ease;
}

.emtec-topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: stretch;
  justify-content: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) 0;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--emtec-border);
  width: 100%;
}

.emtec-topbar-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: var(--space-sm);
  width: 100%;
  min-width: 0;
  padding-inline: 14px;
}

.emtec-topbar-start {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  min-width: 0;
}

.emtec-topbar-center {
  justify-self: center;
}

.emtec-page-head {
  flex: 1;
  min-width: 0;
}

.emtec-topbar-actions {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
  justify-self: end;
  margin-left: 0;
}

.emtec-topbar-pill {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  width: auto;
  max-width: none;
  height: 44px;
  min-height: 44px;
  box-sizing: border-box;
  border-radius: 999px;
  background: rgba(241, 245, 249, 0.92);
  border: 1px solid var(--emtec-border);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.emtec-topbar-clock {
  gap: 8px;
  padding: 0 12px;
  justify-content: center;
  color: #334155;
  font-size: 0.82rem;
  line-height: 1.2;
  white-space: nowrap;
}

.emtec-topbar-user-pill {
  gap: 8px;
  padding: 0 5px 0 10px;
  min-width: 0;
  max-width: min(220px, 42vw);
}

.emtec-topbar-user-avatar {
  flex-shrink: 0;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(145deg, var(--emtec-primary-light), var(--emtec-primary));
  box-shadow: 0 2px 8px rgba(26, 86, 196, 0.28);
}

.emtec-topbar-user-text {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 132px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.2;
}

.emtec-topbar-user-name {
  font-size: 0.84rem;
  font-weight: 600;
  color: #1e293b;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.emtec-topbar-user-role {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--emtec-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.emtec-topbar-user-logout {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  color: #64748b;
  background: #fff;
  border: 1px solid #e2e8f0;
  font-size: 0.88rem;
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease;
}

.emtec-topbar-user-logout:hover {
  color: var(--emtec-danger);
  background: #fef2f2;
  border-color: #fecaca;
}

.emtec-topbar-user-logout:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.25);
}

.emtec-topbar-clock-date {
  font-weight: 500;
  color: #475569;
}

.emtec-topbar-clock-time {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #1e293b;
  letter-spacing: 0.02em;
}

@media (max-width: 900px) {
  .emtec-topbar-clock-date {
    display: none;
  }
}

@media (max-width: 768px) {
  .emtec-topbar-user-role {
    display: none;
  }

  .emtec-topbar-user-text {
    max-width: 88px;
  }
}

@media (max-width: 576px) {
  .emtec-topbar-inner {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .emtec-topbar-center {
    display: none;
  }

  .emtec-topbar-actions {
    gap: 12px;
  }

  .emtec-topbar-pill {
    width: auto;
    max-width: none;
    height: 40px;
    min-height: 40px;
  }

  .emtec-topbar-user-pill {
    gap: 6px;
    padding: 0 4px 0 8px;
    max-width: min(200px, 52vw);
  }

  .emtec-topbar-user-avatar {
    width: 28px;
    height: 28px;
    font-size: 0.75rem;
  }

  .emtec-topbar-user-logout {
    width: 30px;
    height: 30px;
    font-size: 0.8rem;
  }
}

/* —— Tooltips (bocadillo tipo chat) —— */
.emtec-tooltip {
  position: fixed;
  z-index: 12050;
  pointer-events: none;
  width: max-content;
  max-width: min(280px, calc(100vw - 16px));
  opacity: 0;
  transform: scale(0.96);
  transition:
    opacity 0.14s ease,
    transform 0.14s cubic-bezier(0.22, 1, 0.36, 1);
}

.emtec-tooltip.is-visible {
  opacity: 1;
  transform: scale(1);
}

.emtec-tooltip-bubble {
  display: inline-block;
  position: relative;
  z-index: 1;
  width: max-content;
  max-width: min(280px, calc(100vw - 16px));
  padding: 8px 12px;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.25;
  color: #111b21;
  text-align: center;
  white-space: nowrap;
  background: #fff;
  border: 1px solid rgba(17, 27, 33, 0.08);
  border-radius: 10px;
  box-shadow:
    0 4px 14px rgba(11, 20, 26, 0.14),
    0 1px 3px rgba(11, 20, 26, 0.08);
}

.emtec-tooltip--compact .emtec-tooltip-bubble {
  padding: 6px 11px;
  font-size: 0.78rem;
  border-radius: 9px;
}

.emtec-tooltip--wrap .emtec-tooltip-bubble {
  white-space: normal;
  width: auto;
  min-width: 120px;
  line-height: 1.4;
  text-align: center;
}

.emtec-tooltip-tail {
  position: absolute;
  z-index: 0;
  width: 9px;
  height: 9px;
  background: #fff;
  border: 1px solid rgba(17, 27, 33, 0.08);
  transform: rotate(45deg);
  box-sizing: border-box;
}

.emtec-tooltip--top .emtec-tooltip-tail {
  bottom: -4px;
  left: var(--tip-anchor-x, 50%);
  margin-left: -4.5px;
  border-top: none;
  border-left: none;
}

.emtec-tooltip--bottom .emtec-tooltip-tail {
  top: -4px;
  left: var(--tip-anchor-x, 50%);
  margin-left: -4.5px;
  border-bottom: none;
  border-right: none;
}

.emtec-tooltip--right .emtec-tooltip-tail {
  left: -4px;
  top: var(--tip-anchor-y, 50%);
  margin-top: -4.5px;
  border-top: none;
  border-right: none;
}

.emtec-tooltip--left .emtec-tooltip-tail {
  right: -4px;
  top: var(--tip-anchor-y, 50%);
  margin-top: -4.5px;
  border-bottom: none;
  border-left: none;
}

@media (prefers-reduced-motion: reduce) {
  .emtec-tooltip {
    transition: none;
  }
}

/* Cabecera con filtros: título + barra en una fila (escritorio) */
.emtec-page-sticky-head {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: clamp(10px, 2vw, 20px);
  padding: 12px 0;
  min-height: 56px;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--emtec-border);
  width: 100%;
}

.emtec-page-sticky-head .emtec-topbar-inner {
  padding-inline: 14px;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  flex: 1 1 auto;
  min-width: 0;
}

.emtec-page-sticky-head .emtec-topbar--page-title {
  position: static;
  padding: 0;
  border: none;
  background: transparent;
  backdrop-filter: none;
  width: auto;
  min-width: 0;
  flex: 1 1 auto;
}

.emtec-page-sticky-head .emtec-page-head {
  flex: 0 1 auto;
  min-width: 0;
}

.emtec-page-sticky-head .emtec-page-title {
  font-size: clamp(1rem, 1.8vw, 1.2rem);
  white-space: nowrap;
}

.emtec-page-sub--compact {
  display: none;
}

@media (min-width: 1200px) {
  .emtec-page-sub--compact {
    display: block;
    margin: 1px 0 0;
    font-size: 0.72rem;
    line-height: 1.2;
  }
}

.emtec-filters-bar {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding: 2px 0 2px 8px;
}

.emtec-page-sticky-head--solo {
  min-height: 56px;
}

.emtec-menu-btn {
  display: none;
  width: 42px;
  height: 42px;
  border: 1px solid var(--emtec-border);
  border-radius: 10px;
  background: #fff;
  color: var(--emtec-text);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.emtec-page-head {
  flex: 1;
  min-width: 0;
}

.emtec-page-title {
  margin: 0;
  font-size: clamp(1.1rem, 2.5vw, 1.35rem);
  font-weight: 700;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  line-height: 1.3;
}

.emtec-page-title i {
  color: var(--emtec-primary);
  font-size: 1.15rem;
}

.emtec-page-sub {
  margin: 4px 0 0;
  font-size: 0.88rem;
  color: var(--emtec-muted);
}

.emtec-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  min-width: 0;
  padding: var(--pad-page-y) 14px;
  box-sizing: border-box;
}

.emtec-main.emtec-main--table-layout > .emtec-content {
  padding: var(--pad-page-y) 14px;
  gap: var(--space-sm);
}

html.emtec-content-constrained .emtec-main:not(.emtec-main--table-layout) > .emtec-content {
  max-width: var(--emtec-content-max-width, none);
  margin-inline: 0;
  width: 100%;
}

.emtec-main:not(.emtec-main--table-layout) > .emtec-content {
  max-width: none;
  margin-inline: 0;
  width: 100%;
}

/* Dashboard, apariencia y configuración: topbar fijo, scroll solo en contenido */
body.emtec-page-dashboard,
body.emtec-page-appearance,
body.emtec-page-config {
  height: 100dvh;
  overflow: hidden;
}

.emtec-page-dashboard .emtec-main,
.emtec-page-appearance .emtec-main,
.emtec-page-config .emtec-main {
  height: 100%;
  max-height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.emtec-page-dashboard .emtec-main > .emtec-page-sticky-head,
.emtec-page-appearance .emtec-main > .emtec-page-sticky-head,
.emtec-page-config .emtec-main > .emtec-page-sticky-head {
  flex: 0 0 auto;
  position: static;
}

.emtec-page-dashboard .emtec-main > .emtec-content {
  flex: 1 1 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.emtec-page-appearance .emtec-main > .emtec-content,
.emtec-page-config .emtec-main > .emtec-content {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.emtec-page-appearance .emtec-content > .emtec-appearance-wrap,
.emtec-page-config .emtec-content > .emtec-appearance-wrap {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.emtec-page-appearance .emtec-appearance-layout,
.emtec-page-config .emtec-appearance-layout,
.emtec-page-appearance .emtec-appearance-editor-col,
.emtec-page-config .emtec-appearance-editor-col {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

html.emtec-topbar-compact .emtec-topbar,
html.emtec-topbar-compact .emtec-page-sticky-head {
  padding-top: calc(var(--space-xs) * 0.85);
  padding-bottom: calc(var(--space-xs) * 0.85);
  min-height: 48px;
}

html.emtec-topbar-compact .emtec-page-title {
  font-size: 1.05rem;
}

html.emtec-hide-page-subtitle .emtec-page-sub {
  display: none !important;
}

html.emtec-sidebar-nav-compact .emtec-nav-link {
  padding: 8px 12px;
  gap: 10px;
}

html.emtec-nav-active-accent .emtec-nav-link.active {
  background: rgba(255, 255, 255, 0.14);
  box-shadow: inset 4px 0 0 rgba(255, 255, 255, 0.92);
}

html.emtec-nav-active-minimal .emtec-nav-link.active {
  background: transparent;
  box-shadow: none;
  color: #fff;
  font-weight: 700;
}

.emtec-content > *:last-child {
  margin-bottom: 0;
}

/* —— Cards & KPI —— */
.emtec-card {
  background: var(--emtec-surface);
  border: 1px solid var(--emtec-border);
  border-radius: var(--emtec-radius);
  box-shadow: var(--emtec-shadow);
  overflow: hidden;
}

.emtec-card-pad {
  padding: var(--space-md) var(--space-lg);
}

.emtec-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-md) calc(var(--space-lg) + 4px);
  border-bottom: 1px solid var(--emtec-border);
  background: var(--emtec-surface-2);
}

.emtec-card-header-start {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-width: 0;
}

.emtec-card-header-hint {
  margin: 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--emtec-muted);
  line-height: 1.35;
}

.emtec-card-header-hint strong {
  color: var(--emtec-text);
  font-weight: 600;
}

.emtec-card-header-meta {
  margin: 0;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--emtec-muted);
  line-height: 1.3;
}

.emtec-card-header-meta.emtec-chip {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--emtec-text);
}

.emtec-card-header h2,
.emtec-card-header h3 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.emtec-card-header h2 i,
.emtec-card-header h3 i {
  color: var(--emtec-primary);
}

.emtec-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  width: 100%;
}

.emtec-kpi-grid--3 {
  grid-template-columns: repeat(3, 1fr);
}

@media (max-width: 1200px) {
  .emtec-kpi-grid--3 {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 576px) {
  .emtec-kpi-grid--3 {
    grid-template-columns: repeat(2, 1fr);
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }
}

.emtec-kpi {
  background: var(--emtec-surface);
  border: 1px solid var(--emtec-border);
  border-radius: var(--emtec-radius);
  padding: var(--space-md) var(--space-sm);
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  box-shadow: var(--emtec-shadow);
  min-width: 0;
}

.emtec-kpi-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.emtec-kpi-icon.blue {
  background: var(--emtec-info-bg);
  color: var(--emtec-primary);
}

.emtec-kpi-icon.green {
  background: var(--emtec-success-bg);
  color: var(--emtec-success);
}

.emtec-kpi-icon.red {
  background: var(--emtec-danger-bg);
  color: var(--emtec-danger);
}

.emtec-kpi-icon.amber {
  background: var(--emtec-warning-bg);
  color: var(--emtec-warning);
}

.emtec-kpi-icon.indigo {
  background: #e0e7ff;
  color: #4338ca;
}

.emtec-kpi-icon.slate {
  background: #f1f5f9;
  color: #475569;
}

.emtec-kpi-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--emtec-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.emtec-kpi-value {
  font-size: clamp(1.35rem, 3vw, 1.75rem);
  font-weight: 700;
  line-height: 1.2;
  margin-top: 2px;
}

/* —— Panel general (dashboard admin) —— */
.emtec-dashboard {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  width: 100%;
  box-sizing: border-box;
}

.emtec-kpi-grid--dashboard {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.emtec-dashboard-highlights {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md);
}

.emtec-dash-highlight {
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(135deg, #fff 0%, #f8fafc 100%);
  border: 1px solid var(--emtec-border);
  border-radius: var(--emtec-radius);
  box-shadow: var(--emtec-shadow);
}

.emtec-dash-highlight-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  padding: 4px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--emtec-primary-dark);
  background: #eff6ff;
  border-radius: 999px;
}

.emtec-dash-highlight-badge--tool {
  color: #b45309;
  background: #fffbeb;
}

.emtec-dash-highlight strong {
  display: block;
  font-size: 1.05rem;
  line-height: 1.35;
  color: var(--emtec-text);
}

.emtec-dash-highlight p {
  margin: 6px 0 0;
  font-size: 0.86rem;
  color: var(--emtec-muted);
}

.emtec-dashboard-row {
  display: grid;
  gap: var(--space-md);
}

.emtec-dashboard-row--main {
  grid-template-columns: 1.45fr 1fr;
}

.emtec-dashboard-row--bars {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.emtec-chart-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.emtec-chart-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--emtec-border);
}

.emtec-chart-card-head h3 {
  margin: 0;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.emtec-chart-card-head h3 i {
  color: var(--emtec-primary);
}

.emtec-chart-card-head p {
  margin: 4px 0 0;
  font-size: 0.8rem;
  color: var(--emtec-muted);
}

.emtec-chart-wrap {
  position: relative;
  flex: 1;
  min-height: 240px;
  padding: var(--space-md) var(--space-lg) var(--space-lg);
}

.emtec-chart-wrap--lg {
  min-height: 300px;
}

.emtec-chart-wrap--donut {
  min-height: 200px;
  max-height: 220px;
}

.emtec-chart-wrap--bar-h {
  min-height: 300px;
}

.emtec-chart-legend {
  list-style: none;
  margin: 0;
  padding: 0 var(--space-lg) var(--space-md);
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm) var(--space-lg);
  font-size: 0.85rem;
  color: var(--emtec-muted);
}

.emtec-chart-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
}

.emtec-chart-legend strong {
  color: var(--emtec-text);
  font-weight: 700;
}

.emtec-chart-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}

.emtec-chart-legend-empty {
  font-style: italic;
}

.emtec-page-dashboard .emtec-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-sm);
}

.emtec-page-dashboard .emtec-card--dashboard-movimientos:has(.emtec-datatable) {
  display: block;
  overflow: visible;
}

.emtec-page-dashboard .emtec-card--dashboard-movimientos .emtec-datatable {
  flex: none;
  min-height: auto;
}

.emtec-page-dashboard .emtec-card--dashboard-movimientos .emtec-datatable__body:not(.emtec-datatable__body--fill) {
  flex: none;
  max-height: none;
  overflow: visible;
}

.emtec-dashboard-row--registros {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: var(--space-lg);
  align-items: stretch;
}

.emtec-dash-registros-intro {
  margin: 0 0 var(--space-md);
  padding: 0 var(--space-lg);
  font-size: 0.875rem;
  color: var(--emtec-muted);
}

.emtec-registros-agrupados {
  list-style: none;
  margin: 0;
  padding: 0 var(--space-lg) var(--space-lg);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.emtec-registros-agrupados__dia {
  padding: 12px 14px;
  border: 1px solid var(--emtec-border);
  border-radius: var(--radius-md);
  background: var(--emtec-surface-2);
}

.emtec-registros-agrupados__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.emtec-registros-agrupados__head strong {
  text-transform: capitalize;
  font-size: 0.92rem;
}

.emtec-registros-agrupados__total {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--emtec-muted);
}

.emtec-registros-agrupados__counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.emtec-chip-sm {
  font-size: 0.72rem;
  padding: 4px 10px;
}

.emtec-empty--inline {
  margin: 0 var(--space-lg) var(--space-lg);
}

.emtec-dash-ocupacion-cta {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 0 var(--space-lg) var(--space-lg);
  padding: 16px 18px;
  border: 1px solid var(--emtec-border);
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.emtec-dash-ocupacion-cta:hover {
  border-color: var(--emtec-primary);
  box-shadow: 0 4px 14px rgba(26, 86, 196, 0.12);
}

.emtec-dash-ocupacion-cta__icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(220, 38, 38, 0.1);
  color: #b91c1c;
  font-size: 1.1rem;
}

.emtec-dash-ocupacion-cta strong {
  display: block;
  font-size: 0.95rem;
}

.emtec-dash-ocupacion-cta small {
  display: block;
  margin-top: 2px;
  color: var(--emtec-muted);
  font-size: 0.8rem;
}

.emtec-dash-ocupacion-cta > .fa-chevron-right {
  margin-left: auto;
  color: var(--emtec-muted);
}

body.emtec-page-ocupacion {
  height: 100dvh;
  overflow: hidden;
}

.emtec-page-ocupacion .emtec-main {
  height: 100%;
  max-height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

.emtec-page-ocupacion .emtec-main > .emtec-page-sticky-head {
  flex: 0 0 auto;
  position: static;
}

.emtec-page-ocupacion .emtec-main > .emtec-content {
  flex: 1 1 0;
  min-height: 0;
  max-width: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding-bottom: 14px;
}

.emtec-ocupacion-page {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.emtec-ocupacion-empty-card {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-xl);
  min-height: 200px;
}

.emtec-ocupacion-grid {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr));
  grid-auto-rows: minmax(0, 1fr);
  gap: clamp(14px, 2vw, 20px);
  align-items: stretch;
  width: 100%;
}

.emtec-ocupacion-card {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  width: 100%;
  border: 1px solid var(--emtec-border);
  border-radius: 14px;
  background: var(--emtec-surface);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.emtec-ocupacion-card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
  border-bottom: 1px solid var(--emtec-border);
}

.emtec-ocupacion-card__avatar {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--emtec-primary-dark);
  background: #e0ecff;
  border: 1px solid #bfdbfe;
  flex-shrink: 0;
}

.emtec-ocupacion-card__meta {
  min-width: 0;
  flex: 1;
}

.emtec-ocupacion-card__head h3 {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--emtec-text);
  text-transform: none;
  letter-spacing: 0;
}

.emtec-ocupacion-card__badge {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--emtec-primary-dark);
  background: #eff6ff;
  border-radius: 999px;
}

.emtec-ocupacion-card__tools {
  list-style: none;
  margin: 0;
  padding: 8px 0;
  flex: 1 1 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.emtec-ocupacion-card__tools::-webkit-scrollbar {
  width: 6px;
}

.emtec-ocupacion-card__tools::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

.emtec-ocupacion-tool {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px 12px;
  padding: 10px 14px;
  border-bottom: 1px solid #f1f5f9;
  transition: background 0.12s ease;
}

.emtec-ocupacion-tool:last-child {
  border-bottom: none;
}

.emtec-ocupacion-tool:hover {
  background: #f8fafc;
}

.emtec-ocupacion-tool__icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  font-size: 0.75rem;
  color: #64748b;
  background: #f1f5f9;
  flex-shrink: 0;
}

.emtec-ocupacion-tool__main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.emtec-ocupacion-tool__name {
  font-size: 0.84rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--emtec-text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.emtec-ocupacion-tool__marca {
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--emtec-muted);
}

.emtec-ocupacion-tool__aside {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex-shrink: 0;
  text-align: right;
}

.emtec-ocupacion-tool__code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 7px;
  color: #334155;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  letter-spacing: 0.04em;
}

.emtec-ocupacion-tool__aside time {
  font-size: 0.68rem;
  font-weight: 500;
  color: #94a3b8;
  white-space: nowrap;
}

@media (max-width: 767px) {
  .emtec-ocupacion-grid {
    grid-template-columns: 1fr;
  }

  .emtec-ocupacion-tool {
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
  }

  .emtec-ocupacion-tool__aside {
    grid-column: 2;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
    text-align: left;
  }
}

@media (min-width: 768px) and (max-width: 1199px) {
  .emtec-ocupacion-grid {
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
  }
}

@media (min-width: 1600px) {
  .emtec-ocupacion-grid {
    grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  }
}

@media (max-width: 1400px) {
  .emtec-kpi-grid--dashboard {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 991px) {
  .emtec-kpi-grid--dashboard {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .emtec-dashboard-row--main,
  .emtec-dashboard-row--bars,
  .emtec-dashboard-row--registros,
  .emtec-dashboard-highlights {
    grid-template-columns: 1fr;
  }
}

.emtec-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
  width: 100%;
}

.emtec-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr));
  gap: var(--space-sm);
  align-items: end;
  width: 100%;
}

.emtec-row .emtec-field {
  min-width: 0;
  margin-bottom: 0;
}

.emtec-field-action {
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
}

.emtec-field-action .emtec-btn {
  width: 100%;
  min-height: 46px;
}

.emtec-scan-panel .emtec-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr) auto;
}

.emtec-field-wide {
  min-width: 0;
}

/* —— Chips —— */
.emtec-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
}

.emtec-chip-success {
  background: var(--emtec-success-bg);
  color: #15803d;
}

.emtec-chip-danger {
  background: var(--emtec-danger-bg);
  color: #b91c1c;
}

.emtec-chip-warning {
  background: var(--emtec-warning-bg);
  color: #b45309;
}

.emtec-chip-primary {
  background: var(--emtec-info-bg);
  color: var(--emtec-primary-dark);
}

.emtec-chip-neutral {
  background: #f1f5f9;
  color: #475569;
}

.emtec-chip-info {
  background: #e0f2fe;
  color: #0369a1;
}

.emtec-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.emtec-input-sm {
  padding: 6px 10px;
  font-size: 0.82rem;
  min-height: 34px;
}

#modal-obs-seguimiento .emtec-select-wrap.is-open {
  position: relative;
  z-index: 2;
}

.emtec-obs-seguimiento-dialog {
  position: relative;
  max-width: min(520px, calc(100% - 24px));
  border-radius: var(--emtec-radius);
  border: 1px solid var(--emtec-border);
  box-shadow: var(--emtec-shadow-lg);
  overflow: hidden;
}

.emtec-obs-seguimiento-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: 0 var(--space-lg) var(--space-md);
  max-height: min(58vh, 480px);
  overflow-y: auto;
}

.emtec-obs-resumen-texto {
  margin: 0 0 var(--space-sm);
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--emtec-text);
}

.emtec-obs-resumen-fechas {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-xs);
  margin: 0;
  padding: var(--space-sm);
  background: var(--emtec-surface-2);
  border: 1px solid var(--emtec-border);
  border-radius: var(--emtec-radius-sm);
}

.emtec-obs-resumen-fechas dt {
  margin: 0;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--emtec-muted);
}

.emtec-obs-resumen-fechas dd {
  margin: 2px 0 0;
  font-size: 0.82rem;
  font-weight: 600;
}

.emtec-obs-timeline {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.emtec-obs-timeline-item {
  display: grid;
  grid-template-columns: 14px 1fr;
  gap: 12px;
  align-items: start;
}

.emtec-obs-timeline-dot {
  width: 12px;
  height: 12px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--emtec-muted);
  box-shadow: 0 0 0 3px var(--emtec-surface-2);
}

.emtec-obs-timeline-item--pendiente .emtec-obs-timeline-dot {
  background: #f59e0b;
}

.emtec-obs-timeline-item--en_reparacion .emtec-obs-timeline-dot {
  background: #0ea5e9;
}

.emtec-obs-timeline-item--reparada .emtec-obs-timeline-dot {
  background: #22c55e;
}

.emtec-obs-timeline-card {
  padding: 10px 12px;
  background: var(--emtec-surface-2);
  border: 1px solid var(--emtec-border);
  border-radius: var(--emtec-radius-sm);
}

.emtec-obs-timeline-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.emtec-obs-timeline-head time {
  font-size: 0.78rem;
  color: var(--emtec-muted);
}

.emtec-obs-timeline-card p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.45;
}

.emtec-obs-timeline-meta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.75rem;
  color: var(--emtec-muted);
}

.emtec-obs-timeline-empty {
  margin: 0;
  font-size: 0.88rem;
  color: var(--emtec-muted);
}

.emtec-obs-seguimiento-error {
  margin: 0;
  font-size: 0.85rem;
  color: var(--emtec-danger);
}

.emtec-obs-detalle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-md);
  margin: 0 0 var(--space-md);
}

.emtec-obs-detalle-grid dt {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--emtec-muted);
}

.emtec-obs-detalle-grid dd {
  margin: 4px 0 0;
  font-weight: 600;
}

.emtec-obs-detalle-texto h4 {
  margin: 0 0 var(--space-xs);
  font-size: 0.85rem;
  color: var(--emtec-muted);
}

.emtec-obs-detalle-texto p {
  margin: 0;
  line-height: 1.55;
  white-space: pre-wrap;
}

.emtec-muted {
  color: var(--emtec-muted);
}

@media (max-width: 576px) {
  .emtec-obs-resumen-fechas {
    grid-template-columns: 1fr;
  }
}

.emtec-code {
  font-family: ui-monospace, monospace;
  font-size: 0.82rem;
  padding: 4px 10px;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: 6px;
  letter-spacing: 0.05em;
}

/* —— Scan panel (técnico) —— */
.emtec-scan-panel {
  padding: var(--space-md) var(--space-lg);
  background: linear-gradient(135deg, #f0f7ff 0%, #fff 100%);
  border-bottom: 1px solid var(--emtec-border);
}

.emtec-scan-panel .emtec-row {
  align-items: end;
}

.emtec-page-scan .emtec-scan-form {
  margin: 0;
}

.emtec-scan-input-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
}

@media (max-width: 768px) {
  .emtec-page-scan .emtec-scan-input-hidden,
  .emtec-page-scan .emtec-scan-input-hidden--mobile {
    pointer-events: none;
    caret-color: transparent;
    -webkit-user-select: none;
    user-select: none;
  }
}

.emtec-scan-status-row {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  gap: var(--space-sm);
}

.emtec-scan-ready {
  flex: 1 1 240px;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: 14px 16px;
  background: #fff;
  border: 1px solid var(--emtec-border);
  border-radius: var(--emtec-radius);
  box-shadow: 0 2px 10px rgba(26, 86, 196, 0.06);
}

.emtec-scan-ready.is-busy {
  opacity: 0.75;
}

.emtec-scan-ready-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--emtec-primary-light), var(--emtec-primary));
  color: #fff;
  font-size: 1.15rem;
}

.emtec-scan-ready-text {
  flex: 1;
  min-width: 0;
}

.emtec-scan-ready-text strong {
  display: block;
  font-size: 0.95rem;
  color: var(--emtec-text);
  margin-bottom: 2px;
}

.emtec-scan-ready-text p,
.emtec-scan-ready-text > span:not(.emtec-scan-ready-icon) {
  display: block;
  margin: 0;
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--emtec-muted);
  font-weight: 400;
}

button.emtec-scan-ready.emtec-scan-camera-trigger {
  width: 100%;
  flex: 1 1 100%;
  cursor: pointer;
  text-align: left;
  font: inherit;
  color: inherit;
  -webkit-tap-highlight-color: transparent;
  transition: box-shadow 0.15s ease, transform 0.1s ease;
}

button.emtec-scan-camera-trigger:hover {
  box-shadow: 0 4px 14px rgba(26, 86, 196, 0.12);
}

button.emtec-scan-camera-trigger:active {
  transform: scale(0.99);
}

button.emtec-scan-camera-trigger:focus-visible {
  outline: 2px solid var(--emtec-primary);
  outline-offset: 2px;
}

.emtec-scan-ready-dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.5);
  animation: emtecScanPulse 1.8s ease-in-out infinite;
}

@keyframes emtecScanPulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.45);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(34, 197, 94, 0);
  }
}

.emtec-scan-camera-btn {
  flex-shrink: 0;
  align-self: stretch;
  min-height: 48px;
}

.emtec-scan-camera-label {
  margin-left: 6px;
}

@media (min-width: 769px) {
  .emtec-page-scan .emtec-scan-camera-btn {
    display: none !important;
  }
}

.emtec-scan-codigo-tag {
  margin-top: 4px;
  font-family: ui-monospace, monospace;
  font-size: 0.72rem;
  color: var(--emtec-muted);
  letter-spacing: 0.08em;
}

.emtec-scan-obs-cell {
  min-width: 180px;
}

.emtec-scan-obs-input {
  width: 100%;
  min-width: 160px;
}

/* Portal técnico: los códigos de barras no se muestran nunca */
body.emtec-portal-tech .emtec-code,
body.emtec-portal-tech [data-emtec-tool-code] {
  display: none !important;
}

.emtec-datatable--cards .emtec-table--scan .emtec-scan-obs-cell {
  grid-template-columns: 1fr;
}

.emtec-datatable--cards .emtec-table--scan .emtec-scan-obs-input {
  width: 100%;
  min-width: 0;
}

.emtec-datatable--cards .emtec-table--scan td:last-child .emtec-row-actions,
.emtec-datatable--cards .emtec-table--scan td:last-child {
  justify-content: center;
}

.emtec-tech-tools .emtec-datatable__body:not(.emtec-datatable__body--fill) {
  max-height: min(440px, 52vh);
}

.emtec-modal--scan-camera {
  z-index: 11070;
}

.emtec-modal--scan-camera .emtec-modal-backdrop {
  background: rgba(15, 23, 42, 0.65);
}

.emtec-scan-camera-dialog {
  max-width: min(420px, calc(100% - 20px));
  overflow: hidden;
}

.emtec-scan-camera-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--emtec-border);
}

.emtec-scan-camera-head h2 {
  margin: 0;
  font-size: 1rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.emtec-scan-camera-body {
  padding: var(--space-md);
}

.emtec-qr-mount {
  width: 100%;
  min-height: 240px;
  border-radius: var(--emtec-radius-sm);
  overflow: hidden;
  background: #0f172a;
}

.emtec-qr-mount video {
  border-radius: var(--emtec-radius-sm);
}

.emtec-scan-camera-hint {
  margin: var(--space-sm) 0 0;
  text-align: center;
  font-size: 0.85rem;
  color: var(--emtec-muted);
}

.emtec-scan-page {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}

.emtec-scan-card {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.emtec-scan-card .emtec-datatable,
.emtec-scan-card .emtec-scan-basket-panel {
  flex: 1;
  min-height: 0;
}

.emtec-scan-footer {
  flex-shrink: 0;
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--emtec-border);
  background: var(--emtec-surface-2);
}

.emtec-scan-footer .emtec-btn {
  width: 100%;
  min-height: 48px;
  font-size: 1rem;
}

.emtec-scan-camera-inline {
  display: none;
  flex-direction: column;
  background: #0f172a;
  border-bottom: 1px solid var(--emtec-border);
}

.emtec-scan-camera-inline.is-active:not([hidden]) {
  display: flex;
}

.emtec-scan-camera-inline-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: 8px var(--space-md);
  background: #1e293b;
  color: #e2e8f0;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.emtec-scan-camera-inline-bar span {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.emtec-scan-camera-trigger-row {
  width: 100%;
}

.emtec-qr-mount--inline {
  width: 100%;
  min-height: 132px;
  height: clamp(132px, 24vh, 200px);
  border-radius: 0;
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  background: #0f172a;
}

.emtec-qr-mount--inline > div,
.emtec-qr-mount--inline [id^="qr-reader"] {
  width: 100% !important;
  min-height: inherit !important;
  height: 100% !important;
  border: none !important;
  padding: 0 !important;
}

.emtec-qr-mount--inline video,
.emtec-scan-native-video {
  width: 100% !important;
  height: 100% !important;
  min-height: inherit;
  object-fit: cover;
  object-position: center;
  display: block;
  background: #0f172a;
}

.emtec-qr-mount--inline canvas {
  display: block;
}

.emtec-qr-mount--inline [id*="dashboard"],
.emtec-qr-mount--inline button {
  display: none !important;
}

/* Marco visual (no bloquea el escaneo) */
.emtec-qr-mount--inline::after {
  content: "";
  position: absolute;
  left: 5%;
  right: 5%;
  top: 50%;
  transform: translateY(-50%);
  height: 52px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 8px;
  pointer-events: none;
  z-index: 5;
}

@media (min-width: 769px) {
  .emtec-page-scan .emtec-scan-camera-inline,
  .emtec-page-scan .emtec-scan-camera-trigger-row {
    display: none !important;
  }

  .emtec-page-scan .emtec-scan-footer {
    margin-top: var(--space-sm);
    border-radius: 0 0 var(--emtec-radius) var(--emtec-radius);
  }
}

@media (max-width: 768px) {
  .emtec-page-scan .emtec-scan-lector-pc {
    display: none !important;
  }

  .emtec-scan-camera-active .emtec-scan-panel {
    display: none;
  }

  .emtec-page-scan .emtec-content {
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .emtec-page-scan .emtec-scan-page {
    flex: 1;
    min-height: 0;
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  .emtec-page-scan .emtec-scan-footer {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 10050;
    margin: 0;
    padding: var(--space-sm) var(--space-md);
    padding-bottom: calc(var(--space-sm) + env(safe-area-inset-bottom, 0px));
    background: #fff;
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.1);
    border-top: 1px solid var(--emtec-border);
  }

  .emtec-scan-camera-trigger-row {
    display: flex;
  }

  .emtec-scan-camera-trigger[hidden] {
    display: none !important;
  }

  .emtec-scan-camera-trigger:not([hidden]) {
    display: flex !important;
  }

  .emtec-scan-camera-inline.is-active:not([hidden]) {
    flex-shrink: 0;
  }

  .emtec-scan-camera-inline-bar {
    padding: 6px var(--space-sm);
    min-height: 36px;
  }

  .emtec-qr-mount--inline {
    min-height: 128px;
    height: clamp(128px, 22vh, 180px);
  }

  .emtec-qr-mount--inline::after {
    height: 56px;
  }

  .emtec-scan-camera-active .emtec-scan-card {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  .emtec-scan-camera-active .emtec-scan-card > .emtec-scan-basket-panel {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }

  .emtec-scan-camera-active .emtec-scan-basket-panel .emtec-table-footer,
  .emtec-scan-camera-active .emtec-scan-basket-panel .emtec-datatable__foot {
    flex-shrink: 0;
  }
}

@media (max-width: 576px) {
  .emtec-qr-mount--inline {
    min-height: 120px;
    height: clamp(120px, 20vh, 160px);
  }

  .emtec-qr-mount--inline::after {
    height: 52px;
  }

  .emtec-scan-camera-inline-bar {
    padding: 5px var(--space-sm);
    font-size: 0.72rem;
    min-height: 32px;
  }

  .emtec-scan-camera-inline-bar .emtec-btn-sm {
    padding: 4px 10px;
    font-size: 0.72rem;
  }

}

@media (max-width: 768px) {
  .emtec-scan-camera-btn[hidden] {
    display: none !important;
  }

  .emtec-scan-camera-btn:not([hidden]) {
    display: inline-flex;
    align-items: center;
  }

  .emtec-modal--scan-camera {
    padding: 0;
    align-items: stretch;
  }

  .emtec-modal--scan-camera .emtec-modal-backdrop {
    display: block;
  }

  .emtec-scan-camera-dialog {
    flex: 1;
    max-width: none;
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    border-radius: 0;
    display: flex;
    flex-direction: column;
  }

  .emtec-scan-camera-body {
    flex: 1;
    display: flex;
    flex-direction: column;
  }

  .emtec-qr-mount {
    flex: 1;
    min-height: 50vh;
  }
}

.emtec-actions-end {
  display: flex;
  justify-content: center;
  padding: var(--space-md) var(--space-lg);
  gap: var(--space-sm);
  border-top: 1px solid var(--emtec-border);
  background: var(--emtec-surface-2);
}

.emtec-actions-end .emtec-btn {
  min-width: min(100%, 280px);
}

.emtec-topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* —— Toast (flotante, estilo iOS) —— */
.emtec-toast-host {
  position: fixed;
  top: max(14px, env(safe-area-inset-top, 0px));
  left: 0;
  right: 0;
  z-index: 11050;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  pointer-events: none;
}

.emtec-toast {
  pointer-events: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: min(380px, 100%);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.875rem;
  font-weight: 600;
  line-height: 1.35;
  text-align: center;
  color: #fff;
  background: rgba(28, 28, 30, 0.92);
  backdrop-filter: blur(20px) saturate(1.4);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.18),
    0 0 0 0.5px rgba(255, 255, 255, 0.08) inset;
}

.emtec-toast span {
  flex: 1;
  min-width: 0;
}

.emtec-toast i {
  flex-shrink: 0;
  font-size: 1rem;
}

.emtec-toast-success i {
  color: #4ade80;
}

.emtec-toast-error i {
  color: #f87171;
}

.emtec-toast.is-leaving {
  animation: emtecToastOut 0.28s cubic-bezier(0.4, 0, 1, 1) forwards;
}

@media (max-width: 768px) {
  .emtec-toast-host {
    top: max(10px, env(safe-area-inset-top, 0px));
    padding: 0 14px;
  }

  .emtec-toast {
    width: 100%;
    max-width: none;
    border-radius: 14px;
    padding: 14px 18px;
  }
}

/* —— Quick links —— */
.emtec-quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-sm);
  margin-bottom: var(--space-lg);
  width: 100%;
}

.emtec-quick-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-xs);
  padding: var(--space-lg) var(--space-sm);
  min-height: 110px;
  text-align: center;
  background: var(--emtec-surface);
  border: 1px solid var(--emtec-border);
  border-radius: var(--emtec-radius);
  text-decoration: none;
  color: var(--emtec-text);
  font-weight: 600;
  font-size: 0.88rem;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.emtec-quick-link i {
  font-size: 1.5rem;
  color: var(--emtec-primary);
}

.emtec-quick-link:hover {
  border-color: var(--emtec-primary-light);
  box-shadow: var(--emtec-shadow);
  transform: translateY(-2px);
  color: var(--emtec-primary-dark);
}

/* Panel técnico — listas de herramientas (móvil) */
.emtec-tech-tools--dual .emtec-tech-tool-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: none;
}

.emtec-tech-tools--dual .emtec-tech-tools-table {
  display: block;
  min-width: 0;
}

.emtec-tech-tool-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: 12px var(--space-md);
  border: 1px solid var(--emtec-border);
  border-radius: 12px;
  margin: 0 10px 8px;
  background: var(--emtec-surface);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06);
}

.emtec-tech-tools--dual .emtec-tech-tool-item:last-child {
  margin-bottom: 10px;
}

.emtec-tech-tool-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.emtec-tech-tool-name {
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--emtec-text);
}

.emtec-tech-tool-code {
  font-size: 0.78rem;
  color: var(--emtec-muted);
  font-family: ui-monospace, monospace;
}

.emtec-tech-tool-date {
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--emtec-muted);
  white-space: nowrap;
}

.emtec-tech-tools-empty {
  padding: var(--space-lg) var(--space-md);
  text-align: center;
  color: var(--emtec-muted);
}

.emtec-tech-tools-empty i {
  display: block;
  font-size: 1.5rem;
  margin-bottom: var(--space-xs);
  opacity: 0.5;
}

.emtec-tech-tools-empty p {
  margin: 0;
  font-size: 0.9rem;
}

.emtec-tech-tools .emtec-card-header {
  padding: var(--space-sm) var(--space-md);
}

.emtec-tech-kpi-single {
  margin-bottom: var(--space-md);
  max-width: 360px;
}

.emtec-tech-kpi-single .emtec-kpi {
  margin: 0;
}

/* —— 404 —— */
.emtec-404-card {
  max-width: min(440px, 100%);
  padding: clamp(32px, 5vw, 44px) clamp(24px, 4vw, 36px);
}

.emtec-404-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto var(--space-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: linear-gradient(145deg, var(--emtec-primary-light), var(--emtec-primary));
  color: #fff;
  font-size: 1.55rem;
  box-shadow: 0 10px 24px rgba(26, 86, 196, 0.35);
}

.emtec-404-code {
  margin: 0 0 var(--space-xs);
  font-size: clamp(3.25rem, 12vw, 4.5rem);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--emtec-primary);
}

.emtec-404-title {
  margin: 0 0 var(--space-xs);
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--emtec-text);
}

.emtec-404-desc {
  margin: 0 0 var(--space-lg);
  font-size: 0.95rem;
  color: var(--emtec-muted);
  line-height: 1.55;
  max-width: 32ch;
  margin-left: auto;
  margin-right: auto;
}

.emtec-404-actions {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.emtec-404-actions .emtec-btn {
  justify-content: center;
}

/* —— Inline forms in tables —— */
.emtec-inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  align-items: center;
  justify-content: flex-start;
  max-width: 100%;
}

.emtec-inline-form .emtec-input {
  padding: 8px 12px;
  font-size: 0.85rem;
  min-width: min(120px, 100%);
  flex: 1 1 120px;
}

.emtec-inline-form select.emtec-input {
  min-width: min(110px, 100%);
}

.emtec-td-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-xs);
  align-items: center;
  justify-content: flex-start;
}

/* —— Responsive —— */

/* Pantallas muy grandes */
@media (min-width: 1600px) {
  :root {
    --emtec-sidebar-w: 280px;
  }

  .emtec-kpi-grid {
    gap: var(--space-md);
  }

  .emtec-card-pad,
  .emtec-scan-panel {
    padding: var(--space-lg) var(--space-xl);
  }
}

/* Tablet landscape / small laptop */
@media (max-width: 1200px) {
  .emtec-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 991px) {
  :root {
    --emtec-sidebar-w: 100vw;
  }

  .emtec-sidebar {
    transform: translateX(-100%);
    width: 100vw;
    width: 100dvw;
    max-width: 100%;
    height: 100dvh;
    padding:
      max(12px, env(safe-area-inset-top, 0px))
      14px
      max(12px, env(safe-area-inset-bottom, 0px));
    z-index: 1045;
    box-shadow: none;
  }

  .emtec-sidebar.open {
    transform: translateX(0);
  }

  .emtec-sidebar-close {
    display: inline-flex;
  }

  .emtec-sidebar-foot {
    display: none;
  }

  html.emtec-sidebar-collapsed .emtec-sidebar {
    width: 100vw;
    width: 100dvw;
  }

  .emtec-overlay {
    z-index: 1040;
  }

  .emtec-main {
    margin-left: 0;
    width: 100%;
  }

  .emtec-menu-btn {
    display: flex;
    flex-shrink: 0;
  }

  .emtec-quick-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Tablet portrait */
@media (max-width: 768px) {
  .emtec-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xs);
  }

  .emtec-quick-grid {
    grid-template-columns: 1fr;
    max-width: 400px;
    margin-left: auto;
    margin-right: auto;
  }

  .emtec-tech-home .emtec-tech-kpi-single {
    max-width: none;
  }

  .emtec-tech-home .emtec-tech-quick {
    grid-template-columns: repeat(3, 1fr);
    max-width: none;
    margin: 0 0 var(--space-sm);
    gap: var(--space-xs);
  }

  .emtec-tech-home .emtec-tech-quick .emtec-quick-link {
    min-height: 0;
    padding: 12px 6px;
    font-size: 0.72rem;
    gap: 6px;
    border-radius: var(--emtec-radius-sm);
  }

  .emtec-tech-home .emtec-tech-quick .emtec-quick-link i {
    font-size: 1.2rem;
  }

  .emtec-tech-home .emtec-tech-tools {
    margin-bottom: var(--space-sm);
  }

  .emtec-tech-tools--dual .emtec-tech-tool-list {
    display: block;
    padding: 8px 0 4px;
  }

  .emtec-tech-tools--dual .emtec-tech-tools-table,
  .emtec-tech-tools--dual .emtec-datatable {
    display: none !important;
  }

  .emtec-tech-tools--dual .emtec-tech-tools-empty {
    margin: 8px 10px 12px;
    padding: 28px 16px;
    border: 1px dashed var(--emtec-border);
    border-radius: 12px;
    background: var(--emtec-surface-2);
  }

  .emtec-card-header {
    gap: var(--space-sm);
  }

  .emtec-card-pad,
  .emtec-scan-panel {
    padding: var(--space-md);
  }

  .emtec-row,
  .emtec-scan-panel .emtec-row {
    grid-template-columns: 1fr;
  }

  .emtec-field-action {
    justify-content: stretch;
  }

  .emtec-inline-form {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .emtec-inline-form .emtec-input,
  .emtec-inline-form select.emtec-input {
    width: 100%;
    min-width: 0;
    flex: 1 1 auto;
  }

  .emtec-inline-form .emtec-btn {
    width: 100%;
  }

  .emtec-td-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .emtec-td-actions .emtec-btn {
    width: 100%;
  }

  .emtec-actions-end .emtec-btn {
    width: 100%;
    max-width: none;
  }

  .emtec-table th,
  .emtec-table td {
    padding: 12px 14px;
  }

  .emtec-page-title {
    justify-content: flex-start;
  }
}

/* Móvil */
@media (max-width: 576px) {
  :root {
    --pad-page-x: 14px;
    --pad-page-y: 16px;
  }

  .emtec-auth-actions {
    flex-direction: column;
  }

  .emtec-kpi {
    padding: var(--space-sm);
  }

  .emtec-kpi-icon {
    width: 42px;
    height: 42px;
    font-size: 1rem;
  }

  .emtec-kpi-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xs);
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }

  .emtec-kpi-grid--3 {
    grid-template-columns: repeat(2, 1fr);
    max-width: none;
    margin-left: 0;
    margin-right: 0;
  }

  .emtec-kpi-label {
    font-size: 0.72rem;
  }

  .emtec-empty {
    padding: var(--space-xl) var(--space-md) !important;
  }

  .emtec-nav-link {
    padding: 12px 14px;
    min-height: 44px;
  }

  .emtec-menu-btn {
    width: 44px;
    height: 44px;
  }

  .emtec-btn {
    min-height: 44px;
  }
}

/* —— Modal —— */
.emtec-modal {
  position: fixed;
  inset: 0;
  z-index: 10040;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-md);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

.emtec-modal.is-open {
  opacity: 1;
  visibility: visible;
}

.emtec-modal-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  padding: 0;
  margin: 0;
  background: rgba(15, 23, 42, 0.38);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.emtec-modal-dialog--md {
  max-width: 480px;
}

.emtec-modal-dialog--sm {
  max-width: 380px;
}

.emtec-modal-text {
  margin: 0;
  font-size: 0.95rem;
  color: var(--emtec-muted);
  line-height: 1.5;
}

.emtec-modal--logout {
  z-index: 11060;
}

.emtec-modal--confirm {
  z-index: 11050;
}

.emtec-modal--alert {
  z-index: 11075;
}

.emtec-modal--security {
  z-index: 11080;
}

.emtec-modal-dialog,
.emtec-dialog-card,
.emtec-logout-dialog,
.emtec-alert-dialog {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  max-height: min(90vh, 720px);
  display: flex;
  flex-direction: column;
  background: var(--emtec-surface);
  border: 1px solid var(--emtec-border);
  border-radius: var(--emtec-radius);
  box-shadow: var(--emtec-shadow-lg);
  transform: translateY(10px);
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
  overflow: hidden;
}

.emtec-dialog-card,
.emtec-logout-dialog,
.emtec-alert-dialog {
  max-width: 420px;
}

.emtec-dialog-card--wide,
.emtec-security-dialog {
  max-width: min(440px, calc(100vw - 32px));
}

.emtec-dialog-card::before,
.emtec-logout-dialog::before,
.emtec-alert-dialog::before,
.emtec-barcode-dialog::before,
.emtec-obs-seguimiento-dialog::before,
.emtec-loading-dialog::before,
.emtec-modal-dialog:not(.emtec-barcode-dialog):not(.emtec-obs-seguimiento-dialog):not(.emtec-loading-dialog):not(.emtec-scan-camera-dialog)::before {
  display: none;
}

.emtec-dialog-close,
.emtec-logout-dialog-close,
.emtec-security-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--emtec-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.emtec-dialog-close:hover,
.emtec-logout-dialog-close:hover,
.emtec-security-close:hover {
  background: var(--emtec-surface-2);
  color: var(--emtec-text);
}

.emtec-dialog-close:focus-visible,
.emtec-logout-dialog-close:focus-visible,
.emtec-security-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(26, 86, 196, 0.22);
}

.emtec-dialog-body,
.emtec-logout-dialog-body {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: var(--space-md);
  row-gap: 6px;
  align-items: start;
  padding: var(--space-lg);
  padding-right: calc(var(--space-lg) + 28px);
  text-align: left;
}

.emtec-dialog-body--left,
.emtec-security-dialog-body {
  display: flex;
  flex-direction: column;
  gap: var(--space-md);
  padding: var(--space-lg);
  padding-right: calc(var(--space-lg) + 28px);
  text-align: left;
}

.emtec-dialog-hero {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  column-gap: var(--space-md);
  row-gap: 6px;
  align-items: start;
  margin-bottom: 0;
  text-align: left;
}

.emtec-dialog-hero .emtec-dialog-icon {
  grid-column: 1;
  grid-row: 1 / span 2;
  margin: 0;
}

.emtec-dialog-hero .emtec-dialog-title {
  grid-column: 2;
  margin: 0;
  align-self: center;
}

.emtec-dialog-hero .emtec-dialog-text {
  grid-column: 2;
  margin: 0;
}

.emtec-dialog-body:not(.emtec-security-dialog-body) .emtec-dialog-icon {
  grid-column: 1;
  grid-row: 1 / span 2;
}

.emtec-dialog-body:not(.emtec-security-dialog-body) .emtec-dialog-title {
  grid-column: 2;
  margin: 0;
  align-self: center;
}

.emtec-dialog-body:not(.emtec-security-dialog-body) .emtec-dialog-text {
  grid-column: 2;
  margin: 0;
}

.emtec-dialog-icon,
.emtec-logout-dialog-icon {
  width: 44px;
  height: 44px;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  font-size: 1.05rem;
  box-shadow: none;
}

.emtec-dialog-icon--brand,
.emtec-logout-dialog-icon:not(.emtec-dialog-icon--danger):not(.emtec-dialog-icon--warn) {
  background: var(--emtec-info-bg);
  color: var(--emtec-primary);
}

.emtec-dialog-card[data-accent="logout"] .emtec-dialog-icon--brand {
  background: var(--emtec-danger-bg);
  color: var(--emtec-danger);
}

.emtec-dialog-icon--danger,
.emtec-dialog-icon[data-variant="error"],
.emtec-confirm-dialog-icon--danger {
  background: var(--emtec-danger-bg);
  color: var(--emtec-danger);
}

.emtec-dialog-icon--warn,
.emtec-dialog-icon[data-variant="warning"],
.emtec-confirm-dialog-icon--warn {
  background: var(--emtec-warning-bg);
  color: var(--emtec-warning);
}

.emtec-dialog-icon[data-variant="info"] {
  background: var(--emtec-info-bg);
  color: var(--emtec-primary);
}

.emtec-dialog-title,
.emtec-logout-dialog-title,
.emtec-alert-title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--emtec-text);
  line-height: 1.35;
}

.emtec-dialog-text,
.emtec-logout-dialog-text,
.emtec-alert-message {
  margin: 0;
  font-size: 0.9rem;
  color: var(--emtec-muted);
  line-height: 1.55;
  max-width: none;
}

.emtec-dialog-footer,
.emtec-logout-dialog-footer,
.emtec-security-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--emtec-border);
  background: var(--emtec-surface-2);
}

.emtec-dialog-footer--single {
  grid-template-columns: 1fr;
}

.emtec-dialog-btn,
.emtec-logout-dialog-btn,
.emtec-alert-btn {
  justify-content: center;
  min-height: 42px;
  width: 100%;
}

.emtec-logout-form {
  margin: 0;
  display: contents;
}

.emtec-logout-form .emtec-btn {
  width: 100%;
}

.emtec-security-dialog-body .emtec-config-code-hint {
  margin-top: 0;
}

.emtec-modal.is-open .emtec-modal-dialog {
  transform: translateY(0);
}

.emtec-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--emtec-border);
  background: var(--emtec-surface);
}

.emtec-modal-title {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.emtec-modal-title i {
  color: var(--emtec-primary);
}

.emtec-modal-close,
.emtec-barcode-dialog-close {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--emtec-muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.emtec-modal-close:hover,
.emtec-barcode-dialog-close:hover {
  background: var(--emtec-surface-2);
  color: var(--emtec-text);
}

.emtec-modal-close:focus-visible,
.emtec-barcode-dialog-close:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(26, 86, 196, 0.22);
}

.emtec-modal-body {
  padding: var(--space-lg);
  overflow-y: auto;
}

.emtec-modal-footer {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-sm);
  padding: var(--space-md) var(--space-lg);
  border-top: 1px solid var(--emtec-border);
  background: var(--emtec-surface-2);
}

.emtec-modal-footer .emtec-btn {
  justify-content: center;
  min-height: 42px;
  width: 100%;
}

.emtec-modal-footer:has(> :only-child) {
  grid-template-columns: 1fr;
}

.emtec-form-grid--modal {
  grid-template-columns: 1fr;
  gap: var(--space-md);
}

.emtec-card-header-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-sm);
  margin-left: auto;
  flex-shrink: 0;
}

.emtec-card-header-actions .emtec-inline-form {
  margin: 0;
}

.emtec-dropdown {
  position: relative;
  display: inline-flex;
}

.emtec-dropdown-toggle {
  gap: 6px;
}

.emtec-dropdown-caret {
  font-size: 0.65rem;
  opacity: 0.75;
  transition: transform 0.15s ease;
}

.emtec-dropdown.is-open .emtec-dropdown-caret {
  transform: rotate(180deg);
}

.emtec-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 120;
  min-width: 210px;
  padding: 6px;
  border: 1px solid var(--emtec-border);
  border-radius: var(--emtec-radius-sm);
  background: var(--emtec-surface);
  box-shadow: var(--emtec-shadow-lg, 0 12px 32px rgba(15, 23, 42, 0.14));
}

.emtec-dropdown-menu[hidden] {
  display: none;
}

.emtec-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--emtec-text);
  text-decoration: none;
  transition: background 0.12s ease;
}

.emtec-dropdown-item:hover {
  background: var(--emtec-surface-2);
  color: var(--emtec-primary);
}

.emtec-dropdown-item i {
  width: 1.1rem;
  text-align: center;
  color: var(--emtec-primary);
}

/* Barra búsqueda / filtros sobre tablas (dentro de card, no cabecera) */
.emtec-table-toolbar:not(.emtec-table-toolbar--top):not(.emtec-table-toolbar--standalone) {
  display: grid;
  grid-template-columns: minmax(200px, 1.4fr) minmax(0, 1fr);
  gap: var(--space-md) var(--space-lg);
  align-items: end;
  padding: var(--space-md) var(--space-lg);
  border-bottom: 1px solid var(--emtec-border);
  background: var(--emtec-surface);
}

.emtec-card-pad--compact {
  padding: var(--space-sm) var(--space-md);
}

.emtec-table-toolbar--standalone {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  padding: 0;
  border-bottom: none;
  background: transparent;
  gap: var(--space-sm);
  --emtec-toolbar-control-h: 40px;
}

.emtec-table-toolbar--standalone .emtec-label {
  margin-bottom: 4px;
}

.emtec-toolbar-search {
  flex: 1 1 240px;
  min-width: min(100%, 220px);
  max-width: 100%;
}

.emtec-toolbar-search .emtec-input-wrap {
  width: 100%;
}

.emtec-table-toolbar--standalone .emtec-toolbar-filters {
  display: contents;
}

.emtec-toolbar-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: var(--space-sm);
}

.emtec-table-toolbar--standalone .emtec-field--toolbar {
  flex: 0 1 180px;
  width: auto;
  min-width: 168px;
  max-width: 100%;
}

.emtec-field--toolbar {
  margin-bottom: 0;
  min-width: min(180px, 100%);
}

.emtec-table-toolbar--standalone .emtec-input,
.emtec-table-toolbar--standalone select.emtec-input {
  min-height: var(--emtec-toolbar-control-h);
  padding-top: 8px;
  padding-bottom: 8px;
  box-sizing: border-box;
}

.emtec-table-toolbar--standalone .emtec-toolbar-search .emtec-input {
  padding-top: 8px;
  padding-bottom: 8px;
}

.emtec-field--toolbar .emtec-select-wrap {
  min-width: 168px;
}

.emtec-table-toolbar--standalone .emtec-select-trigger {
  min-height: var(--emtec-toolbar-control-h);
  padding: 8px 12px;
  font-size: 0.875rem;
}

.emtec-table-toolbar--standalone .emtec-select-value {
  gap: 8px;
}

/* Filtros en cabecera (anula grid/flex genérico de .emtec-table-toolbar) */
.emtec-table-toolbar.emtec-table-toolbar--top {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  --emtec-toolbar-control-h: 36px;
}

.emtec-table-toolbar--top .emtec-toolbar-filters {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.emtec-table-toolbar--top .emtec-toolbar-search {
  flex: 0 1 200px;
  width: 200px;
  min-width: 120px;
  max-width: 260px;
}

.emtec-table-toolbar--top .emtec-toolbar-search .emtec-input-wrap {
  width: 100%;
}

.emtec-table-toolbar--top .emtec-toolbar-search .emtec-input-wrap i {
  font-size: 0.8rem;
  left: 10px;
}

.emtec-table-toolbar--top .emtec-toolbar-search .emtec-input {
  width: 100%;
  padding: 7px 10px 7px 32px;
  min-height: var(--emtec-toolbar-control-h);
  font-size: 0.8125rem;
  box-sizing: border-box;
}

.emtec-table-toolbar--top .emtec-field--toolbar {
  flex: 0 0 152px;
  width: 152px;
  min-width: 152px;
  max-width: 152px;
  margin: 0;
}

.emtec-table-toolbar--top .emtec-field--toolbar .emtec-select-wrap {
  width: 100%;
  min-width: 0;
}

.emtec-table-toolbar--top .emtec-select-trigger {
  width: 100%;
  min-height: var(--emtec-toolbar-control-h);
  height: var(--emtec-toolbar-control-h);
  padding: 0 28px 0 10px;
  font-size: 0.8125rem;
  box-sizing: border-box;
}

.emtec-table-toolbar--top .emtec-select-value {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.emtec-table-toolbar--top .emtec-select-value-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.emtec-table-toolbar--top .emtec-select-option-icon {
  font-size: 0.75rem;
  flex-shrink: 0;
}

.emtec-table-toolbar--top .emtec-select-chevron {
  right: 8px;
}

.emtec-table-toolbar--top .emtec-toolbar-clear {
  flex: 0 0 auto;
  min-height: var(--emtec-toolbar-control-h);
  height: var(--emtec-toolbar-control-h);
  padding: 0 10px;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.emtec-table-toolbar--top .emtec-toolbar-actions {
  display: flex;
  flex-flow: row nowrap;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.emtec-table-toolbar--top .emtec-toolbar-meta {
  display: none;
}

/* Filtros en cabecera de card (junto al botón de acción) */
.emtec-card-header--with-toolbar {
  align-items: center;
  flex-wrap: nowrap;
  gap: 12px;
}

.emtec-card-header--with-toolbar .emtec-card-header-start {
  flex: 0 0 auto;
}

.emtec-card-header--with-toolbar .emtec-card-header-actions {
  flex: 1 1 auto;
  min-width: 0;
  margin-left: 0;
  flex-wrap: nowrap;
  gap: 8px;
}

.emtec-card-header-actions > .emtec-table-toolbar.emtec-table-toolbar--top {
  flex: 1 1 auto;
  min-width: 0;
  width: auto;
  justify-content: flex-end;
}

.emtec-card-header-actions > .emtec-table-toolbar--top .emtec-toolbar-search {
  flex: 1 1 160px;
  width: auto;
  max-width: 220px;
}

.emtec-card-header-actions > .emtec-table-toolbar--top .emtec-field--toolbar {
  flex: 0 0 132px;
  width: 132px;
  min-width: 112px;
  max-width: 152px;
}

.emtec-toolbar-filters:empty {
  display: none;
}

.emtec-table-toolbar--standalone .emtec-select-option {
  padding: 10px 12px;
  margin: 1px 0;
  font-size: 0.875rem;
  border-radius: 10px;
}

.emtec-table-toolbar--standalone .emtec-select-menu {
  padding: 8px;
  border-radius: var(--emtec-radius-sm);
  box-shadow:
    0 8px 24px rgba(15, 23, 42, 0.1),
    0 2px 8px rgba(15, 23, 42, 0.06);
}

.emtec-toolbar-clear {
  flex-shrink: 0;
  align-self: flex-end;
  min-height: var(--emtec-toolbar-control-h);
  height: var(--emtec-toolbar-control-h);
  padding: 0 16px;
  font-size: 0.875rem;
  box-sizing: border-box;
}

.emtec-toolbar-clear i {
  display: inline-block;
  transform-origin: center center;
}

.emtec-toolbar-clear.is-resetting i {
  animation: emtecResetSpin 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes emtecResetSpin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(-360deg);
  }
}

.emtec-toolbar-meta {
  grid-column: 1 / -1;
  flex: 1 1 100%;
  width: 100%;
  margin: 0;
  font-size: 0.82rem;
  color: var(--emtec-muted);
  min-height: 1.2em;
}

/* Campo marca: lista o nueva */
.emtec-marca-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-xs);
}

.emtec-marca-field-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-xs);
}

.emtec-marca-field-top > .emtec-label--icon {
  margin-bottom: 0;
}

.emtec-marca-switch {
  display: inline-flex;
  padding: 3px;
  background: var(--emtec-surface-2);
  border: 1px solid var(--emtec-border);
  border-radius: 999px;
  gap: 2px;
}

.emtec-marca-switch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--emtec-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.2s ease,
    color 0.2s ease,
    box-shadow 0.2s ease;
}

.emtec-marca-switch-btn i {
  font-size: 0.75rem;
}

.emtec-marca-switch-btn:hover {
  color: var(--emtec-text);
}

.emtec-marca-switch-btn.is-active {
  background: #fff;
  color: var(--emtec-primary-dark);
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.emtec-marca-panel {
  animation: emtecFadeInUp 0.25s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.emtec-marca-panel[hidden] {
  display: none !important;
}

.emtec-marca-hint {
  margin: 6px 0 0;
  font-size: 0.78rem;
  color: var(--emtec-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.emtec-marca-hint i {
  color: var(--emtec-primary);
  font-size: 0.85rem;
}

.emtec-input-wrap--no-icon .emtec-input {
  padding-left: 14px;
}

.emtec-marca-field .emtec-select-wrap.is-open {
  z-index: 10060;
}

.emtec-highlight {
  background: #dbeafe;
  color: inherit;
  padding: 1px 3px;
  border-radius: 4px;
  font-weight: inherit;
}

@media (min-width: 769px) and (max-width: 1024px) {
  .emtec-page-sticky-head {
    flex-wrap: wrap;
    min-height: 0;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .emtec-page-sticky-head .emtec-filters-bar {
    flex: 1 1 100%;
    justify-content: stretch;
    padding: 4px 0 0;
  }

  .emtec-table-toolbar--top .emtec-toolbar-search,
  .emtec-card-header-actions > .emtec-table-toolbar--top .emtec-toolbar-search {
    flex: 1 1 auto;
    width: auto;
    max-width: none;
  }
}

/* Móvil: solo título arriba; filtros fijos abajo (fuera del sticky con backdrop-filter) */
@media (max-width: 768px) {
  .emtec-page-sticky-head {
    display: block;
    padding: 0;
    min-height: 0;
    background: transparent;
    backdrop-filter: none;
    border-bottom: none;
  }

  .emtec-page-sticky-head .emtec-topbar--page-title {
    width: 100%;
    padding: 12px max(var(--pad-page-x), 16px) 10px;
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--emtec-border);
  }

  .emtec-page-sticky-head .emtec-topbar-inner {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    align-items: center;
  }

  .emtec-page-sticky-head .emtec-topbar-start {
    min-width: 0;
    overflow: hidden;
  }

  .emtec-page-sticky-head .emtec-page-head {
    min-width: 0;
    overflow: hidden;
  }

  .emtec-page-sticky-head .emtec-page-title {
    display: block;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 1rem;
    line-height: 1.25;
    max-width: 100%;
  }

  .emtec-page-sticky-head .emtec-page-title i {
    font-size: 1rem;
  }

  .emtec-page-sub--compact {
    display: none !important;
  }

  .emtec-page-sticky-head .emtec-topbar-actions {
    flex-shrink: 0;
  }

  .emtec-topbar-user-text {
    display: none;
  }

  .emtec-topbar-user-pill {
    max-width: none;
    padding: 0 4px;
    gap: 4px;
  }

  .emtec-page-sticky-head .emtec-filters-bar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 110;
    width: 100%;
    margin: 0;
    padding: 7px 10px max(7px, env(safe-area-inset-bottom, 0px));
    background: rgba(255, 255, 255, 0.98);
    backdrop-filter: blur(14px);
    border-top: 1px solid var(--emtec-border);
    box-shadow: 0 -4px 20px rgba(15, 23, 42, 0.07);
    justify-content: stretch;
  }

  .emtec-main.emtec-main--table-layout:has(.emtec-filters-bar) .emtec-content {
    padding-bottom: calc(58px + env(safe-area-inset-bottom, 0px));
  }

  .emtec-card:has(.emtec-table-footer) .emtec-card-header {
    flex-direction: column;
    align-items: stretch;
  }

  .emtec-card:has(.emtec-table-footer) .emtec-card-header-actions {
    margin-left: 0;
    width: 100%;
    justify-content: stretch;
  }

  .emtec-card-header--with-toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .emtec-card-header--with-toolbar .emtec-card-header-actions {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .emtec-card-header--with-toolbar .emtec-card-header-actions > .emtec-btn,
  .emtec-card-header--with-toolbar .emtec-card-header-actions > .emtec-dropdown,
  .emtec-card-header--with-toolbar .emtec-card-header-actions > a.emtec-btn,
  .emtec-card-header--with-toolbar .emtec-card-header-actions > .emtec-inline-form {
    width: 100%;
  }

  .emtec-card-header--with-toolbar .emtec-card-header-actions > .emtec-btn,
  .emtec-card-header--with-toolbar .emtec-card-header-actions > .emtec-dropdown .emtec-btn,
  .emtec-card-header--with-toolbar .emtec-card-header-actions > a.emtec-btn {
    justify-content: center;
  }

  .emtec-card:has(.emtec-table-footer) .emtec-card-header-actions .emtec-btn,
  .emtec-card:has(.emtec-table-footer) .emtec-card-header-actions .emtec-dropdown {
    flex: 1 1 auto;
    justify-content: center;
  }

  /* Barra compacta: buscar + filtros + limpiar (cabecera de card o barra fija legacy) */
  .emtec-filters-bar .emtec-table-toolbar.emtec-table-toolbar--top,
  .emtec-card-header--with-toolbar .emtec-card-header-actions > .emtec-table-toolbar.emtec-table-toolbar--top {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(72px, 0.44fr) minmax(72px, 0.44fr) 30px;
    grid-template-rows: 28px;
    align-items: center;
    gap: 4px 5px;
    width: 100%;
    margin: 0;
    padding: 5px 6px 4px;
    border: 1px solid var(--emtec-border);
    border-radius: 10px;
    background: var(--emtec-surface-2);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.85);
    --emtec-toolbar-control-h: 28px;
  }

  .emtec-filters-bar .emtec-table-toolbar--top:has(.emtec-field--toolbar:only-of-type),
  .emtec-card-header--with-toolbar
    .emtec-card-header-actions
    > .emtec-table-toolbar--top:has(.emtec-field--toolbar:only-of-type) {
    grid-template-columns: minmax(0, 1fr) minmax(0, 0.44fr) 26px;
  }

  .emtec-filters-bar .emtec-table-toolbar--top:not(:has(.emtec-field--toolbar)),
  .emtec-card-header--with-toolbar
    .emtec-card-header-actions
    > .emtec-table-toolbar--top:not(:has(.emtec-field--toolbar)) {
    grid-template-columns: minmax(0, 1fr) 26px;
  }

  .emtec-filters-bar .emtec-table-toolbar--top .emtec-toolbar-filters,
  .emtec-filters-bar .emtec-table-toolbar--top .emtec-toolbar-actions,
  .emtec-card-header--with-toolbar .emtec-card-header-actions > .emtec-table-toolbar--top .emtec-toolbar-filters,
  .emtec-card-header--with-toolbar .emtec-card-header-actions > .emtec-table-toolbar--top .emtec-toolbar-actions {
    display: contents;
  }

  .emtec-filters-bar .emtec-table-toolbar--top .emtec-toolbar-search,
  .emtec-card-header--with-toolbar .emtec-card-header-actions > .emtec-table-toolbar--top .emtec-toolbar-search {
    grid-column: 1;
    grid-row: 1;
    width: auto;
    max-width: none;
    min-width: 0;
  }

  .emtec-filters-bar .emtec-table-toolbar--top .emtec-toolbar-filters .emtec-field--toolbar:nth-child(1),
  .emtec-card-header--with-toolbar
    .emtec-card-header-actions
    > .emtec-table-toolbar--top
    .emtec-toolbar-filters
    .emtec-field--toolbar:nth-child(1) {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .emtec-filters-bar .emtec-table-toolbar--top .emtec-toolbar-filters .emtec-field--toolbar:nth-child(2),
  .emtec-card-header--with-toolbar
    .emtec-card-header-actions
    > .emtec-table-toolbar--top
    .emtec-toolbar-filters
    .emtec-field--toolbar:nth-child(2) {
    grid-column: 3;
    grid-row: 1;
    min-width: 0;
  }

  .emtec-filters-bar
    .emtec-table-toolbar--top:has(.emtec-field--toolbar:only-of-type)
    .emtec-field--toolbar,
  .emtec-card-header--with-toolbar
    .emtec-card-header-actions
    > .emtec-table-toolbar--top:has(.emtec-field--toolbar:only-of-type)
    .emtec-field--toolbar {
    grid-column: 2;
  }

  .emtec-filters-bar .emtec-table-toolbar--top .emtec-toolbar-clear,
  .emtec-card-header--with-toolbar .emtec-card-header-actions > .emtec-table-toolbar--top .emtec-toolbar-clear {
    grid-column: 4;
    grid-row: 1;
    justify-self: stretch;
    align-self: stretch;
  }

  .emtec-filters-bar
    .emtec-table-toolbar--top:not(:has(.emtec-field--toolbar))
    .emtec-toolbar-clear,
  .emtec-card-header--with-toolbar
    .emtec-card-header-actions
    > .emtec-table-toolbar--top:not(:has(.emtec-field--toolbar))
    .emtec-toolbar-clear {
    grid-column: 2;
  }

  .emtec-filters-bar
    .emtec-table-toolbar--top:has(.emtec-field--toolbar:only-of-type)
    .emtec-toolbar-clear,
  .emtec-card-header--with-toolbar
    .emtec-card-header-actions
    > .emtec-table-toolbar--top:has(.emtec-field--toolbar:only-of-type)
    .emtec-toolbar-clear {
    grid-column: 3;
  }

  .emtec-filters-bar .emtec-table-toolbar--top .emtec-toolbar-search .emtec-input-wrap,
  .emtec-card-header--with-toolbar
    .emtec-card-header-actions
    > .emtec-table-toolbar--top
    .emtec-toolbar-search
    .emtec-input-wrap {
    height: var(--emtec-toolbar-control-h);
  }

  .emtec-filters-bar .emtec-table-toolbar--top .emtec-toolbar-search .emtec-input-wrap i,
  .emtec-card-header--with-toolbar
    .emtec-card-header-actions
    > .emtec-table-toolbar--top
    .emtec-toolbar-search
    .emtec-input-wrap
    i {
    left: 7px;
    font-size: 0.68rem;
    opacity: 0.55;
  }

  .emtec-filters-bar .emtec-table-toolbar--top .emtec-toolbar-search .emtec-input,
  .emtec-card-header--with-toolbar
    .emtec-card-header-actions
    > .emtec-table-toolbar--top
    .emtec-toolbar-search
    .emtec-input {
    min-height: var(--emtec-toolbar-control-h);
    height: var(--emtec-toolbar-control-h);
    padding: 0 8px 0 24px;
    font-size: 0.75rem;
    border-radius: 7px;
    background: #fff;
  }

  .emtec-filters-bar .emtec-table-toolbar--top .emtec-field--toolbar,
  .emtec-filters-bar .emtec-table-toolbar--top .emtec-field--toolbar .emtec-select-wrap,
  .emtec-card-header--with-toolbar .emtec-card-header-actions > .emtec-table-toolbar--top .emtec-field--toolbar,
  .emtec-card-header--with-toolbar
    .emtec-card-header-actions
    > .emtec-table-toolbar--top
    .emtec-field--toolbar
    .emtec-select-wrap {
    width: 100%;
    min-width: 0;
    max-width: none;
    margin: 0;
  }

  .emtec-filters-bar .emtec-table-toolbar--top .emtec-select-trigger,
  .emtec-card-header--with-toolbar .emtec-card-header-actions > .emtec-table-toolbar--top .emtec-select-trigger {
    width: 100%;
    min-height: var(--emtec-toolbar-control-h);
    height: var(--emtec-toolbar-control-h);
    padding: 0 18px 0 6px;
    font-size: 0.7rem;
    font-weight: 600;
    border-radius: 7px;
    background: #fff;
    gap: 0;
  }

  .emtec-filters-bar .emtec-table-toolbar--top .emtec-select-value-text,
  .emtec-card-header--with-toolbar
    .emtec-card-header-actions
    > .emtec-table-toolbar--top
    .emtec-select-value-text {
    font-size: 0.7rem;
  }

  .emtec-filters-bar .emtec-table-toolbar--top .emtec-select-option-icon,
  .emtec-card-header--with-toolbar
    .emtec-card-header-actions
    > .emtec-table-toolbar--top
    .emtec-select-option-icon {
    display: none;
  }

  .emtec-filters-bar .emtec-table-toolbar--top .emtec-select-chevron,
  .emtec-card-header--with-toolbar .emtec-card-header-actions > .emtec-table-toolbar--top .emtec-select-chevron {
    right: 5px;
    font-size: 0.55rem;
    opacity: 0.45;
  }

  .emtec-filters-bar .emtec-table-toolbar--top .emtec-toolbar-clear.emtec-btn,
  .emtec-card-header--with-toolbar
    .emtec-card-header-actions
    > .emtec-table-toolbar--top
    .emtec-toolbar-clear.emtec-btn {
    width: 26px;
    min-width: 26px;
    min-height: var(--emtec-toolbar-control-h) !important;
    height: var(--emtec-toolbar-control-h);
    padding: 0;
    font-size: 0;
    gap: 0;
    border-radius: 7px;
    background: #fff;
  }

  .emtec-filters-bar .emtec-table-toolbar--top .emtec-toolbar-clear.emtec-btn i,
  .emtec-card-header--with-toolbar
    .emtec-card-header-actions
    > .emtec-table-toolbar--top
    .emtec-toolbar-clear.emtec-btn
    i {
    font-size: 0.72rem;
    margin: 0;
  }
}

@media (max-width: 992px) {
  .emtec-table-toolbar:not(.emtec-table-toolbar--standalone):not(.emtec-table-toolbar--top) {
    grid-template-columns: 1fr;
  }

  .emtec-table-toolbar--standalone .emtec-toolbar-search {
    flex: 1 1 100%;
    min-width: 0;
    max-width: none;
  }

  .emtec-table-toolbar--standalone .emtec-field--toolbar {
    flex: 1 1 calc(50% - var(--space-sm) / 2);
    min-width: 0;
  }
}

@media (max-width: 576px) {
  .emtec-table-toolbar:not(.emtec-table-toolbar--standalone):not(.emtec-table-toolbar--top) {
    padding: var(--space-sm) var(--space-md);
  }

  .emtec-table-toolbar--standalone .emtec-field--toolbar,
  .emtec-table-toolbar--standalone .emtec-field--toolbar .emtec-select-wrap {
    flex: 1 1 100%;
    width: 100%;
    min-width: 0;
  }

  .emtec-table-toolbar--standalone .emtec-toolbar-clear {
    width: 100%;
  }
}

/* Modales más amplios en escritorio */
@media (min-width: 769px) {
  .emtec-modal {
    padding: var(--space-lg);
  }

  .emtec-modal-dialog {
    max-width: min(760px, calc(100vw - 64px));
    max-height: min(90vh, 900px);
  }

  .emtec-modal-dialog--md {
    max-width: min(860px, calc(100vw - 64px));
  }

  .emtec-modal-dialog--sm {
    max-width: min(520px, calc(100vw - 64px));
  }

  .emtec-modal-header {
    padding: var(--space-md) var(--space-xl);
  }

  .emtec-modal-body {
    padding: var(--space-lg) var(--space-xl);
  }

  .emtec-modal-footer {
    padding: 0 var(--space-xl) var(--space-lg);
    gap: var(--space-sm);
  }

  .emtec-form-grid--modal {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-md) var(--space-lg);
  }

  .emtec-barcode-dialog {
    max-width: min(760px, calc(100vw - 64px));
  }

  .emtec-barcode-dialog-head {
    padding: var(--space-lg) var(--space-xl) var(--space-md);
  }

  .emtec-barcode-dialog-body {
    padding: 0 var(--space-xl) var(--space-md);
  }

  .emtec-barcode-dialog-footer {
    padding: var(--space-md) var(--space-xl) var(--space-lg);
  }

  .emtec-obs-seguimiento-dialog {
    max-width: min(1040px, calc(100vw - 48px));
    width: 100%;
  }

  .emtec-obs-seguimiento-body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(320px, 400px);
    grid-template-areas:
      "resumen resumen"
      "historial form";
    align-items: start;
    gap: var(--space-lg);
    max-height: min(72vh, 720px);
    padding: 0 var(--space-xl) var(--space-lg);
  }

  .emtec-obs-seguimiento-resumen {
    grid-area: resumen;
  }

  .emtec-obs-seguimiento-timeline-wrap {
    grid-area: historial;
    min-height: 0;
    max-height: min(48vh, 420px);
    overflow-y: auto;
    padding-right: 4px;
  }

  .emtec-obs-seguimiento-form-wrap {
    grid-area: form;
    padding: var(--space-md);
    background: var(--emtec-surface-2);
    border: 1px solid var(--emtec-border);
    border-radius: var(--emtec-radius);
  }

  .emtec-obs-seguimiento-form textarea.emtec-input {
    min-height: 120px;
  }
}

body.emtec-modal-open {
  overflow: hidden;
}

.emtec-modal-dialog > form {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

@media (max-width: 768px) {
  .emtec-modal {
    padding: 0;
    align-items: stretch;
    justify-content: stretch;
  }

  .emtec-modal--logout,
  .emtec-modal--confirm,
  .emtec-modal--alert,
  .emtec-modal--security,
  .emtec-modal--barcode,
  .emtec-modal--session-loading,
  #modal-obs-seguimiento.emtec-modal--barcode {
    padding: var(--space-md);
    align-items: center;
    justify-content: center;
  }

  .emtec-modal--logout .emtec-modal-backdrop,
  .emtec-modal--confirm .emtec-modal-backdrop,
  .emtec-modal--alert .emtec-modal-backdrop,
  .emtec-modal--security .emtec-modal-backdrop,
  .emtec-modal--barcode .emtec-modal-backdrop,
  .emtec-modal--session-loading .emtec-loading-backdrop,
  #modal-obs-seguimiento.emtec-modal--barcode .emtec-modal-backdrop {
    display: block;
  }

  .emtec-modal--logout .emtec-logout-dialog,
  .emtec-modal--confirm .emtec-logout-dialog,
  .emtec-modal--alert .emtec-alert-dialog,
  .emtec-modal--security .emtec-security-dialog,
  .emtec-modal--barcode .emtec-barcode-dialog,
  #modal-obs-seguimiento .emtec-obs-seguimiento-dialog {
    flex: none;
    width: 100%;
    max-width: min(400px, 100%);
    height: auto;
    min-height: 0;
    border-radius: var(--emtec-radius);
    transform: translateY(10px);
    box-shadow: var(--emtec-shadow-lg);
  }

  .emtec-modal--logout.is-open .emtec-logout-dialog,
  .emtec-modal--confirm.is-open .emtec-logout-dialog,
  .emtec-modal--alert.is-open .emtec-alert-dialog,
  .emtec-modal--security.is-open .emtec-security-dialog,
  .emtec-modal--barcode.is-open .emtec-barcode-dialog,
  #modal-obs-seguimiento.is-open .emtec-obs-seguimiento-dialog {
    transform: translateY(0);
  }

  .emtec-modal--logout .emtec-logout-dialog-footer,
  .emtec-modal--confirm .emtec-logout-dialog-footer,
  .emtec-modal--alert .emtec-dialog-footer,
  .emtec-modal--security .emtec-dialog-footer {
    flex-direction: row;
    border-top: 1px solid var(--emtec-border);
    background: var(--emtec-surface-2);
    padding: var(--space-md);
  }

  .emtec-modal--barcode .emtec-barcode-dialog-footer {
    padding: var(--space-md);
    border-top: 1px solid var(--emtec-border);
    background: var(--emtec-surface-2);
  }

  .emtec-modal:not(.emtec-modal--logout):not(.emtec-modal--confirm):not(.emtec-modal--alert):not(.emtec-modal--security):not(.emtec-modal--barcode):not(.emtec-modal--session-loading):not(#modal-obs-seguimiento)
    .emtec-modal-backdrop {
    display: none;
  }

  .emtec-modal-dialog:not(.emtec-logout-dialog):not(.emtec-alert-dialog):not(.emtec-security-dialog):not(.emtec-barcode-dialog):not(.emtec-obs-seguimiento-dialog):not(.emtec-session-loading-dialog):not(.emtec-loading-dialog) {
    flex: 1;
    max-width: none;
    max-height: none;
    width: 100%;
    height: 100%;
    min-height: 100dvh;
    border: none;
    border-radius: 0;
    box-shadow: none;
    transform: translateY(100%);
  }

  .emtec-modal.is-open .emtec-modal-dialog:not(.emtec-logout-dialog):not(.emtec-alert-dialog):not(.emtec-security-dialog):not(.emtec-barcode-dialog):not(.emtec-obs-seguimiento-dialog):not(.emtec-session-loading-dialog):not(.emtec-loading-dialog) {
    transform: translateY(0);
  }

  .emtec-modal--session-loading .emtec-session-loading-dialog {
    flex: none;
    width: min(92vw, 360px);
    max-width: min(92vw, 360px);
    height: auto;
    min-height: 0;
    margin: auto;
    border: 1px solid var(--emtec-border);
    border-radius: var(--emtec-radius);
    box-shadow: var(--emtec-shadow-lg);
    transform: none;
  }

  .emtec-modal--session-loading.is-open .emtec-session-loading-dialog {
    transform: none;
    animation: emtec-session-loading-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
  }

  .emtec-modal-header {
    flex-shrink: 0;
    padding-top: max(var(--space-md), env(safe-area-inset-top, 0px));
  }

  .emtec-modal-body {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .emtec-modal-footer {
    flex-shrink: 0;
    flex-direction: column-reverse;
    align-items: stretch;
    gap: var(--space-xs);
    margin-top: auto;
    padding: var(--space-md) var(--space-lg);
    padding-bottom: max(var(--space-md), env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--emtec-border);
    background: var(--emtec-surface-2);
  }

  .emtec-modal-footer .emtec-btn {
    width: 100%;
    justify-content: center;
  }

  .emtec-modal--logout .emtec-logout-dialog-footer,
  .emtec-modal--confirm .emtec-logout-dialog-footer {
    grid-template-columns: 1fr;
  }
}

/* Móvil muy pequeño */
@media (max-width: 380px) {
  .emtec-auth-logo {
    width: 130px;
  }

  .emtec-page-sub {
    font-size: 0.8rem;
  }

  .emtec-chip {
    font-size: 0.72rem;
    padding: 4px 9px;
  }
}

/* —— Configuración / backup BD —— */
html.emtec-content-constrained .emtec-page-config .emtec-main > .emtec-content {
  max-width: none;
  margin-inline: 0;
  width: 100%;
}

.emtec-page-config .emtec-content {
  align-items: stretch;
  justify-content: flex-start;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(41, 118, 137, 0.08), transparent 55%),
    radial-gradient(ellipse 60% 40% at 95% 0%, rgba(26, 86, 196, 0.06), transparent 50%),
    linear-gradient(180deg, #e9eef5 0%, #f3f6fa 100%);
  max-width: none;
  margin-inline: 0;
  padding: 0;
}

.emtec-config-studio.emtec-appearance-wrap {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
}

.emtec-config-studio .emtec-appearance-form-scroll {
  display: flex;
  flex-direction: column;
  padding-top: clamp(14px, 2vh, 24px);
  padding-bottom: clamp(20px, 4vh, 36px);
}

.emtec-config-studio .emtec-appearance-panel.is-active {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  width: 100%;
  padding-top: clamp(12px, 2vh, 20px);
}

.emtec-config-studio .emtec-appearance-panel-head {
  width: 100%;
  max-width: 720px;
  margin-inline: auto;
  margin-bottom: 18px;
  padding: 0 0 14px;
  text-align: center;
}

.emtec-config-studio .emtec-appearance-panel-head h3 {
  font-size: 1.1rem;
  margin-bottom: 4px;
}

.emtec-config-studio .emtec-appearance-panel-head p {
  display: block;
  max-width: 34rem;
  margin-inline: auto;
  font-size: 0.84rem;
  line-height: 1.45;
  text-align: center;
}

.emtec-config-studio .emtec-config-status--inline {
  display: inline-flex;
  margin-left: 6px;
  vertical-align: middle;
}

.emtec-config-studio .emtec-config-head-meta {
  margin: 8px 0 0;
  text-align: center;
}

.emtec-config-studio .emtec-config-head-meta--detail {
  font-size: 0.92rem;
  color: var(--emtec-muted, #64748b);
}

.emtec-config-studio .emtec-config-db-warning {
  margin: 10px auto 0;
  max-width: 640px;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  line-height: 1.45;
  text-align: center;
  color: #9a3412;
  background: #fff7ed;
  border: 1px solid #fdba74;
}

.emtec-config-studio .emtec-config-db-warning--info {
  color: #854d0e;
  background: #fefce8;
  border-color: #fde047;
}

.emtec-config-studio .emtec-config-db-live {
  margin: 12px auto 0;
  max-width: 640px;
  padding: 12px 14px;
  border-radius: 10px;
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  text-align: left;
}

.emtec-config-studio .emtec-config-db-live-list {
  margin: 8px 0 0;
  padding-left: 18px;
  font-size: 0.86rem;
  line-height: 1.5;
}

.emtec-config-studio .emtec-config-db-live-list code {
  font-size: 0.82rem;
}

.emtec-config-studio .emtec-config-db-live-hint {
  margin: 10px 0 0;
  font-size: 0.8rem;
  line-height: 1.45;
  color: #0369a1;
}

.emtec-config-studio .emtec-config-db-diag {
  margin: 10px auto 0;
  max-width: 640px;
  font-size: 0.82rem;
  color: var(--emtec-muted, #64748b);
}

.emtec-config-studio .emtec-config-db-diag summary {
  cursor: pointer;
  font-weight: 600;
}

.emtec-config-studio .emtec-config-db-diag-list {
  margin: 8px 0 0;
  padding-left: 18px;
  line-height: 1.5;
}

.emtec-config-studio .emtec-appearance-panel > .emtec-card,
.emtec-config-studio .emtec-appearance-panel > .emtec-config-actions,
.emtec-config-studio .emtec-appearance-panel > .emtec-config-action {
  width: 100%;
  max-width: 1040px;
  margin-inline: auto;
}

.emtec-config-studio .emtec-appearance-panel > .emtec-config-connection-card {
  max-width: 820px;
}

.emtec-config-studio .emtec-appearance-panel > .emtec-config-action--solo {
  max-width: 680px;
}

.emtec-config-studio .emtec-config-connection-inner {
  max-width: none;
  margin: 0 auto;
  width: 100%;
}

.emtec-config-studio .emtec-config-connection-card {
  padding: clamp(18px, 2.5vw, 24px);
  border: 1px solid var(--emtec-border);
  border-radius: 16px;
  background: #fff;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 10px 28px rgba(15, 23, 42, 0.05);
  position: relative;
  overflow: hidden;
}

.emtec-config-studio .emtec-config-connection-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--emtec-primary) 0%, var(--emtec-accent) 100%);
}

.emtec-config-studio .emtec-config-connection-inner .emtec-db-config-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md) var(--space-lg);
  width: 100%;
}

.emtec-config-studio .emtec-config-connection-inner .emtec-db-config-form .emtec-field {
  margin-bottom: 0;
}

.emtec-config-studio .emtec-config-connection-inner .emtec-field--password {
  grid-column: 1 / -1;
}

.emtec-config-studio .emtec-config-connection-inner .emtec-db-config-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  margin-top: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid var(--emtec-border);
}

.emtec-config-studio .emtec-config-connection-inner .emtec-db-config-actions .emtec-btn {
  width: auto;
  min-width: min(100%, 280px);
  padding-left: 28px;
  padding-right: 28px;
}

.emtec-config-studio .emtec-appearance-panel-head::before {
  left: 50%;
  top: auto;
  bottom: 0;
  transform: translateX(-50%);
  width: 48px;
  height: 3px;
}

.emtec-config-studio .emtec-config-actions--duo {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  align-items: stretch;
}

.emtec-config-studio .emtec-config-action {
  height: auto;
  min-height: 0;
  padding: 18px 20px 20px;
  border-radius: 16px;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.04),
    0 10px 28px rgba(15, 23, 42, 0.05);
  align-items: center;
  text-align: center;
}

.emtec-config-studio .emtec-config-actions--duo > .emtec-config-action {
  height: 100%;
  min-height: 100%;
}

.emtec-config-studio .emtec-config-action--solo {
  height: auto;
  min-height: 0;
  flex: 0 0 auto;
}

.emtec-config-studio .emtec-config-action--solo .emtec-config-action-foot {
  margin-top: 12px;
}

.emtec-config-studio .emtec-config-badge {
  align-self: center;
  margin-bottom: 8px;
}

.emtec-config-studio .emtec-config-action-icon {
  width: 46px;
  height: 46px;
  margin-bottom: 6px;
  font-size: 1.1rem;
  border-radius: 14px;
}

.emtec-config-studio .emtec-config-action-title {
  font-size: 0.98rem;
  margin-bottom: 6px;
}

.emtec-config-studio .emtec-config-action-desc {
  font-size: 0.82rem;
  line-height: 1.45;
  margin-bottom: 10px;
  max-width: 26rem;
  margin-inline: auto;
}

.emtec-config-studio .emtec-config-checklist {
  margin-bottom: 12px;
  gap: 5px;
  font-size: 0.8rem;
}

.emtec-config-studio .emtec-config-checklist li {
  gap: 8px;
}

.emtec-config-studio .emtec-config-alert {
  margin-bottom: 12px;
  padding: 10px 12px;
  font-size: 0.82rem;
}

.emtec-config-studio .emtec-config-alert p {
  font-size: inherit;
  line-height: 1.4;
}

.emtec-config-studio .emtec-config-import-form {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  margin-top: 0;
  width: 100%;
}

.emtec-config-studio .emtec-config-field {
  margin-bottom: 0;
}

.emtec-config-studio .emtec-config-filezone {
  padding: 14px 12px;
}

.emtec-config-studio .emtec-config-checklist,
.emtec-config-studio .emtec-config-alert,
.emtec-config-studio .emtec-config-import-form,
.emtec-config-studio .emtec-config-field {
  width: 100%;
  text-align: left;
}

.emtec-config-studio .emtec-config-action-foot {
  width: 100%;
  max-width: none;
  margin-top: auto;
  padding-top: 8px;
  margin-inline: auto;
}

.emtec-config-studio .emtec-config-cta {
  padding-top: 10px;
  padding-bottom: 10px;
  font-size: 0.88rem;
}

.emtec-config-status--inline {
  display: inline-flex;
  margin-left: 8px;
  vertical-align: middle;
}

.emtec-config-actions--duo {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.emtec-config-action--solo {
  max-width: 560px;
}

.emtec-config-page {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--space-xl);
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.emtec-config-hero {
  padding: var(--space-lg);
  background: linear-gradient(145deg, #ffffff 0%, #f8fafc 55%, #f1f5f9 100%);
  border: 1px solid var(--emtec-border);
}

.emtec-config-hero-head {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  margin-bottom: var(--space-lg);
  flex-wrap: wrap;
  padding-bottom: var(--space-md);
  border-bottom: 1px solid var(--emtec-border);
}

.emtec-config-connection {
  text-align: left;
}

.emtec-config-connection .emtec-config-hero-head {
  justify-content: center;
  text-align: center;
}

.emtec-config-connection .emtec-config-hero-head > div {
  flex: 1 1 200px;
  min-width: 0;
}

.emtec-config-connection .emtec-config-status {
  margin-left: 0;
  flex-shrink: 0;
}

.emtec-config-connection-inner {
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.emtec-config-connection .emtec-db-config-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-md) var(--space-lg);
  width: 100%;
}

.emtec-config-connection .emtec-db-config-form .emtec-field {
  margin-bottom: 0;
}

.emtec-config-connection .emtec-field--password {
  grid-column: 1 / -1;
}

.emtec-config-connection .emtec-field--password .emtec-field-hint {
  text-align: left;
}

.emtec-config-connection .emtec-db-config-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  margin-top: var(--space-sm);
  padding-top: var(--space-md);
  border-top: 1px solid var(--emtec-border);
}

.emtec-config-connection .emtec-db-config-actions .emtec-btn {
  width: auto;
  min-width: min(100%, 280px);
  padding-left: 28px;
  padding-right: 28px;
}

.emtec-config-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.emtec-config-status--ok {
  color: #166534;
  background: var(--emtec-success-bg);
  border: 1px solid #86efac;
}

.emtec-config-status--err {
  color: #991b1b;
  background: var(--emtec-danger-bg, #fef2f2);
  border: 1px solid #fecaca;
}

.emtec-config-hero-sub code {
  font-size: 0.85em;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(15, 23, 42, 0.06);
}

.emtec-config-hero-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--emtec-primary) 0%, var(--emtec-primary-light) 100%);
  color: #fff;
  font-size: 1.25rem;
  box-shadow: 0 8px 20px rgba(26, 86, 196, 0.28);
}

.emtec-config-hero-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--emtec-text);
}

.emtec-config-hero-sub {
  margin: 4px 0 0;
  font-size: 0.9rem;
  color: var(--emtec-muted);
}

.emtec-config-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-md);
  margin-bottom: var(--space-md);
}

.emtec-config-stat {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-md);
  background: var(--emtec-surface);
  border: 1px solid var(--emtec-border);
  border-radius: var(--emtec-radius-sm);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04);
}

.emtec-config-stat-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  font-size: 0.95rem;
}

.emtec-config-stat-icon--host {
  color: var(--emtec-primary-dark);
  background: var(--emtec-info-bg);
}

.emtec-config-stat-icon--db {
  color: #0d9488;
  background: #ccfbf1;
}

.emtec-config-stat-icon--user {
  color: #7c3aed;
  background: #ede9fe;
}

.emtec-config-stat-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--emtec-muted);
}

.emtec-config-stat-value {
  display: block;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--emtec-text);
  word-break: break-word;
}

.emtec-config-tip {
  display: flex;
  align-items: flex-start;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--emtec-radius-sm);
  background: var(--emtec-info-bg);
  border: 1px solid #bfdbfe;
}

.emtec-config-tip > i {
  margin-top: 2px;
  color: var(--emtec-primary);
  font-size: 1rem;
}

.emtec-config-tip p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.55;
  color: #1e3a5f;
}

.emtec-config-path {
  font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
  font-size: 0.82em;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.65);
}

.emtec-config-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-lg);
  align-items: stretch;
  width: 100%;
}

.emtec-config-action--reset::before {
  background: linear-gradient(90deg, #7f1d1d 0%, var(--emtec-danger) 100%);
}

.emtec-config-badge--critical {
  color: #7f1d1d;
  background: #fee2e2;
}

.emtec-config-action-icon--reset {
  color: #991b1b;
  background: linear-gradient(135deg, #fef2f2 0%, #fee2e2 100%);
}

.emtec-config-checklist--danger li i {
  color: var(--emtec-danger);
}

.emtec-config-reset-dialog {
  width: min(92vw, 440px);
}

.emtec-config-reset-lead {
  margin: 0 0 var(--space-md);
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--emtec-muted);
}

.emtec-config-code-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: var(--space-md) 0;
  padding: var(--space-md);
  border-radius: var(--emtec-radius-sm);
  background: var(--emtec-surface-2);
  border: 2px dashed var(--emtec-border);
}

.emtec-config-code-box.is-active {
  border-color: var(--emtec-danger);
  background: #fff5f5;
}

.emtec-config-code-label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--emtec-muted);
}

.emtec-config-code-value {
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  color: var(--emtec-danger);
  font-family: ui-monospace, Consolas, monospace;
}

.emtec-config-code-expires {
  font-size: 0.78rem;
  color: var(--emtec-muted);
}

.emtec-config-code-progress {
  width: 100%;
  height: 4px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--emtec-border);
  overflow: hidden;
}

.emtec-config-code-progress-bar {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--emtec-danger) 0%, #f59e0b 100%);
  transition: width 0.25s linear;
}

.emtec-config-code-value.is-refresh {
  animation: emtec-code-flash 0.4s ease;
}

@keyframes emtec-code-flash {
  0% {
    opacity: 0.35;
    transform: scale(0.96);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}

.emtec-alert-message {
  width: 100%;
  max-width: none;
  max-height: min(50vh, 320px);
  overflow-y: auto;
  word-break: break-word;
}

.emtec-alert-message--mono {
  padding: var(--space-sm);
  border-radius: var(--emtec-radius-sm);
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #7f1d1d;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  font-size: 0.82rem;
  line-height: 1.45;
  text-align: left;
  white-space: pre-wrap;
}


.emtec-config-code-hint {
  margin: 0 0 var(--space-sm);
  font-size: 0.85rem;
  color: var(--emtec-muted);
}

.emtec-config-reset-form {
  margin-top: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.emtec-security-code-entry {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 2px 0 4px;
}

.emtec-security-code-entry-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--emtec-muted);
}

.emtec-otp {
  display: flex;
  justify-content: center;
  gap: clamp(6px, 2vw, 10px);
  width: 100%;
}

.emtec-otp-cell {
  width: clamp(42px, 11vw, 48px);
  height: 52px;
  padding: 0;
  border: 2px solid var(--emtec-border);
  border-radius: 12px;
  background: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  font-family: ui-monospace, Consolas, "Courier New", monospace;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  color: var(--emtec-text);
  caret-color: var(--emtec-primary);
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background 0.15s ease;
}

.emtec-otp-cell:hover:not(:disabled) {
  border-color: #cbd5e1;
}

.emtec-otp-cell:focus {
  outline: none;
  border-color: var(--emtec-primary);
  box-shadow: 0 0 0 3px rgba(26, 86, 196, 0.14);
  background: #fff;
}

.emtec-otp-cell.is-filled:not(:focus) {
  border-color: #cbd5e1;
  background: #f8fafc;
}

.emtec-otp-cell.is-match:not(:focus) {
  border-color: #86efac;
  background: #f0fdf4;
}

.emtec-otp.is-error .emtec-otp-cell {
  border-color: #f87171;
  background: #fff5f5;
}

.emtec-otp.is-error {
  animation: emtec-otp-shake 0.4s ease;
}

@keyframes emtec-otp-shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20%,
  60% {
    transform: translateX(-4px);
  }
  40%,
  80% {
    transform: translateX(4px);
  }
}

.emtec-config-reset-actions {
  display: flex;
  gap: var(--space-sm);
  justify-content: flex-end;
  margin-top: var(--space-xs);
}

.emtec-config-reset-actions .emtec-btn {
  flex: 1;
  justify-content: center;
}

.emtec-loading-visual[data-variant="reset"] .emtec-loading-ring {
  border-top-color: var(--emtec-danger);
}

.emtec-loading-visual[data-variant="reset"] .emtec-loading-icon {
  color: #991b1b;
  background: #fee2e2;
}

.emtec-loading-visual[data-variant="reset"] ~ .emtec-loading-progress .emtec-loading-progress-bar {
  background: linear-gradient(90deg, #7f1d1d 0%, var(--emtec-danger) 100%);
}

.emtec-loading-visual[data-variant="login"] .emtec-loading-ring {
  border-top-color: var(--emtec-primary);
}

.emtec-loading-visual[data-variant="login"] .emtec-loading-icon {
  color: var(--emtec-primary-dark);
  background: var(--emtec-info-bg);
}

.emtec-loading-visual[data-variant="login"] ~ .emtec-loading-progress .emtec-loading-progress-bar {
  background: linear-gradient(90deg, var(--emtec-primary-dark) 0%, var(--emtec-accent) 100%);
}

.emtec-loading-visual[data-variant="logout"] .emtec-loading-ring {
  border-top-color: #0f766e;
}

.emtec-loading-visual[data-variant="logout"] .emtec-loading-icon {
  color: #0f766e;
  background: #ccfbf1;
}

.emtec-loading-visual[data-variant="logout"] ~ .emtec-loading-progress .emtec-loading-progress-bar {
  background: linear-gradient(90deg, #0f766e 0%, var(--emtec-primary) 100%);
}

.emtec-modal--session-loading {
  z-index: 11100;
}

.emtec-modal--session-loading.is-open {
  opacity: 1;
  visibility: visible;
}

.emtec-modal--session-loading .emtec-loading-backdrop {
  background: var(--emtec-bg, #eef2f8);
  backdrop-filter: none;
  cursor: wait;
}

.emtec-modal--session-loading.is-open .emtec-session-loading-dialog {
  animation: emtec-session-loading-in 0.32s cubic-bezier(0.22, 1, 0.36, 1) both;
}

body.emtec-session-loading-open {
  overflow: hidden;
}

/* App / logout: ocultar interfaz; solo modal sobre fondo sólido */
body.emtec-session-loading-open--app > .emtec-sidebar,
body.emtec-session-loading-open--app > .emtec-overlay,
body.emtec-session-loading-open--app > .emtec-main {
  visibility: hidden !important;
  pointer-events: none !important;
}

body.emtec-session-loading-open--app .emtec-modal--session-loading .emtec-loading-backdrop {
  background: var(--emtec-bg, #eef2f8);
}

/* Login / salir: ocultar tarjeta; mantener fondo degradado */
body.emtec-session-loading-open--auth .emtec-auth-card {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}

body.emtec-session-loading-open--auth .emtec-modal--session-loading .emtec-loading-backdrop {
  background: transparent;
  backdrop-filter: none;
}

body.emtec-session-loading-open--auth.emtec-auth {
  align-items: center;
  justify-content: center;
}

@keyframes emtec-session-loading-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1100px) {
  .emtec-config-actions,
  .emtec-config-actions--duo {
    grid-template-columns: 1fr;
  }
}

.emtec-config-action {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: var(--space-lg);
  min-height: 100%;
  overflow: hidden;
}

.emtec-config-action::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
}

.emtec-config-action--export::before {
  background: linear-gradient(90deg, var(--emtec-primary) 0%, var(--emtec-accent) 100%);
}

.emtec-config-action--import::before {
  background: linear-gradient(90deg, #f59e0b 0%, var(--emtec-danger) 100%);
}

.emtec-config-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  align-self: flex-start;
  margin-bottom: var(--space-md);
  padding: 4px 11px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: 999px;
}

.emtec-config-badge--safe {
  color: #166534;
  background: var(--emtec-success-bg);
}

.emtec-config-badge--warn {
  color: #9a3412;
  background: var(--emtec-warning-bg);
}

.emtec-config-action-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: var(--space-sm);
  border-radius: 16px;
  font-size: 1.35rem;
}

.emtec-config-action-icon--export {
  color: var(--emtec-primary-dark);
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
}

.emtec-config-action-icon--import {
  color: #b45309;
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
}

.emtec-config-action-title {
  margin: 0 0 8px;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--emtec-text);
}

.emtec-config-action-desc {
  margin: 0 0 var(--space-md);
  font-size: 0.9rem;
  line-height: 1.55;
  color: var(--emtec-muted);
}

.emtec-config-checklist {
  list-style: none;
  margin: 0 0 var(--space-lg);
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.emtec-config-checklist li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.86rem;
  color: var(--emtec-text);
}

.emtec-config-checklist i {
  color: var(--emtec-success);
  font-size: 0.75rem;
}

.emtec-config-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--emtec-radius-sm);
  background: var(--emtec-warning-bg);
  border: 1px solid #fcd34d;
}

.emtec-config-alert > i {
  margin-top: 2px;
  color: var(--emtec-warning);
}

.emtec-config-alert p {
  margin: 0;
  font-size: 0.86rem;
  line-height: 1.5;
  color: #78350f;
}

.emtec-config-import-form {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: var(--space-md);
}

.emtec-config-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.emtec-config-field-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--emtec-muted);
}

.emtec-config-field-hint kbd {
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--emtec-surface-2);
  border: 1px solid var(--emtec-border);
  font-family: inherit;
  font-size: 0.9em;
  font-weight: 600;
}

.emtec-config-file-input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.emtec-config-filezone {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-md);
  border: 2px dashed var(--emtec-border);
  border-radius: var(--emtec-radius-sm);
  background: var(--emtec-surface-2);
  cursor: pointer;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    box-shadow 0.15s ease;
}

.emtec-config-filezone:hover,
.emtec-config-filezone:focus-within {
  border-color: var(--emtec-primary-light);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 125, 221, 0.12);
}

.emtec-config-filezone.is-selected {
  border-style: solid;
  border-color: var(--emtec-primary);
  background: #fff;
}

.emtec-config-filezone-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--emtec-surface);
  color: var(--emtec-primary);
  font-size: 1.1rem;
  border: 1px solid var(--emtec-border);
}

.emtec-config-filezone-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.emtec-config-filezone-text strong {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--emtec-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.emtec-config-filezone-text small {
  font-size: 0.78rem;
  color: var(--emtec-muted);
}

.emtec-config-filezone-btn {
  flex-shrink: 0;
  padding: 7px 14px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--emtec-primary-dark);
  background: var(--emtec-info-bg);
  border-radius: 8px;
}

.emtec-config-confirm-input {
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.emtec-config-action-foot {
  margin-top: auto;
  padding-top: var(--space-sm);
}

.emtec-config-cta {
  width: 100%;
  justify-content: center;
  padding-top: 12px;
  padding-bottom: 12px;
  font-size: 0.95rem;
}

@media (max-width: 900px) {
  .emtec-config-connection .emtec-db-config-form {
    grid-template-columns: 1fr;
  }

  .emtec-config-connection .emtec-config-hero-head {
    flex-direction: column;
    text-align: center;
  }

  .emtec-config-studio .emtec-config-connection-inner .emtec-db-config-form {
    grid-template-columns: 1fr;
  }

  .emtec-config-page {
    padding-left: var(--space-md);
    padding-right: var(--space-md);
  }

  .emtec-config-stats {
    grid-template-columns: 1fr;
  }
}

/* Modal loading (exportar / importar BD) */
.emtec-modal--loading {
  z-index: 11090;
}

.emtec-modal--loading .emtec-loading-backdrop {
  background: rgba(15, 23, 42, 0.5);
  backdrop-filter: blur(4px);
  cursor: wait;
}

.emtec-loading-dialog {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: min(92vw, 380px);
  padding: var(--space-xl) var(--space-lg);
  border-radius: var(--emtec-radius);
  border: 1px solid var(--emtec-border);
  box-shadow: var(--emtec-shadow-lg);
  overflow: hidden;
}

.emtec-loading-visual {
  position: relative;
  width: 92px;
  height: 92px;
  margin: 0 auto var(--space-md);
}

.emtec-loading-visual[data-variant="import"] .emtec-loading-ring {
  border-top-color: var(--emtec-warning);
}

.emtec-loading-visual[data-variant="import"] .emtec-loading-icon {
  color: #b45309;
  background: var(--emtec-warning-bg);
}

.emtec-loading-ring {
  position: absolute;
  inset: 0;
  border: 3px solid var(--emtec-border);
  border-top-color: var(--emtec-primary);
  border-radius: 50%;
  animation: emtec-loading-spin 0.85s linear infinite;
}

.emtec-loading-icon {
  position: absolute;
  inset: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--emtec-info-bg);
  color: var(--emtec-primary);
  font-size: 1.65rem;
  animation: emtec-loading-pulse 1.5s ease-in-out infinite;
}

.emtec-loading-title {
  margin: 0 0 8px;
  font-size: 1.12rem;
  font-weight: 700;
  color: var(--emtec-text);
}

.emtec-loading-text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--emtec-muted);
  min-height: 2.8em;
  transition: opacity 0.2s ease;
}

.emtec-loading-text.is-fading {
  opacity: 0.35;
}

.emtec-loading-progress {
  width: 100%;
  height: 5px;
  margin-top: var(--space-md);
  border-radius: 999px;
  background: var(--emtec-border);
  overflow: hidden;
}

.emtec-loading-progress-bar {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--emtec-primary) 0%, var(--emtec-accent) 100%);
  animation: emtec-loading-slide 1.15s ease-in-out infinite;
}

.emtec-loading-visual[data-variant="import"] ~ .emtec-loading-progress .emtec-loading-progress-bar {
  background: linear-gradient(90deg, #f59e0b 0%, var(--emtec-danger) 100%);
}

@keyframes emtec-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes emtec-loading-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.06);
    opacity: 0.88;
  }
}

@keyframes emtec-loading-slide {
  0% {
    transform: translateX(-120%);
  }
  100% {
    transform: translateX(320%);
  }
}

@media (max-width: 768px) {
  .emtec-config-hero {
    padding: var(--space-md);
  }

  .emtec-config-action {
    padding: var(--space-md);
  }

  .emtec-config-filezone {
    flex-wrap: wrap;
  }

  .emtec-config-filezone-btn {
    width: 100%;
    text-align: center;
  }
}

/* —— Apariencia / branding —— */
html.emtec-content-constrained .emtec-page-appearance .emtec-main > .emtec-content {
  max-width: none;
  margin-inline: 0;
  width: 100%;
}

.emtec-page-appearance .emtec-content {
  align-items: stretch;
  background:
    radial-gradient(ellipse 80% 50% at 10% -10%, rgba(41, 118, 137, 0.08), transparent 55%),
    radial-gradient(ellipse 60% 40% at 95% 0%, rgba(26, 86, 196, 0.06), transparent 50%),
    linear-gradient(180deg, #e9eef5 0%, #f3f6fa 100%);
  max-width: none;
  margin-inline: 0;
  padding: 0;
}

.emtec-appearance-wrap {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

.emtec-appearance-layout {
  display: block;
  width: 100%;
}

.emtec-appearance-preview-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.emtec-appearance-preview-live {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #047857;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
}

.emtec-appearance-preview-live > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.25);
  animation: emtec-appearance-live-pulse 1.8s ease-in-out infinite;
}

@keyframes emtec-appearance-live-pulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.55;
    transform: scale(0.85);
  }
}

.emtec-appearance-studio-panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  background: #fff;
  border-radius: 0;
  border: none;
  box-shadow: none;
  overflow: hidden;
}

.emtec-appearance-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr);
  gap: 0;
  align-items: stretch;
  flex: 1;
  min-height: 0;
  min-width: 0;
}

@media (min-width: 1400px) {
  .emtec-appearance-workspace {
    grid-template-columns: minmax(280px, 320px) minmax(0, 1fr);
  }
}

.emtec-appearance-rail {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
  height: 100%;
  padding: 18px 14px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
  border-right: 1px solid var(--emtec-border);
  overflow: hidden;
}

.emtec-appearance-rail-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 0 0 auto;
  min-height: 0;
}

.emtec-appearance-rail-preview {
  display: flex;
  flex-direction: column;
  flex: 1 1 0;
  min-height: 0;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--emtec-border);
}

.emtec-appearance-rail-label {
  margin: 0 0 10px 4px;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--emtec-muted);
}

.emtec-appearance-rail-item {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 11px 12px;
  text-align: left;
  font: inherit;
  color: var(--emtec-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.12s ease;
}

.emtec-appearance-rail-item:hover {
  background: rgba(255, 255, 255, 0.72);
  border-color: #e2e8f0;
  color: var(--emtec-text);
}

.emtec-appearance-rail-item.is-active {
  background: #fff;
  border-color: color-mix(in srgb, var(--emtec-primary) 35%, #e2e8f0);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.07);
  transform: translateX(2px);
}

.emtec-appearance-rail-step {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
}

.emtec-appearance-rail-item.is-active .emtec-appearance-rail-step {
  color: var(--emtec-primary);
}

.emtec-appearance-rail-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 10px;
  background: #fff;
  color: var(--emtec-primary);
  border: 1px solid #e8edf3;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.emtec-appearance-rail-item.is-active .emtec-appearance-rail-icon {
  background: var(--emtec-primary);
  color: #fff;
  border-color: transparent;
}

.emtec-appearance-rail-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.emtec-appearance-rail-text strong {
  font-size: 0.85rem;
  color: var(--emtec-text);
}

.emtec-appearance-rail-text small {
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--emtec-muted);
}

.emtec-appearance-form-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 22px clamp(18px, 2.5vw, 28px) 12px;
  scrollbar-gutter: stable;
}

.emtec-appearance-editor {
  display: flex;
  flex-direction: column;
  min-height: 100%;
  min-width: 0;
}

.emtec-appearance-cards-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

.emtec-appearance-cards-grid--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.emtec-appearance-panel-head {
  margin: 0 0 20px;
  padding: 0 0 16px 16px;
  border-bottom: 1px solid var(--emtec-border);
  position: relative;
}

.emtec-appearance-panel-head::before {
  content: "";
  position: absolute;
  left: 0;
  top: 2px;
  bottom: 18px;
  width: 4px;
  border-radius: 4px;
  background: linear-gradient(180deg, var(--emtec-primary) 0%, var(--emtec-primary-dark, var(--emtec-primary)) 100%);
}

.emtec-appearance-panel-head h3 {
  margin: 0 0 6px;
  font-size: 1.28rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--emtec-text);
}

.emtec-appearance-panel-head p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--emtec-muted);
}

.emtec-appearance-card {
  background: #fff;
  border: 1px solid #e8edf3;
  border-radius: 14px;
  margin-bottom: 0;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.emtec-appearance-card:hover {
  border-color: #dbe3ee;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.06);
}

.emtec-appearance-form-scroll > .emtec-appearance-panel > .emtec-appearance-card:last-child,
.emtec-appearance-form-scroll > .emtec-appearance-panel > .emtec-appearance-cards-grid + .emtec-appearance-card:last-of-type {
  margin-bottom: 0;
}

.emtec-appearance-form-scroll > .emtec-appearance-panel .emtec-appearance-card:not(.emtec-appearance-cards-grid .emtec-appearance-card) {
  margin-bottom: 14px;
}

.emtec-appearance-card-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 12px 16px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--emtec-text);
  background: linear-gradient(180deg, #fafbfc 0%, #f4f7fb 100%);
  border-bottom: 1px solid #e8edf3;
}

.emtec-appearance-card-title i {
  color: var(--emtec-primary);
  width: 1.1rem;
  text-align: center;
}

.emtec-appearance-card-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.emtec-appearance-card-lead {
  margin: 0 0 4px;
}

.emtec-appearance-title-preview {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px dashed var(--emtec-border);
  border-radius: 8px;
}

.emtec-appearance-title-preview-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--emtec-muted);
}

.emtec-appearance-title-preview code {
  font-size: 0.82rem;
  color: var(--emtec-text);
  word-break: break-word;
}

.emtec-appearance-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.emtec-appearance-swatch {
  width: 36px;
  height: 36px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 10px;
  background: var(--swatch);
  cursor: pointer;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  transition: transform 0.12s, box-shadow 0.12s;
}

.emtec-appearance-swatch:hover {
  transform: scale(1.06);
}

.emtec-appearance-swatch.is-active {
  border-color: var(--emtec-text);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--emtec-primary);
}

.emtec-appearance-color--pro {
  margin-top: 4px;
}

.emtec-appearance-mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.emtec-appearance-mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 10px;
  text-align: center;
  border: 2px solid var(--emtec-border);
  border-radius: 10px;
  background: #f8fafc;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}

.emtec-appearance-mode-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.emtec-appearance-mode-card i {
  font-size: 1.25rem;
  color: var(--emtec-primary);
}

.emtec-appearance-mode-icon-duo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 1.25rem;
  color: var(--emtec-primary);
}

.emtec-appearance-mode-icon-duo i {
  font-size: inherit;
}

.emtec-appearance-mode-card strong {
  font-size: 0.8rem;
  color: var(--emtec-text);
}

.emtec-appearance-mode-card span {
  font-size: 0.68rem;
  line-height: 1.35;
  color: var(--emtec-muted);
}

.emtec-appearance-mode-card:hover {
  border-color: var(--emtec-primary);
  background: #fff;
}

.emtec-appearance-mode-card.is-selected {
  border-color: var(--emtec-primary);
  background: color-mix(in srgb, var(--emtec-primary) 8%, #fff);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--emtec-primary) 20%, transparent),
    0 8px 20px rgba(15, 23, 42, 0.08);
}

.emtec-brand-upload {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  gap: 12px 16px;
  padding: 16px;
  background: linear-gradient(180deg, #fafbfc 0%, #f4f7fb 100%);
  border: 1px dashed #c5d0de;
  border-radius: 12px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.emtec-brand-upload:hover {
  border-color: color-mix(in srgb, var(--emtec-primary) 40%, #c5d0de);
  background: #fff;
}

.emtec-brand-upload-preview {
  position: relative;
  grid-row: span 2;
  width: 88px;
  height: 88px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--emtec-border);
  border-radius: 10px;
  overflow: hidden;
}

.emtec-brand-upload-preview img {
  max-width: 80px;
  max-height: 80px;
  object-fit: contain;
}

.emtec-brand-upload-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 6px;
  font-size: 0.62rem;
  text-align: center;
  color: var(--emtec-muted);
  background: #f8fafc;
}

.emtec-brand-upload-placeholder i {
  font-size: 1.1rem;
  color: var(--emtec-primary);
}

.emtec-brand-upload.has-file .emtec-brand-upload-placeholder {
  display: none;
}

.emtec-brand-upload:not(.has-file) .emtec-brand-upload-preview img {
  opacity: 0.35;
}

.emtec-brand-upload-meta {
  align-self: center;
}

.emtec-brand-upload-name {
  margin: 0 0 4px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--emtec-text);
}

.emtec-brand-upload-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-self: end;
}

.emtec-appearance-toggle--block {
  padding: 12px;
  background: #f8fafc;
  border: 1px solid var(--emtec-border);
  border-radius: 10px;
}

.emtec-appearance-toggle--block + .emtec-appearance-login-logo-zone,
.emtec-appearance-toggle--block + .emtec-brand-upload {
  margin-top: 10px;
}

.emtec-appearance-toggle-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}

.emtec-appearance-toggle-label strong {
  font-weight: 600;
  color: var(--emtec-text);
}

.emtec-appearance-toggle-label small {
  font-size: 0.78rem;
  color: var(--emtec-muted);
  font-weight: 400;
}

.emtec-appearance-check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
}

.emtec-appearance-check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--emtec-primary);
}

.emtec-appearance-login-logo-zone {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.emtec-char-counter {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  text-align: right;
  color: var(--emtec-muted);
}

.emtec-char-counter.is-limit {
  color: var(--emtec-danger);
  font-weight: 600;
}

.emtec-appearance-actions--sticky {
  flex-shrink: 0;
  margin-top: auto;
  padding: 16px clamp(18px, 2.5vw, 28px);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  border-top: 1px solid var(--emtec-border);
  box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.05);
}

.emtec-appearance-actions-main {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.emtec-appearance-actions-main .emtec-btn-primary {
  min-width: 200px;
  box-shadow: 0 4px 14px var(--emtec-btn-shadow, rgba(26, 86, 196, 0.3));
}

.emtec-appearance-actions-hint {
  margin: 8px 0 0;
  font-size: 0.78rem;
  color: var(--emtec-muted);
}

.emtec-appearance-actions-hint i {
  color: var(--emtec-primary);
  margin-right: 4px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Vista previa flotante (estilo PiP / cookies) */
.emtec-appearance-pip--dock,
.emtec-appearance-rail-preview .emtec-appearance-pip {
  position: static;
  z-index: auto;
  width: 100%;
  max-height: none;
  flex: 1 1 0;
  min-height: 0;
  touch-action: auto;
  border-radius: 14px;
  box-shadow:
    0 0 0 1px rgba(15, 23, 42, 0.06),
    0 8px 24px rgba(15, 23, 42, 0.08);
}

.emtec-appearance-pip--dock .emtec-appearance-pip-chrome,
.emtec-appearance-rail-preview .emtec-appearance-pip-chrome {
  cursor: default;
  padding: 10px 12px;
}

.emtec-appearance-pip--dock .emtec-appearance-pip-body,
.emtec-appearance-rail-preview .emtec-appearance-pip .emtec-appearance-pip-body {
  display: flex;
  flex-direction: column;
}

.emtec-appearance-pip--dock.is-collapsed .emtec-appearance-pip-body,
.emtec-appearance-rail-preview .emtec-appearance-pip.is-collapsed .emtec-appearance-pip-body {
  display: flex;
}

.emtec-appearance-pip--dock .emtec-appearance-pip-body,
.emtec-appearance-rail-preview .emtec-appearance-pip-body {
  flex: 1 1 0;
  min-height: 0;
}

.emtec-appearance-rail-preview .emtec-appearance-preview-root {
  min-height: 180px;
}

.emtec-appearance-pip {
  position: fixed;
  z-index: 450;
  bottom: 20px;
  left: calc(var(--emtec-sidebar-w-current, 260px) + 20px);
  width: min(300px, calc(100vw - var(--emtec-sidebar-w-current, 260px) - 40px));
  max-height: min(420px, calc(100vh - 100px));
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.12);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.5) inset,
    0 24px 60px -12px rgba(15, 23, 42, 0.35),
    0 8px 24px rgba(15, 23, 42, 0.12);
  transition:
    opacity 0.22s ease,
    transform 0.22s ease,
    box-shadow 0.22s ease;
  touch-action: none;
}

.emtec-appearance-pip.is-dragging {
  transition: none;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.5) inset,
    0 32px 72px -8px rgba(15, 23, 42, 0.45);
}

.emtec-appearance-pip.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(12px) scale(0.96);
}

.emtec-appearance-pip.is-collapsed {
  width: auto;
  min-width: 200px;
  max-height: none;
}

.emtec-appearance-pip.is-collapsed .emtec-appearance-pip-body {
  display: none;
}

.emtec-appearance-pip-chrome {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  padding: 8px 10px 8px 12px;
  background: linear-gradient(180deg, #1e293b 0%, #0f172a 100%);
  color: #f8fafc;
  cursor: grab;
  user-select: none;
}

.emtec-appearance-pip.is-dragging .emtec-appearance-pip-chrome {
  cursor: grabbing;
}

.emtec-appearance-pip-grip {
  opacity: 0.45;
  font-size: 0.75rem;
}

.emtec-appearance-pip-title {
  flex: 1;
  min-width: 0;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.emtec-appearance-pip-title i {
  margin-right: 5px;
  opacity: 0.85;
}

.emtec-appearance-pip-live > span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 3px rgba(52, 211, 153, 0.3);
  animation: emtec-appearance-live-pulse 1.8s ease-in-out infinite;
}

.emtec-appearance-pip-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
}

.emtec-appearance-pip-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.emtec-appearance-pip-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

.emtec-appearance-pip-body {
  overflow: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.emtec-appearance-pip-launcher {
  position: fixed;
  z-index: 449;
  bottom: 20px;
  left: calc(var(--emtec-sidebar-w-current, 260px) + 20px);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, var(--emtec-primary) 0%, color-mix(in srgb, var(--emtec-primary) 80%, #0f172a) 100%);
  border: none;
  border-radius: 999px;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.25);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.emtec-appearance-pip-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.3);
}

.emtec-appearance-pip-launcher[hidden] {
  display: none !important;
}

.emtec-appearance-preview-context {
  margin: 0;
  padding: 10px 12px 0;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--emtec-text);
  letter-spacing: -0.01em;
  line-height: 1.35;
}

.emtec-appearance-preview-root {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 160px;
  padding: 10px 12px 14px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.9) 0%, transparent 55%),
    linear-gradient(180deg, #f1f5f9 0%, #fff 100%);
}

.emtec-appearance-preview-block {
  display: none;
  width: 100%;
  padding: 6px;
  border-radius: 14px;
  border: 1px solid transparent;
  box-sizing: border-box;
}

.emtec-appearance-preview-block.is-visible {
  display: block;
  border-color: color-mix(in srgb, var(--emtec-primary) 18%, transparent);
  background: color-mix(in srgb, var(--emtec-primary) 4%, #fff);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--emtec-primary) 10%, transparent);
  animation: emtec-appearance-preview-in 0.28s ease;
}

@keyframes emtec-appearance-preview-in {
  from {
    opacity: 0;
    transform: translateY(8px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .emtec-appearance-preview-block.is-visible {
    animation: none;
  }
}

.emtec-appearance-editor-col {
  min-width: 0;
  width: 100%;
}

.emtec-appearance-panel.is-active {
  animation: emtec-appearance-panel-in 0.22s ease;
}

@keyframes emtec-appearance-panel-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.emtec-appearance-device-body--solo .emtec-appearance-device-sidebar {
  width: var(--emtec-preview-sidebar-w, 100%);
  max-width: 100%;
  border-radius: 0 0 8px 8px;
}

.emtec-appearance-device--interface {
  padding: 14px;
  background: var(--emtec-surface-2, #f8fafc);
}

.emtec-appearance-interface-sample-title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--emtec-text);
}

.emtec-appearance-interface-sample-body {
  margin: 0 0 12px;
  font-size: 0.88rem;
  color: var(--emtec-muted);
  line-height: 1.45;
}

.emtec-appearance-interface-sample-btn {
  display: inline-flex;
  padding: 8px 14px;
  border-radius: var(--emtec-radius-sm, 10px);
  background: var(--emtec-primary);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
}

.emtec-appearance-stepper-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.emtec-appearance-stepper-field + .emtec-appearance-stepper-field,
.emtec-appearance-stepper-field + .emtec-appearance-toggle--block,
.emtec-appearance-toggle--block + .emtec-appearance-stepper-field {
  margin-top: 4px;
}

.emtec-appearance-stepper-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.emtec-appearance-stepper-head .emtec-label {
  margin: 0;
}

.emtec-appearance-stepper-value {
  min-width: 3.2rem;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: var(--emtec-primary);
  padding: 5px 12px;
  border-radius: 8px;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--emtec-primary) 40%, transparent);
}

.emtec-appearance-stepper {
  display: flex;
  align-items: stretch;
  gap: 8px;
}

.emtec-appearance-stepper-btn {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  margin: 0;
  padding: 0;
  border: 1px solid var(--emtec-border);
  border-radius: 10px;
  background: #f8fafc;
  font: inherit;
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1;
  color: var(--emtec-text);
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.emtec-appearance-stepper-btn:hover {
  color: var(--emtec-primary);
  border-color: color-mix(in srgb, var(--emtec-primary) 45%, var(--emtec-border));
  background: #fff;
}

.emtec-appearance-stepper-btn:active {
  transform: scale(0.97);
}

.emtec-appearance-stepper-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--emtec-primary) 30%, transparent);
}

.emtec-appearance-stepper-input-wrap {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  min-height: 44px;
  padding: 0 12px;
  border: 2px solid var(--emtec-border);
  border-radius: 10px;
  background: #fff;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.emtec-appearance-stepper-input-wrap:focus-within {
  border-color: var(--emtec-primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--emtec-primary) 18%, transparent);
}

.emtec-appearance-stepper-input {
  width: 4rem;
  max-width: 100%;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  text-align: center;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--emtec-text);
  -moz-appearance: textfield;
  appearance: textfield;
}

.emtec-appearance-stepper-input::-webkit-outer-spin-button,
.emtec-appearance-stepper-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.emtec-appearance-stepper-input:focus {
  outline: none;
}

.emtec-appearance-stepper-unit {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--emtec-muted);
  white-space: nowrap;
}

.emtec-appearance-stepper-presets {
  display: flex;
  gap: 8px;
}

.emtec-appearance-stepper-preset {
  flex: 1;
  min-width: 0;
  padding: 8px 6px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--emtec-muted);
  background: #f8fafc;
  border: 1px solid var(--emtec-border);
  border-radius: 8px;
  cursor: pointer;
  transition:
    color 0.15s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.emtec-appearance-stepper-preset:hover {
  color: var(--emtec-primary);
  border-color: color-mix(in srgb, var(--emtec-primary) 40%, var(--emtec-border));
}

.emtec-appearance-stepper-preset.is-active {
  color: #fff;
  background: var(--emtec-primary);
  border-color: var(--emtec-primary);
  box-shadow: 0 2px 8px color-mix(in srgb, var(--emtec-primary) 35%, transparent);
}

.emtec-appearance-stepper-preset:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--emtec-primary) 30%, transparent);
}

.emtec-appearance-preview-login-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 14px;
  text-align: center;
  background: #fff;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
}

.emtec-appearance-preview-login-card strong {
  font-size: 0.95rem;
  color: var(--emtec-text);
}

.emtec-appearance-preview-login-fields {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
  margin-top: 4px;
}

.emtec-appearance-preview-login-fields span {
  display: block;
  height: 8px;
  border-radius: 6px;
  background: #e2e8f0;
}

.emtec-appearance-preview-login-fields span:first-child {
  width: 88%;
}

.emtec-appearance-preview-login-fields span:nth-child(2) {
  width: 72%;
}

.emtec-appearance-preview-login-btn {
  height: 10px !important;
  width: 100% !important;
  margin-top: 4px;
  border-radius: 8px !important;
  background: var(--emtec-primary) !important;
}

.emtec-appearance-device--auth[data-preview-login-shell] {
  padding: 14px;
  border: none;
  background: var(--emtec-auth-gradient, linear-gradient(155deg, #0a2f6e, #1a56c4));
}

.emtec-appearance-row--3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.emtec-appearance-device {
  border-radius: 12px;
  border: 1px solid #dbe3ee;
  background: #fff;
  box-shadow: 0 6px 20px rgba(15, 23, 42, 0.08);
  overflow: hidden;
}

.emtec-appearance-device--auth {
  padding: 10px;
  background: #fff;
  border: 1px solid var(--emtec-border);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
}

.emtec-appearance-device-caption {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--emtec-muted);
}

.emtec-appearance-device-caption::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: var(--emtec-primary);
  opacity: 0.75;
  flex-shrink: 0;
}

.emtec-appearance-device-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: #e2e8f0;
  border-bottom: 1px solid #cbd5e1;
}

.emtec-appearance-device-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #94a3b8;
}

.emtec-appearance-device-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: 4px;
  padding: 5px 12px;
  max-width: calc(100% - 50px);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--emtec-text);
  background: #fff;
  border-radius: 8px 8px 0 0;
  border: 1px solid #cbd5e1;
  border-bottom: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.emtec-appearance-device-tab img,
.emtec-appearance-device-favicon {
  width: 14px;
  height: 14px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 3px;
}

.emtec-brand-upload-preview--favicon {
  width: 56px;
  height: 56px;
}

.emtec-brand-upload-preview--favicon img {
  max-width: 48px;
  max-height: 48px;
}

.emtec-brand-upload--favicon {
  grid-template-columns: auto 1fr;
}

.emtec-appearance-device-body {
  display: flex;
  min-height: 100px;
}

.emtec-appearance-device-sidebar {
  width: 44%;
  min-width: 96px;
  padding: 8px 6px;
  background: linear-gradient(
    180deg,
    var(--emtec-sidebar-top, #0d3d94) 0%,
    var(--emtec-sidebar-bottom, #0a2f6e) 100%
  );
}

.emtec-appearance-device-sidebar .emtec-sidebar-brand {
  margin-bottom: 8px;
  padding-bottom: 8px;
  width: 100%;
  box-sizing: border-box;
}

.emtec-appearance-device-sidebar .emtec-sidebar-brand--text {
  flex-direction: column;
  align-items: flex-start;
}

.emtec-appearance-device-sidebar .emtec-sidebar-brand--text .emtec-sidebar-brand-text {
  width: 100%;
}

.emtec-appearance-device-sidebar .emtec-sidebar-brand--text .emtec-sidebar-brand-title {
  font-size: 0.5rem;
  line-height: 1.35;
  letter-spacing: 0.04em;
  word-break: normal;
  overflow-wrap: break-word;
  white-space: normal;
  hyphens: none;
}

.emtec-appearance-device-sidebar .emtec-sidebar-brand--logo .emtec-sidebar-brand-text,
.emtec-appearance-device-sidebar .emtec-sidebar-brand--logo .emtec-sidebar-brand-text[hidden] {
  display: none !important;
}

.emtec-appearance-device-sidebar .emtec-sidebar-brand--logo-text {
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.emtec-appearance-device-sidebar .emtec-sidebar-brand--logo-text .emtec-sidebar-brand-title {
  font-size: 0.48rem;
  line-height: 1.3;
  word-break: normal;
  overflow-wrap: break-word;
}

.emtec-appearance-device-sidebar .emtec-sidebar-brand-title {
  font-size: 0.52rem;
  line-height: 1.25;
  letter-spacing: 0.02em;
}

.emtec-appearance-device-sidebar .emtec-sidebar-brand-img {
  max-height: 28px;
  max-width: 100%;
  object-fit: contain;
}

.emtec-appearance-device-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 4px;
}

.emtec-appearance-device-nav-item {
  height: 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.12);
}

.emtec-appearance-device-nav-item.is-active {
  width: 72%;
  background: rgba(255, 255, 255, 0.22);
}

.emtec-appearance-device-nav-label {
  height: 6px;
  width: 45%;
  margin: 6px 0 2px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
}

.emtec-appearance-device-main {
  flex: 1;
  background: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
}

.emtec-appearance-auth-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 10px;
  text-align: center;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid var(--emtec-border);
}

.emtec-appearance-auth-logo {
  max-height: 28px;
  max-width: 120px;
  object-fit: contain;
}

.emtec-appearance-auth-preview strong {
  font-size: 0.88rem;
  color: var(--emtec-text);
}

.emtec-appearance-auth-preview span {
  font-size: 0.75rem;
  color: var(--emtec-muted);
  line-height: 1.35;
}

.emtec-appearance-panel-body {
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.emtec-appearance-row {
  display: grid;
  gap: 10px;
}

.emtec-appearance-row--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.emtec-appearance-row--color {
  grid-template-columns: 1.2fr 0.8fr;
}

.emtec-field--compact {
  margin-bottom: 0;
}

.emtec-field--compact .emtec-field-hint {
  margin-top: 4px;
  font-size: 0.75rem;
}

.emtec-input--plain {
  padding-left: 14px;
  background: #fff;
}

.emtec-label-optional {
  font-weight: 500;
  color: var(--emtec-muted);
}

.emtec-appearance-segment--inline {
  border: none;
  margin: 0;
  padding: 0;
}

.emtec-appearance-segment--inline .emtec-label {
  margin-bottom: 6px;
}

.emtec-appearance-segment-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.emtec-appearance-segment-opt {
  position: relative;
  display: inline-flex;
  cursor: pointer;
}

.emtec-appearance-segment-opt input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.emtec-appearance-segment-opt span {
  display: inline-block;
  padding: 8px 14px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--emtec-muted);
  background: #f8fafc;
  border: 2px solid var(--emtec-border);
  border-radius: 10px;
  transition:
    border-color 0.15s ease,
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.1s ease;
}

.emtec-appearance-segment-opt:hover span {
  border-color: color-mix(in srgb, var(--emtec-primary) 35%, var(--emtec-border));
  color: var(--emtec-text);
}

.emtec-appearance-segment-opt:has(input:checked) span,
.emtec-appearance-segment-opt.is-selected span {
  color: #fff;
  background: var(--emtec-primary);
  border-color: var(--emtec-primary);
  box-shadow: 0 3px 12px color-mix(in srgb, var(--emtec-primary) 40%, transparent);
  transform: translateY(-1px);
}

.emtec-appearance-segment-opt:has(input:focus-visible) span {
  outline: 2px solid color-mix(in srgb, var(--emtec-primary) 50%, transparent);
  outline-offset: 2px;
}

.emtec-appearance-dropzone {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--emtec-primary);
}

.emtec-appearance-dropzone:hover {
  border-color: var(--emtec-primary);
  background: #fff;
}

.emtec-appearance-dropzone img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  flex-shrink: 0;
  padding: 2px;
  border-radius: 6px;
  background: #fff;
  border: 1px solid var(--emtec-border);
}

.emtec-appearance-dropzone--compact {
  min-height: 44px;
}

.emtec-appearance-color {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.emtec-appearance-color input[type="color"] {
  width: 48px;
  height: 44px;
  padding: 2px;
  border: 1px solid var(--emtec-border);
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
}

.emtec-appearance-color .emtec-input {
  flex: 1;
  font-family: ui-monospace, monospace;
  font-size: 0.88rem;
}

.emtec-appearance-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
}

.emtec-appearance-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.emtec-appearance-toggle-track {
  position: relative;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 999px;
  background: #cbd5e1;
  transition: background 0.2s;
}

.emtec-appearance-toggle-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s;
}

.emtec-appearance-toggle input:checked + .emtec-appearance-toggle-track {
  background: var(--emtec-primary);
}

.emtec-appearance-toggle input:checked + .emtec-appearance-toggle-track::after {
  transform: translateX(20px);
}

@media (max-width: 1280px) {
  .emtec-appearance-cards-grid--2 {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1200px) {
  .emtec-appearance-workspace {
    grid-template-columns: 1fr;
  }

  .emtec-appearance-rail {
    flex-direction: column;
    border-right: none;
    border-bottom: 1px solid var(--emtec-border);
    padding: 12px 14px;
    height: auto;
    overflow: visible;
  }

  .emtec-appearance-rail-nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .emtec-appearance-rail-label {
    width: 100%;
    margin-bottom: 4px;
  }

  .emtec-appearance-rail-item {
    flex: 1 1 170px;
    grid-template-columns: auto 1fr;
  }

  .emtec-appearance-rail-step {
    display: none;
  }

  .emtec-appearance-rail-item.is-active {
    transform: none;
  }

  .emtec-appearance-rail-preview {
    margin-top: 12px;
    padding-top: 12px;
    min-height: 240px;
  }

  .emtec-appearance-studio-panel {
    min-height: 0;
  }

  .emtec-appearance-mode-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 991px) {
  .emtec-appearance-pip,
  .emtec-appearance-pip-launcher {
    left: 16px;
    width: min(300px, calc(100vw - 32px));
  }
}

@media (max-width: 640px) {
  .emtec-appearance-pip {
    right: 16px;
    width: auto;
    max-width: none;
  }

  .emtec-appearance-pip-launcher {
    right: 16px;
    left: 16px;
    justify-content: center;
  }
}

@media (max-width: 1024px) {
  .emtec-appearance-row--2,
  .emtec-appearance-row--3,
  .emtec-appearance-row--color {
    grid-template-columns: 1fr;
  }

  .emtec-brand-upload {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }

  .emtec-brand-upload-preview {
    grid-row: auto;
    margin: 0 auto;
  }
}

.emtec-appearance-device--content {
  padding: 14px;
}

.emtec-appearance-preview-topbar-sample {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  margin-bottom: 10px;
  border-radius: var(--emtec-radius-sm);
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--emtec-border);
}

.emtec-appearance-preview-topbar-sample.emtec-topbar-compact {
  padding: 6px 10px;
}

.emtec-appearance-preview-topbar-title {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--emtec-text);
}

.emtec-appearance-preview-topbar-sub {
  font-size: 0.78rem;
  color: var(--emtec-muted);
}

.emtec-appearance-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: calc(0.78rem * var(--emtec-table-font-scale, 1));
  border-radius: var(--emtec-radius-sm);
  overflow: hidden;
  border: 1px solid var(--emtec-border);
}

.emtec-appearance-preview-table th,
.emtec-appearance-preview-table td {
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--emtec-border);
}

.emtec-appearance-preview-table th {
  background: #f8fafc;
  font-weight: 600;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--emtec-muted);
}

.emtec-appearance-preview-table.emtec-table-striped tbody tr:nth-child(even) {
  background: rgba(15, 23, 42, 0.04);
}

.emtec-appearance-preview-login-card {
  max-width: var(--emtec-auth-card-max-width, min(280px, 100%));
}

.emtec-appearance-preview-login-card strong {
  font-size: calc(1rem * var(--emtec-login-font-scale, 1));
}

.emtec-appearance-device-nav.is-compact .emtec-appearance-device-nav-item {
  height: 5px;
  margin-bottom: 4px;
}

.emtec-appearance-device-nav-item.style-accent.is-active {
  box-shadow: inset 3px 0 0 var(--emtec-primary, #1a56c4);
}

.emtec-appearance-device-nav-item.style-minimal.is-active {
  background: transparent;
  opacity: 1;
}
