/* =========================================
   LEX — LEGAL VOICE PLATFORM
   Design System: main.css
   ========================================= */

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

/* ---- CSS Variables ---- */
:root {
  /* Core Palette */
  --bg-app: #F8FAFC;
  --bg-panel: #FFFFFF;
  --bg-elevated: #FFFFFF;
  --bg-card: #F1F5F9;
  --bg-hover: #E2E8F0;
  --bg-glass: rgba(255, 255, 255, 0.85);

  /* Accent */
  --gold: #B45309;
  --gold-light: #D97706;
  --gold-dim: rgba(180, 83, 9, 0.1);
  --gold-glow: rgba(180, 83, 9, 0.25);
  --blue-accent: #1E3A8A;
  --blue-dim: rgba(30, 58, 138, 0.1);

  /* Text */
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --text-gold: #B45309;

  /* Status */
  --status-active: #059669;
  --status-warn: #D97706;
  --status-error: #DC2626;

  /* Borders */
  --border: #CBD5E1;
  --border-gold: rgba(180, 83, 9, 0.25);

  /* Sidebar */
  --sidebar-width: 240px;
  --sidebar-bg: #FFFFFF;

  /* Voice Bar */
  --voice-bar-h: 96px;

  /* Typography */
  --font-ui: 'Inter', system-ui, sans-serif;
  --font-doc: 'EB Garamond', Georgia, serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Transitions */
  --t-fast: 150ms ease;
  --t-med: 280ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-slow: 450ms cubic-bezier(0.4, 0, 0.2, 1);

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(15, 23, 42, 0.05);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.12);
  --shadow-gold: 0 0 24px rgba(180, 83, 9, 0.15);

  /* Radii */
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --r-xl: 24px;
}

/* ---- Reset ---- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
  overflow: hidden;
}

body {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--bg-hover);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ---- App Shell ---- */
.app-shell {
  display: flex;
  height: 100vh;
  padding-bottom: var(--voice-bar-h);
  background: var(--bg-app);
  position: relative;
  overflow: hidden;
}

/* Background decoration */
.app-shell::before {
  content: '';
  position: fixed;
  top: -30%;
  left: -10%;
  width: 60%;
  height: 70%;
  background: radial-gradient(ellipse, rgba(30, 58, 138, 0.06) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

.app-shell::after {
  content: '';
  position: fixed;
  bottom: var(--voice-bar-h);
  right: -5%;
  width: 40%;
  height: 50%;
  background: radial-gradient(ellipse, rgba(180, 83, 9, 0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* ---- Sidebar ---- */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 10;
  overflow: hidden;
}

.sidebar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
}

/* Logo */
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 18px;
  border-bottom: 1px solid var(--border);
}

.logo-icon {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--gold) 0%, #92400E 100%);
  border-radius: var(--r-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
  box-shadow: 0 0 20px rgba(180, 83, 9, 0.2);
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.logo-name {
  font-family: var(--font-doc);
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: 0.04em;
}

.logo-tagline {
  font-size: 10px;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-top: 2px;
}

/* Nav */
.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 8px;
}

.nav-section-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 10px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: all var(--t-fast);
  margin-bottom: 2px;
  position: relative;
  cursor: pointer;
}

.nav-item:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.nav-item.active {
  background: var(--gold-dim);
  color: var(--gold-light);
  border: 1px solid var(--border-gold);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--gold);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active .nav-icon {
  opacity: 1;
}

.nav-badge {
  margin-left: auto;
  background: var(--gold);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 999px;
  min-width: 18px;
  text-align: center;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}

.user-profile {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1E40AF, #3B82F6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.user-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role {
  font-size: 11px;
  color: var(--text-muted);
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-dot.online {
  background: var(--status-active);
  box-shadow: 0 0 6px var(--status-active);
}

.status-dot.recording {
  background: var(--status-error);
  animation: pulse-dot 1s infinite;
}

@keyframes pulse-dot {

  0%,
  100% {
    opacity: 1;
    box-shadow: 0 0 6px var(--status-error);
  }

  50% {
    opacity: 0.5;
    box-shadow: 0 0 12px var(--status-error);
  }
}

/* ---- Main Content ---- */
.main-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 5;
  overflow: hidden;
}

/* ---- Panel ---- */
.panel {
  display: none;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.panel.active {
  display: flex;
}

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

.header-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}

.panel-title {
  font-family: var(--font-doc);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
}

.panel-subtitle {
  font-size: 12.5px;
  color: var(--text-muted);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Doc Title Input */
.doc-title-input-wrap {
  display: flex;
  align-items: center;
}

.doc-title-input {
  font-family: var(--font-doc);
  font-size: 22px;
  font-weight: 600;
  color: var(--text-primary);
  background: transparent;
  border: none;
  outline: none;
  width: 100%;
  max-width: 400px;
  padding: 2px 0;
  border-bottom: 2px solid transparent;
  transition: border-color var(--t-fast);
}

.doc-title-input:hover,
.doc-title-input:focus {
  border-bottom-color: var(--border-gold);
}

.doc-meta {
  display: flex;
  align-items: center;
  gap: 10px;
}

.doc-type-badge {
  background: var(--gold-dim);
  border: 1px solid var(--border-gold);
  color: var(--gold-light);
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.doc-saved-indicator {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  color: var(--status-active);
  opacity: 0.8;
}

/* ---- Buttons ---- */
.btn-primary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: linear-gradient(135deg, var(--gold) 0%, #92400E 100%);
  color: #FFFFFF;
  font-size: 13px;
  font-weight: 700;
  border: none;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  font-family: var(--font-ui);
  box-shadow: 0 2px 12px rgba(180, 83, 9, 0.2);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(180, 83, 9, 0.3);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-ghost {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: all var(--t-fast);
  white-space: nowrap;
  font-family: var(--font-ui);
}

.btn-ghost:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.btn-danger {
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.2);
  color: #DC2626;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-family: var(--font-ui);
  transition: all var(--t-fast);
}

.btn-danger:hover {
  background: rgba(220, 38, 38, 0.15);
}

/* ---- Search ---- */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: 10px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-input {
  padding: 8px 12px 8px 34px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-ui);
  width: 240px;
  transition: all var(--t-fast);
  outline: none;
}

.search-input:focus {
  border-color: var(--border-gold);
  background: var(--bg-card);
}

.search-input::placeholder {
  color: var(--text-muted);
}

/* ---- Toolbar ---- */
.editor-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 16px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 1px;
}

.toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  background: transparent;
  border: none;
  border-radius: 4px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--t-fast);
  font-size: 12px;
}

.toolbar-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.toolbar-btn.active {
  background: var(--gold-dim);
  color: var(--gold-light);
}

.toolbar-select {
  height: 28px;
  padding: 0 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-ui);
  cursor: pointer;
  outline: none;
}

.toolbar-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  margin: 0 4px;
}

.toolbar-spacer {
  flex: 1;
}

.word-count {
  font-size: 11px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* ---- Editor ---- */
.editor-container {
  flex: 1;
  display: flex;
  overflow: hidden;
  background: var(--bg-app);
}

.editor-paper {
  flex: 1;
  overflow-y: auto;
  padding: 48px 40px;
}

.editor-body {
  width: 100%;
  max-width: 720px;
  min-height: calc(100vh - 280px);
  /* baseline height; grows freely with content */
  margin: 0 auto;
  /* center horizontally in block paper */
  background: var(--bg-elevated);
  border-radius: var(--r-lg);
  padding: 56px 64px;
  font-family: var(--font-doc);
  font-size: 16px;
  line-height: 1.85;
  color: var(--text-primary);
  outline: none;
  caret-color: var(--gold);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.04), inset 0 1px 0 rgba(255, 255, 255, 1);
  border: 1px solid var(--border);
  transition: border-color var(--t-med);
  position: relative;
}

.editor-body:focus {
  border-color: rgba(180, 83, 9, 0.25);
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.04), 0 0 0 1px rgba(180, 83, 9, 0.15), inset 0 1px 0 rgba(255, 255, 255, 1);
}

.editor-body:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
  font-style: italic;
}

/* Editor typography */
.editor-body h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 24px 0 16px;
  text-align: center;
}

.editor-body h2 {
  font-size: 20px;
  font-weight: 700;
  margin: 20px 0 12px;
}

.editor-body h3 {
  font-size: 17px;
  font-weight: 600;
  margin: 16px 0 8px;
}

.editor-body p {
  margin: 0 0 12px;
}

.editor-body ul,
.editor-body ol {
  margin: 8px 0 12px 24px;
}

.editor-body li {
  margin-bottom: 4px;
}

.editor-body blockquote {
  border-left: 3px solid var(--gold);
  padding-left: 16px;
  margin: 16px 0;
  color: var(--text-secondary);
  font-style: italic;
}

/* Legal citation */
.legal-citation {
  display: inline;
  font-style: italic;
  color: var(--gold-light);
  border-bottom: 1px dotted var(--border-gold);
  cursor: help;
}

/* Interim text highlight */
.interim-highlight {
  background: rgba(201, 168, 76, 0.15);
  border-bottom: 2px solid var(--gold);
  border-radius: 2px;
  padding: 0 2px;
}

/* ---- Quick Insert Rail ---- */
.quick-insert-rail {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: width var(--t-med);
}

.quick-insert-rail.collapsed {
  width: 0;
  border-left: none;
}

.rail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  flex-shrink: 0;
}

.rail-toggle {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px;
  display: flex;
  transition: color var(--t-fast);
}

.rail-toggle:hover {
  color: var(--text-primary);
}

.rail-body {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
}

/* ---- Voice Bar ---- */
.voice-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--voice-bar-h);
  background: rgba(10, 16, 31, 0.92);
  backdrop-filter: blur(20px);
  border-top: 1px solid var(--border);
  z-index: 100;
  display: flex;
  align-items: center;
}

.voice-bar::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), var(--gold-dim), transparent);
}

.voice-bar.recording {
  border-top-color: rgba(239, 68, 68, 0.4);
}

.voice-bar.recording::before {
  background: linear-gradient(90deg, transparent, rgba(239, 68, 68, 0.3), rgba(239, 68, 68, 0.3), transparent);
}

.voice-bar-inner {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 0 24px;
  width: 100%;
  height: 100%;
}

.voice-status {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.voice-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.voice-status-dot.idle {
  background: var(--text-muted);
}

.voice-status-dot.listening {
  background: var(--status-active);
  animation: blink 1.2s infinite;
  box-shadow: 0 0 8px var(--status-active);
}

.voice-status-dot.processing {
  background: var(--gold);
  box-shadow: 0 0 8px var(--gold);
}

@keyframes blink {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.3;
  }
}

.waveform-container {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  max-width: 320px;
  overflow: hidden;
}

#waveform-canvas {
  display: block;
  opacity: 0.6;
  transition: opacity var(--t-fast);
}

.voice-bar.recording #waveform-canvas {
  opacity: 1;
}

.interim-text {
  flex: 1;
  font-family: var(--font-doc);
  font-size: 15px;
  font-style: italic;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

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

.mic-button {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #FFFFFF;
  border: 1px solid var(--border);
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-med);
  z-index: 1;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.05);
}

.mic-button:hover {
  border-color: var(--border-gold);
  color: var(--gold);
  box-shadow: 0 4px 16px rgba(180, 83, 9, 0.15);
  transform: scale(1.05);
}

.mic-button.active {
  background: linear-gradient(135deg, #7F1D1D, #991B1B);
  border-color: rgba(239, 68, 68, 0.5);
  color: #fff;
  box-shadow: 0 0 32px rgba(239, 68, 68, 0.4);
  transform: scale(1.05);
}

.mic-ripple {
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid rgba(239, 68, 68, 0.4);
  opacity: 0;
  pointer-events: none;
}

.mic-button.active .mic-ripple {
  animation: mic-ripple 1.5s infinite;
}

@keyframes mic-ripple {
  0% {
    transform: scale(1);
    opacity: 0.6;
  }

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

.voice-btn-secondary {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
}

.voice-btn-secondary:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.lang-select {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-ui);
  padding: 5px 8px;
  cursor: pointer;
  outline: none;
  min-width: 110px;
  transition: border-color var(--t-fast);
}

.lang-select:focus {
  border-color: var(--border-gold);
}

/* ---- Modals ---- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 24, 0.8);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  animation: modal-in var(--t-med) both;
}

.modal-lg {
  max-width: 680px;
}

@keyframes modal-in {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.modal-header h3 {
  font-family: var(--font-doc);
  font-size: 18px;
  font-weight: 600;
}

.modal-close {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 4px;
  border-radius: 4px;
  transition: color var(--t-fast);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 20px;
  border-top: 1px solid var(--border);
}

/* Forms */
.form-group {
  margin-bottom: 16px;
}

.form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-primary);
  font-size: 14px;
  font-family: var(--font-ui);
  padding: 10px 12px;
  outline: none;
  transition: border-color var(--t-fast);
  resize: vertical;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--border-gold);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--text-muted);
  font-style: italic;
}

/* ---- Toast ---- */
.toast-container {
  position: fixed;
  bottom: calc(var(--voice-bar-h) + 16px);
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-end;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  box-shadow: var(--shadow-md);
  animation: toast-in 300ms cubic-bezier(0.4, 0, 0.2, 1) both;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 320px;
}

.toast.success {
  border-left: 3px solid var(--status-active);
}

.toast.error {
  border-left: 3px solid var(--status-error);
}

.toast.info {
  border-left: 3px solid var(--blue-accent);
}

.toast.warn {
  border-left: 3px solid var(--status-warn);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateX(20px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* ---- View Toggle ---- */
.view-toggle {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  overflow: hidden;
}

.view-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 30px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--t-fast);
}

.view-btn.active {
  background: var(--bg-hover);
  color: var(--text-primary);
}

.view-btn:hover {
  color: var(--text-primary);
}

/* ---- Template Preview ---- */
.template-preview {
  font-family: var(--font-doc);
  font-size: 14px;
  line-height: 1.8;
  color: var(--text-secondary);
  max-height: 360px;
  overflow-y: auto;
  white-space: pre-wrap;
  background: var(--bg-card);
  padding: 20px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
}

/* Utility classes */
.hidden {
  display: none !important;
}

.text-gold {
  color: var(--gold);
}

.text-muted {
  color: var(--text-muted);
}

.font-doc {
  font-family: var(--font-doc);
}