@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Outfit:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ───────────────────────────────────────────
   Legisto Voice Widget — Green Palette
   Palette: #1B3B28 | #2D7A52 | #9AC8BE | #E0F0ED | #F5FAFA
   ─────────────────────────────────────────── */

:root {
  --lv-bg: #0C1F15;
  --lv-surface: #152E20;
  --lv-surface-raised: #1B3B28;
  --lv-border: rgba(154, 200, 190, 0.1);
  --lv-border-hover: rgba(154, 200, 190, 0.2);
  --lv-text: #E0F0ED;
  --lv-text-muted: #9AC8BE;
  --lv-text-dim: #4A7A68;
  --lv-accent: #2D7A52;
  --lv-accent-glow: rgba(45, 122, 82, 0.35);
  --lv-accent-bright: #9AC8BE;
  --lv-listening: #9AC8BE;
  --lv-listening-glow: rgba(154, 200, 190, 0.3);
  --lv-speaking: #2D7A52;
  --lv-speaking-glow: rgba(45, 122, 82, 0.3);
  --lv-error: #ff6b6b;
  --lv-radius: 16px;
  --lv-font: 'Outfit', system-ui, sans-serif;
  --lv-font-mono: 'JetBrains Mono', monospace;
  --lv-transition: 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ── Expert Mode Wrapper ── */
.legisto-wrapper {
  display: flex;
  align-items: stretch;
  height: 520px;
  position: relative;
}

.legisto-voice-widget {
  font-family: var(--lv-font);
  width: 720px;
  height: 520px;
  background: var(--lv-bg);
  border: 1px solid var(--lv-border);
  border-radius: var(--lv-radius);
  overflow: hidden;
  color: var(--lv-text);
  position: relative;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  box-shadow: none;
}

/* ── Ambient background ── */
.legisto-voice-widget::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, rgba(45, 122, 82, 0.08), transparent),
    radial-gradient(ellipse 40% 40% at 80% 100%, rgba(154, 200, 190, 0.04), transparent);
  pointer-events: none;
  z-index: 0;
}

/* ── Header ── */
.lv-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--lv-border);
  flex-shrink: 0;
}

.lv-title {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: 0.02em;
}

.lv-logo {
  height: 22px;
  width: auto;
  display: block;
  opacity: 0.5;
}

.lv-header-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

.lv-lang-picker {
  position: relative;
}

.lv-lang-flag {
  font-size: 16px;
  line-height: 1;
  min-width: 0;
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  transition: background var(--lv-transition);
}

.lv-lang-flag:hover {
  background: rgba(154, 200, 190, 0.1);
}

.lv-lang-flag:empty::after {
  content: "🌐";
}

.lv-lang-dropdown {
  display: none;
  position: fixed;
  background: var(--lv-surface);
  border: 1px solid var(--lv-border);
  border-radius: 8px;
  padding: 4px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  animation: lv-fade-in 150ms ease-out;
  flex-direction: column;
  gap: 2px;
}

.lv-lang-picker.open .lv-lang-dropdown {
  display: flex;
}

.lv-lang-option {
  background: none;
  border: none;
  color: var(--lv-text);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 6px;
  font-family: var(--lv-font);
  font-size: 13px;
  text-align: left;
  white-space: nowrap;
  transition: background var(--lv-transition);
}

.lv-lang-option:hover {
  background: rgba(154, 200, 190, 0.12);
}

.lv-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--lv-text-dim);
  transition: background var(--lv-transition), box-shadow var(--lv-transition);
}

.lv-dot[data-state="connected"] {
  background: var(--lv-accent);
  box-shadow: 0 0 8px var(--lv-accent-glow);
}

.lv-dot[data-state="listening"] {
  background: var(--lv-listening);
  box-shadow: 0 0 8px var(--lv-listening-glow);
  animation: lv-pulse 1.5s ease-in-out infinite;
}

.lv-dot[data-state="speaking"] {
  background: var(--lv-speaking);
  box-shadow: 0 0 8px var(--lv-speaking-glow);
  animation: lv-pulse 1s ease-in-out infinite;
}

.lv-countdown {
  font-size: 12px;
  font-family: var(--lv-font-mono);
  color: var(--lv-text-dim);
  font-weight: 500;
  letter-spacing: 0.04em;
  min-width: 0;
  transition: color var(--lv-transition);
}

.lv-countdown:empty {
  display: none;
}

.lv-countdown-warning {
  color: #F5A623;
  animation: lv-pulse 1s ease-in-out infinite;
}

.lv-status-label {
  font-size: 12px;
  font-family: var(--lv-font-mono);
  color: var(--lv-text-dim);
  font-weight: 400;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* Active state when transcript is visible */
.legisto-voice-widget[data-transcript="visible"] .lv-toggle-transcript {
  color: var(--lv-accent-bright);
  border-color: var(--lv-accent);
  background: rgba(45, 122, 82, 0.12);
}

.lv-toggle-transcript.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ── Mute & End Buttons ── */
.lv-toggle-transcript,
.lv-toggle-files,
.lv-upload-btn,
.lv-mute-btn,
.lv-end-btn {
  display: none;
  background: none;
  border: 1px solid var(--lv-border);
  border-radius: 6px;
  color: var(--lv-text-dim);
  cursor: pointer;
  padding: 4px 6px;
  align-items: center;
  justify-content: center;
  transition: color var(--lv-transition), border-color var(--lv-transition), background var(--lv-transition);
}

.lv-toggle-transcript,
.lv-toggle-files {
  display: flex;
}

.lv-toggle-files.active {
  color: var(--lv-accent-bright);
  border-color: var(--lv-accent);
  background: rgba(45, 122, 82, 0.12);
}

.legisto-voice-widget[data-session="active"][data-mode-expert="true"] .lv-upload-btn,
.legisto-voice-widget[data-session="active"] .lv-mute-btn,
.legisto-voice-widget[data-session="active"] .lv-end-btn {
  display: flex;
}

.lv-toggle-transcript:hover,
.lv-toggle-files:hover,
.lv-upload-btn:hover,
.lv-mute-btn:hover,
.lv-end-btn:hover {
  color: var(--lv-text-muted);
  border-color: var(--lv-border-hover);
}

.lv-toggle-transcript svg,
.lv-toggle-files svg,
.lv-upload-btn svg,
.lv-mute-btn svg,
.lv-end-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Mute: show mic icon when unmuted, muted icon when muted */
.lv-mute-btn .lv-mute-icon-off {
  display: none;
}

.lv-mute-btn.muted .lv-mute-icon-on {
  display: none;
}

.lv-mute-btn.muted .lv-mute-icon-off {
  display: block;
}

.lv-mute-btn.muted {
  color: var(--lv-error);
  border-color: rgba(255, 107, 107, 0.3);
  background: rgba(255, 107, 107, 0.08);
}

/* End button: red accent */
.lv-end-btn:hover {
  color: var(--lv-error);
  border-color: rgba(255, 107, 107, 0.3);
  background: rgba(255, 107, 107, 0.08);
}

/* ── Upload Status ── */
.lv-upload-status {
  display: none;
  position: relative;
  z-index: 1;
  padding: 6px 20px;
  font-size: 12px;
  font-family: var(--lv-font-mono);
  letter-spacing: 0.03em;
  text-align: center;
  flex-shrink: 0;
  animation: lv-fade-in 200ms ease-out;
}

.lv-upload-status.visible {
  display: block;
}

.lv-upload-status[data-state="uploading"] {
  color: var(--lv-text-dim);
  background: rgba(154, 200, 190, 0.05);
  border-bottom: 1px solid var(--lv-border);
}

.lv-upload-status[data-state="success"] {
  color: var(--lv-accent);
  background: rgba(45, 122, 82, 0.06);
  border-bottom: 1px solid rgba(45, 122, 82, 0.15);
}

.lv-upload-status[data-state="error"] {
  color: var(--lv-error);
  background: rgba(255, 107, 107, 0.06);
  border-bottom: 1px solid rgba(255, 107, 107, 0.15);
}

/* Hide mute in text mode */
.legisto-voice-widget[data-mode="text"] .lv-mute-btn {
  display: none;
}

/* ── Mode Toggle ── */
.lv-mode-toggle {
  display: flex;
  border: 1px solid var(--lv-border);
  border-radius: 6px;
  overflow: hidden;
}

.lv-mode-btn {
  background: none;
  border: none;
  color: var(--lv-text-dim);
  cursor: pointer;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  transition: color var(--lv-transition), background var(--lv-transition);
}

.lv-mode-btn:hover {
  color: var(--lv-text-muted);
}

.lv-mode-btn.active {
  color: var(--lv-accent-bright);
  background: rgba(45, 122, 82, 0.12);
}

.lv-mode-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.lv-mode-btn + .lv-mode-btn {
  border-left: 1px solid var(--lv-border);
}

.lv-mode-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Orb Zone (WebGL canvas) ── */
.lv-orb-zone {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex: 1;
  min-height: 0;
  padding: 16px 20px;
  gap: 2px;
}

/* Hide placeholder during and after session */
.legisto-voice-widget[data-session="active"] .lv-placeholder,
.legisto-voice-widget[data-session-ended="true"] .lv-placeholder {
  display: none;
}

.lv-orb-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 320px;
  max-height: 320px;
}

/* ── Transcript area ── */
.lv-transcript {
  position: relative;
  z-index: 1;
  padding: 16px 20px;
  height: 200px;
  overflow-y: auto;
  border-top: 1px solid var(--lv-border);
  flex-shrink: 0;
  transition: height 400ms cubic-bezier(0.4, 0, 0.2, 1),
              padding 400ms cubic-bezier(0.4, 0, 0.2, 1),
              opacity 300ms ease;
}

.legisto-voice-widget[data-transcript="hidden"] .lv-transcript {
  height: 0;
  padding-top: 0;
  padding-bottom: 0;
  opacity: 0;
  border-top-color: transparent;
  overflow: hidden;
}

.lv-transcript::-webkit-scrollbar {
  width: 4px;
}

.lv-transcript::-webkit-scrollbar-track {
  background: transparent;
}

.lv-transcript::-webkit-scrollbar-thumb {
  background: var(--lv-surface-raised);
  border-radius: 2px;
}

.lv-message {
  margin-bottom: 12px;
  animation: lv-fade-in 200ms ease-out;
}

.lv-message:last-child {
  margin-bottom: 0;
}

.lv-message-role {
  font-size: 10px;
  font-family: var(--lv-font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--lv-text-dim);
  margin-bottom: 4px;
}

.lv-message-role[data-role="user"] {
  color: var(--lv-listening);
}

.lv-message-role[data-role="assistant"] {
  color: var(--lv-speaking);
}

.lv-message-text {
  font-size: 13.5px;
  line-height: 1.6;
  color: var(--lv-text);
  font-weight: 300;
}

.lv-message-text.lv-streaming {
  opacity: 0.7;
}

.lv-message-text .lv-highlight {
  color: #F5D060;
  font-weight: 500;
}

.lv-message-text em {
  color: var(--lv-text-muted);
  font-style: italic;
}

.lv-message-text .lv-inline-code {
  font-family: var(--lv-font-mono);
  font-size: 12px;
  background: rgba(45, 122, 82, 0.12);
  padding: 1px 5px;
  border-radius: 3px;
  color: var(--lv-accent-bright);
}

.lv-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--lv-text-dim);
  font-size: 13px;
  font-weight: 300;
}

/* ── Noise Banner ── */
.lv-noise-banner {
  position: relative;
  z-index: 1;
  display: none;
  align-items: center;
  gap: 10px;
  padding: 8px 20px;
  background: rgba(245, 166, 35, 0.08);
  border-top: 1px solid rgba(245, 166, 35, 0.2);
  flex-shrink: 0;
  animation: lv-fade-in 200ms ease-out;
}

.lv-noise-banner.visible {
  display: flex;
}

.lv-noise-text {
  flex: 1;
  font-size: 12px;
  color: #F5A623;
  font-weight: 400;
}

.lv-noise-switch {
  background: rgba(245, 166, 35, 0.15);
  border: 1px solid rgba(245, 166, 35, 0.4);
  border-radius: 6px;
  color: #F5A623;
  cursor: pointer;
  padding: 4px 10px;
  font-family: var(--lv-font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  transition: background var(--lv-transition);
  white-space: nowrap;
}

.lv-noise-switch:hover {
  background: rgba(245, 166, 35, 0.25);
}

.lv-noise-dismiss {
  background: none;
  border: none;
  color: rgba(245, 166, 35, 0.5);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  padding: 0 2px;
  transition: color var(--lv-transition);
}

.lv-noise-dismiss:hover {
  color: #F5A623;
}

/* ── Text Mode Layout Overrides ── */
.legisto-voice-widget[data-mode="text"] .lv-orb-zone {
  flex: 0 0 auto;
  padding: 12px 20px;
}

.legisto-voice-widget[data-mode="text"] .lv-orb-container {
  width: 100px;
  height: 100px;
}

.legisto-voice-widget[data-mode="text"] .lv-transcript {
  flex: 1;
  height: auto;
  min-height: 0;
}

/* In text mode, transcript is always visible regardless of toggle */
.legisto-voice-widget[data-mode="text"] .lv-transcript {
  height: auto !important;
  padding-top: 16px !important;
  padding-bottom: 16px !important;
  opacity: 1 !important;
  border-top-color: var(--lv-border) !important;
  overflow: auto !important;
}

/* ── Text Input Bar ── */
.lv-text-input-bar {
  position: relative;
  z-index: 1;
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-top: 1px solid var(--lv-border);
  flex-shrink: 0;
}

.legisto-voice-widget[data-mode="text"][data-session="active"] .lv-text-input-bar {
  display: flex;
}

.lv-text-input {
  flex: 1;
  background: var(--lv-surface);
  border: 1px solid var(--lv-border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--lv-text);
  font-family: var(--lv-font);
  font-size: 13px;
  outline: none;
  transition: border-color var(--lv-transition);
}

.lv-text-input::placeholder {
  color: var(--lv-text-dim);
}

.lv-text-input:focus {
  border-color: var(--lv-accent);
}

.lv-text-send {
  background: var(--lv-accent);
  border: none;
  border-radius: 8px;
  color: var(--lv-text);
  cursor: pointer;
  padding: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--lv-transition);
}

.lv-text-send:hover {
  background: #3a9966;
}

.lv-text-send:active {
  transform: scale(0.95);
}

.lv-text-send svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ── Download bar ── */
.lv-download-bar {
  position: relative;
  z-index: 1;
  display: none;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-top: 1px solid var(--lv-border);
  flex-shrink: 0;
  animation: lv-fade-in 200ms ease-out;
}

.lv-download-bar.visible {
  display: flex;
}

.lv-download-rating {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
}

.lv-inline-stars {
  display: flex;
  gap: 2px;
}

.lv-inline-star {
  background: none;
  border: none;
  font-size: 14px;
  color: var(--lv-text-dim);
  cursor: pointer;
  transition: color 150ms ease;
  padding: 0 1px;
  line-height: 1;
}

.lv-inline-star:hover,
.lv-inline-star.active {
  color: #F5A623;
}

.lv-inline-thanks {
  font-size: 11px;
  color: var(--lv-accent);
  font-family: var(--lv-font-mono);
}

.lv-inline-thanks:empty {
  display: none;
}

.lv-reset-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(154, 200, 190, 0.08);
  border: 1px solid var(--lv-border);
  border-radius: 6px;
  color: var(--lv-text-dim);
  cursor: pointer;
  padding: 6px 8px;
  transition: background var(--lv-transition), border-color var(--lv-transition), color var(--lv-transition);
}

.lv-reset-btn:hover {
  color: var(--lv-error);
  border-color: rgba(255, 107, 107, 0.3);
  background: rgba(255, 107, 107, 0.08);
}

.lv-download-text {
  font-size: 12px;
  color: var(--lv-text-dim);
  font-weight: 400;
}

.lv-download-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(45, 122, 82, 0.12);
  border: 1px solid var(--lv-accent);
  border-radius: 6px;
  color: var(--lv-accent-bright);
  cursor: pointer;
  padding: 6px 12px;
  font-family: var(--lv-font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  transition: background var(--lv-transition), border-color var(--lv-transition);
}

.lv-download-btn:hover {
  background: rgba(45, 122, 82, 0.22);
  border-color: var(--lv-accent-bright);
}

.lv-download-btn:active,
.lv-email-btn:active {
  transform: scale(0.97);
}

.lv-download-actions {
  display: flex;
  gap: 8px;
}

.lv-email-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(154, 200, 190, 0.08);
  border: 1px solid var(--lv-border);
  border-radius: 6px;
  color: var(--lv-text-muted);
  cursor: pointer;
  padding: 6px 12px;
  font-family: var(--lv-font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  transition: background var(--lv-transition), border-color var(--lv-transition);
}

.lv-email-btn:hover {
  background: rgba(154, 200, 190, 0.15);
  border-color: var(--lv-text-muted);
}

/* ── Email Popup ── */
.lv-email-popup {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
  border-radius: var(--lv-radius);
}

.lv-email-popup.visible {
  display: flex;
}

.lv-email-popup-content {
  background: var(--lv-surface);
  border: 1px solid var(--lv-border);
  border-radius: 12px;
  padding: 20px;
  width: 320px;
  max-width: 90%;
  animation: lv-fade-in 200ms ease-out;
}

.lv-email-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 500;
  color: var(--lv-text);
}

.lv-email-popup-close {
  background: none;
  border: none;
  color: var(--lv-text-dim);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0 4px;
  transition: color var(--lv-transition);
}

.lv-email-popup-close:hover {
  color: var(--lv-text);
}

.lv-email-popup-body {
  display: flex;
  gap: 8px;
}

.lv-email-input {
  flex: 1;
  background: var(--lv-bg);
  border: 1px solid var(--lv-border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--lv-text);
  font-family: var(--lv-font);
  font-size: 13px;
  outline: none;
  transition: border-color var(--lv-transition);
}

.lv-email-input::placeholder {
  color: var(--lv-text-dim);
}

.lv-email-input:focus {
  border-color: var(--lv-accent);
}

.lv-email-send-btn {
  background: var(--lv-accent);
  border: none;
  border-radius: 8px;
  color: var(--lv-text);
  cursor: pointer;
  padding: 8px 16px;
  font-family: var(--lv-font);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--lv-transition);
  white-space: nowrap;
}

.lv-email-send-btn:hover {
  background: #3a9966;
}

.lv-email-popup-status {
  margin-top: 10px;
  font-size: 12px;
  font-family: var(--lv-font-mono);
  text-align: center;
  min-height: 16px;
}

.lv-email-popup-status:empty {
  display: none;
}

.lv-email-popup-status[data-state="error"] {
  color: var(--lv-error);
}

.lv-email-popup-status[data-state="sending"] {
  color: var(--lv-text-dim);
}

.lv-email-popup-status[data-state="success"] {
  color: var(--lv-accent);
}

/* ── Rating Popup ── */
.lv-rating-popup {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
  border-radius: var(--lv-radius);
}

.lv-rating-popup.visible {
  display: flex;
}

.lv-rating-popup-content {
  background: var(--lv-surface);
  border: 1px solid var(--lv-border);
  border-radius: 12px;
  padding: 24px;
  width: 300px;
  max-width: 90%;
  text-align: center;
  animation: lv-fade-in 200ms ease-out;
}

.lv-rating-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
  font-size: 14px;
  font-weight: 500;
  color: var(--lv-text);
}

.lv-rating-popup-header button {
  background: none;
  border: none;
  color: var(--lv-text-dim);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
}

.lv-rating-stars {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.lv-star {
  background: none;
  border: none;
  font-size: 32px;
  color: var(--lv-text-dim);
  cursor: pointer;
  transition: color 150ms ease, transform 150ms ease;
  padding: 0;
  line-height: 1;
}

.lv-star:hover,
.lv-star.active {
  color: #F5A623;
  transform: scale(1.15);
}

.lv-star.selected {
  color: #F5A623;
}

.lv-rating-status {
  font-size: 13px;
  color: var(--lv-accent);
  min-height: 18px;
}

.lv-rating-status:empty {
  display: none;
}

/* ── Document Popup ── */
.lv-doc-popup {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 10;
  background: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
  border-radius: var(--lv-radius);
}

.lv-doc-popup.visible {
  display: flex;
}

.lv-doc-popup-content {
  background: var(--lv-surface);
  border: 1px solid var(--lv-border);
  border-radius: 12px;
  padding: 24px;
  width: 600px;
  max-width: 95%;
  max-height: 90%;
  display: flex;
  flex-direction: column;
  animation: lv-fade-in 200ms ease-out;
}

.lv-doc-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  flex-shrink: 0;
}

.lv-doc-popup-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--lv-text);
}

.lv-doc-popup-close {
  background: none;
  border: none;
  color: var(--lv-text-dim);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0 4px;
  transition: color var(--lv-transition);
}

.lv-doc-popup-close:hover {
  color: var(--lv-text);
}

.lv-doc-popup-preview {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  background: var(--lv-bg);
  border: 1px solid var(--lv-border);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--lv-text-muted);
  scrollbar-width: thin;
  scrollbar-color: var(--lv-surface-raised) transparent;
}

.lv-doc-popup-preview::-webkit-scrollbar {
  width: 4px;
}

.lv-doc-popup-preview::-webkit-scrollbar-thumb {
  background: var(--lv-surface-raised);
  border-radius: 2px;
}

.lv-doc-popup-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

.lv-doc-download-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(45, 122, 82, 0.12);
  border: 1px solid var(--lv-accent);
  border-radius: 8px;
  color: var(--lv-accent-bright);
  cursor: pointer;
  padding: 8px 16px;
  font-family: var(--lv-font-mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  transition: background var(--lv-transition), border-color var(--lv-transition);
}

.lv-doc-download-btn:hover {
  background: rgba(45, 122, 82, 0.22);
  border-color: var(--lv-accent-bright);
}

.lv-doc-download-btn:active {
  transform: scale(0.97);
}

.lv-doc-popup-status {
  margin-top: 8px;
  font-size: 12px;
  font-family: var(--lv-font-mono);
  text-align: center;
  min-height: 16px;
}

.lv-doc-popup-status:empty {
  display: none;
}

.lv-doc-popup-status[data-state="error"] {
  color: var(--lv-error);
}

.lv-doc-popup-status[data-state="sending"] {
  color: var(--lv-text-dim);
}

.lv-doc-popup-status[data-state="success"] {
  color: var(--lv-accent);
}

/* ── Error banner ── */
.lv-error {
  position: relative;
  z-index: 1;
  padding: 10px 20px;
  background: rgba(255, 107, 107, 0.08);
  border-top: 1px solid rgba(255, 107, 107, 0.15);
  color: var(--lv-error);
  font-size: 12px;
  font-weight: 400;
  display: none;
  flex-shrink: 0;
}

.lv-error.visible {
  display: block;
  animation: lv-fade-in 200ms ease-out;
}

/* ── Version ── */
.lv-version {
  position: absolute;
  bottom: 4px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  font-family: var(--lv-font-mono);
  color: rgba(74, 122, 104, 0.3);
  z-index: 1;
  pointer-events: none;
  user-select: none;
}

/* ── Side Panels ── */
.lv-panel {
  width: 0;
  height: 520px;
  background: var(--lv-bg);
  border: none;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: width 350ms cubic-bezier(0.4, 0, 0.2, 1), opacity 250ms ease, border 0ms 250ms;
  opacity: 0;
  flex-shrink: 0;
  pointer-events: none;
}

.lv-panel.open {
  width: 240px;
  opacity: 1;
  border: 1px solid var(--lv-border);
  pointer-events: auto;
  transition: width 350ms cubic-bezier(0.4, 0, 0.2, 1), opacity 250ms ease, border 0ms;
}

.lv-panel-left {
  border-radius: var(--lv-radius) 0 0 var(--lv-radius);
  border-right: none;
}

.lv-panel-right {
  border-radius: 0 var(--lv-radius) var(--lv-radius) 0;
  border-left: none;
}

/* Panel header */
.lv-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 12px;
  border-bottom: 1px solid var(--lv-border);
  flex-shrink: 0;
}

.lv-panel-title {
  font-size: 11px;
  font-family: var(--lv-font-mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--lv-text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.lv-panel-close {
  background: none;
  border: none;
  color: var(--lv-text-dim);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  transition: color var(--lv-transition);
}

.lv-panel-close:hover {
  color: var(--lv-text);
}

/* Panel content */
.lv-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  min-height: 0;
}

.lv-panel-body::-webkit-scrollbar {
  width: 3px;
}

.lv-panel-body::-webkit-scrollbar-thumb {
  background: var(--lv-surface-raised);
  border-radius: 2px;
}

/* Session list items */
.lv-session-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background var(--lv-transition);
  margin-bottom: 4px;
  position: relative;
}

.lv-session-item:hover {
  background: rgba(154, 200, 190, 0.08);
}

.lv-session-item.active {
  background: rgba(45, 122, 82, 0.15);
  border: 1px solid rgba(45, 122, 82, 0.3);
}

.lv-session-name {
  font-size: 12px;
  color: var(--lv-text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 180px;
}

.lv-session-meta {
  font-size: 10px;
  color: var(--lv-text-dim);
  font-family: var(--lv-font-mono);
}

.lv-session-actions {
  display: none;
  position: absolute;
  top: 6px;
  right: 6px;
  gap: 2px;
}

.lv-session-item:hover .lv-session-actions {
  display: flex;
}

.lv-session-action {
  background: none;
  border: none;
  color: var(--lv-text-dim);
  cursor: pointer;
  padding: 2px 4px;
  font-size: 12px;
  border-radius: 4px;
  transition: color var(--lv-transition), background var(--lv-transition);
}

.lv-session-action:hover {
  color: var(--lv-text);
  background: rgba(154, 200, 190, 0.12);
}

.lv-session-action.delete:hover {
  color: var(--lv-error);
  background: rgba(255, 107, 107, 0.1);
}

/* New session button */
.lv-panel-footer {
  padding: 8px;
  border-top: 1px solid var(--lv-border);
  flex-shrink: 0;
}

.lv-new-session-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(45, 122, 82, 0.12);
  border: 1px solid var(--lv-accent);
  border-radius: 6px;
  color: var(--lv-accent-bright);
  cursor: pointer;
  padding: 8px;
  font-family: var(--lv-font-mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  transition: background var(--lv-transition);
}

.lv-new-session-btn:hover {
  background: rgba(45, 122, 82, 0.22);
}

/* File list items */
.lv-file-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  margin-bottom: 4px;
  transition: background var(--lv-transition);
}

.lv-file-item:hover {
  background: rgba(154, 200, 190, 0.06);
}

.lv-file-dir {
  font-size: 8px;
  flex-shrink: 0;
}

.lv-file-dir.download {
  color: #F5A623;
}

.lv-file-dir.upload {
  color: var(--lv-accent-bright);
}

.lv-file-info {
  flex: 1;
  min-width: 0;
}

.lv-file-name {
  font-size: 11px;
  color: var(--lv-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lv-file-meta {
  font-size: 9px;
  color: var(--lv-text-dim);
  font-family: var(--lv-font-mono);
}

.lv-file-type-badge {
  font-size: 9px;
  font-family: var(--lv-font-mono);
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
}

.lv-file-type-badge.upload {
  color: var(--lv-accent-bright);
  background: rgba(45, 122, 82, 0.12);
}

.lv-file-type-badge.download {
  color: #F5A623;
  background: rgba(245, 166, 35, 0.12);
}

.lv-file-download-btn {
  background: none;
  border: 1px solid var(--lv-border-hover);
  color: var(--lv-text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--lv-transition), background var(--lv-transition), border-color var(--lv-transition);
}

.lv-file-download-btn:hover {
  color: var(--lv-accent-bright);
  background: rgba(154, 200, 190, 0.12);
  border-color: var(--lv-accent-bright);
}

/* Panel empty state */
.lv-panel-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  font-size: 11px;
  color: var(--lv-text-dim);
  text-align: center;
  padding: 20px;
  line-height: 1.5;
}

/* ── Drop Zone ── */
.lv-drop-zone {
  display: none;
  align-items: center;
  justify-content: center;
  padding: 10px 8px;
  border-top: 1px dashed var(--lv-border);
  flex-shrink: 0;
}

.lv-drop-zone.expert {
  display: flex;
}

.lv-drop-zone-text {
  font-size: 10px;
  font-family: var(--lv-font-mono);
  color: var(--lv-text-dim);
  letter-spacing: 0.04em;
}

.lv-drop-zone.active {
  background: rgba(45, 122, 82, 0.1);
  border-top-color: var(--lv-accent);
}

.lv-drop-zone.active .lv-drop-zone-text {
  color: var(--lv-accent-bright);
}

/* ── Upgrade Popup ── */
.lv-upgrade-popup {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 15;
  background: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
  border-radius: var(--lv-radius);
}

.lv-upgrade-popup.visible {
  display: flex;
}

.lv-upgrade-content {
  background: var(--lv-surface);
  border: 1px solid var(--lv-border);
  border-radius: 12px;
  padding: 28px 24px;
  width: 320px;
  max-width: 90%;
  text-align: center;
  position: relative;
  animation: lv-fade-in 200ms ease-out;
}

.lv-upgrade-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--lv-text-dim);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: color var(--lv-transition);
}

.lv-upgrade-close:hover {
  color: var(--lv-text);
}

.lv-popup-logo {
  width: 32px;
  height: auto;
  margin-bottom: 8px;
}

.lv-upgrade-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--lv-text);
  margin-bottom: 8px;
}

.lv-upgrade-text {
  font-size: 13px;
  color: var(--lv-text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
}

.lv-upgrade-text strong {
  color: var(--lv-accent-bright);
}

.lv-upgrade-login-btn {
  width: 100%;
  background: var(--lv-accent);
  border: none;
  border-radius: 8px;
  color: var(--lv-text);
  cursor: pointer;
  padding: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: background var(--lv-transition);
  margin-bottom: 8px;
}

.lv-upgrade-login-btn:hover {
  background: #3a9966;
}

.lv-upgrade-dismiss {
  width: 100%;
  background: none;
  border: none;
  color: var(--lv-text-dim);
  cursor: pointer;
  padding: 8px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: color var(--lv-transition);
}

.lv-upgrade-dismiss:hover {
  color: var(--lv-text-muted);
}

/* ── Login Popup ── */
.lv-login-popup {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 15;
  background: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
  border-radius: var(--lv-radius);
}

.lv-login-popup.visible {
  display: flex;
}

.lv-login-content {
  background: var(--lv-surface);
  border: 1px solid var(--lv-border);
  border-radius: 12px;
  padding: 24px 20px 16px;
  width: 520px;
  max-width: 95%;
  max-height: 650px;
  overflow-y: auto;
  text-align: center;
  scrollbar-width: thin;
  scrollbar-color: var(--lv-surface-raised) transparent;
  position: relative;
  animation: lv-fade-in 200ms ease-out;
}

.lv-login-close {
  position: absolute;
  top: 10px;
  right: 12px;
  background: none;
  border: none;
  color: var(--lv-text-dim);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  transition: color var(--lv-transition);
  z-index: 1;
}

.lv-login-close:hover {
  color: var(--lv-text);
}

.lv-login-header-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  text-align: left;
}

.lv-login-logo {
  width: 36px;
  height: auto;
  flex-shrink: 0;
}

.lv-login-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--lv-text);
  line-height: 1.2;
}

.lv-login-subtitle {
  font-size: 10px;
  color: var(--lv-text-dim);
}

.lv-login-tabs {
  display: flex;
  background: var(--lv-bg);
  border: 1px solid var(--lv-border);
  border-radius: 8px;
  padding: 3px;
  margin-bottom: 8px;
}

.lv-login-tab {
  flex: 1;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--lv-text-dim);
  cursor: pointer;
  padding: 7px 0;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: color var(--lv-transition), background var(--lv-transition);
}

.lv-login-tab:hover {
  color: var(--lv-text-muted);
}

.lv-login-tab.active {
  background: var(--lv-accent);
  color: var(--lv-text);
}

.lv-login-step {
  display: none;
  text-align: left;
}

.lv-login-step.active {
  display: block;
}

.lv-login-label {
  font-size: 11px;
  color: var(--lv-text-muted);
  margin-bottom: 4px;
  text-align: left;
}

.lv-login-input {
  width: 100%;
  background: var(--lv-bg);
  border: 1px solid var(--lv-border);
  border-radius: 8px;
  padding: 8px 10px;
  color: var(--lv-text);
  font-family: var(--lv-font);
  font-size: 13px;
  outline: none;
  transition: border-color var(--lv-transition);
  box-sizing: border-box;
  margin-bottom: 8px;
  height: 36px;
}

.lv-login-input::placeholder {
  color: var(--lv-text-dim);
}

.lv-login-input:focus {
  border-color: var(--lv-accent);
}

.lv-login-input.code {
  text-align: center;
  font-family: var(--lv-font-mono);
  font-size: 20px;
  letter-spacing: 0.3em;
  font-weight: 600;
  height: 42px;
}

.lv-login-submit {
  width: 100%;
  background: var(--lv-accent);
  border: none;
  border-radius: 8px;
  color: var(--lv-text);
  cursor: pointer;
  padding: 9px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: background var(--lv-transition);
}

.lv-login-submit:hover {
  background: #3a9966;
}

.lv-login-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.lv-login-footer {
  margin-top: 8px;
  font-size: 10px;
  color: var(--lv-text-dim);
  text-align: center;
}

.lv-login-switch {
  background: none;
  border: none;
  color: var(--lv-accent-bright);
  cursor: pointer;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  padding: 0;
  text-decoration: none;
  transition: color var(--lv-transition);
}

.lv-login-switch:hover {
  color: #3a9966;
}

/* Welcome step */
.lv-login-step-welcome {
  text-align: center !important;
}


.lv-welcome-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--lv-text);
  margin-bottom: 6px;
}

.lv-welcome-plan-badge {
  display: inline-block;
  font-size: 11px;
  font-family: var(--lv-font-mono);
  font-weight: 600;
  color: var(--lv-accent-bright);
  background: rgba(45, 122, 82, 0.15);
  padding: 3px 10px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.lv-welcome-text {
  font-size: 12px;
  color: var(--lv-text-muted);
  margin-bottom: 8px;
}

.lv-welcome-features {
  list-style: none;
  padding: 0;
  margin: 0 0 12px;
  text-align: left;
}

.lv-welcome-features li {
  font-size: 11px;
  padding: 2px 0 2px 18px;
  position: relative;
  color: var(--lv-text-muted);
}

.lv-welcome-features li::before {
  position: absolute;
  left: 0;
  font-size: 11px;
}

.lv-welcome-features li.yes::before {
  content: "\2713";
  color: var(--lv-accent);
}

.lv-welcome-features li.no::before {
  content: "\2717";
  color: var(--lv-text-dim);
}

.lv-welcome-features li.no {
  color: var(--lv-text-dim);
  opacity: 0.5;
}

/* Quick access */
.lv-login-quick-email {
  font-size: 13px;
  font-family: var(--lv-font-mono);
  color: var(--lv-accent-bright);
  background: var(--lv-bg);
  border: 1px solid var(--lv-border);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 8px;
  text-align: center;
}

/* Signup fields */
.lv-signup-fields {
  margin-bottom: 0;
}

.lv-signup-row {
  display: flex;
  gap: 8px;
}

.lv-signup-row .lv-login-input {
  flex: 1;
}

/* Promo code row */
.lv-promo-row {
  display: flex;
  gap: 6px;
  margin-bottom: 8px;
}

.lv-promo-row .lv-login-input {
  flex: 1;
  margin-bottom: 0;
  font-size: 12px;
  padding: 8px 10px;
}

.lv-promo-apply {
  background: var(--lv-surface-raised);
  border: 1px solid var(--lv-border);
  border-radius: 8px;
  color: var(--lv-text-muted);
  cursor: pointer;
  padding: 0 14px;
  font-family: 'Inter', sans-serif;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: background var(--lv-transition), color var(--lv-transition), border-color var(--lv-transition);
}

.lv-promo-apply:hover {
  background: var(--lv-accent);
  color: var(--lv-text);
  border-color: var(--lv-accent);
}

.lv-promo-apply:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.lv-promo-status {
  font-size: 11px;
  font-family: var(--lv-font-mono);
  text-align: left;
  margin: -4px 0 8px;
  min-height: 0;
}

.lv-promo-status:empty { display: none; }
.lv-promo-status.success { color: var(--lv-accent); }
.lv-promo-status.error { color: var(--lv-error); }
.lv-promo-status.sending { color: var(--lv-text-dim); }

/* Pay separator */
.lv-pay-separator {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--lv-text-dim);
  font-size: 10px;
}

.lv-pay-separator::before,
.lv-pay-separator::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--lv-border);
}

/* Stripe card element */
.lv-stripe-element {
  background: var(--lv-bg);
  border: 1px solid var(--lv-border);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 8px;
  transition: border-color var(--lv-transition);
}

.lv-stripe-element:focus-within {
  border-color: var(--lv-accent);
}

.lv-stripe-card-errors {
  font-size: 11px;
  color: var(--lv-error);
  text-align: left;
  min-height: 0;
  margin: -4px 0 8px;
}

.lv-stripe-card-errors:empty { display: none; }

#lv-payment-request-btn {
  margin-bottom: 8px;
}

.lv-stripe-test-hint {
  margin-top: 6px;
  font-size: 10px;
  font-family: var(--lv-font-mono);
  color: #F5A623;
  opacity: 0.7;
  text-align: center;
}

.lv-stripe-test-hint:empty { display: none; }

/* Plan cards */
.lv-plan-cards {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.lv-plan-card {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  background: var(--lv-bg);
  border: 1px solid var(--lv-border);
  border-radius: 10px;
  padding: 12px 8px;
  cursor: pointer;
  transition: border-color var(--lv-transition), background var(--lv-transition);
  font-family: var(--lv-font);
}

.lv-plan-card:hover {
  border-color: var(--lv-accent);
  background: rgba(45, 122, 82, 0.06);
}

.lv-plan-card.featured {
  border-color: var(--lv-accent);
  background: rgba(45, 122, 82, 0.04);
}

.lv-plan-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--lv-accent-bright);
  background: rgba(45, 122, 82, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
}

.lv-plan-card.featured .lv-plan-badge {
  background: var(--lv-accent);
  color: var(--lv-text);
}

.lv-plan-price {
  font-size: 16px;
  font-weight: 700;
  color: var(--lv-text);
}

.lv-plan-price small {
  font-size: 10px;
  font-weight: 400;
  color: var(--lv-text-dim);
}

.lv-plan-features {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
  width: 100%;
  text-align: left;
}

.lv-plan-features li {
  font-size: 10px;
  padding: 2px 0 2px 16px;
  position: relative;
  color: var(--lv-text-muted);
}

.lv-plan-features li::before {
  position: absolute;
  left: 0;
  font-size: 10px;
}

.lv-plan-features li.yes::before {
  content: "\2713";
  color: var(--lv-accent);
}

.lv-plan-features li.no::before {
  content: "\2717";
  color: var(--lv-text-dim);
}

.lv-plan-features li.no {
  color: var(--lv-text-dim);
  opacity: 0.5;
}

.lv-plan-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 2px;
}

.lv-plan-info-btn {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 1px solid var(--lv-text-dim);
  background: none;
  color: var(--lv-text-dim);
  font-size: 11px;
  font-weight: 600;
  font-style: italic;
  font-family: serif;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color var(--lv-transition), border-color var(--lv-transition);
}

.lv-plan-info-btn:hover {
  color: var(--lv-accent-bright);
  border-color: var(--lv-accent);
}

.lv-plan-detail {
  font-size: 10px;
  font-family: var(--lv-font-mono);
  color: var(--lv-text-dim);
  margin-bottom: 6px;
}

.lv-plan-select-btn {
  width: 100%;
  background: var(--lv-accent);
  border: none;
  border-radius: 6px;
  color: var(--lv-text);
  cursor: pointer;
  padding: 7px;
  font-family: 'Inter', sans-serif;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: background var(--lv-transition);
  margin-top: 4px;
}

.lv-plan-select-btn:hover {
  background: #3a9966;
}

.lv-plan-card {
  position: relative;
}

.lv-plan-popover {
  display: none;
  position: fixed;
  background: var(--lv-surface-raised);
  border: 1px solid var(--lv-border-hover);
  border-radius: 8px;
  padding: 10px 12px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  animation: lv-fade-in 150ms ease-out;
  width: 220px;
}

.lv-plan-popover.visible {
  display: block;
}

/* Upgrade popup features */
.lv-upgrade-features {
  list-style: none;
  padding: 0;
  margin: 0 0 16px;
  text-align: left;
}

.lv-upgrade-features li {
  font-size: 12px;
  color: var(--lv-text-muted);
  padding: 3px 0 3px 18px;
  position: relative;
}

.lv-upgrade-features li::before {
  content: "\2713";
  position: absolute;
  left: 0;
  color: var(--lv-accent);
  font-weight: 600;
}

.lv-login-status {
  margin-top: 10px;
  font-size: 12px;
  font-family: var(--lv-font-mono);
  text-align: center;
  min-height: 16px;
}

.lv-login-status:empty {
  display: none;
}

.lv-login-status[data-state="error"] {
  color: var(--lv-error);
}

.lv-login-status[data-state="sending"] {
  color: var(--lv-text-dim);
}

.lv-login-status[data-state="success"] {
  color: var(--lv-accent);
}

/* ── Expert Mode Header Controls ── */
.lv-expert-controls {
  display: none;
  align-items: center;
  gap: 8px;
}

.legisto-voice-widget[data-mode-expert="true"] .lv-expert-controls {
  display: flex;
}

.lv-panel-toggle {
  background: none;
  border: 1px solid var(--lv-border);
  border-radius: 6px;
  color: var(--lv-text-dim);
  cursor: pointer;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: color var(--lv-transition), border-color var(--lv-transition), background var(--lv-transition);
}

.lv-panel-toggle:hover {
  color: var(--lv-text-muted);
  border-color: var(--lv-border-hover);
}

.lv-panel-toggle.active {
  color: var(--lv-accent-bright);
  border-color: var(--lv-accent);
  background: rgba(45, 122, 82, 0.12);
}

.lv-panel-toggle svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.lv-user-menu {
  position: relative;
}

.lv-user-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(45, 122, 82, 0.08);
  border: 1px solid rgba(45, 122, 82, 0.2);
  border-radius: 6px;
  padding: 3px 8px;
  cursor: pointer;
  color: var(--lv-accent-bright);
  transition: background var(--lv-transition);
  font-family: var(--lv-font);
}

.lv-user-badge svg {
  opacity: 0.6;
  transition: opacity var(--lv-transition);
}

.lv-user-badge:hover svg {
  opacity: 1;
}

.lv-user-badge:hover {
  background: rgba(45, 122, 82, 0.15);
}

.lv-user-email {
  font-size: 10px;
  font-family: var(--lv-font-mono);
  color: var(--lv-accent-bright);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lv-user-dropdown {
  display: none;
  position: fixed;
  background: var(--lv-surface-raised);
  border: 1px solid var(--lv-border-hover);
  border-radius: 8px;
  padding: 4px;
  z-index: 100;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  animation: lv-fade-in 150ms ease-out;
  min-width: 160px;
  pointer-events: none;
}

.lv-user-menu.open .lv-user-dropdown {
  display: block;
  pointer-events: auto;
}

.lv-user-dropdown-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  color: var(--lv-text);
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 6px;
  font-family: var(--lv-font);
  font-size: 12px;
  text-align: left;
  white-space: nowrap;
  transition: background var(--lv-transition);
}

.lv-user-dropdown-item:hover {
  background: rgba(154, 200, 190, 0.12);
}

.lv-user-dropdown-item.lv-menu-logout:hover {
  color: var(--lv-error);
  background: rgba(255, 107, 107, 0.08);
}

.lv-user-dropdown-item.lv-menu-cancel:hover {
  color: #F5A623;
  background: rgba(245, 166, 35, 0.08);
}

.lv-user-dropdown-divider {
  height: 1px;
  background: var(--lv-border);
  margin: 4px 0;
}

/* ── Cancel Popup ── */
.lv-cancel-popup {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 15;
  background: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
  border-radius: var(--lv-radius);
}

.lv-cancel-popup.visible {
  display: flex;
}

.lv-cancel-content {
  background: var(--lv-surface);
  border: 1px solid var(--lv-border);
  border-radius: 12px;
  padding: 24px;
  width: 320px;
  max-width: 90%;
  text-align: center;
  animation: lv-fade-in 200ms ease-out;
}

.lv-cancel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--lv-text);
  margin-bottom: 8px;
}

.lv-cancel-text {
  font-size: 12px;
  color: var(--lv-text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

.lv-cancel-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lv-cancel-confirm {
  width: 100%;
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.3);
  border-radius: 8px;
  color: var(--lv-error);
  cursor: pointer;
  padding: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: background var(--lv-transition);
}

.lv-cancel-confirm:hover {
  background: rgba(255, 107, 107, 0.2);
}

.lv-cancel-dismiss {
  width: 100%;
  background: var(--lv-accent);
  border: none;
  border-radius: 8px;
  color: var(--lv-text);
  cursor: pointer;
  padding: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  transition: background var(--lv-transition);
}

.lv-cancel-dismiss:hover {
  background: #3a9966;
}

.lv-cancel-status {
  margin-top: 10px;
  font-size: 12px;
  font-family: var(--lv-font-mono);
  min-height: 16px;
}

.lv-cancel-status:empty { display: none; }
.lv-cancel-status[data-state="error"] { color: var(--lv-error); }
.lv-cancel-status[data-state="sending"] { color: var(--lv-text-dim); }
.lv-cancel-status[data-state="success"] { color: var(--lv-accent); }

/* ── Usage Popup ── */
.lv-usage-popup {
  display: none;
  position: absolute;
  inset: 0;
  z-index: 15;
  background: rgba(0, 0, 0, 0.6);
  align-items: center;
  justify-content: center;
  border-radius: var(--lv-radius);
}

.lv-usage-popup.visible {
  display: flex;
}

.lv-usage-content {
  background: var(--lv-surface);
  border: 1px solid var(--lv-border);
  border-radius: 12px;
  padding: 20px;
  width: 480px;
  max-width: 95%;
  max-height: 85%;
  display: flex;
  flex-direction: column;
  animation: lv-fade-in 200ms ease-out;
}

.lv-usage-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.lv-usage-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--lv-text);
}

.lv-usage-subtitle {
  font-size: 11px;
  color: var(--lv-text-dim);
  font-family: var(--lv-font-mono);
  margin-top: 2px;
}

.lv-usage-subtitle:empty {
  display: none;
}

.lv-usage-close {
  background: none;
  border: none;
  color: var(--lv-text-dim);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0 4px;
  transition: color var(--lv-transition);
}

.lv-usage-close:hover {
  color: var(--lv-text);
}

.lv-usage-body {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.lv-usage-body::-webkit-scrollbar {
  width: 4px;
}

.lv-usage-body::-webkit-scrollbar-thumb {
  background: var(--lv-surface-raised);
  border-radius: 2px;
}

.lv-usage-card {
  background: var(--lv-bg);
  border: 1px solid var(--lv-border);
  border-radius: 8px;
  padding: 10px 12px;
  transition: border-color var(--lv-transition);
}

.lv-usage-card:hover {
  border-color: var(--lv-border-hover);
}

.lv-usage-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.lv-usage-card-name {
  font-size: 12px;
  font-weight: 500;
  color: var(--lv-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 280px;
}

.lv-usage-stars {
  font-size: 11px;
  color: #F5A623;
  letter-spacing: 1px;
  flex-shrink: 0;
}

.lv-usage-card-meta {
  display: flex;
  gap: 12px;
  font-size: 10px;
  font-family: var(--lv-font-mono);
  color: var(--lv-text-dim);
  margin-bottom: 4px;
}

.lv-usage-card-stats {
  display: flex;
  gap: 12px;
  font-size: 10px;
  color: var(--lv-text-muted);
}

/* Login button (shown when not logged in) */
.lv-login-btn {
  background: none;
  border: 1px solid var(--lv-border);
  border-radius: 6px;
  color: var(--lv-text-dim);
  cursor: pointer;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--lv-font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  transition: color var(--lv-transition), border-color var(--lv-transition), background var(--lv-transition);
}

.lv-login-btn:hover {
  color: var(--lv-accent-bright);
  border-color: var(--lv-accent);
  background: rgba(45, 122, 82, 0.08);
}

.lv-login-btn svg {
  width: 14px;
  height: 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Hide login button in expert mode */
.legisto-voice-widget[data-mode-expert="true"] .lv-login-btn {
  display: none;
}

/* Session rename input */
.lv-rename-input {
  width: 100%;
  background: var(--lv-bg);
  border: 1px solid var(--lv-accent);
  border-radius: 4px;
  padding: 4px 6px;
  color: var(--lv-text);
  font-family: var(--lv-font);
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
}

/* ── Animations ── */
@keyframes lv-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes lv-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .lv-dot {
    animation: none !important;
  }
  .lv-message {
    animation: none !important;
  }
  .lv-orb-container,
  .lv-transcript {
    transition: none !important;
  }
}
