:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #e4e7ec;
  --accent: #2457d6;
  --mark: #d04a3a;
  --ink: #172033;
  --danger: #c93636;
  --ok: #16805d;
  --shadow: 0 10px 30px rgba(16, 24, 40, 0.07);
  --radius: 12px;
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --serif: "Songti SC", "Noto Serif SC", "Source Han Serif SC", "SimSun", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.login-gate {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 32px 20px;
}
.login-card {
  width: min(400px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}
.login-card h1 { margin: 0; font-size: 22px; }
.login-card .kicker { margin: 0; letter-spacing: 0.08em; text-transform: uppercase; }
.login-card label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.login-card input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}
.login-card input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.12);
}

.app {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: 56px minmax(0, 1fr);
  height: 100%;
}

.app > .desk-view,
.app > .engine-view {
  grid-row: 2;
  grid-column: 1;
  min-height: 0;
  overflow: hidden;
}

.desk-view {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 320px;
  min-height: 0;
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 0 22px;
  background: rgba(255,255,255,0.94);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(16,24,40,.04);
  position: relative;
  z-index: 2;
}
.brand-wrap { display: flex; align-items: center; gap: 18px; }
.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: var(--serif);
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: 16px;
}
.brand::before {
  content: none;
}
.view-nav { display: flex; gap: 4px; }
.nav-link {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 8px;
  min-height: 40px;
}
.nav-link:hover { background: #f3eee4; color: var(--text); }
.nav-link.active { background: #efe8dc; color: var(--accent); font-weight: 600; }
.top-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.continuous-status {
  font-size: 12px;
  color: var(--muted);
  max-width: 280px;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.continuous-status.on { color: var(--accent); }
.continuous-status.err { color: var(--danger); }
.btn.btn-continuous-on {
  border-color: var(--mark);
  color: var(--mark);
  background: #fff8f6;
}
.type-select {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 140px;
}
.add-type {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}
.add-type h3 { margin: 0 0 8px; font-size: 15px; }
.engine-fields { display: grid; gap: 12px; }
.form-actions { display: flex; gap: 8px; align-items: center; }
.form-actions .btn-danger { margin-left: auto; }
.chip.add { border-style: dashed; color: var(--accent); }

.btn {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: 8px;
  padding: 8px 12px;
  transition: transform 0.12s ease, background 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.btn:hover { background: #f9fafb; }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-danger { color: var(--danger); border-color: #fecaca; background: #fff; }
.btn-danger:hover { background: #fef2f2; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }
.btn.is-busy { pointer-events: none; opacity: 0.78; position: relative; }
.btn.is-busy::before {
  content: "";
  display: inline-block;
  width: 12px;
  height: 12px;
  margin: 0 7px 0 0;
  vertical-align: -2px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.action-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  max-width: 220px;
  padding: 5px 10px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity .18s ease, transform .18s ease, background .18s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.action-status.visible { opacity: 1; transform: none; background: #f2f4f7; }
.action-status.pending { color: #2457d6; background: #eef4ff; }
.action-status.success { color: var(--ok); background: #ecfdf3; }
.action-status.error { color: var(--danger); background: #fff1f1; }

.rail, .inspector {
  background: var(--panel);
  overflow: auto;
  padding: 16px;
}
.rail { border-right: 1px solid var(--line); }
.inspector { border-left: 1px solid var(--line); }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 13px;
  color: var(--muted);
  transition: background 0.12s ease, color 0.12s ease, border-color 0.12s ease;
}
.chip:hover { background: #f3f4f6; color: var(--text); }
.chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }

.login-card h1,
.inspector h2,
.engine-card h2,
.sheet h2 {
  font-family: var(--serif);
}
.login-card .kicker { color: var(--mark); }

.list { display: grid; gap: 8px; }
.card {
  text-align: left;
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
  transition: border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}
.card:hover { border-color: #9db6f2; box-shadow: var(--shadow); transform: translateY(-1px); }
.card:active { transform: scale(0.985); }
.card.active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(36, 87, 214, 0.14); background: #f7f9ff; }
.card.busy {
  border-left: 3px solid var(--accent);
  background: #f7f9ff;
  animation: soft-pulse 1.8s ease-in-out infinite;
}
@keyframes soft-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(36,87,214,.02); } 50% { box-shadow: 0 0 0 4px rgba(36,87,214,.08); } }
.card .t { margin: 0 0 4px; font-weight: 600; }
.card .s { margin: 0; color: var(--muted); font-size: 12px; }

.stage {
  display: grid;
  place-items: center;
  overflow: auto;
  padding: 24px;
}
.empty { color: var(--muted); }
.empty.sm { font-size: 14px; }
.preview-wrap { width: min(400px, 100%); }
.phone {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--shadow);
}
.phone-bar {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 14px;
  font-size: 13px;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
}
.phone-body { position: relative; }
.preview-loading {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.9);
  color: var(--muted);
  z-index: 1;
  backdrop-filter: blur(3px);
}
.preview-loading::before {
  content: "";
  width: 20px;
  height: 20px;
  margin-right: 8px;
  border: 2px solid #cbd5e1;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.phone iframe { display: block; width: 100%; height: min(74vh, 820px); border: 0; background: #fff; }

.inspector h2 { margin: 0 0 8px; font-size: 22px; font-weight: 650; line-height: 1.3; }
.inspector h3 { margin: 20px 0 8px; font-size: 12px; color: var(--muted); font-weight: 600; letter-spacing: 0.06em; }
.kicker { margin: 0 0 6px; color: var(--muted); font-size: 12px; }
.meta { color: var(--muted); font-size: 13px; }
.error:not(:empty) { color: var(--danger); font-size: 13px; }
.pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  background: #f3f4f6;
  font-size: 12px;
}
.pill.pending_review { background: #f3eee4; color: #8a3b2c; }
.pill.approved { background: #fff7ed; color: #c2410c; }
.pill.generating, .pill.revising, .pill.publishing { background: #e8eef3; color: #0b1f33; }
.pill.drafted { background: #ecfdf5; color: var(--ok); }
.pill.published { background: #ecfdf5; color: var(--ok); }
.pill.ok { background: #ecfdf5; color: var(--ok); }
.pill.waiting { background: #eef2ff; color: #3730a3; }
.pill.rejected, .pill.failed, .pill.cancelled, .pill.bad { background: #fef2f2; color: var(--danger); }
.process-log {
  margin: 12px 0 0;
  background: #111827;
  color: #e5e7eb;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  padding: 10px 12px;
  border-radius: 10px;
  max-height: 180px;
  overflow: auto;
}
.process-log .log-line { margin: 0; }
.process-log .log-at { color: #9ca3af; margin-right: 8px; }
#job-actions .help { margin: 0; }
.actions, .revise, .stack { display: grid; gap: 8px; margin: 14px 0; }
.notes {
  background: #f8fafc;
  border-left: 3px solid var(--accent);
  padding: 10px 12px;
  font-size: 13px;
  white-space: pre-wrap;
}
.assets {
  background: #f8fafc;
  border: 1px dashed var(--line);
  padding: 10px 12px;
  font-size: 12px;
  color: var(--muted);
  word-break: break-all;
  display: grid;
  gap: 6px;
  margin: 10px 0;
}
.fact-check {
  background: #fffbeb;
  border: 1px solid #f0d9a0;
  border-left: 3px solid #c8a45c;
  padding: 10px 12px;
  margin: 10px 0;
}
.fact-check h3 {
  margin: 0 0 6px;
  font-size: 13px;
}
.fact-check-sources {
  display: grid;
  gap: 5px;
  margin: 8px 0;
  font-size: 12px;
  line-height: 1.5;
  word-break: break-word;
}
.cover-box {
  margin: 12px 0;
  display: grid;
  gap: 8px;
}
.cover-box h3 { margin: 0; font-size: 14px; }
.image-list {
  display: grid;
  gap: 10px;
}
.image-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 8px 0;
  border-top: 1px solid var(--line);
}
.image-row:first-child { border-top: none; padding-top: 0; }
.cover-preview-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.cover-thumb {
  width: 120px;
  height: 68px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f1f5f9;
  flex: 0 0 auto;
}
.cover-thumb.placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
}
.cover-preview-meta { display: grid; gap: 8px; flex: 1; min-width: 0; }
.cover-preview-meta .meta { margin: 0; word-break: break-all; }
.cover-history-sheet { width: min(720px, 100%); }
.cover-tabs { display: flex; gap: 8px; margin: 12px 0; flex-wrap: wrap; }
.cover-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
  max-height: 52vh;
  overflow: auto;
  min-height: 120px;
}
.cover-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  background: #fff;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  display: grid;
  gap: 0;
}
.cover-card:hover,
.cover-card:focus-visible {
  border-color: var(--accent);
  outline: none;
}
.cover-card img {
  width: 100%;
  height: 84px;
  object-fit: cover;
  background: #e2e8f0;
  display: block;
}
.cover-card .cap {
  padding: 6px 8px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
  word-break: break-all;
}
.cover-card .cap strong {
  display: block;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 2px;
}
.cover-fallback-steps {
  display: grid;
  gap: 6px;
  margin: 8px 0 12px;
}
.cover-fallback-steps .check {
  font-size: 13px;
}

.cover-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 13px;
  margin: 12px 0;
}
.revise label, .form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.form label.check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  cursor: pointer;
  user-select: none;
}
.form label.check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
  accent-color: var(--accent);
}
.revise textarea, .form input:not([type="checkbox"]), .form select, .form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.revise textarea:focus, .form input:not([type="checkbox"]):focus, .form select:focus, .form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.12);
}
.stack .item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  text-align: left;
  background: #fff;
  font-size: 13px;
}
.stack .item.active { border-color: var(--accent); }

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.35);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 20;
  animation: fade 0.16s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet {
  background: #fff;
  width: min(760px, 100%);
  max-height: 90vh;
  overflow: auto;
  border-radius: 16px;
  padding: 20px;
  box-shadow: var(--shadow);
  animation: pop 0.16s ease;
}
.sheet.sm { width: min(420px, 100%); }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet header { display: flex; justify-content: space-between; align-items: center; }
.sheet h2 { margin: 0 0 8px; font-size: 18px; }
.form { display: grid; gap: 12px; margin-top: 12px; }
.row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; align-items: end; }
.row.checks { grid-template-columns: repeat(2, max-content); gap: 16px 24px; align-items: center; }
.check { display: flex; align-items: center; gap: 8px; }
.help, .hint { font-size: 13px; color: var(--muted); margin: 0; }
.publish-settings {
  display: grid;
  gap: 8px;
  margin: 12px 0 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line, #e5e7eb);
}
.publish-settings h3 { margin: 0; font-size: 14px; }
.publish-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
}
.publish-settings label:not(.check) {
  display: grid;
  gap: 4px;
  font-size: 13px;
}
.publish-settings input[type="text"],
.publish-settings input[type="url"] {
  width: 100%;
  box-sizing: border-box;
}
.hint { color: var(--ok); min-height: 1.2em; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 8px;
  z-index: 40;
  width: min(320px, calc(100% - 32px));
}
.toast {
  background: #111827;
  color: #fff;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  animation: pop 0.16s ease;
}
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }

.engine-view {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  overflow: hidden;
  background: var(--bg);
  min-height: 0;
}
.config-rail {
  padding: 16px 12px;
  border-right: 1px solid var(--line, #e5e7eb);
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
}
.config-type-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.config-type-item {
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.config-type-item:hover { background: #f3f4f6; }
.config-type-item.active {
  background: #efe8dc;
  border-color: #d9d2c5;
}
.config-type-item .slug {
  display: block;
  font-size: 11px;
  color: var(--muted, #6b7280);
  margin-top: 2px;
}
.config-type-item.off { opacity: 0.55; }
.config-add-btn { width: 100%; }
.engine-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.75fr);
  gap: 20px;
  padding: 24px 28px 48px;
  overflow: auto;
  align-items: start;
}
.engine-form-col, .engine-preview-col { display: grid; gap: 16px; }
.engine-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px;
  box-shadow: var(--shadow);
}
.engine-card h2 { margin: 4px 0 10px; font-size: 20px; }
.engine-card h3 { margin: 16px 0 8px; font-size: 13px; color: var(--muted); font-weight: 600; }
.engine-card .kicker { margin: 0; letter-spacing: 0.08em; text-transform: uppercase; }
.engine-card .form, .engine-card label { margin-top: 10px; }
.engine-card label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.engine-card label.check {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 14px;
  margin-top: 0;
  cursor: pointer;
}
.engine-card label.check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex: 0 0 auto;
}
.engine-card input:not([type="checkbox"]), .engine-card select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
}
.engine-card textarea {
  width: 100%;
  min-height: 160px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.55;
  resize: vertical;
}
.engine-card textarea:focus, .engine-card input:focus, .engine-card select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.12);
}
.engine-query, .engine-filter, .engine-field {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  margin: 10px 0;
  background: #fafbfc;
}
.engine-query-head {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
}
.engine-mini-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: end;
}
.engine-row-2 { grid-template-columns: 1fr 1fr; }
.engine-preview-body {
  font-size: 13px;
  color: var(--text);
  display: grid;
  gap: 12px;
}
.engine-var {
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: 10px;
  padding: 10px 12px;
}
.engine-var dt {
  margin: 0 0 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  color: var(--accent);
  font-size: 12px;
}
.engine-var dd {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 240px;
  overflow: auto;
  color: #374151;
}
.engine-card.sticky { position: sticky; top: 16px; }
.engine-sql-block .btn, .engine-feishu-block .btn, #engine-sql-block .btn, #engine-feishu-block .btn {
  margin-top: 4px;
}

.hot-topic-sheet { width: min(680px, 100%); }
.hot-topic-sheet h3 { margin: 0 0 6px; font-size: 18px; }
.ht-loading { color: var(--muted); margin: 16px 0; }
.ht-angle { color: var(--ink); margin: 0 0 10px; }
.ht-options { display: grid; gap: 8px; margin: 0 0 14px; }
.ht-option {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.ht-option:hover, .ht-option:focus { background: #f8fafc; }
.ht-option.active { border-color: #1a365d; background: rgba(26, 54, 93, 0.06); }
.ht-option-index {
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #f1f5f9;
  font-size: 13px;
  font-weight: 650;
}
.ht-option.active .ht-option-index { background: #1a365d; color: #fff; }
.ht-option-title { display: block; font-weight: 650; font-size: 14px; line-height: 1.4; }
.ht-option-angle, .ht-option-meta {
  display: block;
  margin-top: 2px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.ht-option-angle {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ht-source-box { margin-top: 12px; }
.ht-source-box label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.ht-source-box textarea { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff; font-size: 14px; resize: vertical; }
.ht-facts {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 6px 12px;
  margin: 0 0 12px;
  font-size: 13px;
}
.ht-facts dt { color: var(--muted); margin: 0; }
.ht-facts dd { margin: 0; }
.ht-detail {
  margin: 0;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 10px;
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 180px;
  overflow: auto;
}

.culture-poster-sheet { width: min(560px, 100%); max-height: min(92vh, 900px); overflow: auto; }
.cp-body { display: grid; gap: 10px; }
.universal-sheet { width: min(720px, 100%); max-height: min(94vh, 980px); overflow: auto; }
.universal-sheet label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.universal-sheet input:not([type="file"]), .universal-sheet select, .universal-sheet textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #fff;
  font-size: 14px;
  color: var(--text);
}
.universal-sheet textarea { resize: vertical; }
.universal-sheet .uv-row-2 { grid-template-columns: repeat(2, 1fr); }
.uv-record-actions { display: flex; gap: 6px; justify-self: end; align-self: center; }
@media (max-width: 700px) { .universal-sheet .uv-row-2 { grid-template-columns: 1fr; } }
.company-poster-sheet { width: min(440px, 100%); }
.cop-body { display: grid; gap: 10px; }
.cop-manual { display: grid; gap: 10px; }
.cop-manual.hidden { display: none; }
.cp-list {
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.cp-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 10px;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.cp-item:last-child { border-bottom: 0; }
.cp-item:hover, .cp-item:focus { background: #f8fafc; }
.cp-item.active { background: rgba(26, 54, 93, 0.08); }
.cp-item .cp-name { font-weight: 600; }
.cp-item .cp-meta { font-size: 12px; color: var(--muted); }
.cp-item .pill { justify-self: end; align-self: center; }
.cp-item .cp-pills { justify-self: end; align-self: center; display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.cp-item .pill-ref { background: #e8f1ff; color: #1a365d; }
.cp-ref-block { display: grid; gap: 8px; padding: 10px 0 0; border-top: 1px solid var(--border, #e2e8f0); }

@media (max-width: 1100px) {
  .app { grid-template-columns: 1fr; grid-template-rows: auto auto; height: auto; min-height: 100%; }
  .topbar { min-height: 64px; height: auto; padding: 10px 14px; flex-wrap: wrap; }
  .brand-wrap { flex: 1 1 auto; min-width: 220px; }
  .top-actions { margin-left: auto; }
  .action-status { order: 3; flex-basis: 100%; max-width: none; justify-content: center; }
  .desk-view { grid-template-columns: 1fr; overflow: visible; }
  .row { grid-template-columns: 1fr; }
  .phone iframe { height: 70vh; }
  .engine-view { grid-template-columns: 1fr; }
  .config-rail { border-right: 0; border-bottom: 1px solid var(--line, #e5e7eb); max-height: 220px; }
  .engine-layout { grid-template-columns: 1fr; }
  .engine-card.sticky { position: static; }
}
