/* Auto-reply to Reel comments */

.ar-page { display: flex; flex-direction: column; gap: 20px; }
.ar-page .card { margin-bottom: 0; }
.ar-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 16px; }
.ar-title { font-size: 22px; gap: 10px; }
.ar-hero-actions { display: flex; align-items: flex-end; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.ar-account { display: flex; flex-direction: column; gap: 4px; margin: 0; }
.ar-account[hidden] { display: none; }
.ar-account select { width: auto; min-width: 180px; padding: 8px 12px; }
.ar-title-icon { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(52, 211, 153, 0.15); color: #34d399; flex: none; }
.ar-lede { margin: 6px 0 0; font-size: 13.5px; color: var(--text-muted); max-width: 68ch; }
.ar-muted { color: var(--text-muted); font-size: 13px; }
.ar-small { font-size: 12px; }
.ar-error { color: #fb7185; font-size: 13px; margin: 8px 0 0; }

.ar-notice {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-radius: var(--radius-md); font-size: 13.5px;
  background: rgba(99, 102, 241, 0.1); border: 1px solid rgba(99, 102, 241, 0.3); color: var(--text-main);
}
.ar-notice[hidden] { display: none; }
.ar-notice-problem { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.35); }

.ar-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1100px) { .ar-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.ar-stat {
  background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg);
  padding: 14px 18px; display: flex; flex-direction: column; gap: 4px; min-width: 0;
}
.ar-stat-label { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.ar-stat-value { font-size: 24px; font-weight: 800; color: var(--text-main); font-variant-numeric: tabular-nums; }
.ar-stat-small { font-size: 15px; font-weight: 700; }
.ar-stat-sub { font-size: 12px; color: var(--text-faint); }

.ar-reels { display: flex; flex-direction: column; gap: 10px; }
.ar-reel { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-card-elevated); }
.ar-reel.open { border-color: rgba(99, 102, 241, 0.45); }
.ar-reel-row { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 12px; }
.ar-thumb { width: 54px; height: 72px; border-radius: 8px; object-fit: cover; display: block; background: var(--bg-input); }
.ar-thumb-empty { background: linear-gradient(160deg, #6366f1, #ec4899); opacity: 0.6; }
.ar-reel-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ar-reel-caption { font-weight: 600; font-size: 14px; color: var(--text-main); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-reel-meta { font-size: 12px; color: var(--text-faint); }
.ar-reel-meta a { color: var(--text-muted); }
.ar-reel-summary { font-size: 12.5px; color: var(--text-muted); overflow-wrap: anywhere; }
.ar-reel-side { display: flex; align-items: center; gap: 10px; }

.ar-chip {
  display: inline-block; font-size: 11.5px; font-weight: 600; padding: 4px 9px; border-radius: 999px; white-space: nowrap;
  background: var(--secondary); color: var(--text-muted); border: 1px solid var(--border-subtle);
}
.ar-chip-on, .ar-status-sent { background: rgba(52, 211, 153, 0.14); color: #34d399; border-color: rgba(52, 211, 153, 0.3); }
.ar-chip-problem, .ar-status-partial { background: rgba(245, 158, 11, 0.14); color: #fbbf24; border-color: rgba(245, 158, 11, 0.3); }
.ar-status-failed { background: rgba(244, 63, 94, 0.14); color: #fb7185; border-color: rgba(244, 63, 94, 0.3); }

.ar-editor { border-top: 1px solid var(--border-subtle); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.ar-group { border: 1px solid var(--border-subtle); border-radius: var(--radius-md); padding: 4px 14px 14px; margin: 0; min-width: 0; }
.ar-group legend { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); padding: 0 6px; }
.ar-hint { display: block; font-size: 12px; color: var(--text-faint); margin-top: 6px; }

.ar-switch, .ar-check { display: flex; align-items: flex-start; gap: 10px; margin: 0; cursor: pointer; font-weight: 500; color: var(--text-main); }
.ar-switch small, .ar-check small { display: block; font-size: 12px; color: var(--text-faint); font-weight: 400; margin-top: 2px; }
.ar-check input { width: 16px; height: 16px; margin-top: 2px; flex: none; accent-color: var(--primary); }
.card-header .ar-check { font-size: 13px; color: var(--text-muted); align-items: center; }
.ar-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.ar-switch-track { position: relative; width: 40px; height: 22px; border-radius: 999px; background: var(--secondary-hover); flex: none; transition: var(--transition); }
.ar-switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: var(--transition); }
.ar-switch input:checked + .ar-switch-track { background: #10b981; }
.ar-switch input:checked + .ar-switch-track::after { transform: translateX(18px); }
.ar-switch input:focus-visible + .ar-switch-track { box-shadow: 0 0 0 3px var(--primary-glow); }

.ar-test label { margin-top: 0; }
.ar-test-row { display: flex; gap: 8px; }
.ar-test-row input { flex: 1; min-width: 0; }
.ar-test-result { margin-top: 8px; padding: 10px 12px; border-radius: var(--radius-md); font-size: 13px; display: flex; flex-direction: column; gap: 4px; background: var(--bg-input); border: 1px solid var(--border-subtle); }
.ar-test-result[hidden] { display: none; }
.ar-test-keyword, .ar-test-ai { border-color: rgba(52, 211, 153, 0.35); }

.ar-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

.ar-history { display: flex; flex-direction: column; }
.ar-entry { padding: 12px 0; border-bottom: 1px solid var(--border-subtle); display: flex; flex-direction: column; gap: 4px; font-size: 13.5px; min-width: 0; }
.ar-entry:last-child { border-bottom: 0; }
.ar-entry-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ar-entry-comment { color: var(--text-main); overflow-wrap: anywhere; }
.ar-entry-reply { color: var(--text-muted); overflow-wrap: anywhere; }

@media (max-width: 640px) {
  .ar-reel-row { grid-template-columns: 44px minmax(0, 1fr); }
  .ar-thumb { width: 44px; height: 58px; }
  .ar-reel-side { grid-column: 1 / -1; justify-content: space-between; }
  .ar-hero { grid-template-columns: minmax(0, 1fr); }
  .ar-hero .btn { width: 100%; }
  .ar-hero-actions { justify-content: stretch; }
  .ar-account, .ar-account select { width: 100%; }
}

/* Suggested public replies */
.ar-suggest { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; align-items: center; }
.ar-suggest-label { font-size: 12px; color: var(--text-faint); margin-right: 2px; }
button.ar-suggest-chip {
  font: inherit; font-size: 12px; padding: 5px 10px; border-radius: 999px; cursor: pointer;
  background: var(--bg-input); color: var(--text-muted); border: 1px solid var(--border-subtle);
  max-width: 100%; text-align: left; transition: var(--transition);
}
button.ar-suggest-chip:hover, button.ar-suggest-chip:focus-visible { color: var(--text-main); border-color: rgba(52, 211, 153, 0.5); background: rgba(52, 211, 153, 0.08); }

/* Link button under the private message, and a preview of the DM */
.ar-button-fields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 10px; }
.ar-button-fields label { margin-top: 10px; }
.ar-optional { font-weight: 400; color: var(--text-faint); }
.ar-dm-preview { margin-top: 12px; display: grid; gap: 6px; }
.ar-dm-preview[hidden] { display: none; }
.ar-dm-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-faint); }
.ar-dm-bubble { max-width: 300px; border-radius: 18px; overflow: hidden; background: #262a35; border: 1px solid var(--border-subtle); }
.ar-dm-text { padding: 10px 14px; font-size: 13.5px; line-height: 1.45; color: #f1f5f9; white-space: pre-wrap; overflow-wrap: anywhere; }
.ar-dm-button { padding: 10px 14px; text-align: center; font-size: 13.5px; font-weight: 600; color: #60a5fa; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.ar-dm-button[hidden] { display: none; }
@media (max-width: 560px) { .ar-button-fields { grid-template-columns: minmax(0, 1fr); } }

/* "What the commenter sees": the comment thread and the private message */
.ar-preview { display: grid; gap: 8px; }
.ar-preview[hidden] { display: none; }
.ar-preview-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.ar-phone { background: #0b0d14; border: 1px solid var(--border-subtle); border-radius: 16px; padding: 12px; display: grid; gap: 10px; align-content: start; min-width: 0; }
.ar-phone-head { font-size: 12px; font-weight: 700; color: var(--text-muted); text-align: center; padding-bottom: 8px; border-bottom: 1px solid rgba(255, 255, 255, 0.06); }
.ar-comment { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 8px; font-size: 13px; color: #e2e8f0; line-height: 1.4; }
.ar-comment[hidden] { display: none; }
.ar-comment.reply { margin-left: 30px; }
.ar-comment strong { color: #fff; }
.ar-comment-text { overflow-wrap: anywhere; }
.ar-comment-meta { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.ar-avatar { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; background: #475569; }
.ar-avatar.you { background: linear-gradient(135deg, #f09433, #dc2743, #bc1888); }
.ar-phone .ar-dm-bubble { max-width: 100%; justify-self: start; }
.ar-phone .ar-dm-bubble[hidden], .ar-dm-empty[hidden] { display: none; }
.ar-dm-empty { font-size: 12.5px; color: var(--text-faint); text-align: center; padding: 16px 0; }
@media (max-width: 640px) { .ar-preview-grid { grid-template-columns: minmax(0, 1fr); } }
