:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #f0eee9;
  --line: #d8d4ca;
  --text: #20232a;
  --muted: #6e716f;
  --blue: #2f6f88;
  --green: #2f6d56;
  --amber: #a66f21;
  --red: #a84242;
  --ink: #17191f;
  --shadow: 0 12px 30px rgba(32, 35, 42, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

.app-shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 18px 14px;
  border-right: 1px solid var(--line);
  background: #efede7;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  margin-bottom: 20px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  border-radius: 8px;
}

.brand strong,
.brand span {
  display: block;
}

.brand span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.nav {
  display: grid;
  gap: 6px;
}

.nav-link {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.nav-link:hover {
  border-color: var(--line);
  background: #fffaf0;
}

.nav-link.active {
  border-color: #c8c1b3;
  background: var(--surface);
  box-shadow: var(--shadow);
}

body.cloud-copy-only .nav-link[data-section="operator"],
body.cloud-copy-only #operator {
  display: none !important;
}

.main {
  min-width: 0;
  padding: 22px;
}

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

.topbar {
  align-items: center;
  margin-bottom: 18px;
}

.topbar h1 {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1.18;
}

.topbar p,
.section-head p,
.action-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid #bdb7aa;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}

.button:hover {
  border-color: #8d8677;
}

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

.button.warn {
  border-color: var(--amber);
  background: rgba(166, 111, 33, 0.1);
  color: var(--amber);
}

.button.danger {
  border-color: var(--red);
  background: rgba(168, 66, 66, 0.1);
  color: var(--red);
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--muted);
  white-space: nowrap;
}

.badge.ok {
  color: var(--green);
  border-color: rgba(47, 109, 86, 0.35);
  background: rgba(47, 109, 86, 0.08);
}

.badge.warn {
  color: var(--amber);
  border-color: rgba(166, 111, 33, 0.35);
  background: rgba(166, 111, 33, 0.09);
}

.badge.bad {
  color: var(--red);
  border-color: rgba(168, 66, 66, 0.35);
  background: rgba(168, 66, 66, 0.08);
}

.section {
  display: none;
}

.section.active {
  display: block;
}

.quick-layout {
  display: grid;
  gap: 18px;
  margin-bottom: 14px;
}

.quick-runner {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.quick-card {
  padding: 12px 0 2px;
  border-bottom: 1px solid var(--line);
}

.quick-title {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.quick-title > span {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.quick-title h2 {
  margin: 0 0 5px;
  font-size: 18px;
  line-height: 1.2;
}

.quick-title p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.count-control {
  display: grid;
  grid-template-columns: 48px minmax(0, 180px) 48px;
  gap: 8px;
  align-items: center;
}

.count-control input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  text-align: center;
  font-size: 24px;
  font-weight: 800;
}

.count-btn {
  width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
}

.choice-grid {
  display: grid;
  gap: 10px;
}

.theme-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.style-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.choice {
  position: relative;
  display: grid;
  gap: 5px;
  min-height: 92px;
  padding: 12px 12px 12px 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  cursor: pointer;
}

.choice input {
  position: absolute;
  top: 14px;
  left: 12px;
}

.choice:has(input:checked) {
  border-color: var(--blue);
  background: rgba(47, 111, 136, 0.08);
}

.choice strong {
  line-height: 1.25;
}

.choice small {
  color: var(--muted);
  line-height: 1.35;
}

.quick-runner {
  display: grid;
  grid-template-columns: minmax(180px, 260px) minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 16px;
}

.run-button {
  min-height: 64px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: var(--green);
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
}

.run-button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.quick-status {
  font-weight: 800;
  color: var(--green);
}

.quick-result {
  display: grid;
  gap: 5px;
  color: var(--muted);
  line-height: 1.45;
}

.quick-result strong {
  color: var(--text);
}

.copy-review-panel {
  display: grid;
  gap: 16px;
  padding: 18px;
  border: 2px solid rgba(166, 111, 33, 0.5);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.copy-review-panel[hidden] {
  display: none;
}

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

.copy-review-kicker {
  display: block;
  margin-bottom: 6px;
  color: var(--amber);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.copy-review-head h2 {
  margin: 0 0 6px;
  font-size: 20px;
}

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

.copy-review-blocked {
  padding: 13px 14px;
  border: 1px solid rgba(168, 66, 66, 0.28);
  border-radius: 8px;
  background: rgba(168, 66, 66, 0.06);
  color: var(--red);
}

.copy-review-blocked[hidden] {
  display: none;
}

.copy-review-blocked strong {
  display: block;
  line-height: 1.45;
}

.copy-review-blocked p,
.copy-review-blocked ul {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.copy-review-blocked ul {
  padding-left: 20px;
}

.copy-review-items {
  display: grid;
  gap: 12px;
}

.copy-review-item {
  display: block;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.copy-review-item:has(.copy-review-checkbox:checked) {
  border-color: var(--blue);
  background: rgba(47, 111, 136, 0.055);
}

.copy-review-item.has-warnings:has(.copy-review-checkbox:checked) {
  border-color: rgba(166, 111, 33, 0.65);
}

.copy-review-item.rewrite-incomplete:has(.copy-review-checkbox:checked) {
  border-color: rgba(180, 79, 24, 0.75);
  box-shadow: 0 0 0 2px rgba(180, 79, 24, 0.08);
}

.copy-review-item.hard-blocked {
  border-color: rgba(168, 66, 66, 0.48);
  background: rgba(168, 66, 66, 0.035);
}

.copy-review-checkbox {
  width: 19px;
  height: 19px;
  margin: 0;
  accent-color: var(--green);
}

.copy-review-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 13px;
}

.copy-review-select {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-weight: 750;
  white-space: nowrap;
}

.copy-review-item:has(.copy-review-checkbox:checked) .copy-review-select {
  border-color: rgba(47, 109, 86, 0.38);
  background: rgba(47, 109, 86, 0.1);
  color: var(--green);
}

.copy-review-item.hard-blocked .copy-review-select {
  border-color: rgba(168, 66, 66, 0.28);
  background: rgba(168, 66, 66, 0.08);
  color: var(--red);
  cursor: not-allowed;
}

.copy-review-item.hard-blocked .copy-review-checkbox {
  accent-color: var(--red);
}

.copy-review-item-meta {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.copy-review-item-meta > span:first-child {
  color: var(--muted);
  font-size: 12px;
}

.copy-review-ready {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(47, 109, 86, 0.1);
  color: var(--green);
  font-weight: 700;
  white-space: nowrap;
}

.copy-review-item.has-warnings .copy-review-ready {
  background: rgba(166, 111, 33, 0.1);
  color: var(--amber);
}

.copy-review-item.rewrite-incomplete .copy-review-ready {
  background: rgba(180, 79, 24, 0.13);
  color: #9a4216;
}

.copy-review-item.hard-blocked .copy-review-ready {
  background: rgba(168, 66, 66, 0.1);
  color: var(--red);
}

.copy-review-hard-reasons {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 13px;
  padding: 10px 11px;
  border: 1px solid rgba(168, 66, 66, 0.24);
  border-radius: 8px;
  background: rgba(168, 66, 66, 0.07);
  color: var(--red);
}

.copy-review-hard-reasons strong,
.copy-review-hard-reasons span {
  line-height: 1.4;
}

.copy-review-incomplete-alert {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 13px;
  padding: 11px 12px;
  border: 1px solid rgba(180, 79, 24, 0.38);
  border-left-width: 4px;
  border-radius: 8px;
  background: rgba(180, 79, 24, 0.08);
  color: #8b3911;
  line-height: 1.45;
}

.copy-review-incomplete-alert strong {
  font-size: 14px;
}

.copy-review-incomplete-alert span {
  color: #72411f;
}

.copy-review-hard-reasons span {
  padding: 3px 7px;
  border-radius: 999px;
  background: rgba(168, 66, 66, 0.09);
  font-size: 12px;
}

.copy-review-warning-tags {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 13px;
}

.copy-review-warning-tags span {
  display: inline-flex;
  align-items: center;
  max-width: 100%;
  min-height: 28px;
  padding: 4px 9px;
  border: 1px solid rgba(166, 111, 33, 0.24);
  border-radius: 999px;
  background: rgba(166, 111, 33, 0.08);
  color: #825616;
  font-size: 12px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.copy-review-comparison {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  align-items: stretch;
}

.copy-review-column {
  display: flex;
  min-width: 0;
  flex-direction: column;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.copy-review-column.source-copy {
  background: #f7f5f0;
}

.copy-review-column.rewritten-copy {
  border-color: rgba(47, 111, 136, 0.28);
  background: rgba(47, 111, 136, 0.045);
}

.copy-review-column-label {
  width: fit-content;
  margin-bottom: 8px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.rewritten-copy .copy-review-column-label {
  background: rgba(47, 111, 136, 0.12);
  color: var(--blue);
}

.copy-review-column h3 {
  margin: 0 0 10px;
  font-size: 17px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.copy-review-mode {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
  margin: 0 0 10px;
  padding: 0;
  border: 0;
}

.copy-review-mode legend {
  grid-column: 1 / -1;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.copy-review-mode label {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  min-width: 0;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
}

.copy-review-mode label:has(input:checked) {
  border-color: rgba(47, 111, 136, 0.48);
  background: rgba(47, 111, 136, 0.08);
}

.copy-review-mode input {
  flex: 0 0 auto;
  margin: 2px 0 0;
  accent-color: var(--blue);
}

.copy-review-mode label > span {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.copy-review-mode strong,
.copy-review-mode small {
  overflow-wrap: anywhere;
  line-height: 1.35;
}

.copy-review-mode small {
  color: var(--muted);
}

.copy-review-final-label {
  margin-bottom: 6px;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
}

.copy-review-final-copy {
  flex: 1;
  width: 100%;
  min-height: 320px;
  padding: 13px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font: inherit;
  line-height: 1.68;
}

.copy-review-final-copy:focus {
  border-color: var(--blue);
  outline: 2px solid rgba(47, 111, 136, 0.14);
  outline-offset: 1px;
}

.copy-review-column.uses-original .copy-review-column-label {
  background: rgba(47, 109, 86, 0.12);
  color: var(--green);
}

.copy-review-column.uses-original .copy-review-final-copy {
  border-color: rgba(47, 109, 86, 0.32);
  background: rgba(47, 109, 86, 0.045);
}

.copy-review-final-note {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.copy-review-item.hard-blocked .copy-review-mode,
.copy-review-item.hard-blocked .copy-review-final-copy {
  opacity: 0.72;
}

.copy-review-column pre {
  flex: 1;
  width: 100%;
  margin: 0;
  padding: 13px;
  overflow: visible;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-family: inherit;
  line-height: 1.68;
}

.copy-review-footer {
  display: grid;
  grid-template-columns: minmax(240px, 360px) minmax(0, 1fr);
  gap: 15px;
  align-items: center;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.copy-review-submit {
  width: 100%;
}

.copy-review-footer-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}

.copy-review-reject-all {
  min-width: 126px;
  font-weight: 700;
}

.copy-review-submit-copy {
  display: grid;
  gap: 5px;
  color: var(--muted);
  line-height: 1.45;
}

.copy-review-submit-copy strong {
  color: var(--text);
}

.copy-review-feishu-link {
  width: fit-content;
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.copy-review-feishu-link:hover {
  text-decoration: underline;
}

.copy-review-approved {
  display: grid;
  gap: 7px;
  padding: 16px;
  border: 1px solid rgba(47, 109, 86, 0.32);
  border-radius: 8px;
  background: rgba(47, 109, 86, 0.07);
}

.copy-review-approved span,
.copy-review-approved ul {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.copy-review-approved ul {
  padding-left: 20px;
}

.style-pool-strip {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(140px, 180px) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.style-pool-strip strong,
.style-pool-strip span {
  display: block;
}

.style-pool-strip span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.4;
}

.style-pool-strip label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
}

.style-pool-strip input {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.log-box.small {
  min-height: 180px;
  max-height: 380px;
}

.section-head {
  align-items: flex-end;
  margin: 0 0 14px;
}

.section-head h2,
.panel h2,
.action-card h3 {
  margin: 0;
  line-height: 1.2;
}

.section-head h2 {
  font-size: 20px;
}

.policy-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-bottom: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.policy-strip > div {
  min-height: 76px;
  padding: 12px;
  background: var(--surface);
}

.policy-strip span,
.subtle {
  color: var(--muted);
  font-size: 12px;
}

.policy-strip strong {
  display: block;
  margin-top: 6px;
  line-height: 1.45;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.metric-grid.compact {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.metric {
  min-height: 104px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
  line-height: 1;
}

.metric em {
  display: block;
  margin-top: 10px;
  color: var(--muted);
  font-style: normal;
  line-height: 1.35;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.review-toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.review-toolbar select {
  min-height: 36px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.review-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.review-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 260px);
  overflow: auto;
}

.review-list.compact {
  max-height: none;
}

.quick-copy-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.quick-copy-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.quick-copy-head strong,
.quick-copy-head span {
  display: block;
}

.quick-copy-head strong {
  font-size: 16px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.quick-copy-head span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.quick-copy-actions,
.review-inline-actions {
  display: flex;
  flex: 0 0 auto;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.button.small {
  min-height: 30px;
  padding: 0 10px;
  white-space: nowrap;
}

.quick-copy-body h3 {
  margin: 0 0 8px;
  font-size: 13px;
  line-height: 1.3;
}

.quick-copy-body pre,
.quick-source pre {
  margin: 0;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-family: inherit;
  line-height: 1.6;
}

.quick-copy-body pre {
  max-height: 460px;
}

.quick-source {
  margin-top: 10px;
}

.quick-source summary,
.debug-panel summary {
  cursor: pointer;
}

.quick-source summary {
  color: var(--muted);
  font-size: 12px;
}

.quick-source pre {
  margin-top: 8px;
  max-height: 260px;
  color: var(--muted);
}

.debug-panel {
  padding: 14px;
}

.debug-panel summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  list-style-position: inside;
}

.debug-panel .log-box {
  margin-top: 12px;
}

.review-list-item {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.review-list-item:hover,
.review-list-item.active {
  border-color: var(--blue);
  background: rgba(47, 111, 136, 0.08);
}

.review-list-item strong,
.review-list-item span {
  display: block;
}

.review-list-item strong {
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.review-list-item span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.review-detail-empty {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.review-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.review-meta span {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
}

.review-columns {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.review-columns section {
  min-width: 0;
}

.review-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 30px;
  margin-bottom: 7px;
}

.review-column-head h3 {
  margin: 0;
}

.review-columns h3,
.review-field span,
.review-warning strong {
  display: block;
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.3;
}

.review-columns pre,
.review-field textarea,
.review-warning,
.review-actions + .log-box {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.review-columns pre {
  min-height: 220px;
  max-height: 360px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  line-height: 1.55;
}

.copyable-text {
  cursor: text;
  -webkit-user-select: text;
  user-select: text;
}

.copyable-text:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.review-field {
  display: grid;
  gap: 0;
  margin-bottom: 12px;
}

.review-field textarea {
  resize: vertical;
  min-height: 90px;
  padding: 12px;
  color: var(--text);
  line-height: 1.55;
}

.review-warning {
  margin-bottom: 12px;
  padding: 12px;
  background: rgba(166, 111, 33, 0.08);
}

.review-warning span {
  display: block;
  color: var(--muted);
  line-height: 1.5;
  white-space: pre-wrap;
}

.review-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.panel,
.action-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel {
  padding: 14px;
}

.panel-head {
  align-items: center;
  margin-bottom: 12px;
}

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

.bars {
  display: grid;
  gap: 9px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(108px, 180px) minmax(0, 1fr) 48px;
  align-items: center;
  gap: 10px;
}

.bar-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-2);
}

.bar-fill {
  height: 100%;
  min-width: 2px;
  background: var(--blue);
}

.bar-fill.risk {
  background: var(--amber);
}

.bar-value {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.summary-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.summary-item {
  min-height: 72px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.summary-item span,
.summary-item strong {
  display: block;
}

.summary-item span {
  color: var(--muted);
  font-size: 12px;
}

.summary-item strong {
  margin-top: 8px;
  font-size: 20px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  text-align: left;
}

th {
  background: var(--surface-2);
  color: #4b4d4c;
  font-size: 12px;
  font-weight: 700;
}

td {
  line-height: 1.45;
}

tr:last-child td {
  border-bottom: 0;
}

.risk-tag {
  display: inline-flex;
  margin: 0 4px 4px 0;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(166, 111, 33, 0.12);
  color: var(--amber);
  font-size: 12px;
}

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

.record {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdfa;
}

.warn-record {
  border-color: rgba(166, 111, 33, 0.38);
  background: rgba(166, 111, 33, 0.08);
}

.record strong {
  display: block;
  overflow-wrap: anywhere;
  line-height: 1.45;
}

.record span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.manifest-grid,
.action-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.manifest {
  min-height: 150px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.manifest h3 {
  margin: 0 0 10px;
}

.manifest dl {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 7px 10px;
  margin: 0;
}

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

.manifest dd {
  margin: 0;
  overflow-wrap: anywhere;
}

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

.style-sheets img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 10;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.action-card {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 250px;
  padding: 14px;
}

.action-card h3 {
  font-size: 16px;
}

.action-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}

.action-card input[type="number"] {
  width: 100%;
  min-height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
}

.action-card .check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.log-box {
  min-height: 260px;
  max-height: 520px;
  margin: 0;
  overflow: auto;
  padding: 12px;
  border: 1px solid #272a2f;
  border-radius: 8px;
  background: #1b1d22;
  color: #e7e0d0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.operator-home {
  --operator-blue: #245c74;
  --operator-green: #2f6d56;
  --operator-warm: #f4f0e8;
}

.operator-home.active {
  display: grid;
  gap: 14px;
}

.operator-hero,
.operator-source-card,
.operator-settings-card,
.operator-progress-card,
.operator-control-panel,
.operator-log-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.operator-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 154px;
  padding: 24px;
  border-color: #252930;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), transparent 48%),
    #1b1e23;
  color: #fff;
}

.operator-hero h2 {
  margin: 7px 0 8px;
  font-size: clamp(26px, 4vw, 40px);
  line-height: 1.05;
}

.operator-hero p {
  max-width: 760px;
  margin: 0;
  color: #c6c7ca;
  line-height: 1.55;
}

.operator-kicker,
.operator-step {
  color: var(--operator-blue);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.14em;
}

.operator-hero .operator-kicker {
  color: #90bfd1;
}

.operator-service-state {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 270px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.07);
}

.operator-service-state strong,
.operator-service-state span {
  display: block;
}

.operator-service-state strong {
  margin-bottom: 3px;
  font-size: 15px;
}

.operator-service-state span:not(.status-light) {
  color: #bbbfc5;
  font-size: 12px;
  line-height: 1.4;
}

.status-light {
  position: relative;
  flex: 0 0 auto;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 255, 255, 0.38);
  border-radius: 999px;
  background: #8f949b;
  box-shadow: 0 0 0 5px rgba(143, 148, 155, 0.12);
}

.status-light.ready {
  background: #56bd91;
  box-shadow: 0 0 0 5px rgba(86, 189, 145, 0.14), 0 0 18px rgba(86, 189, 145, 0.45);
}

.status-light.running {
  background: #67c9ee;
  box-shadow: 0 0 0 5px rgba(103, 201, 238, 0.14), 0 0 18px rgba(103, 201, 238, 0.55);
  animation: operator-pulse 1.6s ease-in-out infinite;
}

.status-light.warn {
  background: #e7ad4e;
  box-shadow: 0 0 0 5px rgba(231, 173, 78, 0.14);
}

.status-light.error {
  background: #e06a6a;
  box-shadow: 0 0 0 5px rgba(224, 106, 106, 0.14);
}

.cloud-worker-bar {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(220px, 320px) auto minmax(150px, auto);
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.cloud-worker-bar[hidden] {
  display: none;
}

.cloud-worker-bar strong,
.cloud-worker-bar .operator-step {
  display: block;
}

.cloud-worker-bar select {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

#cloudWorkerHeartbeat {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

@keyframes operator-pulse {
  50% { transform: scale(0.82); opacity: 0.72; }
}

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

.operator-source-card,
.operator-settings-card,
.operator-progress-card,
.operator-log-panel {
  padding: 18px;
}

.operator-source-card {
  display: grid;
  align-content: start;
  gap: 14px;
  min-width: 0;
  min-height: 260px;
}

.operator-card-head,
.operator-panel-title,
.operator-card-foot,
.operator-progress-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.operator-card-head h3,
.operator-panel-title h3,
.operator-control-copy h3 {
  margin: 5px 0 0;
  font-size: 17px;
  line-height: 1.25;
}

.source-state,
.setting-lock {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: #faf9f6;
  font-size: 11px;
  white-space: nowrap;
}

.source-state.ready,
.source-state.running {
  border-color: rgba(47, 109, 86, 0.3);
  background: rgba(47, 109, 86, 0.08);
  color: var(--green);
}

.source-state.warn {
  border-color: rgba(166, 111, 33, 0.3);
  background: rgba(166, 111, 33, 0.08);
  color: var(--amber);
}

.source-state.bad,
.source-state.error {
  border-color: rgba(168, 66, 66, 0.3);
  background: rgba(168, 66, 66, 0.08);
  color: var(--red);
}

.operator-card-copy {
  min-height: 42px;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.background-selection-policy {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border: 1px solid rgba(36, 92, 116, 0.24);
  border-radius: 8px;
  background: rgba(36, 92, 116, 0.06);
}

.background-selection-policy strong {
  color: var(--operator-blue);
  font-size: 12px;
}

.background-selection-policy span {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

.background-category-caption {
  margin-bottom: -8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.background-category-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 26px;
  padding-bottom: 2px;
}

.background-category-chip,
.background-category-empty {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  min-height: 25px;
  padding: 0 8px;
  border: 1px solid #d8d2c7;
  border-radius: 999px;
  background: #faf8f3;
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.background-category-chip strong {
  color: var(--text);
  font-weight: 700;
}

.background-category-chip em {
  color: var(--operator-blue);
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.operator-path {
  min-height: 72px;
  padding: 11px 12px;
  overflow: hidden;
  border: 1px solid #ded9cf;
  border-radius: 8px;
  background: #f7f5f0;
  color: #3f4349;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.operator-card-foot {
  align-items: flex-end;
  margin-top: auto;
}

.operator-card-foot.align-end {
  min-height: 38px;
  align-items: center;
}

.background-library-counts {
  display: grid;
  grid-template-columns: repeat(3, minmax(58px, auto));
  gap: 14px;
  min-width: 0;
}

.background-library-counts .operator-count strong {
  font-size: 22px;
}

.background-library-counts .operator-count.eligible strong {
  color: var(--green);
}

.background-library-counts .operator-count.rejected strong {
  color: var(--red);
}

.operator-count strong,
.operator-count span {
  display: block;
}

.operator-count strong {
  font-size: 28px;
  line-height: 1;
}

.operator-count span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.folder-button {
  min-width: 122px;
  border-color: #9d9688;
  font-weight: 700;
}

.operator-feishu-meta {
  display: grid;
  gap: 0;
  margin: 0;
  border: 1px solid #ded9cf;
  border-radius: 8px;
  background: #f7f5f0;
  overflow: hidden;
}

.operator-feishu-meta div {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 10px;
  min-height: 42px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid #ded9cf;
}

.operator-feishu-meta div:last-child {
  border-bottom: 0;
}

.operator-feishu-meta dt {
  color: var(--muted);
  font-size: 11px;
}

.operator-feishu-meta dd {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  color: var(--text);
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.operator-settings-card,
.operator-progress-card {
  min-width: 0;
}

.setting-lock {
  border-color: #c8c1b3;
  background: var(--operator-warm);
}

.operator-run-policy {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 18px;
  padding: 13px;
  border: 1px solid #d8d4ca;
  border-radius: 9px;
  background: #fbfaf7;
}

.operator-policy-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 6px 10px;
  align-items: center;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.operator-policy-field input,
.operator-policy-field select {
  width: 100%;
  min-height: 36px;
  padding: 0 9px;
  border: 1px solid #c8c1b3;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  font-weight: 700;
}

.operator-policy-field input:disabled,
.operator-policy-field select:disabled {
  cursor: not-allowed;
  background: #efede7;
  color: var(--muted);
}

.operator-policy-field small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
}

.operator-skip-rule {
  grid-column: 1 / -1;
  padding: 10px 12px;
  border-left: 3px solid var(--operator-green);
  background: rgba(47, 109, 86, 0.06);
}

.operator-skip-rule strong,
.operator-skip-rule span {
  display: block;
}

.operator-skip-rule strong {
  color: var(--operator-green);
  font-size: 12px;
}

.operator-skip-rule span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.operator-monitor-status {
  grid-column: 1 / -1;
  min-height: 34px;
  padding: 8px 11px;
  border-radius: 8px;
  background: var(--operator-warm);
  color: var(--operator-blue);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.operator-monitor-status.running {
  background: rgba(47, 109, 86, 0.09);
  color: var(--operator-green);
}

.conversation-setting {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(36, 92, 116, 0.25);
  border-radius: 9px;
  background: rgba(36, 92, 116, 0.06);
}

.conversation-number {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 9px;
  background: var(--operator-blue);
  color: #fff;
  font-size: 28px;
  font-weight: 800;
}

.conversation-setting strong,
.conversation-setting span,
.operator-safety-note strong,
.operator-safety-note span {
  display: block;
}

.conversation-setting span,
.operator-safety-note span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.operator-safety-note {
  margin-top: 12px;
  padding: 12px 14px;
  border-left: 3px solid var(--operator-green);
  background: #f6f7f3;
}

.conversation-progress {
  margin-top: 10px;
  padding: 9px 12px;
  border: 1px solid #d8d4ca;
  border-radius: 8px;
  background: #fbfaf7;
  color: var(--operator-blue);
  font-size: 12px;
  font-weight: 800;
  line-height: 1.45;
}

.operator-current-id {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 36px;
  margin-top: 15px;
  color: var(--muted);
  font-size: 11px;
}

.operator-current-id code {
  min-width: 0;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operator-row-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #d8d4ca;
  border-radius: 8px;
  background: #fbfaf7;
  color: var(--muted);
  font-size: 12px;
}

.operator-row-progress strong {
  color: var(--operator-blue);
  font-size: 14px;
}

.operator-run-counters {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.operator-run-counters > span {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 38px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #f2f0ea;
  color: var(--muted);
  font-size: 12px;
}

.operator-run-counters strong {
  color: var(--text);
  font-size: 16px;
}

.operator-run-counters .completed {
  background: rgba(47, 109, 86, 0.09);
  color: var(--operator-green);
}

.operator-run-counters .skipped {
  background: rgba(166, 111, 33, 0.09);
  color: #8c641f;
}

.operator-run-counters .failed {
  background: rgba(167, 68, 63, 0.09);
  color: #a7443f;
}

.operator-progress-head {
  align-items: center;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.operator-progress-head strong {
  color: var(--text);
  font-size: 16px;
}

.operator-progress-track {
  height: 10px;
  margin-top: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e2db;
}

.operator-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--operator-blue), #5aa4b8);
  transition: width 300ms ease;
}

.operator-progress-detail {
  min-height: 38px;
  margin: 11px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.operator-control-panel {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
}

.operator-control-copy p {
  max-width: 720px;
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.operator-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.operator-actions .button {
  min-height: 42px;
  padding: 0 15px;
  font-weight: 700;
}

.operator-start {
  min-width: 150px;
}

.operator-log-panel {
  min-width: 0;
}

.operator-log {
  min-height: 126px;
  max-height: 260px;
  margin: 14px 0 0;
  padding: 13px 14px;
  overflow: auto;
  border: 1px solid #2c3036;
  border-radius: 8px;
  background: #1b1d22;
  color: #dfe5e2;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
  white-space: pre-wrap;
}

@media (max-width: 1080px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }

  .nav-link {
    text-align: center;
  }

  .metric-grid,
  .summary-row,
  .manifest-grid,
  .action-grid,
  .style-sheets,
  .theme-grid,
  .style-grid,
  .style-pool-strip,
    .review-layout,
    .review-columns,
    .operator-source-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .feishu-source-card {
    grid-column: 1 / -1;
  }

  .operator-control-panel {
    grid-template-columns: 1fr;
  }

  .operator-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .main {
    padding: 14px;
  }

  .topbar,
  .section-head,
  .split-grid,
  .policy-strip,
  .metric-grid,
  .metric-grid.compact,
  .summary-row,
  .manifest-grid,
  .action-grid,
  .style-sheets,
  .theme-grid,
  .style-grid,
  .quick-runner,
  .copy-review-comparison,
  .copy-review-mode,
  .copy-review-footer,
  .style-pool-strip,
    .review-layout,
    .review-columns,
    .operator-source-grid,
    .operator-runtime-grid,
    .operator-control-panel {
    grid-template-columns: 1fr;
  }

  .topbar,
  .section-head {
    display: grid;
  }

  .copy-review-head,
  .copy-review-item-head {
    display: grid;
  }

  .nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .bar-row {
    grid-template-columns: 1fr 1fr 40px;
  }

  .operator-hero {
    display: grid;
    min-height: 0;
    padding: 18px;
  }

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

  #cloudWorkerHeartbeat {
    text-align: left;
  }

  .operator-service-state {
    min-width: 0;
  }

  .feishu-source-card {
    grid-column: auto;
  }

  .operator-source-card {
    min-height: 0;
  }

  .operator-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .operator-run-policy {
    grid-template-columns: 1fr;
  }

  .operator-policy-field,
  .operator-skip-rule,
  .operator-monitor-status {
    grid-column: 1;
  }

  .operator-actions .button,
  .operator-start {
    width: 100%;
    min-width: 0;
  }
}

@media (max-width: 460px) {
  .operator-actions {
    grid-template-columns: 1fr;
  }

  .operator-card-foot {
    align-items: stretch;
    flex-direction: column;
  }

  .folder-button,
  .operator-card-foot .button {
    width: 100%;
  }

  .conversation-setting {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .conversation-number {
    width: 52px;
    height: 52px;
    font-size: 23px;
  }
}

.profile-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.source-link-box {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.62);
}

.source-link-box textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  resize: vertical;
}

.viral-library-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 8px;
}

.copy-source-mode {
  margin: 16px 0;
  padding: 12px;
  border: 1px solid var(--line, #ded8cc);
  border-radius: 12px;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.copy-source-mode legend { padding: 0 6px; font-weight: 700; }

.copy-source-mode-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line, #ded8cc);
  border-radius: 10px;
  cursor: pointer;
  background: #fff;
}

.copy-source-mode-option:has(input:checked) {
  border-color: #28778d;
  background: #eef7f8;
}

.copy-source-mode-option span { display: grid; gap: 4px; }
.copy-source-mode-option small { color: var(--muted, #6f716f); line-height: 1.5; }

.library-source-mode-panel {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  border-radius: 10px;
  background: #f1f7f3;
  border: 1px solid #c8ddd1;
  color: #315f4a;
}

.library-source-mode-panel[hidden], .source-link-box[hidden] { display: none !important; }

@media (max-width: 760px) {
  .copy-source-mode { grid-template-columns: 1fr; }
}

.viral-library-toolbar input {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
}

.viral-library-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.viral-batch-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.viral-source-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.viral-select-checkbox { width: 18px; height: 18px; margin: 0; }

.viral-source-main { display: grid; gap: 4px; min-width: 0; }
.viral-source-main strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.profile-editor {
  width: min(1100px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: var(--paper);
}

.profile-editor::backdrop {
  background: rgba(18, 23, 30, 0.58);
}

.profile-editor form {
  padding: 24px;
}

.profile-editor-head,
.profile-products-head,
.profile-product-head,
.profile-editor-footer {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.profile-editor-head h2,
.profile-products-head h3 {
  margin: 4px 0;
}

.profile-editor-head p,
.profile-products-head p {
  margin: 0;
  color: var(--muted);
}

.profile-form-grid,
.profile-product-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.profile-form-grid label,
.profile-product-grid label {
  display: grid;
  gap: 7px;
  font-weight: 700;
}

.profile-form-grid input,
.profile-form-grid textarea,
.profile-product-grid input,
.profile-product-grid textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 400;
}

.profile-form-grid .wide,
.profile-product-grid .wide {
  grid-column: 1 / -1;
}

.profile-products-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.profile-product,
.profile-empty {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
}

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

.profile-editor-footer {
  align-items: center;
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

@media (max-width: 760px) {
  .profile-form-grid,
  .profile-product-grid {
    grid-template-columns: 1fr;
  }

  .profile-form-grid .wide,
  .profile-product-grid .wide {
    grid-column: auto;
  }
}
