/* =========================================================
   Topify GEO Studio · Modern Theme
   Design tokens + animations inspired by Linear / Vercel /
   Stripe / Notion — warm brand kept, vibrancy added.
   ========================================================= */
:root {
  /* Surfaces — neutral white, aligned with Vercel/Geist palette */
  --bg: #ffffff;
  --bg-deep: #fafafa;
  --panel: #ffffff;
  --panel-soft: #fafafa;
  --panel-glass: rgba(255, 255, 255, 0.88);
  --line: #e5e5e5;
  --line-strong: #d4d4d4;

  /* Text */
  --ink: #0a0a0a;
  --text: #404040;
  --muted: #737373;
  --muted-2: #a3a3a3;

  /* Accents — single brand orange (Orange-600), no purple in primary UI */
  --accent: #ea580c;
  --accent-soft: #fff7ed;
  --accent-deep: #c2410c;
  /* Indigo retained for legacy chart usage only — should NOT appear in main UI */
  --indigo: #6366f1;
  --indigo-deep: #4f46e5;
  --indigo-soft: #eef2ff;
  --violet: #7c3aed;
  --pink: #ec4899;
  --blue: #3b82f6;
  --teal: #14b8a6;
  --green: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;

  /* Gradients — single-hue brand, no orange→indigo two-tone */
  --grad-brand: linear-gradient(135deg, #fb923c 0%, #ea580c 100%);
  --grad-brand-soft: linear-gradient(135deg, rgba(234, 88, 12, 0.10), rgba(234, 88, 12, 0.04));
  --grad-warm: linear-gradient(135deg, #fff7ed 0%, #ffedd5 100%);
  --grad-cool: linear-gradient(135deg, #fafafa 0%, #f5f5f5 100%);

  /* Effects — minimal shadows, Geist/Vercel-style */
  --active: rgba(234, 88, 12, 0.10);
  --dark: #171717;
  --radius: 10px;
  --radius-lg: 12px;
  --radius-xl: 14px;
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 24px rgba(0, 0, 0, 0.08);
  --shadow-glow: 0 4px 12px rgba(234, 88, 12, 0.18);
  --ease: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);

  /* Secondary surfaces — calmer plate colors */
  --btn-primary: var(--ink);
  --btn-primary-hover: #262626;
  --btn-secondary-bg: #ffffff;
  --btn-secondary-bg-hover: #f5f5f5;
  --btn-secondary-border: #d4d4d4;
  --icon-bg: #f5f5f5;
  --icon-ink: var(--ink);
  --icon-bg-strong: var(--accent-soft);
  --icon-ink-strong: var(--accent-deep);

  /* 8-px spacing scale */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  /* Type scale — aligned with Geist/Tailwind defaults */
  --fs-xs: 12px;
  --fs-sm: 14px;
  --fs-body: 15px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-h3: 20px;
  --fs-h2: 24px;
  --fs-h1: 30px;
  --fs-display: 36px;

  /* Legacy aliases */
  --orange: var(--accent);
  --shadow: var(--shadow-sm);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family:
    "Geist", Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
  font-size: var(--fs-body);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* Preserve desktop dashboard layout on tablets+, allow phones to flow */
@media (min-width: 640px) {
  body { min-width: 1024px; }
}

input::placeholder,
textarea::placeholder { color: var(--muted-2); opacity: 1; }

::selection { background: rgba(234, 88, 12, .20); color: var(--ink); }

button, input { font: inherit; }
button {
  cursor: pointer;
  /* Base radius so every button is rounded by default. Rules that need
     different shapes (tabs=0, pill=999px, compact=4-6px) declare their
     own border-radius and override this via cascade. Fixes primary CTA
     buttons in .diagnostic-form / .rewrite-form / .rules-form which
     previously rendered square. */
  border-radius: 11px;
}

/* =========================================================
   Native <select> reset — custom chevron + accent focus ring.
   Applies everywhere; pages keep their own size/border via
   more-specific selectors (e.g. .rewrite-history-filter select).
   ========================================================= */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  min-height: 36px;
  padding: 0 32px 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background-color: #fff;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23737373' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 14px 14px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
select:hover:not(:disabled) { border-color: var(--line-strong); }
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, .18);
}
select:disabled { cursor: not-allowed; opacity: .6; }
select::-ms-expand { display: none; }

/* =========================================================
   Custom <Select> component — fully styled dropdown that
   replaces native popup. Used via <Select /> from
   client/src/components/Select.tsx.
   ========================================================= */
.app-select {
  position: relative;
  display: inline-block;
  min-width: 180px;
}
.app-select.is-disabled { opacity: .6; pointer-events: none; }

.app-select-trigger {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 36px;
  padding: 0 10px 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background-color: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.app-select--sm .app-select-trigger { min-height: 30px; font-size: 13px; }
.app-select-trigger:hover { border-color: var(--line-strong); }
.app-select-trigger:focus-visible,
.app-select.is-open .app-select-trigger {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, .18);
}
.app-select-value {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 500;
}
.app-select-value.is-placeholder { color: var(--muted-2); font-weight: 400; }
.app-select-caret {
  flex-shrink: 0;
  color: var(--muted);
  transition: transform .15s var(--ease);
}
.app-select.is-open .app-select-caret { transform: rotate(180deg); color: var(--accent); }

.app-select-pop {
  position: absolute;
  z-index: 40;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  min-width: 240px;
  max-height: 340px;
  display: flex;
  flex-direction: column;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(10, 10, 10, .12), 0 2px 6px rgba(10, 10, 10, .06);
  outline: none;
  animation: appSelectPopIn .12s var(--ease);
}
.app-select-rows {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}
.app-select-search {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.app-select-search-icon { color: var(--muted); flex-shrink: 0; }
.app-select-search-input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  padding: 2px 0;
}
.app-select-search-input::placeholder { color: var(--muted-2); }
.app-select-search-clear {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.app-select-search-clear:hover { background: var(--accent-soft); color: var(--accent-deep); }
@keyframes appSelectPopIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.app-select-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 13.5px;
  text-align: left;
  cursor: pointer;
  transition: background-color .12s var(--ease), color .12s var(--ease);
}
.app-select-row + .app-select-row { margin-top: 1px; }
.app-select-row.is-highlight,
.app-select-row:hover:not(.is-disabled) {
  background-color: var(--accent-soft);
  color: var(--accent-deep);
}
.app-select-row.is-active { color: var(--accent-deep); font-weight: 500; }
.app-select-row.is-disabled { opacity: .5; cursor: not-allowed; }
.app-select-row-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.app-select-row-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-select-row-desc {
  font-size: 11.5px;
  color: var(--muted);
}
.app-select-row.is-highlight .app-select-row-desc,
.app-select-row:hover:not(.is-disabled) .app-select-row-desc { color: var(--accent-deep); opacity: .75; }
.app-select-row-check { flex-shrink: 0; color: var(--accent); }
.app-select-empty {
  margin: 0;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 13px;
}

/* =========================================================
   <Combobox> — input + suggestion popup, free-text friendly.
   Reuses .app-select-pop / .app-select-row for popup visuals.
   ========================================================= */
.app-combobox {
  position: relative;
  display: block;
  width: 100%;
  min-width: 0;
}
.app-combobox.is-disabled { opacity: .6; pointer-events: none; }
.app-combobox > input { width: 100%; padding-right: 30px !important; }
.app-combobox-caret {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 22px;
  height: 22px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: color .15s var(--ease), transform .15s var(--ease);
}
.app-combobox-caret:hover { color: var(--accent-deep); background: var(--accent-soft); }
.app-combobox.is-open .app-combobox-caret { color: var(--accent); transform: translateY(-50%) rotate(180deg); }
/* Popup is anchored to the combobox trigger — don't inherit the Select's edge-to-edge stretch. */
.app-combobox > .app-select-pop {
  left: 0;
  right: auto;
  width: max-content;
  min-width: 100%;
  max-width: 320px;
}

/* =========================================================
   KEYFRAMES — motion language
   ========================================================= */
@keyframes pageIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(10px) scale(.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes floatY {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-6px); }
}
@keyframes spinSlow { to { transform: rotate(360deg); } }
@keyframes shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
@keyframes pulseDot {
  0%, 100% { opacity: .35; transform: scale(.9); }
  50%      { opacity: 1;   transform: scale(1.15); }
}
@keyframes gradientShift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}
@keyframes ringPulse {
  0%   { transform: scale(.9); opacity: .55; }
  100% { transform: scale(1.8); opacity: 0; }
}

/* =========================================================
   Content area
   ========================================================= */
.content {
  padding: 48px 48px 64px;
  background: transparent;
}

.screen { display: none; animation: pageIn .35s var(--ease) both; }
.screen.is-visible { display: block; }

.page-card,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-sm);
  animation: cardIn .4s var(--ease) both;
  transition: box-shadow .25s var(--ease), transform .25s var(--ease), border-color .25s var(--ease);
}

.page-card:hover,
.panel:hover {
  box-shadow: var(--shadow-md);
}

/* =========================================================
   Home hero — vibrant animated gradient
   ========================================================= */
.home-hero {
  position: relative;
  padding: 48px;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
}

.home-hero::before,
.home-hero::after {
  display: none;
}

.home-hero > * { position: relative; z-index: 1; }

.home-hero-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 520px;
  gap: 56px;
  padding-bottom: 34px;
  border-bottom: 1px solid rgba(241, 223, 207, .6);
}

.kicker {
  display: inline-block;
  margin: 0 0 16px;
  padding: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.home-hero h1 {
  margin: 0 0 18px;
  color: #15131a;
  font-size: var(--fs-display);
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.home-hero h1 span {
  color: var(--accent);
}

.hero-copy {
  max-width: 820px;
  margin: 0;
  color: #4a4654;
  font-size: 16px;
  line-height: 1.7;
}

.hero-copy strong {
  display: inline-block;
  margin-right: 10px;
  padding: 4px 12px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 14px;
  font-weight: 600;
}

.insight-card {
  position: relative;
  min-height: 252px;
  padding: 30px;
  border: 1px solid rgba(255, 255, 255, .8);
  border-radius: var(--radius-xl);
  background: var(--panel-glass);
  backdrop-filter: blur(14px);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform .4s var(--ease), box-shadow .4s var(--ease);
}
.insight-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.insight-card h3 {
  margin: 0 0 14px;
  color: #5b3321;
  font-size: var(--fs-h3);
  font-weight: 600;
}

.insight-card ul {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
}

.insight-card li {
  position: relative;
  padding: 10px 0 10px 22px;
  border-bottom: 1px solid rgba(243, 228, 216, .7);
  color: #4a4654;
  font-size: var(--fs-md);
}

.insight-card li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--grad-brand);
  box-shadow: 0 0 0 4px rgba(255, 138, 91, .15);
}

.insight-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.65;
}

.ring-art {
  position: absolute;
  top: -30px;
  right: -10px;
  width: 156px;
  height: 156px;
  border: 2px solid rgba(255, 138, 91, .35);
  border-radius: 50%;
  animation: spinSlow 24s linear infinite;
}

.ring-art::after {
  content: "";
  position: absolute;
  inset: 22px;
  border: 2px dashed rgba(234, 88, 12, .35);
  border-radius: 50%;
  animation: spinSlow 18s linear infinite reverse;
}

.section-title {
  margin: 30px 0 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.section-title span {
  width: 3px;
  height: 20px;
  border-radius: 2px;
  background: var(--accent);
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.feature-grid article,
.delivery-grid article {
  position: relative;
  min-height: 146px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  overflow: hidden;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease), border-color .35s var(--ease);
}
.feature-grid article::before,
.delivery-grid article::before {
  content: "";
  position: absolute;
  inset: 0;
  background: var(--grad-brand-soft);
  opacity: 0;
  transition: opacity .35s var(--ease);
  pointer-events: none;
}
.feature-grid article:hover,
.delivery-grid article:hover {
  transform: translateY(-4px);
  border-color: rgba(234, 88, 12, .25);
  box-shadow: var(--shadow-md);
}
.feature-grid article:hover::before,
.delivery-grid article:hover::before { opacity: 1; }
.feature-grid article > *,
.delivery-grid article > * { position: relative; z-index: 1; }

.feature-icon,
.delivery-grid b {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--icon-bg-strong);
  color: var(--icon-ink-strong);
  font-size: 18px;
  font-weight: 600;
  transition: transform .4s var(--ease-spring);
}
.feature-grid article:hover .feature-icon,
.delivery-grid article:hover b {
  transform: rotate(-6deg) scale(1.08);
}

.feature-grid h3,
.delivery-grid h3 {
  margin: 14px 0 6px;
  color: var(--ink);
  font-size: var(--fs-h3);
  font-weight: 600;
}

.feature-grid p,
.delivery-grid p {
  margin: 0;
  color: #667184;
  font-size: 14px;
  line-height: 1.65;
}

.delivery-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.delivery-grid article {
  display: grid;
  grid-template-columns: 44px 1fr;
  column-gap: 16px;
  align-items: start;
  cursor: pointer;
}

.delivery-grid article p { grid-column: 2; }

.service-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0 0 22px;
}

.service-flow article {
  position: relative;
  min-height: 132px;
  padding: 22px;
  border: 1px solid rgba(241, 223, 207, .7);
  border-radius: var(--radius);
  background: #fffaf5;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.service-flow article:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); }

.service-flow b {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--icon-bg-strong);
  color: var(--icon-ink-strong);
  font-weight: 600;
}

.service-flow h3 {
  margin: 12px 0 6px;
  color: var(--ink);
  font-size: var(--fs-h3);
  font-weight: 600;
}

.service-flow p {
  margin: 0;
  color: #667184;
  font-size: 14px;
  line-height: 1.6;
}

.pricing-note {
  margin: -4px 0 22px;
  padding: 14px 18px;
  display: flex;
  align-items: start;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.pricing-note strong {
  flex: 0 0 auto;
  color: var(--accent-deep);
}

.visibility-panel { margin-top: 22px; }

.filter-toolbar.compact { margin-bottom: 18px; }

.support-grid {
  grid-template-columns: minmax(540px, 1fr) minmax(460px, 0.95fr);
}

.visibility-panel .chart-panel,
.visibility-panel .competitors-panel { min-width: 0; }

.compact-head {
  margin-bottom: 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.compact-head > div:first-child { min-width: 0; flex: 1; }

.compact-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 19px;
  font-weight: 600;
}

.page-titlebar {
  margin: 0 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.page-titlebar p,
.panel-head p,
.module-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

.page-titlebar h1 {
  margin: 0;
  color: var(--ink);
  font-size: 30px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: -0.02em;
}

/* =========================================================
   Buttons — modern, animated
   ========================================================= */
.title-actions,
.filter-toolbar,
.tabs,
.choice-row,
.search-row,
.model-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.title-actions button,
.filter-toolbar button,
.panel-head button,
.search-row button,
.choice-row button,
.model-row button,
.actions button,
.case,
.filter-board button,
.legend-grid button,
.pill-legend button,
.result-panel button,
.work-row button {
  position: relative;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--btn-secondary-border);
  border-radius: 11px;
  background: var(--btn-secondary-bg);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 500;
  transition: transform .15s var(--ease), border-color .2s var(--ease),
              background .2s var(--ease), color .2s var(--ease),
              box-shadow .25s var(--ease);
}

button:hover {
  transform: translateY(-1px);
  border-color: #a3a3a3;
  background: var(--btn-secondary-bg-hover);
  box-shadow: var(--shadow-xs);
}
button:active { transform: translateY(0); }

button:focus-visible {
  outline: 2px solid rgba(234, 88, 12, .55);
  outline-offset: 2px;
}

.action-list article:hover {
  border-color: var(--line-strong);
  background: #faf8f3;
}

.filter-toolbar { margin-bottom: 24px; }

.tabs {
  gap: 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-soft);
}

.tabs button {
  border: 0;
  background: transparent;
  color: var(--muted);
  transition: color .25s var(--ease), background .25s var(--ease);
}

.tabs .tab-active {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 4px 12px -4px rgba(28, 24, 38, .35);
}

.is-extra { display: none !important; }
.is-extra.is-visible { display: grid !important; }

.overview-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(460px, 0.95fr);
  gap: 22px;
  align-items: stretch;
}

.panel { padding: 22px; }

.panel-head { margin-bottom: 16px; }

.panel-head.inline {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
}

.panel-head h2,
.module-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

/* =========================================================
   Charts
   ========================================================= */
.line-chart {
  width: 100%;
  height: auto;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
}

.grid-lines path {
  fill: none;
  stroke: #ece9e4;
  stroke-dasharray: 5 5;
}

.axis-labels text { fill: #77716a; font-size: 15px; }

.metric-chart {
  margin: 4px 0 8px;
  animation: cardIn .4s var(--ease) both;
}

.line {
  fill: none;
  stroke-width: 3.2;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,.08));
  stroke-dasharray: 4000;
  stroke-dashoffset: 4000;
  animation: drawLine 1.4s var(--ease) forwards;
}

.line.black  { stroke: #1a1822; animation-delay: .05s; }
.line.blue   { stroke: var(--blue); animation-delay: .15s; }
.line.green  { stroke: var(--green); animation-delay: .25s; }
.line.pink   { stroke: var(--pink); animation-delay: .35s; }
.line.orange { stroke: var(--amber); animation-delay: .45s; }

@keyframes drawLine {
  to { stroke-dashoffset: 0; }
}

/* Hover tooltip overlay for MetricChart */
.line-chart .hover-rule {
  stroke: rgba(26, 24, 34, .35);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}
.line-chart .hover-dot {
  fill: #fff;
  stroke-width: 2.2;
}
.line-chart .hover-dot.black  { stroke: #1a1822; }
.line-chart .hover-dot.blue   { stroke: var(--blue); }
.line-chart .hover-dot.green  { stroke: var(--green); }
.line-chart .hover-dot.pink   { stroke: var(--pink); }
.line-chart .hover-dot.orange { stroke: var(--amber); }

.line-chart .hover-legend.black  { fill: #1a1822; }
.line-chart .hover-legend.blue   { fill: var(--blue); }
.line-chart .hover-legend.green  { fill: var(--green); }
.line-chart .hover-legend.pink   { fill: var(--pink); }
.line-chart .hover-legend.orange { fill: var(--amber); }

.line-chart .hover-box {
  fill: rgba(255, 255, 255, .98);
  stroke: var(--line, rgba(26, 24, 34, .12));
  stroke-width: 1;
  filter: drop-shadow(0 6px 14px rgba(26, 24, 34, .12));
}
.line-chart .hover-title {
  fill: var(--muted, #6b6577);
  font-size: 11px;
  font-weight: 500;
}
.line-chart .hover-label {
  fill: var(--ink, #1a1822);
  font-size: 12px;
  dominant-baseline: middle;
}
.line-chart .hover-value {
  fill: var(--ink, #1a1822);
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  dominant-baseline: middle;
}

/* 概览页视图切换 — 简单的下划线 tab，不带背景胶囊 */
.overview-page > .view-tabs {
  display: flex;
  gap: 24px;
  margin: 0 0 18px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  border-radius: 0;
}
.overview-page > .view-tabs button {
  position: relative;
  min-height: 0;
  padding: 8px 2px 12px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-size: 14.5px;
  font-weight: 500;
  transition: color .15s var(--ease);
}
.overview-page > .view-tabs button:hover {
  color: var(--ink);
  background: transparent;
  box-shadow: none;
  transform: none;
  border-color: transparent;
}
.overview-page > .view-tabs button.tab-active {
  color: var(--ink);
  font-weight: 600;
}
.overview-page > .view-tabs button.tab-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  border-radius: 2px;
}

/* 汇总卡片 — KPI strip + merged competitor block */
.summary-kpi-grid {
  margin: 14px 0 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}
.summary-kpi-grid article {
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  display: grid;
  gap: 6px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.summary-kpi-grid article:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-xs);
}
.summary-kpi-grid .kpi-label {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .02em;
}
.summary-kpi-grid .kpi-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.summary-kpi-grid .kpi-value strong {
  color: var(--ink);
  font-size: 28px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.summary-kpi-grid .kpi-unit {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
.summary-kpi-grid .kpi-foot {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}
/* --- KPI cards act as metric selectors for the summary chart --- */
.summary-kpi-grid .kpi-card {
  cursor: pointer;
  position: relative;
  user-select: none;
}
.summary-kpi-grid .kpi-card:focus-visible {
  outline: 2px solid var(--brand, var(--ink));
  outline-offset: 2px;
}
.summary-kpi-grid .kpi-card--active {
  border-color: var(--ink);
  box-shadow: 0 4px 14px -6px rgba(28, 24, 38, .35);
}
.summary-kpi-grid .kpi-card--active::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  border: 1.5px solid var(--ink);
  pointer-events: none;
}

/* --- Delta badge (↑ +4.2pt / ↓ 0.8 位 / — 持平) --- */
.kpi-delta {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  font-size: 12.5px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.kpi-delta--good { color: #1d8a4f; }
.kpi-delta--bad  { color: #c0312e; }
.kpi-delta--flat { color: var(--muted); }
.kpi-delta-hint {
  color: var(--muted);
  font-weight: 400;
  font-size: 11.5px;
  margin-left: 2px;
}

/* --- Sparkline inside KPI card --- */
.kpi-sparkline {
  display: block;
  width: 100%;
  height: 30px;
  margin-top: 4px;
  stroke: currentColor;
  color: var(--muted-2);
  opacity: 0.7;
}
.kpi-sparkline--visibility { color: var(--blue); opacity: 0.9; }
.kpi-sparkline--position   { color: var(--green); opacity: 0.9; }
.kpi-sparkline--sov        { color: var(--amber); opacity: 0.9; }

/* --- Summary chart caption above the main trend chart --- */
.summary-chart-block { margin-top: 6px; }
.summary-chart-caption {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12.5px;
}

.summary-competitors { margin-top: 18px; }
.summary-competitors h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
@media (max-width: 720px) {
  .summary-kpi-grid { grid-template-columns: 1fr; }
}

.competitor-table {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
}

.table-row {
  min-height: 72px;
  padding: 0 18px;
  display: grid;
  grid-template-columns: 56px minmax(140px, 1fr) 180px 90px 80px;
  align-items: center;
  gap: 12px;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 15px;
  transition: background .2s var(--ease);
}

.vis-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  font-variant-numeric: tabular-nums;
}

.vis-bar {
  display: flex;
  gap: 3px;
  height: 18px;
  width: 110px;
  flex: 0 0 auto;
  transform-origin: left center;
  animation: barGrow .6s var(--ease) both;
}

.vis-bar > span {
  flex: 1 1 0;
  border-radius: 2px;
  background: rgba(16, 185, 129, .16);
}

.vis-bar > span.on {
  background: var(--green);
}
.table-row:hover { background: rgba(255, 138, 91, .04); }
.table-row:first-child { border-top: 0; }

.competitor-table .table-row:not(.table-head) {
  opacity: 0;
  animation: rowSlideIn .5s var(--ease) forwards;
}

@keyframes rowSlideIn {
  from { opacity: 0; transform: translateX(-14px); }
  to   { opacity: 1; transform: translateX(0); }
}

.table-head {
  min-height: 54px;
  background: var(--panel-soft);
  color: #6a645e;
  font-weight: 760;
}

.table-row strong {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

@keyframes barGrow {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

.actions-panel { margin-top: 22px; }

.action-list,
.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 24px;
}

.action-list article,
.module-grid article {
  position: relative;
  min-height: 126px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  overflow: hidden;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease), border-color .3s var(--ease);
}
.action-list article::before,
.module-grid article::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--grad-brand);
  opacity: 0;
  transition: opacity .25s var(--ease);
}
.action-list article:hover,
.module-grid article:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(234, 88, 12, .25);
}
.action-list article:hover::before,
.module-grid article:hover::before { opacity: 1; }

.action-list article { cursor: pointer; }

.action-list b,
.module-grid b {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: var(--icon-bg);
  color: var(--ink);
  font-weight: 600;
  font-size: 13.5px;
  transition: transform .4s var(--ease-spring), background .25s var(--ease), color .25s var(--ease);
}
.action-list article:hover b,
.module-grid article:hover b {
  background: var(--icon-bg-strong);
  color: var(--icon-ink-strong);
  transform: rotate(-6deg) scale(1.08);
}

.action-list h3,
.module-grid h3 {
  margin: 14px 0 8px;
  color: var(--ink);
  font-size: 17px;
  font-weight: 600;
}

.action-list p,
.module-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.module-detail-grid {
  margin-top: 18px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.module-detail-grid:empty { display: none; }

.module-detail-grid section {
  padding: 18px;
  border: 1px solid rgba(241, 223, 207, .8);
  border-radius: 14px;
  background: #fafafa;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.module-detail-grid section:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.module-detail-grid h3 {
  margin: 0 0 12px;
  color: var(--accent-deep);
  font-size: 17px;
  font-weight: 600;
}

.module-detail-grid ul {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 9px;
  list-style: none;
}

.module-detail-grid li {
  position: relative;
  padding-left: 18px;
  color: #667184;
  font-size: 14px;
  line-height: 1.5;
}

.module-detail-grid li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--grad-brand);
}

.material-workspace:empty { display: none; }

.material-mvp {
  margin: 18px 0 22px;
  display: grid;
  gap: 16px;
}

/* Panels stacked inside the upload page — give them breathing room */
.diagnose-card > .panel + .panel,
.diagnose-card > .material-mvp + .panel,
.diagnose-card > .panel + .material-mvp {
  margin-top: 22px;
}

.material-dropzone,
.material-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  transition: box-shadow .25s var(--ease);
}
.material-dropzone:hover,
.material-panel:hover { box-shadow: var(--shadow-sm); }

.material-dropzone {
  position: relative;
  padding: 40px 28px 28px;
  border-style: dashed;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 12px;
  transition: border-color .18s var(--ease), background-color .18s var(--ease), box-shadow .18s var(--ease);
}
.material-dropzone.is-dragover {
  border-color: var(--accent);
  background: rgba(234, 88, 12, .06);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, .12);
}
.material-dropzone.is-uploading { opacity: .85; pointer-events: none; }

.material-dropzone-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(234, 88, 12, .12), rgba(234, 88, 12, .04));
  color: var(--accent);
  transition: transform .18s var(--ease), background .18s var(--ease);
}
.material-dropzone.is-dragover .material-dropzone-icon {
  background: linear-gradient(135deg, rgba(234, 88, 12, .22), rgba(234, 88, 12, .08));
  transform: translateY(-2px);
}

.material-dropzone h3,
.material-panel h3 {
  margin: 0;
  color: var(--ink);
  font-weight: 600;
}
.material-dropzone h3 { font-size: 16px; }

.material-dropzone p,
.material-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}
.material-dropzone p { font-size: 13px; }

.upload-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.upload-actions label,
.upload-actions button,
.fact-actions button {
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--btn-secondary-border);
  border-radius: 10px;
  background: var(--btn-secondary-bg);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
  transition: all .2s var(--ease);
}

.upload-actions label { display: inline-flex; align-items: center; }
.upload-actions input { display: none; }

.upload-actions button,
.fact-actions button:first-child {
  border-color: transparent;
  background: var(--btn-primary);
  color: #fff;
  box-shadow: 0 4px 10px -4px rgba(28, 24, 38, .35);
}
.upload-actions button:hover,
.fact-actions button:first-child:hover {
  background: var(--btn-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -4px rgba(28, 24, 38, .42);
}
.upload-actions button[disabled] {
  opacity: .75;
  cursor: progress;
  transform: none;
  box-shadow: none;
}

.btn-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  vertical-align: -2px;
  animation: spinSlow .9s linear infinite;
}

.material-dropzone .upload-actions {
  margin-top: 4px;
  justify-content: center;
}

.pending-file-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 540px;
}
.pending-file-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 13px;
  text-align: left;
}
.pending-file-list strong {
  color: var(--ink);
  font-weight: 700;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.pending-file-list span {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}
.pending-file-list button {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.pending-file-list button:hover { color: var(--ink); }

/* File-type badges — used in both pending and uploaded lists */
.file-badge,
span.file-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  flex-grow: 0;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(135deg, #94a3b8, #475569);
  box-shadow: 0 2px 6px -3px rgba(28, 24, 38, .35);
}
.file-badge svg { display: block; }
.file-badge-pdf   { background: linear-gradient(135deg, #ef4444, #b91c1c); }
.file-badge-doc   { background: linear-gradient(135deg, #3b82f6, #1d4ed8); }
.file-badge-sheet { background: linear-gradient(135deg, #22c55e, #15803d); }
.file-badge-code  { background: linear-gradient(135deg, #f59e0b, #b45309); }
.file-badge-text  { background: linear-gradient(135deg, #a3a3a3, #525252); }
.file-badge-generic { background: linear-gradient(135deg, #94a3b8, #475569); }

.material-columns {
  display: grid;
  grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
  gap: 16px;
}

.material-panel { padding: 20px; }

.brand-fact-card {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(241, 223, 207, .8);
  border-radius: 12px;
  background: #fafafa;
  transition: transform .25s var(--ease);
}
.brand-fact-card:hover { transform: translateX(2px); }

.material-file-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}
.material-file-row,
#material-file-list .material-file-row {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  gap: 12px;
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.material-file-row:hover {
  box-shadow: 0 4px 12px -6px rgba(28, 24, 38, .18);
  border-color: rgba(234, 88, 12, .3);
}
.material-file-body,
#material-file-list .material-file-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.material-file-body strong,
.brand-fact-card b { color: var(--ink); }
.material-file-body strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.material-file-body span,
.material-file-row i {
  color: var(--muted);
  font-style: normal;
  font-size: 13px;
}
.material-file-row i {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  flex-shrink: 0;
}
.material-file-status.is-parsed { color: #2e7a3c; font-weight: 600; }
.material-file-status.is-stored { color: var(--muted); }
.material-file-row-empty > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.material-file-row-empty strong { color: var(--ink); }
.material-file-row-empty span { color: var(--muted); font-size: 13px; }

.brand-fact-card { display: grid; gap: 10px; }

.brand-fact-card > div:first-child {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.fact-status {
  padding: 4px 10px;
  border-radius: 999px;
  background: #fafafa;
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}

.fact-status.approved {
  background: #f5f5f5;
  color: #2e7a3c;
}

.source-chip {
  width: fit-content;
  max-width: 100%;
  padding: 6px 10px;
  border: 1px solid rgba(255, 138, 91, .25);
  border-radius: 999px;
  color: var(--accent-deep);
  background: #fff;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 700;
}

.fact-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.generated-material-content {
  margin-top: 14px;
  padding: 18px;
  border: 1px solid rgba(255, 138, 91, .2);
  border-radius: 12px;
  background: #ffffff;
}

.generated-material-content strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
}

.generated-material-content pre {
  margin: 0 0 10px;
  white-space: pre-wrap;
  color: #3f3a35;
  font: inherit;
  line-height: 1.65;
}

.generated-material-content span { color: var(--muted); font-size: 12px; }

.diagnose-card,
.placement-page,
.module-page {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 30px;
}

.diagnose-card h2 {
  margin: 0 0 18px;
  color: var(--ink);
  font-size: var(--fs-h1);
  font-weight: 600;
  letter-spacing: -0.01em;
}

.report-intro {
  margin-bottom: 26px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 24px;
  align-items: start;
}

.report-intro p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
}

.report-intro h2 { margin-bottom: 10px; }

.report-intro span {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.report-scope {
  padding: 18px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  border: 1px solid rgba(241, 223, 207, .7);
  border-radius: var(--radius);
  background: #fafafa;
}

.report-scope b {
  width: 100%;
  color: var(--accent-deep);
  font-size: 15px;
  font-weight: 600;
}

.report-scope span {
  padding: 7px 12px;
  border: 1px solid rgba(255, 138, 91, .25);
  border-radius: 999px;
  background: #fff;
  color: #5f5a54;
  font-size: 13px;
  font-weight: 700;
}

.model-row { margin-bottom: 30px; }
.model-row button { min-height: 46px; }

.model-row button.is-selected,
.legend-grid button.is-selected,
.pill-legend button.is-selected {
  border-color: transparent;
  background: var(--btn-primary);
  color: #fff;
  box-shadow: 0 4px 10px -4px rgba(28, 24, 38, .35);
}

.diagnose-form { display: grid; gap: 28px; }

.diagnose-form label,
.diagnose-form > div {
  display: grid;
  gap: 12px;
}

.diagnose-form label span,
.form-section {
  color: var(--ink);
  font-size: 20px;
  font-weight: 600;
}

.diagnose-form input,
.filter-board input {
  width: 100%;
  height: 48px;
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}

.diagnose-form input:focus,
.filter-board input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, .18);
}

.diagnose-form input::placeholder,
.filter-board input::placeholder { color: var(--muted-2); }

.diagnose-form small { color: var(--muted); font-size: 14px; }

.choice-row .outline-active {
  border-color: transparent;
  background: var(--btn-primary);
  color: #fff;
  box-shadow: 0 4px 10px -4px rgba(28, 24, 38, .35);
}

/* Buttons — V2 shadcn-button style (h-10 default, h-8 sm, h-11 lg) */
.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: var(--btn-primary);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: background .2s var(--ease);
}
.primary-action:hover {
  background: var(--btn-primary-hover);
}
.primary-action:active {
  transform: scale(0.98);
}
.primary-action:disabled,
.primary-action[aria-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
}
.primary-action.compact {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
  border-radius: 6px;
}
.primary-action.is-accent {
  background: var(--accent);
  color: #fff;
}
.primary-action.is-accent:hover {
  background: var(--accent-deep);
}
.primary-action.is-accent:disabled,
.primary-action.is-accent[aria-disabled="true"] {
  background: var(--accent);
  opacity: .5;
}
.primary-action.full-width {
  width: 100%;
  height: 44px;
  font-size: 14px;
  border-radius: 8px;
}

.result-panel {
  margin-top: 22px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fafafa;
  animation: cardIn .35s var(--ease) both;
}

.inline-report-panel { scroll-margin-top: 96px; }

.report-document { display: grid; gap: 18px; }

.report-document-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 300px);
  gap: 18px;
  align-items: start;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fafafa;
}

.report-document-head span,
.report-document-meta span,
.report-metric-strip span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 720;
}

.report-document-head h3 {
  margin: 8px 0 10px;
  font-size: 26px;
  font-weight: 600;
}

.report-document-head p { max-width: 760px; }

.report-document-meta {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.report-document-meta b {
  font-size: 20px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.report-metric-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.report-metric-strip.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.report-metric-strip.three-col { grid-template-columns: repeat(3, minmax(0, 1fr)); }

.report-metric-strip section {
  min-height: 118px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.report-metric-strip section:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.report-metric-strip strong {
  display: block;
  margin-top: 10px;
  color: var(--ink);
  font-size: 17px;
  line-height: 1.45;
  font-weight: 600;
}

.report-document-section {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
}

.report-document-foot {
  padding: 14px 16px;
  border-radius: 10px;
  background: #fafafa;
  color: var(--accent-deep);
}

.report-reader-page {
  width: 100%;
  max-width: none;
  padding: 30px;
}

.report-reader-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.report-reader-toolbar button {
  min-height: 40px;
  padding: 0 18px;
  border: 1px solid var(--btn-secondary-border);
  border-radius: 10px;
  background: var(--btn-secondary-bg);
  color: var(--ink);
  font-weight: 760;
}

.report-reader-toolbar span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 760;
}

.report-reader-header { max-width: 980px; margin-bottom: 24px; }

.report-reader-header h2 {
  margin: 0 0 8px;
  color: var(--ink);
  font-size: 36px;
  line-height: 1.16;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.report-reader-header p {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
}

.report-reader-body { max-width: 1180px; }

.article-form-grid { display: grid; gap: 12px; }

.article-form-grid label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-weight: 720;
}

.article-form-grid input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.article-form-grid input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, .18);
}

.article-form-grid select,
.article-form-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
  background-color: #fff;
  color: var(--ink);
  font: inherit;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.article-form-grid select { min-height: 42px; padding-right: 36px; }
.article-form-grid textarea { resize: vertical; line-height: 1.6; }
.article-form-grid select:focus,
.article-form-grid textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, .18);
}

/* 4-phase article pipeline (mirrors seo-content-architect step layout) */
.pipeline-stepbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.pipeline-step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--fs-sm);
  color: var(--muted);
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.pipeline-step:hover { color: var(--ink); }
.pipeline-step[disabled] { cursor: not-allowed; opacity: .55; }
.pipeline-step-circle {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  background: var(--btn-secondary-bg);
  color: var(--muted);
  border: 1px solid var(--line);
}
.pipeline-step.is-active {
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-color: rgba(234, 88, 12, .25);
}
.pipeline-step.is-active .pipeline-step-circle {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.pipeline-step.is-done .pipeline-step-circle {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.pipeline-step.is-done { color: var(--ink); }
.pipeline-step.is-running .pipeline-step-circle {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.pipeline-step.is-running {
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-color: rgba(234, 88, 12, .25);
}
.pipeline-step.is-failed .pipeline-step-circle {
  background: #c62828;
  color: #fff;
  border-color: #c62828;
}
.pipeline-step.is-failed { color: #c62828; }
.pipeline-step-spin { animation: spinSlow .9s linear infinite; }
.pipeline-step-sep {
  flex: 0 0 18px;
  height: 1px;
  background: var(--line);
}

.pipeline-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.pipeline-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.pipeline-card-accent {
  width: 4px;
  height: 32px;
  border-radius: 999px;
  background: var(--accent);
  flex: 0 0 4px;
}
.pipeline-card-head h2 {
  margin: 0;
  font-size: var(--fs-md, 16px);
  font-weight: 700;
  color: var(--ink);
}
.pipeline-card-head .sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.pipeline-card-body {
  padding: 20px;
  flex: 1;
  min-height: 240px;
}
.pipeline-card-body.scroll {
  max-height: 70vh;
  overflow-y: auto;
}
.pipeline-card-foot {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
  flex-wrap: wrap;
}
.pipeline-card-foot label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-sm);
  color: var(--text);
}
.pipeline-card-foot .primary {
  background: var(--ink);
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  cursor: pointer;
  transition: background .15s var(--ease);
}
.pipeline-card-foot .primary:hover:not(:disabled) { background: var(--btn-primary-hover); }
.pipeline-card-foot .primary:disabled { opacity: .5; cursor: not-allowed; }
.pipeline-card-foot .ghost {
  background: var(--btn-secondary-bg);
  color: var(--ink);
  border: 1px solid var(--btn-secondary-border);
  padding: 9px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background .15s var(--ease);
}
.pipeline-card-foot .ghost:hover:not(:disabled) { background: var(--btn-secondary-bg-hover); }
.pipeline-card-foot .ghost:disabled { opacity: .5; cursor: not-allowed; }

/* head 版本 —— 让首屏可见的主 CTA 与 foot 保持同款视觉，比 foot 略紧凑。
   之前把 .primary/.ghost 只 scope 到 .pipeline-card-foot，导致 head 里的按钮
   完全没样式（一坨白底 + 蓝色下划线），需要补齐。 */
.pipeline-card-head-actions {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.pipeline-card-head .primary,
.pipeline-card-head .ghost {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: var(--fs-sm);
  line-height: 1;
  cursor: pointer;
  transition: background .15s var(--ease);
  white-space: nowrap;
}
.pipeline-card-head .primary {
  background: var(--ink);
  color: #fff;
  border: none;
}
.pipeline-card-head .primary:hover:not(:disabled) { background: var(--btn-primary-hover); }
.pipeline-card-head .primary:disabled { opacity: .5; cursor: not-allowed; }
.pipeline-card-head .ghost {
  background: var(--btn-secondary-bg);
  color: var(--ink);
  border: 1px solid var(--btn-secondary-border);
}
.pipeline-card-head .ghost:hover:not(:disabled) { background: var(--btn-secondary-bg-hover); }
.pipeline-card-head .ghost:disabled { opacity: .5; cursor: not-allowed; }
.pipeline-card-head .ghost.is-danger { color: #c62828; border-color: rgba(198, 40, 40, .3); }

/* Agent 执行子屏顶部操作条 —— 独立于 ConfigStep 出现的一屏，让用户明确切到"执行栏目" */
.agent-exec-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  margin-bottom: 12px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
}
.agent-exec-bar-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: var(--ink);
  min-width: 0;
  flex: 1;
}
.agent-exec-bar-title svg { color: var(--accent); flex: 0 0 auto; }
.agent-exec-bar-sub {
  font-weight: 400;
  color: var(--muted);
  font-size: var(--fs-sm);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.agent-exec-bar-actions {
  display: inline-flex;
  align-items: center;
  gap: 20px;
  flex: 0 0 auto;
}

/* .link-btn —— 次要 / 反向操作的通用样式：品牌橙 + 加粗字，无底色无边框。
   跟"内联链接不加下划线"一脉相承（feedback_link_underline.md）。
   禁止在次要操作上用灰底 pill/ghost（feedback_button_style.md）。 */
.link-btn,
.agent-exec-bar-actions button {
  background: transparent;
  border: none;
  padding: 0;
  border-radius: 0;
  font-weight: 700;
  font-size: var(--fs-sm);
  line-height: 1;
  cursor: pointer;
  color: var(--accent-deep);
  transition: color .12s var(--ease);
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.link-btn:hover:not(:disabled),
.agent-exec-bar-actions button:hover:not(:disabled) { color: var(--accent); }
.link-btn:disabled,
.agent-exec-bar-actions button:disabled { color: var(--muted); cursor: not-allowed; }
.link-btn.is-danger,
.agent-exec-bar-actions button.is-danger { color: #c62828; }
.link-btn.is-danger:hover:not(:disabled),
.agent-exec-bar-actions button.is-danger:hover:not(:disabled) { color: #a01e1e; }

.pipeline-phase-meta {
  display: grid;
  gap: 4px;
  padding: 12px 16px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 12px;
}
.pipeline-phase-meta strong { color: var(--ink); font-size: var(--fs-sm); }

/* ===== History list cards (Writing pipeline) ===== */
.pipeline-history-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pipeline-history-row {
  display: flex;
  align-items: stretch;
  gap: 20px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  text-decoration: none;
  color: inherit;
  transition: border-color .18s var(--ease), background .18s var(--ease),
              box-shadow .18s var(--ease), transform .18s var(--ease);
}
.pipeline-history-row:hover {
  border-color: var(--line-strong);
  background: var(--panel-soft);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.pipeline-history-row.is-static:hover { transform: none; }
.pipeline-history-select {
  display: inline-flex;
  align-items: center;
  padding-top: 2px;
  cursor: pointer;
}
.pipeline-history-select input[type="checkbox"] { cursor: pointer; }
.pipeline-history-main {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.pipeline-history-title {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: var(--fs-md);
  color: var(--ink);
  flex-wrap: wrap;
}
.pipeline-history-title strong { font-weight: 700; }
.pipeline-history-sep { color: var(--muted-2); }
.pipeline-history-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.pipeline-history-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(16, 185, 129, .10);
  color: #047857;
  font-weight: 600;
}
.pipeline-history-pill.tone-agent {
  background: rgba(255, 122, 26, .10);
  color: #c2410c;
}
.pipeline-agent-hint {
  font-size: var(--fs-xs);
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 8px;
  background: rgba(148, 163, 184, .10);
  align-self: flex-start;
}
.pipeline-agent-hint.tone-running {
  color: #c2410c;
  background: rgba(255, 122, 26, .10);
}
.pipeline-agent-hint.tone-failed {
  color: #b91c1c;
  background: rgba(239, 68, 68, .10);
}
.pipeline-history-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
}
.pipeline-history-open {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: var(--fs-sm);
  color: var(--ink);
  font-weight: 600;
  transition: gap .18s var(--ease);
}
.pipeline-history-row:hover .pipeline-history-open { gap: 8px; }

/* status badge */
.pipeline-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}
.pipeline-status-badge.tone-running {
  background: var(--accent-soft);
  color: var(--accent-deep);
  border-color: rgba(234, 88, 12, .22);
}
.pipeline-status-badge.tone-completed {
  background: rgba(16, 185, 129, .10);
  color: #047857;
  border-color: rgba(16, 185, 129, .25);
}
.pipeline-status-badge.tone-failed {
  background: rgba(244, 63, 94, .10);
  color: #be123c;
  border-color: rgba(244, 63, 94, .25);
}
.pipeline-status-badge.tone-draft {
  background: var(--btn-secondary-bg);
  color: var(--muted);
  border-color: var(--line);
}

/* 4-phase progress dots+labels */
.pipeline-progress-track {
  display: flex;
  align-items: center;
  gap: 0;
  flex-wrap: nowrap;
}
.pipeline-progress-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: var(--fs-xs);
  color: var(--muted);
}
.pipeline-progress-node {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--muted);
  flex-shrink: 0;
}
.pipeline-progress-num { font-size: 11px; font-weight: 700; }
.pipeline-progress-node.status-completed {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}
.pipeline-progress-node.status-running {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(234, 88, 12, .12);
}
.pipeline-progress-node.status-failed {
  background: var(--rose);
  border-color: var(--rose);
  color: #fff;
}
.pipeline-progress-item:has(.status-completed) .pipeline-progress-label { color: var(--ink); }
.pipeline-progress-item:has(.status-running) .pipeline-progress-label { color: var(--accent-deep); font-weight: 600; }
.pipeline-progress-item:has(.status-failed) .pipeline-progress-label { color: #be123c; }
.pipeline-progress-bar {
  display: inline-block;
  width: 28px;
  height: 2px;
  margin: 0 8px;
  background: var(--line);
  border-radius: 999px;
  flex-shrink: 0;
}
.pipeline-progress-bar.is-done { background: var(--green); }

@media (max-width: 720px) {
  .pipeline-history-row { flex-direction: column; gap: 12px; }
  .pipeline-history-side { flex-direction: row; align-items: center; justify-content: space-between; width: 100%; }
  .pipeline-progress-track { flex-wrap: wrap; row-gap: 8px; }
  .pipeline-progress-bar { width: 16px; margin: 0 4px; }
}

.toolbox-panel,
.toolbox-history-panel,
.rules-panel,
.rules-history-panel,
.diagnostic-panel,
.diagnostic-history-panel,
.batch-task-panel,
.batch-task-history-panel,
.finance-panel,
.finance-history-panel,
.rewrite-panel,
.rewrite-history-panel {
  margin-top: 18px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-xs);
  animation: cardIn .35s var(--ease) both;
}

.toolbox-form,
.rules-form,
.diagnostic-form,
.batch-task-form,
.finance-form,
.rewrite-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.toolbox-form label,
.rules-form label,
.diagnostic-form label,
.batch-task-form label,
.finance-form label,
.rewrite-form label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-weight: 720;
}

.toolbox-form label.wide,
.rules-form label.wide,
.diagnostic-form label.wide,
.batch-task-form label.wide,
.finance-form label.wide,
.rewrite-form label.wide {
  grid-column: 1 / -1;
}

.toolbox-form input,
.toolbox-form select,
.toolbox-form textarea,
.rules-form input,
.rules-form textarea,
.diagnostic-form input,
.diagnostic-form textarea,
.batch-task-form input,
.batch-task-form textarea,
.finance-form input,
.finance-form textarea,
.rewrite-form input,
.rewrite-form textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 14px;
  background-color: #fff;
  color: var(--ink);
  font: inherit;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.toolbox-form select { padding-right: 36px; }
.toolbox-form input:focus,
.toolbox-form textarea:focus,
.rules-form input:focus,
.rules-form textarea:focus,
.diagnostic-form input:focus,
.diagnostic-form textarea:focus,
.batch-task-form input:focus,
.batch-task-form textarea:focus,
.finance-form input:focus,
.finance-form textarea:focus,
.rewrite-form input:focus,
.rewrite-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, .18);
}

.toolbox-form textarea,
.rules-form textarea,
.diagnostic-form textarea,
.batch-task-form textarea,
.finance-form textarea,
.rewrite-form textarea {
  min-height: 132px;
  padding: 12px 14px;
  resize: vertical;
  line-height: 1.6;
}

.toolbox-form button,
.rules-form button,
.diagnostic-form button,
.batch-task-form button,
.finance-form button,
.rewrite-form > button {
  grid-column: 1 / -1;
  min-height: 48px;
  background: var(--btn-primary);
  color: #fff;
  font-weight: 600;
  border: 0;
  box-shadow: 0 4px 10px -4px rgba(28, 24, 38, .35);
}
.toolbox-form button:hover,
.rules-form button:hover,
.diagnostic-form button:hover,
.batch-task-form button:hover,
.finance-form button:hover,
.rewrite-form > button:hover {
  background: var(--btn-primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px -4px rgba(28, 24, 38, .42);
}

.toolbox-history-row span,
.rules-history-row span,
.diagnostic-history-row span,
.batch-task-history-row span,
.finance-history-row span,
.rewrite-history-row span {
  display: grid;
  gap: 4px;
}

.toolbox-history-row small,
.rules-history-row small,
.diagnostic-history-row small,
.batch-task-history-row small,
.finance-history-row small,
.rewrite-history-row small {
  color: var(--muted);
  font-size: 13px;
}

.rewrite-history-row .rewrite-history-row-tail,
.rewrite-history-row-tail {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  font-weight: 500;
}

/* 爆文改写 · 竞品热帖抓取 —— 竞争品 chip、热帖候选卡片、结构大纲。 */
.rewrite-known-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  align-items: center;
}
.rewrite-known-list .chip-btn {
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}
.rewrite-known-list .chip-btn em {
  font-style: normal;
  color: var(--muted);
  font-weight: 500;
}
.rewrite-known-list .chip-btn em.chip-tag-custom {
  background: rgba(28, 24, 38, .06);
  color: var(--muted);
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 10px;
}
.rewrite-known-list .chip-btn .chip-btn-check {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  color: var(--muted);
  background: #fff;
}
.rewrite-known-list .chip-btn:hover { border-color: var(--accent); }
.rewrite-known-list .chip-btn.is-active {
  border-color: var(--accent);
  background: rgba(234, 88, 12, .08);
  color: var(--accent);
}
.rewrite-known-list .chip-btn.is-active .chip-btn-check {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.rewrite-competitor-block {
  display: grid;
  gap: 10px;
}
.rewrite-competitor-block.wide { grid-column: 1 / -1; }
.rewrite-competitor-block .form-section-label {
  color: var(--text);
  font-weight: 720;
  font-size: 14px;
}
.rewrite-competitor-stats.wide { grid-column: 1 / -1; }
.rewrite-custom-add {
  display: flex;
  gap: 8px;
  align-items: center;
}
.rewrite-custom-add input {
  flex: 1;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 12px;
  background-color: #fff;
  color: var(--ink);
  font: inherit;
}
.rewrite-custom-add input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, .18);
}
.rewrite-custom-add .ghost-action { flex-shrink: 0; }

.rewrite-competitor-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: -4px;
}
.rewrite-competitor-stats .competitor-stat {
  display: inline-flex;
  gap: 8px;
  align-items: baseline;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(28, 24, 38, .05);
  font-size: 12px;
}
.rewrite-competitor-stats .competitor-stat.is-fallback {
  background: rgba(234, 88, 12, .08);
  color: var(--accent);
}
.rewrite-competitor-stats .competitor-stat em {
  font-style: normal;
  color: var(--muted);
  font-size: 11px;
}
.rewrite-competitor-stats .competitor-stat.is-fallback em { color: var(--accent); }

.rewrite-post-card-meta .competitor-tag {
  color: var(--accent);
  background: rgba(234, 88, 12, .1);
  padding: 1px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.rewrite-structure-competitor {
  margin-left: 8px;
  font-style: normal;
  font-size: 12px;
  color: var(--accent);
  background: rgba(234, 88, 12, .1);
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
}

.rewrite-fetch-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.rewrite-fetch-row.wide { grid-column: 1 / -1; }

.rewrite-post-list.wide { grid-column: 1 / -1; }
.rewrite-post-list h4 { margin: 0 0 4px; display: flex; align-items: center; gap: 8px; }
.rewrite-post-list .muted-line { margin: 0 0 10px; }
.rewrite-post-list-cache-tag {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: rgba(28, 24, 38, .06);
  padding: 2px 8px;
  border-radius: 999px;
}

.rewrite-post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.rewrite-post-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #fff;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.rewrite-post-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px -12px rgba(28, 24, 38, .35);
}
.rewrite-post-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, .18);
}
.rewrite-post-card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, .16);
  background: rgba(234, 88, 12, .04);
}
.rewrite-post-card.is-disabled {
  opacity: .55;
  cursor: not-allowed;
}

.rewrite-post-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.rewrite-post-card-meta .meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.rewrite-post-card-meta .meta-item + .meta-item::before {
  content: "·";
  color: var(--line);
  margin-right: 6px;
}
.rewrite-post-card-meta .competitor-tag {
  color: var(--accent);
  background: rgba(234, 88, 12, .1);
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 11px;
}

.rewrite-post-card-title-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}
.rewrite-post-card-title {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
  color: var(--ink);
  flex: 1;
  min-width: 0;
}
.rewrite-post-card-angle {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  background: rgba(28, 24, 38, .06);
  padding: 3px 10px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  font-weight: 600;
  /* 防御：即使 angle 意外拿到长句也不撑破卡片布局 */
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rewrite-post-card-snippet {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Hunt pipeline —— 每竞品一张卡片 */
.hunt-pipeline {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}
.hunt-pipeline-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.hunt-pipeline-card.is-ok { border-left: 3px solid #10b981; }
.hunt-pipeline-card.is-empty { border-left: 3px solid #d1d5db; }
.hunt-pipeline-card.is-failed { border-left: 3px solid #ef4444; }
.hunt-pipeline-card.is-running { border-left: 3px solid var(--accent); }

.hunt-pipeline-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.hunt-pipeline-card-head b { font-size: 14px; }

.hunt-pipeline-badge {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(28, 24, 38, .06);
  color: var(--muted);
  letter-spacing: 0.02em;
}
.hunt-pipeline-badge.is-ok     { background: rgba(16, 185, 129, .12); color: #059669; }
.hunt-pipeline-badge.is-empty  { background: rgba(28, 24, 38, .06); color: var(--muted); }
.hunt-pipeline-badge.is-failed { background: rgba(239, 68, 68, .12); color: #dc2626; }
.hunt-pipeline-badge.is-running{ background: rgba(255, 137, 51, .12); color: var(--accent); }

.hunt-pipeline-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px 8px;
  margin: 0;
}
.hunt-pipeline-stats > div { display: flex; flex-direction: column; }
.hunt-pipeline-stats dt {
  font-size: 10px;
  color: var(--muted);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.hunt-pipeline-stats dd {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: var(--ink);
}

.hunt-pipeline-reason {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  padding: 6px 8px;
  background: rgba(28, 24, 38, .03);
  border-radius: 4px;
}
.hunt-pipeline-dropped summary {
  cursor: pointer;
  font-size: 12px;
  list-style: none;
}
.hunt-pipeline-dropped summary::-webkit-details-marker { display: none; }
.hunt-pipeline-dropped summary::before {
  content: "▸ ";
  color: var(--muted);
  font-size: 10px;
}
.hunt-pipeline-dropped[open] summary::before { content: "▾ "; }
.hunt-pipeline-dropped ul {
  list-style: none;
  padding: 8px 0 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.hunt-pipeline-dropped li {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 4px 8px;
  align-items: baseline;
  font-size: 11px;
  line-height: 1.5;
}
.hunt-pipeline-dropped-type {
  color: var(--accent);
  font-weight: 600;
  font-size: 10px;
}
.hunt-pipeline-dropped a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.hunt-pipeline-dropped a:hover { color: var(--accent); }
.hunt-pipeline-dropped em {
  grid-column: 2;
  font-style: normal;
  color: var(--muted);
}

/* Hunt 历史列表 */
.hunt-history-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.hunt-history-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-decoration: none;
  color: var(--ink);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.hunt-history-card:hover {
  border-color: var(--accent);
  box-shadow: 0 6px 18px -12px rgba(28, 24, 38, .35);
}
.hunt-history-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hunt-history-card-head b { font-size: 14px; }
.hunt-history-card-head .muted-line { margin-left: auto; font-size: 12px; }
.hunt-history-card-competitors {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.hunt-history-comp {
  display: inline-flex;
  gap: 4px;
  align-items: baseline;
  padding: 3px 10px;
  background: rgba(28, 24, 38, .05);
  border-radius: 999px;
  font-size: 12px;
}
.hunt-history-comp em { font-style: normal; color: var(--muted); font-size: 11px; }
.hunt-history-card-stats {
  display: flex;
  gap: 14px;
  font-size: 12px;
  color: var(--muted);
}

/* 抓取空态：每竞品的被丢弃候选清单，帮用户判断"为啥抓不到" */
.rewrite-empty-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}
.rewrite-empty-comp {
  border: 1px solid rgba(28, 24, 38, .08);
  border-radius: 6px;
  padding: 8px 12px;
  background: #fff;
}
.rewrite-empty-comp summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 12px;
}
.rewrite-empty-comp summary::-webkit-details-marker { display: none; }
.rewrite-empty-comp summary::before {
  content: "▸";
  color: var(--muted);
  font-size: 10px;
}
.rewrite-empty-comp[open] summary::before { content: "▾"; }
.rewrite-empty-dropped {
  list-style: none;
  padding: 10px 0 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rewrite-empty-dropped li {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 6px 10px;
  align-items: baseline;
  font-size: 12px;
  line-height: 1.5;
}
.rewrite-empty-dropped-type {
  color: var(--accent);
  font-weight: 600;
  font-size: 11px;
}
.rewrite-empty-dropped-title {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}
.rewrite-empty-dropped-title:hover { color: var(--accent); }
.rewrite-empty-dropped em {
  grid-column: 2;
  font-style: normal;
}

/* hunt 结果页 —— 分步标题 */
.rewrite-section-h {
  margin: 0 0 12px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* agent 抓取跨篇文风档案 */
.rewrite-style-summary {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin: 10px 0;
}
.rewrite-style-card {
  border: 1px solid rgba(255, 137, 51, .22);
  border-radius: 8px;
  padding: 14px 16px;
  background: rgba(255, 137, 51, .04);
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.rewrite-style-card-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}
.rewrite-style-card-head b {
  font-size: 14px;
  color: var(--accent);
}
.rewrite-style-tone {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--ink);
  font-weight: 600;
}
.rewrite-style-block { font-size: 12px; }
.rewrite-style-block span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
}
.rewrite-style-block ul {
  margin: 4px 0 0;
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.rewrite-style-block li { line-height: 1.55; color: var(--ink); }
.rewrite-style-attrs {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 6px 12px;
  margin: 0;
  font-size: 12px;
}
.rewrite-style-attrs dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding-top: 1px;
}
.rewrite-style-attrs dd {
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
}
.rewrite-style-advice {
  margin: 0;
  padding: 8px 10px;
  background: rgba(28, 24, 38, .04);
  border-radius: 6px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink);
}

/* agent 抓取（试用）—— 判定徽章 + hunt 统计 details 面板 */
.rewrite-post-card-judgment {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 8px;
  background: rgba(255, 137, 51, .06);
  border-left: 2px solid var(--accent);
  border-radius: 4px;
  font-size: 12px;
}
.rewrite-post-card-judgment-type {
  font-weight: 700;
  color: var(--accent);
  font-size: 11px;
  letter-spacing: 0.02em;
}
.rewrite-agent-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  user-select: none;
}
.rewrite-agent-toggle small { display: block; }
.rewrite-agent-toggle input { margin: 0; }
.rewrite-hunt-stats {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 4px;
}
.rewrite-hunt-stat {
  border: 1px solid rgba(28, 24, 38, .08);
  border-radius: 6px;
  padding: 6px 10px;
  background: rgba(28, 24, 38, .02);
  font-size: 12px;
}
.rewrite-hunt-stat summary {
  cursor: pointer;
  list-style: none;
}
.rewrite-hunt-stat summary::-webkit-details-marker { display: none; }
.rewrite-hunt-stat summary::before {
  content: "▸ ";
  color: var(--muted);
  font-size: 10px;
}
.rewrite-hunt-stat[open] summary::before { content: "▾ "; }
.rewrite-hunt-dropped {
  list-style: none;
  padding: 8px 0 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.rewrite-hunt-dropped li {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 8px;
  align-items: baseline;
  font-size: 11px;
}
.rewrite-hunt-dropped li b {
  color: var(--muted);
  font-weight: 600;
}
.rewrite-hunt-dropped li em {
  grid-column: 2;
  font-style: normal;
  color: var(--muted);
  opacity: .8;
}

.rewrite-post-card-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
}
.rewrite-post-card-link {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
}
.rewrite-post-card-link:hover { text-decoration: none; }

.rewrite-structure.wide { grid-column: 1 / -1; }
.rewrite-structure h4 { margin: 0 0 6px; }
.rewrite-structure-meta {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 12px;
  margin: 6px 0 12px;
  font-size: 13px;
}
.rewrite-structure-meta dt { color: var(--muted); font-weight: 600; }
.rewrite-structure-meta dd { margin: 0; }
.rewrite-structure-outline {
  padding-left: 20px;
  margin: 0;
  display: grid;
  gap: 10px;
}
.rewrite-structure-outline > li {
  display: grid;
  gap: 4px;
  font-size: 13px;
}
.rewrite-structure-outline > li > b { font-size: 14px; }
.rewrite-structure-outline ul {
  margin: 4px 0 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 12px;
}

.rewrite-history-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
  margin: 8px 0 16px;
}

.rewrite-history-filter {
  display: grid;
  gap: 4px;
  min-width: 160px;
}

.rewrite-history-filter--wide {
  flex: 1;
  min-width: 240px;
}

.rewrite-history-filter > span {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .02em;
}

.rewrite-history-filter select,
.rewrite-history-filter input {
  height: 36px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background-color: var(--surface);
  color: var(--ink);
  font-size: 14px;
}
.rewrite-history-filter select { padding-right: 32px; }

.rewrite-review-panel,
.rewrite-source-panel {
  margin-top: 16px;
}

.rewrite-review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 0 4px;
}

.rewrite-action--danger {
  color: #b3261e;
  border-color: rgba(179, 38, 30, .35);
}

.rewrite-action--danger:hover {
  background: rgba(179, 38, 30, .08);
}

.rewrite-source-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
  padding: 10px 0 4px;
}

.rewrite-source-grid > div {
  display: grid;
  gap: 4px;
}

.rewrite-source-grid b {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .02em;
}

.rewrite-source-grid p {
  margin: 0;
  color: var(--ink);
}

.rewrite-source-grid-wide {
  grid-column: 1 / -1;
}

.rewrite-source-text {
  margin: 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--surface-sunk, rgba(0, 0, 0, .04));
  border: 1px solid var(--line);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink);
  max-height: 320px;
  overflow: auto;
}

.result-panel h3 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 600;
}

.result-panel .report-document-head h3 {
  margin: 8px 0 10px;
  font-size: 26px;
}

.result-panel p {
  margin: 6px 0;
  color: var(--text);
  font-size: 15px;
}

.report-section-grid {
  margin: 14px 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.report-section-grid section {
  padding: 14px;
  border: 1px solid rgba(241, 223, 207, .7);
  border-radius: 12px;
  background: #fafafa;
}

.report-section-grid b {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-deep);
  font-weight: 600;
}

.article-library-columns {
  margin-top: 18px;
  display: grid;
  grid-template-columns: minmax(320px, 0.85fr) minmax(0, 1.15fr);
  gap: 18px;
  align-items: start;
}

.article-library-list {
  position: sticky;
  top: 24px;
  display: grid;
  gap: 20px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-xs);
  max-height: calc(100vh - 80px);
  overflow: auto;
}

.article-library-list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 4px;
  border-bottom: 1px dashed var(--line);
}

.article-library-list-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: var(--fs-h3);
  font-weight: 600;
}

.article-library-list-head small { color: var(--muted); font-size: 12px; }

.article-library-cards {
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
  list-style: none;
}

.article-library-card {
  display: grid;
  gap: 10px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
}

.article-library-card:hover {
  border-color: rgba(240, 106, 58, 0.45);
  box-shadow: var(--shadow-sm);
}

.article-library-card--active {
  border-color: var(--accent);
  box-shadow: 0 8px 20px -10px rgba(240, 106, 58, 0.55);
  background: var(--accent-soft);
}

.article-library-card-body {
  display: grid;
  gap: 6px;
  padding: 0;
  border: none;
  background: none;
  color: inherit;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.article-library-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.article-library-card-head small { color: var(--muted); font-size: 12px; }

.article-library-card-body b {
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.4;
}

.article-library-card-meta {
  color: var(--muted);
  font-size: 12px;
}

.article-library-card-summary {
  margin: 4px 0 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.article-library-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 6px;
  border-top: 1px dashed var(--line);
}

.article-library-detail {
  display: grid;
  gap: 24px;
  padding: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel);
  box-shadow: var(--shadow-xs);
}

.article-library-detail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.article-library-detail-head .kicker {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.article-library-detail-head h3 {
  margin: 6px 0 8px;
  color: var(--ink);
  font-size: 24px;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.01em;
}

.article-library-detail-head p {
  margin: 0;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

.article-library-detail-meta {
  display: grid;
  gap: 6px;
  justify-items: end;
  text-align: right;
}

.article-library-detail-meta small { color: var(--muted); font-size: 12px; }

.article-library-review {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  border-radius: 14px;
  background: #fafafa;
  border: 1px solid rgba(241, 223, 207, .7);
}

.article-library-review > b {
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .02em;
}

.article-library-facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 18px;
}

.article-library-facts > div { display: grid; gap: 4px; }
.article-library-facts b { color: var(--muted); font-size: 12px; letter-spacing: .02em; }
.article-library-facts p { margin: 0; color: var(--ink); font-size: 14px; }
.article-library-facts-wide { grid-column: 1 / -1; }

.article-library-id {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
}

.article-library-empty {
  display: grid;
  gap: 8px;
  padding: 48px 16px;
  text-align: center;
}

.article-library-empty strong {
  color: var(--ink);
  font-size: var(--fs-h3);
  font-weight: 600;
}

.article-library-empty p { margin: 0; color: var(--muted); }

@media (max-width: 1180px) {
  .article-library-columns {
    grid-template-columns: minmax(0, 1fr);
  }
  .article-library-list {
    position: static;
    max-height: none;
  }
}

.article-prose {
  margin: 18px 0;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  color: var(--ink);
  line-height: 1.85;
  box-shadow: var(--shadow-xs);
}

.article-prose h3 {
  margin: 0 0 18px;
  color: var(--ink);
  font-size: 26px;
  line-height: 1.3;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.article-prose h4 {
  margin: 24px 0 10px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 600;
}

.article-prose p {
  margin: 0 0 14px;
  color: var(--text);
  font-size: 15px;
}

.prompt-report-list {
  margin: 12px 0;
  padding: 0;
  display: grid;
  gap: 8px;
  list-style: none;
}

.prompt-report-list li {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition: transform .2s var(--ease), border-color .2s var(--ease);
}
.prompt-report-list li:hover {
  transform: translateX(3px);
  border-color: rgba(234, 88, 12, .3);
}

.prompt-report-list strong,
.prompt-report-list span { display: block; }

.prompt-report-list span { margin-top: 4px; color: var(--muted); font-size: 13px; }

.result-panel button {
  margin-top: 12px;
  background: var(--ink);
  color: #fff;
  border: 0;
}

.analytics-page { width: 100%; max-width: none; margin: 0; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-grid article {
  position: relative;
  min-height: 150px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  overflow: hidden;
  transition: transform .35s var(--ease), box-shadow .35s var(--ease);
  animation: cardIn .4s var(--ease) both;
}
.stat-grid article::after {
  content: "";
  position: absolute;
  top: -50%; right: -50%;
  width: 200%; height: 200%;
  background: var(--grad-brand-soft);
  opacity: 0;
  transition: opacity .4s var(--ease);
  pointer-events: none;
}
.stat-grid article:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-md);
}
.stat-grid article:hover::after { opacity: 1; }
.stat-grid article > * { position: relative; z-index: 1; }
.stat-grid article:nth-child(1) { animation-delay: .02s; }
.stat-grid article:nth-child(2) { animation-delay: .08s; }
.stat-grid article:nth-child(3) { animation-delay: .14s; }
.stat-grid article:nth-child(4) { animation-delay: .2s; }

.stat-grid span {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.stat-grid strong {
  display: block;
  margin: 8px 0;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.stat-grid p { margin: 0; color: var(--muted); font-size: 14px; }

.stat-grid i {
  position: absolute;
  top: 22px;
  right: 22px;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--icon-bg);
  color: var(--ink);
  font-style: normal;
  font-size: 18px;
  transition: transform .4s var(--ease-spring), background .25s var(--ease), color .25s var(--ease);
}
.stat-grid article:hover i {
  background: var(--icon-bg-strong);
  color: var(--icon-ink-strong);
  transform: rotate(-8deg) scale(1.08);
}

.chart-layout {
  display: grid;
  grid-template-columns: minmax(360px, 0.9fr) minmax(520px, 1.6fr);
  gap: 22px;
}

.chart-card {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-xs);
  transition: box-shadow .25s var(--ease);
}
.chart-card:hover { box-shadow: var(--shadow-md); }

.chart-card h2 {
  margin: 0 0 18px;
  color: var(--ink);
  font-size: 20px;
  font-weight: 600;
}

.donut {
  width: min(330px, 78%);
  aspect-ratio: 1;
  margin: 18px auto 24px;
  border-radius: 50%;
  background: conic-gradient(
    var(--blue) 0 12.5%,
    var(--pink) 0 25%,
    var(--green) 0 37.5%,
    var(--accent) 0 50%,
    var(--teal) 0 62.5%,
    var(--amber) 0 75%,
    var(--accent-deep) 0 87.5%,
    var(--violet) 0
  );
  position: relative;
  box-shadow: 0 18px 40px -16px rgba(28, 24, 38, .25);
  animation: spinSlow 60s linear infinite;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 30%;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 4px 12px rgba(28, 24, 38, .06);
}

.legend-grid,
.pill-legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 20px;
  color: var(--text);
  font-size: 15px;
}

.legend-grid button,
.pill-legend button {
  min-height: 32px;
  justify-content: flex-start;
  padding: 0 12px;
  display: inline-flex;
  align-items: center;
  background: var(--btn-secondary-bg);
}

.pill-legend { display: flex; flex-wrap: wrap; gap: 8px; }

.pill-legend button {
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--panel-soft);
}

.dot {
  width: 12px;
  height: 12px;
  display: inline-block;
  margin-right: 8px;
  border-radius: 50%;
  vertical-align: middle;
  box-shadow: 0 0 0 3px rgba(255,255,255,.6);
}

.deepseek { background: var(--blue); }
.doubao   { background: var(--pink); }
.yuanbao  { background: var(--green); }
.tongyi   { background: var(--accent); }
.wenxin   { background: var(--teal); }
.nami     { background: var(--amber); }
.kimi     { background: var(--accent-deep); }
.zhipu    { background: var(--violet); }

.chart-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
}

.empty-chart {
  position: relative;
  height: 420px;
  margin-top: 18px;
  padding: 0 0 44px 44px;
  display: grid;
  grid-template-rows: repeat(11, 1fr);
  color: var(--muted);
  font-size: 13px;
  background:
    repeating-linear-gradient(to bottom, transparent 0, transparent 37px, #ece9e4 38px),
    linear-gradient(90deg, #ece9e4 1px, transparent 1px) 44px 0 / 1px 100% no-repeat;
}

.empty-chart span { transform: translateY(-8px); }

.x-axis {
  position: absolute;
  left: 70px;
  right: 0;
  bottom: 8px;
  color: var(--muted);
  font-size: 14px;
  word-spacing: 18px;
}

.filter-board {
  padding: 10px 0 0;
  border-bottom: 1px solid var(--line);
}

.outreach-record-grid {
  margin: 22px 0 8px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.outreach-record-grid section {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-soft);
  transition: transform .3s var(--ease), box-shadow .3s var(--ease);
}
.outreach-record-grid section:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.outreach-record-grid .work-row { background: #fff; }

.filter-board > div {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  border-bottom: 1px dashed var(--line);
  color: var(--text);
  font-size: 15px;
}

.filter-board > div:last-child { border-bottom: 0; }

.filter-board b { color: var(--ink); }

.filter-board button {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
}

.filter-board button.is-active {
  padding: 4px 10px;
  border-radius: 8px;
  background: #fafafa;
  border-color: rgba(255, 138, 91, .25);
  color: var(--accent-deep);
  font-weight: 700;
}

.search-row { padding: 14px 0; }

.search-row input {
  max-width: 420px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.search-row input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, .18);
}

.search-row strong {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.search-row button:first-of-type,
.actions button:first-child {
  background: var(--btn-primary);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 10px -4px rgba(28, 24, 38, .35);
}

.search-row .ghost,
.actions button:last-child {
  background: var(--btn-secondary-bg);
  color: var(--ink);
}

/* Compact bubble/chip layout for the customer media picker.
   Multiple chips per row via auto-fill grid; each chip surfaces only the
   essentials — brand / platform / tags / price / submit. */
.media-chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 14px;
  padding: 18px 0 4px;
}

.media-chip {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}
.media-chip:hover {
  border-color: rgba(255, 138, 91, .55);
  box-shadow: 0 8px 22px rgba(255, 138, 91, .12);
  transform: translateY(-1px);
}

.media-chip > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.media-chip-brand {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #161514, #34303a);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .2px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.media-chip-type {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.media-chip-type--official {
  background: rgba(255, 138, 91, .14);
  color: var(--accent-deep);
}
.media-chip-type--industry {
  background: rgba(120, 120, 128, .12);
  color: var(--muted);
}

.media-chip h3 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  line-height: 1.3;
}

.media-chip-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 20px;
}
.media-chip-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: #f5f5f7;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.media-chip-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}
.media-chip-foot em {
  font-style: normal;
  font-weight: 700;
  font-size: 18px;
  color: #e35a48;
}
.media-chip-foot em::before {
  content: "";
}
.media-chip-foot button {
  min-height: 32px;
  padding: 0 14px;
  font-size: 13px;
}

.module-page { min-height: 520px; }

.module-header { margin-bottom: 24px; }

.module-header span {
  display: inline-block;
  margin-bottom: 10px;
  padding: 4px 12px;
  border-radius: 999px;
  background: #fafafa;
  border: 1px solid rgba(255, 138, 91, .25);
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.module-worklist {
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
}

.work-row {
  min-height: 58px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-top: 1px solid var(--line);
  transition: background .2s var(--ease);
}
.work-row:hover { background: rgba(255, 138, 91, .04); }
.work-row:first-child { border-top: 0; }
.work-row > .row-select {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.work-row > .row-select input[type="checkbox"] { cursor: pointer; }
.work-row > span { flex: 1; min-width: 0; }

.work-row span {
  color: var(--ink);
  font-weight: 700;
}

/* =========================================================
   Toast & Drawer
   ========================================================= */
.toast {
  position: fixed;
  right: 28px;
  bottom: 28px;
  z-index: 40;
  max-width: 360px;
  padding: 14px 20px;
  border: 1px solid rgba(255, 255, 255, .6);
  border-radius: 14px;
  background: rgba(255, 255, 255, .9);
  backdrop-filter: blur(12px);
  color: var(--ink);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transform: translateY(12px) scale(.98);
  pointer-events: none;
  transition: .3s var(--ease);
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.drawer {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: none;
  justify-content: flex-end;
  background: rgba(20, 18, 28, 0.32);
  backdrop-filter: blur(4px);
  animation: pageIn .25s var(--ease);
}

.drawer.is-open { display: flex; }

.drawer-panel {
  width: min(460px, 92vw);
  height: 100%;
  padding: 30px;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -14px 0 40px rgba(28, 24, 38, .16);
  animation: pageIn .35s var(--ease);
}

.drawer-close {
  float: right;
  width: 38px;
  height: 38px;
  border: 1px solid var(--btn-secondary-border);
  border-radius: 12px;
  background: var(--btn-secondary-bg);
  color: var(--ink);
  font-size: 24px;
  line-height: 1;
  transition: background .2s var(--ease), transform .2s var(--ease);
}
.drawer-close:hover { background: var(--panel-soft); transform: rotate(90deg); }

#drawer-kicker {
  margin: 8px 0 8px;
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
}

#drawer-title {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: var(--fs-h2);
  font-weight: 600;
  letter-spacing: -0.01em;
}

#drawer-body {
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
}

.drawer-summary {
  margin-bottom: 18px;
  padding: 20px;
  border-radius: var(--radius-lg);
  background: #fafafa;
}

.drawer-summary strong {
  display: block;
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.drawer-summary span { color: var(--muted); }

/* =========================================================
   Reduced motion respect
   ========================================================= */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
}

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1400px) {
  .overview-grid,
  .chart-layout { grid-template-columns: 1fr; }

  .table-row {
    grid-template-columns: 50px minmax(120px, 1fr) 156px 80px 70px;
  }
}

@media (max-width: 980px) {
  body { min-width: 0; overflow-x: hidden; }

  .content { width: 100%; max-width: 100vw; padding: 16px; overflow-x: hidden; }

  .screen, .page-card, .panel, .chart-card { max-width: 100%; }

  .home-hero, .diagnose-card, .placement-page, .module-page { padding: 24px; }

  .home-hero-head, .report-intro, .feature-grid, .delivery-grid, .service-flow,
  .module-detail-grid, .material-columns, .report-section-grid, .report-document-head,
  .report-metric-strip, .toolbox-form, .rules-form,
  .diagnostic-form, .batch-task-form, .finance-form, .rewrite-form,
  .overview-grid, .support-grid, .stat-grid, .chart-layout, .action-list, .module-grid {
    grid-template-columns: 1fr;
  }

  .material-upload-card { align-items: flex-start; flex-direction: column; }

  .home-hero-head { gap: 24px; }
  .home-hero h1 { font-size: 32px; }
  .hero-copy { font-size: 15px; line-height: 1.65; }
  .insight-card { min-height: auto; padding: 22px; }

  .feature-grid article, .delivery-grid article { min-height: 0; }

  .panel-head.inline, .page-titlebar, .chart-heading {
    align-items: stretch; flex-direction: column;
  }
  .title-actions, .filter-toolbar, .search-row { align-items: stretch; }
  .title-actions button, .filter-toolbar button, .search-row button, .search-row input {
    width: 100%; max-width: none;
  }

  .tabs { width: 100%; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .tabs button { padding: 0 8px; }

  .competitor-table { overflow-x: auto; }
  .table-row { min-width: 660px; }
  .line-chart { min-height: 260px; }

  .media-chip-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 10px;
  }

  .empty-chart { min-width: 620px; }
  .chart-card:has(.empty-chart) { overflow-x: auto; }
}

@media (max-width: 560px) {
  .home-hero, .diagnose-card, .placement-page, .module-page, .panel, .chart-card { padding: 18px; }
  .home-hero h1 { font-size: 28px; }
  .section-title, .page-titlebar h1 { font-size: 22px; }
  .delivery-grid article { grid-template-columns: 1fr; }
  .delivery-grid article p { grid-column: auto; }
  .model-row button, .choice-row button { width: 100%; }
  .legend-grid { grid-template-columns: 1fr; }
  .work-row { align-items: stretch; flex-direction: column; padding: 14px; }
  .work-row button { width: 100%; }
}

/* ---------------------------------------------------------------------------
   AI 可见度报告 — 单页生成 UI
--------------------------------------------------------------------------- */

.visibility-page .prompt-source-block {
  display: grid;
  gap: 12px;
}

.prompt-source-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.num-prompts-inline {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.num-prompts-inline span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .01em;
}

.num-prompts-inline input {
  width: 64px;
  height: 36px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  color: var(--ink);
}

.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 40px;
  padding: 0 16px;
  border: 1px solid var(--btn-secondary-border);
  border-radius: 8px;
  background: var(--btn-secondary-bg);
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  transition: background .15s var(--ease), border-color .15s var(--ease);
}
.secondary-action:hover {
  background: var(--btn-secondary-bg-hover);
  border-color: #a3a3a3;
}
.secondary-action.compact {
  height: 32px;
  padding: 0 12px;
  font-size: 12px;
}
.secondary-action.compact.is-danger {
  color: #b3261e;
  border-color: rgba(179, 38, 30, .35);
}
.secondary-action.compact.is-danger:hover {
  background: rgba(179, 38, 30, .08);
  border-color: rgba(179, 38, 30, .55);
}
.secondary-action.compact.is-info > svg { color: #2c5cc3; }
.secondary-action.compact.is-info:hover {
  color: #1e4aa3;
  border-color: rgba(44, 92, 195, .45);
  background: rgba(44, 92, 195, .06);
}
.secondary-action.compact.is-warn > svg { color: #d68910; }
.secondary-action.compact.is-warn:hover {
  color: #8a5a08;
  border-color: rgba(214, 137, 16, .5);
  background: rgba(214, 137, 16, .08);
}
.secondary-action:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.ghost-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border: 1px solid var(--btn-secondary-border);
  border-radius: 6px;
  background: var(--btn-secondary-bg);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  transition: color .15s var(--ease), border-color .15s var(--ease), background .15s var(--ease);
}
.ghost-action:hover {
  background: var(--btn-secondary-bg-hover);
  border-color: #a3a3a3;
  color: var(--ink);
}
.ghost-action:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* Compact ghost-action: borderless text button used next to panel/section titles.
   Lives at the top-right corner of .panel-head / .compact-head as a secondary nav action. */
.ghost-action.compact,
a.ghost-action.compact,
button.ghost-action.compact {
  min-height: 0;
  height: auto;
  padding: 4px 2px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.4;
  white-space: nowrap;
  transition: color .15s var(--ease);
}
.ghost-action.compact::after {
  content: "→";
  margin-left: 4px;
  opacity: .55;
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.ghost-action.compact:hover {
  background: transparent;
  border: 0;
  color: var(--accent-deep);
  box-shadow: none;
  transform: none;
}
.ghost-action.compact:hover::after {
  opacity: 1;
  transform: translateX(2px);
}
.ghost-action.compact:focus-visible {
  outline: 2px solid rgba(234, 88, 12, .45);
  outline-offset: 3px;
  border-radius: 4px;
}

/* =========================================================
   Inline links — brand-coloured, no underline (modern SaaS style)
   - Use .inline-link explicitly, OR
   - Bare <a>/<Link> inside common text containers fall back to this.
   ========================================================= */
.inline-link,
.work-row span > a:not([class]),
.work-row div > a:not([class]),
.muted-line a:not([class]),
.muted-line a[class=""] {
  color: var(--accent-deep);
  font-weight: 600;
  text-decoration: none;
  transition: color .15s var(--ease);
}
.inline-link:hover,
.work-row span > a:not([class]):hover,
.work-row div > a:not([class]):hover,
.muted-line a:not([class]):hover {
  color: var(--accent);
  text-decoration: none;
}
.inline-link:focus-visible,
.work-row span > a:not([class]):focus-visible,
.work-row div > a:not([class]):focus-visible,
.muted-line a:not([class]):focus-visible {
  outline: 2px solid rgba(234, 88, 12, .45);
  outline-offset: 2px;
  border-radius: 2px;
}

/* External link (URL shown in body): same brand colour + a tiny ↗ glyph,
   still no underline. Apply via className="external-link" on <a target="_blank">. */
.external-link {
  color: var(--accent-deep);
  font-weight: 500;
  text-decoration: none;
  word-break: break-all;
  transition: color .15s var(--ease);
}
.external-link::after {
  content: "↗";
  display: inline-block;
  margin-left: 3px;
  font-size: .9em;
  opacity: .65;
  transition: transform .2s var(--ease), opacity .2s var(--ease);
}
.external-link:hover {
  color: var(--accent);
}
.external-link:hover::after {
  opacity: 1;
  transform: translate(1px, -1px);
}

.form-error {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid #f0c2c2;
  border-radius: 10px;
  background: #fdf2f2;
  color: #9b2b2b;
  font-size: 14px;
}
.form-hint {
  margin: 8px 0 0;
  padding: 8px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
}
.submit-with-hint {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.prompt-review.inline-review {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fafafa;
}

.prompt-review-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  flex-wrap: wrap;
}

.prompt-review-head h3 {
  margin: 0 0 4px;
  font-size: 18px;
  color: var(--ink);
}

.prompt-review-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.prompt-review-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.prompt-edit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.prompt-edit-list li {
  display: grid;
  grid-template-columns: 36px 1fr 36px;
  align-items: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.prompt-edit-list li:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, .18);
}

.prompt-edit-list textarea {
  width: 100%;
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font: inherit;
  color: var(--ink);
  resize: vertical;
  background: #fff;
}
.prompt-edit-list textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, .18);
}
.prompt-edit-list textarea:disabled {
  opacity: .6;
}

.prompt-index {
  display: grid;
  place-items: center;
  height: 36px;
  border-radius: 50%;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.prompt-remove {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: #fff;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.prompt-remove:hover {
  color: #b03434;
  border-color: #e7b8b8;
}
.prompt-remove:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.prompt-collapse-summary {
  width: 100%;
  padding: 14px 16px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
  cursor: pointer;
  transition: border-color .2s var(--ease), color .2s var(--ease), background .2s var(--ease);
}
.prompt-collapse-summary:hover {
  border-color: var(--accent);
  color: var(--ink);
  background: var(--panel-soft);
}

.visibility-model-row { margin-top: 8px; margin-bottom: 4px; gap: 12px; }

.visibility-model-row .model-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid #d8dcf2;
  border-radius: 12px;
  background: #f4f6ff;
  color: #4b4f8a;
  font-size: 14.5px;
  font-weight: 500;
  transition: background .2s var(--ease), border-color .2s var(--ease),
              color .2s var(--ease), transform .15s var(--ease),
              box-shadow .25s var(--ease);
}

.visibility-model-row .model-chip:hover {
  border-color: #b9c0ef;
  background: #eef0ff;
  box-shadow: none;
  transform: translateY(-1px);
}

.visibility-model-row .model-chip.is-selected {
  background: #eaecff;
  border-color: #b6bcef;
  color: #3b3f7d;
  box-shadow: none;
}

.model-chip-check {
  width: 16px;
  height: 16px;
  border: 1.5px solid #b6bcef;
  border-radius: 4px;
  background: #fff;
  flex-shrink: 0;
  position: relative;
  transition: background .2s var(--ease), border-color .2s var(--ease);
}

.model-chip.is-selected .model-chip-check {
  background: #6366f1;
  border-color: #6366f1;
}

.model-chip.is-selected .model-chip-check::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.model-chip:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.model-chip-count {
  display: inline-block;
  margin-top: 10px;
}

.muted-line { color: var(--muted); font-size: 14px; }

.visibility-running {
  display: grid;
  gap: 14px;
  padding: 6px 2px;
}
.visibility-running h3 { margin: 0; font-size: 22px; color: var(--ink); }
.visibility-running p { margin: 0; color: var(--muted); font-size: 14px; }

.eta-text {
  margin-left: 6px;
  color: var(--ink);
  font-style: normal;
  font-weight: 700;
}

.progress-bar {
  position: relative;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--panel-soft);
  overflow: hidden;
  border: 1px solid var(--line);
}

.progress-bar-fill {
  height: 100%;
  background: var(--grad-brand);
  transition: width .4s var(--ease);
}

.progress-percent {
  margin: 0;
  text-align: right;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.report-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
}
.report-actions .primary-action,
.report-actions .secondary-action {
  width: auto;
  min-width: 160px;
  height: 50px;
  padding: 0 22px;
  text-decoration: none;
}

@media (max-width: 900px) {
  .report-metric-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .prompt-source-controls { flex-direction: column; align-items: stretch; }
  .num-prompts-inline { justify-content: space-between; }
}

/* History trigger + drawer body
--------------------------------------------------------------------------- */
.history-trigger {
  margin-left: 14px;
  vertical-align: middle;
  font-size: 12px;
  font-weight: 700;
}
.history-list { display: grid; gap: 12px; }
.history-list > ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.history-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.history-row:hover { border-color: var(--accent); box-shadow: var(--shadow-sm); }
.history-row-main h4 { margin: 0; font-size: 16px; color: var(--ink); }
.history-row-main p {
  margin: 4px 0 2px;
  color: var(--text);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 360px;
}
.history-row-main small { display: block; color: var(--muted); font-size: 12px; }
.history-row-main small [data-status] {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--ink);
  font-weight: 700;
}
.history-row-main small [data-status="completed"] { background: rgba(52, 199, 123, .14); color: #1d8a4f; }
.history-row-main small [data-status="processing"],
.history-row-main small [data-status="pending"] { background: rgba(79, 130, 243, .14); color: #2c5cc3; }
.history-row-main small [data-status="failed"],
.history-row-main small [data-status="cancelled"] { background: rgba(176, 52, 52, .14); color: #9b2b2b; }
.history-row-side { display: grid; gap: 8px; justify-items: end; }
.history-row-side strong { color: var(--ink); font-size: 20px; font-weight: 600; }
.history-row-actions { display: flex; gap: 8px; }
.history-row-actions .ghost-action {
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  text-decoration: none;
  display: inline-grid;
  place-items: center;
}

/* Whole history row clickable — the textual area becomes the button */
.history-row-link {
  display: block;
  width: 100%;
  color: inherit;
  text-decoration: none;
  padding: 2px 0;
  border-radius: 8px;
  border: 0;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
  transition: color .2s var(--ease);
}
.history-row-link:hover h4 { color: var(--accent); }
.history-row-link:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Visibility report detail page — toolbar at top
--------------------------------------------------------------------------- */
.visibility-report-page { display: grid; gap: 20px; }
.visibility-report-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.visibility-report-toolbar-side {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.visibility-report-head {
  margin-top: 4px;
}

/* Model responses drawer
--------------------------------------------------------------------------- */
.responses-detail { display: grid; gap: 14px; }
.prompt-accordion {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
  counter-reset: prompt;
}
.prompt-accordion > li {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.prompt-accordion > li.is-open {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.prompt-accordion-head {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 12px 14px;
  background: transparent;
  border: 0;
  text-align: left;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}
.prompt-accordion-head:hover { background: var(--panel-soft); }

.prompt-accordion-num {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--panel-soft);
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}
.is-open .prompt-accordion-num {
  background: var(--accent);
  color: #fff;
}

.prompt-accordion-text {
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  word-break: break-word;
}

.prompt-accordion-count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.prompt-accordion-caret {
  color: var(--muted);
  font-size: 16px;
}

.prompt-accordion-body {
  padding: 14px;
  border-top: 1px solid var(--line);
  background: var(--panel-soft);
  display: grid;
  gap: 12px;
}

.provider-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.provider-tabs button {
  height: 30px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all .15s var(--ease);
}
.provider-tabs button small {
  margin-left: 4px;
  font-size: 10px;
  color: var(--muted-2);
  font-weight: 600;
}
.provider-tabs button:hover { color: var(--ink); border-color: var(--line-strong); }
.provider-tabs button.is-active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}
.provider-tabs button.is-active small { color: #fff; }

.provider-response {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  display: grid;
  gap: 10px;
}
.provider-response-meta {
  display: flex;
  gap: 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.provider-response-text {
  margin: 0;
  padding: 12px;
  background: var(--panel-soft);
  border-radius: 8px;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.65;
  color: var(--ink);
  max-height: 500px;
  overflow: auto;
}
.provider-response-refs b {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}
.provider-response-refs ul {
  list-style: disc;
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}
.provider-response-refs li {
  font-size: 12px;
  color: var(--muted);
}
.provider-response-refs a {
  color: var(--accent-deep);
  word-break: break-all;
  text-decoration: none;
  transition: color .15s var(--ease);
}
.provider-response-refs a:hover { color: var(--accent); }

/* ---------------------------------------------------------------------------
   报告详情：两级嵌套折叠（Prompt -> Provider -> Response cards）
--------------------------------------------------------------------------- */
.prompt-section { display: grid; gap: 14px; }
.prompt-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.prompt-section-head h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
}
.prompt-section-tools { display: flex; gap: 10px; align-items: center; }
.prompt-search {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 320px;
  padding: 0 14px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.prompt-search input {
  flex: 1;
  height: 100%;
  border: 0;
  outline: none;
  font: inherit;
  color: var(--ink);
  background: transparent;
}
.prompt-search input::placeholder { color: var(--muted-2); }

.prompt-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 12px;
}
.prompt-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fafafa;
  overflow: hidden;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.prompt-card.is-open {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-sm);
  background: #fafafa;
}
.prompt-card-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 18px 22px;
  background: transparent;
  border: 0;
  text-align: left;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}
.prompt-card-head:hover { background: rgba(255, 255, 255, .35); }
.prompt-card-head-text { min-width: 0; }
.prompt-card-label {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}
.prompt-card-question {
  margin: 0;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  word-break: break-word;
}
.prompt-card-head-side {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.prompt-provider-dots {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.provider-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #fff;
}
.prompt-card-count { color: var(--muted); }
.prompt-card-caret { color: var(--muted); font-size: 16px; }
.prompt-card-body {
  padding: 0 22px 22px;
  display: grid;
  gap: 10px;
}

/* Provider group inside a prompt */
.provider-group {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.provider-group.is-open {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-xs);
}
.provider-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  background: transparent;
  border: 0;
  text-align: left;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
}
.provider-group-head:hover { background: var(--panel-soft); }
.provider-pill {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
}
.provider-group-count {
  margin-left: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.provider-group-caret {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 14px;
}
.provider-response-list {
  list-style: none;
  margin: 0;
  padding: 10px 14px 14px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 8px;
  background: var(--panel-soft);
}
.response-card {
  display: block;
  width: 100%;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  text-align: left;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), transform .2s var(--ease);
}
.response-card:hover {
  border-color: var(--accent);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}
.response-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}
.response-iteration { color: var(--muted); }
.response-arrow {
  margin-left: auto;
  color: var(--muted-2);
  font-size: 14px;
  transition: color .2s var(--ease), transform .2s var(--ease);
}
.response-card:hover .response-arrow {
  color: var(--accent);
  transform: translateX(2px);
}
.response-card-preview {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Single response detail page (chat bubble + references sidebar)
--------------------------------------------------------------------------- */
.visibility-response-page { display: grid; gap: 18px; }
.response-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 22px;
  align-items: start;
}
.response-detail-chat {
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-xs);
}
.response-detail-foot {
  margin: 6px 0 0;
  text-align: center;
  color: var(--muted-2);
  font-size: 12px;
}
.response-aside-card {
  position: sticky;
  top: 92px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-xs);
}
.response-aside-card h4 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 600;
}
.response-aside-card ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}
.response-aside-card li {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}
.response-aside-card li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}
.response-aside-card .ref-title {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  word-break: break-word;
}
.response-aside-card a {
  color: var(--accent-deep);
  font-size: 12px;
  word-break: break-all;
  text-decoration: none;
  transition: color .15s var(--ease);
}
.response-aside-card a:hover { color: var(--accent); }

@media (max-width: 980px) {
  .response-detail-grid { grid-template-columns: 1fr; }
  .response-aside-card { position: static; }
}

/* Chat bubbles
--------------------------------------------------------------------------- */
.chat-row {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
}
.chat-row-user {
  grid-template-columns: minmax(0, 1fr) 40px;
}
.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: #fff;
  border: 1px solid var(--line);
  padding: 6px;
  object-fit: contain;
  box-shadow: var(--shadow-xs);
}
.chat-bubble {
  position: relative;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  max-width: 100%;
  box-shadow: var(--shadow-xs);
  display: grid;
  gap: 10px;
}
/* AI bubble — light gray, asymmetric corner (top-left squared) like hook-tool */
.chat-bubble-ai {
  background: var(--panel-soft);
  border-color: var(--line);
  border-top-left-radius: 6px;
  max-width: 86%;
}
/* User bubble — warm cream tone, asymmetric corner (top-right squared) */
.chat-bubble-user {
  background: var(--accent-soft);
  border-color: rgba(240, 106, 58, .22);
  border-top-right-radius: 6px;
  justify-self: end;
  max-width: 80%;
}
.chat-prompt-text {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
}
.chat-bubble-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.chat-provider-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  background: var(--panel-soft);
}
.chat-provider-tag small {
  font-size: 10px;
  font-weight: 700;
  opacity: .75;
}
.chat-provider-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.chat-provider-tag-user {
  color: var(--accent-deep);
  background: rgba(240, 106, 58, .14);
}
.chat-bubble-model {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.chat-bubble-target {
  margin-left: auto;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

/* References (collapsed by default) */
.chat-references {
  margin-top: 4px;
  border-top: 1px dashed var(--line);
  padding-top: 10px;
}
.chat-references > summary {
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  list-style: none;
}
.chat-references > summary::marker { display: none; }
.chat-references > summary::before {
  content: "▸ ";
  color: var(--muted-2);
}
.chat-references[open] > summary::before { content: "▾ "; }
.chat-references ul {
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.chat-references li {
  display: grid;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  color: var(--text);
}
.chat-references .ref-title {
  color: var(--ink);
  font-weight: 700;
}
.chat-references a {
  color: var(--accent-deep);
  word-break: break-all;
  text-decoration: none;
  transition: color .15s var(--ease);
}
.chat-references a:hover { color: var(--accent); }

/* Markdown content (inside AI bubbles)
--------------------------------------------------------------------------- */
.markdown-content {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.7;
  word-break: break-word;
}
.markdown-content > *:first-child { margin-top: 0; }
.markdown-content > *:last-child { margin-bottom: 0; }
.markdown-content p { margin: 0 0 10px; }
.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
  color: var(--ink);
  font-weight: 600;
  margin: 16px 0 8px;
  line-height: 1.35;
}
.markdown-content h1 { font-size: 20px; }
.markdown-content h2 { font-size: 17px; }
.markdown-content h3 { font-size: 15px; }
.markdown-content h4 { font-size: 14px; }
.markdown-content ul,
.markdown-content ol {
  margin: 8px 0 12px;
  padding-left: 22px;
  display: grid;
  gap: 6px;
}
.markdown-content li { line-height: 1.7; }
.markdown-content li > p { margin: 0; }
.markdown-content a {
  color: var(--accent-deep);
  text-decoration: underline;
  text-decoration-color: rgba(240, 106, 58, .35);
  text-underline-offset: 2px;
  word-break: break-all;
}
.markdown-content a:hover { color: var(--accent); }
.markdown-content code {
  padding: 2px 6px;
  border-radius: 6px;
  background: #f5f5f5;
  color: var(--ink);
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
  font-size: 13px;
}
.markdown-content pre {
  margin: 12px 0;
  padding: 16px 18px;
  background: #211f29;
  color: #e8e6f2;
  border-radius: 12px;
  overflow-x: auto;
  font-size: 13.5px;
  line-height: 1.7;
}
.markdown-content pre code {
  padding: 0;
  background: transparent;
  color: inherit;
  font-size: inherit;
}
.markdown-content blockquote {
  margin: 10px 0;
  padding: 8px 14px;
  border-left: 3px solid var(--accent);
  background: rgba(240, 106, 58, .06);
  border-radius: 0 8px 8px 0;
  color: var(--text);
}
.markdown-content hr {
  border: 0;
  border-top: 1px dashed var(--line-strong);
  margin: 14px 0;
}
.markdown-content table {
  border-collapse: collapse;
  margin: 12px 0;
  width: 100%;
  font-size: 13.5px;
  line-height: 1.6;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.markdown-content thead { background: var(--panel-soft); }
.markdown-content th,
.markdown-content td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}
.markdown-content tbody tr:last-child td { border-bottom: 0; }
.markdown-content mark {
  background: rgba(242, 177, 59, .35);
  color: #6c4a00;
  padding: 0 3px;
  border-radius: 3px;
}
.markdown-content strong { color: var(--ink); font-weight: 600; }
.markdown-content img { max-width: 100%; height: auto; border-radius: 8px; }

@media (max-width: 720px) {
  .chat-bubble-user { max-width: 92%; }
  .prompt-card-head { padding: 14px 16px; }
  .prompt-search { min-width: 0; width: 100%; }
}

/* =========================================================
   Pipeline KPI grid — Home top metrics (calmer, scannable)
   ========================================================= */
.pipeline-kpi-grid {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.pipeline-kpi-grid article {
  padding: 18px 18px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  display: grid;
  gap: 6px;
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.pipeline-kpi-grid article:hover {
  border-color: var(--line-strong);
  box-shadow: var(--shadow-xs);
}
.pipeline-kpi-grid .kpi-label {
  color: var(--muted);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .02em;
}
.pipeline-kpi-grid .kpi-value {
  display: flex;
  align-items: baseline;
  gap: 4px;
}
.pipeline-kpi-grid .kpi-value strong {
  color: var(--ink);
  font-size: 30px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.02em;
}
.pipeline-kpi-grid .kpi-unit {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}
.pipeline-kpi-grid .kpi-foot {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

@media (max-width: 1200px) {
  .pipeline-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .pipeline-kpi-grid { grid-template-columns: 1fr; }
}

/* =========================================================
   Home summary grid — thumbnails that link to /visibility
   ========================================================= */
.home-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
  padding: 22px;
  align-items: stretch;
}
.home-summary-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow-xs);
  transition: transform .25s var(--ease), box-shadow .25s var(--ease);
  min-height: 200px;
}
.home-summary-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}
.home-summary-card > header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.home-summary-card .card-tag {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--accent-deep);
  background: var(--accent-soft);
  border-radius: 999px;
  padding: 3px 10px;
  line-height: 1.4;
}
.home-summary-card h3 {
  margin: 0;
  font-size: 16px;
  color: var(--ink);
  font-weight: 700;
}
.home-summary-metric {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: -4px;
}
.home-summary-metric strong {
  font-size: 36px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -.02em;
  line-height: 1.05;
}
.home-summary-metric span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.home-summary-sub {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
  letter-spacing: .01em;
}
.home-summary-foot {
  margin-top: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.home-summary-card .card-cta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-deep);
  text-decoration: none;
  padding: 6px 0;
  border-bottom: 1px solid transparent;
  transition: border-color .2s var(--ease), transform .2s var(--ease);
}
.home-summary-card .card-cta:hover {
  border-bottom-color: var(--accent);
  transform: translateX(2px);
}
.home-summary-card .metric-chart {
  margin: 2px 0 0;
  border-radius: 10px;
  overflow: hidden;
}
.home-summary-card.chart-thumb .metric-chart svg.line-chart {
  min-height: 0;
  height: 120px;
  border: 0;
  background: transparent;
  display: block;
}
.competitor-chip-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.competitor-chip-list li {
  font-size: 12px;
  background: var(--panel-soft);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 10px;
}
.competitor-manage-list {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.competitor-manage-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.competitor-manage-name {
  font-size: 14px;
  color: var(--ink);
  font-weight: 500;
}
.competitor-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.competitor-row-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.competitor-row-meta {
  font-size: 12px;
  color: var(--muted);
}
.competitor-row-meta strong {
  color: var(--ink);
  font-weight: 600;
  margin: 0 2px;
}
.competitor-row-bar {
  width: 100%;
  height: 4px;
  background: var(--line);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}
.competitor-row-bar-fill {
  height: 100%;
  background: var(--brand-orange, #ea580c);
  border-radius: 999px;
  transition: width 200ms ease;
}
.competitor-row-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.candidates-toggle {
  background: transparent;
  border: 0;
  padding: 0;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
}
.candidates-toggle:hover {
  color: var(--ink);
}

/* =========================================================
   Visibility overview extras
   ========================================================= */
.report-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
.report-picker > span:first-child { white-space: nowrap; }
.report-picker-select { min-width: 240px; max-width: 320px; }
.report-picker-more {
  border: 1px dashed var(--line-strong);
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 12.5px;
  cursor: pointer;
  transition: color .12s var(--ease), border-color .12s var(--ease), background-color .12s var(--ease);
}
.report-picker-more:hover {
  color: var(--accent-deep);
  border-color: var(--accent);
  background: var(--accent-soft);
}

/* Full report browser inside drawer — 4-column grid: brand / title / score / date */
.report-browser {
  display: flex;
  flex-direction: column;
  gap: 10px;
  height: 100%;
  min-height: 0;
}
.report-browser-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  font-size: 13.5px;
  line-height: 1.4;
  outline: none;
  background: #fff;
  color: var(--ink);
}
.report-browser-search input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.report-browser-brands {
  display: flex;
  gap: 6px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  white-space: nowrap;
}
.report-browser-brands::-webkit-scrollbar { height: 4px; }
.report-browser-brands::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 2px; }
.report-browser-brands button {
  flex-shrink: 0;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  padding: 3px 10px;
  border-radius: 999px;
  font: inherit;
  font-size: 12px;
  line-height: 1.6;
  cursor: pointer;
  transition: color .12s var(--ease), border-color .12s var(--ease), background-color .12s var(--ease);
}
.report-browser-brands button:hover { color: var(--accent-deep); border-color: var(--accent); background: var(--accent-soft); }
.report-browser-brands button.is-active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.report-browser-list {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.report-browser-head,
.report-browser-row {
  display: grid;
  grid-template-columns: minmax(72px, 120px) 1fr minmax(52px, auto) minmax(96px, auto);
  gap: 10px;
  align-items: center;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1.4;
}
.report-browser-head {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #fafafa;
  color: var(--muted);
  font-size: 11.5px;
  letter-spacing: .04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  padding-top: 6px;
  padding-bottom: 6px;
}
.report-browser-row {
  width: 100%;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: background-color .12s var(--ease);
}
.report-browser-row:first-of-type { border-top: 0; }
.report-browser-row:hover { background: var(--accent-soft); }
.report-browser-row.is-active { background: var(--accent-soft); color: var(--accent-deep); font-weight: 500; }
.report-browser-brand {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-browser-title {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.report-browser-row .right,
.report-browser-head .right { text-align: right; }
.report-browser-score { font-variant-numeric: tabular-nums; font-weight: 500; color: var(--accent-deep); }
.report-browser-row.is-active .report-browser-score { color: var(--accent-deep); }
.report-browser-date {
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.report-browser-empty { padding: 24px 12px; text-align: center; color: var(--muted); font-size: 13px; margin: 0; }
.visibility-data-note {
  margin: 8px 0 4px;
  font-size: 12px;
  color: var(--muted);
}
.visibility-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 28px;
}
.visibility-empty-head h2 {
  margin: 6px 0 4px;
  color: var(--ink);
}
.competitor-table .table-row.is-self {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
}

@media (max-width: 980px) {
  .home-summary-grid { grid-template-columns: 1fr; }
}


/* ===========================================================================
 * Visibility history — table layout mirrored after the hook-tool design.
 * One row per report: brand, score pill, model avatars, time, icon actions.
 * =========================================================================== */
.report-table-wrap {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
}
.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.report-table thead {
  background: rgba(245, 246, 250, .8);
}
.report-table th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--muted);
  letter-spacing: .02em;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.report-table-checkbox { width: 44px; }
.report-table-actions-head { text-align: center; }
.report-table td {
  padding: 16px 18px;
  border-bottom: 1px solid rgba(228, 230, 236, .6);
  vertical-align: middle;
}
.report-table tbody tr:last-child td { border-bottom: 0; }
.report-table tbody tr {
  transition: background-color .15s var(--ease);
}
.report-table tbody tr:hover { background: rgba(245, 246, 250, .55); }
.report-table tbody tr.is-in-progress { background: rgba(245, 246, 250, .55); }

.report-table input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.report-row-brand {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: color .15s var(--ease);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.report-row-brand:hover { color: var(--accent); }

.report-row-time {
  color: var(--muted);
  white-space: nowrap;
}

/* Score pills — colour-coded tiers */
.report-score-wrap { display: inline-flex; align-items: center; gap: 8px; }
.score-pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.4;
}
.score-pill--high { background: rgba(52, 199, 123, .14); color: #1d8a4f; }
.score-pill--mid  { background: rgba(245, 158, 11, .14); color: #b6630d; }
.score-pill--low  { background: rgba(239, 68, 68, .14);  color: #c0312e; }
.score-pill--empty { background: var(--panel-soft); color: var(--muted); }

/* Status pills (待确认 / 生成中 / 失败 / 已取消) */
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: var(--panel-soft);
  color: var(--ink);
  white-space: nowrap;
}
.status-pill--pending_review,
.status-pill--pending_competitor_review { background: rgba(245, 158, 11, .14); color: #b6630d; }
.status-pill--processing                { background: rgba(79, 130, 243, .14); color: #2c5cc3; }
.status-pill--failed                    { background: rgba(239, 68, 68, .14);  color: #c0312e; }
.status-pill--cancelled                 { background: rgba(120, 120, 120, .14); color: #4d4d4d; }
.status-pill--fact-confirmed { background: rgba(34, 154, 89, .14); color: #1f7a45; }
.status-pill--fact-draft     { background: rgba(120, 120, 120, .12); color: #4d4d4d; }
.status-pill--fact-disputed  { background: rgba(245, 158, 11, .14); color: #b6630d; }
.status-pill--fact-merged    { background: rgba(110, 86, 207, .12); color: #4530a3; }
.status-pill--fact-rejected  { background: rgba(239, 68, 68, .14); color: #c0312e; }
.status-pill-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
  animation: pulse-dot 1.2s ease-in-out infinite;
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: .55; transform: scale(1.4); }
}

/* Provider avatar row */
.provider-avatars {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.provider-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--line);
  overflow: hidden;
  flex-shrink: 0;
}
.provider-avatar img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}
.provider-avatar-letter {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

/* Bulk-select bar — shown above a list table when rows are selected */
.bulk-select-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  margin-bottom: 10px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid rgba(234, 88, 12, .22);
  animation: bulkBarIn .15s var(--ease);
}
.bulk-select-bar-count { font-size: 13px; color: var(--accent-deep); }
.bulk-select-bar-count strong { font-weight: 700; }
.bulk-select-bar-actions { display: inline-flex; gap: 6px; }
.bulk-select-bar-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
.bulk-select-bar-btn:hover:not(:disabled) { border-color: var(--line-strong); }
.bulk-select-bar-btn:disabled { opacity: .55; cursor: not-allowed; }
.bulk-select-bar-btn.is-danger { color: #c0312e; border-color: rgba(239, 68, 68, .3); }
.bulk-select-bar-btn.is-danger:hover:not(:disabled) { background: rgba(239, 68, 68, .1); border-color: rgba(239, 68, 68, .55); }
@keyframes bulkBarIn {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Checkbox column in list tables */
.report-table-checkbox { width: 32px; text-align: center; }
.report-table-checkbox input[type="checkbox"] { cursor: pointer; }

/* Icon-only action buttons in the rightmost column */
.report-table-actions { text-align: center; }
.report-action-group,
.work-row .report-action-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
/* Selector doubled up so it wins over `.work-row button` (which sets a
   big 42px pill background) — otherwise icon buttons inside HistoryPanel
   rows render as chunky boxes. */
.report-action-icon,
.work-row .report-action-icon,
.work-row button.report-action-icon {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 8px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 400;
  box-shadow: none;
  transform: none;
  text-decoration: none;
  transition: background-color .15s var(--ease), color .15s var(--ease);
}
.report-action-icon-glyph {
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
}
.report-action-icon-glyph svg { width: 100%; height: 100%; }
.report-action-icon:hover {
  background: rgba(0,0,0,.05);
  color: var(--ink);
  transform: none;
  box-shadow: none;
  border-color: transparent;
}
.report-action-icon--default:hover         { background: rgba(79, 130, 243, .12); color: var(--accent); }
.report-action-icon--danger:hover          { background: rgba(239, 68, 68, .12);  color: #c0312e; }
.report-action-icon--success:hover         { background: rgba(52, 199, 123, .14); color: #1d8a4f; }
.report-action-icon--muted:hover           { background: rgba(0,0,0,.06); color: var(--ink); }

/* Pagination */
.report-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}
.report-pagination-controls { display: inline-flex; gap: 8px; }
.muted-line.subtle { font-size: 12px; }

@media (max-width: 900px) {
  .report-table th:nth-child(4),
  .report-table td:nth-child(4),
  .report-table th:nth-child(5),
  .report-table td:nth-child(5) { display: none; }
  .report-row-brand { max-width: 140px; }
}

/* Article library table — five-column layout with sensible widths so the
   title column doesn't starve 品牌·主题 / 状态 / 创建时间. */
.article-library-table { table-layout: fixed; }
.article-library-table col.col-title { width: auto; }
.article-library-table col.col-brand { width: 22%; }
.article-library-table col.col-status { width: 100px; }
.article-library-table col.col-time { width: 168px; }
.article-library-table col.col-actions { width: 96px; }
.article-library-table td .muted-line.subtle {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-top: 4px;
}
.article-library-table .report-row-brand {
  max-width: 100%;
  white-space: normal;
  text-overflow: clip;
  display: block;
  text-align: left;
}
.article-library-table td:nth-child(2) {
  color: var(--muted);
  word-break: break-word;
}
@media (max-width: 900px) {
  .article-library-table { table-layout: auto; }
}

/* =========================================================
   Facts page — clean fact list per the new reference design.
   File card row + status tabs + category-grouped fact rows.
   ========================================================= */

.facts-page .report-intro { margin-bottom: 18px; }

.fact-file-section {
  margin: 4px 0 18px;
}
.fact-file-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  cursor: pointer;
  transition: border-color .18s var(--ease), background-color .18s var(--ease);
  font-size: 13px;
  color: var(--text);
}
.fact-file-toggle:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.fact-file-toggle__chevron {
  display: inline-flex;
  align-items: center;
  color: var(--muted);
}
.fact-file-toggle__label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.fact-file-toggle__label strong {
  color: var(--muted);
  font-weight: 600;
}
.fact-file-toggle__current {
  color: var(--ink);
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 360px;
}
.fact-file-toggle__meta {
  margin-left: auto;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
.fact-file-section.is-expanded .fact-file-toggle {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
}

.fact-file-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-top: 0;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  background: #fff;
}

.fact-file-card {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 14px 18px;
  border-radius: 14px;
  border: 1px solid rgba(28, 24, 38, .08);
  background: #fff;
  text-align: left;
  cursor: pointer;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), transform .18s var(--ease);
}
.fact-file-card:hover {
  border-color: rgba(110, 86, 207, .35);
  box-shadow: 0 2px 10px rgba(28, 24, 38, .04);
}
.fact-file-card.is-active {
  border-color: rgba(110, 86, 207, .55);
  background: #fafafa;
  box-shadow: 0 4px 14px rgba(110, 86, 207, .08);
}

.fact-file-card__icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .04em;
  color: #7b7387;
  background: #f3f1f6;
  border-radius: 12px;
}
.fact-file-card__icon--all {
  font-size: 12px;
  color: #6e56cf;
  background: #efeaff;
}

.fact-file-card__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}
.fact-file-card__title {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.fact-file-card__title strong {
  font-size: 15px;
  font-weight: 700;
  color: #1c1826;
  word-break: break-all;
}

.fact-file-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .01em;
  background: #e6f7ec;
  color: #1f8a4d;
  border: 1px solid rgba(31, 138, 77, .25);
}
.fact-file-badge--pending {
  background: #fff5e2;
  color: #b6630d;
  border-color: rgba(245, 158, 11, .25);
}

.fact-file-card__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  color: #8b8395;
  font-size: 13px;
}
.fact-file-card__meta i {
  font-style: normal;
  color: #c6c0cd;
}

/* ---- Status filter tabs ---- */
.fact-status-tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}
.fact-status-tab {
  padding: 7px 16px;
  border-radius: 999px;
  border: 1px solid rgba(28, 24, 38, .08);
  background: #fff;
  color: #5d5566;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .18s var(--ease), color .18s var(--ease), border-color .18s var(--ease);
}
.fact-status-tab:hover { border-color: rgba(110, 86, 207, .35); color: #1c1826; }
.fact-status-tab.is-active {
  background: #6e56cf;
  color: #fff;
  border-color: #6e56cf;
}
.fact-status-tab--disputed.is-active {
  background: #ffba2b;
  border-color: #ffba2b;
  color: #5b3500;
}
.fact-status-tab--merged.is-active {
  background: #efeaff;
  border-color: #6e56cf;
  color: #4530a3;
}
.fact-status-tab--rejected.is-active {
  background: #fbe3e0;
  border-color: #d77571;
  color: #8a2520;
}
.fact-status-tab--draft.is-active {
  background: #e8eaf2;
  border-color: #aab0c4;
  color: #34374a;
}

/* ---- Category-grouped fact rows ---- */
.fact-group-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fact-group {
  padding: 6px 0;
  border-top: 1px solid rgba(28, 24, 38, .06);
}
.fact-group:first-child { border-top: 0; }

.fact-group-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 4px 12px;
}
.fact-group-icon {
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: #efeaff;
  color: #6e56cf;
  font-size: 14px;
  font-weight: 700;
}
.fact-group-head strong {
  color: #1c1826;
  font-size: 16px;
  font-weight: 700;
}
.fact-group-count {
  color: #9a92a3;
  font-size: 13px;
  font-weight: 500;
}

.fact-row-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.fact-row {
  display: grid;
  grid-template-columns: auto auto auto 1fr auto;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: background-color .15s var(--ease);
}
.fact-row:hover { background: #faf8ff; }
.fact-row + .fact-row { margin-top: 2px; }

.fact-row__check {
  margin-top: 6px;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  cursor: pointer;
  accent-color: #6e56cf;
}

.fact-row__dot {
  margin-top: 10px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #34c77b;
  flex-shrink: 0;
}
.fact-row__dot--draft     { background: #aab0c4; }
.fact-row__dot--confirmed { background: #34c77b; }
.fact-row__dot--disputed  { background: #ffba2b; }
.fact-row__dot--merged    { background: #6e56cf; }
.fact-row__dot--rejected  { background: #d77571; }

.fact-nature-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 22px;
  margin-top: 3px;
  padding: 0 8px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .04em;
  background: #fff5e2;
  color: #b6630d;
  border: 1px solid rgba(245, 158, 11, .35);
}
.fact-nature-badge--soft {
  background: #f3f1f6;
  color: #7b7387;
  border-color: rgba(28, 24, 38, .12);
}

.fact-row__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.fact-row__statement {
  color: #1c1826;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.45;
}
.fact-row__evidence {
  color: #8b8395;
  font-size: 13px;
  line-height: 1.5;
}

.fact-row__actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  opacity: 0;
  transition: opacity .15s var(--ease);
}
.fact-row:hover .fact-row__actions { opacity: 1; }
.fact-row__action {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  border: 1px solid rgba(28, 24, 38, .1);
  background: #fff;
  color: #5d5566;
  font-size: 13px;
  cursor: pointer;
  transition: background-color .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.fact-row__action:hover {
  background: #efeaff;
  color: #4530a3;
  border-color: #6e56cf;
}
.fact-row__action--danger:hover {
  background: #fbe3e0;
  color: #8a2520;
  border-color: #d77571;
}
.fact-row__action:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 760px) {
  .fact-row { grid-template-columns: auto auto auto 1fr; }
  .fact-row__actions { grid-column: 1 / -1; opacity: 1; padding-left: 32px; }
}

/* ---- Multi-select: select-all bar, group checkbox, selected row, batch bar ---- */
.fact-select-all-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  margin-bottom: 6px;
  border-radius: 8px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  font-size: 13px;
  color: var(--text);
}
.fact-select-all-bar__check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}
.fact-select-all-bar__check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}
.fact-select-all-bar__count {
  color: var(--accent-deep);
  font-weight: 700;
}

.fact-group-check {
  display: inline-flex;
  align-items: center;
  margin-right: 2px;
  cursor: pointer;
}
.fact-group-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

.fact-row__check {
  accent-color: var(--accent);
  cursor: pointer;
}
.fact-row.is-selected { background: var(--accent-soft); }
.fact-row.is-selected:hover { background: var(--accent-soft); }

.fact-batch-bar {
  position: sticky;
  bottom: 16px;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 16px;
  margin: 16px auto 8px;
  max-width: 720px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
}
.fact-batch-bar__info {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}
.fact-batch-bar__info strong { font-weight: 700; }
.fact-batch-bar__clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 0;
  background: rgba(255, 255, 255, .12);
  color: #fff;
  cursor: pointer;
  transition: background-color .15s var(--ease);
}
.fact-batch-bar__clear:hover { background: rgba(255, 255, 255, .22); }
.fact-batch-bar__actions {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}
.fact-batch-bar__btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, .18);
  background: rgba(255, 255, 255, .08);
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color .15s var(--ease), border-color .15s var(--ease);
}
.fact-batch-bar__btn:hover {
  background: rgba(255, 255, 255, .18);
  border-color: rgba(255, 255, 255, .35);
}
.fact-batch-bar__btn:disabled { opacity: .5; cursor: not-allowed; }
.fact-batch-bar__btn--primary {
  background: var(--accent);
  border-color: var(--accent);
}
.fact-batch-bar__btn--primary:hover {
  background: var(--accent-deep);
  border-color: var(--accent-deep);
}
.fact-batch-bar__btn--danger {
  background: rgba(244, 63, 94, .22);
  border-color: rgba(244, 63, 94, .45);
}
.fact-batch-bar__btn--danger:hover {
  background: rgba(244, 63, 94, .38);
  border-color: rgba(244, 63, 94, .65);
}

@media (max-width: 600px) {
  .fact-batch-bar { flex-direction: column; align-items: stretch; }
  .fact-batch-bar__actions { justify-content: space-between; }
}

/* ---- Dedupe toggle + cluster view ---- */
.fact-dedupe-toggle {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid rgba(234, 88, 12, .35);
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color .15s var(--ease), border-color .15s var(--ease);
}
.fact-dedupe-toggle:hover {
  background: #ffedd5;
  border-color: var(--accent);
}
.fact-dedupe-toggle.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.fact-row__merged-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 11px;
  font-weight: 600;
  vertical-align: middle;
}

.dupe-cluster-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}
.dupe-cluster {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
  background: #fff;
}
.dupe-cluster__head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.dupe-cluster__badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
  margin-top: 2px;
}
.dupe-cluster__statement {
  color: var(--ink);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.45;
}
.dupe-cluster__items {
  list-style: none;
  margin: 0 0 12px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dupe-cluster__item {
  display: grid;
  grid-template-columns: auto auto auto auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--panel-soft);
  font-size: 13px;
  color: var(--text);
}
.dupe-cluster__item.is-canonical {
  background: var(--accent-soft);
  border: 1px solid rgba(234, 88, 12, .25);
}
.dupe-cluster__pick {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
  font-weight: 600;
  color: var(--muted);
}
.dupe-cluster__item.is-canonical .dupe-cluster__pick { color: var(--accent-deep); }
.dupe-cluster__pick input[type="radio"] {
  accent-color: var(--accent);
  cursor: pointer;
}
.dupe-cluster__status {
  font-size: 12px;
  color: var(--muted);
  text-transform: capitalize;
}
.dupe-cluster__source {
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 220px;
}
.dupe-cluster__evidence {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.dupe-cluster__view {
  color: var(--accent-deep);
  font-weight: 600;
  font-size: 12px;
  text-decoration: none;
}
.dupe-cluster__view:hover { color: var(--accent); }
.dupe-cluster__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.dupe-cluster__foot .primary-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 760px) {
  .dupe-cluster__item {
    grid-template-columns: auto 1fr auto;
    grid-row-gap: 4px;
  }
  .dupe-cluster__evidence { grid-column: 1 / -1; white-space: normal; }
}

.loading-state {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 18px 4px;
}
.loading-state-inline {
  padding: 10px 4px;
}
.loading-state-mark {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
}
.loading-state-mark-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(234, 88, 12, .18);
  border-top-color: var(--accent);
  animation: spinSlow .9s linear infinite;
}
.loading-state-mark-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(234, 88, 12, .12);
}
.loading-state-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.loading-state-body h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-strong, #0f172a);
}
.loading-state-body p {
  margin: 0;
  font-size: 13px;
  color: var(--ink-muted, #64748b);
}

/* =========================================================
   Icon Button — square button with hover tooltip
   ========================================================= */
button.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  min-height: 36px;
  padding: 0;
  border: 1px solid var(--btn-secondary-border);
  border-radius: 8px;
  background: var(--btn-secondary-bg);
  color: var(--ink);
  cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease);
}
button.icon-btn:hover {
  background: var(--btn-secondary-bg-hover);
  border-color: #a3a3a3;
  color: var(--ink);
  transform: none;
  box-shadow: none;
}
button.icon-btn:active { transform: scale(.96); }
button.icon-btn:disabled,
button.icon-btn[aria-disabled="true"] {
  opacity: .45;
  cursor: not-allowed;
}

button.icon-btn--sm {
  width: 28px;
  height: 28px;
  min-height: 28px;
  border-radius: 6px;
}

button.icon-btn--ghost {
  background: transparent;
  border-color: transparent;
  color: var(--muted);
}
button.icon-btn--ghost:hover {
  background: var(--btn-secondary-bg);
  border-color: transparent;
  color: var(--ink);
}

button.icon-btn--danger {
  color: var(--ink);
}
button.icon-btn--danger:hover {
  background: #fef2f2;
  border-color: #f4a4a0;
  color: #b91c1c;
}

button.icon-btn--primary {
  background: var(--btn-primary);
  border-color: transparent;
  color: #fff;
}
button.icon-btn--primary:hover {
  background: var(--btn-primary-hover);
  border-color: transparent;
  color: #fff;
}

/* Tooltip via data-tooltip — top by default */
button.icon-btn[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(2px);
  padding: 5px 9px;
  background: var(--ink);
  color: #fff;
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: .01em;
  white-space: nowrap;
  border-radius: 6px;
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s var(--ease), transform .15s var(--ease);
  z-index: 60;
}
button.icon-btn[data-tooltip]::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 3px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--ink);
  pointer-events: none;
  opacity: 0;
  transition: opacity .15s var(--ease);
  z-index: 60;
}
button.icon-btn[data-tooltip]:hover::after,
button.icon-btn[data-tooltip]:focus-visible::after {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
button.icon-btn[data-tooltip]:hover::before,
button.icon-btn[data-tooltip]:focus-visible::before {
  opacity: 1;
}

button.icon-btn--tip-bottom[data-tooltip]::after {
  top: calc(100% + 8px);
  bottom: auto;
  transform: translateX(-50%) translateY(-2px);
}
button.icon-btn--tip-bottom[data-tooltip]::before {
  top: calc(100% + 3px);
  bottom: auto;
  border-top-color: transparent;
  border-bottom-color: var(--ink);
}
button.icon-btn--tip-bottom[data-tooltip]:hover::after,
button.icon-btn--tip-bottom[data-tooltip]:focus-visible::after {
  transform: translateX(-50%) translateY(0);
}

/* Override grid/flex parent constraints */
.title-actions button.icon-btn,
.filter-toolbar button.icon-btn,
.panel-head button.icon-btn,
.search-row button.icon-btn,
.work-row button.icon-btn,
.choice-row button.icon-btn {
  min-height: 36px;
  padding: 0;
  border-radius: 8px;
  font-size: inherit;
  font-weight: inherit;
}

button.icon-btn svg { display: block; }

/* Global upload indicator — floating pill visible while a background upload is running */
.global-upload-indicator {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 10px 12px;
  min-width: 240px;
  max-width: 320px;
  background: var(--ink);
  color: #fff;
  border-radius: 999px;
  box-shadow: 0 12px 30px -8px rgba(28, 24, 38, .45);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease);
}
.global-upload-indicator:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px -8px rgba(28, 24, 38, .55);
}
.global-upload-indicator .spin {
  animation: spinSlow .9s linear infinite;
  color: var(--accent);
  flex-shrink: 0;
}
.global-upload-indicator-text {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.global-upload-indicator-track {
  position: relative;
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, .18);
  border-radius: 999px;
  overflow: hidden;
  min-width: 60px;
}
.global-upload-indicator-fill {
  display: block;
  height: 100%;
  background: var(--accent);
  transition: width .25s var(--ease);
}

/* ============================================================
   Confirm dialog — replaces native window.confirm
   ============================================================ */
.confirm-dialog-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(20, 18, 28, .38);
  backdrop-filter: blur(4px);
  animation: pageIn .18s var(--ease);
}
.confirm-dialog {
  width: min(440px, 100%);
  padding: 24px 24px 20px;
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 24px 48px -12px rgba(20, 18, 28, .32);
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 14px 16px;
  animation: cardIn .22s var(--ease);
}
.confirm-dialog-icon {
  grid-column: 1;
  grid-row: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(234, 88, 12, .12);
  color: var(--accent);
}
.confirm-dialog--danger .confirm-dialog-icon {
  background: rgba(239, 68, 68, .12);
  color: #dc2626;
}
.confirm-dialog-body {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.confirm-dialog-body h3 {
  margin: 0;
  color: var(--ink);
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.005em;
}
.confirm-dialog-message {
  color: var(--text);
  font-size: 14px;
  line-height: 1.65;
}
.confirm-dialog-message p { margin: 0 0 6px; }
.confirm-dialog-message p:last-child { margin-bottom: 0; }
.confirm-dialog-message ul {
  margin: 4px 0 6px;
  padding-left: 18px;
  color: var(--text);
}
.confirm-dialog-message li { margin-bottom: 2px; }
.confirm-dialog-message strong { color: var(--ink); font-weight: 700; }
.confirm-dialog-hint { color: var(--muted); font-size: 13px; }

.confirm-dialog-actions {
  grid-column: 1 / -1;
  grid-row: 2;
  margin-top: 6px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.confirm-dialog-btn {
  min-height: 38px;
  padding: 0 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .18s var(--ease), transform .18s var(--ease), box-shadow .18s var(--ease);
}
.confirm-dialog-btn--ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--btn-secondary-border);
}
.confirm-dialog-btn--ghost:hover {
  color: var(--ink);
  background: var(--panel-soft);
}
.confirm-dialog-btn--primary {
  background: var(--btn-primary);
  color: #fff;
  box-shadow: 0 6px 14px -6px rgba(28, 24, 38, .38);
}
.confirm-dialog-btn--primary:hover {
  background: var(--btn-primary-hover);
  transform: translateY(-1px);
}
.confirm-dialog-btn--danger {
  background: #dc2626;
  color: #fff;
  box-shadow: 0 6px 14px -6px rgba(220, 38, 38, .5);
}
.confirm-dialog-btn--danger:hover {
  background: #b91c1c;
  transform: translateY(-1px);
}

@media (max-width: 480px) {
  .confirm-dialog {
    grid-template-columns: 1fr;
    padding: 20px;
  }
  .confirm-dialog-icon { grid-row: 1; grid-column: 1; }
  .confirm-dialog-body { grid-row: 2; grid-column: 1; }
  .confirm-dialog-actions { grid-row: 3; grid-column: 1; }
}

/* 模型引用链接分析 —— 结果表格：简洁行样式，跟站里 competitor-table 保持一致的视觉重量 */
.link-analysis-panel h3 {
  margin: 0 0 10px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
}
.link-analysis-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 6px;
  font-size: 13.5px;
  color: var(--ink);
}
.link-analysis-table th,
.link-analysis-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.link-analysis-table th {
  background: var(--panel-soft);
  color: #6a645e;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: .02em;
}
.link-analysis-table tbody tr:hover {
  background: rgba(255, 138, 91, .04);
}
.link-analysis-table td a {
  color: var(--accent);
  font-weight: 600;
}

/* Admin outreach media editor */
.admin-media-editor { margin-top: 16px; }

.admin-media-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding: 4px 0 12px;
}
.admin-media-form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}
.admin-media-form label > span { font-weight: 600; color: var(--ink); }
.admin-media-form input,
.admin-media-form select,
.admin-media-form textarea {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--ink);
}
.admin-media-form input:focus,
.admin-media-form select:focus,
.admin-media-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(234, 88, 12, .16);
}
.admin-media-form-full { grid-column: 1 / -1; }

.admin-media-tag-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.admin-media-tag-picker button {
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: all .15s var(--ease);
}
.admin-media-tag-picker button:hover { border-color: var(--accent); color: var(--accent-deep); }
.admin-media-tag-picker button.is-active {
  background: rgba(255, 138, 91, .14);
  border-color: var(--accent);
  color: var(--accent-deep);
  font-weight: 600;
}

.admin-media-tags-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.admin-media-tags-inline span {
  padding: 2px 8px;
  border-radius: 999px;
  background: #f5f5f7;
  color: var(--muted);
  font-size: 11px;
}

.admin-media-row-actions {
  display: flex;
  gap: 6px;
}
.admin-media-row-actions button { padding: 4px 10px; min-height: 28px; font-size: 12px; }

.admin-media-table td { font-size: 13px; padding: 10px 14px; }
.admin-media-table th { padding: 10px 14px; }

/* ============================================================================
   Rule items（写作规则条目化）
   ============================================================================ */
.rule-items-toolbar {
  display: grid;
  grid-template-columns: 160px 160px 160px 1fr;
  gap: 12px;
  align-items: end;
  margin: 16px 0 4px;
}
.rule-items-toolbar label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.rule-items-toolbar input,
.rule-items-toolbar select {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.rule-items-toolbar-search { min-width: 0; }
@media (max-width: 720px) {
  .rule-items-toolbar { grid-template-columns: 1fr 1fr; }
  .rule-items-toolbar-search { grid-column: 1 / -1; }
}

.rule-items-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 12px;
}

.rule-items-group {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-soft);
  padding: 14px 16px 8px;
}
.rule-items-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 8px;
  gap: 12px;
}
.rule-items-group-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 720;
  color: var(--text);
}
.rule-items-group-head h3 small {
  font-weight: 500;
  font-size: 12px;
  color: var(--muted);
  margin-left: 6px;
}
.rule-items-group-head p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.rule-items-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 6px;
}

.rule-item-row {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 12px;
  align-items: start;
  padding: 10px 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: box-shadow .2s var(--ease), border-color .2s var(--ease);
}
.rule-item-row:hover {
  border-color: rgba(234, 88, 12, .35);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
}
.rule-item-row.is-disabled {
  opacity: 0.55;
  background: #fafafa;
}
.rule-item-toggle {
  position: relative;
  width: 28px;
  height: 16px;
  margin-top: 3px;
  cursor: pointer;
}
.rule-item-toggle input {
  position: absolute;
  opacity: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  cursor: pointer;
}
.rule-item-toggle span {
  position: absolute;
  inset: 0;
  background: #d0d0d0;
  border-radius: 999px;
  transition: background .2s var(--ease);
}
.rule-item-toggle span::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #fff;
  transition: transform .2s var(--ease);
}
.rule-item-toggle input:checked + span { background: var(--accent); }
.rule-item-toggle input:checked + span::after { transform: translateX(12px); }

.rule-item-main { min-width: 0; }
.rule-item-text {
  color: var(--text);
  font-weight: 620;
  line-height: 1.45;
  word-break: break-word;
}
.rule-item-note {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
  word-break: break-word;
}
.rule-item-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 8px;
}
.rule-item-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  background: #f0f0f0;
  color: #555;
  line-height: 1.5;
}
.rule-item-chip--writing   { background: #eef4ff; color: #2758d6; }
.rule-item-chip--forbidden { background: #ffece8; color: #b02a19; }
.rule-item-chip--structure { background: #fff2df; color: #a35b00; }
.rule-item-chip--review    { background: #e6f6ea; color: #256b3a; }
.rule-item-chip--brand     { background: #fff; border: 1px solid var(--line); color: var(--text); }
.rule-item-chip--platform  { background: #eaf5ee; color: #256b3a; border: 1px solid #c8e5d1; }
.rule-item-chip--muted     { background: transparent; border: 1px dashed var(--line); color: var(--muted); }
.rule-item-chip--ai        { background: #f2ebff; color: #6b3ecf; }

.rule-item-actions {
  display: flex;
  gap: 4px;
  align-self: center;
}
.rule-item-actions .icon-button,
.icon-button {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: color .2s var(--ease), border-color .2s var(--ease), background .2s var(--ease);
}
.icon-button:hover { color: var(--accent); border-color: var(--accent); }
.icon-button--danger:hover { color: #c62828; border-color: #c62828; }

.rule-item-editor {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--accent);
  border-radius: 12px;
  background: #fff9f4;
  margin: 6px 0;
}
.rule-item-editor-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 720px) {
  .rule-item-editor-row { grid-template-columns: 1fr; }
}
.rule-item-editor-full { grid-column: 1 / -1; }
.rule-item-editor label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.rule-item-editor input,
.rule-item-editor select,
.rule-item-editor textarea {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}
.rule-item-editor-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}
.rule-item-editor-actions {
  display: flex;
  gap: 8px;
}
.rule-item-toggle-inline {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  font-size: 13px;
  color: var(--text);
}

.rule-items-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px;
  margin-top: 12px;
  border: 1px dashed var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-soft);
}
.rule-items-empty h3 { margin: 0 0 4px; font-size: 15px; }
.rule-items-empty p { margin: 0; color: var(--muted); font-size: 13px; }

.rule-suggest-panel { margin-top: 12px; padding: 16px; }
.rule-suggest-head { margin-bottom: 10px; }
.rule-suggest-head h3 { margin: 0 0 4px; font-size: 15px; }
.rule-suggest-head span { color: var(--muted); font-size: 12.5px; }
.rule-suggest-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.rule-suggest-form label {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}
.rule-suggest-form label.wide { grid-column: 1 / -1; }
.rule-suggest-form input,
.rule-suggest-form textarea {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}
.rule-suggest-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}
.rule-suggest-result { margin-top: 12px; display: flex; flex-direction: column; gap: 12px; }
.rule-suggest-group h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--text);
  font-weight: 720;
}
.rule-suggest-pick {
  display: grid;
  grid-template-columns: 20px 1fr;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 4px;
  cursor: pointer;
}
.rule-suggest-pick:hover { border-color: rgba(234, 88, 12, .5); }
.rule-suggest-pick input { margin-top: 3px; }
.rule-suggest-pick small { color: var(--muted); font-size: 12px; display: block; margin-top: 3px; }
@media (max-width: 720px) {
  .rule-suggest-form { grid-template-columns: 1fr; }
}

/* Rule picker inside article generator */
.rule-picker-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-soft);
  padding: 12px 14px;
  margin-top: 8px;
}
.rule-picker-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.rule-picker-head h4 { margin: 0; font-size: 13px; font-weight: 720; color: var(--text); }
.rule-picker-head span { color: var(--muted); font-size: 12px; }
.rule-picker-actions { display: flex; gap: 8px; }
.rule-picker-actions button {
  min-height: 28px;
  padding: 4px 10px;
  font-size: 12px;
}
.rule-picker-groups {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 10px;
}
@media (max-width: 720px) {
  .rule-picker-groups { grid-template-columns: 1fr; }
}
.rule-picker-group h5 {
  margin: 0 0 6px;
  font-size: 12px;
  font-weight: 720;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.rule-picker-row {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  margin-bottom: 4px;
  font-size: 13px;
  cursor: pointer;
}
.rule-picker-row:hover { border-color: rgba(234, 88, 12, .5); }
.rule-picker-row input { margin-top: 3px; }
.rule-picker-row small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.rule-picker-empty {
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 12.5px;
}
.rule-picker-empty a,
.rule-picker-empty a:hover,
.rule-picker-empty a:visited {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

/* =========================================================
   Segmented tab control（顶部 Pipeline / Agent 切换用）
   风格对齐 Linear / Vercel 的分段控件：一体化背景 + 内层高亮
   ========================================================= */
.tab-segmented {
  display: inline-flex;
  padding: 4px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  gap: 2px;
}
.tab-segmented-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--muted);
  background: transparent;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
  white-space: nowrap;
}
.tab-segmented-item:hover { color: var(--ink); }
.tab-segmented-item.is-active {
  background: var(--panel);
  color: var(--ink);
  box-shadow: var(--shadow-xs);
  font-weight: 600;
}
.tab-segmented-item svg { flex: 0 0 auto; }

/* =========================================================
   Editor Agent 面板 —— 沿用 pipeline-card 视觉语言
   ========================================================= */
.agent-panel { display: flex; flex-direction: column; gap: 16px; }

.agent-panel-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
}
.agent-panel-head .accent {
  width: 4px;
  height: 32px;
  border-radius: 999px;
  background: var(--accent);
  flex: 0 0 4px;
}
.agent-panel-head h2 {
  margin: 0;
  font-size: var(--fs-md);
  font-weight: 700;
  color: var(--ink);
}
.agent-panel-head .sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
}
.agent-panel-head-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.agent-panel-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  background: var(--panel-soft);
  border-bottom: 1px solid var(--line);
  font-size: var(--fs-xs);
  color: var(--muted);
  flex-wrap: wrap;
}
.agent-panel-toolbar .dot { color: var(--muted-2); }
.agent-panel-toolbar b { color: var(--ink); font-weight: 600; }

.agent-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .2px;
  border: 1px solid transparent;
}
.agent-status-pill.is-idle     { background: #f5f5f5; color: #525252; border-color: #e5e5e5; }
.agent-status-pill.is-running  { background: var(--accent-soft); color: var(--accent-deep); border-color: rgba(234,88,12,.25); }
.agent-status-pill.is-done     { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.agent-status-pill.is-error    { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.agent-status-pill.is-canceled { background: #f5f5f5; color: #525252; border-color: #d4d4d4; }
.agent-status-pill svg { animation: none; }
.agent-status-pill.is-running svg { animation: spinSlow .9s linear infinite; }

.agent-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  font-weight: 600;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease);
}
.agent-btn:disabled { opacity: .5; cursor: not-allowed; }
.agent-btn.is-primary {
  background: var(--ink);
  color: #fff;
}
.agent-btn.is-primary:hover:not(:disabled) { background: var(--btn-primary-hover); }
.agent-btn.is-danger {
  background: #fff;
  color: #b91c1c;
  border-color: #fecaca;
}
.agent-btn.is-danger:hover:not(:disabled) { background: #fef2f2; }

.agent-timeline {
  padding: 16px 20px;
  max-height: 560px;
  overflow-y: auto;
  background: var(--panel);
}
.agent-timeline-empty {
  padding: 40px 16px;
  text-align: center;
  color: var(--muted);
  font-size: var(--fs-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.agent-trace-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.agent-trace {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.agent-trace:hover { border-color: var(--line-strong); }
.agent-trace.is-error { border-color: #fecaca; background: #fef2f2; }

.agent-trace-summary {
  display: grid;
  grid-template-columns: 36px 1fr 20px;
  gap: 12px;
  padding: 12px 14px;
  cursor: pointer;
  border: none;
  background: transparent;
  text-align: left;
  width: 100%;
  align-items: start;
}
.agent-trace-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--icon-bg);
  color: var(--icon-ink);
  flex: 0 0 32px;
}
.agent-trace.is-error .agent-trace-icon { background: #fee2e2; color: #b91c1c; }
.agent-trace-icon.is-facts     { background: var(--accent-soft); color: var(--accent-deep); }
.agent-trace-icon.is-search    { background: #eff6ff; color: #1d4ed8; }
.agent-trace-icon.is-fetch     { background: #ecfeff; color: #0e7490; }
.agent-trace-icon.is-competitor{ background: #fdf4ff; color: #a21caf; }
.agent-trace-icon.is-draft     { background: var(--accent-soft); color: var(--accent-deep); }
.agent-trace-icon.is-critique  { background: #fef3c7; color: #b45309; }
.agent-trace-icon.is-finalize  { background: #ecfdf5; color: #047857; }

.agent-trace-body { min-width: 0; }
.agent-trace-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 2px;
}
.agent-trace-meta .step-no { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted-2); }
.agent-trace-meta .label { color: var(--ink); font-weight: 600; font-size: var(--fs-sm); }
.agent-trace-meta .tool-tag {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10.5px;
  color: var(--muted);
}
.agent-trace-meta .dot { color: var(--muted-2); }
.agent-trace-meta .err { color: #b91c1c; font-weight: 600; }
.agent-trace-thought {
  font-size: var(--fs-sm);
  color: var(--text);
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.agent-trace-caret {
  color: var(--muted-2);
  padding-top: 6px;
}

.agent-trace-detail {
  padding: 12px 14px 14px 62px;
  border-top: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 12px;
}
.agent-trace-section h5 {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}
.agent-trace-section p { margin: 0; color: var(--text); line-height: 1.55; white-space: pre-wrap; }
.agent-trace-section pre {
  margin: 0;
  max-height: 200px;
  overflow: auto;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.agent-trace-section.is-raw pre { background: #fef2f2; color: #991b1b; border-color: #fecaca; }

.agent-error-card {
  padding: 12px 16px;
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: #991b1b;
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  margin: 0 20px 20px;
}

.agent-article-card {
  margin: 0 20px 20px;
  border: 1px solid #a7f3d0;
  background: #ecfdf5;
  border-radius: var(--radius-lg);
  padding: 16px 18px;
}
.agent-article-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  color: #047857;
  font-size: var(--fs-sm);
  margin-bottom: 8px;
}
.agent-article-summary {
  margin: 0 0 12px;
  font-size: var(--fs-sm);
  color: var(--text);
  line-height: 1.6;
}
.agent-article-body {
  max-height: 600px;
  overflow-y: auto;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: #fff;
  border: 1px solid var(--line);
}

@keyframes spinSlow { to { transform: rotate(360deg); } }

.site-icp {
  margin-top: 48px;
  padding: 16px 0;
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}
.site-icp a {
  color: inherit;
  text-decoration: none;
}
.site-icp a:hover {
  color: var(--text);
}
