/* ============================================
   Impact Weaver — Design System
   Colors: Deep Plum #4B2E5A | Soft Cream #FAF7F3 | Muted Gold #C8A951
   ============================================ */

:root {
  --plum:        #4B2E5A;
  --plum-dark:   #3A2047;
  --plum-light:  #6B4580;
  --cream:       #FAF7F3;
  --cream-dark:  #F0E9E0;
  --gold:        #C8A951;
  --gold-dark:   #B09441;
  --text:        #2D1B38;
  --text-muted:  #7A6884;
  --border:      #E2D6EE;
  --white:       #FFFFFF;
  --error:       #9B2335;
  --error-bg:    #FDF0F2;
  --success:     #2D6A4F;
  --success-bg:  #EDF7F2;
  --radius:      10px;
  --shadow:      0 4px 24px rgba(75, 46, 90, 0.10);
}

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

html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

/* ---- Typography ---- */
h1, h2, h3 { line-height: 1.25; font-weight: 700; }
a { color: var(--plum); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Auth Layout ---- */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.auth-card {
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  text-align: center;
  margin-bottom: 32px;
}

.auth-logo .wordmark {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--plum);
  letter-spacing: -0.02em;
}

.auth-logo .tagline {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.auth-card h2 {
  font-size: 1.375rem;
  color: var(--text);
  margin-bottom: 24px;
  text-align: center;
}

/* ---- Form Elements ---- */
.form-group {
  margin-bottom: 20px;
}

label {
  display: block;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 6px;
}

input[type="email"],
input[type="password"],
input[type="text"],
textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  color: var(--text);
  background: var(--cream);
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--plum);
  box-shadow: 0 0 0 3px rgba(75, 46, 90, 0.12);
  background: var(--white);
}

input::placeholder,
textarea::placeholder {
  color: var(--text-muted);
}

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background 0.2s, transform 0.1s, opacity 0.2s;
  text-decoration: none;
}

.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-primary {
  background: var(--plum);
  color: var(--white);
  width: 100%;
}
.btn-primary:hover:not(:disabled) { background: var(--plum-dark); }

.btn-gold {
  background: var(--gold);
  color: var(--plum-dark);
  width: 100%;
}
.btn-gold:hover:not(:disabled) { background: var(--gold-dark); }

.btn-outline {
  background: transparent;
  color: var(--plum);
  border: 1.5px solid var(--plum);
}
.btn-outline:hover:not(:disabled) { background: var(--plum); color: var(--white); }

/* ---- Alerts ---- */
.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 0.9rem;
  margin-bottom: 20px;
  display: none;
}

.alert.show { display: block; }

.alert-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(155, 35, 53, 0.2);
}

.alert-success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(45, 106, 79, 0.2);
}

/* ---- Auth footer links ---- */
.consent-group { margin-top: 4px; margin-bottom: 20px; }

.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.checkbox-label input[type="checkbox"] {
  flex-shrink: 0;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--plum);
  cursor: pointer;
}

.checkbox-label a {
  color: var(--plum);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.auth-links {
  margin-top: 24px;
  text-align: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.auth-links a {
  color: var(--plum);
  font-weight: 500;
}

.auth-links a:hover {
  color: var(--plum-dark);
}

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.divider::before,
.divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* ---- Gold accent bar at top of card ---- */
.auth-card::before {
  content: '';
  display: block;
  height: 3px;
  background: linear-gradient(90deg, var(--plum), var(--gold));
  border-radius: 16px 16px 0 0;
  margin: -48px -40px 40px;
}

/* ---- Spinner ---- */
.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: white;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: none;
}
.btn-gold .spinner {
  border-color: rgba(58, 32, 71, 0.25);
  border-top-color: var(--plum-dark);
}
.btn.loading .spinner { display: inline-block; }
.btn.loading .btn-text { opacity: 0.6; }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- App Shell (Phase 3) ---- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 240px;
  background: var(--plum);
  color: var(--white);
  display: flex;
  flex-direction: column;
  padding: 32px 0;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  overflow: hidden;
}

.sidebar-logo {
  padding: 0 24px 32px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--cream);
  border-bottom: 1px solid rgba(255,255,255,0.12);
  position: relative;
}

.sidebar-nav {
  flex: 1;
  padding: 24px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 500;
  color: rgba(255,255,255,0.75);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255,255,255,0.08);
  color: var(--white);
  border-left-color: var(--gold);
}

.nav-item.active {
  font-weight: 600;
}

.sidebar-footer {
  padding: 16px 24px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.5);
}

.main-content {
  flex: 1;
  background: var(--cream);
  overflow-y: auto;
}

.page-header {
  background: var(--cream);
  height: 64px;
  padding: 0 40px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.page-header h1 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--plum);
  line-height: 1.2;
}

.page-body {
  padding: 40px;
  max-width: 800px;
}

/* ---- Win Card ---- */
.win-card {
  background: var(--white);
  border-radius: 12px;
  padding: 20px 24px;
  border-left: 4px solid var(--gold);
  box-shadow: 0 2px 8px rgba(75,46,90,0.06);
  margin-bottom: 16px;
}

.win-card .impact-bullet {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.6;
  margin-bottom: 8px;
}

.win-card .win-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
}

.win-card .delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0;
  margin-left: auto;
}
.win-card .delete-btn:hover { color: var(--error); }

/* ---- Brag Bank input area ---- */
.brag-input-area {
  background: var(--white);
  border-radius: 16px;
  padding: 32px;
  box-shadow: var(--shadow);
  margin-bottom: 32px;
}

.brag-input-area h2 {
  font-size: 1.125rem;
  color: var(--plum);
  margin-bottom: 8px;
}

.brag-input-area .subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.voice-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.btn-voice {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 18px;
  background: var(--cream);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}

.btn-voice:hover { border-color: var(--plum); color: var(--plum); }
.btn-voice.recording {
  border-color: var(--error);
  color: var(--error);
  background: var(--error-bg);
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.voice-status {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ---- AI result panel ---- */
.ai-result {
  background: linear-gradient(135deg, #f5eeff 0%, var(--cream) 100%);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-top: 24px;
  display: none;
}

.ai-result.show { display: block; }

.ai-result .result-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--plum-light);
  margin-bottom: 10px;
}

.ai-result .bullet-text {
  font-size: 1rem;
  color: var(--text);
  line-height: 1.65;
  margin-bottom: 20px;
}

.ai-result-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn-save {
  background: var(--gold);
  color: var(--plum-dark);
  padding: 10px 22px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9375rem;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
}
.btn-save:hover { background: var(--gold-dark); }

.btn-refine {
  background: transparent;
  color: var(--text-muted);
  padding: 10px 22px;
  border-radius: var(--radius);
  font-weight: 500;
  font-size: 0.875rem;
  border: 1.5px solid var(--border);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.btn-refine:hover { border-color: var(--plum); color: var(--plum); }

/* ---- Refinement feedback panel ---- */
.refine-panel {
  margin-top: 16px;
  display: none;
}

.refine-panel.show { display: block; }

.refine-panel textarea {
  resize: vertical;
  min-height: 80px;
}

.refine-panel .refine-hint {
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

/* ============================================
   Phase 3 — Brag Bank & Vault
   ============================================ */

/* ---- Sidebar user footer ---- */
.sidebar-user {
  font-size: 0.8125rem;
  color: rgba(255,255,255,0.6);
  margin-bottom: 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-logout {
  background: none;
  border: 1px solid rgba(255,255,255,0.2);
  color: rgba(255,255,255,0.6);
  border-radius: 6px;
  padding: 6px 12px;
  font-size: 0.8125rem;
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  transition: all 0.2s;
}
.sidebar-logout:hover { background: rgba(255,255,255,0.08); color: var(--white); }

/* ---- Mobile menu toggle ---- */
.mobile-menu-btn {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--plum);
}

/* ---- Form field with mic button ---- */
.field-with-mic {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.field-with-mic input,
.field-with-mic textarea {
  flex: 1;
  min-width: 0;
}

.mic-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  background: var(--cream);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  color: var(--gold);
  padding: 0;
}
.mic-btn:hover { border-color: var(--gold); background: #fff8ea; }
.mic-btn.recording {
  background: #fff8ea;
  border-color: var(--gold);
  color: var(--gold-dark);
  animation: micPulseGold 1.2s ease-in-out infinite;
}

@keyframes micPulseGold {
  0%, 100% { box-shadow: 0 0 0 0 rgba(200, 169, 81, 0.4); }
  50%       { box-shadow: 0 0 0 6px rgba(200, 169, 81, 0); }
}

.mic-status-text {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 5px;
  min-height: 1.1em;
  transition: color 0.2s;
}
.mic-status-text.listening { color: var(--gold-dark); font-weight: 500; }
.mic-status-text.got-it    { color: var(--success);   font-weight: 500; }
.mic-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* Align mic button with textarea: match padding so icon lines up with first line of text */
.field-with-mic textarea ~ .mic-btn,
.field-with-mic .mic-btn.for-textarea { margin-top: 2px; }

/* ---- Two-column form grid ---- */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
}

.form-grid .form-group { margin-bottom: 20px; }
.form-group-full { grid-column: 1 / -1; }

/* ---- Generate button area ---- */
.generate-row {
  margin-top: 8px;
  display: flex;
  gap: 12px;
  align-items: center;
}

.btn-generate {
  background: var(--plum);
  color: var(--white);
  padding: 13px 32px;
  border-radius: var(--radius);
  font-size: 1rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, transform 0.1s;
  display: flex;
  align-items: center;
  gap: 10px;
}
.btn-generate:hover:not(:disabled) { background: var(--plum-dark); }
.btn-generate:active:not(:disabled) { transform: scale(0.98); }
.btn-generate:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-clear-form {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  font-family: inherit;
  padding: 4px 8px;
  border-radius: 6px;
  transition: color 0.2s;
}
.btn-clear-form:hover { color: var(--text); }

/* ---- AI loading state ---- */
.ai-loading-area {
  text-align: center;
  padding: 40px 20px;
  display: none;
}
.ai-loading-area.show { display: block; }

.loading-dots {
  display: inline-flex;
  gap: 7px;
  margin-bottom: 16px;
}
.loading-dots span {
  width: 10px;
  height: 10px;
  background: var(--plum-light);
  border-radius: 50%;
  animation: dotBounce 1.2s ease-in-out infinite;
}
.loading-dots span:nth-child(2) { animation-delay: 0.2s; }
.loading-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes dotBounce {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40%           { transform: scale(1);   opacity: 1; }
}

.ai-loading-area p {
  color: var(--text-muted);
  font-size: 0.9375rem;
}

/* ---- Bullet result section ---- */
.ai-bullets-section {
  margin-top: 32px;
  display: none;
}
.ai-bullets-section.show { display: block; }

.bullets-heading {
  font-size: 0.8125rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--plum-light);
  margin-bottom: 16px;
}

/* ---- Individual bullet card ---- */
.bullet-card {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 20px 22px;
  margin-bottom: 12px;
  transition: border-color 0.2s;
}
.bullet-card:hover { border-color: var(--gold); }
.bullet-card.saved { border-color: var(--success); }

.bullet-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.style-badge {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 3px 9px;
  border-radius: 20px;
  flex-shrink: 0;
}
.style-badge.concise    { background: #EEE4F7; color: var(--plum); }
.style-badge.balanced   { background: #FFF4DC; color: #8B6914; }
.style-badge.leadership { background: #E6F4EE; color: #2D6A4F; }

.bullet-card-text {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.65;
  margin-bottom: 14px;
}

.btn-save-bullet {
  background: var(--gold);
  color: var(--plum-dark);
  border: none;
  border-radius: 8px;
  padding: 8px 20px;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-save-bullet:hover:not(:disabled) { background: var(--gold-dark); }
.btn-save-bullet:disabled {
  background: var(--success-bg);
  color: var(--success);
  cursor: default;
}

/* ---- Soft action row (after bullets) ---- */
.soft-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
  margin-bottom: 4px;
}

.btn-soft {
  background: none;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
  transition: all 0.18s;
}
.btn-soft:hover { border-color: var(--plum-light); color: var(--plum); }
.btn-soft.active { border-color: var(--plum); color: var(--plum); background: #f5eeff; }

/* ---- Refinement panel ---- */
.refinement-panel {
  background: var(--cream);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-top: 16px;
  display: none;
}
.refinement-panel.show { display: block; }

.refine-question {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 12px;
}

.chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 20px;
}

.chip {
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 7px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s;
  user-select: none;
}
.chip:hover { border-color: var(--plum-light); color: var(--plum); }
.chip.selected {
  background: var(--plum);
  border-color: var(--plum);
  color: var(--white);
}

.refine-label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 8px;
  display: block;
}

.btn-regenerate {
  background: var(--plum);
  color: var(--white);
  border: none;
  border-radius: var(--radius);
  padding: 11px 28px;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin-top: 16px;
  transition: background 0.2s;
  display: flex;
  align-items: center;
  gap: 8px;
}
.btn-regenerate:hover:not(:disabled) { background: var(--plum-dark); }
.btn-regenerate:disabled { opacity: 0.6; cursor: not-allowed; }

/* ---- Toast notification ---- */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--plum-dark);
  color: var(--white);
  padding: 13px 24px;
  border-radius: 12px;
  font-size: 0.9375rem;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  z-index: 1000;
  white-space: nowrap;
  border-left: 4px solid var(--gold);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ---- Vault filters ---- */
.vault-filters {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  padding: 20px 40px;
  background: var(--white);
  border-bottom: 1px solid var(--border);
}

.filter-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.tag-filter-pill {
  background: var(--cream);
  border: 1.5px solid var(--border);
  border-radius: 20px;
  padding: 5px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s;
}
.tag-filter-pill:hover { border-color: var(--plum-light); color: var(--plum); }
.tag-filter-pill.active {
  background: var(--plum);
  border-color: var(--plum);
  color: var(--white);
}

.date-filter-select {
  padding: 6px 12px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.8125rem;
  color: var(--text);
  background: var(--cream);
  font-family: inherit;
  cursor: pointer;
  outline: none;
}
.date-filter-select:focus { border-color: var(--plum); }

/* ---- Vault win card ---- */
.vault-win-card {
  background: var(--white);
  border-radius: 12px;
  padding: 20px 24px;
  border-left: 4px solid var(--gold);
  box-shadow: 0 2px 8px rgba(75,46,90,0.05);
  margin-bottom: 14px;
  transition: box-shadow 0.2s;
}
.vault-win-card:hover { box-shadow: 0 4px 16px rgba(75,46,90,0.1); }

.vault-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.vault-card-title {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.vault-card-bullet {
  font-size: 0.9375rem;
  color: var(--text);
  line-height: 1.65;
  margin-bottom: 12px;
}

.vault-card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tag-pill {
  background: #EEE4F7;
  color: var(--plum);
  border-radius: 12px;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 500;
}

.meta-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.vault-delete-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  transition: color 0.2s, background 0.2s;
  flex-shrink: 0;
}
.vault-delete-btn:hover { color: var(--error); background: var(--error-bg); }

/* ---- Vault card action buttons ---- */
.vault-card-actions {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.vault-actions-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-bottom: 10px;
}
.vault-actions-btns {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.vault-action-btn {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  font-family: inherit;
}
.vault-action-btn:hover {
  background: var(--cream-dark);
  color: var(--text);
  border-color: var(--plum);
}
.vault-edit-btn:hover { border-color: var(--gold); color: var(--plum); }
body.dark-mode .vault-action-btn {
  border-color: var(--border);
  color: var(--text-muted);
}
body.dark-mode .vault-action-btn:hover {
  background: var(--cream-dark);
  color: var(--text);
}

/* ---- Empty state ---- */
.empty-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-muted);
}
.empty-state .empty-icon {
  font-size: 2.5rem;
  margin-bottom: 16px;
  opacity: 0.5;
}
.empty-state h3 {
  font-size: 1.125rem;
  color: var(--text);
  margin-bottom: 8px;
}
.empty-state p {
  font-size: 0.9rem;
  max-width: 300px;
  margin: 0 auto 20px;
}

/* ---- Vault count badge ---- */
.vault-count {
  background: var(--gold);
  color: var(--plum-dark);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: 8px;
}

/* ---- Error state in app ---- */
.app-error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(155,35,53,0.2);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 0.9rem;
  margin-bottom: 20px;
  display: none;
}
.app-error.show { display: block; }

/* ---- Progressive disclosure toggle ---- */
.more-detail-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: none;
  color: var(--plum-light);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
  margin: 4px 0 20px;
  font-family: inherit;
  transition: color 0.15s;
}
.more-detail-toggle:hover { color: var(--plum); }
.more-detail-toggle .toggle-arrow {
  font-size: 0.7rem;
  transition: transform 0.2s;
  display: inline-block;
}
.more-detail-toggle.open .toggle-arrow { transform: rotate(90deg); }

.more-detail-fields {
  display: none;
}
.more-detail-fields.open {
  display: contents; /* renders children into the grid */
}

/* ---- Vault search ---- */
.vault-search-wrap {
  position: relative;
  flex: 1;
  min-width: 180px;
  max-width: 320px;
}
.vault-search-wrap svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}
.vault-search {
  width: 100%;
  padding: 7px 12px 7px 32px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 0.875rem;
  color: var(--text);
  background: var(--cream);
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}
/* Fix: higher specificity to override global input[type="text"] padding */
.vault-search-wrap .vault-search { padding: 7px 12px 7px 36px; }
.vault-search:focus { border-color: var(--plum); background: var(--white); }
.vault-search::placeholder { color: var(--text-muted); }

/* ---- Sidebar wordmark + tagline (app.html) ---- */
.sidebar-wordmark {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.word-impact { color: var(--cream); }
.word-weaver { color: var(--gold); }
.sidebar-tagline {
  font-size: 0.68rem;
  color: rgba(250,247,243,0.45);
  margin-top: 4px;
  letter-spacing: 0.02em;
}

/* ---- Sidebar nav item as <a> link ---- */
.sidebar-nav a.nav-item { text-decoration: none; font-family: inherit; }

/* ---- Override nav-item active to use gold background ---- */
.nav-item.active,
.nav-item:hover {
  background: rgba(200, 169, 81, 0.15) !important;
  color: var(--gold) !important;
  border-left-color: var(--gold);
}
.nav-item.active {
  font-weight: 600;
}

/* ---- Sidebar upgrade button ---- */
.sidebar-upgrade { padding: 0 12px 16px; }
.sidebar-upgrade-btn {
  display: block;
  text-align: center;
  background: rgba(200, 169, 81, 0.12);
  border: 1px solid rgba(200, 169, 81, 0.35);
  color: var(--gold);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 0.8125rem;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  transition: background 0.2s;
  cursor: pointer;
}
.sidebar-upgrade-btn:hover { background: rgba(200, 169, 81, 0.22); text-decoration: none; }

/* ---- Password show/hide toggle ---- */
.pw-field-wrap { position: relative; }
.pw-field-wrap input { padding-right: 44px !important; }
.pw-toggle-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.pw-toggle-btn:hover { color: var(--plum); }

/* ---- Password match indicator ---- */
.pw-match-msg {
  font-size: 0.8rem;
  margin-top: 5px;
  min-height: 1.1em;
  display: none;
}
.pw-match-msg.show { display: block; }
.pw-match-msg.match { color: var(--success); }
.pw-match-msg.no-match { color: var(--error); }

/* ---- Tag suggestion notice ---- */
.tag-suggestion-notice {
  font-size: 0.78rem;
  color: var(--gold-dark);
  margin-top: 5px;
  display: none;
}

/* ---- Add another win row ---- */
.add-another-row {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  text-align: center;
}
.btn-add-another {
  background: none;
  border: 1.5px dashed var(--gold);
  color: var(--gold-dark);
  border-radius: var(--radius);
  padding: 10px 28px;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.2s, border-color 0.2s;
}
.btn-add-another:hover { background: rgba(200,169,81,0.08); border-color: var(--gold-dark); }

/* ============================================
   Collapsible Sidebar
   ============================================ */

/* Sidebar transition */
.sidebar { transition: width 0.22s ease; }

/* Collapsed state */
.sidebar--collapsed { width: 60px !important; }
.sidebar--collapsed .sidebar-wordmark,
.sidebar--collapsed .sidebar-tagline { display: none !important; }
.sidebar--collapsed .sidebar-monogram { display: block !important; }
.sidebar--collapsed .nav-label { display: none; }
.sidebar--collapsed .nav-item { justify-content: center; padding: 12px 0; gap: 0; border-left: none; }
.sidebar--collapsed .nav-item:hover,
.sidebar--collapsed .nav-item.active { border-left: none; }
.sidebar--collapsed .sidebar-upgrade { display: none !important; }
.sidebar--collapsed .sidebar-user { display: none; }
.sidebar--collapsed .logout-label,
.sidebar--collapsed .feedback-label { display: none; }
.sidebar--collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
.sidebar--collapsed .sidebar-footer { padding: 16px 8px; }
.sidebar--collapsed .sidebar-logout { padding: 8px; justify-content: center; border: none; }
.sidebar--collapsed .feedback-link { padding: 8px; justify-content: center; }

/* IW monogram shown when collapsed */
.sidebar-monogram {
  display: none;
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: -0.02em;
  padding: 4px 0;
  text-align: center;
}

/* Collapse toggle button */
.sidebar-collapse-btn {
  position: absolute;
  top: 4px;
  right: 16px;
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,0.4);
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s;
}
.sidebar-collapse-btn:hover { color: var(--gold); }

/* Feedback link in sidebar footer */
.feedback-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.4);
  text-decoration: none;
  cursor: pointer;
  background: none;
  border: none;
  width: 100%;
  font-family: inherit;
  transition: color 0.15s;
}
.feedback-link:hover { color: rgba(255,255,255,0.75); }

/* ============================================
   Feedback Modal (shared)
   ============================================ */
.feedback-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  z-index: 600;
  align-items: center;
  justify-content: center;
}
.feedback-modal-overlay.show { display: flex; }
.feedback-modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 16px 48px rgba(75,46,90,0.18);
}
.feedback-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}
.feedback-modal-header h3 {
  font-size: 1.05rem;
  color: var(--plum);
  font-family: 'Cormorant Garamond', serif;
  font-weight: 600;
}
.feedback-modal-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.375rem;
  color: #aaa;
  line-height: 1;
  padding: 0 4px;
  transition: color 0.15s;
}
.feedback-modal-close:hover { color: var(--plum); }
.feedback-field-label {
  display: block;
  font-size: 0.8125rem;
  color: #6B6B6B;
  margin-bottom: 6px;
}
.feedback-select,
.feedback-textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #E2D6EE;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9375rem;
  background: #fff;
  color: #2E2E2E;
  outline: none;
  transition: border-color 0.15s;
}
.feedback-select:focus,
.feedback-textarea:focus { border-color: var(--plum); }
.feedback-textarea { resize: vertical; min-height: 100px; }
.feedback-submit {
  width: 100%;
  padding: 12px;
  background: var(--plum);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
  margin-top: 20px;
}
.feedback-submit:hover { background: var(--plum-dark); }
.feedback-submit:disabled { opacity: 0.65; cursor: not-allowed; }
.feedback-success-msg {
  text-align: center;
  color: var(--plum);
  font-size: 0.9375rem;
  padding: 12px 0;
  display: none;
}

/* ---- Responsive ---- */
@media (max-width: 700px) {
  .auth-card {
    padding: 36px 24px;
  }

  .auth-card::before {
    margin: -36px -24px 32px;
  }

  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    padding: 16px 0;
  }

  .page-body {
    padding: 24px 16px;
  }

  .page-header {
    padding: 16px 20px;
  }

  .mobile-menu-btn { display: flex; }

  .sidebar {
    position: fixed;
    top: 0; left: 0;
    height: 100%;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    width: 240px;
    padding: 32px 0;
  }
  .sidebar.open { transform: translateX(0); }

  .app-layout { display: block; }

  .main-content { min-height: 100vh; }

  .form-grid { grid-template-columns: 1fr; }
  .form-group-full { grid-column: 1; }

  .vault-filters { padding: 16px 20px; }

  .soft-actions { gap: 6px; }
  .btn-soft { font-size: 0.75rem; padding: 7px 12px; }

  .mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 199;
  }
  .mobile-overlay.show { display: block; }
}

/* ---- Mobile menu overlay — hidden globally, shown only when .open on mobile ---- */
.mobile-menu-overlay {
  display: none;
}

/* =====================
   DARK MODE
   ===================== */
body.dark-mode {
  --cream:      #18112a;
  --cream-dark: #211640;
  --white:      #1e1530;
  --text:       #F0EDE8;
  --text-muted: #C8C0D8;
  --border:     #3a2a52;
}

/* Headings */
body.dark-mode h1,
body.dark-mode h2,
body.dark-mode h3 {
  color: #FFFFFF;
}
body.dark-mode h4,
body.dark-mode .section-label,
body.dark-mode label,
body.dark-mode .form-label,
body.dark-mode .metric-subtitle,
body.dark-mode .stat-label,
body.dark-mode .card-label {
  color: #E8E4F0;
}
body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
  color: #C8C0D8;
}

/* Sidebar nav text */
body.dark-mode .nav-label {
  color: #E8E4F0;
}
body.dark-mode .nav-item.active .nav-label {
  color: #FFFFFF;
}

/* Button text — prevent --white variable from going dark in dark mode */
body.dark-mode .btn-primary,
body.dark-mode .btn-generate,
body.dark-mode .btn-regenerate {
  color: #FFFFFF;
}

/* Cards and surfaces */
body.dark-mode .stat-card,
body.dark-mode .action-card,
body.dark-mode .account-card,
body.dark-mode .settings-card,
body.dark-mode .account-section,
body.dark-mode .win-card,
body.dark-mode .bullet-card,
body.dark-mode .brag-input-area,
body.dark-mode .refinement-panel,
body.dark-mode .vault-filters,
body.dark-mode .ai-bullets-section,
body.dark-mode .paywall-card,
body.dark-mode .metric-card,
body.dark-mode .guide-example-card,
body.dark-mode .guide-locked-card {
  background: var(--white);
  border-color: var(--border);
}

/* Form inputs */
body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select {
  background: #231840;
  border-color: var(--border);
  color: #FFFFFF;
}
body.dark-mode input::placeholder,
body.dark-mode textarea::placeholder {
  color: #C8C0D8;
}
body.dark-mode input:focus,
body.dark-mode textarea:focus,
body.dark-mode select:focus {
  border-color: var(--gold);
}

/* Main content backgrounds */
body.dark-mode .main-content,
body.dark-mode main,
body.dark-mode .content-area,
body.dark-mode .content,
body.dark-mode body {
  background: var(--cream);
  color: var(--text);
}

/* Topbar */
body.dark-mode .topbar {
  background: var(--white);
  border-color: var(--border);
}

/* Page header */
body.dark-mode .page-header {
  background: var(--white);
  border-color: var(--border);
}

/* Mic button */
body.dark-mode .mic-btn {
  background: var(--cream-dark);
  border-color: var(--border);
}

/* More details toggle */
body.dark-mode .more-detail-toggle {
  color: var(--gold);
  background: none;
}

/* Bullet cards */
body.dark-mode .bullet-card:hover {
  border-color: var(--gold);
}

/* Win cards */
body.dark-mode .win-meta,
body.dark-mode .win-tags .tag {
  background: var(--cream-dark);
  color: var(--text-muted);
}

/* Footer */
body.dark-mode footer {
  border-color: var(--border);
  background: var(--cream);
}

/* Mobile header */
body.dark-mode #mobileHeader {
  background: var(--white) !important;
  border-color: var(--border) !important;
}
body.dark-mode #mobileHeader span {
  color: #FFFFFF;
}

/* Auth pages */
body.dark-mode .auth-card {
  background: var(--white);
  border-color: var(--border);
}

/* Clear/soft buttons */
body.dark-mode .btn-soft {
  background: var(--cream-dark);
  border-color: var(--border);
  color: var(--text-muted);
}
body.dark-mode .btn-soft:hover {
  background: var(--border);
  color: var(--text);
}

/* Vault search */
body.dark-mode .vault-search-wrap {
  background: var(--white);
  border-color: var(--border);
}

/* FAQ */
body.dark-mode .faq-item {
  border-color: var(--border);
  background: var(--white);
}
body.dark-mode .faq-question {
  color: var(--text);
}
body.dark-mode .faq-answer {
  color: var(--text-muted);
}

/* Card text + vault text */
body.dark-mode .vault-card-title,
body.dark-mode .vault-card-bullet,
body.dark-mode .field-value,
body.dark-mode .toggle-label,
body.dark-mode .action-title,
body.dark-mode p,
body.dark-mode li,
body.dark-mode span {
  color: var(--text);
}

/* Muted/helper text */
body.dark-mode .vault-card-meta,
body.dark-mode .meta-date,
body.dark-mode .tag-pill,
body.dark-mode .field-label,
body.dark-mode .toggle-sub,
body.dark-mode .form-hint,
body.dark-mode .subtitle,
body.dark-mode .guide-intro p,
body.dark-mode .metric-subtitle,
body.dark-mode .stat-detail {
  color: var(--text-muted);
}

/* Section labels — keep gold color */
body.dark-mode .section-title,
body.dark-mode .section-label {
  color: var(--gold);
}

/* Page header */
body.dark-mode .page-header {
  background: #211640;
  border-color: var(--border);
}
body.dark-mode .page-header h1 {
  color: #FFFFFF;
}
body.dark-mode .page-header span {
  color: var(--text-muted);
}

/* Action links — non-nav anchor tags */
body.dark-mode a:not(.nav-item):not(.nav-link):not(.sidebar-link):not(.btn-gold):not(.btn-primary) {
  color: #C8A951;
}
body.dark-mode a:not(.nav-item):not(.nav-link):not(.sidebar-link):not(.btn-gold):not(.btn-primary):hover {
  color: #FFFFFF;
}

/* Ghost / outline buttons */
body.dark-mode .btn-outline,
body.dark-mode .btn-ghost {
  color: #FFFFFF;
  border-color: #6B5F8C;
  background: transparent;
}
body.dark-mode .btn-outline:hover,
body.dark-mode .btn-ghost:hover {
  background: rgba(255,255,255,0.08);
  color: #FFFFFF;
}

/* =====================
   MOBILE RESPONSIVE
   ===================== */

/* Tablet */
@media (max-width: 1024px) {
  .pricing-grid { grid-template-columns: 1fr 1fr; }
  .built-for-grid { grid-template-columns: 1fr 1fr; }
  .how-it-works-grid { grid-template-columns: 1fr 1fr; }
}

/* Mobile */
@media (max-width: 768px) {
  /* Hide desktop sidebar */
  #sidebar, .sidebar { display: none !important; }

  /* Main content full width */
  .main-content, main, .content-area { margin-left: 0 !important; width: 100% !important; }

  /* Bottom navigation bar */
  .mobile-bottom-nav {
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: #2d1250;
    border-top: 1px solid rgba(255,255,255,0.1);
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    padding-bottom: env(safe-area-inset-bottom);
  }

  .mobile-bottom-nav a {
    display: flex;
    flex-direction: column;
    align-items: center;
    color: rgba(255,255,255,0.6);
    text-decoration: none;
    font-size: 10px;
    gap: 3px;
  }

  .mobile-bottom-nav a.active,
  .mobile-bottom-nav a:hover { color: #c9a84c; }

  .mobile-bottom-nav svg { width: 22px; height: 22px; }

  /* Add padding to main content so bottom nav doesn't overlap */
  body { padding-bottom: 70px; }

  /* Hamburger menu */
  .mobile-menu-btn {
    display: flex !important;
    position: fixed;
    top: 12px;
    left: 12px;
    width: 40px;
    height: 40px;
    background: #2d1250;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    z-index: 1001;
  }

  .mobile-menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: #1a0a30;
    z-index: 1002;
    flex-direction: column;
    padding: 60px 32px 32px;
  }

  .mobile-menu-overlay.open { display: flex !important; }

  .mobile-menu-overlay a {
    color: #fff;
    text-decoration: none;
    font-size: 20px;
    padding: 14px 0;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .mobile-menu-close {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    color: #fff;
    font-size: 28px;
    cursor: pointer;
  }

  /* Landing page */
  .hero-headline { font-size: 2rem; }
  .hero-content { padding: 40px 20px; }
  .before-after-grid, .how-it-works-grid, .pricing-grid, .built-for-grid { grid-template-columns: 1fr; }
  .landing-nav .nav-signin { display: none; }

  /* Forms */
  input, textarea, select {
    width: 100% !important;
    box-sizing: border-box;
    font-size: 16px !important;
  }

  button, .btn { width: 100%; box-sizing: border-box; }

  /* Dashboard cards */
  .stats-grid, .action-cards-grid, .quick-actions { grid-template-columns: 1fr; }

  /* Vault */
  .search-bar, .filters { width: 100%; }

  /* Account */
  .account-section, .settings-card { width: 100%; box-sizing: border-box; }

  /* No horizontal scroll */
  html, body { overflow-x: hidden; max-width: 100vw; }
}
