:root {
  --bg: #F5F2ED;
  --surface: #FDFCFA;
  --surface2: #F0EDE7;
  --border: #E2DDD6;
  --border-strong: #C8C2B8;
  --text: #1A1814;
  --text-2: #6B6560;
  --text-3: #9C9690;
  --accent: #2D5A3D;
  --accent-light: #EBF2ED;
  --accent-mid: #4A8A5E;
  --danger: #8B2E2E;
  --danger-light: #F5EAEA;
  --warn: #7A5C1E;
  --warn-light: #F7F0E2;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.04);
}

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

body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

/* NAV */
nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 32px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 100;
}

.logo {
  font-family: 'Instrument Serif', serif;
  font-size: 22px;
  color: var(--text);
  letter-spacing: -.01em;
}

.logo span { color: var(--accent-mid); font-style: italic; }

.nav-badge {
  font-size: 11px;
  background: var(--accent-light);
  color: var(--accent);
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 500;
  letter-spacing: .02em;
}

/* NAV AUTH */
.btn-nav-login {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  background: var(--text);
  color: var(--surface);
  border: none;
  border-radius: 7px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: opacity .15s;
}
.btn-nav-login:hover { opacity: .85; }
.btn-nav-logout {
  padding: 5px 11px;
  font-size: 12px;
  font-weight: 500;
  background: transparent;
  color: var(--text-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all .15s;
}
.btn-nav-logout:hover { border-color: var(--border-strong); color: var(--text); }
.nav-user {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
}
.nav-user-email {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* HERO */
.hero {
  text-align: center;
  padding: 52px 24px 40px;
  max-width: 620px;
  margin: 0 auto;
}

.hero h1 {
  font-family: 'Instrument Serif', serif;
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.15;
  letter-spacing: -.02em;
  margin-bottom: 14px;
  color: var(--text);
}

.hero h1 em {
  font-style: italic;
  color: var(--accent-mid);
}

.hero p {
  font-size: 15px;
  color: var(--text-2);
  max-width: 440px;
  margin: 0 auto;
  line-height: 1.65;
}

/* MAIN LAYOUT */
.main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* STEP INDICATOR */
.steps {
  display: flex;
  align-items: center;
  gap: 0;
  margin-bottom: 28px;
  justify-content: center;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
}

.step.active { color: var(--text); }
.step.done { color: var(--accent-mid); }

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  flex-shrink: 0;
  transition: all .3s;
}

.step.active .step-num {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
}

.step.done .step-num {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.step-line {
  width: 40px;
  height: 1px;
  background: var(--border);
  margin: 0 6px;
}

/* CARDS */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card-label {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 10px;
}

/* INPUT SECTION */
.input-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.input-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  display: block;
  margin-bottom: 7px;
}

textarea {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  padding: 13px 15px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .2s;
}

textarea::placeholder { color: var(--text-3); }
textarea:focus { border-color: var(--border-strong); background: var(--surface); }

/* INPUT TABS */
.input-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 8px;
  background: var(--surface2);
  border-radius: 8px;
  padding: 3px;
  width: fit-content;
}

.input-tab {
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all .15s;
}

.input-tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* FILE DROP ZONE */
.drop-zone {
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--bg);
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.drop-zone:hover, .drop-zone.drag-over {
  border-color: var(--accent-mid);
  background: var(--accent-light);
}

.drop-zone svg { opacity: .4; transition: opacity .2s; }
.drop-zone:hover svg { opacity: .7; }

.drop-zone p {
  font-size: 13px;
  color: var(--text-2);
  margin: 0;
}

.drop-zone span {
  font-size: 11px;
  color: var(--text-3);
}

.drop-zone .file-chosen {
  font-size: 12px;
  color: var(--accent);
  font-weight: 500;
  background: var(--accent-light);
  padding: 4px 12px;
  border-radius: 20px;
}

input[type=file] { display: none; }

/* URL INPUT */
.url-input-wrap {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  flex-direction: column;
  min-height: 180px;
  justify-content: flex-start;
  padding-top: 4px;
}

.url-field {
  width: 100%;
  padding: 10px 13px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .2s;
}

.url-field:focus { border-color: var(--border-strong); background: var(--surface); }
.url-field::placeholder { color: var(--text-3); }

.fetch-btn {
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 500;
  background: var(--text);
  color: var(--surface);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: opacity .15s;
  white-space: nowrap;
}

.fetch-btn:hover { opacity: .85; }
.fetch-btn:disabled { opacity: .4; cursor: default; }

.url-status {
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 6px;
  width: 100%;
}

.url-status.ok { background: var(--accent-light); color: var(--accent); }
.url-status.err { background: var(--danger-light); color: var(--danger); }
.url-status.loading { background: var(--warn-light); color: var(--warn); }

/* OPTIONS SECTION */
.options-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.option-block { }

.option-block .card-label { margin-bottom: 8px; }

.pill-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  padding: 6px 13px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 12px;
  font-weight: 400;
  color: var(--text-2);
  cursor: pointer;
  transition: all .18s;
  font-family: 'DM Sans', sans-serif;
  line-height: 1;
}

.pill:hover { border-color: var(--border-strong); color: var(--text); }

.pill.active {
  background: var(--text);
  border-color: var(--text);
  color: var(--surface);
}

/* HUMANNESS SLIDER */
.slider-wrap {
  padding: 4px 0;
}

.slider-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--text-3);
  margin-top: 6px;
}

input[type=range] {
  width: 100%;
  -webkit-appearance: none;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  outline: none;
}

input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
  border: 3px solid var(--surface);
  box-shadow: 0 0 0 1.5px var(--border-strong);
  transition: transform .15s;
}

input[type=range]::-webkit-slider-thumb:hover { transform: scale(1.15); }

.slider-value-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.slider-desc {
  font-size: 11px;
  color: var(--text-3);
  font-style: italic;
  transition: opacity .2s;
}

/* CHECKBOXES */
.check-group {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.check-item {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  user-select: none;
}

.check-item input[type=checkbox] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: var(--accent);
  flex-shrink: 0;
}

.check-item span {
  font-size: 12px;
  color: var(--text-2);
}

/* ANALYZE BUTTON */
.analyze-btn {
  width: 100%;
  padding: 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 15px;
  font-weight: 500;
  background: var(--text);
  color: var(--surface);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  transition: opacity .2s, transform .1s;
  letter-spacing: -.01em;
  margin-top: 6px;
}

.analyze-btn:hover { opacity: .88; }
.analyze-btn:active { transform: scale(.99); }
.analyze-btn:disabled { opacity: .35; cursor: default; }

/* LOADING MODAL */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,24,20,.55);
  z-index: 999;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}

.loading-overlay.show { display: flex; animation: fadeIn .2s ease; }

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

.loading-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 40px 48px;
  text-align: center;
  min-width: 320px;
  max-width: 420px;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  animation: slideUp .25s cubic-bezier(.4,0,.2,1);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.loading-logo {
  font-family: 'Instrument Serif', serif;
  font-size: 18px;
  color: var(--text);
  margin-bottom: 24px;
}

.loading-logo span { color: var(--accent-mid); font-style: italic; }

.loading-ring {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-mid);
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 20px;
}

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

.loading-step {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  min-height: 22px;
  margin-bottom: 6px;
}

.loading-sub {
  font-size: 12px;
  color: var(--text-3);
  min-height: 18px;
  margin-bottom: 20px;
}

.loading-track {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
}

.loading-fill {
  height: 100%;
  background: var(--accent-mid);
  border-radius: 2px;
  width: 0%;
  transition: width .9s ease;
}

.loading-steps-list {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.loading-step-item {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-3);
  text-align: left;
  transition: color .3s;
}

.loading-step-item.done { color: var(--accent); }
.loading-step-item.active { color: var(--text); font-weight: 500; }

.step-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
  flex-shrink: 0;
  transition: background .3s;
}

.loading-step-item.done .step-dot { background: var(--accent-mid); }
.loading-step-item.active .step-dot { background: var(--text); }

/* RESULTS */
#results {
  display: none;
  animation: fadeUp .4s ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

.results-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

/* SCORE CARD */
.score-hero {
  text-align: center;
  padding: 20px 0 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.score-ring-wrap {
  position: relative;
  width: 90px;
  height: 90px;
  margin: 0 auto 10px;
}

.score-ring-wrap svg { transform: rotate(-90deg); }

.score-number {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Instrument Serif', serif;
  font-size: 26px;
  color: var(--text);
}

.score-label-text {
  font-size: 12px;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: .03em;
}

.score-bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 9px;
}

.score-bar-label {
  font-size: 11px;
  color: var(--text-2);
  min-width: 108px;
  flex-shrink: 0;
}

.score-bar-track {
  flex: 1;
  height: 5px;
  background: var(--surface2);
  border-radius: 3px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s cubic-bezier(.4,0,.2,1) .3s;
  width: 0%;
}

.score-bar-val {
  font-size: 11px;
  font-weight: 500;
  min-width: 28px;
  text-align: right;
  color: var(--text-2);
}

/* KEYWORDS */
.kw-section { margin-top: 14px; }

.kw-row-label {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 6px;
}

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 20px;
  margin: 2px 2px 2px 0;
  font-weight: 400;
}

.tag-green { background: var(--accent-light); color: var(--accent); }
.tag-red { background: var(--danger-light); color: var(--danger); }
.tag-warn { background: var(--warn-light); color: var(--warn); }

/* CV OUTPUT */
.cv-output-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.cv-output-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
}

.cv-output-header span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: .02em;
}

.hum-badge {
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 20px;
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 500;
  letter-spacing: .02em;
}

.cv-text-area {
  padding: 22px 24px;
  font-family: 'DM Sans', sans-serif;
  font-size: 13.5px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  max-height: 480px;
  overflow-y: auto;
}

.cv-output-footer {
  display: flex;
  gap: 8px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface2);
}

.btn-sm {
  padding: 7px 14px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 8px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  font-family: 'DM Sans', sans-serif;
  transition: all .15s;
}

.btn-sm:hover { background: var(--bg); border-color: var(--border-strong); color: var(--text); }
.btn-sm.primary { background: var(--text); color: var(--surface); border-color: var(--text); }
.btn-sm.primary:hover { opacity: .85; background: var(--text); }

/* CHANGES PANEL */
.changes-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.changes-header {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--surface2);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  letter-spacing: .02em;
}

.change-item {
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

.change-item:last-child { border-bottom: none; }

.change-section-tag {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 4px;
}

.change-reason {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 10px;
  font-style: italic;
  line-height: 1.5;
}

.before-after {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.ba-box {
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.55;
}

.ba-box.before {
  background: var(--danger-light);
  color: var(--danger);
  border: 1px solid #E8C5C5;
}

.ba-box.after {
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid #C5DFC9;
}

.ba-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  opacity: .7;
  margin-bottom: 4px;
}

/* REFINE BAR */
.refine-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  box-shadow: var(--shadow);
}

.refine-bar p {
  font-size: 13px;
  color: var(--text-2);
  flex: 1;
}

.refine-bar p strong { color: var(--text); font-weight: 500; }

/* RESPONSIVE */
@media (max-width: 820px) {
  .input-grid, .results-grid { grid-template-columns: 1fr; }
  .options-row { grid-template-columns: 1fr 1fr; }
  nav { padding: 14px 20px; }
  .main { padding: 0 16px 60px; }
}

@media (max-width: 560px) {
  .options-row { grid-template-columns: 1fr; }
  .before-after { grid-template-columns: 1fr; }
  .steps { display: none; }
}

/* MODE SELECTOR */
.mode-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 16px;
}

.mode-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  cursor: pointer;
  transition: all .2s;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mode-card:hover { border-color: var(--border-strong); }

.mode-card.active {
  border-color: var(--text);
  background: var(--surface);
}

.mode-card .mode-icon {
  font-size: 16px;
  flex-shrink: 0;
  line-height: 1;
}

.mode-card .mode-text { flex: 1; min-width: 0; }

.mode-card .mode-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 1px;
}

.mode-card .mode-desc {
  font-size: 11px;
  color: var(--text-3);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mode-card.active .mode-title { color: var(--text); }

.mode-indicator {
  float: right;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid var(--border-strong);
  margin-top: 2px;
  transition: all .2s;
  flex-shrink: 0;
}

.mode-card.active .mode-indicator {
  background: var(--text);
  border-color: var(--text);
  box-shadow: inset 0 0 0 3px var(--surface);
}

/* MISSING INFO MODAL */
.info-modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,24,20,.55);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(3px);
}

.info-modal-overlay.show { display: flex; animation: fadeIn .2s ease; }

.info-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 36px;
  max-width: 500px;
  width: 90%;
  box-shadow: 0 8px 40px rgba(0,0,0,.18);
  animation: slideUp .25s cubic-bezier(.4,0,.2,1);
}

.info-modal h2 {
  font-family: 'Instrument Serif', serif;
  font-size: 22px;
  margin-bottom: 6px;
  color: var(--text);
}

.info-modal p {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 20px;
  line-height: 1.6;
}

.info-question {
  margin-bottom: 14px;
}

.info-question label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  display: block;
  margin-bottom: 5px;
}

.info-question textarea {
  min-height: 70px;
  font-size: 13px;
}

.info-question .optional-tag {
  font-size: 10px;
  color: var(--text-3);
  font-weight: 400;
  margin-left: 5px;
}

/* QUESTIONS PANEL in results */
.questions-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-top: 14px;
  box-shadow: var(--shadow);
}

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

.questions-header span {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
}

.questions-body { padding: 16px 20px; }

.questions-body textarea {
  min-height: 100px;
  font-size: 13px;
  margin-bottom: 10px;
}

.q-output {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  font-size: 13px;
  line-height: 1.75;
  color: var(--text);
  white-space: pre-wrap;
  display: none;
  margin-top: 10px;
}

/* EXPORT BUTTONS */
.export-row {
  display: flex;
  gap: 8px;
  margin-top: 10px;
}

/* AUTH / GATE MODAL */
.gate-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,24,20,.6);
  z-index: 1001;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.gate-overlay.show { display: flex; animation: fadeIn .2s ease; }

.gate-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 36px 40px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 12px 48px rgba(0,0,0,.2);
  animation: slideUp .25s cubic-bezier(.4,0,.2,1);
  text-align: center;
}

.gate-modal .gate-logo {
  font-family: 'Instrument Serif', serif;
  font-size: 20px;
  margin-bottom: 20px;
}
.gate-modal .gate-logo span { color: var(--accent-mid); font-style: italic; }

.gate-free-badge {
  display: inline-block;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 20px;
  margin-bottom: 14px;
  letter-spacing: .03em;
}

.gate-modal h2 {
  font-family: 'Instrument Serif', serif;
  font-size: 22px;
  margin-bottom: 8px;
}

.gate-modal p {
  font-size: 13px;
  color: var(--text-2);
  margin-bottom: 20px;
  line-height: 1.6;
}

.gate-perks {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 22px;
  text-align: left;
}

.gate-perk {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-2);
}

.gate-perk-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-mid);
  flex-shrink: 0;
}

.gate-submit-btn {
  width: 100%;
  padding: 12px;
  font-size: 14px;
  font-weight: 500;
  background: var(--text);
  color: var(--surface);
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: opacity .15s;
}
.gate-submit-btn:hover { opacity: .88; }

.gate-disclaimer {
  font-size: 10px;
  color: var(--text-3);
  margin-top: 10px;
  line-height: 1.5;
}

/* AUTH MODAL TABS */
.auth-tabs {
  display: flex;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--border);
}
.auth-tab {
  flex: 1;
  padding: 8px;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  color: var(--text-3);
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all .15s;
  margin-bottom: -1px;
}
.auth-tab.active { color: var(--text); border-bottom-color: var(--text); }

.auth-input {
  width: 100%;
  padding: 11px 14px;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  margin-bottom: 10px;
  transition: border-color .2s;
}
.auth-input:focus { border-color: var(--border-strong); background: var(--surface); }
.auth-input.error { border-color: var(--danger); }

.auth-error {
  font-size: 12px;
  color: var(--danger);
  background: var(--danger-light);
  padding: 8px 12px;
  border-radius: 6px;
  margin-bottom: 10px;
  display: none;
}
.auth-error.show { display: block; }
.auth-error.success { color: var(--accent); background: var(--accent-light); }

.btn-google {
  width: 100%;
  padding: 11px;
  font-size: 13px;
  font-weight: 500;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-family: 'DM Sans', sans-serif;
  transition: all .15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
}
.btn-google:hover { border-color: var(--border-strong); background: var(--surface2); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 14px 0;
  color: var(--text-3);
  font-size: 11px;
}
.auth-divider::before, .auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

/* EXISTING LETTER CARD */
.existing-letter-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.existing-loading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.existing-loading-spinner {
  width: 20px;
  height: 20px;
  min-width: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-top: 2px;
}
.existing-loading-steps {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.existing-loading-step {
  font-size: 13px;
  color: var(--text-3);
  transition: color 0.2s;
}
.existing-loading-step.active {
  color: var(--text-1);
  font-weight: 500;
}
.existing-loading-step.done {
  color: var(--text-3);
  text-decoration: line-through;
  opacity: 0.5;
}

.existing-analysis {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.existing-analysis-score {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.existing-score-num {
  font-family: 'Instrument Serif', serif;
  font-size: 36px;
  color: var(--text);
  line-height: 1;
}

.existing-score-num span {
  font-size: 16px;
  color: var(--text-3);
}

.improvement-item {
  margin-bottom: 8px;
  padding: 8px 11px;
  background: var(--warn-light);
  border-radius: 7px;
  border-left: 2px solid var(--warn);
}

.improvement-issue {
  font-size: 11px;
  font-weight: 500;
  color: var(--warn);
  margin-bottom: 3px;
}

.improvement-suggestion {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.5;
}

.strength-item {
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-light);
  padding: 3px 9px;
  border-radius: 20px;
  margin: 0 4px 4px 0;
  display: inline-block;
}

/* USAGE COUNTER */
.usage-counter {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 6px;
}

.usage-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-strong);
}
.usage-dot.used { background: var(--accent-mid); }

/* QUESTION THREAD */
.q-thread { display: flex; flex-direction: column; gap: 16px; }

.q-entry {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.q-entry-header {
  padding: 10px 14px;
  background: var(--surface2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.q-entry-num {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
}

.q-entry-body { padding: 12px 14px; background: var(--bg); }
.q-entry-question {
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 6px;
  font-style: italic;
  white-space: pre-wrap;
}
.q-entry-hint {
  font-size: 11px;
  color: var(--accent);
  background: var(--accent-light);
  padding: 3px 8px;
  border-radius: 4px;
  margin-bottom: 8px;
  display: inline-block;
}
.q-entry-answer {
  font-size: 13px;
  color: var(--text);
  line-height: 1.75;
  white-space: pre-wrap;
}

.add-question-row {
  margin-top: 14px;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
}

.add-question-row textarea {
  min-height: 80px;
  border: none;
  border-radius: 0;
  background: var(--bg);
  font-size: 13px;
  margin: 0;
}

.add-question-row textarea:focus { background: var(--surface); }

.add-q-hint-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: var(--surface2);
  border-top: 1px solid var(--border);
}

.add-q-hint-row .hint-field {
  flex: 1;
  padding: 5px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  outline: none;
}
.add-q-hint-field::placeholder { color: var(--text-3); }
