/* ==============================================================================
   ENROQUE SISTEMA - MASTER STYLESHEET
   Design System: TailAdmin Dashboard + MaterialM Login
   Brand Palette: #0c2752 (Navy), #62713d (Olive), #797878 (Grey)
   Nordic Calm: #5DA9E9 (Fjord), #B8DBD9 (Arctic), #708D81 (Pine), #F4F1DE (Snow)
   ============================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Public+Sans:wght@400;500;600;700;800&family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  /* Enroque Corporate Navy + Minimal Web v7.3.0 Tokens */
  --brand-navy: #0C2752;
  --brand-navy-light: #163A75;
  --brand-navy-dark: #081A38;
  --brand-olive: #0C2752;
  --brand-olive-light: #163A75;
  --brand-grey: #637381;

  /* Corporate Accents */
  --nordic-fjord: #1B4B91;
  --nordic-fjord-dark: #0C2752;
  --nordic-arctic: #E8EEF7;
  --nordic-pine: #118D57;
  --nordic-snow: #F4F6F8;

  /* Minimal Web v7.3.0 Light Surfaces & Greys */
  --bg-body: #F4F6F8;
  --bg-sidebar: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F4F6F8;
  --bg-input: #FFFFFF;
  --text-main: #1C252E;
  --text-muted: #637381;
  --text-light: #919EAB;
  --border-color: rgba(145, 158, 171, 0.20);
  --border-light: rgba(145, 158, 171, 0.14);
  --border-active: #0C2752;

  /* Minimal Web v7.3.0 Elevation Shadows */
  --shadow-sm: 0 0 2px 0 rgba(145, 158, 171, 0.20), 0 12px 24px -4px rgba(145, 158, 171, 0.12);
  --shadow-md: 0 0 2px 0 rgba(145, 158, 171, 0.22), 0 16px 32px -4px rgba(145, 158, 171, 0.16);
  --shadow-lg: 0 0 2px 0 rgba(145, 158, 171, 0.24), -20px 20px 40px -4px rgba(145, 158, 171, 0.20);
  --shadow-xl: -40px 40px 80px -8px rgba(28, 37, 46, 0.20);
  --shadow-glow: 0 8px 16px 0 rgba(12, 39, 82, 0.20);

  /* Minimal Web v7.3.0 Radius */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

/* Minimal Web v7.3.0 Dark Theme */
html.dark {
  --bg-body: #141A21;
  --bg-sidebar: #141A21;
  --bg-card: #1C252E;
  --bg-card-hover: #28323D;
  --bg-input: #1C252E;
  --text-main: #FFFFFF;
  --text-muted: #919EAB;
  --text-light: #637381;
  --border-color: rgba(145, 158, 171, 0.16);
  --border-light: rgba(145, 158, 171, 0.12);
  --border-active: #93C5FD;

  --shadow-sm: 0 0 2px 0 rgba(0, 0, 0, 0.28), 0 12px 24px -4px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 0 2px 0 rgba(0, 0, 0, 0.32), 0 16px 32px -4px rgba(0, 0, 0, 0.34);
  --shadow-lg: 0 0 2px 0 rgba(0, 0, 0, 0.36), -20px 20px 40px -4px rgba(0, 0, 0, 0.40);
  --shadow-xl: -40px 40px 80px -8px rgba(0, 0, 0, 0.48);
  --shadow-glow: 0 8px 16px 0 rgba(0, 0, 0, 0.36);
}

/* Global Reset & Base Typography */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Public Sans', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-body);
  color: var(--text-main);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Custom Scrollbars */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 9999px;
}
html.dark ::-webkit-scrollbar-thumb {
  background: #334155;
}

/* ==============================================================================
   LOGIN PAGE (MaterialM Split-Screen Style)
   ============================================================================== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: stretch;
  background-color: var(--brand-navy-dark);
}

/* Left Hero Branding Column */
.login-hero {
  flex: 1.1;
  background: linear-gradient(145deg, #0c2752 0%, #081a38 100%);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 4rem 5rem;
  color: #ffffff;
  z-index: 1;
}

/* Modern Geometric Floating Shapes (MaterialM motifs) */
.hero-shape-1 {
  position: absolute;
  width: 420px;
  height: 420px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(93, 169, 233, 0.25) 0%, rgba(12, 39, 82, 0) 70%);
  top: -80px;
  left: -80px;
  z-index: -1;
  animation: floatSlow 12s ease-in-out infinite alternate;
}

.hero-shape-pill-1 {
  position: absolute;
  width: 140px;
  height: 380px;
  border-radius: 9999px;
  background: linear-gradient(180deg, rgba(93, 169, 233, 0.4) 0%, rgba(184, 219, 217, 0.1) 100%);
  bottom: -60px;
  left: 80px;
  transform: rotate(35deg);
  z-index: -1;
  backdrop-filter: blur(10px);
}

.hero-shape-pill-2 {
  position: absolute;
  width: 110px;
  height: 300px;
  border-radius: 9999px;
  background: linear-gradient(180deg, rgba(98, 113, 61, 0.45) 0%, rgba(93, 169, 233, 0.15) 100%);
  bottom: 20px;
  left: 210px;
  transform: rotate(35deg);
  z-index: -1;
}

.hero-shape-circle {
  position: absolute;
  width: 90px;
  height: 90px;
  border-radius: 50%;
  background: #5DA9E9;
  bottom: 60px;
  left: 50px;
  z-index: -1;
  box-shadow: 0 10px 25px rgba(93, 169, 233, 0.5);
}

@keyframes floatSlow {
  0% { transform: translateY(0) scale(1); }
  100% { transform: translateY(20px) scale(1.05); }
}

/* Right Form Card Column */
.login-form-wrapper {
  flex: 1;
  background-color: var(--bg-card);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 3rem 4rem;
  position: relative;
  overflow-y: auto;
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.15);
}

.login-form-box {
  width: 100%;
  max-width: 560px;
}

/* Form Controls */
.input-group {
  position: relative;
  margin-bottom: 1.25rem;
}

.input-label {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: var(--text-main);
}

.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}

.input-field {
  width: 100%;
  height: 48px;
  padding: 0 1rem 0 2.75rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-input);
  color: var(--text-main);
  font-size: 0.95rem;
  line-height: 1.5;
  outline: none;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.input-field[type="password"] {
  padding-right: 2.75rem;
}

.input-field:focus {
  border-color: var(--nordic-fjord);
  box-shadow: 0 0 0 3px rgba(93, 169, 233, 0.2);
}

.input-icon {
  position: absolute;
  left: 0.95rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-light);
  width: 18px;
  height: 18px;
  pointer-events: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  margin: 0;
  padding: 0;
}

.input-group > .input-icon:not(.input-wrapper *) {
  top: calc(1.5rem + 24px);
}

.input-icon svg,
.input-icon.lucide {
  width: 18px;
  height: 18px;
  display: block;
}

.toggle-password-btn {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: none;
  background: transparent;
  color: #94a3b8;
  cursor: pointer;
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
  z-index: 2;
}

.toggle-password-btn:hover {
  color: var(--nordic-fjord);
  background-color: rgba(93, 169, 233, 0.12);
}

.toggle-password-btn svg,
.toggle-password-btn.lucide {
  width: 18px;
  height: 18px;
  display: block;
}

.btn-primary {
  width: 100%;
  padding: 0.85rem 1.5rem;
  background: linear-gradient(135deg, var(--brand-navy) 0%, var(--brand-navy-light) 100%);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-shadow: 0 4px 14px rgba(12, 39, 82, 0.35);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--nordic-fjord-dark) 0%, var(--brand-navy) 100%);
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(93, 169, 233, 0.4);
}

.btn-social {
  flex: 1;
  padding: 0.65rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-card);
  color: var(--text-main);
  font-size: 0.875rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-social:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--nordic-fjord);
  transform: translateY(-1px);
}

.dgii-results {
  position: absolute;
  z-index: 60;
  left: 0;
  right: 0;
  top: calc(100% + 0.35rem);
  max-height: 240px;
  overflow-y: auto;
  padding: 0.35rem;
  border: 1px solid var(--border-color);
  border-radius: 0.9rem;
  background: var(--bg-card);
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
}

.dgii-result-item {
  display: block;
  width: 100%;
  padding: 0.65rem 0.75rem;
  border-radius: 0.65rem;
  text-align: left;
  transition: background-color 0.15s ease;
}

.dgii-result-item:hover,
.dgii-result-item:focus {
  background: var(--bg-card-hover);
  outline: none;
}

/* Auth Views & 2FA Components */
.hidden {
  display: none !important;
}

.auth-view-panel {
  width: 100%;
}

.pin-box {
  width: 48px !important;
  height: 56px !important;
  text-align: center !important;
  font-size: 1.5rem !important;
  font-weight: 800 !important;
  border-radius: 14px !important;
  border: 1.5px solid #cbd5e1 !important;
  background: #ffffff !important;
  color: #0f172a !important;
  outline: none !important;
  transition: all 0.2s ease-in-out !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
}

html.dark .pin-box {
  background: var(--bg-input) !important;
  border-color: #334155 !important;
  color: #f8fafc !important;
}

.pin-box:focus {
  border-color: #2563eb !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.25) !important;
}

@keyframes popIn {
  0% { opacity: 0; transform: scale(0.96) translateY(4px); }
  100% { opacity: 1; transform: scale(1) translateY(0); }
}

.animate-pop-in {
  animation: popIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

/* ==============================================================================
   TAILADMIN DASHBOARD LAYOUT
   ============================================================================== */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 270px;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1), transform 0.3s ease;
}

.sidebar.collapsed {
  width: 80px;
}

.sidebar-header {
  height: 70px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border-color);
  gap: 0.85rem;
}

.sidebar-header > a {
  width: 100%;
  justify-content: center;
}

.sidebar.collapsed .sidebar-header {
  padding: 0 1.25rem;
  justify-content: center;
}

.sidebar.collapsed .brand-text,
.sidebar.collapsed .menu-heading,
.sidebar.collapsed .nav-item-text,
.sidebar.collapsed .nav-badge {
  display: none;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 0.85rem;
}

.menu-heading {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-light);
  padding: 0.75rem 0.75rem 0.35rem 0.75rem;
  margin-top: 0.5rem;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-weight: 500;
  font-size: 0.9rem;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 2px;
}

.nav-link:hover {
  background-color: var(--bg-card-hover);
  color: var(--nordic-fjord);
}

.nav-link.active {
  background: linear-gradient(90deg, rgba(12, 39, 82, 0.1) 0%, rgba(93, 169, 233, 0.12) 100%);
  color: var(--nordic-fjord);
  font-weight: 700;
}

html.dark .nav-link.active {
  background: linear-gradient(90deg, rgba(93, 169, 233, 0.15) 0%, rgba(12, 39, 82, 0.3) 100%);
}

.nav-badge {
  margin-left: auto;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 0.15rem 0.5rem;
  border-radius: 9999px;
  background-color: rgba(98, 113, 61, 0.18);
  color: var(--brand-olive);
}

html.dark .nav-badge {
  background-color: rgba(98, 113, 61, 0.35);
  color: var(--nordic-arctic);
}

/* Main Content Area */
.main-wrapper {
  flex: 1;
  margin-left: 270px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar.collapsed ~ .main-wrapper {
  margin-left: 80px;
}

/* Top Header */
.top-header {
  height: 70px;
  background-color: var(--bg-sidebar);
  border-bottom: 1px solid var(--border-color);
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.75rem;
  backdrop-filter: blur(8px);
}

.search-bar {
  position: relative;
  width: 100%;
  max-width: 360px;
}

.search-input {
  width: 100%;
  padding: 0.55rem 2.5rem 0.55rem 2.25rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background-color: var(--bg-body);
  color: var(--text-main);
  font-size: 0.875rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--nordic-fjord);
  background-color: var(--bg-card);
}

.search-kbd {
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 0.7rem;
  font-family: monospace;
  padding: 0.1rem 0.35rem;
  color: var(--text-muted);
}

.topbar-scope-controls select {
  min-width: 150px;
}

@media (max-width: 900px) {
  .top-header { height: auto; min-height: 70px; display: grid; grid-template-columns: auto minmax(0,1fr); gap: .6rem; padding-block: .6rem; }
  .topbar-main { display: contents; }
  #sidebarToggleBtn { grid-column: 1; grid-row: 1; justify-self: start; }
  .topbar-actions { grid-column: 2; grid-row: 1; justify-self: end; }
  .top-header .search-bar { display: none; }
  .topbar-scope-controls { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); grid-column: 1/-1; grid-row: 2; width: 100%; min-width: 0; }
  .topbar-scope-controls > div { min-width: 0; }
  .topbar-scope-controls select { flex: 1; min-width: 0; max-width: 100%; width: 100%; min-height: 28px; }
  .topbar-scope-controls :is(svg,i) { flex-shrink: 0; }
}

/* Header Action Buttons */
.header-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background-color: var(--bg-card);
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  position: relative;
  transition: all 0.2s ease;
}

.header-btn:hover {
  background-color: var(--bg-card-hover);
  color: var(--nordic-fjord);
  border-color: var(--nordic-fjord);
}

.badge-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: #ef4444;
  border: 2px solid var(--bg-card);
}

/* Content Container */
.content-container {
  padding: 1.75rem;
  flex: 1;
}

/* Dashboard Cards (TailAdmin SaaS Cards) */
.card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
  box-shadow: var(--shadow-md);
}

.kpi-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.kpi-value {
  font-size: 1.85rem;
  font-weight: 800;
  color: var(--text-main);
  letter-spacing: -0.02em;
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.badge-trend {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.2rem 0.5rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
}

.trend-up {
  background-color: rgba(34, 197, 94, 0.12);
  color: #16a34a;
}

.trend-down {
  background-color: rgba(239, 68, 68, 0.12);
  color: #dc2626;
}

/* Interactive Tabs */
.tab-pills {
  display: inline-flex;
  background-color: var(--bg-body);
  padding: 4px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  gap: 4px;
}

.tab-btn {
  padding: 0.4rem 0.9rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  border: none;
  background: transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tab-btn.active {
  background-color: var(--bg-card);
  color: var(--nordic-fjord);
  box-shadow: var(--shadow-sm);
}

/* Modals & Popovers */
.modal-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(12, 39, 82, 0.4);
  backdrop-filter: blur(4px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  animation: fadeIn 0.2s ease-out;
}

.modal-content {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  max-width: 550px;
  width: 100%;
  padding: 2rem;
  box-shadow: var(--shadow-xl);
  animation: slideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Responsive adjustments */
@media (max-width: 1024px) {
  .login-hero {
    display: none;
  }
  .login-form-wrapper {
    flex: 1;
    padding: 2rem 1.5rem;
  }
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  .main-wrapper {
    margin-left: 0 !important;
  }
}
/* Centro de configuración */
.settings-tabs { display:flex; gap:1.5rem; overflow-x:auto; border-bottom:1px solid #e2e8f0; scrollbar-width:none; }
.settings-tabs::-webkit-scrollbar { display:none; }
.settings-tab,.subtab { display:inline-flex; align-items:center; gap:.5rem; flex:none; padding:.85rem .15rem .75rem; border-bottom:2px solid transparent; color:#64748b; font-size:.78rem; font-weight:700; transition:.2s ease; }
.settings-tab:hover,.subtab:hover { color:#0c2752; }
.settings-tab.active,.subtab.active { color:#2563eb; border-bottom-color:#2563eb; }
.filter-control,.form-control { width:100%; border:1px solid #e2e8f0; border-radius:.75rem; background:#fff; color:#334155; padding:.62rem .8rem; font-size:.75rem; outline:none; transition:.2s ease; }
.filter-control { width:auto; min-width:9rem; }
.form-control:focus,.filter-control:focus { border-color:#2563eb; box-shadow:0 0 0 3px rgba(37,99,235,.08); }
.form-label { display:block; margin-bottom:.35rem; color:#334155; font-size:.75rem; font-weight:700; }
.btn-primary,.btn-secondary,.btn-danger { border-radius:.75rem; padding:.62rem 1rem; font-size:.75rem; font-weight:800; transition:.2s ease; }
.btn-primary { background:#0c2752; color:#fff; box-shadow:0 6px 16px rgba(12,39,82,.16); }
.btn-primary:hover { background:#163b72; }
.btn-primary:disabled { opacity:.6; cursor:not-allowed; }
.btn-secondary { border:1px solid #e2e8f0; background:#fff; color:#475569; }
.btn-danger { background:#dc2626; color:#fff; }
.content-container .btn-primary,.content-container .btn-secondary,.content-container .btn-danger { width:auto; display:inline-flex; align-items:center; justify-content:center; gap:.45rem; white-space:nowrap; }
.config-actions { display:flex; align-items:center; justify-content:flex-end; flex-wrap:wrap; gap:.65rem; }
.config-button { width:auto !important; min-width:9.75rem; min-height:2.45rem; padding:.58rem 1rem !important; }
.action-button { display:inline-flex; width:2rem; height:2rem; align-items:center; justify-content:center; border-radius:.6rem; color:#64748b; transition:.2s ease; }
.action-button:hover { background:#f1f5f9; color:#0c2752; }
.status-pill { display:inline-flex; border-radius:999px; padding:.28rem .6rem; font-size:.625rem; font-weight:800; }
.table-head { border-bottom:1px solid #e2e8f0; background:#f8fafc; color:#64748b; font-size:.6875rem; text-transform:uppercase; letter-spacing:.04em; }
.modal-backdrop { position:fixed; inset:0; z-index:50; align-items:center; justify-content:center; padding:1rem; background:rgba(15,23,42,.64); backdrop-filter:blur(4px); }
.modal-backdrop:not(.hidden) { display:flex; }
.modal-card { width:100%; max-height:92vh; overflow-y:auto; border:1px solid #e2e8f0; border-radius:1rem; background:#fff; box-shadow:0 25px 60px rgba(15,23,42,.28); }
.modal-header { position:sticky; top:0; z-index:2; display:flex; align-items:center; justify-content:space-between; padding:1.15rem 1.25rem; border-bottom:1px solid #e2e8f0; background:#fff; }
@media (prefers-reduced-motion:no-preference) { .settings-tab,.subtab,.action-button,.btn-primary,.btn-secondary { transition-duration:.18s; } }
.dark .settings-tabs,.dark .table-head,.dark .modal-header,.dark .modal-card { border-color:#334155; }
.dark .filter-control,.dark .form-control,.dark .btn-secondary,.dark .modal-card,.dark .modal-header { background:var(--bg-card); color:#e2e8f0; border-color:var(--border-color); }
.dark .form-label { color:#cbd5e1; }
.dark .table-head { background:var(--bg-body); color:#94a3b8; }
.dark .action-button:hover { background:var(--bg-card-hover); color:#fff; }
@media (max-width:639px) { .config-button { min-width:8.75rem; } }

/* Constructor profesional de plantillas */
.template-page { min-height:calc(100vh - 70px); background:#f8fafc; }
.template-list-header { display:flex; align-items:center; justify-content:space-between; gap:1rem; margin-bottom:1.35rem; }
.template-list-header h1 { color:#020617; font-size:1.55rem; font-weight:900; letter-spacing:-.025em; }
.template-list-header h1 span { color:#94a3b8; font-size:.75rem; font-weight:600; }
.template-search-wrap { position:relative; width:min(100%,24rem); margin-bottom:1rem; }
.template-search-icon { position:absolute; z-index:2; left:.9rem; top:50%; width:1rem; height:1rem; color:#94a3b8; transform:translateY(-50%); pointer-events:none; }
.template-search-input { width:100%; height:2.6rem; padding:.62rem .85rem .62rem 2.65rem; border:1px solid #dbe3ef; border-radius:.75rem; background:#fff; color:#334155; font-size:.75rem; outline:none; transition:border-color .18s,box-shadow .18s; }
.template-search-input:focus { border-color:#5da9e9; box-shadow:0 0 0 3px rgba(93,169,233,.12); }
.template-list-card { overflow:hidden; border:1px solid #dbe3ef; border-radius:1rem; background:#fff; box-shadow:0 1px 2px rgba(15,23,42,.04); }
.template-list-table { width:100%; min-width:850px; color:#334155; font-size:.75rem; text-align:left; }
.template-list-table thead { background:#f8fafc; color:#64748b; font-size:.68rem; text-transform:uppercase; letter-spacing:.035em; }
.template-list-table th,.template-list-table td { padding:1rem; }
.template-list-table tbody tr { border-top:1px solid #e8edf4; transition:background .15s; }
.template-list-table tbody tr:hover { background:#f8fafc; }
.template-name-cell { display:block; text-align:left; }
.template-name-cell strong { display:block; color:#0f172a; font-size:.85rem; }
.template-name-cell span,.template-name-cell small { display:block; color:#94a3b8; margin-top:.22rem; }
.template-name-cell small { font-size:.64rem; }
.template-row-actions { display:flex; justify-content:flex-end; gap:.15rem; }
.template-row-actions svg,.template-inline-actions svg,.template-question-actions svg { width:1rem; height:1rem; }

.template-builder-page { min-height:calc(100vh - 70px); background:#f7f7f8; color:#111827; }
.template-builder-toolbar { position:sticky; top:70px; z-index:35; display:flex; align-items:center; justify-content:space-between; gap:1rem; min-height:4.25rem; padding:.7rem 1.75rem; border-bottom:1px solid #e2e8f0; background:rgba(255,255,255,.96); backdrop-filter:blur(10px); }
.template-toolbar-left,.template-toolbar-actions { display:flex; align-items:center; gap:.75rem; }
.template-toolbar-left > div { display:flex; flex-direction:column; min-width:0; }
.template-toolbar-left strong { font-size:.9rem; }
.template-toolbar-left span { overflow:hidden; max-width:28rem; color:#94a3b8; font-size:.68rem; text-overflow:ellipsis; white-space:nowrap; }
.template-toolbar-left em { border-radius:999px; background:#fff7ed; color:#c2410c; padding:.28rem .6rem; font-size:.65rem; font-style:normal; font-weight:700; }
.template-compact-btn { display:inline-flex; align-items:center; justify-content:center; gap:.4rem; width:auto!important; min-width:0!important; min-height:2.35rem; padding:.55rem .9rem!important; }
.template-compact-btn svg { width:1rem; height:1rem; }
.form-field { display:flex; flex-direction:column; gap:.4rem; }
.form-field > span { font-size:.72rem; font-weight:800; color:#475569; }
.template-settings-panel { display:grid; grid-template-columns:1fr 12rem minmax(18rem,1.2fr); gap:1rem; padding:1rem 1.75rem; border-bottom:1px solid #e2e8f0; background:#fff; box-shadow:0 8px 20px rgba(15,23,42,.04); }
.template-settings-panel > div > label { display:block; margin-bottom:.35rem; color:#64748b; font-size:.68rem; font-weight:700; }
.template-project-picker { position:relative; }
.template-project-picker summary { height:2.6rem; padding:.7rem .8rem; border:1px solid #e2e8f0; border-radius:.75rem; background:#fff; font-size:.75rem; cursor:pointer; list-style:none; }
.template-project-picker > div { position:absolute; z-index:50; right:0; width:100%; max-height:16rem; margin-top:.4rem; padding:.45rem; overflow:auto; border:1px solid #e2e8f0; border-radius:.75rem; background:#fff; box-shadow:0 18px 42px rgba(15,23,42,.14); }
.template-project-picker label { display:flex; align-items:center; gap:.5rem; padding:.5rem; font-size:.72rem; }
.template-project-picker p { padding:.6rem; color:#94a3b8; font-size:.72rem; }
.template-builder-canvas { width:min(100% - 2rem,67rem); margin:0 auto; padding:2.75rem 0 6rem; }

.template-hero { display:grid; grid-template-columns:8rem 1fr; align-items:start; gap:2.6rem; padding:0 .75rem 2.7rem; }
.template-cover { display:flex; align-items:center; justify-content:center; width:8rem; height:8rem; overflow:hidden; border:1px dashed #d8dee8; border-radius:.9rem; background:#fff; color:#6ea8fe; }
.template-cover > svg { width:2.65rem; height:2.65rem; }
.template-cover img { width:100%; height:100%; object-fit:cover; }
.template-cover.editable { position:relative; cursor:pointer; }
.template-cover.editable input { display:none; }
.template-cover.editable span { position:absolute; inset:auto 0 0; padding:.35rem; background:rgba(12,39,82,.86); color:#fff; font-size:.62rem; text-align:center; opacity:0; transition:opacity .18s; }
.template-cover.editable:hover span { opacity:1; }
.template-remove-cover { display:block; width:100%; margin-top:.35rem; color:#dc2626; font-size:.65rem; font-weight:700; }
.template-hero-copy { min-width:0; padding-top:.15rem; }
.template-hero-copy h2,.template-title-input { width:100%; border:0; background:transparent; color:#050505; font-size:1.9rem; font-weight:800; letter-spacing:-.03em; outline:none; }
.template-hero-copy > p,.template-description-input { width:100%; margin-top:.45rem; border:0; background:transparent; color:#475569; font-size:.95rem; line-height:1.5; outline:none; resize:none; }
.template-hero-copy > label { display:block; margin-top:1.15rem; color:#64748b; font-size:.7rem; }
.template-hero-copy > strong,.template-format-input { display:block; width:100%; margin-top:.25rem; border:0; border-bottom:1px solid transparent; background:transparent; color:#111827; font-size:.9rem; outline:none; }
.template-title-input:focus,.template-description-input:focus,.template-format-input:focus { border-bottom-color:#4f46e5; }
.template-hero-copy > small { display:block; margin-top:.35rem; color:#94a3b8; font-size:.62rem; }

.template-sections,.template-regular-sections { display:flex; flex-direction:column; gap:3rem; }
.template-regular-sections { margin-top:3rem; }
.template-section { position:relative; }
.template-section-heading { display:flex; align-items:flex-start; gap:.65rem; margin:0 0 .85rem; }
.template-chevron,.template-drag { display:inline-flex; align-items:center; justify-content:center; width:1.65rem; height:1.65rem; flex:none; color:#64748b; cursor:pointer; }
.template-chevron svg,.template-drag svg { width:1rem; height:1rem; transition:transform .15s; }
.template-drag { cursor:grab; }
.template-drag:active { cursor:grabbing; }
.template-section-copy { min-width:0; flex:1; }
.template-section-copy h3,.template-section-title { width:100%; border:0; border-bottom:1px solid transparent; background:transparent; color:#09090b; font-size:1.2rem; font-weight:800; outline:none; }
.template-section-copy p,.template-section-description { width:100%; margin-top:.25rem; border:0; border-bottom:1px solid transparent; background:transparent; color:#475569; font-size:.82rem; outline:none; }
.template-section-title:focus,.template-section-description:focus { border-bottom-color:#4f46e5; }
.template-locked { display:inline-flex; align-items:center; gap:.3rem; border-radius:999px; background:#eef2ff; color:#4f46e5; padding:.28rem .55rem; font-size:.62rem; font-weight:700; }
.template-locked svg { width:.75rem; height:.75rem; }
.template-inline-actions { display:flex; align-items:center; flex:none; gap:.1rem; }
.template-inline-actions button,.template-question-actions button { display:inline-flex; align-items:center; justify-content:center; width:1.8rem; height:1.8rem; border-radius:.45rem; color:#64748b; }
.template-inline-actions button:hover,.template-question-actions button:hover { background:#eaeef5; color:#4338ca; }
.template-question-table { position:relative; overflow:visible; border:1px solid #dfe3e8; border-radius:.65rem; background:#fff; }
.template-question-head { display:grid; grid-template-columns:minmax(0,1fr) 19rem; border-bottom:1px solid #e5e7eb; color:#111827; font-size:.64rem; }
.template-question-head span { padding:.65rem .85rem; }
.template-question-head span + span { border-left:1px solid #e5e7eb; }
.template-question-item { position:relative; border-top:1px solid #e5e7eb; background:#fff; }
.template-question-item:first-child { border-top:0; }
.template-question-main { display:grid; grid-template-columns:2rem minmax(0,1fr) 19rem 5.5rem; align-items:stretch; min-height:3rem; }
.template-question-main > input { min-width:0; border:0; background:transparent; padding:.75rem .5rem; color:#111827; font-size:.9rem; outline:none; }
.template-question-main > input:focus { box-shadow:inset 0 0 0 2px #4f46e5; background:#f8f7ff; }
.template-response-cell { position:relative; border-left:1px solid #e5e7eb; }
.template-response-trigger { display:grid; grid-template-columns:1.75rem minmax(0,1fr) 1rem; align-items:center; gap:.45rem; width:100%; height:100%; padding:.55rem .75rem; color:#111827; font-size:.75rem; text-align:left; }
.template-response-trigger > svg { width:.9rem; height:.9rem; color:#64748b; }
.template-type-icon { display:inline-flex; align-items:center; justify-content:center; width:1.55rem; height:1.55rem; border-radius:999px; }
.template-type-icon svg { width:.82rem; height:.82rem; }
.tone-orange { background:#fff7ed;color:#f97316; }.tone-amber { background:#fffbeb;color:#f59e0b; }.tone-blue { background:#eff6ff;color:#3b82f6; }
.tone-green { background:#f0fdf4;color:#84cc16; }.tone-cyan { background:#ecfeff;color:#06b6d4; }.tone-teal { background:#f0fdfa;color:#14b8a6; }.tone-purple { background:#f5f3ff;color:#7c3aed; }
.template-question-actions { display:flex; align-items:center; justify-content:center; gap:.05rem; border-left:1px solid #e5e7eb; }
.template-question-actions button { width:1.65rem; height:1.65rem; }
.template-question-controls { display:flex; align-items:center; flex-wrap:wrap; gap:1rem; padding:.55rem 2.65rem; border-top:1px solid #eef0f3; font-size:.75rem; }
.template-question-controls label { display:inline-flex; align-items:center; gap:.4rem; }
.template-logic-toggle { display:inline-flex; align-items:center; gap:.35rem; color:#4f46e5; font-weight:600; }
.template-logic-toggle svg { width:.85rem; height:.85rem; }
.template-options-editor { padding:.65rem 2.65rem; border-top:1px solid #eef0f3; background:#fafafa; }
.template-options-title { display:flex; align-items:center; justify-content:space-between; margin-bottom:.45rem; color:#64748b; font-size:.67rem; font-weight:700; }
.template-options-title button,.template-add-option { display:inline-flex; align-items:center; gap:.25rem; color:#4f46e5; font-weight:700; }
.template-options-title svg,.template-add-option svg { width:.8rem;height:.8rem; }
.template-option-row { display:grid; grid-template-columns:1rem minmax(7rem,1fr) 7rem 5rem 1.5rem; align-items:center; gap:.45rem; margin-top:.35rem; }
.template-option-row input,.template-option-row select { min-width:0; border:1px solid #e2e8f0; border-radius:.45rem; background:#fff; padding:.38rem .5rem; font-size:.7rem; outline:none; }
.template-option-row label { display:flex; align-items:center; gap:.25rem; font-size:.68rem; }
.template-option-row button svg { width:.85rem;height:.85rem; }
.template-color-dot { width:.65rem;height:.65rem;border-radius:999px;background:#cbd5e1; }
.color-green { background:#d1fae5!important;color:#047857!important; }.color-yellow { background:#fef3c7!important;color:#b45309!important; }
.color-red { background:#fee2e2!important;color:#dc2626!important; }.color-blue { background:#dbeafe!important;color:#2563eb!important; }
.color-teal { background:#ccfbf1!important;color:#0f766e!important; }.color-orange { background:#ffedd5!important;color:#c2410c!important; }
.color-purple { background:#f3e8ff!important;color:#7e22ce!important; }.color-neutral { background:#e5e7eb!important;color:#52525b!important; }
.template-logic-editor { display:grid; grid-template-columns:auto minmax(9rem,1fr) 9rem minmax(8rem,1fr); align-items:center; gap:.5rem; padding:.65rem 2.65rem; border-top:1px solid #ddd6fe; background:#f5f3ff; color:#5b21b6; font-size:.7rem; }
.template-logic-editor select,.template-logic-editor input { min-width:0; border:1px solid #ddd6fe; border-radius:.45rem; background:#fff; padding:.38rem .5rem; color:#334155; outline:none; }
.template-section-footer { margin-top:.8rem; }
.template-add-button { display:inline-flex; align-items:center; gap:.35rem; border:1px solid #dfe3e8; border-radius:.55rem; background:#fff; color:#4f46e5; padding:.55rem .8rem; font-size:.75rem; font-weight:600; }
.template-add-button svg { width:.9rem;height:.9rem; }
.template-add-rail { position:absolute; top:5.7rem; left:-5.3rem; display:flex; flex-direction:column; width:3.8rem; overflow:hidden; border:1px solid #e2e8f0; border-radius:.55rem; background:#fff; box-shadow:0 6px 18px rgba(15,23,42,.06); }
.template-add-rail button { display:flex; flex-direction:column; align-items:center; gap:.15rem; padding:.55rem .2rem; color:#475569; font-size:.58rem; }
.template-add-rail button:hover { background:#f8fafc;color:#4f46e5; }
.template-add-rail svg { width:1rem;height:1rem; }
.template-question-preview { display:grid; grid-template-columns:minmax(0,1fr) 19rem; min-height:2.85rem; border-top:1px solid #e5e7eb; font-size:.8rem; }
.template-question-preview:first-child { border-top:0; }
.template-question-preview > div { display:flex; align-items:center; gap:.65rem; padding:.65rem .85rem; }
.template-question-preview > div + div { border-left:1px solid #e5e7eb; }
.template-question-preview > div > svg { width:.85rem;height:.85rem;color:#cbd5e1; }
.template-question-preview b { color:#dc2626; }
.template-option-preview { display:flex; flex-wrap:wrap; gap:.3rem; margin-left:.5rem; }
.template-option-chip { display:inline-flex; align-items:center; gap:.2rem; border-radius:999px; padding:.25rem .48rem; font-size:.62rem; }
.template-option-chip svg { width:.65rem;height:.65rem; }
.template-empty-questions { padding:1.4rem; color:#94a3b8; font-size:.75rem; text-align:center; }
.template-field-error { color:#dc2626; font-size:.66rem; }

.template-builder-page > .template-response-picker { position:fixed; z-index:1200; inset:0; display:flex; flex-direction:column; width:100%; height:100vh; height:100dvh; max-height:none; overflow:hidden; border:0; border-radius:0; background:var(--bg-card,#fff); color:var(--text-main,#111827); box-shadow:none; }
.template-picker-header { display:flex; align-items:center; justify-content:space-between; flex:none; gap:1rem; padding:1.25rem 1.5rem; border-bottom:1px solid var(--border-color,#e2e8f0); }
.template-picker-header > div { min-width:0; }
.template-picker-header h2 { font-size:1.15rem; font-weight:800; }
.template-picker-header p { margin-top:.35rem; color:var(--text-muted,#64748b); font-size:.8rem; overflow-wrap:anywhere; }
.template-picker-header > button { display:inline-flex; align-items:center; flex:none; gap:.5rem; }
.template-picker-header svg { width:1rem; height:1rem; }
.template-picker-body { display:grid; grid-template-columns:minmax(16rem,1fr) minmax(0,2fr); flex:1; min-height:0; overflow:auto; overscroll-behavior:contain; }
.template-picker-body.is-editing { grid-template-columns:1fr; }
.template-picker-sets,.template-picker-types { min-width:0; padding:1.25rem 1.5rem; }
.template-picker-types { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); align-content:start; gap:.6rem; border-left:1px solid #e5e7eb; }
.template-picker-search { position:relative; margin-bottom:.75rem; }
.template-picker-search svg { position:absolute; left:.7rem;top:50%;width:.9rem;height:.9rem;transform:translateY(-50%);pointer-events:none; }
.template-picker-search input { width:100%; border:1px solid #e2e8f0;border-radius:.45rem;padding:.55rem .6rem .55rem 2rem;font-size:.72rem;outline:none; }
.template-picker-heading { display:flex;align-items:center;justify-content:space-between;margin-bottom:.35rem;color:#475569;font-size:.68rem; }
.template-picker-heading button { display:inline-flex;align-items:center;gap:.2rem;color:#4f46e5;font-weight:600; }
.template-picker-heading svg { width:.75rem;height:.75rem; }
.template-response-set { display:grid;grid-template-columns:minmax(0,1fr) 1.8rem;align-items:center;border-radius:.45rem; }
.template-response-set:hover { background:#f5f3ff; }
.template-response-set > button:first-child { padding:.55rem;text-align:left; }
.template-response-set strong { display:block;margin-bottom:.3rem;font-size:.72rem; }
.template-response-set span { display:flex;flex-wrap:wrap;gap:.2rem; }
.template-response-set > button:last-child svg { width:.9rem;height:.9rem;color:#4f46e5; }
.template-picker-empty { padding:1rem .5rem;color:#94a3b8;font-size:.72rem;text-align:center; }
.template-picker-types h4 { grid-column:1/-1; margin:.25rem .35rem .55rem;font-size:.72rem; }
.template-picker-types > button { display:grid;grid-template-columns:1.8rem minmax(0,1fr);align-items:center;gap:.45rem;width:100%;min-height:3.75rem;padding:.6rem .5rem;border-radius:.45rem;font-size:.75rem;text-align:left; }
.template-picker-types > button:hover { background:#f8fafc; }
.template-response-set-editor { grid-column:1/-1; width:100%; max-width:60rem; margin:0 auto; padding:1.5rem; }
.template-set-editor-head { display:flex;align-items:center;gap:.5rem;margin-bottom:.8rem; }
.template-set-editor-head button { display:inline-flex;align-items:center;justify-content:center;width:1.8rem;height:1.8rem; }
.template-set-editor-head svg { width:1rem;height:1rem; }
.template-response-set-editor > label { display:block;color:#475569;font-size:.68rem;font-weight:700; }
.template-response-set-editor > label input { display:block;width:100%;margin-top:.3rem;border:1px solid #e2e8f0;border-radius:.5rem;padding:.5rem;font-size:.75rem;outline:none; }
.template-set-options { margin-top:.65rem; }
.template-set-options > div { display:grid;grid-template-columns:1rem minmax(8rem,1fr) 7rem 5rem 1.5rem;align-items:center;gap:.4rem;margin-top:.35rem; }
.template-set-options input,.template-set-options select { min-width:0;border:1px solid #e2e8f0;border-radius:.45rem;padding:.42rem .5rem;font-size:.7rem; }
.template-set-options label { display:flex;align-items:center;gap:.25rem;font-size:.68rem; }
.template-set-options svg { width:.8rem;height:.8rem; }
.template-add-option { margin-top:.65rem;font-size:.7rem; }
.template-set-editor-actions { display:flex;align-items:center;justify-content:space-between;margin-top:1rem;padding-top:.75rem;border-top:1px solid #e5e7eb; }
.sortable-ghost { opacity:.35;background:#eef2ff!important; }
.sortable-chosen { box-shadow:0 8px 24px rgba(79,70,229,.14); }

.inspection-agenda-table { width:100%;min-width:1040px;border-collapse:collapse;color:#17243b;font-size:.76rem; }
.inspection-agenda-table thead { background:#f8fbff; }
.inspection-agenda-table th { padding:.85rem 1rem;border-bottom:1px solid #dce5f1;color:#52657f;font-size:.65rem;font-weight:800;letter-spacing:.035em;text-align:left;text-transform:uppercase;white-space:nowrap; }
.inspection-agenda-table td { padding:.85rem 1rem;border-bottom:1px solid #e2eaf4;vertical-align:middle; }
.inspection-agenda-table tr:last-child td { border-bottom:0; }
.inspection-agenda-table td strong { display:block;color:#12233d;font-weight:750; }
.inspection-agenda-table td small { display:block;margin-top:.2rem;color:#68809e;font-size:.68rem; }
.inspection-frequency { display:inline-flex;padding:.2rem .5rem;border:1px solid #d8e5f6;border-radius:.3rem;background:#f3f8ff;color:#31496a;font-size:.67rem;font-weight:700; }
.inspection-state { display:inline-flex;padding:.24rem .55rem;border:1px solid #d6e2f2;border-radius:999px;background:#f8fbff;color:#475f7d;font-size:.63rem;font-weight:800;text-transform:uppercase;white-space:nowrap; }
.inspection-state-warning { border-color:#f6d688;background:#fffaf0;color:#a15b00; }
.inspection-state-danger { border-color:#ffcbcc;background:#fff5f5;color:#bb272b; }
.inspection-execute { display:inline-flex;align-items:center;justify-content:center;gap:.35rem;border:0;border-radius:.5rem;background:#119548;color:#fff;font-size:.7rem;font-weight:750;white-space:nowrap; }
.inspection-execute:hover { background:#087b38; }
.inspection-execute svg { width:.8rem;height:.8rem; }
.dark .inspection-agenda-table { color:#e2e8f0; }
.dark .inspection-agenda-table thead { background:var(--bg-body); }
.dark .inspection-agenda-table th,.dark .inspection-agenda-table td { border-color:#334155; }
.dark .inspection-agenda-table td strong { color:#f8fafc; }

.dark .template-page,.dark .template-builder-page { background:var(--bg-body); }
.dark .template-list-header h1,.dark .template-name-cell strong,.dark .template-section-copy h3,.dark .template-section-title,.dark .template-hero-copy h2,.dark .template-title-input { color:#f8fafc; }
.dark .template-search-input,.dark .template-list-card,.dark .template-builder-toolbar,.dark .template-settings-panel,.dark .template-project-picker summary,.dark .template-project-picker > div,.dark .template-cover,.dark .template-question-table,.dark .template-question-item,.dark .template-add-button,.dark .template-add-rail,.dark .template-response-picker,.dark .template-option-row input,.dark .template-option-row select,.dark .template-set-options input,.dark .template-set-options select,.dark .template-response-set-editor > label input { border-color:var(--border-color);background:var(--bg-card);color:#e2e8f0; }
.dark .template-list-table thead,.dark .template-options-editor { background:var(--bg-body); }
.dark .template-question-main > input,.dark .template-response-trigger,.dark .template-section-description,.dark .template-description-input,.dark .template-format-input { color:#e2e8f0; }
.dark .template-question-item,.dark .template-question-head,.dark .template-question-main,.dark .template-response-cell,.dark .template-question-actions,.dark .template-question-controls,.dark .template-question-preview,.dark .template-picker-types { border-color:#334155; }

@media (max-width:1100px) {
  .template-add-rail { position:static;flex-direction:row;width:auto;margin-top:.65rem;border:0;background:transparent;box-shadow:none; }
  .template-add-rail button { flex-direction:row;padding:.4rem .6rem;border:1px solid #e2e8f0;border-radius:.5rem;background:#fff; }
}
@media (max-width:800px) {
  .template-builder-toolbar { top:70px;padding:.65rem 1rem; }
  .template-toolbar-left span,.template-toolbar-left em,.template-compact-btn:not(.btn-primary) span { display:none; }
  .template-settings-panel { grid-template-columns:1fr;padding:1rem; }
  .template-builder-canvas { width:calc(100% - 1.25rem);padding-top:1.5rem; }
  .template-hero { grid-template-columns:5.5rem 1fr;gap:1rem;padding-inline:0; }
  .template-cover { width:5.5rem;height:5.5rem; }
  .template-hero-copy h2,.template-title-input { font-size:1.4rem; }
  .template-question-head { display:none; }
  .template-question-main { grid-template-columns:1.8rem minmax(0,1fr) 2.6rem; }
  .template-response-cell { grid-column:2/3;border-left:0;border-top:1px solid #e5e7eb; }
  .template-question-actions { grid-column:3;grid-row:1/3;flex-direction:column; }
  .template-question-controls,.template-options-editor,.template-logic-editor { padding-inline:1rem; }
  .template-logic-editor { grid-template-columns:1fr; }
  .template-option-row,.template-set-options > div { grid-template-columns:1rem minmax(7rem,1fr) 1.5rem; }
  .template-option-row select,.template-option-row label,.template-set-options select,.template-set-options label { grid-column:2; }
  .template-picker-header { padding:1rem; }
  .template-picker-body { grid-template-columns:1fr; }
  .template-picker-sets,.template-picker-types { padding:1rem; }
  .template-picker-types { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .template-picker-types { border-top:1px solid #e5e7eb;border-left:0; }
  .template-question-preview { grid-template-columns:1fr; }
  .template-question-preview > div + div { border-top:1px solid #e5e7eb;border-left:0; }
}
