:root {
  color-scheme: light;

  /* Official SabiSales colours */
  --sabibot-orange: #FF6B00;
  --sabibot-orange-hover: #E85F00;
  --sabibot-navy: #1C1642;
  --sabibot-white: #FFFFFF;
  --sabibot-page-bg: #F8F8FC;
  --sabibot-soft-orange: #FFF0E6;
  --sabibot-soft-navy: #F0EFF7;
  --sabibot-text-primary: #1C1642;
  --sabibot-text-secondary: #5F5B73;
  --sabibot-text-muted: #8A8799;
  --sabibot-border: #E5E3EC;
  --sabibot-border-dark: #C9C6D4;
  --sabibot-success: #22C55E;
  --sabibot-warning: #F59E0B;
  --sabibot-danger: #DC2626;
  --sabibot-info: #2563EB;

  /* Semantic interface tokens */
  --bg: var(--sabibot-page-bg);
  --bg-soft: var(--sabibot-soft-navy);
  --surface: var(--sabibot-white);
  --surface-raised: var(--sabibot-white);
  --surface-hover: #FAF7FF;
  --line: var(--sabibot-border);
  --line-strong: var(--sabibot-border-dark);
  --text: var(--sabibot-text-primary);
  --muted: var(--sabibot-text-secondary);
  --muted-strong: var(--sabibot-text-primary);
  --brand: var(--sabibot-orange);
  --brand-hover: var(--sabibot-orange-hover);
  --brand-strong: var(--sabibot-orange-hover);
  --brand-soft: var(--sabibot-soft-orange);
  --structure: var(--sabibot-navy);
  --structure-soft: var(--sabibot-soft-navy);
  --info: var(--sabibot-info);
  --info-soft: #EAF2FF;
  --success: var(--sabibot-success);
  --success-soft: #EAF9EF;
  --warning: var(--sabibot-warning);
  --warning-soft: #FFF7E3;
  --danger: var(--sabibot-danger);
  --danger-soft: #FDECEC;
  --neutral-soft: var(--sabibot-soft-navy);
  --overlay: rgba(28, 22, 66, .64);
  --shadow: 0 18px 48px rgba(28, 22, 66, .12);
  --shadow-sm: 0 8px 24px rgba(28, 22, 66, .08);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --content: 1180px;
  font-synthesis: none;
}

/* Shared component and route styles. Official tokens live in theme.css. */
* { box-sizing: border-box; }

html { scroll-behavior: smooth; scroll-padding-top: 90px; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 107, 0, .08), transparent 28rem),
    var(--bg);
  color: var(--text);
  font: 16px/1.55 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 3px solid var(--sabibot-orange);
  outline-offset: 3px;
}

h1, h2, h3 { margin: 0; line-height: 1.16; letter-spacing: -.025em; }
h1 { font-size: clamp(2rem, 4vw, 3rem); }
h2 { font-size: clamp(1.3rem, 2vw, 1.65rem); }
h3 { font-size: 1.05rem; }
p { margin: .6rem 0; color: var(--muted); }
small, .hint { color: var(--muted); font-size: .875rem; }
strong { color: var(--text); }
code { color: var(--blue); font: 600 .9rem/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.5rem 0; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(16px);
}

.topbar-inner {
  max-width: var(--content);
  min-height: 70px;
  margin: auto;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand { display: inline-flex; min-width: 0; align-items: center; gap: .7rem; text-decoration: none; font-weight: 850; font-size: 1.15rem; }
.brand img { width: 36px; height: 36px; flex: 0 0 auto; }
.brand-copy { min-width: 0; display: grid; line-height: 1.15; }
.brand-copy strong { overflow: hidden; color: var(--structure); font-size: .96rem; text-overflow: ellipsis; white-space: nowrap; }
.brand-copy small { margin-top: .2rem; color: var(--muted); font-size: .72rem; font-weight: 700; }
.brand-mark { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: var(--brand); color: var(--structure); box-shadow: 0 8px 24px rgba(255, 107, 0, .2); }
.brand-mark svg { width: 20px; height: 20px; }
.top-actions { display: flex; align-items: center; gap: .65rem; }
.top-actions form { margin: 0; }
.desktop-only { display: inline-flex; }

.app-frame { max-width: var(--content); margin: auto; padding: 2.25rem 1.25rem 4rem; }
.app-frame.with-sidebar { display: grid; grid-template-columns: 246px minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.main-content { min-width: 0; }

.sidebar { position: sticky; top: 94px; padding: 1rem; border-radius: var(--radius); background: var(--structure); color: var(--sabibot-white); box-shadow: var(--shadow-sm); }
.sidebar-title { padding: .2rem .7rem 1rem; border-bottom: 1px solid rgba(255, 255, 255, .12); margin-bottom: .7rem; }
.sidebar-title > span { display: block; margin-bottom: .55rem; color: var(--brand); font-size: .68rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.sidebar-title strong { display: block; color: var(--sabibot-white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-title small { display: block; margin-top: .2rem; color: rgba(255, 255, 255, .68); }
.side-nav { display: grid; gap: .35rem; }
.nav-link { display: flex; align-items: center; gap: .75rem; min-height: 44px; padding: .65rem .8rem; border-left: 3px solid transparent; color: rgba(255, 255, 255, .76); text-decoration: none; border-radius: 9px; font-weight: 650; }
.nav-link svg { width: 19px; height: 19px; flex: 0 0 auto; color: rgba(255, 255, 255, .64); }
.nav-link:hover { background: rgba(255, 255, 255, .08); color: var(--sabibot-white); }
.nav-link.active { border-left-color: var(--brand); background: rgba(255, 107, 0, .15); color: var(--sabibot-white); }
.nav-link.active svg { color: var(--brand); }
.mobile-menu { display: none; }

.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.page-header-copy { max-width: 720px; }
.eyebrow { margin: 0 0 .45rem; color: var(--brand); font-size: .76rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.page-subtitle { max-width: 720px; margin-top: .7rem; font-size: 1.02rem; }
.breadcrumb { display: flex; align-items: center; gap: .5rem; margin: 0 0 1rem; color: var(--muted); font-size: .9rem; }
.breadcrumb a { color: var(--muted-strong); text-decoration: none; }
.breadcrumb a:hover { color: var(--brand); }

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.35rem;
  box-shadow: 0 1px 2px rgba(28, 22, 66, .04);
  transition: border-color .2s ease, box-shadow .2s ease;
}
.card:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
}
.card + .card, .section + .section { margin-top: 1rem; }
.card-elevated { box-shadow: var(--shadow); }
.card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.card-header p:last-child { margin-bottom: 0; }
.narrow { width: min(100%, 570px); margin-inline: auto; }
.section { margin-top: 2rem; }
.section-header { display: flex; align-items: end; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }
.section-header p:last-child { margin-bottom: 0; }

.hero-card { padding: clamp(1.4rem, 3vw, 2rem); overflow: hidden; position: relative; }
.hero-card::after { content: ""; position: absolute; width: 260px; height: 260px; right: -130px; top: -160px; border-radius: 50%; background: rgba(255, 107, 0, .1); }
.bot-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; position: relative; z-index: 1; }
.bot-title { display: flex; align-items: center; gap: .85rem; }
.bot-avatar { width: 48px; height: 48px; border-radius: 15px; display: grid; place-items: center; background: var(--brand-soft); color: var(--brand); }
.bot-avatar svg { width: 25px; height: 25px; }

.status { display: inline-flex; align-items: center; align-self: flex-start; gap: .4rem; width: fit-content; padding: .3rem .65rem; border: 1px solid rgba(255, 107, 0, .35); border-radius: 999px; background: var(--brand-soft); color: #8A3900; font-size: .8rem; font-weight: 800; text-transform: capitalize; flex-shrink: 0; white-space: nowrap; }
.status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status.success { color: #137333; border-color: rgba(34, 197, 94, .35); background: var(--success-soft); }
.status.warning { color: #8A5700; border-color: rgba(245, 158, 11, .38); background: var(--warning-soft); }
.status.danger { color: #9F1D1D; border-color: rgba(220, 38, 38, .3); background: var(--danger-soft); }
.status.info { color: #174EA6; border-color: rgba(37, 99, 235, .28); background: var(--info-soft); }
.status.neutral { color: var(--muted); border-color: var(--line-strong); background: var(--neutral-soft); }

.notice { display: flex; align-items: flex-start; gap: 1rem; margin: 1rem 0; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.notice svg { width: 22px; height: 22px; margin-top: .15rem; flex: 0 0 auto; }
.notice p { margin: 0 0 0.5rem 0; color: inherit; }
.notice p:last-child { margin-bottom: 0; }
.notice .button, .notice button { margin-top: 0.5rem; }
.notice.success { color: #137333; background: var(--success-soft); border-color: rgba(34, 197, 94, .32); }
.notice.error { color: #9F1D1D; background: var(--danger-soft); border-color: rgba(220, 38, 38, .28); }
.notice.warning { color: #744900; background: var(--warning-soft); border-color: rgba(245, 158, 11, .34); }
.notice.info { color: #174EA6; background: var(--info-soft); border-color: rgba(37, 99, 235, .28); }
.toast-stack { position: fixed; top: 82px; right: 1rem; z-index: 50; width: min(390px, calc(100vw - 2rem)); display: grid; gap: .65rem; }
.toast-stack .notice { position: relative; overflow: hidden; margin: 0; box-shadow: var(--shadow); backdrop-filter: blur(16px); animation: toast-in .2s ease-out; }
.toast-close { min-width: 32px; min-height: 32px; margin-left: auto; padding: 0; border-radius: 8px; background: transparent; color: currentColor; font-size: 1.3rem; }
.toast-close:hover { background: rgba(28, 22, 66, .08); }
.toast-progress { position: absolute; bottom: 0; left: 0; height: 4px; background: currentColor; opacity: 0.3; animation: toast-progress 6.5s linear forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }
@keyframes toast-progress { from { width: 100%; } to { width: 0%; } }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; margin-top: 1.25rem; }
.metric-card { min-width: 0; padding: 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; box-shadow: 0 1px 2px rgba(28, 22, 66, .04); }
.metric-label { color: var(--muted); font-size: .84rem; }
.metric { margin-top: .3rem; color: var(--text); font-size: clamp(1.25rem, 2.5vw, 1.65rem); font-weight: 820; letter-spacing: -.03em; overflow-wrap: anywhere; }
.metric-detail { display: block; margin-top: .25rem; }

.feature-grid, .choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.feature-card, .choice-card { min-width: 0; display: flex; gap: 1rem; padding: 1.15rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--text); text-decoration: none; transition: transform .16s ease, border-color .16s ease, background .16s ease, box-shadow .16s ease; }
.feature-card:hover, .choice-card:hover { transform: translateY(-2px); border-color: var(--line-strong); background: var(--surface-hover); }
.feature-icon, .choice-icon { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; background: var(--brand-soft); color: var(--brand); }
.feature-icon svg, .choice-icon svg { width: 21px; height: 21px; }
.feature-copy { min-width: 0; flex: 1; }
.feature-copy strong { display: block; }
.feature-copy small { display: block; margin-top: .18rem; line-height: 1.4; }
.feature-arrow { margin-left: auto; color: var(--muted); font-size: 1.2rem; }
.choice-card { min-height: 190px; flex-direction: column; justify-content: space-between; padding: 1.4rem; }
.choice-card h2 { margin-top: .8rem; }
.choice-card p { margin-bottom: 0; }
.choice-meta { display: flex; align-items: center; justify-content: space-between; gap: .8rem; margin-top: 1rem; color: var(--brand); font-weight: 750; }

.actions { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }
.actions form { display: inline-flex; margin: 0; }
.button, button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  margin: 0;
  padding: .68rem 1rem;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--brand);
  color: var(--structure);
  font: inherit;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .15s ease;
}
.button:hover, button:hover { background: var(--brand-hover); transform: translateY(-1px); }
.button:disabled, button:disabled { opacity: .62; cursor: wait; transform: none; }
.button.secondary, button.secondary { background: var(--structure); border-color: var(--structure); color: var(--sabibot-white); }
.button.secondary:hover, button.secondary:hover { background: #30265F; border-color: #30265F; }
.button.ghost, button.ghost { background: transparent; border-color: var(--line); color: var(--muted-strong); }
.button.ghost:hover, button.ghost:hover { background: var(--structure-soft); border-color: var(--line-strong); }
.button.danger, button.danger { background: var(--danger); border-color: var(--danger); color: var(--sabibot-white); }
.button.danger:hover, button.danger:hover { background: #B91C1C; border-color: #B91C1C; }
.button.small, button.small { min-height: 36px; padding: .42rem .7rem; font-size: .84rem; }
.link { color: var(--info); font-weight: 700; text-decoration: none; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.button svg, button svg { width: 17px; height: 17px; }
details > summary.button { width: fit-content; list-style: none; }
details > summary.button::-webkit-details-marker { display: none; }
details[open] > summary.button { margin-bottom: .8rem; }

form { margin: 0; }
.form-group { margin-bottom: 1rem; }
.help-text { margin: .4rem 0 0; color: var(--muted); font-size: .85rem; }
.checkbox-label { display: flex; align-items: flex-start; gap: .45rem; }
label { display: block; margin: .95rem 0 .35rem; color: var(--muted-strong); font-size: .9rem; font-weight: 700; }
input, select, textarea {
  width: 100%;
  min-height: 46px;
  padding: 0.72rem 0.8rem;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.5;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
input::placeholder, textarea::placeholder { color: var(--sabibot-text-muted); }
input:hover:not(:disabled), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus {
  border-color: var(--brand);
  outline: none;
  box-shadow: 0 0 0 3px var(--brand-soft);
}
input:disabled, select:disabled, textarea:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  background: var(--structure-soft);
}
input[aria-invalid="true"], select[aria-invalid="true"], textarea[aria-invalid="true"] {
  border-color: var(--danger);
}
input[aria-invalid="true"]:focus, select[aria-invalid="true"]:focus, textarea[aria-invalid="true"]:focus {
  box-shadow: 0 0 0 3px var(--danger-soft);
}
textarea { min-height: 116px; resize: vertical; margin-bottom: 0.2rem; }
input[type="checkbox"], input[type="radio"] { width: 18px; min-height: 18px; margin: 0 .5rem 0 0; accent-color: var(--brand); vertical-align: middle; }
.check-row { display: flex; align-items: flex-start; gap: .15rem; font-weight: 550; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .35rem 1rem; }
.group-search { margin-bottom: .75rem; }
.reply-section.first-reply { margin-bottom: 1.5rem; }
.reply-section.additional-reply { margin-top: 3rem; padding-top: 3rem; border-top: 1px solid var(--line); }
.reply-section-heading { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; margin: 0 0 .5rem; }
.button.remove-reply-btn, button.remove-reply-btn { border-color: rgba(220, 38, 38, .35); color: var(--danger); background: var(--danger-soft); }
.button.remove-reply-btn:hover, button.remove-reply-btn:hover { border-color: var(--danger); color: var(--sabibot-white); background: var(--danger); }
.field-span { grid-column: 1 / -1; }
.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; margin-top: 1.2rem; padding-top: 1.1rem; border-top: 1px solid var(--line); }
.fieldset { margin-top: 1.2rem; padding-top: .2rem; }
.fieldset-title { margin: 1.8rem 0 .6rem; font-size: 1rem; }
.selection-list { max-height: 320px; overflow: auto; display: grid; gap: .45rem; margin-top: .7rem; padding: .5rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.selection-item { display: flex; align-items: flex-start; gap: .35rem; margin: 0; padding: .65rem; border-radius: 9px; }
.selection-item:hover { background: var(--brand-soft); }

.tabs { display: flex; gap: .3rem; margin-bottom: 1.2rem; padding: .3rem; border: 1px solid var(--line); border-radius: 12px; background: var(--structure-soft); overflow-x: auto; }
.tab { flex: 0 0 auto; padding: .58rem .8rem; border-radius: 9px; color: var(--muted); text-decoration: none; font-weight: 750; font-size: .9rem; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--brand-soft); color: #8A3900; box-shadow: inset 0 -2px 0 var(--brand); }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { min-width: 110px; padding: .8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--structure); background: var(--structure-soft); font-size: .76rem; letter-spacing: .06em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: var(--surface-hover); }
.table-actions { min-width: 255px; }
.status-actions { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }

.empty { padding: 2rem 1rem; text-align: center; border: 1px dashed var(--line-strong); border-radius: 13px; }
.empty-icon { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto .8rem; border-radius: 14px; background: var(--brand-soft); color: var(--brand); }
.empty-icon svg { width: 24px; height: 24px; }
.empty p { max-width: 460px; margin-inline: auto; }
.card > .empty { border: 0; margin: -.35rem; padding: 2.5rem 1.35rem; }

.workflow-toolbar > input[type="search"] { border-color: var(--line-strong); box-shadow: inset 0 1px 2px rgba(28, 22, 66, .06); }

.pairing { display: grid; grid-template-columns: auto 1fr; gap: 1rem; align-items: center; margin-top: 1.2rem; padding: 1rem; border: 1px solid var(--line); border-radius: 13px; background: var(--structure-soft); }
.pairing-action { align-self: center; }
input[type="color"] { border-radius: 60px; height: 38px; width: 60px; cursor: pointer; padding: .1rem; }
select { appearance: none; background: var(--surface) url('data:image/svg+xml;charset=utf-8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23FF6B00" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><polyline points="6 9 12 15 18 9"></polyline></svg>') no-repeat right 1rem center / 16px; padding-right: 2.5rem; }

/* Form Labels and Wrappers */
.floating-label {
  display: flex;
  flex-direction: column;
  margin-bottom: .7rem;
}

.floating-label > label {
  order: 1;
  margin: 0 0 0.35rem 0;
  color: var(--muted-strong);
  font-size: 0.9rem;
  font-weight: 700;
  pointer-events: auto;
}

.floating-label > .hint,
.floating-label > .help-text {
  order: 2;
  margin: -.1rem 0 .45rem;
}

.floating-label > input,
.floating-label > textarea,
.floating-label > select {
  order: 3;
  padding: 0.72rem 0.8rem;
}

.floating-label > .char-counter,
.floating-label > [role="alert"] {
  order: 4;
}

/* Remove absolute positioning logic */

.hint { margin-top: .4rem; font-size: .85rem; color: var(--muted); }
.pair-step { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand); font-weight: 850; }
.pair { margin-top: .55rem; color: var(--brand); font: 800 clamp(1.5rem, 4vw, 2rem)/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .15rem; overflow-wrap: anywhere; }

.progress { height: 7px; margin-top: .65rem; overflow: hidden; border-radius: 999px; background: var(--structure-soft); }
.progress > span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand-strong), var(--brand)); }
progress { width: 100%; height: 7px; margin-top: .65rem; border: 0; border-radius: 999px; overflow: hidden; background: var(--structure-soft); }
progress::-webkit-progress-bar { background: var(--structure-soft); }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--brand-strong), var(--brand)); }
progress::-moz-progress-bar { background: linear-gradient(90deg, var(--brand-strong), var(--brand)); }

.rule-list { display: grid; gap: .7rem; }
.rule-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.rule-meta { display: flex; flex-wrap: wrap; gap: .45rem 1rem; margin-top: .35rem; color: var(--muted); font-size: .84rem; }
.rule-actions { display: flex; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; gap: .4rem; }

.flow-tree { display: grid; gap: .65rem; margin: 1rem 0; }
.flow-editor { margin-top: .5rem; }
.flow-form-spacer { width: 100%; height: 3rem; }
.flow-form-spacer.large { height: 5rem; }
.flow-step { position: relative; padding: .8rem 1rem .8rem 2.4rem; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); }
.flow-step::before { content: ""; position: absolute; left: 1rem; top: 1.1rem; width: 9px; height: 9px; border-radius: 50%; background: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.flow-step.child { margin-left: 1.5rem; }
.flow-step small { display: block; margin-top: .18rem; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: .8rem; }
.media-card { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); display: flex; flex-direction: column; }
.media-preview { height: 120px; display: grid; place-items: center; background: var(--structure-soft); color: var(--structure); position: relative; cursor: zoom-in; flex: 0 0 auto; overflow: hidden; }
.media-preview img, .media-preview video { width: 100%; height: 100%; object-fit: cover; border-radius: 12px 12px 0 0; color: transparent; /* hides alt text when image breaks */ }
.media-preview svg { width: 34px; height: 34px; }
.media-loading, .broken-fallback { position: absolute; inset: 0; width: 100%; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem; color: var(--muted); text-align: center; background: var(--structure-soft); }
.media-loading[hidden], .broken-fallback[hidden] { display: none; }
.loading-spinner { width: 24px; height: 24px; border: 3px solid var(--line-strong); border-top-color: var(--brand); border-radius: 50%; animation: media-spin .8s linear infinite; }
@keyframes media-spin { to { transform: rotate(360deg); } }
.media-retry { min-height: 34px; background: var(--surface); }
.broken-fallback[hidden] { display: none; }
.play-indicator { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 40px; height: 40px; background: rgba(0,0,0,0.6); border-radius: 50%; display: grid; place-items: center; pointer-events: none; }
.play-indicator svg { width: 20px; height: 20px; color: white; margin-left: 2px; }
.media-info { padding: .85rem; min-width: 0; flex: 1 1 auto; }
.media-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 750; display: block; }
.media-meta { margin-top: .2rem; color: var(--muted); font-size: .8rem; }
.upload-progress { display: grid; gap: .35rem; margin-top: .8rem; }
.upload-progress progress[hidden] { display: none; }
.upload-progress small { min-height: 1.35rem; }

.auth-shell { min-height: calc(100vh - 70px); display: grid; grid-template-columns: minmax(0, .9fr) minmax(420px, 1.1fr); max-width: 1100px; margin: auto; padding: 3rem 1.25rem; gap: 4rem; align-items: center; }
.auth-story { max-width: 480px; }
.auth-story h1, .auth-story h2 { font-size: clamp(2.4rem, 5vw, 4.2rem); }
.auth-points { display: grid; gap: .8rem; margin-top: 1.5rem; }
.auth-point { display: flex; align-items: center; gap: .7rem; color: var(--muted-strong); }
.auth-point span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--brand-soft); color: var(--brand); }
.auth-card { padding: clamp(1.4rem, 4vw, 2rem); }
.auth-card .button, .auth-card button { margin-top: 1rem; }
.auth-footer { margin-top: 1.2rem; }

.legal { max-width: 760px; }
.legal p { line-height: 1.75; }
.error-page { min-height: calc(100vh - 170px); display: grid; place-items: center; text-align: center; }
.error-code { color: var(--brand); font-size: clamp(4rem, 16vw, 8rem); font-weight: 900; line-height: 1; letter-spacing: -.08em; opacity: .8; }
.error-page .page-subtitle { margin-inline: auto; }
.support-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: .8rem; }
.conversation-layout { display: grid; grid-template-columns: minmax(240px, .72fr) minmax(0, 1.28fr); gap: 1rem; align-items: start; }
.conversation-list { display: grid; gap: .65rem; }
.conversation-list .rule-card { color: inherit; text-decoration: none; }
.conversation-list .rule-card:hover { border-color: var(--brand); background: var(--brand-soft); }
.conversation-thread { display: grid; gap: .65rem; margin-bottom: 1rem; }
.danger-zone { border-color: rgba(220, 38, 38, .28); }
.support-card { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.support-card svg { width: 24px; height: 24px; color: var(--brand); }
.operator-alert-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .8rem; }
.search-form { display: flex; align-items: end; gap: .6rem; }
.search-form > div { flex: 1; }
.detail-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: .8rem; }
.detail-item { padding: 1rem; border: 1px solid var(--line); border-radius: 11px; background: var(--surface); display: flex; flex-direction: column; gap: .3rem; }
.detail-item small { display: block; margin-top: .15rem; }
.detail-item strong { display: block; margin-top: .1rem; overflow-wrap: anywhere; }
.detail-item .status { margin-top: .35rem; }
.sr-only { position: absolute!important; width: 1px!important; height: 1px!important; padding: 0!important; margin: -1px!important; overflow: hidden!important; clip: rect(0,0,0,0)!important; white-space: nowrap!important; border: 0!important; }
.landing-hero { min-height: 520px; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(340px, .85fr); gap: 3rem; align-items: center; }
.landing-copy h1 { max-width: 760px; font-size: clamp(2.7rem, 7vw, 5.5rem); }
.landing-copy .page-subtitle { font-size: 1.12rem; }
.powered-by { display: inline-flex; margin-bottom: 1rem; padding: .35rem .7rem; border: 1px solid rgba(255, 107, 0, .28); border-radius: 999px; background: var(--brand-soft); color: #8A3900; font-size: .82rem; font-weight: 800; }
.landing-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1.4rem; }
.landing-visual { padding: 1rem; border: 1px solid rgba(255, 255, 255, .14); border-radius: var(--radius-lg); background: linear-gradient(145deg, #2B225D, var(--structure)); color: var(--sabibot-white); box-shadow: var(--shadow); }
.landing-feature { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem; border-bottom: 1px solid var(--line); }
.landing-feature:last-child { border-bottom: 0; }
.landing-feature > span:first-child { display: flex; align-items: center; gap: .8rem; color: var(--sabibot-white); font-weight: 750; }
.landing-feature svg { width: 20px; height: 20px; color: var(--brand); }
.landing-section .section-header > div { max-width: 760px; }
.trust-section { padding: clamp(1.2rem, 3vw, 2rem); border-radius: var(--radius-lg); background: var(--structure-soft); }
.trust-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .85rem; }
.trust-card { padding: 1.2rem; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.trust-card > svg { width: 26px; height: 26px; margin-bottom: .8rem; color: var(--brand); }
.trust-card p { margin-bottom: 0; }
.getting-started { border-top: 4px solid var(--brand); }
.landing-cta { padding: clamp(1.5rem, 4vw, 3rem); border-radius: var(--radius-lg); background: var(--structure); color: var(--sabibot-white); text-align: center; }
.landing-cta h2 { max-width: 720px; margin-inline: auto; color: var(--sabibot-white); font-size: clamp(1.8rem, 4vw, 3rem); }
.landing-cta p:not(.eyebrow) { max-width: 720px; margin-inline: auto; color: rgba(255, 255, 255, .76); }
.landing-cta .landing-actions { justify-content: center; }
.landing-cta .button.ghost { border-color: rgba(255, 255, 255, .35); color: var(--sabibot-white); }
.landing-cta .button.ghost:hover { background: rgba(255, 255, 255, .1); }
.site-footer { display: flex; align-items: flex-start; justify-content: space-between; gap: 2rem; margin-top: 3rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.site-footer p { max-width: 640px; margin-bottom: 0; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 1rem; }
.site-footer a { color: var(--info); font-weight: 750; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; text-underline-offset: 3px; }
.command-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .8rem; }
.command-card { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.command-example { display: block; margin-top: .65rem; padding: .55rem .7rem; border-radius: 8px; background: var(--structure); color: var(--sabibot-white); overflow-x: auto; }
.moderation-selector { background: linear-gradient(145deg, var(--brand-soft), var(--surface)); }
.permission-strip { display: flex; flex-wrap: wrap; align-items: center; gap: .55rem; margin-top: 1rem; padding-top: .9rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .86rem; }
.scope-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin: .8rem 0 1rem; }
.scope-option { display: flex; align-items: flex-start; gap: .75rem; margin: 0; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); cursor: pointer; }
.scope-option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.scope-option input { width: auto; margin-top: .18rem; accent-color: var(--brand); }
.scope-option strong, .scope-option small { display: block; }
.scope-option small { margin-top: .15rem; }
.moderation-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.policy-panel { margin: 0; padding: 1.2rem; transition: background 0.2s; border-radius: var(--radius); border: 1px solid var(--line); }
.policy-panel[open] { background: var(--brand-soft); border-color: var(--brand); }
details.policy-panel > summary { cursor: pointer; list-style: none; outline-offset: 4px; border-radius: 8px; }
details.policy-panel > summary::-webkit-details-marker { display: none; }
.policy-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
details.policy-panel[open] .policy-heading { margin-bottom: 1.2rem; padding-bottom: 1.2rem; border-bottom: 1px solid rgba(255, 107, 0, .2); }
.policy-heading-content { display: flex; align-items: flex-start; gap: 1rem; flex: 1; min-width: 0; }
.policy-heading-content > svg { width: 25px; height: 25px; flex: 0 0 auto; color: var(--brand); margin-top: 0.1rem; }
.policy-heading h2 { margin: 0; font-size: 1.15rem; line-height: 1.3; }
.policy-heading p { margin: 0.35rem 0 0; color: var(--muted); font-size: 0.9rem; line-height: 1.5; }
.policy-heading .chevron { width: 22px; height: 22px; color: var(--muted); transition: transform 0.2s ease; flex: 0 0 auto; margin-top: 0.2rem; }
details.policy-panel[open] .policy-heading .chevron { transform: rotate(180deg); color: var(--brand); }
.check-grid { display: flex; flex-wrap: wrap; gap: .35rem 1rem; margin-top: .45rem; }
.check-grid .check-row { margin: 0; }
.days-grid { justify-content: space-between; }
.sticky-save { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin: 1rem 0; padding: .8rem 1rem; border: 1px solid var(--line-strong); border-radius: 13px; background: var(--surface); box-shadow: var(--shadow); }
.sticky-save strong, .sticky-save small { display: block; }
.sticky-save small { margin-top: .1rem; }
.command-fallback summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; cursor: pointer; }
.command-fallback summary span { color: var(--brand); font-size: .85rem; }
.command-fallback[open] summary { margin-bottom: 1rem; }
.responsive-table td small { display: block; margin-top: .15rem; }
.analytics-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.analytics-grid > .card { margin: 0; }
.analytics-metrics { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 1rem; }
.chart-row { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) 2.5rem; align-items: center; gap: .65rem; margin: .65rem 0; font-size: .82rem; color: var(--muted); }
.chart-row strong { text-align: right; }
.chart-track { width: 100%; height: 10px; margin: 0; overflow: hidden; border-radius: 999px; background: var(--structure-soft); }
.chart-track::-webkit-progress-bar { background: var(--structure-soft); }
.chart-track::-webkit-progress-value { background: linear-gradient(90deg, var(--brand), var(--brand-strong)); }
.chart-track::-moz-progress-bar { background: linear-gradient(90deg, var(--brand), var(--brand-strong)); }
.case-list { display: grid; gap: .8rem; }
.case-card { padding: 1rem; border: 1px solid var(--line); border-radius: 13px; background: var(--surface); }
.case-card details { margin-top: .7rem; }
.case-card details[open] summary { margin-bottom: 1rem; }
.detail-grid.compact { margin-top: 1rem; }

@media (max-width: 900px) {
  .analytics-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .app-frame.with-sidebar { grid-template-columns: 1fr; gap: 1rem; }
  .sidebar { display: none; }
  .mobile-menu { display: block; margin-bottom: 1rem; }
  .mobile-menu summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; padding: .65rem .8rem; border: 1px solid var(--structure); border-radius: 11px; background: var(--structure); color: var(--sabibot-white); cursor: pointer; font-weight: 750; list-style: none; }
  .mobile-menu summary::-webkit-details-marker { display: none; }
  .mobile-menu .side-nav { margin-top: .5rem; padding: .5rem; border: 1px solid var(--structure); border-radius: 12px; background: var(--structure); }
  .auth-shell { grid-template-columns: 1fr; max-width: 620px; gap: 2rem; }
  .landing-hero { min-height: auto; grid-template-columns: 1fr; }
  .trust-grid { grid-template-columns: 1fr; }
  .auth-story { text-align: center; margin-inline: auto; }
  .auth-points { display: none; }
}

.inline-media-upload-wrapper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.inline-media-upload-wrapper select {
  flex: 1;
}
.inline-media-upload-wrapper .inline-upload-btn {
  margin: 0;
  padding: 0.4rem 0.6rem;
  display: flex;
  align-items: center;
  justify-content: center;
}
.inline-media-upload-wrapper .inline-upload-status {
  width: 100%;
  color: var(--brand);
}

.flow-children {
  position: relative;
}
.flow-children .flow-children {
  padding-left: 20px;
}
.flow-node {
  position: relative;
  padding: 8px 0 8px 24px;
}
.flow-node::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  border-left: 2px solid var(--line-strong);
}
.flow-node::after {
  content: '';
  position: absolute;
  top: 24px;
  left: 0;
  width: 24px;
  border-bottom: 2px solid var(--line-strong);
}
.flow-node:last-child::before {
  bottom: auto;
  height: 24px;
}


/* Confirm Modal Styles */
.confirm-modal {
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
  max-width: 400px;
  width: 90%;
  margin: auto;
}
.confirm-modal::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(3px);
}
.confirm-modal-content {
  padding: 1.5rem;
}
.confirm-modal-content h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
}
.confirm-modal-content p {
  margin: 0 0 1.5rem 0;
  color: var(--muted);
}
.confirm-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Character Counter */
.char-counter {
  font-size: 0.75rem;
  color: var(--muted);
  text-align: right;
  margin-top: 0.35rem;
}
.char-counter.char-limit-reached {
  color: var(--danger);
}

@media (max-width: 700px) {
  .analytics-metrics { grid-template-columns: 1fr; }
  .app-frame { padding: 1.4rem 1rem 3rem; }
  .topbar-inner { min-height: 62px; padding-inline: 1rem; }
  .top-actions { gap: .35rem; }
  .brand-copy strong { max-width: 48vw; }
  .public-site .brand-copy small { display: none; }
  .top-actions .button, .top-actions button { min-height: 40px; padding: .45rem .65rem; font-size: .82rem; }
  .desktop-only { display: none; }
  .page-header, .section-header, .card-header { align-items: flex-start; flex-direction: column; }
  .page-header .button { width: 100%; }
  .metrics, .feature-grid, .choice-grid, .form-grid, .command-grid, .support-grid, .operator-alert-grid, .detail-grid, .moderation-grid, .scope-options, .analytics-grid { grid-template-columns: 1fr; }
  .conversation-layout { grid-template-columns: 1fr; }
  .operator-alert-grid, .detail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-card { padding: .85rem; }
  .bot-heading { align-items: flex-start; }
  .bot-title { align-items: flex-start; }
  .feature-card { min-height: 94px; }
  .choice-card { min-height: 170px; }
  .rule-card { grid-template-columns: 1fr; }
  .rule-actions { justify-content: flex-start; }
  .form-actions .button, .form-actions button { flex: 1 1 auto; }
  .pairing { grid-template-columns: 1fr; }
  .auth-shell { min-height: auto; padding: 2rem 1rem; }
  .auth-story h1, .auth-story h2 { font-size: 2.35rem; }
  .landing-copy h1 { font-size: 2.7rem; }
  .landing-actions .button { flex: 1 1 auto; }
  .site-footer { flex-direction: column; }
  .search-form { align-items: stretch; flex-direction: column; }
  .search-form .button, .search-form button { width: 100%; }
  .sticky-save { position: static; align-items: stretch; flex-direction: column; }
  .sticky-save button { width: 100%; }
  table.responsive-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.responsive-table, table.responsive-table tbody, table.responsive-table tr, table.responsive-table td { display: block; width: 100%; }
  table.responsive-table tr { padding: .65rem; border-bottom: 1px solid var(--line); }
  table.responsive-table tr:last-child { border-bottom: 0; }
  table.responsive-table td { min-width: 0; display: grid; grid-template-columns: minmax(105px,.45fr) minmax(0,1fr); gap: .7rem; padding: .55rem; border: 0; }
  table.responsive-table td::before { content: attr(data-label); color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
  table.responsive-table .table-actions { min-width: 0; }
}

.lightbox-modal { max-width: 100vw; max-height: 100vh; width: 100%; height: 100%; padding: 0; margin: auto; border: none; background: transparent; backdrop-filter: blur(8px); }
.lightbox-modal::backdrop { background: rgba(0,0,0,0.85); backdrop-filter: blur(8px); }
.lightbox-form { position: absolute; top: 1rem; right: 1rem; z-index: 10; }
.lightbox-close { background: rgba(255,255,255,0.1); border: none; color: white; width: 44px; height: 44px; border-radius: 50%; font-size: 2rem; cursor: pointer; display: grid; place-items: center; line-height: 1; transition: background 0.2s; }
.lightbox-close:hover { background: rgba(255,255,255,0.25); }
.lightbox-content { width: 100%; height: 100%; display: grid; place-items: center; padding: 2rem; }
.lightbox-content img, .lightbox-content video { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 8px; box-shadow: 0 10px 40px rgba(0,0,0,0.5); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Floating Labels logic removed to restore document flow */

/* Searchable select dropdown */
.searchable-select-wrapper {
  position: relative;
  width: 100%;
}
.floating-label > .searchable-select-wrapper { order: 3; }
.searchable-select-list {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--surface);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  margin: 0;
  padding: 0;
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: var(--shadow);
}
.searchable-select-list.show {
  display: block;
}
.searchable-select-list.open-upward {
  top: auto;
  bottom: calc(100% + 4px);
}
.searchable-select-list li {
  padding: 0.85rem 1rem;
  cursor: pointer;
  color: var(--text);
  border-bottom: 1px solid var(--line);
  font-size: 0.9rem;
  display: flex;
  flex-direction: column;
}
.searchable-select-list li strong {
  display: block;
}
.searchable-select-list li small {
  color: var(--muted);
  display: block;
  margin-top: 0.2rem;
}
.searchable-select-list li:last-child {
  border-bottom: none;
}
.searchable-select-list li:hover {
  background: var(--surface-hover);
}
.searchable-select-list li[aria-selected="true"] {
  background: var(--brand-soft);
  color: #8A3900;
}
.searchable-select-list li[hidden] {
  display: none;
}

/* Interaction and workflow primitives */
[hidden] { display: none !important; }

.tab-panel { scroll-margin-top: 100px; }
.tab-panel.active { animation: panel-in .16s ease-out; }
@keyframes panel-in { from { opacity: .35; transform: translateY(4px); } }

.workflow-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: .75rem;
  margin: 1.25rem 0 1rem;
}
.workflow-toolbar > input[type="search"] { width: min(100%, 360px); }
.toolbar-meta { display: flex; align-items: center; flex-wrap: wrap; gap: .55rem; }

.disclosure-panel { padding: 0; overflow: clip; }
.disclosure-panel > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 72px;
  padding: 1.2rem 1.35rem;
  cursor: pointer;
  list-style: none;
}
.disclosure-panel > summary::-webkit-details-marker { display: none; }
.disclosure-panel > summary > span { display: grid; gap: .2rem; }
.disclosure-panel > summary .eyebrow { margin: 0; }
.disclosure-panel > summary::after {
  content: "+";
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--brand-soft);
  color: var(--brand);
  font-size: 1.25rem;
  font-weight: 800;
}
.disclosure-panel[open] > summary { border-bottom: 1px solid var(--line); }
.disclosure-panel[open] > summary::after { content: "\2212"; }
.disclosure-content { padding: 0 1.35rem 1.35rem; }
.disclosure-content > :first-child { margin-top: 1.2rem; }

.password-field { position: relative; }
.password-field input { padding-right: 4.6rem; }
.password-toggle {
  position: absolute;
  right: .45rem;
  top: 50%;
  transform: translateY(-50%);
  min-height: 34px;
  padding: .3rem .65rem;
  background: transparent;
  border-color: transparent;
  color: var(--info);
  font-size: .8rem;
}
.password-toggle:hover { transform: translateY(-50%); background: var(--structure-soft); }
.password-strength { margin-top: .4rem; color: var(--muted); font-size: .8rem; }
.password-strength::before {
  content: "";
  display: inline-block;
  width: 70px;
  height: 5px;
  margin-right: .5rem;
  border-radius: 999px;
  background: var(--line-strong);
  vertical-align: middle;
}
.password-strength[data-score="1"]::before { background: linear-gradient(90deg, var(--danger) 25%, var(--line-strong) 25%); }
.password-strength[data-score="2"]::before { background: linear-gradient(90deg, var(--warning) 50%, var(--line-strong) 50%); }
.password-strength[data-score="3"]::before { background: linear-gradient(90deg, var(--info) 75%, var(--line-strong) 75%); }
.password-strength[data-score="4"]::before { background: var(--success); }

.sticky-save {
  position: static;
  z-index: 8;
  transition: border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}
.sticky-save.is-dirty {
  position: sticky;
  bottom: .75rem;
  border-color: var(--brand);
  box-shadow: 0 12px 30px rgba(28, 22, 66, .16);
}
.sticky-save:not(.is-dirty) [data-save-state] { color: var(--success); }

.selection-copy { min-width: 0; display: grid; gap: .1rem; }
.selection-copy strong, .selection-copy small { display: block; }
.selection-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selection-item:has(input:checked) { background: var(--brand-soft); outline: 1px solid rgba(255, 107, 0, .3); }

.stepper { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); margin: 0 0 1.2rem; padding: 0; list-style: none; }
.stepper li {
  position: relative;
  display: grid;
  justify-items: center;
  gap: .35rem;
  color: var(--muted);
  font-size: .78rem;
  font-weight: 750;
  text-align: center;
}
.stepper li::before {
  content: attr(data-step);
  position: relative;
  z-index: 1;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 2px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
}
.stepper li::after {
  content: "";
  position: absolute;
  top: 14px;
  left: 50%;
  width: 100%;
  border-top: 2px solid var(--line);
}
.stepper li:last-child::after { display: none; }
.stepper li.active { color: var(--brand); }
.stepper li.active::before { border-color: var(--brand); background: var(--brand-soft); }

.composer-layout { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(220px, .6fr); gap: 1rem; align-items: start; }
.message-preview {
  position: sticky;
  top: 94px;
  min-height: 150px;
  padding: 1rem;
  border-radius: 14px;
  background: var(--structure-soft);
}
.message-preview .preview-label { display: block; margin-bottom: .75rem; color: var(--muted); font-size: .75rem; font-weight: 800; text-transform: uppercase; }
.message-bubble {
  width: fit-content;
  max-width: min(82%, 540px);
  margin: .6rem 0;
  padding: .75rem .9rem;
  border: 1px solid var(--line);
  border-radius: 14px 14px 14px 4px;
  background: var(--surface);
}
.message-bubble.outgoing { margin-left: auto; border-radius: 14px 14px 4px 14px; background: var(--brand-soft); border-color: rgba(255, 107, 0, .25); }
.message-bubble p { color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.message-bubble small { display: block; margin-top: .35rem; }
.message-bubble.is-placeholder { color: var(--muted); font-style: italic; }

.upload-dropzone {
  position: relative;
  display: grid;
  justify-items: center;
  gap: .55rem;
  padding: 1.6rem;
  border: 2px dashed var(--line-strong);
  border-radius: 14px;
  background: var(--structure-soft);
  text-align: center;
  transition: border-color .15s ease, background .15s ease;
}
.upload-dropzone:hover, .upload-dropzone.is-dragging, .upload-dropzone.has-file { border-color: var(--brand); background: var(--brand-soft); }
.upload-dropzone svg { width: 32px; height: 32px; color: var(--brand); }
.upload-dropzone label { margin: 0; color: var(--text); }
.upload-dropzone input[type="file"] {
  position: absolute;
  z-index: 2;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

.action-menu { position: relative; }
.action-menu > summary { list-style: none; }
.action-menu > summary::-webkit-details-marker { display: none; }
.action-menu[open] > .action-menu-panel {
  position: absolute;
  top: calc(100% + .5rem);
  right: 0;
  z-index: 12;
  min-width: 220px;
  display: grid;
  gap: .5rem;
  padding: .7rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.danger-zone { border-color: rgba(220, 38, 38, .3); background: var(--danger-soft); }
.danger-zone h2 { color: var(--danger); }
.safety-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .8rem; }
.support-grid.two-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.detail-grid.three-column { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.conversation-toolbar { margin-bottom: .75rem; }
.conversation-list .rule-card { color: inherit; text-decoration: none; }
.conversation-list .rule-card.active { border-color: var(--brand); background: var(--brand-soft); }
.conversation-actions { display: flex; align-items: center; flex-wrap: wrap; gap: .65rem; margin-top: 1rem; }
.mobile-thread-back { display: none; margin-bottom: .75rem; color: var(--info); font-weight: 750; text-decoration: none; }

.policy-summary {
  display: inline-flex;
  margin-top: .55rem;
  padding: .2rem .5rem;
  border-radius: 999px;
  background: var(--structure-soft);
  color: var(--muted);
  font-size: .75rem;
  font-weight: 750;
}
.policy-panel[open] .policy-summary { background: var(--surface); color: var(--brand); }

.legal-sections { display: grid; gap: 1.4rem; margin-top: 1.4rem; }
.legal-sections section { padding-top: 1.2rem; border-top: 1px solid var(--line); }
.legal-sections h2 { font-size: 1.15rem; }

@media (max-width: 900px) {
  .mobile-menu {
    position: sticky;
    top: 74px;
    z-index: 15;
  }
  .mobile-menu[open] .side-nav {
    max-height: calc(100vh - 145px);
    overflow-y: auto;
    box-shadow: var(--shadow);
  }
  .mobile-menu summary > svg { width: 20px; height: 20px; flex: 0 0 auto; }
}

@media (max-width: 700px) {
  .breadcrumb span:not(:last-child), .breadcrumb > span { display: none; }
  .breadcrumb strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .composer-layout, .safety-summary, .support-grid.two-column, .detail-grid.three-column { grid-template-columns: 1fr; }
  .message-preview { position: static; }
  .stepper li span { display: none; }
  .workflow-toolbar > input[type="search"] { width: 100%; }
  .conversation-layout.has-selection .conversation-list { display: none; }
  .conversation-layout.has-selection .mobile-thread-back { display: inline-flex; }
  .conversation-actions > form, .conversation-actions > form button { width: 100%; }
  .disclosure-panel > summary { min-height: 64px; padding: 1rem; }
  .disclosure-content { padding: 0 1rem 1rem; }
  .action-menu[open] > .action-menu-panel { position: fixed; left: 1rem; right: 1rem; top: 74px; }
}

.offending-message-box { margin-bottom: 1rem; padding: .8rem; border-left: 4px solid var(--danger); border-radius: var(--radius-sm); background: var(--structure-soft); }
.offending-message-box blockquote { margin: .35rem 0 0; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85rem; overflow-wrap: anywhere; white-space: pre-wrap; }

/* Guided onboarding, truthful status and global account controls. */
.landing-assurance { display: flex; flex-wrap: wrap; align-items: center; gap: .75rem 1.25rem; margin-top: 1.25rem; }
.landing-assurance > span { display: inline-flex; align-items: center; gap: .45rem; color: var(--muted); font-size: .86rem; font-weight: 700; }
.landing-assurance svg { width: 18px; height: 18px; color: var(--brand); }
.service-status { padding: .3rem .65rem; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.service-status.available { border-color: rgba(34, 197, 94, .35); background: var(--success-soft); color: var(--success); }
.service-status.unavailable { border-color: rgba(220, 38, 38, .35); background: var(--danger-soft); color: var(--danger); }

.product-tour { scroll-margin-top: 90px; }
.tour-layout { display: grid; grid-template-columns: minmax(220px, .8fr) minmax(0, 1.5fr); gap: 1rem; }
.tour-steps { display: grid; gap: .55rem; align-content: start; }
.tour-step { width: 100%; min-height: 72px; display: grid; grid-template-columns: 34px minmax(0, 1fr); grid-template-rows: auto auto; column-gap: .7rem; align-items: center; padding: .75rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--text); text-align: left; box-shadow: none; }
.tour-step > span { grid-row: 1 / 3; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--structure-soft); color: var(--structure); font-weight: 850; }
.tour-step strong { align-self: end; }
.tour-step small { align-self: start; }
.tour-step.active { border-color: var(--brand); background: var(--brand-soft); }
.tour-step.active > span { background: var(--brand); color: var(--structure); }
.tour-preview { min-height: 320px; padding: clamp(1.25rem, 3vw, 2rem); border: 1px solid var(--line); border-radius: var(--radius-sm); background: linear-gradient(145deg, var(--surface), var(--structure-soft)); }
.tour-preview article { display: grid; align-content: center; min-height: 250px; }
.tour-preview h3 { font-size: clamp(1.35rem, 2vw, 1.8rem); }
.tour-callout { display: flex; align-items: center; gap: .8rem; margin-top: 1.25rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.tour-callout svg { width: 26px; height: 26px; flex: 0 0 auto; color: var(--brand); }
.tour-callout span { display: grid; }

.account-menu { position: relative; }
.account-menu > summary { list-style: none; display: inline-flex; align-items: center; gap: .45rem; }
.account-menu > summary::-webkit-details-marker { display: none; }
.account-menu > summary svg { width: 18px; height: 18px; }
.account-menu-panel { position: absolute; top: calc(100% + .6rem); right: 0; z-index: 30; width: min(290px, calc(100vw - 2rem)); padding: .6rem; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); box-shadow: var(--shadow); }
.account-menu-panel > a, .account-signout { width: 100%; min-height: 44px; display: flex; align-items: center; gap: .65rem; padding: .7rem .75rem; border: 0; border-radius: 9px; background: transparent; color: var(--text); text-decoration: none; text-align: left; font-weight: 700; box-shadow: none; }
.account-menu-panel > a:hover, .account-signout:hover { background: var(--structure-soft); }
.account-menu-panel svg { width: 18px; height: 18px; color: var(--brand); }
.account-menu-identity { display: grid; padding: .65rem .75rem .8rem; margin-bottom: .35rem; border-bottom: 1px solid var(--line); }
.account-menu-identity small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.signup-progress { display: grid; grid-template-columns: repeat(3, 1fr); gap: .5rem; padding: 0; margin: 0 0 1.5rem; list-style: none; }
.signup-progress li { position: relative; display: grid; justify-items: center; gap: .35rem; color: var(--muted); text-align: center; font-size: .72rem; }
.signup-progress li:not(:last-child)::after { content: ""; position: absolute; top: 14px; left: calc(50% + 20px); right: calc(-50% + 20px); height: 2px; background: var(--line); }
.signup-progress span { position: relative; z-index: 1; width: 30px; height: 30px; display: grid; place-items: center; border: 2px solid var(--line); border-radius: 50%; background: var(--surface); font-weight: 850; }
.signup-progress .current, .signup-progress .complete { color: var(--text); }
.signup-progress .current span { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-hover); }
.signup-progress .complete span { border-color: var(--success); background: var(--success-soft); color: var(--success); }
.email-suggestion { margin: -.2rem 0 .8rem; padding: .65rem .75rem; border-radius: 9px; background: var(--warning-soft); color: var(--text); font-size: .86rem; }
.email-suggestion button { min-height: auto; padding: 0; border: 0; background: none; color: var(--info); box-shadow: none; text-decoration: underline; }
.auth-result-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; margin-top: 1rem; }
.auth-result-actions .link { width: 100%; }

.status-overview { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin: 1rem 0; }
.status-overview article { min-width: 0; display: grid; align-content: start; gap: .5rem; padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.status-overview article > span:first-child { color: var(--muted); font-size: .82rem; }
.status-overview .status { justify-self: start; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 1rem; align-items: stretch; margin: 1rem 0; }
.overview-metrics { min-width: 0; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0; }
.quick-actions, .onboarding-card { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.quick-actions { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(210px, .65fr) minmax(0, 2fr); gap: 1rem; align-items: center; margin-block: .5rem; }
.quick-actions .form-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: .6rem; margin: 0; padding: 0; border: 0; }
.quick-actions .form-actions > * { width: 100%; }
.onboarding-card ol { display: grid; gap: .6rem; padding: 0; margin: .8rem 0 0; list-style: none; }
.onboarding-card li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: .55rem; align-items: center; }
.onboarding-card li > span { width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 50%; color: var(--muted); }
.onboarding-card li.complete > span { border-color: rgba(34, 197, 94, .4); background: var(--success-soft); color: var(--success); }
.onboarding-card a { text-decoration: none; font-weight: 700; }
.dashboard-controls { display: grid; gap: .75rem; margin-top: 1.25rem; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.bot-control-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--structure-soft); }
.bot-control-panel > summary { display: flex; align-items: center; justify-content: space-between; gap: 1rem; min-height: 58px; padding: .8rem 1rem; cursor: pointer; list-style: none; }
.bot-control-panel > summary::-webkit-details-marker { display: none; }
.bot-control-panel > summary > span { display: inline-flex; align-items: center; gap: .6rem; }
.bot-control-panel > summary svg { width: 19px; height: 19px; color: var(--brand); }
.bot-control-panel > summary::after { content: "+"; display: grid; place-items: center; width: 28px; height: 28px; margin-left: auto; border-radius: 50%; color: var(--brand); background: var(--brand-soft); font-weight: 850; }
.bot-control-panel[open] > summary::after { content: "−"; }
.bot-control-content { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; align-items: center; padding: 1rem; border-top: 1px solid var(--line); background: var(--surface); }
.bot-control-content p { margin-bottom: 0; }
.activity-section { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.activity-timeline { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .7rem 1rem; padding: 0; margin: 0; list-style: none; }
.activity-timeline li { display: grid; grid-template-columns: 14px minmax(0, 1fr); gap: .55rem; }
.activity-timeline li > div { display: grid; }
.activity-marker { width: 10px; height: 10px; margin-top: .4rem; border: 2px solid var(--brand); border-radius: 50%; background: var(--brand-soft); }

.notification-centre { scroll-margin-top: 90px; }
.notification-item { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; gap: .8rem; align-items: start; padding: .85rem 0; border-top: 1px solid var(--line); }
.notification-item.is-read { opacity: .68; }
.notification-icon { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 10px; background: var(--structure-soft); color: var(--brand); }
.notification-icon svg { width: 20px; height: 20px; }
.notification-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .45rem; }
.empty.compact { min-height: 120px; padding: 1rem; }
.metrics.four-column { grid-template-columns: repeat(4, minmax(0, 1fr)); }

@media (max-width: 1050px) {
  .status-overview { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
  .quick-actions { grid-column: auto; }
  .metrics.four-column { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .tour-layout, .status-overview, .metrics.four-column { grid-template-columns: 1fr; }
  .overview-metrics { grid-template-columns: 1fr; }
  .tour-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tour-step { min-height: 86px; }
  .tour-preview { min-height: 0; }
  .tour-preview article { min-height: 0; }
  .account-menu > summary span:first-of-type { display: none; }
  .quick-actions { grid-template-columns: 1fr; align-items: stretch; }
  .quick-actions .form-actions { grid-template-columns: 1fr; }
  .quick-actions .form-actions, .quick-actions .form-actions > *, .bot-control-content form, .bot-control-content button { width: 100%; }
  .bot-control-content { grid-template-columns: 1fr; }
  .activity-timeline { grid-template-columns: 1fr; }
  .notification-item { grid-template-columns: 38px minmax(0, 1fr); }
  .notification-actions { grid-column: 2; justify-content: flex-start; }
}

@media (max-width: 430px) {
  .tour-steps { grid-template-columns: 1fr; }
  .signup-progress strong { font-size: .66rem; }
}

/* Guided policy, rule and conversation builders */
.preset-wizard { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin: 1rem 0 1.25rem; }
.preset-card { min-height: 132px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: .45rem; padding: 1rem; color: var(--text); text-align: left; background: var(--surface); border: 1px solid var(--line); box-shadow: none; }
.preset-card:hover { border-color: var(--brand); background: var(--brand-soft); }
.preset-card.selected { border: 2px solid var(--brand); background: var(--brand-soft); }
.preset-card, .preset-card small { white-space: normal; }
.preset-card { min-width: 0; }
.preset-card small { max-width: 100%; color: var(--text-secondary); font-weight: 500; line-height: 1.45; overflow-wrap: anywhere; }
.policy-save-preview, .flow-validation { margin-top: 1rem; padding: 1rem; border: 1px solid color-mix(in srgb, var(--brand) 35%, var(--line)); border-radius: 12px; background: var(--brand-soft); }
.policy-save-preview p, .flow-validation p { margin: .35rem 0 0; }
.policy-test-card { border-left: 4px solid var(--info); }
.inline-test { display: flex; gap: .65rem; align-items: stretch; }
.inline-test input { min-width: 0; flex: 1; }
.rule-test-result { margin-top: .75rem; padding: .75rem 1rem; border-radius: 10px; background: var(--structure-soft); color: var(--text-secondary); }
.rule-test-result.success { background: color-mix(in srgb, var(--success) 11%, var(--surface)); color: #126b35; }
.rule-test-result.warning { background: color-mix(in srgb, var(--warning) 13%, var(--surface)); color: #7a4a00; }
.rule-test-result.danger { background: color-mix(in srgb, var(--danger) 9%, var(--surface)); color: var(--danger); }
.filter-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.filter-chip { min-height: 36px; padding: .4rem .7rem; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--line); box-shadow: none; }
.filter-chip.active { color: var(--brand); background: var(--brand-soft); border-color: var(--brand); }
.policy-panel.is-dirty { border-color: var(--warning); }
.policy-dirty-badge { margin-left: auto; margin-right: .5rem; }

.enhanced-rule-card { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: start; gap: .8rem; padding: 1rem; }
.enhanced-rule-card.is-dragging { opacity: .55; border-color: var(--brand); }
.rule-drag-handle { padding-top: .2rem; color: var(--text-muted); cursor: grab; letter-spacing: -.2rem; }
.rule-card-main { min-width: 0; }
.compact-sequence { display: grid; gap: .45rem; margin: .75rem 0; padding: 0; list-style: none; }
.sequence-label { display: block; margin-top: .75rem; color: var(--text-secondary); font-size: .78rem; }
.compact-sequence li, .sequence-preview li { display: flex; gap: .65rem; align-items: flex-start; }
.compact-sequence li > span, .sequence-preview li > span { display: grid; place-items: center; flex: 0 0 24px; height: 24px; border-radius: 50%; color: var(--brand); background: var(--brand-soft); font-weight: 800; }
.compact-sequence li div, .sequence-preview li div { display: grid; min-width: 0; }
.compact-sequence small { overflow: hidden; color: var(--text-secondary); text-overflow: ellipsis; white-space: nowrap; }
.rule-performance { display: flex; flex-wrap: wrap; gap: .65rem 1.1rem; color: var(--text-secondary); font-size: .82rem; }
.rule-performance span { display: flex; gap: .3rem; }
.inline-warning { margin: .75rem 0 0; padding: .65rem .75rem; border-left: 3px solid var(--danger); background: color-mix(in srgb, var(--danger) 7%, var(--surface)); color: var(--danger); }
.rule-action-menu { position: relative; }
.rule-action-menu .action-menu-panel { min-width: 190px; }
.rule-action-menu form, .rule-action-menu button, .rule-action-menu a { width: 100%; }
.rule-test-sandbox { margin: 1.5rem 0; padding: 1rem; border-radius: 14px; background: var(--structure-soft); }
.sequence-preview { margin-top: 1rem; }
.sequence-preview > strong { display: block; margin-bottom: .55rem; }
.sequence-preview ol { display: grid; gap: .5rem; padding: 0; list-style: none; }

.flow-builder-card { overflow: visible; }
.flow-validation { margin: 0 0 1rem; border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); background: color-mix(in srgb, var(--danger) 6%, var(--surface)); }
.flow-validation.success { border-color: color-mix(in srgb, var(--success) 35%, var(--line)); background: color-mix(in srgb, var(--success) 7%, var(--surface)); }
.flow-workspace { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .65fr); gap: 1rem; align-items: start; }
.flow-node-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: .45rem .7rem; margin-bottom: .3rem; }
.flow-node-heading strong { line-height: 1.35; }
.flow-node-type { display: inline-flex; width: max-content; margin: 0; color: var(--brand); font-size: .72rem; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.opening-node { border-color: var(--brand); background: var(--brand-soft); }
.flow-simulator { position: sticky; top: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--structure-soft); }
.simulator-transcript { min-height: 240px; max-height: 420px; overflow-y: auto; display: flex; flex-direction: column; gap: .6rem; margin: .75rem 0; padding: .75rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.simulator-empty { margin: auto; color: var(--text-muted); text-align: center; }
.simulator-bubble { width: min(86%, 420px); padding: .65rem .75rem; border-radius: 12px; background: var(--structure-soft); }
.simulator-bubble.customer { align-self: flex-end; background: var(--brand-soft); }
.simulator-bubble.bot { align-self: flex-start; border-left: 3px solid var(--brand); }
.simulator-bubble.system { align-self: center; width: 100%; color: var(--text-secondary); background: var(--structure-soft); text-align: center; }
.simulator-bubble p { margin: 0; white-space: pre-wrap; }
.simulator-bubble small { display: block; margin-top: .3rem; color: var(--text-muted); }
.wizard-actions { display: flex; justify-content: space-between; gap: .75rem; margin-top: 1rem; }
.flow-progress { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 1.25rem; }
.signup-progress.flow-progress > span {
  position: relative;
  display: grid;
  justify-items: center;
  gap: .35rem;
  width: auto;
  height: auto;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 0;
  text-align: center;
  white-space: normal;
  font-size: .72rem;
}
.signup-progress.flow-progress > span:not(:last-child)::after {
  content: "";
  position: absolute;
  top: 14px;
  left: calc(50% + 20px);
  right: calc(-50% + 20px);
  height: 2px;
  background: var(--line);
}
.signup-progress.flow-progress > span > strong {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  color: var(--muted);
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: 50%;
}
.signup-progress.flow-progress > span.active { color: var(--text); }
.signup-progress.flow-progress > span.active > strong {
  color: var(--brand-hover);
  background: var(--brand-soft);
  border-color: var(--brand);
}
.autosave-status { color: var(--text-muted); font-size: .82rem; }

@media (max-width: 1050px) {
  .preset-wizard { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .flow-workspace { grid-template-columns: 1fr; }
  .flow-simulator { position: static; }
}

@media (max-width: 700px) {
  .preset-wizard { grid-template-columns: 1fr; }
  .inline-test { flex-direction: column; }
  .enhanced-rule-card { grid-template-columns: minmax(0, 1fr) auto; }
  .rule-drag-handle { display: none; }
  .rule-card-main { grid-column: 1; }
  .rule-action-menu { grid-column: 2; grid-row: 1; }
  .rule-performance { display: grid; gap: .35rem; }
}

.automation-priority ol { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .75rem; margin: 0; padding: 0; list-style: none; }
.automation-priority li { display: grid; grid-template-columns: auto 1fr; gap: .35rem .65rem; align-items: start; padding: .9rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.automation-priority li > span { grid-row: span 2; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--surface); background: var(--brand); font-weight: 850; }
.automation-priority li strong, .automation-priority li small { grid-column: 2; }
.automation-priority li small { color: var(--text-secondary); }
.instruction-audit { margin: 1rem 0; padding: .9rem 1rem; border: 1px solid var(--line); border-radius: 12px; }
.instruction-audit.warning { border-color: color-mix(in srgb, var(--warning) 45%, var(--line)); background: color-mix(in srgb, var(--warning) 9%, var(--surface)); }
.instruction-audit.success { border-color: color-mix(in srgb, var(--success) 40%, var(--line)); background: color-mix(in srgb, var(--success) 7%, var(--surface)); }
.instruction-audit ul { margin: .55rem 0 0; padding-left: 1.2rem; }
.instruction-audit p { margin: .35rem 0 0; }
.threshold-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin: 1rem 0; }
.threshold-grid > div { padding: .9rem; border: 1px solid var(--line); border-radius: 12px; background: var(--structure-soft); }
.threshold-grid input[type="range"] { width: 100%; accent-color: var(--brand); }
.sandbox-answer { margin-top: 1rem; padding: 1rem; border-left: 4px solid var(--brand); border-radius: 12px; background: var(--brand-soft); }
.sandbox-answer p { white-space: pre-wrap; }
.sandbox-answer small { color: var(--text-secondary); }

@media (max-width: 1050px) {
  .automation-priority ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 700px) {
  .automation-priority ol, .threshold-grid { grid-template-columns: 1fr; }
}

.queue-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; margin-bottom: .75rem; }
.queue-tab { min-width: 0; min-height: 42px; display: flex; align-items: center; justify-content: space-between; gap: .6rem; padding: .5rem .65rem; color: var(--text-secondary); background: var(--surface); border: 1px solid var(--line); box-shadow: none; font-size: .78rem; }
.queue-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-count { display: inline-grid; place-items: center; flex: 0 0 auto; min-width: 24px; height: 24px; padding: 0 .3rem; border-radius: 999px; background: var(--structure-soft); font-weight: 800; }
.queue-tab.active { color: var(--brand); background: var(--brand-soft); border-color: var(--brand); }
.conversation-card-list { display: grid; gap: .5rem; }
.conversation-card { display: grid; gap: .55rem; padding: .85rem; color: var(--text); text-decoration: none; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.conversation-card:hover, .conversation-card.active { border-color: var(--brand); background: var(--brand-soft); }
.conversation-card-top { display: flex; justify-content: space-between; gap: .5rem; }
.unread-count { display: grid; place-items: center; min-width: 24px; height: 24px; padding: 0 .35rem; border-radius: 999px; color: var(--surface); background: var(--brand); font-size: .75rem; font-weight: 850; }
.handoff-explanation { margin-bottom: 1rem; padding: .9rem; border-left: 4px solid var(--warning); border-radius: 10px; background: color-mix(in srgb, var(--warning) 9%, var(--surface)); }
.handoff-explanation p { margin: .25rem 0 0; }
.conversation-management { display: grid; grid-template-columns: .7fr .7fr 1.2fr; gap: .75rem; margin-bottom: 1rem; padding: .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--structure-soft); }
.conversation-management > div { display: grid; gap: .3rem; align-content: end; }
.internal-note { align-self: center; max-width: 92%; color: var(--text-secondary); background: var(--structure-soft); border: 1px dashed var(--line-strong); }
.internal-note-panel, .resolve-form { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.resolve-form { display: flex; flex-wrap: wrap; align-items: end; gap: .7rem; }
.resolve-form label { width: 100%; }
.resolve-form select { flex: 1 1 240px; }

@media (max-width: 900px) {
  .conversation-management { grid-template-columns: 1fr; }
}

.analytics-filters form { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)) auto; gap: .75rem; align-items: end; }
.analytics-filters form > div { display: grid; gap: .3rem; }
.trend { display: inline-flex; width: max-content; margin-top: .45rem; font-size: .78rem; font-weight: 750; }
.trend.up { color: var(--danger); }
.trend.down { color: var(--success); }
.trend.neutral { color: var(--text-muted); }
.chart-drilldown { width: 100%; color: var(--text); background: transparent; border: 0; border-radius: 8px; box-shadow: none; text-align: left; }
.chart-drilldown:hover, .chart-drilldown:focus-visible { background: var(--brand-soft); }
.insight-grid { display: grid; grid-template-columns: minmax(260px, .7fr) minmax(0, 1.3fr); gap: 1rem; }
.insight-card { border-left: 4px solid var(--brand); }
.insight-card > strong { display: block; margin: .4rem 0; color: var(--structure); font-size: clamp(1.4rem, 3vw, 2rem); }
.resolution-history { margin-top: .8rem; padding: .75rem; border-radius: 10px; background: var(--structure-soft); }
.analytics-grid { grid-template-columns: 1fr; }
.link-button {
  max-width: 100%;
  min-height: auto;
  padding: 0;
  color: var(--brand-hover);
  background: transparent;
  border: 0;
  box-shadow: none;
  text-align: left;
  overflow-wrap: anywhere;
  white-space: normal;
}
.link-button:hover, .link-button:focus-visible { color: var(--structure); background: transparent; text-decoration: underline; }

@media (max-width: 1050px) {
  .analytics-filters form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .insight-grid { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .analytics-filters form { grid-template-columns: 1fr; }
}

.schedule-preview { display: grid; align-content: start; gap: .75rem; }
.timezone-preview { padding: .8rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.timezone-preview strong { display: block; margin-top: .45rem; }
.timezone-preview p { margin: .2rem 0; color: var(--text-secondary); font-size: .84rem; }
.timezone-preview ol { display: grid; gap: .2rem; margin: .3rem 0; padding-left: 1.2rem; color: var(--text-secondary); font-size: .82rem; }
.view-switcher { display: inline-flex; gap: .25rem; margin-bottom: 1rem; padding: .25rem; border-radius: 10px; background: var(--structure-soft); }
.view-switcher button { min-height: 36px; padding: .4rem .8rem; color: var(--text-secondary); background: transparent; border: 0; box-shadow: none; }
.view-switcher button.active { color: var(--brand); background: var(--surface); box-shadow: var(--shadow-sm); }
.delivery-status-line { display: flex; flex-wrap: wrap; gap: .3rem .65rem; font-size: .78rem; }
.delivery-details { margin-top: .5rem; }
.delivery-list { display: grid; gap: .45rem; min-width: min(420px, 75vw); padding: .65rem; }
.delivery-list > div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .2rem .5rem; padding: .55rem; border: 1px solid var(--line); border-radius: 9px; }
.delivery-list small { grid-column: 1 / -1; color: var(--text-secondary); }
.schedule-calendar { display: grid; gap: .65rem; }
.calendar-event { display: grid; grid-template-columns: 105px minmax(0, 1fr) auto; gap: .8rem; align-items: center; padding: .85rem; border: 1px solid var(--line); border-radius: 12px; }
.calendar-event time { display: grid; color: var(--text-secondary); font-size: .78rem; }
.calendar-event time strong { color: var(--structure); font-size: 1.05rem; }
.calendar-event > div { display: grid; min-width: 0; }
.calendar-event small { overflow: hidden; color: var(--text-secondary); text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 600px) {
  .calendar-event { grid-template-columns: 1fr auto; }
  .calendar-event time { grid-column: 1 / -1; }
}

.upload-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(240px, .85fr); gap: 1rem; }
.upload-preview { min-height: 190px; display: grid; place-items: center; overflow: hidden; padding: .75rem; color: var(--text-muted); border: 1px dashed var(--line-strong); border-radius: 14px; background: var(--structure-soft); text-align: center; }
.upload-preview img, .upload-preview video { width: 100%; max-height: 260px; object-fit: contain; border-radius: 9px; }
.media-toolbar { display: grid; grid-template-columns: minmax(220px, 1fr) auto auto; }
.enhanced-media-card { position: relative; overflow: visible; }
.media-select { position: absolute; z-index: 2; top: .65rem; left: .65rem; display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; background: color-mix(in srgb, var(--surface) 94%, transparent); box-shadow: var(--shadow-sm); }
.media-select input { width: 18px; height: 18px; accent-color: var(--brand); }
.media-usage { margin-top: .5rem; }
.media-tags { min-height: 28px; display: flex; flex-wrap: wrap; gap: .3rem; margin-top: .55rem; }
.media-tag { display: inline-flex; padding: .18rem .5rem; border-radius: 999px; color: var(--brand); background: var(--brand-soft); font-size: .72rem; font-weight: 750; }
.media-actions { position: relative; margin-top: .65rem; }
.media-actions > summary { width: max-content; list-style: none; }
.media-actions[open] { z-index: 5; }
.media-actions[open] > summary { margin-bottom: .65rem; }
.media-actions form { display: grid; gap: .45rem; margin-top: .65rem; padding-top: .65rem; border-top: 1px solid var(--line); }
.media-actions label { font-size: .78rem; }
.media-actions input { min-width: 0; }

@media (max-width: 760px) {
  .upload-layout, .media-toolbar { grid-template-columns: 1fr; }
}

.risk-score.healthy, .live-risk-panel.healthy { border-color: color-mix(in srgb, var(--success) 42%, var(--line)); }
.risk-score.warning, .live-risk-panel.warning { border-color: color-mix(in srgb, var(--warning) 48%, var(--line)); }
.risk-score.danger, .live-risk-panel.danger { border-color: color-mix(in srgb, var(--danger) 48%, var(--line)); }
.live-risk-panel { border-left-width: 4px; }
.live-risk-panel ul { margin: .65rem 0 0; padding-left: 1.2rem; color: var(--text-secondary); }
.keyword-manager { padding: 1rem; border: 1px solid var(--line); border-radius: 12px; background: var(--structure-soft); }
.keyword-list { min-height: 38px; display: flex; flex-wrap: wrap; gap: .4rem; margin: .55rem 0; }
.keyword-chip { min-height: 34px; padding: .35rem .65rem; color: var(--brand); background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line)); box-shadow: none; font-size: .8rem; }
.keyword-chip:hover { color: var(--surface); background: var(--danger); border-color: var(--danger); }
.unsafe-combination { margin: 1rem 0; padding: .85rem 1rem; color: var(--danger); border: 1px solid color-mix(in srgb, var(--danger) 42%, var(--line)); border-radius: 12px; background: color-mix(in srgb, var(--danger) 7%, var(--surface)); font-weight: 750; }

.connection-health .detail-item { border-top: 3px solid var(--line); }
.recovery-assistant { border-left-width: 4px; }
.recovery-assistant.success { border-color: color-mix(in srgb, var(--success) 50%, var(--line)); }
.recovery-assistant.warning { border-color: color-mix(in srgb, var(--warning) 55%, var(--line)); }
.recovery-assistant.danger { border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); }
.recovery-steps { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .75rem; margin: 1rem 0; }
.recovery-steps article { display: grid; grid-template-columns: auto 1fr; gap: .65rem; padding: .85rem; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.recovery-steps article > span { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: var(--surface); background: var(--brand); font-weight: 850; }
.recovery-steps p { margin: .25rem 0 0; color: var(--text-secondary); font-size: .82rem; }
.connection-timeline { position: relative; display: grid; gap: .85rem; margin: 0; padding: 0; list-style: none; }
.connection-timeline::before { content: ""; position: absolute; top: 10px; bottom: 10px; left: 9px; width: 2px; background: var(--line); }
.connection-timeline li { position: relative; display: grid; grid-template-columns: 20px 1fr; gap: .75rem; }
.connection-timeline li > div { display: grid; padding-bottom: .6rem; }
.connection-timeline small { color: var(--text-secondary); }
.timeline-dot { z-index: 1; width: 20px; height: 20px; border: 4px solid var(--surface); border-radius: 50%; background: var(--info); box-shadow: 0 0 0 1px var(--line); }
.timeline-dot.healthy { background: var(--success); }
.timeline-dot.danger { background: var(--danger); }
.deletion-countdown { border: 2px solid var(--danger); background: color-mix(in srgb, var(--danger) 4%, var(--surface)); }
.countdown-value { margin: 1rem 0; color: var(--danger); font-size: clamp(1.5rem, 4vw, 2.4rem); font-weight: 900; }

@media (max-width: 760px) {
  .recovery-steps { grid-template-columns: 1fr; }
}
