/* Voice mode switch beside the AI Assistant rail button. */

.rail-ai {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  width: 100%;
  gap: 0.35rem;
}

.rail-ai-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  gap: 0.2rem;
}

.rail-ai .rail-btn {
  width: 100%;
}

.voice-switch {
  appearance: none;
  flex: none;
  width: 1.85rem;
  height: 1.05rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: #d5ddda;
  position: relative;
  cursor: pointer;
}

.voice-switch-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.15s ease;
}

.voice-switch.is-on {
  background: #0f6e5b;
}

.voice-switch.is-on .voice-switch-knob {
  transform: translateX(0.8rem);
}

.voice-switch:focus-visible,
.rail-btn.is-listening:focus-visible {
  outline: none;
  box-shadow: var(--focus, 0 0 0 3px rgba(15, 110, 91, 0.28));
}

.rail-btn.is-listening {
  color: #0f6e5b;
  background: #fff;
}

.rail-btn.is-processing {
  color: #fff;
  border-color: transparent;
  background-image: linear-gradient(
    90deg,
    #0a5a4a 0%,
    #1a8f75 28%,
    #7ed4bd 50%,
    #1a8f75 72%,
    #0a5a4a 100%
  );
  background-size: 220% 100%;
  animation: ai-process-sweep 1.5s ease-in-out infinite alternate;
}

@keyframes ai-process-sweep {
  from { background-position: 0% 50%; }
  to { background-position: 100% 50%; }
}

.sidebar-expanded .rail-ai-row {
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
}

.sidebar-expanded .rail-ai .rail-btn {
  flex: 1;
  width: auto;
}

.ai-soundbar {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  width: 100%;
  height: 22px;
  padding: 0 2px;
}

.ai-soundbar[hidden] {
  display: none !important;
}

.ai-usage {
  display: none;
  box-sizing: border-box;
  width: 100%;
  margin: 0.15rem 0 0.35rem;
  padding: 0.7rem 0.75rem 0.65rem;
  border: 1px solid rgba(15, 110, 91, 0.14);
  border-radius: 14px;
  background: #fff;
  box-shadow: 0 8px 22px rgba(16, 42, 36, 0.06);
  color: #667570;
  font-size: 11px;
  line-height: 1.3;
}

.sidebar-expanded .ai-usage {
  display: block;
}

body.is-guest .ai-usage {
  display: none !important;
}

.ai-usage-top,
.ai-usage-split,
.ai-usage-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.75rem;
  align-items: end;
}

.ai-usage-top {
  align-items: baseline;
}

.ai-usage-kicker {
  margin: 0;
  color: #0f6e5b;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.ai-usage-total {
  margin: 0.15rem 0 0;
  color: #102a24;
  font-size: 1.35rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
}

.ai-usage-caption {
  margin: 0;
  justify-self: end;
  color: #8a9692;
  font-size: 10px;
}

.ai-usage-split {
  margin-top: 0.55rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e7eeeb;
  font-variant-numeric: tabular-nums;
}

.ai-usage-split p,
.ai-usage-meta p {
  margin: 0;
  min-width: 0;
}

.ai-usage-split p:last-child,
.ai-usage-meta p:last-child {
  text-align: right;
}

.ai-usage-split em,
.ai-usage-meta em {
  display: block;
  color: #102a24;
  font-style: normal;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.ai-usage-split span,
.ai-usage-meta span {
  display: block;
  color: #8a9692;
}

.ai-usage-meta {
  margin-top: 0.45rem;
}

.ai-soundbar span {
  flex: 1 1 0;
  height: 12%;
  min-height: 2px;
  border-radius: 2px;
  background: #0f6e5b;
}

.sidebar-expanded .voice-switch {
  width: 2.15rem;
  height: 1.25rem;
  margin-right: 0.15rem;
}

.sidebar-expanded .voice-switch-knob {
  width: 1rem;
  height: 1rem;
}

.sidebar-expanded .voice-switch.is-on .voice-switch-knob {
  transform: translateX(0.9rem);
}
