/* ============================================================
   Q STUDIO — Discord Bots
   Rides on portal.css: same sidebar, tiles, buttons. Everything
   here is logical-property (inline-start/end), so RTL costs
   nothing extra. Mobile first, then wider.
   ============================================================ */

/* ---------- shared bits ---------- */

.bots__av {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid var(--line);
  flex: none;
}

.bots__none {
  color: var(--gray-dim);
  font-size: 13px;
}

.bots__hint {
  color: var(--gray);
  font-size: 13px;
  margin: 0 0 12px;
  max-width: 52ch;
}

.flash--err {
  border-color: rgba(255, 96, 96, .35);
  color: #ff9c9c;
}

/* ---------- link panel ---------- */

.bots__link {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  padding: 48px 20px;
}
.bots__link h2 { margin: 0; }
.bots__link p  { color: var(--gray); max-width: 46ch; margin: 0 0 6px; }

/* ---------- cards grid ---------- */

.bots__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 640px)  { .bots__grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1200px) { .bots__grid { grid-template-columns: repeat(3, 1fr); } }

.bots__card {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}
.bots__card header {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.bots__card h3 {
  margin: 0;
  font-size: 15.5px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bots__icon { width: 22px; height: 22px; color: var(--gray); flex: none; }

.bots__card dl {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px 14px;
}
.bots__card dl div { min-width: 0; }
.bots__card dt {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gray-dim);
}
.bots__card dd {
  margin: 2px 0 0;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bots__card footer {
  margin-top: auto;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.bots__card footer .btn { min-height: 40px; }

.bots__tag  { margin: 0; font-size: 13.5px; color: var(--white); }
.bots__desc { margin: 0; font-size: 13px; color: var(--gray); }
.bots__price { font-size: 12.5px; color: var(--gray); margin-inline-end: auto; }
.bots__price b { color: var(--white); }
.bots__soon {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gray-dim);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 6px 12px;
}
.bots__card.is-soon { opacity: .62; }

/* ---------- status dot ---------- */

.bots__dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-dim);
  vertical-align: middle;
  margin-inline-end: 2px;
}
.bots__dot--running      { background: #4ade80; box-shadow: 0 0 8px rgba(74, 222, 128, .6); }
.bots__dot--stopped      { background: #facc15; }
.bots__dot--expired,
.bots__dot--failed       { background: #f87171; }
.bots__dot--provisioning { background: var(--accent); animation: botsPulse 1.2s infinite; }
@keyframes botsPulse { 50% { opacity: .35; } }
.bots__status { font-size: 12px; color: var(--gray); }

/* ---------- notifications ---------- */

.bots__notifs {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.bots__notifs li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 11px 4px;
  border-block-end: 1px solid var(--line-soft);
  font-size: 13.5px;
  color: var(--gray);
}
.bots__notifs li:last-child { border-block-end: 0; }
.bots__notifs li.is-new { color: var(--white); }
.bots__notifs li.is-new::before { content: '•'; color: var(--accent); margin-inline-end: 6px; }
.bots__notifs time { font-family: var(--font-mono); font-size: 11px; color: var(--gray-dim); flex: none; }

/* ---------- buy modal ---------- */

.bots__modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(0, 0, 0, .66);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: grid;
  place-items: center;
  padding: 18px;
  overflow-y: auto;
}
.bots__modal[hidden] { display: none; }
.bots__modal__card {
  width: min(480px, 100%);
  max-height: calc(100svh - 36px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.bots__modal__card h4 {
  margin: 4px 0 0;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--gray-dim);
}
.bots__x {
  background: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 34px;
  height: 34px;
  color: var(--gray);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.bots__x:hover { color: var(--white); }

.bots__plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
@media (max-width: 420px) { .bots__plans { grid-template-columns: 1fr; } }
.bots__plan {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--gray);
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  font: inherit;
  min-height: 44px;
}
.bots__plan b    { color: var(--white); font-size: 13px; }
.bots__plan span { font-family: var(--font-mono); font-size: 12px; }
.bots__plan.on {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.bots__servers {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
}
.bots__server {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--white);
  padding: 9px 12px;
  cursor: pointer;
  font: inherit;
  font-size: 13.5px;
  text-align: start;
  min-height: 44px;
}
.bots__server img,
.bots__server i {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--card);
  flex: none;
}
.bots__server span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bots__server.on { border-color: var(--accent); background: var(--accent-dim); }

/* ---------- settings form ---------- */

.bots__form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 14px;
}
.bots__fields {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 760px) { .bots__fields { grid-template-columns: repeat(2, 1fr); } }
.bots__field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.bots__field > span { font-size: 13px; color: var(--white); }
.bots__field > small { font-size: 12px; color: var(--gray-dim); }
.bots__field input[type="text"],
.bots__field input[type="number"],
.bots__field select,
.bots__field textarea {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--white);
  padding: 11px 12px;
  font: inherit;
  font-size: 13.5px;
  min-height: 44px;
}
.bots__field textarea { resize: vertical; min-height: 90px; }
.bots__field input:focus,
.bots__field select:focus,
.bots__field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.bots__field input[type="color"] {
  width: 64px;
  height: 40px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  cursor: pointer;
}
.bots__field--textarea,
.bots__field--role_list,
.bots__field--channel_list { grid-column: 1 / -1; }

/* toggle: checkbox drives the pill through :checked */
.bots__field--toggle {
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}
.bots__field--toggle > span  { flex: 1; min-width: 0; }
.bots__field--toggle > small { order: 3; width: 100%; }
.bots__field--toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.bots__switch {
  width: 42px;
  height: 24px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--surface);
  position: relative;
  flex: none;
  transition: background .2s, border-color .2s;
}
.bots__switch::after {
  content: '';
  position: absolute;
  inset-block-start: 3px;
  inset-inline-start: 3px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--gray);
  transition: transform .2s, background .2s;
}
.bots__field--toggle input:checked + .bots__switch {
  background: var(--accent-dim);
  border-color: var(--accent);
}
.bots__field--toggle input:checked + .bots__switch::after {
  background: var(--accent-lo);
  transform: translateX(18px);
}
[dir="rtl"] .bots__field--toggle input:checked + .bots__switch::after {
  transform: translateX(-18px);
}

.bots__save {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

/* ---------- logs ---------- */

.bots__logs {
  margin: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.7;
  color: var(--gray);
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
}

/* ---------- admin tables ---------- */

.bots__tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.bots__table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  min-width: 640px;
}
.bots__table th, .bots__table td {
  padding: 10px 8px;
  text-align: start;
  border-block-end: 1px solid var(--line-soft);
  white-space: nowrap;
}
.bots__table th {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gray-dim);
  font-weight: 500;
}
.bots__table td { color: var(--gray); }
.bots__table td b { color: var(--white); font-weight: 600; }
.bots__table .btn { min-height: 34px; padding: 6px 12px; font-size: 12px; }
.bots__table form { display: inline; }

/* ---------- small screens: cards + modal breathing room ---------- */

@media (max-width: 520px) {
  .bots__card dl { grid-template-columns: 1fr 1fr; }
  .bots__card footer .btn { flex: 1; justify-content: center; }
  .bots__save { align-items: stretch; }
  .bots__save .btn { justify-content: center; }
}

/* ============================================================
   The landing (bots.php) — hero, story scroll, collection.
   Same tokens as the rest of the site; the pinned mock is the
   one loud thing here, everything else stays quiet.
   ============================================================ */

.botslp .display--sm { font-size: clamp(30px, 5vw, 54px); }

.botslp__hero { min-height: 92svh; }

.botslp__marks {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 26px;
  margin-top: 34px;
}
.botslp__marks span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .08em;
  color: var(--gray);
}
.botslp__marks svg { width: 15px; height: 15px; color: var(--gray-dim); }

/* ---------- story scroll ---------- */

.botslp__story { padding: 110px 0 40px; }

.botslp__stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
  align-items: start;
  margin-top: 44px;
}

.botslp__pin {
  position: sticky;
  top: 96px;
}

/* the mock: the real panel's components, miniaturized */
.botslp__mock {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .5);
  transition: border-color .5s;
}
.botslp__mock[data-step="4"] { border-color: rgba(74, 222, 128, .35); }
.botslp__mock__bar {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
}
.botslp__mock__bar b { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.botslp__mock__status {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gray);
}
.botslp__mock__kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.botslp__mock__kpis > div {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 10px;
  min-width: 0;
}
.botslp__mock__kpis i {
  display: block;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gray-dim);
  margin-bottom: 4px;
}
.botslp__mock__kpis b {
  font-size: 13px;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.botslp__mock__logs i {
  display: block;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gray-dim);
  margin-bottom: 6px;
}
.botslp__mock__logs pre {
  margin: 0;
  min-height: 108px;
  background: var(--bg);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 12px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  line-height: 1.8;
  color: var(--gray);
  white-space: pre-wrap;
  word-break: break-word;
  text-align: left;
}
.botslp__mock__acts { display: flex; gap: 8px; flex-wrap: wrap; }
.botslp__mock__acts .btn { pointer-events: none; min-height: 34px; padding: 6px 14px; font-size: 12px; }

.botslp__steps {
  display: flex;
  flex-direction: column;
  gap: 34vh;
  padding: 16vh 0 24vh;
}
.botslp__step {
  max-width: 40ch;
  opacity: .28;
  transition: opacity .5s;
}
.botslp__step.on { opacity: 1; }
.botslp__step__n {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .2em;
  color: var(--accent);
}
.botslp__step h3 { margin: 10px 0 8px; font-size: clamp(19px, 2.6vw, 26px); }
.botslp__step p { margin: 0; color: var(--gray); font-size: 14.5px; line-height: 1.8; }

/* ---------- collection ---------- */

.botslp__bots { padding: 110px 0 40px; }
.botslp__cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
  margin-top: 44px;
}
.botslp__bot {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--card);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
  transition: border-color .3s, transform .3s;
}
.botslp__bot:hover { border-color: rgba(139, 92, 255, .35); transform: translateY(-3px); }
.botslp__bot.is-soon { opacity: .58; }
.botslp__bot.is-soon:hover { transform: none; border-color: var(--line); }
.botslp__bot header { display: flex; gap: 14px; align-items: flex-start; }
.botslp__bot__icon {
  width: 44px;
  height: 44px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
}
.botslp__bot__icon svg { width: 20px; height: 20px; color: var(--accent-lo); }
.botslp__bot h3 { margin: 0 0 4px; font-size: 18px; }
.botslp__bot header p { margin: 0; color: var(--gray); font-size: 13px; line-height: 1.6; }

.botslp__feats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 9px;
}
.botslp__feats li {
  display: flex;
  gap: 9px;
  align-items: baseline;
  font-size: 13.5px;
  color: var(--gray);
  line-height: 1.6;
}
.botslp__feats svg { width: 10px; height: 10px; flex: none; color: var(--accent); transform: translateY(1px); }

.botslp__plans {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: auto;
}
.botslp__plan {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 10px 8px;
  text-align: center;
}
.botslp__plan i {
  display: block;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gray-dim);
  margin-bottom: 4px;
}
.botslp__plan b { font-size: 14px; }
.botslp__bot footer { display: flex; }
.botslp__bot footer .btn { flex: 1; justify-content: center; min-height: 44px; }

/* ---------- control grid ---------- */

.botslp__ctrl { padding: 110px 0 40px; }
.botslp__ctrlgrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 14px;
  margin-top: 44px;
}
.botslp__ctrlcell {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 22px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .015), transparent);
}
.botslp__ctrlcell svg { width: 20px; height: 20px; color: var(--accent-lo); }
.botslp__ctrlcell h3 { margin: 14px 0 6px; font-size: 15.5px; }
.botslp__ctrlcell p { margin: 0; color: var(--gray); font-size: 13px; line-height: 1.7; }

/* ---------- closer ---------- */

.botslp__close { padding: 130px 0 150px; text-align: center; }
.botslp__close .display { max-width: none; }
.botslp__close .lede { margin: 20px auto 30px; }
.botslp__close .hero__cta { justify-content: center; }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .botslp__stage { grid-template-columns: 1fr; gap: 0; }
  .botslp__pin { position: sticky; top: 74px; z-index: 2; }
  .botslp__mock { box-shadow: 0 18px 50px rgba(0, 0, 0, .6); }
  .botslp__steps { gap: 22vh; padding: 10vh 0 16vh; }
  .botslp__step { background: rgba(5, 5, 5, .72); backdrop-filter: blur(6px); border-radius: var(--r-sm); padding: 6px 2px; }
}
@media (max-width: 520px) {
  .botslp__mock__kpis { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .botslp__mock__kpis > div { padding: 8px 6px; }
  .botslp__mock__logs pre { min-height: 92px; font-size: 9.5px; }
  .botslp__story, .botslp__bots, .botslp__ctrl { padding-top: 80px; }
}
@media (prefers-reduced-motion: reduce) {
  .botslp__bot, .botslp__step, .botslp__mock { transition: none; }
}

/* ============================================================
   Polish pass — command cards, motion, micro-interactions.
   Every animation respects prefers-reduced-motion at the end.
   ============================================================ */

/* ---------- command cards ---------- */

.bots__cmds {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 860px) { .bots__cmds { grid-template-columns: repeat(2, 1fr); } }

.bots__cmd {
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  padding: 14px 16px;
  transition: border-color .25s, opacity .25s, transform .25s;
}
.bots__cmd:hover { border-color: rgba(139, 92, 255, .3); }
.bots__cmd:not(.is-on) { opacity: .55; }
.bots__cmd:not(.is-on) .bots__cmd__body { display: none; }

.bots__cmd__head {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.bots__cmd__head input { position: absolute; opacity: 0; width: 0; height: 0; }
.bots__cmd__name {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--accent-lo);
  background: var(--accent-dim);
  border-radius: 6px;
  padding: 3px 8px;
  flex: none;
}
.bots__cmd__label {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bots__cmd__head input:checked + .bots__switch,
.bots__cmd__head input:checked ~ .bots__switch {
  background: var(--accent-dim);
  border-color: var(--accent);
}
.bots__cmd__head input:checked ~ .bots__switch::after {
  background: var(--accent-lo);
  transform: translateX(18px);
}
[dir="rtl"] .bots__cmd__head input:checked ~ .bots__switch::after { transform: translateX(-18px); }

.bots__cmd__desc {
  margin: 8px 0 0;
  font-size: 12.5px;
  color: var(--gray-dim);
  line-height: 1.6;
}
.bots__cmd__body {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line-soft);
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  animation: botsUnfold .3s ease both;
}
@keyframes botsUnfold {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}
.bots__cmd__body textarea { min-height: 58px; font-family: var(--font-mono); font-size: 11.5px; }

/* ---------- modal motion ---------- */

.bots__modal { animation: botsFade .18s ease both; }
.bots__modal__card { animation: botsPop .26s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes botsFade { from { opacity: 0; } }
@keyframes botsPop  { from { opacity: 0; transform: translateY(14px) scale(.97); } }

/* ---------- status dot: alive when running ---------- */

.bots__dot--running { animation: botsBreathe 2.2s ease-in-out infinite; }
@keyframes botsBreathe {
  0%, 100% { box-shadow: 0 0 6px rgba(74, 222, 128, .55); }
  50%      { box-shadow: 0 0 13px rgba(74, 222, 128, .85); }
}

/* ---------- buttons & fields: press + focus feel ---------- */

.bots .btn, .botslp .btn { transition: transform .15s, border-color .2s, background .2s; }
.bots .btn:active, .botslp .btn:active { transform: scale(.97); }
.bots__field input, .bots__field select, .bots__field textarea {
  transition: border-color .2s, box-shadow .2s;
}
.bots__field input:focus, .bots__field select:focus, .bots__field textarea:focus {
  box-shadow: 0 0 0 3px rgba(139, 92, 255, .12);
}
.bots__plan, .bots__server { transition: border-color .2s, background .2s, transform .15s; }
.bots__plan:hover, .bots__server:hover { border-color: rgba(139, 92, 255, .4); }
.bots__plan:active, .bots__server:active { transform: scale(.98); }

/* ---------- skeleton shimmer while servers load ---------- */

.bots__skel {
  height: 44px;
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--surface) 25%, var(--card) 45%, var(--surface) 65%);
  background-size: 220% 100%;
  animation: botsShimmer 1.1s linear infinite;
}
@keyframes botsShimmer { to { background-position: -120% 0; } }

/* ---------- saved flash: settle, don't shout ---------- */

.flash[data-pulse] { animation: botsSettle .5s ease both; }
@keyframes botsSettle { from { opacity: 0; transform: translateY(-6px); } }

/* ---------- logs: soft reveal on refresh ---------- */

.bots__logs, .botslp__mock__logs pre { transition: opacity .2s; }
.bots__logs.is-loading { opacity: .4; }

/* ---------- reduced motion: states still switch, nothing moves ---------- */

@media (prefers-reduced-motion: reduce) {
  .bots__modal, .bots__modal__card, .bots__cmd__body,
  .bots__dot--running, .bots__skel, .flash[data-pulse] { animation: none; }
  .bots .btn, .botslp .btn, .bots__plan, .bots__server, .bots__cmd { transition: none; }
}

/* ============================================================
   The card designer — a live, draggable preview of the card
   the bot will actually render. Stage is 3:1 like the card.
   ============================================================ */

.bots__dz { display: flex; flex-direction: column; gap: 14px; }

.bots__dz__tabs { display: flex; gap: 8px; }
.bots__dz__tab {
  font: inherit;
  font-size: 12.5px;
  color: var(--gray);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 8px 18px;
  cursor: pointer;
  transition: border-color .2s, color .2s, background .2s;
}
.bots__dz__tab.on { color: var(--white); border-color: var(--accent); background: var(--accent-dim); }

.bots__dz__stage {
  position: relative;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background:
    linear-gradient(45deg, #101010 25%, transparent 25%, transparent 75%, #101010 75%),
    linear-gradient(45deg, #101010 25%, #0b0b0b 25%, #0b0b0b 75%, #101010 75%);
  background-size: 22px 22px;
  background-position: 0 0, 11px 11px;   /* checker: "this area is the image" */
  overflow: hidden;
  touch-action: none;                    /* the stage owns its gestures */
  user-select: none;
}
.bots__dz__bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.bots__dz__box {
  position: absolute;
  inset: 7%;
  background: rgba(0, 0, 0, .52);
  border-radius: 14px;
  backdrop-filter: blur(2px);
}

.bots__dz__el {
  position: absolute;
  cursor: grab;
  transition: box-shadow .15s;
  will-change: transform;
}
.bots__dz__el:active { cursor: grabbing; }
.bots__dz__el.on { z-index: 3; }
.bots__dz__el.on::after {
  content: '';
  position: absolute;
  inset: -6px;
  border: 1.5px dashed var(--accent);
  border-radius: 10px;
  pointer-events: none;
}
.bots__dz__el--avatar img {
  width: 92px;
  height: 92px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .85);
  background: var(--card);
  display: block;
  pointer-events: none;
}
.bots__dz__el--avatar.on::after { border-radius: 50%; }
.bots__dz__el--name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 26px;
  color: #fff;
  text-shadow: 0 2px 10px rgba(0, 0, 0, .6);
  white-space: nowrap;
}
.bots__dz__el--message {
  font-size: 15px;
  color: rgba(255, 255, 255, .82);
  text-shadow: 0 1px 8px rgba(0, 0, 0, .6);
  white-space: nowrap;
}

.bots__dz__ctl {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 14px;
}
.bots__dz__ctl input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
  min-height: 30px;
}

.bots__dz__fine { margin-top: 14px; }
.bots__dz__fine summary {
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 10.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gray-dim);
  padding: 6px 0;
}
.bots__dz__fine[open] summary { color: var(--gray); }
.bots__dz__fine .bots__fields { margin-top: 12px; }
.bots__dz__fine .bots__field > span { font-family: var(--font-mono); font-size: 10.5px; color: var(--gray-dim); }

@media (max-width: 640px) {
  .bots__dz__el--name { font-size: 18px; }
  .bots__dz__el--message { font-size: 12px; }
  .bots__dz__el--avatar img { width: 64px; height: 64px; }
  .bots__dz__ctl { flex-direction: column; align-items: stretch; }
}
@media (prefers-reduced-motion: reduce) {
  .bots__dz__tab, .bots__dz__el { transition: none; }
}

/* ============================================================
   Live pickers — chips + searchable dropdown fed by the guild.
   The raw input hides behind the face but stays in the form.
   ============================================================ */

.bots__pick { position: relative; }
.bots__pick__raw { display: none !important; }

.bots__pick__face {
  width: 100%;
  min-height: 44px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 7px 36px 7px 10px;
  cursor: pointer;
  font: inherit;
  text-align: start;
  transition: border-color .2s, box-shadow .2s;
}
[dir="rtl"] .bots__pick__face { padding: 7px 10px 7px 36px; }
.bots__pick__face:hover { border-color: rgba(139, 92, 255, .4); }
.bots__pick__face:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(139, 92, 255, .12);
}
.bots__pick__face.is-loading { opacity: .6; pointer-events: none; }

.bots__pick__ph { color: var(--gray-dim); font-size: 13px; }
.bots__pick__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-dim);
  border: 1px solid rgba(139, 92, 255, .3);
  color: var(--accent-lo);
  border-radius: 99px;
  padding: 3px 10px;
  font-size: 12px;
  font-family: var(--font-mono);
  direction: ltr;
  max-width: 100%;
}
.bots__pick__chip i {
  font-style: normal;
  cursor: pointer;
  color: var(--gray);
  padding: 0 2px;
}
.bots__pick__chip i:hover { color: #fff; }
.bots__pick__caret {
  position: absolute;
  inset-inline-end: 14px;
  top: 50%;
  width: 8px;
  height: 8px;
  border-inline-end: 1.5px solid var(--gray-dim);
  border-block-end: 1.5px solid var(--gray-dim);
  transform: translateY(-70%) rotate(45deg);
  pointer-events: none;
}
.bots__pick__note { display: block; margin-top: 6px; color: #ff9c9c; font-size: 12px; }

.bots__dd {
  position: absolute;
  z-index: 30;
  inset-inline: 0;
  top: calc(100% + 6px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: 0 22px 60px rgba(0, 0, 0, .6);
  padding: 8px;
  animation: botsPop .2s cubic-bezier(.2, .9, .3, 1.1) both;
}
.bots__dd__search {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--white);
  padding: 9px 12px;
  font: inherit;
  font-size: 13px;
  margin-bottom: 6px;
}
.bots__dd__search:focus { outline: none; border-color: var(--accent); }
.bots__dd__list {
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}
.bots__dd__item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  background: none;
  border: 0;
  border-radius: 8px;
  color: var(--white);
  padding: 9px 10px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  text-align: start;
  direction: ltr;
}
.bots__dd__item:hover { background: var(--surface); }
.bots__dd__item.on { background: var(--accent-dim); color: var(--accent-lo); }
.bots__dd__item i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex: none;
}
.bots__dd__item span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) { .bots__dd { animation: none; } }

/* ============================================================
   Layering fix, floating save, image pickers.
   ============================================================ */

/* an open dropdown lifts its whole tile above the sections after it */
.tile { position: relative; }
.tile.is-picking { z-index: 50; }

/* the save button rides along as you scroll the long settings form */
.bots__save {
  position: sticky;
  bottom: 16px;
  z-index: 40;
  align-self: flex-end;
  background: rgba(10, 10, 10, .8);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 10px 12px;
  box-shadow: 0 16px 44px rgba(0, 0, 0, .5);
}
.bots__save .btn { min-height: 44px; }
@media (max-width: 520px) {
  .bots__save { align-self: stretch; border-radius: var(--r-md); }
}

/* image pickers: thumb + choose + clear */
.bots__file {
  display: flex;
  align-items: center;
  gap: 10px;
}
.bots__file__thumb {
  border: 1px solid var(--line);
  background: var(--surface);
  object-fit: cover;
  flex: none;
}
.bots__file__thumb--round { width: 46px; height: 46px; border-radius: 50%; }
.bots__file__thumb--wide  { width: 92px; height: 34px; border-radius: 8px; }
.bots__file__clear {
  background: none;
  border: 1px solid var(--line);
  border-radius: 50%;
  width: 28px;
  height: 28px;
  color: var(--gray);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  flex: none;
}
.bots__file__clear:hover { color: #fff; border-color: rgba(255, 96, 96, .5); }

/* ---------- ticket reasons repeater ---------- */
.bots__reasons { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.bots__reasons__rows { display: flex; flex-direction: column; gap: 8px; width: 100%; }
.bots__reasons__row {
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) minmax(0, 1.3fr) 30px;
  gap: 8px;
  align-items: center;
  animation: botsUnfold .25s ease both;
}
.bots__reasons__row input {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--white);
  padding: 10px 12px;
  font: inherit;
  font-size: 13px;
  min-height: 42px;
  width: 100%;
}
.bots__reasons__row input:focus { outline: none; border-color: var(--accent); }
.bots__reasons__emoji { text-align: center; }
@media (max-width: 640px) {
  .bots__reasons__row { grid-template-columns: 46px 1fr 28px; }
  .bots__reasons__desc { grid-column: 1 / -1; }
}

/* ---------- emoji fields ---------- */

.bots__emoji { position: relative; display: flex; align-items: center; gap: 10px; }
.bots__emoji__view {
  width: 46px;
  height: 46px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 22px;
  line-height: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
}
.bots__emoji__view img { width: 28px; height: 28px; object-fit: contain; }
.bots__emoji__view.is-busy { opacity: .45; }

.bots__dd__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
  gap: 4px;
  max-height: 190px;
  overflow-y: auto;
  margin-top: 6px;
}
.bots__dd__emoji {
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 6px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.bots__dd__emoji:hover { background: var(--surface); border-color: var(--line); }
.bots__dd__emoji img { width: 26px; height: 26px; object-fit: contain; }

/* reason rows: the emoji cell is now a picker */
.bots__reasons__emoji { position: relative; }
.bots__reasons__eface {
  width: 100%;
  min-height: 42px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--white);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.bots__reasons__eface:hover { border-color: rgba(139, 92, 255, .4); }
.bots__reasons__eface img { width: 24px; height: 24px; object-fit: contain; }
.bots__reasons__eface.is-busy { opacity: .45; }

/* ---------- emoji modal ----------
   A centred dialog rather than a dropdown: the emoji cell is only ~50px wide,
   so anchoring a 320px panel to it fought both edges of the screen and the
   rows underneath. Centring removes the whole class of problem. */

.bots__modal--emoji .bots__modal__card {
  width: min(420px, 100%);
  gap: 12px;
}
.bots__em__up {
  width: 100%;
  justify-content: center;
  min-height: 46px;
}
.bots__modal--emoji .bots__dd__search {
  width: 100%;
  margin: 0;
  min-height: 44px;
}
.bots__modal--emoji .bots__dd__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 6px;
  max-height: 46vh;
  overflow-y: auto;
  margin: 0;
  padding-top: 4px;
  border-top: 1px solid var(--line-soft);
}
.bots__modal--emoji .bots__dd__emoji {
  min-height: 46px;
  border: 1px solid var(--line-soft);
  background: var(--surface);
}
.bots__modal--emoji .bots__dd__emoji:hover { border-color: var(--accent); }
.bots__modal--emoji .bots__dd__emoji img { width: 28px; height: 28px; }
.bots__modal--emoji .flash--err { margin: 0; font-size: 12.5px; }

/* the reason row's emoji cell — a clean square button, nothing anchored to it */
.bots__reasons__emoji { position: static; }

/* a field the server rejected — outlined and scrolled to on save */
.is-bad input, .is-bad select, .is-bad textarea, .is-bad .bots__pick__face {
  border-color: rgba(255, 96, 96, .7) !important;
  box-shadow: 0 0 0 3px rgba(255, 96, 96, .12) !important;
}
.is-bad > span { color: #ff9c9c; }
