:root {
  --brand: #1f70b5;
  --brand-hover: #1b6cad;
  --ink: #202a34;
  --muted: #536273;
  --line: #dce4ec;
  --control-border: #8090a2;
  --surface: #fff;
  --surface-muted: #f5f8fb;
  --brand-wash: #edf5fc;
  font-family: Roboto, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--surface);
}
* { box-sizing: border-box; }
body {
  min-height: 100vh;
  margin: 0;
  padding: clamp(20px, 3vw, 32px) clamp(16px, 3vw, 40px) 40px;
  border-block-start: 3px solid var(--brand);
}
#workspace, body > #notice { max-width: 1440px; margin-inline: auto; }
.product-credit { margin: 26px auto 0; color: var(--muted); font-size: 12px; text-align: center; }
h1 { font-size: 24px; font-weight: 600; line-height: 1.25; margin: 0 0 18px; }
h2 { font-size: 20px; font-weight: 600; line-height: 1.3; margin: 24px 0 14px; }
h3 { font-size: 15px; }
button, input, select, textarea { font: inherit; }
a { color: var(--brand); text-underline-offset: 2px; }
a:hover { color: var(--brand-hover); }
button, .action-link {
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 500;
  cursor: pointer;
}
button:hover, .action-link:hover { background: var(--surface-muted); border-color: var(--muted); }
button.primary, .action-link.primary { background: var(--brand); border-color: var(--brand); color: white; }
button.primary:hover, .action-link.primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }
.action-link { text-decoration: none; }
button:disabled { opacity: .55; cursor: wait; }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible, textarea:focus-visible, summary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
input, select, textarea {
  display: block;
  width: 100%;
  padding: 8px 10px;
  margin-top: 6px;
  border: 1px solid var(--control-border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  accent-color: var(--brand);
}
input[type=file] { border: 0; padding: 0; }
textarea { resize: vertical; }
label { display: block; margin: 16px 0; font-size: 13px; font-weight: 600; }
label :is(input, select, textarea) { font-weight: 400; }
body:has(#login:not([hidden])) { background: var(--surface-muted); }
body:has(#login:not([hidden])) > #notice, #login { max-width: 440px; }
#login {
  margin: clamp(24px, 8vh, 96px) auto 0;
  padding: clamp(20px, 4vw, 30px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}
#login form > button { margin-top: 4px; }
.page-header { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--line); }
.page-header h1 { margin: 0 auto 0 0; }
.sections { display: flex; flex-wrap: wrap; gap: 0 20px; border-bottom: 1px solid var(--line); }
.sections a { color: var(--muted); padding: 12px 2px 10px; text-decoration: none; border-bottom: 2px solid transparent; }
.sections a:hover { color: var(--brand); }
.sections a[aria-current] { border-color: var(--brand); color: var(--brand); font-weight: 600; }
.toolbar, .dialog-footer { display: flex; flex-wrap: wrap; gap: 8px; }
.summary { margin: 16px 0; color: var(--muted); font-size: 13px; }
.summary span { font-weight: 600; color: var(--ink); }
.table-scroll { max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { border-collapse: collapse; width: 100%; min-width: 760px; }
th, td { border-bottom: 1px solid var(--line); padding: 12px; text-align: left; vertical-align: middle; }
thead th { background: var(--surface-muted); color: var(--muted); font-size: 12px; font-weight: 600; }
tbody th { font-weight: 500; overflow-wrap: anywhere; }
tbody tr:last-child > * { border-bottom: 0; }
tbody tr:hover { background: var(--surface-muted); }
.campaign-list-identity { display: flex; align-items: center; gap: 9px; }
.campaign-list-label { min-width: 0; }
.campaign-list-cover { display: block; flex: 0 0 28px; height: 36px; overflow: hidden; border-radius: 4px; background: var(--surface-muted); }
.campaign-list-cover img { display: block; width: 100%; height: 100%; object-fit: cover; }
.number { text-align: right; font-variant-numeric: tabular-nums; }
.period { white-space: nowrap; line-height: 1.6; font-size: 13px; color: var(--muted); }
.status { font-size: 13px; font-weight: 600; }
.status-active { color: #347148; }
.status-paused { color: #846221; }
.status-scheduled { color: var(--brand); }
.status-draft, .status-finished { color: var(--muted); }
.pager { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 12px; color: var(--muted); font-size: 13px; }
.pager:empty { display: none; }
.back { margin: 20px 0 0; }
.detail-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; }
.detail-heading h2 { margin: 12px 0 0; overflow-wrap: anywhere; }
.version-panels { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 16px 0 22px; }
.version-panel { border: 1px solid var(--line); border-radius: 8px; padding: 14px; overflow-wrap: anywhere; }
.version-panel h3 { margin: 0 0 12px; }
.version-panel .toolbar { margin-top: 12px; }
.compact-table { min-width: 360px; }
.report-filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px 12px; margin: 0 0 16px; }
.report-filters label { margin: 0; min-width: 0; max-width: 240px; }
.report-actions { flex-basis: 100%; margin-top: 6px; }
#report-chart { display: block; width: min(100%, 760px); background: #fafbfc; border: 1px solid #e1e5e9; border-radius: 4px; }
#report-chart text { fill: #5d6875; font-size: 10px; }
.daily-details .table-scroll { max-width: 760px; margin-top: 8px; }
.conflict { border: 1px solid #d5a9a9; padding: 10px 12px; margin-top: 16px; overflow-wrap: anywhere; }
dialog {
  width: min(580px, calc(100% - 24px));
  max-height: calc(100% - 24px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--surface);
}
dialog::backdrop { background: #0003; }
#editor { width: min(1040px, calc(100% - 24px)); }
.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  grid-template-areas: "content preview" "audience preview";
  gap: 0 28px;
  margin-top: 16px;
  align-items: start;
}
.editor-content-fields { grid-area: content; min-width: 0; }
.editor-audience-fields { grid-area: audience; min-width: 0; }
.editor-content-fields > label:first-child { margin-top: 0; }
#preview {
  grid-area: preview;
  position: sticky;
  top: 0;
  align-self: start;
  min-width: 0;
  max-height: calc(100dvh - 64px);
  overflow-y: auto;
  padding: 0 6px 4px;
}
#preview-heading { margin: 0 0 16px; color: #687481; font-size: 13px; font-weight: 500; }
.preview-phone {
  position: relative;
  width: min(100%, 300px);
  margin-inline: auto;
  padding: 7px;
  border: 1px solid #505861;
  border-radius: 34px;
  background: #20262d;
  box-shadow: 0 4px 14px #252d3618;
}
.preview-phone::before {
  content: "";
  position: absolute;
  top: 12px;
  left: 50%;
  width: 70px;
  height: 14px;
  transform: translateX(-50%);
  border-radius: 9px;
  background: #20262d;
  z-index: 4;
}
.preview-phone::after {
  content: "";
  position: absolute;
  bottom: 14px;
  left: 50%;
  width: 88px;
  height: 4px;
  transform: translateX(-50%);
  border-radius: 4px;
  background: #ffffffb3;
  z-index: 4;
}
.preview-screen {
  position: relative;
  container-type: inline-size;
  aspect-ratio: 9 / 18;
  overflow: hidden;
  border-radius: 27px;
  background: #173c35;
  color: #fff;
}
#preview .preview-media {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  margin: 0;
  object-fit: cover;
}
#preview video.preview-media { object-fit: contain; background: #142923; }
.preview-screen:has(video:not([hidden])) > img,
.preview-screen:has(video:not([hidden])) > .preview-media-empty { display: none; }
.preview-shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(transparent 40%, #092b24e6);
  pointer-events: none;
}
.preview-progress { position: absolute; top: 35px; left: 14px; right: 14px; height: 3px; display: flex; gap: 3px; z-index: 2; }
.preview-progress span { flex: 1; min-width: 1px; height: 3px; border-radius: 3px; background: #ffffff55; overflow: hidden; }
.preview-progress span::after { content: ""; display: block; height: 100%; width: var(--fill, 0%); background: white; }
.series-editor { margin: 20px 0; padding: 14px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.series-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.series-heading h3 { margin: 0; }
.story-frame-list { display: flex; gap: 8px; overflow-x: auto; margin: 12px 0; padding: 2px 2px 9px; list-style: none; }
.story-frame-list li { flex: 0 0 86px; min-width: 0; }
.story-frame-list button { position: relative; display: block; width: 100%; padding: 0; overflow: hidden; text-align: left; background: var(--surface-muted); }
.story-frame-list button[aria-current=true] { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.story-frame-list button span { display: block; }
.frame-thumbnail { aspect-ratio: 3 / 4; background: #e7ecef; color: #687481; }
.frame-thumbnail img { display: block; width: 100%; height: 100%; aspect-ratio: 3 / 4; object-fit: cover; }
.frame-thumbnail:empty::after { content: "Нет медиа"; display: block; padding: 42px 4px 0; text-align: center; font-size: 10px; }
.frame-caption { padding: 6px; font-size: 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.frame-marker { position: absolute; top: 5px; left: 5px; padding: 2px 4px; border-radius: 3px; font-size: 10px; color: white; background: #20332dbb; }
.frame-experiment { top: auto; bottom: 29px; background: var(--brand); }
.frame-tools button { padding: 5px 8px; font-size: 12px; }
.preview-series-controls { display: flex; justify-content: center; gap: 6px; margin: 12px auto 0; }
.preview-series-controls button { padding: 6px 9px; font-size: 12px; }
.preview-copy { position: absolute; bottom: 28px; left: 20px; right: 20px; overflow-wrap: anywhere; }
#preview .preview-copy h4 { margin: 0; font-size: 24px; line-height: 1.1; letter-spacing: -.6px; }
#preview .preview-copy p { margin: 10px 0; font-size: 12px; line-height: 1.5; white-space: pre-wrap; }
#preview .preview-copy p:empty { display: none; }
#preview .action-preview { margin-top: 12px; }
#preview .action-preview > summary,
#preview .preview-play {
  padding: 8px 12px;
  border: 1px solid #d7e8e0;
  border-radius: 4px;
  color: #173c35;
  background: #f5faf7;
  font-size: 12px;
  font-weight: 500;
}
#preview .action-preview > summary { display: inline-block; list-style: none; }
#preview .action-preview > summary::-webkit-details-marker { display: none; }
#preview .action-preview > p { max-height: 140px; overflow-y: auto; padding: 9px 10px; border: 1px solid #91aca0; border-radius: 4px; background: #13382e; }
#preview .preview-play { position: absolute; top: 42%; left: 50%; transform: translateX(-50%); width: max-content; max-width: 86%; margin: 0; z-index: 2; }
.preview-media-empty { position: absolute; top: 35%; left: 22px; right: 22px; text-align: center; color: #e2ece8; }
.preview-empty-icon { display: block; width: 37px; height: 30px; margin: 0 auto 13px; border: 1px dashed #a3bcb2; border-radius: 4px; }
.preview-media-empty strong { display: block; font-size: 14px; font-weight: 500; line-height: 1.4; }
.preview-media-empty p { margin: 9px 0 14px; font-size: 11px; line-height: 1.5; color: #c5d6cf; }
#preview .preview-upload { display: inline-block; margin: 0; padding: 7px 10px; border: 1px solid #8ca99e; border-radius: 4px; color: #f1f7f4; font-size: 11px; font-weight: 400; cursor: pointer; }
#preview-experiment-a { margin: 0 0 10px; font-size: 12px; color: #687481; }
#preview-experiment-b > h4 { margin-bottom: 10px; font-size: 12px; color: #687481; }
@media (min-width: 801px) {
  .preview-phone { width: min(100%, 300px, max(180px, calc((100dvh - 240px) / 2))); }
  .preview-copy { bottom: 9.86cqw; left: 7.04cqw; right: 7.04cqw; }
  #preview .preview-copy h4 { font-size: 8.45cqw; letter-spacing: -.21cqw; }
  #preview .preview-copy p { font-size: 4.23cqw; margin: 3.52cqw 0; }
  #preview .action-preview { margin-top: 4.23cqw; }
  #preview .action-preview > summary, #preview .preview-play { padding: 2.82cqw 4.23cqw; font-size: 4.23cqw; }
  .preview-progress { top: 12.32cqw; left: 4.93cqw; right: 4.93cqw; gap: 1.06cqw; }
  .preview-media-empty { left: 7.75cqw; right: 7.75cqw; }
  .preview-media-empty strong { font-size: 4.93cqw; }
  .preview-media-empty p { font-size: 3.87cqw; margin: 3.17cqw 0 4.93cqw; }
  #preview .preview-upload { font-size: 3.87cqw; padding: 2.46cqw 3.52cqw; }
  .preview-empty-icon { width: 13.03cqw; height: 10.56cqw; margin-bottom: 4.58cqw; }
}
.dialog-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.dialog-header h2, #confirm-title { margin: 0; }
.dialog-footer { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }
.help { color: var(--muted); margin: 4px 0 12px; font-size: 12px; }
fieldset { min-width: 0; border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 16px 0; }
legend { font-size: 13px; padding: 0 4px; }
.subject-row { display: flex; gap: 8px; align-items: center; }
.subject-row input { margin: 0; min-width: 0; }
.address-results, .address-chips { list-style: none; padding: 0; margin: 8px 0; }
.address-results { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: 6px; }
.address-results li + li { border-top: 1px solid var(--line); }
.address-results button { display: block; width: 100%; border: 0; border-radius: 0; text-align: left; overflow-wrap: anywhere; }
.address-results button[aria-pressed=true] { background: var(--brand-wash); color: var(--brand); }
.address-results button:focus-visible { outline-offset: -2px; }
.address-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.address-chips button, #subject-address-parent-reset, #segment-address-parent-reset { padding: 4px 8px; text-align: left; overflow-wrap: anywhere; }
#selected-subjects { padding-left: 20px; margin: 10px 0 0; max-height: 200px; overflow-y: auto; }
#selected-subjects:empty { display: none; }
#selected-subjects li { margin-top: 5px; }
#selected-subjects button { margin-left: 8px; padding: 2px 6px; }
.dates { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.campaign-dates { grid-template-columns: repeat(auto-fit, minmax(min(100%, 172px), 1fr)); }
.campaign-dates input[readonly] { background: var(--surface-muted); }
details { margin-top: 16px; }
summary { cursor: pointer; }
#preview-image, #revision-image { display: block; max-width: 100%; max-height: 240px; margin-top: 12px; }
#editor-video-preview, #revision-video-preview, #editor-video-b-preview, #revision-video-b-preview {
  display: block; width: 100%; max-height: 320px; margin-top: 12px;
}
#play-editor-video, #play-revision-video, #play-editor-video-b, #play-revision-video-b { margin-top: 12px; }
.experiment-variant { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 12px; }
.experiment-variant h3, .experiment-variant h4 { margin: 0; }
#experiment-report-link { margin: 0 0 16px; }
.action-preview p { overflow-wrap: anywhere; white-space: pre-wrap; }
#preview-title, #preview-subtitle, #confirm-summary, #revision-preview-content { overflow-wrap: anywhere; }
.story-text-links { display: grid; justify-items: start; gap: 6px; margin: 6px 0 10px; }
.story-text-links ul { list-style: none; margin: 0; padding: 0; width: 100%; }
.story-text-links li { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-block: 4px; }
.story-text-link-edit { max-width: 100%; overflow-wrap: anywhere; text-align: left; }
.story-text-link-preview { text-decoration: underline; text-underline-offset: 2px; }
#story-text-link-dialog { width: min(420px, calc(100% - 24px)); }
.notice { padding: 10px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--surface-muted); margin: 0 0 12px; }
.notice.error { color: #a13030; border-color: #d5a9a9; background: #fff8f8; }
#segment-table, #mailings-table { margin-top: 16px; }
.check-label { display: flex; align-items: center; gap: 8px; }
.check-label input { width: auto; margin: 0; }
.compact-list { margin: 8px 0; padding-inline-start: 20px; }
.compact-list li + li { margin-top: 6px; }
.compact-list button { margin-left: 8px; padding: 3px 8px; }
.mailing-form, .preview-panel { max-width: 700px; }
.mailing-form fieldset:disabled { opacity: .6; }
.preview-panel { border: 1px solid var(--line); border-radius: 8px; padding: 12px; margin: 16px 0; }
.preview-panel h3 { margin-top: 0; }
.preview-panel button { margin-top: 8px; }
.preview-panel .pager button { margin-top: 0; }
.audience-ids { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 8px 0; padding: 0; list-style: none; }
.audience-ids li { font-variant-numeric: tabular-nums; }
.mailing-message { max-width: 700px; white-space: pre-wrap; overflow-wrap: anywhere; }
.mailing-metrics { display: flex; flex-wrap: wrap; gap: 14px 28px; margin: 16px 0; }
.mailing-metrics dt { color: var(--muted); font-size: 13px; }
.mailing-metrics dd { margin: 5px 0 0; font-size: 18px; font-variant-numeric: tabular-nums; }
.status-running, .status-inbox_accepted { color: #347148; }
.status-stopping, .status-needs_review, .status-unknown { color: #846221; }
.status-failed { color: #a13030; }
.status-stopped, .status-cancelled, .status-expired, .status-excluded { color: var(--muted); }
[hidden] { display: none !important; }
@media (max-width: 800px) {
  .editor-layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "content" "preview" "audience"; gap: 16px; }
  #preview { position: static; max-height: none; overflow: visible; }
}
@media (max-width: 680px) {
  .version-panels { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
  #login form > button { width: 100%; margin: 4px 0 0; }
  #login form > button + button { margin-top: 8px; }
  .page-header h1 { flex-basis: 100%; }
  .sections { gap: 0 14px; }
  .dates { grid-template-columns: 1fr; gap: 0; }
}

.employee-roles .check-label { margin: 8px 0; }
#license-banner { margin: 16px 0; }
#employee-code { font-family: monospace; }
