/* Telegram Auto — modern macOS software UI (responsive) */
:root {
  --ios-bg: #ffffff;
  --ios-elevated: rgba(255, 255, 255, 0.86);
  --ios-card: #ffffff;
  --ios-ink: #1d1d1f;
  --ios-muted: #6e6e73;
  --ios-separator: rgba(0, 0, 0, 0.08);
  --ios-blue: #3b5998;
  --ios-blue-press: #2d4373;
  --ios-green: #28c840;
  --ios-red: #ff5f57;
  --ios-orange: #febc2e;
  --ios-fill: #f2f2f7;
  --ios-bubble-ai: #f5f5f7;
  --ios-bubble-user: #3b5998;
  --ios-shadow: 0 22px 60px rgba(0, 0, 0, 0.18), 0 2px 8px rgba(0, 0, 0, 0.06);
  --ios-radius: 12px;
  --ios-radius-sm: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", system-ui, sans-serif;
  --phone-max: 920px;
  --fb-blue: #3b5998;
  --fb-blue-soft: rgba(59, 89, 152, 0.12);
  --fb-mist: #f5f5f7;
  --mac-title: linear-gradient(180deg, #f6f6f6 0%, #ececec 100%);
  --mac-toolbar: rgba(246, 246, 246, 0.92);
  --mac-border: rgba(0, 0, 0, 0.12);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  color: var(--ios-ink);
  background: #e8e8ed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

.trial-seo {
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 20px 48px;
  color: #4b4f56;
  font-size: 0.95rem;
  line-height: 1.6;
}
.trial-seo h1 {
  color: var(--ios-ink);
  font-size: 1.45rem;
  letter-spacing: -0.03em;
  margin: 0 0 0.65rem;
}
.trial-seo h2 {
  color: var(--ios-ink);
  font-size: 1.05rem;
  margin: 1.35rem 0 0.4rem;
}
.trial-seo a { color: var(--fb-blue); }
.trial-seo .cite {
  background: #fff;
  border: 1px solid var(--ios-separator);
  border-radius: 10px;
  padding: 0.95rem 1.05rem;
  margin: 0.85rem 0 0;
}
.trial-seo ul { margin: 0.4rem 0 0; padding-left: 1.15rem; }
.trial-seo li { margin: 0.25rem 0; }

a { color: var(--ios-blue); text-decoration: none; }

.ios-stage {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 28px 20px;
  background:
    radial-gradient(1200px 700px at 20% 0%, #d7deea 0%, transparent 55%),
    radial-gradient(900px 600px at 90% 100%, #cfd6e4 0%, transparent 50%),
    linear-gradient(165deg, #eceff4 0%, #e3e7ef 45%, #d9dee8 100%);
}

.ios-phone {
  width: min(100%, var(--phone-max));
  height: min(100dvh - 56px, 780px);
  max-height: 100dvh;
  background: var(--ios-bg);
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  isolation: isolate;
  border: 1px solid rgba(0, 0, 0, 0.14);
  box-shadow: var(--ios-shadow);
  display: flex;
  flex-direction: column;
}

.ios-status {
  height: 44px;
  padding: 0 14px 0 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ios-muted);
  background: var(--mac-title);
  border-bottom: 1px solid var(--mac-border);
  position: relative;
  flex-shrink: 0;
  z-index: 30;
  order: 1;
}

.ios-status::before {
  content: "";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  width: 52px;
  height: 12px;
  background:
    radial-gradient(circle closest-side at 6px 6px, #ff5f57 0 5.2px, transparent 5.5px),
    radial-gradient(circle closest-side at 24px 6px, #febc2e 0 5.2px, transparent 5.5px),
    radial-gradient(circle closest-side at 42px 6px, #28c840 0 5.2px, transparent 5.5px);
  pointer-events: none;
}

.ios-status .time {
  font-variant-numeric: tabular-nums;
  color: var(--ios-ink);
  font-weight: 600;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
}
.ios-status .pills {
  display: flex;
  gap: 6px;
  margin-left: auto;
  color: var(--ios-muted);
  font-size: 0.72rem;
  font-weight: 600;
  background: rgba(0,0,0,0.04);
  border-radius: 999px;
  padding: 3px 10px;
}
.ios-status .pills:empty { display: none; }

.ios-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: var(--mac-toolbar);
  backdrop-filter: saturate(180%) blur(20px);
  color: var(--ios-ink);
  border-bottom: 1px solid var(--mac-border);
  flex-shrink: 0;
  order: 2;
}

.ios-nav h1 {
  margin: 0;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
  font-weight: 700;
  color: var(--ios-ink);
}

.ios-nav .sub {
  margin: 1px 0 0;
  color: var(--ios-muted);
  font-size: 0.78rem;
  font-weight: 500;
}

.ios-nav .sub a { color: var(--fb-blue); }

.ios-nav .nav-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.ios-nav .nav-logo {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(27, 143, 212, 0.35);
}
.ios-nav .nav-brand > div { min-width: 0; }

.ios-icon-btn {
  width: 28px;
  height: 28px;
  border: 1px solid var(--mac-border);
  border-radius: 7px;
  background: #fff;
  color: var(--ios-ink);
  display: grid;
  place-items: center;
  cursor: pointer;
  font-size: 0.95rem;
  box-shadow: 0 1px 0 rgba(255,255,255,0.8) inset;
}
.ios-icon-btn:hover { background: #f7f7f8; }

.ios-body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px 20px 20px;
  scroll-behavior: smooth;
  background: #ffffff;
  order: 4;
}

.ios-phone:has(.tabbar) .ios-body {
  padding-bottom: 20px;
}

.agent-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 720px;
}

.bubble {
  max-width: 88%;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 0.94rem;
  line-height: 1.45;
  animation: rise 0.28s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.bubble.ai {
  align-self: flex-start;
  background: var(--ios-bubble-ai);
  color: var(--ios-ink);
  border: 1px solid var(--ios-separator);
  box-shadow: none;
}

.bubble.user {
  align-self: flex-end;
  background: var(--ios-bubble-user);
  color: #fff;
  box-shadow: none;
}

.bubble .label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--fb-blue);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.bubble.user .label { color: rgba(255,255,255,0.75); }

.typing {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  padding: 4px 2px;
}
.typing span {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ios-muted);
  animation: blink 1.2s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.15s; }
.typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes blink {
  0%, 80%, 100% { opacity: 0.25; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-2px); }
}

.choice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip, .ios-btn {
  border: none;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.chip {
  padding: 7px 12px;
  border-radius: 7px;
  background: #fff;
  color: var(--fb-blue);
  border: 1px solid rgba(59, 89, 152, 0.28);
  box-shadow: 0 1px 0 rgba(255,255,255,0.9) inset;
}

.chip:hover { background: var(--fb-blue-soft); }
.chip:active, .ios-btn:active { transform: translateY(0.5px); }
.ios-btn:active { background: var(--ios-blue-press); }
.composer .send:active { background: var(--ios-blue-press); }

.ios-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 8px 16px;
  border-radius: 8px;
  background: var(--ios-blue);
  color: #fff;
  font-size: 0.92rem;
  box-shadow: 0 1px 0 rgba(255,255,255,0.15) inset;
}

.ios-btn.secondary {
  background: #fff;
  color: var(--ios-ink);
  border: 1px solid var(--mac-border);
}

.ios-btn.danger { background: var(--ios-red); }
.ios-btn:disabled { opacity: 0.45; }

.composer {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  max-width: none;
  transform: none;
  padding: 12px 16px 16px;
  background: var(--mac-toolbar);
  border-top: 1px solid var(--mac-border);
  backdrop-filter: saturate(180%) blur(16px);
  z-index: 80;
  box-sizing: border-box;
  order: 5;
}

body.ios-tool .composer {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, var(--phone-max));
  bottom: 0;
  z-index: 80;
  padding: 12px 16px calc(14px + var(--safe-bottom));
  border-left: 1px solid var(--mac-border);
  border-right: 1px solid var(--mac-border);
  border-radius: 0 0 12px 12px;
}

.ios-phone.tool-open .tabbar {
  display: none;
}

.ios-phone.tool-open .ios-frame {
  display: block;
  height: 100%;
}

.composer-inner {
  display: flex;
  gap: 8px;
  align-items: center;
  background: #fff;
  border-radius: 8px;
  padding: 6px 8px 6px 12px;
  box-shadow: none;
  border: 1px solid var(--mac-border);
  width: 100%;
  box-sizing: border-box;
}

.composer input[type="text"],
.composer input[type="email"],
.composer input[type="file"],
.composer textarea {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font: inherit;
  font-size: 0.94rem;
  padding: 6px 0;
  min-width: 0;
  color: var(--ios-ink);
}

.composer .send {
  width: 30px; height: 30px;
  border: none;
  border-radius: 7px;
  background: var(--ios-blue);
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
  flex-shrink: 0;
}

.tabbar {
  position: relative;
  left: auto; right: auto; bottom: auto;
  height: auto;
  min-height: 40px;
  margin: 0;
  border-radius: 0;
  background: var(--mac-toolbar);
  backdrop-filter: saturate(180%) blur(16px);
  border: none;
  border-bottom: 1px solid var(--mac-border);
  box-shadow: none;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 8px 12px;
  z-index: 25;
  overflow: hidden;
  order: 3;
  flex-shrink: 0;
}

.tabbar a, .tabbar button {
  border: 1px solid transparent;
  background: transparent;
  color: var(--ios-ink);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  text-decoration: none;
  border-radius: 7px;
  min-height: 30px;
  padding: 4px 8px;
}

.tabbar a:hover, .tabbar button:hover {
  background: rgba(0,0,0,0.04);
}

.tabbar .ico { font-size: 0.9rem; line-height: 1; }
.tabbar .active {
  color: var(--ios-ink);
  background: #fff;
  border-color: var(--mac-border);
  box-shadow: 0 1px 2px rgba(0,0,0,0.05);
}

.ios-card {
  background: var(--ios-card);
  border-radius: var(--ios-radius);
  padding: 16px;
  border: 1px solid var(--ios-separator);
  box-shadow: none;
}

.ios-list {
  background: var(--ios-card);
  border-radius: var(--ios-radius);
  overflow: hidden;
  border: 1px solid var(--ios-separator);
}

.ios-list a, .ios-list button.row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: none;
  background: #fff;
  border-bottom: 1px solid var(--ios-separator);
  text-align: left;
  font: inherit;
  color: var(--ios-ink);
  cursor: pointer;
  text-decoration: none;
}

.ios-list a:hover, .ios-list button.row:hover { background: #f7f7f8; }
.ios-list a:last-child, .ios-list button.row:last-child { border-bottom: none; }

.ios-list .glyph {
  width: 28px; height: 28px; border-radius: 7px;
  display: grid; place-items: center;
  color: #fff; font-size: 0.85rem; flex-shrink: 0;
}
.ios-list .glyph.blue { background: var(--ios-blue); }
.ios-list .glyph.green { background: var(--ios-green); }
.ios-list .glyph.orange { background: var(--ios-orange); }
.ios-list .glyph.purple { background: #af52de; }

.ios-list .meta { flex: 1; min-width: 0; }
.ios-list .meta strong { display: block; font-size: 0.92rem; font-weight: 650; }
.ios-list .meta span { color: var(--ios-muted); font-size: 0.78rem; }
.ios-list .chev { color: var(--ios-muted); }

.progress-pills {
  display: flex; gap: 6px; margin: 4px 0 12px;
}
.progress-pills i {
  height: 4px; flex: 1; border-radius: 2px; background: var(--ios-fill);
}
.progress-pills i.on { background: var(--ios-blue); }

.hidden { display: none !important; }

.ios-frame {
  flex: 1;
  width: 100%;
  border: none;
  background: var(--ios-bg);
  order: 4;
}

body.ios-tool {
  background: #e8e8ed !important;
  min-height: 100dvh;
  font-family: var(--font) !important;
}

body.ios-tool .centered-content,
body.ios-tool .page-wrap,
body.ios-tool .login-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 20px 18px 40px !important;
}

body.ios-tool .input-card,
body.ios-tool .page-card,
body.ios-tool .login-card,
body.ios-tool .modal-content,
body.ios-tool #modalContent {
  border: 1px solid var(--mac-border) !important;
  border-radius: 10px !important;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08) !important;
  background: #fff !important;
}

body.ios-tool .wide-text-input,
body.ios-tool input[type="text"],
body.ios-tool input[type="email"] {
  border-radius: 8px !important;
  border: 1px solid var(--mac-border) !important;
  background: #fff !important;
  padding: 10px 12px !important;
}

body.ios-tool .btn-next,
body.ios-tool .button-link,
body.ios-tool .btn,
body.ios-tool .redirect-button,
body.ios-tool .scrape-btn,
body.ios-tool .modal-buttons a,
body.ios-tool .modal-buttons button {
  border-radius: 8px !important;
  background: var(--ios-blue) !important;
  min-height: 36px;
  font-weight: 650 !important;
}

body.ios-tool .buy-btn {
  background: #fff !important;
  color: var(--ios-ink) !important;
  border: 1px solid var(--mac-border) !important;
}

@media (max-width: 720px) {
  .ios-stage {
    padding: 0;
    background: #e8e8ed;
  }
  .ios-phone {
    width: 100%;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
  body.ios-tool .composer {
    width: 100%;
    border-left: none;
    border-right: none;
    border-radius: 0;
  }
  .tabbar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 8px;
  }
  .tabbar a, .tabbar button {
    font-size: 0.7rem;
    gap: 4px;
    padding: 6px 4px;
  }
  .ios-body { padding: 14px 14px 18px; }
}

@media (max-width: 420px) {
  .tabbar a .ico, .tabbar button .ico { display: none; }
  .ios-status { padding-left: 68px; }
}

/* ===== Agent results, tables, progress, sheets ===== */
.agent-screen {
  max-width: 720px;
  margin: 16px auto;
  min-height: calc(100dvh - 32px);
  padding: 18px 18px 48px;
  background: #ffffff;
  border: 1px solid var(--mac-border);
  border-radius: 12px;
  box-shadow: var(--ios-shadow);
}

@media (max-width: 720px) {
  .agent-screen {
    margin: 0;
    min-height: 100dvh;
    border: none;
    border-radius: 0;
    box-shadow: none;
  }
}

.agent-status-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--ios-muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--ios-separator);
}

.ios-progress {
  background: var(--ios-fill);
  border-radius: 999px;
  height: 8px;
  overflow: hidden;
  margin: 10px 0 14px;
  position: relative;
}

.ios-progress .progress-bar,
.ios-progress #progress-bar,
.progress-bar {
  height: 100% !important;
  background: linear-gradient(90deg, #8b9dc3, var(--ios-blue)) !important;
  border-radius: 999px !important;
  color: transparent !important;
  font-size: 0 !important;
  line-height: 0 !important;
  border: none !important;
  transition: width 0.2s ease;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.progress-meta #progressPercent,
.progress-meta .pct {
  color: var(--ios-blue);
}

.id-sheet {
  background: #fff;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--ios-separator);
  box-shadow: none;
  max-height: 52vh;
  overflow-y: auto;
}

.id-sheet table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 !important;
}

.id-sheet th {
  position: sticky;
  top: 0;
  background: #f0f2f5 !important;
  color: var(--ios-muted);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: none !important;
  padding: 10px 14px !important;
  text-align: left !important;
}

.id-sheet td {
  border: none !important;
  border-bottom: 1px solid var(--ios-separator) !important;
  padding: 12px 14px !important;
  text-align: left !important;
  font-variant-numeric: tabular-nums;
  font-size: 0.95rem;
}

.id-sheet tr:last-child td { border-bottom: none !important; }
.id-sheet td:first-child {
  color: var(--ios-muted);
  width: 52px;
  font-weight: 650;
}

.modal,
#popup-modal,
#activateModal,
#trialModal {
  background: rgba(28, 30, 33, 0.28) !important;
  backdrop-filter: blur(10px);
  display: none;
  align-items: flex-end;
  justify-content: center;
}

.modal[style*="block"],
#popup-modal[style*="block"],
#activateModal[style*="block"],
#trialModal[style*="block"] {
  display: flex !important;
}

.modal-content,
#modalContent,
#activateModalContent,
#popup-modal .modal-content {
  width: min(100%, 720px) !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 28px 28px 0 0 !important;
  padding: 18px 16px calc(22px + var(--safe-bottom)) !important;
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.1) !important;
  text-align: left !important;
  background: #ffffff !important;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: rgba(120,120,128,0.18);
  display: grid !important;
  place-items: center;
  color: var(--ios-ink) !important;
  font-weight: 700;
  top: 14px !important;
  right: 14px !important;
}

.modal-title,
#modalContent h2,
#activateModalContent h2 {
  font-size: 1.25rem !important;
  letter-spacing: -0.02em;
  margin: 8px 0 10px !important;
}

.modal-text,
#modalContent p,
#activateModalContent p {
  color: var(--ios-muted) !important;
  line-height: 1.45;
  font-size: 0.95rem !important;
}

.modal-buttons {
  display: grid !important;
  gap: 8px !important;
  margin-top: 14px !important;
}

.modal-buttons a,
.modal-buttons button,
.modal-btn,
.save-csv-button {
  display: flex !important;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 14px !important;
  background: var(--ios-blue) !important;
  color: #fff !important;
  font-weight: 700 !important;
  text-decoration: none !important;
  border: none !important;
}

.modal-buttons a#modal-buy,
.buy-btn {
  background: var(--ios-fill) !important;
  color: var(--ios-ink) !important;
  border: 1px solid var(--ios-separator) !important;
}

.save-csv-container {
  display: none;
  position: sticky;
  top: 0;
  z-index: 20;
  margin: 0 0 12px;
  padding: 10px 0 2px;
  background: linear-gradient(180deg, #ffffff 70%, rgba(255,255,255,0.85) 100%);
}
.save-csv-container.is-visible {
  display: block;
}
.save-csv-container .ios-btn,
.save-csv-container .save-csv-button {
  width: 100%;
  margin: 0;
}

#progressOverlay {
  background: rgba(255,255,255,0.96) !important;
  backdrop-filter: blur(18px);
  padding: 24px !important;
}

#progressOverlay h3 {
  font-size: 1.2rem !important;
  letter-spacing: -0.02em;
}

#progressOverlay .progress-container,
.progress-container {
  width: 100% !important;
  max-width: 320px;
  height: 12px !important;
  border: none !important;
  background: var(--ios-fill) !important;
  border-radius: 999px !important;
  box-shadow: none !important;
  overflow: hidden;
}

body.ios-tool .centered-content,
body.ios-tool .input-card {
  max-width: 720px !important;
  border-radius: 12px !important;
  box-shadow: none !important;
}

body.ios-tool .page-title,
body.ios-tool h3 {
  letter-spacing: -0.03em;
}

.info-table,
.csv-table {
  width: 100% !important;
  border-collapse: collapse !important;
  overflow: hidden;
  border-radius: 12px;
  background: #fff;
}

.info-table th,
.info-table td,
.csv-table th,
.csv-table td {
  border: none !important;
  border-bottom: 1px solid var(--ios-separator) !important;
  padding: 12px 14px !important;
}

.info-table th { background: transparent !important; color: var(--ios-muted); text-align: left !important; }
.csv-table th { background: #f0f2f5 !important; }

.chat-hero {
  text-align: left;
  overflow: hidden;
}

.chat-hero .chat-photo,
.chat-photo {
  width: 72px !important;
  height: 72px !important;
  max-width: 72px !important;
  object-fit: cover;
  border-radius: 20px !important;
  margin: 0 !important;
  display: block;
  flex-shrink: 0;
  box-shadow: 0 10px 28px rgba(34, 158, 217, 0.28);
  background: #eef6fb;
}

.chat-photo.placeholder {
  background: linear-gradient(145deg, #5bc8f5, #178bcf);
}

/* Modern group/channel listing card */
.chat-card,
.ios-card.chat-hero,
.ios-card.chat-card {
  padding: 16px !important;
  overflow: hidden;
}

.chat-card-main {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  min-width: 0;
  width: 100%;
}

.chat-card-body {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.chat-card-title,
.chat-hero .page-title,
.chat-hero h2.page-title,
.chat-hero h3,
.input-card .page-title,
.input-card .page-title h3 {
  margin: 0 0 4px !important;
  padding: 0 !important;
  font-size: 1.08rem !important;
  font-weight: 750 !important;
  letter-spacing: -0.02em;
  line-height: 1.3 !important;
  color: var(--ios-ink);
  text-align: left !important;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: normal;
  hyphens: auto;
}

.chat-card-user {
  margin: 0 0 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ios-blue);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-card-meta,
.chat-hero .info-table {
  display: flex !important;
  flex-wrap: wrap;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  margin: 0 !important;
}

.chat-card-meta .chat-pill,
.chat-hero .info-table tr {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  margin: 0;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--ios-fill);
  border: 1px solid var(--ios-separator);
  font-size: 0.78rem;
  font-weight: 650;
  color: var(--ios-ink);
  line-height: 1.2;
}

.chat-hero .info-table th,
.chat-hero .info-table td {
  display: inline;
  padding: 0 !important;
  border: none !important;
  background: transparent !important;
  font-size: inherit !important;
  color: inherit !important;
  width: auto !important;
  white-space: normal;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-hero .info-table th {
  color: var(--ios-muted) !important;
  font-weight: 700 !important;
}

.chat-hero .info-table th::after {
  content: ": ";
}

.chat-card-actions {
  margin-top: 14px;
}

.chat-card-actions .ios-btn,
.chat-card-actions .button-link {
  width: 100%;
  text-align: center;
}

.input-card .chat-card-main {
  margin-bottom: 4px;
}

body.ios-tool .input-card,
body.ios-tool .input-card.chat-card {
  overflow: hidden !important;
  max-width: 100% !important;
  width: 100%;
  background: #fff;
  border: 1px solid var(--mac-border);
  border-radius: 16px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.06);
  padding: 16px;
  text-align: left;
}

body.ios-tool .centered-content {
  padding-left: 12px !important;
  padding-right: 12px !important;
  box-sizing: border-box;
  width: 100%;
}

/* Modern status / error cards */
.status-card {
  background: #fff;
  border: 1px solid var(--mac-border, rgba(0,0,0,0.12));
  border-radius: 20px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.08);
  padding: 28px 22px 22px;
  text-align: center;
  overflow: hidden;
}
.status-card-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  font-size: 1.45rem;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.02em;
  box-shadow: 0 10px 24px rgba(255, 95, 87, 0.28);
  background: linear-gradient(145deg, #ff7a72, #ff5f57);
}
.status-card--warning .status-card-icon {
  background: linear-gradient(145deg, #ffc857, #febc2e);
  box-shadow: 0 10px 24px rgba(254, 188, 46, 0.3);
  color: #5a4200;
}
.status-card--info .status-card-icon {
  background: linear-gradient(145deg, #5bc8f5, #178bcf);
  box-shadow: 0 10px 24px rgba(34, 158, 217, 0.3);
}
.status-card-title {
  margin: 0 0 10px;
  font-size: 1.28rem;
  font-weight: 780;
  letter-spacing: -0.03em;
  line-height: 1.25;
  color: var(--ios-ink, #1d1d1f);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.status-card-text {
  margin: 0 0 16px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: var(--ios-muted, #6e6e73);
  overflow-wrap: anywhere;
  word-break: break-word;
}
.status-card-text strong {
  color: var(--ios-ink, #1d1d1f);
  font-weight: 700;
}
.status-card-hint {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  max-width: 100%;
  margin: 0 auto 18px;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--ios-fill, #f2f2f7);
  border: 1px solid var(--ios-separator, rgba(0,0,0,0.08));
  box-sizing: border-box;
}
.status-card-hint code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.86rem;
  font-weight: 650;
  color: var(--ios-blue, #3b5998);
  overflow-wrap: anywhere;
  word-break: break-all;
}
.status-card-btn {
  width: 100%;
  text-decoration: none !important;
}
.status-card-support {
  margin: 14px 0 0;
  font-size: 0.82rem;
  color: var(--ios-muted, #6e6e73);
}
.status-card-support a {
  color: var(--ios-blue, #3b5998);
  font-weight: 650;
  text-decoration: none;
}


.control-sheet .control-label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ios-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--ios-blue);
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  background: var(--ios-fill);
  border-radius: 14px;
  padding: 8px;
}

.segmented .seg-label {
  width: 100%;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ios-muted);
  padding: 0 4px 2px;
}

.segmented .seg-opt {
  flex: 1;
  text-align: center;
  background: #fff;
  border-radius: 10px;
  padding: 10px 8px;
  font-weight: 650;
  font-size: 0.92rem;
}

.segmented .seg-opt input {
  margin-right: 4px;
}

#activateSoftware.button-link,
#activateBtn {
  width: 100%;
  border-radius: 8px !important;
  background: var(--ios-blue) !important;
  color: #fff !important;
  border: none !important;
  min-height: 40px;
  font-weight: 700 !important;
}

#accountPopup {
  display: none;
  position: fixed !important;
  inset: 0;
  z-index: 1000;
  background: rgba(28, 30, 33, 0.28) !important;
  backdrop-filter: blur(10px);
  align-items: flex-end;
  justify-content: center;
}

#accountPopup[style*="flex"] {
  display: flex !important;
}

#accountPopup .popup-card,
#accountPopup .modal-content {
  width: min(100%, 720px) !important;
  border-radius: 28px 28px 0 0 !important;
  background: #ffffff !important;
  padding: 18px 16px calc(22px + var(--safe-bottom)) !important;
  text-align: left !important;
}

#telegramLoginWidget {
  display: flex;
  justify-content: center;
  padding: 8px 0;
}

#progressOverlay {
  position: relative !important;
  inset: auto !important;
  min-height: auto !important;
  background: transparent !important;
  backdrop-filter: none !important;
  padding: 0 !important;
  display: block;
}

#removedLine { display: none; }

.agent-thread {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* Mild ATM / pro1 skin */
body.atm-skin .chip {
  border-radius: 7px;
  background: #fff;
  border: 1px solid rgba(59, 89, 152, 0.3);
  color: var(--fb-blue);
  font-weight: 650;
}
body.atm-skin .ios-btn {
  border-radius: 8px;
}
body.atm-skin .progress-pills i {
  height: 4px;
  border-radius: 2px;
  background: #d8dee9;
}
body.atm-skin .progress-pills i.on {
  background: var(--fb-blue);
}
body.atm-skin .bubble.ai {
  border-left: 3px solid var(--fb-blue);
}
body.atm-skin .bubble .label {
  color: var(--fb-blue);
  letter-spacing: 0.06em;
}
body.atm-skin .ios-list .glyph {
  border-radius: 7px;
}
body.atm-skin .tabbar .active {
  border-color: rgba(59, 89, 152, 0.28);
}
body.atm-skin .agent-status-line {
  color: var(--fb-blue);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
body.atm-skin .id-sheet {
  border-radius: 10px;
  border: 1px solid rgba(59, 89, 152, 0.12);
}
body.atm-skin .composer-inner {
  border-radius: 8px;
}
body.atm-skin .composer .send {
  border-radius: 7px;
}

/* Tool wrappers used in scrape/add flows */
body.ios-tool > div[style*="max-width"] {
  background: #fff;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 12px;
  margin-top: 16px !important;
  margin-bottom: 16px !important;
  box-shadow: 0 18px 50px rgba(0,0,0,0.12);
  min-height: calc(100dvh - 32px);
  box-sizing: border-box;
}
@media (max-width: 720px) {
  body.ios-tool > div[style*="max-width"] {
    border: none;
    border-radius: 0;
    box-shadow: none;
    margin-top: 0 !important;
    margin-bottom: 0 !important;
    min-height: 100dvh;
  }
}

/* Embedded in parent shell iframe — content only, no second window */
html.ios-embed,
body.ios-embed {
  background: #ffffff !important;
}
body.ios-embed .ios-stage {
  min-height: 100%;
  height: 100%;
  display: block;
  padding: 0;
  background: #ffffff;
  place-items: stretch;
}
body.ios-embed .ios-phone {
  width: 100%;
  height: 100%;
  max-height: none;
  min-height: 100%;
  border: none;
  border-radius: 0;
  box-shadow: none;
}
body.ios-embed .ios-status,
body.ios-embed .ios-nav,
body.ios-embed > .ios-stage > .ios-phone > .tabbar,
body.ios-embed .ios-phone > .tabbar {
  display: none !important;
}
body.ios-embed .ios-body {
  order: 1;
  flex: 1;
  padding: 16px 18px 24px;
  background: #ffffff;
}
body.ios-embed .composer {
  order: 2;
  border-left: none;
  border-right: none;
  border-radius: 0;
  position: sticky;
  bottom: 0;
}
body.ios-embed.ios-tool {
  background: #ffffff !important;
}
body.ios-embed.ios-tool > div[style*="max-width"],
body.ios-embed .agent-screen {
  max-width: none !important;
  width: 100% !important;
  margin: 0 !important;
  border: none !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  min-height: 100% !important;
  background: #ffffff !important;
}
body.ios-embed.ios-tool .composer {
  left: 0;
  transform: none;
  width: 100%;
  border-left: none;
  border-right: none;
  border-radius: 0;
}
