/* Flow Mini App — Автоответ */

.reply-mark {
  background: linear-gradient(135deg, #7f6cf0, var(--flow) 55%, #3fb8a8);
}

.reply-root {
  padding-bottom: 8px;
}

/* ---------- Главная карточка ---------- */
.ar-hero {
  margin: 4px 14px 0;
  padding: 18px 16px 16px;
  border-radius: 22px;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background 0.3s ease, box-shadow 0.3s ease;
}

.ar-hero .hero-row {
  padding: 0 2px;
}

.ar-hero.is-on {
  background:
    radial-gradient(120% 140% at 100% 0%, rgba(139, 92, 246, 0.2), transparent 55%),
    radial-gradient(120% 140% at 0% 100%, rgba(var(--flow-rgb), 0.18), transparent 60%),
    var(--surface);
  box-shadow: inset 0 0 0 1px rgba(var(--flow-rgb), 0.32);
}

.ar-hero.is-on .hero-sub {
  color: var(--flow);
  font-weight: 600;
}

/* ---------- Кто отвечает ---------- */
.ar-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 16px;
}

.ar-mode {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 12px 12px 13px;
  border-radius: 16px;
  text-align: left;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: box-shadow 0.2s var(--ease), background 0.2s var(--ease), transform 0.12s ease;
}

.ar-mode:active {
  transform: scale(0.98);
}

.ar-mode.on {
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--flow);
}

.ar-mode-ico {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  margin-bottom: 8px;
  border-radius: 11px;
  color: var(--ink-2);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: color 0.2s ease, background 0.2s ease;
}

.ar-mode.on .ar-mode-ico {
  color: #fff;
  background: var(--flow);
  box-shadow: none;
}

.ar-mode[data-mode='twin'].on .ar-mode-ico {
  background: linear-gradient(135deg, #8b5cf6, var(--flow));
}

.ar-mode-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}

.ar-mode-desc {
  font-size: 12.5px;
  color: var(--ink-3);
}

.ar-mode-check {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  background: var(--flow);
  opacity: 0;
  transform: scale(0.6);
  transition: opacity 0.2s ease, transform 0.2s var(--ease);
}

.ar-mode.on .ar-mode-check {
  opacity: 1;
  transform: scale(1);
}

.ar-mode.locked .ar-mode-check {
  display: none;
}

.ar-mode-title {
  white-space: nowrap;
}

.ar-tag {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #fff;
  background: linear-gradient(135deg, #8b5cf6, var(--flow));
}

/* ---------- Предупреждение о подключении ---------- */
.ar-warn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: calc(100% - 28px);
  margin: 4px 14px 10px;
  padding: 12px 14px;
  border-radius: 18px;
  text-align: left;
  background: var(--amber-soft);
}

.ar-warn-ico {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  color: #fff;
  background: var(--amber);
}

.ar-warn-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.ar-warn-body b {
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink);
}

.ar-warn-body small {
  font-size: 12.5px;
  line-height: 1.4;
  color: var(--ink-2);
}

.ar-alert {
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--amber);
  background: var(--amber-soft);
  box-shadow: none;
}

.ar-lock {
  margin-top: 0;
}

/* ---------- Текст ответа как переписка ---------- */
.ar-chat {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 12px 10px;
}

.ar-in,
.ar-out {
  max-width: 86%;
  border-radius: 18px;
  font-size: 15px;
  line-height: 1.4;
}

.ar-in {
  align-self: flex-start;
  padding: 8px 13px;
  border-bottom-left-radius: 6px;
  color: var(--ink);
  background: var(--surface-2);
}

.ar-out {
  align-self: flex-end;
  width: 86%;
  padding: 2px;
  border-bottom-right-radius: 6px;
  background: var(--bubble-out);
  box-shadow: inset 0 0 0 1.5px transparent;
  transition: box-shadow 0.2s ease;
}

.ar-out:focus-within {
  box-shadow: inset 0 0 0 1.5px var(--flow);
}

.ar-out textarea {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 7px 11px;
  border: 0;
  resize: none;
  font: inherit;
  color: var(--ink);
  background: transparent;
  outline: none;
}

.ar-out textarea::placeholder {
  color: var(--ink-3);
}

.ar-saved {
  align-self: flex-end;
  margin: 2px 4px 0;
  font-size: 12px;
  color: var(--ink-3);
}

.ar-saved.bad {
  color: var(--caught);
}

/* ---------- Ночной режим ---------- */
.ar-rules {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.ar-rule {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 10px 10px 10px;
  border-radius: 14px;
  background: var(--surface-2);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.ar-rule.leaving {
  opacity: 0;
  transform: scale(0.96);
}

.ar-time {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #fff;
  background: linear-gradient(135deg, #6d5bd0, #3b4fd8);
}

.ar-rule-text {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  line-height: 1.35;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}

.ar-empty {
  padding: 14px 12px;
  border-radius: 14px;
  text-align: center;
  font-size: 13.5px;
  color: var(--ink-3);
  background: var(--surface-2);
}

.ar-add {
  width: 100%;
  margin-top: 12px;
}

.ar-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.ar-times {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ar-times label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ar-times label span {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-3);
}

.ar-times .field {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.ar-form .btn-row {
  margin-top: 4px;
}

/* ---------- Заметка ---------- */
.ar-note {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-3);
}

.ar-note svg {
  flex-shrink: 0;
}
.ar-form .field { margin-top: 0; }
