:root {
  --bg: #f5f2ee;
  --panel: #ffffff;
  --ink: #1e1b18;
  --muted: #7d766f;
  --faint: #a39c94;
  --line: #e8e2db;
  --accent: #e8344e;
  --accent-dark: #c8243b;
  --accent-soft: #fdecef;
  --good: #1c7c54;
  --mid: #a86a12;
  --bad: #b23a2f;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow: 0 1px 2px rgba(30, 27, 24, 0.05), 0 12px 32px rgba(30, 27, 24, 0.06);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1100px 520px at 85% -10%, #ffe8eb 0%, transparent 62%),
    var(--bg);
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.topbar {
  max-width: 1240px;
  margin: 0 auto;
  padding: 26px 24px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.logo {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(140deg, #f2556b, var(--accent) 55%, #c81f3a);
  color: #fff;
  font-size: 21px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(232, 52, 78, 0.28);
}

.brand h1 {
  margin: 0;
  font-size: 21px;
  letter-spacing: 0.01em;
}

.brand p {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.72);
  border: 1px solid var(--line);
  padding: 8px 14px;
  border-radius: 999px;
  backdrop-filter: blur(6px);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #35a06f;
  box-shadow: 0 0 0 3px rgba(53, 160, 111, 0.16);
}

.mainnav {
  display: flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(6px);
}

.nav-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  padding: 7px 16px;
  border-radius: 999px;
  font: inherit;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-item:hover {
  color: var(--ink);
}

.nav-item.active {
  background: var(--ink);
  color: #fff;
}

.nav-count {
  font-size: 11px;
  line-height: 1.4;
  padding: 0 6px;
  border-radius: 999px;
  background: #ece7e1;
  color: var(--muted);
}

.nav-item.active .nav-count {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.today-board {
  max-width: 1240px;
  margin: 0 auto 16px;
  padding: 0 24px;
}

.today-inner {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 18px 16px;
}

.today-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.today-head h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.today-head h2 span {
  margin-left: 6px;
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--faint);
}

.today-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.today-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fdfcfa;
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.today-item:hover {
  border-color: #f0a3ae;
  background: #fff;
}

.today-label {
  font-size: 12px;
  color: var(--muted);
}

.today-count {
  font-size: 22px;
  font-weight: 600;
  line-height: 1.25;
  color: var(--ink);
}

.today-note {
  font-size: 11px;
  color: var(--faint);
}

.today-item.is-empty .today-count {
  color: var(--faint);
  font-weight: 500;
}

.layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px 56px;
  display: grid;
  grid-template-columns: minmax(340px, 410px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 22px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.head-actions {
  display: flex;
  gap: 14px;
}

.card-head h2 {
  margin: 0;
  font-size: 15px;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
}

.backup-card {
  grid-column: 1 / -1;
}

.backup-card .hint {
  margin-top: 8px;
}

.backup-snapshots {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.snapshot-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.snapshot-title {
  font-size: 13px;
  font-weight: 600;
}

.snapshot-hint {
  margin: 0;
  flex: 1 1 240px;
}

.snapshot-list {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.snapshot-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 12px;
  background: var(--panel-2, #f7f7f5);
  border: 1px solid var(--line);
  border-radius: 10px;
}

.snapshot-meta {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.snapshot-meta strong {
  font-size: 13px;
  color: inherit;
  font-variant-numeric: tabular-nums;
}

.snapshot-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.snapshot-empty {
  margin: 10px 0 0;
}

.workflow-card {
  grid-column: 1 / -1;
}

.workflow-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}

.workflow-date {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.workflow-date em {
  font-style: normal;
  color: var(--faint);
}

.workflow-date input {
  width: auto;
  padding: 6px 10px;
  font-size: 12px;
}

.workflow-status {
  font-size: 12px;
  color: var(--muted);
}

.workflow-status.ok {
  color: #2f7a3e;
}

.workflow-status.bad {
  color: #a33;
}

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

.workflow-step {
  display: flex;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fdfcfa;
}

.workflow-dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 50%;
  background: #d8d4cc;
}

.workflow-step b {
  display: block;
  font-size: 12px;
  color: var(--text);
}

.workflow-note {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
  word-break: break-word;
}

.workflow-step.running {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.workflow-step.running .workflow-dot {
  background: var(--accent);
}

.workflow-step.done .workflow-dot {
  background: #4f9a63;
}

.workflow-step.fail {
  border-color: #d9a3a0;
  background: #fdf6f5;
}

.workflow-step.fail .workflow-dot {
  background: #b5544c;
}

.workflow-step.paused {
  border-color: #d8b46a;
  background: #fdf8ec;
}

.workflow-step.paused .workflow-dot {
  background: #c08a2e;
}

.workflow-card > .hint {
  margin-top: 10px;
}

.workflow-schedule {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--muted);
}

.workflow-time {
  display: flex;
  align-items: center;
  gap: 8px;
}

.workflow-time input {
  width: auto;
  padding: 6px 10px;
  font-size: 12px;
}

.workflow-enable {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.workflow-enable input {
  width: auto;
}

#briefDialog {
  width: min(760px, calc(100vw - 32px));
}

.brief-card {
  max-height: calc(100vh - 32px);
}

.brief-text {
  margin: 0;
  max-height: 58vh;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfaf7;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.brief-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin: -4px 0 10px;
  font-size: 12px;
}

.brief-nav .link {
  padding: 0;
}

.brief-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.brief-actions[hidden] {
  display: none;
}

.brief-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.brief-action strong {
  display: block;
  font-size: 13px;
  color: var(--text);
}

.brief-action span {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--muted);
}

.brief-action .link {
  flex: none;
}

.editor {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.field-label em {
  font-style: normal;
  font-weight: 400;
  font-size: 11.5px;
  color: var(--faint);
}

input[type="text"],
input[type="search"],
input[type="date"],
input[type="password"],
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  background: #fdfcfa;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

select {
  cursor: pointer;
}

input[type="text"]:focus,
input[type="search"]:focus,
input[type="date"]:focus,
input[type="password"]:focus,
select:focus,
textarea:focus {
  border-color: #f0a3ae;
  box-shadow: 0 0 0 3px var(--accent-soft);
  background: #fff;
}

input::placeholder,
textarea::placeholder {
  color: #b9b2aa;
}

textarea {
  min-height: 290px;
  resize: vertical;
  line-height: 1.85;
}

.platforms {
  border: 0;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.platforms legend {
  padding: 0;
  margin-bottom: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.03em;
}

.chip {
  position: relative;
}

.chip input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.chip span {
  display: inline-flex;
  padding: 7px 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.chip input:checked + span {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 600;
}

.switch {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
}

.switch input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.btn {
  border: 0;
  border-radius: 10px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease, opacity 0.15s ease;
}

.btn.primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 16px;
  color: #fff;
  background: linear-gradient(135deg, #f04b61, var(--accent));
  box-shadow: 0 8px 20px rgba(232, 52, 78, 0.24);
}

.btn.primary:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}

.btn.primary:active {
  transform: translateY(1px);
}

.btn.primary:disabled {
  opacity: 0.65;
  cursor: progress;
}

.btn.small {
  padding: 8px 14px;
  font-size: 13px;
  box-shadow: none;
  flex: none;
}

.btn.ghost {
  padding: 10px 16px;
  font-size: 13px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
}

.btn.ghost:hover {
  background: #fbf9f6;
  border-color: #d9d2ca;
}

.btn.ghost:disabled {
  opacity: 0.6;
  cursor: progress;
}

kbd {
  font-family: inherit;
  font-size: 11px;
  font-weight: 500;
  background: rgba(255, 255, 255, 0.22);
  border-radius: 4px;
  padding: 1px 5px;
}

.hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--faint);
}

.save-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.save-state {
  font-size: 12px;
  color: var(--faint);
  line-height: 1.4;
}

.view[hidden] {
  display: none;
}

.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.toolbar input[type="search"] {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
}

.toolbar select {
  width: auto;
  min-width: 110px;
  padding: 9px 12px;
  font-size: 13px;
}

.toolbar .btn {
  flex: none;
}

.lib-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.lib-item {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 1px 2px rgba(30, 27, 24, 0.04);
}

.lib-main {
  min-width: 0;
  flex: 1;
}

.lib-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
}

.lib-video {
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.7;
}

.lib-storyboard {
  padding: 0 7px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-family: inherit;
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.7;
  cursor: pointer;
}

.lib-storyboard:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.lib-missing {
  padding: 0 7px;
  border-radius: 999px;
  background: #fdeee9;
  color: #b4382c;
  font-size: 11px;
  line-height: 1.7;
}

.lib-wx {
  padding: 0 7px;
  border-radius: 999px;
  background: #eef7f1;
  color: #2f7a4f;
  font-size: 10.5px;
  line-height: 1.7;
}

.lib-pub {
  padding: 0 7px;
  border-radius: 999px;
  background: #eef7f1;
  color: #2f7a4f;
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.7;
}

.lib-excerpt {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 760px;
}

.lib-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--faint);
}

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

.lib-actions select,
.lib-actions input[type="date"] {
  width: auto;
  padding: 6px 8px;
  font-size: 12px;
  border-radius: 8px;
}

.lib-actions .link {
  color: var(--muted);
  padding: 4px 2px;
}

.lib-actions .link.danger {
  color: var(--bad);
}

.lib-empty {
  padding: 40px 20px;
  text-align: center;
  color: var(--faint);
  font-size: 14px;
}

.lib-empty .link {
  margin-left: 6px;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.7;
}

.badge.idea {
  background: #f1efec;
  color: #6f6862;
}

.badge.draft {
  background: #fdf3e3;
  color: var(--mid);
}

.badge.scheduled {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.badge.published {
  background: #eef7f1;
  color: var(--good);
}

.badge.block {
  background: #fdf1ef;
  color: var(--bad);
}

.badge.warn {
  background: #fdf8ee;
  color: var(--mid);
}

.badge.tip {
  background: #f1efec;
  color: #6f6862;
}

.badge.good {
  background: #eef7f1;
  color: var(--good);
}

.badge.mid {
  background: #fdf3e3;
  color: var(--mid);
}

.badge.bad {
  background: #fdf1ef;
  color: var(--bad);
}

.badge.none {
  background: #f1efec;
  color: var(--faint);
  font-weight: 500;
}

.rules-card {
  max-width: 1040px;
  margin: 0 auto;
}

.rules-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.rules-title {
  margin: 0;
  font-size: 19px;
}

.rules-sub {
  max-width: 620px;
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--muted);
}

.rules-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.rule-list {
  display: flex;
  flex-direction: column;
}

.rule-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px 0;
  border-bottom: 1px dashed var(--line);
}

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

.rule-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
  flex: none;
}

.rule-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.rule-builtin {
  flex: 1;
  min-width: 0;
  margin: 2px 0 0;
  text-align: right;
  font-size: 12px;
  line-height: 1.6;
  color: var(--faint);
}

.rule-words {
  min-height: 68px;
  padding: 9px 11px;
  font-size: 13px;
  line-height: 1.7;
  background: #fdfcfa;
}

.rule-advice {
  margin: 0;
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
}

.custom-block {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

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

.custom-head h3 {
  margin: 0;
  font-size: 15px;
}

.custom-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.custom-rule {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbf9f6;
}

.custom-rule-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.custom-rule-head input[type="text"] {
  flex: 1 1 160px;
  min-width: 0;
  padding: 8px 10px;
  font-size: 13.5px;
  background: #fff;
}

.custom-rule-head select {
  width: auto;
  flex: none;
  padding: 8px 10px;
  font-size: 13px;
  background: #fff;
}

.custom-rule textarea {
  min-height: 92px;
  padding: 9px 11px;
  font-size: 13px;
  line-height: 1.7;
  background: #fff;
}

.custom-empty {
  margin: 0;
  padding: 22px;
  text-align: center;
  font-size: 13px;
  color: var(--faint);
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fdfcfa;
}

.auto-card {
  margin: 16px auto 0;
}

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

.auto-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auto-group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.auto-group-head h3 {
  margin: 0;
  font-size: 15px;
}

.auto-group-head .link {
  font-size: 12px;
}

.auto-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fdfcfa;
}

.auto-item.done {
  border-color: #cfe3d2;
  background: #f7fbf6;
}

.auto-item-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  cursor: pointer;
}

.auto-item-head input {
  flex: none;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.auto-item.done .auto-item-head b {
  color: var(--faint);
  text-decoration: line-through;
}

.auto-badge {
  margin-left: auto;
  padding: 1px 7px;
  border-radius: 999px;
  background: #f1efec;
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  flex: none;
}

.auto-badge.need {
  background: #fdf3e3;
  color: var(--mid);
}

.auto-entry {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
}

.auto-steps {
  margin: 0;
  padding-left: 20px;
  font-size: 12.5px;
  line-height: 1.75;
  color: var(--ink);
}

.auto-prep {
  margin: 0;
  font-size: 12px;
  line-height: 1.65;
  color: var(--faint);
}

.auto-item-foot {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.auto-item-foot .auto-prep {
  flex: 1;
  min-width: 0;
}

.auto-go {
  flex: none;
  font-size: 12px;
  white-space: nowrap;
}

.auto-note {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.calendar-card {
  padding: 20px 22px 18px;
}

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

.cal-title {
  font-size: 17px;
  font-weight: 600;
}

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

.icon-btn {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}

.icon-btn:hover {
  background: #fbf9f6;
  color: var(--ink);
}

.cal-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  padding: 6px 0;
  text-align: center;
  font-size: 12px;
  color: var(--faint);
}

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

.cal-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  min-height: 92px;
  padding: 6px 7px;
  background: #fff;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.cal-cell.out {
  background: #fbf9f6;
}

.cal-cell.out .cal-day {
  color: #c9c2ba;
}

.cal-day {
  font-size: 12px;
  color: var(--muted);
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
}

.cal-cell.today .cal-day {
  background: var(--ink);
  color: #fff;
  border-radius: 50%;
}

.cal-items {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.cal-chip {
  max-width: 100%;
  padding: 3px 6px;
  border: 0;
  border-radius: 6px;
  font: inherit;
  font-size: 11.5px;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}

.cal-chip.idea {
  background: #f1efec;
  color: #6f6862;
}

.cal-chip.draft {
  background: #fdf3e3;
  color: var(--mid);
}

.cal-chip.scheduled {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.cal-chip.published {
  background: #eef7f1;
  color: var(--good);
}

.cal-chip.risk {
  box-shadow: inset 2px 0 0 var(--bad);
}

.cal-more {
  padding-left: 4px;
  font-size: 11px;
  color: var(--faint);
}

.cal-foot {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--faint);
}

.cal-foot span {
  color: var(--ink);
  font-weight: 600;
}

.cal-list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.cal-list-head h3 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0;
  font-size: 13px;
}

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

.cal-list-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
}

.cal-list-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cal-list-tools-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cal-list-tools .filter-chip {
  flex: none;
}

.cal-list {
  display: flex;
  flex-direction: column;
  max-height: 320px;
  margin-top: 8px;
  overflow-y: auto;
}

.cal-list-row {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  border: 0;
  border-bottom: 1px dashed #f1ece6;
  background: none;
  font: inherit;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

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

.cal-list-row:hover,
.cal-list-row:focus-visible {
  background: #faf6f1;
  outline: none;
}

.cal-list-date {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 11.5px;
  color: var(--muted);
}

.cal-list-date strong {
  font-size: 12.5px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

.cal-list-date em {
  font-style: normal;
  color: var(--faint);
}

.cal-list-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.cal-list-title {
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-list-meta {
  overflow: hidden;
  font-size: 11px;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-list-empty {
  margin: 0;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.link {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-size: 13px;
  color: var(--accent-dark);
  cursor: pointer;
}

.link:hover {
  text-decoration: underline;
}

.link.danger {
  color: var(--bad);
}

.results {
  min-height: 420px;
}

.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 36px;
  margin-bottom: 16px;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tab {
  border: 1px solid var(--line);
  background: #fbf9f6;
  color: var(--muted);
  padding: 7px 16px;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab.active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}

.score {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
  white-space: nowrap;
  font-size: 12px;
  color: var(--muted);
  background: #fbf9f6;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 4px 12px 4px 14px;
}

.score b {
  font-size: 16px;
  line-height: 1;
}

.score[data-level="good"] b {
  color: var(--good);
}

.score[data-level="mid"] b {
  color: var(--mid);
}

.score[data-level="bad"] b {
  color: var(--bad);
}

.output.empty {
  display: grid;
  place-items: center;
  min-height: 360px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: #fdfcfa;
  color: var(--faint);
  font-size: 14px;
  text-align: center;
  padding: 24px;
}

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

.result-actions {
  display: flex;
  flex: none;
  gap: 8px;
}

.result-actions .btn.small {
  white-space: nowrap;
}

.result h3 {
  margin: 0;
  font-size: 18px;
}

.result-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--faint);
}

.block {
  margin-top: 18px;
}

.block-label {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
}

.block-label span {
  font-weight: 400;
  color: var(--faint);
}

.block-label .over {
  color: var(--bad);
  font-weight: 600;
}

.title-text {
  margin-top: 6px;
  font-size: 17px;
  font-weight: 600;
  line-height: 1.5;
}

.body-text {
  margin-top: 6px;
  padding: 14px 16px;
  max-height: 430px;
  overflow: auto;
  background: #fdfcfa;
  border: 1px solid var(--line);
  border-radius: 12px;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.85;
  word-break: break-word;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  font-size: 12px;
  color: var(--accent-dark);
  background: var(--accent-soft);
  padding: 3px 10px;
  border-radius: 999px;
}

.digest {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
}

.cover {
  margin: 16px 0 0;
  padding-left: 10px;
  border-left: 2px solid var(--line);
  font-size: 12px;
  color: var(--faint);
}

.notes {
  margin: 14px 0 0;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--muted);
}

.notes li + li {
  margin-top: 4px;
}

.result-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.checks {
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.checks:empty {
  display: none;
}

.checks-title {
  margin: 0 0 12px;
  font-size: 14px;
}

.checks-title span {
  font-size: 12px;
  font-weight: 400;
  color: var(--faint);
  margin-left: 6px;
}

.check {
  display: flex;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbf9f6;
}

.check + .check {
  margin-top: 8px;
}

.check-level {
  flex: none;
  width: 30px;
  height: 22px;
  margin-top: 1px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
}

.check.block {
  border-color: #f2cdc8;
  background: #fdf1ef;
}

.check.block .check-level {
  background: #f6d5d0;
  color: var(--bad);
}

.check.warn {
  border-color: #f0e0c4;
  background: #fdf8ee;
}

.check.warn .check-level {
  background: #f5e3c0;
  color: var(--mid);
}

.check.tip .check-level {
  background: #eceae5;
  color: var(--muted);
}

.check-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  font-size: 13.5px;
  font-weight: 600;
}

.check-detail {
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
}

.check p {
  margin: 3px 0 0;
  font-size: 12.5px;
  line-height: 1.65;
  color: #6b655f;
}

.hits {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.hit {
  display: flex;
  align-items: baseline;
  gap: 8px;
  max-width: 100%;
  padding: 5px 9px;
  border: 1px dashed #e4ddd5;
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.hit:hover {
  border-color: #e0b3b9;
  background: #fffbfb;
}

.hit-where {
  flex: none;
  padding: 0 6px;
  border-radius: 4px;
  background: #f1efec;
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.8;
}

.hit-context {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hit mark {
  padding: 0 1px;
  border-radius: 2px;
  background: #fbe0c3;
  color: #8a4b0f;
}

.check.block .hit mark {
  background: #f6d5d0;
  color: var(--bad);
}

.check.warn .hit mark {
  background: #f5e3c0;
  color: var(--mid);
}

.check-ok {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border: 1px solid #d5e9dd;
  border-radius: 12px;
  background: #f0f7f3;
  font-size: 13px;
  color: var(--good);
}

.ok-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--good);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  padding: 10px 18px;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.engage-bar {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.engage-bar .queue-open {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.queue-open .count:empty {
  display: none;
}

.queue-open .count {
  min-width: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}

.segments {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(6px);
}

.segments::-webkit-scrollbar {
  display: none;
}

.seg {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 13.5px;
  color: var(--muted);
  padding: 7px 22px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.seg-badge {
  min-width: 16px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  line-height: 16px;
  text-align: center;
}

.seg.active .seg-badge {
  background: rgba(255, 255, 255, 0.24);
}

.seg:hover {
  color: var(--ink);
}

.seg.active {
  background: var(--ink);
  color: #fff;
}

.count {
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--faint);
}

.var-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 0 16px;
  margin-bottom: 14px;
  border-bottom: 1px dashed var(--line);
}

.var-row label {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.var-row span {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
}

.var-row input {
  padding: 8px 10px;
  font-size: 13px;
}

.tpl-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.tpl-tools input[type="search"] {
  flex: 1 1 auto;
  min-width: 0;
  padding: 8px 10px;
  font-size: 12.5px;
}

.tpl-tools select {
  flex: none;
  width: auto;
  padding: 8px 10px;
  font-size: 12.5px;
}

.tpl-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 560px;
  overflow-y: auto;
}

.tpl-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fdfcfa;
}

.tpl-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tpl-name {
  font-size: 13.5px;
}

.tpl-actions {
  margin-left: auto;
  display: flex;
  gap: 10px;
  font-size: 12px;
}

.tpl-preview {
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--muted);
  word-break: break-word;
}

.tpl-empty {
  padding: 36px 12px;
  text-align: center;
  font-size: 13px;
  color: var(--faint);
}

.badge.scene-consult {
  background: #eef3fb;
  color: #2f5e9e;
}

.badge.scene-price {
  background: #fdf3e3;
  color: var(--mid);
}

.badge.scene-aftersale {
  background: #fdf1ef;
  color: var(--bad);
}

.badge.scene-collab {
  background: #eef7f1;
  color: var(--good);
}

.badge.scene-other {
  background: #f1efec;
  color: #6f6862;
}

.comment-wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px 56px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.comment-input-card .comment-input {
  min-height: 170px;
}

.comment-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
}

.comment-actions .hint {
  margin-left: auto;
}

.comment-summary {
  font-size: 12px;
  color: var(--faint);
}

.comment-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.comment-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 5px 10px;
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-chip span {
  padding: 0 6px;
  border-radius: 999px;
  background: #f1efec;
  font-size: 11px;
  color: var(--faint);
}

.filter-chip:hover {
  border-color: #d9d2ca;
}

.filter-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-weight: 600;
}

.filter-chip.active span {
  background: rgba(232, 52, 78, 0.12);
  color: var(--accent-dark);
}

.comment-toolbar input[type="search"] {
  flex: 1 1 180px;
  min-width: 0;
  padding: 8px 12px;
  font-size: 13px;
}

.comment-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-left: auto;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 620px;
  overflow-y: auto;
}

.comment-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fdfcfa;
}

.comment-row .badge {
  flex: none;
  margin-top: 3px;
}

.comment-text {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 13.5px;
  line-height: 1.7;
  word-break: break-word;
}

.comment-main {
  flex: 1;
  min-width: 0;
}

.comment-reply {
  margin: 4px 0 0;
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
  word-break: break-word;
}

.comment-reply b {
  margin-right: 6px;
  padding: 0 5px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 10.5px;
  font-weight: 600;
}

.comment-reply.muted {
  color: var(--faint);
}

.comment-mini-actions {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}

.comment-mini-actions .link {
  font-size: 12px;
  white-space: nowrap;
}

.comment-mini-actions .link:disabled {
  color: var(--faint);
  cursor: default;
}

.comment-row .link {
  flex: none;
}

.comment-empty {
  padding: 40px 16px;
  text-align: center;
  font-size: 13px;
  color: var(--faint);
}

.comment-status-filters {
  padding-left: 10px;
  border-left: 1px solid var(--line);
}

.comment-state {
  display: inline-block;
  margin-right: 6px;
  padding: 0 6px;
  border-radius: 4px;
  font-size: 10.5px;
  line-height: 1.7;
  vertical-align: 1px;
  background: #f1efec;
  color: var(--faint);
}

.comment-state.is-new {
  background: rgba(232, 52, 78, 0.1);
  color: var(--accent-dark);
}

.comment-state.is-replied {
  background: rgba(47, 125, 79, 0.12);
  color: #2f7d4f;
}

.comment-state.is-ignored {
  background: #f1efec;
  color: #9a938c;
}

.comment-row.is-ignored .comment-text,
.comment-row.is-ignored .comment-reply {
  opacity: 0.62;
}

.dm-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.dm-form textarea {
  min-height: 110px;
  resize: vertical;
}

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

.dm-form-actions .hint {
  margin-left: auto;
}

.dm-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 12px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.dm-filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dm-toolbar input[type="search"] {
  flex: 1 1 220px;
  min-width: 0;
  padding: 8px 12px;
  font-size: 13px;
}

.dm-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 620px;
  overflow-y: auto;
}

.dm-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fdfcfa;
}

.dm-card.dm-status-pending {
  border-left: 3px solid var(--accent);
}

.dm-card.dm-status-lead {
  border-left: 3px solid #79b98a;
}

.dm-card-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.dm-platform {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f6f4f0;
  font-size: 11px;
  color: var(--muted);
}

.dm-name {
  font-weight: 600;
  color: var(--text);
}

.dm-time {
  font-size: 11px;
  color: var(--faint);
}

.dm-intent {
  margin-left: auto;
  flex: none;
  width: auto;
  padding: 4px 8px;
  font-size: 12px;
}

.dm-status-badge {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
}

.dm-status-badge.pending {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.dm-status-badge.replied {
  background: #eef3fb;
  color: #2f5e9e;
}

.dm-status-badge.lead {
  background: #edf6ee;
  color: #2f7a3e;
}

.dm-status-badge.ignored {
  background: #f1efec;
  color: var(--faint);
}

.dm-text {
  margin: 8px 0 0;
  font-size: 13.5px;
  line-height: 1.7;
  word-break: break-word;
  white-space: pre-wrap;
}

.dm-note {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--muted);
  word-break: break-word;
}

.dm-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
}

.dm-actions .link {
  font-size: 12px;
}

.dm-actions .link.danger {
  color: #a33;
}

.dm-linked {
  font-size: 12px;
  color: #2f7a3e;
}

#dmReplyDialog {
  width: min(560px, calc(100vw - 32px));
}

#dmReplyPreview {
  min-height: 150px;
  resize: vertical;
}

.dm-batch {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
}

.dm-batch-head {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 6px;
}

.dm-batch-tip {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.7;
  color: var(--muted);
}

.dm-batch-tip code {
  padding: 1px 4px;
  border-radius: 4px;
  background: #f3f1ec;
  font-size: 11px;
}

.dm-batch textarea {
  min-height: 130px;
  resize: vertical;
}

.dm-batch-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 10px;
}

.dm-batch-platform {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.dm-batch-platform select {
  width: auto;
  padding: 6px 10px;
  font-size: 12px;
}

.dm-batch-preview {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.dm-batch-summary {
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--muted);
}

.dm-batch-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 520px;
  overflow-y: auto;
}

.dm-batch-item {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fdfcfa;
}

.dm-batch-item.dm-batch-missing {
  border-color: #d9a3a0;
  background: #fdf6f5;
}

#dmDraftDialog {
  width: min(720px, calc(100vw - 32px));
}

.dm-draft-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 52vh;
  overflow-y: auto;
  margin: 4px 0 10px;
}

.dm-draft {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fdfcfa;
}

.dm-draft-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}

.dm-draft-head b {
  font-size: 13px;
  color: var(--text);
}

.dm-draft-source {
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.dm-draft textarea {
  min-height: 72px;
  resize: vertical;
}

.dm-batch-item-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.dm-batch-item-head select,
.dm-batch-item-head input {
  width: auto;
  flex: 1 1 120px;
  min-width: 0;
  padding: 6px 8px;
  font-size: 12px;
}

.dm-batch-item-head [data-batch-field="time"] {
  flex-basis: 180px;
}

.dm-batch-item-head .link {
  flex: none;
}

.dm-batch-item textarea {
  min-height: 64px;
  resize: vertical;
  font-size: 13px;
}

.dm-batch-item [data-batch-field="note"] {
  font-size: 12px;
}

.lead-toolbar {
  margin-top: 12px;
}

.lead-sort {
  flex: none;
  width: auto;
  padding: 8px 10px;
  font-size: 12.5px;
}

.lead-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 620px;
  overflow-y: auto;
}

.lead-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fdfcfa;
}

.lead-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.lead-head select {
  width: auto;
  flex: none;
  padding: 4px 8px;
  font-size: 12px;
}

.lead-date {
  margin-left: auto;
  font-size: 11px;
  color: var(--faint);
}

.lead-text {
  margin: 8px 0 0;
  font-size: 13.5px;
  line-height: 1.7;
  word-break: break-word;
}

.lead-next {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

.lead-next label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.lead-next input {
  width: 150px;
  padding: 5px 8px;
  font-size: 12px;
}

.lead-next.overdue input {
  border-color: #e2a3a3;
  color: #a33;
}

.lead-quick {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.lead-quick .link {
  font-size: 11px;
  color: var(--muted);
}

.lead-quick .link:hover {
  color: var(--accent-dark);
}

.lead-overdue {
  color: #b44242;
  font-size: 11px;
}

.lead-note {
  width: 100%;
  margin-top: 8px;
  padding: 7px 10px;
  font-size: 12.5px;
}

.lead-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 8px;
}

.lead-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--muted);
}

.lead-platform {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f6f4f0;
  font-size: 11px;
}

.lead-name {
  font-weight: 600;
  color: var(--text);
}

.lead-keyword {
  color: var(--faint);
}

.lead-meta .link {
  margin-left: auto;
  font-size: 11px;
}

.badge.intent-high {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.badge.intent-mid {
  background: #eef3fb;
  color: #2f5e9e;
}

.badge.intent-low {
  background: #f1f0ee;
  color: var(--muted);
}

.lead-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lead-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.lead-form textarea {
  min-height: 96px;
  resize: vertical;
}

.lead-form-state {
  margin-right: auto;
  font-size: 12px;
  color: #a33;
}

.lead-history {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.lead-history-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 6px;
}

.lead-history-head h3 {
  margin: 0;
  font-size: 13px;
}

.lead-history-head span {
  font-size: 12px;
  color: var(--muted);
}

.lead-history-list {
  max-height: 200px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  list-style: none;
}

.lead-history-item {
  display: flex;
  gap: 10px;
  padding: 6px 0 6px 12px;
  border-left: 2px solid #f0d9dc;
  font-size: 12px;
  line-height: 1.5;
}

.lead-history-time {
  flex: none;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.lead-history-text {
  color: var(--text);
  overflow-wrap: anywhere;
}

.lead-history-empty {
  padding: 8px 0;
  font-size: 12px;
  color: var(--faint);
}

.lead-view-toggle {
  display: inline-flex;
  flex: none;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #faf8f5;
}

.seg-mini {
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-size: 12px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}

.seg-mini.active {
  background: #fff;
  color: var(--text);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

.lead-bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #faf8f5;
  font-size: 12px;
}

.lead-bulk[hidden] {
  display: none;
}

.lead-bulk-count {
  font-weight: 600;
  color: var(--text);
}

.lead-bulk .link {
  font-size: 12px;
}

.lead-bulk-next {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
}

.lead-bulk-next input,
.lead-bulk-next select {
  width: auto;
  padding: 5px 8px;
  font-size: 12px;
}

.lead-table-wrap {
  max-width: 100%;
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow-x: auto;
  background: #fff;
}

.lead-table-wrap[hidden] {
  display: none;
}

.lead-table {
  width: 100%;
  min-width: 1000px;
  border-collapse: collapse;
  font-size: 12.5px;
}

.lead-table th {
  position: sticky;
  top: 0;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  background: #faf8f5;
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  white-space: nowrap;
}

.lead-table td {
  padding: 9px 10px;
  border-bottom: 1px solid #f1ede7;
  vertical-align: middle;
}

.lead-table tbody tr:last-child td {
  border-bottom: 0;
}

.lead-table tbody tr:hover {
  background: #fdfbf8;
}

.lead-table .lead-check {
  width: 36px;
  text-align: center;
}

.lead-table input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent);
}

.lead-table-text {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-table-history {
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
}

.lead-table-history .lead-history-time {
  margin-right: 4px;
  font-size: 11px;
}

.lead-table .badge {
  font-size: 11px;
}

.lead-table .link {
  font-size: 12px;
}

.lead-table-empty {
  padding: 28px;
  text-align: center;
  color: var(--faint);
}

.lead-table-overdue {
  margin-left: 4px;
  font-size: 11px;
  color: #b44242;
}

.lead-plan-dialog {
  width: min(680px, calc(100vw - 32px));
}

.lead-plan-tools {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lead-plan-search-row {
  display: flex;
  gap: 8px;
}

.lead-plan-search {
  flex: 1;
  min-width: 0;
  padding: 8px 12px;
  font-size: 13px;
}

.lead-plan-search-row .btn {
  flex: none;
}

.lead-plan-intents {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.lead-plan-reset {
  margin-left: 6px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 12px;
  color: var(--accent-dark);
  text-decoration: underline;
  cursor: pointer;
}

.lead-plan-activity {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fdfcfa;
}

.lead-plan-activity summary {
  display: flex;
  align-items: baseline;
  gap: 8px;
  padding: 8px 12px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
}

.lead-plan-activity summary em {
  margin-left: auto;
  font-style: normal;
  font-size: 11.5px;
  font-weight: 400;
  color: var(--muted);
}

.lead-plan-activity[open] summary {
  border-bottom: 1px dashed #efe9e2;
}

.lead-plan-activity-note {
  margin: 8px 12px 4px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--faint);
}

.lead-plan-activity-body {
  display: flex;
  flex-direction: column;
  max-height: 230px;
  padding: 0 8px 8px;
  overflow-y: auto;
}

.lead-plan-activity-item {
  display: grid;
  grid-template-columns: 82px 72px minmax(0, 1fr);
  align-items: baseline;
  gap: 8px;
  padding: 6px 4px;
  border: 0;
  border-bottom: 1px dashed #f1ece6;
  background: none;
  font: inherit;
  font-size: 11.5px;
  text-align: left;
  color: var(--ink);
  cursor: pointer;
}

.lead-plan-activity-item:last-child {
  border-bottom: 0;
}

.lead-plan-activity-item:hover,
.lead-plan-activity-item:focus-visible {
  background: #faf6f1;
  outline: none;
}

.lead-plan-activity-time {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.lead-plan-activity-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-plan-activity-text {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-plan-activity-empty {
  margin: 0;
  padding: 0 4px 8px;
  font-size: 11.5px;
  color: var(--muted);
}

.lead-plan-activity-more {
  margin: 0;
  padding: 6px 4px 2px;
  font-size: 11px;
  color: var(--faint);
}

.lead-plan-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lead-plan-group h3 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin: 0 0 5px;
  font-size: 13px;
}

.lead-plan-group.group-overdue h3 {
  color: #b44242;
}

.lead-plan-count {
  padding: 1px 7px;
  border-radius: 999px;
  background: #f3efea;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.lead-plan-group.group-overdue .lead-plan-count {
  background: #fbe9e9;
  color: #b44242;
}

.lead-plan-group h3 em {
  margin-left: auto;
  font-style: normal;
  font-size: 11px;
  font-weight: 400;
  color: var(--faint);
}

.lead-plan-group-action {
  padding: 1px 8px;
  border: 1px solid #f0c7c7;
  border-radius: 999px;
  background: #fdf1ef;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.6;
  color: #b44242;
  white-space: nowrap;
  cursor: pointer;
}

.lead-plan-group-action:hover,
.lead-plan-group-action:focus-visible {
  border-color: #d98f8f;
  background: #fbe5e5;
  outline: none;
}

.lead-plan-group-action:disabled {
  opacity: 0.6;
  cursor: default;
}

.lead-plan-list {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.lead-plan-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  border-bottom: 1px solid #f1ede7;
  background: #fff;
}

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

.lead-plan-row:hover {
  background: #faf8f5;
}

.lead-plan-open {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 62px 52px;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding: 8px 10px;
  border: 0;
  background: none;
  font: inherit;
  font-size: 12px;
  text-align: left;
  color: var(--text);
  cursor: pointer;
}

.lead-plan-open:focus-visible {
  border-radius: 8px;
  outline: 2px solid #f0a3ae;
  outline-offset: -2px;
}

.lead-plan-actions {
  display: flex;
  gap: 6px;
  padding-right: 10px;
}

.lead-plan-action {
  padding: 2px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font: inherit;
  font-size: 11px;
  line-height: 1.6;
  color: var(--muted);
  white-space: nowrap;
  cursor: pointer;
}

.lead-plan-action:hover,
.lead-plan-action:focus-visible {
  border-color: #f0a3ae;
  color: var(--accent-dark);
  outline: none;
}

.lead-plan-action:disabled {
  opacity: 0.5;
  cursor: default;
}

.lead-plan-date {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.group-overdue .lead-plan-date {
  color: #b44242;
}

.lead-plan-main {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 1px;
}

.lead-plan-name {
  overflow: hidden;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-plan-meta {
  overflow: hidden;
  font-size: 11px;
  color: var(--faint);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-plan-intent {
  justify-self: end;
}

.lead-plan-status {
  text-align: right;
  color: var(--muted);
}

.lead-plan-empty {
  margin: 0;
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.lead-batch-dialog {
  width: min(720px, calc(100vw - 32px));
}

.lead-batch-input {
  min-height: 140px;
  line-height: 1.7;
}

.lead-batch-preview {
  max-height: 262px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.lead-batch-list {
  display: flex;
  flex-direction: column;
}

.lead-batch-row {
  display: grid;
  grid-template-columns: 58px minmax(0, 1fr) auto;
  gap: 3px 8px;
  padding: 8px 10px;
  border-bottom: 1px solid #f1ede7;
  font-size: 12px;
  line-height: 1.5;
}

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

.lead-batch-line {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.lead-batch-text {
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-batch-row.is-dup .lead-batch-text {
  color: var(--muted);
}

.lead-batch-row.is-invalid .lead-batch-text {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: #d9b3ae;
}

.lead-batch-badge {
  justify-self: end;
  height: fit-content;
  padding: 0 7px;
  border-radius: 999px;
  background: #eef7f1;
  font-size: 11px;
  font-weight: 600;
  color: var(--good);
  white-space: nowrap;
}

.lead-batch-row.is-dup .lead-batch-badge {
  background: #fbf3e4;
  color: var(--mid);
}

.lead-batch-row.is-invalid .lead-batch-badge {
  background: #fdf1ef;
  color: var(--bad);
}

.lead-batch-meta,
.lead-batch-note {
  grid-column: 2 / 4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-batch-meta {
  color: var(--faint);
}

.lead-batch-note {
  color: var(--mid);
  white-space: normal;
}

.lead-batch-row.is-invalid .lead-batch-note {
  color: var(--bad);
}

.lead-batch-empty {
  margin: 0;
  padding: 18px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.lead-batch-more {
  margin: 0;
  padding: 8px 10px;
  border-top: 1px dashed var(--line);
  font-size: 11px;
  color: var(--faint);
  text-align: center;
}

.lead-batch-state {
  margin: 0;
  font-size: 12px;
  color: var(--bad);
  word-break: break-word;
}

.lead-batch-state:empty {
  display: none;
}

.lead-insights-dialog {
  width: min(760px, calc(100vw - 32px));
}

.lead-insights-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.lead-insight-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #faf8f5;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.lead-insight-kpi:hover,
.lead-insight-kpi:focus-visible {
  border-color: var(--accent);
  background: #fff;
  outline: none;
}

.lead-insight-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.lead-insight-label {
  font-size: 12px;
  color: var(--muted);
}

.lead-insight-note {
  font-size: 11px;
  color: var(--faint);
}

.lead-insights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.lead-insights-block {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.lead-insights-wide {
  grid-column: 1 / -1;
}

.lead-insights-block h3 {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 8px;
  font-size: 13px;
}

.lead-insights-block h3 em {
  font-style: normal;
  font-size: 11px;
  font-weight: 400;
  color: var(--faint);
}

.lead-insights-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.lead-insights-table th,
.lead-insights-table td {
  padding: 6px 4px;
  border-bottom: 1px solid #f1ede7;
  text-align: left;
}

.lead-insights-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}

.lead-insights-table th:not(:first-child),
.lead-insights-table td:not(:first-child) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.lead-insights-table tr:last-child td {
  border-bottom: 0;
}

.lead-insights-drill {
  cursor: pointer;
}

.lead-insights-drill:hover td {
  background: #faf8f5;
}

.lead-insights-drill:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.lead-insights-name {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lead-insights-bars {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.lead-insights-bar-row {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr) 64px;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 0.15s ease;
}

.lead-insights-bar-row:hover,
.lead-insights-bar-row:focus-visible {
  background: #faf8f5;
  outline: none;
}

.lead-insights-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #f3efea;
}

.lead-insights-fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
}

.lead-insights-fill.status-contacted {
  background: #6f93c4;
}

.lead-insights-fill.status-won {
  background: #6ba683;
}

.lead-insights-fill.status-lost {
  background: #b9b1a8;
}

.lead-insights-count {
  text-align: right;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.lead-insights-none {
  margin: 6px 0 0;
  font-size: 12px;
  color: var(--faint);
}

.lead-insights-empty {
  margin: 0;
  padding: 16px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.badge.ctype-buy {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.badge.ctype-consult {
  background: #eef3fb;
  color: #2f5e9e;
}

.badge.ctype-aftersale {
  background: #fdf3e3;
  color: var(--mid);
}

.badge.ctype-question {
  background: #eef3fb;
  color: #2f5e9e;
}

.badge.ctype-negative {
  background: #fdf1ef;
  color: var(--bad);
}

.badge.ctype-positive {
  background: #eef7f1;
  color: var(--good);
}

.badge.ctype-spam {
  background: #fdf3e3;
  color: var(--mid);
}

.badge.ctype-other {
  background: #f1efec;
  color: #6f6862;
}

.comment-type-select {
  border: 0;
  max-width: 112px;
  padding: 1px 4px 1px 8px;
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.7;
  border-radius: 999px;
  cursor: pointer;
}

.comment-type-select:hover {
  filter: brightness(0.97);
}

.modal {
  width: min(460px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--ink);
}

.modal::backdrop {
  background: rgba(30, 27, 24, 0.36);
  backdrop-filter: blur(2px);
}

.modal-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 22px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 24px 60px rgba(30, 27, 24, 0.22);
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-head h2 {
  margin: 0;
  font-size: 17px;
}

.modal-status {
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fdfcfa;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  word-break: break-word;
}

.modal-status:empty {
  display: none;
}

.modal-status.ok {
  border-color: #d8ebdf;
  background: #eef7f1;
  color: var(--good);
}

.modal-status.bad {
  border-color: #f2dcd8;
  background: #fdf1ef;
  color: var(--bad);
}

.modal-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.modal-actions .link.danger {
  margin-right: auto;
}

.queue-dialog {
  width: min(760px, calc(100vw - 32px));
}

.queue-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.queue-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.queue-search {
  flex: 1 1 160px;
  min-width: 0;
  max-width: 240px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
}

.queue-search:focus {
  outline: none;
  border-color: var(--accent);
}

.queue-toolbar select {
  max-width: 280px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 12.5px;
  color: var(--ink);
}

.queue-list {
  display: grid;
  gap: 10px;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 4px;
}

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

.queue-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.queue-head b {
  font-size: 13.5px;
}

.queue-kind {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--line);
  font-size: 11px;
  color: var(--muted);
}

.queue-kind.is-dm {
  background: rgba(59, 130, 246, 0.12);
  color: #2563eb;
}

.queue-kind.is-comment {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
}

.queue-meta {
  margin-left: auto;
  font-size: 12px;
  color: var(--faint);
}

.queue-stale {
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(234, 88, 12, 0.12);
  color: #c2410c;
  font-size: 11px;
  white-space: nowrap;
}

.queue-actions .dm-linked {
  font-size: 12px;
  color: #2f7a3e;
}

.queue-source {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.55;
  color: var(--muted);
  word-break: break-word;
}

.queue-item textarea {
  min-height: 64px;
}

.queue-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.queue-empty {
  padding: 18px 0;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
}

.queue-empty-actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  margin-top: 8px;
}

.ai-draft-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.ai-draft-angle {
  min-height: 84px;
}

.ai-draft-preview {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffdfa;
  max-height: 320px;
  overflow: auto;
}

.ai-draft-field span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 4px;
}

.ai-draft-field p,
.ai-draft-field pre {
  margin: 0;
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
}

.ai-draft-note {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin: -2px 0 4px;
  padding: 8px 10px;
  border: 1px dashed #e2d6c4;
  border-radius: 10px;
  background: #fdf8ef;
  font-size: 12px;
  line-height: 1.6;
  color: #8a6a3a;
}

.ai-library-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid #e2d6c4;
  background: #fdf8ef;
  color: #8a6a3a;
  font-size: 10.5px;
  font-weight: 600;
  vertical-align: middle;
}

.thumb-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.thumb-tools select {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
  font-size: 13px;
}

.cover-field {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fdfcfa;
}

.cover-preview {
  width: 56px;
  height: 56px;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #fff;
  font-size: 11px;
  color: var(--faint);
}

.cover-preview.has {
  border-style: solid;
}

.cover-preview img,
.cover-preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-meta {
  flex: 1;
  min-width: 0;
}

.cover-meta .field-label {
  justify-content: flex-start;
  gap: 8px;
}

.cover-meta p {
  margin: 2px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--faint);
}

.cover-actions {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
}

.cover-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  max-height: 360px;
  overflow: auto;
}

.cover-option {
  position: relative;
  aspect-ratio: 1;
  padding: 0;
  overflow: hidden;
  border: 2px solid transparent;
  border-radius: 12px;
  background: #f7f4f0;
  cursor: pointer;
}

.cover-option img,
.cover-option video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.cover-option.selected {
  border-color: var(--accent);
}

.cover-option-badge {
  position: absolute;
  left: 6px;
  top: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  background: rgba(30, 27, 24, 0.72);
  color: #fff;
  font-size: 10.5px;
  line-height: 1.6;
}

.cover-option-time {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(30, 27, 24, 0.55);
  color: #fff;
  font-size: 10px;
  line-height: 1.6;
}

.cover-empty {
  grid-column: 1 / -1;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  color: var(--faint);
  font-size: 13px;
  text-align: center;
}

.ratio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: center;
  gap: 14px;
  margin: 4px 0 2px;
}

.ratio-item {
  margin: 0;
  min-width: 0;
}

.ratio-frame {
  position: relative;
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f4f1ec;
}

.ratio-frame[data-ratio="xhs"] {
  aspect-ratio: 3 / 4;
}

.ratio-frame[data-ratio="wechat"] {
  aspect-ratio: 2.35 / 1;
}

.ratio-frame[data-ratio="douyin"] {
  aspect-ratio: 9 / 16;
}

.ratio-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
}

.ratio-caption {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 5px 7px 4px;
  background: linear-gradient(to top, rgba(30, 27, 24, 0.82), rgba(30, 27, 24, 0.3));
  color: #fff;
  font-size: 10.5px;
  line-height: 1.4;
}

.ratio-caption b {
  font-weight: 600;
  white-space: nowrap;
}

.ratio-caption b.tight {
  color: #ffb7ad;
}

.ratio-frame[data-ratio="wechat"] .ratio-caption {
  gap: 4px;
  padding: 3px 5px;
  font-size: 9.5px;
}

.ratio-tip {
  margin: 12px 0 0;
  padding: 9px 11px;
  border: 1px solid #f0dcc0;
  border-radius: 10px;
  background: #fdf7ee;
  font-size: 12px;
  line-height: 1.6;
  color: var(--mid);
}

.ratio-save {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  margin-top: 7px;
  padding-left: 4px;
  padding-right: 4px;
  font-size: 11.5px;
  white-space: nowrap;
}

.ratio-save-state {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--mid);
}

.ratio-save-state.bad {
  color: #b4382c;
}

.ratio-card {
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.preflight-card {
  max-height: calc(100vh - 32px);
}

.preflight-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
}

.pf-item {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.pf-item b {
  font-size: 13px;
  font-weight: 600;
}

.pf-item p {
  margin: 2px 0 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
}

.pf-tag {
  flex: none;
  padding: 0 7px;
  border-radius: 999px;
  background: #f1f0ed;
  color: var(--mid);
  font-size: 10.5px;
  line-height: 1.7;
}

.pf-item.block {
  border-color: #f0c9c1;
  background: #fdf5f3;
}

.pf-item.block .pf-tag {
  background: #b4382c;
  color: #fff;
}

.pf-item.warn {
  border-color: #f0dcc0;
  background: #fdf7ee;
}

.pf-item.warn .pf-tag {
  background: #b7791f;
  color: #fff;
}

.pf-item.ok .pf-tag {
  background: #2f7a4f;
  color: #fff;
}

#packageDialog {
  width: min(860px, calc(100vw - 32px));
}

.package-card {
  max-height: calc(100vh - 32px);
}

.package-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
}

.pkg-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.pkg-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.pkg-head h3 {
  margin: 0;
  font-size: 14px;
}

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

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

.pkg-pub.done {
  color: var(--good);
  font-weight: 600;
}

.pkg-field {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 8px;
  margin-top: 10px;
}

.pkg-field > span {
  padding-top: 2px;
  font-size: 12px;
  color: var(--faint);
}

.pkg-field p {
  margin: 0;
  font-size: 13px;
  line-height: 1.65;
  word-break: break-word;
}

.pkg-field pre {
  max-height: 160px;
  margin: 0;
  padding: 8px 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fdfcfa;
  font: inherit;
  font-size: 12.5px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.pkg-assets {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  font-size: 12px;
}

.pkg-missing {
  color: var(--faint);
}

.pkg-tip {
  margin-left: auto;
  color: var(--mid);
}

.pkg-notes {
  margin: 10px 0 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted);
}

.pkg-storyboard {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fdfcfa;
}

.pkg-storyboard-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.pkg-storyboard-head h3 {
  margin: 0;
  font-size: 14px;
}

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

.pkg-storyboard summary {
  margin-top: 8px;
  cursor: pointer;
  font-size: 12.5px;
  color: var(--muted);
}

.pkg-storyboard-audit {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--muted);
}

.pkg-storyboard-audit.warn {
  color: var(--bad);
}

.pkg-storyboard pre {
  max-height: 220px;
  margin: 8px 0 0;
  padding: 10px 12px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font: inherit;
  font-size: 12px;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}

.lib-cover {
  width: 34px;
  height: 34px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  object-fit: cover;
}

.model-status {
  margin: 10px 0 14px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fdfcfa;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
  word-break: break-word;
}

.model-status.ok {
  border-color: #d8ebdf;
  background: #eef7f1;
  color: var(--good);
}

.model-status.bad {
  border-color: #f2dcd8;
  background: #fdf1ef;
  color: var(--bad);
}

.asset-prompt {
  min-height: 108px;
}

.asset-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.asset-actions .btn {
  flex: 1;
}

.asset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.asset-card {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.asset-thumb {
  position: relative;
  aspect-ratio: 4 / 3;
  background: #f7f4f0;
}

.asset-thumb img,
.asset-thumb video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.ai-badge {
  position: absolute;
  left: 8px;
  top: 8px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(30, 27, 24, 0.72);
  color: #fff;
  font-size: 11px;
  line-height: 1.6;
  letter-spacing: 0.04em;
}

.asset-pending {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
}

.asset-pending b {
  font-size: 13px;
  color: var(--ink);
}

.asset-pending.bad b {
  color: var(--bad);
}

.asset-pending small {
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--faint);
  word-break: break-word;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2px solid #e8e2db;
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: asset-spin 0.9s linear infinite;
}

@keyframes asset-spin {
  to {
    transform: rotate(360deg);
  }
}

.asset-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px 12px;
}

.asset-prompt-text {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.asset-sub {
  margin: 0;
  font-size: 11.5px;
  color: var(--faint);
  word-break: break-word;
}

.asset-card-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 2px;
}

.asset-card-actions .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  font-size: 12px;
  text-decoration: none;
}

.asset-card-actions .link.danger {
  margin-left: auto;
}

.asset-empty {
  grid-column: 1 / -1;
  min-height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: #fdfcfa;
  color: var(--faint);
  font-size: 13px;
  text-align: center;
}

.video-source {
  display: flex;
  justify-content: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fdfcfa;
}

.video-source img {
  width: 100%;
  height: 180px;
  object-fit: contain;
  border-radius: 8px;
}

.video-prompt {
  min-height: 76px;
}

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

.still-stage {
  display: flex;
  justify-content: center;
  background: #12100f;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}

.still-stage video {
  width: 100%;
  max-height: 46vh;
  min-height: 160px;
  object-fit: contain;
  background: #12100f;
}

#stillRange {
  width: 100%;
  cursor: pointer;
  accent-color: var(--accent);
}

.still-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
}

.still-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.asset-head-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.card-dialog {
  width: min(860px, calc(100vw - 32px));
}

.card-maker-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 16px;
  align-items: start;
}

.card-maker-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.card-maker-form textarea {
  min-height: 0;
  height: 76px;
  line-height: 1.7;
}

.card-maker-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.card-maker-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f7f4f0;
}

.card-maker-preview canvas {
  display: block;
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 56vh;
  border-radius: 10px;
  box-shadow: 0 10px 26px rgba(30, 27, 24, 0.18);
}

.batch-dialog {
  width: min(640px, calc(100vw - 32px));
}

.batch-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 34vh;
  overflow-y: auto;
  padding-right: 2px;
}

.batch-empty {
  padding: 18px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fdfcfa;
  color: var(--faint);
  font-size: 13px;
  text-align: center;
}

.batch-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
}

.batch-item input {
  width: 16px;
  height: 16px;
  flex: none;
  accent-color: var(--accent);
}

.batch-item img {
  width: 48px;
  height: 48px;
  flex: none;
  border-radius: 8px;
  object-fit: cover;
  background: #f7f4f0;
}

.batch-item-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.batch-item-text b {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
}

.batch-item-text small {
  font-size: 11px;
  color: var(--faint);
}

.storyboard-dialog {
  width: min(680px, calc(100vw - 32px));
}

.storyboard-controls {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px 16px;
}

.storyboard-controls .field {
  width: 190px;
}

.storyboard-regen {
  padding-bottom: 9px;
  font-size: 12.5px;
}

.storyboard-undo {
  padding-bottom: 9px;
  font-size: 12.5px;
}

.storyboard-undo:disabled {
  opacity: 0.4;
  cursor: default;
}

.storyboard-summary {
  margin: 0 0 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.storyboard-rate {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  margin: 0 0 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.storyboard-rate[hidden] {
  display: none;
}

.storyboard-rate button {
  font-size: 12.5px;
}

.storyboard-shoot-tools {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 16px;
  margin: 0 0 2px;
  font-size: 12.5px;
  color: var(--muted);
}

.storyboard-shoot-tools[hidden],
.storyboard-shoot-tools .link[hidden] {
  display: none;
}

.storyboard-filter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.storyboard-filter input {
  width: 14px;
  height: 14px;
  margin: 0;
  accent-color: var(--accent);
}

.storyboard-shoot-tools .link {
  font-size: 12.5px;
}

.storyboard-scenes {
  flex-basis: 100%;
  margin: 0 0 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.storyboard-scenes[hidden] {
  display: none;
}

.storyboard-scenes summary {
  cursor: pointer;
}

.storyboard-scene-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 132px;
  margin: 6px 0;
  overflow-y: auto;
}

.story-scene-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 10px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fdfcfa;
}

.story-scene-row .story-scene-name {
  flex: 1 1 130px;
  min-width: 0;
  color: var(--text);
}

.story-scene-rename {
  flex: none;
  font-size: 12px;
}

.story-scene-rename-input {
  width: 100%;
  min-width: 0;
  padding: 4px 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  font: inherit;
  font-size: 12.5px;
  color: var(--text);
}

.story-scene-rename-input:focus {
  outline: none;
  border-color: var(--accent);
}

.story-scene-edit-actions {
  display: flex;
  flex: none;
  gap: 8px;
}

.story-scene-edit-actions button {
  font-size: 12px;
}

.story-scene-row b {
  font-weight: 600;
  color: var(--accent-dark);
}

.story-scene-row em {
  flex: none;
  font-style: normal;
  font-size: 11.5px;
  color: var(--faint);
}

.story-scene-row small {
  color: var(--faint);
}

.storyboard-scene-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 14px;
  margin-top: 2px;
}

.storyboard-audit {
  flex-basis: 100%;
  margin: 0 0 6px;
  font-size: 12.5px;
  color: var(--muted);
}

.storyboard-audit[hidden] {
  display: none;
}

.storyboard-audit summary {
  cursor: pointer;
}

.storyboard-audit-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 112px;
  margin: 4px 0 0;
  overflow-y: auto;
}

.storyboard-audit-body[hidden] {
  display: none;
}

.audit-item {
  text-align: left;
  font-size: 12.5px;
  line-height: 1.5;
}

.story-flag {
  flex: none;
  padding: 0 6px;
  border-radius: 999px;
  background: #fff1ee;
  color: var(--bad);
  font-size: 11px;
  font-weight: 600;
}

.story-shot-flag {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.storyboard-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 160px;
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 2px;
}

.storyboard-exports {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 16px;
  justify-content: flex-end;
  margin-top: 10px;
  font-size: 12.5px;
}

.shot-image-dialog .modal-card {
  width: min(980px, 100%);
}

.shot-image-controls {
  display: flex;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-bottom: 10px;
}

.shot-image-controls .field {
  margin: 0;
  min-width: 150px;
}

.shot-image-summary {
  flex: 1 1 200px;
  margin: 0;
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.shot-image-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 140px;
  max-height: 52vh;
  overflow-y: auto;
  padding-right: 2px;
}

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

.shot-image-row-off {
  opacity: 0.6;
}

.shot-image-index {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
}

.shot-image-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.shot-image-meta {
  font-size: 11.5px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.shot-image-prompt {
  width: 100%;
  min-height: 44px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fdfcfa;
  font: inherit;
  font-size: 12.5px;
  line-height: 1.55;
  resize: vertical;
}

.shot-image-state {
  font-size: 11.5px;
  color: var(--faint);
  white-space: nowrap;
}

.shot-image-state.running {
  color: var(--accent);
}

.shot-image-state.done {
  color: var(--good);
}

.shot-image-state.failed {
  color: var(--bad);
}

.shot-image-state.stopped {
  color: #a16207;
}

.story-shot {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.story-shot-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--faint);
}

.story-shot-head b {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  color: var(--accent);
}

.story-shot-head .story-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11.5px;
  color: var(--muted);
}

.story-seconds {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11.5px;
  color: var(--faint);
}

.story-seconds input {
  width: 48px;
  padding: 2px 4px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fdfcfa;
  font: inherit;
  font-size: 12px;
  color: var(--text);
  text-align: center;
}

.story-seconds input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}

.story-done {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted);
  cursor: pointer;
}

.story-done input {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.story-shot-done {
  border-color: #cfe3d2;
  background: #fbfdfb;
}

.story-field {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.story-field-label {
  flex: none;
  width: 30px;
  padding-top: 6px;
  font-size: 11.5px;
  color: var(--faint);
}

.story-voice-input,
.story-sub-input,
.story-scene-input,
.story-note-input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fdfcfa;
  font: inherit;
  font-size: 13px;
  line-height: 1.6;
  color: var(--text);
  resize: vertical;
}

.story-voice-input {
  min-height: 52px;
}

.story-sub-input,
.story-scene-input,
.story-note-input {
  font-size: 12.5px;
}

.story-voice-input:focus,
.story-sub-input:focus,
.story-scene-input:focus,
.story-note-input:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
}

.story-shot-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-top: 2px;
  font-size: 12px;
}

.story-shot-actions button:disabled {
  opacity: 0.4;
  cursor: default;
}

.story-empty {
  padding: 22px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  background: #fdfcfa;
  color: var(--faint);
  font-size: 13px;
  text-align: center;
}

.hotspot-layout {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px 56px;
  display: grid;
  grid-template-columns: minmax(340px, 440px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.hotspot-left {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.hint-inline {
  font-size: 11.5px;
  color: var(--faint);
}

.hotspot-head-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.hotspot-edit-hint {
  color: var(--accent-dark);
}

.hotspot-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 10px;
}

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

.hotspot-ref-input {
  min-height: 130px;
}

.hotspot-angle {
  min-height: 92px;
}

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

.hotspot-form-actions .hint {
  flex: 1 1 200px;
  margin: 0;
}

.hotspot-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-bottom: 12px;
  margin: 10px 0 12px;
  border-bottom: 1px solid var(--line);
}

.hotspot-tools input[type="search"] {
  flex: 1 1 180px;
  min-width: 0;
  padding: 8px 12px;
  font-size: 13px;
}

.hotspot-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 680px;
  overflow-y: auto;
}

.hotspot-item {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fdfcfa;
}

.hotspot-item.busy {
  opacity: 0.65;
}

.hotspot-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.hotspot-platform {
  font-size: 12px;
  color: var(--muted);
}

.hotspot-head select {
  width: auto;
  flex: none;
  padding: 4px 8px;
  font-size: 12px;
}

.hotspot-date {
  margin-left: auto;
  font-size: 11px;
  color: var(--faint);
}

.hotspot-keyword {
  margin: 8px 0 0;
  font-size: 15px;
  line-height: 1.5;
  word-break: break-word;
}

.hotspot-meta,
.hotspot-ref,
.hotspot-note {
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--muted);
  word-break: break-word;
}

.hotspot-meta {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hotspot-note a {
  color: var(--accent-dark);
  word-break: break-all;
}

.hotspot-used {
  font-size: 11.5px;
  color: var(--accent-dark);
}

.hotspot-result {
  margin-top: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f6f8f4;
  font-size: 12px;
  line-height: 1.6;
}

.hotspot-result-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.hotspot-result-label {
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11.5px;
}

.hotspot-result-head a {
  color: var(--accent-dark);
  word-break: break-all;
}

.hotspot-result-note {
  margin: 4px 0 0;
  color: var(--muted);
  word-break: break-word;
}

.hotspot-result-form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding: 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #fdfcfa;
}

.hotspot-result-form textarea {
  min-height: 70px;
}

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

.hotspot-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
}

.hotspot-empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--faint);
  font-size: 13px;
}

.badge.heat-high {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.badge.heat-mid {
  background: #fdf3e3;
  color: var(--mid);
}

.badge.heat-low {
  background: #f1efec;
  color: #6f6862;
}

.badge.ai {
  background: #eef3fb;
  color: #2f5e9e;
}

.badge.local {
  background: #f1efec;
  color: #6f6862;
}

.hotspot-draft-title {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.5;
  word-break: break-word;
}

.hotspot-draft-body {
  margin: 8px 0 0;
  padding: 12px;
  max-height: 280px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fdfcfa;
  font: inherit;
  font-size: 12.5px;
  line-height: 1.8;
  white-space: pre-wrap;
  word-break: break-word;
}

.hotspot-draft-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.angle-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.angle-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fdfcfa;
}

.angle-head {
  font-size: 13.5px;
  color: var(--accent-dark);
}

.angle-hook {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  font-weight: 600;
  word-break: break-word;
}

.angle-audience,
.angle-platform {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.angle-structure {
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.65;
  color: #4a443f;
}

.angle-structure li + li {
  margin-top: 2px;
}

.angle-note {
  margin: 0;
  padding: 6px 8px;
  border-radius: 8px;
  background: #fdf3e3;
  color: var(--mid);
  font-size: 12px;
  line-height: 1.5;
}

.angle-card .btn {
  margin-top: auto;
  align-self: flex-start;
}

.angle-compare {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}

.variant-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.variant-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fdfcfa;
}

.variant-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--accent-dark);
}

.variant-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.5;
  word-break: break-word;
}

.variant-body {
  margin: 0;
  padding: 10px;
  max-height: 180px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font: inherit;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.variant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.review-dialog {
  width: min(620px, calc(100vw - 32px));
}

.review-card {
  max-height: calc(100vh - 32px);
}

.review-platforms {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

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

.review-platform-chip {
  padding: 1px 8px;
  border-radius: 999px;
  background: #f1f0ed;
  color: var(--mid);
  font-size: 11.5px;
  line-height: 1.8;
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: auto;
}

.review-item {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.review-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.review-platform {
  font-size: 12px;
  color: var(--muted);
}

.review-keyword {
  font-size: 13.5px;
  color: var(--ink);
  word-break: break-word;
}

.review-date {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--faint);
  white-space: nowrap;
}

.review-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 12.5px;
  color: var(--accent-dark);
  word-break: break-all;
}

.review-note {
  margin: 6px 0 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: #4a443f;
  word-break: break-word;
  white-space: pre-wrap;
}

.review-note.muted {
  color: var(--faint);
}

.review-angle {
  margin: 6px 0 0;
  font-size: 12px;
  line-height: 1.55;
  color: var(--muted);
  word-break: break-word;
}

.review-edit {
  margin-top: 8px;
}

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

  .dm-form-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .results {
    min-height: 320px;
  }

  .toolbar {
    flex-wrap: wrap;
  }

  .toolbar input[type="search"] {
    flex-basis: 100%;
  }

  .lib-item {
    flex-direction: column;
  }

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

@media (max-width: 600px) {
  .topbar {
    padding: 18px 16px 14px;
    gap: 12px;
  }

  .topbar-meta {
    display: none;
  }

  .topbar-meta.is-account {
    display: flex;
    order: 3;
    width: 100%;
    justify-content: flex-end;
    padding: 6px 10px;
    gap: 10px;
    flex-wrap: wrap;
    row-gap: 6px;
  }

  .topbar-meta.is-account .account-chip {
    max-width: 48vw;
    overflow: hidden;
  }

  .topbar-meta.is-account #accountName {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar-meta.is-account .account-role {
    flex: none;
    white-space: nowrap;
  }

  .topbar-meta.is-account .dot,
  .topbar-meta.is-account .meta-text {
    display: none;
  }

  .mainnav {
    width: 100%;
    justify-content: space-between;
  }

  .mainnav .nav-item {
    flex: 1;
    justify-content: center;
    padding: 7px 3px;
    font-size: 12px;
    white-space: nowrap;
  }

  .video-options {
    grid-template-columns: 1fr;
  }

  .card-maker-body {
    grid-template-columns: 1fr;
  }

  .card-maker-preview canvas {
    max-height: 38vh;
  }

  .batch-list {
    max-height: 24vh;
  }

  .storyboard-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .storyboard-controls .field {
    width: 100%;
  }

  .storyboard-regen,
  .storyboard-undo {
    align-self: flex-start;
    padding-bottom: 0;
  }

  .storyboard-list {
    flex: none;
    max-height: 38vh;
  }

  .story-shot-actions {
    gap: 4px 10px;
  }

  .cover-field {
    flex-wrap: wrap;
  }

  .cover-actions {
    width: 100%;
    justify-content: flex-end;
  }

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

  .ai-draft-row {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .shot-image-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .shot-image-controls .field {
    width: 100%;
  }

  .shot-image-summary {
    flex: 0 0 auto;
  }

  .shot-image-dialog .modal-actions {
    flex-wrap: wrap;
    justify-content: flex-start;
  }

  .shot-image-list {
    max-height: 42vh;
  }

  .shot-image-row {
    grid-template-columns: auto auto minmax(0, 1fr);
  }

  .shot-image-state {
    grid-column: 2 / -1;
    justify-self: start;
  }

  .ratio-item:nth-child(1) {
    grid-column: 1;
    grid-row: 1;
  }

  .ratio-item:nth-child(3) {
    grid-column: 2;
    grid-row: 1;
  }

  .ratio-item:nth-child(2) {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .ratio-frame[data-ratio="wechat"] .ratio-caption {
    gap: 6px;
    padding: 5px 7px 4px;
    font-size: 10.5px;
  }

  .layout {
    padding: 0 16px 40px;
  }

  .hotspot-layout {
    padding: 0 16px 40px;
  }

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

  .hotspot-tools input[type="search"] {
    flex-basis: 100%;
  }

  .hotspot-list {
    max-height: none;
  }

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

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

  .review-date {
    margin-left: 0;
  }

  .today-board {
    padding: 0 16px;
    margin-bottom: 14px;
  }

  .today-inner {
    padding: 12px 14px 14px;
    border-radius: 16px;
  }

  .today-head h2 span {
    display: block;
    margin: 2px 0 0;
  }

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

  .today-grid .today-item:last-child {
    grid-column: span 2;
  }

  .today-item {
    padding: 9px 11px;
  }

  .card {
    padding: 18px;
    border-radius: 16px;
  }

  .toolbar {
    padding: 12px;
  }

  .engage-bar {
    padding: 0 16px 12px;
  }

  .engage-bar .queue-open {
    flex: 1 1 auto;
    justify-content: center;
  }

  .queue-list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .queue-toolbar select {
    max-width: none;
    width: 100%;
  }

  .queue-search {
    flex: 1 1 100%;
    max-width: none;
  }

  .segments {
    display: flex;
    width: 100%;
    gap: 2px;
    overflow-x: auto;
  }

  .seg {
    flex: none;
    padding: 7px 10px;
    font-size: 13px;
  }

  .comment-wrap {
    padding: 0 16px 40px;
  }

  .account-form.account-profile {
    grid-template-columns: minmax(0, 1fr);
  }

  .account-form.account-profile .btn {
    justify-self: end;
  }

  .var-row {
    grid-template-columns: 1fr;
  }

  .tpl-tools {
    flex-wrap: wrap;
  }

  .tpl-tools input[type="search"] {
    flex-basis: 100%;
  }

  .comment-actions .hint {
    margin-left: 0;
    flex-basis: 100%;
  }

  .comment-toolbar input[type="search"] {
    flex-basis: 100%;
  }

  .lead-sort {
    flex-basis: 100%;
    width: 100%;
  }

  .lead-view-toggle {
    flex-basis: 100%;
    justify-content: center;
  }

  .lead-bulk-next {
    flex-basis: 100%;
  }

  .lead-form-row {
    grid-template-columns: 1fr;
  }

  .dm-form-row {
    grid-template-columns: 1fr;
  }

  .workflow-steps {
    grid-template-columns: 1fr;
  }

  .workflow-date {
    flex-basis: 100%;
  }

  .workflow-card .card-head {
    flex-wrap: wrap;
    gap: 4px 12px;
  }

  .workflow-card .card-head h2 {
    white-space: nowrap;
  }

  .workflow-time {
    flex-basis: 100%;
    justify-content: space-between;
  }

  .workflow-schedule .workflow-status {
    flex-basis: 100%;
  }

  .brief-action {
    flex-wrap: wrap;
  }

  .brief-action .link {
    margin-left: auto;
  }

  .dm-form-actions .hint {
    flex-basis: 100%;
    margin-left: 0;
  }

  .dm-draft-head {
    flex-wrap: wrap;
  }

  .dm-toolbar input[type="search"] {
    flex-basis: 100%;
  }

  #panel-dm-inbox .card-head {
    flex-wrap: wrap;
    gap: 6px;
  }

  #panel-dm-inbox .card-head h2 {
    flex-basis: 100%;
  }

  #panel-dm-inbox .card-head .head-actions {
    margin-left: auto;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .dm-intent {
    margin-left: 0;
  }

  .dm-time {
    flex-basis: 100%;
  }

  .dm-batch-platform {
    flex-basis: 100%;
  }

  .dm-batch-item-head select,
  .dm-batch-item-head input {
    flex-basis: 100%;
  }

  .dm-batch-item-head .link {
    margin-left: auto;
  }

  .lead-meta .link {
    margin-left: 0;
  }

  .comment-row {
    flex-wrap: wrap;
  }

  .comment-status-filters {
    padding-left: 0;
    border-left: 0;
    width: 100%;
  }

  .comment-mini-actions {
    flex-basis: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    padding-left: 62px;
  }

  .lead-date {
    flex-basis: 100%;
    margin-left: 0;
  }

  .lead-head select {
    flex: 1;
  }

  #panel-leads .card-head {
    flex-wrap: wrap;
    gap: 6px;
  }

  #panel-leads .card-head h2 {
    flex-basis: 100%;
  }

  #panel-leads .card-head .head-actions {
    margin-left: auto;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .lead-insights-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .lead-insights-grid {
    grid-template-columns: 1fr;
  }

  .lead-insights-wide {
    grid-column: auto;
  }

  .lead-insights-name {
    max-width: 110px;
  }

  .lead-insights-bar-row {
    grid-template-columns: 54px minmax(0, 1fr) 58px;
    gap: 6px;
  }

  .lead-plan-search-row {
    flex-wrap: wrap;
  }

  .lead-plan-search {
    flex-basis: 100%;
  }

  .lead-plan-search-row .btn {
    margin-left: auto;
  }

  .lead-plan-activity-item {
    grid-template-columns: 74px minmax(0, 1fr);
  }

  .lead-plan-activity-text {
    grid-column: 1 / -1;
    white-space: normal;
  }

  .lead-plan-open {
    grid-template-columns: 56px minmax(0, 1fr) auto;
    gap: 6px;
    padding: 8px 4px 8px 8px;
  }

  .lead-plan-actions {
    gap: 4px;
    padding-right: 8px;
  }

  .lead-plan-action {
    padding: 2px 6px;
  }

  .lead-plan-status {
    display: none;
  }

  .lead-batch-row {
    grid-template-columns: 50px minmax(0, 1fr) auto;
    gap: 2px 6px;
    padding: 8px;
  }

  .pkg-field {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .pkg-tip {
    flex-basis: 100%;
    margin-left: 0;
  }

  .toolbar select {
    min-width: 0;
    flex: 1;
  }

  .results-head {
    flex-direction: column-reverse;
    align-items: flex-start;
    gap: 10px;
  }

  .result-head {
    flex-direction: column;
    gap: 10px;
  }

  .result-actions {
    flex-wrap: wrap;
    width: 100%;
  }

  .calendar-card {
    padding: 16px 12px;
  }

  .cal-cell {
    min-height: 70px;
    padding: 4px;
  }

  .cal-chip {
    font-size: 10.5px;
    padding: 2px 5px;
  }

  .cal-list-head {
    flex-wrap: wrap;
  }

  .cal-list-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .cal-list-tools {
    align-items: flex-start;
  }

  .cal-list-row {
    grid-template-columns: 74px minmax(0, 1fr) auto;
    gap: 6px;
    padding: 8px 2px;
  }

  .cal-week {
    font-size: 11px;
  }

  .rules-head {
    flex-direction: column;
    gap: 14px;
  }

  .rules-actions {
    width: 100%;
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .rule-head {
    flex-direction: column;
    gap: 6px;
  }

  .rule-builtin {
    text-align: left;
  }

  .custom-rule-head select {
    flex: 1 1 96px;
  }

  .auto-item-foot {
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
  }

  .auto-item-foot .auto-go {
    margin-left: 0;
  }

  textarea {
    min-height: 220px;
  }

  .body-text {
    max-height: 340px;
  }
}

/* 账号体系 */
.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.account-role {
  padding: 0 6px;
  border-radius: 999px;
  background: #f7f4ef;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
}

#accountDialog {
  width: min(580px, calc(100vw - 32px));
}

.account-card {
  width: 100%;
}

.account-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.account-section h3 {
  margin: 0;
  font-size: 14px;
}

.account-section .hint {
  margin: 0;
}

.account-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  align-items: center;
}

.account-form > * {
  min-width: 0;
}

.account-form .btn {
  grid-column: 1 / -1;
  justify-self: end;
}

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

.account-profile {
  grid-template-columns: minmax(0, 1fr) auto;
}

.account-profile .btn {
  grid-column: auto;
}

.account-form input,
.account-form select {
  font-size: 13px;
  padding: 9px 11px;
}

.account-form .btn {
  white-space: nowrap;
}

.user-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
}

.user-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fdfcfa;
}

.user-row.is-disabled {
  opacity: 0.6;
}

.user-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-right: auto;
  min-width: 180px;
}

.user-main strong {
  font-size: 13.5px;
}

.user-meta {
  font-size: 11.5px;
  color: var(--muted);
}

.user-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
}

.user-actions .link {
  font-size: 12px;
}

.user-reset {
  display: flex;
  flex: 1 1 100%;
  align-items: center;
  gap: 8px;
}

.user-reset input {
  flex: 1;
  min-width: 0;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  overflow-y: auto;
  background:
    radial-gradient(900px 420px at 82% -8%, #ffe3e7 0%, transparent 60%),
    var(--bg);
}

body.auth-locked {
  overflow: hidden;
}

.auth-card {
  width: min(400px, 100%);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px 26px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--panel);
  box-shadow: 0 30px 70px rgba(30, 27, 24, 0.16);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-brand h2 {
  margin: 0;
  font-size: 19px;
}

.auth-brand p {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.auth-card > h3 {
  margin: 4px 0 0;
  font-size: 16px;
}

.auth-hint {
  margin: 0;
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--muted);
}

.auth-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-card input {
  padding: 11px 13px;
}

.auth-submit {
  width: 100%;
  padding: 12px;
  font-size: 14px;
}

.auth-error {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid #f2dcd8;
  border-radius: 10px;
  background: #fdf1ef;
  font-size: 12.5px;
  color: var(--bad);
}

.auth-foot {
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  font-size: 11.5px;
  line-height: 1.6;
  color: var(--muted);
}

.audit-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.audit-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 220px;
  overflow-y: auto;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbf8f5;
}

.audit-row {
  display: flex;
  gap: 10px;
  align-items: baseline;
  font-size: 12px;
  line-height: 1.55;
}

.audit-time {
  flex: 0 0 auto;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.audit-main {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.audit-note {
  display: block;
  color: var(--muted);
}

@media (max-width: 600px) {
  #accountDialog {
    width: calc(100vw - 24px);
  }

  .account-card {
    width: 100%;
    padding: 18px 16px;
  }

  .account-form,
  .account-create {
    grid-template-columns: 1fr 1fr;
  }

  .account-form .btn {
    grid-column: span 2;
  }

  .user-main {
    min-width: 0;
    flex: 1 1 100%;
  }

  .audit-list {
    max-height: none;
  }

  .auth-card {
    padding: 24px 20px;
  }
}

@media (max-width: 340px) {
  .mainnav {
    gap: 2px;
  }

  .mainnav .nav-item {
    padding: 7px 2px;
    font-size: 11px;
  }
}
