@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,600;12..96,700;12..96,800&family=Instrument+Sans:wght@400;500;600&display=swap');

:root {
  --bg: #f5f0e8;
  --surface: #fffdf9;
  --surface-2: #f3ede4;
  --surface-3: #ebe3d7;
  --ink: #1c1712;
  --ink-2: #6b6157;
  --ink-3: #9a8f83;
  --line: #e6ddd0;
  --line-2: #d8cdbd;
  --accent: #ff4f6d;
  --accent-soft: #ffe9ed;
  --accent-2: #ff9a3d;
  --violet: #7a5cff;
  --ok: #1f9d6a;
  --grad: linear-gradient(120deg, #ff9a3d 0%, #ff4f6d 45%, #c13bd6 75%, #7a5cff 100%);
  --radius: 20px;
  --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(28,23,18,.04), 0 8px 28px -14px rgba(28,23,18,.16);
  --ring: 0 0 0 4px rgba(255,79,109,.14);
  --font-display: 'Bricolage Grotesque', system-ui, sans-serif;
  --font-body: 'Instrument Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
.muted { color: var(--ink-2); font-size: 13.5px; }

/* =========================================================
   Login
   ========================================================= */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.auth-art {
  position: relative; overflow: hidden;
  background: var(--ink); color: #fff;
  padding: 48px;
  display: flex; flex-direction: column; justify-content: space-between; gap: 40px;
}
.auth-art::before {
  content: ''; position: absolute;
  width: 620px; height: 620px; right: -180px; bottom: -220px;
  background: var(--grad); border-radius: 50%;
  filter: blur(10px); opacity: .9;
}
.auth-art::after {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.08) 1px, transparent 1px);
  background-size: 22px 22px;
}
.auth-art > * { position: relative; z-index: 1; }
.auth-art h1 {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(40px, 5.5vw, 76px); line-height: .95; letter-spacing: -.03em;
  max-width: 9ch;
}
.auth-art p { color: rgba(255,255,255,.72); max-width: 36ch; margin-top: 18px; }
.chat-float { display: flex; flex-direction: column; gap: 10px; max-width: 300px; }
.bubble { padding: 10px 14px; border-radius: 18px; font-size: 14px; width: fit-content; max-width: 100%; }
.bubble.in { background: rgba(255,255,255,.14); backdrop-filter: blur(8px); border-bottom-left-radius: 6px; }
.bubble.out { background: #fff; color: var(--ink); margin-left: auto; border-bottom-right-radius: 6px; }

.auth-form-wrap { display: grid; place-items: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 380px; }
.auth-card h2 { font-family: var(--font-display); font-size: 32px; letter-spacing: -.02em; margin-bottom: 6px; }
.auth-card .sub { color: var(--ink-2); margin-bottom: 28px; }
.auth-error {
  display: none; background: var(--accent-soft); color: #b3203c;
  border: 1px solid #ffc7d1; padding: 10px 14px; border-radius: var(--radius-sm);
  font-size: 14px; margin-bottom: 16px;
}
.auth-error.show { display: block; }

/* =========================================================
   Brand + buttons + inputs
   ========================================================= */
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 700; font-size: 19px; letter-spacing: -.01em;
  text-decoration: none;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px;
  background: var(--grad); color: #fff;
  display: grid; place-items: center;
}

.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field > label, .label, .sub-label {
  display: block; font-weight: 600; font-size: 13px; margin-bottom: 7px;
}
.sub-label { margin: 14px 0 7px; }
.req { color: var(--accent); }
.hint { font-weight: 500; color: var(--ink-3); font-size: 12px; }
.help { color: var(--ink-2); font-size: 12.5px; margin-top: 7px; }

.input, .select, .textarea {
  width: 100%;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  min-height: 46px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.input::placeholder, .textarea::placeholder { color: var(--ink-3); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-2); }
.textarea { resize: vertical; min-height: 0; line-height: 1.5; }
.select {
  appearance: none; cursor: pointer; padding-right: 40px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%231c1712' stroke-width='1.8'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E") no-repeat right 15px center;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: var(--ring); }
.input.invalid, .textarea.invalid { border-color: var(--accent); background: #fffafb; }

.pw-wrap { position: relative; }
.pw-toggle {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; cursor: pointer;
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  padding: 6px 8px; border-radius: 8px;
}
.pw-toggle:hover { background: var(--surface-2); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 999px;
  height: 44px; padding: 0 22px;
  font-weight: 600; font-size: 14.5px;
  cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: transform .12s, box-shadow .15s, background .2s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-primary {
  background: var(--grad); background-size: 160% 100%; color: #fff;
  box-shadow: 0 10px 24px -10px rgba(255,79,109,.7);
}
.btn-primary:hover { background-position: 100% 0; }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover { background: #352c24; }
.btn-ghost { background: transparent; border: 1.5px solid var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-block { width: 100%; }
.btn-sm { height: 36px; padding: 0 14px; font-size: 13px; }
.link-btn {
  border: 0; background: none; cursor: pointer;
  font-size: 13px; font-weight: 600; color: var(--accent);
  padding: 4px 6px; border-radius: 6px;
}
.link-btn:hover { background: var(--accent-soft); }

.icon-btn {
  width: 36px; height: 36px; flex: none;
  border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface);
  display: grid; place-items: center;
  cursor: pointer; color: var(--ink-2);
  transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn.danger:hover { color: var(--accent); border-color: #ffc7d1; background: var(--accent-soft); }

/* =========================================================
   App shell
   ========================================================= */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: rgba(245,240,232,.82);
  backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1200px; margin: 0 auto;
  height: 64px; padding: 0 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.user-chip { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--grad); color: #fff;
  display: grid; place-items: center;
  font-weight: 700; font-size: 13px;
}
.user-email { font-size: 13.5px; color: var(--ink-2); margin-right: 4px; }

.container { max-width: 1200px; margin: 0 auto; padding: 40px 24px 32px; }

/* Page header */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 24px;
  flex-wrap: wrap; margin-bottom: 24px;
}
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 10px;
}
.page-head h1 {
  font-family: var(--font-display); font-weight: 800;
  font-size: clamp(32px, 4vw, 48px); letter-spacing: -.035em; line-height: 1;
}
.page-head h1 em {
  font-style: normal; background: var(--grad);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lede { color: var(--ink-2); margin-top: 12px; }

.stats {
  display: flex;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
}
.stat { padding: 12px 22px; min-width: 96px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat b { display: block; font-family: var(--font-display); font-size: 26px; line-height: 1.1; }
.stat span { font-size: 12px; color: var(--ink-2); }

/* Accounts bar */
.accounts-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 16px 16px 20px;
  margin-bottom: 24px;
}
.accounts-label { display: flex; align-items: center; gap: 14px; min-width: 0; }
.accounts-label b { display: block; font-size: 14px; margin-bottom: 4px; }
.ig-icon {
  width: 42px; height: 42px; border-radius: 12px; flex: none;
  background: var(--grad); color: #fff;
  display: grid; place-items: center;
}
.accounts-list { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.accounts-list .muted { font-size: 13px; }
.acct {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 3px 4px 3px 11px;
  font-weight: 600; font-size: 13px;
}
.acct .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 3px rgba(31,157,106,.15); }
.acct.warn .dot { background: var(--accent-2); box-shadow: 0 0 0 3px rgba(255,154,61,.18); }
.acct em { font-style: normal; font-weight: 500; font-size: 12px; color: #b25d0a; }
.acct button {
  width: 22px; height: 22px; border-radius: 50%;
  border: 0; background: transparent; cursor: pointer;
  color: var(--ink-3); font-size: 16px; line-height: 1;
}
.acct button:hover { background: var(--accent-soft); color: var(--accent); }

/* Layout grid */
.grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 24px;
  align-items: start;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}
.card-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.card-head h2 { font-family: var(--font-display); font-size: 22px; letter-spacing: -.02em; line-height: 1.2; }
.card-head .muted { margin-top: 3px; }
.badge-edit {
  font-size: 12px; font-weight: 600;
  background: var(--accent-soft); color: #c2264a;
  padding: 5px 12px; border-radius: 999px;
}

/* Builder sections */
.builder { padding: 0; }
.builder .card-head { padding: 26px 28px 0; margin-bottom: 8px; }
.section { padding: 22px 28px 26px; }
.section + .section { border-top: 1px solid var(--line); }
.section-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--ink-2);
  margin-bottom: 18px;
}
.num {
  width: 22px; height: 22px; border-radius: 7px;
  background: var(--ink); color: #fff;
  display: grid; place-items: center;
  font-size: 11.5px; letter-spacing: 0;
}
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.row-2 + .field, .field + .row-2 { margin-top: 18px; }
.row-2 .field { margin-bottom: 0; }

/* Segmented action type */
.segmented {
  position: relative;
  display: grid; grid-template-columns: repeat(3, 1fr);
  background: var(--surface-2);
  border-radius: 14px; padding: 4px; gap: 4px;
}
.segmented input, .pills input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label {
  text-align: center; padding: 9px 8px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2);
  cursor: pointer; transition: background .15s, color .15s;
}
.segmented label:hover { color: var(--ink); }
.segmented input:checked + label { background: #fff; color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 10px -6px rgba(0,0,0,.25); }
.segmented input:focus-visible + label { outline: 2px solid var(--accent); }

/* Pill radios */
.pills { display: flex; gap: 8px; flex-wrap: wrap; }
.pills label {
  border: 1.5px solid var(--line); border-radius: 999px;
  padding: 7px 16px; font-size: 13.5px; font-weight: 600;
  cursor: pointer; transition: all .15s;
}
.pills label:hover { border-color: var(--line-2); }
.pills input:checked + label { border-color: var(--ink); background: var(--ink); color: #fff; }
.pills input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Message blocks */
.block {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  background: #fff;
}
.block + .block { margin-top: 14px; }
.block.hidden { display: none; }
.block-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.block-icon {
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  display: grid; place-items: center; color: #fff;
}
.bi-comment { background: var(--accent-2); }
.bi-dm { background: var(--accent); }
.bi-link { background: var(--violet); }
.block-head h3 { font-size: 14.5px; font-weight: 600; line-height: 1.3; }
.block-head small { display: block; color: var(--ink-2); font-size: 12.5px; }
.block .textarea, .block .input { background: var(--surface); }
.block-step2 { border-style: dashed; border-color: var(--line-2); background: var(--surface-2); }
.block-step2 .textarea, .block-step2 .input { background: #fff; }

.dm-button-input {
  width: 100%; height: 44px;
  border: 1.5px dashed var(--line-2);
  background: var(--surface);
  color: #3797f0;
  text-align: center; font-weight: 600;
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.dm-button-input:focus { border-color: var(--accent); border-style: solid; box-shadow: var(--ring); }
.dm-button-input::placeholder { color: var(--ink-3); font-weight: 500; }

.form-actions {
  display: flex; gap: 10px; align-items: center; justify-content: flex-end; flex-wrap: wrap;
  padding: 18px 28px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  border-radius: 0 0 var(--radius) var(--radius);
}
.form-actions .btn-primary { min-width: 150px; }

/* Post picker */
.posts-box { display: none; margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; }
.posts-box.show { display: block; }
.posts-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.posts-head .help { margin: 0; }
.posts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
  max-height: 330px; overflow-y: auto;
}
.posts-grid:empty { display: none; }
.post {
  position: relative; aspect-ratio: 1; padding: 0;
  border: 2px solid transparent; border-radius: 12px;
  overflow: hidden; background: var(--surface-2);
  cursor: pointer; transition: border-color .15s, transform .15s;
}
.post:hover { transform: translateY(-1px); }
.post img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-ph { display: grid; place-items: center; height: 100%; font-size: 12px; color: var(--ink-2); }
.post-cap {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 16px 7px 6px;
  font-size: 10.5px; color: #fff; text-align: left;
  background: linear-gradient(transparent, rgba(0,0,0,.65));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.post-check {
  position: absolute; top: 6px; right: 6px;
  width: 22px; height: 22px; border-radius: 50%;
  background: rgba(255,255,255,.9); border: 1.5px solid var(--line);
  color: transparent; font-size: 12px; font-weight: 700;
  display: grid; place-items: center;
}
.post.on { border-color: var(--accent); }
.post.on .post-check { background: var(--accent); border-color: var(--accent); color: #fff; }

/* =========================================================
   Phone preview
   ========================================================= */
.preview-sticky { position: sticky; top: 88px; }
.preview-label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3);
  margin: 4px 6px 12px;
}
.preview-label span:last-child { text-transform: none; letter-spacing: 0; color: var(--ink-2); }
.phone {
  background: var(--ink);
  border-radius: 44px;
  padding: 10px;
  box-shadow: 0 1px 0 rgba(255,255,255,.1) inset, 0 30px 60px -30px rgba(28,23,18,.55);
}
.screen {
  position: relative;
  background: #fff; color: #111;
  border-radius: 35px; overflow: hidden;
  height: 600px;
  display: flex; flex-direction: column;
}
.notch {
  position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
  width: 92px; height: 24px; border-radius: 999px; background: var(--ink);
}
.screen-top {
  padding: 46px 16px 12px;
  border-bottom: 1px solid #efefef;
  display: flex; align-items: center; gap: 10px;
}
.screen-top .pf { width: 34px; height: 34px; border-radius: 50%; background: var(--grad); padding: 2px; flex: none; }
.screen-top .pf span { display: block; width: 100%; height: 100%; border-radius: 50%; background: #f1f1f1; border: 2px solid #fff; }
.screen-top b { font-size: 13.5px; display: block; line-height: 1.2; }
.screen-top small { font-size: 11px; color: #8e8e8e; }
.screen-body {
  flex: 1; overflow-y: auto;
  padding: 14px 14px 20px;
  display: flex; flex-direction: column; gap: 8px;
  font-size: 13px;
}
.sys { align-self: center; font-size: 11px; color: #a0a0a0; margin: 6px 0 2px; }
.msg {
  max-width: 80%; padding: 9px 13px; border-radius: 18px;
  word-wrap: break-word; white-space: pre-wrap;
}
.msg.them { background: #efefef; align-self: flex-start; border-bottom-left-radius: 6px; }
.msg.me { background: #3797f0; color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.msg-card {
  align-self: flex-end; max-width: 84%;
  border: 1px solid #e6e6e6; border-radius: 18px; overflow: hidden;
}
.msg-card .txt { padding: 10px 13px; white-space: pre-wrap; word-wrap: break-word; }
.msg-card .cta {
  display: block; border-top: 1px solid #e6e6e6;
  padding: 9px; text-align: center; color: #3797f0; font-weight: 600;
}
.comment-preview { background: #fafafa; border-radius: 14px; padding: 11px 12px; font-size: 12.5px; }
.comment-preview .c + .c { margin-top: 7px; }
.comment-preview .reply { padding-left: 12px; margin-left: 4px; border-left: 2px solid #e8e8e8; }
.empty-line { color: #bbb; font-style: italic; }

/* =========================================================
   Rules list
   ========================================================= */
.rules-card { margin-top: 24px; }
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; }
.search { position: relative; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search .input { width: 230px; min-height: 40px; height: 40px; padding: 0 14px 0 36px; }
.toolbar .select { width: auto; min-height: 40px; height: 40px; padding: 0 38px 0 14px; }

.rules { display: grid; gap: 10px; }
.rule {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 14px 14px 16px;
  display: grid; grid-template-columns: auto 1fr auto;
  gap: 16px; align-items: center;
  background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.rule:hover { border-color: var(--line-2); box-shadow: 0 6px 18px -12px rgba(28,23,18,.25); }
.rule.off { background: var(--surface); }
.rule.off .rule-kw, .rule.off .rule-main { opacity: .5; }
.rule-kw {
  font-family: var(--font-display); font-weight: 700; font-size: 15px;
  background: var(--surface-2);
  border-radius: 12px; padding: 10px 14px;
  min-width: 96px; max-width: 180px;
  text-align: center; word-break: break-word;
}
.rule-main { min-width: 0; }
.rule-main h4 { font-size: 15px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rule-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.tag {
  font-size: 11.5px; font-weight: 600;
  padding: 3px 9px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2);
}
.tag.t-both { background: var(--accent-soft); color: #c2264a; }
.tag.t-reply { background: #fff0e0; color: #b25d0a; }
.tag.t-dm { background: #ece7ff; color: #5638d6; }
.rule-actions { display: flex; align-items: center; gap: 6px; }
.rule-actions .switch { margin-right: 6px; }

.switch { position: relative; width: 40px; height: 24px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; background: var(--surface-3);
  border-radius: 999px; cursor: pointer; transition: background .2s;
}
.switch span::after {
  content: ''; position: absolute; left: 3px; top: 3px;
  width: 18px; height: 18px; background: #fff; border-radius: 50%;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
  transition: transform .2s;
}
.switch input:checked + span { background: var(--ok); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.empty {
  text-align: center; padding: 44px 20px;
  color: var(--ink-2);
  border: 1.5px dashed var(--line); border-radius: 16px;
}
.empty b { display: block; color: var(--ink); font-family: var(--font-display); font-size: 18px; margin-bottom: 4px; }

.page-foot { text-align: center; color: var(--ink-3); font-size: 13px; padding: 32px 0 8px; }
.page-foot a { color: var(--ink-2); text-decoration: none; }
.page-foot a:hover { color: var(--ink); text-decoration: underline; }

/* Toast */
.toast {
  position: fixed; left: 50%; bottom: 24px;
  transform: translate(-50%, 20px);
  background: var(--ink); color: #fff;
  padding: 12px 20px; border-radius: 999px;
  font-size: 14px; font-weight: 500;
  box-shadow: 0 12px 30px -10px rgba(0,0,0,.4);
  opacity: 0; pointer-events: none;
  transition: all .25s; z-index: 50;
  max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1024px) {
  .grid { grid-template-columns: 1fr; }
  .preview-sticky { position: static; width: 100%; max-width: 330px; margin: 0 auto; }
  .screen { height: 540px; }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { min-height: 300px; padding: 28px 20px; }
  .auth-art .chat-float { display: none; }
}
@media (max-width: 640px) {
  .container { padding: 24px 16px 24px; }
  .topbar-inner { padding: 0 16px; height: 58px; }
  .user-email { display: none; }
  .page-head { align-items: stretch; }
  .stats { width: 100%; }
  .stat { flex: 1; min-width: 0; padding: 10px 14px; }
  .accounts-bar { padding: 14px; }
  .accounts-bar .btn { width: 100%; }
  .card { padding: 20px 16px; }
  .builder { padding: 0; }
  .builder .card-head { padding: 20px 16px 0; }
  .section { padding: 18px 16px 20px; }
  .form-actions { padding: 14px 16px; }
  .form-actions .btn { flex: 1; min-width: 0; }
  .row-2 { grid-template-columns: 1fr; gap: 18px; }
  .block { padding: 14px; }
  .segmented label { font-size: 12.5px; padding: 9px 4px; }
  .rule { grid-template-columns: 1fr; gap: 12px; }
  .rule-kw { justify-self: start; }
  .rule-main h4 { white-space: normal; }
  .toolbar, .search, .search .input, .toolbar .select { width: 100%; }
}
