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

/* ── Custom Properties ── */
:root {
  --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;
}

.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; }

/* 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 ── */
.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;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 10px 10px 10px 14px;
  transition: border-color 0.15s;
}
.chat-input-row:focus-within { border-color: var(--border-focus); }

.chat-input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  resize: none;
  font-size: 14px;
  font-family: inherit;
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 0;
  max-height: 120px;
  padding: 0;
}
.chat-input::placeholder { color: var(--text-disabled); }

.send-button {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  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; font-size: 16px; 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;
}

.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-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: monospace;
  font-size: 12px;
  background: var(--surface-alt);
  padding: 10px;
  border-radius: 6px;
  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: scrollable body */
.article-body-scroll {
}

/* 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;
}

/* 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; }

/* ── 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 {
  position: absolute;
  bottom: 10px;
  right: 14px;
  font-size: 10px;
  color: var(--text-secondary);
  opacity: 0.6;
  pointer-events: none;
}
.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;
  min-height: 0;
  position: relative;
}
.bento-traffic-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
  shape-rendering: geometricPrecision;
}
.bento-traffic-svg line {
  shape-rendering: crispEdges;
}
.bento-traffic-dot-group { cursor: default; }
.bento-traffic-tip {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
}
.bento-traffic-dot-group:hover .bento-traffic-tip { opacity: 1; }
.bento-traffic-footer {
  font-size: 11px;
  color: var(--text-secondary);
  text-align: center;
  margin-top: -4px;
}

/* 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 — 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: 24px 40px 16px;
  flex-shrink: 0;
}
.projects-view-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}
.projects-view-list {
  padding: 0 40px 32px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 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; }

/* ── 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;
}

/* ── 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-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;
}
.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 ── */
.topic-chips-label {
  font-size: 13px;
  font-weight: 600;
  margin: 0 0 10px 0;
  color: var(--text-primary);
}
.topic-chips-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.topic-chip {
  background: none;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--text-primary);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s, background 0.15s;
}
.topic-chip:hover {
  border-color: var(--btn-bg);
  background: var(--hover-bg, rgba(0,0,0,0.03));
}
.topic-chip:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.topic-chip-selected {
  border-color: var(--btn-bg);
  background: var(--hover-bg, rgba(0,0,0,0.03));
}
.topic-chip {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.topic-chip-kw {
  font-size: 11px;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ── 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);
}

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

/* ── 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;
  top: 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;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-color: var(--border, #e5e7eb);
}
.intent-chip .intent-tooltip::after {
  content: "";
  position: absolute;
  bottom: calc(100% - 1px);
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-bottom-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);
}

/* ── 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);
}
.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;
}
#article-view-blocks {
  padding: 16px 40px;
  overflow-y: auto;
  flex: 1;
}

.article-view-footer {
  flex-shrink: 0;
  padding: 16px 40px 28px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
}

/* ── 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;
}

/* ── Settings page ── */

.settings-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 24px 40px 120px; /* 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; }

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

/* 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;
}

/* 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;
  justify-content: flex-end;
  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 .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 24px;
  border-top: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
  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;
}

.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;
}

.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);
}

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

.catalog-edit-layout {
  padding: 24px 40px 40px;
  max-width: 680px;
  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;
}

.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-delete {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 12px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color 0.15s, background 0.15s;
}

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

/* 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);
  }
}
