/* BibVera — shared design tokens and components */
:root {
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eff6ff;
  --ink: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --bg: #f8fafc;
  --white: #fff;
  --green: #059669;
  --radius: 12px;
  --shadow: 0 8px 24px rgba(15, 23, 42, .06);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); font-size: 14px; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

/* top bar */
.topbar {
  height: 68px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 max(24px, calc((100vw - 1160px) / 2));
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand { font-size: 19px; font-weight: 750; letter-spacing: -.5px; display: flex; align-items: center; gap: 9px; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--blue); color: white; display: grid; place-items: center; font-weight: 800; }
.nav { display: flex; align-items: center; gap: 26px; color: #475569; }
.nav a:hover, .nav a.active { color: var(--blue); }
.actions { display: flex; align-items: center; gap: 10px; }

/* buttons */
.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px 15px;
  border-radius: 9px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}
.btn.primary { background: var(--blue); border-color: var(--blue); color: white; }
.btn.primary:hover { background: var(--blue-dark); }
.btn.ghost { border-color: transparent; background: transparent; }

/* layout */
.container { max-width: 1160px; margin: 0 auto; padding: 44px 24px; }
.eyebrow { color: var(--blue); font-weight: 700; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.hero { text-align: center; padding: 42px 0 30px; }
.hero h1 { font-size: clamp(34px, 5vw, 52px); letter-spacing: -1.8px; line-height: 1.08; margin: 14px 0; }
.hero p { color: var(--muted); font-size: 17px; margin: 0 auto 28px; max-width: 640px; }
.panel, .card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* generator */
.generator { max-width: 760px; margin: 0 auto; padding: 22px; text-align: left; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tab { border: 0; background: transparent; padding: 10px 14px; color: var(--muted); border-bottom: 2px solid transparent; }
.tab.active { color: var(--blue); border-color: var(--blue); font-weight: 700; }
.field-label { display: block; font-weight: 650; margin: 14px 0 7px; }
.field { width: 100%; border: 1px solid #cbd5e1; border-radius: 8px; padding: 12px 13px; background: #fff; outline: none; }
.field:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #dbeafe; }
.generator-row { display: flex; gap: 10px; }
.generator-row .field { flex: 1; }
.styles { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 18px 0 4px; }
.chip { padding: 7px 12px; border-radius: 999px; background: #f1f5f9; color: #475569; font-size: 12px; }
.chip.selected { background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.benefits { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 42px auto 0; max-width: 850px; text-align: center; }
.benefits strong { display: block; margin: 7px 0 4px; }
.benefits span { color: var(--muted); font-size: 12px; }
.section-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 18px; }
.section-head h2 { font-size: 24px; letter-spacing: -.6px; margin: 6px 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* field confirmation */
.field-confirm { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.field-confirm h3 { font-size: 15px; margin: 0 0 4px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin-top: 14px; }
.field-grid .full { grid-column: 1 / -1; }
.field-grid label { display: block; font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 5px; }
.field-grid input, .field-grid select { width: 100%; border: 1px solid #cbd5e1; border-radius: 8px; padding: 9px 11px; background: #fff; outline: none; font-size: 13px; }
.field-grid input:focus, .field-grid select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px #dbeafe; }
.confirm-actions { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* result preview */
.result-view { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.result-view h3 { font-size: 15px; margin: 0 0 12px; }
.result-box { background: var(--bg); border: 1px solid var(--line); border-radius: 9px; padding: 16px; font-family: Georgia, serif; line-height: 1.8; min-height: 60px; }
.copy-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* content blocks (SEO pages) */
.content-section { max-width: 860px; margin: 44px auto 0; }
.content-section h2 { font-size: 24px; letter-spacing: -.6px; margin: 0 0 16px; }
.content-section h3 { font-size: 17px; margin: 24px 0 10px; }
.content-section p { color: #475569; line-height: 1.7; margin: 0 0 14px; }
.example-box { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin: 14px 0; }
.example-box .ex-label { font-size: 11px; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: .08em; }
.example-box .ex-text { font-family: Georgia, serif; line-height: 1.8; margin-top: 8px; }
.example-box .ex-input { font-family: ui-monospace, monospace; font-size: 13px; background: var(--bg); padding: 8px 10px; border-radius: 6px; display: inline-block; margin-top: 6px; }
.rules-list { list-style: none; padding: 0; margin: 0; }
.rules-list li { padding: 11px 0 11px 24px; border-top: 1px solid #f1f5f9; position: relative; color: #475569; line-height: 1.6; }
.rules-list li::before { content: "✓"; position: absolute; left: 0; color: var(--green); font-weight: 700; }
.faq-item { border-top: 1px solid #f1f5f9; padding: 16px 0; }
.faq-item h3 { font-size: 15px; margin: 0 0 6px; }
.faq-item p { margin: 0; }
.data-source { background: var(--blue-soft); border-radius: 9px; padding: 14px 16px; font-size: 13px; color: #1e40af; line-height: 1.6; margin-top: 18px; }
.data-source strong { display: block; margin-bottom: 4px; }

/* workspace */
.layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); min-height: calc(100vh - 68px); }
.sidebar { background: #fff; border-right: 1px solid var(--line); padding: 24px 14px; display: flex; flex-direction: column; gap: 5px; }
.side-link { padding: 11px 13px; border-radius: 8px; color: #475569; display: flex; gap: 11px; align-items: center; }
.side-link.active { background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.side-label { font-size: 11px; color: #94a3b8; text-transform: uppercase; letter-spacing: .08em; padding: 20px 13px 7px; }
.user { margin-top: auto; padding: 14px 10px; border-top: 1px solid var(--line); display: flex; gap: 10px; align-items: center; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #dbeafe; color: var(--blue); display: grid; place-items: center; font-weight: 700; }
.main { padding: 34px clamp(20px, 4vw, 48px); max-width: 1400px; width: 100%; margin: 0 auto; }
.welcome { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; }
.welcome h1 { font-size: 28px; letter-spacing: -.8px; margin: 0 0 6px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 22px 0; }
.stat { padding: 18px; }
.stat .num { font-size: 26px; font-weight: 750; margin: 8px 0 3px; }
.stat .label { color: var(--muted); font-size: 12px; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(260px, 1fr); gap: 18px; }
.card { padding: 20px; }
.card h3 { margin: 0 0 16px; font-size: 16px; }
.project-row, .ref-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-top: 1px solid #f1f5f9; }
.project-info { display: flex; gap: 12px; align-items: center; }
.folder { width: 36px; height: 36px; border-radius: 10px; background: var(--blue-soft); color: var(--blue); display: grid; place-items: center; }
.project-info strong, .ref-row strong { display: block; font-size: 13px; }
.project-info span, .ref-row span { font-size: 12px; color: var(--muted); }
.empty-state { padding: 22px 0; color: #475569; font-size: 13px; border-top: 1px solid #f1f5f9; }
.empty-state .small { margin-top: 6px; }
.quick-list a { display: flex; justify-content: space-between; padding: 13px 0; border-top: 1px solid #f1f5f9; color: #475569; }

/* editor */
.editor-wrap { max-width: 1180px; margin: 28px auto; padding: 0 22px; }
.editor-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.editor { display: grid; grid-template-columns: 1fr 1fr; overflow: hidden; }
.editor-pane { padding: 26px; }
.editor-pane + .editor-pane { border-left: 1px solid var(--line); background: #fcfdff; }
.editor-pane h2 { font-size: 18px; margin: 0 0 20px; }
.two-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.preview-tabs { display: flex; gap: 18px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.preview-tabs button { border: 0; background: none; padding: 0 0 12px; color: var(--muted); }
.preview-tabs button.active { color: var(--blue); border-bottom: 2px solid var(--blue); font-weight: 700; }
.citation { font-family: Georgia, serif; font-size: 16px; line-height: 1.85; padding: 20px 8px; min-height: 170px; }
.success { background: #ecfdf5; color: #047857; padding: 14px; border-radius: 9px; font-size: 13px; margin-top: 25px; }
.notice { font-size: 12px; color: var(--muted); margin-top: 14px; }
.footer { border-top: 1px solid var(--line); padding: 24px; text-align: center; color: var(--muted); font-size: 12px; margin-top: 60px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #0f172a; color: #fff; padding: 12px 18px; border-radius: 9px; display: none; z-index: 10; }
.toast.show { display: block; }

/* language switcher */
.lang-switch { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted); }
.lang-switch select { border: 1px solid var(--line); border-radius: 7px; padding: 5px 6px; font-size: 12px; color: var(--ink); background: #fff; cursor: pointer; max-width: 128px; }
.lang-switch select:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px #dbeafe; }

/* citation check panel */
.check-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.check-tab { border: 0; background: transparent; color: var(--muted); padding: 8px 12px; cursor: pointer; font-size: 13px; border-bottom: 2px solid transparent; }
.check-tab.active { color: var(--blue); border-bottom-color: var(--blue); font-weight: 600; }
.check-input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font-size: 13px; font-family: inherit; color: var(--ink); background: #fff; resize: vertical; box-sizing: border-box; }
.check-input:focus { border-color: var(--blue); outline: none; box-shadow: 0 0 0 3px #dbeafe; }
.check-fields { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-top: 8px; }
.check-result { margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--bg); font-size: 13px; line-height: 1.7; }
.check-result .ok { color: #15803d; }
.check-result .bad { color: #b91c1c; }
.check-result .op-added { background: #dcfce7; color: #14532d; padding: 0 2px; border-radius: 3px; }
.check-result .op-removed { background: #fee2e2; color: #7f1d1d; text-decoration: line-through; padding: 0 2px; border-radius: 3px; }
.check-result ul { margin: 6px 0; padding-left: 18px; }

/* responsive */
@media (max-width: 800px) {
  .nav { display: none; }
  .layout { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 24px 16px; }
  .content-grid { grid-template-columns: 1fr; }
  .editor { grid-template-columns: 1fr; }
  .editor-pane + .editor-pane { border-left: 0; border-top: 1px solid var(--line); }
  .benefits { gap: 8px; }
  .topbar { padding: 0 16px; }
  .container { padding: 28px 16px; }
  .welcome { align-items: flex-start; gap: 15px; flex-direction: column; }
  .field-grid { grid-template-columns: 1fr; }
}
@media (max-width: 520px) {
  .generator-row { flex-direction: column; }
  .stats { grid-template-columns: 1fr; }
  .benefits { grid-template-columns: 1fr; }
  .two-fields { grid-template-columns: 1fr; }
  .editor-pane { padding: 20px; }
}

/* ---- account login modal ---- */
.auth-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 1000; }
.auth-card {
  position: fixed; z-index: 1001; top: 50%; left: 50%; transform: translate(-50%,-50%);
  width: min(420px, calc(100vw - 32px)); max-height: calc(100vh - 40px); overflow: auto;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(15,23,42,.25); padding: 26px;
}
.auth-x { position: absolute; top: 10px; right: 14px; border: 0; background: transparent; font-size: 22px; color: var(--muted); line-height: 1; }
.auth-tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.auth-tab { flex: 1; padding: 10px; border: 0; border-bottom: 2px solid transparent; background: transparent; color: var(--muted); font-weight: 600; }
.auth-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.auth-title { margin: 0 0 16px; font-size: 18px; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form .field-label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; font-weight: 600; color: var(--ink); }
.auth-form .field { width: 100%; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; font-size: 14px; }
.auth-form .field:focus { outline: 2px solid var(--blue-soft); border-color: var(--blue); }
.auth-form .field-label .small { font-weight: 400; }
.auth-form .btn.primary { width: 100%; margin-top: 4px; }
.auth-msg { background: var(--blue-soft); color: var(--blue-dark); border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.5; }
.auth-link { display: block; width: 100%; margin-top: 12px; border: 0; background: transparent; color: var(--blue); font-size: 13px; }
.auth-link:hover { text-decoration: underline; }
.auth-sep { display: flex; align-items: center; gap: 10px; margin: 18px 0 12px; color: var(--muted); font-size: 12px; }
.auth-sep::before, .auth-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-google { display: flex; align-items: center; justify-content: center; width: 100%; border: 1px solid var(--line); background: #fff; }
.auth-google:hover { background: var(--bg); }
.auth-foot { margin-top: 16px; font-size: 12px; color: var(--muted); line-height: 1.5; }
body.auth-open { overflow: hidden; }

/* ---- signed-in account popover (topbar) ---- */
.btn[data-auth-open].is-signed { background: var(--blue-soft); color: var(--blue-dark); }
.auth-popover {
  position: absolute; z-index: 1100; min-width: 210px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 12px 36px rgba(15,23,42,.18); padding: 6px;
}
.auth-popover-mail { padding: 8px 10px; font-size: 12px; color: var(--muted); border-bottom: 1px solid var(--line); word-break: break-all; }
.auth-popover-item {
  display: block; width: 100%; text-align: left; padding: 9px 10px; margin: 0;
  border: 0; border-radius: 6px; background: transparent; color: var(--ink);
  font-size: 13px; text-decoration: none; cursor: pointer;
}
.auth-popover-item:hover { background: var(--bg); }

/* ---- subscription pricing ---- */
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin: 8px 0 16px; }
.plan-card { position: relative; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: 0 6px 20px rgba(15,23,42,.05); }
.plan-name { font-size: 15px; font-weight: 700; color: var(--ink); display: flex; align-items: center; gap: 10px; }
.plan-badge { background: var(--blue-soft); color: var(--blue-dark); font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; }
.plan-price { display: flex; align-items: baseline; gap: 6px; margin: 14px 0 4px; }
.plan-price strong { font-size: 40px; line-height: 1; color: var(--ink); }
.plan-price span { font-size: 14px; color: var(--muted); }
.plan-card .plan-cta { width: 100%; margin: 16px 0 18px; }
.plan-features { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.plan-features li { position: relative; padding-left: 22px; font-size: 13px; color: var(--ink); line-height: 1.5; }
.plan-features li::before { content: "✓"; position: absolute; left: 0; color: var(--green, #1D9E75); font-weight: 700; }
.plan-mock { text-align: center; margin-top: 4px; }
