/* Timora Public Mini App.
   Light theme only, in the style of Timora (mytimora.ru) and Apple apps:
   monochrome colors, system font, large titles, grouped lists. */

:root {
  /* Timora colors */
  --bg: #F6F6F7;
  --surface: #FFFFFF;
  --surface-2: #F1F1F3;
  --surface-3: #E8E8EB;
  --ink: #141414;
  --ink-2: #5E5E64;
  --ink-3: #8E8E94;
  --line: #E4E4E7;
  --critical: #B3261E;
  --ok: #1E8A4C;
  --warn: #A8761F;
  --tg: #229ED9;
  --switch-on: #34C759; /* the Apple switch green */

  /* Timora Agent colors (from the robot logo) */
  --agent: #6D5DFC;
  --agent-grad: linear-gradient(135deg, #8B5CF6 0%, #6D7CFF 55%, #5EC8F5 100%);
  --glow-yes: #34C759;
  --glow-no: #FF3B30;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, .04), 0 8px 24px rgba(0, 0, 0, .06);
  --shadow-2: 0 2px 6px rgba(0, 0, 0, .05), 0 28px 64px rgba(0, 0, 0, .14);
  --bar-bg: rgba(246, 246, 247, .8);

  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 24px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --tabbar-h: 58px;
  color-scheme: light;
}

* { box-sizing: border-box; }
/* The hidden attribute must win over display: flex of our classes. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden; /* a card flying away must not make the page wider */
}

button, input, textarea, select { font: inherit; color: inherit; }
button { -webkit-user-select: none; user-select: none; }
svg.icon { width: 22px; height: 22px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
}
.topbar:empty { display: none; }

.channel-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 78%;
  padding: 4px 12px 4px 4px;
  border: none;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  font-weight: 650;
  font-size: 15px;
  cursor: pointer;
  transition: transform .18s var(--ease);
}
.channel-pill:active { transform: scale(.97); }
.channel-pill .name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.channel-pill .icon { width: 16px; height: 16px; color: var(--ink-3); stroke-width: 2.4; }

.logo { width: 30px; height: 30px; flex: none; }
.topbar .robot { width: 40px; flex: none; }

.avatar {
  flex: none;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: #fff;
  font: 700 13px var(--display);
}
.avatar.md { width: 42px; height: 42px; font-size: 17px; }
.avatar.lg { width: 76px; height: 76px; font-size: 30px; }

/* ---------- Page and large titles ---------- */

.view {
  max-width: 640px;
  margin: 0 auto;
  padding: 4px 16px calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom));
  animation: appear .28s var(--ease);
}
/* Only movement, no fading: if the browser pauses the animation
   (for example, the app is in the background), the page stays visible. */
@keyframes appear { from { transform: translateY(8px); } }

.large-title {
  margin: 6px 4px 2px;
  font: 800 32px/1.1 var(--display);
  letter-spacing: -.035em;
}
.subtitle { margin: 0 4px 16px; color: var(--ink-3); font-size: 15px; }

/* ---------- Grouped lists (like iOS Settings) ---------- */

.group-title {
  margin: 22px 16px 7px;
  color: var(--ink-3);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .02em;
}
.group {
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-1);
}
.group-footer { margin: 7px 16px 0; color: var(--ink-3); font-size: 13px; }

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  padding: 10px 16px;
}
/* hairline between rows, starting after the left padding like in iOS */
.row + .row::before {
  content: "";
  position: absolute;
  top: 0;
  left: 16px;
  right: 0;
  height: 1px;
  background: var(--line);
  transform: scaleY(.6);
}
.row.tap { cursor: pointer; }
.row.tap:active { background: var(--surface-2); }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.row-sub { color: var(--ink-3); font-size: 13.5px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.row-value { color: var(--ink-3); }
.row .icon.chevron { width: 18px; height: 18px; color: var(--ink-3); stroke-width: 2.2; }
.row.accent { color: var(--ink); font-weight: 650; }
.row.accent .icon { color: var(--ink); }

.letter {
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--ink-2);
  font-weight: 700;
}

.dot { display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--ink-3); vertical-align: 1px; }
.dot.ok { background: var(--ok); }
.dot.bad { background: var(--critical); }

/* Inputs that live inside grouped rows: no borders, like iOS forms */
.field {
  width: 100%;
  min-height: 52px;
  padding: 14px 16px;
  border: none;
  outline: none;
  background: transparent;
}
.field::placeholder { color: var(--ink-3); }
.row .field { min-height: 0; padding: 0; }

select.value-select {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  background: transparent;
  color: var(--ink-2);
  font-weight: 500;
  text-align: right;
  text-align-last: right;
  padding: 4px 22px 4px 4px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238E8E94' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 10l4-4 4 4M8 14l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right center;
  background-size: 16px;
  cursor: pointer;
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 50px;
  padding: 0 22px;
  border: none;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-weight: 650;
  font-size: 15.5px;
  letter-spacing: -.1px;
  cursor: pointer;
  transition: transform .18s var(--ease), opacity .18s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; }
.btn.wide { width: 100%; }
.btn.soft { background: var(--surface-2); color: var(--ink); }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 14px; }
.btn.danger { background: transparent; color: var(--critical); padding: 0 6px; }
.btn .icon { width: 19px; height: 19px; }

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-3);
  cursor: pointer;
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn .icon { width: 20px; height: 20px; }

/* Apple switch */
.switch { position: relative; flex: none; width: 51px; height: 31px; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--surface-3);
  transition: background .25s var(--ease);
  cursor: pointer;
}
.switch span::before {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 3px 8px rgba(0, 0, 0, .15), 0 1px 1px rgba(0, 0, 0, .16);
  transition: transform .25s var(--ease);
}
.switch input:checked + span { background: var(--switch-on); }
.switch input:checked + span::before { transform: translateX(20px); }

/* Apple stepper: [ − | + ] */
.stepper { display: flex; flex: none; overflow: hidden; border-radius: 9px; background: var(--surface-2); }
.stepper button {
  width: 44px;
  height: 32px;
  border: none;
  background: transparent;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.stepper button:active { background: var(--surface-3); }
.stepper button + button { border-left: 1px solid var(--line); }

/* Segmented control */
.segmented {
  display: flex;
  margin: 0 0 14px;
  padding: 2px;
  border-radius: 10px;
  background: var(--surface-3);
}
.segmented button {
  flex: 1;
  min-height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--ink-2);
  cursor: pointer;
  transition: background .2s, box-shadow .2s;
}
.segmented button.on { background: var(--surface); color: var(--ink); box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 1px 1px rgba(0, 0, 0, .04); }

/* ---------- Swipe cards ---------- */

.stack {
  position: relative;
  height: min(60vh, 540px);
  min-height: 380px;
  margin: 4px 0 20px;
}

.card {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
  touch-action: pan-y; /* vertical scroll is for the text, a horizontal drag is the swipe */
  -webkit-user-select: none;
  user-select: none;
  transition: transform .3s var(--ease), opacity .3s var(--ease);
}
.card.next { transform: scale(.94) translateY(16px); opacity: .6; box-shadow: var(--shadow-1); pointer-events: none; }

.card-media { position: relative; flex: none; height: 42%; background: var(--surface-2); }
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-media .source-chip { position: absolute; left: 12px; bottom: 12px; }

.source-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 80%;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .86);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card-body { flex: 1; overflow-y: auto; padding: 16px 18px 20px; }
.card-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: var(--ink-3); font-size: 13px; }
.card-meta .source-chip { background: var(--surface-2); }
.card-title { margin: 0 0 10px; font: 750 21px/1.22 var(--display); letter-spacing: -.02em; }
.card-text { margin: 0; color: var(--ink-2); font-size: 15.5px; line-height: 1.5; white-space: pre-wrap; }

.stamp {
  position: absolute;
  top: 18px;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  color: #fff;
  font-weight: 750;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  box-shadow: var(--shadow-1);
}
.stamp .icon { width: 18px; height: 18px; stroke-width: 2.6; }
.stamp.yes { left: 16px; background: var(--ok); }
.stamp.no { right: 16px; background: var(--critical); }

.actions { display: flex; justify-content: center; align-items: center; gap: 26px; }
.round {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 66px;
  height: 66px;
  border: none;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: var(--shadow-2);
  cursor: pointer;
  transition: transform .18s var(--ease);
}
.round:active { transform: scale(.9); }
.round .icon { width: 28px; height: 28px; stroke-width: 2.6; }
.round.no { color: var(--critical); }
.round.yes { color: var(--ok); }
.round.small { width: 48px; height: 48px; color: var(--ink-2); box-shadow: var(--shadow-1); }
.round.small .icon { width: 21px; height: 21px; stroke-width: 2.2; }
.swipe-hint { margin: 14px 0 0; text-align: center; color: var(--ink-3); font-size: 13px; }

/* ---------- Queue ---------- */

.post { padding: 14px 16px; }
.post + .post { border-top: 1px solid var(--line); }
.post-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.post-time { color: var(--ink-3); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.post-text { margin: 0; white-space: pre-wrap; font-size: 15px; max-height: 8.9em; overflow: hidden; position: relative; cursor: pointer; }
.post-text.clamped::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2.2em; background: linear-gradient(transparent, var(--surface)); }
.post-text.open { max-height: none; }
.post-actions { display: flex; gap: 8px; margin-top: 12px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 650;
  white-space: nowrap;
}
.badge .icon { width: 14px; height: 14px; stroke-width: 2.4; }
.badge.review { background: #FBF1DC; color: var(--warn); }
.badge.queued { background: #E8F3FB; color: #1C6E9C; }
.badge.published { background: #E3F3EA; color: var(--ok); }
.badge.failed { background: #FBE7E5; color: var(--critical); }

.note {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: #FBF1DC;
  color: #6E4E14;
  font-size: 13.5px;
}
.note .icon { width: 18px; height: 18px; color: var(--warn); }
.note.bad { background: #FBE7E5; color: #7A1A14; }
.note.bad .icon { color: var(--critical); }

.banner {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  font-size: 14px;
}
.banner .icon { color: var(--warn); }

/* ---------- Style examples ---------- */

.hero-card {
  position: relative;
  overflow: hidden;
  padding: 18px;
  border-radius: var(--r-lg);
  background: var(--agent-grad);
  color: #fff;
  box-shadow: 0 14px 40px rgba(109, 93, 252, .28);
}
.hero-card .robot { position: absolute; right: -6px; top: -4px; width: 96px; opacity: .95; }
.hero-card .icon { width: 26px; height: 26px; }
.hero-card h3 { margin: 10px 0 6px; font: 750 20px/1.2 var(--display); letter-spacing: -.02em; }
.hero-card p { margin: 0; color: rgba(255, 255, 255, .72); font-size: 14.5px; }
.progress { height: 5px; margin-top: 16px; border-radius: 999px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: inherit; background: #fff; transition: width .3s var(--ease); }
.progress-label { margin-top: 8px; font-size: 13px; color: rgba(255, 255, 255, .72); }

.example { display: flex; gap: 12px; padding: 14px 16px; }
.example + .example { border-top: 1px solid var(--line); }
.example-num {
  flex: none;
  width: 26px;
  height: 26px;
  margin-top: 1px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 700;
}
.example.filled .example-num { background: var(--ink); color: #fff; }
.example textarea {
  flex: 1;
  min-height: 24px;
  border: none;
  outline: none;
  resize: none;
  background: transparent;
  line-height: 1.45;
  overflow: hidden;
}
.example textarea::placeholder { color: var(--ink-3); }

.sticky-action {
  position: sticky;
  bottom: calc(var(--tabbar-h) + 14px + env(safe-area-inset-bottom));
  z-index: 5;
  margin-top: 18px;
}
.sticky-action .btn { box-shadow: var(--shadow-2); }

/* ---------- Channel page ---------- */

.profile { display: flex; flex-direction: column; align-items: center; padding: 8px 0 2px; text-align: center; }
.profile h2 { margin: 12px 0 2px; font: 800 24px/1.15 var(--display); letter-spacing: -.03em; }
.profile .row-sub { white-space: normal; }
.status-pill { display: inline-flex; align-items: center; margin-top: 10px; padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 650; }
.status-pill.ok { background: #E3F3EA; color: var(--ok); }
.status-pill.off { background: var(--surface-3); color: var(--ink-2); }
.status-pill.bad { background: #FBE7E5; color: var(--critical); }
.stepper-value { min-width: 34px; text-align: center; font-weight: 650; }

/* ---------- Empty states and welcome ---------- */

.empty { display: flex; flex-direction: column; align-items: center; padding: 34px 20px; text-align: center; }
.empty-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
  margin-bottom: 14px;
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  color: var(--ink);
}
.empty-icon .icon { width: 30px; height: 30px; }
.empty h3 { margin: 0 0 6px; font: 750 20px/1.2 var(--display); letter-spacing: -.02em; }
.empty p { margin: 0 0 18px; max-width: 300px; color: var(--ink-3); font-size: 15px; }

.welcome { padding: 28px 4px 10px; }
.welcome .logo { width: 64px; height: 64px; }
.welcome h1 { margin: 20px 0 10px; font: 850 36px/1.02 var(--display); letter-spacing: -.045em; }
.welcome .lead { margin: 0 0 22px; color: var(--ink-2); font-size: 16.5px; }
.step-num {
  flex: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}

/* ---------- Loading skeleton ---------- */

.skeleton { border-radius: var(--r-md); background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite linear; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Bottom tab bar ---------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  display: flex;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--bar-bg);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  box-shadow: 0 -1px 0 rgba(0, 0, 0, .06);
}
.tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: none;
  background: none;
  color: var(--ink-3);
  font-size: 10.5px;
  font-weight: 600;
  cursor: pointer;
}
.tab .icon { width: 25px; height: 25px; stroke-width: 1.8; }
.tab.active { color: var(--ink); }
.tab.active .icon { stroke-width: 2.2; }

/* ---------- Bottom sheet (channel list) ---------- */

.sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(0, 0, 0, .28);
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 31;
  max-height: 82vh;
  overflow-y: auto;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  border-radius: 24px 24px 0 0;
  background: var(--bg);
  animation: slide-up .32s var(--ease);
}
@keyframes slide-up { from { transform: translateY(100%); } }
.grabber { width: 38px; height: 5px; margin: 0 auto 12px; border-radius: 999px; background: var(--surface-3); }
.sheet-title { display: flex; align-items: center; justify-content: space-between; margin: 0 4px 12px; }
.sheet-title h2 { margin: 0; font: 800 22px var(--display); letter-spacing: -.03em; }
.row.selected .row-title::after { content: " ✓"; color: var(--ok); }

/* ---------- Toast (top capsule) ---------- */

.toast {
  position: fixed;
  top: 12px;
  left: 50%;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 9px;
  max-width: calc(100% - 32px);
  padding: 11px 18px 11px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  box-shadow: var(--shadow-2);
  font-size: 14.5px;
  font-weight: 600;
  transform: translateX(-50%);
  animation: drop .35s var(--ease);
}
@keyframes drop { from { transform: translate(-50%, -16px); } }
.toast .icon { width: 20px; height: 20px; stroke-width: 2.4; color: var(--ok); }
.toast.bad .icon { color: var(--critical); }

/* ---------- Timora Agent robot ---------- */

.robot { display: block; overflow: visible; }
.robot .eyes { transform-box: fill-box; transform-origin: center; animation: blink 4.5s infinite; }
@keyframes blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.15); } }
.robot.idle .body { animation: float 3.2s ease-in-out infinite; }
.robot.working .body { animation: bob .7s ease-in-out infinite; }
.robot.working .eyes { animation: think 1.1s ease-in-out infinite; }
.robot.done .body { animation: pop .5s var(--ease); }
.robot.error .eyes path { stroke: #FCA5A5; }
@keyframes float { 50% { transform: translateY(-3px); } }
@keyframes bob { 50% { transform: translateY(-4px) rotate(-2deg); } }
@keyframes think { 50% { transform: translateX(3px); } }
@keyframes pop { 40% { transform: scale(1.12); } }

.wordmark { margin: 18px 0 8px; font: 850 40px/0.98 var(--display); letter-spacing: -.045em; }
.wordmark .agent { display: block; background: var(--agent-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.welcome .robot { width: 120px; }

/* ---------- Agent status (top capsule with the robot) ---------- */

.agent-hud {
  position: fixed;
  top: 60px;
  left: 50%;
  z-index: 35;
  width: min(420px, calc(100% - 24px));
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px 10px 10px;
  border-radius: 22px;
  background: rgba(255, 255, 255, .94);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  backdrop-filter: blur(24px) saturate(180%);
  box-shadow: var(--shadow-2);
  transform: translateX(-50%);
  animation: hud-in .45s var(--ease);
}
.agent-hud.leaving { animation: hud-out .3s ease forwards; }
@keyframes hud-in { from { transform: translate(-50%, -14px) scale(.96); } }
@keyframes hud-out { to { opacity: 0; transform: translate(-50%, -10px) scale(.97); } }
.agent-hud .robot { width: 50px; flex: none; }
.agent-hud .hud-main { flex: 1; min-width: 0; }
.agent-hud .hud-name { color: var(--ink-3); font-size: 12px; font-weight: 600; }
.agent-hud .hud-text { font-weight: 700; font-size: 15px; }
.agent-hud .hud-end .icon { width: 24px; height: 24px; stroke-width: 2.6; color: var(--ok); }
.agent-hud.error .hud-end .icon { color: var(--critical); }
.agent-hud .hud-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--surface-2); overflow: hidden; }
.agent-hud .hud-bar i { position: absolute; top: 0; bottom: 0; width: 40%; border-radius: 999px; background: var(--agent-grad); animation: indeterminate 1.3s var(--ease) infinite; }
@keyframes indeterminate { from { left: -40%; } to { left: 100%; } }

/* animated "…" after a working status */
.dots::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.2s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }

.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--surface-3); border-top-color: var(--agent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Glowing border while swiping ---------- */

/* --angle can be animated only when it is registered as an angle. */
@property --angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

.card-glow {
  position: absolute;
  inset: 0;
  z-index: 3;
  padding: 4px; /* the width of the glowing line */
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  /* Two bright "comets" run around a tinted border. */
  background:
    conic-gradient(from var(--angle),
      transparent 0deg, var(--glow) 40deg, #fff 75deg, var(--glow) 110deg, transparent 160deg,
      transparent 180deg, var(--glow) 220deg, #fff 255deg, var(--glow) 290deg, transparent 340deg),
    linear-gradient(color-mix(in srgb, var(--glow) 45%, transparent), color-mix(in srgb, var(--glow) 45%, transparent));
  /* Show only the border: the content box is cut out. */
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; /* Safari (Telegram on iPhone) */
  mask-composite: exclude;     /* other browsers */
  animation: run-around 1.2s linear infinite;
}
@keyframes run-around { to { --angle: 360deg; } }

/* A soft light inside the card edge, breathing with the pulse. */
.card-aura {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  box-shadow: inset 0 0 26px 4px color-mix(in srgb, var(--glow) 55%, transparent);
}
.card.glow-yes, .card.glow-no { animation: pulse 1s ease-in-out infinite; }
.card.glow-yes { --glow: var(--glow-yes); }
.card.glow-no { --glow: var(--glow-no); }
.card.glow-yes .card-aura, .card.glow-no .card-aura { animation: breathe 1s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: var(--shadow-2), 0 0 0 0 transparent; }
  50% { box-shadow: var(--shadow-2), 0 0 0 5px color-mix(in srgb, var(--glow) 22%, transparent), 0 0 44px 8px color-mix(in srgb, var(--glow) 50%, transparent); }
}
@keyframes breathe { 0%, 100% { opacity: .45; } 50% { opacity: 1; } }

/* ---------- Revise sheet ---------- */

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; }
.chip-btn {
  padding: 8px 14px;
  border: none;
  border-radius: 999px;
  background: var(--surface);
  box-shadow: var(--shadow-1);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.chip-btn:active { transform: scale(.96); }
.sheet textarea.field { min-height: 110px; resize: none; }
.mini-robot { width: 22px; margin: -4px 0 -4px -4px; }
.post-actions { flex-wrap: wrap; }
.btn.agent { background: var(--agent-grad); }

/* "Reduce motion" in the phone settings: no decorative animations. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Plans ---------- */

.meter { height: 6px; margin-top: 7px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.meter i { display: block; height: 100%; border-radius: inherit; background: var(--ink); transition: width .4s var(--ease); }
.meter.full i { background: var(--critical); }
.usage-row { display: block; }
.usage-row .row-head { display: flex; justify-content: space-between; gap: 8px; font-size: 15px; }
.usage-row .row-head span:last-child { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.account .robot { width: 46px; flex: none; }

.plan-card {
  position: relative;
  margin-bottom: 12px;
  padding: 18px 16px 16px;
  border: 2px solid transparent;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-1);
}
.plan-card.current { border-color: var(--ink); }
.plan-card.popular { border-color: var(--agent); }
.plan-tag {
  position: absolute;
  top: -11px;
  right: 14px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--agent-grad);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}
.plan-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.plan-name { font: 800 22px var(--display); letter-spacing: -.03em; }
.plan-price { font: 800 22px var(--display); letter-spacing: -.02em; white-space: nowrap; }
.plan-price small { color: var(--ink-3); font: 500 13px var(--font); letter-spacing: 0; }
.plan-features { margin: 10px 0 14px; padding: 0; list-style: none; }
.plan-features li { display: flex; gap: 8px; align-items: flex-start; margin: 6px 0; color: var(--ink-2); font-size: 14.5px; }
.plan-features .icon { width: 18px; height: 18px; color: var(--ok); stroke-width: 2.4; margin-top: 1px; }
.current-pill { display: flex; align-items: center; justify-content: center; min-height: 44px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); font-weight: 650; }
