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

/* ── Design tokens — Mendeley theme (#007398 teal) ───────────────────────────── */
:root {
  /* Core surface */
  --bg:              hsl(0 0% 97%);
  --surface:         hsl(0 0% 100%);
  --surface-subtle:  hsl(0 0% 98%);
  --border:          hsl(0 0% 89%);
  --text:            hsl(0 0% 20%);
  --text-muted:      hsl(0 0% 45%);

  /* Primary — Mendeley teal (#007398) */
  --accent:          hsl(193 100% 30%);
  --accent-dark:     hsl(193 100% 23%);
  --accent-subtle:   hsl(193 60% 95%);
  --accent-light:    hsl(193 60% 85%);
  --accent-medium:   hsl(193 70% 45%);
  --accent-border:   hsl(193 60% 72%);

  /* Semantic */
  --amber:           hsl(43 74% 50%);
  --amber-bg:        hsl(43 74% 96%);
  --amber-border:    hsl(43 74% 82%);
  --green:           hsl(160 60% 35%);
  --green-bg:        hsl(160 60% 96%);
  --green-border:    hsl(160 60% 72%);
  --red:             hsl(0 84% 60%);
  --red-bg:          hsl(0 84% 97%);
  --red-border:      hsl(0 84% 85%);

  /* Misc */
  --radius:          0.5rem;
  --shadow:          0 1px 3px rgba(0,0,0,.07), 0 1px 2px rgba(0,0,0,.04);
}

/* ── Dark mode ───────────────────────────────────────────────────────────────── */
.dark {
  --bg:              hsl(193 20% 8%);
  --surface:         hsl(193 16% 11%);
  --surface-subtle:  hsl(193 14% 13%);
  --border:          hsl(193 12% 20%);
  --text:            hsl(0 0% 95%);
  --text-muted:      hsl(193 8% 55%);

  --accent:          hsl(193 80% 45%);
  --accent-dark:     hsl(193 80% 35%);
  --accent-subtle:   hsl(193 60% 10%);
  --accent-light:    hsl(193 50% 22%);
  --accent-medium:   hsl(193 65% 40%);
  --accent-border:   hsl(193 50% 32%);

  --amber:           hsl(43 90% 65%);
  --amber-bg:        hsl(43 80% 10%);
  --amber-border:    hsl(43 80% 24%);
  --green:           hsl(160 55% 50%);
  --green-bg:        hsl(160 55% 8%);
  --green-border:    hsl(160 55% 28%);
  --red:             hsl(0 72% 65%);
  --red-bg:          hsl(0 72% 10%);
  --red-border:      hsl(0 72% 28%);

  --shadow:          0 1px 4px rgba(0,0,0,.4), 0 1px 2px rgba(0,0,0,.3);
}

html {
  overflow-x: hidden;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  overflow-x: hidden;
  max-width: 100%;
}

/* ── Page layout ─────────────────────────────────────────────────────────────── */
.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────────── */
.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 24px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.logo { display: flex; align-items: center; gap: 8px; }
.logo-icon { font-size: 1.5rem; }
.logo-text  { font-size: 1.2rem; font-weight: 700; }
.tagline    { font-size: .75rem; color: var(--text-muted); line-height: 1.5; }

hr { border: none; border-top: 1px solid var(--border); }

.field-label {
  display: block;
  font-size: .72rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); margin-bottom: 4px;
}

select {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); font-size: .88rem; color: var(--text);
  cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center;
}

.status-badge {
  display: flex; align-items: center; gap: 7px;
  font-size: .78rem; padding: 6px 10px;
  border-radius: 8px; font-weight: 500;
}
.status-badge.checking { background: var(--accent-subtle); color: var(--accent); }
.status-badge.ok       { background: var(--green-bg); color: var(--green); }
.status-badge.error    { background: var(--red-bg);   color: var(--red); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex-shrink: 0; }
.status-badge.checking .dot { animation: blink 1.2s infinite; }

.hint-box {
  background: var(--surface-subtle); border: 1px solid var(--border);
  border-radius: 8px; padding: 10px 12px;
  font-size: .78rem; color: var(--text-muted); line-height: 1.5;
}

.btn-clear {
  background: none; border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 14px;
  font-size: .84rem; color: var(--text-muted);
  cursor: pointer; width: 100%; margin-top: auto;
}
.btn-clear:hover { background: var(--bg); color: var(--text); }

.theme-toggle {
  background: none; border: none;
  padding: 4px; cursor: pointer;
  color: var(--text); font-size: 1.4rem;
  display: flex; align-items: center;
}
.theme-toggle:hover { opacity: .75; }

/* ── Main area ───────────────────────────────────────────────────────────────── */
.main {
  padding: 28px 28px 48px;
  display: flex; flex-direction: column; gap: 18px;
  overflow-y: auto;
}

.input-section { display: flex; flex-direction: column; gap: 16px; }

.section-title {
  font-size: 1rem; font-weight: 700; color: var(--text);
  display: flex; align-items: center; gap: 10px;
}
.section-badge {
  font-size: .7rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: .04em; padding: 2px 8px;
  background: var(--green-bg); color: var(--green);
  border-radius: 20px; border: 1px solid var(--green-border);
}

/* ── Citation Generator Form ─────────────────────────────────────────────────── */
.cite-form {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 14px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  align-items: end;
}

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group.span-2 { grid-column: span 2; }
.form-group.span-3 { grid-column: span 3; }

.form-group label {
  font-size: .78rem; font-weight: 600; color: var(--text-muted);
}
.form-group label small { font-weight: 400; }
.req { color: var(--red); }

.form-group input,
.form-group select,
.form-group textarea {
  padding: 8px 10px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); font-size: .88rem;
  color: var(--text); font-family: inherit;
  outline: none; transition: border-color .15s;
  width: 100%;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--accent); }
.form-group textarea { resize: vertical; }

/* Citation output */
.cite-output {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
}
.cite-output-label {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted);
}
.citation-block {
  background: var(--surface-subtle);
  border-left: 3px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 12px 16px;
  font-family: "Georgia", serif;
  font-size: .93rem; line-height: 1.7;
  word-break: break-word;
}
.copy-btn-standalone {
  align-self: flex-start;
  background: var(--accent); color: hsl(0 0% 100%);
  border: none; border-radius: 7px;
  padding: 5px 14px; font-size: .8rem;
  cursor: pointer; transition: background .15s;
}
.copy-btn-standalone:hover { background: var(--accent-dark); }

.cite-btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

.cite-output-sublabel {
  font-size: .67rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted); margin-top: 6px;
}

#cite-intext-wrap { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }

.citation-block-intext {
  background: var(--accent-subtle);
  border-left-color: var(--accent-medium);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: .88rem;
}

.cite-warnings {
  font-size: .78rem; color: var(--amber);
  background: var(--amber-bg); border: 1px solid var(--amber-border);
  border-radius: 6px; padding: 6px 10px;
}

/* ── Citation Generator card ─────────────────────────────────────────────────── */
.cite-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 6px solid var(--accent);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 20px;
}

/* Pill pickers */
.picker-label {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted); margin-bottom: 8px;
}

.style-pills, .type-pills {
  display: flex; flex-wrap: wrap; gap: 6px;
}

.style-pill, .type-pill {
  padding: 7px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text);
  font-size: .84rem; font-weight: 500;
  cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.style-pill:hover, .type-pill:hover {
  background: var(--secondary, var(--border)); border-color: var(--accent-border);
}
.style-pill.active, .type-pill.active {
  background: var(--accent); color: hsl(0 0% 100%); border-color: var(--accent);
}

/* "More" pill — same style for both style and source-type pickers */
.style-pill-more,
.type-pill-more {
  background: var(--surface-subtle);
  border-style: dashed;
  display: inline-flex; align-items: center; gap: 4px;
}
.style-pill-more:hover,
.type-pill-more:hover { border-style: solid; }
.style-pill-more::after,
.type-pill-more::after {
  content: "";
  display: inline-block;
  width: 0; height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: .65;
  flex-shrink: 0;
}

/* Style picker modal */
.cg-modal-style-picker { max-width: 520px; }

.cg-modal-style-search-bar {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.style-picker-input {
  width: 100%; padding: 8px 12px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text);
  font-size: .9rem; font-family: inherit; outline: none;
  transition: border-color .15s;
}
.style-picker-input:focus { border-color: var(--accent); }

.style-picker-list-wrap {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.style-picker-list {
  list-style: none; margin: 0; padding: 6px 0;
}
.style-picker-item {
  padding: 9px 20px;
  cursor: pointer; font-size: .875rem; color: var(--text);
  transition: background .1s;
}
.style-picker-item:hover { background: var(--secondary, var(--border)); }
.style-picker-item.active {
  color: var(--accent); font-weight: 600;
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.style-picker-count {
  padding: 4px 20px 5px;
  font-size: .72rem; color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  min-height: 24px;
}
.style-picker-loading,
.style-picker-empty {
  padding: 32px 20px; text-align: center;
  font-size: .875rem; color: var(--text-muted);
}
.style-picker-sentinel {
  height: 1px;
  visibility: hidden;
}

/* Smart textarea */
.smart-textarea {
  width: 100%; min-height: 120px;
  padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); font-size: .93rem;
  color: var(--text); font-family: inherit;
  resize: vertical; outline: none; transition: border-color .15s;
  line-height: 1.6;
}
.smart-textarea:focus { border-color: var(--accent); }

.smart-tip {
  font-size: .75rem; color: var(--text-muted); margin-top: 6px;
}

/* Inline "Try an example" chips (used in the bulk converter) */
.example-chip {
  display: inline-block;
  margin-left: 4px;
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid var(--accent-border);
  background: var(--accent-subtle);
  color: var(--accent);
  font-size: .72rem; font-weight: 600;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
}
.example-chip:hover {
  background: var(--accent);
  color: hsl(0 0% 100%);
  border-color: var(--accent);
}

/* Actions row */
.cite-actions { display: flex; gap: 10px; }

.btn-cite-main { flex: 1; justify-content: center; }

.btn-clear-secondary {
  background: var(--red); color: hsl(0 0% 100%);
  border: none; border-radius: 8px;
  padding: 9px 20px; font-size: .92rem; font-weight: 600;
  cursor: pointer; transition: background .15s;
}
.btn-clear-secondary:hover { background: hsl(0 84% 50%); }

/* Style guide card */
.style-guide-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 16px;
  font-size: .9rem; line-height: 1.7; color: var(--text);
}
.style-guide-card h2 { font-size: 1.3rem; font-weight: 700; }
.style-guide-card h3 { font-size: 1rem; font-weight: 600; margin-bottom: 4px; }

.guide-format-box {
  background: var(--accent-subtle); border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0; padding: 10px 14px; margin-bottom: 8px;
}
.guide-format-box code { font-size: .9rem; font-weight: 700; display: block; }
.guide-format-box small { font-size: .75rem; color: var(--text-muted); }

.guide-rules { list-style: disc; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }

.guide-tips {
  background: var(--accent-subtle); border: 1px solid var(--accent-light);
  border-radius: 8px; padding: 14px 16px;
}
.guide-tips h3 { color: var(--accent-dark); }
.guide-tips ul { list-style: disc; padding-left: 18px; color: var(--accent-dark); display: flex; flex-direction: column; gap: 3px; font-size: .85rem; }

/* ── LLM input area ──────────────────────────────────────────────────────────── */
.input-area {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px;
}

textarea#query {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: .93rem;
  font-family: inherit; color: var(--text);
  background: var(--bg); resize: vertical; outline: none;
  transition: border-color .15s;
}
textarea#query:focus { border-color: var(--accent); }

.btn-submit {
  align-self: flex-end;
  background: var(--accent); color: hsl(0 0% 100%);
  border: none; border-radius: 8px;
  padding: 9px 22px; font-size: .92rem; font-weight: 600;
  cursor: pointer; display: flex; align-items: center; gap: 8px;
  transition: background .15s;
}
.btn-submit:hover    { background: var(--accent-dark); }
.btn-submit:disabled { opacity: .55; cursor: not-allowed; }

.spinner {
  width: 15px; height: 15px;
  border: 2px solid hsl(0 0% 100% / .35);
  border-top-color: hsl(0 0% 100%);
  border-radius: 50%; animation: spin .65s linear infinite;
}

/* ── Two-column agent output ─────────────────────────────────────────────────── */
.content-grid {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 18px; align-items: start;
}

.panel {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; overflow: hidden;
}

.panel-header {
  display: flex; align-items: center; gap: 7px;
  padding: 11px 16px; border-bottom: 1px solid var(--border);
  font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-muted); background: var(--surface-subtle);
}
.panel-icon { font-size: 1rem; }
.panel-body { padding: 16px; }
.placeholder { color: var(--text-muted); font-size: .88rem; font-style: italic; }

/* Answer */
.answer-body { line-height: 1.75; font-size: .95rem; }
.answer-body p + p { margin-top: .75em; }

/* Source metadata bar (authors · journal · year · citations) */
.source-meta-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 14px;
  font-size: .82rem; color: var(--text-muted); font-weight: 500;
  line-height: 1.4;
}
.sm-sep   { color: var(--border); font-size: .9em; user-select: none; }
.sm-authors { color: var(--text); }
.sm-journal { font-style: italic; color: var(--text); }
.sm-cited {
  display: inline-flex; align-items: center;
  background: var(--surface-subtle, var(--bg));
  border: 1px solid var(--border);
  border-radius: 99px; padding: 1px 8px;
  font-size: .75rem; font-weight: 600; color: var(--text-muted);
}

/* Inline Visit/Cite buttons injected after each URL in find_source answers */
.answer-url {
  color: var(--accent); word-break: break-all;
}
.inline-paper-actions {
  display: inline-flex; gap: 5px; align-items: center;
  margin-left: 7px; vertical-align: middle; white-space: nowrap;
}
.inline-visit-btn {
  display: inline-block;
  padding: 2px 9px; border-radius: var(--radius);
  font-size: .75rem; font-weight: 600;
  background: var(--accent); color: #fff;
  text-decoration: none;
  transition: background .15s;
}
.inline-visit-btn:hover { background: var(--accent-dark); }
.inline-cite-btn {
  padding: 2px 9px; border-radius: var(--radius);
  font-size: .75rem; font-weight: 600;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.inline-cite-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Visit Source + Cite action bar */
.source-action-bar { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }

.visit-source-btn, .cite-source-btn {
  display: inline-block;
  padding: 9px 18px; border-radius: var(--radius);
  font-size: .875rem; font-weight: 600;
  cursor: pointer; transition: background .15s, border-color .15s, color .15s;
  text-decoration: none; border: none;
}
.visit-source-btn { background: var(--accent); color: #fff; }
.visit-source-btn:hover { background: var(--accent-dark); }
.cite-source-btn  { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.cite-source-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Related Academic Papers section (find_source mode) */
.related-papers-section {
  margin-top: 20px;
  border-top: 1px solid var(--border);
  padding-top: 14px;
}
.rp-header {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted);
  margin-bottom: 10px; display: flex; align-items: center; gap: 8px;
}
.rp-count {
  font-weight: 500; text-transform: none; letter-spacing: 0;
  background: var(--surface-subtle, var(--bg));
  border: 1px solid var(--border);
  border-radius: 99px; padding: 1px 8px; font-size: .75rem;
}
.rp-card {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}
.rp-card:last-child { border-bottom: none; }
.rp-card-main { flex: 1; min-width: 0; }
.rp-title {
  display: block; font-size: .875rem; font-weight: 600;
  color: var(--text); line-height: 1.35;
  text-decoration: none; margin-bottom: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
a.rp-title:hover { color: var(--accent); text-decoration: underline; }
.rp-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 5px;
  font-size: .78rem; color: var(--text-muted);
}
.rp-authors { color: var(--text); font-weight: 500; }
.rp-journal { font-style: italic; }
.rp-verified-badge {
  display: inline-flex; align-items: center; gap: 3px;
  background: var(--accent-subtle); color: var(--accent);
  border: 1px solid var(--accent-border);
  border-radius: 99px; padding: 1px 7px;
  font-size: .7rem; font-weight: 700; letter-spacing: .01em;
  white-space: nowrap;
}
.rp-cite-btn {
  flex-shrink: 0;
  padding: 5px 12px; border-radius: var(--radius);
  font-size: .78rem; font-weight: 600;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border);
  cursor: pointer; transition: border-color .15s, color .15s;
  white-space: nowrap;
}
.rp-cite-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Cite source modal */
.cite-source-modal-inner { max-width: 480px; }
.cite-modal-url-label, .cite-modal-section-label {
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted); margin-bottom: 6px;
}
.cite-modal-url {
  font-size: .8rem; color: var(--text-muted); word-break: break-all;
  padding: 8px 10px; background: var(--surface-subtle);
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 16px;
}
.cite-modal-styles { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.cite-style-pill {
  padding: 5px 13px; border-radius: 99px; font-size: .8rem; font-weight: 600;
  border: 1px solid var(--border); background: var(--bg); color: var(--text-muted);
  cursor: pointer; transition: all .15s;
}
.cite-style-pill:hover  { border-color: var(--accent); color: var(--accent); }
.cite-style-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.cite-panel-output {
  font-size: .875rem; line-height: 1.6; color: var(--text);
  padding: 10px 12px; background: var(--surface-subtle);
  border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 8px;
}
.cite-panel-loading { font-size: .85rem; color: var(--text-muted); margin-top: 4px; }
.cite-modal-error   { font-size: .85rem; color: var(--red, #e53935); margin-top: 4px; }
.cite-modal-result-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Agent log */
.log-panel { position: sticky; top: 20px; max-height: calc(100vh - 80px); }
.log-status {
  margin-left: auto; font-size: .72rem; font-weight: 500;
  padding: 2px 8px; border-radius: 20px;
}
.log-status.running { background: var(--amber-bg); color: var(--amber); }
.log-status.done    { background: var(--green-bg); color: var(--green); }

.log-body {
  overflow-y: auto; max-height: calc(100vh - 160px);
  padding: 10px; display: flex; flex-direction: column; gap: 8px;
}

.log-entry {
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden; font-size: .82rem;
}
.log-entry-header {
  display: flex; align-items: center; gap: 7px;
  padding: 7px 10px; cursor: pointer; user-select: none;
}
.log-entry-header:hover { background: var(--bg); }
.log-step-num { font-size: .68rem; font-weight: 700; color: var(--text-muted); min-width: 18px; }
.log-tool-badge {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: .73rem; font-weight: 600; padding: 2px 7px;
  border-radius: 4px;
  background: var(--amber-bg); border: 1px solid var(--amber-border); color: var(--amber);
}
.log-entry-status { margin-left: auto; font-size: .85rem; }

.log-entry.running .log-entry-header { background: var(--amber-bg); }
.log-entry.running .log-tool-badge   { background: var(--amber); color: hsl(0 0% 100%); border-color: var(--amber); }
.log-entry.done .log-entry-header    { background: var(--green-bg); }
.log-entry.done .log-tool-badge      { background: var(--green); color: hsl(0 0% 100%); border-color: var(--green); }

/* Reasoning (DeepSeek R1 thinking) entry */
.log-entry.reasoning .log-entry-header { background: var(--surface); }
.reasoning-badge {
  font-family: inherit !important; font-style: italic;
  background: var(--surface) !important; border-color: var(--border) !important;
  color: var(--text-muted) !important;
}
.log-entry.reasoning.running .log-entry-header { background: var(--surface); }
.reasoning-text {
  font-family: inherit; font-size: .8rem; color: var(--text-muted);
  white-space: pre-wrap; line-height: 1.5; max-height: 200px; overflow-y: auto;
}

.log-entry-body {
  padding: 8px 10px; border-top: 1px solid var(--border);
  background: var(--surface-subtle); display: none;
}
.log-entry.open .log-entry-body { display: block; }

.log-section-label {
  font-size: .67rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted); margin-bottom: 3px;
}
.log-input, .log-result {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: .75rem; color: var(--text);
  white-space: pre-wrap; word-break: break-word;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 8px; margin-bottom: 6px;
}

.error-card {
  background: var(--red-bg); border: 1px solid var(--red-border);
  border-radius: var(--radius); padding: 14px 18px;
  color: var(--red); font-size: .88rem;
}

/* ── Animations ──────────────────────────────────────────────────────────────── */
@keyframes spin  { to { transform: rotate(360deg); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.hidden { display: none !important; }

/* ── Writing Assistant ───────────────────────────────────────────────────────── */
.writing-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
  height: calc(100vh - 160px);
  min-height: 500px;
}

/* Editor container */
.editor-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

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

.editor-title {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
}

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

.btn-review {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  background: var(--accent);
  color: hsl(0 0% 100%);
  border: none;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-review:hover:not(:disabled)  { background: var(--accent-dark); }
.btn-review:disabled               { opacity: .6; cursor: not-allowed; }

.btn-edit-back {
  padding: 7px 14px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: .83rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-edit-back:hover { background: var(--bg); color: var(--text); }

.writing-textarea {
  flex: 1;
  width: 100%;
  padding: 18px 20px;
  border: none;
  outline: none;
  resize: none;
  font-size: .95rem;
  line-height: 1.75;
  color: var(--text);
  font-family: inherit;
  background: transparent;
}
.writing-textarea::placeholder { color: var(--text-muted); }

.writing-display {
  flex: 1;
  padding: 18px 20px;
  font-size: .95rem;
  line-height: 1.75;
  color: var(--text);
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.editor-footer {
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

.word-count {
  font-size: .75rem;
  color: var(--text-muted);
}

/* Issue highlights */
.issue-highlight {
  border-radius: 3px;
  cursor: pointer;
  transition: opacity .15s;
  padding: 1px 0;
}
.issue-highlight:hover { opacity: .75; }

.issue-highlight.issue-grammar {
  background: var(--red-bg);
  border-bottom: 2px solid var(--red);
}
.issue-highlight.issue-clarity {
  background: var(--accent-subtle);
  border-bottom: 2px solid var(--accent-medium);
}

.issue-accepted {
  background: var(--green-bg);
  border-radius: 3px;
  padding: 1px 0;
  transition: background 1s ease;
}

/* Review panel */
.review-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

.review-panel-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.review-panel-title {
  font-size: .85rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  flex: 1;
}

.issue-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent);
  color: #fff;
  border-radius: 999px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  font-size: .72rem;
  font-weight: 700;
}

.review-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.review-disclaimer {
  font-size: .75rem;
  color: var(--text-muted);
  text-align: center;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  margin: 0;
}

/* "Verify your citation" note shown after a citation is generated */
.cite-verify-note {
  font-size: .85rem;
  color: var(--text-muted);
  margin: 6px 0 0;
  padding: 10px 14px;
  background: var(--accent-subtle);
  border-left: 3px solid var(--accent);
  border-radius: 0 6px 6px 0;
  line-height: 1.5;
}
.cite-verify-note a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
  margin-left: 4px;
}
.cite-verify-note a:hover { text-decoration: underline; }

/* "Want to Learn More?" section on the citation generator page */
.learn-more-section {
  max-width: 1100px;
  margin: 48px auto 64px;
  padding: 0 24px;
}
.learn-more-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 24px;
  color: var(--text);
  text-align: center;
}
.learn-more-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.learn-more-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  box-shadow: var(--shadow);
}
.learn-more-card h3 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--accent);
}
.learn-more-card p {
  font-size: .88rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0;
}
.learn-more-card a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.learn-more-card a:hover { text-decoration: underline; }

.review-placeholder {
  font-size: .85rem;
  color: var(--text-muted);
  text-align: center;
  margin-top: 24px;
  line-height: 1.6;
}

.review-all-clear {
  font-size: .85rem;
  color: var(--green);
  background: var(--green-bg);
  border: 1px solid var(--green-border);
  border-radius: 8px;
  padding: 14px 16px;
  text-align: center;
}

/* Issue cards */
.issue-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px 14px;
  transition: box-shadow .15s, border-color .15s;
}
.issue-card:hover { border-color: var(--accent-border); box-shadow: 0 0 0 2px var(--accent-subtle); }

.issue-card-pulse {
  animation: pulse-card .4s ease;
}
@keyframes pulse-card {
  0%   { box-shadow: 0 0 0 0 hsl(220 100% 50% / .4); }
  70%  { box-shadow: 0 0 0 8px hsl(220 100% 50% / 0); }
  100% { box-shadow: none; }
}

.issue-card-top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.issue-badge {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: 2px 7px;
  border-radius: 999px;
  flex-shrink: 0;
}
.issue-badge-grammar  { background: var(--red-bg);       color: hsl(0 84% 36%); }
.issue-badge-spelling { background: hsl(30 90% 92%);     color: hsl(30 80% 30%); }
.issue-badge-clarity  { background: var(--accent-subtle); color: var(--accent-dark); }

.issue-original {
  font-size: .8rem;
  color: var(--text-muted);
  font-style: italic;
  line-height: 1.4;
}

.issue-arrow {
  font-size: .85rem;
  color: var(--text);
  margin-bottom: 6px;
  line-height: 1.5;
}

.issue-suggestion {
  font-weight: 600;
  color: var(--green);
}

.issue-explanation {
  font-size: .78rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.5;
}

.issue-card-actions {
  display: flex;
  gap: 6px;
  margin-top: 8px;
}

.btn-accept {
  flex: 1;
  padding: 6px 10px;
  background: var(--accent);
  color: hsl(0 0% 100%);
  border: none;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-accept:hover { background: var(--accent-dark); }

.btn-reject {
  flex: 1;
  padding: 6px 10px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: .8rem;
  cursor: pointer;
  transition: background .15s, color .15s;
}
.btn-reject:hover { background: var(--bg); color: var(--text); }

/* ── Responsive (legacy) ─────────────────────────────────────────────────────── */
@media (max-width: 1000px) {
  .content-grid  { grid-template-columns: 1fr; }
  .log-panel     { position: static; max-height: 400px; }
  .writing-layout { grid-template-columns: 1fr; height: auto; }
  .editor-wrap,
  .review-panel  { height: 400px; }
}
@media (max-width: 700px) {
  .form-row { grid-template-columns: 1fr 1fr; }
  .form-group.span-2,
  .form-group.span-3 { grid-column: span 2; }
}
@media (max-width: 640px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .main    { padding: 14px; }
}

/* ════════════════════════════════════════════════════════════════════════════════
   LANDING PAGE STYLES
   ════════════════════════════════════════════════════════════════════════════════ */

/* ── Announcement banner ─────────────────────────────────────────────────────── */
.announce-banner {
  background: hsl(220 100% 96%);
  border-bottom: 1px solid hsl(220 100% 88%);
  padding: 8px 20px;
  text-align: center;
  font-size: .83rem;
  color: hsl(220 40% 35%);
}
.dark .announce-banner {
  background: hsl(220 40% 14%);
  border-color: hsl(220 40% 22%);
  color: hsl(220 60% 75%);
}
.announce-link {
  color: var(--accent); font-weight: 600; margin-left: 8px; text-decoration: none;
}
.announce-link:hover { text-decoration: underline; }

/* ── Beta banner ─────────────────────────────────────────────────────────────── */
.beta-banner {
  background: hsl(262 80% 96%);
  border-bottom-color: hsl(262 60% 85%);
  color: hsl(262 40% 35%);
}
.dark .beta-banner {
  background: hsl(262 30% 14%);
  border-bottom-color: hsl(262 30% 24%);
  color: hsl(262 60% 78%);
}

/* ── Coming-soon tabs ────────────────────────────────────────────────────────── */
.mode-tab.mode-tab-soon {
  opacity: 0.45;
  cursor: not-allowed;
}

/* ── Auth-gated (paid) tabs ──────────────────────────────────────────────────── */
.mode-tab.mode-tab-paid {
  opacity: 0.7;
}
.soon-badge {
  display: inline-block;
  background: hsl(262 70% 58%);
  color: #fff;
  font-size: .58rem;
  font-weight: 700;
  letter-spacing: .04em;
  padding: 1px 5px;
  border-radius: 8px;
  line-height: 1.5;
  vertical-align: middle;
  pointer-events: none;
}

/* ── Coming-soon feature button ──────────────────────────────────────────────── */
.btn-feature.btn-feature-soon {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-feature.btn-feature-soon:hover { opacity: 0.45; }

/* ── Navbar ──────────────────────────────────────────────────────────────────── */
.navbar {
  display: flex; align-items: center;
  padding: 0 32px; height: 60px;
  width: 100%; box-sizing: border-box;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 100;
  gap: 24px;
}
.nav-logo {
  display: flex; align-items: center; gap: 8px;
  font-size: 1.1rem; font-weight: 700; color: var(--text);
  text-decoration: none;
  flex-shrink: 0;
}
.logo-img { height: 28px; width: auto; display: block; }
.footer-logo .logo-img { height: 22px; }
.nav-links { display: flex; gap: 20px; margin-left: auto; }
.nav-link {
  font-size: .88rem; color: var(--text-muted);
  text-decoration: none; font-weight: 500;
  transition: color .15s;
}
.nav-link:hover { color: var(--text); }
.nav-link-soon {
  font-size: .88rem; color: var(--text-muted);
  font-weight: 500; opacity: .5;
  cursor: default; display: flex; align-items: center; gap: 5px;
}
.nav-right {
  display: flex; align-items: center; gap: 10px;
}

/* ── Hero ────────────────────────────────────────────────────────────────────── */
.hero-section {
  background: var(--bg);
  padding: 64px 32px 48px;
}
.hero-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: flex-start;
  gap: 48px; flex-wrap: wrap;
}
.hero-left {
  flex: 1; min-width: 300px; max-width: 520px;
  display: flex; flex-direction: column; gap: 20px;
}
.hero-title {
  font-size: clamp(1.9rem, 4vw, 3rem);
  font-weight: 800; line-height: 1.15;
  color: var(--text);
}
.hero-accent { color: var(--accent); }
.hero-desc {
  font-size: 1rem; color: var(--text-muted); line-height: 1.7;
  max-width: 440px;
}
.hero-stats {
  display: flex; gap: 0; border-left: none;
}
.hero-stat {
  display: flex; flex-direction: column; padding-right: 24px;
}
.hero-stat-divider {
  border-left: 1px solid var(--border); padding-left: 24px;
}
.stat-num {
  font-size: 1.9rem; font-weight: 800; color: var(--green); line-height: 1;
}
.stat-label {
  font-size: .78rem; color: var(--text-muted); margin-top: 2px;
}
.btn-hero-cta {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: hsl(0 0% 100%);
  border: none; border-radius: 24px;
  padding: 14px 28px; font-size: .95rem; font-weight: 600;
  text-decoration: none; cursor: pointer;
  box-shadow: 0 4px 14px hsl(220 100% 50% / .25);
  transition: background .15s, transform .15s;
  width: fit-content;
}
.btn-hero-cta:hover { background: var(--accent-dark); transform: translateY(-1px); }

/* ── Tool card (hero right) ──────────────────────────────────────────────────── */
.hero-right {
  flex: 1; min-width: 320px; max-width: 680px;
}
.tool-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.06);
  overflow: hidden;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}
.tool-card-tabs {
  padding: 12px 14px 0;
}
.tab-rail {
  display: flex; background: hsl(220 20% 96%);
  border-radius: 32px; padding: 3px; gap: 1px;
  overflow-x: auto; width: 100%;
  /* hide scrollbar but keep scroll behaviour */
  scrollbar-width: none;
}
.tab-rail::-webkit-scrollbar { display: none; }
.dark .tab-rail { background: hsl(220 12% 16%); }
.mode-tab {
  padding: 7px 10px; border-radius: 28px; border: none;
  background: transparent; color: var(--text-muted);
  font-size: .78rem; font-weight: 600; cursor: pointer;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.mode-tab:hover { color: var(--text); }
.mode-tab.active {
  background: var(--surface); color: var(--text);
  box-shadow: 0 1px 4px rgba(0,0,0,.12);
}

/* ── Card panels ─────────────────────────────────────────────────────────────── */
.card-panel {
  padding: 16px 16px 12px;
  display: flex; flex-direction: column; gap: 12px;
  max-height: 520px; overflow-y: auto;
  width: 100%; min-width: 0; box-sizing: border-box;
}
.card-section { display: flex; flex-direction: column; gap: 6px; }
.card-label {
  font-size: .72rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; color: var(--text-muted);
}
.card-textarea {
  width: 100%; border: 1px solid var(--border); border-radius: 8px;
  padding: 10px 12px; font-size: .9rem;
  font-family: inherit; color: var(--text);
  background: var(--bg); resize: vertical; outline: none;
  transition: border-color .15s; line-height: 1.6;
}
.card-textarea:focus { border-color: var(--accent); }
.card-textarea::placeholder { color: var(--text-muted); }
.card-footer-row {
  display: flex; justify-content: flex-end;
  margin-top: 2px;
}
.card-actions {
  display: flex; gap: 8px; flex-wrap: wrap;
}
.card-hint {
  padding: 0 16px 12px;
  font-size: .78rem; color: var(--text-muted); line-height: 1.5;
}
.card-hint:empty { padding-bottom: 0; }

/* ── Styles strip ────────────────────────────────────────────────────────────── */
.styles-strip {
  background: hsl(220 20% 97%);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 14px 0; overflow: hidden;
}
.dark .styles-strip { background: hsl(220 12% 10%); }
.styles-strip-inner {
  display: flex; gap: 24px; width: max-content;
  animation: marquee 28s linear infinite;
}
.style-chip {
  font-size: .8rem; font-weight: 600; color: var(--text-muted);
  padding: 4px 14px; border-radius: 20px;
  border: 1px solid var(--border); background: var(--surface);
  white-space: nowrap;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* ── Output panels ───────────────────────────────────────────────────────────── */
.output-wrapper { background: var(--bg); }
.output-panel { padding: 32px; }
.output-panel-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 20px;
}

/* Writing layout inside output panel */
.output-panel .writing-layout {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr 320px;
  gap: 20px; align-items: start;
  min-height: 400px;
}
.output-panel .editor-wrap {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-height: 400px;
}
.output-panel .writing-display {
  flex: 1; padding: 18px 20px;
  font-size: .95rem; line-height: 1.75;
  color: var(--text); overflow-y: auto;
  white-space: pre-wrap; word-break: break-word;
  min-height: 300px;
}

/* ── Features section ────────────────────────────────────────────────────────── */
.features-section {
  padding: 48px 32px 64px;
  background: var(--surface);
  border-top: 1px solid var(--border);
}
.features-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; flex-direction: column;
  border-top: 1px solid var(--border);
}
.feature-row {
  display: flex; align-items: center;
  gap: 60px; padding: 64px 0;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.feature-row-reverse { flex-direction: row-reverse; }
.feature-text {
  flex: 1; min-width: 280px; max-width: 460px;
  display: flex; flex-direction: column; gap: 14px;
}
.feature-tag {
  font-size: .7rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--text-muted);
}
.feature-title {
  font-size: clamp(1.3rem, 2.5vw, 1.85rem); font-weight: 700;
  color: var(--text); line-height: 1.25;
}
.feature-desc {
  font-size: .95rem; color: var(--text-muted); line-height: 1.7;
}
.btn-feature {
  display: inline-flex; align-items: center;
  background: var(--text); color: var(--surface);
  border: none; border-radius: 8px;
  padding: 10px 22px; font-size: .88rem; font-weight: 600;
  cursor: pointer; width: fit-content; margin-top: 10px;
  transition: opacity .15s;
  text-decoration: none;
}
.btn-feature:hover { opacity: .8; }
.dark .btn-feature { background: var(--surface); color: var(--text); border: 1px solid var(--border); }

/* ── Feature visuals (mockup cards) ─────────────────────────────────────────── */
.feature-visual {
  flex: 1; min-width: 280px; max-width: 520px;
}
.fv-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  display: flex; flex-direction: column; gap: 12px;
  font-size: .88rem;
}
.fv-header { display: flex; }
.fv-pill {
  font-size: .68rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .05em; padding: 3px 10px; border-radius: 20px;
}
.fv-pill-blue  { background: var(--accent-subtle); color: var(--accent-dark); }
.fv-pill-amber { background: var(--amber-bg); color: var(--amber); }
.fv-pill-red   { background: var(--red-bg); color: var(--red); }
.fv-pill-green  { background: var(--green-bg); color: var(--green); }
.fv-pill-purple { background: #ede9fe; color: #6d28d9; }

.fv-citation {
  font-family: Georgia, serif; font-size: .85rem; line-height: 1.7;
  color: var(--text); border-left: 3px solid var(--accent);
  padding-left: 12px;
}
.fv-citation-small { font-size: .78rem; }
.fv-badge-row { display: flex; gap: 8px; flex-wrap: wrap; }
.fv-badge {
  font-size: .73rem; padding: 3px 10px; border-radius: 20px;
  background: var(--surface-subtle); border: 1px solid var(--border); color: var(--text-muted);
}
.fv-green { background: var(--green-bg); border-color: var(--green-border); color: var(--green); }

.fv-query {
  font-size: .83rem; font-style: italic; color: var(--text-muted);
  background: var(--surface-subtle); border-radius: 6px;
  padding: 8px 10px; line-height: 1.5;
}
.fv-query-error { border: 1px solid var(--red-border); background: var(--red-bg); font-style: normal; }

.fv-results { display: flex; flex-direction: column; gap: 8px; }
.fv-result {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg);
}
.fv-result-icon { font-size: 1.1rem; flex-shrink: 0; margin-top: 2px; }
.fv-result-title { font-size: .83rem; font-weight: 600; color: var(--text); }
.fv-result-meta  { font-size: .75rem; color: var(--text-muted); margin-top: 2px; }

.fv-issues { display: flex; flex-direction: column; gap: 5px; }
.fv-issue { font-size: .8rem; padding: 5px 8px; border-radius: 6px; }
.fv-issue-warn { background: var(--amber-bg); color: var(--amber); border: 1px solid var(--amber-border); }
.fv-issue-ok   { background: var(--green-bg); color: var(--green); border: 1px solid var(--green-border); }
.fv-corrected-label { font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); }

.fv-text {
  font-size: .88rem; line-height: 1.7; color: var(--text);
  padding: 10px 12px; background: var(--surface-subtle);
  border-radius: 6px;
}
.fv-mark-grammar {
  background: var(--red-bg); border-bottom: 2px solid var(--red);
  border-radius: 3px; padding: 1px 2px;
}
.fv-mark-clarity {
  background: var(--accent-subtle); border-bottom: 2px solid var(--accent-medium);
  border-radius: 3px; padding: 1px 2px;
}
.fv-issue-cards { display: flex; flex-direction: column; gap: 6px; }
.fv-mini-issue {
  font-size: .78rem; color: var(--text);
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 6px 10px;
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.fv-mini-badge {
  font-size: .65rem; font-weight: 700; text-transform: uppercase;
  padding: 2px 7px; border-radius: 20px; flex-shrink: 0;
}
.fv-mini-grammar { background: var(--red-bg); color: hsl(0 84% 36%); }
.fv-mini-clarity { background: var(--accent-subtle); color: var(--accent-dark); }

/* ── FAQ section ─────────────────────────────────────────────────────────────── */
.faq-section {
  padding: 64px 32px;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.faq-inner {
  max-width: 1100px; margin: 0 auto;
  display: grid; grid-template-columns: 300px 1fr; gap: 64px;
}
.faq-sidebar-title {
  font-size: 1.15rem; font-weight: 700; margin-bottom: 12px;
}
.faq-sidebar-sub {
  font-size: .88rem; color: var(--text-muted); line-height: 1.6;
}
.faq-sidebar code {
  font-family: monospace; background: var(--surface-subtle);
  padding: 1px 5px; border-radius: 4px; font-size: .9em;
}
.faq-content { display: flex; flex-direction: column; }
.faq-item { border-bottom: 1px solid var(--border); }
.faq-q {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 16px 0; text-align: left;
  background: none; border: none; cursor: pointer; gap: 16px;
  font-size: .97rem; font-weight: 500; color: var(--text);
}
.faq-q:hover { color: var(--accent); }
.faq-icon {
  width: 18px; height: 18px; flex-shrink: 0; color: var(--text-muted);
  transition: transform .2s; transform: rotate(0deg);
}
.faq-item.open .faq-icon { transform: rotate(180deg); }
.faq-a {
  font-size: .9rem; color: var(--text-muted); line-height: 1.7;
  padding-bottom: 16px; display: none;
}
.faq-a code {
  font-family: monospace; background: var(--surface-subtle);
  padding: 1px 5px; border-radius: 4px; font-size: .9em; color: var(--text);
}
.faq-item.open .faq-a { display: block; }

/* ── Footer ──────────────────────────────────────────────────────────────────── */
.footer {
  background: var(--surface); border-top: 1px solid var(--border);
  padding: 32px;
}
.footer-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px; flex-wrap: wrap;
}
.footer-logo { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.footer-tagline { font-size: .8rem; color: var(--text-muted); margin-right: auto; }
.footer-links { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-left: auto; }
.footer-link {
  font-size: .82rem; color: var(--text-muted); text-decoration: none;
  transition: color .12s;
}
.footer-link:hover { color: var(--accent); }

/* ── Feedback widget ─────────────────────────────────────────────────────────── */
.feedback-fab {
  position: fixed; right: 20px; bottom: 20px;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--accent); color: #fff;
  padding: 11px 18px; border-radius: 999px;
  font-size: .9rem; font-weight: 700; letter-spacing: .02em;
  text-decoration: none; cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,.18);
  transition: background .15s, box-shadow .15s, transform .15s;
  z-index: 900;
  white-space: nowrap;
  border: none; font-family: inherit;
}
.feedback-fab:hover {
  background: var(--accent-dark);
  box-shadow: 0 6px 20px rgba(0,0,0,.25);
  transform: translateY(-1px);
}
.feedback-fab-icon { flex: 0 0 auto; }
@media (max-width: 480px) {
  .feedback-fab { padding: 11px 13px; right: 14px; bottom: 14px; }
  .feedback-fab-label { display: none; }
}

/* ── Tool pages ──────────────────────────────────────────────────────────────── */
.tool-page-header {
  background: var(--bg);
  padding: 40px 32px 24px;
  border-bottom: 1px solid var(--border);
}
.tool-page-header-inner {
  max-width: 860px; margin: 0 auto;
  display: flex; flex-direction: column; gap: 10px;
}
.tool-page-title {
  font-size: clamp(1.6rem, 3vw, 2.4rem);
  font-weight: 800; color: var(--text); line-height: 1.2;
}
.tool-page-desc {
  font-size: .97rem; color: var(--text-muted); line-height: 1.7;
  max-width: 640px;
}

/* Writing assistant two-column layout */
.writing-page-wrap {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 28px 32px;
  align-items: start;
}
.writing-page-wrap .tool-page-main {
  padding: 0;
  max-width: none;
  margin: 0;
  width: 100%;
  min-width: 0;
}
.writing-page-wrap .review-panel {
  position: sticky;
  top: 80px;
  max-height: calc(100vh - 100px);
}
.writing-page-wrap #writing-display-wrap {
  min-height: 260px;
  display: flex;
  flex-direction: column;
}
.writing-page-wrap .writing-display {
  flex: 1;
  overflow-y: auto;
  max-height: 60vh;
}

@media (max-width: 1000px) {
  .writing-page-wrap {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .writing-page-wrap .review-panel {
    position: static;
    max-height: 400px;
  }
}

.tool-page-main {
  padding: 28px 32px;
  max-width: 860px; margin: 0 auto;
}
.tool-card-page {
  /* full-width card, not constrained by hero-right */
  max-height: none;
}
.tool-card-page .card-panel {
  max-height: none;
}

.tool-page-output .output-panel-inner,
.tool-page-output .writing-layout {
  max-width: 860px; margin: 0 auto;
}
.tool-page-output {
  padding: 0 32px 32px;
}

@media (max-width: 600px) {
  .tool-page-header, .tool-page-main, .tool-page-output {
    padding: 16px;
  }
  .tool-page-main {
    box-sizing: border-box;
    max-width: 100%;
  }
}

/* ── SEO intro strip ─────────────────────────────────────────────────────────── */
.seo-intro {
  background: var(--surface-subtle);
  border-bottom: 1px solid var(--border);
  padding: 18px 32px;
}
.seo-intro-inner {
  max-width: 1100px; margin: 0 auto;
  font-size: .85rem; color: var(--text-muted); line-height: 1.7;
}
.seo-intro-inner strong { color: var(--text); font-weight: 600; }

/* ── Source logos strip ──────────────────────────────────────────────────────── */
.sources-strip {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 32px 32px;
}
.sources-strip-inner {
  max-width: 1100px;
  margin: 0 auto;
  text-align: center;
}
.sources-strip-label {
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 24px;
}
.sources-strip ul {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 32px 48px;
}
.sources-strip ul ul {
  gap: 32px 48px;
}
.sources-strip img {
  max-height: 40px;
  width: auto;
  object-fit: contain;
}

/* ── Writing page responsive ─────────────────────────────────────────────────── */
@media (max-width: 860px) {
  .writing-page-wrap {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  .writing-page-wrap .review-panel {
    position: static;
    max-height: 400px;
  }
}

/* ── Landing page responsive ─────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .hero-inner { flex-direction: column; }
  .hero-left, .hero-right { max-width: 100%; }
  .feature-row, .feature-row-reverse { flex-direction: column; gap: 32px; }
  .feature-text, .feature-visual { max-width: 100%; }
  .faq-inner { grid-template-columns: 1fr; gap: 32px; }
  .output-panel .writing-layout { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
  .hero-section { padding: 40px 16px 32px; }
  .hero-right { min-width: 0; }
  .navbar { padding: 0 16px; }
  .navbar .nav-links { display: none; }
  .navbar .nav-right { margin-left: auto; }
  .features-section, .faq-section { padding: 40px 16px; }
  .output-panel { padding: 16px; }
  .footer { padding: 24px 16px; }
  .tab-rail { gap: 1px; }
  .mode-tab { padding: 7px 10px; font-size: .76rem; }
}

/* ── Mobile features dropdown (hamburger menu) ──────────────────────────────── */
.nav-mobile-menu { position: relative; display: none; }
@media (max-width: 600px) {
  .nav-mobile-menu { display: block; }
}
.nav-mobile-btn {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: none; border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text); cursor: pointer;
  transition: background .15s, border-color .15s;
}
.nav-mobile-btn:hover { background: var(--surface); border-color: var(--accent-border); }
.nav-mobile-btn svg { width: 18px; height: 18px; }
.nav-mobile-dropdown {
  position: absolute; top: calc(100% + 6px); right: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0,0,0,.12);
  padding: 6px;
  z-index: 200;
  display: flex; flex-direction: column; gap: 2px;
}
.nav-mobile-dropdown[hidden] { display: none; }
.nav-mobile-dropdown a {
  display: block;
  padding: 8px 12px;
  font-size: .88rem;
  color: var(--text);
  text-decoration: none;
  border-radius: 6px;
  transition: background .12s, color .12s;
}
.nav-mobile-dropdown a:hover { background: var(--accent-subtle); color: var(--accent); }
.nav-mobile-dropdown a.is-current { color: var(--accent); font-weight: 600; }


/* ── Source type selection modal grid (3 col × 11 rows) ──────────────────────── */
.cg-modal-type-select { max-width: 620px; }

.cg-source-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 16px 20px 20px;
  overflow-y: auto;
  max-height: calc(90vh - 60px);
}

.cg-source-type-btn {
  padding: 10px 12px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--text);
  font-size: .84rem; font-weight: 500;
  cursor: pointer; text-align: left;
  transition: background .1s, border-color .1s, color .1s;
  line-height: 1.3;
}
.cg-source-type-btn:hover {
  background: var(--accent-subtle);
  border-color: var(--accent-border);
  color: var(--accent);
}
.cg-source-type-btn--manual {
  grid-column: 1 / -1;
  text-align: center;
  border-style: dashed;
  color: var(--text-muted);
}
.cg-source-type-btn--manual:hover { color: var(--accent); }

/* ── Citation Generator modals ───────────────────────────────────────────────── */
.cg-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  animation: cgFadeIn .15s ease;
}
.cg-modal-overlay[hidden] { display: none; }
@keyframes cgFadeIn { from { opacity: 0; } to { opacity: 1; } }

.cg-modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 1.5);
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  width: 100%; max-width: 520px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  animation: cgSlideUp .18s ease;
}
@keyframes cgSlideUp { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.cg-modal-form { max-width: 580px; }

.cg-modal-header {
  display: flex; align-items: center; gap: 10px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.cg-modal-title {
  flex: 1; font-size: .95rem; font-weight: 600; color: var(--text);
}
.cg-modal-back {
  background: none; border: none; color: var(--accent);
  font-size: .85rem; font-weight: 500; cursor: pointer; padding: 0;
}
.cg-modal-back:hover { text-decoration: underline; }
.cg-modal-close {
  background: none; border: none; color: var(--text-muted);
  font-size: 1rem; cursor: pointer; padding: 6px 8px; line-height: 1;
  flex-shrink: 0;
}
.cg-modal-close:hover { color: var(--text); }

/* Type selection grid */
.cg-modal-type-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px;
  padding: 20px;
}
.cg-type-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 12px; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--bg);
  cursor: pointer; transition: border-color .12s, background .12s;
  font-size: .85rem; font-weight: 500; color: var(--text);
}
.cg-type-card:hover { border-color: var(--accent-border); background: var(--accent-subtle); }
.cg-type-card-icon { font-size: 1.6rem; line-height: 1; }
.cg-type-card-label { text-align: center; line-height: 1.3; }

/* Book picker modal — multiple Open Library results */
.cg-modal-book-picker { max-width: 620px; }
.cg-modal-subtitle {
  margin: 0; padding: 0 20px 12px;
  font-size: .85rem; color: var(--text-muted);
}
.cg-book-picker-list {
  display: flex; flex-direction: column; gap: 8px;
  padding: 0 20px 20px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}
.cg-book-card {
  display: flex; flex-direction: column; gap: 4px;
  padding: 12px 14px;
  text-align: left;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--text);
  cursor: pointer; font-family: inherit;
  transition: border-color .12s, background .12s;
}
.cg-book-card:hover {
  border-color: var(--accent-border, var(--accent));
  background: var(--accent-subtle, color-mix(in srgb, var(--accent) 6%, transparent));
}
.cg-book-card-title    { font-size: .95rem; font-weight: 600; line-height: 1.3; }
.cg-book-card-authors  { font-size: .85rem; color: var(--text); }
.cg-book-card-meta     { font-size: .78rem; color: var(--text-muted); }

/* Manual entry form */
.cg-modal-body {
  overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
  flex: 1;
}
.cg-manual-form { display: flex; flex-direction: column; gap: 14px; }

.cg-field { display: flex; flex-direction: column; gap: 5px; }
.cg-field-label {
  font-size: .78rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-muted);
}
.cg-field-input {
  padding: 8px 11px; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--bg); color: var(--text); font-size: .9rem; font-family: inherit;
  outline: none; transition: border-color .12s;
}
.cg-field-input:focus { border-color: var(--accent); }

/* Author rows */
.manual-authors { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.author-row {
  display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; align-items: center;
}
.remove-author-btn {
  background: none; border: 1px solid var(--border); border-radius: var(--radius);
  color: var(--text-muted); cursor: pointer; padding: 6px 8px; line-height: 1;
  font-size: .8rem; transition: color .12s, border-color .12s;
}
.remove-author-btn:hover { color: var(--red); border-color: var(--red-border); }
.add-author-btn {
  background: none; border: none; color: var(--accent);
  font-size: .82rem; font-weight: 500; cursor: pointer; padding: 0;
  align-self: flex-start;
}
.add-author-btn:hover { text-decoration: underline; }

.cg-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.cg-modal-submit { width: 100%; justify-content: center; }

/* ── Add to Works Cited button ───────────────────────────────────────────────── */
.btn-add-works-cited {
  background: var(--green);
}
.btn-add-works-cited:hover { background: hsl(160 60% 28%); }

/* ── Blog layout ─────────────────────────────────────────────────────────────── */
.blog-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px 72px;
}

.blog-article {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

/* Blog header */
.blog-header {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.blog-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .82rem;
  color: var(--text-muted);
}

.blog-category {
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-size: .75rem;
}

.blog-dot { color: var(--border); }

.blog-title {
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  font-weight: 800;
  line-height: 1.2;
  color: var(--text);
}

.blog-lead {
  font-size: 1.05rem;
  color: var(--text-muted);
  line-height: 1.7;
}

/* Table of contents */
.blog-toc {
  background: var(--surface-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 22px;
}

.blog-toc-title {
  font-size: .78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.blog-toc-list {
  margin: 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.blog-toc-list a {
  color: var(--accent);
  text-decoration: none;
  font-size: .9rem;
}

.blog-toc-list a:hover { text-decoration: underline; }

/* Body sections */
.blog-article section {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.blog-article h2 {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text);
  padding-top: 4px;
  border-top: 2px solid var(--accent-subtle);
  margin-top: 8px;
}

.blog-article h3 {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  margin-top: 6px;
}

.blog-article p {
  line-height: 1.75;
  color: var(--text);
}

.blog-article ul, .blog-article ol {
  padding-left: 22px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  line-height: 1.7;
}

/* Example boxes */
.blog-example-box {
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.blog-example-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--accent);
}

.blog-example-text {
  font-size: .92rem;
  line-height: 1.7;
  color: var(--text);
}

.blog-example-hanging {
  padding-left: 2em;
  text-indent: -2em;
}

.blog-cite-marker {
  color: var(--accent);
  font-weight: 500;
}

/* Callout */
.blog-callout {
  background: var(--amber-bg);
  border: 1px solid var(--amber-border);
  border-left: 4px solid var(--amber);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: .9rem;
  line-height: 1.65;
  color: var(--text);
}

/* Side-by-side examples */
.blog-side-by-side {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 600px) {
  .blog-side-by-side { grid-template-columns: 1fr; }
}

.blog-side-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.blog-side-label {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
}

/* Summary table */
.blog-summary-table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.blog-summary-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .88rem;
}

.blog-summary-table th,
.blog-summary-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  line-height: 1.5;
}

.blog-summary-table th {
  background: var(--surface-subtle);
  font-weight: 700;
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}

.blog-summary-table tr:last-child td { border-bottom: none; }

.blog-summary-table td:first-child {
  white-space: nowrap;
  color: var(--text-muted);
  font-size: .82rem;
}

/* CTA block */
.blog-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  border-radius: calc(var(--radius) * 1.5);
  padding: 28px 24px;
  margin-top: 8px;
}

.blog-cta-text {
  font-size: 1rem;
  color: var(--text);
  font-weight: 500;
}

.blog-cta-btn {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: .9rem;
  padding: 10px 22px;
  border-radius: var(--radius);
  text-decoration: none;
  transition: background .15s;
}

.blog-cta-btn:hover { background: var(--accent-dark); }

/* Blog index listing */
.blog-index-heading {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
  margin: 0 0 6px;
}
.blog-index-subhead {
  font-size: 1rem;
  color: var(--text-muted);
  margin: 0 0 36px;
}
.blog-index-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}
.blog-index-item {
  display: block;
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}
.blog-index-item:first-child { border-top: 1px solid var(--border); }
.blog-index-item:hover .blog-index-item-title { color: var(--accent); }
.blog-index-item-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .8rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.blog-index-item-title {
  font-size: 1.08rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 6px;
  transition: color .15s;
}
.blog-index-item-desc {
  font-size: .9rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.55;
}

@media (max-width: 600px) {
  .blog-wrap { padding: 32px 16px 56px; }
}

/* ── Auth nav elements ───────────────────────────────────────────────────────── */
#nav-auth {
  display: flex; align-items: center; gap: 10px;
}

.btn-signin {
  padding: 7px 16px; border-radius: var(--radius);
  border: 1px solid var(--accent); background: var(--accent);
  color: #fff; font-size: .875rem; font-weight: 500;
  cursor: pointer; transition: background .15s;
}
.btn-signin:hover { background: var(--accent-dark); border-color: var(--accent-dark); }

.nav-library-link {
  font-size: .85rem; font-weight: 600; color: var(--text);
  text-decoration: none; padding: 6px 12px; border-radius: var(--radius);
  transition: background .15s, color .15s;
}
.nav-library-link:hover { background: var(--surface); color: var(--accent); }

.nav-credits-menu { position: relative; }
.nav-credits-btn {
  background: none; border: none; cursor: pointer;
  width: 32px; height: 32px; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent);
  transition: background .15s, color .15s;
}
.nav-credits-btn:hover { background: var(--accent-subtle); }
.nav-credits-popover {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow);
  width: 280px; z-index: 100; padding: 0 16px;
}
.nav-credits-popover__head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 0; border-bottom: 1px dashed var(--border);
}
.nav-credits-popover__tier {
  font-family: Georgia, "Times New Roman", serif;
  color: var(--text); font-size: 1rem; font-weight: 700; line-height: 22px;
}
.nav-credits-popover__body {
  display: flex; flex-direction: column; gap: 16px; padding: 16px 0;
}
.nav-credits-popover__foot {
  padding: 10px 0 12px; border-top: 1px dashed var(--border); text-align: right;
}
.nav-credits-popover__link {
  font-size: .8rem; font-weight: 600; color: var(--accent); text-decoration: none;
}
.nav-credits-popover__link:hover { text-decoration: underline; }
.nav-credits-popover__empty {
  padding: 16px 0; color: var(--text-muted); font-size: .875rem; text-align: center;
}
.nav-credits-popover .credits-group { display: flex; flex-direction: column; gap: 4px; }
.nav-credits-popover .credits-group__row { display: flex; align-items: center; gap: 6px; }
.nav-credits-popover .credits-group__icon {
  width: 20px; height: 20px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text);
}
.nav-credits-popover .credits-group__icon--muted { color: var(--text-muted); }
.nav-credits-popover .credits-group__label {
  color: var(--text); font-size: .875rem; font-weight: 500;
}
.nav-credits-popover .credits-group__value {
  flex: 1; min-width: 0; text-align: right;
  color: var(--text); font-size: .875rem; font-weight: 500;
}
.nav-credits-popover .credits-group__sublist {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.nav-credits-popover .credits-group__subitem {
  display: flex; align-items: center; width: 100%;
  color: var(--text-muted); font-size: 13px; line-height: 18px;
}
.nav-credits-popover .credits-group__subitem span:first-child { flex: 1; min-width: 0; }
.nav-credits-popover .credits-group__note {
  color: var(--text-muted); font-size: 12px; line-height: 18px; margin: 0;
}
.nav-credits-popover .btn-upgrade {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--text); color: var(--surface);
  height: 28px; min-width: 56px; padding: 0 10px;
  border: none; border-radius: 8px;
  font-size: 13px; line-height: 18px; font-weight: 500;
  cursor: pointer; text-decoration: none;
  transition: opacity .15s;
}
.nav-credits-popover .btn-upgrade:hover { opacity: .9; }

.nav-user-menu { position: relative; }

.nav-user-btn {
  background: none; border: none; cursor: pointer; padding: 2px;
  display: flex; align-items: center;
}

.nav-avatar {
  width: 30px; height: 30px; border-radius: 50%;
  object-fit: cover; display: block;
}
.nav-avatar-initials {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700;
}

.nav-dropdown {
  position: absolute; right: 0; top: calc(100% + 8px);
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  min-width: 200px; z-index: 100; padding: 6px 0;
}
.nav-dropdown-email {
  padding: 8px 14px 2px; font-size: .8rem; color: var(--text-muted);
  word-break: break-all;
}
.nav-dropdown-balance {
  padding: 2px 14px 8px; font-size: .8rem; font-weight: 600; color: var(--accent);
}
.nav-dropdown-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }
.nav-dropdown-item {
  display: block; width: 100%; text-align: left;
  padding: 8px 14px; font-size: .875rem; color: var(--text);
  background: none; border: none; cursor: pointer; text-decoration: none;
  transition: background .12s;
}
.nav-dropdown-item:hover { background: var(--surface-subtle); }
.nav-dropdown-signout { color: var(--red); }

/* ── Auth modal ──────────────────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,.45); backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-backdrop[hidden] { display: none; }

/* ── Card token notice ───────────────────────────────────────────────────────── */
.card-token-notice {
  font-size: .75rem; color: var(--text-muted); text-align: center;
  padding-top: 4px;
}
.card-token-notice a { color: var(--accent); text-decoration: none; }
.card-token-notice a:hover { text-decoration: underline; }

.modal-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: calc(var(--radius) * 2); box-shadow: 0 8px 32px rgba(0,0,0,.15);
  padding: 36px 32px; max-width: 380px; width: 100%;
  position: relative; text-align: center;
}

.modal-close {
  position: absolute; top: 14px; right: 16px;
  background: none; border: none; font-size: 1.4rem; cursor: pointer;
  color: var(--text-muted); line-height: 1;
}
.modal-close:hover { color: var(--text); }

.modal-logo {
  font-weight: 800; font-size: 1.1rem; color: var(--accent);
  letter-spacing: -.02em; margin-bottom: 16px;
}
.modal-title {
  font-size: 1.2rem; font-weight: 700; margin-bottom: 8px;
}
.modal-desc {
  font-size: .875rem; color: var(--text-muted); margin-bottom: 24px; line-height: 1.5;
}

.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; padding: 11px 20px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--surface); color: var(--text);
  font-size: .9rem; font-weight: 500; cursor: pointer;
  transition: background .15s, box-shadow .15s;
}
.btn-google:hover {
  background: var(--surface-subtle);
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
}

/* ── Reading Assistant ──────────────────────────────────────────────────────── */
.reading-drop-zone {
  border: 2px dashed var(--border);
  border-radius: 8px;
  padding: 1.5rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s, background .2s;
}
.reading-drop-zone.drag-over {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
}
.reading-drop-inner svg {
  display: block;
  margin: 0 auto .5rem;
  opacity: .4;
}
.reading-drop-text {
  font-size: .875rem;
  color: var(--text-secondary);
  margin: 0;
}
.reading-drop-sub {
  font-size: .8rem;
  color: var(--text-secondary);
  margin: .25rem 0 0;
}
.reading-browse-link {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: inherit;
  text-decoration: underline;
  padding: 0;
}
.reading-file-info {
  display: flex;
  align-items: center;
  gap: .5rem;
  justify-content: center;
  padding: .5rem 0;
  font-size: .875rem;
  color: var(--text);
}
.reading-clear-file {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 1.1rem;
  line-height: 1;
  padding: 0 .25rem;
}
.reading-clear-file:hover {
  color: var(--text);
}

