/**
 * UtafitiLog theme — loaded after bootstrap.min.css and style.css.
 * Field palette: canopy green, maize yellow (brand), leaf green for links.
 */

:root {
  --canopy: #173f2e;
  --canopy-2: #21543e;
  --maize: #f7b500;
  --maize-strong: #e0a300;
  --leaf: #2e7d4f;
  --leaf-soft: #e3efe6;
  --paper: #f3f5f0;
  --surface: #ffffff;
  --line: #d9dfd6;
  --ink: #1b2420;
  --muted: #5c6a62;
  --danger: #b3261e;

  --font-display: 'Bricolage Grotesque', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Atkinson Hyperlegible', 'Segoe UI', system-ui, sans-serif;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 2px rgba(23, 63, 46, 0.06), 0 4px 16px rgba(23, 63, 46, 0.06);
}

/* ---------- Base ---------- */

html,
body {
  height: auto;
}

body {
  min-height: 100vh;
}

body {
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 1rem;
  line-height: 1.55;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

body.bg-lightgrey {
  background: var(--paper);
}

h1, h2, h3, h4, h5, h6,
.h1, .h2, .h3, .h4, .h5, .h6 {
  font-family: var(--font-display);
  font-weight: 650;
  color: inherit;
  letter-spacing: -0.01em;
  line-height: 1.15;
}

h1, .h1 { font-size: 2.25rem; }
h2, .h2 { font-size: 1.75rem; }
h3, .h3 { font-size: 1.375rem; }
h4, .h4 { font-size: 1.125rem; }

b, strong { font-weight: 700; }

a {
  color: var(--leaf);
}
a:hover {
  color: var(--canopy);
}

.text-muted {
  color: var(--muted) !important;
}

:focus-visible {
  outline: 3px solid var(--maize);
  outline-offset: 2px;
}

main {
  flex: 1 0 auto;
}

/* ---------- Buttons ---------- */

.btn {
  border-radius: var(--radius-sm);
  font-weight: 700;
  padding: 0.5rem 1rem;
  transition: background-color 0.15s, border-color 0.15s, color 0.15s;
}

.btn-lg {
  padding: 0.75rem 1.4rem;
  font-size: 1.05rem;
}

.btn-sm {
  padding: 0.3rem 0.65rem;
}

.btn-warning,
.btn-primary-action {
  background: var(--maize);
  border-color: var(--maize);
  color: var(--canopy);
}
.btn-warning:hover,
.btn-warning:focus,
.btn-primary-action:hover,
.btn-primary-action:focus {
  background: var(--maize-strong);
  border-color: var(--maize-strong);
  color: var(--canopy);
}

.btn-success,
.btn-primary {
  background: var(--leaf);
  border-color: var(--leaf);
  color: #fff;
}
.btn-success:hover,
.btn-success:focus,
.btn-primary:hover,
.btn-primary:focus {
  background: var(--canopy-2);
  border-color: var(--canopy-2);
  color: #fff;
}

.btn-dark,
.btn-secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--ink);
}
.btn-dark:hover,
.btn-dark:focus,
.btn-secondary:hover,
.btn-secondary:focus {
  background: var(--paper);
  border-color: #c5cec2;
  color: var(--ink);
}

.btn-ghost {
  background: transparent;
  border: 1px solid currentColor;
  color: inherit;
}
.btn-ghost:hover {
  background: rgba(23, 63, 46, 0.06);
  color: inherit;
}

.btn-link {
  color: var(--leaf);
  font-weight: 700;
}

/* ---------- Forms ---------- */

label {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
}

.form-control,
.custom-select {
  border-radius: var(--radius-sm);
  border: 1px solid #c5cec2;
  min-height: 2.75rem;
  color: var(--ink);
}

.form-control:focus,
.custom-select:focus {
  border-color: var(--leaf);
  box-shadow: 0 0 0 3px rgba(46, 125, 79, 0.2);
}

textarea.form-control {
  min-height: 6rem;
}

.form-text {
  color: var(--muted);
}

.custom-file-label {
  border-radius: var(--radius-sm);
  min-height: 2.75rem;
  display: flex;
  align-items: center;
}

.custom-file-label::after {
  height: 100%;
  display: flex;
  align-items: center;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

/* ---------- Cards, alerts, tables ---------- */

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.card-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
}

.alert {
  border-radius: var(--radius-sm);
  border-width: 0 0 0 4px;
}
.alert-danger {
  background: #fbeceb;
  border-color: var(--danger);
  color: #6f1813;
}
.alert-success {
  background: var(--leaf-soft);
  border-color: var(--leaf);
  color: var(--canopy);
}
.alert-warning {
  background: #fff6dc;
  border-color: var(--maize);
  color: #5a4300;
}

.table {
  color: var(--ink);
}
.table thead th {
  border-top: 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: 700;
}
.table td {
  border-top: 1px solid var(--line);
  vertical-align: middle;
}

.modal-content {
  border: 0;
  border-radius: var(--radius-lg);
  box-shadow: 0 24px 64px rgba(23, 63, 46, 0.25);
}
.modal-header,
.modal-footer {
  border-color: var(--line);
  padding: 1.1rem 1.5rem;
}
.modal-body {
  padding: 1.5rem;
}
.modal-title {
  font-size: 1.25rem;
}

.dropdown-menu {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 0.4rem;
}
.dropdown-item {
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
}
.dropdown-item:active,
.dropdown-item.active {
  background: var(--leaf-soft);
  color: var(--canopy);
}

/* ---------- Top bar ---------- */

.topbar {
  background: var(--canopy);
  color: #fff;
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

.topbar .navbar-brand img {
  height: 26px;
}

.topbar .nav-link {
  color: rgba(255, 255, 255, 0.78);
  font-weight: 700;
  padding: 0.45rem 0.85rem !important;
  border-radius: var(--radius-sm);
}
.topbar .nav-link:hover,
.topbar .nav-link:focus {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
.topbar .nav-item.active > .nav-link,
.topbar .nav-link.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.topbar .navbar-toggler {
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--radius-sm);
}

.topbar .btn-warning {
  padding: 0.45rem 0.95rem;
}

.avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: var(--maize);
  color: var(--canopy);
  font-weight: 700;
  font-size: 0.9rem;
  text-transform: uppercase;
}

@media (max-width: 991.98px) {
  .topbar .navbar-collapse {
    padding: 0.75rem 0 0.25rem;
  }
  .topbar .navbar-nav .nav-link {
    padding: 0.65rem 0.75rem !important;
  }
}

/* ---------- Context bar (observatory / campaign) ---------- */

.contextbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.contextbar .crumbs {
  font-size: 0.875rem;
  color: var(--muted);
  padding-top: 1rem;
}
.contextbar .crumbs a {
  color: var(--muted);
}
.contextbar .crumbs a:hover {
  color: var(--leaf);
}
.contextbar .crumbs .sep {
  margin: 0 0.4rem;
  opacity: 0.6;
}

.contextbar .context-title {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.6rem 0 0.9rem;
}

.contextbar .context-title h1 {
  font-size: 1.6rem;
  margin: 0;
}

.contextbar .observatory-app-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background-size: cover;
  flex: 0 0 auto;
}

.context-icon {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--radius);
  background: var(--leaf-soft);
  color: var(--leaf);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  flex: 0 0 auto;
}

.context-tabs {
  display: flex;
  gap: 0.25rem;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow-x: auto;
}

.context-tabs a {
  display: block;
  padding: 0.7rem 0.9rem;
  color: var(--muted);
  font-weight: 700;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}
.context-tabs a:hover {
  color: var(--ink);
  text-decoration: none;
}
.context-tabs a.active {
  color: var(--canopy);
  border-bottom-color: var(--maize);
}

.contextbar.sub {
  background: var(--paper);
}

/* ---------- Page scaffolding ---------- */

.page {
  padding-top: 2rem;
  padding-bottom: 3rem;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.page-head h1 {
  margin: 0;
  font-size: 2rem;
}

.page-head p {
  margin: 0.35rem 0 0;
  color: var(--muted);
  max-width: 60ch;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.5rem;
}

.panel + .panel {
  margin-top: 1.25rem;
}

.panel-title {
  font-size: 1.15rem;
  margin-bottom: 1rem;
}

.prose {
  max-width: 72ch;
}

.prose > :last-child {
  margin-bottom: 0;
}

/* ---------- Tiles (observatory / campaign lists) ---------- */

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1.25rem;
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.25rem;
  color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.tile:hover,
.tile:focus-within {
  border-color: var(--leaf);
  box-shadow: var(--shadow);
}

.tile-head {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 0.75rem;
}

.tile-thumb {
  width: 3.5rem;
  height: 3.5rem;
  border-radius: var(--radius);
  background-color: var(--paper);
  background-size: cover;
  background-position: center;
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

.tile h2 {
  font-size: 1.15rem;
  margin: 0;
}

/* whole tile is clickable via the title link */
.tile h2 a {
  color: inherit;
}
.tile h2 a::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
}
.tile h2 a:hover {
  text-decoration: none;
}

.tile p {
  color: var(--muted);
  margin: 0;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.tile-meta {
  margin-top: auto;
  padding-top: 1rem;
  font-size: 0.875rem;
  color: var(--leaf);
  font-weight: 700;
}

.empty-state {
  background: var(--surface);
  border: 1px dashed #bfc9bc;
  border-radius: var(--radius);
  padding: 3rem 1.5rem;
  text-align: center;
}
.empty-state .icon {
  font-size: 1.75rem;
  color: var(--leaf);
  margin-bottom: 0.75rem;
}
.empty-state h2 {
  font-size: 1.25rem;
}
.empty-state p {
  color: var(--muted);
  max-width: 46ch;
  margin: 0.5rem auto 1.25rem;
}

/* ---------- Dashboard area ---------- */

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 2rem 0 1rem;
}
.section-title h2 {
  font-size: 1.25rem;
  margin: 0;
}

#dashboard .card {
  box-shadow: none;
}

.live-dot {
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--leaf);
  margin-right: 0.4rem;
  vertical-align: middle;
}

/* ---------- Auth ---------- */

.auth {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  flex: 1 0 auto;
  min-height: calc(100vh - 66px);
}

.auth-form {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.25rem;
  background: var(--surface);
}

.auth-form form {
  width: 100%;
  max-width: 380px;
}

.auth-form h1 {
  font-size: 1.9rem;
  margin-bottom: 0.4rem;
}

.auth-form .lede {
  color: var(--muted);
  margin-bottom: 1.75rem;
}

.auth-form .form-group {
  margin-bottom: 1.1rem;
}

.auth-alt {
  margin-top: 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
  color: var(--muted);
}

.auth-art {
  background-size: cover;
  background-position: center;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 2.5rem;
  color: #fff;
}
.auth-art::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(23, 63, 46, 0.85), rgba(23, 63, 46, 0) 60%);
}
.auth-art p {
  position: relative;
  font-family: var(--font-display);
  font-size: 1.5rem;
  line-height: 1.25;
  max-width: 24ch;
  margin: 0;
}

@media (max-width: 767.98px) {
  .auth {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  .auth-art {
    display: none;
  }
}

/* ---------- Public site ---------- */

.hero {
  background: var(--paper);
  padding: 4.5rem 0 4rem;
  overflow: hidden;
}

.hero h1 {
  font-size: clamp(2.4rem, 5.2vw, 4rem);
  font-weight: 700;
  line-height: 1.02;
  letter-spacing: -0.03em;
  color: var(--canopy);
  max-width: 13ch;
  margin-bottom: 1.25rem;
}

.hero .lede {
  font-size: 1.15rem;
  color: #34433b;
  max-width: 46ch;
  margin-bottom: 2rem;
}

.hero .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.hero .footnote {
  margin-top: 1.75rem;
  font-size: 0.9rem;
  color: var(--muted);
}

/* Pipeline diagram: collect -> process -> see */
.pipeline {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 44px auto 44px minmax(0, 1.15fr);
  align-items: center;
  padding: 1.75rem 1.5rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.pipe-col {
  display: flex;
  justify-content: center;
}

.pipe-caption {
  margin-top: 0.9rem;
  font-size: 0.85rem;
  color: var(--muted);
  text-align: center;
}

.pipe-phone {
  background: var(--canopy);
  color: #fff;
  border-radius: 22px;
  padding: 0.9rem 0.75rem 0.9rem;
  width: 100%;
  max-width: 190px;
}
.pipe-phone .notch {
  width: 36px;
  height: 4px;
  border-radius: 4px;
  margin: 0 auto 0.8rem;
  background: rgba(255, 255, 255, 0.3);
}
.pipe-phone .q {
  background: rgba(255, 255, 255, 0.09);
  border-radius: 8px;
  padding: 0.4rem 0.6rem;
  margin-bottom: 0.4rem;
  font-size: 0.8rem;
  font-weight: 700;
}
.pipe-phone .q span {
  display: block;
  color: rgba(255, 255, 255, 0.62);
  font-size: 0.7rem;
  font-weight: 400;
}
.pipe-phone .send {
  margin-top: 0.6rem;
  background: var(--maize);
  color: var(--canopy);
  text-align: center;
  font-weight: 700;
  border-radius: 8px;
  padding: 0.4rem;
  font-size: 0.8rem;
}

.pipe-blocks {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}
.pipe-block {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}
.pipe-block i {
  color: var(--leaf);
  width: 1rem;
  text-align: center;
}

.pipe-wire {
  width: 44px;
  height: 130px;
  align-self: center;
}
.pipe-wire path {
  fill: none;
  stroke: var(--maize);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 5 6;
  animation: flow 1.4s linear infinite;
}

@keyframes flow {
  to {
    stroke-dashoffset: -22;
  }
}

.pipe-screen {
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #e9eee6;
  width: 100%;
}
.pipe-screen .head {
  background: var(--surface);
  padding: 0.45rem 0.65rem;
  font-size: 0.75rem;
  font-weight: 700;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pipe-screen svg {
  display: block;
  width: 100%;
  height: auto;
}

@media (max-width: 575.98px) {
  .pipeline {
    grid-template-columns: 1fr;
    gap: 1.25rem;
  }
  .pipe-wire,
  .pipe-caption {
    display: none;
  }
  .pipe-blocks {
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .pipe-wire path {
    animation: none;
  }
}

/* Steps */
.band {
  padding: 4.5rem 0;
}
.band-white {
  background: var(--surface);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.band h2 {
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  color: var(--canopy);
  max-width: 22ch;
}
.band .intro {
  color: var(--muted);
  max-width: 60ch;
  margin-bottom: 2.5rem;
}

.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem;
  counter-reset: step;
}
.steps li {
  counter-increment: step;
  border-top: 3px solid var(--canopy);
  padding-top: 1rem;
}
.steps li::before {
  content: counter(step);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2rem;
  color: var(--maize-strong);
  display: block;
  line-height: 1;
  margin-bottom: 0.75rem;
}
.steps h3 {
  font-size: 1.15rem;
}
.steps p {
  color: var(--muted);
  margin: 0;
}

@media (max-width: 991.98px) {
  .steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 575.98px) {
  .steps {
    grid-template-columns: 1fr;
  }
}

/* Photo strip */
.field-strip {
  min-height: 340px;
  background-size: cover;
  background-position: center 60%;
  display: flex;
  align-items: flex-end;
}
.field-strip .caption {
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1.5rem 1.75rem;
  max-width: 560px;
}
.field-strip .caption h2 {
  font-size: 1.4rem;
  color: var(--canopy);
}
.field-strip .caption p {
  color: var(--muted);
  margin: 0;
}

/* Features */
.features {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 2rem 2.25rem;
}
.feature i {
  color: var(--leaf);
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}
.feature h3 {
  font-size: 1.05rem;
  margin-bottom: 0.35rem;
}
.feature p {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0;
}
@media (max-width: 991.98px) {
  .features {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 575.98px) {
  .features {
    grid-template-columns: 1fr;
  }
}

/* Call to action */
.cta-band {
  background: var(--canopy);
  color: #fff;
  padding: 3.5rem 0;
}
.cta-band h2 {
  color: #fff;
  font-size: clamp(1.6rem, 3vw, 2.1rem);
  margin: 0 0 0.4rem;
}
.cta-band p {
  color: rgba(255, 255, 255, 0.75);
  margin: 0;
}
.cta-band .btn-ghost {
  color: #fff;
}
.cta-band .btn-ghost:hover {
  background: rgba(255, 255, 255, 0.1);
}

/* Footer */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding: 1.75rem 0;
  font-size: 0.9rem;
  color: var(--muted);
}
.site-footer .container {
  gap: 0.75rem 1.5rem;
}
.site-footer nav {
  display: flex;
  gap: 1.25rem;
}
.site-footer a {
  color: var(--muted);
}
.site-footer a:hover {
  color: var(--leaf);
}

/* Legacy website pages (tutorial, faq): calmer banners */
.banner,
.banner-small {
  min-height: 280px;
  position: relative;
}
.banner .bg-black-transparant,
.banner-small .bg-black-transparant {
  background: rgba(23, 63, 46, 0.88);
  border-radius: var(--radius);
}

#accordionExample .card {
  border-radius: var(--radius) !important;
  margin-bottom: 0.75rem;
  border: 1px solid var(--line) !important;
}
#accordionExample .card-header {
  border-bottom: 0;
  padding: 0.25rem 0.5rem;
}
#accordionExample .card-header .btn {
  text-align: left;
  white-space: normal;
  color: var(--ink);
}

/* ---------- Builder (visual programming editor) ---------- */

html:has(body.builder) {
  height: 100%;
}

body.builder {
  height: 100vh;
  min-height: 0;
  background: var(--paper);
}

body.builder #loadingWindow {
  color: var(--leaf);
  height: 100vh;
}

/* Toolbar */
body.builder .builder-bar {
  display: flex;
  align-items: stretch;
  background: var(--canopy);
  color: #fff;
  min-height: 56px;
  flex-shrink: 0;
}

body.builder .builder-bar a {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  cursor: pointer;
}

body.builder .builder-back {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 350px;
  padding: 0 1.25rem;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}
body.builder .builder-back span {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
  font-weight: 700;
  color: #fff;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
body.builder .builder-back small {
  font-weight: 400;
  color: rgba(255, 255, 255, 0.65);
}
body.builder .builder-back:hover span {
  text-decoration: underline;
}

body.builder .builder-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  list-style: none;
  margin: 0 auto;
  padding: 0;
}

body.builder .builder-actions > li > a {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.8rem;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
}
body.builder .builder-actions > li > a:hover,
body.builder .builder-actions > li > a:focus {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}
/* preview toggles mark their open state with .text-white */
body.builder .builder-actions > li > a.text-white {
  background: rgba(255, 255, 255, 0.16);
  box-shadow: inset 0 -3px 0 var(--maize);
}

body.builder .builder-badge {
  min-width: 1.4rem;
  padding: 0.25rem 0.4rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-family: var(--font-body);
}
body.builder .builder-badge:empty {
  display: none;
}
body.builder .builder-badge.btn-danger {
  background: #e5484d;
  color: #fff;
}
body.builder .builder-badge.btn-success {
  background: var(--leaf-soft);
  color: var(--canopy);
}

body.builder .builder-bar .dropdown-item {
  color: var(--ink);
  cursor: pointer;
}

body.builder .builder-menu-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 350px;
  justify-content: center;
  font-weight: 700;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}
body.builder .builder-menu-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}
body.builder .builder-menu-toggle.active {
  background: var(--surface);
  color: var(--canopy);
}

/* Canvas */
body.builder #canvas {
  background-color: var(--paper);
  background-image: radial-gradient(#c9d3c6 1px, transparent 1px);
  background-size: 22px 22px;
}

body.builder .component,
body.builder .component-rectangle {
  cursor: pointer;
}

body.builder .component-rectangle {
  border-radius: 9px;
  border-color: var(--canopy);
  transition: box-shadow 0.15s;
}
body.builder .component-rectangle-inner {
  border-radius: 7px;
}
body.builder .component:hover .component-rectangle {
  box-shadow: 0 0 0 3px rgba(247, 181, 0, 0.55);
}

body.builder .component-label {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
}

body.builder .ui-draggable-dragging,
body.builder .ui-draggable-dragging * {
  cursor: grabbing !important;
}

/* Component menu */
body.builder .component-menu-sidebar {
  background: var(--surface);
  border-left: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}

body.builder #component-menu {
  padding: 0.85rem 0.85rem 0 !important;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

body.builder .component-menu-tabs {
  display: flex;
  flex-wrap: nowrap;
  gap: 2px;
  padding: 3px !important;
  margin-bottom: 0.75rem;
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

body.builder .component-menu-tabs .nav-link {
  flex: 1 1 0;
  max-width: none;
  margin: 0;
  padding: 0.45rem 0.25rem;
  border-radius: 7px;
  color: var(--muted) !important;
  font-size: 0.8rem !important;
  line-height: 1.3;
  text-align: center;
  cursor: pointer;
}
body.builder .component-menu-tabs .nav-link i {
  font-size: 0.95rem;
  margin-bottom: 2px;
}
body.builder .component-menu-tabs .nav-link:hover {
  color: var(--ink) !important;
}
body.builder .component-menu-tabs .nav-link.active {
  background: var(--surface);
  color: var(--canopy) !important;
  box-shadow: 0 1px 3px rgba(23, 63, 46, 0.18);
}

body.builder #component-menu > .form-control {
  min-height: 2.5rem;
  padding-left: 2.1rem !important;
  background: var(--surface)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%235c6a62' stroke-width='1.8' stroke-linecap='round'%3E%3Ccircle cx='7' cy='7' r='4.5'/%3E%3Cpath d='M10.5 10.5 14 14'/%3E%3C/svg%3E")
    no-repeat 0.7rem center / 15px;
}

body.builder .component-menu-list-container {
  margin: 0;
  padding: 0 0.25rem 2rem 0;
  flex: 1 1 auto;
}

body.builder .component-menu-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 0.4rem 0.5rem;
  margin-bottom: 2px;
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s;
}
body.builder .component-menu-item:hover {
  background: var(--leaf-soft);
  border-color: #c3dccb;
}
body.builder .component-menu-item:active {
  cursor: grabbing;
}

body.builder .component-menu-item > i {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border-radius: 7px;
  background: var(--canopy);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
}

body.builder .component-menu-item-name {
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 400;
  padding-left: 0 !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* thin, light scrollbars inside the menu */
body.builder .component-menu-list-container::-webkit-scrollbar {
  width: 8px;
}
body.builder .component-menu-list-container::-webkit-scrollbar-thumb {
  background: #c9d3c6;
  border-radius: 8px;
}
body.builder .component-menu-list-container::-webkit-scrollbar-track {
  background: transparent;
}

/* Legend */
body.builder .legend {
  bottom: 12px !important;
  left: 12px !important;
  font-size: 0.8rem !important;
}
body.builder #legendContainerToggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  cursor: pointer;
  user-select: none;
}
body.builder #legendContainer {
  margin-bottom: 0.4rem !important;
  border-radius: var(--radius) !important;
}

/* Mobile preview reorder handle */
body.builder #live-preview-reorder-handle,
body.builder #live-preview-mobile-drag-handle {
  cursor: grab;
}

/* ---------- Flow canvas: card nodes, wires, dock ---------- */

body.builder {
  --lane-phone: #2e7d4f;
  --lane-server: #8a5a2b;
  --lane-campaign: #6d5bd0;
  --lane-dashboard: #c68a00;
}

/* Node card */
body.builder .component.node {
  width: 236px;
  padding: 0;
  z-index: 2;
}

body.builder .node-card {
  position: relative;
  background: var(--surface);
  border: 1px solid #dfe4dc;
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(23, 63, 46, 0.05), 0 6px 18px rgba(23, 63, 46, 0.06);
  padding: 6px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
body.builder .node:hover .node-card {
  border-color: #b9c6b6;
  box-shadow: 0 1px 2px rgba(23, 63, 46, 0.06), 0 10px 26px rgba(23, 63, 46, 0.1);
}
body.builder .jtk-drag .node-card,
body.builder .node.jtk-drag .node-card {
  box-shadow: 0 18px 40px rgba(23, 63, 46, 0.18);
}
body.builder .node-card.is-picked {
  border-color: var(--maize);
  box-shadow: 0 0 0 3px rgba(247, 181, 0, 0.35);
}
body.builder .node.node-new .node-card {
  animation: node-arrive 1.4s ease-out;
}
@keyframes node-arrive {
  0% { box-shadow: 0 0 0 6px rgba(247, 181, 0, 0.6); }
  100% { box-shadow: 0 0 0 0 rgba(247, 181, 0, 0); }
}

body.builder .node-start {
  display: inline-block;
  margin: 0 0 6px 6px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid #dfe4dc;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(23, 63, 46, 0.05);
}

body.builder .node-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px 8px 4px;
}

body.builder .node-icon {
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 12px;
  background: var(--lane-server);
}
body.builder .lane-phone .node-icon { background: var(--lane-phone); }
body.builder .lane-campaign .node-icon { background: var(--lane-campaign); }
body.builder .lane-dashboard .node-icon { background: var(--lane-dashboard); }

body.builder .node-title {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 700;
  font-size: 14px;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

body.builder .node-lane {
  flex: 0 0 auto;
  font-size: 11px;
  color: var(--muted);
}

body.builder .node-more {
  flex: 0 0 auto;
  border: 0;
  background: transparent;
  color: var(--muted);
  width: 24px;
  height: 24px;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
}
body.builder .node-more:hover,
body.builder .node-more:focus-visible {
  background: var(--paper);
  color: var(--ink);
}

/* Settings rows */
body.builder .node-props:empty {
  display: none;
}
body.builder .node-props {
  background: #f4f6f2;
  border-radius: 9px;
  padding: 4px 10px;
  margin-bottom: 6px;
}
body.builder .node-prop {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 0;
  font-size: 12.5px;
}
body.builder .node-prop span {
  color: var(--muted);
  white-space: nowrap;
}
body.builder .node-prop b {
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 120px;
}
body.builder .node-prop-more {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 4px 0 3px;
  text-align: left;
  font-size: 12px;
  font-weight: 700;
  color: var(--leaf);
  cursor: pointer;
}
body.builder .node-prop-more:hover {
  text-decoration: underline;
}

/* Port rows: inputs on the left edge, outputs on the right edge */
body.builder .node-ports {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 8px;
  padding: 2px 0;
}
body.builder .node-ports-out {
  text-align: right;
}
body.builder .node-port-row {
  position: relative;
  padding: 3px 10px;
  font-size: 12px;
  color: #34433b;
  white-space: nowrap;
}
body.builder .node-port-name {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}
/* the 1px marker the endpoint anchors to sits exactly on the card border */
body.builder .node-port-row > .port {
  position: absolute;
  top: 50%;
  margin: 0;
  width: 1px;
  height: 1px;
}
body.builder .node-port-row.in > .port {
  left: -7px;
}
body.builder .node-port-row.out > .port {
  right: -7px;
}

/* Live activity */
body.builder .node-activity {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  padding: 6px 10px;
  border-radius: 9px;
  background: #f4f6f2;
  font-size: 12px;
  color: var(--muted);
}
body.builder .node-activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c3ccc0;
  flex: 0 0 auto;
}
body.builder .node-activity.has-data .node-activity-dot {
  background: var(--leaf);
}
body.builder .node-activity-dot.blink {
  animation: activity-blink 0.9s ease-out;
}
@keyframes activity-blink {
  0% { box-shadow: 0 0 0 0 rgba(46, 125, 79, 0.6); }
  100% { box-shadow: 0 0 0 8px rgba(46, 125, 79, 0); }
}
body.builder .node-activity.has-data .node-activity-text {
  color: var(--ink);
  font-weight: 700;
}
body.builder .node-activity-value {
  margin-left: auto;
  color: var(--ink);
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.builder .component-combineports:empty {
  display: none;
}

/* Endpoints and wires */
body.builder .jtk-connector {
  z-index: 1;
}
body.builder .jtk-endpoint {
  z-index: 4;
  cursor: crosshair;
  transition: transform 0.15s;
}
body.builder .jtk-overlay {
  z-index: 5;
}
body.builder .dragActive::before {
  content: none !important;
}
body.builder #canvas.is-wiring .jtk-endpoint.dragActive {
  transform: scale(1.5);
  animation: port-ready 1s ease-in-out infinite;
}
@keyframes port-ready {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(247, 181, 0, 0)); }
  50% { filter: drop-shadow(0 0 4px rgba(247, 181, 0, 0.95)); }
}

body.builder .jtk-connector.wire {
  cursor: pointer;
}
body.builder .jtk-connector.wire.is-selected path:last-child {
  stroke-width: 4px;
}
body.builder .jtk-connector.wire.is-selected {
  filter: drop-shadow(0 0 3px rgba(247, 181, 0, 0.9));
}
body.builder .jtk-connector.wire-pulse path:last-child {
  stroke-dasharray: 9 7;
  animation: wire-flow 0.5s linear infinite;
}
body.builder .jtk-connector.wire-pulse {
  filter: drop-shadow(0 0 3px rgba(247, 181, 0, 0.85));
}
@keyframes wire-flow {
  to { stroke-dashoffset: -16; }
}

body.builder .wire-delete {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: var(--ink);
  color: #fff;
  font-size: 11px;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}
body.builder .wire-delete:hover {
  background: #b3261e;
}

/* Lane focus: fade everything outside the chosen lane */
body.builder #canvas[data-focus] .component,
body.builder #canvas[data-focus] .jtk-connector,
body.builder #canvas[data-focus] .jtk-endpoint {
  transition: opacity 0.2s;
}
body.builder #canvas[data-focus='phone'] .component:not(.lane-phone),
body.builder #canvas[data-focus='phone'] .jtk-connector:not(.lane-phone),
body.builder #canvas[data-focus='phone'] .jtk-endpoint:not(.lane-phone),
body.builder #canvas[data-focus='server'] .component:not(.lane-server),
body.builder #canvas[data-focus='server'] .jtk-connector:not(.lane-server),
body.builder #canvas[data-focus='server'] .jtk-endpoint:not(.lane-server),
body.builder #canvas[data-focus='campaign'] .component:not(.lane-campaign),
body.builder #canvas[data-focus='campaign'] .jtk-connector:not(.lane-campaign),
body.builder #canvas[data-focus='campaign'] .jtk-endpoint:not(.lane-campaign),
body.builder #canvas[data-focus='dashboard'] .component:not(.lane-dashboard),
body.builder #canvas[data-focus='dashboard'] .jtk-connector:not(.lane-dashboard),
body.builder #canvas[data-focus='dashboard'] .jtk-endpoint:not(.lane-dashboard) {
  opacity: 0.12;
  pointer-events: none;
}

/* Drag ghost from the component menu */
.node-ghost {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 220px;
  padding: 8px 10px;
  background: #fff;
  border: 1px solid #b9c6b6;
  border-radius: 12px;
  box-shadow: 0 16px 36px rgba(23, 63, 46, 0.22);
  font-family: 'Atkinson Hyperlegible', system-ui, sans-serif;
  font-weight: 700;
  font-size: 14px;
  color: #1b2420;
  z-index: 9999;
  cursor: grabbing;
}
.node-ghost .node-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #173f2e;
  color: #fff;
  font-size: 12px;
}

/* Floating dock, toast and empty state, centred over the canvas */
body.builder .flow-dock,
body.builder .flow-toast,
body.builder .flow-empty {
  --canvas-center: calc((100vw - 350px) / 2);
}
body.builder.menu-closed .flow-dock,
body.builder.menu-closed .flow-toast,
body.builder.menu-closed .flow-empty {
  --canvas-center: 50vw;
}

body.builder .flow-dock {
  position: fixed;
  bottom: 18px;
  left: var(--canvas-center);
  transform: translateX(-50%);
  z-index: 9000;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 10px 30px rgba(23, 63, 46, 0.14);
  font-size: 13px;
}
body.builder .flow-dock-label {
  padding: 0 6px 0 10px;
  color: var(--muted);
}
body.builder .lane-chip,
body.builder .flow-dock-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 6px 12px;
  border-radius: 999px;
  font-weight: 700;
  cursor: pointer;
}
body.builder .lane-chip:hover,
body.builder .flow-dock-btn:hover {
  background: var(--paper);
}
body.builder .lane-chip.is-on {
  background: var(--canopy);
  color: #fff;
}
body.builder .lane-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lane-server);
}
body.builder .lane-dot.lane-phone { background: var(--lane-phone); }
body.builder .lane-dot.lane-campaign { background: var(--lane-campaign); }
body.builder .lane-dot.lane-dashboard { background: var(--lane-dashboard); }
body.builder .lane-chip.is-on .lane-dot {
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}
body.builder .flow-dock-sep {
  width: 1px;
  height: 20px;
  background: var(--line);
  margin: 0 4px;
}
body.builder .flow-dock-btn i {
  color: var(--maize-strong);
}

body.builder .flow-toast {
  position: fixed;
  bottom: 74px;
  left: var(--canvas-center);
  transform: translate(-50%, 12px);
  z-index: 9001;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px 10px 16px;
  background: var(--ink);
  color: #fff;
  border-radius: 10px;
  font-size: 14px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
body.builder .flow-toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
  pointer-events: auto;
}
body.builder .flow-toast-action {
  border: 0;
  background: transparent;
  color: var(--maize);
  font-weight: 700;
  cursor: pointer;
  padding: 2px 4px;
}

body.builder .flow-empty {
  position: fixed;
  top: 50%;
  left: 64px;
  transform: translateY(-50%);
  z-index: 5;
  pointer-events: none;
}
body.builder .flow-empty[hidden] {
  display: none;
}
body.builder .flow-empty-card {
  width: 380px;
  text-align: center;
  background: rgba(255, 255, 255, 0.92);
  border: 1px dashed #bfc9bc;
  border-radius: 16px;
  padding: 28px 28px 24px;
}
body.builder .flow-empty-card h2 {
  font-size: 1.25rem;
  margin: 16px 0 8px;
}
body.builder .flow-empty-card p {
  color: var(--muted);
  margin: 0;
  font-size: 14px;
}
body.builder .flow-empty-art {
  display: flex;
  align-items: center;
  justify-content: center;
}
body.builder .flow-empty-art span {
  width: 54px;
  height: 34px;
  border-radius: 9px;
  border: 1.5px solid #b9c6b6;
  background: #fff;
}
body.builder .flow-empty-art i {
  width: 28px;
  height: 2px;
  background: repeating-linear-gradient(90deg, var(--maize) 0 5px, transparent 5px 9px);
  animation: art-flow 0.8s linear infinite;
}
@keyframes art-flow {
  to { background-position: 9px 0; }
}

@media (prefers-reduced-motion: reduce) {
  body.builder .jtk-connector.wire-pulse path:last-child,
  body.builder .flow-empty-art i,
  body.builder #canvas.is-wiring .jtk-endpoint.dragActive {
    animation: none;
  }
}

body.builder #canvas {
  user-select: none;
  -webkit-user-select: none;
}
