/* ============================================================
   SEOSmith Design System — styles.css
   Style: warm cream, white cards, black buttons (Claude.ai-inspired)
   ============================================================ */

/* ── Custom Properties ── */
:root {
  color-scheme: light only;
  --bg:             #f5f3f0;
  --surface:        #ffffff;
  --surface-alt:    #efecea;
  --border:         #e4e0da;
  --border-focus:   #1a1a1a;

  --text-primary:   #1a1a1a;
  --text-secondary: #6b6863;
  --text-disabled:  #b0ada8;

  --accent:         #c96442;
  --accent-hover:   #b05435;

  --success-bg:     #d1fae5;
  --success-text:   #065f46;
  --error-bg:       #fee2e2;
  --error-text:     #991b1b;
  --warning-bg:     #fef3c7;
  --warning-text:   #92400e;

  --btn-bg:         #1a1a1a;
  --btn-text:       #ffffff;
  --btn-hover:      #2d2d2d;
}

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

body {
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text-primary);
}

/* ── Email verification banner ── */
.email-verify-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 10px 16px;
  background: #f59e0b;
  color: #1a1a1a;
  font-size: 13px;
  line-height: 1.4;
  flex-wrap: wrap;
}
.email-verify-banner.hidden { display: none; }
.email-verify-banner-text { flex: 1; min-width: 0; }
.email-verify-banner-btn {
  flex-shrink: 0;
  background: rgba(0,0,0,0.12);
  border: none;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  color: #1a1a1a;
}
.email-verify-banner-btn:hover { background: rgba(0,0,0,0.2); }
.email-verify-banner-btn:disabled { opacity: 0.5; cursor: default; }

/* ── Layout ── */
.app-layout,
.app-root {
  display: flex;
  height: 100vh;
  overflow: hidden;
}
body.has-verify-banner .app-root {
  height: calc(100vh - 40px);
  margin-top: 40px;
}

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  overflow-y: auto;
}

.sidebar-header {
  padding: 8px 12px;
  margin-bottom: 8px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
}

.logo-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  object-fit: contain;
  flex-shrink: 0;
}

.logo-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.2px;
}

.logo-subtitle {
  font-size: 11px;
  color: var(--text-secondary);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 14px;
  transition: background 0.1s;
}
.nav-item:hover  { background: var(--surface-alt); }
.nav-item.active { background: var(--surface); font-weight: 500; }

.content {
  flex: 1;
  overflow-y: auto;
  padding: 40px;
}
.content-inner { max-width: 760px; margin: 0 auto; }

.main {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
  position: relative;
}

.route-transition {
  position: absolute;
  inset: 0;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--bg);
  color: var(--text-secondary);
  font-size: 15px;
}

.route-transition-indicator {
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: route-transition-spin 0.8s linear infinite;
}

@keyframes route-transition-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .route-transition-indicator { animation: none; }
}

.main-header {
  flex-shrink: 0;
  padding: 32px 40px 0;
}

.main-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.main-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 0;
}

/* ── Typography ── */
h1 { font-size: 24px; font-weight: 600; line-height: 1.3; }
h2 { font-size: 18px; font-weight: 600; line-height: 1.3; }
h3 { font-size: 15px; font-weight: 600; }

.text-secondary { color: var(--text-secondary); }
.text-caption   { font-size: 12px; color: var(--text-secondary); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-full     { width: 100%; }

.btn-primary {
  background: var(--btn-bg);
  color: var(--btn-text);
}
.btn-primary:hover:not(:disabled) { background: var(--btn-hover); }

.btn-secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}
.btn-secondary:hover:not(:disabled) { background: var(--surface-alt); }

.btn-danger {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1.5px solid #fecaca;
}
.btn-danger:hover:not(:disabled) { background: #fecaca; }

.btn-sm { padding: 6px 12px; font-size: 13px; }

/* Legacy pill-button aliases */
.pill-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  border: none;
  transition: background 0.15s, opacity 0.15s;
  text-decoration: none;
  white-space: nowrap;
}
.pill-button:disabled { opacity: 0.45; cursor: not-allowed; }
.pill-button.primary {
  background: var(--btn-bg);
  color: var(--btn-text);
}
.pill-button.primary:hover:not(:disabled) { background: var(--btn-hover); }
.pill-button.secondary {
  background: var(--surface);
  color: var(--text-primary);
  border: 1.5px solid var(--border);
}
.pill-button.secondary:hover:not(:disabled) { background: var(--surface-alt); }
.pill-button.danger {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1.5px solid #fecaca;
}
.pill-button.danger:hover:not(:disabled) { background: #fecaca; }
.pill-button.wide { width: 100%; }

.link-button {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  font-family: inherit;
}
.link-button:hover { color: var(--accent-hover); text-decoration: underline; }
.link-button.small { font-size: 12px; }

/* ── Card ── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
}
.card.active-plan {
  border-color: var(--text-primary);
  border-width: 2px;
}

/* ── Input ── */
.input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.input:focus        { border-color: var(--border-focus); }
.input::placeholder { color: var(--text-disabled); }

/* Legacy field-input alias */
.field-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text-primary);
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s;
}
.field-input:focus        { border-color: var(--border-focus); }
.field-input::placeholder { color: var(--text-disabled); }

/* ── Form ── */
.form-group { display: flex; flex-direction: column; gap: 6px; }
.label      { font-size: 13px; font-weight: 500; color: var(--text-secondary); }
.error-msg  { font-size: 12px; color: var(--error-text); }

/* Legacy field classes */
.field        { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field-label  { font-size: 13px; font-weight: 500; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }
.settings-field-icon { width: 18px; height: 18px; border-radius: 4px; flex-shrink: 0; display: block; }
.field-error  {
  font-size: 12px;
  color: var(--error-text);
  background: var(--error-bg);
  border-radius: 6px;
  padding: 6px 10px;
}
.field-error.hidden { display: none; }
.field-hint         { font-size: 12px; color: var(--text-secondary); margin-top: 2px; }
.field-hint.hidden  { display: none; }

/* ── Consent Checkboxes ── */
.checkbox-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  user-select: none;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.checkbox-label input[type="checkbox"] {
  display: none;
}
.checkbox-box {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
  transition: border-color .15s, background .15s;
}
.checkbox-label input[type="checkbox"]:checked + .checkbox-box {
  border-color: var(--primary, #2563eb);
  background: var(--primary, #2563eb);
}
.checkbox-label input[type="checkbox"]:checked + .checkbox-box::after {
  content: '';
  width: 10px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg);
  margin-bottom: 2px;
}
.checkbox-box.error {
  border-color: var(--error-text, #dc2626);
}
.checkbox-label a {
  color: var(--primary, #2563eb);
  text-decoration: none;
}
.checkbox-label a:hover {
  text-decoration: underline;
}

.field-with-check {
  display: flex;
  align-items: center;
  gap: 8px;
}
.field-check {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.field-check.checked {
  background: var(--btn-bg);
  border-color: var(--btn-bg);
}
.field-check.checked::after {
  content: '';
  width: 10px;
  height: 6px;
  border-left: 2px solid #fff;
  border-bottom: 2px solid #fff;
  transform: rotate(-45deg) translateY(-1px);
  display: block;
}

.grid-two {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Progress bar ── */
.progress-bar {
  background: var(--border);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
}
.progress-fill,
.plan-progress-bar {
  height: 100%;
  border-radius: 4px;
  background: var(--text-primary);
  transition: width 0.3s;
}

/* Plan progress bar in sidebar */
.plan-progress {
  flex: 1;
  background: var(--border);
  border-radius: 4px;
  height: 4px;
  overflow: hidden;
}

/* ── Banner / Flash ── */
.banner {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}
.banner-success { background: var(--success-bg); color: var(--success-text); }
.banner-error   { background: var(--error-bg);   color: var(--error-text);   }
.banner-warning { background: var(--warning-bg); color: var(--warning-text); }

/* Flash banner (subscription page) */
#flash-banner {
  padding: 12px 16px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 14px;
  margin-bottom: 4px;
}
#flash-banner.success     { background: var(--success-bg); color: var(--success-text); }
#flash-banner.flash-error { background: var(--error-bg);   color: var(--error-text);   }

/* Quota / plan limit banner */
#quota-banner {
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--warning-bg);
  border: 1px solid #fde68a;
  font-size: 13px;
  color: var(--warning-text);
  margin-bottom: 8px;
}
#quota-banner a { color: var(--accent); font-weight: 500; }

.plan-limit-banner {
  padding: 14px 20px;
  background: var(--warning-bg);
  border: 1px solid #fde68a;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 20px 16px;
}
.plan-limit-banner.hidden { display: none; }
.plan-limit-text { font-size: 14px; color: var(--warning-text); }

/* ── Modal ── */
.overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.overlay.visible { display: flex; }

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.25);
}
.overlay-backdrop.dimmed { background: rgba(0, 0, 0, 0.35); }

.modal {
  position: relative;
  background: var(--surface);
  border-radius: 14px;
  padding: 28px;
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 20px;
  z-index: 1;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: var(--surface-alt);
  border: none;
  border-radius: 6px;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  transition: background 0.15s;
}
.modal-close:hover { background: var(--border); }

.modal-header { display: flex; flex-direction: column; gap: 6px; }
.modal-body   { display: flex; flex-direction: column; gap: 16px; }
.modal-footer { display: flex; gap: 8px; }

.modal-box {
  position: relative;
  background: var(--surface);
  border-radius: 14px;
  padding: 28px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 16px;
  z-index: 1;
}
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* AI Wizard pick-company modal — dark bento style */
#wizard-pick-modal .modal {
  background: var(--btn-bg);
  border: 1px solid rgba(255,255,255,0.08);
  box-shadow: 0 24px 64px rgba(0,0,0,0.5);
}
#wizard-pick-modal .modal-header h2 { color: #fff; }
#wizard-pick-modal .modal-header p  { color: rgba(255,255,255,0.55); font-size: 13px; }
#wizard-pick-modal .modal-close {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.6);
}
#wizard-pick-modal .modal-close:hover { background: rgba(255,255,255,0.15); }
.wizard-pick-item {
  display: block;
  width: 100%;
  padding: 12px 16px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.wizard-pick-item:hover {
  background: rgba(255,255,255,0.12);
  border-color: rgba(255,255,255,0.2);
}

/* Specific modal sizes */
.project-modal { max-width: 540px; }
.pricing-modal { max-width: 700px; }
.confirm-modal {
  max-width: 380px;
  text-align: center;
  align-items: center;
}
.confirm-modal-icon    { color: var(--text-secondary); }
.confirm-modal-title   { font-size: 17px; font-weight: 600; }
.confirm-modal-body    { font-size: 14px; color: var(--text-secondary); }
.confirm-modal-actions { display: flex; gap: 10px; justify-content: center; }
.modal-subtitle { font-size: 13px; color: var(--text-secondary); margin: 4px 0 12px; line-height: 1.5; }

/* Pricing grid */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.pricing-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pricing-card--featured {
  border-color: var(--text-primary);
  border-width: 2px;
}
.pricing-name      { font-size: 15px; font-weight: 600; }
.pricing-price-rub { font-size: 20px; font-weight: 700; }
.pricing-list {
  list-style: none;
  font-size: 13px;
  color: var(--text-secondary);
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}
.pricing-list li::before { content: '✓  '; color: var(--accent); }

/* ── Sidebar footer ── */
.sidebar-footer {
  margin-top: auto;
  padding-top: 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.plan-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.plan-summary-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  font-weight: 500;
}
.plan-summary-bottom {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* ── Account widget ── */
.article-model-wrapper { position: relative; }
.sidebar-unpaid-notice {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  margin-top: 8px;
  margin-bottom: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
  font-family: inherit;
  box-sizing: border-box;
  transition: background .15s, border-color .15s;
}
.sidebar-unpaid-notice:hover {
  background: var(--surface-alt);
  border-color: var(--text-secondary);
}
.sidebar-unpaid-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #e07b39;
  flex-shrink: 0;
}
.sidebar-unpaid-text {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-unpaid-action {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent, #e07b39);
  white-space: nowrap;
}
.article-model-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: background .15s, border-color .15s;
}
.article-model-button:hover,
.article-model-button[aria-expanded="true"] { background: var(--surface-alt); border-color: var(--text-secondary); }
.article-model-button-copy { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.article-model-label { font-size: 11px; color: var(--text-secondary); }
.article-model-current-row { display: flex; align-items: center; gap: 6px; min-width: 0; }
.article-model-current { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 500; }
.article-model-current-top,
.article-model-recommended-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #ede8ff;
  color: #5937a3;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
}
.article-model-current-top { padding: 2px 5px; }
.article-model-current-top[hidden] { display: none; }
.article-model-recommended-badge { padding: 3px 6px; }
.article-model-icon {
  display: block;
  width: 22px;
  height: 22px;
  flex: 0 0 22px;
  padding: 2px;
  border-radius: 6px;
  background: #fff;
  object-fit: contain;
}
.article-model-current-icon { width: 18px; height: 18px; flex-basis: 18px; padding: 1px; }
.article-model-chevron { flex: 0 0 auto; color: var(--text-secondary); transition: transform .15s; }
.article-model-button[aria-expanded="true"] .article-model-chevron { transform: rotate(180deg); }
.article-model-menu {
  position: absolute;
  z-index: 11;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,.10);
}
.article-model-menu.hidden { display: none; }
.article-model-option {
  display: flex;
  position: relative;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  padding: 9px 25px 9px 10px;
  border: 0;
  border-radius: 5px;
  background: none;
  color: var(--text-primary);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.article-model-option:hover,
.article-model-option[aria-checked="true"] { background: var(--surface-alt); }
.article-model-option[aria-checked="true"]::after { content: "✓"; position: absolute; top: 10px; right: 9px; font-size: 14px; font-weight: 700; }
.article-model-option--recommended,
.article-model-option--recommended[aria-checked="true"] { background: #f7f4ff; box-shadow: inset 0 0 0 1px #e2d9ff; }
.article-model-option--recommended:hover { background: #eee8ff; }
.article-model-option-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.article-model-option-title { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.article-model-option-name { font-size: 13px; font-weight: 500; }
.article-model-option-recommendation { font-size: 11px; font-weight: 600; color: #6945aa; }
.article-model-option-cost { font-size: 11px; color: var(--text-secondary); }
.article-model-option-lock { font-size: 11px; color: var(--accent); }
.article-model-option:disabled { cursor: not-allowed; opacity: .72; }
.article-model-option:disabled:hover { background: none; }
.account-wrapper  { position: relative; }
.account-button {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  background: none;
  border: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s;
  text-align: left;
}
.account-button:hover { background: var(--surface-alt); }
.account-avatar {
  width: 28px;
  height: 28px;
  background: var(--btn-bg);
  color: var(--btn-text);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
}
.account-email { font-size: 13px; font-weight: 500; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 140px; }
.account-label { font-size: 11px; color: var(--text-secondary); }

.account-popup {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,.08);
  overflow: visible;
  z-index: 10;
}
.account-popup.hidden { display: none; }
.account-popup-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text-primary);
  transition: background 0.1s;
}
.account-popup-item:hover       { background: var(--surface-alt); }
.account-popup-item:first-child { border-radius: 7px 7px 0 0; }
.account-popup-item:last-child  { border-radius: 0 0 7px 7px; }
.account-popup-item:only-child  { border-radius: 7px; }
.account-popup-item.logout      { color: var(--error-text); }

/* ── Account popup: Help submenu ── */
.account-popup-item-label { flex: 1; }
.account-popup-item-icon  { flex-shrink: 0; display: flex; align-items: center; color: var(--text-secondary); }
.account-popup-item-ext-icon { flex-shrink: 0; display: flex; align-items: center; opacity: 0.45; }
.account-popup-item-ext-icon img { display: block; }

.account-popup-help {
  position: relative;
  cursor: pointer;
  user-select: none;
}
.account-popup-help-arrow {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  transition: transform 0.2s ease;
}
.help-arrow-icon { display: block; opacity: 0.5; }
.account-popup-help:hover .help-arrow-icon,
.account-popup-help.open  .help-arrow-icon { opacity: 1; }

/* Submenu (portal — appended to body, positioned via JS) */
.account-help-submenu {
  position: fixed;
  min-width: 230px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,.14);
  overflow: hidden;
  z-index: 9999;
  transform-origin: left center;
  transform: scaleX(0.85) translateX(-8px);
  opacity: 0;
  pointer-events: none;
  transition: transform 0.2s ease, opacity 0.2s ease;
}
.account-help-submenu.open {
  transform: scaleX(1) translateX(0);
  opacity: 1;
  pointer-events: auto;
}
.account-help-submenu-item {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--text-primary);
  transition: background 0.1s;
}
.account-help-submenu-item:hover { background: var(--surface-alt); }

/* Arrow rotate when open */
.account-popup-help.open .account-popup-help-arrow,
.account-popup-help:hover .account-popup-help-arrow {
  transform: rotate(0deg);
}

/* Mobile: submenu becomes full overlay-style below trigger */
@media (max-width: 600px) {
  .account-help-submenu {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: auto;
    top: auto;
    width: auto;
    min-width: 0;
    border-radius: 10px;
    transform: translateY(6px);
    transition: transform 0.2s ease, opacity 0.2s ease;
  }
  .account-popup-help.open .account-help-submenu,
  .account-popup-help:focus-within .account-help-submenu {
    transform: translateY(0);
  }
  .account-help-submenu-item { padding: 14px 16px; font-size: 14px; }
}

/* ── Legal pages ── */
.legal-page {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.6;
}
.legal-header {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
}
.legal-header .logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}
.legal-header .logo-icon { width: 28px; height: 28px; display: block; }
.legal-header .logo-title { font-size: 15px; font-weight: 700; color: var(--text-primary); }
.legal-header .logo-subtitle { font-size: 11px; color: var(--text-secondary); }
.legal-content {
  max-width: 760px;
  margin: 48px auto;
  padding: 0 24px 80px;
}
.legal-content h1 { font-size: 26px; font-weight: 700; margin-bottom: 8px; }
.legal-content .legal-date { font-size: 12px; color: var(--text-secondary); margin-bottom: 32px; }
.legal-content h2 { font-size: 16px; font-weight: 600; margin: 28px 0 8px; }
.legal-content p  { margin-bottom: 12px; }
.legal-content ul { padding-left: 20px; margin-bottom: 12px; }
.legal-content li { margin-bottom: 4px; }
.legal-content a  { color: var(--accent); text-decoration: underline; }

/* ── Sidebar sections ── */
.sidebar-section { margin-top: 8px; }
.sidebar-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 12px;
  margin-bottom: 4px;
}
.sidebar-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}

.sidebar-new-article      { margin: 8px 0; font-size: 14px; }
.sidebar-new-article-icon { font-size: 18px; line-height: 1; }

/* Upsell banner */
.sidebar-upsell {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 8px;
}
.sidebar-upsell.hidden { display: none; }
.upsell-icon    { font-size: 18px; flex-shrink: 0; }
.upsell-content { flex: 1; min-width: 0; }
.upsell-title   { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.upsell-text    { font-size: 11px; color: var(--text-secondary); }
.upsell-button {
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Projects list ── */
.projects-list { display: flex; flex-direction: column; gap: 2px; }
.project-empty { font-size: 13px; color: var(--text-secondary); padding: 8px 12px; }

.project-item {
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.1s;
}
.project-item:hover                        { background: var(--surface-alt); }
.project-item-active                       { background: var(--surface); border-left: 3px solid var(--accent); padding-left: 7px; }
.project-item-active .project-name         { font-weight: 600; }

.project-item-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 8px 10px 6px;
  gap: 6px;
}
.project-item-info { flex: 1; min-width: 0; }
.project-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.project-url {
  font-size: 11px;
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── 3-dot menu ── */
.project-item-menu-wrap {
  position: relative;
  flex-shrink: 0;
}
.btn-item-dots {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-disabled);
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 16px;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s, background 0.1s, color 0.15s;
}
.project-item:hover .btn-item-dots { opacity: 1; }
.btn-item-dots:hover                { background: var(--surface-alt); color: var(--text-primary); }

.project-item-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  z-index: 50;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  min-width: 148px;
  padding: 4px 0;
  margin-top: 2px;
}
.project-item-dropdown-item {
  display: block;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-size: 13px;
  color: var(--text-primary);
  padding: 7px 14px;
  transition: background 0.1s;
}
.project-item-dropdown-item:hover         { background: var(--surface-alt); }
.project-item-dropdown-item.danger        { color: var(--error-text); }
.project-item-dropdown-item.danger:hover  { background: var(--error-bg, #fef2f2); }

.project-item-topics {
  display: block;
  font-size: 12px;
  color: var(--accent);
  padding: 2px 10px 6px 10px;
  text-decoration: none;
  opacity: 0.85;
}
.project-item-topics:hover { opacity: 1; text-decoration: underline; }

/* ── Chat list ── */
.chat-list { list-style: none; padding: 0 4px 6px; }
.chat-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  gap: 4px;
  transition: background 0.1s;
}
.chat-list-item:hover    { background: rgba(0,0,0,.04); }
.chat-list-item-title {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ── Chat area ── */
.chat-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 20px 40px;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding-bottom: 16px;
  align-items: center;
}
.chat-messages .project-view-header {
  width: 100%;
  max-width: 680px;
}
.chat-messages .message-row {
  width: 100%;
  max-width: 680px;
}

.message-row           { display: flex; gap: 12px; }
.message-row.user      { justify-content: flex-end; }
.message-row.assistant { justify-content: flex-start; }

.message-bubble {
  max-width: 80%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
}
.user .message-bubble {
  background: var(--btn-bg);
  color: var(--btn-text);
  border-bottom-right-radius: 3px;
}
.assistant .message-bubble {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 3px;
}

/* Typing indicator */
.typing-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-secondary);
  font-size: 13px;
}
.typing-dots       { display: flex; gap: 3px; align-items: center; }
.typing-dots span  {
  width: 5px; height: 5px;
  background: var(--text-disabled);
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}
.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes bounce {
  0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
  40%            { transform: scale(1.1); opacity: 1;   }
}

/* ── Chat input ── */
.chat-input-wrapper {
  flex-shrink: 0;
  margin-top: auto;
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.chat-input-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.03);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.chat-input-row:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--border-focus) 12%, transparent);
}

.chat-input {
  width: 100%;
  background: none;
  border: none;
  outline: none;
  resize: none;
  font-size: 15px;
  font-family: inherit;
  color: var(--text-primary);
  line-height: 1.55;
  min-height: 48px;
  /* Seven 21px text lines (14px × 1.5 line-height). */
  max-height: 147px;
  overflow-y: auto;
  padding: 1px 2px;
}
.chat-input::placeholder { color: var(--text-disabled); }

.chat-input-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 32px;
  gap: 12px;
}
.chat-input-actions {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}
.chat-input-action {
  display: inline-flex;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.chat-input-action:hover,
.chat-input-action:focus-visible {
  background: var(--surface-alt);
  color: var(--text-primary);
}
.chat-input-action:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 1px;
}
.chat-input-action[hidden] { display: none; }
.chat-input-hint {
  padding-left: 2px;
  color: var(--text-disabled);
  font-size: 11px;
  line-height: 1.3;
  user-select: none;
}
.editorial-skills-input-row #chat-view-editorial-skills,
.editorial-skills-input-row .chat-input-hint { display: none; }

.send-button {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--btn-bg);
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, opacity 0.15s;
}
.send-button:hover:not(:disabled) { background: var(--btn-hover); }
.send-button:disabled { opacity: 0.35; cursor: not-allowed; }
.send-icon { color: #fff; flex-shrink: 0; font-size: 18px; line-height: 1; }
.send-button--stop { background: var(--accent); }
.send-button--stop:hover { background: var(--btn-hover); }
.send-button--stop .send-icon { font-size: 16px; }

/* ── Intent selector ── */
.intent-selector {
  padding: 10px 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 12px;
}
.intent-selector.hidden { display: none; }
.intent-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  display: block;
  margin-bottom: 8px;
}
.intent-options { display: flex; flex-wrap: wrap; gap: 6px; }
.intent-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.intent-btn:hover  { border-color: var(--text-primary); color: var(--text-primary); }
.intent-btn.active {
  background: var(--btn-bg);
  border-color: var(--btn-bg);
  color: var(--btn-text);
}

/* ── Empty state ── */
.chat-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  gap: 16px;
  text-align: center;
  padding: 40px;
}
.chat-empty-text { font-size: 15px; color: var(--text-secondary); max-width: 340px; }
.chat-empty-btn {
  width: auto;
  height: auto;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  background: var(--accent, var(--btn-bg));
  color: #fff;
  white-space: nowrap;
}

/* ── Topic cards ── */
.topic-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.topic-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.topic-card:hover {
  border-color: var(--text-primary);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.topic-title { font-size: 13px; font-weight: 500; margin-bottom: 4px; }
.topic-meta  { font-size: 11px; color: var(--text-secondary); }

/* ── Article result ── */
.article-result { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.article-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.article-section--analysis { background: var(--surface-alt); }
.article-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}
.article-section-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
}
.article-section-body {
  padding: 14px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-primary);
  white-space: pre-wrap;
  word-break: break-word;
}

.copy-button {
  background: none;
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  color: var(--text-secondary);
  font-family: inherit;
  transition: background 0.1s;
}
.copy-button:hover { background: var(--border); }

.analysis-blocks { list-style: none; display: flex; flex-direction: column; gap: 3px; }
.analysis-block  { font-size: 13px; }
.analysis-block--h1 { font-weight: 700; }
.analysis-block--h2 { padding-left: 14px; }
.analysis-block--h3 { padding-left: 28px; color: var(--text-secondary); }


.jsonld-block {
  background: var(--bg);
  border-radius: 6px;
  padding: 12px;
  font-size: 12px;
  font-family: ui-monospace, monospace;
  overflow-x: auto;
  white-space: pre;
}

.links-table { width: 100%; border-collapse: collapse; font-size: 13px; table-layout: fixed; }
.links-table td:nth-child(1) { width: 89%; }
.links-table td:nth-child(2) { width: 9%; }
.links-table td:nth-child(3) { width: 2%; }
.links-table th {
  text-align: left;
  padding: 6px 10px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid var(--border);
}
.links-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  word-break: break-all;
}
.links-table tr:last-child td { border-bottom: none; }

/* ── Spinner ── */
.spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-top-color: var(--text-primary);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Company delete modal */
.del-company-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.del-company-box {
  position: relative;
  background: var(--surface);
  border-radius: 14px;
  padding: 28px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,.14);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  z-index: 1;
}
.del-company-icon  { color: var(--text-secondary); }
.del-company-title { font-size: 16px; font-weight: 600; }
.del-company-body  { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.del-company-error {
  font-size: 12px;
  color: var(--error-text);
  background: var(--error-bg);
  border-radius: 6px;
  padding: 6px 10px;
  width: 100%;
}
.del-company-error.hidden { display: none; }
.del-company-actions      { display: flex; gap: 8px; justify-content: center; }

.del-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-right: 6px;
  vertical-align: middle;
}

/* ── Project modal specifics ── */
.project-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px 0;
  min-height: 320px;
}
.project-loading.hidden    { display: none; }
.project-loading-text      { text-align: center; }
.project-loading-text h3   { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.project-loading-text p    { font-size: 13px; color: var(--text-secondary); }
#thrust-canvas             { border-radius: 12px; box-shadow: 0 4px 20px rgba(26,26,26,0.1); }

/* ── Slider (addon packs) ── */
#addon-slider {
  width: 100%;
  accent-color: var(--text-primary);
  height: 4px;
}
#slider-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
}
#slider-ticks span {
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}
#slider-ticks span.active { color: var(--text-primary); font-weight: 600; }

@media (max-width: 480px) {
  #slider-ticks span:nth-child(2),
  #slider-ticks span:nth-child(3),
  #slider-ticks span:nth-child(5),
  #slider-ticks span:nth-child(6) { display: none; }
}

/* Plan card (subscription page) */
.plan-card {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 20px;
}
.plan-card.active-plan { border-color: var(--text-primary); border-width: 2px; }

/* ── Mobile ── */
@media (max-width: 767px) {
  .sidebar { display: none; }
  .chat-container { padding: 12px 16px; }
  .main-header { padding: 20px 16px 0; }
}

/* ── Utility ── */
.hidden  { display: none !important; }
.divider { border: none; border-top: 1px solid var(--border); margin: 24px 0; }
.stack   { display: flex; flex-direction: column; gap: 16px; }
.row     { display: flex; gap: 12px; align-items: center; }

/* ── Article Blocks ── */
.article-blocks {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 16px 0;
}

.article-disclaimer {
  padding: 0 16px;
  font-size: 12px;
  color: var(--text-muted, #888);
  font-style: italic;
}

.article-setup-banner {
  display: flex;
  align-items: center;
  gap: 16px;
  background: linear-gradient(135deg, #fff8f0 0%, #fff3e8 100%);
  border: 1px solid #f0c080;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
}

.settings-business-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.settings-business-heading .settings-section-title { margin: 0; }
.settings-business-hint { margin: 0 0 20px; color: var(--text-secondary); font-size: 13px; line-height: 1.5; }
.settings-business-status { margin: 0 0 20px; padding: 12px 14px; border-radius: 8px; background: var(--surface); font-size: 13px; line-height: 1.5; }
.settings-business-status.is-error { background: var(--error-bg); color: var(--error-text); }

.article-setup-banner-icon {
  font-size: 28px;
  flex-shrink: 0;
}

.article-setup-banner-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.article-setup-banner-text strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #111);
}

.article-setup-banner-text span {
  font-size: 13px;
  color: var(--text-secondary, #666);
  line-height: 1.4;
}

.article-setup-banner-btn {
  flex-shrink: 0;
  display: inline-block;
  background: var(--accent, #e07a30);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  padding: 9px 18px;
  border-radius: 8px;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.15s;
}

.article-setup-banner-btn:hover {
  opacity: 0.87;
}

.article-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  margin-bottom: 32px;
}

/* Label badge above content — no grey strip */
.article-block-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 0;
  background: transparent;
  border-bottom: none;
}

.article-block-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.article-block-title {
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Block number prefix — terracotta */
.article-block-num {
  color: #c0604a;
  font-weight: 600;
  margin-right: 6px;
}

.article-block-body {
  padding: 8px 16px 16px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-primary);
}

.article-block-body pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  line-height: 1.5;
  tab-size: 2;
  background: var(--surface-alt);
  padding: 12px 14px;
  border-radius: 8px;
  overflow-x: auto;
}

.copy-btn {
  border: none;
  padding: 4px 6px;
  cursor: pointer;
  background: transparent;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.copy-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Block 3: per-element rows */
.body-element-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
}

.body-element-content {
  flex: 1;
  min-width: 0;
}

.body-element-content a {
  color: var(--accent, #e55a2b);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.body-element-content blockquote {
  margin: 4px 0;
  padding: 10px 16px;
  border-left: 3px solid var(--accent, #e55a2b);
  background: transparent;
  color: var(--text-secondary, #6b7280);
  font-style: italic;
  line-height: 1.6;
}

/* Case study block (heading + blockquote merged) */
.case-block {
  border-left: 3px solid var(--accent, #e55a2b);
  padding: 10px 16px;
  margin: 12px 0 4px;
}
.case-block-title {
  margin: 0 0 6px;
  font-weight: 700;
  font-size: 15px;
  color: var(--text-primary, #111827);
  font-style: normal;
  line-height: 1.4;
}
.case-block-body {
  margin: 0;
  color: var(--text-secondary, #6b7280);
  font-style: italic;
  line-height: 1.6;
  font-size: 14px;
}

/* Author quote block */
.author-quote-wrap {
  border-left: 3px solid var(--accent, #e55a2b);
  padding: 12px 16px;
  margin: 20px 0 4px;
  background: var(--bg-secondary, #f9fafb);
  border-radius: 0 6px 6px 0;
}
.author-quote-text {
  margin: 0 0 8px;
  font-style: italic;
  color: var(--text-primary, #111827);
  line-height: 1.6;
  font-size: 15px;
}
.author-quote-attrib {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted, #9ca3af);
  font-style: normal;
}

/* Block 0: Анализ — тихий мета-ряд */
.analysis-meta {
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
  padding: 4px 2px;
  font-size: 11px;
  color: var(--text-muted, #9ca3af);
  line-height: 1.4;
}

.analysis-meta-label {
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10px;
  color: var(--text-muted, #9ca3af);
}

.analysis-meta-info {
  color: var(--text-muted, #9ca3af);
}

.analysis-meta-details {
  display: inline;
  font-size: 11px;
  color: var(--text-muted, #9ca3af);
}

.analysis-meta-details summary {
  display: inline;
  cursor: pointer;
  text-decoration: underline dotted;
  text-underline-offset: 2px;
  list-style: none;
  color: var(--text-muted, #9ca3af);
}

.analysis-meta-details summary::-webkit-details-marker { display: none; }

.analysis-meta-details[open] { display: block; }

.analysis-meta-details[open] .heading-tree {
  margin-top: 4px;
}

/* Block 0: heading tree */
.heading-tree {
  list-style: none;
  padding-left: 0;
  margin: 0;
}

.heading-tree li {
  position: relative;
  padding: 2px 0;
  color: var(--text-secondary);
  font-size: 12px;
}

.heading-tree li::before {
  content: "·";
  color: var(--text-secondary);
  margin-right: 6px;
  opacity: 0.5;
}

.heading-tree .level-H1 { padding-left: 0; font-weight: 600; color: var(--text-primary); }
.heading-tree .level-H2 { padding-left: 16px; }
.heading-tree .level-H3 { padding-left: 32px; }

/* Block 4: FAQ */
.faq-item { margin-bottom: 12px; }
.faq-question { font-weight: 600; margin-bottom: 4px; }
.faq-answer { color: var(--text-secondary); }

/* Block 5: META fields */
.meta-field {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
.meta-field:last-child { border-bottom: none; }
.meta-label { font-weight: 600; min-width: 100px; font-size: 12px; color: var(--text-secondary); }
.meta-value { flex: 1; min-width: 0; }


/* Block 9: links table */
.links-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}
.links-table td {
  padding: 8px 6px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
.links-table tr:last-child td { border-bottom: none; }

/* ── Views ── */
.view { display: flex; flex-direction: column; flex: 1; overflow: hidden; position: relative; }
.view.hidden { display: none !important; }
#view-catalog-edit, #view-cta { overflow-y: auto; }

/* ── Dashboard: empty state ── */
.dashboard-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 40px;
}

/* ── Dashboard: has projects ── */
.dashboard-has-projects {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px;
  max-width: 640px;
  margin: 0 auto;
  width: 100%;
}
.dashboard-project-logo-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 16px;
}
.dashboard-project-logo {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: contain;
  border: 1px solid var(--border);
}
.dashboard-project-logo-fallback {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--btn-bg);
  color: var(--btn-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}
.dashboard-project-prompt {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
}
.dashboard-chat-input { width: 100%; }

/* ── Bento Dashboard ── */
.dashboard-bento {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: 
    minmax(380px, 1.5fr)
    minmax(280px, 1.1fr)
    minmax(180px, 0.7fr);
  gap: 14px;
  padding: 28px 32px 40px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
}

/* explicit card placement — 3-row layout */
.bento-traffic    { grid-column: 1 / 4; grid-row: 1; }
.bento-counter    { grid-column: 4;     grid-row: 1; }
.bento-wizard-card  { grid-column: 1;     grid-row: 2; }
.bento-recent-card  { grid-column: 2 / 4; grid-row: 2; }
.bento-score-card   { grid-column: 4;     grid-row: 2; }
.bento-sub-card      { grid-column: 1 / 3; grid-row: 3; }
.bento-keywords-card { grid-column: 3 / 5; grid-row: 3; }

/* base card */
.bento-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
  align-self: stretch;
  position: relative;
}
.bento-card-eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
}
.bento-card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}
.bento-card-link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  margin-top: auto;
  transition: color 0.15s;
}
.bento-card-link:hover { color: var(--accent-hover); text-decoration: underline; }

/* Traffic Growth card */
.bento-traffic {
  background: var(--surface);
  position: relative;
}
.bento-traffic-disclaimer {
  align-self: flex-end;
  font-size: 10px;
  color: var(--text-secondary);
  opacity: 0.7;
}
.bento-traffic-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.bento-traffic-axis-label {
  font-size: 10px;
  color: var(--text-disabled);
  white-space: nowrap;
}
.bento-traffic-svg-wrap {
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 180px;
  position: relative;
  overflow: hidden;
  border-radius: 10px;
}
.bento-traffic-footer {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  margin-top: -4px;
}

/* Interactive chart inspired by Spell UI. */
.bento-traffic-chart {
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  touch-action: none;
}
.bento-traffic-chart-hitarea { cursor: crosshair; }
.bento-traffic-chart-baseline,
.bento-traffic-chart-guide { vector-effect: non-scaling-stroke; }
.bento-traffic-chart-baseline { stroke: var(--border); stroke-width: 1; }
.bento-traffic-chart-guide {
  stroke: color-mix(in srgb, var(--accent) 32%, var(--border));
  stroke-width: 1;
  stroke-dasharray: 3 4;
}
.bento-traffic-chart-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}
.bento-traffic-chart-area { fill: url(#bento-traffic-gradient); }
.bento-traffic-chart-dot {
  fill: var(--surface);
  stroke: var(--accent);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  transition: r 0.16s ease, fill 0.16s ease;
}
.bento-traffic-chart-dot.is-active { fill: var(--accent); }
.bento-traffic-chart-label {
  fill: var(--text-secondary);
  font-family: inherit;
  font-size: 11px;
}
.bento-traffic-chart-tooltip {
  position: absolute;
  z-index: 2;
  display: flex;
  min-width: 112px;
  flex-direction: column;
  gap: 2px;
  padding: 9px 11px;
  border: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 8px 22px rgba(24, 24, 24, 0.11);
  color: var(--text-primary);
  pointer-events: none;
  transform: translate(-50%, calc(-100% - 12px));
  transition: left 0.16s ease, top 0.16s ease, transform 0.16s ease;
  backdrop-filter: blur(8px);
}
.bento-traffic-chart-tooltip.is-below { transform: translate(-50%, 12px); }
.bento-traffic-chart-tooltip-name {
  color: var(--text-secondary);
  font-size: 10px;
  line-height: 1.2;
}
.bento-traffic-chart-tooltip-value {
  font-size: 16px;
  font-weight: 650;
  line-height: 1.1;
}
.bento-traffic-chart-tooltip-meta {
  color: var(--text-disabled);
  font-size: 10px;
  line-height: 1.2;
}
.bento-traffic-svg-wrap:focus-visible {
  outline: 2px solid var(--border-focus);
  outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
  .bento-traffic-chart-tooltip,
  .bento-traffic-chart-dot { transition: none; }
}

/* Articles Counter card */
.bento-counter-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.bento-company-switcher {
  position: relative;
  flex-shrink: 0;
}
.bento-company-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 11px;
  color: var(--text-secondary);
  cursor: pointer;
  white-space: nowrap;
  max-width: 110px;
  transition: background 0.15s;
}
.bento-company-btn:hover { background: var(--surface-alt); }
.bento-company-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 80px;
  display: block;
}
.bento-company-dropdown {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  min-width: 150px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.10);
  z-index: 100;
  overflow: hidden;
}
.bento-company-dropdown-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  font-size: 12px;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: background 0.12s;
}
.bento-company-dropdown-item:hover { background: var(--surface-alt); }
.bento-company-dropdown-item.active { font-weight: 600; color: var(--accent); }

.bento-big-num {
  font-size: 52px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  letter-spacing: -2px;
}
.bento-counter-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: -4px;
}
.bento-mini-bar-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 2px;
}
.bento-mini-bar {
  height: 4px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
}
.bento-mini-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.5s ease;
}
.bento-mini-label {
  font-size: 11px;
  color: var(--text-secondary);
}

/* AI Wizard card */
.bento-wizard-card {
  background: var(--btn-bg);
  border-color: transparent;
  overflow: hidden;
}
.wizard-star {
  position: absolute;
  border-radius: 50%;
  background: #fff;
  pointer-events: none;
}
.bento-wizard-card .bento-card-eyebrow { color: rgba(255,255,255,0.5); }
.bento-wizard-card .bento-card-title   { color: #fff; }
.bento-wizard-sparkle {
  font-size: 24px;
  line-height: 1;
  color: #fff;
  opacity: 0.9;
}
.bento-wizard-desc {
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  line-height: 1.5;
  flex: 1;
}
.bento-wizard-cta {
  display: inline-block;
  margin-top: auto;
  padding: 9px 16px;
  background: rgba(255,255,255,0.12);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
  align-self: flex-start;
}
.bento-wizard-cta:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.35);
}

/* Settings page — sidebar nav layout */
.settings-page-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.settings-sidebar-nav {
  width: 260px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 56px 0 32px 32px;
  background: var(--bg);
  overflow-y: auto;
}

.settings-sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  text-align: left;
  padding: 10px 14px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}

.settings-sidebar-nav-item:hover {
  background: var(--surface-alt);
  color: var(--text-primary);
}

.settings-sidebar-nav-item.active {
  background: var(--surface-alt);
  color: var(--text-primary);
  font-weight: 500;
}

.settings-sidebar-nav-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  color: inherit;
  opacity: 0.7;
}

/* Settings page — submenu */
.settings-submenu {
  display: flex;
  flex-direction: row;
  gap: 4px;
  padding: 0 0 12px 0;
  flex-wrap: wrap;
}
.settings-submenu-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  font-size: 13px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text-primary);
  text-decoration: none;
  transition: background 0.1s, border-color 0.1s;
}
.settings-submenu-item:hover {
  background: var(--surface);
  border-color: var(--border-focus, var(--accent));
}
.settings-submenu-icon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  color: var(--text-secondary);
}
.settings-submenu-label { flex: 1; }
.settings-submenu-item--soon { opacity: 0.55; cursor: default; }
.settings-submenu-item--soon:hover { background: var(--surface-alt); border-color: var(--border); }
.settings-submenu-soon {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-secondary);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 4px;
}

/* Settings page — AI Wizard banner */
.settings-wizard-banner {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--btn-bg);
  border: none;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.settings-wizard-banner.hidden { display: none; }
.settings-wizard-banner-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  font-weight: 600;
  color: #fff;
  line-height: 1.4;
}
.settings-wizard-banner-sparkle {
  font-size: 22px;
  color: #fff;
  opacity: 0.9;
  flex-shrink: 0;
  font-style: normal;
}
.settings-wizard-banner-bottom {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-left: calc(20px + 10px);
}
.settings-wizard-banner-desc {
  flex: 1;
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  line-height: 1.4;
  min-width: 0;
}

/* Recent Articles card */
.bento-recent-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}
.bento-recent-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  background: var(--surface-alt);
  border-radius: 8px;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.12s;
}
.bento-recent-item:hover { background: var(--border); }
.bento-recent-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bento-recent-date {
  font-size: 11px;
  color: var(--text-secondary);
}
.bento-empty-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0;
}

/* AI Score card — Accelerometer */
.bento-accel-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  margin: 4px 0 2px;
}
.bento-accel-svg {
  width: 100%;
  max-width: 130px;
  display: block;
  overflow: visible;
}
.bento-accel-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: -4px;
  line-height: 1;
}
.bento-accel-zone {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #9ca3af;
  margin-top: 2px;
}
.bento-accel-zone.zone-warn  { color: #f59e0b; }
.bento-accel-zone.zone-good  { color: #22c55e; }
.bento-score-hint {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 4px;
  text-align: center;
}

/* Subscription card */
.bento-plan-badge {
  display: inline-block;
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: capitalize;
}
.bento-sub-quota {
  font-size: 12px;
  color: var(--text-secondary);
}
.bento-addon-row {
  display: flex;
  align-items: center;
  gap: 5px;
}
.bento-addon-count {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
}
.bento-addon-label {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Keyword Coverage card */
.bento-keywords-source {
  font-size: 11px;
  color: var(--text-secondary);
  margin-top: -6px;
}
.bento-kw-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
  justify-content: center;
}
.bento-kw-metrics {
  display: flex;
  gap: 24px;
}
.bento-kw-metric {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.bento-kw-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -1px;
  line-height: 1;
}
.bento-kw-label {
  font-size: 11px;
  color: var(--text-secondary);
}
.bento-kw-top {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.bento-kw-empty {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0;
}

/* ── Sidebar logo with project logo ── */
.sidebar-logo-divider {
  width: 1px;
  height: 24px;
  background: var(--border);
  flex-shrink: 0;
}
.sidebar-project-logo {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  object-fit: contain;
  flex-shrink: 0;
}

/* ── Breadcrumbs ── */
.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 40px 10px;
  flex-shrink: 0;
}
.breadcrumb-link {
  font-size: 13px;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}
.breadcrumb-link:hover { color: var(--text-primary); text-decoration: underline; }
.breadcrumb-sep { font-size: 13px; color: var(--text-disabled); }
.breadcrumb-current { font-size: 13px; color: var(--text-primary); font-weight: 500; }
.wizard-restart-btn {
  position: relative;
  margin-left: auto;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-secondary);
  font-size: 18px;
  line-height: 1;
  padding: 5px 11px;
  cursor: pointer;
  transition: color 0.15s;
}
.wizard-restart-btn:hover {
  color: var(--accent);
}
.wizard-restart-btn::after {
  content: "Начать сначала";
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--text-primary);
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
  padding: 4px 8px;
  border-radius: 5px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.12s, transform 0.12s;
}
.wizard-restart-btn:hover::after {
  opacity: 1;
  transform: translateY(0);
}

/* ── Project view header ── */
.project-view-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 48px 40px 24px;
  flex-shrink: 0;
}
.project-view-logo {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  object-fit: contain;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.project-view-logo-fallback {
  width: 56px;
  height: 56px;
  border-radius: 12px;
  background: var(--btn-bg);
  color: var(--btn-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  flex-shrink: 0;
}
.project-view-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.3px;
  color: var(--text-primary);
  text-align: center;
}

/* ── Projects list view ── */
.projects-view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 32px 48px 16px 48px;
  flex-shrink: 0;
}
.projects-view-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}
.projects-view-list {
  padding: 0 48px 48px 48px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  overflow-y: auto;
}
.projects-view-empty {
  font-size: 14px;
  color: var(--text-secondary);
  grid-column: 1 / -1;
}
.projects-view-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.projects-view-card:hover {
  border-color: var(--accent, #2563eb);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.projects-view-card-logo {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: contain;
  border: 1px solid var(--border);
}
.projects-view-card-fallback {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--btn-bg);
  color: var(--btn-text);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
}
.projects-view-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}
.projects-view-card-url {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.projects-view-card-topics {
  font-size: 12px;
  color: var(--accent);
  margin-top: 6px;
  opacity: 0.85;
  cursor: pointer;
}
.projects-view-card-topics:hover { opacity: 1; text-decoration: underline; }

/* ── Add project card ── */
.projects-view-card-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 130px;
  border: 1.5px dashed var(--border);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.projects-view-card-add:hover {
  border-color: var(--text-primary);
  background: var(--surface-alt);
  box-shadow: none;
}
.projects-view-card-add--locked {
  border-color: var(--border);
}
.projects-view-card-add--locked:hover {
  border-color: var(--accent);
  background: var(--surface-alt);
}
.projects-view-card-add--locked .projects-view-add-circle--lock {
  border-color: var(--text-disabled);
  color: var(--text-disabled);
}
.projects-view-card-add--locked:hover .projects-view-add-circle--lock {
  border-color: var(--accent);
  color: var(--accent);
}
.projects-view-card-add--locked .projects-view-add-label {
  color: var(--text-disabled);
}
.projects-view-card-add--locked:hover .projects-view-add-label {
  color: var(--text-secondary);
}
.projects-view-add-upgrade {
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.projects-view-add-circle {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1.5px solid var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: border-color 0.15s, color 0.15s;
}
.projects-view-card-add:hover .projects-view-add-circle {
  border-color: var(--text-primary);
  color: var(--text-primary);
}
.projects-view-add-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
  transition: color 0.15s;
}
.projects-view-card-add:hover .projects-view-add-label {
  color: var(--text-primary);
}

/* ── Project hero (legacy, kept for dashboard view) ── */
.project-hero {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 40px;
  gap: 20px;
}
.project-hero-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
  max-width: 480px;
  margin: 0;
}
.project-hero-input {
  width: 100%;
  max-width: 560px;
}
.chat-error {
  font-size: 12px;
  color: var(--error-text, #dc2626);
  margin-top: 6px;
  text-align: center;
}
.chat-generating {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
}

/* ── Project chat layout ── */
.project-chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.project-launchpad {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 40px 24px;
  overflow-y: visible;
}
.project-launchpad-input {
  width: 100%;
  max-width: 680px;
  display: flex;
  flex-direction: column;
}
.project-chat-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 32px 40px 16px;
}
.chat-welcome {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
  gap: 16px;
  text-align: center;
}
.chat-welcome .project-hero-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--text-primary);
  text-align: center;
  max-width: 480px;
  margin: 0;
  line-height: 1.35;
}

/* ── Active starter topics mode (shown when creating project / picking first topics) ── */
#view-project.has-starter-topics .project-launchpad,
#view-project:has(#starter-topics:not(.hidden)) .project-launchpad {
  flex: 0 1 auto;
  min-height: 0;
  justify-content: flex-start;
  gap: 16px;
  padding: 12px 40px 20px;
  overflow: hidden;
}
#view-project.has-starter-topics .project-launchpad-input,
#view-project:has(#starter-topics:not(.hidden)) .project-launchpad-input {
  flex: 0 0 auto;
}
#view-project.has-starter-topics .chat-welcome,
#view-project:has(#starter-topics:not(.hidden)) .chat-welcome {
  flex: 0 0 auto;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 12px 40px 0;
}
#view-project.has-starter-topics .chat-welcome .project-hero-title,
#view-project:has(#starter-topics:not(.hidden)) .chat-welcome .project-hero-title {
  max-width: none;
  font-size: 22px;
  font-weight: 700;
  text-align: left;
}
#view-project.has-starter-topics .project-body-layout,
#view-project:has(#starter-topics:not(.hidden)) .project-body-layout {
  margin-top: 0;
}

/* ── First article ideas shown after project creation ── */
.starter-topics {
  display: flex;
  flex: 0 1 auto;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  max-width: 680px;
  margin: 0;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(37, 28, 24, 0.05);
  overflow: hidden;
}
.starter-topics-header {
  display: flex;
  flex: 0 0 auto;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.starter-topics-title {
  margin: 0;
  color: var(--text-primary);
  font-size: 16px;
  line-height: 1.35;
}
.starter-topics-subtitle,
.starter-topics-status {
  margin: 4px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.4;
}
.starter-topics-close {
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: transparent;
  color: var(--text-secondary);
  font: 20px/1 inherit;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.starter-topics-close:hover {
  border-color: var(--text-secondary);
  background: var(--surface-alt);
  color: var(--text-primary);
}
.starter-topics-list {
  display: grid;
  flex: 1 1 auto;
  min-height: 0;
  gap: 8px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
  max-height: min(44vh, 380px);
}
.starter-topic-row {
  display: grid;
  gap: 3px;
}
.starter-topic-dismiss {
  justify-self: end;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}
.starter-topic-card {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--bg, #fff);
  color: var(--text-primary);
  font: 500 14px/1.4 inherit;
  text-align: left;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s, background 0.15s;
}
.starter-topic-card .topic-purpose-badges {
  position: absolute;
  top: 12px;
  right: 14px;
}
.starter-topic-card:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 4%, var(--surface));
}
.starter-topic-card:disabled { opacity: 0.55; cursor: wait; transform: none; }
.starter-topic-content { display: grid; gap: 5px; min-width: 0; }
.starter-topic-title {
  font: 600 14px/1.4 inherit;
  padding-right: 74px;
}
.starter-topic-coverage-label {
  margin-top: 3px;
  color: var(--text-secondary);
  font: 600 11px/1.3 inherit;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.starter-topic-coverage {
  display: grid;
  gap: 2px;
  margin: 0;
  padding-left: 18px;
  color: var(--text-secondary);
  font: 400 12px/1.4 inherit;
}
.starter-topic-relevance { color: var(--text-secondary); font: 400 11px/1.35 inherit; }
.starter-topic-arrow { flex: 0 0 auto; color: var(--accent); font-size: 18px; }
.suggest-topics-btn--highlight {
  border-color: var(--accent);
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 8%, transparent);
  animation: starter-topics-highlight 0.75s ease 2;
}
.starter-topics-pointer {
  color: var(--accent);
  font-size: 12px;
  line-height: 1.35;
  animation: starter-topics-pointer-in 0.2s ease-out;
}
@keyframes starter-topics-highlight {
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
}
@keyframes starter-topics-pointer-in {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Gear button (project settings shortcut) ── */
.btn-project-settings {
  position: absolute;
  top: 8px;
  right: 16px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 8px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.15s;
}
.btn-project-settings:hover { background: var(--surface-alt); color: var(--text-primary); }

.project-settings-hint {
  position: absolute;
  top: 44px;
  right: 8px;
  z-index: 200;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  padding: 10px 36px 10px 12px;
  max-width: 220px;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-primary);
}
.project-settings-hint::before {
  content: "";
  position: absolute;
  top: -7px;
  right: 18px;
  width: 12px;
  height: 12px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transform: rotate(45deg);
}
.project-settings-hint-text { display: block; }
.project-settings-hint-competitors {
  display: block;
  margin-top: 6px;
  color: var(--accent);
  font-weight: 600;
}
.project-settings-hint-close {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  color: var(--text-secondary);
  padding: 0;
}
.project-settings-hint-close:hover { background: var(--surface-alt); color: var(--text-primary); }

.project-chat-input-area {
  flex-shrink: 0;
  padding: 12px 40px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.project-chat-input-area > * {
  width: 100%;
  max-width: 680px;
}

/* ── Suggest topics button ── */
.suggest-topics-bar {
  display: inline-flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.suggest-topics-btn {
  background: none;
  border: 1px dashed var(--border);
  border-radius: 20px;
  padding: 7px 16px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.suggest-topics-btn:hover {
  border-color: var(--btn-bg);
  color: var(--btn-bg);
  background: var(--hover-bg, rgba(0,0,0,0.03));
}
.suggest-topics-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-input-row { position:relative; }
.composer-mode-chips { display:flex; flex-wrap:wrap; gap:8px; padding:6px 10px 0; }
.composer-mode-chips:empty { display:none; }
.composer-mode-chip { display:inline-flex; align-items:center; gap:4px; min-height:30px; padding:0 8px; border-radius:8px; background:var(--surface-alt,#f4f4f4); color:var(--text-primary); font-size:13px; }
.composer-mode-chip button { min-width:36px; min-height:36px; border:0; background:transparent; color:inherit; cursor:pointer; font-size:18px; }
.composer-mode-menu { position:absolute; bottom:calc(100% + 8px); left:0; z-index:30; width:min(360px,calc(100vw - 32px)); padding:6px; border:1px solid var(--border); border-radius:12px; background:var(--surface,#fff); box-shadow:0 10px 30px rgba(0,0,0,.14); }
.composer-mode-menu-item { width:100%; min-height:44px; display:flex; flex-direction:column; justify-content:center; gap:2px; padding:8px 10px; border:0; border-radius:8px; background:transparent; color:var(--text-primary); text-align:left; cursor:pointer; }
.composer-mode-menu-item:hover,.composer-mode-menu-item:focus-visible { background:var(--surface-alt,#f3f3f3); outline:2px solid var(--accent,#e76d32); }
.composer-mode-menu-item strong { font-size:14px; }.composer-mode-menu-item small { font-size:12px; color:var(--text-secondary); }
.composer-mode-separator { height:1px; margin:5px 3px; background:var(--border); }
.chat-message-copy-style { display:block; margin:4px 0 10px auto; padding:5px 8px; border:0; background:transparent; color:var(--accent); font-size:12px; cursor:pointer; }
.writing-style-overlay { position:fixed; inset:0; z-index:1100; display:grid; place-items:center; padding:16px; background:rgba(0,0,0,.5); }
.writing-style-panel { box-sizing:border-box; width:min(720px,100%); max-height:calc(100vh - 32px); overflow:auto; padding:24px; border:1px solid var(--border); border-radius:14px; background:var(--surface,#fff); color:var(--text-primary); box-shadow:0 16px 48px rgba(0,0,0,.18); }
.writing-style-header { display:flex; align-items:center; justify-content:space-between; gap:12px; }.writing-style-header h2 { margin:0; }
.writing-style-close { border:0; background:transparent; font-size:24px; cursor:pointer; min-width:44px; min-height:44px; }
.writing-style-note,.writing-style-count { color:var(--text-secondary); font-size:13px; line-height:1.5; }
.writing-style-targets { display:flex; flex-wrap:wrap; gap:16px; margin:16px 0; }
.writing-style-source-note.is-experience { margin:4px 0 18px; padding:12px 14px; border:1px solid #f6d8c7; border-radius:10px; background:#fff8f3; color:var(--text-primary); }
.writing-style-sample,.writing-style-result,.writing-style-candidate { padding:12px 0; border-top:1px solid var(--border); }
.writing-style-sample .field-label,.writing-style-result .field-label { display:block; margin:8px 0; }
.writing-style-sample .field-input,.writing-style-result .field-input { display:block; width:100%; margin:6px 0 0; box-sizing:border-box; }
.writing-style-result h3 { margin:0 0 12px; }.writing-style-result button { margin:8px 8px 8px 0; }
.writing-style-status { min-height:1.4em; margin:8px 0; font-size:13px; }.writing-style-status.error { color:#a33128; }.writing-style-status.success { color:#1d7144; }
.writing-style-warning { color:#9a5a16; }.writing-style-link { border:0; background:transparent; color:var(--accent); cursor:pointer; }
.writing-style-settings-summary { white-space:pre-wrap; overflow-wrap:anywhere; margin:12px 0; font-size:14px; }
.writing-style-settings-actions { display:flex; flex-wrap:wrap; gap:14px; }
.writing-style-form-actions { display:flex; flex-wrap:wrap; align-items:center; gap:16px; margin-top:4px; }
.writing-style-form-actions .btn { min-height:44px; }
.writing-style-page-card { padding:32px; border:1px solid var(--border); border-radius:20px; }
.writing-style-page-heading { display:flex; align-items:flex-start; gap:16px; }
.writing-style-page-heading .settings-section-title { margin:1px 0 8px; font-size:20px; line-height:1.3; }
.writing-style-page-icon { display:grid; flex:none; place-items:center; width:40px; height:40px; border-radius:12px; background:#fff1e8; color:var(--accent); font-size:21px; }
.writing-style-page-hint { max-width:520px; margin:0; color:var(--text-secondary); font-size:14px; line-height:1.6; }
.writing-style-page-card .writing-style-settings-summary { margin:24px 0; padding:18px 20px; border:1px solid var(--border); border-radius:12px; background:var(--surface-alt); color:var(--text-primary); line-height:1.55; }
.writing-style-page-card .writing-style-settings-summary.is-empty { color:var(--text-secondary); }
.writing-style-summary-name { display:block; font-size:15px; }
.writing-style-page-card .writing-style-settings-summary p { margin:8px 0 0; color:var(--text-secondary); }
.writing-style-page-card .writing-style-settings-actions .pill-button { min-height:44px; }
.writing-style-page-card .writing-style-status:empty { display:none; }
.kb-experience-card details { margin-top:14px; }.kb-experience-card summary { cursor:pointer; min-height:44px; }
@media (max-width:480px) { .writing-style-page-card { padding:22px; }.writing-style-page-heading { gap:12px; }.writing-style-page-icon { width:36px; height:36px; } }
@media (max-width:480px) { .writing-style-panel { padding:16px; max-height:calc(100dvh - 24px); }.writing-style-overlay { padding:12px; } }
.editorial-slash-button { width:34px; height:34px; border:1px solid var(--border); border-radius:9px; background:var(--card-bg,#fff); color:var(--text-secondary); font-weight:700; cursor:pointer; }
.editorial-style-button { min-height:34px; padding:0 10px; border:1px solid var(--border); border-radius:9px; background:var(--surface,#fff); color:var(--text-primary); cursor:pointer; }
.editorial-skills-menu { position:absolute; left:0; bottom:calc(100% + 8px); z-index:20; width:min(360px,100%); padding:6px; border:1px solid var(--border); border-radius:12px; background:var(--card-bg,#fff); box-shadow:0 10px 30px rgba(0,0,0,.12); }
.editorial-skills-command { display:block; width:100%; padding:9px; border:0; border-radius:8px; background:transparent; color:var(--text-primary); text-align:left; cursor:pointer; }
.editorial-skills-command:hover { background:var(--hover-bg,#f5f5f5); }
.editorial-upgrade-button { margin-left:8px; border:0; border-radius:7px; padding:5px 9px; background:var(--btn-bg); color:var(--btn-text); font:inherit; font-weight:600; cursor:pointer; }
.editorial-skills-answer { white-space:pre-wrap; overflow-wrap:anywhere; }
.topics-counter {
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 4px;
  padding: 3px 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
}

/* ── Topic suggestion chips inside assistant bubble ── */
.chat-msg-bubble-assistant:has(.topic-chips-list) {
  width: 100%;
  max-width: 100%;
  padding: 22px;
  border-radius: 18px;
  border-bottom-left-radius: 18px;
  box-shadow: 0 10px 28px rgba(37, 28, 24, 0.05);
}
.topic-chips-header {
  margin-bottom: 16px;
}
.topic-chips-label {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
  color: var(--text-primary);
}
.topic-chips-note {
  margin: 5px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.45;
}
.topic-chips-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.topic-chip-row {
  position: relative;
}
.topic-chip-row:has(.topic-chip-actions[open]) {
  z-index: 10;
}
.topic-chip-row .topic-chip {
  width: 100%;
  min-width: 0;
}
.topic-chip {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  box-sizing: border-box;
  min-height: 104px;
  padding: 16px 58px 15px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.topic-chip:hover {
  border-color: var(--btn-bg);
  background: #fffdfb;
  box-shadow: 0 6px 18px rgba(37, 28, 24, 0.06);
}
.topic-chip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.topic-chip-selected {
  border-color: var(--btn-bg);
  background: #fffaf6;
}
.topic-chip-title {
  display: block;
  max-width: 800px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.35;
}
.topic-chip-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}
.topic-chip-kw {
  font-size: 12px;
  color: var(--text-secondary);
}
.topic-chip-coverage-label {
  margin-top: 4px;
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.topic-chip-coverage {
  display: grid;
  gap: 2px;
  margin: 0;
  padding-left: 17px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.4;
}
.topic-purpose-badges {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}
.topic-purpose-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 30px;
  min-height: 25px;
  padding: 0;
  border-radius: 999px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}
.topic-purpose-icon {
  display: inline-flex;
  width: 15px;
  height: 11px;
  flex: 0 0 auto;
}
.topic-purpose-icon svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}
.topic-purpose-icon--reach svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.topic-purpose-icon--sales {
  width: 16px;
  height: 14px;
}
.topic-purpose-icon--sales .gold-rays {
  fill: none;
  stroke: #ffc229;
  stroke-width: 2.4;
  stroke-linecap: round;
}
.topic-purpose-icon--sales .gold-main { fill: #ff9f05; }
.topic-purpose-icon--sales .gold-mid { fill: #ffad08; }
.topic-purpose-icon--sales .gold-light { fill: #ffc62e; }
.topic-purpose-icon--sales .gold-dark { fill: #ff9800; }
.topic-purpose-badge--reach {
  background: #f5f1ed;
}
.topic-purpose-badge--sales {
  background: #f5f1ed;
  color: var(--text-secondary);
}
.topic-chip-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 3;
}
.topic-chip-actions[open] {
  z-index: 20;
}
.topic-chip-actions-toggle {
  display: grid;
  place-items: center;
  box-sizing: border-box;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  list-style: none;
}
.topic-chip-actions-toggle::-webkit-details-marker {
  display: none;
}
.topic-chip-actions-toggle:hover,
.topic-chip-actions[open] .topic-chip-actions-toggle {
  background: var(--surface-alt);
  color: var(--text-primary);
}
.topic-chip-actions-menu {
  position: absolute;
  top: 42px;
  right: 0;
  width: 190px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: 0 12px 32px rgba(37, 28, 24, 0.14);
}
.topic-chip-actions-label {
  display: block;
  padding: 6px 9px 5px;
  color: var(--text-secondary);
  font-size: 11px;
  font-weight: 600;
}
.topic-chip-action {
  display: block;
  width: 100%;
  min-height: 38px;
  padding: 7px 9px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text-primary);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  text-align: left;
}
.topic-chip-action:hover:not(:disabled) {
  background: var(--surface-alt);
}
.topic-chip-action:disabled {
  opacity: 0.5;
  cursor: wait;
}

.topic-chip-badge {
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  white-space: nowrap;
}
.topic-chip-badge--competitive {
  background: #e8f4fd;
  color: #1a73e8;
  border: 1px solid #c5dff9;
}
.topic-chip-badge--catalog {
  background: #f0fdf4;
  color: #16a34a;
  border: 1px solid #bbf7d0;
}
.chat-msg-more-topics {
  justify-content: flex-start;
}
.topic-chips-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.more-topics-btn {
  border: 1px solid var(--btn-bg);
  border-radius: 999px;
  min-height: 40px;
  padding: 0 16px;
  background: transparent;
  color: var(--btn-bg);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}
.more-topics-btn:hover:not(:disabled) {
  background: var(--btn-bg);
  color: var(--btn-text);
}
.more-topics-btn:disabled {
  cursor: wait;
  opacity: 0.6;
}
@media (max-width: 767px) {
  .chat-msg-bubble-assistant:has(.topic-chips-list) {
    padding: 16px;
  }
  .topic-chip {
    width: 100%;
    min-height: 0;
    padding: 14px 50px 14px 14px;
  }
  .topic-chip-title {
    font-size: 15px;
  }
  .topic-chip-meta {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }
}

/* ── Chat message rows ── */
.chat-msg-row {
  display: flex;
  max-width: 680px;
  width: 100%;
  margin: 0 auto;
}
.chat-msg-user      { justify-content: flex-end; }
.chat-msg-assistant-bubble,
.chat-msg-assistant-chips,
.chat-msg-typing    { justify-content: flex-start; }

.chat-msg-bubble {
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.6;
  max-width: 80%;
}
.chat-msg-bubble-user {
  background: var(--btn-bg);
  color: var(--btn-text);
  border-bottom-right-radius: 3px;
}
.chat-msg-bubble-assistant {
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-left-radius: 3px;
  color: var(--text-primary);
}

.chat-msg-bubble-assistant:has(.chat-status-card) {
  background: transparent;
  border: none;
  padding: 0;
  max-width: min(100%, 560px);
}

.chat-status-card {
  background:
    radial-gradient(circle at top right, rgba(224, 111, 45, 0.1), transparent 38%),
    linear-gradient(180deg, #fffaf4 0%, #ffffff 100%);
  border: 1px solid #ead8c8;
  border-radius: 20px;
  padding: 18px 20px;
  box-shadow: 0 18px 40px rgba(72, 50, 33, 0.08);
}

.chat-status-card--quota {
  border-color: #efd39c;
}

.chat-status-card--expired {
  border-color: #f0c29a;
  background:
    radial-gradient(circle at top right, rgba(249, 115, 22, 0.12), transparent 40%),
    linear-gradient(180deg, #fff7f0 0%, #ffffff 100%);
}

.chat-status-card--temporary {
  border-color: #c9d8f5;
  background:
    radial-gradient(circle at top right, rgba(59, 130, 246, 0.12), transparent 42%),
    linear-gradient(180deg, #f8fbff 0%, #ffffff 100%);
}

.chat-status-card-badge {
  display: inline-flex;
  align-items: center;
  margin-bottom: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(122, 79, 47, 0.08);
  color: #8a4b1f;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chat-status-card-title {
  font-size: 20px;
  line-height: 1.2;
  font-weight: 700;
  color: #241814;
}

.chat-status-card-text {
  margin-top: 8px;
  color: #6b5b4f;
  font-size: 14px;
  line-height: 1.6;
}

.article-failure-state {
  max-width: 640px;
  padding: 40px;
}

.chat-status-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.chat-status-card-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.chat-status-card-link:hover {
  transform: translateY(-1px);
}

.chat-status-card-link-primary {
  background: #221f1d;
  color: #fffaf7;
  box-shadow: 0 10px 22px rgba(34, 31, 29, 0.16);
}

.chat-status-card-link-primary:hover {
  box-shadow: 0 14px 28px rgba(34, 31, 29, 0.2);
}

.chat-status-card-link-secondary {
  background: #ffffff;
  color: #8a4b1f;
  border: 1px solid #e5c8a9;
}

@media (max-width: 767px) {
  .chat-msg-bubble-assistant:has(.chat-status-card) {
    max-width: 100%;
    width: 100%;
  }

  .chat-status-card {
    padding: 16px;
    border-radius: 18px;
  }

  .chat-status-card-title {
    font-size: 18px;
  }

  .chat-status-card-actions {
    flex-direction: column;
  }

  .chat-status-card-link {
    width: 100%;
  }
}

/* typing indicator inside bubble */
.chat-msg-bubble .typing-label {
  font-size: 13px;
  color: var(--text-secondary);
  margin-right: 8px;
}

/* ── Source type confirmation step ── */
.source-type-label {
  font-size: 13px;
  margin: 0 0 12px 0;
  color: var(--text-primary);
  line-height: 1.5;
}
.source-type-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.source-type-btn {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface-raised, #f4f5f7);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.source-type-btn-yes {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.source-type-btn-yes:hover {
  opacity: 0.88;
}
.source-type-btn-neutral {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text-primary);
  opacity: 1;
}
.source-type-btn-neutral:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--surface);
}
.source-type-btn-no:hover {
  border-color: var(--accent);
  color: var(--accent);
}
.source-type-btn:disabled {
  cursor: default;
  opacity: 0.5;
}
.source-type-btn-selected {
  opacity: 1 !important;
}
.source-type-actions .source-type-btn-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.chat-material-mode .chat-message-copy-style {
  display: none;
}
.source-type-input {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  width: 200px;
  transition: border-color 0.15s;
}
.source-type-input:focus {
  border-color: var(--accent);
}

/* ── Intent chips inside assistant bubble ── */
.intent-chips-label {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 10px 0;
  color: var(--text-primary);
}
.intent-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.intent-chip {
  position: relative;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface-raised, #f4f5f7);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}
.intent-chip:hover {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.intent-chip:disabled {
  cursor: default;
  opacity: 0.5;
}
.intent-chip.intent-chip-selected {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  opacity: 1;
}
.intent-chip .intent-tooltip {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  color: #111;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.55;
  padding: 10px 14px;
  border-radius: 8px;
  white-space: pre-line;
  width: 280px;
  text-align: left;
  pointer-events: none;
  z-index: 200;
  box-shadow: 0 4px 20px rgba(0,0,0,0.14);
  border: 1px solid var(--border);
}
.intent-chip .intent-tooltip::before {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border, #e5e7eb);
}
.intent-chip .intent-tooltip::after {
  content: "";
  position: absolute;
  top: calc(100% - 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #fff;
}
.intent-chip:hover .intent-tooltip {
  display: block;
}
.chips-chosen .intent-chip:not(.intent-chip-selected) {
  /* pointer-events set to none inline via JS in onIntentChosen() — CSS fallback only */
  pointer-events: none;
  opacity: 0.45;
}
.intent-chip:disabled:hover .intent-tooltip {
  display: none;
}
.intent-tooltip-example {
  display: block;
  margin-top: 6px;
  font-style: italic;
  color: var(--text-secondary, #6b7280);
}

.intent-tooltip-wordcount {
  display: block;
  margin-top: 6px;
  font-size: 0.85em;
  color: var(--text-secondary, #6b7280);
}

.intent-chip-token-warning {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  border-radius: 10px;
  background: #fff3cd;
  color: #92400e;
  font-size: 10px;
  font-weight: 600;
  vertical-align: middle;
  line-height: 1.6;
  letter-spacing: 0.01em;
}
.intent-chip:hover .intent-chip-token-warning,
.intent-chip.intent-chip-selected .intent-chip-token-warning {
  background: rgba(255,255,255,0.25);
  color: #fff;
}

.intent-tooltip-token-warning {
  display: block;
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--border, #e5e7eb);
  font-size: 0.82em;
  color: #b45309;
  font-weight: 500;
}

/* ── Project articles section ── */
.project-articles-section {
  flex-shrink: 0;
  padding: 20px 40px 32px 240px;
  border-top: 1px solid var(--border);
  max-height: 40vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.project-articles-section > * {
  width: 100%;
  max-width: 580px;
}
.project-articles-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
}
.project-articles-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.project-articles-empty {
  font-size: 13px;
  color: var(--text-secondary);
}
.article-card {
  display: block;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.article-card:hover {
  border-color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.article-card-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 2px;
}
.article-card-meta {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}
.article-card-published-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--success-text, #065f46);
  font-weight: 500;
  font-size: 11px;
}
.article-card-published-status::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: #10b981;
}
.article-card-pending {
  cursor: default;
  border-style: dashed;
  opacity: 0.85;
}
.article-card-pending:hover {
  border-color: var(--border);
  box-shadow: none;
}
.article-card-pending-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.article-card-pending-badge {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
  flex-shrink: 0;
}
.article-card-dismiss {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.15s;
}
.article-card-dismiss:hover {
  opacity: 1;
  color: var(--text-primary);
}
.article-card-done-badge {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: #22c55e;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 500;
}
.article-card-done {
  cursor: pointer;
  border-color: #22c55e33;
}
.article-card-done:hover {
  border-color: #22c55e;
  box-shadow: 0 1px 4px rgba(34,197,94,.12);
}

/* ── Article view ── */
#view-article {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}
#article-view-body {
  display: flex;
  flex: 1;
  overflow: hidden;
  gap: 0;
}
#article-view-blocks {
  padding: 16px 40px;
  overflow-y: auto;
  flex: 1;
  min-width: 0;
}
#article-view-sidebar {
  width: 300px;
  flex-shrink: 0;
  overflow-y: auto;
  padding: 68px 20px 16px 4px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* Sidebar block — card style */
.sidebar-block {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 8px;
  padding: 16px 16px;
  margin-bottom: 16px;
}
.sidebar-block-heading {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-secondary, #888);
  margin-bottom: 12px;
}
.sidebar-field {
  margin-bottom: 14px;
}
.sidebar-field:last-child {
  margin-bottom: 0;
}
.sidebar-field-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary, #888);
  margin-bottom: 4px;
}
.sidebar-field-value-row {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}
.sidebar-field-value {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary, #1a1a1a);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  word-break: break-word;
}
.sidebar-field-value-row .copy-btn {
  flex-shrink: 0;
  margin-top: 2px;
}

@media (max-width: 900px) {
  #article-view-body {
    flex-direction: column;
    overflow: visible;
  }
  #article-view-blocks {
    overflow-y: visible;
    padding: 16px 16px;
    flex: none;
  }
  #article-view-sidebar {
    width: 100%;
    padding: 0 16px 16px;
    overflow-y: visible;
  }
}


/* ── Tooltip ── */
.sitemap-info-icon {
  position: relative;
  display: inline-block;
}
.sitemap-info-icon:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text-primary);
  color: var(--surface);
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  white-space: nowrap;
  z-index: 10;
  pointer-events: none;
}

/* ── Upgrade modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-upgrade-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-upgrade-box {
  position: relative;
  background: var(--surface);
  border-radius: 16px;
  padding: 32px;
  width: 100%;
  max-width: 460px;
  box-sizing: border-box;
  box-shadow: 0 8px 32px rgba(0,0,0,0.12);
}

.modal-upgrade-header {
  margin-bottom: 12px;
}

.modal-upgrade-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-primary);
}

.modal-upgrade-body {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.6;
  margin: 0 0 20px;
}

.upgrade-plans-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 24px;
}

.upgrade-plan-card {
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.upgrade-plan-card:hover {
  border-color: var(--text-secondary);
}

.upgrade-plan-card.selected {
  border-color: var(--accent);
  background: #fff8f6;
}

.upgrade-plan-name {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.upgrade-plan-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.upgrade-plan-price {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}

.modal-upgrade-actions {
  display: flex;
  gap: 10px;
}

.btn-upgrade-primary {
  flex: 1;
  padding: 11px 0;
  background: var(--btn-bg);
  color: var(--btn-text);
  border: none;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-upgrade-primary:hover {
  background: var(--btn-hover);
}

.btn-upgrade-secondary {
  flex: 1;
  padding: 11px 0;
  background: transparent;
  color: var(--text-secondary);
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
}

.btn-upgrade-secondary:hover {
  background: var(--surface-alt);
}

/* ── Article ready toast ── */

.article-toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 9999;
  width: 280px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,.10);
  display: flex;
  flex-direction: column;
  gap: 6px;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 250ms ease, transform 250ms ease;
  pointer-events: none;
}

.article-toast--visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.article-toast-close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1;
  padding: 2px 4px;
}

.article-toast-close:hover {
  color: var(--text-primary);
}

.article-toast-status {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  padding-right: 20px;
}

.article-toast-h1 {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.4;
}

.article-toast-link {
  font-size: 12px;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  margin-top: 2px;
}

.article-toast-link:hover {
  text-decoration: underline;
}

/* ── is_new badge in article list ── */

.article-card-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 2px;
}

.article-is-new-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  background: var(--success-bg);
  color: var(--success-text);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.article-generating-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  background: var(--surface-2, #f0f0f0);
  color: var(--text-secondary);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.article-error-badge {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  background: #fee2e2;
  color: #dc2626;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
}

.article-card--generating,
.article-card--error {
  cursor: default;
  opacity: 0.75;
}

.article-card--generating:hover,
.article-card--error:hover {
  border-color: var(--border);
  box-shadow: none;
}

.article-card-upgrade-link {
  color: var(--accent);
  text-decoration: underline;
  font-size: inherit;
}

.article-card {
  position: relative;
  z-index: 0;
}
.article-card:has(.article-card-dropdown:not(.hidden)) {
  z-index: 10;
}

.article-card-menu-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
.article-card:hover .article-card-menu-btn {
  opacity: 1;
}
.article-card-menu-btn:hover {
  background: var(--border);
  color: var(--text-primary);
}

.article-card-menu-wrap {
  position: relative;
  margin-left: auto;
  flex-shrink: 0;
}

.article-card-dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 100;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.10);
  min-width: 160px;
  padding: 4px;
}
.article-card-dropdown.hidden {
  display: none;
}
.article-card-dropdown-delete {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: #e53e3e;
  text-align: left;
  transition: background 0.12s;
}
.article-card-dropdown-delete:hover {
  background: rgba(229,62,62,.08);
}

/* ── Inline article in chat ── */

.chat-article-bubble {
  max-height: 60vh;
  overflow-y: auto;
  padding: 0 !important;
}

/* ── Account settings layout (sidebar + tabs) ── */

.account-settings-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.account-settings-nav {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 72px 24px 32px 40px;
  background: var(--bg);
  overflow-y: auto;
}

.account-settings-nav-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 18px;
  border-radius: 8px;
  border: none;
  background: transparent;
  font-size: 15px;
  font-weight: 400;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.account-settings-nav-item:hover {
  background: var(--surface-alt);
  color: var(--text-primary);
}

.account-settings-nav-item.active {
  background: var(--surface-alt);
  color: var(--text-primary);
  font-weight: 500;
}

.account-settings-tab {
  flex: 1;
  min-width: 0;
}

/* Billing tab */
.billing-plan-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.billing-plan-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.billing-plan-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.billing-plan-btn {
  text-decoration: none;
  flex-shrink: 0;
}

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

.billing-usage-label {
  font-size: 13px;
  color: var(--text-secondary);
}

.billing-usage-value {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}

.billing-usage-bar-wrap {
  height: 6px;
  background: var(--surface-alt);
  border-radius: 999px;
  overflow: hidden;
}

.billing-usage-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s ease;
  max-width: 100%;
}

.billing-addon-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}

.billing-addon-packs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.billing-addon-pack-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.billing-addon-pack-btn:hover {
  border-color: var(--text-primary);
  background: var(--surface-alt);
}

.billing-addon-pack-count {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.billing-addon-pack-price {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Payment card section */
.billing-card-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.billing-card-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.billing-card-icon {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.billing-card-label {
  font-size: 14px;
  color: var(--text-primary);
}

.billing-card-form {
  margin-top: 16px;
}

.billing-card-form-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.billing-card-form-row2 {
  display: flex;
  gap: 12px;
}

.billing-card-form-row2 .billing-card-field-group {
  flex: 1;
}

.billing-card-field-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.billing-card-field-label {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
}

.billing-card-input {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--text-primary);
  background: var(--bg-primary, #fff);
  outline: none;
  transition: border-color 0.15s;
  font-family: inherit;
}

.billing-card-input:focus {
  border-color: var(--accent);
}

.billing-card-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}

.billing-cards-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.billing-card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
}

.billing-card-item-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.billing-card-text {
  font-size: 14px;
  color: var(--text-primary);
}

.billing-card-delete-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: background-color 0.15s, color 0.15s;
}

.billing-card-delete-btn:hover {
  background-color: var(--error-bg);
  color: var(--error-text);
}

.billing-card-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}

/* Payments table */
.billing-payments-empty {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 8px 0;
}

.billing-payments-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.billing-payments-table th {
  text-align: left;
  padding: 6px 12px 10px 0;
  color: var(--text-secondary);
  font-weight: 500;
  border-bottom: 1px solid var(--border);
}

.billing-payments-table td {
  padding: 10px 12px 10px 0;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-light, #f0ece8);
  vertical-align: middle;
}

.billing-payments-table tbody tr:last-child td {
  border-bottom: none;
}

.billing-payments-collapse.hidden {
  display: none;
}

.billing-payments-toggle-row td {
  padding: 8px 0 2px;
  border-bottom: none;
  border-top: none;
}

.billing-payments-toggle-btn {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.billing-payments-toggle-btn:hover {
  text-decoration: underline;
}

.billing-payments-toggle-btn::after {
  content: "▾";
  font-size: 11px;
  transition: transform 0.2s;
}

.billing-payments-toggle-row--open .billing-payments-toggle-btn::after {
  transform: rotate(180deg);
}

.billing-payment-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: 999px;
}

.billing-payment-status--paid {
  background: #e6f9f0;
  color: #1a7f4f;
}

.billing-payment-status--pending {
  background: #fff7e0;
  color: #9a6700;
}

.billing-payment-status--failed {
  background: #fff0f0;
  color: #c0392b;
}

.billing-status-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.billing-pay-retry-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 500;
  padding: 2px 9px;
  border-radius: 6px;
  border: 1px solid var(--accent, #e07b39);
  background: var(--accent, #e07b39);
  color: #fff;
  cursor: pointer;
  text-decoration: none;
  line-height: 1.4;
  font-family: inherit;
  transition: opacity .15s, transform .1s;
}

.billing-pay-retry-btn:hover {
  opacity: .88;
}

.billing-pay-retry-btn:active {
  transform: scale(0.97);
}

.billing-pay-retry-btn:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* ── Settings page ── */

.settings-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 40px 40px 120px 0; /* bottom clearance for sticky bar */
}

.settings-content {
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-card {
  display: flex;
  flex-direction: column;
  gap: 0; /* fields have their own margin-bottom */
}
.settings-card .field:last-child { margin-bottom: 0; }

.kb-experience-card {
  margin-bottom: 24px;
}

.kb-experience-hint {
  margin: 0 0 22px;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.55;
}

.article-no-company-notice {
  margin: 0 0 16px;
  padding: 14px 16px;
  border: 1px solid #fed7aa;
  border-radius: 12px;
  background: #fff7ed;
  color: #7c2d12;
  font-size: 14px;
  line-height: 1.5;
}

.article-no-company-notice-btn {
  margin-left: 8px;
  border: 0;
  border-radius: 8px;
  background: #d76442;
  color: #fff;
  font-weight: 700;
  padding: 6px 10px;
  cursor: pointer;
}

.settings-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 20px;
}
.settings-section-title.danger { color: var(--error-text); }

.settings-competitor-add-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
  align-items: center;
  margin: 12px 0;
}

.competitor-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.competitor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-top: 1px solid var(--border);
}

.competitor-main {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.competitor-domain {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  word-break: break-word;
}

.competitor-meta {
  font-size: 12px;
  color: var(--text-secondary);
  word-break: break-word;
}

.competitor-source-chip {
  display: inline-flex;
  align-items: center;
  height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  white-space: nowrap;
}

.competitor-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.competitor-delete-button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.competitor-delete-button:hover,
.competitor-delete-button:focus-visible {
  background: var(--surface-alt);
  color: var(--error-text);
  outline: none;
}

.competitor-empty {
  margin: 10px 0 0;
  color: var(--text-secondary);
  font-size: 13px;
}

.competitors-analysis-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.competitors-analysis-title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.competitors-analysis-hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.competitors-analysis-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 12px;
  font-size: 13px;
}

.competitors-analysis-status-label {
  color: var(--text-secondary);
}

.competitors-analysis-status {
  font-weight: 500;
}

.competitors-analysis-status--running { color: var(--accent); }
.competitors-analysis-status--ready   { color: #22c55e; }
.competitors-analysis-status--failed  { color: #ef4444; }

.competitors-analysis-timestamp {
  color: var(--text-dim, var(--text-secondary));
  font-size: 12px;
}

.competitors-analysis-message {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text-primary);
  font-size: 13px;
}

.competitors-analysis-message--running {
  border-color: rgba(224, 123, 57, 0.24);
  background: rgba(224, 123, 57, 0.08);
  color: var(--text-primary);
}

.competitors-analysis-message--failed {
  border-color: rgba(239, 68, 68, 0.2);
  background: rgba(239, 68, 68, 0.08);
  color: var(--text-primary);
}

.competitors-analysis-message-text {
  line-height: 1.5;
}

.competitors-analysis-queue {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.competitors-analysis-queue-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-start;
}

.competitors-analysis-queue-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 88px;
  padding-top: 3px;
}

.competitors-analysis-queue-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.competitors-analysis-queue-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.22);
  color: var(--text-primary);
  line-height: 1.3;
}

.competitors-analysis-message--failed .competitors-analysis-queue-chip {
  background: rgba(255, 255, 255, 0.78);
}

.competitor-analysis-results {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}

.competitor-analysis-positioning {
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1.6;
  margin: 0 0 16px;
}

.competitor-analysis-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 600px) {
  .competitor-analysis-cols { grid-template-columns: 1fr; }
}

.competitor-analysis-col-title {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 8px;
  color: var(--text-primary);
}

.competitor-analysis-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.competitor-analysis-list li {
  font-size: 13px;
  color: var(--text-secondary);
  padding: 4px 0 4px 14px;
  position: relative;
  line-height: 1.5;
}

.competitor-analysis-list li::before {
  content: "•";
  position: absolute;
  left: 0;
  color: var(--accent);
}

.competitor-analysis-suggest-btn {
  margin-top: 16px;
}

.competitor-discovery-summary {
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: var(--surface-alt);
  color: var(--text-secondary);
  font-size: 13px;
  border-radius: 8px;
}

.competitor-skipped-note {
  margin-top: 8px;
  color: var(--text-primary);
  font-size: 13px;
}

.competitor-skipped-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.competitor-skipped-list--muted {
  opacity: 0.8;
}

.competitor-skipped-item {
  display: inline-flex;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--warning-bg);
  color: var(--warning-text);
  font-size: 12px;
  word-break: break-word;
}

.geo-assets,
.audit-summary {
  border-color: var(--border);
}

.geo-assets-title {
  margin: 12px 0 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.geo-asset-row,
.geo-internal-row,
.source-row,
.audit-row {
  padding: 8px 0;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-secondary);
  word-break: break-word;
}

.source-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.source-title {
  color: var(--text-primary);
  font-weight: 500;
}

.source-domain {
  font-size: 12px;
}

.audit-score {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.audit-score--sidebar {
  font-size: 20px;
}

.audit-row--pass { color: var(--success-text); }
.audit-row--warning { color: var(--warning-text); }
.audit-row--fail { color: var(--error-text); }

@media (max-width: 720px) {
  .settings-competitor-add-row,
  .competitor-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .competitor-source-chip,
  .competitor-actions {
    justify-self: start;
  }
}

/* Danger card */
.settings-danger-card {
  border-color: var(--error-text);
}

.settings-danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.settings-danger-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.settings-danger-label-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}
.settings-danger-label-hint {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Status pill toggle */
.settings-status-toggle {
  position: relative;
  width: 48px;
  height: 26px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: var(--accent);
  transition: background 0.2s;
  flex-shrink: 0;
}
.settings-status-toggle--frozen {
  background: var(--text-disabled);
}
.settings-status-knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s;
  pointer-events: none;
}
.settings-status-toggle--frozen .settings-status-knob {
  transform: translateX(22px);
}

/* Postal address rows */
.settings-address-row {
  display: grid;
  grid-template-columns: 1fr 2fr 2fr;
  gap: 8px;
  margin-bottom: 8px;
}
.settings-address-row--second {
  grid-template-columns: 1fr auto;
}
.settings-address-postal {
  width: 110px;
  flex: none;
}
.field-hint-inline {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
  margin-left: 4px;
}

/* Logo preview row */
.settings-logo-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.settings-logo-row .field-input { flex: 1; }
.settings-logo-preview {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  object-fit: contain;
  border: 1px solid var(--border);
  flex-shrink: 0;
}

/* Org type read-only field */
.settings-org-type-value {
  font-size: 14px;
  color: var(--text-primary);
  padding: 8px 12px;
  background: var(--bg-secondary, #f5f5f5);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 4px;
}
.settings-org-type-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
}
.settings-link {
  color: var(--accent, #6366f1);
  text-decoration: none;
}
.settings-link:hover {
  text-decoration: underline;
}

/* knowsAbout tags grid — 3 per row */
.settings-tags-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-top: 6px;
}
.settings-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-secondary, #f4f4f8);
  border: 1px solid var(--border-color, #e0e0e8);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 13px;
  color: var(--text-primary);
  min-width: 0;
}
.settings-tag-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.settings-tag-remove {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 14px;
  line-height: 1;
  padding: 0;
}
.settings-tag-remove:hover { color: var(--danger, #ef4444); }
.settings-tags-add-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}
.settings-tags-add-row .field-input {
  flex: 1;
}
.field-hint {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 4px;
}

/* ── Hint tooltip (универсальный "?" в кружке) ──────────────────────────────
   Использование: createHintTooltip("Текст подсказки") → вставить в DOM рядом
   с лейблом или заголовком. ------------------------------------------------ */
.hint-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--accent, #6366f1);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent, #6366f1);
  cursor: default;
  flex-shrink: 0;
  vertical-align: middle;
  margin-bottom: 4px;
  user-select: none;
}
.hint-tooltip::before {
  content: "?";
}
.hint-tooltip-popup {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  color: #111;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
  padding: 10px 14px;
  border-radius: 8px;
  white-space: pre-line;
  width: 360px;
  text-align: left;
  pointer-events: auto;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.13);
  border: 1px solid var(--border);
}
.hint-tooltip-popup::after {
  content: "";
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: var(--border, #e5e7eb);
}
.hint-tooltip-popup::before {
  content: "";
  position: absolute;
  top: calc(100% - 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #fff;
}
.hint-tooltip:hover .hint-tooltip-popup,
.hint-tooltip:focus .hint-tooltip-popup {
  display: block;
}
.hint-tooltip-popup a {
  color: var(--accent, #6366f1);
  text-decoration: underline;
}

/* ── Field inline tooltip ("?" рядом с лейблом поля) ──────────────────────── */
.field-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--accent, #6366f1);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  color: var(--accent, #6366f1);
  cursor: default;
  flex-shrink: 0;
  user-select: none;
}
.field-tooltip-body {
  display: none;
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  color: #111;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.6;
  padding: 10px 14px;
  border-radius: 8px;
  white-space: normal;
  width: 320px;
  text-align: left;
  pointer-events: auto;
  z-index: 1000;
  box-shadow: 0 4px 20px rgba(0,0,0,0.13);
  border: 1px solid var(--border);
}
.field-tooltip:hover .field-tooltip-body,
.field-tooltip:focus .field-tooltip-body {
  display: block;
}

/* Settings accordion (соцсети) */
.settings-accordion {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: 8px;
}
.settings-accordion-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--surface-raised, var(--surface));
  border: none;
  overflow: visible;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  gap: 8px;
  transition: background 0.15s;
  border-radius: 7px;
}
.settings-accordion-toggle:hover { background: var(--hover-bg, var(--border)); }
.settings-accordion-toggle[aria-expanded="true"] { color: var(--text-primary); }
.settings-accordion-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.settings-accordion-chevron {
  flex-shrink: 0;
  transition: transform 0.2s;
}
.settings-accordion-toggle[aria-expanded="true"] .settings-accordion-chevron {
  transform: rotate(180deg);
}
.settings-accordion-body {
  padding: 12px 14px 4px;
  border-top: 1px solid var(--border);
}
.settings-accordion-body .field { margin-bottom: 14px; }
.settings-accordion-body .field:last-child { margin-bottom: 8px; }

/* Geo coords row */
.settings-geo-coords { margin-top: 8px; }
.field-geo-pair {
  display: flex;
  gap: 12px;
}
.field-geo-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.field-geo-item .field-label { margin-bottom: 0; }
.field-geo-item .field-input {
  background: var(--surface-raised, #f9f9f9);
  color: var(--text-secondary);
  cursor: default;
}

/* Sticky save bar */
.settings-save-bar {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 14px 40px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  z-index: 10;
  flex-shrink: 0;
}

.settings-save-feedback {
  font-size: 13px;
  color: var(--text-secondary);
}
.settings-save-feedback.hidden { display: none; }

/* Settings toast */
.settings-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: var(--btn-bg);
  color: var(--btn-text);
  font-size: 14px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,.15);
  z-index: 200;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  white-space: nowrap;
  pointer-events: none;
}
.settings-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.settings-toast--error {
  background: var(--error-bg);
  color: var(--error-text);
}

/* ── Thrust Gauge Overlay ── */

/* ── AI Wizard Launch Button ── */
.ai-wizard-launch-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  margin-top: 6px;
}
.ai-wizard-launch-btn:hover { background: var(--accent-hover); }
.ai-wizard-launch-btn svg { flex-shrink: 0; }

/* ── AI Wizard Chat View ── */
#view-ai-wizard { overflow-y: auto; position: relative; }
.wizard-bg-star {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.6);
  pointer-events: none;
  z-index: 0;
}
.wizard-layout {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 420px;
  overflow: hidden;
  padding: 54px 40px 24px;
  gap: 20px;
  align-items: stretch;
}
.wizard-progress-panel {
  width: 250px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  padding-top: 0;
}
.wizard-ring-wrap {
  position: relative;
  width: 80px;
  height: 80px;
}
.wizard-ring {
  width: 80px;
  height: 80px;
  transform: rotate(-90deg);
}
.wizard-ring-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 6;
}
.wizard-ring-fill {
  fill: none;
  stroke: var(--accent);
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 213.63;
  stroke-dashoffset: 213.63;
  transition: stroke-dashoffset 0.6s ease;
}
.wizard-ring-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}
.wizard-step-hint {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
}
.wizard-step-hint-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}
.wizard-step-hint-body {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}
.wizard-chat-area {
  display: flex;
  flex-direction: column;
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.wizard-messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.wizard-messages:empty { display: none; }
.wizard-input-area {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg);
}

/* Message rows */
.wizard-msg-row { display: flex; }
.wizard-msg-user { justify-content: flex-end; }
.wizard-msg-bot { justify-content: flex-start; }

.wizard-msg-bubble {
  max-width: 75%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.55;
}
.wizard-msg-bubble-user {
  background: var(--accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.wizard-msg-bubble-bot {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-bottom-left-radius: 4px;
}

/* Typing indicator */
.wizard-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 10px 14px;
}
.wizard-typing span {
  width: 7px; height: 7px;
  background: var(--text-disabled);
  border-radius: 50%;
  animation: wizardDot 1.2s infinite ease-in-out;
}
.wizard-typing span:nth-child(2) { animation-delay: 0.2s; }
.wizard-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes wizardDot {
  0%, 80%, 100% { transform: scale(0.7); opacity: 0.5; }
  40% { transform: scale(1); opacity: 1; }
}

/* Choice buttons */
.wizard-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.wizard-btn-group--inline {
  justify-content: flex-end;
  padding: 4px 0 4px 48px;
}
.wizard-choice-btn {
  padding: 8px 16px;
  border: 1.5px solid var(--accent);
  border-radius: 20px;
  background: var(--surface);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s;
  box-shadow: 0 0 0 1px var(--accent);
}
.wizard-choice-btn:hover { border-color: var(--accent); background: var(--surface-alt); }
.wizard-choice-btn.selected { border-color: var(--accent); background: var(--accent); color: #fff; }
.wizard-choice-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Text input area */
.wizard-text-input-wrap {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 10px 10px 14px;
  transition: border-color 0.15s;
}
.wizard-text-input-wrap:focus-within { border-color: var(--border-focus); }
.wizard-textarea {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  background: none;
  padding: 0;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 21px;
  max-height: 120px;
  overflow-y: auto;
  box-sizing: border-box;
}
.wizard-textarea:focus { outline: none; }
.wizard-textarea::placeholder { color: var(--text-disabled); }
.wizard-text-btns {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-shrink: 0;
}
.wizard-text-btns .pill-button {
  height: 36px;
  padding: 0 14px;
  font-size: 13px;
  border-radius: 8px;
  white-space: nowrap;
}

.wizard-done-btn { margin-top: 8px; }

/* Social link input */
.wizard-social-row {
  display: flex;
  flex: 1;
  gap: 8px;
  align-items: center;
}
.wizard-social-row .field-input { flex: 1; min-width: 0; }

.wizard-links-collected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 6px;
}
.wizard-link-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-secondary);
}
.wizard-link-tag-icon {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  flex-shrink: 0;
  display: block;
}

.wizard-thinking { color: var(--text-secondary); font-style: italic; }
.wizard-scroll-spacer { display: none; }

/* ── Wizard dark mode (sidebar + background when on /ai_wizard) ── */
body.wizard-mode {
  --wiz-bg:       #14161a;
  --wiz-surface:  #1e2128;
  --wiz-border:   #2e3340;
  --wiz-text:     #c8cdd8;
  --wiz-text-dim: #6b7280;
}
body.wizard-mode .sidebar {
  background: var(--wiz-bg);
  border-right-color: var(--wiz-border);
}
body.wizard-mode .sidebar-section-title,
body.wizard-mode .logo-title,
body.wizard-mode .logo-subtitle {
  color: var(--wiz-text);
}
body.wizard-mode .sidebar-project-btn,
body.wizard-mode .sidebar-project-name {
  color: var(--wiz-text);
}
body.wizard-mode .sidebar-project-btn:hover,
body.wizard-mode .sidebar-project-btn.active {
  background: var(--wiz-surface);
}
body.wizard-mode .plan-summary-label,
body.wizard-mode .plan-name,
body.wizard-mode #plan-usage-label,
body.wizard-mode #plan-name {
  color: var(--wiz-text-dim);
}
body.wizard-mode .sidebar-footer .link-button,
body.wizard-mode .sidebar-footer .icon-button {
  color: var(--wiz-text-dim);
}
body.wizard-mode .account-wrapper .account-email,
body.wizard-mode #account-email {
  color: var(--wiz-text-dim);
}
body.wizard-mode .sidebar-section-header .link-button {
  color: var(--wiz-text-dim);
}
body.wizard-mode .plan-progress {
  background: var(--wiz-border);
}
body.wizard-mode .sidebar-footer {
  border-top-color: var(--wiz-border);
}
body.wizard-mode .account-button {
  border-color: var(--wiz-border);
}
body.wizard-mode .article-model-button,
body.wizard-mode .article-model-menu {
  background: var(--wiz-surface);
  border-color: var(--wiz-border);
  color: var(--wiz-text);
}
body.wizard-mode .article-model-button:hover,
body.wizard-mode .article-model-button[aria-expanded="true"],
body.wizard-mode .article-model-option:hover,
body.wizard-mode .article-model-option[aria-checked="true"] {
  background: #282c35;
}
body.wizard-mode .article-model-option--recommended,
body.wizard-mode .article-model-option--recommended[aria-checked="true"] { background: #28253a; box-shadow: inset 0 0 0 1px #554a7b; }
body.wizard-mode .article-model-option--recommended:hover { background: #332d48; }
body.wizard-mode .article-model-current-top,
body.wizard-mode .article-model-recommended-badge { background: #4c3f72; color: #f1eaff; }
body.wizard-mode .article-model-option-recommendation { color: #cbb9ff; }
body.wizard-mode .article-model-label,
body.wizard-mode .article-model-option-cost,
body.wizard-mode .article-model-option-lock,
body.wizard-mode .article-model-chevron {
  color: var(--wiz-text-dim);
}
body.wizard-mode .view:not(.hidden) {
  background: var(--wiz-bg);
}
body.wizard-mode .breadcrumbs,
body.wizard-mode .breadcrumb-link,
body.wizard-mode .breadcrumb-current,
body.wizard-mode .breadcrumb-sep {
  color: var(--wiz-text-dim);
}
body.wizard-mode .breadcrumb-link:hover {
  color: var(--wiz-text);
}
body.wizard-mode .wizard-step-hint {
  background: var(--wiz-surface);
  border-color: var(--wiz-border);
}
body.wizard-mode .wizard-step-hint-title {
  color: var(--wiz-text);
}
body.wizard-mode .wizard-step-hint-body {
  color: var(--wiz-text-dim);
}
body.wizard-mode .wizard-ring-bg {
  stroke: var(--wiz-border);
}
body.wizard-mode .wizard-ring-label {
  color: var(--wiz-text);
}
body.wizard-mode .wizard-chat-area {
  background: var(--wiz-surface);
  border-color: var(--wiz-border);
}
body.wizard-mode .wizard-messages {
  background: var(--wiz-surface);
}
body.wizard-mode .wizard-input-area {
  background: var(--wiz-bg);
  border-top-color: var(--wiz-border);
}
body.wizard-mode .wizard-msg-bubble-bot {
  background: #252a35;
  border-color: var(--wiz-border);
  color: var(--wiz-text);
}
body.wizard-mode .wizard-choice-btn {
  background: var(--wiz-surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
  color: var(--wiz-text);
}
body.wizard-mode .wizard-choice-btn:hover {
  background: #252a35;
  border-color: var(--accent);
}
body.wizard-mode .wizard-text-input-wrap {
  background: var(--wiz-surface);
  border-color: var(--wiz-border);
}
body.wizard-mode .wizard-textarea {
  color: var(--wiz-text);
}
body.wizard-mode .wizard-textarea::placeholder {
  color: var(--wiz-text-dim);
}
body.wizard-mode .wizard-text-input-wrap:focus-within {
  border-color: var(--accent);
}
body.wizard-mode .field-input {
  background: rgba(255, 255, 255, 0.06);
  border-color: var(--wiz-border);
  color: var(--wiz-text);
}
body.wizard-mode .field-input::placeholder {
  color: var(--wiz-text-dim);
}
body.wizard-mode .field-input:focus {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.09);
}
body.wizard-mode .wizard-link-tag {
  background: #252a35;
  border-color: var(--wiz-border);
  color: var(--wiz-text-dim);
}
body.wizard-mode .wizard-thinking {
  color: var(--wiz-text-dim);
}

/* ── AI Result Page ── */
#view-ai-result { overflow: hidden; }

/* Ring fully filled */
.result-ring-full {
  stroke-dashoffset: 0 !important;
}

/* Warning icon bubble */
.result-warn-icon {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1.5px solid var(--accent);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 11px;
  flex-shrink: 0;
  margin-right: 8px;
  align-self: flex-start;
  margin-top: 4px;
}

/* Install button as user bubble */
.result-install-btn {
  font-size: 14px;
  padding: 8px 40px;
  min-width: 200px;
  background: var(--accent);
  color: #fff;
  border: none;
  box-shadow: none;
}
.result-install-btn:hover { background: var(--accent); opacity: 0.88; }
body.wizard-mode .result-install-btn { background: var(--accent); color: #fff; border: none; box-shadow: none; }
body.wizard-mode .result-install-btn:hover { background: var(--accent); opacity: 0.88; }

/* More breathing room between result messages */
#result-messages { gap: 20px; }

/* Code row stretches to fill remaining chat height */
.result-code-row {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: stretch;
}

/* Code bubble: full-width bot bubble that fills the row */
.result-code-bubble {
  max-width: 100% !important;
  width: 100%;
  box-sizing: border-box;
  padding: 14px !important;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.result-code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.result-code-label { font-size: 13px; font-weight: 600; color: var(--text-secondary); }

.ai-result-install-hint {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.6;
  display: block;
}

.ai-result-code {
  background: #1e1e2e;
  color: #cdd6f4;
  padding: 16px;
  border-radius: 8px;
  font-size: 12px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  line-height: 1.5;
  overflow-x: auto;
  overflow-y: auto;
  white-space: pre;
  margin: 0;
  flex: 1;
  min-height: 0;
}

/* ── Project body layout (articles + orientirs sidebar) ─────────────────── */

.project-body-layout {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 0;
  flex: 0 0 auto;
  width: 100%;
  box-sizing: border-box;
  min-height: 0;
  margin-top: auto;
}

.project-body-layout .project-articles-section {
  flex: 1 1 0;
  min-width: 0;
  overflow-y: auto;
  border-top: 1px solid var(--border);
  border-right: 1px solid var(--border);
}

/* ── Orientirs widget ────────────────────────────────────────────────────── */

.orientirs-widget {
  flex: 0 0 340px;
  min-width: 240px;
  padding: 20px 20px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg);
  box-sizing: border-box;
  align-self: flex-start;
}

.orientirs-static {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.orientirs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  user-select: none;
}

.orientirs-chevron {
  font-size: 12px;
  color: var(--text-secondary);
  transition: transform 0.2s ease;
  line-height: 1;
}

.orientirs-section[data-open="true"] .orientirs-chevron,
.orientirs-widget[data-open="true"] .orientirs-chevron {
  transform: rotate(90deg);
}

.orientirs-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.25s ease;
}

.orientirs-body-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.orientirs-section[data-open="true"] .orientirs-body,
.orientirs-widget[data-open="true"] .orientirs-body {
  max-height: 500px;
}

.orientirs-section + .orientirs-section {
  border-top: 1px solid var(--border);
  margin-top: 12px;
  padding-top: 12px;
}

.orientirs-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0;
  letter-spacing: 0.01em;
}

.orientirs-desc {
  font-size: 11px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.orientirs-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
  max-height: 208px;
  overflow-y: auto;
  flex-shrink: 0;
}

.orientirs-empty {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
}

.orientir-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.orientir-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.orientir-desc {
  font-size: 11px;
  color: var(--text-secondary);
  line-height: 1.3;
}

.orientir-price {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-top: 2px;
}

.orientir-link,
.catalog-item-url {
  color: var(--accent);
  font-size: 11px;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.orientir-link:hover,
.catalog-item-url:hover {
  text-decoration: underline;
}

.orientirs-source {
  font-size: 10px;
  color: var(--text-secondary);
  margin: 0;
  margin-top: 10px;
  line-height: 1.4;
}

.orientirs-change-btn {
  align-self: flex-start;
  margin-top: 0;
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.orientirs-change-btn:hover {
  border-color: var(--border-focus);
  color: var(--text-primary);
}
.cta-card {
  position: relative;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px 10px 28px;
  margin-bottom: 8px;
}
.cta-card-quote {
  position: absolute;
  left: 8px;
  top: 8px;
  font-size: 14px;
  color: var(--text-secondary);
  opacity: 0.5;
  line-height: 1;
}
.cta-card-text {
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
  margin: 0;
  word-break: break-word;
}

/* ── Catalog edit view ───────────────────────────────────────────────────── */

.catalog-edit-layout {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 40px 40px 80px;
}

.catalog-edit-main {
  max-width: 760px;
  margin: 0 auto;
}

.catalog-edit-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 0 0 8px;
}

.catalog-edit-hint {
  font-size: 13px;
  color: var(--text-secondary);
  margin: 0 0 20px;
  line-height: 1.5;
}

.catalog-add-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.catalog-form-row {
  display: flex;
  gap: 8px;
}

.catalog-input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-primary);
  background: var(--bg);
  font-family: inherit;
  transition: border-color 0.15s;
  box-sizing: border-box;
}

.catalog-input:focus {
  outline: none;
  border-color: var(--border-focus);
}

.catalog-input-price {
  flex: 0 0 140px;
  width: 140px;
}

.catalog-input-desc {
  resize: vertical;
  min-height: 56px;
}

.catalog-add-btn {
  align-self: flex-start;
}

.catalog-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.catalog-item-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: opacity 0.2s;
}

.catalog-item-inactive {
  opacity: 0.45;
}

.catalog-item-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-top: 2px;
}

.catalog-toggle-input {
  display: none;
}

.catalog-toggle-slider {
  display: block;
  width: 32px;
  height: 18px;
  background: var(--border);
  border-radius: 9px;
  position: relative;
  transition: background 0.2s;
}

.catalog-toggle-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 12px;
  height: 12px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.catalog-toggle-input:checked + .catalog-toggle-slider {
  background: var(--accent, #6366f1);
}

.catalog-toggle-input:checked + .catalog-toggle-slider::after {
  transform: translateX(14px);
}

.catalog-item-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.catalog-item-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.catalog-item-price {
  font-size: 12px;
  color: var(--text-secondary);
  font-weight: 500;
  margin-left: 8px;
}

.catalog-item-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.4;
}

.catalog-item-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.catalog-item-delete,
.catalog-item-edit {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 4px 5px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s, background 0.15s;
}

.catalog-item-delete:hover {
  color: #dc2626;
  background: #fee2e2;
}

.catalog-item-edit:hover {
  color: var(--accent);
  background: var(--surface-alt);
}

.catalog-item-save {
  font-size: 12px;
  padding: 4px 10px;
}
.catalog-edit-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}

.catalog-done-row {
  margin-top: 20px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 12px;
}

.cta-items-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
}

.cta-item-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: border-color 0.15s;
}

.cta-item-row.cta-item-active {
  border-color: var(--accent, #6366f1);
  background: var(--surface-alt, #f5f5ff);
}

.cta-item-radio-label {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  cursor: pointer;
  margin-top: 2px;
}

.cta-radio-input {
  display: none;
}

.cta-radio-dot {
  display: block;
  width: 16px;
  height: 16px;
  border: 2px solid var(--border);
  border-radius: 50%;
  position: relative;
  transition: border-color 0.15s;
}

.cta-radio-dot::after {
  content: "";
  position: absolute;
  inset: 2px;
  border-radius: 50%;
  background: var(--accent, #6366f1);
  opacity: 0;
  transition: opacity 0.15s;
}

.cta-radio-input:checked + .cta-radio-dot {
  border-color: var(--accent, #6366f1);
}

.cta-radio-input:checked + .cta-radio-dot::after {
  opacity: 1;
}

.cta-item-text {
  flex: 1;
  font-size: 13px;
  color: var(--text-primary);
  line-height: 1.5;
  margin: 0;
  word-break: break-word;
}

.cta-item-delete {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 2px 5px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

.cta-item-delete:hover {
  color: #dc2626;
  background: #fee2e2;
}

.cta-add-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-top: 4px;
  border-top: 1px solid var(--border);
}

.cta-save-success {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  color: #2d8a4e;
}
.cta-save-success.hidden { display: none; }

.settings-sidebar-nav-item.filled .settings-sidebar-nav-icon {
  color: #e07b00;
  opacity: 1;
}

/* Responsive: на маленьких экранах виджет уходит под статьи */
@media (max-width: 900px) {
  .project-body-layout {
    flex-direction: column;
  }
  .project-body-layout .project-articles-section {
    border-right: none;
  }
  .orientirs-widget {
    flex: none;
    width: 100%;
    border-top: 1px solid var(--border);
  }
}

/* ── Article generation stepper ─────────────────────────────────────────────── */

.gen-stepper-wrap {
  padding: 40px 24px 24px;
  max-width: 560px;
  margin: 0 auto;
}

.gen-stepper {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.gen-stepper-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  position: relative;
  padding-bottom: 8px;
}

.gen-stepper-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  transition: border-color 0.2s, background 0.2s;
}

.gen-stepper-item.active .gen-stepper-icon {
  border-color: var(--accent);
  background: var(--accent-light, #eff6ff);
}

.gen-stepper-item.done .gen-stepper-icon {
  border-color: #22c55e;
  background: #f0fdf4;
  color: #16a34a;
}

.gen-step-num {
  line-height: 1;
}

.gen-step-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--accent);
  border-top-color: transparent;
  border-radius: 50%;
  animation: gen-spin 0.7s linear infinite;
}

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

.gen-step-check {
  color: #16a34a;
  font-size: 15px;
  font-weight: 700;
}

.gen-stepper-text {
  padding-top: 5px;
  flex: 1;
  min-width: 0;
}

.gen-stepper-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.gen-stepper-item.active .gen-stepper-name {
  color: var(--accent);
}

.gen-stepper-item.done .gen-stepper-name {
  color: var(--text-secondary);
}

.gen-stepper-sub {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.gen-stepper-line {
  position: absolute;
  left: 15px;
  top: 36px;
  bottom: 0;
  width: 2px;
  background: var(--border);
  transition: background 0.3s;
}

.gen-stepper-line.done {
  background: #22c55e;
}

/* ── Deep Research блок (deepdive) ───────────────────────────────────────────── */

.gen-deep-research {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 24px;
  border: 1px solid var(--accent, #3b82f6);
  border-radius: 10px;
  background: var(--accent-light, #eff6ff);
  flex-wrap: wrap;
}

.gen-deep-research.done {
  border-color: #22c55e;
  background: #f0fdf4;
}

.gen-deep-research-icon {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.gen-deep-research-label {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent, #3b82f6);
  flex-shrink: 0;
}

.gen-deep-research.done .gen-deep-research-label {
  color: #16a34a;
}

.gen-deep-research-phrase {
  font-size: 12px;
  color: var(--text-secondary);
  flex: 1;
  min-width: 140px;
}

.gen-deep-research-progress {
  width: 100%;
  height: 3px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}

.gen-deep-research-bar {
  height: 100%;
  width: 0%;
  background: var(--accent, #3b82f6);
  border-radius: 2px;
  transition: width 0.2s linear;
}

.gen-deep-research.done .gen-deep-research-bar {
  background: #22c55e;
}

/* H1 preview card */
.gen-h1-preview {
  margin-top: 20px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 13px;
}

.gen-h1-preview.hidden { display: none; }

.gen-h1-preview-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 6px;
}

.gen-h1-preview-h1 {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
}

.gen-h1-preview-intent {
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-secondary);
}

/* Error banner */
.gen-error-banner {
  margin-top: 20px;
  padding: 12px 16px;
  background: #fee2e2;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  color: #991b1b;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.gen-error-banner.hidden { display: none; }

.gen-retry-btn {
  margin-left: auto;
  padding: 4px 12px;
  border: 1px solid #fca5a5;
  border-radius: 6px;
  background: #fff;
  color: #991b1b;
  font-size: 12px;
  cursor: pointer;
  white-space: nowrap;
}

.gen-retry-btn:hover {
  background: #fca5a5;
  color: #7f1d1d;
}

/* Success bar */
.gen-success-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #f0fdf4;
  border: 1px solid #86efac;
  border-radius: 8px;
  font-size: 13px;
  color: #166534;
  margin-bottom: 20px;
}

.gen-success-close {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #16a34a;
  line-height: 1;
  padding: 0 2px;
}

/* ── Article generation: progress bar + skeleton ─────────────────────────── */

.gen-progress-wrap {
  max-width: 720px;
  margin: 0 auto;
  padding: 32px 24px 48px;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.gen-progress-top {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.gen-progress-label {
  font-size: 13px;
  color: var(--text-secondary);
  min-height: 18px;
  transition: opacity 0.3s;
}

.gen-progress-reassurance {
  margin-top: -4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  animation: gen-reassurance-in 0.3s ease both;
}

@keyframes gen-reassurance-in {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .gen-progress-reassurance { animation: none; }
}

.gen-progress-track {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
}

.gen-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 99px;
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

.gen-progress-steps {
  display: flex;
  gap: 24px;
  margin-top: 4px;
}

.gen-progress-step {
  display: flex;
  align-items: center;
  gap: 6px;
  opacity: 0.4;
  transition: opacity 0.3s;
}

.gen-progress-step.active {
  opacity: 1;
}

.gen-progress-step.done {
  opacity: 0.6;
}

.gen-progress-step-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-secondary);
  flex-shrink: 0;
  transition: background 0.3s;
}

.gen-progress-step.active .gen-progress-step-dot {
  background: var(--accent);
}

.gen-progress-step.done .gen-progress-step-dot {
  background: #22c55e;
}

.gen-progress-step-label {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.gen-progress-step.active .gen-progress-step-label {
  color: var(--accent);
  font-weight: 600;
}

/* ── Skeleton shimmer ─────────────────────────────────────────────────────── */

@keyframes gen-shimmer {
  0%   { background-position: -600px 0; }
  100% { background-position: 600px 0; }
}

.gen-sk {
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    var(--border) 25%,
    color-mix(in srgb, var(--border) 60%, var(--surface)) 50%,
    var(--border) 75%
  );
  background-size: 600px 100%;
  animation: gen-shimmer 1.6s ease-in-out infinite;
}

.gen-sk-h1 {
  height: 36px;
  width: 78%;
  margin-bottom: 24px;
}

.gen-sk-heading {
  height: 22px;
  width: 45%;
  margin-bottom: 14px;
}

.gen-sk-line {
  height: 14px;
  margin-bottom: 8px;
}

.gen-sk-line--90 { width: 90%; }
.gen-sk-line--85 { width: 85%; }
.gen-sk-line--80 { width: 80%; }
.gen-sk-line--75 { width: 75%; }
.gen-sk-line--72 { width: 72%; }
.gen-sk-line--70 { width: 70%; }
.gen-sk-line--68 { width: 68%; }
.gen-sk-line--65 { width: 65%; }
.gen-sk-line--60 { width: 60%; }
.gen-sk-line--50 { width: 50%; }

.gen-sk-block {
  margin-bottom: 28px;
}

.gen-sk-insights {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 28px;
}

.gen-sk-insight {
  height: 80px;
  border-radius: 10px;
}

.gen-sk-section {
  margin-bottom: 28px;
}

.gen-skeleton-wrap {
  padding-top: 8px;
}

/* ═══════════════════════════════════════════════════════════════
   MOBILE ADAPTATION  (≤ 767px)
   ─────────────────────────────────────────────────────────────
   Strategy:
   • Desktop sidebar → hidden; replaced by slide-in drawer (same .sidebar)
   • Mobile top header (hamburger + logo + new-article)
   • Mobile bottom tab bar (dashboard / projects / account)
   • Bento grid → single-column cards
   • Settings/catalog sidebar nav → horizontal pill tabs
   • Account settings nav → horizontal tabs
   • Content padding reduced to 16px
   ═══════════════════════════════════════════════════════════════ */

/* ── Mobile top header ───────────────────────────────────────── */
.mobile-header {
  display: none;
}
@media (max-width: 767px) {
  .mobile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 300;
    height: 52px;
    background: var(--bg);
    border-bottom: 1px solid var(--border);
    padding: 0 12px;
    flex-shrink: 0;
  }
  body.has-verify-banner .mobile-header {
    top: 40px;
  }
}

.mobile-menu-btn,
.mobile-new-btn {
  display: none;
}
@media (max-width: 767px) {
  .mobile-menu-btn,
  .mobile-new-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: none;
    color: var(--text-primary);
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
  }
  .mobile-new-btn {
    display: none;
  }
  .mobile-menu-btn:active,
  .mobile-new-btn:active {
    background: var(--surface-alt);
  }
}

.mobile-header-logo {
  display: none;
}
@media (max-width: 767px) {
  .mobile-header-logo {
    display: flex;
    align-items: center;
    gap: 8px;
    text-decoration: none;
    color: var(--text-primary);
  }
  .mobile-header-logo-img {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    object-fit: contain;
  }
  .mobile-header-logo-name {
    font-size: 15px;
    font-weight: 700;
    letter-spacing: -0.2px;
  }
}

/* ── Mobile sidebar overlay ──────────────────────────────────── */
.mobile-sidebar-overlay {
  display: none;
}
@media (max-width: 767px) {
  .mobile-sidebar-overlay {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 399;
    background: rgba(0, 0, 0, 0.45);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }
  .mobile-sidebar-overlay.active {
    opacity: 1;
    pointer-events: auto;
  }
}

/* ── Sidebar as slide-in drawer on mobile ────────────────────── */
@media (max-width: 767px) {
  .sidebar {
    display: flex !important;   /* override the old display:none */
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 400;
    transform: translateX(-100%);
    transition: transform 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: none;
  }
  .sidebar.mobile-open {
    transform: translateX(0);
  }
  body.has-verify-banner .sidebar {
    top: 40px;
  }
}

/* ── App root offset for top header on mobile ────────────────── */
@media (max-width: 767px) {
  .app-root {
    height: calc(100dvh - 52px);
    margin-top: 52px;
  }
  body.has-verify-banner .app-root {
    height: calc(100dvh - 52px - 40px);
    margin-top: calc(52px + 40px);
  }
}


/* ── Main padding & overflow fix on mobile ───────────────────── */
@media (max-width: 767px) {
  .main {
    overflow-y: auto;
    overflow-x: hidden;
  }
}

/* ── Breadcrumbs on mobile ───────────────────────────────────── */
@media (max-width: 767px) {
  .breadcrumbs {
    padding: 10px 16px 6px;
    overflow-x: auto;
    white-space: nowrap;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .breadcrumbs::-webkit-scrollbar { display: none; }
}

/* ── Dashboard bento grid → single column ────────────────────── */
@media (max-width: 767px) {
  .dashboard-bento {
    display: flex;
    flex-direction: column;
    gap: 12px;
    padding: 16px 16px 24px;
    overflow-y: visible;
    overflow-x: hidden;
    flex: none;
  }

  /* Reset explicit grid placement */
  .bento-traffic,
  .bento-counter,
  .bento-wizard-card,
  .bento-recent-card,
  .bento-score-card,
  .bento-sub-card,
  .bento-keywords-card {
    grid-column: unset;
    grid-row: unset;
  }

  /* Give the chart enough room for labels and the active value. */
  .bento-traffic-svg-wrap {
    flex: none;
    height: clamp(180px, 48vw, 220px);
  }
}

/* ── Project launchpad on mobile ─────────────────────────────── */
@media (max-width: 767px) {
  .project-launchpad {
    padding: 40px 16px 26px;
    flex: none;
    justify-content: flex-start;
    min-height: unset;
  }
  .project-chat {
    flex: none;
    overflow: visible;
  }
  .project-launchpad-input {
    max-width: 100%;
  }
  .suggest-topics-bar {
    width: 100%;
    margin-top: 36px;
  }
  .ai-wizard-launch-btn {
    font-size: 12px;
    padding: 7px 12px;
  }
  .chat-welcome {
    gap: 10px;
  }
  .starter-topics { flex: none; max-height: min(48vh, 460px); padding: 14px; margin-bottom: 16px; }
  .starter-topics-subtitle { display: none; }
  .project-hero-title {
    font-size: 16px;
  }

  /* When starter topics are shown on mobile */
  #view-project.has-starter-topics .project-launchpad,
  #view-project:has(#starter-topics:not(.hidden)) .project-launchpad {
    padding: 12px 16px 26px;
    overflow: visible;
  }
  #view-project.has-starter-topics .suggest-topics-bar,
  #view-project:has(#starter-topics:not(.hidden)) .suggest-topics-bar {
    margin-top: 0;
  }
  #view-project.has-starter-topics .chat-welcome,
  #view-project:has(#starter-topics:not(.hidden)) .chat-welcome {
    justify-content: flex-start;
    gap: 10px;
    padding: 16px 16px 0;
  }
  #view-project.has-starter-topics .chat-welcome .project-hero-title,
  #view-project:has(#starter-topics:not(.hidden)) .chat-welcome .project-hero-title {
    font-size: 18px;
  }
  #view-project.has-starter-topics .chat-welcome .project-view-logo,
  #view-project.has-starter-topics .chat-welcome .project-view-logo-fallback,
  #view-project:has(#starter-topics:not(.hidden)) .chat-welcome .project-view-logo,
  #view-project:has(#starter-topics:not(.hidden)) .chat-welcome .project-view-logo-fallback {
    width: 42px;
    height: 42px;
  }
}

/* ── Chat input row ──────────────────────────────────────────── */
@media (max-width: 767px) {
  .chat-container { padding: 12px 16px; }
  .main-header    { padding: 16px 16px 0; }
  .chat-input-hint {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .project-chat-messages { padding: 16px 16px 12px; }
  .project-chat-input-area {
    padding: 0 16px 16px;
    max-width: 100%;
  }
}

/* ── Settings page: sidebar nav → horizontal tab strip ──────── */
@media (max-width: 767px) {
  .settings-page-layout {
    flex-direction: column;
    overflow: visible;
  }
  .settings-scroll {
    padding: 16px 16px 80px;
  }
  .settings-wizard-banner-bottom {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    padding-left: 0;
  }
  .bento-wizard-cta {
    width: 100%;
    text-align: center;
  }
  .settings-sidebar-nav {
    width: 100%;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 4px;
    padding: 10px 16px 0;
    scrollbar-width: none;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    position: sticky;
    top: 0;
    z-index: 10;
    /* cancel vertical-only padding from desktop */
    padding-top: 10px;
  }
  .settings-sidebar-nav::-webkit-scrollbar { display: none; }
  .settings-sidebar-nav-item {
    flex-shrink: 0;
    width: auto;
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 20px;
    white-space: nowrap;
  }
  .settings-sidebar-nav-item.active {
    background: var(--btn-bg);
    color: var(--btn-text);
  }
  .settings-sidebar-nav-icon {
    display: none;
  }
  .catalog-edit-layout {
    padding: 20px 16px 80px;
  }
  .catalog-edit-main {
    max-width: 100%;
  }
  .catalog-form-row {
    flex-direction: column;
    gap: 8px;
  }
  .catalog-input-price {
    width: 100%;
  }
}

/* ── Account settings: sidebar nav → horizontal tabs ────────── */
@media (max-width: 767px) {
  .account-settings-layout {
    flex-direction: column;
    overflow: visible;
  }
  .account-settings-nav {
    width: 100%;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 4px;
    padding: 10px 16px 8px;
    scrollbar-width: none;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
  }
  .account-settings-nav::-webkit-scrollbar { display: none; }
  .account-settings-nav-item {
    flex-shrink: 0;
    width: auto;
    padding: 8px 14px;
    font-size: 13px;
    border-radius: 20px;
    white-space: nowrap;
  }
  .account-settings-nav-item.active {
    background: var(--btn-bg);
    color: var(--btn-text);
  }
  .account-settings-tab {
    overflow-y: auto;
    padding-bottom: 24px;
  }
}

/* ── Projects view ───────────────────────────────────────────── */
@media (max-width: 767px) {
  .projects-view-header {
    padding: 16px 16px 12px;
    gap: 12px;
  }
  .projects-view-title {
    font-size: 18px;
  }
  .projects-view-list {
    padding: 0 16px 48px;
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

/* ── View scrolling on mobile ────────────────────────────────── */
@media (max-width: 767px) {
  .view:not(#view-ai-wizard) {
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  #view-ai-wizard {
    overflow: hidden;
  }
}

/* ── Project body layout: already goes to column at 900px ───── */
@media (max-width: 767px) {
  #view-project {
    overflow-y: auto;
    flex: 1;
  }
  .project-body-layout {
    flex-direction: column;
    flex: 1;
  }
  .orientirs-widget {
    display: none;
  }
  .project-articles-section {
    padding: 16px 16px 24px;
    max-height: none;
    flex: 1;
    overflow-y: auto;
  }
}

/* ── Gen stepper padding ─────────────────────────────────────── */
@media (max-width: 767px) {
  .gen-stepper-wrap {
    padding: 20px 16px 24px;
    max-width: 100%;
  }
}

/* ── Address row in settings ─────────────────────────────────── */
@media (max-width: 767px) {
  .settings-address-row {
    flex-direction: column;
    gap: 8px;
  }
  .settings-address-row > * {
    width: 100% !important;
  }
}

/* ── Billing plan row ────────────────────────────────────────── */
@media (max-width: 767px) {
  .billing-plan-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
  .billing-plan-btn {
    width: 100%;
    text-align: center;
  }
}

/* ── Dashboard empty state ───────────────────────────────────── */
@media (max-width: 767px) {
  .dashboard-empty {
    padding: 40px 24px;
    text-align: center;
  }
}

/* ── Keyword coverage card ───────────────────────────────────── */
@media (max-width: 767px) {
  .bento-kw-body {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── Wizard steps on mobile ──────────────────────────────────── */
@media (max-width: 767px) {
  body.wizard-mode .main {
    padding-bottom: 0;
    overflow: hidden;
  }
  #view-ai-wizard {
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }
  .wizard-layout {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    padding: 0;
    gap: 0;
  }
  .wizard-progress-panel {
    display: none;
  }
  .wizard-chat-area {
    position: relative;
    flex: 1;
    min-height: 0;
    overflow: hidden;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .wizard-messages {
    position: absolute;
    inset: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 100px;
  }
  .wizard-input-area {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 2;
  }
}

/* ── Modal overlay on mobile: render above fixed header ─────── */
@media (max-width: 767px) {
  .overlay {
    top: 52px;
    z-index: 400;
  }
  body.has-verify-banner .overlay {
    top: 92px;
  }
}

.gen-success-close:hover { color: #166534; }

/* ── Preferences dialog ─────────────────────────────────────── */
.preferences-dialog-bubble {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.preferences-dialog-msg {
  margin: 0;
  line-height: 1.6;
}
.preferences-dialog-msg p {
  margin: 0 0 10px 0;
}
.preferences-dialog-msg p:last-child {
  margin-bottom: 0;
}
.preferences-dialog-msg ul {
  margin: 0;
  padding-left: 20px;
}
.preferences-dialog-msg li {
  margin: 0 0 8px 0;
}
.preferences-dialog-final-box {
  background: var(--bg-secondary, #f8f9fa);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 8px;
  padding: 10px 12px;
}
.preferences-dialog-final-label {
  margin: 0 0 6px 0;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary, #64748b);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.preferences-dialog-final-text {
  margin: 0;
  font-size: 13px;
  font-family: inherit;
  color: var(--text-primary, #1e293b);
  line-height: 1.5;
}
.preferences-dialog-final-text p {
  margin: 0 0 10px 0;
}
.preferences-dialog-final-text p:last-child {
  margin-bottom: 0;
}
.preferences-dialog-markdown-list {
  margin: 0;
  padding-left: 20px;
}
.preferences-dialog-markdown-list li {
  margin: 0 0 8px 0;
}
.preferences-dialog-markdown-list li:last-child {
  margin-bottom: 0;
}
.preferences-dialog-final-text strong,
.preferences-dialog-msg strong {
  font-weight: 700;
}
.preferences-dialog-generate-btn {
  align-self: flex-start;
}
.preferences-skip-btn {
  margin: 0 0 4px 0;
  font-size: 12px;
  opacity: 0.7;
}

/* ── WordPress settings status badge ──────────────────────────────────────── */
.wp-status {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
}
.wp-status-ok       { background: #d1fae5; color: #065f46; }
.wp-status-fail     { background: #fee2e2; color: #991b1b; }
.wp-status-unchecked{ background: #e5e7eb; color: #4b5563; }
.wp-status-detail   { font-size: 12px; }

/* ── Integrations page ───────────────────────────────────────────────────── */
.integrations-page-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary, #111827);
  margin: 0 0 20px 0;
}

/* ── Integrations grid (summary cards) ───────────────────────────────────── */
.int-cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}
.int-summary-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.int-summary-card:hover {
  border-color: var(--accent, #e07b39);
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
}
.int-summary-card-logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
}
.int-summary-card-body {
  flex: 1;
}
.int-summary-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #111827);
  margin-bottom: 2px;
}
.int-summary-card-desc {
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
  line-height: 1.4;
}

/* ── Back button in detail panel ─────────────────────────────────────────── */
.int-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary, #6b7280);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-bottom: 16px;
}
.int-back-btn:hover { color: var(--text-primary, #111827); }

.integration-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 12px;
  overflow: hidden;
  margin-bottom: 16px;
}

.integration-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border, #e5e7eb);
}

.integration-card-logo {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.integration-card-info {
  flex: 1;
  min-width: 0;
}

.integration-card-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary, #111827);
  margin-bottom: 2px;
}

.integration-card-desc {
  font-size: 13px;
  color: var(--text-secondary, #6b7280);
  line-height: 1.4;
}

.integration-status-badge {
  flex-shrink: 0;
  font-size: 12px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  background: #e5e7eb;
  color: #4b5563;
}

.integration-status-badge.connected {
  background: #d1fae5;
  color: #065f46;
}

.integration-status-badge.error {
  background: #fee2e2;
  color: #991b1b;
}

.integration-card-body {
  padding: 20px;
}

.integration-card-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 12px;
  flex-wrap: wrap;
}

.int-wp-help-link {
  margin-left: auto;
  font-size: 13px;
  color: var(--text-secondary, #6b7280);
  text-decoration: none;
  border-bottom: 1px dashed var(--text-secondary, #6b7280);
  white-space: nowrap;
}
.int-wp-help-link:hover {
  color: var(--text-primary, #111827);
  border-bottom-color: var(--text-primary, #111827);
}
.integration-card-info .int-wp-help-link {
  margin-left: 0;
  margin-top: 6px;
  width: fit-content;
  font-size: 12px;
}
.integration-card-note {
  margin-top: 8px;
  margin-bottom: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-secondary, #6b7280);
}
.integration-card-note--tilda {
  margin-bottom: 20px;
}
.tilda-mode-section {
  margin: 26px 0 22px;
}
.tilda-mode-title {
  margin: 0 0 14px;
  color: var(--text-primary, #1f2937);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
}
.tilda-mode-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.tilda-mode-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  min-height: 190px;
  padding: 16px;
  border: 1.5px solid var(--border, #e5e7eb);
  border-radius: 14px;
  background: #fff;
  color: var(--text-primary, #1f2937);
  text-align: left;
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, box-shadow .16s ease;
}
.tilda-mode-card:hover:not(:disabled) {
  border-color: #d8653f;
  background: #fffaf7;
}
.tilda-mode-card.is-selected {
  border-color: #d8653f;
  background: #fff7f2;
  box-shadow: 0 0 0 2px rgba(216, 101, 63, .12);
}
.tilda-mode-card:focus-visible {
  outline: 3px solid #d8653f;
  outline-offset: 3px;
}
.tilda-mode-card:disabled { cursor: default; opacity: .62; }
.tilda-mode-card-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 70px;
  margin-bottom: 12px;
  border-radius: 9px;
  background: #f7f5f2;
  color: #343b42;
}
.tilda-mode-card-visual svg { width: 118px; height: 62px; }
.tilda-mode-card-title {
  display: block;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
}
.tilda-mode-card-desc {
  display: block;
  margin-top: 7px;
  color: var(--text-secondary, #6b7280);
  font-size: 12px;
  line-height: 1.4;
}
.tilda-mode-hint {
  margin: 10px 0 0;
  color: var(--text-secondary, #6b7280);
  font-size: 12px;
  line-height: 1.45;
}
@media (max-width: 760px) {
  .tilda-mode-cards { grid-template-columns: 1fr; }
  .tilda-mode-card { min-height: 0; display: grid; grid-template-columns: 84px 1fr; column-gap: 14px; align-items: center; }
  .tilda-mode-card-visual { grid-row: span 2; width: 84px; height: 64px; margin: 0; }
  .tilda-mode-card-visual svg { width: 80px; height: 56px; }
  .tilda-mode-card-desc { margin-top: 3px; }
}
#integration-card-tilda {
  overflow: visible;
}
.tilda-project-field {
  position: relative;
}
.tilda-project-field .field-tooltip {
  position: static;
}
.tilda-project-field .field-tooltip-body {
  left: 0;
  bottom: calc(100% + 8px);
  transform: none;
  width: min(320px, 100%);
}
.tilda-template-help {
  margin: 8px 0 20px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}
.tilda-auto-template {
  margin: 8px 0 20px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-secondary, #fafafa);
}
.tilda-auto-template-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.tilda-auto-preferences {
  min-height: 78px;
  resize: vertical;
  line-height: 1.45;
}
.tilda-auto-result {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.tilda-auto-stage {
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 650;
}
.tilda-auto-stage.error {
  color: var(--error-text);
}
.tilda-auto-profile {
  margin: 7px 0 0;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}
.tilda-auto-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.tilda-auto-actions a.pill-button {
  text-decoration: none;
}
.tilda-template-help summary {
  cursor: pointer;
  color: var(--text-primary);
  font-weight: 600;
}
.tilda-template-help p {
  margin: 12px 0 0;
}
.tilda-template-help code {
  overflow-wrap: anywhere;
}
.tilda-template-mapping {
  margin: 4px 0 20px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-secondary, #fafafa);
  overflow-anchor: none;
}
.tilda-template-mapping-title {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 700;
}
.tilda-template-mapping-note {
  margin: 6px 0 14px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.5;
}
.tilda-template-mapping-grid {
  display: grid;
  grid-template-columns: minmax(130px, 0.7fr) minmax(0, 1.3fr);
  align-items: center;
  gap: 10px 14px;
  margin-bottom: 16px;
}

.tilda-faq-toggle-row {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 4px;
}

.tilda-faq-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  position: relative;
}

.tilda-faq-toggle input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.tilda-faq-toggle-slider {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: var(--border);
  transition: background 0.2s ease;
}

.tilda-faq-toggle-slider::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 16px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.2s ease;
}

.tilda-faq-toggle input:checked + .tilda-faq-toggle-slider {
  background: var(--accent);
}

.tilda-faq-toggle input:checked + .tilda-faq-toggle-slider::after {
  transform: translateX(16px);
}

.tilda-faq-toggle input:focus-visible + .tilda-faq-toggle-slider {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
}

.tilda-faq-toggle-value {
  min-width: 28px;
  color: var(--text-secondary);
}
.tilda-faq-layout-hint {
  grid-column: 2;
  margin: -4px 0 2px;
  color: var(--text-secondary);
  font-size: 12px;
  line-height: 1.45;
}
.tilda-template-mapping-grid .field-label {
  margin: 0;
}
.tilda-template-required {
  color: var(--error, #dc2626);
  font-weight: 700;
}
.tilda-template-mapping-grid .field-input {
  min-width: 0;
}
.tilda-template-mapping-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tilda-template-refresh {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  min-width: 42px;
  padding: 0;
}
@media (max-width: 560px) {
  .tilda-template-mapping-grid {
    grid-template-columns: 1fr;
    gap: 6px;
  }
  .tilda-template-mapping-grid .field-input {
    margin-bottom: 6px;
  }
  .tilda-faq-layout-hint {
    grid-column: 1;
  }
}
.tilda-connector-actions {
  margin-top: 24px;
}
.pill-button.tilda-save-button {
  background: var(--accent);
  color: #fff;
}
.pill-button.tilda-save-button:hover:not(:disabled) {
  background: var(--accent-hover);
}
.tilda-connector-status:not(:empty) {
  margin-top: 20px;
  font-size: 13px;
  line-height: 1.5;
}
.tilda-template-status:not(:empty) {
  margin-top: 12px;
}
#view-integrations .settings-scroll {
  padding-bottom: 40px;
}
.tilda-connector-status.connected {
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--success-bg);
  color: var(--success-text);
  font-weight: 600;
}
.tilda-connector-status.error {
  color: var(--error-text);
}
.integration-card-note code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  background: #f3f4f6;
  padding: 1px 4px;
  border-radius: 4px;
  color: var(--text-primary, #111827);
}

/* ── Webhook connector card styles ────────────────────────────────────────── */
.warning-text {
  font-size: 12px;
  color: #b45309;
  background: #fffbeb;
  padding: 6px 10px;
  border-radius: 6px;
  margin-top: 6px;
  margin-bottom: 0;
}

.wh-platform-pills {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.wh-platform-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border, #e5e7eb);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary, #6b7280);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  user-select: none;
  background: var(--surface, #fff);
}

.wh-platform-pill:hover {
  border-color: var(--accent, #e07b39);
  color: var(--accent, #e07b39);
}

.wh-platform-pill input[type="radio"] {
  display: none;
}

.wh-platform-pill:has(input[type="radio"]:checked) {
  border-color: var(--accent, #e07b39);
  color: var(--accent, #e07b39);
  background: #fff8f3;
}

/* ── WP discovery banner (project header) ─────────────────────────────────── */
.wp-discovery-banner {
  position: absolute;
  top: 26px;
  transform: translateY(-50%);
  right: 52px; /* sits to the left of #btn-project-settings (gear) */
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px 6px 12px;
  background: #fdf3ef;
  border: 1px solid #e8b49e;
  color: var(--accent);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  z-index: 10;
}
.wp-discovery-label {
  cursor: pointer;
  user-select: none;
}
.wp-discovery-label:hover { text-decoration: underline; }
.wp-discovery-dismiss {
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border-radius: 999px;
}
.wp-discovery-dismiss:hover { background: rgba(201,100,66,.1); }
.wp-discovery-dismiss:disabled { opacity: 0.5; cursor: wait; }

/* One explicit action for every publishing destination. */
.article-publish-host { position: sticky; top: 12px; z-index: 5; margin-bottom: 16px; }
.article-publish-panel {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px; border: 1px solid var(--border, #e5e5e5);
  border-radius: 12px; background: var(--surface, #fff);
}
.article-publish-button {
  min-height: 44px; padding: 9px 14px; border: 0; border-radius: 9px;
  background: var(--accent); color: #fff; font: inherit; font-weight: 600;
  cursor: pointer;
}
.article-publish-button:hover:not(:disabled) { background: var(--accent-hover); }
.article-publish-button:disabled { opacity: .55; cursor: not-allowed; }
.article-publish-actions { display: flex; align-items: stretch; gap: 8px; }
.article-publish-actions[hidden] { display: none; }
.article-publish-new-article { flex: 1; min-width: 0; }
.article-publish-update {
  position: relative; display: inline-grid; place-items: center; flex: 0 0 44px;
  min-height: 44px; padding: 0; border: 1px solid var(--border, #e5e5e5);
  border-radius: 9px; background: var(--surface, #fff);
  color: var(--text-secondary, #64748b); cursor: pointer;
}
.article-publish-update:hover:not(:disabled), .article-publish-update:focus-visible {
  background: #f5f4f2; color: var(--text-primary, #111);
}
.article-publish-update:disabled { opacity: .5; cursor: not-allowed; }
.article-publish-update::after {
  content: attr(data-tooltip); position: absolute; right: 0; bottom: calc(100% + 8px);
  width: max-content; max-width: min(260px, 80vw); padding: 7px 10px;
  border-radius: 7px; background: #262626; color: #fff; font-size: 12px;
  line-height: 1.35; font-weight: 400; text-align: center;
  opacity: 0; pointer-events: none; transform: translateY(3px);
  transition: opacity .15s ease, transform .15s ease; z-index: 2;
}
.article-publish-update:hover::after, .article-publish-update:focus-visible::after {
  opacity: 1; transform: translateY(0);
}
.article-publish-reconcile { min-height: 38px; padding: 7px 10px; border: 1px solid var(--accent); border-radius: 8px; background: transparent; color: var(--accent); font: inherit; cursor: pointer; }
.article-publish-reconcile:disabled { opacity: .55; cursor: not-allowed; }
.article-publish-choice { width: 100%; min-height: 40px; border: 1px solid var(--border, #ddd); border-radius: 8px; padding: 6px; background: var(--surface, #fff); color: var(--text-primary, #111); }
.article-publish-status-row { display: flex; flex-direction: column; align-items: stretch; gap: 8px; min-height: 22px; }
.article-publish-status { font-size: 12px; line-height: 1.4; color: var(--text-secondary, #64748b); text-align: center; }
.article-publish-link, .article-publish-setup-link { font-size: 12px; color: var(--accent); }
.article-publish-lottie { position: relative; align-self: center; width: min(100%, 240px); aspect-ratio: 4 / 3; overflow: hidden; }
.article-publish-lottie[hidden] { display: none; }
.article-publish-lottie-stage { position: absolute; inset: 0; }
.article-publish-lottie-stage svg { display: block; width: 100% !important; height: 100% !important; }
.article-publish-lottie-fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--accent); font: 72px/1 Arial, sans-serif; }
.article-publish-lottie-fallback[hidden] { display: none; }
@media (max-width: 900px) { .article-publish-host { top: 0; } }

/* ── Branches section ────────────────────────────────────────────────────── */
.branches-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.branches-title {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text-primary, #111827);
}
.branches-subtitle {
  font-size: 13px;
  color: var(--text-secondary, #6b7280);
  margin: 0;
  max-width: 480px;
  line-height: 1.5;
}
.branches-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* ── Branch card ─────────────────────────────────────────────────────────── */
.branch-card {
  background: var(--surface, #fff);
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 10px;
  padding: 14px 16px;
  transition: border-color 0.15s;
}
.branch-card:hover {
  border-color: #c7d2fe;
}
.branch-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.branch-card-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.branch-card-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: #f0f4ff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #4f46e5;
}
.branch-card-info {
  min-width: 0;
}
.branch-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #111827);
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.branch-badge-primary {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  background: #e0f2fe;
  color: #0369a1;
  border-radius: 4px;
  padding: 2px 6px;
  flex-shrink: 0;
}
.branch-card-addr {
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.branch-card-phone {
  font-size: 12px;
  color: var(--text-secondary, #6b7280);
  margin-top: 1px;
}
.branch-card-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.btn-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border, #e5e7eb);
  border-radius: 7px;
  padding: 6px;
  cursor: pointer;
  color: var(--text-secondary, #6b7280);
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}
.btn-icon:hover {
  background: var(--surface-hover, #f3f4f6);
  color: var(--text-primary, #111827);
  border-color: #d1d5db;
}
.btn-icon.btn-icon--danger:hover {
  background: #fef2f2;
  color: #dc2626;
  border-color: #fca5a5;
}

/* ── Inline branch form panel ────────────────────────────────────────────── */
.branch-form-panel {
  margin-top: 12px;
  background: var(--surface, #fff);
  border: 1px solid #c7d2fe;
  border-radius: 12px;
  border-left: 3px solid #4f46e5;
  overflow: hidden;
}
.branch-form-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 0;
}
.branch-form-panel-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary, #111827);
}
.branch-form-close {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary, #6b7280);
  padding: 4px;
  border-radius: 6px;
  transition: background 0.12s, color 0.12s;
}
.branch-form-close:hover {
  background: var(--surface-hover, #f3f4f6);
  color: var(--text-primary, #111827);
}
.branch-form-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.branch-form-body .field {
  margin-bottom: 14px;
}
.branch-form-body .settings-address-row {
  display: flex;
  gap: 12px;
  margin-bottom: 14px;
}
.branch-form-body .settings-address-row .field {
  margin-bottom: 0;
}
.branch-form-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}
.branch-form-checkbox input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: #4f46e5;
  flex-shrink: 0;
  margin: 0;
}
.branch-form-map-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.branch-form-map-row:first-of-type {
  margin-top: 6px;
}
.branch-map-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  border-radius: 4px;
}
.branch-coords-hint {
  font-size: 12px;
  color: var(--text-secondary, #64748b);
  background: var(--bg-subtle, #f8fafc);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  padding: 5px 10px;
  margin-top: 4px;
}
.branch-coords-hint.hidden { display: none; }
.branch-form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 14px;
  border-top: 1px solid var(--border, #e5e7eb);
  margin-top: 6px;
}
.btn-sm {
  font-size: 13px;
  padding: 6px 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ── Field inline editor ── */
.field-edit-btn {
  opacity: 0.72;
  transition: opacity 0.15s;
  flex: none;
}
.field-edit-btn:hover, .field-edit-btn:focus-visible, .field-edit-btn.is-editing {
  opacity: 1;
}
.field-editor-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  width: 100%;
  padding: 10px 0;
}
.article-edit-control {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-size: 12px;
  color: var(--text-secondary, #64748b);
}
.field-editor-textarea {
  width: 100%;
  min-height: 80px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
  line-height: 1.6;
  color: var(--text-primary, #1e293b);
  background: var(--bg-primary, #fff);
  border: 1px solid var(--border, #e2e8f0);
  border-radius: 6px;
  resize: vertical;
  box-sizing: border-box;
  outline: none;
}
.field-editor-textarea:focus {
  border-color: var(--accent, #e06f2d);
  box-shadow: 0 0 0 2px rgba(224,111,45,.12);
}
.article-edit-add {
  align-self: flex-start;
  border: 1px solid var(--border, #e2e8f0);
  background: transparent;
  border-radius: 6px;
  padding: 6px 9px;
  color: var(--accent, #e06f2d);
  cursor: pointer;
}
.article-edit-error {
  font-size: 12px;
  color: var(--error, #b42318);
  line-height: 1.4;
}
.article-edit-error:empty { display: none; }
.article-edit-error-visual { margin: 4px 0 0; }
.sidebar-field-value-row:has(.field-editor-wrap) { flex-wrap: wrap; }
.sidebar-field-value-row .field-editor-wrap { flex-basis: 100%; }
.article-body-display[hidden], .sidebar-field-value[hidden] { display: none; }
.article-edit-empty { color: var(--text-secondary, #64748b); }
.article-body-display.is-visual-editing {
  border-radius: 6px;
  outline: 1px solid var(--accent, #e06f2d);
  outline-offset: 4px;
}
.article-body-display.is-visual-editing [data-body-editable] {
  cursor: text;
  outline: none;
}
.article-body-display.is-visual-editing [data-body-editable]:focus {
  background: rgba(224, 111, 45, 0.06);
  border-radius: 3px;
}
@media (max-width: 900px) {
  .field-edit-btn { opacity: 1; min-width: 32px; min-height: 32px; }
}

.kb-confirm-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kb-confirm-box {
  background: #fff;
  border-radius: 12px;
  padding: 24px 28px 20px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  min-width: 260px;
  text-align: center;
}
.kb-confirm-box p {
  margin: 0 0 20px;
  font-size: 15px;
  color: var(--text-primary, #1e293b);
}
.kb-confirm-btns {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.kb-confirm-cancel {
  padding: 8px 20px;
  border-radius: 8px;
  border: 1px solid var(--border, #e2e8f0);
  background: #fff;
  color: var(--text-secondary, #64748b);
  font-size: 14px;
  cursor: pointer;
}
.kb-confirm-cancel:hover { background: var(--bg-secondary, #f8fafc); }
.kb-confirm-ok {
  padding: 8px 20px;
  border-radius: 8px;
  border: none;
  background: #ef4444;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}
.kb-confirm-ok:hover { background: #dc2626; }

/* ── VIEW: IDEA («Предложить идею») ── */
#view-idea { overflow-y: auto; overflow-x: hidden; }

.idea-wrap {
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(40px, 9vh, 96px) 20px 64px;
  box-sizing: border-box;
}
.idea-hero { overflow-wrap: break-word; }

.idea-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 18px;
}

.idea-hero {
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0 0 30px;
}

.idea-composer {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px 24px 24px;
  box-shadow: 0 10px 34px rgba(26, 26, 26, 0.05);
}

/* Промо-«марка» — почтовый штамп в углу композера */
.idea-stamp {
  position: absolute;
  top: -14px;
  right: 18px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: 7px 12px;
  background: var(--surface);
  border: 1.5px dashed var(--accent);
  border-radius: 8px;
  transform: rotate(-2deg);
}
.idea-stamp-line {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent);
}
.idea-stamp-reward {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
}

.idea-field-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin: 8px 0 8px;
}

.idea-textarea {
  width: 100%;
  box-sizing: border-box;
  resize: vertical;
  min-height: 120px;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-primary);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  transition: border-color 0.15s ease;
}
.idea-textarea::placeholder { color: var(--text-disabled); }
.idea-textarea:focus {
  outline: none;
  border-color: var(--border-focus);
}

.idea-error {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--error-text);
}

.idea-submit {
  margin-top: 18px;
  width: 100%;
  padding: 13px 20px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--btn-text);
  background: var(--btn-bg);
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.idea-submit:hover:not(:disabled) { background: var(--btn-hover); }
.idea-submit:disabled { opacity: 0.6; cursor: default; }

.idea-tg {
  margin: 20px 2px 0;
  font-size: 14px;
  color: var(--text-secondary);
}
.idea-tg-link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.idea-tg-link:hover { color: var(--accent-hover); text-decoration: underline; }

/* Success-состояние */
.idea-success {
  text-align: center;
  padding: 24px 4px;
  animation: idea-success-in 0.35s ease both;
}
.idea-success-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 20px;
  color: var(--accent);
  background: var(--surface);
  border: 1.5px solid var(--accent);
  border-radius: 50%;
}
.idea-success-title {
  font-size: clamp(22px, 3.5vw, 28px);
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  margin: 0 0 14px;
}
.idea-success-body {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-secondary);
  margin: 0 0 18px;
}
.idea-success-promo {
  display: inline-block;
  font-size: 13px;
  line-height: 1.5;
  color: var(--accent);
  background: var(--surface);
  border: 1px dashed var(--accent);
  border-radius: 10px;
  padding: 10px 16px;
  margin: 0;
}

@keyframes idea-success-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media (prefers-reduced-motion: reduce) {
  .idea-success { animation: none; }
}

/* Unread ideas in the project topic pool. */
.topic-new-indicator {
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 8px;
  border-radius: 50%;
  background: var(--accent);
  vertical-align: middle;
}
