/* ==========================================================================
   Settings, onboarding, admin, dashboards, automations, import
   ========================================================================== */

.anim-rise[style*="--i"] { animation-delay: calc(var(--i) * 45ms); }

/* ---------- Settings ---------- */
.settings-layout { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 32px; max-width: 980px; align-items: start; }
.settings-nav { position: sticky; top: 0; display: flex; flex-direction: column; gap: 2px; }
.settings-nav .nav-item { height: 34px; }
.settings-main { display: flex; flex-direction: column; gap: 28px; min-width: 0; }
.set-section { display: flex; flex-direction: column; gap: 10px; }
.set-head h2 { font-family: var(--font-display); font-size: 17px; font-weight: 650; letter-spacing: -0.015em; }
.set-head p { color: var(--text-3); font-size: 13.5px; margin-top: 2px; }
.set-body { display: flex; flex-direction: column; padding: 4px 0; }
.set-row { display: flex; align-items: center; gap: 24px; padding: 14px 20px; min-height: 60px; }
.set-row + .set-row { border-top: 1px solid var(--border-subtle); }
.set-label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.set-label strong { font-weight: 560; font-size: 14px; }
.set-label span { color: var(--text-3); font-size: 12.5px; line-height: 1.4; }
.set-control { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; max-width: 60%; }
.set-control .input { width: 280px; max-width: 100%; }
.profile-card { display: flex; align-items: center; gap: 18px; padding: 18px 20px; border-bottom: 1px solid var(--border-subtle); }
.profile-card .swatches .swatch { background: var(--c-gray-dot); }

.accent-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.accent-dot {
  width: 26px; height: 26px; border-radius: 50%; background: var(--c); position: relative;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.08);
  transition: transform var(--dur-2) var(--ease-spring);
}
.accent-dot::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; box-shadow: 0 0 0 2px var(--c); opacity: 0; transform: scale(.85); transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease-spring); }
.accent-dot:hover:not(:disabled) { transform: scale(1.08); }
.accent-dot.on::after { opacity: 1; transform: scale(1); }
.accent-dot:disabled { opacity: .5; cursor: not-allowed; }
:root[data-theme="dark"] .accent-dot[style*="#1c1d20"] { --c: #e8e9ec !important; }

.danger-title { color: var(--danger); }
.danger-card { display: flex; align-items: center; gap: 16px; padding: 18px 20px; box-shadow: var(--shadow-xs), inset 0 0 0 1px color-mix(in srgb, var(--danger) 25%, var(--border)); }
.danger-card p { font-size: 13px; margin-top: 2px; }

.members-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px 8px; }
.member-list { display: flex; flex-direction: column; padding: 0 8px 8px; }
.member-row { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: var(--r-md); transition: background var(--dur-1) var(--ease); }
.member-row:hover { background: var(--bg-hover); }
.set-body > .label { padding: 0 16px; }
.role-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.role-cards .type-card { align-items: flex-start; text-align: left; padding: 10px 12px; height: auto; }
.invite-sent { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.invite-sent p { color: var(--text-2); max-width: 340px; }
.copy-field { display: flex; gap: 8px; width: 100%; }
.copy-field .input { flex: 1; font-family: var(--font-mono); font-size: 12px; }

/* ---------- Onboarding ---------- */
.onb { position: relative; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg-subtle); overflow-x: hidden; }
.onb-aurora { position: fixed; inset: 0; pointer-events: none; background:
  radial-gradient(60vmax 50vmax at 10% -10%, color-mix(in srgb, var(--accent) 12%, transparent), transparent 70%),
  radial-gradient(50vmax 40vmax at 100% 110%, color-mix(in srgb, var(--accent) 9%, transparent), transparent 70%);
  transition: background var(--dur-4) var(--ease); }
:root[data-theme="dark"] .onb-aurora { opacity: .6; }
.onb-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; padding: 18px 28px; }
.onb-brand { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 15px; letter-spacing: -0.01em; }
.onb-steps { display: flex; gap: 6px; }
.onb-steps span { width: 22px; height: 4px; border-radius: 4px; background: var(--border-strong); transition: background var(--dur-3) var(--ease), width var(--dur-3) var(--ease-spring); }
.onb-steps span.on { background: var(--accent); }
.onb-stage { position: relative; z-index: 1; flex: 1; width: min(1120px, 100%); margin: 0 auto; padding: 24px 28px 56px; animation: rise-in var(--dur-4) var(--ease-spring) both; }
.onb-intro { text-align: center; margin: 28px auto 40px; max-width: 620px; }
.onb-intro h1, .onb-form h1, .onb-building h1 { font-family: var(--font-display); font-size: clamp(28px, 4vw, 40px); font-weight: 700; letter-spacing: -0.035em; line-height: 1.08; }
.onb-intro p { color: var(--text-2); font-size: 16.5px; margin-top: 12px; line-height: 1.5; }
.onb-foot { text-align: center; color: var(--text-3); font-size: 13px; margin-top: 28px; }

.tpl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.tpl-card {
  position: relative; display: flex; flex-direction: column; text-align: left; padding: 10px; border-radius: 20px;
  background: var(--surface); box-shadow: var(--shadow-sm), var(--hairline);
  transition: transform var(--dur-3) var(--ease-spring), box-shadow var(--dur-3) var(--ease);
  animation: rise-in var(--dur-4) var(--ease-spring) both; animation-delay: calc(var(--i, 0) * 70ms + 80ms);
}
.tpl-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg), var(--hairline); }
.tpl-card:active { transform: translateY(-1px) scale(.995); }
.tpl-card:focus-visible { outline: none; box-shadow: var(--shadow-lg), 0 0 0 3px var(--accent-ring), var(--hairline); }
.tpl-art {
  position: relative; height: 150px; border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; padding: 16px;
  background: linear-gradient(145deg, var(--c-gray-bg), color-mix(in srgb, var(--c-gray-bg) 40%, var(--surface)));
}
.tpl-art::after { content: ""; position: absolute; width: 180px; height: 180px; right: -50px; top: -70px; border-radius: 50%; background: radial-gradient(circle, color-mix(in srgb, var(--c-gray-dot) 30%, transparent), transparent 70%); }
.tpl-emblem { width: 48px; height: 48px; border-radius: 14px; display: grid; place-items: center; background: var(--c-gray-dot); color: #fff; box-shadow: 0 6px 16px -6px var(--c-gray-dot); }
.tpl-emblem.sm { width: 38px; height: 38px; border-radius: 11px; flex: none; }
.tpl-emblem .icon { width: 24px; height: 24px; }
.tpl-emblem.sm .icon { width: 19px; height: 19px; }
.tpl-mini { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 5px; }
.tpl-chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px 0 4px; border-radius: 8px; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(8px); font-size: 12px; font-weight: 550; color: var(--text); box-shadow: var(--shadow-xs); }
.tpl-chip .obj-icon { width: 17px; height: 17px; border-radius: 5px; }
.tpl-chip .obj-icon .icon { width: 11px; height: 11px; }
.tpl-body { padding: 14px 8px 8px; display: flex; flex-direction: column; gap: 4px; }
.tpl-body h3 { font-size: 16.5px; font-weight: 650; letter-spacing: -0.015em; }
.tpl-body p { color: var(--text-2); font-size: 13.5px; line-height: 1.45; }
.tpl-meta { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; color: var(--text-3); font-size: 12.5px; }
.tpl-meta span { display: inline-flex; align-items: center; gap: 4px; }
.tpl-go { position: absolute; right: 18px; bottom: 18px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-muted); color: var(--text-2); opacity: 0; transform: translateX(-6px); transition: all var(--dur-2) var(--ease); }
.tpl-card:hover .tpl-go { opacity: 1; transform: none; background: var(--accent); color: var(--accent-fg); }
.tpl-card.blank .tpl-art { background: repeating-linear-gradient(135deg, var(--bg-subtle) 0 10px, var(--surface) 10px 20px); box-shadow: inset 0 0 0 1.5px var(--border); align-items: center; justify-content: center; }
.tpl-card.blank .tpl-art::after { display: none; }
.blank-art { position: relative; }
.blank-art > .icon { position: relative; z-index: 1; width: 44px; height: 44px; padding: 10px; border-radius: 14px; background: var(--surface); color: var(--text-2); box-shadow: var(--shadow-md), var(--hairline); transition: transform var(--dur-3) var(--ease-spring); }
.tpl-card.blank:hover .blank-art > .icon { transform: rotate(90deg) scale(1.05); }
.blank-art > span { position: absolute; border-radius: 8px; background: var(--surface); box-shadow: var(--hairline); }
.blank-art > span:nth-child(1) { width: 70px; height: 22px; left: 22%; top: 24%; transform: rotate(-6deg); }
.blank-art > span:nth-child(2) { width: 56px; height: 22px; right: 18%; top: 30%; transform: rotate(5deg); }
.blank-art > span:nth-child(3) { width: 84px; height: 22px; left: 36%; bottom: 20%; transform: rotate(-2deg); }
.skeleton-card { padding: 10px; pointer-events: none; }

.onb-setup { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 56px; align-items: center; padding-top: 8px; }
.onb-form { display: flex; flex-direction: column; }
.onb-back { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; color: var(--text-2); font-size: 13.5px; font-weight: 500; margin-bottom: 18px; padding: 4px 8px 4px 4px; border-radius: 8px; transition: color var(--dur-1), background var(--dur-1); }
.onb-back:hover { color: var(--text); background: var(--bg-hover); }
.onb-form h1 { font-size: clamp(26px, 3.4vw, 34px); }
.onb-lead { color: var(--text-2); font-size: 15px; line-height: 1.55; margin-top: 10px; }
.onb-label { display: block; font-size: 13px; font-weight: 600; color: var(--text-2); margin: 24px 0 8px; }
.onb-form .input.lg { font-size: 16px; }
.onb-form > .btn { margin-top: 30px; align-self: flex-start; min-width: 200px; }
.onb-hint { color: var(--text-3); font-size: 12.5px; margin-top: 8px; }
.onb-row { display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap; }
.onb-row .select { width: 130px; }
.onb-sample { flex: 1; min-width: 240px; display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: var(--r-lg); background: var(--surface); box-shadow: var(--hairline); cursor: pointer; }
.onb-sample > div { flex: 1; display: flex; flex-direction: column; }
.onb-sample strong { font-size: 13.5px; font-weight: 600; }
.onb-sample span { font-size: 12.5px; color: var(--text-3); }
.starter-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.starter { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 10px 0 6px; border-radius: 11px; background: var(--surface); box-shadow: var(--hairline); font-weight: 550; font-size: 13.5px; transition: box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease-spring), opacity var(--dur-2); opacity: .7; }
.starter:hover { opacity: 1; }
.starter.on { opacity: 1; box-shadow: var(--shadow-sm), inset 0 0 0 1.5px var(--accent); }
.starter-check { width: 16px; height: 16px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-muted); color: transparent; transition: all var(--dur-2) var(--ease-spring); }
.starter.on .starter-check { background: var(--accent); color: var(--accent-fg); }
.starter:active { transform: scale(.97); }

.onb-preview { perspective: 1600px; }
.mock-window { border-radius: 16px; background: var(--surface); box-shadow: var(--shadow-xl), var(--hairline); overflow: hidden; transform: rotateY(-8deg) rotateX(3deg); transform-origin: left center; transition: transform var(--dur-4) var(--ease); animation: rise-in 700ms var(--ease-spring) both 120ms; }
.onb-preview:hover .mock-window { transform: rotateY(-3deg) rotateX(1deg); }
.mock-bar { display: flex; gap: 6px; padding: 12px 14px; border-bottom: 1px solid var(--border-subtle); }
.mock-bar i { width: 10px; height: 10px; border-radius: 50%; background: var(--border-strong); }
.mock-body { display: grid; grid-template-columns: 190px 1fr; min-height: 380px; }
.mock-side { background: var(--bg-subtle); border-right: 1px solid var(--border-subtle); padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; min-width: 0; }
.mock-ws { display: flex; align-items: center; gap: 8px; font-weight: 650; padding: 4px 6px 10px; min-width: 0; }
.mock-ws-icon { flex: none; width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: var(--accent); color: var(--accent-fg); font-size: 11.5px; transition: background var(--dur-3) var(--ease); }
.mock-nav { display: flex; align-items: center; gap: 8px; height: 26px; padding: 0 6px; border-radius: 7px; color: var(--text-2); min-width: 0; }
.mock-nav.on { background: var(--bg-active); color: var(--text); }
.mock-nav .icon { color: var(--text-3); }
.mock-obj { animation: rise-in var(--dur-3) var(--ease-spring) both; animation-delay: calc(var(--i) * 40ms); font-weight: 500; color: var(--text); }
.mock-obj .obj-icon { width: 18px; height: 18px; border-radius: 5px; flex: none; }
.mock-obj .obj-icon .icon { width: 11px; height: 11px; color: inherit; }
.mock-label { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); padding: 12px 6px 4px; }
.mock-line { display: inline-block; height: 7px; border-radius: 4px; background: var(--border); }
.mock-line.faint { background: var(--border-subtle); }
.mock-main { padding: 16px 18px; display: flex; flex-direction: column; gap: 0; min-width: 0; }
.mock-title { font-family: var(--font-display); font-weight: 680; font-size: 18px; letter-spacing: -0.02em; margin-bottom: 12px; }
.mock-toolbar { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.mock-pill { width: 54px; height: 20px; border-radius: 6px; background: var(--bg-muted); }
.mock-pill.on { background: var(--accent-soft); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 30%, transparent); }
.mock-btn { width: 64px; height: 22px; border-radius: 7px; background: var(--accent); transition: background var(--dur-3) var(--ease); }
.mock-row { display: flex; align-items: center; gap: 14px; height: 36px; border-bottom: 1px solid var(--border-subtle); animation: fade-in var(--dur-3) var(--ease) both; animation-delay: calc(var(--i) * 35ms + 200ms); }
.mock-cb { width: 12px; height: 12px; border-radius: 4px; box-shadow: inset 0 0 0 1.5px var(--border-strong); }
.mock-tag { width: 52px; height: 16px; border-radius: 5px; background: var(--c-gray-bg); }

.onb-building { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 22px; min-height: 60vh; }
.build-orb { position: relative; animation: orb 2.4s var(--ease-in-out) infinite; }
.build-orb::before { content: ""; position: absolute; inset: -18px; border-radius: 30px; background: radial-gradient(circle, var(--accent-ring), transparent 70%); animation: pulse-ring 2.4s var(--ease-in-out) infinite; }
.onb-building h1 { font-size: clamp(24px, 3vw, 30px); }
.build-steps { list-style: none; display: flex; flex-direction: column; gap: 10px; min-width: 280px; text-align: left; }
.build-steps li { display: flex; align-items: center; gap: 10px; font-size: 14.5px; color: var(--text-2); opacity: 0; animation: rise-in var(--dur-3) var(--ease-spring) forwards; animation-delay: var(--d); }
.bs-icon { position: relative; width: 20px; height: 20px; display: grid; place-items: center; }
.bs-icon .spinner { width: 16px; height: 16px; position: absolute; animation: spin .8s linear infinite, fade-out 1ms linear forwards; animation-delay: 0s, calc(var(--d) + 480ms); }
.bs-icon .icon { width: 20px; height: 20px; padding: 3px; border-radius: 50%; background: var(--accent); color: var(--accent-fg); transform: scale(0); animation: pop-in var(--dur-3) var(--ease-spring) forwards; animation-delay: calc(var(--d) + 480ms); }
@keyframes orb { 0%, 100% { transform: translateY(0) } 50% { transform: translateY(-8px) } }
@keyframes pulse-ring { 0%, 100% { opacity: .5; transform: scale(.9) } 50% { opacity: 1; transform: scale(1.1) } }
@keyframes pop-in { to { transform: scale(1) } }
@keyframes fade-out { to { opacity: 0 } }

/* ---------- Admin ---------- */
.simple-table-wrap { overflow-x: auto; }
.simple-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.simple-table th { text-align: left; font-weight: 550; color: var(--text-3); font-size: 12px; padding: 8px 16px; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
.simple-table td { padding: 10px 16px; border-bottom: 1px solid var(--border-subtle); white-space: nowrap; }
.simple-table tr:last-child td { border-bottom: 0; }
.simple-table tbody tr:hover { background: var(--bg-hover); }
.simple-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.admin-tpls { display: flex; flex-direction: column; gap: 10px; }
.admin-tpl { display: flex; align-items: center; gap: 14px; padding: 14px 16px; }
.admin-tpl .tpl-meta { margin-top: 6px; }
.request-card { padding: 14px 18px; }

/* ---------- Shared bits ---------- */
.filter-rules { display: flex; flex-direction: column; gap: 8px; }
.segmented.sm button { height: 24px; padding: 0 9px; font-size: 12.5px; }
.notice { display: flex; align-items: center; gap: 8px; padding: 10px 14px; border-radius: var(--r-md); background: var(--bg-muted); color: var(--text-2); font-size: 13.5px; }
.notice.warn { background: var(--c-orange-bg); color: var(--c-orange-fg); }
.link { color: var(--accent-text); font-weight: 500; display: inline-flex; align-items: center; gap: 6px; max-width: 100%; }
.link:hover { text-decoration: underline; text-underline-offset: 2px; }
.page-wide { padding: 24px 28px 48px; }
.title-switch { display: inline-flex; align-items: center; gap: 6px; font: inherit; color: inherit; padding: 2px 6px; margin: -2px -6px; border-radius: 8px; }
.title-switch:hover { background: var(--bg-hover); }
.title-switch .icon { color: var(--text-3); }
.chip-select { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 8px 0 4px; border-radius: 8px; background: var(--surface); box-shadow: var(--hairline); font-weight: 550; font-size: 13px; transition: box-shadow var(--dur-1); }
.chip-select:hover { box-shadow: inset 0 0 0 1px var(--text-4); }
.chip-select > .icon:last-child { color: var(--text-3); }
.chip-select .obj-icon { width: 20px; height: 20px; border-radius: 6px; }
.chip-select .obj-icon .icon { width: 12px; height: 12px; }

/* ---------- Automations ---------- */
.auto-hero { max-width: 620px; }
.auto-list { display: flex; flex-direction: column; gap: 8px; }
.auto-card { display: flex; align-items: center; gap: 14px; padding: 14px 16px; transition: box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease), opacity var(--dur-2); }
.auto-card:hover { box-shadow: var(--shadow-md), var(--hairline); transform: translateY(-1px); }
.auto-card.off { opacity: .62; }
.auto-card.off .auto-icon { background: var(--bg-muted); color: var(--text-3); }
.auto-icon { flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.auto-icon.sm { width: 28px; height: 28px; border-radius: 9px; }
.auto-icon.act { background: var(--bg-muted); color: var(--text-2); }
.auto-name { font-weight: 600; font-size: 14.5px; }
.auto-sum { display: flex; align-items: center; gap: 7px; color: var(--text-2); font-size: 13px; margin-top: 3px; min-width: 0; }
.auto-obj { display: inline-flex; align-items: center; gap: 5px; font-weight: 550; color: var(--text); flex: none; }
.auto-obj .obj-icon { width: 18px; height: 18px; border-radius: 5px; }
.auto-obj .obj-icon .icon { width: 11px; height: 11px; }
.auto-acts { display: inline-flex; gap: 3px; flex: none; }
.auto-act { width: 22px; height: 22px; border-radius: 7px; display: grid; place-items: center; background: var(--bg-muted); color: var(--text-2); }
.auto-stats { display: flex; flex-direction: column; align-items: flex-end; font-size: 12.5px; color: var(--text-2); flex: none; }
.recipe-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.recipe { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; padding: 14px 16px; text-align: left; transition: box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease-spring); }
.recipe:hover { box-shadow: var(--shadow-md), var(--hairline); transform: translateY(-2px); }
.recipe strong { font-size: 14px; font-weight: 600; margin-top: 8px; }
.recipe .faint { font-size: 12.5px; line-height: 1.4; }
.recipe-flow { display: flex; align-items: center; gap: 6px; color: var(--text-4); }

.auto-enabled { gap: 8px; font-size: 13px; color: var(--text-2); margin-right: 4px; }
.auto-builder { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; max-width: 1120px; margin: 0 auto; padding: 24px 28px 64px; align-items: start; }
.flow { max-width: 680px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; }
.flow-title { font-family: var(--font-display); font-size: 26px; font-weight: 680; letter-spacing: -0.025em; border: 0; background: none; outline: none; padding: 4px 0 14px; color: var(--text); width: 100%; }
.flow-title::placeholder { color: var(--text-4); }
.flow-steps { border: 0; padding: 0; margin: 0; min-width: 0; display: flex; flex-direction: column; }
.flow-steps .notice { margin-bottom: 12px; }
.step { padding: 0; overflow: visible; transition: box-shadow var(--dur-2) var(--ease); }
.step:focus-within { box-shadow: var(--shadow-md), inset 0 0 0 1px var(--accent-ring); }
.step.error { box-shadow: var(--shadow-xs), inset 0 0 0 1px color-mix(in srgb, var(--danger) 45%, transparent); }
.step.muted .step-icon { background: var(--bg-muted); color: var(--text-3); }
.step-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 0 14px; }
.step-icon { width: 28px; height: 28px; border-radius: 9px; display: grid; place-items: center; background: var(--accent); color: var(--accent-fg); }
.step-label { font-weight: 650; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--text-2); }
.step-opt { font-size: 12px; }
.step-body { padding: 14px 16px 16px; }
.step-error { display: flex; align-items: center; gap: 6px; padding: 0 16px 12px; color: var(--danger); font-size: 12.5px; font-weight: 500; }
.connector { display: flex; justify-content: center; height: 26px; }
.connector span { width: 2px; height: 100%; background: linear-gradient(var(--border-strong), var(--border)); border-radius: 2px; position: relative; }
.connector span::after { content: ""; position: absolute; left: 50%; bottom: -2px; width: 7px; height: 7px; border-right: 2px solid var(--border-strong); border-bottom: 2px solid var(--border-strong); transform: translateX(-50%) rotate(45deg); }
.add-action { display: flex; justify-content: center; }
.add-action .btn { border: 1.5px dashed var(--border-strong); border-radius: 12px; height: 38px; padding: 0 16px; }
.add-action .btn:hover { border-color: var(--accent); color: var(--accent-text); }
.trigger-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.trigger-opt { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 10px 6px; min-height: 68px; border-radius: 11px; font-size: 12.5px; font-weight: 550; color: var(--text-2); box-shadow: var(--hairline); line-height: 1.25; transition: all var(--dur-2) var(--ease); }
.trigger-opt:hover { color: var(--text); background: var(--bg-subtle); }
.trigger-opt.on { color: var(--accent-text); background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.sentence { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); }
.sentence .select.sm { width: auto; max-width: 240px; }
.num-in { width: 64px !important; text-align: center; }
.time-in { width: 104px !important; }
.trigger-hint { color: var(--text-3); font-size: 12.5px; line-height: 1.45; margin: 0; }
.action-type { margin-bottom: 12px; }
.action-type .select { width: auto; font-weight: 550; }
.action-grid { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px 14px; align-items: center; }
.action-grid > label { font-size: 13px; color: var(--text-2); font-weight: 500; align-self: start; padding-top: 5px; }
.action-grid .select.sm { width: 100%; }
.var-input { position: relative; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.var-input .input, .var-input .textarea { width: 100%; padding-right: 38px; }
.var-input .textarea { min-height: 110px; font-size: 13.5px; line-height: 1.5; }
.var-btn { position: absolute; right: 4px; top: 4px; height: 20px; padding: 0 6px; border-radius: 6px; font-family: var(--font-mono); font-size: 11.5px; font-weight: 600; color: var(--text-3); background: var(--bg-muted); transition: all var(--dur-1); }
.var-btn:hover { color: var(--accent-text); background: var(--accent-soft); }
.var-preview { font-size: 12.5px; color: var(--text-3); line-height: 1.7; white-space: pre-wrap; }
.var-token { display: inline-block; padding: 0 6px; border-radius: 5px; background: var(--accent-soft); color: var(--accent-text); font-weight: 550; line-height: 1.5; }
.var-token.bad { background: var(--danger-soft); color: var(--danger); }
.var-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.var-chip { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 12px; background: var(--bg-muted); color: var(--text-2); }
.var-chip:hover { background: var(--accent-soft); color: var(--accent-text); }
.form-input-wrap { min-width: 0; }
.auto-side { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 12px; }
.run-list { display: flex; flex-direction: column; padding: 0 8px 8px; max-height: 480px; overflow: auto; }
.run-row { display: flex; align-items: flex-start; gap: 10px; padding: 8px; border-radius: 8px; font-size: 13px; }
.run-row:hover { background: var(--bg-hover); }
.run-row .faint { font-size: 12px; }
.run-row .link { font-weight: 550; }
.run-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: var(--success); box-shadow: 0 0 0 3px color-mix(in srgb, var(--success) 18%, transparent); }
.run-dot.error { background: var(--danger); box-shadow: 0 0 0 3px var(--danger-soft); }
.run-time { flex: none; font-size: 12px; white-space: nowrap; }
.auto-tips { display: flex; gap: 10px; padding: 14px 16px; font-size: 13px; color: var(--text-2); }
.auto-tips > .icon { color: var(--c-yellow-dot); flex: none; margin-top: 2px; }
.auto-tips strong { color: var(--text); font-weight: 600; display: block; margin-bottom: 2px; }
.auto-tips p { margin: 0; line-height: 1.5; }

/* ---------- Dashboards ---------- */
.dash-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; grid-auto-flow: dense; max-width: 1400px; margin: 0 auto; }
.widget { grid-column: span var(--w, 2); display: flex; flex-direction: column; min-height: 320px; position: relative; transition: box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease), opacity var(--dur-2); }
.widget.w-metric { min-height: 150px; }
.widget.w-list { min-height: 300px; }
.widget.skeleton-w { min-height: 200px; padding: 12px; }
.widget[draggable="true"] { cursor: grab; }
.widget.dragging { opacity: .45; transform: scale(.98); }
.widget.over { box-shadow: var(--shadow-md), inset 0 0 0 2px var(--accent); }
.widget-head { display: flex; align-items: flex-start; gap: 8px; padding: 14px 14px 0 18px; }
.widget-title { font-weight: 600; font-size: 14px; letter-spacing: -0.005em; }
.widget-sub { color: var(--text-3); font-size: 12px; margin-top: 1px; }
.widget-menu { opacity: 0; transition: opacity var(--dur-1); }
.widget:hover .widget-menu, .widget-menu[aria-expanded="true"] { opacity: 1; }
.widget-body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 8px 14px 14px 14px; }
.widget-foot { display: flex; align-items: center; gap: 6px; padding: 0 18px 14px; color: var(--text-3); font-size: 12px; }
.widget-foot .obj-icon { width: 16px; height: 16px; border-radius: 5px; }
.widget-foot .obj-icon .icon { width: 10px; height: 10px; }
.chart { position: relative; flex: 1; min-height: 200px; }
.chart svg { position: absolute; inset: 0; overflow: visible; }
.chart .grid line { stroke: var(--border-subtle); stroke-width: 1; }
.chart .grid text, .chart .xl { fill: var(--text-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .bar .hit { fill: transparent; }
.chart .bar .fill { transform-box: fill-box; transform-origin: bottom; animation: grow-y 620ms var(--ease-spring) both; transition: opacity var(--dur-2); }
.chart .bar.dim .fill { opacity: .35; }
.chart .line { fill: none; stroke: var(--accent); stroke-width: 2.25; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw 1s var(--ease) forwards; }
.chart .area { animation: fade-in 900ms var(--ease) both 300ms; }
.chart .cursor line { stroke: var(--border-strong); stroke-dasharray: 3 3; }
.chart .cursor circle { fill: var(--surface); stroke: var(--accent); stroke-width: 2.5; }
.chart-tip { position: absolute; transform: translate(-50%, calc(-100% - 10px)); pointer-events: none; background: var(--text); color: var(--text-inverse); border-radius: 8px; padding: 6px 9px; font-size: 12px; white-space: nowrap; display: flex; flex-direction: column; gap: 1px; box-shadow: var(--shadow-md); z-index: 2; animation: fade-in 120ms var(--ease); }
.chart-tip span { opacity: .7; }
.chart-tip strong { font-weight: 650; font-variant-numeric: tabular-nums; }
.chart-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; color: var(--text-3); font-size: 13px; text-align: center; padding: 16px; min-height: 100px; }
.chart-empty .icon { width: 22px; height: 22px; color: var(--text-4); }
@keyframes grow-y { from { transform: scaleY(0); } }
@keyframes draw { to { stroke-dashoffset: 0; } }

.metric { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 6px; padding: 0 4px; }
.metric-value { font-family: var(--font-display); font-size: clamp(30px, 3.2vw, 40px); font-weight: 700; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.metric-delta { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; }
.metric-delta.up { color: var(--success); }
.metric-delta.down { color: var(--danger); }
.metric-delta.flat { color: var(--text-3); }
.metric-delta .faint { font-weight: 450; }

.donut { flex: 1; display: flex; align-items: center; gap: 22px; padding: 4px 6px; min-height: 0; }
.donut-ring { position: relative; flex: none; }
.donut-ring svg { transform: rotate(-90deg); display: block; }
.donut-track { fill: none; stroke: var(--bg-muted); stroke-width: 16; }
.donut-seg { fill: none; stroke-width: 16; stroke-linecap: butt; cursor: pointer; transition: opacity var(--dur-2), stroke-width var(--dur-2) var(--ease); animation: fade-in 500ms var(--ease) both; }
.donut-seg:hover { stroke-width: 19; }
.donut-seg.dim { opacity: .3; }
.donut-center { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; pointer-events: none; }
.donut-center strong { font-family: var(--font-display); font-size: 20px; font-weight: 700; letter-spacing: -0.03em; font-variant-numeric: tabular-nums; }
.donut-center span { font-size: 11.5px; color: var(--text-3); }
.legend { list-style: none; flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; max-height: 240px; overflow: auto; }
.legend li { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; font-size: 13px; cursor: default; transition: opacity var(--dur-2), background var(--dur-1); }
.legend li:hover { background: var(--bg-hover); }
.legend li.dim { opacity: .4; }
.legend .sw { flex: none; width: 9px; height: 9px; border-radius: 3px; }
.legend .lv { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--text-2); font-weight: 550; }

.funnel { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 10px; }
.funnel-row { display: grid; grid-template-columns: minmax(70px, 0.9fr) minmax(0, 2fr) 56px 40px; align-items: center; gap: 10px; font-size: 13px; animation: rise-in var(--dur-3) var(--ease-spring) both; animation-delay: calc(var(--i) * 60ms); }
.funnel-track { height: 22px; border-radius: 7px; background: var(--bg-muted); overflow: hidden; }
.funnel-bar { height: 100%; border-radius: 7px; transform-origin: left; animation: grow-x 700ms var(--ease-spring) both; animation-delay: calc(var(--i) * 60ms + 80ms); }
.funnel-val { text-align: right; font-weight: 600; font-variant-numeric: tabular-nums; }
.funnel-conv { font-size: 12px; text-align: right; }
@keyframes grow-x { from { transform: scaleX(0); } }

.w-list { display: flex; flex-direction: column; margin: 0 -6px; }
.w-list-row { display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-radius: 8px; text-align: left; font-size: 13.5px; font-weight: 500; }
.w-list-row + .w-list-row { box-shadow: 0 -1px 0 var(--border-subtle); }
.w-list-row:hover { background: var(--bg-hover); box-shadow: none; }
.w-list-row:hover + .w-list-row { box-shadow: none; }
.w-list-val { margin-left: auto; flex: none; color: var(--text-2); font-weight: 450; }

.wtype-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.wtype { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 10px 10px 12px; border-radius: 14px; text-align: left; box-shadow: var(--hairline); transition: box-shadow var(--dur-2) var(--ease), transform var(--dur-2) var(--ease-spring); }
.wtype:hover { box-shadow: var(--shadow-md), inset 0 0 0 1.5px var(--accent); transform: translateY(-2px); }
.wtype strong { font-size: 13.5px; font-weight: 600; padding: 0 4px; margin-top: 6px; }
.wtype .faint { font-size: 12px; padding: 0 4px; line-height: 1.35; }
.wtype-art { width: 100%; height: 76px; border-radius: 10px; background: var(--bg-subtle); display: grid; place-items: center; }
.wtype-art svg { width: 96px; height: 56px; overflow: visible; }
.art-bar { fill: var(--accent); transform-box: fill-box; transform-origin: bottom; }
.wtype:hover .art-bar { animation: grow-y 500ms var(--ease-spring) both; }
.art-muted { fill: var(--border-strong); }
.art-line { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.art-line.thick { stroke-width: 2.5; }
.art-area { fill: var(--accent); opacity: .12; }
.art-num { font-family: var(--font-display); font-size: 26px; font-weight: 700; fill: var(--text); letter-spacing: -1px; }
.art-ring { fill: none; stroke: var(--border); stroke-width: 9; transform: rotate(-90deg); transform-origin: 48px 28px; }
.art-ring.a { stroke: var(--accent); }
.art-ring.b { stroke: var(--c-orange-dot); }
.wtype-mini { display: flex; gap: 4px; }
.wtype-mini button { width: 34px; height: 30px; border-radius: 8px; display: grid; place-items: center; color: var(--text-3); box-shadow: var(--hairline); }
.wtype-mini button.on { color: var(--accent-text); background: var(--accent-soft); box-shadow: inset 0 0 0 1.5px var(--accent); }
.wizard { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 24px; }
.wizard-form { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.wizard-filters { padding: 10px; border-radius: var(--r-md); background: var(--bg-subtle); }
.wizard-filters .filter-rule { grid-template-columns: 44px minmax(0, 1fr) minmax(0, 0.9fr) minmax(0, 1fr) 24px; }
.wizard-preview { display: flex; flex-direction: column; gap: 10px; position: sticky; top: 0; align-self: start; }
.wizard-preview .widget { min-height: 300px; box-shadow: var(--shadow-md), var(--hairline); }
.wizard-preview .widget.w-metric { min-height: 170px; }

/* ---------- Import ---------- */
.import { max-width: 880px; }
.import-steps { list-style: none; display: flex; gap: 8px; margin-bottom: 22px; }
.import-steps li { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 550; color: var(--text-3); padding-right: 14px; }
.import-steps li + li::before { content: ""; width: 28px; height: 1.5px; background: var(--border-strong); margin-right: 6px; }
.import-steps li span { width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--bg-muted); font-size: 12px; transition: all var(--dur-2) var(--ease-spring); }
.import-steps li.on { color: var(--text); }
.import-steps li.on span { background: var(--accent); color: var(--accent-fg); }
.import-steps li.done span { background: var(--c-green-bg); color: var(--c-green-fg); }
.dropzone.big { min-height: 260px; gap: 10px; border-radius: 20px; cursor: pointer; }
.dropzone.big strong { font-size: 16px; color: var(--text); }
.dropzone.big .btn { margin-top: 8px; }
.dropzone.busy { cursor: progress; }
.drop-icon { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: var(--c-green-bg); color: var(--c-green-fg); margin-bottom: 6px; transition: transform var(--dur-3) var(--ease-spring); }
.dropzone:hover .drop-icon, .dropzone.over .drop-icon { transform: translateY(-4px) rotate(-4deg); }
.drop-icon.sm { width: 38px; height: 38px; border-radius: 11px; margin: 0; }
.import-help { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 20px; margin-top: 18px; font-size: 13px; color: var(--text-2); }
.import-help > div { display: flex; gap: 8px; align-items: flex-start; line-height: 1.45; }
.import-help .icon { color: var(--text-3); flex: none; margin-top: 1px; }
.import-file { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 12px; }
.import-file .faint { font-size: 12.5px; }
.map-card { padding: 6px 0; }
.map-head, .map-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) 24px minmax(0, 1.1fr); gap: 14px; align-items: center; padding: 8px 16px; }
.map-head { font-size: 12px; color: var(--text-3); font-weight: 550; border-bottom: 1px solid var(--border-subtle); }
.map-row { animation: rise-in var(--dur-3) var(--ease-spring) both; animation-delay: calc(var(--i) * 25ms); transition: opacity var(--dur-2); }
.map-row + .map-row { border-top: 1px solid var(--border-subtle); }
.map-row.skipped { opacity: .55; }
.map-row.skipped:hover { opacity: 1; }
.map-samples { font-size: 12.5px; color: var(--text-2); }
.map-arrow { color: var(--text-4); }
.map-target { display: flex; align-items: center; gap: 8px; min-width: 0; }
.map-target .select { flex: 1; min-width: 0; }
.map-ficon { width: 26px; height: 26px; border-radius: 8px; flex: none; display: grid; place-items: center; background: var(--bg-muted); color: var(--text-2); }
.import .notice { margin-top: 12px; }
.import-foot { display: flex; align-items: center; gap: 14px; margin-top: 18px; font-size: 13.5px; flex-wrap: wrap; }
.import-done { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; padding: 30px 0; }
.done-icon.big { width: 76px; height: 76px; border-radius: 24px; animation: pop 600ms var(--ease-spring) both; }
@keyframes pop { from { transform: scale(.5); opacity: 0; } }
.import-done h2 { font-family: var(--font-display); font-size: 26px; font-weight: 700; letter-spacing: -0.025em; }
.import-errors { width: 100%; max-width: 620px; padding: 10px 14px; display: flex; flex-direction: column; gap: 6px; text-align: left; font-size: 13px; max-height: 260px; overflow: auto; }

@media (max-width: 1100px) {
  .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .widget[style*="--w:3"], .widget[style*="--w:4"] { grid-column: span 2; }
  .auto-builder { grid-template-columns: 1fr; }
  .auto-side { position: static; }
}
@media (max-width: 860px) {
  .wizard { grid-template-columns: 1fr; }
  .wizard-preview { position: static; order: -1; }
  .trigger-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .auto-stats { display: none; }
  .page-wide, .auto-builder { padding: 16px 16px 48px; }
}
@media (max-width: 620px) {
  .dash-grid { grid-template-columns: 1fr; }
  .widget { grid-column: span 1; }
  .wtype-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .action-grid { grid-template-columns: 1fr; gap: 6px; }
  .action-grid > label { padding-top: 6px; }
  .map-head { display: none; }
  .map-row { grid-template-columns: 1fr; gap: 6px; }
  .map-arrow { display: none; }
  .import-help { grid-template-columns: 1fr; }
  .donut { flex-direction: column; align-items: stretch; }
  .donut-ring { align-self: center; }
}

@media (max-width: 960px) {
  .onb-setup { grid-template-columns: 1fr; gap: 32px; }
  .onb-preview { display: none; }
}
@media (max-width: 860px) {
  .settings-layout { grid-template-columns: 1fr; gap: 16px; }
  .settings-nav { position: static; flex-direction: row; overflow-x: auto; }
  .settings-nav .nav-item { flex: none; }
  .set-row { flex-direction: column; align-items: stretch; gap: 10px; }
  .set-control { max-width: none; }
  .set-control .input { width: 100%; }
  .role-cards { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .onb-top { padding: 14px 16px; }
  .onb-stage { padding: 12px 16px 40px; }
  .onb-intro { margin: 12px auto 24px; }
  .tpl-grid { grid-template-columns: 1fr; }
  .admin-tpl { flex-wrap: wrap; }
}
