/* ============================================================
   Vibesuite — Control Panel design system
   ============================================================ */
[hidden] { display: none !important; }

:root {
  --navy: #0D163D;
  --navy-800: #0A1030;
  --navy-50: #EEF0F8;
  --royal: #143683;
  --royal-600: #0F2A66;
  --yellow: #FCE166;
  --yellow-300: #FFF3C4;
  --white: #FFFFFF;
  --ink: #1A1F36;
  --ink-muted: #5A6172;
  --line: #E3E6EF;
  --line-strong: #D3D9E6;
  --surface: #F7F8FC;

  --success: #147D3C;
  --warning: #B26A00;
  --danger: #B3261E;
  --neutral: #5A6172;

  --success-tint: #E4F3EA;
  --warning-tint: #FBF0E0;
  --neutral-tint: #EEF0F3;

  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 8px;
  --shadow-sm: 0 1px 2px rgba(13, 22, 61, 0.05);
  --shadow-md: 0 16px 40px rgba(13, 22, 61, 0.18);
  --font: 'Roboto', 'Open Sans', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--surface);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

body.no-scroll { overflow: hidden; }

h1, h2, h3, h4 { color: var(--navy); font-weight: 700; line-height: 1.15; margin: 0 0 0.4rem; }
p { margin: 0 0 1rem; }
.muted { color: var(--ink-muted); font-size: 0.9rem; }
.hint { color: var(--ink-muted); font-size: 0.85rem; margin-bottom: 1rem; }
.spacer { flex: 1; }

/* ---- Top nav ---- */
.topnav {
  background: var(--navy);
  color: var(--white);
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow-sm);
}
.topnav__inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  padding: 0 1.5rem;
  height: 60px;
}
.brand { display: flex; align-items: center; }
.brand__logo { height: 28px; width: auto; display: block; }
.topnav__nav { display: flex; gap: 0.25rem; }
.topnav__link {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.75);
  font: inherit;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 0.9rem;
  cursor: pointer;
  border-radius: 6px;
  position: relative;
}
.topnav__link:hover { color: #fff; background: rgba(255, 255, 255, 0.06); }
.topnav__link.is-active { color: var(--yellow); }
.topnav__link.is-active::after {
  content: '';
  position: absolute;
  left: 0.9rem;
  right: 0.9rem;
  bottom: 0.15rem;
  height: 2px;
  background: var(--yellow);
  border-radius: 2px;
}
.topnav__right { margin-left: auto; display: flex; align-items: center; gap: 0.75rem; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--yellow);
  color: var(--navy);
  display: grid; place-items: center;
  font-weight: 700; font-size: 0.75rem;
}

/* ---- Layout ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }
.view { animation: fade 0.2s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}
.page-head__title { font-size: 1.9rem; margin-bottom: 0.2rem; }
.page-head__sub { color: var(--ink-muted); margin: 0; }

/* ---- Buttons ---- */
.btn {
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  border-radius: var(--radius);
  padding: 0.55rem 1rem;
  cursor: pointer;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.05s ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
.btn--primary { background: var(--royal); color: #fff; }
.btn--primary:hover { background: var(--royal-600); }
.btn--accent { background: var(--yellow); color: var(--navy); }
.btn--accent:hover { background: #f7d94e; }
.btn--outline { background: #fff; color: var(--royal); border-color: var(--royal); }
.btn--outline:hover { background: var(--navy-50); }
.btn--ghost { background: transparent; color: var(--ink-muted); }
.btn--ghost:hover { background: var(--navy-50); color: var(--ink); }
.btn--danger { background: transparent; color: var(--danger); }
.btn--danger:hover { background: #FBEDEB; }
.btn--sm { padding: 0.3rem 0.7rem; font-size: 0.82rem; }
.btn svg { width: 16px; height: 16px; display: block; flex: none; }
.btn--sm svg { width: 15px; height: 15px; }
.btn--menu { background: #fff; border-color: var(--line); color: var(--ink); padding: 0.3rem 0.55rem; }
.btn--menu:hover { background: var(--navy-50); color: var(--ink); }
.icon-btn {
  background: none; border: none; color: var(--ink-muted);
  font-size: 1.5rem; line-height: 1; cursor: pointer; padding: 0.2rem 0.4rem;
  border-radius: 6px;
}
.icon-btn:hover { background: var(--navy-50); color: var(--ink); }

/* ---- Stats ---- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem;
  border-left: 3px solid var(--navy);
}
.stat--success { border-left-color: var(--success); }
.stat--warning { border-left-color: var(--warning); }
.stat--neutral { border-left-color: var(--neutral); }
.stat__value { font-size: 1.7rem; font-weight: 700; color: var(--navy); line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat__label { color: var(--ink-muted); font-size: 0.85rem; }

/* ---- Connection cards ---- */
.conn {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 0.85rem 1rem;
  margin-bottom: 0.6rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  transition: border-color 0.12s ease;
}
.conn:hover { border-color: var(--line-strong); }
.conn__main { flex: 1; min-width: 240px; }
.conn__head { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.35rem; }
.conn__name { font-weight: 700; color: var(--navy); font-size: 1.05rem; }
.conn__meta { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; color: var(--ink-muted); font-size: 0.85rem; }
.conn__cal { display: inline-flex; align-items: center; gap: 0.3rem; }
.conn__cal svg { width: 15px; height: 15px; color: var(--ink-muted); flex: none; }
.conn__actions { display: flex; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }

/* ---- Chips & badges ---- */
.chip {
  display: inline-flex; align-items: center;
  font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; text-transform: uppercase;
  padding: 0.2rem 0.6rem; border-radius: 999px; border: 1px solid transparent;
}
.chip--success { background: var(--success-tint); color: var(--success); border-color: #B9DFC7; }
.chip--warning { background: var(--warning-tint); color: var(--warning); border-color: #EFD6AC; }
.chip--neutral { background: var(--neutral-tint); color: var(--neutral); border-color: #D8DCE4; }
.badge {
  background: var(--navy-50);
  color: var(--royal);
  font-size: 0.75rem; font-weight: 500;
  padding: 0.15rem 0.55rem; border-radius: 6px;
  white-space: nowrap;
}

/* ---- Empty state ---- */
.empty {
  text-align: center;
  padding: 3rem 1rem;
  background: #fff;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
}
.empty__icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px;
  color: var(--ink-muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
}
.empty__icon svg { width: 20px; height: 20px; }
.empty__title { margin-top: 0.25rem; font-size: 1.15rem; }
.empty__text { color: var(--ink-muted); max-width: 380px; margin: 0 auto 1.25rem; }

/* ---- Cards (settings) ---- */
.cards-2col { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; }
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem;
}
.card__title { font-size: 1.05rem; margin-bottom: 0.75rem; }
.brand-swatch {
  background: var(--navy);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 0.75rem;
  display: flex;
  justify-content: center;
}
.brand-swatch__logo { height: 40px; width: auto; }

/* ---- Forms ---- */
.field { display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 1rem; }
.field__label { font-size: 0.82rem; font-weight: 600; color: var(--ink); }
.req { color: var(--danger); font-style: normal; }
input[type="text"], input[type="password"], input[type="email"], input:not([type]) {
  font: inherit;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
}
input:focus { outline: none; border-color: var(--royal); box-shadow: 0 0 0 3px var(--yellow-300); }
textarea {
  font: inherit;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  resize: vertical;
}
textarea:focus { outline: none; border-color: var(--royal); box-shadow: 0 0 0 3px var(--yellow-300); }
fieldset.field { border: none; padding: 0; margin-bottom: 1rem; }
fieldset.field legend { margin-bottom: 0.4rem; }
.radio { display: flex; align-items: center; gap: 0.5rem; margin-bottom: 0.4rem; font-size: 0.9rem; cursor: pointer; }

/* ---- Wizard steps ---- */
.steps {
  display: flex;
  gap: 0.5rem;
  list-style: none;
  margin: 0 0 1.25rem;
  padding: 0 0 1rem;
  border-bottom: 1px solid var(--line);
}
.step { display: flex; align-items: center; gap: 0.5rem; color: var(--ink-muted); font-size: 0.85rem; font-weight: 500; }
.step__num {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--neutral-tint); color: var(--ink-muted);
  display: grid; place-items: center; font-size: 0.75rem; font-weight: 700;
}
.step.is-active { color: var(--navy); font-weight: 700; }
.step.is-active .step__num { background: var(--yellow); color: var(--navy); }
.step.is-done .step__num { background: var(--success); color: #fff; }

/* ---- Modal ---- */
.backdrop {
  position: fixed; inset: 0;
  background: rgba(13, 22, 61, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 1.25rem;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.15s ease;
}
.backdrop.is-open { opacity: 1; }
.modal {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow: auto;
  padding: 1.4rem;
  transform: translateY(6px);
  transition: transform 0.16s ease;
}
.backdrop.is-open .modal { transform: none; }
.modal--wide { max-width: 720px; }
.modal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.modal__title { margin: 0; font-size: 1.25rem; }
.modal__foot { display: flex; align-items: center; gap: 0.5rem; margin-top: 1.5rem; }

/* ---- Detail: key/value + mapping table ---- */
.detail__head { display: flex; align-items: center; gap: 0.6rem; font-size: 1.15rem; font-weight: 700; color: var(--navy); margin-bottom: 1rem; }
.detail__sub { margin: 1.25rem 0 0.5rem; font-size: 1rem; }
.kv { width: 100%; border-collapse: collapse; }
.kv th, .kv td { text-align: left; padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--line); font-size: 0.88rem; }
.kv th { color: var(--ink-muted); font-weight: 500; white-space: nowrap; width: 1%; }
.map { width: 100%; border-collapse: collapse; margin-top: 0.5rem; }
.map th, .map td { text-align: left; padding: 0.55rem 0.75rem; border-bottom: 1px solid var(--line); font-size: 0.85rem; }
.map thead th { color: var(--ink-muted); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.03em; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 0.5rem; }
.dot--success { background: var(--success); }
.dot--warning { background: var(--warning); }
.dot--danger { background: var(--danger); }
.dot--neutral { background: var(--neutral); }

/* ---- Automations / condition builder ---- */
.rule {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem;
  margin-bottom: 0.75rem;
  background: var(--surface);
}
.rule__head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.rule__head input[type="checkbox"] { width: 16px; height: 16px; cursor: pointer; }
.rule__title { font-weight: 700; color: var(--navy); flex: 1; }
.rule__cond-title { font-size: 0.8rem; font-weight: 600; color: var(--ink-muted); margin: 0 0 0.4rem; }
.cond-list { display: flex; flex-direction: column; gap: 0.4rem; margin-bottom: 0.5rem; }
.cond { display: flex; gap: 0.4rem; align-items: center; }
.cond select, .cond input { flex: 1; min-width: 0; }
.snapshot {
  background: var(--navy);
  color: #e7ecff;
  border-radius: var(--radius);
  padding: 0.9rem;
  font-size: 0.78rem;
  overflow: auto;
  max-height: 220px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

/* ---- Toasts ---- */
.toasts { position: fixed; top: 72px; right: 1rem; z-index: 70; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  display: flex; align-items: center; gap: 0.55rem;
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 3px solid var(--navy);
  padding: 0.6rem 0.7rem 0.6rem 0.85rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  font-size: 0.88rem;
  max-width: 360px;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.is-visible { opacity: 1; transform: none; }
.toast svg { width: 16px; height: 16px; flex: none; }
.toast--success { border-left-color: var(--success); }
.toast--error { border-left-color: var(--danger); }
.toast--info { border-left-color: var(--navy); }
.toast__close {
  margin-left: auto; background: none; border: none;
  color: var(--ink-muted); cursor: pointer; padding: 0.1rem 0.25rem;
  border-radius: 4px; font: inherit; font-size: 0.95rem; line-height: 1;
}
.toast__close:hover { color: var(--ink); background: var(--surface); }

/* ---- Invites ---- */
.invite-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-bottom: 1.25rem; }
.invite-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.invite-step {
  font-size: 0.8rem; font-weight: 700; letter-spacing: 0.03em;
  text-transform: uppercase; color: var(--ink-muted);
  margin: 0 0 0.9rem; padding-bottom: 0.55rem; border-bottom: 1px solid var(--line);
}
.invite-preview {
  margin-top: 0.75rem; padding: 0.6rem 0.75rem;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); font-size: 0.9rem; line-height: 1.9;
}
.invite-event-preview {
  margin: -0.25rem 0 0.75rem; padding: 0.55rem 0.75rem;
  border-radius: var(--radius); border: 1px dashed var(--line-strong);
  background: var(--navy-50); color: var(--ink); font-size: 0.9rem;
}
.invite-event-preview.is-warn { border-color: #EFD6AC; background: var(--warning-tint); }
.invite-event-preview.is-invalid { border-color: #E8B8B4; background: #FBEDEB; color: var(--danger); }
.invite-actions {
  display: flex; align-items: center; gap: 0.5rem;
  margin-bottom: 1.5rem; padding: 0.75rem 1rem;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface);
}
.invite-actions__note { font-size: 0.8rem; color: var(--ink-muted); }
.field__label-row { display: flex; align-items: center; justify-content: space-between; }
.field__label-row .field__label { margin: 0; }
.pill {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.78rem; font-weight: 600; padding: 0.15rem 0.55rem;
  border-radius: 999px; border: 1px solid transparent; white-space: nowrap;
}
.pill--ok { background: var(--success-tint); color: var(--success); border-color: #B9DFC7; }
.pill--warn { background: var(--warning-tint); color: var(--warning); border-color: #EFD6AC; }
.pill--danger { background: #FBEDEB; color: var(--danger); border-color: #E8B8B4; }
.pill--neutral { background: var(--neutral-tint); color: var(--neutral); border-color: #D8DCE4; }
.chip--danger { background: #FBEDEB; color: var(--danger); border-color: #E8B8B4; }
.seg-pick { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg-pick__row {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.5rem 0.7rem; cursor: pointer; font-size: 0.9rem;
  border-top: 1px solid var(--line);
}
.seg-pick__row:first-child { border-top: none; }
.seg-pick__row:hover { background: var(--navy-50); }
.seg-pick__row input { width: auto; flex: none; margin: 0; }
.seg-pick__row.is-disabled { opacity: 0.55; cursor: default; }
.seg-pick__name { flex: 1; }
.seg-pick__count { font-size: 0.76rem; color: var(--ink-muted); white-space: nowrap; }
.seg-pick__all { font-weight: 700; color: var(--navy); background: var(--surface); }
.table-scroll { overflow-x: auto; }
.invite-result {
  margin-bottom: 1rem; padding: 0.75rem 1rem;
  border-radius: var(--radius); border: 1px solid var(--line); font-size: 0.92rem;
}
.invite-result--success { background: var(--success-tint); border-color: #B9DFC7; color: var(--success); }
.invite-result--error { background: #FBEDEB; border-color: #E8B8B4; color: var(--danger); }
.invite-result a { color: var(--royal); font-weight: 600; }
.section-title { margin: 1.5rem 0 0.6rem; font-size: 1.1rem; }

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .cards-2col { grid-template-columns: 1fr; }
  .invite-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr; }
  .topnav__inner { gap: 0.75rem; padding: 0 1rem; }
  .conn { flex-direction: column; align-items: stretch; }
  .conn__actions { justify-content: flex-start; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .invite-row { grid-template-columns: 1fr; }
}

/* ---- Icons (monoline) ---- */
.ico { display: inline-flex; align-items: center; justify-content: center; line-height: 0; }
.ico svg { width: 1em; height: 1em; display: block; }
.nav-ico { display: inline-flex; align-items: center; justify-content: center; margin-right: 0.45rem; }
.nav-ico svg { width: 16px; height: 16px; display: block; }
.topnav__link { display: inline-flex; align-items: center; }
.icon-btn:focus-visible, .menu__item:focus-visible, .dropzone:focus-visible, .toast__close:focus-visible {
  outline: 2px solid var(--yellow); outline-offset: 2px;
}

/* ---- Buttons: states + spinner ---- */
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn--busy { pointer-events: none; opacity: 0.72; }
.spinner {
  width: 14px; height: 14px; flex: none;
  border: 2px solid rgba(255, 255, 255, 0.45);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn--ghost .spinner, .btn--outline .spinner { border-color: rgba(20, 54, 131, 0.3); border-top-color: var(--royal); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Skeletons ---- */
.skeleton {
  background: linear-gradient(90deg, #EDF0F6 25%, #F6F8FB 50%, #EDF0F6 75%);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: var(--radius);
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skel-card { height: 70px; border-radius: var(--radius-lg); margin-bottom: 0.6rem; }
.skel-stat { height: 74px; border-radius: var(--radius-lg); }

/* ---- Selects (match inputs) ---- */
select {
  font: inherit;
  padding: 0.5rem 2rem 0.5rem 0.7rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%235A6172' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.6rem center;
  background-size: 12px;
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
}
select:focus { outline: none; border-color: var(--royal); box-shadow: 0 0 0 3px var(--yellow-300); }

/* ---- Dropzone (file input) ---- */
.dropzone {
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  color: var(--ink-muted);
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.dropzone:hover { border-color: var(--royal); background: var(--navy-50); }
.dropzone.is-drag { border-color: var(--royal); background: var(--yellow-300); }
.dropzone input[type="file"] { display: none; }
.dropzone__icon { display: inline-flex; margin-bottom: 0.35rem; color: var(--ink-muted); }
.dropzone__icon svg { width: 20px; height: 20px; }
.dropzone__text { font-size: 0.85rem; font-weight: 600; color: var(--ink); }
.dropzone__hint { font-size: 0.78rem; margin-top: 0.1rem; }
.dropzone__file { display: block; margin-top: 0.4rem; font-size: 0.8rem; color: var(--royal); font-weight: 500; }

/* ---- Overflow menu ---- */
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 30;
  min-width: 180px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 0.3rem;
  display: none;
}
.menu.is-open { display: block; }
.menu__item {
  display: flex; align-items: center; gap: 0.55rem;
  width: 100%; text-align: left;
  background: none; border: none; cursor: pointer;
  font: inherit; font-size: 0.86rem; color: var(--ink);
  padding: 0.45rem 0.6rem; border-radius: var(--radius-sm);
}
.menu__item:hover { background: var(--navy-50); }
.menu__item svg { width: 15px; height: 15px; color: var(--ink-muted); flex: none; }
.menu__item--danger { color: var(--danger); }
.menu__item--danger svg { color: var(--danger); }
.menu__item--danger:hover { background: #FBEDEB; }

/* ---- Segment result ---- */
.seg {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 0.6rem;
  overflow: hidden;
  background: #fff;
}
.seg__head {
  display: flex; align-items: center; gap: 0.6rem;
  padding: 0.6rem 0.8rem;
  cursor: pointer;
  background: var(--surface);
}
.seg__head:hover { background: var(--navy-50); }
.seg__name { font-weight: 700; color: var(--navy); flex: 1; font-size: 0.95rem; }
.seg__count { font-size: 0.78rem; color: var(--ink-muted); white-space: nowrap; }
.seg__chev { display: inline-flex; transition: transform 0.15s ease; color: var(--ink-muted); }
.seg__chev svg { width: 15px; height: 15px; }
.seg[data-open="true"] .seg__chev { transform: rotate(90deg); }
.seg__reason { padding: 0.55rem 0.8rem; color: var(--ink-muted); font-size: 0.85rem; border-top: 1px solid var(--line); }
.seg__rows { border-top: 1px solid var(--line); }
.seg__rows .map { margin: 0; }
.seg[data-open="false"] .seg__reason,
.seg[data-open="false"] .seg__rows { display: none; }

/* ---- Knowledge snippet ---- */
.snippet {
  color: var(--ink-muted); font-size: 0.84rem;
  margin: 0.3rem 0 0;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Confirm dialog ---- */
.modal--sm { max-width: 400px; }
.confirm__msg { color: var(--ink-muted); font-size: 0.9rem; margin: 0.25rem 0 0; }

/* ---- Summary strip ---- */
.summary { display: flex; gap: 1.25rem; flex-wrap: wrap; margin-bottom: 1rem; }
.summary__item { display: flex; align-items: baseline; gap: 0.5rem; }
.summary__value { font-weight: 700; color: var(--navy); font-variant-numeric: tabular-nums; }
.summary__label { color: var(--ink-muted); font-size: 0.82rem; }

/* ---- Nav overflow on mobile ---- */
.topnav__nav { overflow-x: auto; scrollbar-width: none; }
.topnav__nav::-webkit-scrollbar { display: none; }

@media (max-width: 560px) {
  .topnav__inner { height: 54px; }
  .topnav__link { padding: 0.45rem 0.6rem; font-size: 0.85rem; }
  .topnav__link .nav-ico { margin-right: 0; }
  .modal { max-height: 100vh; border-radius: 0; }
}