/*
  营销统计开发辅助样式：为评审和开发提供 PRD 侧栏、分组说明和线上批注入口。
*/

.dev-toolbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 6px 20px;
  background: linear-gradient(90deg, #1e293b 0%, #334155 100%);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 600;
  border-bottom: 1px solid #475569;
}

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

.dev-toolbar-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 12px;
  font-weight: 600;
}

.dev-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  height: 30px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  color: #e2e8f0;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.dev-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.25);
}

.dev-btn.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.prd-sidebar {
  position: fixed;
  top: 42px;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: 28%;
  min-width: 340px;
  max-width: 460px;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -4px 0 24px rgba(35, 49, 77, 0.08);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}

.prd-sidebar.open {
  transform: translateX(0);
}

body.prd-open .page-shell {
  margin-right: min(28%, 460px);
  transition: margin-right 0.25s ease;
}

.prd-sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  background: #f8fafc;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.prd-sidebar-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 15px;
}

.prd-sidebar-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  transition: all 0.15s;
}

.prd-sidebar-close:hover {
  background: #f1f5f9;
  color: #d14343;
}

.prd-tabs {
  display: flex;
  gap: 2px;
  padding: 8px 12px;
  background: #f1f5f9;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.prd-tab {
  flex: 1;
  min-width: 0;
  padding: 6px 2px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s;
}

.prd-tab:hover {
  background: rgba(0, 0, 0, 0.03);
  color: var(--text);
}

.prd-tab.active {
  background: #fff;
  color: var(--brand);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.prd-sidebar-status {
  display: none;
  padding: 7px 14px;
  border-bottom: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #64748b;
  font-size: 12px;
  line-height: 1.5;
}

.prd-sidebar-status.is-visible {
  display: block;
}

.prd-sidebar-status.is-error {
  background: #fff7ed;
  color: #9a3412;
}

.prd-sidebar-body {
  flex: 1;
  overflow-y: auto;
}

.prd-section {
  border-bottom: 1px solid #eef2f7;
}

.prd-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 16px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}

.prd-section-header:hover {
  background: #f8fafc;
}

.prd-section-header h4 {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  color: var(--text);
  font-size: 14px;
}

.prd-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  font-size: 13px;
  flex-shrink: 0;
}

.prd-icon-req {
  background: #eef6ff;
  color: var(--brand);
}

.prd-icon-field {
  background: #f0fbf5;
  color: #15803d;
}

.prd-icon-rule {
  background: var(--accent-soft);
  color: #b76d00;
}

.prd-icon-err {
  background: #fff1f2;
  color: #d14343;
}

.prd-chevron {
  color: var(--muted);
  font-size: 12px;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.prd-section.open .prd-chevron {
  transform: rotate(90deg);
}

.prd-section-body {
  display: none;
  padding: 0 16px 14px;
}

.prd-section.open .prd-section-body {
  display: block;
}

.prd-content {
  color: #475569;
  font-size: 12.5px;
  line-height: 1.7;
}

.prd-content h5 {
  margin: 10px 0 4px;
  color: var(--text);
  font-size: 13px;
}

.prd-content p {
  margin: 4px 0;
}

.prd-content ul,
.prd-content ol {
  margin: 4px 0;
  padding-left: 18px;
}

.prd-content li {
  margin: 2px 0;
}

.prd-content table {
  width: 100%;
  min-width: 0;
  margin: 6px 0;
  border-collapse: collapse;
  font-size: 12px;
}

.prd-content th,
.prd-content td {
  height: auto;
  padding: 5px 8px;
  border: 1px solid #e2e8f0;
  text-align: left;
  white-space: normal;
}

.prd-content th {
  background: #f8fafc;
  color: #475569;
  font-weight: 700;
}

.prd-content code {
  padding: 1px 5px;
  border-radius: 4px;
  background: #f1f5f9;
  color: #be123c;
  font-size: 11.5px;
}

.prd-annotation-area {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
}

.prd-annotation-toggle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-size: 12px;
  cursor: pointer;
}

.prd-annotation-toggle:hover {
  text-decoration: underline;
}

.prd-annotation-box {
  display: none;
  margin-top: 6px;
}

.prd-annotation-box.open {
  display: block;
}

.prd-annotation-input {
  width: 100%;
  min-height: 60px;
  padding: 8px;
  border: 1px solid #d8e0ea;
  border-radius: 8px;
  background: #fffde7;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1.5;
  resize: vertical;
}

.prd-annotation-input:focus {
  outline: 0;
  border-color: var(--brand);
}

.prd-annotation-actions {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.prd-annotation-actions .btn {
  min-width: 60px;
  height: 28px;
  font-size: 12px;
}

.prd-annotation-saved {
  margin-top: 6px;
  padding: 6px 8px;
  border-left: 3px solid #f59e0b;
  border-radius: 6px;
  background: #fffde7;
  color: #78350f;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .prd-sidebar {
    width: 86%;
    min-width: 280px;
    max-width: none;
  }

  body.prd-open .page-shell {
    margin-right: 0;
  }
}
