/* ============================================================
   Workflox — page styles
   ============================================================ */

/* ============================================================ dashboard */
.welcome {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 26px;
  padding: 26px 30px;
  border-radius: 22px;
  border: 1px solid #ead6da;
  background:
    radial-gradient(80% 150% at 100% 0%, rgba(166, 61, 82, .16), transparent 55%),
    radial-gradient(60% 130% at 55% 120%, rgba(125, 31, 46, .09), transparent 60%),
    linear-gradient(120deg, #fdf8f9 0%, #f9eef0 55%, #fdf6f7 100%);
  overflow: hidden;
  margin-bottom: 18px;
}
.welcome::before {
  content: "";
  position: absolute; width: 340px; height: 340px; border-radius: 50%;
  border: 1px dashed rgba(125, 31, 46, .18);
  right: -80px; top: -150px;
}
.welcome::after {
  content: "";
  position: absolute; width: 180px; height: 180px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.7), transparent 70%);
  left: 42%; bottom: -130px;
}
.welcome-copy { position: relative; z-index: 2; max-width: 540px; display: flex; flex-direction: column; justify-content: center; }
.welcome-badge {
  display: inline-flex; align-items: center; gap: 6px;
  align-self: flex-start;
  padding: 4px 9px 4px 5px;
  background: rgba(255,255,255,.82);
  border: 1px solid #ead6da;
  border-radius: 99px;
  font-size: 10px; font-weight: 600; color: var(--ink-2);
  box-shadow: var(--shadow-xs);
  margin-bottom: 13px;
}
.welcome-badge .badge-icon { width: 19px; height: 19px; border-radius: 50%; background: linear-gradient(135deg, #faedf0, #f9e9ed); color: var(--primary); display: grid; place-items: center; }
.welcome-badge svg { width: 11px; height: 11px; }
.welcome h2 { font-size: 27px; font-weight: 800; letter-spacing: -.035em; line-height: 1.15; }
.welcome h2 span { background: linear-gradient(100deg, #651624, #b14a5d); -webkit-background-clip: text; background-clip: text; color: transparent; }
.welcome-copy > p { font-size: 12.5px; color: #6d565b; margin-top: 7px; max-width: 430px; line-height: 1.6; }
.welcome-actions { display: flex; align-items: center; gap: 8px; margin-top: 17px; }
.welcome-meta { display: flex; align-items: center; gap: 16px; margin-top: 17px; font-size: 10.5px; color: var(--muted); }
.welcome-meta span { display: inline-flex; align-items: center; gap: 5px; }
.welcome-meta svg { width: 12px; height: 12px; color: #059669; }
.welcome-visual { position: relative; z-index: 1; width: 370px; flex: none; display: flex; align-items: center; justify-content: flex-end; }
.mini-flow { position: relative; width: 100%; padding: 10px 0; }
.mini-node {
  position: relative;
  display: flex; align-items: center; gap: 9px;
  width: fit-content;
  background: rgba(255,255,255,.88);
  border: 1px solid rgba(229,232,247,.9);
  padding: 8px 12px 8px 8px;
  border-radius: 12px;
  box-shadow: 0 10px 24px -18px rgba(58,20,28,.4);
  backdrop-filter: blur(6px);
  animation: floatNode 7s ease-in-out infinite;
}
.mini-node:nth-child(2) { margin-left: 88px; animation-delay: -2.4s; }
.mini-node:nth-child(4) { margin-left: 42px; animation-delay: -4.8s; }
@keyframes floatNode { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.mini-node-icon { width: 29px; height: 29px; border-radius: 8px; display: grid; place-items: center; color: var(--c); background: var(--t); }
.mini-node-icon svg { width: 15px; height: 15px; }
.mini-node strong { display: block; font-size: 10.5px; font-weight: 650; color: var(--ink); line-height: 1.2; }
.mini-node span { display: block; font-size: 8.5px; color: var(--muted); margin-top: 1px; }
.mini-link { height: 24px; margin-left: 22px; border-left: 1.5px dashed #d7bcc2; width: 1px; }
.mini-link.pink { border-color: #e3b8c1; }
.mini-link.blue { border-color: #d8b6bd; }
.mini-badge {
  position: absolute; right: 2px; bottom: -3px;
  display: flex; align-items: center; gap: 6px;
  background: #fff; border: 1px solid var(--line); border-radius: 9px;
  box-shadow: var(--shadow-sm); padding: 7px 9px;
  font-size: 9.5px; color: var(--muted);
}
.mini-badge strong { display: block; font-size: 11px; color: var(--ink); }
.mini-badge .badge-pulse { width: 7px; height: 7px; border-radius: 50%; background: #10b981; box-shadow: 0 0 0 3px rgba(16,185,129,.16); }

.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 16px;
  position: relative;
  overflow: hidden;
  transition: transform .22s var(--ease), box-shadow .22s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.stat-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 13px; }
.stat-label { display: flex; align-items: center; gap: 7px; font-size: 10.5px; font-weight: 600; color: var(--muted); }
.stat-icon { width: 33px; height: 33px; border-radius: 9px; display: grid; place-items: center; color: var(--c); background: var(--t); }
.stat-icon svg { width: 16px; height: 16px; }
.stat-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; position: relative; z-index: 1; }
.stat-value { font-family: var(--font-display); font-size: 25px; font-weight: 750; letter-spacing: -.04em; line-height: 1; }
.stat-value small { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: 0; }
.stat-delta { display: inline-flex; align-items: center; gap: 3px; font-size: 10px; font-weight: 650; color: #059669; background: var(--green-soft); border-radius: 20px; padding: 2px 6px; margin-bottom: 3px; }
.stat-delta svg { width: 10px; height: 10px; }
.stat-delta.down { color: #dc2626; background: #fef0f0; }
.stat-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; }
.stat-foot span { font-size: 9.5px; color: var(--muted-2); }
.stat-card .sparkline { width: 88px; height: 28px; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(280px, .9fr); gap: 16px; margin-bottom: 16px; }
.chart-card .card-head { align-items: center; padding-bottom: 4px; }
.chart-head-title { display: flex; align-items: center; gap: 10px; }
.chart-head-title .legend { display: flex; align-items: center; gap: 10px; margin-left: 6px; }
.chart-head-title .legend span { display: inline-flex; align-items: center; gap: 4px; font-size: 9.5px; color: var(--muted); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary); display: inline-block; }
.dot.grey { background: #cbd2e5; }
.chart-summary { display: flex; align-items: center; gap: 18px; padding: 14px 20px 0; }
.chart-summary strong { font-family: var(--font-display); font-size: 22px; font-weight: 750; letter-spacing: -.03em; }
.chart-summary span { font-size: 10px; color: var(--muted); display: block; }
.chart-legend-foot { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.chart-legend-foot span { display: flex; align-items: center; gap: 5px; font-size: 10px; color: var(--muted); }
.chart-wrap { padding: 4px 16px 0 8px; }
.chart-foot-stats { display: flex; align-items: center; gap: 24px; }
.chart-foot-stat strong { display: block; font-size: 14px; font-weight: 700; }
.chart-foot-stat span { font-size: 9.5px; color: var(--muted); }

.live-list { padding: 10px 0 4px; }
.live-item { display: flex; align-items: center; gap: 10px; padding: 9px 20px; position: relative; }
.live-item + .live-item { border-top: 1px solid #f2f4f9; }
.live-icon { width: 31px; height: 31px; border-radius: 9px; display: grid; place-items: center; color: var(--c); background: var(--t); flex: none; }
.live-icon svg { width: 15px; height: 15px; }
.live-copy { flex: 1; min-width: 0; }
.live-copy strong { display: block; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.live-copy span { display: flex; align-items: center; gap: 5px; font-size: 9.5px; color: var(--muted); margin-top: 1px; }
.live-copy .live-source { color: var(--muted-2); }
.live-time { font-size: 9px; color: var(--muted-2); white-space: nowrap; }
.live-state { display: flex; align-items: center; gap: 5px; font-size: 9px; font-weight: 600; color: #059669; }
.live-state .pulse { width: 6px; height: 6px; background: #10b981; border-radius: 50%; position: relative; }
.live-state .pulse::after { content: ""; position: absolute; inset: -3px; border-radius: 50%; background: rgba(16,185,129,.2); animation: pulseOut 1.8s infinite; }
@keyframes pulseOut { 0% { transform: scale(.6); opacity: 1; } 100% { transform: scale(1.7); opacity: 0; } }
.live-foot { margin-top: auto; padding: 13px 20px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.dash-col-card { display: flex; flex-direction: column; }

.recent-card .data-table td { padding-top: 11px; padding-bottom: 11px; }
.recent-card .data-table th:first-child, .recent-card .data-table td:first-child { padding-left: 20px; }
.run-auto { display: flex; align-items: center; gap: 8px; }
.run-auto-icon { width: 27px; height: 27px; border-radius: 7px; display: grid; place-items: center; color: var(--c); background: var(--t); flex: none; }
.run-auto-icon svg { width: 13px; height: 13px; }
.run-auto strong { font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.run-auto span { display: block; font-size: 9px; color: var(--muted-2); }
.duration-cell { display: flex; align-items: center; gap: 7px; }
.duration-cell .bar { width: 36px; height: 4px; border-radius: 99px; background: #eef0f7; overflow: hidden; }
.duration-cell .bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #818cf8, #a78bfa); }
.memory-text { font-family: var(--font-mono); font-size: 10px; color: var(--muted); }

.health-list { padding: 8px 20px 4px; }
.health-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.health-row + .health-row { border-top: 1px solid #f2f4f9; }
.health-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.health-copy { flex: 1; min-width: 0; }
.health-copy strong { display: block; font-size: 11.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.health-copy span { display: block; font-size: 9.5px; color: var(--muted); }
.health-meter { width: 76px; }
.health-meter .track { height: 4px; border-radius: 99px; background: #eef0f7; overflow: hidden; }
.health-meter .track span { display: block; height: 100%; border-radius: inherit; }
.health-meter small { display: block; text-align: right; font-size: 8.5px; color: var(--muted); margin-top: 3px; font-weight: 600; }

.template-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.template-card {
  display: flex; align-items: center; gap: 12px;
  padding: 14px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  transition: border-color .2s, transform .2s, box-shadow .2s;
  cursor: pointer;
}
.template-card:hover { border-color: #d5daf0; transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.template-icon { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; color: var(--c); background: var(--t); flex: none; }
.template-icon svg { width: 18px; height: 18px; }
.template-copy { flex: 1; min-width: 0; }
.template-copy strong { display: block; font-size: 11.5px; font-weight: 650; }
.template-copy span { display: block; font-size: 9.5px; color: var(--muted); margin-top: 1px; line-height: 1.4; }
.template-arrow { color: var(--muted-2); }
.template-arrow svg { width: 15px; height: 15px; }
.template-row-head { display: flex; align-items: center; justify-content: space-between; margin: 22px 0 11px; }
.template-row-head h3 { font-size: 13px; font-weight: 700; }

/* ============================================================ workflows */
.toolbar-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 17px; flex-wrap: wrap; }
.toolbar-row .toolbar-right { display: flex; align-items: center; gap: 8px; }
.toolbar-search { position: relative; }
.toolbar-search .input { width: 210px; height: 34px; font-size: 11.5px; padding-left: 31px; }
.toolbar-search svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--muted-2); }
.auto-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.auto-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  display: flex; flex-direction: column;
  position: relative;
  cursor: pointer;
  transition: transform .22s var(--ease), box-shadow .22s, border-color .22s;
}
.auto-card:hover { transform: translateY(-3px); box-shadow: 0 18px 34px -24px rgba(58,20,28,.28); border-color: #dfe3f2; }
.auto-card-top { display: flex; align-items: flex-start; gap: 11px; }
.auto-icon { width: 43px; height: 43px; border-radius: 12px; display: grid; place-items: center; color: var(--c); background: var(--t); flex: none; position: relative; }
.auto-icon svg { width: 20px; height: 20px; }
.auto-icon::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(58,20,28,.04); }
.auto-title { flex: 1; min-width: 0; padding-top: 1px; }
.auto-title h3 { font-size: 13.5px; font-weight: 700; letter-spacing: -.015em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.auto-title p { font-size: 9.5px; color: var(--muted); margin-top: 2px; display: flex; align-items: center; gap: 5px; }
.auto-title p .sep { width: 3px; height: 3px; background: #c7cddc; border-radius: 50%; }
.auto-menu { margin: -3px -4px 0 0; }
.auto-desc { font-size: 10.5px; color: var(--muted); line-height: 1.55; margin: 12px 0 14px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; min-height: 31px; }
.node-chain { display: flex; align-items: center; gap: 0; padding: 10px 11px; background: #fbf6f7; border: 1px solid #f1e6e8; border-radius: 10px; }
.chain-node { width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center; color: var(--c); background: #fff; box-shadow: 0 1px 3px rgba(58,20,28,.08); flex: none; position: relative; z-index: 1; }
.chain-node svg { width: 13px; height: 13px; }
.chain-link { height: 2px; width: 12px; background: #e1e5f0; flex: none; }
.chain-link.yes { background: #a7f3d0; }
.chain-link.no { background: #fecaca; }
.chain-more { font-size: 9px; color: var(--muted); margin-left: 5px; font-weight: 600; }
.auto-metrics { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 13px; border-top: 1px dashed var(--line); padding-top: 12px; }
.auto-metrics > div + div { border-left: 1px solid var(--line); padding-left: 12px; }
.auto-metrics strong { display: block; font-size: 13px; font-weight: 700; letter-spacing: -.01em; }
.auto-metrics span { display: block; font-size: 8.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; }
.auto-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 13px; }
.trigger-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px 3px 4px; border-radius: 6px; background: var(--t); color: var(--c); font-size: 9px; font-weight: 650; }
.trigger-pill .mini-ic { width: 16px; height: 16px; border-radius: 4px; display: grid; place-items: center; background: rgba(255,255,255,.6); }
.trigger-pill svg { width: 10px; height: 10px; }
.auto-status { display: flex; align-items: center; gap: 7px; }
.auto-status .status { font-size: 9px; height: 20px; }
.auto-card .switch { transform: scale(.9); transform-origin: right center; }
.auto-paused .auto-icon, .auto-paused .node-chain { opacity: .65; filter: saturate(.6); }

.folder-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.folder-chip { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 7px; background: #fff; border: 1px solid var(--line); font-size: 10px; font-weight: 550; color: var(--muted); }
.folder-chip svg { width: 12px; height: 12px; }
.folder-chip.active { background: var(--primary-soft); border-color: transparent; color: var(--primary-ink); font-weight: 650; }

/* ============================================================ runs */
.mini-stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.mini-stat { background: #fff; border: 1px solid var(--line); border-radius: 13px; padding: 12px 14px; display: flex; align-items: center; gap: 10px; }
.mini-stat-icon { width: 31px; height: 31px; border-radius: 8px; display: grid; place-items: center; flex: none; color: var(--c); background: var(--t); }
.mini-stat-icon svg { width: 15px; height: 15px; }
.mini-stat strong { display: block; font-size: 15px; font-weight: 750; letter-spacing: -.02em; line-height: 1.1; }
.mini-stat span { display: block; font-size: 9px; color: var(--muted); margin-top: 1px; }
.runs-card .card-head { padding-bottom: 14px; }
.run-id { font-family: var(--font-mono); font-size: 10px; color: var(--muted); }
.run-trigger { display: inline-flex; align-items: center; gap: 5px; font-size: 10px; color: var(--ink-2); white-space: nowrap; }
.run-trigger svg { width: 12px; height: 12px; color: var(--muted-2); }
.async-badge { display: inline-flex; align-items: center; gap: 3px; height: 17px; padding: 0 5px; border-radius: 4px; background: #f9e9ed; color: #8b2336; font-size: 8px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.async-badge svg { width: 9px; height: 9px; }
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.table-toolbar .left, .table-toolbar .right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.table-toolbar .segmented { background: #f7f0f1; }
.filter-select { height: 32px; width: auto; min-width: 156px; flex: none; border: 1px solid var(--line-2); border-radius: 8px; background-color: #fff; padding: 0 30px 0 10px; font-size: 10.5px; color: var(--ink-2); }

.run-summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; margin-bottom: 18px; }
.run-summary-tile { background: #fbf6f7; border: 1px solid #f1e6e8; border-radius: 10px; padding: 10px 11px; }
.run-summary-tile span { display: block; font-size: 8.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); font-weight: 650; }
.run-summary-tile strong { display: block; font-size: 13px; font-weight: 700; margin-top: 3px; }
.run-summary-tile strong small { font-size: 9px; color: var(--muted); font-weight: 500; }
.run-progress { height: 6px; border-radius: 99px; background: #eef0f7; overflow: hidden; display: flex; margin: 4px 0 18px; }
.run-progress span { display: block; height: 100%; }
.drawer-section-label { font-size: 9px; text-transform: uppercase; letter-spacing: .12em; font-weight: 750; color: var(--muted-2); margin: 20px 0 9px; display: flex; align-items: center; justify-content: space-between; }
.trigger-timeline { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.timeline-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 13px; position: relative; }
.timeline-row + .timeline-row { border-top: 1px solid #f2f4f9; }
.timeline-dot { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; flex: none; margin-top: 1px; }
.timeline-dot svg { width: 10px; height: 10px; }
.timeline-dot.ok { background: var(--green-soft); color: #059669; }
.timeline-dot.neutral { background: var(--surface-3); color: var(--muted); }
.timeline-dot.blue { background: var(--sky-soft); color: #0284c7; }
.timeline-copy { flex: 1; min-width: 0; }
.timeline-copy strong { display: block; font-size: 11px; font-weight: 600; }
.timeline-copy span { display: block; font-size: 9.5px; color: var(--muted); margin-top: 1px; }
.timeline-time { font-family: var(--font-mono); font-size: 9px; color: var(--muted-2); white-space: nowrap; margin-top: 2px; }
.node-log-list { display: flex; flex-direction: column; gap: 6px; }
.node-log { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.node-log-head { display: flex; align-items: center; gap: 9px; padding: 9px 11px; cursor: pointer; }
.node-log-head:hover { background: #fdf9fa; }
.log-node-icon { width: 27px; height: 27px; border-radius: 7px; display: grid; place-items: center; color: var(--c); background: var(--t); flex: none; }
.log-node-icon svg { width: 13px; height: 13px; }
.log-node-copy { flex: 1; min-width: 0; }
.log-node-copy strong { display: block; font-size: 10.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-node-copy span { display: block; font-size: 8.5px; color: var(--muted); margin-top: 1px; }
.log-duration { font-family: var(--font-mono); font-size: 9px; color: var(--muted); text-align: right; white-space: nowrap; }
.log-duration small { display: block; font-size: 8px; color: var(--muted-2); }
.log-skipped { opacity: .55; }
.log-body { padding: 0 11px 10px 47px; display: none; }
.node-log.open .log-body { display: block; }
.node-log.open .log-chevron { transform: rotate(180deg); }
.log-chevron { color: var(--muted-2); transition: transform .2s; }
.log-chevron svg { width: 13px; height: 13px; }
.log-lines { background: #0f172a; border-radius: 8px; padding: 9px 11px; font-family: var(--font-mono); font-size: 9px; line-height: 1.7; display: flex; flex-direction: column; gap: 1px; max-height: 180px; overflow: auto; }
.log-line { display: flex; gap: 8px; }
.log-line .t { color: #64748b; flex: none; }
.log-line .msg { color: #cbd5e1; word-break: break-word; }
.log-line.error .msg { color: #fca5a5; }
.log-line.warn .msg { color: #fcd34d; }
.log-line.success .msg { color: #6ee7b7; }
.log-line.request .msg { color: #93c5fd; }
.log-vars { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.log-var { font-family: var(--font-mono); font-size: 8.5px; background: #f7f0f1; border: 1px solid #eee3e5; border-radius: 4px; padding: 2px 5px; color: #6d565b; }
.run-note { display: flex; gap: 8px; padding: 10px 12px; border-radius: 9px; background: var(--primary-soft); color: var(--primary-ink); font-size: 10.5px; line-height: 1.5; }
.run-note svg { width: 14px; height: 14px; flex: none; margin-top: 1px; }
.run-error-box { display: flex; gap: 8px; padding: 10px 12px; border-radius: 9px; background: #fef2f2; color: #b91c1c; font-size: 10.5px; line-height: 1.5; border: 1px solid #fee2e2; }
.run-error-box svg { width: 14px; height: 14px; flex: none; margin-top: 1px; }

/* ============================================================ variables */
.var-banner {
  display: flex; align-items: center; gap: 20px;
  padding: 20px 22px; border-radius: 17px;
  border: 1px solid #e8e4ff;
  background:
    radial-gradient(90% 180% at 100% 0%, rgba(168,85,247,.13), transparent 52%),
    linear-gradient(120deg, #fdf7f8, #f4f2ff);
  margin-bottom: 17px;
  flex-wrap: wrap;
}
.var-banner-icon { width: 43px; height: 43px; border-radius: 12px; background: #fff; color: #8b2336; display: grid; place-items: center; box-shadow: var(--shadow-sm); flex: none; }
.var-banner-icon svg { width: 21px; height: 21px; }
.var-banner-copy { flex: 1; min-width: 220px; }
.var-banner-copy h3 { font-size: 14px; font-weight: 700; }
.var-banner-copy p { font-size: 10.5px; color: var(--muted); margin-top: 2px; line-height: 1.55; max-width: 560px; }
.var-banner-meta { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.var-banner-stat { text-align: right; padding: 0 14px; border-left: 1px solid #e4e1f5; }
.var-banner-stat strong { display: block; font-size: 16px; font-weight: 750; font-family: var(--font-display); }
.var-banner-stat span { display: block; font-size: 8.5px; color: var(--muted); margin-top: 1px; text-transform: uppercase; letter-spacing: .04em; }
.var-key { display: inline-flex; align-items: center; gap: 6px; font-family: var(--font-mono); font-size: 10.5px; font-weight: 500; color: #651624; background: #fbf0f2; border: 1px solid #ecd7dc; border-radius: 5px; padding: 2px 6px; }
.var-value { display: flex; align-items: center; gap: 7px; max-width: 300px; }
.var-value code { font-family: var(--font-mono); font-size: 10px; color: var(--muted); background: #fbf5f6; border-radius: 4px; padding: 2px 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 220px; }
.scope-pill { display: inline-flex; align-items: center; gap: 4px; height: 20px; padding: 0 7px; border-radius: 5px; background: #f7f0f1; color: var(--muted); font-size: 9px; font-weight: 600; }
.scope-pill svg { width: 10px; height: 10px; }
.scope-shared { background: #faeef1; color: #651624; }
.scope-private { background: #fff1f2; color: #e11d48; }
.var-info-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; margin-bottom: 17px; }
.var-info-card { padding: 16px; border-radius: 14px; border: 1px solid var(--line); background: #fff; display: flex; gap: 12px; }
.var-info-card .info-ic { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; color: var(--c); background: var(--t); }
.var-info-card .info-ic svg { width: 16px; height: 16px; }
.var-info-card h4 { font-size: 12px; font-weight: 650; }
.var-info-card p { font-size: 10px; color: var(--muted); line-height: 1.55; margin-top: 2px; }
.var-info-card code { font-family: var(--font-mono); font-size: 9px; background: #f7f0f1; padding: 1px 4px; border-radius: 3px; }

/* ============================================================ integrations */
.integration-note {
  display: flex; align-items: center; gap: 13px;
  padding: 13px 16px;
  border-radius: 13px;
  border: 1px solid #dcecff;
  background: linear-gradient(110deg, #f7fbff, #f2f7ff);
  margin-bottom: 17px;
}
.integration-note-icon { width: 33px; height: 33px; border-radius: 9px; background: #fff; color: #0284c7; display: grid; place-items: center; box-shadow: var(--shadow-xs); flex: none; }
.integration-note-icon svg { width: 16px; height: 16px; }
.integration-note p { flex: 1; font-size: 10.5px; color: #586683; line-height: 1.5; }
.integration-note p strong { color: var(--ink-2); }
.integration-note.internal {
  border-color: #d1fae5;
  background: linear-gradient(110deg, #f6fffb, #effcf7);
}
.integration-note.internal .integration-note-icon { color: #059669; }
.app-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.app-card { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 16px; display: flex; flex-direction: column; transition: transform .2s var(--ease), box-shadow .2s; cursor: pointer; }
.app-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.app-card-head { display: flex; align-items: flex-start; gap: 11px; }
.app-logo { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; color: #fff; background: var(--c); flex: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.2); }
.app-logo svg { width: 20px; height: 20px; }
.app-logo.soft { background: var(--t); color: var(--c); }
.app-card-title { flex: 1; min-width: 0; }
.app-card-title h3 { font-size: 13px; font-weight: 700; }
.app-card-title p { font-size: 9.5px; color: var(--muted); margin-top: 1px; display: flex; align-items: center; gap: 5px; }
.app-card-desc { font-size: 10.5px; color: var(--muted); line-height: 1.5; margin: 11px 0; min-height: 30px; }
.app-endpoint { font-family: var(--font-mono); font-size: 9px; color: #64748b; background: #fbf5f6; border: 1px solid #f1e6e8; border-radius: 6px; padding: 5px 7px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.app-card-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 13px; padding-top: 12px; border-top: 1px dashed var(--line); }
.app-stat { display: flex; align-items: center; gap: 5px; font-size: 9.5px; color: var(--muted); }
.app-stat svg { width: 12px; height: 12px; color: var(--muted-2); }
.app-card-actions { display: flex; align-items: center; gap: 4px; }
.app-add-card {
  border: 1.5px dashed #e2d0d4;
  border-radius: 16px;
  background: #fdf8f9;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 7px; padding: 24px;
  min-height: 196px;
  color: var(--muted);
  transition: border-color .2s, background .2s;
}
.app-add-card:hover { border-color: #b9c0df; background: #f7f9ff; }
.app-add-icon { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #faedf0; color: var(--primary); }
.app-add-icon svg { width: 18px; height: 18px; }
.app-add-card strong { font-size: 11.5px; color: var(--ink-2); font-weight: 650; }
.app-add-card span { font-size: 9.5px; color: var(--muted); }

/* integration drawer tabs */
.act-list { display: flex; flex-direction: column; gap: 7px; }
.act-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; background: #fff; }
.act-method { font-family: var(--font-mono); font-size: 8px; font-weight: 600; padding: 2px 5px; border-radius: 4px; background: #faeef1; color: #651624; flex: none; }
.act-row input { border: 0; outline: none; font-size: 10.5px; min-width: 0; background: transparent; }
.act-row .act-path { flex: 1; font-family: var(--font-mono); font-size: 9px; color: var(--muted); }
.connection-test { display: flex; align-items: center; gap: 8px; font-size: 10.5px; padding: 9px 11px; border-radius: 8px; background: #fbf6f7; border: 1px solid var(--line); color: var(--muted); }
.connection-test.ok { background: var(--green-soft); border-color: #d1fae5; color: #047857; }
.connection-test svg { width: 14px; height: 14px; }

/* ============================================================ databases */
.db-layout { display: grid; grid-template-columns: 288px minmax(0, 1fr); gap: 16px; align-items: start; }
.db-side { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; position: sticky; top: 0; }
.db-side-head { padding: 14px 15px 11px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.db-side-head h3 { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.db-list { padding: 7px; display: flex; flex-direction: column; gap: 2px; }
.db-item { display: flex; align-items: center; gap: 10px; padding: 9px 9px; border-radius: 10px; cursor: pointer; border: 1px solid transparent; transition: background .16s, border-color .16s; }
.db-item:hover { background: #fbf6f7; }
.db-item.active { background: #f5f7ff; border-color: #e7eafb; }
.db-item-icon { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: var(--c); background: var(--t); flex: none; }
.db-item-icon svg { width: 15px; height: 15px; }
.db-item-copy { flex: 1; min-width: 0; }
.db-item-copy strong { display: block; font-size: 11px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.db-item-copy span { display: block; font-size: 9px; color: var(--muted); margin-top: 1px; }
.db-item-status { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.db-item-status.connected { background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,.12); }
.db-item-status.paused { background: #cbd5e1; }
.db-side-foot { padding: 11px; border-top: 1px solid var(--line); }
.db-side-note { font-size: 9px; color: var(--muted); line-height: 1.5; display: flex; gap: 6px; padding: 8px 9px; border-radius: 8px; background: #fbf6f7; }
.db-side-note svg { width: 12px; height: 12px; flex: none; margin-top: 1px; }
.db-main { min-width: 0; }
.db-hero { background: #fff; border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px; display: flex; align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.db-hero-icon { width: 48px; height: 48px; border-radius: 13px; display: grid; place-items: center; color: var(--c); background: var(--t); flex: none; }
.db-hero-icon svg { width: 23px; height: 23px; }
.db-hero-copy { flex: 1; min-width: 0; }
.db-hero-copy h2 { font-size: 17px; font-weight: 700; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.db-hero-copy p { font-size: 10px; color: var(--muted); margin-top: 4px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.db-hero-copy p span { display: inline-flex; align-items: center; gap: 4px; }
.db-hero-copy p svg { width: 11px; height: 11px; color: var(--muted-2); }
.db-hero-actions { display: flex; align-items: center; gap: 7px; }
.db-content { background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.db-content .tabs { padding: 0 16px; }
.db-pane { padding: 18px 20px 20px; }
.db-stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; margin-bottom: 18px; }
.db-stat { border: 1px solid var(--line); border-radius: 11px; padding: 11px 13px; background: #fdf8f9; }
.db-stat span { display: flex; align-items: center; gap: 5px; font-size: 8.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.db-stat span svg { width: 11px; height: 11px; }
.db-stat strong { display: block; font-size: 17px; font-weight: 750; letter-spacing: -.02em; margin-top: 5px; }
.table-card-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.table-card { border: 1px solid var(--line); border-radius: 12px; background: #fff; padding: 13px; transition: border-color .18s, box-shadow .18s; }
.table-card:hover { border-color: #dbe0f0; box-shadow: var(--shadow-xs); }
.table-card-head { display: flex; align-items: flex-start; gap: 9px; }
.table-card-ic { width: 29px; height: 29px; border-radius: 8px; display: grid; place-items: center; background: #f9eef0; color: #651624; flex: none; }
.table-card-ic svg { width: 14px; height: 14px; }
.table-card-title { flex: 1; min-width: 0; }
.table-card-title strong { display: block; font-size: 11.5px; font-weight: 650; font-family: var(--font-mono); }
.table-card-title span { display: block; font-size: 9px; color: var(--muted); margin-top: 1px; }
.column-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 11px; }
.column-chip { display: inline-flex; align-items: center; gap: 4px; height: 19px; padding: 0 6px; border-radius: 4px; background: #faf4f5; border: 1px solid #eef0f7; font-family: var(--font-mono); font-size: 8.5px; color: #59637d; }
.type-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--c); flex: none; }
.type-string { --c: #0ea5e9; } .type-number { --c: #f59e0b; } .type-json { --c: #a855f7; } .type-index { --c: #10b981; } .type-id { --c: #ec4899; }
.column-more { font-size: 8.5px; color: var(--muted-2); padding: 0 4px; align-self: center; }
.table-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); }
.table-card-foot .left { display: flex; align-items: center; gap: 4px; }
.table-mini-btn { border: 0; background: none; color: var(--muted); font-size: 9px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; padding: 2px 4px; border-radius: 4px; }
.table-mini-btn:hover { color: var(--primary-ink); background: var(--primary-soft); }
.table-mini-btn svg { width: 11px; height: 11px; }

.query-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 13px; border-bottom: 1px solid #1e293b; background: #111c33; }
.query-toolbar .left { display: flex; align-items: center; gap: 8px; }
.query-dot { width: 8px; height: 8px; border-radius: 50%; }
.query-tab-label { font-family: var(--font-mono); font-size: 9.5px; color: #94a3b8; }
.query-editor-wrap { border-radius: 12px; overflow: hidden; border: 1px solid #1e293b; background: #0f172a; }
.query-editor { width: 100%; min-height: 160px; border: 0; outline: none; resize: vertical; background: #0f172a; color: #dbeafe; padding: 14px; font-family: var(--font-mono); font-size: 11px; line-height: 1.75; }
.query-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 13px; background: #111c33; border-top: 1px solid #1e293b; }
.query-hint { font-size: 8.5px; color: #64748b; display: flex; align-items: center; gap: 5px; }
.query-hint svg { width: 11px; height: 11px; }
.query-result { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.query-result-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 13px; background: #fbf6f7; border-bottom: 1px solid var(--line); font-size: 9.5px; color: var(--muted); }
.query-result table { width: 100%; border-collapse: collapse; }
.query-result th { font-size: 8.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: left; padding: 7px 12px; background: #fdf9fa; border-bottom: 1px solid var(--line); }
.query-result td { font-size: 10px; padding: 7px 12px; border-bottom: 1px solid #f5ecee; font-family: var(--font-mono); color: var(--ink-2); }
.query-result tr:last-child td { border-bottom: 0; }
.db-settings-section { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.db-settings-section + .db-settings-section { margin-top: 12px; }
.db-settings-section h4 { font-size: 11px; font-weight: 700; margin-bottom: 10px; }
.db-empty { text-align: center; padding: 26px; font-size: 10.5px; color: var(--muted); }

/* new database / table builder */
.column-builder { display: flex; flex-direction: column; gap: 7px; }
.column-builder-row { display: grid; grid-template-columns: 1fr 140px 30px; gap: 6px; align-items: center; }
.column-builder-row .input, .column-builder-row .select { height: 34px; font-size: 11px; }
.column-builder-add { display: flex; align-items: center; gap: 5px; color: var(--primary-ink); font-size: 10.5px; font-weight: 600; background: none; border: 0; padding: 4px 2px; }
.column-builder-add svg { width: 13px; height: 13px; }
.type-picker { display: grid; grid-template-columns: repeat(2, 1fr); gap: 5px; }
.type-option { display: flex; align-items: center; gap: 6px; padding: 7px 8px; border: 1px solid var(--line); border-radius: 7px; font-size: 9.5px; cursor: pointer; }
.type-option.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-ink); }
.type-option svg { width: 12px; height: 12px; }

/* ============================================================ form studio */
.form-studio { height: 100%; display: flex; flex-direction: column; background: var(--bg); }
.studio-top { flex: none; height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--line); }
.studio-top-left { display: flex; align-items: center; gap: 10px; min-width: 0; }
.studio-back { width: 31px; height: 31px; border-radius: 8px; border: 1px solid var(--line); background: #fff; display: grid; place-items: center; color: var(--muted); }
.studio-back svg { width: 15px; height: 15px; }
.studio-title-wrap { min-width: 0; }
.studio-title-wrap h2 { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.studio-title-wrap p { font-size: 9.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; margin-top: 1px; }
.studio-top-right { display: flex; align-items: center; gap: 8px; }
.studio-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 232px minmax(0, 1fr) 340px; }
.studio-panel { background: #fff; display: flex; flex-direction: column; overflow: hidden; }
.studio-panel.left { border-right: 1px solid var(--line); }
.studio-panel.right { border-left: 1px solid var(--line); }
.studio-panel-head { padding: 14px 15px 10px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #f3f4f9; }
.studio-panel-head h3 { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.studio-panel-scroll { flex: 1; overflow: auto; padding: 12px; }
.field-palette-group + .field-palette-group { margin-top: 15px; }
.field-palette-label { font-size: 8.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted-2); font-weight: 700; padding: 0 4px 6px; }
.field-palette { display: flex; flex-direction: column; gap: 3px; }
.field-btn { display: flex; align-items: center; gap: 8px; padding: 6px 7px; border-radius: 8px; border: 1px solid transparent; background: transparent; font-size: 10.5px; font-weight: 550; color: var(--ink-2); text-align: left; }
.field-btn:hover { background: #fbf6f7; border-color: #f2e7e9; }
.field-btn-icon { width: 25px; height: 25px; border-radius: 6px; display: grid; place-items: center; color: var(--c); background: var(--t); flex: none; }
.field-btn-icon svg { width: 13px; height: 13px; }
.layout-preview { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px; }
.layout-option { border: 1px solid var(--line); border-radius: 8px; padding: 6px; background: #fff; text-align: left; }
.layout-option.active { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(125,31,46,.1); }
.layout-bars { height: 24px; display: flex; flex-direction: column; gap: 3px; }
.layout-bars span { height: 4px; border-radius: 2px; background: #ede1e3; }
.layout-bars span:nth-child(1) { width: 45%; }
.layout-bars span:nth-child(3) { width: 67%; }
.layout-option span { display: block; font-size: 8px; color: var(--muted); margin-top: 4px; }

.form-stage { background-color: #f5ecee; background-image: radial-gradient(#d7dbea 1px, transparent 1px); background-size: 18px 18px; overflow: auto; position: relative; padding: 32px 24px; }
.stage-toolbar { position: sticky; top: 0; z-index: 5; display: flex; justify-content: center; gap: 6px; margin-bottom: 22px; }
.stage-toolbar .segmented { background: #fff; box-shadow: var(--shadow-sm); border: 1px solid var(--line); }
.form-canvas-wrap { display: flex; justify-content: center; padding-bottom: 40px; }
.form-canvas {
  width: 100%; max-width: 460px;
  background: #fff; border-radius: 18px;
  box-shadow: 0 22px 50px -28px rgba(58,20,28,.35), 0 0 0 1px rgba(58,20,28,.04);
  overflow: hidden;
  transition: max-width .25s var(--ease);
}
.form-canvas.mobile { max-width: 350px; }
.form-canvas-head { padding: 24px 24px 20px; position: relative; overflow: hidden; }
.form-canvas-head::before { content: ""; position: absolute; inset: 0; background: radial-gradient(120% 160% at 100% 0%, rgba(255,255,255,.3), transparent 55%); }
.form-canvas-head .form-mark { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.2); backdrop-filter: blur(6px); display: grid; place-items: center; color: #fff; margin-bottom: 12px; position: relative; z-index: 1; }
.form-canvas-head .form-mark svg { width: 17px; height: 17px; }
.form-canvas-head h3 { font-size: 19px; font-weight: 750; color: #fff; letter-spacing: -.025em; position: relative; z-index: 1; }
.form-canvas-head p { font-size: 10.5px; color: rgba(255,255,255,.8); line-height: 1.55; margin-top: 4px; position: relative; z-index: 1; max-width: 340px; }
.form-canvas-body { padding: 20px 24px 24px; display: flex; flex-direction: column; gap: 12px; }
.preview-field { padding: 5px; margin: -5px; border-radius: 9px; border: 1px solid transparent; position: relative; cursor: pointer; transition: border-color .15s, background .15s; }
.preview-field:hover { border-color: #e4e7f2; }
.preview-field.selected { border-color: rgba(125,31,46,.65); background: rgba(125,31,46,.035); box-shadow: 0 0 0 3px rgba(125,31,46,.08); }
.preview-field-label { display: flex; align-items: center; gap: 4px; font-size: 10px; font-weight: 600; color: #3f4964; margin-bottom: 4px; }
.preview-field-label .req { color: #ef4444; }
.preview-field-label .type-hint { margin-left: auto; font-size: 7.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted-2); background: #f7f0f1; border-radius: 3px; padding: 1px 4px; }
.preview-input { width: 100%; height: 35px; border: 1px solid #e4e7f2; border-radius: 8px; padding: 0 10px; font-size: 10.5px; background: #fcfdff; color: var(--ink); pointer-events: none; }
.preview-input::placeholder { color: #aeb5c8; }
.preview-textarea { height: 62px; padding: 8px 10px; resize: none; }
.preview-select { display: flex; align-items: center; justify-content: space-between; color: #aeb5c8; }
.preview-select svg { width: 13px; height: 13px; }
.preview-check { display: flex; align-items: center; gap: 7px; font-size: 10px; color: var(--muted); }
.preview-submit { height: 37px; border: 0; border-radius: 8px; color: #fff; font-size: 11px; font-weight: 650; margin-top: 4px; box-shadow: 0 8px 16px -9px rgba(58,20,28,.4); }
.form-field-actions { position: absolute; right: 6px; top: -8px; display: none; align-items: center; gap: 2px; background: #fff; border: 1px solid var(--line); border-radius: 5px; box-shadow: var(--shadow-sm); padding: 1px; }
.preview-field.selected .form-field-actions { display: flex; }
.form-field-actions button { width: 20px; height: 20px; border: 0; background: none; display: grid; place-items: center; color: var(--muted); border-radius: 4px; }
.form-field-actions button:hover { background: #f7f0f1; color: var(--ink); }
.form-field-actions button svg { width: 11px; height: 11px; }
.form-success { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 40px 24px; }
.form-success .success-icon { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; background: var(--green-soft); color: #059669; margin-bottom: 12px; }
.form-success .success-icon svg { width: 22px; height: 22px; }
.form-success h4 { font-size: 15px; font-weight: 700; }
.form-success p { font-size: 10.5px; color: var(--muted); margin-top: 3px; max-width: 300px; line-height: 1.55; }
.form-success button { margin-top: 16px; }

.studio-section { border-bottom: 1px solid #f5ecee; padding: 14px 15px; }
.studio-section:last-child { border-bottom: 0; }
.studio-section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.studio-section-head h4 { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.studio-section-head h4 svg { width: 12px; height: 12px; }
.studio-section .field + .field { margin-top: 10px; }
.studio-section .field > label { font-size: 10px; }
.studio-section .input, .studio-section .select { height: 34px; font-size: 11px; }
.studio-section textarea.input { min-height: 58px; font-size: 10.5px; }
.swatch-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.swatch { width: 22px; height: 22px; border-radius: 50%; border: 2px solid transparent; padding: 0; position: relative; }
.swatch.active { border-color: #fff; box-shadow: 0 0 0 2px var(--sw); }
.swatch:hover { transform: scale(1.08); }
.attach-card { border: 1px solid #ede9fe; background: linear-gradient(120deg, #fdf7f8, #f7f3ff); border-radius: 10px; padding: 11px; margin-top: 10px; }
.attach-card-head { display: flex; align-items: center; gap: 7px; font-size: 9px; font-weight: 700; color: #8b2336; text-transform: uppercase; letter-spacing: .05em; }
.attach-card-head svg { width: 12px; height: 12px; }
.attach-card-body { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.attach-icon { width: 27px; height: 27px; border-radius: 7px; background: #fff; color: var(--c); display: grid; place-items: center; box-shadow: var(--shadow-xs); flex: none; }
.attach-icon svg { width: 13px; height: 13px; }
.attach-copy { flex: 1; min-width: 0; }
.attach-copy strong { display: block; font-size: 10px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.attach-copy span { display: block; font-size: 8.5px; color: var(--muted); margin-top: 1px; }
.attach-card .link-btn { font-size: 9px; }
.studio-empty { padding: 30px 20px; text-align: center; }
.studio-empty .empty-icon { width: 42px; height: 42px; border-radius: 12px; margin-bottom: 9px; }
.studio-empty h4 { font-size: 11.5px; font-weight: 650; }
.studio-empty p { font-size: 9.5px; color: var(--muted); margin-top: 3px; line-height: 1.5; }
.field-settings-title { display: flex; align-items: center; gap: 8px; padding: 13px 15px; border-bottom: 1px solid #f5ecee; }
.field-settings-title .drag { color: var(--muted-2); }
.field-settings-title strong { flex: 1; font-size: 11px; font-weight: 650; }
.field-settings-title .type-badge { border: 1px solid var(--line); background: #fbf6f7; color: var(--muted); }
.option-editor { display: flex; flex-direction: column; gap: 5px; }
.option-row { display: flex; align-items: center; gap: 5px; }
.option-row input { flex: 1; height: 30px; font-size: 10.5px; }
.option-row button { width: 26px; height: 26px; border: 1px solid var(--line); background: #fff; border-radius: 6px; display: grid; place-items: center; color: var(--muted); }
.option-row button svg { width: 12px; height: 12px; }
.form-live-banner { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 8px; background: var(--green-soft); color: #047857; font-size: 9.5px; margin-top: 10px; }
.form-live-banner svg { width: 13px; height: 13px; }
.form-live-banner strong { font-weight: 700; }

/* ============================================================ responsive pages */
@media (max-width: 1280px) {
  .auto-grid, .app-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .welcome-visual { width: 310px; }
  .studio-body { grid-template-columns: 215px minmax(0, 1fr) 320px; }
}
@media (max-width: 1080px) {
  .dash-grid { grid-template-columns: 1fr; }
  .welcome-visual { display: none; }
  .mini-stat-strip { grid-template-columns: repeat(2, 1fr); }
  .db-layout { grid-template-columns: 1fr; }
  .db-side { position: static; }
  .db-list { flex-direction: row; overflow-x: auto; }
  .db-item { min-width: 210px; }
  .studio-body { grid-template-columns: 200px minmax(0, 1fr); }
  .studio-panel.right { display: none; }
  .form-canvas-wrap { padding-top: 0; }
}
@media (max-width: 860px) {
  .welcome { padding: 22px; }
  .welcome h2 { font-size: 22px; }
  .auto-grid, .app-grid, .template-strip, .var-info-grid { grid-template-columns: 1fr; }
  .toolbar-row { align-items: stretch; }
  .toolbar-search .input { width: 100%; }
  .var-banner-meta { width: 100%; margin-left: 0; border-top: 1px solid #e9e5f8; padding-top: 12px; }
  .var-banner-stat:first-child { border-left: 0; padding-left: 0; }
  .db-hero { flex-wrap: wrap; }
  .db-hero-actions { width: 100%; }
  .db-stat-row { grid-template-columns: 1fr; }
  .table-card-grid { grid-template-columns: 1fr; }
  .run-summary-grid { grid-template-columns: repeat(2, 1fr); }
  .studio-body { grid-template-columns: minmax(0, 1fr); }
  .studio-panel.left { display: none; }
  .form-stage { padding: 20px 14px; }
}

/* ============================================================ AI management */
.ai-page .page-head { margin-bottom: 16px; }
.ai-hero {
  position: relative;
  display: flex; align-items: stretch; justify-content: space-between; gap: 24px;
  padding: 26px 30px;
  border-radius: 22px;
  overflow: hidden;
  color: #fff;
  background:
    radial-gradient(75% 140% at 100% 0%, rgba(236, 72, 153, .34), transparent 55%),
    radial-gradient(70% 130% at 0% 120%, rgba(59, 130, 246, .26), transparent 55%),
    linear-gradient(135deg, #1e1b4b 0%, #3b1d78 52%, #701a75 100%);
  border: 1px solid #3f2b74;
  box-shadow: 0 22px 44px -30px rgba(76, 29, 149, .65);
  margin-bottom: 16px;
}
.ai-hero::before {
  content: "";
  position: absolute; inset: 0;
  background-image: linear-gradient(rgba(255,255,255,.045) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.045) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: radial-gradient(80% 80% at 50% 30%, #000, transparent 80%);
  pointer-events: none;
}
.ai-hero::after {
  content: "";
  position: absolute; width: 340px; height: 340px; border-radius: 50%;
  border: 1px solid rgba(255,255,255,.12);
  right: 20px; top: -180px;
}
.ai-hero-copy { position: relative; z-index: 1; max-width: 560px; }
.ai-hero-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 99px;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.16);
  backdrop-filter: blur(6px);
  font-size: 9.5px; font-weight: 650; color: #ede9fe;
  margin-bottom: 14px;
}
.ai-hero-badge svg { width: 12px; height: 12px; }
.ai-hero-copy h2 { font-size: 28px; line-height: 1.12; letter-spacing: -.04em; font-weight: 800; color: #fff; }
.ai-hero-copy h2 span { color: #e9d5ff; }
.ai-hero-copy p { font-size: 12px; line-height: 1.65; color: rgba(237,233,254,.74); max-width: 490px; margin-top: 8px; }
.ai-contract-chips { display: flex; align-items: center; gap: 6px; margin-top: 16px; }
.ai-contract-chips span {
  display: inline-flex; align-items: center; gap: 5px;
  height: 27px; padding: 0 9px; border-radius: 7px;
  background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.13);
  color: #f9e9ed; font-size: 9.5px; font-weight: 600;
}
.ai-contract-chips svg { width: 12px; height: 12px; color: #d8b4fe; }
.ai-hero-side { width: 336px; flex: none; display: flex; align-items: center; position: relative; z-index: 1; }
.ai-route-preview {
  width: 100%;
  background: rgba(255,255,255,.09);
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 15px;
  padding: 15px;
  backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08);
}
.ai-route-label { font-size: 8px; letter-spacing: .12em; text-transform: uppercase; font-weight: 750; color: rgba(237,233,254,.55); margin-bottom: 9px; }
.ai-route-model { display: flex; align-items: center; gap: 9px; }
.ai-route-model .ai-provider-logo { width: 30px; height: 30px; border-radius: 8px; font-size: 10px; }
.ai-route-model .ai-provider-logo svg { width: 15px; height: 15px; }
.ai-route-model strong { display: block; font-size: 11px; font-weight: 650; color: #fff; }
.ai-route-model span { display: block; font-size: 8.5px; color: rgba(237,233,254,.58); margin-top: 1px; }
.ai-route-model .ai-route-status { margin-left: auto; width: 20px; height: 20px; border-radius: 50%; background: rgba(16,185,129,.16); color: #6ee7b7; display: grid; place-items: center; }
.ai-route-model .ai-route-status svg { width: 11px; height: 11px; }
.ai-route-link { width: 1px; height: 20px; background: rgba(255,255,255,.18); margin: 4px 0 4px 14px; }
.ai-route-model.fallback .ai-route-fallback-icon { width: 30px; height: 30px; border-radius: 8px; background: rgba(255,255,255,.1); display: grid; place-items: center; color: #d8b4fe; }
.ai-route-model.fallback .ai-route-fallback-icon svg { width: 14px; height: 14px; }
.ai-route-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 12px; padding-top: 10px; border-top: 1px dashed rgba(255,255,255,.16); font-size: 9px; color: rgba(237,233,254,.62); }
.ai-route-foot strong { color: #fff; font-weight: 650; }
.ai-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(286px, .72fr); gap: 16px; align-items: start; }
.ai-provider-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ai-provider-card {
  background: #fff; border: 1px solid var(--line); border-radius: 15px; padding: 15px;
  display: flex; flex-direction: column; position: relative;
  transition: transform .2s var(--ease), box-shadow .2s;
}
.ai-provider-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-sm); }
.ai-provider-card.is-default { border-color: #e4dcff; box-shadow: inset 0 2px 0 #a855f7; }
.ai-provider-head { display: flex; align-items: flex-start; gap: 9px; }
.ai-provider-logo { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: #fff !important; flex: none; }
.ai-provider-logo svg { width: 19px; height: 19px; }
.ai-provider-title { flex: 1; min-width: 0; }
.ai-provider-title h3 { font-size: 12.5px; font-weight: 700; }
.ai-provider-title p { font-size: 8.5px; color: var(--muted); margin-top: 1px; font-family: var(--font-mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ai-provider-state { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.ai-provider-state .status { height: 19px; font-size: 8px; padding: 0 6px; }
.ai-provider-state .pill { height: 18px; font-size: 7.5px; padding: 0 6px; }
.ai-provider-desc { font-size: 9.5px; color: var(--muted); line-height: 1.5; margin: 10px 0 10px; min-height: 28px; }
.ai-model-list { border: 1px solid #f2e7e9; border-radius: 8px; overflow: hidden; }
.ai-model-row { display: flex; align-items: center; gap: 7px; padding: 6px 8px; background: #fdf8f9; }
.ai-model-row + .ai-model-row { border-top: 1px solid #f2f4f9; }
.ai-model-name { font-size: 9px; font-weight: 600; color: var(--ink-2); min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ai-model-meta { font-size: 7.5px; color: var(--muted-2); margin-left: auto; }
.ai-model-out { font-size: 7px; color: #8b2336; background: #f9e9ed; border-radius: 3px; padding: 1px 4px; white-space: nowrap; }
.ai-model-dot { width: 5px; height: 5px; border-radius: 50%; background: #22c55e; flex: none; }
.ai-model-more { padding: 5px 8px; font-size: 7.5px; color: var(--muted); border-top: 1px solid #f2f4f9; }
.ai-provider-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: auto; padding-top: 10px; border-top: 1px dashed var(--line); }
.ai-model-list { margin-bottom: 11px; }
.ai-provider-usage { display: flex; flex-direction: column; gap: 1px; font-size: 8px; color: var(--muted); }
.ai-provider-usage span:first-child { color: var(--ink-2); font-weight: 600; }
.ai-provider-foot .btn { height: 28px; padding: 0 8px; font-size: 9px; }
.ai-provider-foot .btn svg { width: 11px; height: 11px; }
.ai-add-card {
  border: 1.5px dashed #e2d0d4; border-radius: 15px; background: #fdf8f9;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  min-height: 214px; color: var(--muted); transition: border-color .2s, background .2s;
}
.ai-add-card:hover { border-color: #b9c0df; background: #f7f9ff; }
.ai-add-icon { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: #f9e9ed; color: #a855f7; }
.ai-add-icon svg { width: 17px; height: 17px; }
.ai-add-card strong { font-size: 10.5px; color: var(--ink-2); font-weight: 650; }
.ai-add-card span:last-child { font-size: 9px; }
.ai-side .settings-card + .settings-card { margin-top: 14px; }
.ai-budget-row { display: flex; justify-content: space-between; font-size: 9.5px; margin: 5px 0; }
.ai-budget-row span { color: var(--muted); }
.ai-budget-row strong { font-weight: 650; }
.ai-budget-track { height: 6px; border-radius: 99px; background: #edd8de; overflow: hidden; margin: 4px 0 8px; }
.ai-budget-track span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #a855f7, #ec4899); }
.ai-policy-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.ai-policy-card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 14px; }
.ai-policy-head { display: flex; align-items: center; gap: 8px; }
.ai-policy-icon { width: 29px; height: 29px; border-radius: 8px; display: grid; place-items: center; color: var(--c); background: var(--t); flex: none; }
.ai-policy-icon svg { width: 14px; height: 14px; }
.ai-policy-head h3 { font-size: 11.5px; font-weight: 700; }
.ai-policy-head span:not(.pill) { display: block; font-size: 8px; color: var(--muted); margin-top: 1px; }
.ai-policy-card > p { font-size: 9.5px; color: var(--muted); line-height: 1.55; margin: 9px 0; }
.ai-policy-code { display: block; font-family: var(--font-mono); font-size: 8.5px; color: #8b2336; background: #fdf7f8; border: 1px solid #edd8de; border-radius: 6px; padding: 7px 8px; }
@media (max-width: 1200px) {
  .ai-layout { grid-template-columns: 1fr; }
  .ai-side { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .ai-side .settings-card + .settings-card { margin-top: 0; }
}
@media (max-width: 860px) {
  .ai-hero { flex-direction: column; padding: 22px; }
  .ai-hero-side { width: 100%; }
  .ai-provider-grid, .ai-policy-grid { grid-template-columns: 1fr; }
  .ai-side { grid-template-columns: 1fr; }
  .ai-side .settings-card + .settings-card { margin-top: 0; }
}


/* ---------- MCP management ---------- */
.mcp-endpoint {
  display: block; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: 9px; background: var(--surface-2); color: var(--primary-ink);
  font-family: var(--font-mono); font-size: 10.5px; overflow-wrap: anywhere;
}
.mcp-code {
  margin: 0; padding: 13px 14px; border: 1px solid #e2d3d6; border-radius: 10px;
  background: #29161a; color: #f5e8ea; font-family: var(--font-mono);
  font-size: 10px; line-height: 1.6; overflow: auto; max-height: 260px;
}
.mcp-tools { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.mcp-tool { border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px; background: var(--surface-2); }
.mcp-tool-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 5px; }
.mcp-tool-head code { font-family: var(--font-mono); font-size: 9.5px; color: var(--primary-ink); font-weight: 600; }
.mcp-tool-head > span { display: flex; gap: 3px; flex-wrap: wrap; justify-content: flex-end; }
.mcp-field { font-family: var(--font-mono); font-size: 7.5px; color: var(--muted); background: var(--surface-3); border-radius: 3px; padding: 1px 4px; }
.mcp-tool p { margin: 0; font-size: 9px; line-height: 1.5; color: var(--muted); }
@media (max-width: 900px) { .mcp-tools { grid-template-columns: 1fr; } }
