/* ─── Reset ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ─── Tokens ─────────────────────────────────────────────────────────────── */
:root {
  --sidebar-w:   240px;
  --chat-w:      300px;
  --topbar-h:    58px;

  /* Main surface */
  --bg:          #f0f2f9;
  --surface:     #ffffff;
  --surface-2:   #f7f8fc;
  --border:      #e8eaf0;
  --border-2:    #d0d4df;

  /* Sidebar (dark) */
  --sb-bg:       #0d1117;
  --sb-border:   #1c2030;
  --sb-text:     #e2e8f0;
  --sb-text-2:   #7d8fb3;
  --sb-text-3:   #3d4a6b;
  --sb-hover:    rgba(255,255,255,.05);
  --sb-active-bg:rgba(99,102,241,.18);
  --sb-active:   #a5b4fc;

  /* Accent */
  --accent:      #6366f1;
  --accent-h:    #4f52cc;
  --accent-light:#eef0ff;
  --accent-grad: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

  /* Semantic colors */
  --text:        #0f1729;
  --text-1:      #0f1729;
  --text-2:      #5a6480;
  --text-3:      #9ba3c0;

  --green:       #059669;
  --green-bg:    #ecfdf5;
  --green-border:#a7f3d0;
  --amber:       #d97706;
  --amber-bg:    #fffbeb;
  --amber-border:#fcd34d;
  --red:         #dc2626;
  --red-bg:      #fef2f2;
  --red-border:  #fca5a5;
  --blue:        #2563eb;
  --blue-bg:     #eff6ff;
  --blue-border: #bfdbfe;
  --purple:      #7c3aed;
  --purple-bg:   #f5f3ff;

  --r:   12px;
  --rsm:  8px;
  --rxs:  5px;

  --shadow-sm: 0 1px 4px rgba(15,23,41,.06), 0 1px 2px rgba(15,23,41,.04);
  --shadow:    0 4px 20px rgba(15,23,41,.10), 0 1px 6px rgba(15,23,41,.06);
  --shadow-lg: 0 12px 40px rgba(15,23,41,.14), 0 4px 12px rgba(15,23,41,.08);

  --font: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;
}

/* ─── Base ───────────────────────────────────────────────────────────────── */
html, body { height: 100%; overflow: hidden; }
body {
  display: flex;
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  position: fixed;
  width: 100%;
  top: 0; left: 0;
}

/* ─── Sidebar (dark) ──────────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100vh;
  background: var(--sb-bg);
  border-right: 1px solid var(--sb-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  z-index: 100;
}

.sidebar-brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 18px;
  border-bottom: 1px solid var(--sb-border);
  flex-shrink: 0;
}
.brand-mark {
  width: 30px; height: 30px;
  border-radius: 9px;
  background: var(--accent-grad);
  flex-shrink: 0;
  position: relative;
  box-shadow: 0 2px 8px rgba(99,102,241,.4);
}
.brand-mark::before {
  content: '';
  position: absolute;
  top: 7px; left: 50%; transform: translateX(-50%);
  width: 12px; height: 2px;
  background: rgba(255,255,255,.9);
  border-radius: 2px;
}
.brand-mark::after {
  content: '';
  position: absolute;
  bottom: 7px; left: 50%; transform: translateX(-50%);
  width: 7px; height: 2px;
  background: rgba(255,255,255,.55);
  border-radius: 2px;
}
.brand-name {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.4px;
  color: #f1f5f9;
}

.sidebar-nav {
  flex: 1;
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 1px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .9px;
  color: var(--sb-text-3);
  padding: 0 10px;
  margin-bottom: 5px;
  margin-top: 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 11px;
  border: none;
  border-radius: var(--rsm);
  background: transparent;
  color: var(--sb-text-2);
  font: inherit;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--sb-hover); color: var(--sb-text); }
.nav-item.active {
  background: var(--sb-active-bg);
  color: var(--sb-active);
  font-weight: 600;
}
.nav-icon { width: 16px; height: 16px; flex-shrink: 0; stroke-width: 2; }

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--sb-border);
}
.env-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 500;
  color: var(--sb-text-2);
}
.env-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 7px rgba(52,211,153,.6);
}

/* ─── App shell ──────────────────────────────────────────────────────────── */
.app-shell {
  margin-left: var(--sidebar-w);
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  min-width: 0;
}

/* ─── Topbar ──────────────────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 26px;
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 90;
  box-shadow: 0 1px 0 var(--border), 0 2px 8px rgba(15,23,41,.04);
}
.page-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -.4px;
  color: var(--text);
}
.topbar-right { display: flex; align-items: center; gap: 12px; }

.conn-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-3);
}
.conn-badge::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-3);
  flex-shrink: 0;
}
.conn-badge.ok {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green);
}
.conn-badge.ok::before { background: var(--green); box-shadow: 0 0 5px rgba(5,150,105,.5); }
.conn-badge.err {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: var(--red);
}
.conn-badge.err::before { background: var(--red); }

/* ─── Body ───────────────────────────────────────────────────────────────── */
.app-body {
  flex: 1;
  display: flex;
  overflow: hidden;
}
.main-content {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  /* Clear the floating chat button so it never sits over the last row's actions
     (e.g. the queue table's Status / "Why?" column). */
  padding-bottom: 96px;
  min-width: 0;
}

/* ─── Pages ──────────────────────────────────────────────────────────────── */
.page { display: none; }
.page.active { display: block; }

/* ─── Dashboard ──────────────────────────────────────────────────────────── */
.dash-welcome {
  margin-bottom: 26px;
  background: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #1e3a8a 100%);
  border-radius: var(--r);
  padding: 28px 32px;
  position: relative;
  overflow: hidden;
}
.dash-welcome::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 200px; height: 200px;
  border-radius: 50%;
  background: rgba(139,92,246,.18);
  pointer-events: none;
}
.dash-welcome::after {
  content: '';
  position: absolute;
  bottom: -60px; right: 80px;
  width: 160px; height: 160px;
  border-radius: 50%;
  background: rgba(99,102,241,.12);
  pointer-events: none;
}
.dash-title {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: -.5px;
  color: #f1f5f9;
  margin-bottom: 6px;
  position: relative;
}
.dash-sub {
  font-size: 14px;
  color: rgba(241,245,249,.6);
  font-weight: 400;
  position: relative;
}

/* Feature-maturity notice */
.dash-notice {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 20px;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid #6366f1;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
}
.dash-notice-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 10px;
  white-space: nowrap;
  background: rgba(34,197,94,.12);
  color: #16a34a;
}
.dash-notice-beta { color: #6366f1; font-weight: 600; }

/* Stats row */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 16px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s, transform .2s;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  border-radius: var(--r) var(--r) 0 0;
}
.stat-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); }
.stat-icon-wrap {
  width: 44px; height: 44px;
  border-radius: 11px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.stat-icon-wrap svg { width: 20px; height: 20px; stroke-width: 2; }
.stat-icon-wrap.blue   { background: #eff6ff; color: #2563eb; }
.stat-icon-wrap.purple { background: #f5f3ff; color: #7c3aed; }
.stat-icon-wrap.green  { background: #ecfdf5; color: #059669; }
.stat-icon-wrap.red    { background: #fef2f2; color: #dc2626; }
.stat-card:has(.blue)::before   { background: #2563eb; }
.stat-card:has(.purple)::before { background: #7c3aed; }
.stat-card:has(.green)::before  { background: #059669; }
.stat-card:has(.red)::before    { background: #dc2626; }

.stat-value {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -.6px;
  color: var(--text);
  line-height: 1.1;
}
.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  margin-top: 3px;
  letter-spacing: .01em;
}

/* Section header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.section-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: .02em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 8px;
}
.section-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 14px;
  background: var(--accent-grad);
  border-radius: 2px;
  flex-shrink: 0;
}
.link-btn {
  background: none;
  border: none;
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--accent);
  cursor: pointer;
  padding: 2px 4px;
}
.link-btn:hover { text-decoration: underline; }

/* Quick grid */
.quick-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 28px;
}
.quick-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 22px;
  text-align: left;
  cursor: pointer;
  transition: box-shadow .2s, border-color .2s, transform .2s;
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.quick-card::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: var(--r);
  opacity: 0;
  transition: opacity .2s;
  background: linear-gradient(135deg, rgba(99,102,241,.04) 0%, rgba(139,92,246,.04) 100%);
}
.quick-card:hover {
  box-shadow: 0 8px 28px rgba(15,23,41,.12), 0 2px 8px rgba(15,23,41,.06);
  border-color: rgba(99,102,241,.25);
  transform: translateY(-3px);
}
.quick-card:hover::after { opacity: 1; }
.quick-icon {
  width: 44px; height: 44px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
}
.quick-icon svg { width: 21px; height: 21px; stroke-width: 2; }
.accent-bg { background: linear-gradient(135deg, #eef0ff, #f3f0ff); color: var(--accent); }
.blue-bg   { background: linear-gradient(135deg, #eff6ff, #e0f2fe); color: var(--blue); }
.green-bg  { background: linear-gradient(135deg, #ecfdf5, #d1fae5); color: var(--green); }

.quick-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 5px;
  letter-spacing: -.1px;
}
.quick-desc {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.6;
}

/* Recent iFlows table (dashboard) */
.dash-iflow-table {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  overflow: hidden;
  box-shadow: 0 2px 12px rgba(15,23,41,.06), 0 1px 3px rgba(15,23,41,.04);
}
.dash-iflow-row {
  display: flex;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  gap: 14px;
  transition: background .1s;
}
.dash-iflow-row:last-child { border-bottom: none; }
.dash-iflow-row:hover { background: var(--surface-2); }
.dash-iflow-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dash-iflow-dot.started { background: var(--green); }
.dash-iflow-dot.error   { background: var(--red); }
.dash-iflow-dot.unknown { background: var(--text-3); }
.dash-iflow-name { font-size: 13px; font-weight: 600; flex: 1; }
.dash-iflow-pkg  { font-size: 11px; color: var(--text-3); font-family: var(--mono); }

/* ─── Empty / loading states ──────────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 60px 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-sm);
}
.empty-graphic {
  width: 48px; height: 48px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  margin: 0 auto 16px;
}
.empty-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}
.empty-sub, .empty-text {
  font-size: 13px;
  color: var(--text-2);
}

/* ─── Generate page ──────────────────────────────────────────────────────── */
.gen-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 20px;
  align-items: start;
}
.form-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  box-shadow: 0 2px 12px rgba(15,23,41,.06), 0 1px 3px rgba(15,23,41,.04);
  position: sticky;
  top: 24px;
}
.result-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 24px;
  box-shadow: 0 2px 12px rgba(15,23,41,.06), 0 1px 3px rgba(15,23,41,.04);
  min-height: 240px;
}
.panel-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.3px;
  color: var(--text);
}

/* ─── Form fields ─────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 6px; }
.field label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-2);
}
.req { color: var(--red); }
.field-hint {
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.4;
}
.field-hint code {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 0 3px;
  font-size: 11px;
}

input[type=text], input[type=password], input[type=email], select, textarea {
  width: 100%;
  font-family: var(--font);
  font-size: 13.5px;
  color: var(--text);
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--rsm);
  padding: 9px 12px;
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  resize: vertical;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }
input:hover, textarea:hover, select:hover { border-color: var(--border-2); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(99,102,241,.12);
  background: var(--surface);
}
select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%239ca3af' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Collapsible */
.collapsible { border: 1px solid var(--border); border-radius: var(--rsm); overflow: hidden; }
.collapsible summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  list-style: none;
  user-select: none;
  transition: background .12s;
}
.collapsible summary:hover { background: var(--surface-2); }
.collapsible summary::-webkit-details-marker { display: none; }
.collapsible summary::before { content: '+ '; color: var(--text-3); font-weight: 400; }
.collapsible[open] summary::before { content: '- '; }
.collapsible[open] summary { border-bottom: 1px solid var(--border); }
.coll-body { padding: 14px; display: flex; flex-direction: column; gap: 14px; background: var(--surface); }

/* ─── Notice block ────────────────────────────────────────────────────────── */
.notice {
  display: flex;
  gap: 10px;
  padding: 11px 14px;
  border-radius: var(--rsm);
  border: 1px solid;
  font-size: 12.5px;
  line-height: 1.5;
}
.notice-warn {
  background: var(--amber-bg);
  border-color: var(--amber-border);
  color: #92400e;
}
.notice-icon {
  width: 15px;
  height: 15px;
  flex-shrink: 0;
  margin-top: 1px;
  stroke-width: 2;
}
.notice-title {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .4px;
  margin-bottom: 2px;
}
.notice-body { color: #78350f; }

/* ─── Buttons ─────────────────────────────────────────────────────────────── */
.btn-row { display: flex; gap: 8px; }
button { cursor: pointer; font: inherit; border: none; border-radius: var(--rsm); transition: all .15s; }

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 20px;
  letter-spacing: -.1px;
  box-shadow: 0 1px 6px rgba(99,102,241,.35), 0 1px 2px rgba(99,102,241,.2);
}
.btn-primary:hover { background: linear-gradient(135deg, #4f52cc 0%, #7c3aed 100%); box-shadow: 0 4px 16px rgba(99,102,241,.4); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); box-shadow: 0 1px 4px rgba(99,102,241,.25); }
.btn-primary:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-ghost {
  background: var(--surface);
  border: 1.5px solid var(--border);
  color: var(--text);
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 16px;
  box-shadow: 0 1px 3px rgba(15,23,41,.05);
}
.btn-ghost:hover { background: var(--surface-2); border-color: var(--border-2); box-shadow: 0 2px 8px rgba(15,23,41,.08); }
.btn-ghost:disabled { opacity: .4; cursor: not-allowed; }

.btn-sm { font-size: 12px; padding: 5px 12px; }
.w100 { width: 100%; margin-top: 12px; }
.dim { color: var(--text-3); }

/* ─── Spinner ─────────────────────────────────────────────────────────────── */
.spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 56px 24px;
  color: var(--text-2);
  font-size: 13px;
}
.spin-ring {
  width: 30px; height: 30px;
  border: 2.5px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Result header ──────────────────────────────────────────────────────── */
.result-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 18px;
}
.result-header h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.1px;
}
.cost-tag {
  font-size: 11px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-2);
  font-family: var(--mono);
}

/* ─── Plan brief ──────────────────────────────────────────────────────────── */
.plan-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 16px 18px;
  margin-bottom: 12px;
}
.plan-card h4 {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-3);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.plan-card h4::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.scenario-text { font-size: 13px; color: var(--text); line-height: 1.7; }

.fact-list { list-style: none; display: flex; flex-direction: column; gap: 5px; }
.fact-list li {
  font-size: 12.5px;
  color: var(--text);
  padding-left: 16px;
  position: relative;
  line-height: 1.5;
}
.fact-list li::before {
  content: '';
  position: absolute;
  left: 4px; top: 8px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--accent);
}

/* Step timeline */
.step-list {
  list-style: none;
  counter-reset: step;
  position: relative;
  padding: 4px 0;
}
.step-list::before {
  content: '';
  position: absolute;
  left: 11px; top: 22px; bottom: 10px;
  width: 1px;
  background: linear-gradient(to bottom, var(--accent), transparent);
  opacity: .2;
}
.step-list li {
  counter-increment: step;
  position: relative;
  padding: 6px 0 6px 36px;
  font-size: 12.5px;
  color: var(--text);
  line-height: 1.5;
}
.step-list li::before {
  content: counter(step);
  position: absolute;
  left: 0; top: 6px;
  width: 23px; height: 23px;
  border-radius: 50%;
  background: var(--surface);
  border: 1.5px solid var(--accent);
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
  line-height: 20px;
}

.constraints-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 10px; }
.constraint-block .label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 8px;
}
.constraint-block.pos .label { color: var(--green); }
.constraint-block.neg .label { color: var(--red); }

.options-row { display: flex; flex-direction: column; gap: 8px; }
.option-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--rsm);
  padding: 14px;
  position: relative;
}
.option-card.recommended { border-color: rgba(79,70,229,.35); }
.option-card .opt-title  { font-size: 13px; font-weight: 700; margin-bottom: 3px; }
.option-card .opt-design { font-size: 12px; color: var(--text-2); margin-bottom: 8px; }
.option-card .opt-pros-cons { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 11.5px; }
.opt-pros { color: var(--green); }
.opt-cons { color: var(--red); }
.rec-badge {
  position: absolute; top: 10px; right: 10px;
  font-size: 10px; font-weight: 700;
  padding: 2px 9px; border-radius: 20px;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid rgba(79,70,229,.2);
}

.trigger-line {
  font-size: 12px; color: var(--text-2);
  margin-bottom: 12px;
  display: flex; align-items: center; flex-wrap: wrap; gap: 5px;
}
.trigger-line code {
  font-family: var(--mono); font-size: 11px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 1px 7px; border-radius: 4px; color: var(--accent);
}

/* Callouts */
.callout {
  display: flex; flex-direction: column; gap: 5px;
  padding: 11px 14px; border-radius: var(--rsm);
  border-left: 3px solid; margin-bottom: 10px;
  font-size: 12.5px; line-height: 1.6;
}
.callout.warn    { background: var(--amber-bg); border-color: var(--amber); color: #92400e; }
.callout.error   { background: var(--red-bg);   border-color: var(--red);   color: #991b1b; }
.callout.info    { background: var(--blue-bg);  border-color: var(--blue);  color: #1e40af; }
.callout.success { background: var(--green-bg); border-color: var(--green); color: #065f46; }
.callout .callout-title {
  font-size: 10.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .6px;
}
.callout ul { margin-left: 14px; }
.callout li { margin-top: 3px; }

/* Data Persistence Strategy picker */
.ds-strategy-list { display: flex; flex-direction: column; gap: 6px; }
.ds-strategy-option {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px; border-radius: var(--rsm);
  border: 1px solid var(--border);
  background: var(--surface);
  cursor: pointer; transition: border-color .15s;
}
.ds-strategy-option:hover { border-color: var(--blue); }
.ds-strategy-option input[type="radio"] { margin-top: 3px; flex-shrink: 0; accent-color: var(--blue); }
.ds-strategy-option input[type="radio"]:checked ~ .ds-strategy-body .ds-strategy-title { color: var(--blue); }
.ds-strategy-recommended { border-color: rgba(79,70,229,.3); }
.ds-strategy-body { display: flex; flex-direction: column; gap: 2px; }
.ds-strategy-title { font-size: 12.5px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
.ds-strategy-detail { font-size: 11.5px; color: var(--text-2); }
.ds-strategy-pattern {
  font-size: 11px; font-family: var(--mono); color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 3px; padding: 3px 7px; margin-top: 4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Revise bar */
.revise-bar {
  display: flex; gap: 8px;
  margin: 16px 0 10px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--rsm);
}
.revise-bar input { flex: 1; }

/* Generate result */
.gen-success {
  padding: 16px 18px;
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  border-radius: var(--rsm);
  margin-bottom: 14px;
}
.gen-success .iflow-id {
  font-size: 17px; font-weight: 800;
  color: var(--green); letter-spacing: -.3px;
  margin-bottom: 4px;
}
.gen-success .endpoint {
  font-size: 12px; color: var(--text-2);
  display: flex; align-items: center; gap: 6px;
}
.gen-success .endpoint code {
  font-family: var(--mono); font-size: 11px;
  background: var(--surface); border: 1px solid var(--border);
  padding: 1px 8px; border-radius: 4px; color: var(--accent);
}
.action-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

/* ─── iFlows page ─────────────────────────────────────────────────────────── */
.pkg-selector-bar {
  display: flex; gap: 16px; align-items: flex-end; flex-wrap: wrap;
  padding: 18px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 14px;
  box-shadow: var(--shadow-sm);
}

/* iFlow table */
.iflow-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 4px;
}
.iflow-table thead th {
  text-align: left;
  padding: 6px 16px;
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .8px;
  color: var(--text-3);
}
.iflow-table tbody tr td {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 13px 16px;
  vertical-align: middle;
  transition: background .1s;
}
.iflow-table tbody tr td:first-child {
  border-left: 1px solid var(--border);
  border-radius: var(--rsm) 0 0 var(--rsm);
}
.iflow-table tbody tr td:last-child {
  border-right: 1px solid var(--border);
  border-radius: 0 var(--rsm) var(--rsm) 0;
}
.iflow-table tbody tr:hover td { background: var(--surface-2); }
.iflow-table tbody tr.detail-tr td { background: transparent; border: none; padding: 0; border-radius: 0; }

.iflow-name { font-size: 13.5px; font-weight: 600; color: var(--text); }
.iflow-id   { font-size: 11px; color: var(--text-3); font-family: var(--mono); margin-top: 2px; }

.pkg-tag {
  font-size: 10.5px; font-weight: 700;
  padding: 3px 11px; border-radius: 20px;
  background: linear-gradient(135deg, #eef0ff, #f3f0ff);
  border: 1px solid rgba(99,102,241,.2);
  color: var(--accent);
  letter-spacing: .01em;
}

.status-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 600;
  padding: 4px 12px; border-radius: 20px;
  cursor: pointer; white-space: nowrap; border: 1px solid;
  transition: opacity .15s;
}
.status-badge::before {
  content: ''; width: 5px; height: 5px;
  border-radius: 50%; flex-shrink: 0;
}
.status-badge:hover { opacity: .7; }
.status-badge.started { background: var(--green-bg); color: #065f46; border-color: var(--green-border); }
.status-badge.started::before { background: var(--green); box-shadow: 0 0 5px rgba(5,150,105,.4); }
.status-badge.error   { background: var(--red-bg);   color: #991b1b; border-color: var(--red-border); }
.status-badge.error::before   { background: var(--red); }
.status-badge.unknown { background: var(--surface-2); color: var(--text-3); border-color: var(--border); }
.status-badge.loading { background: var(--surface-2); color: var(--text-2); border-color: var(--border); animation: pulse 1.2s ease infinite; }
@keyframes pulse { 0%,100% { opacity:1; } 50% { opacity:.4; } }

.act-btns { display: flex; gap: 5px; }
.btn-action {
  font-size: 11.5px; font-weight: 500;
  padding: 5px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text-2);
  border-radius: var(--rxs);
  transition: all .12s;
  box-shadow: var(--shadow-sm);
}
.btn-action:hover { background: var(--surface-2); color: var(--text); border-color: var(--border-2); }

/* Detail panel */
.detail-panel {
  background: var(--bg);
  border: 1px solid var(--border-2);
  border-top: none;
  border-radius: 0 0 var(--rsm) var(--rsm);
  padding: 20px 24px;
  animation: slideDown .15s ease;
  margin-bottom: 2px;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.detail-panel h4 { font-size: 13px; font-weight: 700; color: var(--accent); margin-bottom: 14px; }
.explain-text {
  font-size: 13px; line-height: 1.7; color: var(--text);
  max-height: 420px; overflow-y: auto;
}
.md-body { white-space: normal; }
.md-body h1,.md-body h2,.md-body h3 { font-size: 13.5px; font-weight: 700; color: var(--primary); margin: 14px 0 4px; }
.md-body p { margin: 0 0 8px; }
.md-body strong { font-weight: 700; color: var(--text); }
.md-body ul,.md-body ol { padding-left: 20px; margin: 0 0 8px; }
.md-body li { margin-bottom: 3px; }
.md-body code { background: var(--surface-2); border-radius: 3px; padding: 1px 5px; font-family: var(--mono); font-size: 11.5px; }
.md-body pre { background: var(--surface-2); border-radius: 6px; padding: 10px 14px; overflow-x: auto; margin: 8px 0; }
.md-body pre code { background: none; padding: 0; }
.modify-form, .verify-form { display: flex; flex-direction: column; gap: 12px; max-width: 600px; }
.modify-form .row { display: flex; gap: 10px; align-items: center; }
.modify-form label.check {
  display: flex; align-items: center; gap: 7px;
  font-size: 12.5px; color: var(--text-2); cursor: pointer;
}
.sep { height: 1px; background: var(--border); margin: 10px 0; }

/* ─── Groovy page ─────────────────────────────────────────────────────────── */
.code-block {
  background: #1e1e2e;
  border: 1px solid var(--border);
  border-radius: var(--rsm);
  padding: 18px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: #cdd6f4;
  overflow: auto;
  white-space: pre;
  max-height: 540px;
}

/* ─── Chat panel ──────────────────────────────────────────────────────────── */
.chat-panel {
  width: var(--chat-w);
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.chat-panel-header {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.chat-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}
.chat-status-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(5,150,105,.5);
}
.chat-online-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--green);
}

.chat-suggestions-wrap {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-suggestions-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--text-3);
  margin-bottom: 8px;
}
.chat-suggestions { display: flex; flex-direction: column; gap: 5px; }
.suggestion-btn {
  width: 100%;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--rsm);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  cursor: pointer;
  transition: all .12s;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.suggestion-btn:hover { background: var(--accent-light); color: var(--accent); border-color: rgba(79,70,229,.2); }
.suggestion-btn::after { content: '->'; font-size: 11px; opacity: .5; flex-shrink: 0; }

.chat-divider { height: 1px; background: var(--border); flex-shrink: 0; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px;
}
.chat-msg { display: flex; }
.chat-msg.user      { justify-content: flex-end; }
.chat-msg.assistant { justify-content: flex-start; }
.bubble {
  max-width: 88%;
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
}
.chat-msg.user .bubble {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 3px;
}
.chat-msg.assistant .bubble {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-bottom-left-radius: 3px;
}

.chat-input-bar {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-input-bar textarea {
  flex: 1;
  resize: none;
  border-radius: var(--rsm);
  font-size: 13px;
  min-height: 40px;
}
.chat-send-btn {
  width: 36px; height: 36px;
  background: var(--accent-grad);
  color: #fff;
  border: none;
  border-radius: var(--rsm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .15s;
  box-shadow: 0 2px 8px rgba(99,102,241,.3);
}
.chat-send-btn:hover { background: linear-gradient(135deg, #4f52cc, #7c3aed); box-shadow: 0 4px 14px rgba(99,102,241,.4); }
.chat-send-btn svg { width: 15px; height: 15px; stroke-width: 2; }

/* ─── Utilities ───────────────────────────────────────────────────────────── */
.hidden  { display: none !important; }
.mt16    { margin-top: 16px; }

/* ─── Validation failure block ───────────────────────────────────────────── */
.validation-fail-header {
  padding: 16px 18px;
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-left: 4px solid var(--red);
  border-radius: var(--rsm);
  margin-bottom: 14px;
}
.validation-fail-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 6px;
}
.validation-fail-sub {
  font-size: 12.5px;
  color: #991b1b;
  line-height: 1.6;
}
.validation-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--rsm);
}

/* ─── Sidebar resize handle ───────────────────────────────────────────────── */
.sidebar {
  transition: width .15s ease;
}
.sidebar-resize-handle {
  position: absolute;
  top: 0; right: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 200;
  background: transparent;
}
.sidebar-resize-handle:hover,
.sidebar-resize-handle.dragging {
  background: var(--accent);
  opacity: .25;
  border-radius: 3px;
}

/* ─── Chat panel collapse ─────────────────────────────────────────────────── */
.chat-panel {
  transition: width .2s ease;
}
.chat-collapse-btn {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--rxs);
  color: var(--text-3);
  padding: 0;
  flex-shrink: 0;
  transition: background .12s, color .12s;
}
.chat-collapse-btn:hover { background: var(--surface-2); color: var(--text-2); }
.chat-collapse-btn svg { width: 14px; height: 14px; stroke-width: 2; }

/* Collapsed strip */
.chat-collapsed-strip {
  display: none;
  flex-direction: column;
  align-items: center;
  padding: 14px 0 10px;
  gap: 12px;
  height: 100%;
}
.chat-reopen-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-light);
  border: 1px solid rgba(79,70,229,.2);
  border-radius: var(--rsm);
  color: var(--accent);
  padding: 0;
  transition: background .12s;
}
.chat-reopen-btn:hover { background: var(--accent); color: #fff; }
.chat-reopen-btn svg { width: 16px; height: 16px; stroke-width: 2; }
.chat-collapsed-label {
  font-size: 9px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--text-3);
  writing-mode: vertical-rl;
  transform: rotate(180deg);
}

/* Collapsed state */
.chat-panel.collapsed {
  width: 48px;
}
.chat-panel.collapsed .chat-collapsed-strip {
  display: flex;
}
.chat-panel.collapsed .chat-panel-header,
.chat-panel.collapsed .chat-suggestions-wrap,
.chat-panel.collapsed .chat-divider,
.chat-panel.collapsed .chat-messages,
.chat-panel.collapsed .chat-input-bar {
  display: none;
}

/* ─── Monitor page ────────────────────────────────────────────────────────── */

/* Config bar */
.mon-config-card { padding: 18px 20px 0; }
.mon-config-fields { display: flex; gap: 14px; flex-wrap: wrap; }
.mon-cfg-item { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 180px; }
.mon-cfg-item-sm { flex: 0 0 148px; }
.mon-cfg-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.mon-cfg-input, .mon-cfg-select {
  height: 36px; padding: 0 11px; border: 1px solid var(--border);
  border-radius: var(--rsm); background: var(--surface); color: var(--text-1);
  font-size: 13px; font-family: var(--font); outline: none;
}
.mon-cfg-input:focus, .mon-cfg-select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(99,102,241,.08); }
.mon-control-row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0 0; margin-top: 14px; border-top: 1px solid var(--border); }
.mon-control-actions { display: flex; align-items: center; gap: 8px; }
.mon-run-indicator { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--text-2); white-space: nowrap; }
.mon-run-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.mon-check-now-btn { font-size: 13px; padding: 9px 16px; }
.mon-refresh-icon-btn { background: var(--surface); border: 1.5px solid var(--border); cursor: pointer; color: var(--text-3); display: inline-flex; align-items: center; justify-content: center; padding: 7px; border-radius: 8px; box-shadow: 0 1px 3px rgba(15,23,41,.05); transition: all .15s; }
.mon-refresh-icon-btn:hover { color: var(--text); background: var(--surface-2); border-color: var(--border-2); box-shadow: 0 2px 8px rgba(15,23,41,.08); }
.mon-refresh-icon-btn:active { transform: translateY(1px); }
.mon-refresh-icon-btn i { width: 15px; height: 15px; }
.mon-dot-on  { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.2); animation: mon-pulse 2s infinite; }
.mon-dot-off { background: var(--border-2); }
@keyframes mon-pulse { 0%,100% { box-shadow: 0 0 0 3px rgba(34,197,94,.2); } 50% { box-shadow: 0 0 0 5px rgba(34,197,94,.1); } }
.mon-timing-bar { font-size: 11px; color: var(--text-3); padding: 8px 0 14px; margin-top: 10px; border-top: 1px solid var(--border); }

/* Recipients reminder bar */
.mon-recipients-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 16px 10px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-3);
  background: var(--surface-2);
}
.mon-recipients-list { display: flex; flex-wrap: wrap; gap: 5px; flex: 1; }
.mon-recipient-chip {
  background: #e0e7ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
  border-radius: 10px;
  padding: 1px 9px;
  font-size: 11.5px;
  font-weight: 500;
}
.mon-recipients-edit {
  font-size: 11px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0 4px;
  text-decoration: underline;
  text-underline-offset: 2px;
  flex-shrink: 0;
}
.btn-danger {
  background: #dc2626;
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 20px;
  letter-spacing: -.1px;
  box-shadow: 0 1px 6px rgba(220,38,38,.35), 0 1px 2px rgba(220,38,38,.2);
}
.btn-danger:hover { background: #b91c1c; box-shadow: 0 4px 16px rgba(220,38,38,.4); transform: translateY(-1px); }
.btn-danger:active { transform: translateY(0); box-shadow: 0 1px 4px rgba(220,38,38,.25); }

/* Search */
.mon-search {
  height: 30px; padding: 0 10px; border: 1px solid var(--border);
  border-radius: var(--rsm); background: var(--surface); color: var(--text-1);
  font-size: 12.5px; font-family: var(--font); outline: none; width: 200px;
}
.mon-search:focus { border-color: var(--blue); }
.mon-empty-hint { font-size: 13px; color: var(--text-3); padding: 20px 0; margin: 0; }
.mon-loading { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); padding: 20px 0; }
.mon-load-err { font-size: 13px; color: var(--red, #dc2626); padding: 16px 0; line-height: 1.6; }
.mon-spin { animation: mon-rotate 1s linear infinite; width: 16px; height: 16px; }
@keyframes mon-rotate { to { transform: rotate(360deg); } }

/* Package accordion */
.mon-pkg-section { border-bottom: 1px solid var(--border); }
.mon-pkg-section:last-child { border-bottom: none; }
.mon-pkg-header {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 11px 14px; cursor: pointer; user-select: none; transition: background .12s;
}
.mon-pkg-header:hover { background: var(--surface-2); }
.mon-pkg-left { display: flex; align-items: center; gap: 8px; }
.mon-pkg-chevron { width: 14px; height: 14px; color: var(--text-3); transition: transform .2s; flex-shrink: 0; }
.mon-chev-open { transform: rotate(90deg); }
.mon-pkg-name { font-size: 13px; font-weight: 700; color: var(--text-1); }
.mon-pkg-count { font-size: 11px; color: var(--text-3); font-weight: 400; }
.mon-pkg-right { display: flex; gap: 6px; align-items: center; }
.mon-pkg-badge-fail { font-size: 10.5px; font-weight: 700; color: #dc2626; background: #fee2e2; padding: 2px 8px; border-radius: 10px; }
.mon-pkg-badge-watch { font-size: 10.5px; font-weight: 600; color: var(--blue); background: rgba(79,70,229,.08); padding: 2px 8px; border-radius: 10px; }

/* Package flow list */
.mon-pkg-flows { display: none; border-top: 1px solid var(--border); }
.mon-pkg-open  { display: block; }
.mon-flow-row {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 14px 9px 36px; border-bottom: 1px solid var(--border); transition: background .1s;
}
.mon-flow-row:last-child { border-bottom: none; }
.mon-flow-row:hover { background: var(--surface-2); }
.mon-fdot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.mon-fdot-none { background: var(--border-2); }
.mon-fdot-ok   { background: #22c55e; }
.mon-fdot-fail { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.15); }
.mon-flow-name { font-size: 12.5px; color: var(--text-1); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mon-flow-status-txt { min-width: 60px; }
.mon-flow-fail-tag { font-size: 10px; font-weight: 700; color: #dc2626; background: #fee2e2; padding: 1px 7px; border-radius: 9px; letter-spacing: .04em; }
.mon-flow-ok-tag   { font-size: 10px; font-weight: 600; color: #166534; background: #dcfce7; padding: 1px 7px; border-radius: 9px; }
.mon-flow-chk-label { display: flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text-2); cursor: pointer; white-space: nowrap; }
.mon-flow-chk-label input { accent-color: var(--blue); width: 13px; height: 13px; }
.mon-chk-dim { opacity: .4; pointer-events: none; }
.mon-chk { cursor: pointer; }

/* Failure cards */
.mon-fail-card { border: 1px solid var(--border); border-radius: var(--r); margin-bottom: 12px; overflow: hidden; }
.mon-fail-header {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px;
  padding: 11px 16px; background: #fef2f2; border-bottom: 1px solid #fee2e2;
}
.mon-fail-name { font-size: 13px; font-weight: 700; color: #991b1b; }
.mon-fail-badge { font-size: 10px; font-weight: 700; color: #fff; background: #dc2626; padding: 2px 8px; border-radius: 10px; letter-spacing: .06em; }
.mon-fail-time { font-size: 11.5px; color: var(--text-2); }
.mon-fail-body { padding: 12px 16px; display: flex; flex-direction: column; gap: 9px; }
.mon-ai-box { background: #fff7ed; border-left: 3px solid #f97316; padding: 9px 12px; border-radius: 0 4px 4px 0; }
.mon-ai-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: #9a3412; margin-bottom: 4px; }
.mon-ai-text  { font-size: 13px; color: var(--text-1); line-height: 1.5; }
.mon-meta { font-size: 12.5px; color: var(--text-1); }
.mon-meta code { background: var(--surface-2); padding: 1px 5px; border-radius: 3px; font-size: 11.5px; font-family: var(--mono); }
.mon-err-txt { color: var(--text-2); word-break: break-word; }
.mon-headers-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); margin-bottom: 5px; }
.mon-headers-grid { display: grid; grid-template-columns: auto 1fr; gap: 3px 14px; font-size: 12px; }
.mon-hkey { font-weight: 600; color: var(--text-2); white-space: nowrap; }
.mon-hval { font-family: var(--mono); color: var(--text-1); word-break: break-all; }
.mon-corr { font-size: 11px; color: var(--text-3); }

/* Dashboard health widget */
.dash-health-summary { font-size: 12.5px; font-weight: 600; margin-bottom: 10px; }
.dash-health-warn { color: #dc2626; }
.dash-health-good { color: #166534; }
.dash-health-grid { display: flex; flex-wrap: wrap; gap: 7px; }
.dash-health-pill {
  display: flex; align-items: center; gap: 6px; padding: 5px 11px;
  border-radius: 20px; border: 1px solid var(--border); background: var(--surface);
  cursor: pointer; font-size: 12px; transition: border-color .15s, background .15s;
}
.dash-health-pill:hover { border-color: var(--blue); background: var(--surface-2); }
.dhp-fail { border-color: #fca5a5; background: #fff5f5; }
.dhp-ok   { border-color: #bbf7d0; background: #f0fdf4; }
.dhp-dot  { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.dhp-dot-fail { background: #dc2626; }
.dhp-dot-ok   { background: #22c55e; }
.dhp-name { color: var(--text-1); font-weight: 500; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dhp-imm-tag { font-size: 9px; font-weight: 700; color: #7c3aed; background: #ede9fe; padding: 1px 5px; border-radius: 6px; }

/* ─── Settings page ───────────────────────────────────────────────────────── */
.settings-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.settings-section-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.settings-section-icon {
  width: 40px; height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.settings-section-icon svg { width: 18px; height: 18px; stroke-width: 2; }
.settings-section-icon.blue   { background: #eff6ff; color: #2563eb; }
.settings-section-icon.purple { background: #f5f3ff; color: #7c3aed; }
.settings-section-icon.green  { background: #ecfdf5; color: #059669; }
.settings-section-title { font-size: 14px; font-weight: 700; color: var(--text); }
.settings-section-sub   { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.settings-grid .field:only-child,
.settings-grid .field.full { grid-column: 1 / -1; }
.cfg-status {
  margin-left: auto;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 20px;
  white-space: nowrap;
}
.cfg-status.ok  { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.cfg-status.err { background: var(--red-bg);   color: var(--red);   border: 1px solid var(--red-border);   }
.cfg-status.set { background: var(--accent-light); color: var(--accent); border: 1px solid rgba(99,102,241,.2); }
/* SMTP mode toggle */
.smtp-mode-wrap {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.smtp-mode-opt {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  min-width: 220px;
  border: 1.5px solid var(--border);
  border-radius: var(--r);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: var(--surface-2);
}
.smtp-mode-opt:hover { border-color: var(--accent); }
.smtp-mode-opt.smtp-mode-selected { border-color: var(--accent); background: var(--accent-light); }
.smtp-mode-opt input[type="radio"] { margin-top: 2px; flex-shrink: 0; accent-color: var(--accent); }
.smtp-mode-body { display: flex; flex-direction: column; gap: 2px; }
.smtp-mode-title { font-size: 13.5px; font-weight: 600; color: var(--text); display: flex; align-items: center; gap: 7px; }
.smtp-mode-sub   { font-size: 12px; color: var(--text-3); line-height: 1.4; }
.smtp-free-badge {
  font-size: 10px;
  font-weight: 700;
  background: #dcfce7;
  color: #15803d;
  border: 1px solid #bbf7d0;
  border-radius: 9px;
  padding: 1px 7px;
  letter-spacing: .04em;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.settings-msg {
  font-size: 13px;
  font-weight: 600;
  padding: 0 4px;
}
.settings-msg.ok  { color: var(--green); }
.settings-msg.err { color: var(--red); }
.settings-info-box {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  border-radius: var(--rsm);
  font-size: 13px;
  color: #065f46;
  line-height: 1.6;
}

/* ─── Global banner ──────────────────────────────────────────────────────── */
.global-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 9999;
  padding: 11px 20px;
  font-size: 13.5px;
  font-weight: 500;
  text-align: center;
  display: none;
  animation: slideDown .2s ease;
}
.global-banner.info  { background: #e0f2fe; color: #0369a1; }
.global-banner.warn  { background: #fef3c7; color: #92400e; }
.global-banner.error { background: #fee2e2; color: #991b1b; }
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }

/* ─── Auth screen ─────────────────────────────────────────────────────────── */
.auth-screen {
  position: fixed;
  inset: 0;
  background: linear-gradient(135deg, #0d1117 0%, #1e1b4b 60%, #0d1117 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}
.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 36px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 24px 64px rgba(0,0,0,.4), 0 4px 16px rgba(99,102,241,.15);
}
.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}
.auth-tabs {
  display: flex;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--rsm);
  padding: 3px;
  margin-bottom: 24px;
}
.auth-tab {
  flex: 1;
  padding: 7px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}
.auth-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 4px rgba(15,23,41,.1);
}
.auth-link-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12.5px;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.auth-link-btn:hover { color: var(--accent-h); }
.auth-err {
  margin-top: 10px;
  padding: 9px 12px;
  background: var(--red-bg);
  border: 1px solid var(--red-border);
  border-radius: var(--rsm);
  font-size: 12.5px;
  color: #991b1b;
}
.auth-err.auth-ok {
  background: var(--green-bg);
  border-color: var(--green-border);
  color: var(--green);
}
.auth-logout-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  width: 100%;
  padding: 6px 8px;
  background: transparent;
  border: none;
  border-radius: var(--rsm);
  color: var(--sb-text-3);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.auth-logout-btn:hover { background: rgba(220,38,38,.12); color: #f87171; }

/* ─── Scrollbars ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .chat-panel { display: none; }
  .stats-row  { grid-template-columns: repeat(2, 1fr); }
  .quick-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 820px) {
  .gen-layout { grid-template-columns: 1fr; }
  .form-panel { position: static; }
  .constraints-row { grid-template-columns: 1fr; }
}

/* ─── Mobile sidebar & layout ────────────────────────────────────────────── */
.mob-hamburger {
  display: none;
  align-items: center; justify-content: center;
  background: none; border: none; cursor: pointer;
  color: var(--text); padding: 6px; border-radius: var(--rsm);
  flex-shrink: 0; touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.mob-hamburger i { width: 22px; height: 22px; }

.mob-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 199;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.mob-overlay.visible { display: block; }

/* ─── Admin page ─────────────────────────────────────────────────────────── */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}
.admin-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px 18px;
  text-align: center;
}
.admin-stat-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
  margin-bottom: 8px;
}
.admin-stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.5px;
}
.adm-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  margin-bottom: 20px;
  overflow: hidden;
}
.adm-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
}
.adm-section-title {
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text);
}
.adm-table-wrap { overflow-x: auto; }
.adm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.adm-table th {
  text-align: left;
  padding: 9px 16px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.adm-table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  white-space: nowrap;
}
.adm-table tr:last-child td { border-bottom: none; }
.adm-table tbody tr:hover td { background: var(--surface-2); }
.adm-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}
.adm-badge.adm-ok { background: var(--green-bg); color: var(--green); }
.adm-badge.adm-na { background: var(--surface-2); color: var(--text-3); }

@media (max-width: 640px) {
  /* Sidebar becomes a slide-in drawer */
  .sidebar {
    transform: translateX(-100%);
    transition: transform .22s ease;
    z-index: 200;
    width: 260px;
    height: 100vh;
    height: 100dvh;
  }
  .sidebar.mob-open { transform: translateX(0); }
  .sidebar-footer {
    padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    flex-shrink: 0;
  }

  /* Shell: no sidebar margin, full width */
  .app-shell {
    margin-left: 0;
    height: 100vh;
    height: 100dvh;
  }

  /* Show hamburger */
  .mob-hamburger { display: flex; }

  /* Prevent browser auto-zoom on input focus (triggers when font-size < 16px) */
  input, textarea, select { font-size: 16px !important; }

  /* Topbar compact */
  .topbar { padding: 0 14px; gap: 10px; }

  /* Content */
  .main-content {
    padding: 16px 14px;
    padding-bottom: calc(80px + env(safe-area-inset-bottom, 0px));
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior-y: contain;
    touch-action: pan-y;
    will-change: scroll-position;
  }

  /* Layout simplifications */
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 22px; }
  .quick-grid { grid-template-columns: 1fr; }
  .settings-grid { grid-template-columns: 1fr; }
  .mon-config-fields { flex-direction: column; }
  .card { padding: 14px; }
  .card-header { flex-wrap: wrap; gap: 8px; }
  .auth-card { padding: 28px 20px; margin: 0 12px; }
  .sidebar-resize-handle { display: none; }
}

/* Nav items: fast tap on all devices */
.nav-item {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ─── Chat FAB ───────────────────────────────────────────────────────────── */
.chat-fab-root {
  position: fixed;
  bottom: 24px; right: 24px;
  z-index: 400;
  display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
  pointer-events: none; /* container is invisible to touch — only children opt back in */
}
.chat-fab {
  pointer-events: auto;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(99,102,241,.45);
  color: #fff;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: transform .15s, box-shadow .15s;
}
.chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 28px rgba(99,102,241,.55); }
.chat-fab i { width: 22px; height: 22px; }

.chat-popup {
  width: 360px; height: 500px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(15,23,41,.18), 0 2px 8px rgba(15,23,41,.08);
  display: flex; flex-direction: column;
  overflow: hidden;
  opacity: 0; transform: translateY(16px) scale(.96);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.chat-popup.open {
  opacity: 1; transform: none;
  pointer-events: all;
}
.chat-popup-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.chat-popup-title {
  display: flex; align-items: center; gap: 8px;
  font-weight: 600; font-size: 14px; color: var(--text);
}
.chat-popup-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-3); padding: 4px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  touch-action: manipulation;
}
.chat-popup-close:hover { background: var(--hover); color: var(--text); }
.chat-popup-close i { width: 16px; height: 16px; }

/* Horizontal suggestion chips */
.chat-suggestions-wrap {
  padding: 10px 12px 8px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.chat-suggestions {
  display: flex; flex-direction: row; gap: 8px;
  overflow-x: auto; scrollbar-width: none;
}
.chat-suggestions::-webkit-scrollbar { display: none; }
.suggestion-btn {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 12px; font-family: var(--font); color: var(--text-2);
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  touch-action: manipulation; -webkit-tap-highlight-color: transparent;
  transition: background .12s, border-color .12s, color .12s;
}
.suggestion-btn:hover { background: var(--accent); border-color: var(--accent); color: #fff; }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 14px 14px 6px;
  display: flex; flex-direction: column; gap: 10px;
  -webkit-overflow-scrolling: touch;
}
.chat-msg { display: flex; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg .bubble {
  max-width: 85%; padding: 9px 13px;
  border-radius: 14px; font-size: 13.5px; line-height: 1.55;
}
.chat-msg.user .bubble {
  background: var(--accent); color: #fff; border-bottom-right-radius: 4px;
}
.chat-msg.assistant .bubble {
  background: var(--surface-2); color: var(--text); border-bottom-left-radius: 4px;
  border: 1px solid var(--border);
}

.chat-input-bar {
  display: flex; gap: 8px; padding: 10px 12px 12px;
  border-top: 1px solid var(--border); flex-shrink: 0;
  align-items: flex-end;
}
.chat-input-bar textarea {
  flex: 1; resize: none; min-height: 38px; max-height: 100px;
  font-size: 13.5px; border-radius: 10px;
}
.chat-send-btn {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--accent); border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  color: #fff; flex-shrink: 0;
  touch-action: manipulation;
}
.chat-send-btn:hover { background: var(--accent-h); }
.chat-send-btn i { width: 16px; height: 16px; }

/* Markdown styles */
.md-pre { background: var(--surface-2); border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; overflow-x: auto; font-size: 12.5px; margin: 6px 0; }
.md-inline { background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; font-size: 12.5px; font-family: var(--mono); }
.md-h1, .md-h2, .md-h3 { font-weight: 700; margin: 8px 0 4px; color: var(--text); }
.md-h1 { font-size: 16px; } .md-h2 { font-size: 15px; } .md-h3 { font-size: 14px; }
.md-li { padding-left: 14px; position: relative; margin: 2px 0; }
.md-li::before { content: '•'; position: absolute; left: 0; color: var(--accent); }

/* Mobile: FAB clears the browser bottom bar */
@media (max-width: 640px) {
  .chat-fab-root { bottom: calc(72px + env(safe-area-inset-bottom, 0px)); right: 16px; }
  .chat-popup { width: calc(100vw - 32px); height: 420px; }
}

/* ── Performance Analyzer ─────────────────────────────────────────────── */
.perf-live-badge { font-size: 10px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--green); margin-left: 8px; margin-right: auto; }
.perf-live-badge:not(:empty)::before { content: ""; display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: var(--green); margin-right: 5px; animation: perfPulse 2s infinite; }
@keyframes perfPulse { 0%,100% { opacity: 1 } 50% { opacity: .35 } }

.perf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }

.perf-card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 16px 18px; transition: box-shadow .18s ease, transform .18s ease; }
.perf-card:hover { box-shadow: 0 8px 24px rgba(15, 23, 41, .08); transform: translateY(-1px); }
.perf-card-degraded { border-left: 3px solid var(--red); background: linear-gradient(135deg, #fff 70%, var(--red-bg)); }

.perf-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.perf-flow-name { font-weight: 700; font-size: 13px; color: var(--text); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }

.perf-badge { font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.perf-badge-bad    { color: var(--red);   background: var(--red-bg);   border: 1px solid var(--red-border); }
.perf-badge-good   { color: var(--green); background: var(--green-bg); border: 1px solid var(--green-border); }
.perf-badge-steady { color: #6b7280;      background: #f3f4f6;         border: 1px solid var(--border); }
.perf-badge-mute   { color: #9ca3af;      background: #f8f9fc;         border: 1px dashed var(--border); font-weight: 500; }

.perf-card-body { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.perf-avg { font-size: 26px; font-weight: 800; color: var(--text); letter-spacing: -.02em; line-height: 1.1; }
.perf-sub { font-size: 11px; color: #8a91a3; margin-top: 3px; }
.perf-fail { color: var(--red); font-weight: 600; }
.perf-spark { width: 150px; height: 40px; flex-shrink: 0; }
.perf-spark-empty { display: flex; align-items: center; justify-content: center; font-size: 11px;
  color: #b6bcc9; width: 150px; height: 40px; border: 1px dashed var(--border); border-radius: 8px; }

.perf-cause { margin-top: 12px; padding: 10px 12px; background: var(--amber-bg);
  border-left: 3px solid var(--amber); border-radius: 0 8px 8px 0; }
.perf-cause-label { font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--amber); margin-bottom: 3px; }
.perf-cause-text { font-size: 12.5px; color: var(--text); }

.perf-breakdown { margin-top: 8px; display: flex; flex-direction: column; gap: 4px; }
.perf-bd-row { display: grid; grid-template-columns: 110px 1fr 90px; align-items: center; gap: 8px; font-size: 11px; }
.perf-bd-step { color: #4b5563; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.perf-bd-bar { height: 6px; background: rgba(15,23,41,.06); border-radius: 4px; overflow: hidden; }
.perf-bd-bar > span { display: block; height: 100%; background: var(--amber); border-radius: 4px; }
.perf-bd-ms { color: #6b7280; font-family: "JetBrains Mono", monospace; font-size: 10px; text-align: right; }

/* ── Monitor redesign: hero + flow board ─────────────────────────────── */
.mon-hero { display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 22px 24px; border-radius: 16px; margin-bottom: 4px; border: 1px solid var(--border);
  background: var(--surface); transition: background .3s ease, border-color .3s ease; flex-wrap: wrap; }
.mon-hero-ok  { background: linear-gradient(135deg, #ffffff 55%, var(--green-bg)); border-color: var(--green-border); }
.mon-hero-bad { background: linear-gradient(135deg, #ffffff 45%, var(--red-bg)); border-color: var(--red-border); }
.mon-hero-off { background: var(--surface); }

.mon-hero-main { display: flex; align-items: center; gap: 16px; min-width: 260px; }
.mon-hero-ring { width: 46px; height: 46px; border-radius: 50%; display: flex; align-items: center;
  justify-content: center; flex-shrink: 0; border: 2px solid var(--border); background: #fff; }
.mon-hero-ok  .mon-hero-ring { border-color: var(--green); box-shadow: 0 0 0 5px var(--green-bg); }
.mon-hero-bad .mon-hero-ring { border-color: var(--red);   box-shadow: 0 0 0 5px var(--red-bg); }
.mon-hero-ring .mon-run-dot { width: 14px; height: 14px; }

.mon-hero-title { font-size: 19px; font-weight: 800; letter-spacing: -.02em; color: var(--text); }
.mon-hero-bad .mon-hero-title { color: var(--red); }
.mon-hero-ok  .mon-hero-title { color: #065f46; }
.mon-hero-sub { font-size: 12.5px; color: #8a91a3; margin-top: 3px; }
.mon-hero-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

#mon-flow-board { margin-top: 14px; margin-bottom: 16px; }

.flow-card .perf-flow-name { font-size: 15px; margin-bottom: 1px; }
.flow-pkg { font-size: 11px; color: #a2a8b8; margin-bottom: 10px; }

.flow-health { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .06em; margin-right: auto; }
.flow-health-dot { width: 8px; height: 8px; border-radius: 50%; }
.flow-health-healthy { color: var(--green); } .flow-health-healthy .flow-health-dot { background: var(--green); box-shadow: 0 0 0 3px var(--green-bg); }
.flow-health-failing { color: var(--red); }   .flow-health-failing .flow-health-dot { background: var(--red); box-shadow: 0 0 0 3px var(--red-bg); animation: perfPulse 1.4s infinite; }
.flow-health-paused  { color: #9ca3af; }      .flow-health-paused .flow-health-dot { background: #cbd5e1; }

.flow-failing { border-left: 3px solid var(--red); }
.flow-imm-badge { font-size: 9.5px; font-weight: 800; color: var(--accent); background: var(--accent-light);
  border-radius: 10px; padding: 2px 8px; letter-spacing: .04em; }

.flow-lasterr { margin-top: 12px; padding: 10px 12px; background: var(--red-bg);
  border-left: 3px solid var(--red); border-radius: 0 8px 8px 0; }
.flow-lasterr-label { font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--red); margin-bottom: 3px; }
.flow-lasterr-text { font-size: 12px; color: var(--text); }

.mon-board-empty { text-align: center; padding: 46px 20px; background: var(--surface);
  border: 1px dashed var(--border); border-radius: 16px; }
.mon-board-empty-art { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 16px;
  background: var(--accent-light); color: var(--accent); display: flex; align-items: center; justify-content: center; }
.mon-board-empty-art svg { width: 26px; height: 26px; }
.mon-board-empty-title { font-size: 16px; font-weight: 800; color: var(--text); }
.mon-board-empty-sub { font-size: 13px; color: #8a91a3; max-width: 460px; margin: 6px auto 18px; }

.mon-settings-card { padding: 16px 18px; margin-bottom: 4px; }
.mon-ai-toggle { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px;
  padding-top: 13px; border-top: 1px solid var(--border, #eceef3); cursor: pointer; }
.mon-ai-toggle input { margin-top: 2px; width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; flex-shrink: 0; }
.mon-ai-toggle-text { display: flex; flex-direction: column; gap: 2px; }
.mon-ai-toggle-text strong { font-size: 13px; color: var(--text, #0f1729); font-weight: 600; }
.mon-ai-toggle-sub { font-size: 12px; color: var(--text-3, #6b7280); line-height: 1.45; }

/* Stuck state — messages not completing */
.flow-health-stuck { color: var(--amber); }
.flow-health-stuck .flow-health-dot { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-bg); animation: perfPulse 1.4s infinite; }
.flow-stuck { margin-top: 12px; padding: 10px 12px; background: var(--amber-bg);
  border-left: 3px solid var(--amber); border-radius: 0 8px 8px 0; }
.flow-stuck-label { font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  color: var(--amber); margin-bottom: 3px; }
.flow-stuck-text { font-size: 12px; color: var(--text); }
.flow-stuck-card { border-left: 3px solid var(--amber); }

/* ── Watch-list picker redesign ──────────────────────────────────────── */
.mon-chips-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 12px 14px; margin-bottom: 12px; background: var(--accent-light);
  border: 1px solid #dfe3ff; border-radius: 12px; }
.mon-chips-empty { color: #8a91a3; font-size: 12.5px; background: #f8f9fc; border: 1px dashed var(--border); }
.mon-chips-label { font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em;
  color: var(--accent); margin-right: 4px; }

.mon-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 20px; padding: 4px 6px 4px 6px; font-size: 12px;
  box-shadow: 0 1px 3px rgba(15,23,41,.05); }
.mon-chip-imm { border-color: var(--accent); }
.mon-chip-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 600; color: var(--text); }
.mon-chip-bell { border: none; background: #f1f2f8; color: #a2a8b8; border-radius: 50%;
  width: 20px; height: 20px; font-size: 11px; cursor: pointer; line-height: 1; }
.mon-chip-bell.on { background: var(--accent-light); color: var(--accent); }
.mon-chip-x { border: none; background: none; color: #a2a8b8; font-size: 15px; cursor: pointer;
  padding: 0 4px; border-radius: 50%; }
.mon-chip-x:hover { color: var(--red); background: var(--red-bg); }

.mon-flow-row2 { display: flex; align-items: center; gap: 10px; padding: 9px 12px; cursor: pointer;
  border-radius: 9px; transition: background .12s ease; font-size: 13px; user-select: none; }
.mon-flow-row2:hover { background: #f5f6fb; }
.mon-flow-row2.watched { background: var(--accent-light); }
.mon-flow-row2.watched:hover { background: #e3e6ff; }
.mon-row-check { width: 20px; height: 20px; border-radius: 6px; display: flex; align-items: center;
  justify-content: center; font-size: 12px; font-weight: 800; flex-shrink: 0;
  border: 1.5px solid var(--border); color: #b6bcc9; background: var(--surface); }
.mon-flow-row2.watched .mon-row-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.mon-row-hint { margin-left: auto; font-size: 11px; color: #c3c8d4; opacity: 0; transition: opacity .12s; }
.mon-flow-row2:hover .mon-row-hint { opacity: 1; }
.mon-row-bell { margin-left: auto; border: 1px solid var(--border); background: var(--surface);
  color: #8a91a3; border-radius: 20px; padding: 3px 10px; font-size: 11px; font-weight: 700; cursor: pointer; }
.mon-row-bell.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.mon-savebar { position: sticky; bottom: 12px; display: flex; align-items: center; gap: 10px;
  margin-top: 14px; padding: 12px 16px; background: #101528; color: #e2e8f0; border-radius: 12px;
  font-size: 13px; box-shadow: 0 10px 30px rgba(15,23,41,.25); }
.mon-savebar-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--amber);
  animation: perfPulse 1.4s infinite; flex-shrink: 0; }
.mon-savebar-actions { margin-left: auto; display: flex; gap: 8px; }
.mon-savebar .btn-ghost { color: #cbd5e1; border-color: #2b3149; }

/* ── Watch-list picker v2 — calm, aligned, icon-consistent ───────────── */
.mon-manage-head { display: flex; align-items: flex-start; justify-content: space-between;
  gap: 14px; margin-bottom: 14px; flex-wrap: wrap; }
.mon-manage-sub { font-size: 12px; color: #8a91a3; margin-top: 3px; }
.mon-manage-actions { display: flex; gap: 8px; align-items: center; }
.mon-manage-actions .mon-search { width: 220px; }
.mon-manage-actions .btn-ghost { display: flex; align-items: center; justify-content: center; padding: 7px 10px; }

.mon-chips-strip { background: #f8f9fc; border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 12px; }
.mon-chip { padding: 3px 4px 3px 10px; border-radius: 8px; box-shadow: none; gap: 5px; }
.mon-chip-zap { width: 11px; height: 11px; color: var(--accent); flex-shrink: 0; }
.mon-chip-x { display: flex; align-items: center; justify-content: center; width: 18px; height: 18px; padding: 0; }
.mon-chip-x svg { width: 12px; height: 12px; }

.mon-flow-row2 { padding: 8px 10px; border-radius: 8px; }
.mon-flow-row2.watched { background: transparent; box-shadow: inset 3px 0 0 var(--accent); border-radius: 4px 8px 8px 4px; }
.mon-flow-row2.watched:hover { background: #f5f6fb; }
.mon-flow-row2.watched .mon-flow-name { font-weight: 600; }
.mon-row-check { border-radius: 50%; }
.mon-row-check svg { width: 12px; height: 12px; }

.mon-row-bell { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 8px; }
.mon-row-bell svg { width: 11px; height: 11px; }
.mon-row-bell:not(.on) svg { opacity: .45; }

.mon-savebar { position: static; margin: 14px -2px 0; border-radius: 10px; padding: 10px 14px; }
.mon-savebar-discard { border: none; background: none; color: #94a3b8; font-size: 12.5px;
  cursor: pointer; padding: 6px 10px; }
.mon-savebar-discard:hover { color: #e2e8f0; }

/* ── "Suggested to watch" — AI-surfaced flows worth watching ───────────── */
.mon-suggest { border: 1px solid var(--accent); background: linear-gradient(180deg, var(--accent-light), transparent);
  border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.mon-suggest-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.mon-suggest-head > span { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 700; color: var(--text); }
.mon-suggest-head svg { width: 15px; height: 15px; color: var(--accent); }
.mon-suggest-all { border: 1px solid var(--accent); background: var(--accent); color: #fff; font-weight: 700;
  font-size: 12px; padding: 5px 12px; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.mon-suggest-all:hover { background: var(--accent-h); }
.mon-suggest-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mon-suggest-chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: 12px; font-weight: 600; padding: 4px 10px 4px 7px;
  border-radius: 20px; cursor: pointer; max-width: 220px; }
.mon-suggest-chip:hover { border-color: var(--accent); color: var(--accent); }
.mon-suggest-chip svg { width: 12px; height: 12px; color: var(--accent); flex-shrink: 0; }
.mon-suggest-chip span, .mon-suggest-chip { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Domain divider — separates "Flows" from "Queues" so they never blur ── */
.mon-domain-divider { display: flex; align-items: baseline; gap: 12px; margin: 30px 2px 14px; padding-top: 22px;
  border-top: 1px solid var(--border); }
.mon-domain-label { display: inline-flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 800;
  letter-spacing: -.01em; color: var(--text); }
.mon-domain-label svg { width: 16px; height: 16px; color: var(--accent); }
.mon-domain-sub { font-size: 12.5px; color: var(--text-3); }

/* ── JMS Queue Health — premium monitoring table ──────────────────────── */
.qh-scroll { overflow-x: auto; margin: 2px -4px 0; }
.qh-table { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 640px; font-size: 13px; }
.qh-table th { text-align: left; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-3); padding: 0 14px 9px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.qh-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.qh-table tbody tr:last-child td { border-bottom: none; }
.qh-row { transition: background .12s; }
.qh-row:hover { background: var(--surface-2); }
.qh-row.qh-bad { background: linear-gradient(90deg, rgba(220,38,38,.035), transparent 40%); }
/* column widths */
.qh-table th:nth-child(1), .qh-table td:nth-child(1) { width: 30%; }
.qh-table th:nth-child(2), .qh-table td:nth-child(2) { width: 16%; }
.qh-table th:nth-child(7), .qh-table td:nth-child(7) { width: 92px; text-align: right; }
/* name: truncate + tooltip (min-width:0 so ellipsis works in a fixed table) */
.qh-name { display: block; font-weight: 600; color: var(--accent); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.qh-num { text-align: right; font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; white-space: nowrap; }
.qh-muted { color: var(--text-3); }
.qh-amber { color: var(--amber, #b45309); font-weight: 700; }
.qh-red   { color: var(--red, #dc2626); font-weight: 700; }
.qh-mode { font-size: 11.5px; color: var(--text-3); }
.qh-mode.qh-excl { color: var(--amber, #b45309); font-weight: 700; }
.qh-tag { font-size: 10px; font-weight: 700; color: var(--amber, #b45309); background: #fffbeb; border: 1px solid #fde68a;
  border-radius: 5px; padding: 1px 5px; margin-left: 4px; white-space: nowrap; }
.qh-tag-red { color: var(--red, #dc2626); background: #fef2f2; border-color: #fecaca; }
.qh-status { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: 20px; white-space: nowrap; }
.s-ok      { color: #16a34a; background: #f0fdf4; }
.s-warn    { color: var(--amber, #b45309); background: #fffbeb; }
.s-failed, .s-frozen, .s-stopped { color: #fff; background: var(--red, #dc2626); }
.qh-actions { text-align: right; white-space: nowrap; }
.qh-why, .qh-retry { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--border);
  background: var(--surface); font-weight: 700; font-size: 11.5px; padding: 4px 9px; border-radius: 7px;
  cursor: pointer; white-space: nowrap; }
.qh-why { color: var(--accent); }
.qh-why:hover { background: var(--accent-light); border-color: var(--accent); }
.qh-retry { color: var(--amber, #b45309); margin-left: 6px; }
.qh-retry:hover { background: #fffbeb; border-color: var(--amber, #d97706); }
.qh-act { color: var(--text-2); }
.qh-act:hover { background: var(--surface-2); border-color: var(--border-2, #c7cbd8); }
.qh-why svg, .qh-retry svg, .qh-act svg { width: 12px; height: 12px; }
/* Queue actions popup */
.qact-list { display: flex; flex-direction: column; gap: 8px; }
.qact-item { display: flex; align-items: center; gap: 11px; width: 100%; text-align: left; border: 1px solid var(--border);
  background: var(--surface); border-radius: 10px; padding: 11px 13px; cursor: pointer; }
.qact-item > svg { width: 18px; height: 18px; flex-shrink: 0; color: var(--text-3); }
.qact-item b { display: block; font-size: 13.5px; }
.qact-item span { display: block; font-size: 11.5px; color: var(--text-3); }
.qact-retry:hover { border-color: var(--accent); }
.qact-retry:hover > svg { color: var(--accent); }
.qact-delete { cursor: pointer; }
.qact-delete:hover { border-color: var(--red, #dc2626); background: #fffafa; }
.qact-delete:hover > svg { color: var(--red, #dc2626); }
.qact-move-row { cursor: default; }
.qact-select { display: block; margin-top: 6px; width: 100%; padding: 6px 8px; border: 1px solid var(--border);
  border-radius: 7px; font-size: 12.5px; background: var(--surface); }
.qact-go { border: 1px solid var(--accent); background: var(--accent); color: #fff; font-weight: 700; font-size: 12px;
  padding: 6px 14px; border-radius: 7px; cursor: pointer; align-self: center; }
.qact-go:disabled { opacity: .5; cursor: not-allowed; }
.qact-note { font-size: 12px; color: var(--accent); min-height: 16px; margin: 10px 0 2px; }

/* On-brand confirm dialog — replaces window.confirm. Stacks above other modals. */
.ui-confirm-overlay { position: fixed; inset: 0; background: rgba(15,23,41,.55); z-index: 3000;
  display: flex; align-items: center; justify-content: center; padding: 20px; }
.ui-confirm-overlay.hidden { display: none; }
.ui-confirm-box { background: var(--surface, #fff); border-radius: 16px; width: 100%; max-width: 380px;
  padding: 26px 24px 20px; text-align: center; box-shadow: 0 24px 60px rgba(15,23,41,.4); }
.ui-confirm-icon { width: 46px; height: 46px; border-radius: 50%; background: var(--accent-light); color: var(--accent);
  display: grid; place-items: center; margin: 0 auto 14px; }
.ui-confirm-icon svg { width: 22px; height: 22px; }
.ui-confirm-danger .ui-confirm-icon { background: #fef2f2; color: var(--red, #dc2626); }
.ui-confirm-title { font-size: 17px; font-weight: 800; letter-spacing: -.01em; color: var(--text, #0f1729); margin-bottom: 7px; }
.ui-confirm-msg { font-size: 14px; color: var(--text-2, #4a5578); line-height: 1.55; margin-bottom: 20px; }
.ui-confirm-actions { display: flex; gap: 10px; justify-content: center; }
.ui-confirm-actions .btn-ghost, .ui-confirm-actions .btn { min-width: 96px; justify-content: center; }
/* make the actions column wide enough for two buttons */
.qh-table th:nth-child(7), .qh-table td:nth-child(7) { width: 168px; }
.mon-queue-hint { font-size: 13px; color: var(--text-2); line-height: 1.6; padding: 4px 2px; }
.mon-queue-hint code { background: var(--surface-2); padding: 2px 6px; border-radius: 5px; font-size: 12px; color: var(--accent); }
/* Manage-queues picker rows */
.q-pick-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid var(--border);
  border-radius: 9px; margin-bottom: 7px; cursor: pointer; }
.q-pick-row:hover { background: var(--surface-2); }
.q-pick-row.q-suggested { border-color: var(--accent); background: var(--accent-light); }
.q-pick-row input { width: 16px; height: 16px; accent-color: var(--accent); }
.q-pick-name { font-weight: 600; font-size: 13.5px; }
.q-pick-meta { font-size: 11px; color: var(--text-3); margin-left: 2px; }
.q-pick-flow { margin-left: auto; font-size: 11px; font-weight: 700; color: var(--accent);
  background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 2px 8px; white-space: nowrap; }

/* ── Scheduled-flow control + badge ──────────────────────────────────── */
.mon-row-sched { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 8px;
  margin-left: 6px; border: 1px solid var(--border); background: var(--surface);
  color: #8a91a3; border-radius: 20px; font-size: 11px; font-weight: 700; cursor: pointer; }
.mon-row-sched svg { width: 11px; height: 11px; opacity: .5; }
.mon-row-sched.on { background: var(--amber, #d97706); border-color: var(--amber, #d97706); color: #fff; }
.mon-row-sched.on svg { opacity: 1; }
.flow-sched-badge { font-size: 9.5px; font-weight: 800; color: var(--amber, #b45309);
  background: rgba(217,119,6,.12); border-radius: 6px; padding: 2px 7px; margin-left: 8px;
  letter-spacing: .02em; white-space: nowrap; }

/* ── Schedule editor modal ───────────────────────────────────────────── */
.sched-modal-overlay { position: fixed; inset: 0; background: rgba(15,23,41,.5);
  display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px; }
.sched-modal-overlay.hidden { display: none; }
.sched-modal { background: var(--surface, #fff); border-radius: 16px; width: 100%; max-width: 440px;
  box-shadow: 0 24px 60px rgba(15,23,41,.35); padding: 22px 24px; max-height: 90vh; overflow-y: auto; }
.sched-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sched-modal-title { font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--amber, #b45309); }
.sched-modal-flow { font-size: 17px; font-weight: 700; color: var(--text, #111827); margin-top: 2px; word-break: break-all; }
.sched-x { border: none; background: none; cursor: pointer; color: #9ca3af; padding: 4px; border-radius: 6px; }
.sched-x svg { width: 18px; height: 18px; }
.sched-x:hover { background: rgba(0,0,0,.05); }
.sched-modal-hint { font-size: 12px; color: #8a91a3; margin: 10px 0 16px; line-height: 1.5; }
.sched-field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; flex: 1; }
.sched-field label { font-size: 11px; font-weight: 700; color: #6b7280; text-transform: uppercase; letter-spacing: .04em; }
.sched-field select, .sched-field input { padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; background: var(--surface); color: var(--text, #111827); width: 100%; }
.sched-row { display: flex; gap: 12px; }
.sched-days { display: flex; gap: 5px; flex-wrap: wrap; }
.sched-day { border: 1px solid var(--border); background: var(--surface); color: #8a91a3;
  border-radius: 7px; padding: 5px 9px; font-size: 11px; font-weight: 700; cursor: pointer; }
.sched-day.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.sched-cadence-wrap { display: flex; gap: 6px; align-items: center; }
.sched-cadence-wrap input { flex: 1; }
.sched-suggest-note { font-size: 11.5px; color: var(--amber, #b45309); min-height: 16px; margin: -6px 0 12px; }
.sched-modal-actions { display: flex; align-items: center; gap: 8px; margin-top: 8px; }

/* ── Ask your monitoring ─────────────────────────────────────────────── */
.mon-ask { margin: 14px 0 4px; padding: 16px 18px; border-radius: 14px;
  background: linear-gradient(135deg, var(--surface) 60%, var(--accent-light));
  border: 1px solid #dfe3ff; }
.mon-ask-head { display: flex; align-items: center; gap: 8px; font-weight: 700;
  font-size: 13px; color: var(--text); margin-bottom: 10px; }
.mon-ask-icon { width: 16px; height: 16px; color: var(--accent); }
.mon-ask-bar { display: flex; gap: 8px; }
.mon-ask-input { flex: 1; padding: 11px 14px; border: 1px solid var(--border);
  border-radius: 10px; font-size: 13.5px; background: var(--surface); }
.mon-ask-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-light); }
.mon-ask-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.mon-ask-chips button { border: 1px solid var(--border); background: var(--surface);
  color: #6b7280; font-size: 11.5px; padding: 5px 11px; border-radius: 20px; cursor: pointer;
  transition: all .12s; }
.mon-ask-chips button:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-light); }

.mon-ask-answer { margin-top: 14px; }
.mon-ask-q { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600;
  color: var(--text); margin-bottom: 8px; }
.mon-ask-q svg { width: 15px; height: 15px; color: var(--accent); flex-shrink: 0; }
.mon-ask-a { background: linear-gradient(135deg, var(--surface) 70%, var(--accent-light));
  border: 1px solid #dfe3ff; border-left: 3px solid var(--accent); border-radius: 10px;
  padding: 16px 18px; font-size: 15px; font-weight: 500; color: var(--text); line-height: 1.62; }
.mon-ask-a p:first-child { margin-top: 0; } .mon-ask-a p:last-child { margin-bottom: 0; }
.mon-ask-a strong { color: #111827; font-weight: 800; }
.mon-ask-a ul { margin: 8px 0; padding-left: 20px; } .mon-ask-a li { margin: 4px 0; }
.mon-ask-a code { background: #eef0ff; color: var(--accent); padding: 1px 6px; border-radius: 4px; font-size: 13px; }
.mon-ask-loading { display: flex; align-items: center; gap: 8px; color: #8a91a3; font-size: 13px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 14px 16px; }
.mon-ask-loading svg { width: 15px; height: 15px; }
.mon-ask-err { background: var(--red-bg); border: 1px solid var(--red-border); color: var(--red);
  border-radius: 10px; padding: 12px 16px; font-size: 13px; }
.mon-ask-meta { font-size: 10.5px; color: #a2a8b8; margin-top: 6px; padding-left: 2px; }

/* Ask answer — web IDE deep links */
.mon-ask-links { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.mon-ask-links a { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600;
  color: var(--accent); background: var(--accent-light); border: 1px solid #dfe3ff; border-radius: 8px;
  padding: 5px 11px; text-decoration: none; transition: all .12s; }
.mon-ask-links a:hover { background: #e3e6ff; border-color: var(--accent); }
.mon-ask-links a svg { width: 12px; height: 12px; }

.groovy-checks {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.groovy-check-title {
  font-size: 11px;
  font-weight: 800;
  color: var(--text-2);
  text-transform: uppercase;
  letter-spacing: .45px;
}
.groovy-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}
.groovy-check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--rsm);
  background: var(--surface-2);
  font-size: 12px;
  font-weight: 700;
  color: var(--text-2);
}
.groovy-check span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}
.groovy-check.ok span { background: var(--green); }
.groovy-check.bad {
  background: var(--red-bg);
  border-color: var(--red-border);
  color: #991b1b;
}
.groovy-check.bad span { background: var(--red); }
.groovy-signals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.groovy-signals span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--blue-border);
  background: var(--blue-bg);
  color: #1e40af;
  font-size: 11px;
  font-weight: 700;
}
