:root {
  --bg: #07131c;
  --surface: #0b1924;
  --surface-2: #0d1d28;
  --panel: #102330;
  --panel-2: #132a38;
  --line: #223847;
  --line-soft: rgba(148, 163, 184, .18);
  --text: #f8fafc;
  --muted: #b9b59c;
  --subtle: #7f8ea3;
  --primary: #f59e0b;
  --primary-2: #ffb22c;
  --danger: #ef4444;
  --ok: #22c55e;
  --blue: #3b82f6;
  --shadow: 0 18px 45px rgba(0, 0, 0, .22);
  --radius: 8px;
  --sidebar-w: 250px;
  --header-h: 54px;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  overflow: hidden;
}

a { color: inherit; }

button, input, textarea, select { font: inherit; }

button { cursor: pointer; }

button:disabled { cursor: not-allowed; opacity: .55; }

:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.app-shell { min-height: 100vh; background: var(--bg); }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  background: #07121a;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 20;
}

.brand {
  height: 59px;
  display: grid;
  place-items: center;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}

.brand img {
  max-width: 118px;
  max-height: 42px;
  object-fit: contain;
}

.sidebar-section {
  padding: 18px 8px;
  overflow-y: auto;
  flex: 1;
}

.sidebar-title {
  margin: 0 0 10px;
  padding: 0 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.nav-list { display: grid; gap: 4px; }

.nav-link,
.nav-parent,
.site-link,
.ghost {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 36px;
  padding: 8px 10px;
  color: var(--text);
  border-radius: var(--radius);
  text-decoration: none;
  background: transparent;
  border: 0;
}

.nav-link:hover,
.nav-parent:hover,
.site-link:hover,
.ghost:hover { background: rgba(255, 255, 255, .06); }

.nav-link.active,
.nav-parent.active {
  background: #152a38;
  color: var(--primary);
  font-weight: 700;
}

.nav-icon {
  width: 18px;
  text-align: center;
  color: currentColor;
  flex: 0 0 auto;
}

.site-tree {
  margin: 0 0 8px 18px;
  border-left: 1px solid var(--line);
  padding-left: 10px;
  display: grid;
  gap: 3px;
}

.site-link {
  color: #e5e7eb;
  font-size: 14px;
  min-height: 29px;
  padding: 5px 8px;
}

.site-link::before {
  content: "›";
  color: var(--muted);
}

.sidebar-footer {
  border-top: 1px solid var(--line);
  min-height: 56px;
  padding: 10px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.sidebar-footer form { margin: 0; }

.top-header {
  position: fixed;
  top: 0;
  left: var(--sidebar-w);
  right: 0;
  height: var(--header-h);
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 22px;
  z-index: 15;
}

.main {
  margin-left: var(--sidebar-w);
  padding: calc(var(--header-h) + 36px) 32px 32px;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
}

.editor-main {
  margin-left: 0;
  padding: 0;
  height: 100vh;
  overflow: hidden;
}

.auth-main {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at top, #102330, var(--bg) 50%);
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.page-title-row {
  display: flex;
  align-items: center;
  gap: 14px;
}
.page-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

h1, h2, h3, p { margin-top: 0; }

h1 { margin-bottom: 4px; font-size: 24px; line-height: 1.15; }
h2 { margin-bottom: 14px; font-size: 18px; }
h3 { margin-bottom: 8px; font-size: 16px; }

.muted { color: var(--muted); }
.subtle { color: var(--subtle); }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.cluster { display: flex; align-items: center; gap: 8px; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: none;
}

.card { padding: 20px; }
.panel { overflow: hidden; }
.panel-body { padding: 18px; }

.button,
button.primary,
.primary,
.primary-button,
.outline-button,
.icon-button,
button.secondary,
button.danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: var(--radius);
  min-height: 36px;
  padding: 9px 14px;
  border: 1px solid transparent;
  font-weight: 800;
  text-decoration: none;
}

.button,
button.primary,
.primary,
.primary-button {
  background: var(--primary);
  color: #111827;
  border-color: var(--primary);
}

.button:hover,
button.primary:hover,
.primary:hover,
.primary-button:hover { background: var(--primary-2); }

.button.secondary,
button.secondary,
.outline-button {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

.button.secondary:hover,
button.secondary:hover,
.outline-button:hover { background: rgba(255, 255, 255, .05); }

.button.danger,
button.danger {
  background: transparent;
  border-color: rgba(239, 68, 68, .38);
  color: var(--danger);
}

.button.small,
.primary.small,
.outline-button.small,
button.small,
.icon-button.small { min-height: 12px; padding: 6px 10px; font-size: 13px; }

.icon-button {
  width: 36px;
  padding: 0;
  background: transparent;
  color: var(--text);
  border: 1px solid var(--line);
}

.icon-button:hover { background: rgba(255, 255, 255, .06); }

label {
  display: block;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
  margin: 10px 0 6px;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  background: #0a1721;
  color: var(--text);
}

textarea { min-height: 96px; resize: vertical; }

input::placeholder, textarea::placeholder { color: #667789; }

hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 18px 0;
}

.flash {
  padding: 12px 14px;
  border-radius: var(--radius);
  margin-bottom: 18px;
  border: 1px solid transparent;
}

.flash.success { background: rgba(34, 197, 94, .1); color: #86efac; border-color: rgba(34, 197, 94, .32); }
.flash.error { background: rgba(239, 68, 68, .1); color: #fca5a5; border-color: rgba(239, 68, 68, .32); }

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(245, 158, 11, .13);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.badge.ok { background: rgba(34, 197, 94, .13); color: #86efac; }
.badge.danger { background: rgba(239, 68, 68, .13); color: #fca5a5; }
.pill.off, .badge.off { background: #172a38; color: var(--muted); }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid var(--line); padding: 13px 12px; text-align: left; vertical-align: middle; }
.table th { color: var(--muted); font-size: 13px; background: rgba(255, 255, 255, .02); }
.table tr:last-child td { border-bottom: 0; }

.empty {
  min-height: 210px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
}

.empty-icon {
  font-size: 38px;
  color: var(--muted);
  margin-bottom: 12px;
}

.auth-card { width: 100%; max-width: 420px; }
.auth-card img { display: block; max-width: 210px; margin: 0 auto 20px; }
.auth-divider {
  position: relative;
  margin: 18px 0 16px;
  text-align: center;
}
.auth-divider::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  border-top: 1px solid var(--line);
}
.auth-divider span {
  position: relative;
  z-index: 1;
  display: inline-block;
  padding: 0 10px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
}
.auth-google-placeholder {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 14px;
  background: rgba(255, 255, 255, .025);
  margin-bottom: 16px;
}
.auth-google-placeholder strong {
  display: block;
  margin-bottom: 6px;
}
.auth-google-placeholder p {
  margin-bottom: 0;
}
.google-auth-button {
  margin-top: 12px;
  min-height: 42px;
}
.small-text {
  font-size: 12px;
}

.modal {
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  width: min(520px, calc(100vw - 32px));
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
}

.modal::backdrop { background: rgba(0, 0, 0, .74); }
.modal-header, .modal-footer { padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-footer { border-top: 1px solid var(--line); border-bottom: 0; display: flex; justify-content: flex-end; gap: 10px; }
.modal-body { padding: 20px; }

.switch {
  position: relative;
  width: 44px;
  height: 24px;
  display: inline-flex;
  align-items: center;
}

.switch input { position: absolute; opacity: 0; inset: 0; }
.switch span {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #203848;
  transition: .18s ease;
}
.switch span::after {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  margin: 3px;
  border-radius: 50%;
  background: #08131b;
  transition: .18s ease;
}
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(20px); }

.site-card {
  margin-bottom: 16px;
  padding: 0;
}

.site-head {
  min-height: 78px;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.site-title { display: flex; gap: 12px; align-items: center; }
.site-title .globe { color: var(--primary); font-size: 20px; }
.site-body { padding: 16px 18px; background: rgba(255,255,255,.015); }
.site-actions { display: flex; gap: 12px; align-items: center; }

.tour-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 12px;
}

.tour-card,
.tour {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  background: #0d1d28;
}

.tour-head { display: flex; justify-content: space-between; gap: 12px; }
.tour-device-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.device-toggle { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; text-align: center; }
.tour-primary-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tour-secondary-actions { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; }

.code {
  white-space: pre-wrap;
  word-break: break-all;
  background: #0a1721;
  color: #f8fafc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  font-family: Consolas, ui-monospace, monospace;
  font-size: 12px;
}

.metric-grid,
.stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.metric-card,
.stat { text-align: center; }
.metric-card strong,
.stat strong { display: block; font-size: 28px; margin-top: 6px; }

.editor-page {
  margin: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: 55px 1fr;
  background: var(--bg);
  overflow: hidden;
}

.editor-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
}

.editor {
  display: grid;
  grid-template-columns: 324px 1fr;
  min-height: 0;
  height: calc(100vh - 55px);
}

.editor-panel {
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: auto;
  padding: 0;
}

.editor-section { padding: 14px 12px; border-bottom: 1px solid var(--line); }
.editor-steps-head { display: flex; justify-content: space-between; align-items: center; }
.preview { background: #fff; position: relative; min-width: 0; }
.preview iframe { width: 100%; height: 100%; min-height: 0; border: 0; display: block; }

.step-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  margin: 8px 0;
  background: #0b1b26;
}
.step-card.active { border-color: rgba(245,158,11,.75); box-shadow: 0 0 0 2px rgba(245,158,11,.12); }
.step-number { width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 50%; background: rgba(245,158,11,.14); color: var(--primary); font-weight: 900; font-size: 12px; }
.editor-status { font-size: 12px; border-radius: 999px; padding: 6px 10px; background: #172a38; color: var(--muted); }
.editor-status.ok { background: rgba(34,197,94,.13); color: #86efac; }
.editor-status.warn { background: rgba(245,158,11,.13); color: #fcd34d; }
.editor-status.selecting { background: rgba(59,130,246,.13); color: #93c5fd; }
.selector-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; align-items: end; }
.preview-help { position:absolute; left:16px; right:16px; bottom:16px; background:rgba(17,24,39,.92); color:#fff; border-radius:10px; padding:12px 14px; font-size:13px; z-index:4; box-shadow:0 12px 30px rgba(0,0,0,.18); max-width: 640px; }
.preview-help strong { display:block; margin-bottom:3px; }

@media (max-width: 920px) {
  .sidebar { position: static; width: auto; }
  .top-header { position: static; left: 0; }
  .main { margin: 0; padding: 22px; height: auto; min-height: 100vh; overflow: visible; }
  .editor-main { padding: 0; }
  .editor-page { margin: 0; height: auto; min-height: 100vh; overflow: visible; }
  .editor { grid-template-columns: 1fr; }
  .preview iframe { min-height: 70vh; }
}

/* Redesign refinements */
.site-link::before { content: ">"; color: var(--muted); }

.modal-card { padding: 22px; }
.modal.wide,
.modal-card.wide { width: min(760px, calc(100vw - 32px)); }
.modal-close {
  float: right;
  width: 30px;
  height: 30px;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  border: 0;
  color: var(--muted);
  font-size: 22px;
}
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }

.switch i {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #203848;
  transition: .18s ease;
}
.switch i::after {
  content: "";
  display: block;
  width: 18px;
  height: 18px;
  margin: 3px;
  border-radius: 50%;
  background: #08131b;
  transition: .18s ease;
}
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(20px); }
.switch.small { width: 44px; height: 22px; transform: scale(.88); transform-origin: center; }

.site-stack { display: grid; gap: 16px; }
.site-card {
  margin-bottom: 0;
  padding: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.site-card-head {
  min-height: 78px;
  padding: 18px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}
.site-icon { color: var(--primary); font-size: 21px; }
.chevron { color: var(--muted); font-size: 20px; }
.site-actions form,
.tour-card-foot form { margin: 0; }
.tour-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
  gap: 12px;
}
.tour-card-head { display: flex; justify-content: space-between; gap: 12px; }
.tour-card-head p { margin-bottom: 0; color: var(--muted); }
.tour-repeat-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--subtle) !important;
}
.state-inline { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.device-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 14px 0; }
.device-grid.compact { grid-template-columns: repeat(3, 1fr); }
.device-toggle strong { display: block; margin-top: 5px; font-size: 12px; }
.tour-actions-main { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tour-card-foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; }
.add-tour-button { margin-top: 14px; }
.repeat-days-row {
  display: grid;
  grid-template-columns: 110px auto;
  gap: 10px;
  align-items: center;
  margin-top: 8px;
}
.repeat-days-row span {
  color: var(--muted);
  font-weight: 800;
}
.repeat-enabled-row {
  margin-top: 14px;
}
.repeat-note {
  margin-top: 16px;
}
.tour-repeat-form:not(.repeat-enabled) .repeat-days-row {
  opacity: .45;
}
.empty-state { min-height: 250px; display: grid; place-items: center; text-align: center; padding: 30px; }
.empty-state p { color: var(--muted); }
.empty-inline {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 22px;
  color: var(--muted);
  margin-bottom: 14px;
}
.empty-inline strong { display: block; color: var(--text); margin-bottom: 3px; }
.color-preview {
  margin-top: 16px;
  padding: 14px;
  background: var(--preview-bg);
  color: var(--preview-text);
  border-radius: var(--radius);
}
.color-preview .primary { background: var(--preview-primary); color: var(--preview-button); border-color: var(--preview-primary); }

.editor-sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: auto;
  padding: 0;
  position: relative;
}
.editor-titlebar,
.editor-actions { display: flex; align-items: center; gap: 10px; }
.preview-controls {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}
.preview-controls[hidden] { display: none; }
.preview-controls span {
  padding: 0 7px;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.preview-controls .icon-button {
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
}
.editor-titlebar .compass { color: var(--primary); }
.editor-block { padding: 14px 12px; border-bottom: 1px solid var(--line); }
.steps-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 12px; border-bottom: 1px solid var(--line); }
.row.between { justify-content: space-between; }
.url-loader { display: grid; grid-template-columns: 1fr 42px 42px; gap: 8px; }
.color-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 8px; }
.color-grid input { height: 42px; padding: 4px; }
.steps-list { padding: 8px; }
.steps-list.compact { display: grid; gap: 10px; }
.helper-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}
.helper-toggle {
  min-height: 28px;
  padding: 4px 6px;
  color: var(--primary);
  font-weight: 400;
}
.helper-box {
  border-bottom: 1px solid var(--line);
  background: rgba(245, 158, 11, .06);
  padding: 14px 12px;
  display: grid;
  gap: 10px;
}
.helper-box[hidden] { display: none; }
.helper-box p,
.helper-box small {
  color: var(--muted);
  line-height: 1.45;
  margin: 0;
}
.helper-box .outline-button { width: 100%; }
.editor-inline-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
  color: var(--text);
}
.restart-config {
  margin-top: 12px;
}
.restart-config.is-disabled {
  display: none;
}
.editor-inline-toggle > span:first-child,
.restart-config label[for="restartButtonPositionSelect"],
.restart-config .muted {
  font-size: 0;
}
.editor-inline-toggle > span:first-child::before {
  content: "Bot\00e3o de reiniciar";
  font-size: 12px;
}
.restart-config label[for="restartButtonPositionSelect"]::before {
  content: "Posi\00e7\00e3o do bot\00e3o";
  font-size: 12px;
}
.restart-config .muted::before {
  content: "Exibe um bot\00e3o quadrado pequeno para o visitante reiniciar o tour manualmente.";
  font-size: 12px;
}

.step-list-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0b1b26;
  min-height: 86px;
  position: relative;
  overflow: hidden;
}
[data-theme="light"] .step-list-card { background: #ffffff; }
.step-list-card.active { border-color: rgba(245, 158, 11, .72); box-shadow: 0 0 0 2px rgba(245, 158, 11, .1); }
.step-list-main {
  width: 100%;
  min-height: 86px;
  border: 0;
  background: transparent;
  color: var(--text);
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  text-align: left;
  padding: 14px 42px 12px 14px;
}
.step-list-main strong,
.step-list-main small,
.step-list-main em {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.step-list-main small { color: var(--text); font-size: 12px; margin-top: 8px; }
.step-list-main em { color: var(--primary); font-size: 12px; font-style: normal; margin-top: 3px; }
.step-list-actions {
  position: absolute;
  right: 8px;
  top: 8px;
  /* display: grid; */
  gap: 6px;
  opacity: 0;
  transform: translateX(6px);
  transition: .15s ease;
}
.step-list-card:hover .step-list-actions,
.step-list-card:focus-within .step-list-actions {
  opacity: 1;
  transform: translateX(0);
}

.step-editor-panel {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: var(--panel);
  display: grid;
  grid-template-rows: auto 1fr auto;
}
.step-editor-panel[hidden] { display: none; }
.step-editor-head {
  min-height: 58px;
  display: grid;
  grid-template-columns: 38px 1fr 38px;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
}
.step-editor-head span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}
.step-editor-body {
  overflow-y: auto;
  padding: 14px 10px 90px;
}
.step-editor-foot {
  border-top: 1px solid var(--line);
  padding: 10px;
  background: var(--panel);
}
.step-editor-foot .primary { width: 100%; }
.upload-drop {
  position: relative;
  min-height: 64px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: var(--muted);
  overflow: hidden;
}
.upload-drop.image-preview {
  display: block;
  width: 100%;
  padding: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
}
.upload-drop.image-preview:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, .12);
}
.upload-drop.media-preview {
  display: block;
  width: 100%;
  margin-top: 8px;
  padding: 0;
  background: transparent;
  text-align: left;
  overflow: hidden;
  appearance: none;
  -webkit-appearance: none;
}
.upload-drop.media-preview:hover {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, .12);
}
.image-preview-frame {
  width: 100%;
  position: relative;
  aspect-ratio: 16 / 8;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at top, rgba(245, 158, 11, .12), transparent 58%),
    linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,0));
}
.image-preview-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.image-preview-empty {
  position: absolute;
  inset: 0;
  padding: 14px 16px;
  display: grid;
  gap: 4px;
  place-items: center;
  text-align: center;
  color: var(--muted);
  background: linear-gradient(180deg, rgba(9, 18, 27, .66), rgba(9, 18, 27, .2));
}
.image-preview-empty i {
  font-size: 24px;
  color: var(--primary);
}
.image-preview-empty strong,
.image-preview-empty small {
  display: block;
}
.image-preview-info {
  display: block;
  width: 100%;
  padding: 8px 12px 12px;
  color: var(--muted);
  font-size: 12px;
  word-break: break-all;
  border-top: 1px solid var(--line-soft);
  background: rgba(255, 255, 255, .02);
}
.upload-drop input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}
.video-preview-frame {
  min-height: 0;
}
.video-preview img {
  filter: saturate(1.03);
}
.media-preview-play {
  position: absolute;
  inset: auto auto 14px 14px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(15, 23, 42, .72);
  color: #fff;
  box-shadow: 0 10px 24px rgba(0, 0, 0, .28);
  pointer-events: none;
}
.media-preview-play i { margin-left: 2px; }
.media-preview-clear {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(239, 68, 68, .88);
  color: #fff;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .24);
  pointer-events: auto;
  z-index: 3;
}
.media-preview-clear:hover { filter: brightness(1.05); }
.media-preview-clear i { font-size: 12px; }
.image-preview-frame img[hidden],
.image-preview-empty[hidden],
.media-preview-clear[hidden],
.media-preview-play[hidden],
.image-preview-info[hidden] {
  display: none !important;
}
.editor-options { grid-template-columns: repeat(3, 1fr); margin-top: 14px; }
.step-card-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.step-card-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.step-card-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.step-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.step-options label { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--text); font-size: 12px; }
.step-options input { width: auto; }
.code-popover { position: relative; }
.code-popover summary { list-style: none; }
.code-popover summary::-webkit-details-marker { display: none; }
.code-popover-card {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  width: min(520px, 88vw);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  z-index: 30;
  box-shadow: var(--shadow);
}

.panel-toolbar {
  min-height: 58px;
  padding: 15px 17px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.panel-toolbar h2,
.panel-toolbar p { margin-bottom: 0; }
.filters-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}
.filters-row select { max-width: 210px; border-color: var(--primary); }
.analytics-panel { margin-top: 24px; }
.spaced { margin-top: 18px; }
.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
  margin-top: 22px;
}
.check-row input { width: auto; }
.ticket-list { display: grid; gap: 12px; }
.ticket-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #0d1d28;
  padding: 14px;
}
.ticket-head { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.tickets-grid { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.support-layout { align-items: start; }
.support-metrics { margin-bottom: 18px; }
.support-filters { margin: 18px 0 22px; }
.ticket-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.badge.warning {
  background: rgba(249, 115, 22, .14);
  color: #fdba74;
}
.support-ticket-card,
.support-admin-card {
  display: grid;
  gap: 12px;
}
.ticket-response,
.ticket-message-block {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .025);
  padding: 12px;
}
.ticket-response strong,
.ticket-message-block strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.ticket-response p,
.ticket-message-block p {
  margin-bottom: 0;
}
.ticket-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}
.ticket-actions form { margin: 0; }
.support-admin-form {
  display: grid;
  gap: 12px;
}
.support-form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.support-admin-grid .panel-body {
  display: grid;
  gap: 14px;
}

button.danger,
.danger {
  background: transparent;
  border-color: rgba(239, 68, 68, .38);
  color: var(--danger);
}

[data-theme="light"] {
  --bg: #f4f7fb;
  --surface: #ffffff;
  --surface-2: #ffffff;
  --panel: #ffffff;
  --panel-2: #edf3f8;
  --line: #d8e2ea;
  --line-soft: rgba(15, 23, 42, .12);
  --text: #0f1f2e;
  --muted: #607083;
  --subtle: #7b8a9b;
  --shadow: 0 18px 45px rgba(15, 23, 42, .08);
}

[data-theme="light"] body { background: var(--bg); color: var(--text); }
[data-theme="light"] .sidebar { background: #ffffff; }
[data-theme="light"] .nav-link.active,
[data-theme="light"] .nav-parent.active { background: #fff4df; }
[data-theme="light"] input,
[data-theme="light"] textarea,
[data-theme="light"] select,
[data-theme="light"] .code { background: #f8fafc; color: var(--text); }
[data-theme="light"] .tour-card,
[data-theme="light"] .ticket-card,
[data-theme="light"] .step-card { background: #ffffff; }
[data-theme="light"] .site-body { background: #f8fbfd; }
[data-theme="light"] .ticket-response,
[data-theme="light"] .ticket-message-block { background: #f8fafc; }

.theme-menu { position: relative; }
.theme-options {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  width: 142px;
  display: none;
  padding: 6px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 40;
}
.theme-options.open { display: grid; }
.theme-options button {
  background: transparent;
  color: var(--text);
  border: 0;
  border-radius: 6px;
  padding: 9px 10px;
  text-align: left;
}
.theme-options button:hover { background: rgba(245, 158, 11, .12); }

.nav-parent { width: 100%; cursor: pointer; }
.nav-caret { margin-left: auto; color: var(--muted); }
.site-tree.collapsed,
.tour-tree.collapsed { display: none; }
.nav-site-group { display: grid; gap: 2px; }
.site-toggle {
  width: 100%;
  border: 0;
  cursor: pointer;
  text-align: left;
}
.tour-tree {
  margin-left: 12px;
  padding-left: 12px;
  border-left: 1px solid var(--line);
  display: grid;
  gap: 2px;
}
.tour-tree a {
  min-height: 26px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  text-decoration: none;
}
.tour-tree a:hover { color: var(--text); }

.sidebar-collapsed .sidebar { width: 72px; }
.sidebar-collapsed .brand img { max-width: 48px; }
.sidebar-collapsed .top-header { left: 72px; }
.sidebar-collapsed .main { margin-left: 72px; }
.sidebar-collapsed .editor-main { margin-left: 0; }
.sidebar-collapsed .sidebar-title,
.sidebar-collapsed .nav-label,
.sidebar-collapsed .site-tree,
.sidebar-collapsed .sidebar-footer span,
.sidebar-collapsed .nav-caret { display: none; }
.sidebar-collapsed .nav-link,
.sidebar-collapsed .nav-parent {
  justify-content: center;
  padding-inline: 0;
}
.sidebar-collapsed .sidebar-footer { justify-content: center; }

.dashboard-site summary { list-style: none; cursor: pointer; }
.dashboard-site summary::-webkit-details-marker { display: none; }
.dashboard-site .chevron { transition: transform .18s ease; }
.dashboard-site:not([open]) .chevron { transform: rotate(-90deg); }
.dashboard-site:not([open]) .site-card-head { border-bottom: 0; }

.site-actions .icon-button,
.tour-card-foot .icon-button {
  width: 34px;
  height: 34px;
  color: var(--muted);
}
.site-actions .icon-button:hover,
.tour-card-foot .icon-button:hover {
  color: var(--text);
  border-color: rgba(245, 158, 11, .55);
}
.site-actions .danger,
.tour-card-foot .danger { color: var(--danger); }

.tour-switch-bar {
  display: grid;
  grid-template-columns: 1.2fr repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}
.status-toggle,
.tour-switch-bar .device-toggle {
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 10px;
  display: grid;
  place-items: center;
  text-align: center;
  margin: 0;
}
.status-toggle span:first-child {
  color: var(--muted);
  font-size: 12px;
}

@media (max-width: 760px) {
  .tour-switch-bar { grid-template-columns: repeat(2, 1fr); }
  .site-card-head { align-items: flex-start; flex-direction: column; }
  .site-actions { width: 100%; justify-content: flex-start; }
  .support-form-grid { grid-template-columns: 1fr; }
  .ticket-head { flex-direction: column; align-items: flex-start; }
  .ticket-badges { justify-content: flex-start; }
}

/* Font Awesome icon polish */
.site-link::before { content: none !important; }
.site-link i,
.tour-tree i { width: 16px; color: var(--muted); }

.theme-options button {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tour-tree a { gap: 8px; }

.sidebar-collapsed .nav-icon {
  width: 40px;
  font-size: 17px;
}

.tour-card-head { align-items: flex-start; }
.tour-active-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.tour-active-toggle span:first-child {
  color: var(--muted);
  font-size: 12px;
}
.tour-switch-bar { grid-template-columns: repeat(3, 1fr); }
.tour-switch-bar .device-toggle { min-height: 64px; }

@media (max-width: 760px) {
  .tour-switch-bar { grid-template-columns: repeat(2, 1fr); }
}

.modal.wide.install-modal {
  width: min(920px, calc(100vw - 32px));
  max-width: calc(100vw - 32px);
  overflow-x: hidden;
}
.install-modal .modal-card {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}
.install-header {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 18px;
}
.install-header h2 { margin-bottom: 6px; }
.install-header p { color: var(--muted); line-height: 1.45; margin-bottom: 0; }
.install-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  display: grid;
  place-items: center;
  color: #111827;
  background: var(--primary);
}
.install-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-bottom: 12px;
}
.install-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .025);
  padding: 14px;
  min-width: 0;
}
[data-theme="light"] .install-card { background: #f8fafc; }
.install-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 10px;
  min-width: 0;
}
.install-card-copy {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.install-card .code {
  display: block;
  width: 100%;
  min-width: 0;
  max-height: none;
  overflow-x: hidden;
  margin-bottom: 10px;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-wrap: anywhere;
  font-size: 13px;
  line-height: 1.6;
  padding: 18px;
}
.param-list {
  display: grid;
  gap: 9px;
  margin: 0;
}
.param-list div {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 10px;
  align-items: start;
}
.param-list dt,
.param-list dd { margin: 0; }
.param-list dd { color: var(--muted); }
.install-section-title {
  margin: 18px 0 10px;
  font-size: 14px;
  color: var(--text);
}
.install-note {
  margin-top: 12px;
  border: 1px solid rgba(34, 197, 94, .28);
  background: rgba(34, 197, 94, .08);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: grid;
  gap: 3px;
}
.install-note span { color: var(--muted); }

.swal2-popup.beetour-swal,
.swal2-popup {
  background: var(--panel) !important;
  color: var(--text) !important;
  border: 1px solid var(--line);
  border-radius: var(--radius) !important;
}
.swal2-title { color: var(--text) !important; }
.swal2-html-container { color: var(--muted) !important; }
.swal2-styled.swal2-confirm {
  background: var(--primary) !important;
  color: #111827 !important;
}
.swal2-styled.swal2-cancel {
  background: transparent !important;
  color: var(--text) !important;
  border: 1px solid var(--line) !important;
}

.bt-swal {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity .14s ease;
}
.bt-swal.open {
  opacity: 1;
  pointer-events: auto;
}
.bt-swal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .72);
}
.bt-swal-dialog {
  position: relative;
  width: min(430px, calc(100vw - 32px));
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 26px;
  text-align: center;
  transform: translateY(8px) scale(.98);
  transition: transform .14s ease;
}
.bt-swal.open .bt-swal-dialog { transform: translateY(0) scale(1); }
.bt-swal-icon {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: rgba(245, 158, 11, .14);
  color: var(--primary);
  font-size: 22px;
}
.bt-swal-icon.success { background: rgba(34, 197, 94, .14); color: var(--ok); }
.bt-swal-icon.error { background: rgba(239, 68, 68, .14); color: var(--danger); }
.bt-swal-dialog p {
  color: var(--muted);
  line-height: 1.5;
}
.bt-swal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 20px;
}

.analytics-header { margin-bottom: 22px; }
.analytics-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 18px;
}
.analytics-tabs a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--muted);
  text-decoration: none;
  background: rgba(255, 255, 255, .025);
}
.analytics-tabs a:hover,
.analytics-tabs a.active {
  color: var(--text);
  border-color: rgba(245, 158, 11, .55);
  background: rgba(245, 158, 11, .12);
}
.analytics-filters {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  align-items: center;
  margin-bottom: 22px;
}
.analytics-filters select,
.analytics-filters input {
  min-width: 0;
  min-height: 38px;
  padding-top: 8px;
  padding-bottom: 8px;
}
.analytics-filters input { min-width: min(260px, 100%); }
.analytics-filters .primary,
.analytics-filters .outline-button {
  min-height: 38px;
  white-space: nowrap;
}
.analytics-filters select:first-child {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, .18);
}
.analytics-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 10px;
}
.resources-metrics {
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
}
.analytics-metrics .metric-card {
  min-height: 78px;
  padding: 12px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 3px;
}
.analytics-metrics .metric-card i {
  font-size: 15px;
}
.analytics-metrics .metric-card strong {
  font-size: 21px;
  line-height: 1;
}
.analytics-metrics .metric-card span {
  color: var(--muted);
  font-size: 12px;
}
.metric-orange { color: var(--primary); }
.metric-blue { color: var(--blue); }
.metric-green { color: var(--ok); }
.analytics-table {
  max-height: 360px;
  overflow: auto;
}
.analytics-table .table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
}
.analytics-resource-filters {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.analytics-resource-table {
  max-height: calc(100vh - 430px);
  min-height: 280px;
  overflow: auto;
}
.analytics-resource-table .table {
  min-width: 1180px;
}
.analytics-resource-table code {
  font-size: 12px;
  color: var(--muted);
  overflow-wrap: anywhere;
}
.analytics-resource-table th {
  white-space: nowrap;
}
.table-sort {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}
.resource-name-cell {
  min-width: 230px;
}
.resource-name-input {
  min-width: 210px;
  padding: 8px 10px;
}
.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 14px 0 0;
  color: var(--muted);
}
.pagination .disabled {
  pointer-events: none;
  opacity: .5;
}

/* NPS */
.nps-tabs { margin-bottom: 22px; }
.nps-onboarding { padding: 32px; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 24px; align-items: start; }
.nps-onboarding-icon { width: 58px; height: 58px; display: grid; place-items: center; border-radius: 16px; background: rgba(245,158,11,.14); color: #f59e0b; font-size: 24px; }
.nps-onboarding-icon.success { background: rgba(34,197,94,.14); color: #22c55e; }
.nps-onboarding h2 { margin: 12px 0 8px; }
.nps-onboarding p { max-width: 760px; }
.nps-install-card, .nps-feature-list { grid-column: 2; }
.nps-feature-list { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }
.nps-feature-list span { border: 1px solid var(--border); border-radius: 10px; padding: 14px; }
.nps-feature-list i { width: 24px; color: #f59e0b; }
.badge.warning { background: rgba(245,158,11,.13); color: #d97706; }
.flash.warning { background: rgba(245,158,11,.12); color: #b45309; border: 1px solid rgba(245,158,11,.25); }
.nps-warning { margin-bottom: 18px; }
.nps-dashboard-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 18px; }
.nps-dashboard-toolbar select { min-width: 190px; }
.nps-tag-status { display: flex; align-items: center; gap: 9px; color: var(--muted); font-size: 13px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 5px rgba(34,197,94,.12); }
.nps-metrics { grid-template-columns: repeat(4,minmax(0,1fr)); }
.nps-metric-note { margin: -6px 0 18px; font-size: 12px; }
.nps-dashboard-grid { display: grid; grid-template-columns: minmax(0,2fr) minmax(280px,1fr); gap: 18px; }
.nps-chart-wrap { min-width: 0; }
.nps-chart-wrap canvas { display: block; max-width: 100%; }
.nps-chart-legend { display: flex; justify-content: center; gap: 22px; color: var(--muted); font-size: 12px; }
.nps-chart-legend span { display: flex; align-items: center; gap: 7px; }
.legend-visitors, .legend-viewers, .legend-respondents { display: inline-block; width: 13px; height: 13px; border-radius: 3px; }
.legend-visitors { background: #64748b; }
.legend-viewers { background: #f59e0b; }
.legend-respondents { background: #22c55e; }
.nps-distribution-row { margin: 20px 0; }
.nps-distribution-row > div:first-child { display: flex; justify-content: space-between; margin-bottom: 8px; font-size: 13px; }
.nps-distribution-row span { color: var(--muted); }
.nps-progress { height: 9px; overflow: hidden; border-radius: 999px; background: var(--panel-2); }
.nps-progress i { display: block; height: 100%; border-radius: inherit; }
.nps-progress .promoter { background: #22c55e; }
.nps-progress .neutral { background: #eab308; }
.nps-progress .detractor { background: #ef4444; }
.nps-empty { min-height: 230px; justify-content: center; }
.nps-config-layout { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(340px,.8fr); gap: 22px; align-items: start; }
.nps-config-fields { display: grid; gap: 16px; }
.nps-config-section { padding: 22px; }
.nps-config-section .panel-toolbar { padding: 0 0 18px; }
.nps-config-section label { display: grid; gap: 8px; font-weight: 600; }
.form-grid.two { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.nps-active-row, .nps-close-row { display: flex !important; align-items: flex-start; gap: 12px !important; }
.nps-active-row span, .nps-close-row span { display: grid; gap: 3px; }
.nps-active-row small, .nps-close-row small { color: var(--muted); font-weight: 400; }
.nps-color-field, .nps-number-field { display: flex; align-items: center; gap: 10px; }
.nps-color-field input[type="color"] { width: 54px; min-width: 54px; padding: 4px; }
.nps-color-field code { color: var(--muted); }
.nps-number-field input { flex: 1; }
.nps-number-field em { font-style: normal; color: var(--muted); }
.nps-band-messages { display: grid; gap: 12px; margin-top: 14px; }
.nps-config-layout [hidden] { display: none !important; }
.nps-action-section { display: grid; gap: 14px; margin-top: 20px; padding-top: 18px; border-top: 1px solid var(--border); }
.nps-band-actions { display: grid; gap: 12px; }
.nps-action-card { display: grid; gap: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
.nps-action-card > strong { color: var(--text); }
.nps-action-card small { color: var(--muted); font-weight: 400; }
.nps-save-bar { display: flex; justify-content: flex-end; gap: 10px; position: sticky; bottom: 14px; z-index: 5; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.nps-preview-column { position: sticky; top: 82px; }
.nps-preview-panel { padding: 20px; }
.nps-preview-panel .panel-toolbar { padding: 0 0 16px; }
.nps-preview-stage { height: 530px; position: relative; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: #f1f5f9; }
.nps-preview-site-bar { height: 55px; background: #172033; }
.nps-preview-site-content { display: grid; gap: 16px; padding: 28px; }
.nps-preview-site-content i { height: 60px; border-radius: 10px; background: #e2e8f0; }
.nps-preview-site-content i:first-child { width: 55%; height: 18px; }
.nps-preview-box { position: absolute; width: 310px; max-width: calc(100% - 24px); padding: 20px; border-radius: 14px; box-shadow: 0 18px 50px rgba(15,23,42,.22); font-family: system-ui,sans-serif; transition: .2s ease; }
.nps-preview-box[data-size="small"] { width: 260px; padding: 16px; font-size: 13px; }
.nps-preview-box[data-size="large"] { width: 370px; padding: 25px; font-size: 16px; }
.nps-preview-box[data-position="top-left"] { top: 68px; left: 12px; }
.nps-preview-box[data-position="top-right"] { top: 68px; right: 12px; }
.nps-preview-box[data-position="bottom-left"] { bottom: 12px; left: 12px; }
.nps-preview-box[data-position="bottom-right"] { bottom: 12px; right: 12px; }
.nps-preview-box strong { display: block; padding-right: 16px; line-height: 1.4; }
.nps-preview-close { position: absolute; right: 8px; top: 6px; border: 0; color: inherit; background: transparent; font-size: 20px; }
.nps-preview-scale { display: flex; flex-wrap: wrap; gap: 5px; margin: 16px 0 9px; }
.nps-preview-scale button { flex: 1 0 24px; min-width: 24px; height: 31px; border: 0; border-radius: 7px; font-weight: 700; padding: 0 5px; }
.nps-preview-box small { opacity: .7; font-size: 10px; }
.nps-preview-note { margin: 12px 0 0; text-align: center; }
.nps-final-preview { display: grid; gap: 9px; margin-top: 14px; padding: 18px; border-radius: 12px; text-align: center; box-shadow: 0 12px 35px rgba(15,23,42,.12); }
.nps-final-preview small { opacity: .7; text-transform: uppercase; letter-spacing: .5px; }
.nps-final-preview button { justify-self: center; border: 0; border-radius: 8px; padding: 9px 14px; font-weight: 700; }
.nps-response-filters { grid-template-columns: minmax(150px,1fr) minmax(150px,1fr) auto auto auto auto auto; }
.nps-reset-note { margin-bottom: 18px; }
.nps-response-filters label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; }
.nps-response-filters label input { min-width: 135px; }
.nps-score-badge { display: inline-grid; place-items: center; min-width: 35px; height: 35px; border-radius: 10px; background: rgba(245,158,11,.14); color: #d97706; font-weight: 800; }
.nps-category { display: inline-block; padding: 5px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.nps-category.promoter { background: rgba(34,197,94,.13); color: #16a34a; }
.nps-category.neutral { background: rgba(234,179,8,.13); color: #ca8a04; }
.nps-category.detractor { background: rgba(239,68,68,.13); color: #dc2626; }
.nps-responses-table td small { display: block; margin-top: 3px; color: var(--muted); }
.nps-comment-cell { min-width: 220px; max-width: 360px; white-space: normal; }
.nps-tags-code { display: block; max-width: 260px; white-space: normal; word-break: break-word; font-size: 11px; }

@media (max-width: 1100px) {
  .nps-config-layout, .nps-dashboard-grid { grid-template-columns: 1fr; }
  .nps-preview-column { position: static; }
  .nps-preview-stage { height: 440px; }
  .nps-response-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-width: 760px) {
  .nps-onboarding { grid-template-columns: 1fr; padding: 22px; }
  .nps-install-card, .nps-feature-list { grid-column: 1; }
  .nps-feature-list, .form-grid.two, .nps-metrics, .nps-response-filters { grid-template-columns: 1fr; }
  .nps-dashboard-toolbar { align-items: stretch; flex-direction: column; }
  .nps-dashboard-toolbar select { width: 100%; }
  .nps-config-section { padding: 18px; }
  .nps-preview-stage { height: 390px; }
}
.analytics-toggle {
  width: 100%;
  color: var(--muted);
  font-size: 13px;
  min-height: 26px;
  padding: 0;
}
.analytics-toggle span { font-size: 13px; }
.analytics-tree {
  margin-left: 18px;
}
.analytics-tree ~ a[href*="/analytics/"] {
  display: none;
}

.map-metrics {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.page-title-with-badge {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.beta-badge {
  background: rgba(245, 158, 11, .16);
  color: var(--primary);
}
.analytics-beta-note {
  margin-bottom: 16px;
}
.analytics-beta-note .panel-body {
  display: grid;
  gap: 6px;
}
.analytics-beta-note strong {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.analytics-beta-note p {
  margin-bottom: 0;
}
.map-recorder-panel .panel-body {
  padding: 18px;
}
.map-start-grid {
  display: grid;
  grid-template-columns: minmax(160px, 240px) 1fr auto;
  gap: 12px;
  align-items: end;
}
.map-start-grid label {
  margin: 0;
}
.map-recording-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.map-recording-status h3 {
  margin: 10px 0 4px;
}
.map-recording-status > div:first-child {
  flex: 1 1 320px;
}
.map-new-form[hidden] {
  display: none;
}
.map-viewer-toolbar {
  align-items: flex-start;
}
.map-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.map-controls select {
  width: auto;
  min-width: 130px;
}
.map-controls .check-row {
  margin: 0;
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255,255,255,.025);
}
.map-controls .check-row input {
  width: auto;
}
.map-frame-wrap {
  position: relative;
  height: min(720px, calc(100vh - 330px));
  min-height: 460px;
  background: #fff;
  overflow: auto;
}
.map-stage {
  position: relative;
  width: 100%;
  min-height: 100%;
}
.map-stage iframe,
.map-stage canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.map-stage iframe {
  border: 0;
  z-index: 1;
}
.map-stage canvas {
  z-index: 2;
  pointer-events: none;
  mix-blend-mode: multiply;
}
.scroll-legend {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 3;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border-radius: var(--radius);
  background: rgba(15, 23, 42, .84);
  color: #fff;
  font-size: 12px;
  box-shadow: var(--shadow);
}
.scroll-legend strong {
  color: var(--primary);
}

@media (max-width: 1280px) {
  .analytics-filters { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
  .analytics-metrics { grid-template-columns: repeat(3, minmax(160px, 1fr)); }
}

@media (max-width: 760px) {
  .analytics-filters,
  .analytics-metrics { grid-template-columns: 1fr; }
  .map-start-grid,
  .map-recording-status { grid-template-columns: 1fr; display: grid; }
  .map-frame-wrap { min-height: 520px; height: 70vh; }
}

.flows-header {
  align-items: flex-start;
  gap: 18px;
}
.flows-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}
.flows-actions select,
.flow-toolbar input {
  min-height: 40px;
}
.flows-shell {
  display: grid;
  grid-template-columns: 260px minmax(520px, 1fr) 280px;
  gap: 14px;
  height: calc(100vh - 170px);
  min-height: calc(100vh - 170px);
}
.flows-library,
.flows-inspector,
.flow-canvas-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  min-width: 0;
}
.flows-library,
.flows-inspector {
  padding: 14px;
  overflow: auto;
}
.flows-panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.flows-panel-head strong,
.flows-panel-head span {
  display: block;
}
.flows-panel-head span {
  color: var(--muted);
  font-size: 12px;
}
.flow-tour-list {
  display: grid;
  gap: 10px;
}
.flow-library-card {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  padding: 12px;
  cursor: grab;
}
.flow-library-card:hover {
  border-color: var(--primary);
}
.flow-library-card strong,
.flow-library-card span,
.flow-library-card small {
  display: block;
}
.flow-library-card span,
.flow-library-card small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 3px;
}
.flow-canvas-panel {
  display: grid;
  grid-template-rows: auto auto 1fr;
  overflow: hidden;
}
.flow-production-warning {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(245, 158, 11, .28);
  background: rgba(245, 158, 11, .1);
  color: var(--text);
  font-size: 13px;
  line-height: 1.35;
}
.flow-production-warning i {
  color: var(--primary);
}
.flow-production-warning[hidden] {
  display: none;
}
.flow-toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.flow-toolbar label {
  display: grid;
  gap: 6px;
  min-width: min(360px, 100%);
  color: var(--muted);
  font-size: 12px;
}
.flow-toolbar select {
  min-height: 40px;
  max-width: 150px;
}
.flow-elements-head {
  margin-top: 20px;
}
.flow-library-element strong i {
  color: var(--primary);
  margin-right: 6px;
}
.flow-canvas {
  position: relative;
  min-width: 960px;
  min-height: 560px;
  height: 100%;
  overflow: auto;
  cursor: grab;
  background:
    linear-gradient(rgba(148,163,184,.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148,163,184,.08) 1px, transparent 1px);
  background-size: 28px 28px;
}
.flow-canvas.panning {
  cursor: grabbing;
}
.flow-canvas-world {
  position: relative;
  width: 6000px;
  height: 5000px;
  transform-origin: 0 0;
}
.flow-canvas.connecting {
  cursor: crosshair;
}
.flow-drag-hint {
  position: sticky;
  left: 16px;
  top: 16px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid rgba(245, 158, 11, .38);
  border-radius: 999px;
  background: rgba(15, 23, 42, .92);
  color: #f8fafc;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: var(--shadow);
}
.flow-drag-hint[hidden] {
  display: none;
}
.flow-lines {
  position: absolute;
  left: 0;
  top: 0;
  width: 6000px;
  height: 5000px;
  pointer-events: none;
  overflow: visible;
}
.flow-edge {
  fill: none;
  stroke: var(--primary);
  stroke-width: 2.5;
  stroke-linecap: round;
  pointer-events: none;
}
.flow-edge-true {
  stroke: var(--ok);
}
.flow-edge-false {
  stroke: var(--danger);
}
.flow-edge-label {
  fill: var(--text);
  paint-order: stroke;
  stroke: var(--panel);
  stroke-width: 5px;
  stroke-linejoin: round;
  font-size: 12px;
  font-weight: 800;
  text-anchor: middle;
  pointer-events: none;
}
.flow-edge-temp {
  stroke-dasharray: 6 6;
  opacity: .88;
}
.flow-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  pointer-events: none;
}
.flow-empty i {
  font-size: 34px;
  color: var(--primary);
}
.flow-empty strong {
  color: var(--text);
  font-size: 18px;
}
.flow-node {
  position: absolute;
  width: 230px;
  min-height: 132px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  padding: 13px 42px 13px 22px;
  box-shadow: var(--shadow);
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.flow-node.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, .18), var(--shadow);
}
.flow-node.connecting {
  border-color: var(--ok);
  box-shadow: 0 0 0 2px rgba(34, 197, 94, .2), var(--shadow);
}
.flow-node-condition {
  border-style: dashed;
}
.flow-node-end {
  border-color: rgba(239, 68, 68, .4);
}
.flow-node.drop-target {
  border-color: var(--ok);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, .22), var(--shadow);
}
.flow-node.drop-target .flow-handle-in {
  background: var(--ok);
  border-color: var(--ok);
  transform: translateY(-50%) scale(1.18);
}
.flow-node:active,
.flow-node.dragging {
  cursor: grabbing;
  border-color: var(--primary);
  box-shadow: 0 18px 45px rgba(0, 0, 0, .28);
}
.flow-node strong,
.flow-node span,
.flow-node small {
  display: block;
}
.flow-node strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.flow-node-kicker {
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  margin-bottom: 5px;
}
.flow-node-status,
.flow-node small {
  color: var(--muted);
  font-size: 12px;
  margin-top: 5px;
}
.flow-node-remove {
  position: absolute;
  right: 8px;
  top: 8px;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.flow-node-remove:hover {
  color: var(--danger);
  border-color: rgba(239, 68, 68, .45);
}
.flow-handle-in {
  position: absolute;
  left: -8px;
  top: 50%;
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  transform: translateY(-50%);
  box-shadow: 0 0 0 4px rgba(15, 23, 42, .9);
}
.flow-handle-out {
  position: absolute;
  right: -11px;
  width: 22px;
  height: 22px;
  border: 2px solid var(--primary);
  border-radius: 999px;
  background: var(--panel);
  color: var(--text);
  display: inline-grid;
  place-items: center;
  padding: 0;
  cursor: grab;
  z-index: 2;
  box-shadow: 0 0 0 4px rgba(15, 23, 42, .9);
  touch-action: none;
  user-select: none;
}
.flow-handle-out:hover,
.flow-handle-out:focus {
  background: var(--primary);
  color: #111827;
  transform: scale(1.08);
}
.flow-handle-out span {
  position: absolute;
  left: 26px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--muted);
  padding: 3px 7px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
  pointer-events: none;
}
.flow-handle-next {
  top: 50%;
  transform: translateY(-50%);
}
.flow-handle-true {
  top: 82px;
  border-color: var(--ok);
}
.flow-handle-true:hover,
.flow-handle-true:focus {
  background: var(--ok);
  color: #052e16;
}
.flow-handle-true span {
  color: var(--ok);
}
.flow-handle-false {
  top: 112px;
  border-color: var(--danger);
}
.flow-handle-false:hover,
.flow-handle-false:focus {
  background: var(--danger);
  color: #fff;
}
.flow-handle-false span {
  color: var(--danger);
}
.flow-node-end .flow-handle-in {
  border-color: rgba(239, 68, 68, .55);
}
.flow-info-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  padding: 12px;
  margin-bottom: 12px;
}
.flow-info-card h2 {
  font-size: 15px;
  margin-bottom: 6px;
}
.flow-info-card p {
  color: var(--muted);
  line-height: 1.45;
}
.flow-inspector-form {
  display: grid;
  gap: 10px;
}
.flow-inspector-form[hidden] {
  display: none;
}
.flow-inspector-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}
.flow-node-fields {
  display: grid;
  gap: 10px;
}
.flow-node-fields[hidden] {
  display: none;
}
.flow-node-fields p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.flow-edge-list {
  display: grid;
  gap: 8px;
}
.flow-edge-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  color: var(--muted);
  font-size: 12px;
}
.flow-edge-row b {
  color: var(--primary);
  margin: 0 4px;
}
.flow-edge-row button {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.flow-edge-row button:hover {
  color: var(--danger);
  border-color: rgba(239, 68, 68, .45);
}
.flow-edge-empty {
  color: var(--muted);
  font-size: 12px;
}
.outline-button.active {
  border-color: var(--ok);
  color: var(--ok);
}
.danger-outline:hover {
  border-color: rgba(239, 68, 68, .45);
  color: var(--danger);
}
.muted-card {
  opacity: .76;
}
.flow-order-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}
.badge.ok {
  background: rgba(34, 197, 94, .14);
  color: var(--ok);
}

@media (max-width: 1180px) {
  .flows-shell {
    grid-template-columns: 1fr;
    height: auto;
  }
  .flow-canvas {
    min-height: 520px;
    height: 620px;
  }
}
