/* ─────────────────────────────────────────
   TAP Previews — Client-facing Preview
   ───────────────────────────────────────── */

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

/* ─── Tokens (light default) ─── */
:root {
  --bg-base:      hsl(220, 22%, 98%);
  --bg-surface:   hsl(0, 0%, 100%);
  --bg-subtle:    hsl(220, 18%, 96%);
  --bg-overlay:   hsla(220, 30%, 98%, 0.92);

  --border-subtle:  hsla(220, 18%, 20%, 0.08);
  --border-medium:  hsla(220, 18%, 20%, 0.14);
  --border-strong:  hsla(220, 18%, 20%, 0.22);

  --text-primary:   hsl(220, 25%, 14%);
  --text-secondary: hsl(220, 15%, 36%);
  --text-muted:     hsl(220, 10%, 54%);

  --accent:         hsl(238, 62%, 52%);
  --accent-hover:   hsl(238, 62%, 46%);
  --accent-soft:    hsla(238, 62%, 52%, 0.1);
  --accent-fg:      hsl(0, 0%, 100%);
  --accent-ring:    hsla(238, 62%, 52%, 0.22);

  --success:        hsl(152, 62%, 38%);
  --success-soft:   hsla(152, 62%, 38%, 0.14);
  --warning:        hsl(32, 92%, 46%);
  --warning-soft:   hsla(32, 92%, 46%, 0.14);
  --danger:         hsl(0, 68%, 50%);
  --danger-soft:    hsla(0, 68%, 50%, 0.1);

  /* Plugin mockup tokens (inside frame) */
  --mp-bg:            hsl(220, 22%, 98%);
  --mp-panel:         hsl(0, 0%, 100%);
  --mp-deep:          hsl(220, 22%, 96%);
  --mp-border:        hsla(220, 18%, 20%, 0.1);
  --mp-text:          hsl(220, 25%, 14%);
  --mp-text-muted:    hsl(220, 10%, 52%);
  --mp-accent:        hsl(210, 78%, 48%);
  --mp-keep:          hsl(152, 60%, 40%);
  --mp-alt:           hsl(275, 55%, 52%);
  --mp-record:        hsl(0, 68%, 50%);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --shadow-sm:  0 1px 2px hsla(220, 25%, 14%, 0.05);
  --shadow-md:  0 4px 12px hsla(220, 25%, 14%, 0.06), 0 1px 3px hsla(220, 25%, 14%, 0.04);
  --shadow-lg:  0 12px 36px hsla(220, 25%, 14%, 0.1), 0 2px 6px hsla(220, 25%, 14%, 0.05);
  --shadow-xl:  0 24px 64px hsla(220, 25%, 14%, 0.15);

  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 8px;
  --r-lg: 12px;
  --r-xl: 16px;

  --t-fast: 140ms cubic-bezier(0.4, 0, 0.2, 1);
  --t-med:  260ms cubic-bezier(0.4, 0, 0.2, 1);
}

body.theme-dark {
  --bg-base:      hsl(222, 22%, 8%);
  --bg-surface:   hsl(222, 18%, 11%);
  --bg-subtle:    hsl(222, 16%, 14%);
  --bg-overlay:   hsla(222, 28%, 6%, 0.94);

  --border-subtle:  hsla(220, 15%, 70%, 0.08);
  --border-medium:  hsla(220, 15%, 70%, 0.14);
  --border-strong:  hsla(220, 15%, 70%, 0.22);

  --text-primary:   hsl(220, 15%, 94%);
  --text-secondary: hsl(220, 12%, 72%);
  --text-muted:     hsl(220, 10%, 52%);

  --accent:         hsl(238, 80%, 68%);
  --accent-hover:   hsl(238, 80%, 74%);
  --accent-soft:    hsla(238, 80%, 68%, 0.15);
  --accent-fg:      hsl(222, 22%, 10%);
  --accent-ring:    hsla(238, 80%, 68%, 0.32);

  --success:        hsl(152, 62%, 54%);
  --success-soft:   hsla(152, 62%, 54%, 0.18);
  --warning:        hsl(32, 92%, 60%);
  --warning-soft:   hsla(32, 92%, 60%, 0.18);

  --mp-bg:            hsl(220, 18%, 10%);
  --mp-panel:         hsl(220, 16%, 13%);
  --mp-deep:          hsl(220, 20%, 8%);
  --mp-border:        hsla(220, 15%, 70%, 0.1);
  --mp-text:          hsl(220, 15%, 92%);
  --mp-text-muted:    hsl(220, 10%, 52%);
  --mp-accent:        hsl(210, 80%, 62%);
  --mp-keep:          hsl(152, 62%, 54%);
  --mp-alt:           hsl(275, 60%, 68%);
  --mp-record:        hsl(0, 72%, 62%);

  --shadow-sm:  0 1px 2px hsla(0, 0%, 0%, 0.3);
  --shadow-md:  0 4px 12px hsla(0, 0%, 0%, 0.35);
  --shadow-lg:  0 12px 36px hsla(0, 0%, 0%, 0.45);
  --shadow-xl:  0 24px 64px hsla(0, 0%, 0%, 0.55);
}

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  letter-spacing: -0.005em;
}

.mono { font-family: var(--font-mono); font-size: 0.92em; }
.sep { color: var(--text-muted); opacity: 0.6; }

kbd {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 0.5px 5px;
  background: var(--bg-subtle);
  border: 1px solid var(--border-medium);
  border-radius: 3px;
  color: var(--text-primary);
}

.theme-icon-sun { display: none; }
.theme-icon-moon { display: block; }
body.theme-dark .theme-icon-sun { display: block; }
body.theme-dark .theme-icon-moon { display: none; }

/* ─── Stage switching ─── */
body[data-stage="gate"] #viewer-screen { display: none; }
body[data-stage="viewer"] #gate-screen { display: none; }

/* ─────────────────────────────────────────
   PASSWORD GATE
   ───────────────────────────────────────── */
#gate-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  padding: 40px 20px;
  background: radial-gradient(ellipse at top, hsla(238, 55%, 60%, 0.08) 0%, transparent 60%),
              linear-gradient(180deg, var(--bg-base) 0%, var(--bg-subtle) 100%);
  animation: fade-in 260ms ease-out;
}
body.theme-dark #gate-screen {
  background: radial-gradient(ellipse at top, hsla(238, 60%, 50%, 0.2) 0%, transparent 55%),
              linear-gradient(180deg, var(--bg-base) 0%, hsl(222, 22%, 6%) 100%);
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.gate-container {
  position: relative;
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
}

.gate-card {
  width: 100%;
  padding: 44px 40px 36px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
  text-align: center;
  animation: gate-pop 360ms cubic-bezier(0.4, 0, 0.2, 1);
}
@keyframes gate-pop {
  from { transform: translateY(10px) scale(0.99); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.gate-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 32px;
  padding: 5px 12px 5px 5px;
  background: var(--bg-subtle);
  border-radius: 18px;
  font-size: 12px;
  color: var(--text-secondary);
}
.gate-mark {
  width: 22px;
  height: 22px;
  background: var(--accent);
  color: var(--accent-fg);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.gate-brand-text strong { font-weight: 700; color: var(--text-primary); margin-right: 2px; }

.gate-lock {
  width: 56px;
  height: 56px;
  margin: 0 auto 20px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gate-title {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: -0.015em;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.gate-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 28px;
  line-height: 1.5;
}
.gate-subtitle strong { color: var(--text-primary); font-weight: 600; }

.gate-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}
.gate-field { display: flex; flex-direction: column; gap: 6px; }
.gate-field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}
.gate-field input {
  padding: 11px 14px;
  font: inherit;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--r-sm);
  outline: none;
  transition: all var(--t-fast);
  letter-spacing: 0.02em;
}
.gate-field input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.gate-field-error {
  font-size: 12px;
  color: var(--danger);
  min-height: 0;
}
.gate-field.error input {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px var(--danger-soft);
  animation: shake 220ms ease-in-out;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.gate-submit {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 12px 18px;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
  box-shadow: var(--shadow-sm);
  margin-top: 4px;
}
.gate-submit:hover {
  background: var(--accent-hover);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}

.gate-footer {
  margin-top: 26px;
  padding-top: 22px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.gate-session-note, .gate-help {
  font-size: 12px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.gate-link { color: var(--accent); text-decoration: none; font-weight: 500; }
.gate-link:hover { text-decoration: underline; }

.gate-owner {
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.gate-owner-inner {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}
.gate-owner-inner strong { color: var(--text-secondary); font-weight: 600; }

.gate-theme-btn {
  position: absolute;
  top: -52px;
  right: 0;
  width: 32px;
  height: 32px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: all var(--t-fast);
}
.gate-theme-btn:hover { color: var(--text-primary); border-color: var(--border-medium); }

/* ─────────────────────────────────────────
   VIEWER
   ───────────────────────────────────────── */
#viewer-screen {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--bg-base);
  animation: fade-in 320ms ease-out;
  position: relative;
}

/* Thin top chrome */
#preview-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  height: 38px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-subtle);
  z-index: 10;
  font-size: 12px;
}
.chrome-left {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  min-width: 0;
}
.chrome-brand {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px 3px 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 4px;
  font-size: 11.5px;
  flex-shrink: 0;
}
.chrome-brand strong { font-weight: 700; margin-right: 1px; }
.chrome-sep { color: var(--text-muted); opacity: 0.4; flex-shrink: 0; }
.chrome-project {
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chrome-meta { color: var(--text-muted); white-space: nowrap; }
.chrome-meta strong { font-weight: 600; color: var(--text-secondary); }

.chrome-right { display: flex; align-items: center; gap: 8px; }
.chrome-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px 3px 7px;
  background: var(--success-soft);
  color: var(--success);
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

/* Mockup frame */
#mockup-frame {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: margin-right var(--t-med);
}
body.feedback-open #mockup-frame { margin-right: 380px; }

/* ─────────────────────────────────────────
   EMBEDDED MOCKUP (AudioScout-ish)
   ───────────────────────────────────────── */
#mock-plugin {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: var(--mp-bg);
  color: var(--mp-text);
}

.mp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  height: 54px;
  flex-shrink: 0;
  background: var(--mp-deep);
  border-bottom: 1px solid var(--mp-border);
}
.mp-header-left { display: flex; align-items: center; gap: 14px; }
.mp-header-right { display: flex; align-items: center; gap: 14px; }
.mp-logo {
  font-weight: 700;
  font-size: 16px;
  color: var(--mp-keep);
  letter-spacing: -0.01em;
}
.mp-session { display: flex; align-items: center; gap: 7px; }
.mp-session-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--mp-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.mp-session-name {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--mp-text);
  background: var(--mp-panel);
  border: 1px solid var(--mp-border);
  padding: 2px 8px;
  border-radius: 4px;
}

.mp-meter {
  display: flex;
  align-items: center;
  gap: 6px;
}
.mp-meter-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--mp-text-muted);
}
.mp-meter-bar {
  width: 110px;
  height: 8px;
  background: var(--mp-panel);
  border: 1px solid var(--mp-border);
  border-radius: 3px;
  overflow: hidden;
}
.mp-meter-fill {
  width: 58%;
  height: 100%;
  background: linear-gradient(90deg, var(--mp-keep), hsl(50,80%,55%), var(--mp-record));
  border-radius: 2px;
}
.mp-meter-db {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--mp-text-muted);
  min-width: 48px;
}
.mp-samplerate {
  font-size: 12px;
  color: var(--mp-text-muted);
}

/* Lines panel */
.mp-lines {
  flex: 0 0 44%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-bottom: 1px solid var(--mp-border);
}
.mp-lines-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
  height: 34px;
  flex-shrink: 0;
  background: var(--mp-deep);
  border-bottom: 1px solid var(--mp-border);
}
.mp-lines-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--mp-text);
}
.mp-lines-count {
  font-size: 12px;
  color: var(--mp-text-muted);
}
.mp-lines-body {
  flex: 1;
  overflow-y: auto;
}
.mp-line {
  display: grid;
  grid-template-columns: 44px 110px 1fr 110px 80px;
  gap: 12px;
  align-items: center;
  padding: 8px 16px;
  border-bottom: 1px solid var(--mp-border);
  font-size: 12.5px;
  cursor: pointer;
  transition: background var(--t-fast);
}
.mp-line:hover { background: var(--mp-panel); }
.mp-line.active {
  background: hsla(210, 70%, 50%, 0.08);
  box-shadow: inset 3px 0 0 var(--mp-accent);
}
body.theme-dark .mp-line.active { background: hsla(210, 70%, 50%, 0.1); }

.mp-line-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--mp-text-muted);
  text-align: center;
}
.mp-line-char {
  display: flex;
  align-items: center;
  gap: 7px;
  font-weight: 600;
  color: var(--mp-text);
}
.mp-chip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  flex-shrink: 0;
}
.mp-line-text {
  color: var(--mp-text);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mp-line-takes {
  display: flex;
  gap: 4px;
}
.mp-take {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  padding: 2px 7px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 700;
  border-radius: 4px;
  border: 1px solid;
}
.mp-take.keep {
  background: hsla(152, 50%, 45%, 0.15);
  color: var(--mp-keep);
  border-color: hsla(152, 50%, 45%, 0.3);
}
.mp-take.alt {
  background: hsla(275, 50%, 55%, 0.15);
  color: var(--mp-alt);
  border-color: hsla(275, 50%, 55%, 0.3);
}
.mp-line-status {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  padding: 2px 9px;
  border-radius: 10px;
  justify-self: center;
}
.mp-line-status.done {
  background: hsla(152, 50%, 45%, 0.12);
  color: var(--mp-keep);
}
.mp-line-status.pending {
  background: hsla(32, 80%, 50%, 0.12);
  color: var(--warning);
}

/* Track area */
.mp-track-area {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
.mp-take-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px;
  height: 48px;
  flex-shrink: 0;
  background: var(--mp-deep);
  border-bottom: 1px solid var(--mp-border);
}
.mp-transport {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--mp-panel);
  border: 1px solid var(--mp-border);
  border-radius: 6px;
}
.mp-btn {
  width: 34px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  color: var(--mp-text-muted);
  cursor: pointer;
  border-radius: 4px;
  transition: all var(--t-fast);
}
.mp-btn:hover { background: var(--bg-subtle); color: var(--mp-text); }
.mp-btn.record .mp-rec-dot {
  width: 13px;
  height: 13px;
  background: var(--mp-record);
  border-radius: 50%;
  opacity: 0.75;
}
.mp-btn.record:hover .mp-rec-dot { opacity: 1; }

.mp-timecode {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 1px;
  color: var(--mp-text);
  min-width: 160px;
  text-align: center;
}
.mp-take-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--mp-panel);
  border: 1px solid var(--mp-border);
  border-radius: 6px;
  font-size: 12.5px;
}
.mp-take-pill-num {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--mp-text);
}
.mp-take-pill-actor { font-weight: 600; color: var(--mp-text); }
.mp-take-pill-dur {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--mp-text-muted);
}

/* Waveform */
.mp-waveform {
  position: relative;
  flex: 1;
  min-height: 140px;
  background: var(--mp-panel);
  overflow: hidden;
  color: var(--mp-text-muted);
}
.mp-wave-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.mp-playhead {
  position: absolute;
  top: 0; bottom: 0;
  left: 52%;
  width: 1.5px;
  background: var(--mp-text);
}
.mp-playhead::before {
  content: '';
  position: absolute;
  top: 0; left: -4px;
  width: 10px; height: 10px;
  background: var(--mp-text);
  clip-path: polygon(0 0, 100% 0, 50% 100%);
}

/* Plugin footer */
.mp-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  height: 32px;
  flex-shrink: 0;
  background: var(--mp-deep);
  border-top: 1px solid var(--mp-border);
  font-size: 12px;
  color: var(--mp-text-muted);
}
.mp-footer > div { display: flex; align-items: center; gap: 8px; }
.mp-footer strong { color: var(--mp-text); font-weight: 600; }
.mp-status-dot {
  width: 6px;
  height: 6px;
  background: var(--mp-text-muted);
  border-radius: 50%;
  display: inline-block;
}

/* ─────────────────────────────────────────
   FEEDBACK FAB + PANEL
   ───────────────────────────────────────── */
.feedback-fab {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 11px 16px 11px 14px;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 24px hsla(238, 60%, 50%, 0.3), 0 2px 6px hsla(238, 60%, 50%, 0.2);
  z-index: 50;
  transition: all var(--t-fast);
}
.feedback-fab:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 12px 32px hsla(238, 60%, 50%, 0.35), 0 2px 6px hsla(238, 60%, 50%, 0.2);
}
.feedback-fab-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: var(--warning);
  color: white;
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-base);
}
body.feedback-open .feedback-fab { display: none; }

/* Slide-over panel */
#feedback-panel {
  position: fixed;
  top: 38px;
  right: 0;
  bottom: 0;
  width: 380px;
  background: var(--bg-surface);
  border-left: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform var(--t-med);
  z-index: 40;
}
#feedback-panel.open { transform: translateX(0); }
body.feedback-open.has-panel { /* placeholder */ }
/* trigger the shift via JS class on body */
body.feedback-open #feedback-panel { transform: translateX(0); }

.fp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}
.fp-header-left {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--accent);
}
.fp-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.fp-count {
  margin-left: 2px;
  padding: 1px 7px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 9px;
  font-size: 11px;
  font-weight: 700;
}
.fp-close {
  width: 28px; height: 28px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--t-fast);
}
.fp-close:hover { background: var(--bg-subtle); color: var(--text-primary); }

.fp-tabs {
  display: flex;
  gap: 2px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.fp-tab {
  padding: 5px 11px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  border-radius: var(--r-xs);
  cursor: pointer;
  transition: all var(--t-fast);
}
.fp-tab:hover { background: var(--bg-subtle); color: var(--text-primary); }
.fp-tab.active {
  background: var(--bg-subtle);
  border-color: var(--border-subtle);
  color: var(--text-primary);
}

.fp-list {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px;
}

.fp-comment {
  padding: 14px 0;
  border-bottom: 1px solid var(--border-subtle);
}
.fp-comment:last-child { border-bottom: none; }
.fp-comment:first-child { padding-top: 0; }
.fp-comment.resolved { opacity: 0.68; }
.fp-comment.resolved .fp-body { color: var(--text-muted); }

.fp-comment-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.fp-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}
.fp-avatar.sm { width: 26px; height: 26px; font-size: 10px; }
.fp-head-meta { min-width: 0; }
.fp-author {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}
.fp-resolved-chip {
  font-size: 10px;
  font-weight: 700;
  padding: 1px 7px;
  background: var(--success-soft);
  color: var(--success);
  border-radius: 9px;
  letter-spacing: 0.2px;
}
.fp-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}
.fp-body {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.55;
  margin-bottom: 6px;
  padding-left: 40px;
}
.fp-actions {
  display: flex;
  gap: 14px;
  padding-left: 40px;
}
.fp-action-btn {
  background: transparent;
  border: none;
  font: inherit;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  padding: 0;
  transition: color var(--t-fast);
}
.fp-action-btn:hover { color: var(--accent); }

/* Composer */
.fp-composer {
  flex-shrink: 0;
  border-top: 1px solid var(--border-subtle);
  padding: 14px;
  background: var(--bg-subtle);
}
.fp-composer-author {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 10px;
}
.fp-composer-author input {
  flex: 1;
  padding: 6px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-xs);
  font: inherit;
  font-size: 12.5px;
  color: var(--text-primary);
  outline: none;
  transition: all var(--t-fast);
}
.fp-composer-author input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

#fp-text {
  width: 100%;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--r-sm);
  font: inherit;
  font-size: 13px;
  color: var(--text-primary);
  resize: vertical;
  min-height: 64px;
  outline: none;
  transition: all var(--t-fast);
  line-height: 1.5;
}
#fp-text:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
#fp-text::placeholder { color: var(--text-muted); }

.fp-composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
}
.fp-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-muted);
}
.fp-submit {
  padding: 7px 16px;
  background: var(--accent);
  color: var(--accent-fg);
  border: none;
  border-radius: var(--r-xs);
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
}
.fp-submit:hover { background: var(--accent-hover); }

/* Toasts */
#toast-area {
  position: fixed;
  bottom: 20px; left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 300;
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--border-medium);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  animation: toast-in 200ms ease-out;
  pointer-events: auto;
}
.toast.success { border-color: var(--success); }
.toast.success .toast-icon { color: var(--success); }
@keyframes toast-in { from { transform: translateY(6px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

/* Scrollbars */
.fp-list::-webkit-scrollbar,
.mp-lines-body::-webkit-scrollbar { width: 6px; height: 6px; }
.fp-list::-webkit-scrollbar-thumb,
.mp-lines-body::-webkit-scrollbar-thumb {
  background: var(--border-medium);
  border-radius: 3px;
}
.fp-list::-webkit-scrollbar-thumb:hover,
.mp-lines-body::-webkit-scrollbar-thumb:hover {
  background: var(--border-strong);
}
