:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --panel: #ffffff;
  --line: #dfe3ea;
  --line-strong: #c8ced8;
  --text: #18202c;
  --muted: #657182;
  --accent: #2367e8;
  --accent-dark: #174db4;
  --success: #138a5b;
  --danger: #b42318;
  --shadow: 0 18px 48px rgba(22, 34, 51, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

.cot-shell {
  min-height: 100vh;
  padding: 28px;
}

.cot-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  max-width: 1280px;
  margin: 0 auto 20px;
}

.cot-kicker {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 32px;
  line-height: 1.04;
}

h2 {
  margin-bottom: 6px;
  font-size: 18px;
}

h3 {
  margin-bottom: 0;
  font-size: 14px;
}

.cot-status {
  min-width: 170px;
  color: var(--muted);
  text-align: right;
  font-size: 14px;
}

.cot-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 18px;
  max-width: 1280px;
  margin: 0 auto;
}

.cot-main,
.cot-preview {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.cot-main {
  min-width: 0;
}

.cot-toolbar,
.cot-settings,
.cot-actions,
.cot-preview {
  padding: 20px;
}

.cot-toolbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
}

.cot-toolbar p,
.cot-preview p {
  color: var(--muted);
  margin-bottom: 0;
}

.cot-settings {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  border-bottom: 1px solid var(--line);
}

.cot-widget-description {
  grid-column: 1 / -1;
}

.cot-widget-description textarea {
  min-height: 64px;
}

.cot-access-rule {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(190px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.cot-access-rule p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.cot-switch {
  position: relative;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  white-space: nowrap;
}

.cot-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  opacity: 0;
}

.cot-switch-track {
  width: 40px;
  height: 22px;
  flex: 0 0 40px;
  padding: 2px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #e8ebf0;
  transition: background 140ms ease, border-color 140ms ease;
}

.cot-switch-track i {
  display: block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(24, 32, 44, 0.24);
  transition: transform 140ms ease;
}

.cot-switch input:checked + .cot-switch-track {
  border-color: var(--accent);
  background: var(--accent);
}

.cot-switch input:checked + .cot-switch-track i {
  transform: translateX(18px);
}

.cot-switch input:focus-visible + .cot-switch-track {
  box-shadow: 0 0 0 3px rgba(35, 103, 232, 0.16);
}

.cot-access-threshold {
  transition: opacity 140ms ease;
}

.cot-access-rule.is-disabled .cot-access-threshold {
  opacity: 0.44;
}

.cot-branding {
  display: grid;
  grid-column: 1 / -1;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.cot-branding-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.cot-text-button {
  padding: 5px 0;
  border: 0;
  background: transparent;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.cot-theme-presets {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.cot-theme-preset {
  display: flex;
  min-width: 0;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: #384253;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
}

.cot-theme-preset:hover {
  border-color: var(--line-strong);
  background: #f8fafc;
}

.cot-theme-preset[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(35, 103, 232, 0.11);
}

.cot-theme-swatches {
  display: flex;
  flex: 0 0 auto;
}

.cot-theme-swatches i {
  width: 15px;
  height: 15px;
  border: 1px solid rgba(24, 32, 44, 0.16);
  border-radius: 50%;
}

.cot-theme-swatches i + i {
  margin-left: -4px;
}

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

.cot-color-control {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 7px;
}

.cot-color-control input[type="color"] {
  width: 42px;
  min-height: 40px;
  padding: 4px;
  border-radius: 7px;
  cursor: pointer;
}

.cot-color-control input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.cot-color-control input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 4px;
}

.cot-color-control input[type="text"] {
  min-width: 0;
  text-transform: uppercase;
}

label {
  display: grid;
  gap: 7px;
  color: #384253;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #fff;
  color: var(--text);
  padding: 10px 11px;
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(35, 103, 232, 0.13);
}

.cot-button {
  border: 0;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  padding: 10px 14px;
  font-weight: 750;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease;
}

.cot-button:hover {
  background: var(--accent-dark);
  transform: translateY(-1px);
}

.cot-secondary {
  background: #eef2f7;
  color: #263244;
}

.cot-secondary:hover {
  background: #e1e7ef;
}

.cot-list {
  display: grid;
  gap: 10px;
  padding: 16px 18px 20px;
  background: #f8fafc;
}

.cot-list-head {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.cot-list-head h3,
.cot-list-head p {
  margin: 0;
}

.cot-list-head h3 {
  font-size: 14px;
}

.cot-list-head p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.cot-list-head .cot-button {
  min-width: 96px;
}

.cot-item {
  overflow: visible;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.cot-item.is-expanded {
  border-color: #b8c5d8;
  box-shadow: 0 8px 22px rgba(22, 34, 51, 0.07);
}

.cot-item-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  min-height: 68px;
  padding: 8px 10px 8px 12px;
}

.cot-item-toggle {
  display: grid;
  min-width: 0;
  grid-template-columns: 34px minmax(0, 1fr) auto 24px;
  align-items: center;
  gap: 11px;
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.cot-item-index {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: #edf3ff;
  color: var(--accent);
  font-weight: 800;
  font-size: 13px;
}

.cot-item-summary-copy {
  min-width: 0;
}

.cot-item-summary-copy strong,
.cot-item-summary-copy small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cot-item-summary-copy strong {
  font-size: 14px;
  line-height: 1.35;
}

.cot-item-summary-copy small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.cot-item-chevron {
  color: #68768a;
  font-size: 25px;
  line-height: 1;
  transition: transform 140ms ease;
}

.cot-item.is-expanded .cot-item-chevron {
  transform: rotate(90deg);
}

.cot-item-fields {
  display: block;
  padding: 0 24px 24px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.cot-item-fields[hidden] {
  display: none;
}

.cot-step-section {
  padding: 24px 0;
}

.cot-step-section + .cot-step-section {
  border-top: 1px solid #e6eaf0;
}

.cot-step-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 18px;
}

.cot-step-section-head h3,
.cot-instructions-head h3 {
  margin-top: 3px;
  font-size: 15px;
}

.cot-step-section-head p {
  max-width: 430px;
  margin: 1px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
}

.cot-section-eyebrow {
  display: block;
  color: var(--accent-dark);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.cot-step-primary {
  display: grid;
  grid-template-columns: minmax(220px, 0.85fr) minmax(280px, 1.15fr);
  gap: 16px;
}

.cot-step-primary textarea {
  min-height: 74px;
}

.cot-row {
  display: grid;
  grid-template-columns: minmax(230px, 0.75fr) minmax(300px, 1.25fr);
  gap: 16px;
}

.cot-form-field {
  align-content: start;
  gap: 6px;
}

.cot-form-field > span,
.cot-visibility-field > span {
  color: #273245;
  font-size: 12px;
  font-weight: 800;
}

.cot-form-field > small,
.cot-visibility-field small {
  color: #778295;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
}

.cot-item-fields .cot-form-field input,
.cot-item-fields .cot-form-field select,
.cot-item-fields .cot-form-field textarea {
  min-height: 44px;
  border-color: #d5dce6;
  background: #fbfcfe;
  box-shadow: 0 1px 2px rgba(22, 34, 51, 0.03);
  transition: border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
}

.cot-item-fields .cot-form-field input:hover,
.cot-item-fields .cot-form-field select:hover,
.cot-item-fields .cot-form-field textarea:hover {
  border-color: #b8c3d1;
  background: #ffffff;
}

.cot-item-fields .cot-form-field input:focus,
.cot-item-fields .cot-form-field select:focus,
.cot-item-fields .cot-form-field textarea:focus {
  border-color: var(--accent);
  background: #ffffff;
}

.cot-target-editor,
.cot-target-label {
  min-width: 0;
}

.cot-combobox {
  position: relative;
}

.cot-combobox input[type="search"] {
  padding-right: 34px;
}

.cot-combobox-list {
  position: absolute;
  z-index: 20;
  top: calc(100% + 5px);
  right: 0;
  left: 0;
  max-height: 260px;
  overflow-y: auto;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #ffffff;
  box-shadow: 0 12px 28px rgba(22, 34, 51, 0.14);
}

.cot-combobox-option {
  display: block;
  width: 100%;
  min-height: 40px;
  padding: 10px 12px;
  border: 0;
  border-bottom: 1px solid #edf0f4;
  background: #ffffff;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.cot-combobox-option:last-child {
  border-bottom: 0;
}

.cot-combobox-option:hover,
.cot-combobox-option[aria-selected="true"] {
  background: #edf3ff;
  color: var(--accent-dark);
}

.cot-combobox-empty {
  padding: 14px 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}

.cot-field-notice {
  color: var(--danger);
  font-weight: 600;
  line-height: 1.4;
}

.cot-rule-row {
  display: grid;
  grid-template-columns: minmax(170px, 0.8fr) minmax(240px, 1.2fr) minmax(170px, 0.8fr);
  align-items: start;
  gap: 16px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid #e8ebf0;
}

.cot-visibility-field {
  display: grid;
  gap: 8px;
}

.cot-step-visibility {
  min-height: 44px;
  align-items: center;
  gap: 10px;
  white-space: normal;
}

.cot-step-visibility > span:last-child {
  display: grid;
  gap: 2px;
}

.cot-step-visibility strong {
  color: #273245;
  font-size: 12px;
  line-height: 1.2;
}

.cot-item-actions {
  display: flex;
  gap: 5px;
  align-items: center;
}

.cot-item-actions button {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: #526071;
  cursor: pointer;
}

.cot-item-actions button:hover {
  border-color: var(--line-strong);
  background: #f3f6fa;
  color: var(--text);
}

.cot-item-actions .cot-remove-item:hover {
  border-color: #efc0bc;
  background: #fff3f2;
  color: var(--danger);
}

.cot-instruction-status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 3px 8px;
  border: 1px solid #d7dde6;
  border-radius: 6px;
  background: #f5f7fa;
  color: #6b7789;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}

.cot-instruction-status.is-added {
  border-color: #a9d8c3;
  background: #edf9f3;
  color: #08734a;
}

.cot-instructions {
  display: grid;
  gap: 20px;
  margin: 0 -24px -24px;
  padding: 24px;
  border-top: 1px solid #dfe5ed;
  border-radius: 0 0 8px 8px;
  background: #f5f7fa;
}

.cot-instructions-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.cot-instructions-head > div {
  max-width: 700px;
}

.cot-instructions-head p {
  margin: 8px 0 0;
  color: #5d697a;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.6;
}

.cot-instruction-flow {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid #dfe5ed;
  border-bottom: 1px solid #dfe5ed;
}

.cot-instruction-flow > div {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: start;
  gap: 9px;
  padding: 14px 16px;
}

.cot-instruction-flow > div:first-child {
  padding-left: 0;
}

.cot-instruction-flow > div + div {
  border-left: 1px solid #dfe5ed;
}

.cot-instruction-flow > div > span {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #e4ecfb;
  color: var(--accent-dark);
  font-size: 11px;
  font-weight: 850;
}

.cot-instruction-flow p,
.cot-instruction-flow strong,
.cot-instruction-flow small {
  display: block;
  margin: 0;
}

.cot-instruction-flow strong {
  color: #273245;
  font-size: 11px;
  line-height: 1.35;
}

.cot-instruction-flow small {
  margin-top: 3px;
  color: #778295;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.4;
}

.cot-instruction-compose {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  gap: 20px;
}

.cot-instruction-compose.has-video {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 320px);
}

.cot-instruction-inputs {
  display: grid;
  min-width: 0;
  gap: 16px;
}

.cot-video-preview {
  width: 100%;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  aspect-ratio: 16 / 9;
  background: #101722;
}

.cot-video-preview[hidden] {
  display: none;
}

.cot-video-preview iframe {
  width: 100%;
  height: 100%;
  border: 0;
}

.cot-rich-label {
  margin-bottom: -10px;
}

.cot-rich-editor {
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #ffffff;
}

.cot-rich-editor:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(35, 103, 232, 0.13);
}

.cot-rich-toolbar {
  display: flex;
  min-height: 40px;
  align-items: center;
  gap: 4px;
  padding: 5px 7px;
  border-bottom: 1px solid var(--line);
  background: #f7f9fc;
}

.cot-rich-toolbar button {
  min-width: 30px;
  height: 29px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  color: #425064;
  font-size: 12px;
  cursor: pointer;
}

.cot-rich-toolbar button:hover,
.cot-rich-toolbar button:focus-visible {
  border-color: var(--line-strong);
  background: #ffffff;
  color: var(--accent-dark);
  outline: none;
}

.cot-rich-content {
  min-height: 172px;
  max-height: 360px;
  overflow-y: auto;
  padding: 14px 15px;
  color: #263244;
  font-size: 14px;
  font-weight: 450;
  line-height: 1.6;
  outline: none;
}

.cot-rich-content:empty::before {
  color: #8994a3;
  content: attr(data-placeholder);
  pointer-events: none;
}

.cot-rich-content h2,
.cot-rich-content h3,
.cot-rich-content p,
.cot-rich-content blockquote,
.cot-rich-content ul,
.cot-rich-content ol {
  margin: 0 0 10px;
}

.cot-rich-content h2,
.cot-rich-content h3 {
  font-size: 16px;
}

.cot-rich-content blockquote {
  padding-left: 12px;
  border-left: 3px solid #b9c6d8;
  color: #526071;
}

.cot-rich-content a {
  color: var(--accent-dark);
}

.cot-item-fields {
  padding: 0 24px;
}

.cot-compact-section {
  padding: 18px 0;
}

.cot-compact-section + .cot-compact-section {
  border-top: 1px solid #e7eaf0;
}

.cot-compact-section > h3 {
  margin: 0 0 12px;
  color: #536071;
  font-size: 11px;
  text-transform: uppercase;
}

.cot-compact-section .cot-step-primary,
.cot-compact-section .cot-row {
  gap: 14px;
}

.cot-compact-section .cot-step-primary textarea {
  min-height: 44px;
  height: 44px;
  resize: vertical;
}

.cot-step-disclosure {
  margin: 0 -24px;
  border-top: 1px solid #e1e5eb;
  background: #ffffff;
}

.cot-step-disclosure:last-child {
  border-radius: 0 0 8px 8px;
}

.cot-step-disclosure > summary {
  display: grid;
  min-height: 60px;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 24px;
  list-style: none;
  cursor: pointer;
  transition: background 140ms ease;
}

.cot-step-disclosure > summary::-webkit-details-marker {
  display: none;
}

.cot-step-disclosure > summary:hover {
  background: #f8fafc;
}

.cot-step-disclosure > summary:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.cot-step-disclosure[open] > summary {
  background: #f8fafc;
}

.cot-disclosure-copy {
  min-width: 0;
}

.cot-disclosure-copy strong,
.cot-disclosure-copy small {
  display: block;
}

.cot-disclosure-copy strong {
  color: #273245;
  font-size: 13px;
  line-height: 1.3;
}

.cot-disclosure-copy small {
  margin-top: 3px;
  overflow: hidden;
  color: #778295;
  font-size: 10px;
  font-weight: 550;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cot-disclosure-chevron {
  color: #68768a;
  font-size: 22px;
  line-height: 1;
  transition: transform 140ms ease;
}

.cot-step-disclosure[open] > summary .cot-disclosure-chevron {
  transform: rotate(90deg);
}

.cot-disclosure-body {
  padding: 0 24px 18px;
  animation: cot-disclosure-in 150ms ease-out;
}

@keyframes cot-disclosure-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

.cot-disclosure-body .cot-rule-row {
  margin: 0;
  padding: 16px 0 0;
  border-top: 1px solid #e7eaf0;
}

.cot-step-disclosure.cot-instructions {
  display: block;
  gap: 0;
  margin: 0 -24px;
  padding: 0;
  border-top: 1px solid #e1e5eb;
  border-radius: 0 0 8px 8px;
  background: #ffffff;
}

.cot-step-disclosure.cot-instructions > summary {
  grid-template-columns: minmax(0, 1fr) auto 20px;
}

.cot-instructions-body {
  padding: 18px 24px 22px;
  border-top: 1px solid #e1e5eb;
  background: #f5f7fa;
}

.cot-instruction-callout {
  margin-bottom: 18px;
  padding-left: 13px;
  border-left: 3px solid #9ab5e8;
}

.cot-instruction-callout strong {
  display: block;
  color: #273245;
  font-size: 12px;
}

.cot-instruction-callout p {
  max-width: 720px;
  margin: 5px 0 0;
  color: #657182;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.55;
}

.cot-instruction-save-note {
  display: flex;
  min-height: 30px;
  align-items: center;
  gap: 8px;
  margin: -4px 0 16px;
  color: #687588;
}

.cot-instruction-save-note > span {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #9aa5b3;
  transition: background 140ms ease, box-shadow 140ms ease;
}

.cot-instruction-save-note strong {
  font-size: 10px;
  font-weight: 700;
}

.cot-instruction-save-note.is-saving > span {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(35, 103, 232, 0.12);
  animation: cot-save-pulse 900ms ease-in-out infinite alternate;
}

.cot-instruction-save-note.is-saved {
  color: #08734a;
}

.cot-instruction-save-note.is-saved > span {
  background: var(--success);
}

.cot-instruction-save-note.is-error {
  color: var(--danger);
}

.cot-instruction-save-note.is-error > span {
  background: var(--danger);
}

@keyframes cot-save-pulse {
  from { opacity: 0.55; }
  to { opacity: 1; }
}

.cot-empty {
  margin: 20px;
  padding: 24px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.cot-preview {
  align-self: start;
  position: sticky;
  top: 16px;
}

.cot-widget-preview {
  --preview-primary: #2367e8;
  --preview-on-primary: #ffffff;
  --preview-accent: #138a5b;
  --preview-on-accent: #ffffff;
  --preview-surface: #ffffff;
  --preview-text: #17202d;
  --preview-muted: #657182;
  --preview-line: #dfe3ea;
  --preview-soft: #edf0f4;
  margin-top: 18px;
  border: 1px solid var(--preview-line);
  border-radius: 8px;
  background: var(--preview-surface);
  color: var(--preview-text);
  overflow: hidden;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.cot-preview-head {
  padding: 14px;
  border-bottom: 1px solid var(--preview-line);
}

.cot-preview-head strong {
  display: block;
  margin-bottom: 8px;
}

.cot-preview-description {
  margin: -2px 0 10px;
  color: var(--preview-muted);
  font-size: 11px;
  font-weight: 500;
  line-height: 1.4;
}

.cot-preview-access {
  margin: 10px 0 0;
  color: var(--preview-muted);
  font-size: 11px;
  font-weight: 750;
}

.cot-meter {
  height: 8px;
  border-radius: 999px;
  background: var(--preview-soft);
  overflow: hidden;
}

.cot-meter span {
  display: block;
  height: 100%;
  width: 0;
  background: var(--preview-accent);
  transition: width 180ms ease;
}

.cot-preview-list {
  display: grid;
}

.cot-preview-row {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 8px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--preview-line);
  font-size: 13px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cot-status.is-error {
  color: var(--danger);
}

.cot-tabs {
  display: flex;
  max-width: 1280px;
  margin: 0 auto 18px;
  border-bottom: 1px solid var(--line);
}

.cot-tab {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
  cursor: pointer;
}

.cot-tab:hover {
  color: var(--text);
}

.cot-tab.is-active {
  border-bottom-color: var(--accent);
  color: var(--accent-dark);
}

.cot-page {
  max-width: 1280px;
  margin: 0 auto;
}

.cot-page[hidden] {
  display: none;
}

.cot-page-head,
.cot-template-band {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 0;
}

.cot-page-head p,
.cot-template-band p {
  margin-bottom: 0;
  color: var(--muted);
}

.cot-summary {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: #ffffff;
}

.cot-summary > div {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 16px 18px;
  border-right: 1px solid var(--line);
}

.cot-summary > div:last-child {
  border-right: 0;
}

.cot-summary strong {
  font-size: 23px;
  line-height: 1;
}

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

.cot-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 0;
}

.cot-search-field {
  width: min(300px, 100%);
}

.cot-filter-buttons {
  display: flex;
  align-items: center;
  overflow-x: auto;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: #ffffff;
}

.cot-filter-buttons button {
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-right: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  cursor: pointer;
}

.cot-filter-buttons button:last-child {
  border-right: 0;
}

.cot-filter-buttons button.is-active {
  background: #edf3ff;
  color: var(--accent-dark);
}

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

.cot-client-table {
  width: 100%;
  min-width: 1060px;
  border-collapse: collapse;
}

.cot-client-table th,
.cot-client-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.cot-client-table th {
  background: #f8fafc;
  color: #526071;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.cot-client-table td:first-child {
  max-width: 230px;
}

.cot-client-table td:first-child strong,
.cot-client-table td:first-child small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cot-client-table td:first-child small {
  margin-top: 3px;
  color: var(--muted);
}

.cot-status-badge,
.cot-tag-state {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #eef2f7;
  color: #465365;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.cot-status-badge.is-in_progress {
  background: #e7f0ff;
  color: #1854a8;
}

.cot-status-badge.is-overdue,
.cot-tag-state.is-error {
  background: #feebea;
  color: #9f241b;
}

.cot-status-badge.is-completed,
.cot-tag-state.is-ready {
  background: #e5f5ed;
  color: #08734a;
}

.cot-status-badge.is-paused {
  background: #fff4d9;
  color: #835500;
}

.cot-table-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 126px;
}

.cot-table-progress > span {
  width: 76px;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ebf0;
}

.cot-table-progress i {
  display: block;
  height: 100%;
  background: var(--success);
}

.cot-table-progress strong {
  min-width: 34px;
  font-size: 12px;
}

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

.cot-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.cot-row-actions button,
.cot-action-menu {
  width: auto;
  min-height: 32px;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: #ffffff;
  color: #334155;
  font-size: 11px;
  font-weight: 750;
  cursor: pointer;
}

.cot-action-menu {
  max-width: 76px;
}

.cot-template-band {
  align-items: center;
  margin-bottom: 18px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.cot-template-picker {
  display: grid;
  grid-template-columns: minmax(240px, 340px) auto;
  align-items: end;
  gap: 6px 10px;
}

.cot-template-picker p {
  grid-column: 1 / -1;
  grid-row: 2;
  font-size: 12px;
}

.cot-rule-row {
  align-items: start;
}

.cot-preview-row > span:last-child {
  min-width: 0;
}

.cot-preview-row strong,
.cot-preview-row small {
  display: block;
}

.cot-preview-row small {
  margin-top: 3px;
  color: var(--preview-muted);
  font-size: 10px;
}

.cot-preview-row.is-locked {
  opacity: 0.56;
}

.cot-automation-layout {
  display: grid;
  grid-template-columns: minmax(0, 560px) minmax(280px, 1fr);
  gap: 36px;
  padding: 28px 0;
  border-top: 1px solid var(--line);
}

.cot-automation-form {
  display: grid;
  gap: 18px;
  align-content: start;
}

.cot-automation-form .cot-button {
  justify-self: start;
}

.cot-permission-state {
  align-self: start;
  padding: 18px;
  border-left: 4px solid #d18a00;
  background: #fff9e8;
}

.cot-permission-state.is-ready {
  border-left-color: var(--success);
  background: #edf9f3;
}

.cot-permission-state strong {
  display: block;
  margin-bottom: 5px;
}

.cot-permission-state p {
  margin: 0;
  color: #536071;
  line-height: 1.5;
}

.cot-dialog {
  width: min(520px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  box-shadow: var(--shadow);
}

.cot-dialog::backdrop {
  background: rgba(20, 28, 39, 0.38);
}

.cot-dialog form,
.cot-dialog > div {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.cot-dialog header,
.cot-dialog footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.cot-dialog footer {
  justify-content: flex-end;
}

.cot-dialog-close {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
  color: #526071;
  font-size: 22px;
  cursor: pointer;
}

.cot-help {
  margin: -5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.cot-contact-source {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--bg);
}

.cot-contact-source span,
.cot-contact-source small {
  color: var(--muted);
}

.cot-contact-source strong,
.cot-contact-source small {
  overflow-wrap: anywhere;
}

.cot-preview-dialog {
  width: min(620px, calc(100vw - 28px));
}

.cot-live-preview-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

.cot-preview-dot {
  width: 18px;
  height: 18px;
  border: 1px solid var(--preview-line);
  border-radius: 999px;
  background: var(--preview-surface);
}

.cot-preview-dot.is-complete {
  border-color: var(--preview-accent);
  background: var(--preview-accent);
}

.cot-preview-complete {
  margin: 14px;
  width: calc(100% - 28px);
  background: var(--preview-primary);
  color: var(--preview-on-primary);
}

.cot-preview-complete:hover {
  background: var(--preview-primary);
}

.cot-preview-complete[disabled] {
  filter: blur(0.6px);
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
}

.cot-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding-left: 0;
  padding-right: 0;
  padding-bottom: 0;
}

@media (max-width: 920px) {
  .cot-shell {
    padding: 16px;
  }

  .cot-header,
  .cot-workspace {
    display: grid;
    grid-template-columns: 1fr;
  }

  .cot-page-head,
  .cot-template-band,
  .cot-filters {
    align-items: stretch;
    flex-direction: column;
  }

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

  .cot-summary > div {
    border-bottom: 1px solid var(--line);
  }

  .cot-template-picker,
  .cot-automation-layout {
    grid-template-columns: 1fr;
  }

  .cot-filter-buttons {
    width: 100%;
  }

  .cot-status {
    text-align: left;
  }

  .cot-settings,
  .cot-access-rule,
  .cot-row,
  .cot-step-primary,
  .cot-rule-row,
  .cot-color-grid {
    grid-template-columns: 1fr;
  }

  .cot-instruction-compose.has-video {
    grid-template-columns: minmax(0, 1fr);
  }

  .cot-video-preview {
    width: min(380px, 100%);
  }

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

  .cot-item-fields {
    padding: 0 20px;
  }

  .cot-step-disclosure,
  .cot-step-disclosure.cot-instructions {
    margin-right: -20px;
    margin-left: -20px;
  }

  .cot-preview {
    position: static;
  }

  h1 {
    font-size: 28px;
  }
}

@media (max-width: 560px) {
  .cot-shell {
    padding: 12px;
  }

  .cot-header {
    gap: 12px;
  }

  .cot-tabs {
    overflow-x: auto;
  }

  .cot-tab {
    padding: 0 12px;
    white-space: nowrap;
  }

  .cot-summary {
    grid-template-columns: 1fr 1fr;
  }

  .cot-template-picker {
    display: grid;
  }

  .cot-template-picker p {
    grid-column: 1;
    grid-row: auto;
  }

  .cot-list {
    padding: 12px;
  }

  .cot-list-head {
    min-height: 62px;
    padding: 10px 12px;
  }

  .cot-item-summary {
    position: relative;
    grid-template-columns: minmax(0, 1fr);
    padding: 9px 10px;
  }

  .cot-item-toggle {
    grid-template-columns: 34px minmax(0, 1fr);
    padding-right: 104px;
  }

  .cot-item-toggle .cot-instruction-status {
    grid-column: 2;
    justify-self: start;
  }

  .cot-item-chevron {
    display: none;
  }

  .cot-item-actions {
    position: absolute;
    top: 12px;
    right: 10px;
  }

  .cot-item-fields {
    padding: 0 16px;
  }

  .cot-step-section {
    padding: 20px 0;
  }

  .cot-step-section-head,
  .cot-instructions-head {
    display: grid;
    gap: 8px;
  }

  .cot-step-section-head p {
    max-width: none;
  }

  .cot-step-disclosure,
  .cot-step-disclosure.cot-instructions {
    margin-right: -16px;
    margin-left: -16px;
  }

  .cot-step-disclosure > summary {
    padding: 11px 16px;
  }

  .cot-disclosure-body,
  .cot-instructions-body {
    padding-right: 16px;
    padding-left: 16px;
  }

  .cot-step-disclosure.cot-instructions > summary {
    grid-template-columns: minmax(0, 1fr) auto 18px;
    gap: 9px;
  }

  .cot-step-disclosure.cot-instructions .cot-disclosure-copy small {
    display: none;
  }

  .cot-instruction-flow {
    grid-template-columns: 1fr;
  }

  .cot-instruction-flow > div,
  .cot-instruction-flow > div:first-child {
    padding: 12px 0;
  }

  .cot-instruction-flow > div + div {
    border-top: 1px solid #dfe5ed;
    border-left: 0;
  }

  .cot-rich-toolbar {
    flex-wrap: wrap;
  }
}
