/* styles-ai.css — extracted from styles.css (AI panel, meeting transcript, hemingway, fact-check, markdown lint styles) */

/* ── AI (ai.js) ──────────────────────────────────────────────── */

      .ai-popup {
        background: var(--card-bg-solid);
        border: 1px solid rgba(var(--primary-rgb), 0.3);
        border-radius: var(--radius-lg);
        padding: 0;
        z-index: var(--z-toast);
        box-shadow: 0 16px 48px rgba(0,0,0,0.6);
        display: flex;
        flex-direction: column;
        overflow: hidden;
      }
      .ai-popup--sm { border-radius: var(--radius-md); box-shadow: 0 12px 40px rgba(0,0,0,0.6); }
      .ai-popup-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 12px 16px;
        border-bottom: 1px solid rgba(255,255,255,0.06);
        flex-shrink: 0;
      }
      .ai-popup-header--sm { padding: 10px 14px; }
      .ai-popup-body {
        padding: 16px;
        overflow-y: auto;
        flex: 1;
        font-size: var(--fs-base);
        color: var(--text-dim);
        line-height: 1.7;
        min-height: 60px;
      }
      .ai-popup-body--sm { padding: 14px; min-height: 50px; }
      .ai-popup-footer {
        display: flex;
        gap: 8px;
        padding: 10px 16px;
        border-top: 1px solid rgba(255,255,255,0.06);
        flex-shrink: 0;
      }
      .ai-popup-footer--sm { padding: 8px 14px; }
      .ai-popup-input-row {
        display: flex;
        gap: 6px;
        padding: 8px 16px;
        border-top: 1px solid rgba(255,255,255,0.06);
        flex-shrink: 0;
      }
      .ai-popup-input {
        flex: 1;
        background: rgba(255,255,255,0.04);
        border: 1px solid rgba(255,255,255,0.1);
        border-radius: var(--radius-base);
        padding: 8px 12px;
        color: var(--text-dim);
        font-size: var(--fs-base);
        outline: none;
      }
      .ai-popup-send {
        width: 36px;
        border-radius: var(--radius-base);
        border: none;
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        color: var(--text-main);
        cursor: pointer;
        font-size: var(--fs-md);
        font-weight: 700;
        flex-shrink: 0;
      }
      .ai-insert-btn {
        flex: 1;
        padding: 8px;
        border-radius: var(--radius-base);
        border: none;
        background: linear-gradient(135deg, var(--primary), var(--secondary));
        color: var(--text-main);
        cursor: pointer;
        font-size: var(--fs-base);
        font-weight: 600;
      }
      .ai-copy-btn {
        padding: 8px 14px;
        border-radius: var(--radius-base);
        border: 1px solid rgba(255,255,255,0.1);
        background: transparent;
        color: var(--text-muted);
        cursor: pointer;
        font-size: var(--fs-base);
      }
      .ai-tag-banner {
        position: fixed;
        bottom: 24px;
        right: 24px;
        background: linear-gradient(135deg, var(--bg-solid), var(--card-bg-solid));
        border: 1px solid rgba(var(--primary-rgb), 0.4);
        border-radius: var(--radius-md);
        padding: 14px 16px;
        z-index: var(--z-modal);
        box-shadow: 0 8px 32px rgba(0,0,0,0.5);
        animation: gn-slide-right-in 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
      }
      .ai-banner-header {
        font-size: var(--fs-sm);
        color: var(--primary-light);
        margin-bottom: 8px;
        font-weight: 600;
        letter-spacing: 0.5px;
      }
      .ai-tag-pill {
        background: rgba(var(--primary-rgb), 0.2);
        border-radius: var(--radius-sm);
        padding: 1px 6px;
        margin: 2px;
        display: inline-block;
      }
      .ai-banner-btns {
        display: flex;
        gap: 8px;
        margin-top: 6px;
      }
      .ai-banner-apply {
        flex: 1;
        padding: 6px 10px;
        background: var(--primary);
        border: none;
        border-radius: var(--radius-base);
        color: var(--text-main);
        cursor: pointer;
        font-size: var(--fs-base);
        font-weight: 600;
      }
      .ai-banner-dismiss {
        padding: 6px 10px;
        background: rgba(255,255,255,0.08);
        border: none;
        border-radius: var(--radius-base);
        color: var(--text-dim);
        cursor: pointer;
        font-size: var(--fs-base);
      }
      .ai-model-dropdown {
        position: absolute;
        bottom: 100%;
        right: 0;
        margin-bottom: 6px;
        background: var(--card-bg);
        border: 1px solid rgba(255,255,255,0.12);
        border-radius: var(--radius-md);
        padding: 8px 0;
        min-width: 240px;
        max-height: 320px;
        overflow-y: auto;
        z-index: var(--z-modal);
        box-shadow: 0 12px 40px rgba(0,0,0,0.5);
      }
      .ai-model-item {
        padding: 8px 14px;
        cursor: pointer;
        font-size: var(--fs-base);
        color: var(--text-dim);
        display: flex;
        justify-content: space-between;
        align-items: center;
        transition: background 0.15s;
      }
      .ai-model-item:hover { background: rgba(var(--primary-rgb), 0.1); }
      .ai-voice-badge {
        position: fixed;
        bottom: 1.5rem;
        left: 50%;
        transform: translateX(-50%);
        background: linear-gradient(135deg, var(--color-danger), #b91c1c);
        color: var(--text-main);
        padding: 8px 18px;
        border-radius: var(--radius-lg);
        z-index: var(--z-toast);
        display: flex;
        align-items: center;
        gap: 10px;
        font-size: var(--fs-base);
        box-shadow: 0 8px 24px rgba(var(--color-danger-rgb),0.4);
        animation: gn-popup-in 0.2s both;
      }
      .ai-sysprompt-box {
        background: var(--card-bg);
        border: 1px solid rgba(255,255,255,0.12);
        border-radius: var(--radius-lg);
        padding: 24px 28px;
        max-width: 560px;
        width: 95%;
        max-height: 80vh;
        overflow-y: auto;
      }
      body.light-mode .ai-popup { background: #fff; border-color: rgba(var(--primary-rgb),0.15); box-shadow: 0 16px 48px rgba(0,0,0,0.12); }
      body.light-mode .ai-popup-input { background: #f5f7fa; border-color: rgba(0,0,0,0.12); color: #1e293b; }
      body.light-mode .ai-tag-banner { background: linear-gradient(135deg, #f8fafc, #fff); border-color: rgba(var(--primary-rgb),0.25); box-shadow: 0 8px 32px rgba(0,0,0,0.1); }
      body.light-mode .ai-model-dropdown { background: #fff; border-color: rgba(0,0,0,0.12); box-shadow: 0 12px 40px rgba(0,0,0,0.12); }
      body.light-mode .ai-model-item:hover { background: rgba(0,0,0,0.04); }
      body.light-mode .ai-sysprompt-box { background: #fff; border-color: rgba(0,0,0,0.12); }
      /* body.light-mode #inline-ai-toolbar — merged into line ~1275 */
.ai-ghost-text {
  color: rgba(var(--primary-rgb),0.35);
  pointer-events: none;
  user-select: none;
  font-style: italic;
}
.ai-banner-content-scroll { max-height: 180px; overflow-y: auto; margin-bottom: 8px; }
.ai-banner-row { margin-bottom: 8px; }
.ai-banner-row--card { padding: 6px 8px; background: rgba(255,255,255,0.03); border-radius: var(--radius-base); }
.ai-banner-note-title {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-main);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ai-banner-desc { margin-bottom: 4px; font-size: var(--fs-base); color: var(--text-dim); }
.ai-link-banner {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: linear-gradient(135deg, var(--bg-solid), var(--card-bg-solid));
  border: 1px solid rgba(var(--primary-rgb), 0.4);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  max-width: 360px;
  z-index: var(--z-modal-bg);
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  animation: gn-slide-right-in 0.3s cubic-bezier(0.175,0.885,0.32,1.275);
}
.ai-link-banner-header {
  font-size: var(--fs-sm);
  color: var(--primary-light);
  margin-bottom: 8px;
  font-weight: 600;
  letter-spacing: 0.5px;
}
.ai-link-banner-list { margin-bottom: 10px; }
.ai-link-banner-item { font-size: var(--fs-base); color: var(--text-dim); margin-bottom: 4px; }
.ai-link-banner-item-link { color: var(--primary-light); font-weight: 500; }
.ai-link-banner-item-reason { opacity: 0.5; font-size: var(--fs-sm); margin-left: 4px; }
.ai-link-banner-btns { display: flex; gap: 8px; margin-top: 6px; }
.ai-link-banner-apply {
  flex: 1;
  padding: 6px 10px;
  background: var(--primary);
  border: none;
  border-radius: var(--radius-base);
  color: var(--text-main);
  cursor: pointer;
  font-size: var(--fs-base);
  font-weight: 600;
}
.ai-link-banner-dismiss {
  padding: 6px 10px;
  background: rgba(255,255,255,0.08);
  border: none;
  border-radius: var(--radius-base);
  color: var(--text-dim);
  cursor: pointer;
  font-size: var(--fs-base);
}
body.light-mode .ai-link-banner { background: linear-gradient(135deg, #f8fafc, #fff); border-color: rgba(var(--primary-rgb),0.25); box-shadow: 0 8px 32px rgba(0,0,0,0.1); }
.ai-chat-thumb { max-height: 120px; border-radius: var(--radius-base); margin-top: 6px; display: block; }
.ai-insert-wrapper { display: block; margin-top: 10px; opacity: 0; transition: opacity 0.15s; }
.msg:hover .ai-insert-wrapper { opacity: 1; }
.ai-rag-sources {
  font-size: var(--fs-sm);
  color: var(--text-muted);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.ai-rag-source-link { cursor: pointer; color: var(--primary-light); margin-right: 6px; }
.ai-voice-badge-dot {
  width: 10px;
  height: 10px;
  border-radius: var(--radius-full);
  background: #fff;
  animation: gn-blink 1s infinite;
}
body.light-mode .ai-voice-badge-dot { background: var(--primary); }
.ai-voice-badge-stop {
  background: rgba(255,255,255,0.25);
  border: none;
  color: var(--text-main);
  padding: 4px 12px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  font-size: var(--fs-base);
}
.ai-popup--fixed-center {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 500px;
  max-width: 92vw;
  max-height: 75vh;
}
.ai-popup-label {
  font-size: var(--fs-base);
  color: var(--primary-light);
  font-weight: 600;
}
.ai-followup-q {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.ai-followup-q-label { color: var(--primary-light); font-size: var(--fs-sm); font-weight: 600; }
.ai-followup-q-text { color: var(--text-muted); }
.ai-followup-a-label { color: var(--primary-light); font-size: var(--fs-sm); font-weight: 600; }
.ai-thinking { margin-top: 8px; opacity: 0.5; }
.ai-error-text { color: var(--color-danger); }
.ai-explain-insert { color: var(--primary-light); font-size: var(--fs-base); }
.ai-tmpl-del-btn {
  color: var(--color-danger);
  opacity: 0.5;
  cursor: pointer;
  margin-left: 8px;
  font-size: var(--fs-sm);
}
.ai-tmpl-sep { border-top: 1px solid rgba(255,255,255,0.08); margin: 4px 0; }
.ai-tmpl-add-item {
  padding: 8px 14px;
  cursor: pointer;
  font-size: var(--fs-base);
  color: var(--primary-light);
  transition: background 0.15s;
}
.ai-tmpl-add-item:hover { background: rgba(var(--primary-rgb), 0.08); }

/* ── Meeting Transcript (ai.js) ──────────────────────────────── */

.mt-title { margin: 0 0 6px; color: var(--text-dim); font-size: var(--fs-lg); }
.mt-desc { margin: 0 0 14px; color: var(--text-muted); font-size: var(--fs-base); }
.mt-textarea {
  width: 100%;
  height: 200px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-md);
  color: var(--text-dim);
  font-size: var(--fs-base);
  padding: 12px;
  resize: vertical;
  box-sizing: border-box;
  font-family: inherit;
}
.mt-btn-row { display: flex; gap: 8px; margin-top: 12px; justify-content: flex-end; }
.mt-process-btn {
  padding: 9px 22px;
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border: none;
  color: var(--text-main);
  border-radius: var(--radius-md);
  cursor: pointer;
  font-size: var(--fs-md);
  font-weight: 600;
}
.mt-result { margin-top: 14px; }
.mt-loading { color: var(--text-muted); font-size: var(--fs-base); text-align: center; padding: 12px; }
.mt-error { color: var(--color-danger); font-size: var(--fs-base); padding: 8px; }
body.light-mode .mt-textarea { background: #f5f7fa; border-color: rgba(0,0,0,0.12); color: #1e293b; }


/* ── Hemingway Writing Assistant ──────────────────────────── */

.hw-panel {
  background: var(--card-bg);
  border-bottom: 1px solid var(--glass-border);
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: var(--fs-base);
  animation: hw-slide-down 0.2s ease;
}
.hw-panel-title { font-weight: 600; color: var(--text-main); }
.hw-score {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 36px; height: 24px; border-radius: var(--radius-md);
  font-weight: 700; font-size: var(--fs-base); padding: 0 8px;
}
.hw-score-good { background: rgba(var(--color-success-rgb), 0.13); color: var(--color-success); }
.hw-score-ok   { background: rgba(var(--color-warning-rgb), 0.13); color: var(--color-warning); }
.hw-score-bad  { background: rgba(var(--color-danger-rgb), 0.13); color: var(--color-danger); }
.hw-stats { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.hw-stat { display: flex; align-items: center; gap: 4px; color: var(--text-dim); }
.hw-stat-count { font-weight: 600; min-width: 16px; }
.hw-legend { display: flex; gap: 10px; flex-wrap: wrap; }
.hw-legend-item { display: flex; align-items: center; gap: 4px; color: var(--text-dim); font-size: var(--fs-base); }
.hw-dot { width: 10px; height: 10px; border-radius: var(--radius-full); display: inline-block; }
.hw-dot-long   { background: var(--color-warning); }
.hw-dot-vlong  { background: var(--color-danger); }
.hw-dot-complex{ background: var(--secondary, #a855f7); }
.hw-dot-adverb { background: var(--color-info); }
.hw-dot-repeat { background: var(--color-success); }
.hw-panel-close {
  margin-left: auto; background: none; border: none;
  color: var(--text-dim); cursor: pointer; font-size: var(--fs-md);
  padding: 2px 6px; border-radius: var(--radius-xs);
}
.hw-panel-close:hover { background: rgba(var(--primary-rgb), 0.1); color: var(--text-main); }
.hw-block-long {
  background: rgba(251, 191, 36, 0.12) !important;
  border-left: 3px solid var(--color-warning);
  padding-left: 8px !important;
  transition: background 0.2s;
}
.hw-block-vlong {
  background: rgba(var(--color-danger-rgb), 0.12) !important;
  border-left: 3px solid var(--color-danger);
  padding-left: 8px !important;
  transition: background 0.2s;
}
.hw-complex { background: rgba(168, 85, 247, 0.2); border-radius: var(--radius-xs); padding: 0 1px; cursor: pointer; }
.hw-adverb  { background: rgba(59, 130, 246, 0.2); border-radius: var(--radius-xs); padding: 0 1px; cursor: pointer; }
.hw-repeat  { background: rgba(34, 197, 94, 0.2);  border-radius: var(--radius-xs); padding: 0 1px; cursor: pointer; }
.hw-complex:hover, .hw-adverb:hover, .hw-repeat:hover { filter: brightness(1.15); }
.hw-block-long:hover, .hw-block-vlong:hover { filter: brightness(1.05); cursor: pointer; }
.hw-tooltip {
  position: fixed; z-index: var(--z-toast);
  background: var(--card-bg); border: 1px solid var(--glass-border);
  border-radius: var(--radius-md); padding: 12px 16px;
  max-width: 400px; min-width: 220px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.25);
  animation: gn-fade-in 0.15s ease;
}
.hw-tooltip-label { font-size: var(--fs-sm); color: var(--text-dim); opacity: 0.7; margin-bottom: 4px; }
.hw-tooltip-text { font-size: var(--fs-base); color: var(--text-dim); margin-bottom: 8px; line-height: 1.5; font-style: italic; }
.hw-tooltip-suggestion {
  font-size: var(--fs-base); color: var(--text-main); line-height: 1.5;
  margin-bottom: 8px; padding: 8px;
  background: rgba(var(--primary-rgb), 0.08); border-radius: var(--radius-sm);
}
.hw-tooltip-actions { display: flex; gap: 8px; }
.hw-tooltip-btn {
  padding: 4px 12px; border-radius: var(--radius-sm); border: none;
  cursor: pointer; font-size: var(--fs-base); font-weight: 500;
}
.hw-tooltip-btn-primary { background: var(--primary); color: white; }
.hw-tooltip-btn-primary:hover { filter: brightness(1.1); }
.hw-tooltip-btn-ai { background: rgba(var(--primary-rgb), 0.15); color: var(--primary); }
.hw-tooltip-btn-ai:hover { background: rgba(var(--primary-rgb), 0.25); }
.hw-tooltip-btn-cancel { background: rgba(255,255,255,0.08); color: var(--text-dim); }
.hw-tooltip-btn-cancel:hover { background: rgba(255,255,255,0.15); }
.hw-tooltip-loading { color: var(--primary); font-size: var(--fs-base); padding: 8px 0; }
body.light-mode .hw-tooltip { box-shadow: 0 8px 24px rgba(0,0,0,0.12); }
body.light-mode .hw-tooltip-btn-cancel { background: rgba(0,0,0,0.06); }
body.light-mode .hw-tooltip-btn-cancel:hover { background: rgba(0,0,0,0.1); }

/* ── Fact-Check Panel ────────────────────────────────────── */

.fc-panel {
  background: var(--card-bg-solid);
  border: 1px solid rgba(var(--primary-rgb), 0.2);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
  backdrop-filter: blur(12px);
}
.fc-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.fc-panel-title {
  font-weight: 700;
  font-size: var(--fs-base);
  color: var(--text-main);
}
.fc-status {
  font-size: var(--fs-sm);
  color: var(--text-dim);
}
.fc-panel-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: center;
}
.fc-btn-cite {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(var(--primary-rgb), 0.3);
  background: rgba(var(--primary-rgb), 0.12);
  color: var(--primary-light);
  font-size: var(--fs-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.fc-btn-cite:hover { background: rgba(var(--primary-rgb), 0.25); }
.fc-btn-recheck, .fc-panel-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: var(--fs-base);
  padding: 2px 4px;
  transition: color 0.2s;
}
.fc-btn-recheck:hover, .fc-panel-close:hover { color: var(--text-main); }
.fc-claims {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}
.fc-claim {
  background: rgba(255, 255, 255, 0.03);
  border-radius: var(--radius-base);
  padding: 10px 12px;
  border-left: 3px solid #888;
  transition: border-color 0.3s;
}
.fc-claim.fc-verified { border-left-color: var(--color-success); }
.fc-claim.fc-unverified { border-left-color: var(--color-warning); }
.fc-claim.fc-false { border-left-color: var(--color-danger); }
.fc-claim-text {
  font-size: var(--fs-base);
  color: var(--text-main);
  margin-bottom: 6px;
  line-height: 1.4;
}
.fc-claim-verdict {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-sm);
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-md);
  margin-bottom: 6px;
}
.fc-verdict-ok { background: rgba(var(--color-success-rgb), 0.15); color: var(--color-success); }
.fc-verdict-warn { background: rgba(var(--color-warning-rgb), 0.15); color: var(--color-warning); }
.fc-verdict-bad { background: rgba(var(--color-danger-rgb), 0.15); color: var(--color-danger); }
.fc-claim-sources {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 4px;
}
.fc-source {
  font-size: var(--fs-sm);
  color: var(--text-dim);
  display: flex;
  gap: 4px;
  align-items: baseline;
}
.fc-source a {
  color: var(--primary-light);
  text-decoration: none;
  word-break: break-all;
}
.fc-source a:hover { text-decoration: underline; }
.fc-source-num {
  color: var(--primary-light);
  font-weight: 700;
  min-width: 16px;
}
.fc-loading {
  text-align: center;
  padding: 20px;
  color: var(--text-dim);
  font-size: var(--fs-base);
}
.fc-loading-spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(var(--primary-rgb), 0.2);
  border-top: 2px solid var(--primary-light);
  border-radius: var(--radius-full);
  animation: fc-spin 0.8s linear infinite;
  vertical-align: middle;
  margin-right: 8px;
}
.fc-footnote {
  color: var(--primary-light);
  font-size: var(--fs-xs);
  vertical-align: super;
  font-weight: 700;
  cursor: help;
}
body.light-mode .fc-panel { background: rgba(248, 248, 255, 0.95); border-color: rgba(var(--primary-rgb), 0.15); }
body.light-mode .fc-claim { background: rgba(0, 0, 0, 0.02); }
body.light-mode .fc-btn-cite { background: rgba(var(--primary-rgb), 0.08); }

/* ── Markdown Linter Panel ───────────────────────────────── */

.ml-panel {
  background: var(--card-bg-solid);
  border: 1px solid rgba(0, 212, 255, 0.2);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-bottom: 10px;
  backdrop-filter: blur(12px);
}
.ml-panel-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.ml-panel-title {
  font-weight: 700;
  font-size: var(--fs-base);
  color: var(--text-main);
}
.ml-score {
  font-size: var(--fs-base);
  font-weight: 700;
  padding: 2px 8px;
  border-radius: var(--radius-md);
  min-width: 24px;
  text-align: center;
}
.ml-score-ok { background: rgba(var(--color-success-rgb), 0.15); color: var(--color-success); }
.ml-score-bad { background: rgba(var(--color-danger-rgb), 0.15); color: var(--color-danger); }
.ml-score-warn { background: rgba(var(--color-warning-rgb), 0.15); color: var(--color-warning); }
.ml-score-info { background: rgba(var(--color-info-rgb), 0.15); color: var(--color-info); }
.ml-panel-actions {
  margin-left: auto;
  display: flex;
  gap: 6px;
}
.ml-btn-recheck, .ml-panel-close {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  font-size: var(--fs-base);
  padding: 2px 4px;
  transition: color 0.2s;
}
.ml-btn-recheck:hover, .ml-panel-close:hover { color: var(--text-main); }
.ml-stats {
  max-height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ml-issue {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.ml-issue:hover { background: rgba(255, 255, 255, 0.04); }
.ml-issue-error { border-left: 2px solid var(--color-danger); }
.ml-issue-warn { border-left: 2px solid var(--color-warning); }
.ml-issue-info { border-left: 2px solid var(--color-info); }
.ml-issue-icon { font-size: var(--fs-base); flex-shrink: 0; margin-top: 1px; }
.ml-issue-body { flex: 1; min-width: 0; }
.ml-issue-msg {
  font-size: var(--fs-base);
  color: var(--text-main);
  line-height: 1.3;
}
.ml-issue-fix {
  font-size: var(--fs-sm);
  color: var(--text-dim);
  margin-top: 2px;
}
.ml-mark-error {
  outline: 2px solid rgba(var(--color-danger-rgb), 0.5);
  outline-offset: 1px;
  border-radius: var(--radius-xs);
  background: rgba(var(--color-danger-rgb), 0.08);
}
.ml-mark-warn {
  outline: 2px solid rgba(var(--color-warning-rgb), 0.4);
  outline-offset: 1px;
  border-radius: var(--radius-xs);
  background: rgba(var(--color-warning-rgb), 0.06);
}
.ml-mark-info {
  outline: 1px dashed rgba(var(--color-info-rgb), 0.3);
  outline-offset: 1px;
  background: rgba(var(--color-info-rgb), 0.04);
}
.ml-mark-flash {
  animation: ml-flash 0.6s ease 2;
}
body.light-mode .ml-panel { background: rgba(248, 248, 255, 0.95); border-color: rgba(0, 150, 200, 0.15); }
body.light-mode .ml-issue:hover { background: rgba(0, 0, 0, 0.03); }
body.light-mode .ml-mark-error { background: rgba(var(--color-danger-rgb), 0.06); }
body.light-mode .ml-mark-warn { background: rgba(var(--color-warning-rgb), 0.04); }

      /* ── AI Smart Plan ───────────────────────────────────────── */
      .dr-aiplan-section {
        grid-column: 1 / -1;
        text-align: center;
        padding: 4px 0;
      }
      .dr-aiplan-btn {
        background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.12), rgba(var(--primary-rgb), 0.04));
        border: 1px solid rgba(var(--primary-rgb), 0.2);
        color: var(--primary-light);
        padding: 10px 24px;
        border-radius: var(--radius-md);
        font-size: var(--fs-md);
        font-family: inherit;
        font-weight: 500;
        cursor: pointer;
        transition: all 0.2s;
        width: 100%;
      }
      .dr-aiplan-btn:hover {
        background: linear-gradient(135deg, rgba(var(--primary-rgb), 0.2), rgba(var(--primary-rgb), 0.1));
        border-color: rgba(var(--primary-rgb), 0.4);
        transform: scale(1.02);
      }
      .dr-aiplan-btn:disabled {
        opacity: 0.6;
        cursor: wait;
        transform: none;
      }
      .dr-aiplan-result {
        text-align: left;
        font-size: var(--fs-base);
        line-height: 1.65;
        color: var(--text-main);
        padding: 8px 4px;
        white-space: pre-wrap;
      }

      .ai-input-area {
        padding: 0.75rem;
        border-top: 1px solid rgba(255, 255, 255, 0.05);
        display: flex;
        gap: 8px;
      }
      #ai-input {
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-md);
        padding: 8px 12px;
        color: var(--text-main);
        flex: 1;
        font-family: inherit;
        font-size: var(--fs-md);
      }
      #ai-input:focus:not(:focus-visible) { outline: none; }
      #ai-input:focus {
        border-color: var(--primary);
      }
      .ai-send-btn {
        background: var(--primary);
        border: none;
        color: white;
        border-radius: var(--radius-md);
        width: 36px;
        height: 36px;
        cursor: pointer;
        font-size: var(--fs-md);
        transition: 0.2s;
      }
      .ai-send-btn:hover {
        opacity: 0.85;
      }
      /* AI streaming cursor */
      .ai-cursor {
        display: inline-block;
        animation: blink-cursor 0.7s step-end infinite;
        color: var(--primary);
        font-size: var(--fs-base);
      }
      @keyframes blink-cursor {
        0%,
        100% {
          opacity: 1;
        }
        50% {
          opacity: 0;
        }
      }
      /* Quick Prompts */
      .ai-quick-prompts {
        display: flex;
        flex-wrap: wrap;
        gap: 5px;
        padding: 6px 10px 4px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
      }
      .ai-qp-btn {
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-lg);
        color: var(--text-dim);
        font-size: var(--fs-sm);
        padding: 3px 10px;
        cursor: pointer;
        transition: 0.15s;
        font-family: inherit;
      }
      .ai-qp-btn:hover {
        background: var(--primary);
        color: white;
        border-color: var(--primary);
      }
      /* AI Actions Dropdown */
      .ai-actions-wrap {
        position: relative;
        padding: 7px 10px 5px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        display: flex;
        align-items: center;
        gap: 6px;
      }
      .ai-actions-trigger {
        background: rgba(var(--primary-rgb), 0.15);
        border: 1px solid rgba(var(--primary-rgb), 0.35);
        border-radius: var(--radius-md);
        color: var(--primary-light);
        padding: 5px 10px;
        font-size: var(--fs-base);
        cursor: pointer;
        font-family: inherit;
        transition: 0.15s;
        display: flex;
        align-items: center;
        gap: 6px;
        white-space: nowrap;
        flex-shrink: 0;
      }
      .ai-actions-trigger:hover {
        background: rgba(var(--primary-rgb), 0.28);
      }
      .ai-actions-trigger .trigger-arrow {
        transition: transform 0.2s;
        font-size: var(--fs-sm);
      }
      .ai-actions-trigger.open .trigger-arrow {
        transform: rotate(180deg);
      }
      .ai-model-select-inline {
        background: rgba(var(--primary-rgb), 0.1);
        border: 1px solid rgba(var(--primary-rgb), 0.3);
        border-radius: var(--radius-md);
        color: var(--primary-light);
        padding: 6px 10px;
        font-size: var(--fs-base);
        cursor: pointer;
        font-family: inherit;
        outline: none;
        min-width: 0;
        transition: background 0.15s;
      }
      .ai-model-select-inline:hover {
        background: rgba(var(--primary-rgb), 0.2);
      }
      .ai-clear-btn {
        background: rgba(255, 255, 255, 0.05);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-md);
        color: rgba(255, 255, 255, 0.6);
        padding: 6px 11px;
        font-size: var(--fs-base);
        cursor: pointer;
        font-family: inherit;
        transition: 0.15s;
        white-space: nowrap;
        flex-shrink: 0;
        line-height: 1;
      }
      .ai-clear-btn:hover {
        background: rgba(var(--color-danger-rgb), 0.15);
        border-color: rgba(var(--color-danger-rgb), 0.3);
        color: var(--color-danger);
      }
      .ai-actions-dropdown {
        display: none;
        position: absolute;
        top: calc(100% + 6px);
        left: 0;
        min-width: 340px;
        background: var(--bg-solid);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(var(--primary-rgb), 0.35);
        border-radius: var(--radius-md);
        z-index: var(--z-sticky);
        box-shadow:
          0 8px 40px rgba(0, 0, 0, 0.8),
          0 0 0 1px rgba(var(--primary-rgb), 0.08),
          inset 0 1px 0 rgba(255, 255, 255, 0.04);
        overflow: hidden;
        max-height: 420px;
        overflow-y: auto;
        scrollbar-width: thin;
        scrollbar-color: rgba(var(--primary-rgb), 0.3) transparent;
      }
      .ai-launcher-wrap {
        position: relative;
      }
      .ai-launcher-dropdown {
        position: fixed; /* escape overflow-y:hidden on .header-right — positioned via JS */
        left: auto;
        right: 8px;
        top: 50px;
        min-width: min(92vw, 340px);
        width: min(92vw, 340px);
        max-width: calc(100vw - 12px);
        max-height: none;
        overflow: visible;
        overflow-y: visible;
        z-index: var(--z-toast);
      }
      .ai-actions-dropdown.open {
        display: block;
        animation: gn-popup-in 0.15s cubic-bezier(0.16, 1, 0.3, 1);
      }
      /* dropdownSlideIn — removed, now using gn-popup-in engine keyframe */
      .ai-action-group {
        padding: 8px 0 4px;
        border-bottom: 1px solid rgba(var(--primary-rgb), 0.07);
      }
      .ai-action-group:last-child {
        border-bottom: none;
        padding-bottom: 8px;
      }
      .ai-action-group-label {
        font-size: var(--fs-sm);
        color: rgba(var(--primary-rgb), 0.7);
        padding: 0 14px 6px;
        text-transform: uppercase;
        letter-spacing: 0.1em;
        font-weight: 700;
      }
      .ai-action-item {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 8px 14px;
        min-height: 34px;
        cursor: pointer;
        color: rgba(226, 232, 240, 0.75);
        font-size: var(--fs-base);
        line-height: 1.25;
        position: relative;
        transition:
          background 0.12s,
          color 0.12s,
          border-color 0.12s;
        border: none;
        border-left: 2px solid transparent;
        background: none;
        width: 100%;
        text-align: left;
        font-family: inherit;
      }
      .ai-action-item:hover {
        background: rgba(var(--primary-rgb), 0.14);
        color: var(--primary-light);
        border-left-color: rgba(var(--primary-rgb), 0.55);
      }
      .ai-action-item:focus-visible {
        background: rgba(var(--primary-rgb), 0.14);
        color: var(--primary-light);
        border-left-color: rgba(var(--primary-rgb), 0.55);
        outline: none;
        box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.35);
      }
      .ai-action-item .ai-action-icon {
        font-size: var(--fs-md);
        width: 22px;
        text-align: center;
        flex-shrink: 0;
        opacity: 0.85;
      }
      .ai-action-item:hover .ai-action-icon {
        opacity: 1;
      }
      .ai-action-item:focus-visible .ai-action-icon {
        opacity: 1;
      }
      .ai-action-item .ai-action-desc {
        font-size: var(--fs-sm);
        color: rgba(148, 163, 184, 0.7);
        margin-left: auto;
      }
      .ai-action-item:hover .ai-action-desc {
        color: rgba(148, 163, 184, 0.85);
      }
      /* Voice input recording animation */
      #ai-voice-btn.recording {
        background: var(--color-danger) !important;
        animation: pulse-rec 0.8s infinite alternate;
      }
      @keyframes pulse-rec {
        from {
          opacity: 1;
        }
        to {
          opacity: 0.5;
        }
      }
      /* Inline AI toolbar */
      #inline-ai-toolbar {
        position: fixed;
        z-index: var(--z-modal);
        display: none;
        gap: 4px;
        background: var(--card-bg-solid);
        border: 1px solid rgba(255, 255, 255, 0.15);
        border-radius: var(--radius-md);
        padding: 4px 6px;
        box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
        align-items: center;
        -webkit-app-region: no-drag;
      }
      .inline-ai-btn {
        background: none;
        border: none;
        color: var(--text-dim);
        font-size: var(--fs-base);
        padding: 3px 7px;
        border-radius: var(--radius-sm);
        cursor: pointer;
        font-family: inherit;
        white-space: nowrap;
        transition: 0.15s;
      }
      .inline-ai-btn:hover {
        background: var(--primary);
        color: white;
      }
      /* Right Sidebar */
      .sidebar-right {
        padding: 1rem;
        display: flex;
        flex-direction: column;
        gap: 1rem;
        overflow-y: auto;
        position: relative;
        min-width: 200px;
        max-width: 600px;
        border-radius: var(--radius-lg);
      }
      .sidebar-right .sidebar-resize-handle {
        right: auto;
        left: -6px;
      }
      .sidebar-right::-webkit-scrollbar {
        width: 4px;
      }
      .sidebar-right::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-xs);
      }
      .widget {
        background: rgba(255, 255, 255, 0.02);
        border-radius: var(--radius-lg);
        padding: 0.75rem;
        border: 1px solid rgba(255, 255, 255, 0.05);
        transition:
          border-color 0.15s,
          box-shadow 0.15s;
      }
      .widget.dragging {
        opacity: 0.35;
        border-style: dashed;
      }
      .widget.drag-over {
        border-color: rgba(var(--primary-rgb), 0.6);
        box-shadow: 0 0 0 2px rgba(var(--primary-rgb), 0.2);
      }
      .widget-label {
        font-size: var(--fs-sm);
        color: var(--text-dim);
        text-transform: uppercase;
        letter-spacing: 0.1em;
        margin-bottom: 0.6rem;
        display: flex;
        align-items: center;
        gap: 5px;
      }
      .widget-gear-btn {
        margin-left: auto;
        background: none;
        border: none;
        color: var(--text-dim);
        cursor: pointer;
        font-size: var(--fs-lg);
        padding: 3px 6px;
        border-radius: var(--radius-xs);
        opacity: 0.5;
        transition: opacity 0.15s;
      }
      .widget-gear-btn:hover {
        opacity: 1;
        background: rgba(255,255,255,0.08);
      }
      .widget-drag-handle {
        cursor: grab;
        color: rgba(255, 255, 255, 0.15);
        font-size: var(--fs-md);
        line-height: 1;
        flex-shrink: 0;
        transition: color 0.15s;
        user-select: none;
      }
      .widget-drag-handle:hover {
        color: rgba(255, 255, 255, 0.45);
      }
      .widget-drag-handle:active {
        cursor: grabbing;
      }
      .weather-row {
        display: flex;
        align-items: center;
        gap: 10px;
      }
      .weather-temp {
        font-size: var(--fs-xl);
        font-weight: 600;
        font-family: var(--font-mono);
      }
      #weather-forecast {
        scrollbar-width: thin;
        scrollbar-color: rgba(var(--primary-rgb), 0.3) transparent;
      }
      #weather-forecast::-webkit-scrollbar {
        height: 6px;
      }
      #weather-forecast::-webkit-scrollbar-track {
        background: rgba(255, 255, 255, 0.05);
        border-radius: var(--radius-xs);
      }
      #weather-forecast::-webkit-scrollbar-thumb {
        background: rgba(var(--primary-rgb), 0.4);
        border-radius: var(--radius-xs);
      }
      #weather-forecast::-webkit-scrollbar-thumb:hover {
        background: rgba(var(--primary-rgb), 0.6);
      }
      .crypto-row {
        display: flex;
        justify-content: space-between;
        margin-bottom: 6px;
        font-size: var(--fs-md);
        color: var(--text-main);
      }
      .price {
        color: var(--color-success);
        font-family: var(--font-mono);
        font-weight: 500;
      }
      .price.down {
        color: var(--color-danger);
      }

      /* Pomodoro */
      .pomo-display {
        font-family: var(--font-mono);
        font-size: var(--fs-2xl);
        font-weight: 700;
        text-align: center;
        color: var(--text-main);
        letter-spacing: 0.05em;
        text-shadow: 0 0 20px var(--primary);
        border-radius: var(--radius-base);
        padding: 2px 6px;
        transition: background 0.2s;
        cursor: pointer;
      }
      .pomo-display:hover {
        background: rgba(var(--primary-rgb),0.08);
      }
      .pomo-stepper {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        animation: gn-popup-in 0.2s ease-out;
      }
      /* pomoStepIn — removed, now using gn-popup-in engine keyframe */

      /* Theme dropdown panel */
      .theme-dropdown-panel {
        position: fixed;
        min-width: 220px;
        z-index: var(--z-toast); /* intentionally above --z-modal(9999): dropdown overlays all modals */
        background: var(--card-bg-solid);
        border: 1px solid rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-md);
        padding: 14px 16px;
        box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
        max-height: 80vh;
        overflow-y: auto;
      }
      .theme-dropdown-panel::-webkit-scrollbar { width: 4px; }
      .theme-dropdown-panel::-webkit-scrollbar-track { background: transparent; }
      .theme-dropdown-panel::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: var(--radius-xs); }
      .jm-bottom-section::-webkit-scrollbar { width: 4px; }
      .jm-bottom-section::-webkit-scrollbar-track { background: transparent; }
      .jm-bottom-section::-webkit-scrollbar-thumb { background: rgba(var(--primary-rgb,99,102,241),0.35); border-radius: var(--radius-xs); }
      .jm-bottom-section::-webkit-scrollbar-thumb:hover { background: rgba(var(--primary-rgb,99,102,241),0.55); }
      .theme-dropdown-panel input[type="range"] {
        -webkit-appearance: none; height: 4px; border-radius: var(--radius-xs);
        background: rgba(255,255,255,0.1); outline: none;
      }
      .theme-dropdown-panel input[type="range"]::-webkit-slider-thumb {
        -webkit-appearance: none; width: 14px; height: 14px; border-radius: var(--radius-full);
        background: var(--primary-light); cursor: pointer;
        box-shadow: 0 0 6px rgba(var(--primary-rgb), 0.4);
      }

      /* ✨ Animation type cards (inside theme-dropdown-panel) */
      .anim-type-grid {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 6px;
      }
      .anim-type-card {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 3px;
        padding: 8px 4px;
        border-radius: var(--radius-base);
        background: rgba(255,255,255,0.04);
        border: 1.5px solid transparent;
        cursor: pointer;
        transition: all 0.2s;
        user-select: none;
      }
      .anim-type-card:hover {
        background: rgba(255,255,255,0.08);
        border-color: rgba(var(--primary-rgb), 0.3);
      }
      .anim-type-card.active {
        background: rgba(var(--primary-rgb), 0.15);
        border-color: var(--primary-light);
        box-shadow: 0 0 12px rgba(var(--primary-rgb), 0.2);
      }
      .anim-card-emoji {
        font-size: var(--fs-lg);
        line-height: 1;
      }
      .anim-card-label {
        font-size: var(--fs-xs);
        font-weight: 600;
        color: var(--text-dim);
        text-align: center;
        line-height: 1.1;
        letter-spacing: 0.02em;
      }
      .anim-type-card.active .anim-card-label {
        color: var(--primary-light);
      }


      /* ── Light mode: AI panel extras ── */
      body.light-mode .ai-messages::-webkit-scrollbar-thumb {
        background: rgba(0,0,0,0.1) !important;
      }
      body.light-mode .ai-messages::-webkit-scrollbar-track { background: rgba(0, 0, 0, 0.04); }


      /* ── Light mode: Inline AI popup ── */
      body.light-mode #inline-ai-toolbar {
        background: #fff !important;
        border-color: rgba(0,0,0,0.12) !important;
        box-shadow: 0 6px 24px rgba(0,0,0,0.15) !important;
      }


/* ── Moved from styles.css (base) ─────────────────────────── */
      /* AI */
      .ai-chat-toggle {
        position: absolute;
        bottom: 1.5rem;
        right: 2.5rem;
        width: 38px;
        height: 38px;
        border-radius: var(--radius-full);
        background: transparent;
        border: 1px solid rgba(255, 255, 255, 0.1);
        color: var(--text-dim);
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: var(--fs-xl);
        opacity: 0.5;
        transition:
          opacity 0.2s,
          background 0.2s,
          border-color 0.2s;
        z-index: var(--z-dropdown);
      }
      .ai-chat-toggle:hover {
        opacity: 1;
        background: rgba(255, 255, 255, 0.08);
        border-color: rgba(255, 255, 255, 0.25);
      }
      .ai-panel {
        position: absolute;
        bottom: 5.5rem;
        right: 1.5rem;
        width: 640px;
        height: 720px;
        min-width: 360px;
        min-height: 400px;
        background: var(--bg-solid);
        border: 1px solid var(--glass-border);
        border-radius: var(--radius-lg);
        display: none;
        flex-direction: column;
        box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
        z-index: var(--z-dropdown);
        overflow: visible;
      }
      .ai-resize-handle {
        position: absolute;
        z-index: var(--z-sticky);
        transition: background 0.12s;
      }
      .ai-resize-handle:hover {
        background: rgba(var(--primary-rgb), 0.28);
      }
      /* Corners */
      .ai-rz-nw {
        top: 0;
        left: 0;
        width: 22px;
        height: 22px;
        cursor: nw-resize;
        border-radius: var(--radius-lg) 0 var(--radius-base) 0;
      }
      .ai-rz-ne {
        top: 0;
        right: 0;
        width: 22px;
        height: 22px;
        cursor: ne-resize;
        border-radius: 0 18px 0 8px;
      }
      .ai-rz-sw {
        bottom: 0;
        left: 0;
        width: 22px;
        height: 22px;
        cursor: sw-resize;
        border-radius: 0 8px 0 18px;
      }
      .ai-rz-se {
        bottom: 0;
        right: 0;
        width: 22px;
        height: 22px;
        cursor: se-resize;
        border-radius: var(--radius-base) 0 var(--radius-lg) 0;
      }
      /* Edges */
      .ai-rz-n {
        top: 0;
        left: 22px;
        right: 22px;
        height: 6px;
        cursor: n-resize;
      }
      .ai-rz-s {
        bottom: 0;
        left: 22px;
        right: 22px;
        height: 6px;
        cursor: s-resize;
      }
      .ai-rz-w {
        top: 22px;
        left: 0;
        bottom: 22px;
        width: 6px;
        cursor: w-resize;
      }
      .ai-rz-e {
        top: 22px;
        right: 0;
        bottom: 22px;
        width: 6px;
        cursor: e-resize;
      }
      .ai-panel.active {
        display: flex;
        animation: gn-slide-right-in 1s cubic-bezier(0.25, 0.1, 0.25, 1) both;
      }
      .ai-header {
        padding: 1rem 1.25rem;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        display: flex;
        align-items: center;
        gap: 8px;
        font-family: var(--font-brand);
        font-weight: 600;
        font-size: var(--fs-md);
      }
      .ai-dot {
        width: 8px;
        height: 8px;
        background: var(--secondary);
        border-radius: var(--radius-full);
        box-shadow: 0 0 8px var(--secondary);
      }
      .ai-messages {
        flex: 1;
        padding: 1rem;
        overflow-y: auto;
        display: flex;
        flex-direction: column;
        gap: 0.75rem;
      }
      .ai-messages::-webkit-scrollbar {
        width: 4px;
      }
      .ai-messages::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.1);
        border-radius: var(--radius-xs);
      }
      .msg {
        padding: 9px 13px;
        border-radius: var(--radius-md);
        font-size: var(--fs-md);
        max-width: 88%;
        line-height: 1.5;
        overflow-wrap: break-word;
        word-break: break-word;
        min-width: 0;
      }
      .msg pre {
        white-space: pre-wrap;
        word-break: break-word;
        overflow-wrap: break-word;
        overflow-x: auto;
        max-width: 100%;
        box-sizing: border-box;
        background: rgba(0, 0, 0, 0.3);
        border-radius: var(--radius-sm);
        padding: 8px 10px;
        font-size: var(--fs-base);
        margin: 6px 0;
      }
      .msg code {
        word-break: break-word;
        overflow-wrap: break-word;
      }
      .msg p,
      .msg li,
      .msg h1,
      .msg h2,
      .msg h3 {
        overflow-wrap: break-word;
        word-break: break-word;
      }
      .msg ol,
      .msg ul {
        padding-left: 1.6em;
        margin: 4px 0;
        list-style-position: outside;
      }
      .msg ol { list-style-type: decimal; }
      .msg ul { list-style-type: disc; }
      .msg ol ol, .msg ol ul,
      .msg ul ol, .msg ul ul {
        padding-left: 1.4em;
        margin: 2px 0;
      }
      .msg li {
        margin: 2px 0;
        padding-left: 0.2em;
      }
      .msg.bot {
        background: rgba(30, 41, 70, 0.95);
        align-self: flex-start;
        max-width: 88%;
        color: var(--text-main);
        border: 1px solid rgba(var(--primary-rgb), 0.15);
        text-align: left;
        position: relative;
      }
      .msg.user {
        background: rgba(var(--primary-rgb), 0.25);
        border: 1px solid rgba(var(--primary-rgb), 0.2);
        align-self: flex-end;
        max-width: 88%;
        color: var(--text-main);
        position: relative;
        text-align: left;
      }
      /* Расширяем зону hover влево — накрывает область кнопок */
      .msg.user::before {
        content: "";
        position: absolute;
        left: -72px;
        top: 0;
        width: 72px;
        height: 100%;
      }
      .msg-user-actions {
        display: flex;
        position: absolute;
        left: -68px;
        top: 50%;
        transform: translateY(-50%);
        gap: 4px;
        flex-direction: row;
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.18s ease 0.75s;
      }
      .msg.user:hover .msg-user-actions,
      .msg.bot:hover .msg-user-actions {
        opacity: 1;
        pointer-events: auto;
        transition: opacity 0.15s ease 0s;
      }
      .msg-ua-btn {
        background: var(--card-bg-solid);
        border: 1px solid rgba(var(--primary-rgb), 0.3);
        border-radius: var(--radius-base);
        color: var(--text-muted);
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        font-size: var(--fs-base);
        transition: 0.15s;
        flex-shrink: 0;
        padding: 0;
        line-height: 1;
      }
      .msg-ua-btn:hover {
        background: rgba(var(--primary-rgb), 0.25);
        color: var(--text-dim);
        border-color: rgba(var(--primary-rgb), 0.6);
      }
      /* Edit mode inline */
      .msg-edit-area {
        width: 100%;
        background: transparent;
        border: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: 0;
        color: var(--text-main);
        font-family: inherit;
        font-size: var(--fs-md);
        padding: 4px 2px;
        resize: none;
        outline: none;
        box-sizing: border-box;
        margin-top: 4px;
      }
      .msg-edit-actions {
        display: flex;
        gap: 6px;
        margin-top: 6px;
        justify-content: flex-end;
      }
      .msg-edit-save {
        background: rgba(var(--primary-rgb), 0.7);
        border: none;
        color: var(--text-main);
        border-radius: var(--radius-base);
        padding: 4px 12px;
        cursor: pointer;
        font-size: var(--fs-base);
      }
      .msg-edit-cancel {
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.12);
        color: var(--text-muted);
        border-radius: var(--radius-base);
        padding: 4px 10px;
        cursor: pointer;
        font-size: var(--fs-base);
      }
      .msg.typing {
        opacity: 0.6;
      }
      .msg-actions {
        display: flex;
        gap: 4px;
        margin-top: 6px;
        flex-wrap: wrap;
      }
      .msg-insert-btn {
        display: inline-flex;
        align-items: center;
        gap: 3px;
        padding: 2px 7px;
        background: rgba(255, 255, 255, 0.04);
        border: 1px solid rgba(255, 255, 255, 0.08);
        border-radius: var(--radius-xs);
        font-size: var(--fs-sm);
        color: var(--text-dim);
        cursor: pointer;
        transition: all 0.15s;
      }
      .msg-insert-btn:hover {
        background: rgba(255, 255, 255, 0.12);
        color: var(--text-dim);
        border-color: rgba(255, 255, 255, 0.2);
      }
      .msg-insert-btn:active {
        transform: scale(0.95);
      }
      #ai-web-search-inline.active {
        background: rgba(var(--primary-rgb), 0.15) !important;
        border-color: rgba(var(--primary-rgb), 0.45) !important;
        color: var(--primary-light) !important;
        box-shadow: 0 0 8px rgba(var(--primary-rgb), 0.25);
      }
      body.light-mode .msg.bot {
        background: rgba(230,235,255,0.95) !important;
        color: #1e293b !important;
        border-color: rgba(var(--primary-rgb),0.2) !important;
      }
      body.light-mode .msg.user {
        background: rgba(var(--primary-rgb),0.18) !important;
        color: #1e1b4b !important;
      }
      body.light-mode .ai-chat-toggle {
        background: rgba(var(--primary-rgb), 0.15) !important;
        border-color: rgba(var(--primary-rgb), 0.35) !important;
        color: var(--primary-dark) !important;
        opacity: 1 !important;
      }
      body.light-mode .ai-chat-toggle:hover {
        background: rgba(var(--primary-rgb), 0.25) !important;
        border-color: rgba(var(--primary-rgb), 0.5) !important;
        opacity: 1 !important;
      }
      body.light-mode .ai-panel {
        background: #f0f4ff !important;
        border-color: rgba(0, 0, 0, 0.12) !important;
        color: #1e293b !important;
      }
      body.light-mode .ai-header {
        border-bottom-color: rgba(0, 0, 0, 0.08) !important;
        color: #1e293b !important;
      }
      body.light-mode #ai-input {
        background: rgba(0, 0, 0, 0.04) !important;
        border-color: rgba(0, 0, 0, 0.12) !important;
        color: #1e293b !important;
      }
      body.light-mode .ai-input-area {
        border-top-color: rgba(0, 0, 0, 0.08) !important;
      }
      body.light-mode .ai-send-btn {
        color: #fff !important;
      }
      /* light-mode #inline-ai-toolbar — moved to audit-fix batch (line ~8976) */
      body.light-mode .inline-ai-btn {
        color: #334155 !important;
      }
      body.light-mode .inline-ai-btn:hover {
        background: rgba(var(--primary-rgb), 0.1) !important;
        color: var(--primary-dark) !important;
      }
      /* AI inline popup (AI ответ) */
      body.light-mode .inline-ai-popup {
        background: #f0f4ff !important;
        border-color: rgba(var(--primary-rgb), 0.25) !important;
        box-shadow: 0 16px 48px rgba(0, 0, 0, 0.15) !important;
        color: #1e293b !important;
      }
      body.light-mode .inline-ai-popup > div {
        color: #1e293b !important;
        border-color: rgba(0, 0, 0, 0.08) !important;
      }
      body.light-mode .inline-ai-popup #inline-ai-popup-body {
        color: #334155 !important;
      }
      body.light-mode .inline-ai-popup input {
        background: rgba(0, 0, 0, 0.04) !important;
        border-color: rgba(0, 0, 0, 0.12) !important;
        color: #1e293b !important;
      }
      body.light-mode .inline-ai-popup button {
        color: #475569 !important;
      }
      body.light-mode .inline-ai-popup button[style*="gradient"] {
        color: #fff !important;
      }
      /* AI auto-tag banner (AI ПРЕДЛАГАЕТ) */
      body.light-mode .auto-tag-banner {
        background: linear-gradient(135deg, #e8edf8, #dde4f8) !important;
        border-color: rgba(var(--primary-rgb), 0.3) !important;
        box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12) !important;
        color: #1e293b !important;
      }
      body.light-mode .auto-tag-banner div {
        color: #334155 !important;
      }
      body.light-mode .auto-tag-banner span {
        color: #334155 !important;
      }
      body.light-mode .auto-tag-banner #atb-dismiss {
        background: rgba(0, 0, 0, 0.06) !important;
        color: #64748b !important;
      }
      body.light-mode .ai-actions-dropdown { background: rgba(255,255,255,0.98) !important; border: 1px solid rgba(0,0,0,0.12) !important; box-shadow: 0 8px 40px rgba(0,0,0,0.15) !important; }
      body.light-mode .ai-tool-menu { background: rgba(255,255,255,0.98) !important; border: 1px solid rgba(0,0,0,0.12) !important; box-shadow: 0 8px 40px rgba(0,0,0,0.15) !important; }
      body.light-mode .ai-action-group { border-color: rgba(0,0,0,0.06) !important; }
      body.light-mode .ai-action-group-label { color: var(--primary) !important; }
      body.light-mode .ai-tool-menu-btn { color: #334155 !important; }
      body.light-mode .ai-tool-menu-btn:hover,
      body.light-mode .ai-tool-menu-btn:focus-visible { background: rgba(var(--primary-rgb),0.08) !important; color: #1e293b !important; border-left-color: rgba(var(--primary-rgb),0.45) !important; box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb),0.18) !important; }
      body.light-mode .ai-action-item { color: #334155 !important; }
      body.light-mode .ai-action-item:hover { background: rgba(var(--primary-rgb),0.08) !important; color: #1e293b !important; }
      body.light-mode .ai-action-item:focus-visible { background: rgba(var(--primary-rgb),0.08) !important; color: #1e293b !important; border-left-color: rgba(var(--primary-rgb),0.45) !important; box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb),0.18) !important; }
      body.light-mode .ai-action-item .ai-action-icon { background: rgba(var(--primary-rgb),0.08) !important; }
      body.light-mode .ai-action-item .ai-action-desc { color: var(--text-muted) !important; }
      body.light-mode .ai-actions-trigger { background: rgba(0,0,0,0.04) !important; color: #334155 !important; border-color: rgba(0,0,0,0.12) !important; }
      body.light-mode .ai-actions-trigger:hover { background: rgba(var(--primary-rgb),0.08) !important; }
      body.light-mode .ai-quick-prompts button { background: rgba(0,0,0,0.04) !important; color: #475569 !important; border-color: rgba(0,0,0,0.08) !important; }
      body.light-mode .ai-quick-prompts button:hover { background: rgba(var(--primary-rgb),0.1) !important; color: var(--primary-dark) !important; }
      body.light-mode .msg pre {
        background: rgba(0,0,0,0.04) !important;
        color: #334155 !important;
      }
      body.light-mode .msg-ua-btn {
        background: rgba(255,255,255,0.9) !important;
        border-color: rgba(0,0,0,0.12) !important;
        color: #475569 !important;
      }
      body.light-mode .msg-ua-btn:hover {
        background: rgba(var(--primary-rgb),0.1) !important;
        color: var(--primary-dark) !important;
      }
      body.light-mode .msg-insert-btn {
        background: rgba(0,0,0,0.04) !important;
        border-color: rgba(0,0,0,0.1) !important;
        color: #475569 !important;
      }
      body.light-mode .msg-insert-btn:hover {
        background: rgba(0,0,0,0.08) !important;
        color: #1e293b !important;
      }
      body.light-mode .ai-clear-btn {
        background: rgba(0,0,0,0.04) !important;
        border-color: rgba(0,0,0,0.08) !important;
        color: #64748b !important;
      }
      body.light-mode .ai-clear-btn:hover {
        background: rgba(229,57,53,0.08) !important;
        color: #dc2626 !important;
      }
      body.light-mode .ai-model-select-inline {
        background: rgba(var(--primary-rgb),0.06) !important;
        border-color: rgba(var(--primary-rgb),0.2) !important;
        color: var(--primary-dark) !important;
      }
      body.light-mode .ai-qp-btn {
        background: rgba(0,0,0,0.04) !important;
        border-color: rgba(0,0,0,0.08) !important;
        color: #475569 !important;
      }
      body.light-mode .ai-qp-btn:hover {
        background: var(--primary) !important;
        color: white !important;
      }
      body.light-mode .ai-quick-prompts {
        border-bottom-color: rgba(0,0,0,0.06) !important;
      }
      body.light-mode .ai-actions-wrap {
        border-bottom-color: rgba(0,0,0,0.06) !important;
      }
      /* body.light-mode .ai-header — merged into earlier rule (~line 1651) */
      /* body.light-mode .ai-input-area — merged into earlier rule (~line 1660) */

/* ── AI Tool Menu ──────────────────────────────── */
      .ai-tool-menu {
        display: none;
        background: var(--bg-solid);
        border: 1px solid rgba(var(--primary-rgb), 0.35);
        border-radius: var(--radius-md);
        padding: 6px;
        z-index: var(--z-modal);
        min-width: 220px;
        max-width: min(92vw, 340px);
        max-height: 420px;
        overflow-y: auto;
        box-shadow:
          0 8px 40px rgba(0, 0, 0, 0.8),
          0 0 0 1px rgba(var(--primary-rgb), 0.08),
          inset 0 1px 0 rgba(255, 255, 255, 0.04);
      }
      .ai-tool-menu-btn {
        display: flex;
        align-items: center;
        gap: 9px;
        width: 100%;
        background: none;
        border: none;
        border-left: 2px solid transparent;
        color: rgba(226, 232, 240, 0.82);
        padding: 8px 10px;
        min-height: 34px;
        border-radius: var(--radius-sm);
        cursor: pointer;
        font-size: var(--fs-base);
        line-height: 1.25;
        text-align: left;
        font-family: inherit;
        transition:
          background 0.12s,
          color 0.12s,
          border-color 0.12s;
      }
      .ai-tool-menu-btn:hover,
      .ai-tool-menu-btn:focus-visible {
        background: rgba(var(--primary-rgb), 0.14);
        color: var(--primary-light);
        border-left-color: rgba(var(--primary-rgb), 0.55);
      }
      .ai-tool-menu-btn:focus-visible {
        outline: none;
        box-shadow: inset 0 0 0 1px rgba(var(--primary-rgb), 0.35);
      }
      .ai-close-btn-fade {
        background: none;
        border: none;
        color: var(--text-dim);
        cursor: pointer;
        font-size: var(--fs-lg);
        flex-shrink: 0;
        opacity: 0.6;
        transition: opacity 0.15s;
      }
      .ai-close-btn-fade:hover,
      .ai-close-btn-fade:focus-visible {
        opacity: 1;
      }

/* AI header utility classes */
.ai-usage-counter { font-size: var(--fs-xs); color: var(--text-dim); margin-left: 8px; opacity: 0.9; }
.ai-header-actions-wrap { position: relative; margin-left: auto; flex-shrink: 0; }
.ai-toolbar-btn { background: rgba(255, 255, 255, 0.06); margin-right: 4px; }
.ai-toolbar-btn:hover { background: rgba(255, 255, 255, 0.12); }
.ai-chat-toggle--emoji { font-size: var(--fs-lg); }

/* Floating button stack — bottom positions extracted from inline styles */
#ai-toggle          { bottom: 11.5rem; }
#tool-star          { bottom: 8.7rem; }
#float-attach       { bottom: 5.9rem; }
#float-voice-note   { bottom: 3rem; }

/* AI persona / provider selects */
.ai-compact-select {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: var(--radius-sm);
    color: var(--text-dim);
    font-size: var(--fs-xs);
    padding: 2px 4px;
    cursor: pointer;
    flex-shrink: 0;
}

/* ── Focus-visible for AI buttons ──────────────────────── */
.ai-insert-btn:focus-visible, .ai-copy-btn:focus-visible,
.ai-banner-apply:focus-visible, .ai-banner-dismiss:focus-visible,
.ai-link-banner-apply:focus-visible, .ai-link-banner-dismiss:focus-visible,
.ai-voice-badge-stop:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 2px;
}

/* ── Light-mode overrides for hw/ml panels ─────────────── */
body.light-mode .hw-panel { background: rgba(255,255,255,0.95); border-bottom-color: rgba(0,0,0,0.1); }
body.light-mode .ml-panel-title,
body.light-mode .ml-btn-recheck,
body.light-mode .ml-panel-close { color: #334155; }

/* ── Scrollbars for fact-check & linter ────────────────── */
.fc-claims::-webkit-scrollbar, .ml-stats::-webkit-scrollbar { width: 4px; }
.fc-claims::-webkit-scrollbar-thumb, .ml-stats::-webkit-scrollbar-thumb { background: rgba(var(--primary-rgb), 0.3); border-radius: var(--radius-xs); }
.fc-claims::-webkit-scrollbar-thumb:hover, .ml-stats::-webkit-scrollbar-thumb:hover { background: rgba(var(--primary-rgb), 0.5); }

/* ── Reduced motion ────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .ai-panel.active, .ai-tag-banner, .ai-link-banner, .ai-voice-badge,
  .hw-panel, .fc-loading-spinner, .ai-actions-dropdown.open,
  #ai-voice-btn.recording, .ai-cursor {
    animation: none !important;
  }
}
