/* /JackalL/frontend/styles/main.css */

:root {
  --bg-primary: #14161C;
  --bg-secondary: #23252C;
  --bg-tertiary: #2a2d35;
  --accent: #72D8EF;
  --accent-dark: #5ab0bf;
  --text-primary: #F4F4F4;
  --text-secondary: #888;
  --text-muted: #666;
  --border: #444;
  --border-light: rgba(244, 244, 244, 0.1);
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
}

/* ============================================================
   APP SHELL — sidebar + main
   ============================================================ */
.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

/* ============================================================
   SIDEBAR
   ============================================================ */
.sb {
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-light);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sb-brand {
  display: flex; align-items: center; gap: 12px;
  padding-bottom: 16px; margin-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}
.sb-logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--accent); color: var(--bg-primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 500; font-size: 13px;
}
.sb-name { font-size: 15px; font-weight: 500; margin: 0; }
.sb-tag { font-size: 11px; color: var(--text-muted); margin: 0; }

.sb-group-label {
  font-size: 10px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin: 14px 0 6px 10px;
}
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px; border-radius: 6px;
  font-size: 13px; color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.sb-item:hover { background: var(--bg-tertiary); color: var(--text-primary); }
.sb-item.active { background: var(--bg-tertiary); color: var(--text-primary); }
.sb-item-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--text-muted); flex-shrink: 0;
}
.sb-item.active .sb-item-dot { background: var(--accent); }

.sb-footer { margin-top: auto; padding-top: 16px; }
.sb-toggle {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px; margin-bottom: 10px;
  font-size: 12px; color: var(--text-secondary);
  cursor: pointer;
}
.sb-switch {
  width: 30px; height: 16px; border-radius: 8px;
  background: var(--border); position: relative;
  transition: background 0.2s;
}
.sb-switch::after {
  content: ''; position: absolute; left: 2px; top: 2px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--text-secondary);
  transition: all 0.2s;
}
.sb-toggle.on .sb-switch { background: var(--accent); }
.sb-toggle.on .sb-switch::after {
  left: 16px; background: var(--bg-primary);
}
.sb-streak {
  background: var(--bg-tertiary); border-radius: 8px;
  padding: 10px 12px;
}
.sb-streak-num { font-size: 22px; font-weight: 500; color: var(--accent); }
.sb-streak-label { font-size: 10px; color: var(--text-secondary); margin-top: 2px; }

/* ============================================================
   MAIN PANEL
   ============================================================ */
.main { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  padding: 20px 28px 16px;
  border-bottom: 1px solid var(--border-light);
}
.crumb { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.h2 { margin: 0; font-size: 20px; font-weight: 500; }
.h2-sub { margin: 4px 0 0; font-size: 13px; color: var(--text-secondary); }

/* Input row used on every panel */
.input-row {
  display: flex; gap: 8px; align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 4px 4px 4px 14px;
  margin-top: 14px;
}
.input-row input {
  flex: 1;
  background: transparent; border: none; outline: none;
  color: var(--text-primary); font-size: 14px; font-family: inherit;
  padding: 8px 0;
}
.input-row input::placeholder { color: var(--text-muted); }
.input-row select {
  background: var(--bg-tertiary); border: none; outline: none;
  color: var(--text-secondary); font-size: 12px;
  padding: 6px 10px; border-radius: 5px; font-family: inherit;
  cursor: pointer;
}
.btn {
  background: var(--accent); color: var(--bg-primary);
  border: none; padding: 8px 16px; border-radius: 6px;
  font-size: 13px; font-weight: 500; cursor: pointer;
  font-family: inherit;
  transition: background 0.15s;
}
.btn:hover { background: var(--accent-dark); }
.btn:disabled { opacity: 0.5; cursor: wait; }

.quick-asks {
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
  margin-top: 12px; font-size: 12px; color: var(--text-muted);
}
.chip {
  background: var(--bg-secondary); border: 0.5px solid var(--border-light);
  padding: 5px 11px; border-radius: 999px; font-size: 12px;
  cursor: pointer; color: var(--text-secondary);
  font-family: inherit;
  transition: all 0.15s;
}
.chip:hover { background: var(--bg-tertiary); color: var(--accent); border-color: var(--accent); }

/* ============================================================
   STAGE (now-playing focus area, large text)
   ============================================================ */
.stage {
  margin: 16px 28px 0;
  background: var(--bg-secondary);
  border: 0.5px solid var(--border-light);
  border-radius: 12px;
  padding: 24px 24px 16px;
  position: relative;
}
.stage.hidden { display: none; }

.stage-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 10px;
}
.stage-label {
  font-size: 10px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.1em;
}
.stage-speaker {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--text-secondary);
}
.pulse {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  animation: pulse 1.4s infinite;
}
.pulse.paused { animation: none; background: var(--text-muted); }
@keyframes pulse { 50% { opacity: 0.35; } }

.stage-line-fr {
  font-size: 24px; font-weight: 400; line-height: 1.5;
  margin: 10px 0 10px;
}
.stage-line-en {
  font-size: 15px; color: var(--text-secondary);
  margin: 0 0 6px;
}
.stage-line-pr {
  font-size: 12px; font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  color: var(--text-muted); letter-spacing: 0.03em;
  margin: 0 0 18px;
}

.stage-controls {
  display: flex; align-items: center; gap: 10px;
  padding-top: 14px; border-top: 0.5px solid var(--border-light);
  flex-wrap: wrap;
}
.ctrl {
  width: 34px; height: 34px; border-radius: 50%;
  background: transparent; border: 0.5px solid var(--border-light);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px;
  transition: all 0.15s;
}
.ctrl.play {
  width: 44px; height: 44px;
  background: var(--accent); color: var(--bg-primary); border: none;
}
.ctrl:hover { color: var(--accent); border-color: var(--accent); }
.ctrl.play:hover { background: var(--accent-dark); color: var(--bg-primary); }

.progress-line {
  flex: 1; min-width: 80px; height: 3px;
  background: var(--border-light); border-radius: 2px;
  position: relative; margin: 0 4px;
}
.progress-fill {
  position: absolute; left: 0; top: 0; bottom: 0;
  width: 0%; background: var(--accent); border-radius: 2px;
  transition: width 0.2s linear;
}
.progress-time {
  font-size: 10px; font-family: ui-monospace, monospace;
  color: var(--text-muted);
}

.speed-chip {
  display: flex; align-items: center;
  background: var(--bg-tertiary);
  border-radius: 6px;
  padding: 3px;
  gap: 2px;
}
.speed-opt {
  padding: 5px 10px;
  font-size: 11px;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  font-family: ui-monospace, monospace;
  transition: all 0.15s;
}
.speed-opt:hover { color: var(--text-primary); }
.speed-opt.active {
  background: var(--accent); color: var(--bg-primary);
}

/* ============================================================
   TRANSCRIPT LIST (full dialogue)
   ============================================================ */
.transcript-head {
  padding: 22px 28px 8px;
  display: flex; justify-content: space-between; align-items: center;
}
.transcript-title {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.transcript-meta { font-size: 11px; color: var(--text-muted); }

.list { padding: 0 28px 28px; }

.ex {
  display: grid; grid-template-columns: 50px 1fr auto;
  gap: 14px; padding: 12px;
  border-radius: 8px;
  border-bottom: 0.5px solid var(--border-light);
  align-items: start;
  cursor: pointer;
  transition: background 0.15s;
}
.ex:last-child { border-bottom: none; }
.ex:hover:not(.current) { background: var(--bg-secondary); }
.ex.current {
  background: rgba(114, 216, 239, 0.06);
  border: 0.5px solid rgba(114, 216, 239, 0.25);
}
.ex.done .line-fr { color: var(--text-secondary); }

.avatar {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500; margin: 0 auto;
}
.avatar.a { background: rgba(114,216,239,0.15); color: var(--accent); }
.avatar.b { background: rgba(245,158,11,0.15); color: var(--warning); }
.sp-label {
  text-align: center; font-size: 10px; color: var(--text-muted);
  margin-top: 4px;
}
.line-fr {
  font-size: 16px; font-weight: 400; line-height: 1.55;
  margin: 4px 0 4px;
}
.line-en {
  font-size: 13px; color: var(--text-secondary);
  line-height: 1.5; margin: 0 0 3px;
}
.line-pr {
  font-size: 10px; font-family: ui-monospace, monospace;
  color: var(--text-muted); letter-spacing: 0.03em;
  margin: 0;
}
.line-actions { display: flex; gap: 4px; }
.mini-btn {
  width: 28px; height: 28px; border-radius: 6px;
  background: transparent; border: 0.5px solid var(--border-light);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 12px;
  transition: all 0.15s;
}
.mini-btn:hover { color: var(--accent); border-color: var(--accent); }

/* ============================================================
   CLICKABLE FRENCH WORDS
   ============================================================ */
.fr-word {
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  padding: 0 2px;
  border-radius: 3px;
  transition: all 0.15s;
}
.fr-word.has-meaning { border-bottom-color: var(--accent); }
.fr-word:hover { background: rgba(114, 216, 239, 0.15); color: var(--accent); }
.fr-word.active {
  background: rgba(114, 216, 239, 0.2);
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ============================================================
   POPUP (word definitions, C-style large + clear)
   ============================================================ */
.popover {
  position: fixed;
  background: var(--bg-tertiary);
  border: 0.5px solid var(--border-light);
  border-radius: 10px;
  padding: 16px 18px;
  max-width: 300px;
  min-width: 220px;
  z-index: 100;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.popover.hidden { display: none; }
.popover-close {
  position: absolute; top: 8px; right: 12px;
  background: none; border: none; font-size: 16px; cursor: pointer;
  color: var(--text-muted);
}
.popover-close:hover { color: var(--text-primary); }
.popover-body .fr {
  font-weight: 500; font-size: 18px; color: var(--accent);
  margin-bottom: 4px;
}
.popover-body .en {
  font-size: 15px; color: var(--text-primary); margin-bottom: 4px;
}
.popover-body .meta {
  font-size: 11px; color: var(--text-muted);
  font-family: ui-monospace, monospace;
}
.popover-body .note {
  font-size: 12px; color: var(--text-secondary);
  margin-top: 8px; line-height: 1.5;
}
.popover-body .example {
  font-size: 12px; background: var(--bg-secondary); padding: 8px 10px;
  border-radius: 6px; margin-top: 10px; line-height: 1.5;
}
.popover-body .example .ex-en {
  color: var(--text-muted); font-style: italic; margin-top: 2px;
}

/* ============================================================
   GRAMMAR PANEL
   ============================================================ */
.panel-body {
  padding: 16px 28px 28px;
  flex: 1;
}
.grammar-card {
  background: var(--bg-secondary);
  border: 0.5px solid var(--border-light);
  border-radius: 12px;
  padding: 20px 22px;
}
.grammar-card h3 {
  margin: 0 0 8px; font-size: 16px; color: var(--accent); font-weight: 500;
}
.grammar-rule { font-size: 15px; margin: 0 0 16px; line-height: 1.6; }

.speak-summary {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-tertiary); border: 0.5px solid var(--border-light);
  color: var(--text-secondary);
  padding: 6px 12px; border-radius: 6px;
  font-size: 12px; cursor: pointer; margin-bottom: 16px;
  font-family: inherit;
}
.speak-summary:hover { color: var(--accent); border-color: var(--accent); }

.grammar-examples {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  margin-bottom: 16px;
}
.grammar-example {
  background: var(--bg-tertiary);
  padding: 12px 14px;
  border-radius: 8px;
  border-left: 2px solid var(--accent);
  border-radius: 0 8px 8px 0;
}
.grammar-example .ex-fr {
  font-weight: 500; font-size: 15px; margin-bottom: 2px;
}
.grammar-example .ex-en {
  color: var(--text-secondary); font-size: 13px; margin-top: 2px;
}
.grammar-example .ex-pr {
  font-family: ui-monospace, monospace; font-size: 10px;
  color: var(--text-muted); margin-top: 4px;
}
.grammar-example .mini-btn { margin-top: 6px; }

.grammar-mistake {
  background: rgba(245, 158, 11, 0.08);
  border-left: 2px solid var(--warning);
  padding: 12px 14px;
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  line-height: 1.5;
}
.grammar-mistake strong { color: var(--warning); }

/* ============================================================
   TRANSLATE PANEL
   ============================================================ */
.translate-card {
  background: var(--bg-secondary);
  border: 0.5px solid var(--border-light);
  border-radius: 12px;
  padding: 20px 22px;
}
.translate-card .row {
  display: flex; justify-content: space-between; gap: 16px;
  padding: 12px 0;
  border-bottom: 0.5px solid var(--border-light);
  align-items: baseline;
}
.translate-card .row:last-child { border-bottom: none; }
.translate-card .label {
  font-size: 11px; color: var(--text-muted); flex: 0 0 110px;
  text-transform: uppercase; letter-spacing: 0.08em;
}
.translate-card .value {
  flex: 1; font-size: 15px; line-height: 1.5;
  display: flex; align-items: center; gap: 8px;
}

.mistake-flag {
  background: rgba(245, 158, 11, 0.1);
  border-left: 2px solid var(--warning);
  color: var(--text-primary);
  padding: 10px 14px;
  border-radius: 0 8px 8px 0;
  font-size: 13px;
  margin-bottom: 16px;
}
.mistake-flag strong { color: var(--warning); }

/* ============================================================
   Vocabulary tab styles
   ============================================================ */

/* Category filter chips */
.cat-row {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 16px 28px 0;
}
.cat-chip {
  padding: 6px 14px; border-radius: 999px;
  background: var(--bg-secondary);
  border: 0.5px solid var(--border-light);
  color: var(--text-secondary);
  font-size: 12px; cursor: pointer;
  display: flex; align-items: center; gap: 6px;
  transition: all 0.15s;
  font-family: inherit;
}
.cat-chip:hover { border-color: var(--border); }
.cat-chip.active {
  background: rgba(114, 216, 239, 0.12);
  border-color: var(--accent);
  color: var(--accent);
}
.cat-count {
  font-size: 10px; color: var(--text-muted);
  padding: 1px 6px; border-radius: 4px;
  background: var(--bg-tertiary);
}
.cat-chip.active .cat-count {
  background: rgba(114, 216, 239, 0.15);
  color: var(--accent);
}

/* Mode toggle (Grid / Flashcards) */
.mode-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 28px 0;
  gap: 10px;
  flex-wrap: wrap;
}
.mode-toggle {
  display: flex;
  background: var(--bg-tertiary);
  border-radius: 6px;
  padding: 3px;
}
.mode-opt {
  padding: 5px 14px;
  font-size: 11px;
  color: var(--text-secondary);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.mode-opt:hover { color: var(--text-primary); }
.mode-opt.active {
  background: var(--accent); color: var(--bg-primary);
}
.vocab-meta {
  font-size: 11px; color: var(--text-muted);
}

/* Grid of word cards */
.vocab-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
  padding: 16px 28px 28px;
}
.vocab-grid.hidden { display: none; }

.v-card {
  background: var(--bg-secondary);
  border: 0.5px solid var(--border-light);
  border-radius: 10px;
  padding: 14px 16px;
  position: relative;
  transition: border-color 0.15s;
  cursor: pointer;
}
.v-card:hover { border-color: rgba(114, 216, 239, 0.3); }

.v-card-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 4px;
  gap: 10px;
}
.v-fr {
  font-size: 17px; font-weight: 500;
  color: var(--text-primary);
  line-height: 1.3;
}
.v-speak {
  width: 30px; height: 30px; border-radius: 50%;
  background: transparent;
  border: 0.5px solid var(--border-light);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; cursor: pointer;
  flex-shrink: 0;
  transition: all 0.15s;
  font-family: inherit;
}
.v-speak:hover {
  background: var(--accent); color: var(--bg-primary); border-color: var(--accent);
}
.v-en {
  font-size: 13px; color: var(--text-secondary);
  margin-bottom: 6px;
  line-height: 1.4;
}
.v-pr {
  font-size: 10px;
  font-family: ui-monospace, 'SF Mono', Menlo, monospace;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  margin-bottom: 6px;
}
.v-pos-pill {
  display: inline-block;
  font-size: 9px;
  padding: 2px 7px;
  border-radius: 3px;
  background: var(--bg-tertiary);
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.v-pos-pill.masc { color: #85B7EB; background: rgba(133, 183, 235, 0.1); }
.v-pos-pill.fem  { color: #ED93B1; background: rgba(237, 147, 177, 0.1); }
.v-pos-pill.verb { color: #5DCAA5; background: rgba(93, 202, 165, 0.1); }

/* Flashcard mode */
.flashcard-area {
  padding: 32px 28px;
  display: flex; flex-direction: column; align-items: center;
  gap: 14px;
}
.flashcard-area.hidden { display: none; }

.flashcard {
  background: var(--bg-secondary);
  border: 0.5px solid var(--border-light);
  border-radius: 14px;
  padding: 40px 30px;
  width: 100%;
  max-width: 420px;
  text-align: center;
  min-height: 220px;
  display: flex; flex-direction: column; justify-content: center; gap: 10px;
  position: relative;
  cursor: pointer;
  transition: border-color 0.15s;
}
.flashcard:hover { border-color: rgba(114, 216, 239, 0.3); }

.fc-counter {
  position: absolute; top: 12px; left: 16px;
  font-size: 10px; color: var(--text-muted);
  letter-spacing: 0.08em;
}
.fc-pos { position: absolute; top: 12px; right: 16px; }

.fc-big-fr { font-size: 34px; font-weight: 400; color: var(--text-primary); line-height: 1.2; }
.fc-pr {
  font-size: 12px; font-family: ui-monospace, monospace;
  color: var(--text-muted); letter-spacing: 0.03em;
}
.fc-en {
  font-size: 16px; color: var(--text-secondary); margin-top: 8px;
  transition: opacity 0.2s;
}
.fc-en.hidden { opacity: 0; }
.fc-hint {
  font-size: 11px; color: var(--text-muted); margin-top: 16px;
}

.fc-controls { display: flex; gap: 10px; }
.fc-btn {
  width: 42px; height: 42px; border-radius: 50%;
  background: transparent; border: 0.5px solid var(--border-light);
  color: var(--text-secondary);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 14px;
  transition: all 0.15s;
  font-family: inherit;
}
.fc-btn:hover { color: var(--accent); border-color: var(--accent); }
.fc-btn.main {
  width: 50px; height: 50px;
  background: var(--accent); color: var(--bg-primary); border: none;
}
.fc-btn.main:hover { background: var(--accent-dark); color: var(--bg-primary); }

/* Responsive */
@media (max-width: 700px) {
  .vocab-grid { grid-template-columns: 1fr; padding: 16px; }
  .cat-row, .mode-row { padding-left: 16px; padding-right: 16px; }
  .fc-big-fr { font-size: 28px; }
  .flashcard { padding: 30px 20px; }
}


/* ============================================================
   APPEND to /JackalL/frontend/styles/main.css
   Custom categories — "+ New" chip, delete button, dialog
   ============================================================ */

/* "+ New category" chip — dashed style to feel like an add action */
.cat-chip.cat-new {
  background: transparent;
  border: 0.5px dashed var(--border);
  color: var(--text-muted);
}
.cat-chip.cat-new:hover {
  background: var(--bg-secondary);
  border-color: var(--accent);
  border-style: dashed;
  color: var(--accent);
}

/* Delete "×" inside custom category chips */
.cat-del {
  display: inline-flex;
  align-items: center; justify-content: center;
  width: 16px; height: 16px;
  border-radius: 50%;
  margin-left: 2px;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s;
}
.cat-del:hover {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}
.cat-chip.active .cat-del { color: var(--accent); }
.cat-chip.active .cat-del:hover {
  background: rgba(239, 68, 68, 0.2);
  color: var(--danger);
}

/* ---------- Dialog (modal) ---------- */
.dialog-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn 0.15s ease-out;
}
.dialog-backdrop.hidden { display: none; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.dialog {
  background: var(--bg-secondary);
  border: 0.5px solid var(--border-light);
  border-radius: 12px;
  padding: 22px 24px;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
}
.dialog-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 4px;
}
.dialog-head h3 {
  margin: 0; font-size: 16px; font-weight: 500;
  color: var(--text-primary);
}
.dialog-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 20px; cursor: pointer;
  width: 26px; height: 26px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  line-height: 1;
}
.dialog-close:hover { background: var(--bg-tertiary); color: var(--text-primary); }

.dialog-sub {
  font-size: 12px; color: var(--text-secondary);
  margin: 0 0 14px;
}
.dialog-label {
  display: block;
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin: 10px 0 6px;
}
.dialog-input {
  width: 100%;
  background: var(--bg-tertiary);
  border: 0.5px solid var(--border-light);
  border-radius: 6px;
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s;
}
.dialog-input:focus { border-color: var(--accent); }
.dialog-input::placeholder { color: var(--text-muted); }

.dialog-error {
  font-size: 12px;
  color: var(--danger);
  margin-top: 10px;
  min-height: 16px;
}

.dialog-actions {
  display: flex; justify-content: flex-end; gap: 8px;
  margin-top: 16px;
}
.btn-ghost {
  background: transparent;
  border: 0.5px solid var(--border-light);
  color: var(--text-secondary);
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
}
.btn-ghost:hover { background: var(--bg-tertiary); color: var(--text-primary); }

/* ============================================================
   UTILITIES
   ============================================================ */
.placeholder {
  color: var(--text-muted);
  text-align: center;
  padding: 48px 20px;
  font-size: 13px;
}
.loading {
  text-align: center;
  padding: 36px;
  color: var(--text-secondary);
  font-size: 13px;
}
.loading::after {
  content: '';
  display: inline-block;
  width: 12px; height: 12px;
  margin-left: 8px;
  border: 2px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
  border: 0.5px solid rgba(239, 68, 68, 0.3);
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
}

.panel { display: none; flex-direction: column; flex: 1; }
.panel.active { display: flex; }

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 700px) {
  .app { grid-template-columns: 1fr; }
  .sb {
    position: static; height: auto;
    flex-direction: row; flex-wrap: wrap; overflow-x: auto;
    padding: 12px;
  }
  .sb-brand, .sb-footer, .sb-group-label { display: none; }
  .sb-item { flex: 1; min-width: 110px; font-size: 12px; padding: 8px; }
  .grammar-examples { grid-template-columns: 1fr; }
  .stage-line-fr { font-size: 20px; }
  .ex { grid-template-columns: 40px 1fr auto; }
  .avatar { width: 32px; height: 32px; }
}