/* VoiceRemote main bundle (no @import for tunnel/cache safety) */
/**
 * Design tokens — colors, spacing, radii, z-index, safe areas.
 * Prefer these variables in component CSS files below.
 */

:root {
  /* Colors */
  --bg: #090b10;
  --bg-elevated: #12151c;
  --surface: #181c26;
  --surface-hover: #1f2430;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f4f6fb;
  --muted: #8b95a8;
  --accent: #5b8cff;
  --accent-soft: rgba(91, 140, 255, 0.15);
  --danger: #ff6b6b;
  --danger-soft: rgba(255, 107, 107, 0.14);
  --ok: #3dd68c;
  --ok-soft: rgba(61, 214, 140, 0.12);
  /** Inbound agent reply on chat cards — soft, readable (not success green). */
  --reply-text: #c8d2e6;
  --reply-text-soft: rgba(200, 210, 230, 0.14);
  --record: #ff4d5f;
  --record-soft: rgba(255, 77, 95, 0.16);

  /* Spacing (4px grid) */
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;

  /* Radii */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  /* Layout */
  --app-max-width: 720px;
  --grid-gap: var(--space-3);

  /* Stacking */
  --z-chat-chrome: 4;
  --z-chat-menu: 5;
  --z-chat-rec: 6;
  --z-transcription-reveal: 150;
  --z-response-celebration: 140;
  --z-modal: 200;

  /* Safe areas (notched phones) */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  /* Footer: safe-area only on iPhone (no extra stack on top of home indicator). */
  --footer-inset-bottom: max(6px, var(--safe-bottom));
}

@property --chat-agent-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@property --chat-voice-arming-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

@property --chat-stt-aura-angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}

/* Global reset and app shell grid */

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

[hidden] {
  display: none !important;
}

html {
  height: 100%;
  height: -webkit-fill-available;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  min-height: -webkit-fill-available;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

/* Scrollable main area */
.app {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  overflow-x: hidden;
  overflow-y: auto;
  overflow-anchor: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
  padding:
    calc(20px + var(--safe-top))
    calc(20px + var(--safe-right))
    20px
    calc(20px + var(--safe-left));
}

.app-content {
  min-height: min-content;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}


/* App layout: recording bar, footer */

/* Full-width stop recording control above the footer */
.recording-bar {
  flex-shrink: 0;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding:
    22px
    calc(16px + var(--safe-right))
    20px
    calc(16px + var(--safe-left));
}

.recording-bar[hidden] {
  display: none !important;
}

.recording-bar__actions {
  display: flex;
  align-items: stretch;
  gap: 14px;
}

.recording-bar__btn {
  flex: 1 1 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 144px;
  border-radius: 28px;
  padding: 22px 18px;
  font: inherit;
  font-size: 1.1875rem;
  font-weight: 700;
  line-height: 1.15;
  text-align: center;
  letter-spacing: -0.01em;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.12s ease,
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    opacity 0.15s ease,
    color 0.15s ease;
}

.recording-bar__btn-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  max-width: 100%;
}

.recording-bar__icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.75rem;
  height: 2.75rem;
  filter: drop-shadow(0 0 8px currentcolor);
  opacity: 0.95;
}

.recording-bar__icon svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.recording-bar__label {
  display: block;
  max-width: 100%;
  padding: 0 4px;
}

.recording-bar__btn--cancel {
  border: 1px solid rgba(255, 107, 107, 0.42);
  color: #ffd7dc;
  background: rgba(255, 107, 107, 0.18);
  box-shadow: 0 0 16px rgba(255, 77, 95, 0.2);
}

.recording-bar__btn--cancel:hover {
  background: rgba(255, 107, 107, 0.28);
  border-color: rgba(255, 107, 107, 0.55);
}

.recording-bar__btn--cancel:active {
  transform: scale(0.98);
  background: rgba(255, 107, 107, 0.34);
  box-shadow: 0 0 20px rgba(255, 77, 95, 0.32);
}

.recording-bar__icon--cancel,
.recording-bar__icon--send {
  width: 3rem;
  height: 3rem;
}

.recording-bar__icon--cancel {
  color: #ffb8c0;
}

.recording-bar__icon--send {
  color: #c8ffe0;
}

.recording-bar__plane-body {
  fill: rgba(200, 255, 225, 0.14);
}

.recording-bar__plane-fold {
  opacity: 0.7;
}

.recording-bar__btn--send {
  border: 1px solid rgba(72, 210, 140, 0.55);
  color: #e6fff2;
  background: rgba(52, 180, 120, 0.38);
  box-shadow: 0 0 20px rgba(56, 200, 130, 0.3);
}

.recording-bar__btn--send:hover:not(:disabled) {
  background: rgba(62, 200, 135, 0.48);
  border-color: rgba(100, 230, 165, 0.72);
}

.recording-bar__btn--send:active:not(:disabled) {
  transform: scale(0.98);
  background: rgba(48, 175, 115, 0.55);
  box-shadow: 0 0 24px rgba(56, 210, 140, 0.4);
}

.recording-bar__btn--send:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  color: rgba(190, 220, 205, 0.65);
  border-color: rgba(90, 130, 110, 0.28);
  background: rgba(60, 90, 75, 0.22);
  box-shadow: none;
}

.recording-bar__btn--send:disabled .recording-bar__icon {
  filter: none;
  opacity: 0.55;
}

@media (prefers-reduced-motion: no-preference) {
  .recording-bar__btn--cancel:not(:disabled) .recording-bar__icon--cancel {
    animation: recording-bar-icon-pulse-cancel 2.4s ease-in-out infinite;
  }

  .recording-bar__btn--send:not(:disabled) .recording-bar__icon--send {
    animation: recording-bar-icon-pulse-send 2.4s ease-in-out infinite;
  }
}

@keyframes recording-bar-icon-pulse-cancel {
  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 6px rgba(255, 120, 130, 0.45));
  }

  50% {
    transform: scale(1.06);
    filter: drop-shadow(0 0 12px rgba(255, 100, 120, 0.7));
  }
}

@keyframes recording-bar-icon-pulse-send {
  0%,
  100% {
    transform: scale(1);
    filter: drop-shadow(0 0 6px rgba(80, 220, 150, 0.45));
  }

  50% {
    transform: scale(1.08);
    filter: drop-shadow(0 0 14px rgba(70, 230, 150, 0.75));
  }
}

/* Pinned footer at bottom of the viewport */
.app-footer[hidden] {
  display: none !important;
}

.app-footer {
  flex-shrink: 0;
  width: 100%;
  padding:
    0
    calc(12px + var(--safe-right))
    calc(10px + var(--safe-bottom))
    calc(12px + var(--safe-left));
  background:
    linear-gradient(180deg, rgba(9, 11, 16, 0), rgba(9, 11, 16, 0.82) 40%);
  pointer-events: none;
}

.app-footer__inner {
  max-width: 620px;
  margin: 0 auto;
  padding: 8px 10px 10px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(16, 20, 28, 0.85), rgba(10, 13, 18, 0.75));
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  box-shadow:
    0 -10px 32px rgba(0, 0, 0, 0.2),
    0 18px 42px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 20px rgba(91, 140, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: auto;
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.app-footer__inner:hover {
  border-color: rgba(91, 140, 255, 0.25);
  box-shadow:
    0 -10px 32px rgba(0, 0, 0, 0.22),
    0 18px 46px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.12),
    0 0 28px rgba(91, 140, 255, 0.08);
}

.chat-call-overlay[hidden],
.chat-context-actions[hidden] {
  display: none !important;
}

.chat-call-overlay {
  position: relative;
  z-index: 4;
  display: flex;
  justify-content: center;
  min-width: 0;
  align-self: start;
  margin-top: -32px;
  pointer-events: auto;
}

.chat-call-button {
  position: relative;
  overflow: visible;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  width: 86px;
  height: 86px;
  border: 0;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0) 50%),
    linear-gradient(145deg, #7dffad, #0bbf67 56%, #08713f);
  color: #042817;
  font: inherit;
  font-weight: 850;
  letter-spacing: -0.03em;
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.35),
    0 0 20px rgba(63, 222, 131, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    inset 0 -2px 6px rgba(0, 0, 0, 0.3);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  animation: callPulse 3s infinite ease-in-out;
  transition:
    transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1),
    filter 0.2s ease,
    opacity 0.2s ease,
    box-shadow 0.2s ease;
}

.chat-call-button::after {
  content: "";
  position: absolute;
  top: -2px;
  left: -2px;
  right: -2px;
  bottom: -2px;
  border-radius: 999px;
  box-shadow: 0 0 0 0 rgba(63, 222, 131, 0.6);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.chat-call-button[data-recording="true"]::after {
  opacity: 1;
  animation: rippleWave 1.4s infinite cubic-bezier(0.25, 0, 0, 1);
}

@keyframes rippleWave {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 77, 95, 0.8);
    opacity: 0.8;
  }
  100% {
    box-shadow: 0 0 0 24px rgba(255, 77, 95, 0);
    opacity: 0;
  }
}

.chat-call-button:hover:not(:disabled) {
  transform: scale(1.06) translateY(-2px);
  filter: brightness(1.06);
  box-shadow:
    0 16px 36px rgba(0, 0, 0, 0.4),
    0 0 35px rgba(63, 222, 131, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -2px 6px rgba(0, 0, 0, 0.25);
}

.chat-call-button:active:not(:disabled) {
  transform: translateY(1px) scale(0.95);
  filter: brightness(0.95);
  animation-play-state: paused;
}

.chat-call-button:disabled {
  cursor: default;
  filter: grayscale(0.45);
  opacity: 0.58;
  animation: none;
}

.chat-call-button[data-recording="true"] {
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0) 50%),
    linear-gradient(145deg, #ff8b8b, #d92542 58%, #86182b);
  color: #fff5f5;
  box-shadow:
    0 12px 28px rgba(0, 0, 0, 0.35),
    0 0 25px rgba(255, 77, 95, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.35),
    inset 0 -2px 6px rgba(0, 0, 0, 0.4);
  animation: recordingPulse 1.4s infinite ease-in-out;
}

.chat-call-button__icon {
  width: 26px;
  height: 26px;
  transition: transform 0.2s ease;
}

.chat-call-button:hover:not(:disabled) .chat-call-button__icon {
  transform: scale(1.12);
}

.chat-call-button__icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.chat-call-button__label {
  font-size: 0.71rem;
  line-height: 1;
}

.chat-context-actions {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 102px minmax(0, 1fr);
  grid-template-areas:
    "title title title"
    "chat call voice";
  align-items: center;
  gap: 6px 8px;
  width: 100%;
  min-height: 106px;
  padding: 5px 0 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.chat-context-actions::before {
  position: absolute;
  z-index: -1;
  top: 36px;
  left: 50%;
  width: 116px;
  height: 58px;
  border-radius: 0 0 999px 999px;
  background: radial-gradient(circle at 50% 0, rgba(81, 240, 148, 0.12), transparent 66%);
  box-shadow: none;
  content: "";
  transform: translateX(-50%);
  pointer-events: none;
}

.chat-context-actions__title {
  grid-area: title;
  justify-self: center;
  max-width: 100%;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 2px 10px 1px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(218, 255, 235, 0.5);
  font-size: 0.68rem;
  font-weight: 750;
  letter-spacing: 0.01em;
}

.chat-context-actions__btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 58px;
  border: 0;
  border-radius: 14px;
  padding: 8px 8px 4px;
  background: transparent !important;
  color: rgba(226, 233, 246, 0.72);
  font: inherit;
  font-size: 0.73rem;
  font-weight: 750;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: none;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.chat-context-actions__btn:hover:not(:disabled) {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05) !important;
  transform: translateY(-2px);
}

.chat-context-actions__icon {
  width: 22px;
  height: 22px;
  color: rgba(160, 255, 202, 0.72);
  transition: transform 0.2s ease, color 0.2s ease;
}

.chat-context-actions__btn:hover:not(:disabled) .chat-context-actions__icon {
  color: var(--ok);
  transform: scale(1.08);
}

.chat-context-actions__icon svg {
  display: block;
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.75;
}

.chat-context-actions__label {
  line-height: 1;
  transition: opacity 0.2s ease;
}

.chat-context-actions__btn:hover:not(:disabled) .chat-context-actions__label {
  opacity: 1;
}

.chat-context-actions__btn:first-of-type {
  grid-area: chat;
}

.chat-context-actions__btn:last-of-type {
  grid-area: voice;
}

.chat-context-actions .chat-call-overlay {
  grid-area: call;
}

.chat-context-actions__btn:active:not(:disabled) {
  transform: scale(0.97);
  background: transparent !important;
}

.chat-context-actions__btn:disabled {
  cursor: default;
  opacity: 0.5;
}

.status {
  margin: 0;
  min-height: 1rem;
  font-size: 0.8125rem;
  line-height: 1.4;
  text-align: center;
  color: var(--muted);
}

.status:empty {
  display: none;
}

.footer-actions {
  position: relative;
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 2px;
  width: 100%;
  min-width: 0;
  overflow: visible;
  padding: 4px 0 0;
}

.footer-actions::-webkit-scrollbar {
  display: none;
}

a.footer-action {
  text-decoration: none;
  box-sizing: border-box;
}

.footer-action {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  min-width: 0;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  padding: 5px 2px 4px;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: -0.005em;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: none;
  transition:
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease,
    transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.footer-action__label {
  display: block;
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.62rem;
  font-weight: 700;
  line-height: 1;
  text-align: center;
  color: currentcolor;
  opacity: 0.76;
  transition: opacity 0.2s ease, color 0.2s ease;
}

.footer-action__icon {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform 0.2s ease, color 0.2s ease, filter 0.2s ease;
}

.footer-more-actions {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(3, minmax(70px, 1fr));
  gap: 6px;
  width: min(310px, calc(100vw - 24px - var(--safe-left) - var(--safe-right)));
  padding: 9px;
  border-radius: 22px;
  background: rgba(14, 17, 24, 0.92);
  backdrop-filter: blur(24px) saturate(1.25);
  -webkit-backdrop-filter: blur(24px) saturate(1.25);
  box-shadow:
    0 18px 54px rgba(0, 0, 0, 0.42),
    0 0 28px rgba(91, 140, 255, 0.08);
}

.footer-more-actions[hidden] {
  display: none !important;
}

.footer-actions > .footer-action--overflow {
  display: none;
}

.footer-more-actions .footer-action {
  display: inline-flex;
  min-height: 58px;
  padding: 7px 4px 6px;
  border-radius: 15px;
  background: rgba(244, 246, 251, 0.055);
}

.footer-more-actions .footer-action__label {
  font-size: 0.66rem;
}

.footer-action--restart {
  color: rgba(244, 246, 251, 0.88);
}

.footer-action--windows {
  color: rgba(244, 246, 251, 0.86);
}

.footer-action--monitor {
  color: rgba(160, 200, 255, 0.92);
}

.footer-action--monitor:hover {
  border-color: transparent;
  background: rgba(40, 72, 120, 0.18);
}

.footer-action--monitor .footer-action__icon {
  stroke-width: 1.45;
}

.footer-action--terminals {
  color: rgba(158, 255, 216, 0.94);
}

.footer-action--terminals:hover {
  border-color: transparent;
  background: rgba(40, 114, 92, 0.2);
}

.footer-action--terminals .footer-action__icon {
  stroke-width: 1.5;
}

.footer-action--arrange {
  color: rgba(244, 246, 251, 0.82);
}

.footer-action--focus {
  color: rgba(244, 246, 251, 0.86);
}

.footer-action--models {
  color: rgba(244, 246, 251, 0.84);
}

.footer-action--summary-tts {
  order: -1;
}

.footer-action--summary-tts[aria-pressed="true"] {
  color: #c8ffe0;
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.footer-action--summary-tts[aria-pressed="false"] {
  color: rgba(170, 180, 195, 0.72);
  border-color: transparent;
  background: transparent;
  box-shadow: none;
}

.footer-action--summary-tts[aria-pressed="true"]:hover {
  border-color: transparent;
  background: rgba(255, 255, 255, 0.06);
}

.footer-action--summary-tts.footer-action--server-off {
  opacity: 0.72;
}

.footer-action--summary-play,
.footer-action--summary-mark-all {
  position: relative;
}

.footer-action--summary-play {
  color: rgba(244, 210, 130, 0.92);
  border-color: transparent;
  background: transparent;
}

.footer-action--summary-play:hover:not(:disabled) {
  border-color: transparent;
  background: rgba(255, 185, 70, 0.1);
}

.footer-action--summary-play:disabled {
  opacity: 0.4;
  cursor: default;
}

.footer-action--summary-mark-all {
  color: rgba(200, 220, 255, 0.88);
}

.footer-action--summary-mark-all:hover:not(:disabled) {
  border-color: transparent;
  background: rgba(91, 140, 255, 0.08);
}

.footer-action--summary-play .footer-action__badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: #e8a830;
  color: #1a1408;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
}

.footer-action--summary-play.footer-action--queue-active {
  color: #ffe8b0;
  border-color: transparent;
  background: rgba(255, 190, 70, 0.12);
}

.footer-action__icon--summary-tts {
  width: 20px;
  height: 20px;
}

.footer-action__icon--summary-tts .footer-action__tts-head {
  fill: rgba(200, 255, 225, 0.16);
}

.footer-action__icon--summary-tts .footer-action__tts-antenna-cap,
.footer-action__icon--summary-tts .footer-action__tts-eye {
  fill: currentcolor;
  stroke: none;
}

.footer-action__icon--summary-tts .footer-action__tts-bot .footer-action__tts-antenna,
.footer-action__icon--summary-tts .footer-action__tts-bot .footer-action__tts-mouth {
  stroke-width: 1.65;
}

.footer-action__icon--summary-tts .footer-action__tts-sound {
  stroke-width: 1.38;
}

.footer-action__icon--summary-tts .footer-action__tts-voice {
  opacity: 0.95;
}

.footer-action__tts-state-on,
.footer-action__tts-state-off {
  display: none;
}

.footer-action--summary-tts[aria-pressed="true"] .footer-action__tts-state-on {
  display: block;
}

.footer-action--summary-tts[aria-pressed="false"] .footer-action__tts-state-off {
  display: block;
}

.footer-action__icon--summary-tts .footer-action__tts-muted-x,
.footer-action__icon--summary-tts .footer-action__tts-eye-closed,
.footer-action__icon--summary-tts .footer-action__tts-mute-slash {
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
}

.footer-action__icon--summary-tts .footer-action__tts-muted {
  stroke-width: 1.45;
}

.footer-action__icon--summary-tts .footer-action__tts-eye-closed,
.footer-action__icon--summary-tts .footer-action__tts-state-off .footer-action__tts-mouth {
  stroke-width: 1.55;
}

.footer-action__icon--summary-tts .footer-action__tts-mute-slash {
  stroke-width: 1.7;
  opacity: 0.88;
}

.footer-action--summary-tts[aria-pressed="false"] .footer-action__tts-state-off .footer-action__tts-head {
  fill: rgba(150, 158, 172, 0.14);
}

.footer-action--summary-tts[aria-pressed="false"] .footer-action__tts-state-off .footer-action__tts-muted-x {
  opacity: 0.78;
}

.footer-action--icon {
  padding: 3px 2px 4px;
  color: var(--accent);
  background: transparent;
  border-color: transparent;
  font-size: 1.25rem;
  font-weight: 400;
  line-height: 1;
}

.footer-action--icon > span[aria-hidden="true"] {
  display: block;
  height: 17px;
  font-size: 1.35rem;
  line-height: 0.82;
}

.footer-action--more {
  color: rgba(210, 222, 246, 0.9);
}

.footer-action--more[aria-expanded="true"] {
  background: rgba(255, 255, 255, 0.08);
  color: #c8ffe0;
}

.footer-action--more[aria-expanded="true"] .footer-action__icon {
  transform: rotate(90deg) scale(1.1);
  color: var(--ok);
}

.footer-action:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-2px);
}

.footer-action:hover:not(:disabled) .footer-action__icon {
  color: var(--accent);
  filter: drop-shadow(0 0 5px rgba(91, 140, 255, 0.4));
  transform: scale(1.08);
}

.footer-action:hover:not(:disabled) .footer-action__label {
  opacity: 1;
}

.footer-action--icon:hover:not(:disabled) {
  background: rgba(91, 140, 255, 0.12);
}

.footer-action--icon:hover:not(:disabled) .footer-action__icon {
  color: var(--accent);
}

.footer-action:active:not(:disabled) {
  transform: translateY(1px) scale(0.96);
  background: var(--surface-hover);
  transition: transform 0.08s ease;
}

/* More menu reveal animation */
@keyframes footerMoreReveal {
  0% {
    opacity: 0;
    transform: translateY(10px) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.footer-more-actions:not([hidden]) {
  animation: footerMoreReveal 0.22s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transform-origin: bottom right;
}

/* Call & Recording button pulses */
@keyframes callPulse {
  0% {
    box-shadow:
      0 10px 24px rgba(0, 0, 0, 0.3),
      0 0 20px rgba(63, 222, 131, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.34);
  }
  50% {
    box-shadow:
      0 14px 28px rgba(0, 0, 0, 0.35),
      0 0 32px rgba(63, 222, 131, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.34);
  }
  100% {
    box-shadow:
      0 10px 24px rgba(0, 0, 0, 0.3),
      0 0 20px rgba(63, 222, 131, 0.2),
      inset 0 1px 0 rgba(255, 255, 255, 0.34);
  }
}

@keyframes recordingPulse {
  0% {
    box-shadow:
      0 10px 24px rgba(0, 0, 0, 0.35),
      0 0 18px rgba(255, 77, 95, 0.25),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: scale(1);
  }
  50% {
    box-shadow:
      0 14px 30px rgba(0, 0, 0, 0.42),
      0 0 35px rgba(255, 77, 95, 0.55),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: scale(1.03);
  }
  100% {
    box-shadow:
      0 10px 24px rgba(0, 0, 0, 0.35),
      0 0 18px rgba(255, 77, 95, 0.25),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
    transform: scale(1);
  }
}

/* Summary TTS docked player — above footer */

.summary-audio-player {
  flex-shrink: 0;
  width: 100%;
  background: rgba(12, 15, 22, 0.94);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  border-top: 1px solid rgba(91, 140, 255, 0.22);
  box-shadow: 0 -8px 28px rgba(0, 0, 0, 0.28);
}

.summary-audio-player[hidden] {
  display: none !important;
}

.summary-audio-player__inner {
  max-width: 720px;
  margin: 0 auto;
  padding:
    6px
    calc(10px + var(--safe-right))
    6px
    calc(10px + var(--safe-left));
}

.summary-audio-player__controls {
  --summary-player-btn-size: 36px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  grid-template-rows: auto var(--summary-player-btn-size);
  align-items: center;
  column-gap: 8px;
  row-gap: 2px;
  min-width: 0;
}

.summary-audio-player__main {
  grid-column: 2;
  grid-row: 1 / 3;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  min-height: 0;
}

.summary-audio-player__btn--primary {
  grid-column: 1;
  grid-row: 2;
}

.summary-audio-player__btn--close {
  grid-column: 3;
  grid-row: 2;
}

.summary-audio-player__title {
  margin: 0 0 2px;
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.2;
  color: rgba(206, 214, 232, 0.92);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.summary-audio-player__btn {
  flex-shrink: 0;
  display: grid;
  place-items: center;
  width: var(--summary-player-btn-size);
  height: var(--summary-player-btn-size);
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 50%;
  color: rgba(228, 236, 255, 0.98);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    transform 0.12s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    color 0.18s ease;
}

.summary-audio-player__btn-icon {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  line-height: 0;
  pointer-events: none;
}

.summary-audio-player__btn-icon svg {
  display: block;
  width: 17px;
  height: 17px;
}

.summary-audio-player__btn--primary {
  color: rgba(232, 242, 255, 0.98);
  background: rgba(52, 92, 178, 0.96);
  box-shadow:
    0 0 0 1px rgba(120, 170, 255, 0.45),
    0 3px 10px rgba(28, 52, 110, 0.35);
}

.summary-audio-player__btn--primary:hover {
  background: rgba(64, 108, 198, 0.98);
  box-shadow:
    0 0 0 1px rgba(150, 195, 255, 0.55),
    0 0 12px rgba(91, 140, 255, 0.22),
    0 4px 12px rgba(28, 52, 110, 0.38);
}

.summary-audio-player__btn--primary:active {
  transform: scale(0.94);
  background: rgba(44, 78, 152, 0.98);
}

.summary-audio-player__btn--close {
  color: rgba(198, 204, 218, 0.95);
  background: rgba(44, 48, 58, 0.96);
  box-shadow:
    0 0 0 1px rgba(108, 116, 132, 0.35),
    0 3px 10px rgba(0, 0, 0, 0.26);
}

.summary-audio-player__btn--close:hover {
  color: rgba(255, 218, 222, 0.98);
  background: rgba(72, 52, 58, 0.98);
  box-shadow:
    0 0 0 1px rgba(248, 113, 113, 0.38),
    0 0 10px rgba(248, 113, 113, 0.14),
    0 4px 12px rgba(0, 0, 0, 0.28);
}

.summary-audio-player__btn--close:active {
  transform: scale(0.94);
}

.summary-audio-player__btn:focus-visible {
  outline: 2px solid rgba(91, 140, 255, 0.65);
  outline-offset: 2px;
}

.summary-audio-player__timeline {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: var(--summary-player-btn-size);
}

.summary-audio-player__time {
  flex-shrink: 0;
  font-size: 0.625rem;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(148, 160, 184, 0.88);
  min-width: 2rem;
  text-align: center;
}

.summary-audio-player__track {
  position: relative;
  flex: 1 1 auto;
  height: 6px;
  min-width: 0;
  border-radius: 999px;
  background: rgba(148, 160, 184, 0.2);
  cursor: pointer;
  touch-action: none;
}

.summary-audio-player__track:focus-visible {
  outline: 2px solid rgba(91, 140, 255, 0.55);
  outline-offset: 2px;
}

.summary-audio-player__fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(91, 140, 255, 0.85), rgba(130, 175, 255, 0.95));
  pointer-events: none;
  transition: width 0.08s linear;
}

.summary-audio-player__track::after {
  content: "";
  position: absolute;
  top: 50%;
  left: var(--summary-player-pct, 0%);
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #e8eeff;
  box-shadow: 0 0 0 2px rgba(91, 140, 255, 0.45);
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.summary-audio-player__track:hover::after,
.summary-audio-player__track:active::after {
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .summary-audio-player__fill {
    transition: none;
  }
}

/* Center-screen transcription reveal → fly into chat card */

.transcription-reveal {
  position: fixed;
  inset: 0;
  z-index: var(--z-transcription-reveal, 150);
  overflow: visible;
  display: flex;
  align-items: center;
  justify-content: center;
  padding:
    calc(24px + var(--safe-top))
    calc(20px + var(--safe-right))
    calc(24px + var(--safe-bottom))
    calc(20px + var(--safe-left));
  pointer-events: none;
}

.transcription-reveal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(9, 11, 16, 0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.transcription-reveal.is-visible .transcription-reveal__backdrop {
  opacity: 1;
}

.transcription-reveal__backdrop.is-fading,
.transcription-reveal.is-flying .transcription-reveal__backdrop {
  opacity: 0;
}

.transcription-reveal__bubble {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(92vw, 440px);
  padding: 18px 20px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  background: rgba(24, 28, 38, 0.96);
  box-shadow:
    0 24px 64px rgba(0, 0, 0, 0.45),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transform: scale(0.9) translateY(8px);
  opacity: 0;
  transition:
    transform 0.34s cubic-bezier(0.22, 1, 0.36, 1),
    opacity 0.28s ease;
  will-change: transform, opacity;
  backface-visibility: hidden;
  pointer-events: auto;
}

.transcription-reveal.is-visible .transcription-reveal__bubble {
  transform: scale(1) translateY(0);
  opacity: 1;
}

/* Measure centered bubble size without flashing on screen */
.transcription-reveal.is-layout {
  visibility: hidden;
  pointer-events: none;
}

.transcription-reveal.is-emerging .transcription-reveal__backdrop {
  opacity: 0;
  transition: opacity var(--reveal-emerge-ms, 640ms) ease;
}

.transcription-reveal.is-emerging.is-emerge-run .transcription-reveal__backdrop {
  opacity: 1;
}

.transcription-reveal.is-emerging .transcription-reveal__bubble {
  opacity: 0;
  transform: none;
  transition: none;
}

.transcription-reveal.is-emerging .transcription-reveal__bubble.is-emerge-active {
  opacity: 1;
  animation: transcription-reveal-emerge var(--reveal-emerge-ms, 640ms) cubic-bezier(0.22, 1, 0.36, 1)
    forwards;
  will-change: transform, opacity, filter;
}

@keyframes transcription-reveal-emerge {
  0% {
    transform: translate3d(var(--emerge-dx, 0), var(--emerge-dy, 0), 0) scale(var(--emerge-scale, 0.22));
    opacity: 0.5;
    filter: drop-shadow(0 8px 18px rgba(0, 0, 0, 0.28));
  }

  18% {
    opacity: 0.88;
  }

  100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 1;
    filter: drop-shadow(0 24px 64px rgba(0, 0, 0, 0.45));
  }
}

@keyframes transcription-reveal-fly {
  0% {
    transform: translate3d(0, 0, 0) scale(1) rotate(0deg);
    opacity: 1;
    filter: drop-shadow(0 22px 50px rgba(0, 0, 0, 0.5));
  }

  14% {
    transform: translate3d(
        calc(var(--reveal-dx, 0px) * 0.1),
        calc(var(--reveal-dy, 0px) * 0.1 - 26px),
        0
      )
      scale(1.05)
      rotate(calc(var(--reveal-rotate, 0deg) * 0.4));
    opacity: 1;
    filter: drop-shadow(0 28px 56px rgba(0, 0, 0, 0.42));
  }

  72% {
    opacity: 0.92;
  }

  100% {
    transform: translate3d(var(--reveal-dx, 0), var(--reveal-dy, 0), 0) scale(var(--reveal-scale, 0.2))
      rotate(var(--reveal-rotate, 0deg));
    opacity: 0;
    filter: drop-shadow(0 6px 14px rgba(0, 0, 0, 0.2));
  }
}

.transcription-reveal.is-visible .transcription-reveal__bubble.is-flying {
  transition: none;
  animation: transcription-reveal-fly var(--reveal-fly-ms, 680ms) cubic-bezier(0.32, 0.82, 0.18, 1)
    forwards;
  will-change: transform, opacity, filter;
}

.transcription-reveal__lead {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.transcription-reveal__logo {
  width: 22px;
  height: 22px;
  object-fit: contain;
  border-radius: 5px;
  display: block;
}

.transcription-reveal__chat-label {
  font-size: 0.75rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  color: var(--muted);
  line-height: 1.2;
}

.transcription-reveal__text {
  margin: 0;
  font-size: 1.0625rem;
  font-weight: 500;
  line-height: 1.45;
  letter-spacing: -0.015em;
  color: var(--text);
  text-align: center;
  word-break: break-word;
}

.transcription-reveal__actions {
  display: flex;
  justify-content: center;
  margin-top: 4px;
}

.transcription-reveal__close {
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text);
  font-size: 0.875rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.transcription-reveal__close:hover {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.transcription-reveal__close:active {
  background: var(--surface);
}

.transcription-reveal__close:focus-visible {
  outline: 2px solid rgba(91, 140, 255, 0.65);
  outline-offset: 2px;
}

/* Source card pulse while the bubble lifts out */
.chat-wrap.is-reveal-source {
  z-index: 9;
}

.chat-wrap.is-reveal-source::before {
  content: "";
  position: absolute;
  inset: -6px;
  z-index: 30;
  border-radius: var(--radius-lg);
  border: 2px solid rgba(124, 168, 255, 0.55);
  box-shadow:
    0 0 0 1px rgba(91, 140, 255, 0.2),
    0 0 22px rgba(91, 140, 255, 0.28);
  pointer-events: none;
  opacity: 0;
  animation: chat-reveal-source-ring 0.72s cubic-bezier(0.33, 0.86, 0.22, 1) forwards;
}

@keyframes chat-reveal-source-ring {
  0% {
    opacity: 0;
    transform: scale(0.94);
  }

  35% {
    opacity: 1;
    transform: scale(1.02);
  }

  100% {
    opacity: 0;
    transform: scale(1);
  }
}

/* Landing cue on the tile edge (not inside the .chat surface) — pairs with flying bubble */
.chat-wrap.is-reveal-target {
  z-index: 9;
}

.chat-wrap.is-reveal-target::before {
  content: "";
  position: absolute;
  inset: -6px;
  z-index: 30;
  border-radius: var(--radius-lg);
  border: 2px solid rgba(124, 168, 255, 0.75);
  box-shadow:
    0 0 0 1px rgba(91, 140, 255, 0.25),
    0 0 28px rgba(91, 140, 255, 0.35);
  pointer-events: none;
  opacity: 0;
  animation: chat-reveal-land-ring 0.58s cubic-bezier(0.33, 0.86, 0.22, 1) forwards;
}

@keyframes chat-reveal-land-ring {
  0% {
    opacity: 0;
    transform: scale(1.06);
  }

  40% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  .transcription-reveal__bubble,
  .transcription-reveal__backdrop {
    transition: none;
  }

  .transcription-reveal.is-emerging .transcription-reveal__bubble.is-emerge-active {
    animation: none;
    transform: none;
    opacity: 1;
    filter: none;
  }

  .chat-wrap.is-reveal-source::before {
    animation: none;
    opacity: 0;
  }

  .transcription-reveal.is-visible .transcription-reveal__bubble.is-flying {
    animation: none;
    transform: none;
    opacity: 0;
    filter: none;
  }

  .chat-wrap.is-reveal-target::before {
    animation: none;
    opacity: 0;
  }
}

/* Terminal chat cards (grid tiles) */

/* Terminal chats */
.chat-wrap {
  position: relative;
  aspect-ratio: 1;
  overflow: visible;
  border-radius: var(--radius-lg);
}

.chat-wrap.is-selected .chat:not([data-recording="true"]) {
  border-color: rgba(100, 230, 165, 0.74);
  box-shadow:
    inset 0 0 0 1.5px rgba(100, 230, 165, 0.74),
    0 0 0 3px rgba(72, 210, 140, 0.14),
    0 18px 42px rgba(0, 0, 0, 0.34);
}

/* No corner stop control during voice record — release on the card stops recording. */
.chat-wrap:has(.chat[data-recording="true"]) .chat-summary-play,
.chat-wrap:has(.chat[data-voice-arming="true"]) .chat-summary-play {
  display: none !important;
  pointer-events: none;
}

.chat-wrap:has(.chat-model-trigger:focus-within) {
  z-index: 8;
}

.chat-wrap[data-status="ready"] .chat:not([data-recording="true"]) {
  box-shadow: inset 0 0 0 1.5px var(--border-strong);
}

.chat-wrap[data-status="limit"] .chat:not([data-recording="true"]) {
  background: rgba(128, 86, 22, 0.22);
  box-shadow:
    inset 0 0 0 1.5px rgba(245, 158, 11, 0.72),
    0 0 0 3px rgba(245, 158, 11, 0.12);
}

.chat-wrap[data-status="limit"]::after {
  content: "Лимит";
  position: absolute;
  left: 10px;
  bottom: 9px;
  z-index: 5;
  padding: 3px 7px;
  border-radius: 999px;
  color: #ffdfa3;
  background: rgba(88, 55, 12, 0.82);
  border: 1px solid rgba(245, 158, 11, 0.36);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.chat-wrap[data-agent-active="true"][data-status="ready"] .chat:not([data-recording="true"]) {
  box-shadow: none;
}

.chat-wrap[data-agent-active="true"] .chat:not([data-recording="true"]),
.chat-wrap[data-status="starting"] .chat:not([data-recording="true"]) {
  background: var(--surface-hover);
}

.chat-wrap[data-agent-active="true"]:not(:has(.chat[data-recording="true"])) {
  isolation: isolate;
  border-radius: var(--radius-lg);
}

.chat-agent-ring {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  padding: 2px;
  --chat-agent-angle: 0deg;
  background: conic-gradient(
    from var(--chat-agent-angle),
    transparent 0deg 242deg,
    rgba(91, 140, 255, 0.06) 254deg,
    rgba(91, 140, 255, 0.22) 268deg,
    rgba(91, 140, 255, 0.42) 284deg,
    rgba(168, 198, 255, 0.52) 302deg,
    rgba(91, 140, 255, 0.42) 318deg,
    rgba(91, 140, 255, 0.22) 332deg,
    rgba(91, 140, 255, 0.06) 344deg,
    transparent 356deg
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  filter:
    drop-shadow(0 0 3px rgba(91, 140, 255, 0.22))
    drop-shadow(0 0 8px rgba(91, 140, 255, 0.14))
    drop-shadow(0 0 16px rgba(91, 140, 255, 0.08))
    drop-shadow(0 0 28px rgba(91, 140, 255, 0.04));
  animation: chat-agent-ring-run 1.5s linear infinite;
  pointer-events: none;
}

.chat-wrap[data-agent-active="true"] .chat {
  position: relative;
  z-index: 1;
  border-color: transparent;
  background-clip: padding-box;
}

@keyframes chat-agent-ring-run {
  to {
    --chat-agent-angle: 360deg;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-agent-ring {
    animation: none;
    --chat-agent-angle: 45deg;
    opacity: 0.55;
  }
}

/* Voice arming: same orbit ring as agent, red until MediaRecorder is live */
.chat-wrap:has(.chat[data-voice-arming="true"]):not(:has(.chat[data-recording="true"])) {
  isolation: isolate;
  border-radius: var(--radius-lg);
}

.chat-wrap:has(.chat[data-voice-arming="true"]) .chat-agent-ring {
  display: none;
}

.chat-voice-arming-ring {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  padding: 2px;
  --chat-voice-arming-angle: 0deg;
  background: conic-gradient(
    from var(--chat-voice-arming-angle),
    transparent 0deg 242deg,
    rgba(255, 77, 95, 0.06) 254deg,
    rgba(255, 77, 95, 0.22) 268deg,
    rgba(255, 77, 95, 0.42) 284deg,
    rgba(255, 180, 190, 0.52) 302deg,
    rgba(255, 77, 95, 0.42) 318deg,
    rgba(255, 77, 95, 0.22) 332deg,
    rgba(255, 77, 95, 0.06) 344deg,
    transparent 356deg
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  filter:
    drop-shadow(0 0 3px rgba(255, 77, 95, 0.24))
    drop-shadow(0 0 8px rgba(255, 77, 95, 0.16))
    drop-shadow(0 0 16px rgba(255, 77, 95, 0.1))
    drop-shadow(0 0 28px rgba(255, 77, 95, 0.05));
  animation: chat-voice-arming-ring-run 1.5s linear infinite;
  pointer-events: none;
}

.chat-wrap:has(.chat[data-voice-arming="true"]) .chat:not([data-recording="true"]) {
  position: relative;
  z-index: 1;
  border-color: transparent;
  background-clip: padding-box;
}

@keyframes chat-voice-arming-ring-run {
  to {
    --chat-voice-arming-angle: 360deg;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-voice-arming-ring {
    animation: none;
    --chat-voice-arming-angle: 45deg;
    opacity: 0.55;
  }
}

/* Stop terminal: red orbit ring, counter-clockwise */
.chat-wrap[data-stopping="true"] {
  isolation: isolate;
  border-radius: var(--radius-lg);
}

.chat-wrap[data-stopping="true"] .chat-agent-ring {
  display: none;
}

.chat-stop-ring {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  padding: 2px;
  --chat-stop-angle: 360deg;
  background: conic-gradient(
    from var(--chat-stop-angle),
    transparent 0deg 242deg,
    rgba(255, 77, 95, 0.06) 254deg,
    rgba(255, 77, 95, 0.22) 268deg,
    rgba(255, 77, 95, 0.42) 284deg,
    rgba(255, 180, 190, 0.52) 302deg,
    rgba(255, 77, 95, 0.42) 318deg,
    rgba(255, 77, 95, 0.22) 332deg,
    rgba(255, 77, 95, 0.06) 344deg,
    transparent 356deg
  );
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  filter:
    drop-shadow(0 0 3px rgba(255, 77, 95, 0.28))
    drop-shadow(0 0 8px rgba(255, 77, 95, 0.18))
    drop-shadow(0 0 16px rgba(255, 77, 95, 0.1))
    drop-shadow(0 0 28px rgba(255, 77, 95, 0.06));
  animation: chat-stop-ring-run 1.5s linear infinite;
  pointer-events: none;
}

.chat-wrap[data-stopping="true"] .chat {
  position: relative;
  z-index: 1;
  border-color: transparent;
  background-clip: padding-box;
}

@keyframes chat-stop-ring-run {
  to {
    --chat-stop-angle: 0deg;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-stop-ring {
    animation: none;
    --chat-stop-angle: 225deg;
    opacity: 0.55;
  }
}

.chat-starting {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 14px 48px;
  border-radius: var(--radius-lg);
  text-align: center;
  pointer-events: none;
  background: rgba(9, 11, 16, 0.78);
  backdrop-filter: blur(10px) saturate(1.05);
  -webkit-backdrop-filter: blur(10px) saturate(1.05);
}

.chat-starting__row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.chat-starting__spinner {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(244, 246, 251, 0.22);
  border-top-color: rgba(91, 140, 255, 0.95);
  border-radius: 50%;
  animation: chat-starting-spin 0.75s linear infinite;
}

.chat-starting__title {
  font-size: 0.8125rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: rgba(244, 246, 251, 0.92);
}

.chat-starting__meta {
  max-width: 100%;
  padding: 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: clamp(0.625rem, 2.5vw, 0.75rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--muted);
}

@keyframes chat-starting-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Voice-to-text: нижняя зона внутри .chat (под заголовком) */
.chat-transcribing {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 2px 10px 10px;
  pointer-events: none;
}

.chat-transcribing__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chat-transcribing__viz {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  max-width: 10.5rem;
  max-height: 100%;
}

.chat-transcribing__icon {
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  overflow: hidden;
  color: rgba(210, 225, 255, 0.92);
}

.chat-transcribing__icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.chat-transcribing__icon--voice {
  animation: chat-transcribing-icon-voice 1.8s ease-in-out infinite;
}

.chat-transcribing__voice-head,
.chat-transcribing__voice-body {
  fill: none;
  stroke: currentcolor;
  stroke-width: 1.65;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-transcribing__voice-head {
  transform-origin: 13px 11px;
  transform-box: fill-box;
  animation: chat-transcribing-head-bob 1.8s ease-in-out infinite;
}

.chat-transcribing__voice-body {
  transform-origin: 13px 22px;
  transform-box: fill-box;
  animation: chat-transcribing-body-sway 1.8s ease-in-out infinite;
}

.chat-transcribing__voice-arc {
  fill: none;
  stroke: currentcolor;
  stroke-width: 1.5;
  stroke-linecap: round;
  opacity: 0.3;
  transform-origin: 13px 11px;
  transform-box: fill-box;
}

.chat-transcribing__voice-arc--1 {
  animation: chat-transcribing-speak-arc 1.35s ease-out infinite;
}

.chat-transcribing__voice-arc--2 {
  animation: chat-transcribing-speak-arc 1.35s ease-out 0.18s infinite;
}

.chat-transcribing__voice-arc--3 {
  animation: chat-transcribing-speak-arc 1.35s ease-out 0.36s infinite;
}

.chat-transcribing__icon--text {
  animation: chat-transcribing-icon-text 1.8s ease-in-out infinite;
}

.chat-transcribing__letter path,
.chat-transcribing__letter circle {
  fill: none;
  stroke: currentcolor;
  stroke-width: 1.55;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-transcribing__letter {
  transform-box: fill-box;
  opacity: 0;
  animation: chat-transcribing-letter-in 2.5s cubic-bezier(0.33, 1, 0.68, 1) infinite;
}

.chat-transcribing__letter--1 {
  transform-origin: 6.5px 17px;
}

.chat-transcribing__letter--1 path {
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  animation: chat-transcribing-letter-draw 2.5s cubic-bezier(0.33, 1, 0.68, 1) infinite;
}

.chat-transcribing__letter--2 {
  transform-origin: 14.2px 16.5px;
  animation-delay: 0.32s;
}

.chat-transcribing__letter--3 {
  transform-origin: 19.5px 16.5px;
  animation-name: chat-transcribing-letter-in-dim;
  animation-delay: 0.64s;
}

.chat-transcribing__waves {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 5.25rem;
  height: 22px;
  overflow: hidden;
}

.chat-transcribing__waves svg {
  display: block;
  width: 100%;
  height: 100%;
}

.chat-transcribing__wave {
  fill: none;
  stroke: currentcolor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 14 86;
  stroke-dashoffset: 0;
}

.chat-transcribing__wave--top,
.chat-transcribing__wave--bot {
  stroke-width: 1.15;
  color: rgba(160, 195, 255, 0.42);
  animation: chat-transcribing-flow 1.65s linear infinite;
}

.chat-transcribing__wave--top {
  animation-delay: -0.55s;
}

.chat-transcribing__wave--bot {
  animation-delay: -1.1s;
}

.chat-transcribing__wave--mid {
  stroke-width: 1.85;
  color: rgba(200, 225, 255, 0.92);
  stroke-dasharray: 20 80;
  animation: chat-transcribing-flow-mid 1.35s linear infinite;
}

@keyframes chat-transcribing-flow {
  to {
    stroke-dashoffset: -100;
  }
}

@keyframes chat-transcribing-flow-mid {
  0% {
    stroke-dashoffset: 0;
    opacity: 0.65;
  }

  40% {
    opacity: 1;
  }

  100% {
    stroke-dashoffset: -100;
    opacity: 0.65;
  }
}

@keyframes chat-transcribing-icon-voice {
  0%,
  100% {
    transform: scale(0.97);
  }

  50% {
    transform: scale(1.04);
  }
}

@keyframes chat-transcribing-head-bob {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }

  40% {
    transform: translateY(-1.25px) scale(1.04);
  }

  70% {
    transform: translateY(0.5px) scale(0.98);
  }
}

@keyframes chat-transcribing-body-sway {
  0%,
  100% {
    transform: scaleY(1);
  }

  50% {
    transform: scaleY(1.03);
  }
}

@keyframes chat-transcribing-speak-arc {
  0% {
    opacity: 0.2;
    transform: scale(0.94);
  }

  40% {
    opacity: 0.95;
    transform: scale(1.04);
  }

  100% {
    opacity: 0.15;
    transform: scale(1.06);
  }
}

@keyframes chat-transcribing-icon-text {
  0%,
  100% {
    opacity: 0.82;
    transform: scale(0.97);
  }

  50% {
    opacity: 1;
    transform: scale(1.04);
  }
}

@keyframes chat-transcribing-letter-draw {
  0%,
  6% {
    stroke-dashoffset: 30;
  }

  22%,
  58% {
    stroke-dashoffset: 0;
  }

  78%,
  100% {
    stroke-dashoffset: -4;
  }
}

@keyframes chat-transcribing-letter-in {
  0%,
  4% {
    opacity: 0;
    transform: translateY(5px) scale(0.78);
  }

  16%,
  52% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }

  68%,
  100% {
    opacity: 0.25;
    transform: translateY(-2px) scale(0.92);
  }
}

@keyframes chat-transcribing-letter-in-dim {
  0%,
  4% {
    opacity: 0;
    transform: translateY(5px) scale(0.78);
  }

  16%,
  52% {
    opacity: 0.82;
    transform: translateY(0) scale(1);
  }

  68%,
  100% {
    opacity: 0.2;
    transform: translateY(-2px) scale(0.92);
  }
}

.chat-wrap[data-transcribing="true"] .chat:not([data-recording="true"]) {
  border-color: rgba(130, 175, 255, 0.52);
  background:
    radial-gradient(
      circle at 50% 44%,
      rgba(120, 165, 255, 0.2) 0%,
      transparent 58%
    ),
    linear-gradient(
      118deg,
      rgba(110, 150, 255, 0.03) 0%,
      rgba(160, 130, 255, 0.09) 38%,
      rgba(120, 185, 255, 0.08) 72%,
      rgba(110, 150, 255, 0.03) 100%
    ),
    linear-gradient(188deg, rgba(91, 140, 255, 0.055), rgba(130, 100, 220, 0.02)),
    var(--surface);
  background-size:
    100% 100%,
    260% 100%,
    100% 100%,
    100% 100%;
  box-shadow:
    0 0 calc(12px + 10px) rgba(100, 140, 230, 0.22),
    inset 0 0 0 1.5px rgba(130, 175, 255, 0.42);
  animation:
    chat-transcribing-glow 4.4s cubic-bezier(0.42, 0, 0.58, 1) infinite,
    chat-transcribing-shimmer 4.4s cubic-bezier(0.42, 0, 0.58, 1) infinite;
}

.chat-wrap[data-transcribing="true"] .chat {
  justify-content: flex-start;
  overflow: hidden;
}

.chat-wrap[data-transcribing="true"] .chat-model-trigger {
  display: grid;
  z-index: 6;
  pointer-events: none;
}

.chat-wrap[data-transcribing="true"] .chat-model-trigger__model-row {
  display: none !important;
}

.chat-wrap[data-transcribing="true"] .chat-model-trigger__number {
  color: rgba(220, 228, 248, 0.98);
}

.chat-wrap[data-transcribing="true"] .chat-response-preview {
  display: none !important;
}

.chat-wrap[data-transcribing="true"] .chat-card-body {
  position: relative;
  z-index: 4;
  flex: 0 0 auto;
  justify-content: flex-start;
  align-items: center;
  align-self: stretch;
  width: 100%;
  min-height: 0;
  padding: 4px 2px 6px;
  overflow: hidden;
}

.chat-wrap[data-transcribing="true"] .chat-label {
  position: relative;
  z-index: 1;
  flex-shrink: 0;
  width: 100%;
  max-width: 100%;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  font-size: clamp(0.78rem, 3.6cqw, 0.98rem);
  line-height: 1.2;
  text-align: center;
  color: rgba(220, 228, 248, 0.96);
}

.chat-wrap[data-transcribing="true"] .chat-transcribing {
  position: relative;
  z-index: 1;
  flex: 1 1 auto;
  min-height: 0;
}

@keyframes chat-transcribing-shimmer {
  0%,
  100% {
    background-position:
      0 0,
      0% 0,
      0 0,
      0 0;
  }

  50% {
    background-position:
      0 0,
      100% 0,
      0 0,
      0 0;
  }
}

@keyframes chat-transcribing-glow {
  0%,
  100% {
    box-shadow:
      0 0 14px rgba(100, 140, 220, 0.14),
      inset 0 0 0 1.5px rgba(125, 168, 255, 0.38);
  }

  50% {
    box-shadow:
      0 0 28px rgba(120, 150, 255, 0.28),
      inset 0 0 0 1.5px rgba(170, 155, 255, 0.52);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-wrap[data-transcribing="true"] .chat:not([data-recording="true"]) {
    animation: none;
  }

  .chat-transcribing__wave,
  .chat-transcribing__icon--voice,
  .chat-transcribing__icon--text,
  .chat-transcribing__voice-head,
  .chat-transcribing__voice-body,
  .chat-transcribing__voice-arc,
  .chat-transcribing__letter,
  .chat-transcribing__letter path {
    animation: none !important;
  }

  .chat-transcribing__wave {
    stroke-dasharray: none;
    stroke-dashoffset: 0;
    opacity: 0.75;
  }

  .chat-transcribing__wave--mid {
    opacity: 0.95;
  }

  .chat-transcribing__voice-arc {
    opacity: 0.7;
    transform: scale(1.05);
  }

  .chat-transcribing__letter {
    opacity: 0.88;
    transform: none;
  }

  .chat-transcribing__letter path {
    stroke-dasharray: none;
    stroke-dashoffset: 0;
  }

  .chat-transcribing__letter--3 {
    opacity: 0.65;
  }
}

.chat-wrap[data-transcribing="true"] .chat-history-btn,
.chat-wrap[data-transcribing="true"] .chat-menu,
.chat-wrap[data-transcribing="true"] .chat-stop,
.chat-wrap[data-transcribing="true"] .chat-prompt-btn,
.chat-wrap[data-transcribing="true"] .chat-summary-play {
  display: none !important;
}

/* Summarize in flight — статус внутри .chat, текст пользователя скрыт */
.chat-summarizing {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: 4px 12px 12px;
  pointer-events: none;
}

.chat-summarizing__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.chat-summarizing__content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 100%;
}

.chat-summarizing__spinner {
  width: 1.35rem;
  height: 1.35rem;
  border: 2px solid rgba(120, 220, 190, 0.22);
  border-top-color: rgba(150, 240, 210, 0.9);
  border-radius: 50%;
  animation: chat-summarize-spin 0.65s linear infinite;
}

.chat-summarizing__label {
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.03em;
  line-height: 1.2;
  text-align: center;
  color: rgba(150, 240, 210, 0.9);
}

.chat-wrap[data-summarizing="true"] .chat:not([data-recording="true"]) {
  justify-content: flex-start;
  overflow: hidden;
  box-shadow: inset 0 0 0 1.5px rgba(100, 200, 170, 0.32);
  background:
    radial-gradient(ellipse 68% 52% at 50% 54%, rgba(90, 210, 175, 0.07) 0%, transparent 70%),
    var(--surface);
}

.chat-wrap[data-summarizing="true"] .chat-model-trigger {
  z-index: 3;
  pointer-events: none;
}

.chat-wrap[data-summarizing="true"] .chat-card-body {
  flex: 0 0 auto;
  justify-content: flex-start;
  align-items: center;
  align-self: stretch;
  width: 100%;
  min-height: 0;
  overflow: hidden;
}

.chat-wrap[data-summarizing="true"] .chat-label {
  width: 100%;
  opacity: 0.88;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  text-align: center;
}

.chat-wrap[data-summarizing="true"] .chat-response-preview {
  display: none !important;
}

.chat-wrap[data-summarizing="true"] .chat-summary-play {
  display: none !important;
}

@keyframes chat-summarize-spin {
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-summarizing__spinner {
    animation: none;
    border-top-color: rgba(150, 240, 210, 0.55);
  }
}

.chat {
  container-type: size;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  width: 100%;
  height: 100%;
  min-height: 120px;
  padding: 34px var(--space-2) 36px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition:
    transform 0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94),
    background 0.15s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
  --voice-level: 0;
}

/* Outer neon halo around the card (voice-reactive) */
.chat-wrap:has(.chat[data-recording="true"]) {
  --voice-level: 0;
}

.chat-wrap:has(.chat[data-recording="true"])::before {
  content: "";
  position: absolute;
  inset: -8px;
  border-radius: calc(var(--radius-lg) + 8px);
  pointer-events: none;
  z-index: -1;
  opacity: calc(0.42 + var(--voice-level) * 0.58);
  background: radial-gradient(
    ellipse 105% 95% at 50% 48%,
    rgba(255, 90, 110, calc(0.2 + var(--voice-level) * 0.42)) 0%,
    rgba(255, 45, 85, calc(0.08 + var(--voice-level) * 0.18)) 48%,
    transparent 72%
  );
  box-shadow:
    0 0 calc(18px + var(--voice-level) * 44px) rgba(255, 77, 95, calc(0.32 + var(--voice-level) * 0.48)),
    0 0 calc(40px + var(--voice-level) * 64px) rgba(255, 40, 90, calc(0.14 + var(--voice-level) * 0.28));
}

/* iOS-like subtle lift on press (main card only, not chrome buttons) */
.chat:active:not(:disabled) {
  transform: scale(1.03);
  transition-duration: 0.14s;
  transition-timing-function: cubic-bezier(0.34, 1.12, 0.64, 1);
}

@media (prefers-reduced-motion: reduce) {
  .chat:active:not(:disabled) {
    transform: none;
    transition-duration: 0.15s;
  }
}

.chat[data-recording="true"],
.chat-wrap[data-status="ready"] .chat[data-recording="true"],
.chat-wrap[data-has-prompt="true"] .chat[data-recording="true"],
.chat-wrap[data-agent-active="true"] .chat[data-recording="true"],
.chat-wrap[data-status="starting"] .chat[data-recording="true"] {
  border-color: rgba(255, 100, 118, calc(0.62 + var(--voice-level) * 0.32));
  background:
    radial-gradient(
      ellipse 88% 78% at 50% 42%,
      rgba(255, 95, 115, calc(0.2 + var(--voice-level) * 0.42)) 0%,
      rgba(255, 55, 90, calc(0.1 + var(--voice-level) * 0.16)) 46%,
      transparent 72%
    ),
    radial-gradient(
      circle at 50% 100%,
      rgba(255, 40, 70, calc(0.06 + var(--voice-level) * 0.14)) 0%,
      transparent 55%
    ),
    linear-gradient(180deg, rgba(255, 77, 95, 0.1), rgba(255, 77, 95, 0.02)),
    var(--surface);
  box-shadow:
    inset 0 0 calc(16px + var(--voice-level) * 32px) rgba(255, 77, 95, calc(0.18 + var(--voice-level) * 0.32)),
    inset 0 0 0 1.5px rgba(255, 130, 145, calc(0.55 + var(--voice-level) * 0.38)),
    0 0 calc(10px + var(--voice-level) * 28px) rgba(255, 77, 95, calc(0.3 + var(--voice-level) * 0.45)),
    0 0 calc(22px + var(--voice-level) * 40px) rgba(255, 50, 90, calc(0.12 + var(--voice-level) * 0.26));
}

.chat[data-recording="true"][data-voice-level="1"] .chat-label,
.chat-wrap[data-voice-active="1"] .chat[data-recording="true"] .chat-label {
  text-shadow: 0 0 calc(8px + var(--voice-level) * 14px) rgba(255, 120, 135, 0.55);
}

@media (prefers-reduced-motion: reduce) {
  .chat-wrap:has(.chat[data-recording="true"])::before {
    opacity: 0.55;
    box-shadow: 0 0 18px rgba(255, 77, 95, 0.35);
  }

  .chat[data-recording="true"] {
    box-shadow:
      inset 0 0 0 1.5px rgba(255, 77, 95, 0.72),
      0 0 16px rgba(255, 77, 95, 0.3);
  }
}

.chat-label {
  width: 100%;
  max-width: 100%;
  margin: 0;
  padding: 0 2px;
  font-size: clamp(0.9rem, 4.4vw, 1.12rem);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.16;
  text-align: center;
  color: var(--text);
  pointer-events: none;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 6;
  line-clamp: 6;
  word-break: break-word;
}

.chat-label:empty {
  display: none;
}

/* Top chrome: номер слева; по центру — крошечный логотип провайдера + название модели */
.chat-model-trigger {
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  z-index: var(--z-chat-chrome);
  box-sizing: border-box;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, max-content) minmax(0, 1fr);
  align-items: center;
  gap: 2px 4px;
  min-width: 0;
  width: 100%;
  padding: 3px 12px 0;
  border: none;
  border-radius: 0;
  color: rgba(186, 200, 224, 0.92);
  background: none;
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  text-align: center;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  box-shadow: none;
  transition: color 0.15s ease;
}

.chat-model-trigger__number {
  grid-column: 1;
  justify-self: start;
  flex-shrink: 0;
  font-size: 0.875rem;
  font-weight: 750;
  letter-spacing: -0.03em;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.chat-model-trigger__model-row {
  grid-column: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 0;
  max-width: min(100%, 12.5rem);
}

.chat-model-trigger__logo {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  object-fit: contain;
  object-position: center;
  opacity: 0.88;
  user-select: none;
  -webkit-user-drag: none;
}

.chat-model-trigger__text {
  flex: 1 1 auto;
  min-width: 0;
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.6875rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1.2;
  color: rgba(139, 149, 168, 0.72);
}

@media (hover: hover) {
  .chat-model-trigger:hover .chat-model-trigger__text {
    color: rgba(186, 200, 224, 0.82);
  }

  .chat-model-trigger:hover .chat-model-trigger__number {
    color: var(--text);
  }
}

.chat-model-trigger:focus {
  outline: none;
}

.chat-model-trigger:focus-visible {
  outline: 2px solid rgba(91, 140, 255, 0.45);
  outline-offset: 1px;
  border-radius: 6px;
}

.chat-model-trigger:active:not(:disabled) .chat-model-trigger__model-row {
  transform: scale(0.96);
  transition: transform 0.12s ease;
}

.chat-model-trigger:disabled {
  opacity: 0.42;
  cursor: default;
  pointer-events: none;
}

.chat-wrap[data-has-prompt="true"] .chat-menu__item--close,
.chat-wrap[data-has-prompt="true"]:not(:has(.chat[data-recording="true"])):not(
    :has(.chat[data-voice-arming="true"])
  ):not(:has(.chat[data-transcribing="true"]))
  .chat-model-trigger {
  display: none;
}

.chat-rec-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 6;
  display: none;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 24px;
  padding-block: 3px;
  padding-inline: 6px 7px;
  border: 1px solid rgba(255, 77, 95, 0.72);
  border-radius: 999px;
  background: rgba(255, 77, 95, 0.28);
  backdrop-filter: blur(10px) saturate(1.1);
  -webkit-backdrop-filter: blur(10px) saturate(1.1);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1;
  color: #ffd8de;
  pointer-events: none;
  box-shadow:
    0 0 0 1px rgba(255, 77, 95, 0.28) inset,
    0 0 10px rgba(255, 77, 95, 0.28);
  animation: chat-rec-blink 1.1s ease-in-out infinite;
}

.chat-wrap:has(.chat[data-recording="true"]) .chat-rec-badge {
  display: inline-flex;
}

@keyframes chat-rec-blink {
  0%,
  100% {
    opacity: 1;
    box-shadow:
      0 0 0 1px rgba(255, 77, 95, 0.28) inset,
      0 0 10px rgba(255, 77, 95, 0.28);
  }

  50% {
    opacity: 0.5;
    box-shadow:
      0 0 0 1px rgba(255, 77, 95, 0.16) inset,
      0 0 5px rgba(255, 77, 95, 0.14);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-rec-badge {
    animation: none;
    opacity: 0.88;
  }
}

.chat-wrap[data-has-prompt="true"]::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: var(--radius-lg);
  padding: 2px;
  background: rgba(255, 193, 77, 0.95);
  -webkit-mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  -webkit-mask-composite: xor;
  mask:
    linear-gradient(#fff 0 0) content-box,
    linear-gradient(#fff 0 0);
  mask-composite: exclude;
  animation: chat-prompt-border-pulse 1.6s ease-in-out infinite;
  pointer-events: none;
}

.chat-wrap[data-has-prompt="true"] .chat {
  position: relative;
  z-index: 1;
}

.chat-wrap[data-has-prompt="true"] .chat:not([data-recording="true"]) {
  border-color: rgba(255, 193, 77, 0.28);
  box-shadow: none;
}

.chat-wrap[data-has-prompt="true"][data-status="ready"] .chat:not([data-recording="true"]) {
  box-shadow: none;
}

@keyframes chat-prompt-border-pulse {
  0%,
  100% {
    opacity: 0.32;
  }
  50% {
    opacity: 1;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-wrap[data-has-prompt="true"]::after {
    animation: none;
    opacity: 0.72;
  }
}

.chat-response-countdown {
  display: none !important;
}

.chat-response-countdown__svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.chat-response-countdown__track {
  fill: none;
  stroke: rgba(61, 214, 140, 0.08);
  stroke-width: 2.5;
  vector-effect: non-scaling-stroke;
}

.chat-response-countdown__path {
  fill: none;
  stroke-width: 2.75;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  transition: stroke-dasharray 120ms linear;
}

.chat-response-countdown__timer {
  position: absolute;
  top: 7px;
  right: 46px;
  z-index: 1;
  min-width: 18px;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(9, 11, 16, 0.72);
  border: 1px solid rgba(61, 214, 140, 0.28);
  font-size: 0.5625rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1.1;
  color: rgba(196, 255, 224, 0.95);
  text-align: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.chat-card-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  overflow: hidden;
}

/* Corner controls: menu (top-right), chat (bottom-left), summary play (bottom-right) */
.chat-menu__trigger,
.chat-history-btn,
.chat-summary-play {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 36px;
  height: 36px;
  margin: 0;
  padding: 0;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: rgba(148, 160, 184, 0.62);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  overflow: visible;
  transition:
    color 0.16s ease,
    transform 0.12s ease,
    opacity 0.16s ease;
}

/* Expanded touch target ~60×60px (visual control stays 36×36) */
.chat-menu__trigger::before,
.chat-history-btn::before,
.chat-summary-play::before {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 16px;
}

@media (hover: hover) {
  .chat-menu__trigger:hover:not(:disabled),
  .chat-history-btn:hover:not(:disabled),
  .chat-summary-play:hover:not(:disabled) {
    color: rgba(206, 214, 232, 0.95);
  }
}

.chat-menu__trigger:focus-visible,
.chat-history-btn:focus-visible,
.chat-summary-play:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px rgba(91, 140, 255, 0.45);
}

.chat-menu__trigger:active:not(:disabled),
.chat-history-btn:active:not(:disabled),
.chat-summary-play:active:not(:disabled) {
  transform: scale(0.94);
  color: rgba(220, 228, 244, 0.98);
}

.chat-menu__trigger:disabled,
.chat-history-btn:disabled,
.chat-summary-play:disabled {
  opacity: 0.35;
  cursor: default;
}

.chat-summary-play {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
}

/* Виртуальная зона нажатия +10px вокруг видимого круга (итого ~50×50) */
.chat-summary-play::before {
  inset: -10px;
  border-radius: 50%;
}

.chat-summary-play[hidden] {
  display: none !important;
}

.chat-summary-play__icon {
  position: relative;
  z-index: 1;
  display: block;
  width: 14px;
  height: 14px;
  margin: 0;
}

/* Непрослушанное summary: мигающий бордер; без is-unlistened — обычная кнопка PLAY */
.chat-summary-play.is-unlistened {
  border: 1.5px solid rgba(255, 190, 80, 0.28);
  animation: chat-summary-play-unlistened-border 1.5s ease-in-out infinite;
}

@keyframes chat-summary-play-unlistened-border {
  0%,
  100% {
    border-color: rgba(255, 190, 80, 0.22);
  }

  50% {
    border-color: rgba(255, 205, 110, 0.88);
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-summary-play.is-unlistened {
    animation: none !important;
    border-color: rgba(255, 200, 100, 0.55);
  }
}

.chat-summary-play.is-stop {
  color: rgba(248, 113, 113, 0.92);
}

.chat-summary-play.is-stop:hover:not(:disabled) {
  color: rgba(252, 165, 165, 0.98);
}

.chat-summary-play.is-loading {
  color: rgba(148, 160, 184, 0.42);
  cursor: wait;
}

.chat-summary-play.is-loading .chat-summary-play__icon {
  opacity: 0.55;
}

.chat-summary-play__progress-ring {
  position: absolute;
  inset: 0;
  width: 30px;
  height: 30px;
  transform: rotate(-90deg);
  z-index: 0;
  pointer-events: none;
}

.chat-summary-play__progress-track {
  fill: none;
  stroke: rgba(148, 160, 184, 0.22);
  stroke-width: 2.5;
}

.chat-summary-play__progress-bar {
  fill: none;
  stroke: rgba(91, 140, 255, 0.92);
  stroke-width: 2.5;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.18s ease;
}

.chat-summary-play.is-indeterminate .chat-summary-play__progress-ring {
  animation: chat-summary-play-indeterminate 0.95s linear infinite;
}

@keyframes chat-summary-play-indeterminate {
  to {
    transform: rotate(270deg);
  }
}

/* Water-ripple rings from Stop while summary TTS plays */
.chat-summary-playback-ripples {
  position: absolute;
  right: 8px;
  bottom: 8px;
  width: 30px;
  height: 30px;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease;
}

.chat-wrap.chat-wrap--summary-audio-active .chat-summary-playback-ripples {
  opacity: 1;
  visibility: visible;
}

.chat-summary-playback-ripples__ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  box-sizing: border-box;
  border-radius: 50%;
  border: 2px solid rgba(248, 113, 113, 0.72);
  background: transparent;
  box-shadow:
    0 0 0 1px rgba(248, 113, 113, 0.12),
    0 0 14px rgba(248, 113, 113, 0.28);
  transform: scale(0.5);
  opacity: 0;
  animation: chat-summary-playback-ripple 2.4s cubic-bezier(0.22, 0.55, 0.25, 1) infinite;
}

.chat-summary-playback-ripples__ring:nth-child(2) {
  animation-delay: 0.8s;
}

.chat-summary-playback-ripples__ring:nth-child(3) {
  animation-delay: 1.6s;
}

.chat-wrap.chat-wrap--summary-audio-active .chat-summary-play.is-stop {
  z-index: 6;
  color: rgba(252, 129, 129, 0.98);
  animation: chat-summary-playback-btn-glow 1.35s ease-in-out infinite;
}

@keyframes chat-summary-playback-ripple {
  0% {
    transform: scale(0.52);
    opacity: 0.88;
    border-width: 2.5px;
  }
  55% {
    opacity: 0.42;
  }
  100% {
    transform: scale(2.65);
    opacity: 0;
    border-width: 1px;
  }
}

@keyframes chat-summary-playback-btn-glow {
  0%,
  100% {
    filter: drop-shadow(0 0 4px rgba(248, 113, 113, 0.45));
  }
  50% {
    filter: drop-shadow(0 0 10px rgba(248, 113, 113, 0.85));
  }
}

.chat-summary-play__stop-icon {
  position: relative;
  z-index: 1;
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 2px;
  background: currentColor;
}

/* Перенос по слогам (часть слова + «-» + остаток на следующей строке), не целое слово */
.chat-response-preview {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  margin: 0;
  padding: 0 2px;
  font-size: clamp(calc(0.625rem + 1px), calc(5.4cqw + 1px), calc(0.8125rem + 1px));
  font-weight: 500;
  letter-spacing: -0.01em;
  line-height: 1.12;
  text-align: left;
  color: var(--reply-text);
  pointer-events: none;
  overflow: hidden;
  display: block;
  overflow-wrap: break-word;
  word-break: normal;
  hyphens: auto;
  -webkit-hyphens: auto;
  -moz-hyphens: auto;
  hyphenate-character: "-";
  hyphenate-limit-chars: 5 3 2;
  text-wrap: pretty;
}

.chat-response-preview__prefix {
  white-space: nowrap;
}

.chat-response-preview__who {
  font-weight: 700;
  color: rgba(226, 232, 240, 0.98);
}

/* Summary preview: короткий блок по вертикали по центру карточки; длинный — max-height + скролл в превью */
.chat-wrap[data-response-preview="true"] {
  --chat-preview-inline-pad: 8px;
}

.chat-wrap[data-response-preview="true"] .chat {
  justify-content: center;
  align-items: stretch;
  padding-top: 28px;
  padding-bottom: 6px;
  padding-inline: 0;
}

.chat-wrap[data-response-preview="true"] .chat-card-body {
  flex: 0 1 auto;
  max-height: 100%;
  align-self: stretch;
  width: 100%;
  min-height: 0;
  justify-content: flex-start;
  gap: 2px;
  overflow: hidden;
  box-sizing: border-box;
  padding-inline: var(--chat-preview-inline-pad);
}

.chat-wrap[data-response-preview="true"] .chat-label,
.chat-wrap[data-response-preview="true"] .chat-response-preview {
  padding-inline: 0;
}

.chat-wrap[data-response-preview="true"] .chat-response-preview:not([hidden]) {
  display: block;
  flex: 1 1 auto;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  hyphens: auto;
  -webkit-hyphens: auto;
  -moz-hyphens: auto;
  pointer-events: auto;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  overscroll-behavior-y: contain;
  scroll-padding-bottom: 44px;
  user-select: none;
  -webkit-user-select: none;
}

.chat-wrap[data-response-preview="true"] .chat-label {
  opacity: 1;
  flex-shrink: 0;
  width: 100%;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  font-size: clamp(0.75rem, 4.2cqw, 0.875rem);
  line-height: 1.1;
  text-align: center;
}

.chat-wrap[data-has-prompt="true"] .chat-response-countdown,
.chat-wrap[data-transcribing="true"] .chat-response-countdown,
.chat-wrap:has(.chat[data-recording="true"]) .chat-response-countdown {
  display: none;
}

.chat-wrap[data-response-preview="true"][data-agent-active="true"] .chat:not([data-recording="true"]) {
  background: var(--surface);
}

.chat-prompt-btn {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 999px;
  background: rgba(255, 193, 77, 0.95);
  color: #1a1408;
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  animation: prompt-pulse 1.4s ease-in-out infinite;
  box-shadow: 0 0 0 0 rgba(255, 193, 77, 0.55);
}

.chat-prompt-btn:active {
  transform: scale(0.94);
}

@keyframes prompt-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(255, 193, 77, 0.45);
  }
  50% {
    box-shadow: 0 0 0 10px rgba(255, 193, 77, 0);
  }
}

.prompt-picker__options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0 16px;
}

.prompt-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  text-align: left;
  color: var(--text);
  background: var(--surface);
  cursor: pointer;
  touch-action: manipulation;
}

.prompt-option__label {
  font-size: 0.9375rem;
  font-weight: 600;
}

.prompt-option__hint {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--accent);
  white-space: nowrap;
}

.prompt-option:active {
  background: var(--surface-hover);
}

.chat-wrap[data-agent-active="true"] .chat-menu__item--close {
  display: none;
}

.chat-menu {
  position: absolute;
  top: 3px;
  right: 1px;
  z-index: 5;
  overflow: visible;
}

.chat-menu__trigger-icon {
  position: relative;
  z-index: 1;
  width: 15px;
  height: 15px;
  display: block;
}

.chat-menu.is-open .chat-menu__trigger {
  color: rgba(186, 218, 255, 0.96);
}

.chat-menu__panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 188px;
  padding: 6px;
  border: 1px solid rgba(139, 153, 178, 0.28);
  border-radius: 14px;
  background: rgba(9, 11, 16, 0.96);
  box-shadow:
    0 10px 28px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.04);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
}

.chat-menu__panel[hidden] {
  display: none;
}

.chat-menu__item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  color: rgba(244, 246, 251, 0.94);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 550;
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.12s ease, color 0.12s ease;
}

.chat-menu__item[hidden] {
  display: none;
}

.chat-menu__item:disabled {
  opacity: 0.45;
  cursor: default;
}

.chat-menu__item-icon {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  color: rgba(186, 218, 255, 0.92);
}

.chat-menu__item--close .chat-menu__item-icon {
  color: rgba(180, 188, 204, 0.95);
}

.chat-menu__item--reload .chat-menu__item-icon {
  color: rgba(91, 140, 255, 0.95);
}

.chat-menu__item--focus .chat-menu__item-icon {
  color: rgba(120, 200, 160, 0.95);
}

.chat-menu__item-label {
  min-width: 0;
  white-space: nowrap;
}

.chat-menu__item:active:not(:disabled) {
  background: rgba(91, 140, 255, 0.14);
}

.chat-reload__icon,
.chat-fullscreen__icon,
.chat-close__icon,
.chat-focus__icon {
  width: 16px;
  height: 16px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-fullscreen__icon {
  stroke-width: 1.7;
}

.chat-stop {
  position: absolute;
  left: 50%;
  bottom: 12px;
  z-index: var(--z-chat-chrome);
  transform: translateX(-50%);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 62px;
  height: 26px;
  border: 1px solid rgba(255, 107, 107, 0.42);
  border-radius: 999px;
  padding: 0;
  background: rgba(255, 107, 107, 0.2);
  color: var(--danger);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  overflow: visible;
  box-shadow: 0 0 12px rgba(255, 77, 95, 0.22);
  transition:
    background 0.15s ease,
    transform 0.1s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.chat-stop::before {
  content: "";
  position: absolute;
  inset: -10px -6px;
  border-radius: 999px;
}

.chat-recording-stop {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border: 1px solid rgba(255, 107, 107, 0.48);
  border-radius: 999px;
  padding: 0;
  background: rgba(255, 107, 107, 0.24);
  color: var(--danger);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 0 0 18px rgba(255, 77, 95, 0.32);
  transition:
    background 0.15s ease,
    transform 0.1s ease,
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.chat-stop__icon {
  position: relative;
  z-index: 1;
  display: block;
  width: 11px;
  height: 11px;
  border-radius: 0;
  background: currentColor;
}

.chat-recording-stop .chat-stop__icon {
  width: 22px;
  height: 22px;
  border-radius: 4px;
}

.chat-stop:active {
  transform: translateX(-50%) scale(0.94);
  border-color: rgba(255, 107, 107, 0.58);
  background: rgba(255, 107, 107, 0.32);
  box-shadow: 0 0 16px rgba(255, 77, 95, 0.34);
}

.chat-recording-stop:active {
  transform: scale(0.96);
  border-color: rgba(255, 107, 107, 0.62);
  background: rgba(255, 107, 107, 0.36);
  box-shadow: 0 0 22px rgba(255, 77, 95, 0.4);
}

/* Hide chat chrome while voice recording; restores when data-recording is cleared */
.chat-wrap:has(.chat[data-recording="true"]) .chat-history-btn,
.chat-wrap:has(.chat[data-recording="true"]) .chat-menu,
.chat-wrap:has(.chat[data-recording="true"]) .chat-stop,
.chat-wrap:has(.chat[data-recording="true"]) .chat-prompt-btn {
  display: none !important;
}

/* Запись / arming: номер терминала в левом верхнем углу всегда виден */
.chat-wrap:has(.chat[data-recording="true"]) .chat-model-trigger,
.chat-wrap:has(.chat[data-voice-arming="true"]) .chat-model-trigger {
  display: grid;
  z-index: 6;
  pointer-events: none;
  cursor: default;
}

.chat-wrap:has(.chat[data-recording="true"]) .chat-model-trigger__model-row,
.chat-wrap:has(.chat[data-voice-arming="true"]) .chat-model-trigger__model-row {
  display: none !important;
}

.chat-wrap:has(.chat[data-recording="true"]) .chat-model-trigger__number,
.chat-wrap:has(.chat[data-voice-arming="true"]) .chat-model-trigger__number {
  grid-column: 1;
  justify-self: start;
  color: rgba(255, 228, 232, 0.98);
  text-shadow: 0 0 10px rgba(255, 77, 95, 0.4);
}
.chat-history-btn {
  position: absolute;
  left: 1px;
  bottom: 3px;
  z-index: 5;
}

.chat-history-btn__icon {
  position: relative;
  z-index: 1;
  display: block;
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-wrap[data-has-prompt="true"] .chat-history-btn {
  display: none;
}
.chat-wrap--window-closed {
  aspect-ratio: auto;
  min-height: 148px;
}

.chat-window-closed {
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
  min-height: 148px;
  padding: 14px 12px 12px;
  border-radius: var(--radius-lg);
  border: 1px dashed var(--border-strong);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
}

.chat-window-closed__title {
  font-size: 1.05rem;
  font-weight: 700;
}

.chat-window-closed__meta,
.chat-window-closed__status {
  font-size: 0.8125rem;
  color: var(--muted);
  line-height: 1.35;
}

.chat-window-closed__restore {
  margin-top: auto;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--accent-soft);
  color: var(--accent);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 650;
  cursor: pointer;
}

.chat-window-closed__restore:active {
  transform: scale(0.98);
}

.chat-window-closed__history {
  position: absolute;
  top: 8px;
  right: 44px;
}

.chat-window-closed__delete {
  position: absolute;
  top: 8px;
  right: 8px;
  min-width: 44px;
  min-height: 32px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
}

.chat-window-closed__delete:active {
  color: var(--danger);
  background: var(--danger-soft);
}

/*
 * Награда за завершённый ответ: конфетти + мягкое свечение карточки.
 * Ритм медленный (без строба) — заметная обратная связь, в т.ч. при ADHD.
 */

.chat-wrap.chat-wrap--response-celebration {
  animation:
    chat-wrap-response-twinkle 2s ease-in-out 7,
    chat-wrap-celebrate-nudge 3.5s ease-in-out 4;
}

/* Мягкий цветной ореол вокруг плитки (медленное «дыхание») */
.chat-wrap.chat-wrap--response-celebration::after {
  content: "";
  position: absolute;
  inset: -8px;
  z-index: 0;
  border-radius: calc(var(--radius-lg) + 6px);
  pointer-events: none;
  opacity: 0;
  box-shadow:
    0 0 32px rgba(255, 200, 130, 0.42),
    0 0 64px rgba(91, 140, 255, 0.28),
    0 0 96px rgba(194, 107, 255, 0.12),
    inset 0 0 0 1px rgba(255, 255, 255, 0.1);
  animation: chat-celebration-aura 3.5s ease-in-out 4;
}

.chat-wrap.chat-wrap--response-celebration .chat:not([data-recording="true"]) {
  position: relative;
  z-index: 2;
  animation: chat-inner-response-spark 2s ease-in-out 7;
}

@keyframes chat-wrap-response-twinkle {
  0%,
  100% {
    filter: brightness(1);
  }

  50% {
    filter: brightness(1.09) saturate(1.12);
  }
}

@keyframes chat-wrap-celebrate-nudge {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.018);
  }
}

@keyframes chat-celebration-aura {
  0%,
  100% {
    opacity: 0;
    transform: scale(0.94);
  }

  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes chat-inner-response-spark {
  0%,
  100% {
    box-shadow:
      inset 0 0 0 0 transparent,
      0 0 0 0 transparent;
  }

  35% {
    box-shadow:
      inset 0 0 0 1px rgba(91, 140, 255, 0.44),
      0 0 22px rgba(255, 193, 77, 0.32);
  }

  68% {
    box-shadow:
      inset 0 0 0 1px rgba(194, 107, 255, 0.4),
      0 0 20px rgba(91, 140, 255, 0.34);
  }
}

.response-confetti-host {
  position: fixed;
  inset: 0;
  z-index: var(--z-response-celebration, 140);
  pointer-events: none;
  overflow: hidden;
}

.response-confetti-piece {
  position: absolute;
  width: 7px;
  height: 10px;
  margin-left: -3.5px;
  margin-top: -5px;
  border-radius: 2px;
  opacity: 0;
  will-change: transform, opacity;
  animation-fill-mode: forwards;
}

.response-confetti-piece--streamer {
  width: 3px;
  height: 17px;
  margin-left: -1.5px;
  margin-top: -8.5px;
  border-radius: 1px;
}

.response-confetti-drift {
  position: absolute;
  width: 5px;
  height: 5px;
  margin-left: -2.5px;
  margin-top: -2.5px;
  border-radius: 50%;
  opacity: 0;
  will-change: transform, opacity;
  animation-fill-mode: forwards;
}

@keyframes response-confetti-burst {
  0% {
    transform: translate3d(0, 0, 0) rotate(0deg);
    opacity: 0;
  }

  6% {
    opacity: 1;
  }

  72% {
    opacity: 0.92;
  }

  100% {
    transform: translate3d(var(--tx, 0), var(--ty, 0), 0) rotate(var(--rot, 540deg));
    opacity: 0;
  }
}

@keyframes response-confetti-drift {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0;
  }

  12% {
    opacity: 0.88;
  }

  78% {
    opacity: 0.55;
  }

  100% {
    transform: translate3d(var(--dx, 0), var(--dy, 0), 0) scale(0.35);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chat-wrap.chat-wrap--response-celebration,
  .chat-wrap.chat-wrap--response-celebration .chat:not([data-recording="true"]) {
    animation: none !important;
    filter: none !important;
    transform: none !important;
  }

  .chat-wrap.chat-wrap--response-celebration::after {
    animation: none !important;
    opacity: 0 !important;
    box-shadow: none !important;
  }
}

/* Shared modals: pickers, PIN gate, close confirm */

/* Preset picker */
.preset-picker {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: end center;
  padding:
    12px
    calc(12px + var(--safe-right))
    calc(12px + var(--safe-bottom))
    calc(12px + var(--safe-left));
}

.preset-picker[hidden] {
  display: none !important;
}

.preset-picker__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(4px);
}

.preset-picker__sheet {
  position: relative;
  width: min(100%, 400px);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 20px;
  background: var(--bg-elevated);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
}

.preset-picker__title {
  margin: 0 0 4px;
  font-size: 1.125rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.preset-picker__hint {
  margin: 0 0 16px;
  font-size: 0.8125rem;
  color: var(--muted);
}

.preset-picker__options {
  display: grid;
  gap: 8px;
  max-height: min(60vh, 520px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.preset-option {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  background: var(--surface);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.preset-option:active {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.preset-option__lead {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.preset-option__logo {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  object-fit: contain;
  border-radius: 8px;
}

.preset-option__name {
  font-size: 1rem;
  font-weight: 600;
}

.preset-option__cmd {
  font-size: 0.75rem;
  color: var(--muted);
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.chat-close-confirm__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.chat-close-confirm__confirm {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  background: var(--surface-hover);
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 650;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.1s ease;
}

.chat-close-confirm__confirm:active {
  transform: scale(0.98);
  background: var(--accent-soft);
}

.chat-close-confirm__danger {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 16px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
}

.chat-close-confirm__danger:active {
  background: var(--danger-soft);
  color: var(--danger);
}

.preset-picker__cancel {
  margin-top: 10px;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--muted);
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  touch-action: manipulation;
}

.pin-login__sheet {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.pin-login__label {
  font-size: 0.875rem;
  color: var(--muted);
}

.pin-login__input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid rgba(244, 246, 251, 0.12);
  border-radius: var(--radius-md);
  background: rgba(8, 10, 16, 0.72);
  color: var(--text);
  font-size: 1rem;
}

.pin-login__input:focus {
  outline: 2px solid rgba(91, 140, 255, 0.45);
  outline-offset: 1px;
}

.pin-login__error {
  margin: 0;
  color: #ff8f98;
  font-size: 0.875rem;
}

.pin-login__submit {
  margin-top: 4px;
  width: 100%;
  min-height: 44px;
  border: 0;
  border-radius: var(--radius-md);
  background: rgba(91, 140, 255, 0.92);
  color: #081018;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  touch-action: manipulation;
}

.pin-login__submit:active {
  transform: scale(0.98);
}

.settings-modal .preset-picker__sheet,
.picker-modal.settings-modal .preset-picker__sheet {
  width: min(100%, 420px);
  padding: 0;
  overflow: hidden;
}

.settings-modal__sheet {
  display: flex;
  flex-direction: column;
  max-height: min(92vh, 820px);
}

.settings-modal__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding: var(--space-4) var(--space-4) var(--space-2);
  flex-shrink: 0;
}

.settings-modal__header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin: -4px -4px 0 0;
}

.settings-modal__title {
  flex: 1;
  margin: 0;
}

.settings-modal__close {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  margin: -4px -4px 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.1s ease;
}

.settings-modal__close:active {
  transform: scale(0.94);
  color: var(--text);
  border-color: rgba(139, 149, 168, 0.55);
  background: rgba(24, 28, 38, 0.92);
}

.settings-modal__tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 0 var(--space-4) var(--space-3);
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: rgba(8, 10, 16, 0.55);
  flex-shrink: 0;
}

.settings-modal__tab {
  min-height: 36px;
  border: 0;
  border-radius: var(--radius-pill);
  padding: 7px 12px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 650;
  cursor: pointer;
  touch-action: manipulation;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease;
}

.settings-modal__tab.is-active {
  background: var(--surface-hover);
  color: var(--text);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.35),
    inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.settings-modal__panel {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 var(--space-4) calc(var(--space-5) + var(--safe-bottom));
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

.settings-modal__panel[hidden] {
  display: none !important;
}


/* Settings modal — iOS-style grouped lists */

.settings-stack {
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.settings-stack--tight {
  gap: var(--space-3);
}

.settings-section__label {
  margin: 0 0 var(--space-2);
  padding: 0 var(--space-1);
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.settings-lead {
  margin: 0;
  padding: 0 var(--space-1);
  font-size: 0.8125rem;
  line-height: 1.45;
  color: var(--muted);
}

.settings-empty {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  font-size: 0.8125rem;
  color: var(--muted);
}

/* Inset group (shared by toggles, models, picker rows) */
.settings-inset {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(24, 28, 38, 0.55);
}

.settings-inset > * + * {
  border-top: 1px solid var(--border);
}

.settings-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  width: 100%;
  min-height: 48px;
  margin: 0;
  padding: 10px var(--space-4);
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 0.9375rem;
  text-align: left;
  cursor: default;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.settings-row--toggle,
.settings-row--check {
  cursor: pointer;
}

.settings-row--stepper {
  justify-content: space-between;
}

.settings-row--picker {
  cursor: pointer;
  transition: background 0.12s ease;
}

.settings-row--picker:active {
  background: var(--surface-hover);
}

.settings-row--picker[aria-expanded="true"] {
  background: rgba(91, 140, 255, 0.08);
}

.settings-row--picker[aria-expanded="true"] .settings-row__chevron {
  transform: rotate(90deg);
  color: var(--accent);
}

.settings-row__label {
  flex: 1 1 auto;
  min-width: 0;
  font-weight: 550;
  line-height: 1.3;
}

.settings-row__stack {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.settings-row__hint {
  font-size: 0.75rem;
  font-weight: 450;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-row__value {
  flex-shrink: 0;
  max-width: 52%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--muted);
}

.settings-row__chevron {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  transition:
    transform 0.2s ease,
    color 0.15s ease;
}

.settings-row__chevron::before {
  content: "›";
}

/* Toggle switch */
.settings-row__switch {
  flex-shrink: 0;
  position: relative;
  width: 48px;
  height: 28px;
  margin: 0;
  appearance: none;
  border: 0;
  border-radius: var(--radius-pill);
  background: rgba(139, 149, 168, 0.35);
  cursor: pointer;
  transition: background 0.2s ease;
}

.settings-row__switch::before {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
  transition: transform 0.2s ease;
}

.settings-row__switch:checked {
  background: var(--accent);
}

.settings-row__switch:checked::before {
  transform: translateX(20px);
}

.settings-row__switch:focus-visible {
  outline: 2px solid rgba(91, 140, 255, 0.55);
  outline-offset: 2px;
}

/* Stepper */
.settings-stepper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  flex-shrink: 0;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: rgba(8, 10, 16, 0.45);
}

.settings-stepper__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--accent);
  font-size: 1.125rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.settings-stepper__btn:active {
  background: var(--accent-soft);
}

.settings-stepper__value {
  min-width: 1.75rem;
  font-size: 0.9375rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--text);
}

/* Event card */
.settings-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: linear-gradient(180deg, rgba(28, 32, 44, 0.65) 0%, rgba(18, 21, 28, 0.4) 100%);
  overflow: hidden;
}

.settings-card__head {
  padding: var(--space-3) var(--space-4) var(--space-2);
}

.settings-card__title {
  margin: 0;
  font-size: 0.9375rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.settings-card__hint {
  margin: var(--space-1) 0 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--muted);
}

.settings-card .settings-inset {
  border: 0;
  border-radius: 0;
  border-top: 1px solid var(--border);
  background: rgba(12, 14, 20, 0.35);
}

/* Expandable sound picker */
.sound-picker-list {
  display: flex;
  flex-direction: column;
  max-height: min(42vh, 280px);
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  border-top: 1px solid var(--border);
  background: rgba(8, 10, 16, 0.5);
}

.sound-picker-list[hidden] {
  display: none !important;
}

.sound-picker-option {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  padding: 8px var(--space-4);
  cursor: pointer;
  touch-action: manipulation;
  transition: background 0.12s ease;
}

.sound-picker-option + .sound-picker-option {
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.sound-picker-option:active {
  background: var(--surface-hover);
}

.sound-picker-option.is-selected,
.sound-picker-option:has(input:checked) {
  background: rgba(91, 140, 255, 0.1);
}

.sound-picker-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.sound-picker-option__main {
  flex: 1 1 auto;
  min-width: 0;
}

.sound-picker-option__title {
  display: block;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sound-picker-option__play {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  color: var(--accent);
  font-size: 0.625rem;
  cursor: pointer;
  touch-action: manipulation;
}

.sound-picker-option__play:active {
  transform: scale(0.94);
  background: var(--accent-soft);
}

.model-settings-options {
  min-height: 0;
}

/* Model / provider picker modals (same shell as settings) */
.picker-modal__panel {
  padding-top: 0;
}

.picker-modal__options {
  min-height: 0;
}

.picker-modal__toolbar {
  flex-shrink: 0;
  padding: 0 var(--space-4) var(--space-2);
}

.picker-modal__toolbar:not(:has(.picker-modal__back:not([hidden]))) {
  display: none;
}

.picker-modal__back {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 4px 2px;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 650;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.picker-modal__back:active {
  opacity: 0.75;
}

.picker-modal__icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    transform 0.1s ease;
}

.picker-modal__icon-btn:active:not(:disabled) {
  transform: scale(0.94);
  color: var(--text);
  border-color: rgba(139, 149, 168, 0.55);
  background: rgba(24, 28, 38, 0.92);
}

.picker-modal__icon-btn:disabled {
  opacity: 0.45;
  cursor: wait;
}

.picker-modal__icon-btn[data-busy="true"] .picker-modal__icon-btn-svg {
  animation: picker-modal-spin 0.85s linear infinite;
}

@keyframes picker-modal-spin {
  to {
    transform: rotate(360deg);
  }
}

.picker-modal__icon-btn-svg {
  width: 17px;
  height: 17px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.settings-row--option {
  cursor: pointer;
  text-align: left;
  transition: background 0.12s ease;
}

.settings-row--option:active {
  background: var(--surface-hover);
}

.settings-row--option.is-selected {
  background: rgba(91, 140, 255, 0.1);
}

.settings-row__logo {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  object-fit: contain;
  object-position: center;
  border-radius: 7px;
  user-select: none;
  -webkit-user-drag: none;
}

.settings-row__mark {
  flex-shrink: 0;
  min-width: 1.25rem;
  font-size: 0.875rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  color: transparent;
}

.settings-row--option.is-selected .settings-row__mark {
  color: var(--accent);
}

.settings-row--option.is-selected .settings-row__mark::before {
  content: "✓";
}

/* ElevenLabs API keys (STT) */
.elevenlabs-tts-config {
  margin-bottom: 12px;
}

.elevenlabs-tts-config__meta {
  margin: 4px 0 0;
  font-size: 0.8125rem;
  line-height: 1.45;
  color: rgba(203, 213, 225, 0.88);
}

.settings-row__label--sub {
  margin: 12px 0 6px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(148, 163, 184, 0.85);
}

.elevenlabs-keys-section__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: var(--space-2) 0 0;
  padding: 0 var(--space-1);
}

.elevenlabs-keys-section__checked {
  margin: 0;
  font-size: 0.6875rem;
  color: var(--muted);
}

.elevenlabs-keys-section__refresh {
  flex-shrink: 0;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 0.6875rem;
  font-weight: 600;
  cursor: pointer;
}

.elevenlabs-keys-section__refresh:hover {
  background: rgba(255, 255, 255, 0.04);
}

.elevenlabs-key-row {
  padding: 11px var(--space-4);
  border-bottom: 1px solid var(--border);
}

.elevenlabs-key-row:last-child {
  border-bottom: 0;
}

.elevenlabs-key-row--active {
  background: rgba(61, 214, 140, 0.08);
}

.elevenlabs-key-row--selectable {
  cursor: pointer;
}

.elevenlabs-key-row--selectable:hover {
  background: rgba(255, 255, 255, 0.04);
}

.elevenlabs-key-row__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.elevenlabs-key-row__title {
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--text);
}

.elevenlabs-key-row__hint {
  margin-left: 6px;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.elevenlabs-key-row__badge {
  flex-shrink: 0;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(196, 255, 224, 0.95);
  background: rgba(61, 214, 140, 0.18);
  border: 1px solid rgba(61, 214, 140, 0.35);
}

.elevenlabs-key-row__meta {
  margin: 6px 0 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--muted);
}

.elevenlabs-key-row__error {
  margin: 4px 0 0;
  font-size: 0.6875rem;
  line-height: 1.35;
  color: var(--danger);
}

/* Chat visibility picker — light chat list */

.visibility-modal__panel {
  padding-top: 0;
}

.visibility-empty {
  margin: 0;
  padding: var(--space-4) 0;
  font-size: 0.8125rem;
  color: var(--muted);
  text-align: center;
}

.visibility-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.visibility-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: var(--space-3);
  min-height: 44px;
  padding: 4px 0;
  border-radius: var(--radius-md);
}

.visibility-row__logo {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  object-fit: contain;
}

.visibility-row__meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}

.visibility-row__num {
  flex-shrink: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.visibility-row__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--muted);
}

.visibility-row__switch {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  margin: 0;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.visibility-row__switch-input {
  width: 44px;
  height: 26px;
}

.visibility-row__switch-input::before {
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
}

.visibility-row__switch-input:checked::before {
  transform: translateX(18px);
}

.footer-action--chats {
  position: relative;
}

.footer-action--chats .footer-action__badge {
  position: absolute;
  top: 4px;
  right: 4px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 0.625rem;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
  pointer-events: none;
}

/* macOS window list modal (footer «Окна») */

.system-windows-modal .preset-picker__sheet {
  width: min(100%, 520px);
  transition: transform 0.24s cubic-bezier(0.32, 0.82, 0.18, 1);
  will-change: transform;
}

.system-windows-modal .preset-picker__sheet.is-swipe-dragging {
  transition: none;
  transform: translateY(var(--swipe-drag-y, 0));
}

.system-windows-modal .preset-picker__sheet.is-swipe-dismissing {
  transform: translateY(var(--swipe-drag-y, 0));
}

.system-windows-modal.is-swipe-active .preset-picker__backdrop {
  opacity: 0.38;
  transition: opacity 0.18s ease;
}

@media (prefers-reduced-motion: reduce) {
  .system-windows-modal .preset-picker__sheet.is-swipe-dragging,
  .system-windows-modal .preset-picker__sheet.is-swipe-dismissing {
    transition: none;
    transform: none;
  }
}

.system-windows-modal .system-windows-modal__panel {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  padding: 0 var(--space-4);
  overflow: hidden;
}

.system-windows-modal__footer {
  flex-shrink: 0;
  padding: var(--space-3) var(--space-4) calc(var(--space-4) + var(--safe-bottom));
  border-top: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
  background: color-mix(in srgb, var(--bg-elevated) 92%, transparent);
}

.system-windows-modal__close-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 52px;
  margin: 0;
  padding: 14px var(--space-4);
  border: 1px solid color-mix(in srgb, var(--border) 80%, transparent);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface-2) 95%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.1s ease;
}

.system-windows-modal__close-btn:active {
  transform: scale(0.98);
  background: var(--surface-hover);
  border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
}

@media (hover: hover) {
  .system-windows-modal__close-btn:hover {
    background: var(--surface-hover);
    border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
  }
}

.system-windows-modal__header {
  align-items: center;
  gap: var(--space-3);
}

.system-windows-modal__heading {
  min-width: 0;
  flex: 1 1 auto;
}

.system-windows-modal__status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.system-windows-modal__freshness {
  margin: 0;
  padding: 0;
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1;
  letter-spacing: -0.01em;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.system-windows-modal__freshness[hidden] {
  display: none !important;
}

.system-windows-modal__freshness--pending {
  color: color-mix(in srgb, var(--muted) 92%, var(--text));
}

.system-windows-modal__freshness--live {
  color: color-mix(in srgb, #9be7b8 88%, var(--muted));
}

.system-windows-modal__freshness--ok {
  color: var(--muted);
}

.system-windows-modal__freshness--stale,
.system-windows-modal__freshness--warn {
  color: color-mix(in srgb, #e8c468 92%, var(--text));
}

.system-windows-modal__freshness--error {
  color: color-mix(in srgb, #ffb4bc 90%, var(--text));
}

.system-windows-modal .settings-modal__header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  margin: 0 -4px 0 0;
}

.system-windows-poll-indicator {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  cursor: default;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}

.system-windows-poll-indicator[hidden] {
  display: none !important;
}

.system-windows-poll-indicator__ring {
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  border: 1.5px solid transparent;
  opacity: 0;
}

.system-windows-poll-indicator__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--muted);
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

.system-windows-poll-indicator--pending .system-windows-poll-indicator__dot {
  background: color-mix(in srgb, var(--muted) 80%, var(--text));
  animation: system-windows-poll-breathe 1.2s ease-in-out infinite;
}

.system-windows-poll-indicator--live .system-windows-poll-indicator__dot {
  background: #7dcea0;
  box-shadow: 0 0 0 3px color-mix(in srgb, #7dcea0 28%, transparent);
}

.system-windows-poll-indicator--live .system-windows-poll-indicator__ring {
  opacity: 1;
  border-color: color-mix(in srgb, #7dcea0 55%, transparent);
  animation: system-windows-poll-ring 1.6s ease-out infinite;
}

.system-windows-poll-indicator--ok .system-windows-poll-indicator__dot {
  background: color-mix(in srgb, #7dcea0 72%, var(--muted));
}

.system-windows-poll-indicator--stale .system-windows-poll-indicator__dot {
  background: #e8b84a;
  box-shadow: 0 0 0 3px color-mix(in srgb, #e8b84a 18%, transparent);
}

.system-windows-poll-indicator--warn .system-windows-poll-indicator__dot {
  background: #e8b84a;
  box-shadow: 0 0 0 3px color-mix(in srgb, #e8b84a 22%, transparent);
}

.system-windows-poll-indicator--error .system-windows-poll-indicator__dot {
  background: #ff8a96;
  box-shadow: 0 0 0 3px color-mix(in srgb, #ff8a96 22%, transparent);
}

@keyframes system-windows-poll-breathe {
  0%,
  100% {
    opacity: 0.45;
    transform: scale(0.92);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes system-windows-poll-ring {
  0% {
    transform: scale(0.85);
    opacity: 0.7;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .system-windows-poll-indicator--pending .system-windows-poll-indicator__dot,
  .system-windows-poll-indicator--live .system-windows-poll-indicator__ring {
    animation: none;
  }
}

.system-windows-empty {
  margin: 0;
  padding: var(--space-5) var(--space-3);
  font-size: 0.875rem;
  line-height: 1.45;
  color: var(--muted);
  text-align: center;
  border: 1px dashed color-mix(in srgb, var(--border) 65%, transparent);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface-2) 50%, transparent);
}

.system-windows-modal__list {
  flex: 1 1 auto;
  min-height: 120px;
  max-height: min(58vh, 420px);
  overflow-y: auto;
  overscroll-behavior-y: none;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 2px 0 var(--space-2);
}

.system-windows-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

/* One macOS process (PID) — shared icon, app name, Vibe */
.system-windows-group {
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--surface) 90%, transparent);
  overflow: hidden;
}

.system-windows-group__head {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: var(--space-3);
  align-items: center;
  padding: 10px var(--space-3);
}

.system-windows-group__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.system-windows-group__app-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  min-width: 0;
}

.system-windows-group__app {
  font-size: 0.9375rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
  word-break: break-word;
}

.system-windows-group__pid {
  font-size: 0.75rem;
  font-weight: 600;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  color: var(--muted);
}

.system-windows-group__pid[hidden],
.system-windows-group__count[hidden] {
  display: none !important;
}

.system-windows-group__count {
  font-size: 0.75rem;
  color: var(--muted);
}

.system-windows-group__windows {
  display: flex;
  flex-direction: column;
  border-top: 1px solid color-mix(in srgb, var(--border) 55%, transparent);
  padding: 2px var(--space-3) var(--space-2);
}

.system-windows-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: var(--space-3);
  align-items: start;
  padding: 10px 0;
  border: none;
  border-radius: 0;
  background: transparent;
}

.system-windows-row--window {
  grid-template-columns: minmax(0, 1fr);
  padding: 8px 0;
  border-top: 1px solid color-mix(in srgb, var(--border) 40%, transparent);
}

.system-windows-row--window:first-child {
  border-top: none;
}

.system-windows-row[data-on-screen="0"] {
  opacity: 0.72;
}

.system-windows-row__icon-wrap {
  --system-windows-icon-size: 40px;
  grid-row: 1;
  align-self: center;
  width: var(--system-windows-icon-size);
  height: var(--system-windows-icon-size);
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  border-radius: 9px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.22);
}

.system-windows-row__icon-fallback {
  display: flex;
  position: absolute;
  inset: 0;
  border-radius: 9px;
  align-items: center;
  justify-content: center;
  background: linear-gradient(
    145deg,
    color-mix(in srgb, var(--accent-soft) 55%, var(--surface-2)),
    color-mix(in srgb, var(--surface-2) 90%, transparent)
  );
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--border) 45%, transparent);
  box-sizing: border-box;
}

.system-windows-row__icon-fallback-glyph {
  font-size: calc(var(--system-windows-icon-size) * 0.42);
  font-weight: 700;
  line-height: 1;
  color: color-mix(in srgb, var(--text) 90%, var(--muted));
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  user-select: none;
}

.system-windows-row__body {
  position: relative;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.system-windows-row--has-pid .system-windows-row__body {
  padding-bottom: 12px;
  padding-right: 2px;
}

.system-windows-row__head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
}

.system-windows-row__app-line {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
  flex: 1 1 auto;
}

.system-windows-row__app {
  min-width: 0;
  font-size: 0.8125rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.system-windows-row__win-id {
  flex-shrink: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.6875rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  color: var(--muted);
  white-space: nowrap;
}

.system-windows-row__win-id[hidden] {
  display: none !important;
}

.system-windows-row__state {
  margin-left: auto;
  flex-shrink: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.system-windows-row__title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.35;
  color: color-mix(in srgb, var(--text) 92%, var(--muted));
}

.system-windows-row__title[hidden] {
  display: none;
}

.system-windows-row--has-pid .system-windows-row__title:not([hidden]) {
  padding-right: 4.5rem;
}

.system-windows-row__pid {
  position: absolute;
  right: 0;
  bottom: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.625rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: -0.02em;
  color: color-mix(in srgb, var(--muted) 88%, transparent);
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

.system-windows-row__pid[hidden] {
  display: none !important;
}

.footer-action--windows .footer-action__icon {
  stroke: currentColor;
  fill: none;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Chat chat history modal */

.chat-history-modal__sheet {
  display: flex;
  flex-direction: column;
  width: min(100%, 440px);
  max-height: min(88vh, 720px);
  padding-bottom: 20px;
  transition: transform 0.24s cubic-bezier(0.32, 0.82, 0.18, 1);
  will-change: transform;
}

.chat-history-modal__sheet.is-swipe-dragging {
  transition: none;
  transform: translateY(var(--swipe-drag-y, 0));
}

.chat-history-modal__sheet.is-swipe-dismissing {
  transform: translateY(var(--swipe-drag-y, 0));
}

.chat-history-modal.is-swipe-active .preset-picker__backdrop {
  opacity: 0.38;
  transition: opacity 0.18s ease;
}

@media (prefers-reduced-motion: reduce) {
  .chat-history-modal__sheet.is-swipe-dragging,
  .chat-history-modal__sheet.is-swipe-dismissing {
    transition: none;
    transform: none;
  }
}

.chat-history-modal__header {
  margin-bottom: 4px;
}

.chat-history-modal__identity {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.chat-history-modal__logo {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  object-fit: contain;
  object-position: center;
  border-radius: 8px;
  opacity: 0.95;
  user-select: none;
  -webkit-user-drag: none;
}

.chat-history-modal__title-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.chat-history-modal__title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}

.chat-history-modal__subtitle {
  margin: 0;
  font-size: 0.8125rem;
  font-weight: 500;
  line-height: 1.3;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-history-modal__error {
  flex-shrink: 0;
  margin: 0 0 10px;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(232, 92, 92, 0.35);
  background: rgba(232, 92, 92, 0.1);
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--danger);
}

.chat-history-modal__error[hidden] {
  display: none !important;
}

.chat-history-modal__load-earlier {
  flex-shrink: 0;
  display: flex;
  justify-content: center;
  margin-bottom: 8px;
}

.chat-history-modal__load-earlier-btn {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 14px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease;
}

.chat-history-modal__load-earlier-btn:active:not(:disabled) {
  background: var(--surface-hover);
  border-color: var(--border-strong);
}

.chat-history-modal__load-earlier-btn:disabled {
  opacity: 0.5;
}

.chat-history-modal__list {
  flex: 1 1 auto;
  min-height: 120px;
  max-height: min(52vh, 480px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 4px 10px;
  margin-bottom: 12px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.chat-history-modal__empty {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 120px;
  margin: 0 0 12px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--muted);
}

.chat-voice-history-modal {
  place-items: end center;
  padding: 0;
  pointer-events: none;
}

.chat-voice-history-modal .preset-picker__backdrop {
  display: none;
}

.chat-voice-history-modal .chat-history-modal__sheet {
  position: fixed;
  right: max(calc(12px + var(--safe-right)), calc((100vw - 620px) / 2 + 12px));
  bottom: calc(132px + var(--safe-bottom));
  width: min(340px, calc(100vw - 24px - var(--safe-left) - var(--safe-right)));
  max-height: min(430px, calc(100dvh - 176px - var(--safe-top) - var(--safe-bottom)));
  padding-bottom: 10px;
  border: 0;
  border-radius: 22px;
  background: rgba(14, 17, 24, 0.9);
  backdrop-filter: blur(24px) saturate(1.25);
  -webkit-backdrop-filter: blur(24px) saturate(1.25);
  box-shadow:
    0 18px 56px rgba(0, 0, 0, 0.42),
    0 0 32px rgba(70, 220, 135, 0.08);
  pointer-events: auto;
}

.chat-voice-history-modal .chat-history-modal__header {
  align-items: center;
  padding: 12px 12px 6px;
}

.chat-voice-history-modal .chat-history-modal__logo {
  width: 22px;
  height: 22px;
  border-radius: 7px;
}

.chat-voice-history-modal .chat-history-modal__title {
  font-size: 0.95rem;
  letter-spacing: -0.025em;
}

.chat-voice-history-modal .chat-history-modal__subtitle {
  max-width: 190px;
  font-size: 0.72rem;
}

.chat-voice-history-modal .settings-modal__header-actions {
  gap: 4px;
}

.chat-voice-history-modal .picker-modal__icon-btn,
.chat-voice-history-modal .settings-modal__close {
  width: 32px;
  height: 32px;
}

.chat-voice-history-modal .chat-history-modal__error {
  margin: 0 10px 8px;
  border: 0;
  background: rgba(232, 92, 92, 0.12);
  font-size: 0.75rem;
}

.chat-voice-history__list {
  flex: 1 1 auto;
  min-height: 160px;
  max-height: min(62vh, 560px);
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 8px 4px 10px;
  border-radius: var(--radius-md);
  background: rgba(0, 0, 0, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.chat-voice-history-modal .chat-voice-history__list {
  min-height: 0;
  max-height: min(336px, calc(100dvh - 244px - var(--safe-top) - var(--safe-bottom)));
  gap: 8px;
  padding: 4px 10px 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.chat-voice-history__list[hidden] {
  display: none !important;
}

.chat-voice-history__item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(120, 238, 170, 0.16);
  border-radius: 14px;
  background: rgba(18, 24, 32, 0.86);
}

.chat-voice-history-modal .chat-voice-history__item {
  --voice-player-pct: 0%;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas:
    "meta"
    "player"
    "text";
  align-items: stretch;
  gap: 7px;
  padding: 10px;
  border: 0;
  border-radius: 16px;
  background:
    linear-gradient(135deg, rgba(244, 246, 251, 0.075), rgba(244, 246, 251, 0.032)),
    rgba(9, 12, 20, 0.62);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.045),
    0 10px 24px rgba(0, 0, 0, 0.14);
}

.chat-voice-history-modal .chat-voice-history__item.is-playing {
  background:
    radial-gradient(circle at calc(var(--voice-player-pct) + 6%) 100%, rgba(91, 140, 255, 0.18), transparent 40%),
    radial-gradient(circle at 88% 18%, rgba(65, 226, 129, 0.16), transparent 44%),
    linear-gradient(135deg, rgba(244, 246, 251, 0.09), rgba(244, 246, 251, 0.04)),
    rgba(9, 12, 20, 0.66);
}

.chat-voice-history__meta {
  color: rgba(186, 199, 225, 0.78);
  font-size: 0.75rem;
  line-height: 1.35;
}

.chat-voice-history-modal .chat-voice-history__meta {
  grid-area: meta;
  font-size: 0.68rem;
  color: rgba(186, 199, 225, 0.66);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-voice-history__audio {
  width: 100%;
  min-height: 38px;
}

.chat-voice-history-modal .chat-voice-history__audio {
  display: none;
}

.chat-voice-history__player {
  --voice-player-btn-size: 34px;
  display: grid;
  grid-template-columns: var(--voice-player-btn-size) minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.chat-voice-history-modal .chat-voice-history__player {
  grid-area: player;
}

.chat-voice-history__play {
  display: grid;
  place-items: center;
  width: var(--voice-player-btn-size);
  height: var(--voice-player-btn-size);
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: rgba(52, 92, 178, 0.96);
  color: rgba(232, 242, 255, 0.98);
  font: inherit;
  cursor: pointer;
  box-shadow:
    0 0 0 1px rgba(120, 170, 255, 0.42),
    0 4px 12px rgba(28, 52, 110, 0.34);
  transition:
    transform 0.12s ease,
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.chat-voice-history__play:hover {
  background: rgba(64, 108, 198, 0.98);
  box-shadow:
    0 0 0 1px rgba(150, 195, 255, 0.55),
    0 0 12px rgba(91, 140, 255, 0.2),
    0 4px 12px rgba(28, 52, 110, 0.38);
}

.chat-voice-history__play:active:not(:disabled) {
  transform: scale(0.94);
}

.chat-voice-history__play:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.chat-voice-history__play:focus-visible {
  outline: 2px solid rgba(65, 226, 129, 0.72);
  outline-offset: 2px;
}

.chat-voice-history__item.is-playing .chat-voice-history__play {
  background: rgba(65, 226, 129, 0.88);
  color: #effff5;
  box-shadow:
    0 0 0 1px rgba(164, 255, 193, 0.38),
    0 0 14px rgba(65, 226, 129, 0.2),
    0 4px 12px rgba(12, 85, 42, 0.28);
}

.chat-voice-history__btn-icon {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  line-height: 0;
  pointer-events: none;
}

.chat-voice-history__btn-icon svg {
  display: block;
  width: 17px;
  height: 17px;
}

.chat-voice-history__player-main {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 3px;
}

.chat-voice-history__player-title {
  min-width: 0;
  overflow: hidden;
  color: rgba(206, 214, 232, 0.9);
  font-size: 0.68rem;
  font-weight: 650;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-voice-history__timeline {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.chat-voice-history__time {
  flex-shrink: 0;
  min-width: 2rem;
  color: rgba(148, 160, 184, 0.88);
  font-size: 0.625rem;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  text-align: center;
}

.chat-voice-history__track {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  height: 6px;
  border-radius: 999px;
  background: rgba(148, 160, 184, 0.2);
  cursor: pointer;
  touch-action: none;
}

.chat-voice-history__track:focus-visible {
  outline: 2px solid rgba(91, 140, 255, 0.55);
  outline-offset: 2px;
}

.chat-voice-history__fill {
  position: absolute;
  top: 0;
  left: 0;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(91, 140, 255, 0.85), rgba(130, 175, 255, 0.95));
  pointer-events: none;
  transition: width 0.08s linear;
}

.chat-voice-history__track::after {
  content: "";
  position: absolute;
  top: 50%;
  left: var(--voice-player-pct, 0%);
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #e8eeff;
  box-shadow: 0 0 0 2px rgba(91, 140, 255, 0.45);
  transform: translate(-50%, -50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s ease;
}

.chat-voice-history__track:hover::after,
.chat-voice-history__track:active::after,
.chat-voice-history__item.is-playing .chat-voice-history__track::after {
  opacity: 1;
}

.chat-voice-history__cancel {
  min-height: 28px;
  border: 0;
  border-radius: 999px;
  padding: 0 8px;
  background: rgba(232, 92, 92, 0.13);
  color: rgba(255, 194, 194, 0.92);
  font: inherit;
  font-size: 0.68rem;
  font-weight: 750;
  cursor: pointer;
  white-space: nowrap;
}

.chat-voice-history__cancel:hover {
  background: rgba(232, 92, 92, 0.22);
}

.chat-voice-history__cancel:disabled {
  cursor: wait;
  opacity: 0.55;
}

.chat-voice-history__cancel:focus-visible {
  outline: 2px solid rgba(232, 92, 92, 0.72);
  outline-offset: 2px;
}

.chat-voice-history__text {
  margin: 0;
  color: var(--text);
  font-size: 0.9375rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-voice-history-modal .chat-voice-history__text {
  grid-area: text;
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: rgba(244, 246, 251, 0.9);
  font-size: 0.74rem;
  line-height: 1.3;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.chat-voice-history-modal .chat-history-modal__empty {
  min-height: 90px;
  margin: 0 10px 10px;
  border-radius: 15px;
  background: rgba(244, 246, 251, 0.045);
  font-size: 0.78rem;
}

.chat-history-modal__terminal {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid rgba(91, 140, 255, 0.18);
  border-radius: var(--radius-md);
  background: rgba(4, 7, 13, 0.72);
}

.chat-terminal-modal .chat-history-modal__sheet {
  min-height: min(760px, calc(100dvh - 24px));
}

.chat-terminal-modal .chat-history-modal__terminal {
  flex: 1;
  min-height: 0;
  margin: 0;
}

.chat-terminal-modal .chat-history-modal__terminal-output {
  flex: 1;
  min-height: 360px;
  max-height: none;
}

.chat-history-modal__terminal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-history-modal__terminal-status {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-family: var(--mono-font, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.75rem;
  color: rgba(186, 199, 225, 0.78);
}

.chat-history-modal__terminal-connect {
  flex-shrink: 0;
  border: 1px solid rgba(91, 140, 255, 0.45);
  border-radius: 999px;
  padding: 6px 10px;
  background: rgba(91, 140, 255, 0.18);
  color: rgba(216, 228, 255, 0.98);
  font: inherit;
  font-size: 0.75rem;
  font-weight: 650;
  cursor: pointer;
}

.chat-history-modal__terminal-connect:disabled {
  opacity: 0.5;
  cursor: default;
}

.chat-history-modal__terminal-output {
  min-height: 160px;
  max-height: 260px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.48);
  color: rgba(226, 233, 246, 0.96);
  font-family: var(--mono-font, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.765rem;
  line-height: 1.35;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-history-modal__terminal-input {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 9px 10px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  font-family: var(--mono-font, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 0.8125rem;
}

.chat-history-modal__terminal-input:focus {
  outline: none;
  border-color: rgba(91, 140, 255, 0.58);
  box-shadow: 0 0 0 2px rgba(91, 140, 255, 0.18);
}

.chat-history-modal__compose {
  flex-shrink: 0;
  padding-top: 4px;
}

.chat-history-modal__compose-field {
  position: relative;
}

.chat-history-modal__compose-input {
  display: block;
  width: 100%;
  min-height: 88px;
  max-height: 180px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px 48px;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  line-height: 1.45;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease;
}

.chat-history-modal__compose-input::placeholder {
  color: rgba(139, 149, 168, 0.72);
}

.chat-history-modal__compose-input:focus {
  outline: none;
  border-color: rgba(91, 140, 255, 0.58);
  box-shadow: 0 0 0 2px rgba(91, 140, 255, 0.22);
}

.chat-history-modal__compose-send {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid rgba(91, 140, 255, 0.45);
  border-radius: 999px;
  background: rgba(91, 140, 255, 0.22);
  color: rgba(216, 228, 255, 0.98);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 650;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    transform 0.1s ease;
}

.chat-history-modal__compose-send:active:not(:disabled) {
  transform: scale(0.96);
  background: rgba(91, 140, 255, 0.32);
}

.chat-history-modal__compose-send:disabled {
  opacity: 0.45;
  cursor: default;
}

.chat-history-modal__compose-send-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-history__row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 100%;
}

.chat-history__row--outbound {
  align-items: flex-end;
}

.chat-history__row--inbound {
  align-items: flex-start;
}

.chat-history__row--system {
  align-items: center;
}

.chat-history__bubble {
  max-width: 92%;
  border-radius: 14px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}

.chat-history__row--outbound .chat-history__bubble {
  border-color: rgba(91, 140, 255, 0.35);
  background: var(--accent-soft);
}

.chat-history__row--inbound .chat-history__bubble {
  background: var(--bg-elevated);
}

.chat-history__bubble-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.chat-history__copy {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin: 0 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  opacity: 0.72;
  transition:
    opacity 0.15s ease,
    color 0.15s ease,
    background 0.15s ease;
}

.chat-history__row:hover .chat-history__copy,
.chat-history__system:hover .chat-history__copy,
.chat-history__copy:focus-visible {
  opacity: 1;
}

.chat-history__copy:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.chat-history__copy:active:not(:disabled) {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}

.chat-history__copy:disabled {
  cursor: default;
}

.chat-history__copy.is-copied {
  opacity: 1;
  color: var(--ok);
}

.chat-history__copy-icon {
  display: block;
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chat-history__who {
  font-size: 0.6875rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.chat-history__status {
  font-size: 0.625rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.chat-history__status--queued {
  color: #e8b84a;
}

.chat-history__status--failed {
  color: var(--danger);
}

.chat-history__status--sent {
  color: var(--ok);
}

.chat-history__body {
  margin: 0;
  font-size: 0.9375rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-history__body--full {
  margin-top: 8px;
}

.chat-history__summaries {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.chat-history__summary {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-history__summary-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.chat-history__summary-play {
  position: relative;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid rgba(91, 140, 255, 0.35);
  border-radius: 999px;
  background: rgba(91, 140, 255, 0.12);
  color: rgba(91, 140, 255, 0.95);
  cursor: pointer;
  overflow: visible;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* ~52×52px finger target around the 28px circle */
.chat-history__summary-play::before {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: 999px;
}

.chat-history__summary-play:hover {
  background: rgba(91, 140, 255, 0.22);
}

.chat-history__summary-play:disabled {
  opacity: 0.55;
  cursor: wait;
}

.chat-history__summary-play.is-loading svg {
  opacity: 0.45;
}

.chat-history__summary-play.is-stop {
  border-color: rgba(248, 113, 113, 0.45);
  background: rgba(248, 113, 113, 0.14);
  color: rgba(248, 113, 113, 0.95);
}

.chat-history__summary-play.is-stop:hover {
  background: rgba(248, 113, 113, 0.24);
}

.chat-history__summary-play .chat-summary-play__stop-icon {
  display: block;
  width: 9px;
  height: 9px;
  border-radius: 1px;
  background: currentColor;
}

.chat-history__summary--short {
  background: rgba(61, 214, 140, 0.08);
  border-color: rgba(61, 214, 140, 0.22);
}

.chat-history__summary--long {
  background: rgba(91, 140, 255, 0.08);
  border-color: rgba(91, 140, 255, 0.2);
}

.chat-history__summary-label {
  font-size: 0.625rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.chat-history__summary--short .chat-history__summary-label {
  color: rgba(61, 214, 140, 0.9);
}

.chat-history__summary--long .chat-history__summary-label {
  color: rgba(91, 140, 255, 0.92);
}

.chat-history__summary-text {
  margin: 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--text);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-history__summary--short .chat-history__summary-text {
  font-weight: 600;
  letter-spacing: -0.01em;
}

.chat-history__expand {
  margin-top: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.chat-history__meta {
  font-size: 0.6875rem;
  color: var(--muted);
}

.chat-history__system {
  max-width: 100%;
  text-align: center;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
}

.chat-history__system-head {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 6px;
}

.chat-history__system-head .chat-history__copy {
  margin: 2px 0 0;
}

.chat-history__system-text {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
  font-size: 0.8125rem;
  line-height: 1.4;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.chat-history__system .chat-history__meta {
  display: block;
}

.workspace-projects-bar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: center;
  padding: 0 var(--space-2) var(--space-2);
  max-width: 100%;
}

.workspace-projects-bar[hidden] {
  display: none !important;
}

.workspace-project-btn {
  appearance: none;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.14));
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-secondary, #a8b0c0);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  max-width: 9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease;
}

.workspace-project-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary, #eef1f6);
}

.workspace-project-btn.is-active {
  border-color: var(--accent, #7c6cf6);
  background: rgba(124, 108, 246, 0.22);
  color: var(--text-primary, #eef1f6);
}

.workspace-project-btn:disabled {
  opacity: 0.45;
  cursor: wait;
}

/* Wider phones / small tablets */

@media (min-width: 480px) {
  .app-footer__inner {
    gap: 8px;
    padding: 8px;
  }

  .status {
    text-align: center;
  }

  .footer-actions {
    width: 100%;
    gap: 4px;
  }

  .footer-action {
    width: 100%;
    min-width: 0;
    min-height: 50px;
    padding: 5px 2px 4px;
    border-radius: 14px;
    font-size: 0.8125rem;
  }

  .footer-action__label {
    display: block;
  }

  .footer-action__icon {
    width: 18px;
    height: 18px;
  }

  .footer-action--restart {
    min-width: 0;
    padding-inline: 2px;
  }

  .footer-action--icon {
    width: 100%;
    padding: 3px 2px 4px;
    font-size: 1.35rem;
  }
}
