:root {
  --primary: #2f6bff;
  --primary-hover: #1f55df;
  --primary-soft: #edf3ff;
  --primary-border: #a9c4ff;
  --bg: #f2f3f5;
  --sidebar: #ffffff;
  --panel: #ffffff;
  --text: #111827;
  --muted: #7a8494;
  --line: #e5e7eb;
  --line-dark: #d9dee8;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --cyan: #12b8f6;
  --purple: #7c3aed;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  --sidebar-width: 208px;
  --topbar-height: 48px;
  --tabs-height: 49px;
  --radius: 6px;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  min-width: 1024px;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.admin-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  height: 100vh;
  overflow: hidden;
}

.sidebar {
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line-dark);
  background: var(--sidebar);
}

.brand {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line-dark);
  color: var(--primary);
  font-size: 18px;
  font-weight: 600;
}

.brand-logo {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  clip-path: polygon(18% 0, 92% 0, 60% 42%, 88% 42%, 24% 100%, 39% 56%, 12% 56%);
  background: linear-gradient(135deg, #2f6bff, #8b5cf6 50%, #facc15);
}

.sidebar-nav {
  flex: 1;
  overflow: auto;
  padding: 12px 4px;
}

.sidebar-nav::-webkit-scrollbar,
.main-scroll::-webkit-scrollbar,
.table-wrap::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.sidebar-nav::-webkit-scrollbar-thumb,
.main-scroll::-webkit-scrollbar-thumb,
.table-wrap::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: #d1d5db;
}

.nav-section {
  margin-bottom: 4px;
}

.nav-item {
  width: 100%;
  height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 22px;
  border: 0;
  border-radius: var(--radius);
  background: transparent;
  color: #1f2937;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: var(--primary-soft);
  color: var(--primary);
}

.nav-item.sub {
  padding-left: 50px;
}

.nav-icon {
  width: 16px;
  display: inline-grid;
  place-items: center;
  font-size: 15px;
}

.nav-arrow {
  margin-left: auto;
  color: var(--muted);
}

.content-shell {
  min-width: 0;
  height: 100vh;
  display: grid;
  grid-template-rows: var(--topbar-height) var(--tabs-height) 1fr 28px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px 0 22px;
  border-bottom: 1px solid var(--line-dark);
  background: #fff;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #6b7280;
}

.hamburger {
  font-size: 18px;
  color: #111827;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #111827;
}

.top-select {
  width: 190px;
  min-height: 30px;
  padding: 4px 28px 4px 9px;
  border-color: #d9dee8;
  background-color: #fff;
}

.project-select {
  width: 220px;
}

.avatar {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  background: #dbeafe;
  color: var(--primary);
  font-size: 12px;
}

.tabbar {
  display: flex;
  align-items: stretch;
  gap: 4px;
  overflow: hidden;
  border-bottom: 1px solid var(--line-dark);
  background: #fff;
  box-shadow: 0 2px 7px rgba(15, 23, 42, 0.04);
}

.tab {
  min-width: 96px;
  height: var(--tabs-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 18px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: #fff;
  color: #111827;
}

.tab.active {
  background: var(--primary-soft);
  border-bottom-color: var(--primary);
  color: var(--primary);
}

.tab-close {
  color: #6b7280;
}

.main-scroll {
  min-height: 0;
  overflow: auto;
  padding: 14px 16px 0;
  background: var(--bg);
}

.footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  color: #6b7280;
  font-size: 12px;
  background: var(--bg);
}

.page {
  display: grid;
  gap: 14px;
}

.context-strip {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: #fff;
}

.context-strip div:first-child {
  display: grid;
  gap: 4px;
}

.context-strip span,
.muted,
small {
  color: var(--muted);
}

.strip-actions,
.editor-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel {
  border-radius: var(--radius);
  background: var(--panel);
  overflow: hidden;
}

.panel-head {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
}

.panel-head h2 {
  margin: 0;
  font-size: 16px;
}

.panel-body {
  padding: 16px 24px;
}

.filter-bar {
  min-height: 58px;
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr)) auto;
  gap: 16px;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--radius);
  background: #fff;
}

.filter-item {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 10px;
}

.filter-item span {
  white-space: nowrap;
}

.filter-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.input,
.select,
input,
select,
textarea {
  width: 100%;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #dcdfe6;
  border-radius: 5px;
  background: #fff;
  color: var(--text);
  outline: 0;
}

textarea {
  min-height: 88px;
  resize: vertical;
}

.input:focus,
.select:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(47, 107, 255, 0.12);
}

.btn {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 14px;
  border: 1px solid #dcdfe6;
  border-radius: 5px;
  background: #fff;
  color: #1f2937;
  white-space: nowrap;
}

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

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

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

.btn.text {
  min-height: 24px;
  padding: 0 4px;
  border: 0;
  background: transparent;
  color: var(--primary);
}

.btn.icon {
  width: 32px;
  padding: 0;
}

.table-panel {
  min-height: 696px;
  display: grid;
  grid-template-rows: auto 1fr auto;
  border-radius: var(--radius);
  background: #fff;
}

.table-panel.dense th,
.table-panel.dense td {
  height: 32px;
  padding: 0 7px;
}

.table-toolbar {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-wrap {
  overflow: auto;
  padding: 0 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  height: 40px;
  padding: 0 9px;
  border-bottom: 1px solid #ebeef5;
  text-align: left;
  vertical-align: middle;
}

th {
  background: #fafafa;
  color: #111827;
  font-weight: 600;
}

td {
  color: #111827;
}

tr:hover td {
  background: #f8fbff;
}

.link {
  color: var(--primary);
  text-decoration: none;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 7px;
  border: 1px solid var(--primary-border);
  border-radius: 4px;
  background: #edf5ff;
  color: var(--primary);
  font-size: 12px;
}

.badge.success {
  border-color: #86efac;
  background: #f0fdf4;
  color: #16a34a;
}

.badge.warning {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #d97706;
}

.badge.danger {
  border-color: #fca5a5;
  background: #fef2f2;
  color: #dc2626;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 56px;
  height: 22px;
  padding: 0 4px 0 8px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
}

.status-pill::after {
  content: "";
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
}

.pagination {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 0 16px;
}

.page-btn {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 6px;
  background: #eef0f4;
  color: #9ca3af;
}

.page-btn.active {
  background: var(--primary);
  color: #fff;
}

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

.metric-card {
  height: 118px;
  display: grid;
  grid-template-columns: 1fr 190px;
  gap: 10px;
  padding: 18px;
  overflow: hidden;
  border-radius: 4px;
}

.metric-card.blue {
  background: #eef8ff;
}

.metric-card.green {
  background: #f0fff1;
}

.metric-card.purple {
  background: #f5f2ff;
}

.metric-card.red {
  background: #fff1f2;
}

.metric-label {
  color: #6b7280;
  font-size: 16px;
  font-weight: 600;
}

.metric-value {
  margin: 14px 0 4px;
  font-size: 24px;
}

.metric-sub {
  color: #6b7280;
  font-size: 12px;
}

.metric-sub em {
  color: #ff4d4f;
  font-style: normal;
}

.spark {
  align-self: center;
  width: 180px;
  height: 70px;
}

.chart-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 14px;
}

.chart-area {
  height: 335px;
  padding: 24px 34px;
  position: relative;
}

.bar-chart {
  height: 250px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  align-items: end;
  gap: 28px;
  border-bottom: 1px solid #b8c1d1;
  background:
    linear-gradient(to top, #dfe4ec 1px, transparent 1px) 0 0 / 100% 25%;
}

.bar-stack {
  height: var(--h);
  min-height: 44px;
  display: grid;
  align-items: end;
  grid-template-rows: var(--a) var(--b) var(--c);
}

.bar-stack span:nth-child(1) {
  background: #2f6bff;
}

.bar-stack span:nth-child(2) {
  background: #0ea5e9;
}

.bar-stack span:nth-child(3) {
  background: #75d8f2;
}

.legend {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 12px;
  color: #6b7280;
}

.dot {
  width: 12px;
  height: 12px;
  display: inline-block;
  border-radius: 50%;
  margin-right: 6px;
  background: var(--primary);
}

.dot.cyan {
  background: #0ea5e9;
}

.dot.sky {
  background: #75d8f2;
}

.tree-table-layout {
  display: grid;
  grid-template-columns: 274px 1fr;
  gap: 8px;
}

.tree-panel {
  min-height: 708px;
  padding: 8px;
  border-radius: var(--radius);
  background: #fff;
}

.tree-search {
  display: flex;
}

.tree-search input {
  border-top-right-radius: 0;
  border-bottom-right-radius: 0;
}

.tree-search button {
  width: 34px;
  border: 1px solid #dcdfe6;
  border-left: 0;
  border-radius: 0 5px 5px 0;
  background: #fff;
}

.tree-node {
  height: 28px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #111827;
}

.tree-node.selected,
.tree-node.active-tree {
  color: var(--primary);
  font-weight: 600;
}

.tree-divider {
  margin: 14px 0 6px;
  color: var(--muted);
  font-size: 12px;
}

.tree-node::before {
  content: "▶";
  font-size: 10px;
}

.toolbar-title {
  min-width: 130px;
  color: #111827;
}

.health-wrap {
  min-width: 94px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.health-wrap strong {
  min-width: 24px;
  font-size: 12px;
}

.health-bar,
.score-bar {
  width: 72px;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f5;
}

.health-bar span,
.score-bar i {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--primary);
}

.health-bar.success span,
.score-bar.success i {
  background: var(--success);
}

.health-bar.warning span,
.score-bar.warning i {
  background: var(--warning);
}

.health-bar.danger span,
.score-bar.danger i {
  background: var(--danger);
}

/* 内容池「生成中 / 生成失败」占位记录：状态列下方补一条队列进度或失败原因 */
.gen-progress {
  margin-top: 5px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 110px;
}

.gen-progress-bar {
  width: 100%;
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f5;
}

.gen-progress-bar span {
  height: 100%;
  display: block;
  border-radius: inherit;
  background: var(--primary);
  transition: width 0.3s ease;
}

.gen-progress small {
  color: #6b7280;
  font-size: 11px;
  line-height: 1.4;
}

.gen-progress small.gen-error {
  color: var(--danger);
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 180px;
}

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

.status-card,
.connector-card,
.insight-card,
.wizard-step {
  display: grid;
  gap: 9px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.status-card div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.status-card div span,
.connector-card span {
  color: var(--muted);
  font-size: 12px;
}

.task-list,
.insight-list,
.compliance-stack {
  display: grid;
  gap: 10px;
}

.task-item,
.insight-line {
  display: grid;
  gap: 4px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.task-item:last-child,
.insight-line:last-child {
  border-bottom: 0;
}

.factory-grid {
  display: grid;
  grid-template-columns: 280px minmax(360px, 1fr) 300px;
  gap: 14px;
}

.stacked-form,
.stacked-form label {
  display: grid;
  gap: 10px;
}

.editor-text {
  min-height: 260px;
  margin-top: 12px;
  line-height: 1.7;
}

.phone-preview {
  min-height: 190px;
  display: grid;
  align-content: end;
  gap: 10px;
  padding: 16px;
  margin-bottom: 16px;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  background: linear-gradient(180deg, #f8fbff 0%, #eef7ff 100%);
}

.phone-preview p {
  margin: 0;
  font-weight: 600;
  line-height: 1.6;
}

.score-row {
  display: grid;
  grid-template-columns: 76px 1fr 34px;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.score-bar {
  width: 100%;
  height: 8px;
}

.compliance-note,
.compliance-banner {
  padding: 10px 12px;
  border: 1px solid #fed7aa;
  border-radius: var(--radius);
  background: #fff7ed;
  color: #9a3412;
  line-height: 1.6;
}

.calendar-tabs {
  display: inline-flex;
  border: 1px solid var(--line-dark);
  border-radius: var(--radius);
  overflow: hidden;
}

.calendar-tabs button {
  min-width: 48px;
  height: 30px;
  border: 0;
  border-right: 1px solid var(--line-dark);
  background: #fff;
}

.calendar-tabs button:last-child {
  border-right: 0;
}

.calendar-tabs button.active {
  background: var(--primary);
  color: #fff;
}

.status-legend {
  flex-wrap: wrap;
  justify-content: flex-start;
  margin-bottom: 12px;
}

.calendar-board {
  display: grid;
  grid-template-columns: repeat(7, minmax(128px, 1fr));
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.calendar-board.list-mode {
  grid-template-columns: 1fr;
}

.calendar-board.list-mode .calendar-day {
  min-height: 86px;
}

.calendar-day {
  min-height: 138px;
  display: grid;
  align-content: start;
  gap: 7px;
  padding: 10px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.calendar-day.has-risk {
  background: #fff7f7;
}

.calendar-day em {
  color: #c0c4cc;
  font-style: normal;
  font-size: 12px;
}

.calendar-task {
  display: grid;
  gap: 3px;
  padding: 7px;
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  background: #f6f9ff;
  font-size: 12px;
}

.calendar-task.success {
  border-left-color: var(--success);
  background: #f0fdf4;
}

.calendar-task.warning {
  border-left-color: var(--warning);
  background: #fffbeb;
}

.calendar-task.danger {
  border-left-color: var(--danger);
  background: #fef2f2;
}

.calendar-task small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wizard-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
}

.wizard-step span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.compliance-banner {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
}

.inspiration-grid,
.optimization-grid,
.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.settings-grid {
  grid-template-columns: 2fr 1fr;
}

.insight-card p {
  margin: 0;
  color: #1f2937;
  line-height: 1.6;
}

.card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: start;
}

.insight-card dl {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 8px;
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
}

.insight-card dt {
  color: var(--muted);
}

.insight-card dd {
  margin: 0;
}

.connector-card {
  align-content: start;
}

.ai-config-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.ai-config-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.ai-config-card dl {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 7px 10px;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.ai-config-card dt {
  color: var(--muted);
}

.ai-config-card dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

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

.workflow-step {
  min-height: 82px;
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 6px 10px;
  padding: 14px;
  border-radius: var(--radius);
  background: #fff;
}

.workflow-step span {
  grid-row: span 2;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

.workflow-step strong,
.workflow-step small {
  min-width: 0;
}

.seo-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 14px;
}

.site-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.site-list-page {
  max-width: 100%;
}

.site-overview-panel {
  min-width: 0;
}

.site-list-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 160px 180px;
  gap: 10px;
  padding: 14px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.site-list-toolbar label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.site-list-toolbar input,
.site-list-toolbar select {
  width: 100%;
  min-height: 36px;
}

.site-list-table {
  overflow-x: auto;
}

.site-list-header,
.site-list-row {
  display: grid;
  grid-template-columns: minmax(250px, 1.8fr) minmax(120px, 1fr) 72px 72px 90px minmax(150px, 1fr) minmax(130px, 0.9fr) 150px;
  align-items: center;
  min-width: 1120px;
  gap: 12px;
  padding: 12px 14px;
}

.site-list-header {
  color: var(--muted);
  font-size: 12px;
  background: #f8fafc;
}

.site-list-row {
  border-top: 1px solid var(--line);
  background: #fff;
}

.site-list-row:hover,
.site-list-row.active {
  background: var(--primary-soft);
}

.site-list-main {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-width: 0;
  padding: 0;
  color: var(--text);
  text-align: left;
}

.site-list-main > span:last-child,
.site-list-cell {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.site-list-main strong,
.site-list-main small,
.site-list-cell strong,
.site-list-cell small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-list-main small,
.site-list-cell small {
  color: var(--muted);
  font-size: 12px;
}

.site-list-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.site-list-panel {
  position: sticky;
  top: 14px;
}

.site-switcher-list {
  display: grid;
  gap: 8px;
}

.site-switcher {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-width: 0;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: #f8fafc;
  color: var(--text);
  text-align: left;
}

.site-switcher:hover,
.site-switcher.active {
  border-color: var(--primary-border);
  background: var(--primary-soft);
}

.site-switcher-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  font-weight: 800;
}

.site-switcher-copy,
.site-switcher-copy strong,
.site-switcher-copy small {
  min-width: 0;
}

.site-switcher-copy {
  display: grid;
  gap: 3px;
}

.site-switcher-copy strong,
.site-switcher-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-switcher-copy small {
  color: var(--muted);
  font-size: 12px;
}

.site-detail {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.site-detail-page {
  max-width: 1440px;
  margin: 0 auto;
}

.site-detail-context {
  max-width: 1440px;
  margin: 0 auto 14px;
}

.site-detail-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px;
}

.site-detail-head h1 {
  margin: 3px 0 5px;
  font-size: 24px;
}

.site-detail-head p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.site-kpi-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.site-kpi-strip > div {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.site-kpi-strip span,
.site-kpi-strip small {
  color: var(--muted);
  font-size: 12px;
}

.site-kpi-strip strong {
  font-size: 20px;
}

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

.site-config-card {
  min-width: 0;
}

.site-config-card .panel-body {
  display: grid;
  gap: 12px;
}

.site-detail-dl {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 7px 10px;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.site-detail-dl dt {
  color: var(--muted);
}

.site-detail-dl dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.compact-keyword-grid {
  max-height: 190px;
  overflow: auto;
}

.site-content-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
}

.site-content-row:last-child {
  border-bottom: 0;
}

.site-content-row > div:first-child {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.site-content-row strong,
.site-content-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.site-content-row small {
  color: var(--muted);
  font-size: 12px;
}

.site-task-summary {
  padding: 10px 12px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 13px;
}

.site-review-panel .panel-body {
  display: grid;
  gap: 0;
}

.seo-card-list,
.content-review-grid,
.mini-list {
  display: grid;
  gap: 12px;
}

.seo-card,
.content-review-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.seo-card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.seo-card-head strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.seo-card dl {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 7px 10px;
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
}

.seo-card dt {
  color: var(--muted);
}

.seo-card dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.modal-intro {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  color: #374151;
  line-height: 1.55;
}

.review-preview dl {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 6px 12px;
  margin: 0 0 14px;
}

.review-preview dt {
  color: var(--muted);
}

.review-preview dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.review-preview-list {
  display: grid;
  gap: 10px;
}

.review-preview-list article {
  padding: 10px 12px;
  border-left: 3px solid var(--primary);
  background: #fff;
}

.review-preview-list article strong,
.review-preview-list article small {
  display: block;
}

.review-preview-list article small {
  margin-top: 3px;
  color: var(--muted);
}

.review-preview-list article p {
  margin: 7px 0 0;
  color: #4b5563;
  line-height: 1.6;
}

.seo-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.profile-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  border-top: 1px solid var(--line);
}

.profile-pill {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafc;
  text-align: left;
}

.profile-pill:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.profile-pill span {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.research-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.keyword-grid {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.keyword-chip {
  display: grid;
  gap: 5px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
}

.keyword-chip.selected {
  border-color: var(--primary-border);
  background: var(--primary-soft);
}

.keyword-chip span,
.keyword-chip small,
.mini-metrics,
.mini-row small {
  color: var(--muted);
  font-size: 12px;
}

.content-review-card p {
  min-height: 48px;
  margin: 0;
  color: #374151;
  line-height: 1.6;
}

.mini-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.mini-row {
  display: grid;
  grid-template-columns: auto minmax(160px, 1fr) minmax(120px, 0.8fr) auto;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.mini-row:last-child {
  border-bottom: 0;
}

.scenario-row {
  grid-template-columns: auto minmax(0, 1fr) minmax(120px, 0.8fr) auto;
}

.mini-row strong,
.mini-row small {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-note {
  padding: 14px;
  border: 1px dashed var(--line-dark);
  border-radius: var(--radius);
  background: #fafafa;
  color: var(--muted);
  line-height: 1.6;
}

dialog,
.app-modal {
  width: min(var(--modal-width, 720px), calc(100vw - 48px));
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 12px 34px rgba(15, 23, 42, 0.24);
}

dialog::backdrop,
.modal-mask {
  background: rgba(0, 0, 0, 0.42);
}

.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.14s ease;
}

.modal-mask.show {
  opacity: 1;
}

.app-modal {
  transform: translateY(-6px) scale(0.985);
  transition: transform 0.14s ease;
}

.modal-mask.show .app-modal {
  transform: translateY(0) scale(1);
}

.app-modal.expanded {
  width: min(980px, calc(100vw - 48px));
}

dialog.expanded {
  width: min(980px, calc(100vw - 48px));
}

.dialog-body,
.modal-form {
  display: grid;
  grid-template-columns: 1fr;
  background: #fff;
}

.dialog-head,
.modal-head {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  border-bottom: 1px solid var(--line);
}

.dialog-head {
  grid-column: 1 / -1;
}

.dialog-head h2,
.modal-head h2 {
  margin: 0;
  color: #111827;
  font-size: 16px;
  font-weight: 700;
}

.dialog-tools,
.modal-tools {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #8b95a5;
}

.modal-tool {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: #8b95a5;
  font-size: 18px;
  line-height: 1;
}

.modal-tool:hover {
  color: var(--primary);
}

.modal-tool:focus {
  outline: 0;
}

.dialog-tools .btn.text:focus {
  outline: 0;
  box-shadow: none;
}

.dialog-body {
  grid-template-columns: 1fr 1fr;
  gap: 22px 28px;
  padding: 0;
}

.dialog-body > .dialog-field,
.dialog-body > .radio-row {
  margin: 0 28px;
}

.dialog-body > .dialog-field:nth-of-type(1),
.dialog-body > .dialog-field:nth-of-type(2) {
  margin-top: 24px;
}

.modal-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 28px;
  max-height: min(62vh, 560px);
  overflow: auto;
  padding: 24px 28px 28px;
}

.modal-body.modal-content-only {
  display: block;
  max-height: min(76vh, 760px);
  padding: 20px 24px 24px;
  background: #f8fafc;
}

.content-preview-page {
  display: grid;
  gap: 12px;
  max-width: 860px;
  margin: 0 auto;
}

.content-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.content-preview-meta span {
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.dialog-field,
.modal-field {
  display: grid;
  grid-template-columns: 110px 1fr;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.dialog-field > span,
.modal-field > span {
  justify-self: end;
  white-space: nowrap;
}

.dialog-field.wide,
.modal-field.wide {
  grid-column: 1 / -1;
}

.modal-error {
  grid-column: 2;
  min-height: 16px;
  color: #f56c6c;
  font-size: 12px;
  line-height: 1.2;
}

[aria-invalid="true"] {
  border-color: #f56c6c !important;
}

.required {
  color: #f56c6c;
  font-style: normal;
}

.radio-row,
.modal-radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  align-items: center;
}

.modal-check,
.modal-check-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  align-items: center;
}

.modal-check-grid {
  padding: 8px 10px;
  border: 1px solid #dcdfe6;
  border-radius: 5px;
  background: #fff;
}

.modal-check label,
.modal-check-grid label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 24px;
}

.modal-check input,
.modal-check-grid input {
  width: 14px;
  min-height: 14px;
  accent-color: var(--primary);
  box-shadow: none;
}

.modal-radio-row label,
.radio-row label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.modal-radio-row input,
.radio-row input {
  width: 14px;
  min-height: 14px;
  accent-color: var(--primary);
  box-shadow: none;
}

.radio-dot {
  width: 14px;
  height: 14px;
  display: inline-block;
  border: 1px solid #d4d9e2;
  border-radius: 50%;
  vertical-align: -2px;
  margin-right: 6px;
}

.radio-dot.active {
  border: 4px solid var(--primary);
}

.modal-code {
  grid-column: 1 / -1;
  max-height: 420px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8fafc;
  color: #111827;
  font-family: Consolas, "Courier New", monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.dialog-actions,
.modal-actions {
  min-height: 56px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.dialog-actions {
  grid-column: 1 / -1;
  margin-top: 6px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 38px;
  z-index: 40;
  padding: 10px 14px;
  border-radius: 6px;
  background: #1f2937;
  color: #fff;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.feedback-mask {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s ease;
}

.feedback-mask.show {
  opacity: 1;
  pointer-events: auto;
}

.feedback-card {
  width: min(520px, calc(100vw - 40px));
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  padding: 18px;
  border: 1px solid #bbf7d0;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.26);
  transform: translateY(8px) scale(0.98);
  transition: transform 0.14s ease;
}

.feedback-mask.show .feedback-card {
  transform: translateY(0) scale(1);
}

.feedback-card.danger {
  border-color: #fecaca;
}

.feedback-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #dcfce7;
  color: #16a34a;
  font-size: 24px;
  font-weight: 800;
}

.feedback-card.danger .feedback-icon {
  background: #fee2e2;
  color: #dc2626;
}

.feedback-content {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.feedback-content strong {
  color: #111827;
  font-size: 17px;
}

.feedback-content p {
  margin: 0;
  color: #4b5563;
  line-height: 1.6;
}

.feedback-actions {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding-top: 4px;
}

.muted {
  color: var(--muted);
}

.knowledge-inline {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #f8fbff;
  border-radius: 8px;
}

.knowledge-inline div {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.knowledge-inline span {
  padding: 5px 8px;
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
  font-size: 12px;
}

.knowledge-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
}

.knowledge-hero strong {
  display: block;
  font-size: 20px;
  margin-bottom: 6px;
}

.knowledge-hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.7;
}

.line-clamp {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  max-width: 560px;
  color: var(--muted);
}

.article-preview {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  padding: 18px;
  line-height: 1.8;
  max-height: 520px;
  overflow: auto;
}

.article-preview header {
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  padding-bottom: 10px;
}

.article-preview header p {
  color: var(--muted);
  margin: 0 0 4px;
}

.article-preview h1,
.article-preview h2,
.article-preview h3 {
  margin: 12px 0 8px;
  line-height: 1.35;
}

.article-preview h1 {
  font-size: 24px;
}

.article-preview h2 {
  font-size: 18px;
}

.article-preview h3 {
  font-size: 15px;
}

.article-preview p,
.article-preview li {
  color: #273142;
}

.article-preview.empty {
  color: var(--muted);
  text-align: center;
}

.video-preview {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.video-frame {
  aspect-ratio: 9 / 16;
  border-radius: 8px;
  background: linear-gradient(145deg, #111827, #344256);
  color: #fff;
  padding: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.video-frame span {
  opacity: 0.75;
  font-size: 12px;
}

.video-frame strong {
  line-height: 1.35;
}

.shot-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
  max-height: 520px;
  overflow: auto;
}

.image-preview {
  display: grid;
  gap: 14px;
}

.image-canvas {
  aspect-ratio: 4 / 3;
  border-radius: 8px;
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(19, 97, 255, 0.18), rgba(36, 182, 134, 0.16)),
    repeating-linear-gradient(45deg, #f5f7fb, #f5f7fb 10px, #edf1f7 10px, #edf1f7 20px);
  display: grid;
  place-items: center;
  color: #1f2a44;
  font-weight: 700;
}

.danger-text {
  color: #b42318;
}

select[multiple] {
  min-height: 104px;
}

@media (max-width: 1280px) {
  body {
    min-width: 1024px;
  }

  .dashboard-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }

  .workflow-steps,
  .seo-grid,
  .ai-config-grid,
  .profile-strip {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 900px) {
  body {
    min-width: 0;
    overflow: auto;
  }

  .admin-shell {
    grid-template-columns: 72px 1fr;
  }

  .brand {
    justify-content: center;
    padding: 0;
  }

  .brand span,
  .nav-item span:not(.nav-icon),
  .nav-arrow {
    display: none;
  }

  .nav-item,
  .nav-item.sub {
    justify-content: center;
    padding: 0;
  }

  .content-shell {
    min-width: 0;
  }

  .filter-bar {
    grid-template-columns: 1fr;
  }

  .dashboard-cards,
  .chart-grid,
  .tree-table-layout,
  .site-workspace,
  .site-config-grid {
    grid-template-columns: 1fr;
  }

  .site-list-toolbar {
    grid-template-columns: 1fr;
  }

  .site-list-panel {
    position: static;
  }

  .site-detail-head {
    align-items: start;
    flex-direction: column;
  }

  .site-kpi-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tree-panel {
    min-height: auto;
  }
}
