/* ==========================================================================
   Boomi Insights — Reusable Components (part 1a)
   Sidebar
   ========================================================================== */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: var(--z-sticky);
  width: var(--sb-w);
  display: flex;
  flex-direction: column;
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-bd);
  transition: width var(--dur-3) var(--ease);
  overflow: hidden;
}

.sidebar__brand {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: 16px 16px 15px;
  border-bottom: 1px solid var(--sb-bd);
  min-height: var(--tb-h);
  flex: 0 0 auto;
}

.brand-mark {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  border-radius: var(--r-lg);
  background: linear-gradient(150deg, #12a3b0 0%, #0b6d7c 100%);
  display: grid;
  place-items: center;
  box-shadow: 0 2px 8px rgba(11, 109, 124, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.brand-mark svg { width: 19px; height: 19px; color: #fff; }

.brand-text { min-width: 0; }
.brand-text__name {
  font-size: var(--fs-md);
  font-weight: var(--fw-bold);
  color: var(--sb-fg-strong);
  letter-spacing: -0.01em;
  line-height: 1.25;
  white-space: nowrap;
}
.brand-text__sub {
  font-size: var(--fs-2xs);
  color: var(--sb-fg-dim);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}

.sidebar__nav {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  padding: var(--s-5) 10px var(--s-8);
}
.sidebar__nav::-webkit-scrollbar-thumb { background: #2b415a; background-clip: content-box; }

.nav-group { margin-bottom: var(--s-5); }
.nav-group__label {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wider);
  text-transform: uppercase;
  color: var(--sb-label);
  padding: 0 10px var(--s-3);
  display: flex;
  align-items: center;
  gap: var(--s-3);
}
.nav-group__label::after {
  content: "";
  flex: 1 1 auto;
  height: 1px;
  background: var(--sb-bd);
}

.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s-5);
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 1px;
  border: 0;
  background: transparent;
  border-radius: var(--r-md);
  color: var(--sb-fg);
  font-size: var(--fs-base);
  font-weight: var(--fw-medium);
  text-align: left;
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.nav-item:hover { background: var(--sb-hover); color: var(--sb-fg-strong); }
.nav-item__icon { flex: 0 0 18px; width: 18px; height: 18px; opacity: 0.85; }
.nav-item__icon svg { width: 18px; height: 18px; }
.nav-item__label { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-item__status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: 0 0 auto;
  padding: 2px 5px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  font-size: 9px;
  font-weight: var(--fw-bold);
  letter-spacing: 0.04em;
  line-height: 1.2;
}
.nav-item__status--live { color: #a7efd2; background: rgba(21, 128, 94, 0.2); border-color: rgba(91, 202, 157, 0.28); }
.nav-item__status--live::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.nav-item__status--partial { color: #ffce87; background: rgba(176, 112, 12, 0.2); border-color: rgba(255, 206, 135, 0.22); }
.nav-item__status--demo { color: var(--sb-fg-dim); background: #1c3049; border-color: #2b415a; }

.nav-item__count {
  flex: 0 0 auto;
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  font-variant-numeric: tabular-nums;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: #1c3049;
  color: var(--sb-fg);
}
.nav-item__count.is-crit { background: rgba(199, 54, 66, 0.26); color: #ffa3aa; }
.nav-item__count.is-warn { background: rgba(176, 112, 12, 0.28); color: #ffce87; }

.nav-item.is-active {
  background: var(--sb-active-bg);
  color: var(--sb-active-fg);
  font-weight: var(--fw-semibold);
}
.nav-item.is-active .nav-item__icon { opacity: 1; }
.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: -10px;
  top: 6px;
  bottom: 6px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--sb-active-bar);
}
/* ==========================================================================
   Boomi Insights — Reusable Components (part 1b)
   Topbar · Breadcrumbs
   ========================================================================== */

.topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-dropdown);
  flex: 0 0 auto;
  min-height: var(--tb-h);
  display: flex;
  align-items: center;
  gap: var(--s-5);
  padding: 0 var(--content-pad);
  background: var(--tb-bg);
  border-bottom: 1px solid var(--tb-bd);
}

.icon-btn {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: var(--ctl-h);
  height: var(--ctl-h);
  border: 1px solid var(--bd);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  color: var(--fg-secondary);
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease),
    border-color var(--dur-2) var(--ease);
}
.icon-btn:hover { background: var(--bg-hover); color: var(--fg); border-color: var(--bd-strong); }
.icon-btn svg { width: 16px; height: 16px; }
.icon-btn.is-ghost { border-color: transparent; background: transparent; }
.icon-btn.is-ghost:hover { background: var(--bg-muted); }
.icon-btn.is-bare {
  width: 26px; height: 26px; border-color: transparent; background: transparent;
  color: var(--fg-muted);
}
.icon-btn.is-bare:hover { background: var(--bg-muted); color: var(--fg); }
.icon-btn.is-bare svg { width: 14px; height: 14px; }

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: var(--s-1);
  min-width: 0;
  font-size: var(--fs-base);
  color: var(--fg-muted);
}
.breadcrumbs__item {
  padding: 4px 6px;
  border-radius: var(--r-sm);
  white-space: nowrap;
  transition: color var(--dur-2) var(--ease), background var(--dur-2) var(--ease);
}
a.breadcrumbs__item:hover { color: var(--brand-600); background: var(--bg-hover); }
.breadcrumbs__item.is-current {
  color: var(--fg);
  font-weight: var(--fw-semibold);
  max-width: 460px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.breadcrumbs__sep { color: var(--fg-faint); flex: 0 0 auto; display: grid; place-items: center; width: 14px; }
.breadcrumbs__sep svg { width: 13px; height: 13px; }

.topbar__spacer { flex: 1 1 auto; }
.topbar__actions { display: flex; align-items: center; gap: var(--s-3); flex: 0 0 auto; }

.env-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  height: var(--ctl-h);
  padding: 0 10px;
  border: 1px solid var(--bd);
  border-radius: var(--r-md);
  background: var(--bg-subtle);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  color: var(--fg-secondary);
}
.env-pill strong { color: var(--fg); font-weight: var(--fw-semibold); }
.env-pill .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--ok); box-shadow: 0 0 0 3px var(--ok-bg);
}

.live-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--s-2);
  height: var(--ctl-h);
  padding: 0 10px;
  border-radius: var(--r-md);
  border: 1px solid var(--ok-bd);
  background: var(--ok-bg);
  color: var(--ok-fg);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.pulse-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ok); animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(21, 128, 94, 0.5); }
  50% { box-shadow: 0 0 0 4px rgba(21, 128, 94, 0); }
}


/* ---------- Buttons ----------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-3);
  height: var(--ctl-h);
  padding: 0 12px;
  border: 1px solid var(--bd);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  color: var(--fg);
  font-size: var(--fs-base);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
  transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease),
    color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.btn svg { width: 15px; height: 15px; flex: 0 0 auto; }
.btn:hover { background: var(--bg-hover); border-color: var(--bd-strong); }
.btn:active { transform: translateY(0.5px); }
.btn[disabled], .btn.is-disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.btn--primary { background: var(--brand-600); border-color: var(--brand-600); color: #fff; box-shadow: var(--sh-xs); }
.btn--primary:hover { background: var(--brand-700); border-color: var(--brand-700); color: #fff; }
.btn--danger { background: var(--crit); border-color: var(--crit); color: #fff; }
.btn--danger:hover { background: var(--crit-fg); border-color: var(--crit-fg); color: #fff; }
.btn--warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn--warn:hover { background: var(--warn-fg); border-color: var(--warn-fg); color: #fff; }
.btn--ghost { background: transparent; border-color: transparent; color: var(--fg-secondary); }
.btn--ghost:hover { background: var(--bg-muted); border-color: transparent; color: var(--fg); }
.btn--outline-brand { border-color: var(--brand-200); color: var(--brand-700); background: var(--brand-50); }
.btn--outline-brand:hover { background: var(--brand-100); border-color: var(--brand-300); color: var(--brand-800); }

.btn--sm { height: 28px; padding: 0 9px; font-size: var(--fs-sm); }
.btn--sm svg { width: 13px; height: 13px; }
.btn--xs { height: 24px; padding: 0 8px; font-size: var(--fs-xs); border-radius: var(--r-sm); }
.btn--lg { height: 38px; padding: 0 16px; font-size: var(--fs-md); }
.btn--icon { width: var(--ctl-h); padding: 0; }
.btn--icon.btn--sm { width: 28px; }
.btn--block { width: 100%; }

.btn-group { display: inline-flex; }
.btn-group .btn { border-radius: 0; margin-left: -1px; }
.btn-group .btn:first-child { border-radius: var(--r-md) 0 0 var(--r-md); margin-left: 0; }
.btn-group .btn:last-child { border-radius: 0 var(--r-md) var(--r-md) 0; }
.btn-group .btn.is-active { background: var(--brand-50); border-color: var(--brand-300); color: var(--brand-700); z-index: 1; }

.avatar {
  flex: 0 0 auto;
  width: 30px; height: 30px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: var(--brand-100);
  color: var(--brand-700);
  font-size: var(--fs-xs);
  font-weight: var(--fw-bold);
  letter-spacing: 0.02em;
}


.sidebar__footer {
  flex: 0 0 auto;
  border-top: 1px solid var(--sb-bd);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: var(--s-4);
}
.sidebar__conn {
  display: flex;
  align-items: center;
  gap: var(--s-4);
  font-size: var(--fs-xs);
  color: var(--sb-fg);
  min-width: 0;
}
.sidebar__conn strong { color: var(--sb-fg-strong); font-weight: var(--fw-semibold); }

/* Collapsed rail */
.app[data-sidebar="collapsed"] .sidebar { width: var(--sb-w-collapsed); }
.app[data-sidebar="collapsed"] .brand-text,
.app[data-sidebar="collapsed"] .nav-item__label,
.app[data-sidebar="collapsed"] .nav-item__count,
.app[data-sidebar="collapsed"] .sidebar__conn-text { display: none; }
.app[data-sidebar="collapsed"] .nav-item__status {
  width: 7px;
  height: 7px;
  padding: 0;
  border-radius: 50%;
  font-size: 0;
  gap: 0;
}
.app[data-sidebar="collapsed"] .nav-item__status--live::before { width: 100%; height: 100%; }
.app[data-sidebar="collapsed"] .nav-group__label { justify-content: center; padding-inline: 0; font-size: 0; }
.app[data-sidebar="collapsed"] .nav-group__label::after { display: none; }
.app[data-sidebar="collapsed"] .nav-item { justify-content: center; padding-inline: 0; }
.app[data-sidebar="collapsed"] .sidebar__brand { justify-content: center; padding-inline: 0; }
.app[data-sidebar="collapsed"] .sidebar__footer { align-items: center; }

/* ==========================================================================
   Part 1c — Fields, filters, segmented, chips, switch
   ========================================================================== */

.field { display: flex; flex-direction: column; gap: var(--s-2); min-width: 0; }
.field__label {
  font-size: var(--fs-2xs);
  font-weight: var(--fw-bold);
  letter-spacing: var(--ls-wide);
  text-transform: uppercase;
  color: var(--fg-muted);
}

.input, .select, .textarea {
  width: 100%;
  height: var(--ctl-h);
  padding: 0 10px;
  border: 1px solid var(--bd);
  border-radius: var(--r-md);
  background: var(--bg-surface);
  color: var(--fg);
  font-size: var(--fs-base);
  transition: border-color var(--dur-2) var(--ease), box-shadow var(--dur-2) var(--ease);
}
.input::placeholder, .textarea::placeholder { color: var(--fg-faint); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--bd-strong); }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand-400); box-shadow: var(--ring-focus); }
.textarea { height: auto; min-height: 76px; padding: 8px 10px; resize: vertical; line-height: var(--lh-normal); }

.select {
  appearance: none;
  padding-right: 30px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236c7c8b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  background-size: 14px;
  cursor: pointer;
}
.select--sm { height: 28px; font-size: var(--fs-sm); }

.search { position: relative; display: flex; align-items: center; min-width: 0; }
.search > svg {
  position: absolute; left: 10px; width: 14px; height: 14px;
  color: var(--fg-faint); pointer-events: none;
}
.search .input { padding-left: 30px; }
.search--wide .input { width: 300px; max-width: 100%; }
.search__clear {
  position: absolute; right: 6px;
  width: 20px; height: 20px;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--bg-muted); color: var(--fg-secondary);
}
.search__clear:hover { background: var(--n-200); color: var(--fg); }
.search__clear svg { width: 11px; height: 11px; }

.toolbar { display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; }
.toolbar__right { margin-left: auto; display: flex; align-items: center; gap: var(--s-4); flex-wrap: wrap; }
.toolbar__divider { width: 1px; height: 22px; background: var(--bd); flex: 0 0 auto; }

.segmented {
  display: inline-flex;
  padding: 2px;
  border: 1px solid var(--bd);
  border-radius: var(--r-lg);
  background: var(--bg-muted);
  gap: 2px;
}
.preview-pill {
  display: inline-flex;
  align-items: center;
  height: var(--ctl-h);
  padding: 0 10px;
  border: 1px solid var(--info-bd);
  border-radius: var(--r-md);
  background: var(--info-bg);
  color: var(--info-fg);
  font-size: var(--fs-xs);
  font-weight: var(--fw-semibold);
  white-space: nowrap;
}
.segmented__btn {
  height: 28px;
  padding: 0 11px;
  border: 0;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--fg-secondary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-semibold);
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
}
.segmented__btn:hover { color: var(--fg); }
.segmented__btn.is-active {
  background: var(--bg-surface);
  color: var(--brand-700);
  box-shadow: var(--sh-sm);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--s-3);
  height: 28px;
  padding: 0 10px;
  border: 1px solid var(--bd);
  border-radius: var(--r-pill);
  background: var(--bg-surface);
  color: var(--fg-secondary);
  font-size: var(--fs-sm);
  font-weight: var(--fw-medium);
  transition: all var(--dur-2) var(--ease);
}
.chip:hover { border-color: var(--bd-strong); background: var(--bg-hover); }
.chip.is-active { background: var(--brand-50); border-color: var(--brand-300); color: var(--brand-700); }
.chip__count { font-variant-numeric: tabular-nums; color: var(--fg-faint); font-size: var(--fs-xs); }
.chip.is-active .chip__count { color: var(--brand-600); }
.chip svg { width: 12px; height: 12px; opacity: 0.7; }

.switch { display: inline-flex; align-items: center; gap: var(--s-4); cursor: pointer; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch__track {
  width: 32px; height: 18px; border-radius: var(--r-pill);
  background: var(--n-300); position: relative;
  transition: background var(--dur-2) var(--ease); flex: 0 0 auto;
}
.switch__track::after {
  content: ""; position: absolute; top: 2px; left: 2px;
  width: 14px; height: 14px; border-radius: 50%; background: #fff;
  box-shadow: var(--sh-xs); transition: transform var(--dur-2) var(--ease);
}
.switch input:checked + .switch__track { background: var(--brand-500); }
.switch input:checked + .switch__track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch__track { box-shadow: var(--ring-focus); }
.switch__label { font-size: var(--fs-sm); color: var(--fg-secondary); font-weight: var(--fw-medium); }
