:root {
  --ink: #3a2a38;
  --muted: #8a7a88;
  --quiet: #b0a0ae;
  --paper: #fdf5f7;
  --panel: #fffbfc;
  --panel-soft: #fff0f4;
  --line: #f0dce4;
  --line-strong: #e0c4d0;
  --rose: #e8739a;
  --rose-dark: #c24b73;
  --rose-glow: rgba(232, 115, 154, 0.15);
  --lavender: #b8a9d4;
  --lavender-light: #ede4f5;
  --lavender-glow: rgba(184, 169, 212, 0.12);
  --blush: #ffe8e4;
  --cream: #fdf6f0;
  --mint: #a8d8c8;
  --teal: #7bc4b4;
  --violet: #9b8ec4;
  --gold: #e8c87a;
  --danger: #d45a78;
  --shadow-sm: 0 8px 24px rgba(58, 42, 56, 0.06);
  --shadow-md: 0 20px 48px rgba(58, 42, 56, 0.1);
  --shadow-lg: 0 32px 64px rgba(58, 42, 56, 0.14);
  --font-body: 'DM Sans', 'SF Pro', ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-full: 999px;
}

* {
  box-sizing: border-box;
}

body {
  position: relative;
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--ink);
  font-family: var(--font-body);
  background: #1a1220;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 15% 20%, rgba(232, 115, 154, 0.35) 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 85% 15%, rgba(184, 169, 212, 0.3) 0%, transparent 50%),
    radial-gradient(ellipse 60% 70% at 50% 90%, rgba(168, 216, 200, 0.2) 0%, transparent 55%),
    linear-gradient(165deg, #2a1f32 0%, #1f1528 35%, #241a2e 65%, #1a1220 100%);
  animation: mesh-drift 18s ease-in-out infinite alternate;
}

@keyframes mesh-drift {
  0% { filter: hue-rotate(0deg) brightness(1); transform: scale(1); }
  100% { filter: hue-rotate(8deg) brightness(1.05); transform: scale(1.02); }
}

.ambient-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.55;
  will-change: transform;
}

.orb-1 {
  width: 420px;
  height: 420px;
  top: -8%;
  left: -6%;
  background: radial-gradient(circle, rgba(232, 115, 154, 0.7), transparent 70%);
  animation: float-1 14s ease-in-out infinite;
}

.orb-2 {
  width: 360px;
  height: 360px;
  top: 40%;
  right: -10%;
  background: radial-gradient(circle, rgba(184, 169, 212, 0.65), transparent 70%);
  animation: float-2 16s ease-in-out infinite;
}

.orb-3 {
  width: 300px;
  height: 300px;
  bottom: -5%;
  left: 30%;
  background: radial-gradient(circle, rgba(168, 216, 200, 0.5), transparent 70%);
  animation: float-3 12s ease-in-out infinite;
}

.orb-4 {
  width: 200px;
  height: 200px;
  top: 20%;
  left: 45%;
  background: radial-gradient(circle, rgba(232, 200, 122, 0.35), transparent 70%);
  animation: float-4 20s ease-in-out infinite;
}

.sparkle-field {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(1.5px 1.5px at 20% 30%, rgba(255, 255, 255, 0.35) 50%, transparent 100%),
    radial-gradient(1px 1px at 70% 20%, rgba(255, 255, 255, 0.25) 50%, transparent 100%),
    radial-gradient(1.5px 1.5px at 40% 70%, rgba(255, 255, 255, 0.2) 50%, transparent 100%),
    radial-gradient(1px 1px at 85% 60%, rgba(255, 255, 255, 0.3) 50%, transparent 100%),
    radial-gradient(1px 1px at 10% 80%, rgba(255, 255, 255, 0.2) 50%, transparent 100%);
  animation: sparkle-twinkle 6s ease-in-out infinite alternate;
}

@keyframes float-1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, 30px) scale(1.08); }
}

@keyframes float-2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-50px, 25px) scale(1.05); }
}

@keyframes float-3 {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(30px, -40px); }
}

@keyframes float-4 {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  50% { transform: translate(-20px, 35px) rotate(15deg); }
}

@keyframes sparkle-twinkle {
  0% { opacity: 0.4; }
  100% { opacity: 0.9; }
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(260px, 300px) minmax(0, 1fr) minmax(260px, 320px);
  height: 100vh;
  max-height: 100vh;
  min-height: 0;
  overflow-x: auto;
  overflow-y: hidden;
  animation: shell-rise 0.8s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes shell-rise {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.sidebar,
.inspector {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 18px;
}

.sidebar {
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 251, 252, 0.72);
  backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: inset -1px 0 0 rgba(232, 115, 154, 0.08);
}

.inspector {
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 251, 252, 0.68);
  backdrop-filter: blur(24px) saturate(1.4);
  box-shadow: inset 1px 0 0 rgba(184, 169, 212, 0.1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
  margin-bottom: 4px;
}

.brand-mark {
  position: relative;
  display: grid;
  flex: 0 0 52px;
  width: 52px;
  height: 52px;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--rose), var(--lavender));
  box-shadow:
    0 8px 24px var(--rose-glow),
    0 0 0 1px rgba(232, 115, 154, 0.15);
}

.brand-mark::after {
  content: '';
  position: absolute;
  inset: -12px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--rose-glow), transparent 70%);
  z-index: -1;
  animation: rose-pulse 3s ease-in-out infinite;
}

@keyframes rose-pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.9; transform: scale(1.12); }
}

.brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  font-style: italic;
  line-height: 1;
  background: linear-gradient(135deg, var(--rose-dark), var(--lavender), var(--rose));
  background-size: 200% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: title-shimmer 6s ease-in-out infinite;
}

@keyframes title-shimmer {
  0%, 100% { background-position: 0% center; }
  50% { background-position: 100% center; }
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.04em;
}

.panel {
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius);
  padding: 16px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.92), rgba(255, 248, 251, 0.78));
  box-shadow:
    var(--shadow-sm),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transition: transform 220ms ease, box-shadow 220ms ease, border-color 220ms ease;
  animation: panel-in 0.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.panel:nth-child(2) { animation-delay: 0.05s; }
.panel:nth-child(3) { animation-delay: 0.1s; }
.panel:nth-child(4) { animation-delay: 0.15s; }
.panel:nth-child(5) { animation-delay: 0.2s; }

@keyframes panel-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.panel:hover {
  border-color: rgba(232, 115, 154, 0.35);
  box-shadow: var(--shadow-md), 0 0 24px var(--rose-glow);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-hint {
  margin: -6px 0 12px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.add-workflow-btn {
  min-height: 32px;
  padding: 0 10px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.key-quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 10px;
}

.key-quick-btn {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  background: var(--panel);
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.key-quick-btn:hover {
  border-color: var(--rose);
  box-shadow: 0 4px 14px var(--rose-glow);
  transform: translateY(-1px);
}

.panel-keys,
.panel-credentials {
  border-color: rgba(124, 92, 255, 0.25);
}

.cred-category-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}

.cred-category-tab {
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--panel);
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.cred-category-tab:hover {
  border-color: var(--rose);
  color: var(--ink);
}

.cred-category-tab.active {
  border-color: rgba(124, 92, 255, 0.5);
  color: var(--ink);
  background: rgba(124, 92, 255, 0.12);
}

.cred-cat-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  margin-left: 4px;
  border-radius: 999px;
  padding: 0 4px;
  background: rgba(124, 92, 255, 0.2);
  color: var(--ink);
  font-size: 9px;
  font-weight: 800;
}

.cred-vault-count {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.cred-vault-ai-quick {
  margin-bottom: 10px;
}

.cred-vault-ai-quick.hidden {
  display: none;
}

.cred-quick-label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.cred-type-badge {
  display: inline-block;
  margin-left: 4px;
  border-radius: 4px;
  padding: 1px 5px;
  background: rgba(124, 92, 255, 0.15);
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

.setup-start-here {
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 2px solid rgba(237, 79, 143, 0.35);
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, rgba(237, 79, 143, 0.08), rgba(124, 92, 255, 0.06));
}

.setup-start-eyebrow {
  margin: 0 0 6px;
  color: var(--rose);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.setup-start-lead {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.5;
}

.setup-hour-steps {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.setup-hour-steps li + li {
  margin-top: 10px;
}

.setup-hour-steps strong {
  color: var(--ink);
}

.setup-success-note {
  margin: 12px 0 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
  background: rgba(74, 222, 128, 0.12);
  border: 1px solid rgba(74, 222, 128, 0.35);
}

.setup-glossary {
  margin: 0 0 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-soft);
}

.setup-glossary-list {
  margin: 8px 0 0;
  display: grid;
  gap: 8px;
}

.setup-glossary-list dt {
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.setup-glossary-list dd {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.setup-pages-callout {
  margin: 0 0 14px;
  padding: 12px 14px;
  border: 1px solid rgba(237, 79, 143, 0.3);
  border-radius: var(--radius-sm);
  background: rgba(237, 79, 143, 0.06);
}

.setup-alt-path {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.5);
}

.setup-alt-path summary {
  cursor: pointer;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.setup-alt-path p {
  margin: 8px 0 0;
}

.setup-first-run-steps {
  margin: 8px 0 12px;
  padding-left: 1.2rem;
}

.setup-free-callout {
  margin: 12px 0 16px;
  padding: 12px 14px;
  border: 1px solid rgba(124, 92, 255, 0.25);
  border-radius: var(--radius-sm);
  background: rgba(124, 92, 255, 0.06);
}

.howto-table-compact td,
.howto-table-compact th {
  padding: 6px 8px;
  font-size: 11px;
}

.palette-section-label {
  margin: 4px 0 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.block-palette-ai {
  margin-bottom: 10px;
}

.cred-inline-add {
  margin-top: 6px;
  min-height: 32px;
  padding: 0 10px;
  font-size: 11px;
}

.connect-engine-options {
  display: grid;
  gap: 8px;
  margin: 12px 0 4px;
}

.connect-engine-options .primary-button {
  width: 100%;
}

.template-card .card-cta {
  display: block;
  margin-top: 6px;
  color: var(--rose);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.workflow-empty {
  display: grid;
  gap: 12px;
  padding: 16px 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-sm);
  text-align: center;
  background: var(--panel-soft);
}

.workflow-empty p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.panel h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.template-list,
.block-palette {
  display: grid;
  gap: 8px;
}

.template-card,
.palette-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--ink);
  text-align: left;
  background: var(--panel);
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.template-card:hover,
.palette-card:hover,
.template-card.active {
  transform: translateY(-1px);
  border-color: var(--rose);
  background: var(--panel-soft);
  box-shadow: 0 8px 20px var(--rose-glow);
}

.template-card strong,
.palette-card strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.template-card span,
.palette-card span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.tile-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 12px;
  font-weight: 800;
  box-shadow: inset 0 -6px 14px rgba(0, 0, 0, 0.08);
}

.workspace {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  padding: 20px 22px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  min-width: 0;
  padding-bottom: 16px;
}

.topbar h2 {
  margin: 0;
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 600;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--ink), var(--rose-dark));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.workspace-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.workspace-meta span,
.status-link {
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 4px 10px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.7);
}

.status-link {
  cursor: pointer;
  font: inherit;
  transition: border-color 160ms ease, color 160ms ease;
}

.status-link:hover {
  border-color: var(--rose);
  color: var(--rose-dark);
}

.howto-steps {
  display: grid;
  gap: 10px;
  margin: 16px 0;
}

.howto-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.75);
  text-align: left;
}

.howto-step-num {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: white;
  font-size: 12px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--rose), var(--lavender));
}

.howto-step strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 13px;
}

.howto-step span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.pages-banner-steps {
  flex: 1 1 100%;
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.howto-section-title {
  margin: 18px 0 8px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
}

.howto-table {
  width: 100%;
  margin: 12px 0 4px;
  border-collapse: collapse;
  font-size: 12px;
}

.howto-table th,
.howto-table td {
  padding: 8px 10px;
  border: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.howto-table th {
  color: var(--ink);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.85);
}

.howto-table td {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
}

.setup-drawer {
  border-color: rgba(155, 142, 196, 0.35);
  background: linear-gradient(180deg, #faf8ff, #f5f2fc);
}

.setup-drawer-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  color: var(--ink);
}

.setup-drawer-summary::-webkit-details-marker {
  display: none;
}

.setup-drawer-body {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.setup-status {
  margin: 0;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.45;
}

.setup-status-ok {
  border: 1px solid rgba(168, 216, 200, 0.8);
  background: rgba(168, 216, 200, 0.15);
  color: var(--ink);
}

.setup-status-warn {
  border: 1px solid rgba(232, 200, 122, 0.8);
  background: rgba(232, 200, 122, 0.12);
  color: var(--ink);
}

.setup-mini-steps {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.setup-mini-steps li + li {
  margin-top: 6px;
}

.setup-keys-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.setup-drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.setup-guide-cta {
  width: 100%;
  margin-top: 10px;
}

.guide-inline-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--rose-dark);
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}

.guide-inline-link:hover {
  color: var(--rose);
}

.howto-code {
  margin: 12px 0 4px;
  padding: 12px 14px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-family: ui-monospace, "Cascadia Code", "Consolas", monospace;
  font-size: 11px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  background: rgba(255, 255, 255, 0.9);
}

.key-quick-local {
  border-color: rgba(168, 216, 200, 0.9);
  background: rgba(168, 216, 200, 0.15);
}

.howto-code-label,
.setup-path-label {
  margin: 14px 0 6px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.howto-checklist {
  margin: 12px 0;
  padding: 12px 14px;
  border: 1px solid rgba(168, 216, 200, 0.7);
  border-radius: var(--radius-sm);
  background: rgba(168, 216, 200, 0.1);
}

.howto-checklist-title {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.howto-checklist-steps {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.howto-checklist-steps li + li {
  margin-top: 8px;
}

.howto-troubleshoot {
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.65);
}

.howto-troubleshoot-list {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.howto-troubleshoot-list li + li {
  margin-top: 6px;
}

.panel-hint .guide-inline-link {
  font-size: inherit;
}

.howto-table-sub {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
}

.howto-table-ai td {
  font-size: 11px;
  line-height: 1.45;
}

.ai-provider-grid {
  display: grid;
  gap: 10px;
  margin: 10px 0 4px;
}

.ai-provider-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.8);
  text-align: left;
}

.ai-provider-card-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.ai-provider-card-note {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.ai-provider-card-steps {
  margin: 0 0 10px;
  padding-left: 18px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.ai-provider-card-steps li + li {
  margin-top: 4px;
}

.ai-free-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  color: var(--ink);
  font-size: 10px;
  font-weight: 700;
  background: rgba(168, 216, 200, 0.35);
  border: 1px solid rgba(168, 216, 200, 0.8);
}

.ai-free-badge-sm {
  font-size: 9px;
  padding: 1px 6px;
  vertical-align: middle;
}

.setup-ai-list {
  margin: 0;
  padding-left: 0;
  list-style: none;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.setup-ai-list li + li {
  margin-top: 6px;
}

.key-provider-pick {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px;
  margin-bottom: 10px;
}

.key-provider-select {
  width: 100%;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 600;
  background: var(--panel);
}

.ai-provider-tabs {
  margin: 12px 0 4px;
}

.ai-tab-dropdown-label {
  display: grid;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.ai-tab-dropdown {
  width: 100%;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.9);
}

.ai-tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.ai-tab {
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.75);
  cursor: pointer;
  transition: border-color 160ms ease, color 160ms ease, background 160ms ease;
}

.ai-tab:hover {
  border-color: var(--rose);
  color: var(--rose-dark);
}

.ai-tab.active {
  border-color: var(--rose);
  color: var(--ink);
  background: var(--panel-soft);
  box-shadow: 0 2px 10px var(--rose-glow);
}

.ai-tab-panels {
  display: grid;
}

.ai-tab-panel {
  display: none;
}

.ai-tab-panel.active {
  display: block;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.primary-button,
.ghost-button,
.icon-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  transition: all 180ms ease;
}

.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 16px;
  font-size: 12px;
  font-weight: 700;
}

.primary-button {
  position: relative;
  overflow: hidden;
  color: white;
  background: linear-gradient(135deg, var(--rose), var(--lavender));
  box-shadow: 0 8px 20px var(--rose-glow);
  animation: btn-glow 3s ease-in-out infinite;
}

@keyframes btn-glow {
  0%, 100% { box-shadow: 0 8px 20px var(--rose-glow); }
  50% { box-shadow: 0 8px 32px rgba(232, 115, 154, 0.35), 0 0 40px rgba(184, 169, 212, 0.15); }
}

.primary-button::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent 20%, rgba(255,255,255,0.15) 50%, transparent 80%);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.primary-button:hover::after {
  transform: translateX(100%);
}

.primary-button:hover {
  box-shadow: 0 12px 28px var(--rose-glow);
  transform: translateY(-1px);
}

.ghost-button,
.icon-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--line);
}

.ghost-button:hover,
.icon-button:hover {
  border-color: var(--rose);
  background: var(--panel-soft);
}

.icon-button {
  display: grid;
  width: 38px;
  padding: 0;
  place-items: center;
  font-size: 16px;
  font-weight: 700;
}

.icon-button.danger {
  color: var(--danger);
}

.board-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: var(--radius);
  background:
    linear-gradient(rgba(255, 255, 255, 0.55), rgba(255, 248, 252, 0.45)),
    repeating-linear-gradient(0deg, transparent 0 44px, rgba(184, 169, 212, 0.09) 44px 45px),
    repeating-linear-gradient(90deg, transparent 0 44px, rgba(232, 115, 154, 0.06) 44px 45px),
    linear-gradient(135deg, #fdf5f7 0%, #f9f0f7 50%, #faf0ee 100%);
  box-shadow: var(--shadow-md), 0 0 60px rgba(232, 115, 154, 0.08);
  transition: box-shadow 400ms ease;
}

.board-wrap.board-running {
  box-shadow: var(--shadow-md), 0 0 80px rgba(168, 216, 200, 0.25);
  border-color: rgba(168, 216, 200, 0.4);
}

.board-wrap::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 30%, rgba(232, 115, 154, 0.03) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 70%, rgba(184, 169, 212, 0.04) 0%, transparent 60%);
  pointer-events: none;
  z-index: 0;
}

.board-toolbar {
  position: absolute;
  z-index: 5;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  pointer-events: none;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 0 14px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 12px rgba(58, 42, 56, 0.06);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 3px rgba(168, 216, 200, 0.2);
  animation: dot-pulse 2s ease-in-out infinite;
}

@keyframes dot-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 3px rgba(168, 216, 200, 0.2); }
  50% { transform: scale(1.2); box-shadow: 0 0 0 6px rgba(168, 216, 200, 0.35); }
}

.board-running .status-dot {
  background: var(--rose);
  animation: dot-run 0.8s ease-in-out infinite;
}

@keyframes dot-run {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hint {
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 7px 12px;
  color: var(--muted);
  font-size: 11px;
  background: rgba(255, 255, 255, 0.8);
}

.board {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 0;
  height: 100%;
  overflow: auto;
  z-index: 1;
  scroll-behavior: smooth;
}

.canvas-empty {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(255, 251, 252, 0.72);
  backdrop-filter: blur(4px);
}

.canvas-empty-card {
  display: grid;
  gap: 12px;
  max-width: 360px;
  padding: 28px 24px;
  border: 1px dashed var(--rose);
  border-radius: var(--radius);
  text-align: center;
  background: var(--panel);
  box-shadow: var(--shadow-md);
}

.canvas-empty-icon {
  display: grid;
  width: 56px;
  height: 56px;
  margin: 0 auto;
  place-items: center;
  border-radius: var(--radius);
  color: white;
  font-size: 28px;
  background: linear-gradient(135deg, var(--rose), var(--lavender));
}

.canvas-empty-card h3 {
  margin: 0;
  font-size: 20px;
  color: var(--ink);
}

.canvas-empty-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.connections {
  position: absolute;
  inset: 0;
  width: 100%;
  min-width: 100%;
  height: 100%;
  min-height: 420px;
  pointer-events: none;
}

.connection-line {
  fill: none;
  stroke: var(--lavender);
  stroke-linecap: round;
  stroke-width: 3;
  cursor: pointer;
  transition: stroke 180ms ease, stroke-width 180ms ease;
}

.board-running .connection-line {
  stroke: url(#flowGradient);
  stroke-dasharray: 10 6;
  animation: flow-dash 1.2s linear infinite;
}

@keyframes flow-dash {
  to { stroke-dashoffset: -32; }
}

.connection-line:hover {
  stroke: var(--danger);
  stroke-width: 4;
  opacity: 0.8;
}

.nodes {
  position: relative;
  width: 100%;
  min-width: 100%;
  min-height: 420px;
}

.node {
  position: absolute;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr);
  gap: 14px;
  width: 330px;
  min-height: 150px;
  border: 1px solid var(--line);
  border-top: 3px solid var(--rose);
  border-radius: var(--radius);
  padding: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(255, 249, 251, 0.95));
  box-shadow:
    0 4px 16px rgba(58, 42, 56, 0.06),
    0 12px 32px rgba(58, 42, 56, 0.04);
  user-select: none;
  touch-action: none;
  transition: box-shadow 200ms ease, border-color 200ms ease;
}

.node:hover {
  box-shadow:
    0 6px 24px rgba(58, 42, 56, 0.08),
    0 16px 40px rgba(58, 42, 56, 0.06);
}

.node.selected {
  border-color: var(--rose);
  box-shadow:
    0 0 0 3px var(--rose-glow),
    0 8px 28px rgba(58, 42, 56, 0.1);
}

.node-icon {
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 15px;
  font-weight: 800;
  box-shadow: inset 0 -8px 18px rgba(0, 0, 0, 0.08);
}

.node-kicker {
  overflow: hidden;
  margin-bottom: 3px;
  color: var(--rose-dark);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node h3 {
  overflow: hidden;
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.node p {
  display: -webkit-box;
  overflow: hidden;
  min-height: 38px;
  margin: 6px 0 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.node-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.node-port {
  width: 10px;
  height: 10px;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 1px rgba(58, 42, 56, 0.12);
}

.node-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.meta-chip {
  border: 1px solid var(--line);
  border-radius: var(--radius-full);
  padding: 3px 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  background: rgba(255, 255, 255, 0.8);
}

.guide-panel {
  border-color: rgba(232, 115, 154, 0.35);
  background: linear-gradient(180deg, #fff8fa, #fff3f7);
}

.guide-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  background: rgba(255, 255, 255, 0.75);
  transition: border-color 180ms ease, background 180ms ease, color 180ms ease;
}

.guide-step.done {
  border-color: rgba(168, 216, 200, 0.8);
  color: var(--ink);
  background: rgba(168, 216, 200, 0.12);
}

.guide-step.active {
  border-color: var(--rose);
  color: var(--ink);
  background: var(--panel-soft);
  box-shadow: 0 4px 16px var(--rose-glow);
}

.guide-check {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  color: white;
  font-size: 11px;
  font-weight: 800;
  background: var(--line-strong);
}

.guide-step.done .guide-check {
  content: "✓";
  background: var(--mint);
}

.guide-step.active .guide-check {
  background: linear-gradient(135deg, var(--rose), var(--lavender));
}

.inspector-card {
  min-height: 400px;
}

.inspector-empty {
  display: grid;
  min-height: 340px;
  place-items: center;
  align-content: center;
  gap: 12px;
  color: var(--muted);
  text-align: center;
}

.inspector-empty h2 {
  margin: 0;
  color: var(--ink);
  font-size: 20px;
  font-weight: 600;
}

.inspector-empty p {
  max-width: 230px;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}

.empty-mark {
  display: grid;
  width: 60px;
  height: 60px;
  place-items: center;
  border-radius: var(--radius);
  color: white;
  font-size: 28px;
  background: linear-gradient(135deg, var(--mint), var(--rose));
  box-shadow: 0 8px 20px rgba(168, 216, 200, 0.2);
  animation: empty-float 4s ease-in-out infinite;
}

@keyframes empty-float {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-8px) rotate(5deg); }
}

.inspector-form {
  display: grid;
  gap: 14px;
}

.hidden {
  display: none;
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--ink);
  font-size: 13px;
  background: var(--panel);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}

textarea {
  resize: vertical;
  min-height: 120px;
  line-height: 1.5;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--rose);
  box-shadow: 0 0 0 3px var(--rose-glow);
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.run-panel {
  min-height: 170px;
}

.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--mint);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.chat-badge span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--mint);
  box-shadow: 0 0 0 3px rgba(168, 216, 200, 0.2);
}

.chat-log {
  display: flex;
  flex-direction: column;
  gap: 6px;
  overflow-y: auto;
  max-height: 160px;
  min-height: 40px;
  padding: 2px 0;
}

.chat-msg {
  max-width: 88%;
  border-radius: var(--radius-sm);
  padding: 7px 10px;
  font-size: 12px;
  line-height: 1.4;
  word-break: break-word;
}

.chat-msg-user {
  align-self: flex-end;
  color: white;
  background: linear-gradient(135deg, var(--rose), var(--lavender));
}

.chat-msg-bot {
  align-self: flex-start;
  border: 1px solid var(--line);
  color: var(--ink);
  background: rgba(255, 249, 251, 0.9);
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr 38px;
  gap: 6px;
  align-items: center;
}

.chat-form input {
  margin: 0;
}

.chat-send-btn {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: none;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 18px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--rose), var(--lavender));
  box-shadow: 0 4px 12px var(--rose-glow);
  transition: opacity 160ms ease, transform 120ms ease;
}

.chat-send-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.chat-send-btn:active {
  transform: translateY(0);
}

.run-log {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.run-log li.active {
  color: var(--rose-dark);
  font-weight: 700;
}

.run-log li.completed {
  color: var(--mint);
}

.run-log li.error {
  color: var(--danger);
  font-weight: 700;
}

.node-result {
  margin: 4px 0 6px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: 10px;
  line-height: 1.3;
  word-break: break-all;
  max-height: 36px;
  overflow: hidden;
}

.result-success {
  background: rgba(168, 216, 200, 0.12);
  color: #5a9e8a;
  border: 1px solid rgba(168, 216, 200, 0.2);
}

.result-error {
  background: rgba(212, 90, 120, 0.08);
  color: var(--danger);
  border: 1px solid rgba(212, 90, 120, 0.15);
}

#nodeConfig {
  display: grid;
  gap: 10px;
  margin-top: 6px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.node-handles {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.node-handle {
  position: absolute;
  width: 12px;
  height: 12px;
  border: 2px solid #fff;
  border-radius: 50%;
  pointer-events: all;
  cursor: crosshair;
  z-index: 3;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
  opacity: 0.6;
}

.node-handle-input {
  top: 77px;
  left: -8px;
  background: var(--violet);
  box-shadow: 0 0 0 1px rgba(155, 142, 196, 0.3);
}

.node-handle-output {
  top: 77px;
  right: -8px;
  background: var(--mint);
  box-shadow: 0 0 0 1px rgba(168, 216, 200, 0.3);
}

.node-handle:hover {
  opacity: 1;
  transform: scale(1.4);
  box-shadow: 0 0 0 4px var(--rose-glow);
}

.node-handle.drag-over {
  opacity: 1;
  transform: scale(1.6);
  background: var(--rose);
  box-shadow: 0 0 0 6px var(--rose-glow);
}

.connection-dragging {
  fill: none;
  stroke: var(--rose);
  stroke-linecap: round;
  stroke-width: 3;
  stroke-dasharray: 7 4;
  opacity: 0.8;
  pointer-events: none;
}

.webhook-url {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.webhook-url input {
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-size: 11px;
  background: var(--panel-soft);
}

.webhook-hint {
  margin: 8px 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.webhook-hint code {
  font-size: 10px;
  color: var(--rose-dark);
}

.pages-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 12px;
  line-height: 1.45;
  background: linear-gradient(90deg, var(--panel-soft), rgba(255, 251, 252, 0.9));
}

.pages-banner strong {
  color: var(--rose-dark);
}

.danger-button {
  min-height: 38px;
  padding: 0 16px;
  border: 1px solid var(--danger);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 12px;
  font-weight: 700;
  background: rgba(212, 90, 120, 0.06);
}

@media (max-width: 1100px) {
  .app-shell {
    grid-template-columns: minmax(240px, 280px) minmax(0, 1fr);
  }

  .inspector {
    grid-column: 1 / -1;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .topbar h2 {
    font-size: 36px;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr;
    height: auto;
    max-height: none;
    overflow: visible;
  }

  .workspace {
    order: 1;
    flex: 0 0 auto;
    min-height: 58vh;
    padding: 14px;
  }

  .sidebar {
    order: 2;
    flex: 1 1 auto;
    max-height: 42vh;
    overflow-y: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    padding: 14px;
  }

  .inspector {
    order: 3;
    padding: 14px;
  }

.panel-palette {
  max-height: 220px;
  overflow: auto;
}

.palette-drawer {
  border: none;
  padding: 0;
  background: transparent;
}

.palette-drawer-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  padding: 0 2px;
  list-style: none;
  cursor: pointer;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.palette-drawer-summary::-webkit-details-marker {
  display: none;
}

.palette-drawer-summary .panel-hint {
  margin: 0;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
}

.palette-drawer[open] .palette-drawer-summary {
  margin-bottom: 12px;
}

.canvas-empty-card .warn-steps {
  margin: 0;
  color: var(--rose-dark);
  font-size: 12px;
  font-weight: 600;
}

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .topbar h2 {
    font-size: 30px;
    white-space: normal;
  }

  .topbar-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .primary-button,
  .ghost-button {
    flex: 1 1 140px;
  }

  .board-wrap,
  .board {
    min-height: 560px;
  }

  .hint {
    display: none;
  }
}

@media (max-width: 520px) {
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .brand h1 {
    font-size: 22px;
  }

  .panel {
    padding: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ===== Onboarding ===== */
.onboarding {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
}

.onboarding.hidden {
  display: none;
}

.onboarding-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: rgba(58, 42, 56, 0.35);
  backdrop-filter: blur(8px);
  animation: fade-in 280ms ease;
}

.onboarding-card {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: min(90vh, 720px);
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: 32px 28px 28px;
  background: linear-gradient(180deg, #fffbfc 0%, #fdf5f7 100%);
  box-shadow: var(--shadow-lg);
  animation: slide-up 320ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(24px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.onboarding-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
}

.onboarding-dot {
  flex: 1;
  height: 4px;
  border-radius: var(--radius-full);
  background: var(--line);
  transition: background 300ms ease, transform 300ms ease;
}

.onboarding-dot.active {
  background: linear-gradient(90deg, var(--rose), var(--lavender));
  transform: scaleY(1.3);
}

.onboarding-dot.done {
  background: var(--mint);
}

.onboarding-hero {
  display: grid;
  place-items: center;
  gap: 16px;
  margin-bottom: 24px;
  text-align: center;
}

.onboarding-hero-mark {
  display: grid;
  width: 72px;
  height: 72px;
  place-items: center;
  border-radius: 18px;
  color: white;
  font-size: 36px;
  background: linear-gradient(135deg, var(--rose), var(--lavender));
  box-shadow: 0 12px 32px var(--rose-glow);
  animation: rose-pulse 3s ease-in-out infinite;
}

.onboarding-title {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--rose-dark), var(--lavender));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.onboarding-subtitle {
  margin: 0;
  max-width: 380px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
}

.onboarding-steps {
  display: grid;
  gap: 10px;
  margin: 20px 0 24px;
}

.onboarding-step {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.7);
}

.onboarding-step-num {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  color: white;
  font-size: 14px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--rose), var(--lavender));
}

.onboarding-step strong {
  display: block;
  font-size: 13px;
  color: var(--ink);
}

.onboarding-step span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.onboarding-choices {
  display: grid;
  gap: 10px;
  margin: 20px 0 24px;
}

.onboarding-choice {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: left;
  color: var(--ink);
  background: var(--panel);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease;
}

.onboarding-choice:disabled {
  opacity: 0.6;
  cursor: wait;
  transform: none;
}

.onboarding-choice:hover {
  transform: translateY(-2px);
  border-color: var(--rose);
  box-shadow: 0 8px 24px var(--rose-glow);
}

.onboarding-choice-hint {
  display: block;
  margin: 14px 0 4px;
  color: var(--rose-dark);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.onboarding-choice-cta {
  display: inline-block;
  margin-top: 6px;
  color: var(--rose);
  font-size: 11px;
  font-weight: 700;
}

.onboarding-choice-icon {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: var(--radius-sm);
  color: white;
  font-size: 18px;
  background: linear-gradient(135deg, var(--rose), var(--lavender));
}

.onboarding-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.onboarding-actions .ghost-button,
.onboarding-actions .primary-button {
  min-width: 100px;
}

.template-card .template-badge,
.picker-card .template-badge {
  display: inline-block;
  margin-top: 4px;
  border-radius: var(--radius-full);
  padding: 2px 8px;
  color: var(--rose-dark);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--rose-glow);
}

.picker-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.picker-card {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  color: var(--ink);
  text-align: left;
  background: var(--panel);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.picker-card:hover {
  transform: translateY(-2px);
  border-color: var(--rose);
  background: var(--panel-soft);
  box-shadow: 0 10px 24px var(--rose-glow);
}

.picker-card strong {
  display: block;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker-card > span > span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.picker-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0 8px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.picker-divider::before,
.picker-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

/* ===== Palette drag ===== */
.palette-card {
  cursor: grab;
  touch-action: none;
}

.palette-card:active {
  cursor: grabbing;
}

.palette-card.dragging-source {
  opacity: 0.45;
  transform: scale(0.96);
}

.palette-ghost {
  position: fixed;
  z-index: 900;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 10px;
  width: 220px;
  border: 2px solid var(--rose);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  pointer-events: none;
  background: var(--panel-soft);
  box-shadow: 0 16px 40px var(--rose-glow);
  transform: translate(-50%, -50%);
  animation: ghost-pop 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes ghost-pop {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.board.drop-active {
  outline: 2px dashed var(--rose);
  outline-offset: -6px;
  background-color: rgba(232, 115, 154, 0.03);
}

.board.drop-target {
  outline-color: var(--mint);
}

/* ===== Node animations ===== */
@keyframes node-spawn {
  0% { opacity: 0; transform: translate(var(--spawn-x, 0), var(--spawn-y, 0)) scale(0.85); }
  60% { transform: translate(var(--spawn-x, 0), var(--spawn-y, 0)) scale(1.03); }
  100% { opacity: 1; transform: translate(var(--spawn-x, 0), var(--spawn-y, 0)) scale(1); }
}

.node.node-spawn {
  animation: node-spawn 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes connection-snap {
  0% { stroke-width: 5; stroke: var(--rose); }
  100% { stroke-width: 3; stroke: var(--lavender); }
}

.connection-line.just-connected {
  animation: connection-snap 400ms ease;
}

/* ===== Modal ===== */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1100;
  display: grid;
  place-items: center;
  padding: 20px;
}

.modal.hidden { display: none; }

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(58, 42, 56, 0.35);
  backdrop-filter: blur(6px);
}

.modal-card {
  position: relative;
  width: min(480px, 100%);
  max-height: 90vh;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  padding: 20px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
}

.modal-card.modal-wide {
  width: min(680px, 100%);
}

@media (max-width: 520px) {
  .picker-grid {
    grid-template-columns: 1fr;
  }
}

.modal-card form {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 8px;
}

.credential-form-grid {
  display: grid;
  gap: 10px;
}

.run-state.success-pulse {
  color: var(--mint);
  animation: success-pulse 600ms ease;
}

@keyframes success-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

/* ===== Toasts ===== */
.toast-host {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 1200;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 40px));
  pointer-events: none;
}

.toast {
  padding: 12px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  background: var(--panel);
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 220ms ease, transform 220ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.toast-success {
  border-color: rgba(168, 216, 200, 0.9);
  background: linear-gradient(180deg, #f8fffc, #f0faf6);
}

.toast-info {
  border-color: rgba(232, 115, 154, 0.35);
  background: linear-gradient(180deg, #fffbfc, #fff5f8);
}
