:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  font-synthesis: none;
  /* Бренд «Наш город»: оттенки красного */
  --brand: #d0141c;
  --brand-hover: #a80f16;
  --brand-deep: #6d0b11;
  --brand-deep-hover: #8a0c12;
  --brand-bright: #e41e26;
  /* Градиент как у фона логотипа: тёмные края, яркий центр */
  --brand-gradient: linear-gradient(
    180deg,
    #5c080d 0%,
    #a50f16 22%,
    #e41e26 50%,
    #b3121a 78%,
    #5c080d 100%
  );
  --brand-gradient-soft: linear-gradient(
    135deg,
    #8a0c12 0%,
    #e41e26 55%,
    #b3121a 100%
  );
  --brand-muted: #d9575c;
  --brand-line: #efc9cc;
  --brand-tint: #f8e1e2;
  --brand-soft: #fcf2f1;
  --brand-blush: #fbe8e8;
  /* Тёплые нейтральные */
  --ink: #2e2224;
  --ink-soft: #4a3b3d;
  --muted: #76686a;
  --faint: #847477;
  --line: #ece3e1;
  --line-soft: #f3edeb;
  --line-strong: #e2d5d3;
  --bg: #f8f5f3;
  --surface: #fdfbfa;
  --focus-ring: #f6d6d8;
  /* Семантические состояния (не брендовые) */
  --success: #23703a;
  --success-dot: #3fa35b;
  --success-soft: #e4f3e8;
  --warning: #85600e;
  --warning-soft: #fdf1d8;
  --danger: #c2331f;
  --danger-soft: #fdece8;
  --danger-line: #f3c2b8;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
textarea,
select {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink-soft);
  border-radius: 9px;
  padding: 10px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  line-height: 1.4;
  transition: background 0.15s;
}
button:hover {
  background: var(--brand-soft);
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}
button.primary {
  background: var(--brand);
  color: white;
  border-color: var(--brand);
}
button.primary:hover {
  background: var(--brand-hover);
}
button.danger {
  color: var(--danger);
}
button.ghost {
  background: transparent;
  border-color: transparent;
}
button.small {
  padding: 6px 10px;
  font-size: 12px;
}
button.icon-btn {
  padding: 8px;
}
svg.icon {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
a {
  color: var(--brand);
  text-underline-offset: 3px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: 29px;
  letter-spacing: -1px;
  margin-bottom: 10px;
  font-weight: 650;
}
h2 {
  font-size: 18px;
  letter-spacing: -0.3px;
  font-weight: 600;
}
h3 {
  font-size: 15px;
  font-weight: 600;
}
p {
  line-height: 1.6;
}
small {
  font-size: 12px;
}
input,
textarea,
select {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
  padding: 11px 12px;
  width: 100%;
  color: var(--ink);
  outline: none;
}
input:focus,
textarea:focus,
select:focus,
[contenteditable]:focus {
  border-color: var(--brand-muted);
  box-shadow: 0 0 0 3px var(--focus-ring);
}
label {
  display: block;
  font-size: 13px;
  font-weight: 550;
  margin-bottom: 8px;
}
label.check {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
  cursor: pointer;
}
input[type="checkbox"] {
  width: 17px;
  height: 17px;
  accent-color: var(--brand);
}
.muted {
  color: var(--muted);
}
.subtitle {
  color: var(--muted);
  font-size: 14px;
  margin: 0;
}
.eyebrow {
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 1.8px;
  text-transform: uppercase;
  color: var(--faint);
  margin-bottom: 16px;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 226px;
  background: var(--brand-gradient);
  color: #fff;
  padding: 28px 16px 18px;
  display: flex;
  flex-direction: column;
  z-index: 10;
  box-shadow: inset -1px 0 0 #ffffff1f;
}
.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 0 4px 26px;
  margin-bottom: 8px;
  border-bottom: 1px solid #ffffff2e;
  color: #fff;
}
.brand .logo {
  width: 76px;
  height: auto;
}
.brand strong {
  display: block;
  font-size: 21px;
  font-weight: 900;
  letter-spacing: 0.4px;
  line-height: 1;
  text-transform: uppercase;
}
.brand small {
  color: #ffe3e4;
  display: block;
  margin-top: 6px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.2px;
}
.nav-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  padding: 15px 14px 10px;
  color: #ffd6d8;
}
.nav button {
  width: 100%;
  justify-content: flex-start;
  background: transparent;
  border: 0;
  color: #fff;
  padding: 12px 14px;
  margin: 3px 0;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  gap: 13px;
}
.nav button:hover {
  background: #ffffff1f;
  color: #fff;
}
.nav button.active {
  background: #fff;
  color: var(--brand-hover);
  font-weight: 700;
  box-shadow: 0 6px 18px #3a05082e;
}
.nav button .count {
  margin-left: auto;
  font-size: 11px;
  opacity: 0.8;
}
.sidebar-bottom {
  margin-top: auto;
  border-top: 1px solid #ffffff2e;
  padding: 18px 10px 0;
}
.local-label {
  font-size: 12px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}
.dot {
  width: 6px;
  height: 6px;
  background: var(--success-dot);
  border-radius: 50%;
  display: inline-block;
}
.sidebar .dot {
  background: #7ee29a;
  box-shadow: 0 0 0 3px #7ee29a33;
}
.sidebar-bottom p {
  color: #ffe3e4;
  font-size: 11px;
  line-height: 1.7;
  margin: 9px 0;
}
.sidebar-bottom button {
  color: #fff;
  background: transparent;
  border: 0;
  padding-left: 0;
  font-size: 11px;
}
.sidebar-bottom button:hover {
  background: transparent;
  text-decoration: underline;
}
.main {
  margin-left: 226px;
  min-height: 100vh;
}
.topbar {
  height: 76px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  padding: 0 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
}
.breadcrumb {
  color: var(--faint);
}
.breadcrumb span {
  color: var(--ink-soft);
  margin-left: 14px;
}
.top-right {
  display: flex;
  gap: 17px;
  align-items: center;
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  color: var(--muted);
  border: 1px solid #f0dcdd;
  border-radius: 20px;
  padding: 6px 11px;
  background: var(--brand-soft);
  white-space: nowrap;
}
.avatar {
  background: var(--brand-tint);
  border-radius: 50%;
  height: 30px;
  width: 30px;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 600;
  color: var(--brand-hover);
}
.workspace {
  max-width: 1450px;
  margin: auto;
  padding: 35px 38px 50px;
}
.page-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 29px;
  gap: 20px;
}
.actions {
  display: flex;
  align-items: center;
  gap: 9px;
}
.panel {
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
}
.panel-pad {
  padding: 24px;
}
.panel-head {
  padding: 20px 24px;
  border-bottom: 1px solid var(--line-soft);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
}
.panel-head h2 {
  margin: 0;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 28px;
}
.metric {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px 24px;
}
.metric-head {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 12px;
}
.metric-head svg {
  color: var(--brand-muted);
}
.metric-value {
  font-size: 34px;
  letter-spacing: -1px;
  font-weight: 550;
  margin: 14px 0 8px;
}
.metric-footer {
  font-size: 11px;
  color: var(--faint);
}
.overview-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 305px;
  gap: 22px;
}
.welcome {
  background: var(--brand-gradient-soft);
  color: #fff;
  border-radius: 14px;
  padding: 30px 30px 28px;
  margin-bottom: 22px;
  position: relative;
  overflow: hidden;
  box-shadow: 0 14px 40px #a80f1629;
}
.welcome .eyebrow {
  color: #ffe3e4;
}
.welcome h2 {
  font-size: 24px;
  font-weight: 800;
  margin-bottom: 12px;
  max-width: 450px;
  color: #fff;
}
.welcome p {
  font-size: 13px;
  color: #ffeaea;
  max-width: 430px;
}
.welcome button {
  background: #fff;
  color: var(--brand-hover);
  border-color: #fff;
  font-weight: 600;
  position: relative;
}
.welcome button:hover {
  background: #fff1f1;
}
.welcome .lineart {
  position: absolute;
  right: 24px;
  bottom: -6px;
  opacity: 0.22;
  width: 150px;
  height: auto;
}
.bot-line {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line-soft);
}
.bot-line:last-child {
  border-bottom: 0;
}
.platform {
  height: 34px;
  width: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #eaf5fc;
  color: #409fce;
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 700;
}
.platform.max {
  background: #eeeafa;
  color: #8261ca;
}
.bot-line .info {
  flex: 1;
}
.info strong {
  font-size: 13px;
}
.info small {
  display: block;
  color: var(--faint);
  margin-top: 5px;
}
.mini-note {
  font-size: 12px;
  line-height: 1.7;
  color: var(--faint);
  margin-top: 19px;
}
.empty {
  text-align: center;
  padding: 48px 24px;
}
.empty .empty-icon {
  margin: 0 auto 18px;
  border: 1px solid #f1dcdd;
  width: 54px;
  height: 54px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: var(--brand-soft);
  color: var(--brand-muted);
}
.empty .empty-icon svg {
  width: 25px;
  height: 25px;
}
.empty h3 {
  font-size: 16px;
  margin-bottom: 10px;
}
.empty p {
  font-size: 13px;
  color: var(--muted);
  max-width: 345px;
  margin: 0 auto 21px;
}
.list-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 21px;
}
.search {
  max-width: 310px;
  position: relative;
}
.search svg {
  position: absolute;
  left: 13px;
  top: 11px;
  color: var(--faint);
}
.search input {
  padding-left: 40px;
  background: #fff;
}
.filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.filters button {
  font-size: 12px;
  padding: 8px 12px;
}
.filters .selected {
  background: var(--brand-tint);
  color: var(--brand-hover);
  border-color: var(--brand-line);
}
.ad-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.ad-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  transition: box-shadow 0.2s;
}
.ad-card:hover {
  box-shadow: 0 7px 22px #4a0d1214;
}
.ad-cover {
  height: 164px;
  background: #f5e8e7;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #d09a9e;
  position: relative;
}
.ad-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ad-cover > svg {
  width: 44px;
  height: 44px;
  stroke-width: 1;
}
.photo-badge {
  position: absolute;
  bottom: 12px;
  right: 12px;
  background: #ffffffdd;
  padding: 5px 8px;
  font-size: 10px;
  border-radius: 6px;
  color: var(--ink-soft);
}
.ad-card-body {
  padding: 18px;
}
.ad-card h3 {
  margin: 0 0 10px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ad-excerpt {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  height: 38px;
  overflow: hidden;
  margin-bottom: 18px;
}
.card-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid var(--line-soft);
  padding-top: 13px;
}
.card-foot small {
  color: var(--faint);
  font-size: 10px;
}
.status {
  font-size: 11px;
  padding: 5px 9px;
  border-radius: 6px;
  white-space: nowrap;
  display: inline-block;
  background: #f3eeed;
  color: var(--muted);
}
.status.ready,
.status.sent {
  background: var(--success-soft);
  color: var(--success);
}
.status.pending,
.status.unknown {
  background: var(--warning-soft);
  color: var(--warning);
}
.status.failed {
  background: var(--danger-soft);
  color: var(--danger);
  box-shadow: inset 0 0 0 1px var(--danger-line);
}
.status.sending {
  background: #e7f1fc;
  color: #4b83b4;
}
.status.queued {
  background: #f0edfb;
  color: #7c66a6;
}
.table-wrap {
  overflow: auto;
}
table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
}
th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  background: var(--surface);
  color: var(--faint);
  font-weight: 600;
  padding: 14px 20px;
}
td {
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12px;
}
tr:last-child td {
  border-bottom: 0;
}
td .subtitle {
  font-size: 11px;
  margin-top: 5px;
}
.chat-name {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-note {
  max-width: 300px;
  font-size: 11px;
  color: var(--faint);
  line-height: 1.5;
  margin-top: 5px;
}
.bots-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 23px;
}
.bot-card {
  padding: 28px;
}
.bot-card header {
  display: flex;
  gap: 13px;
  align-items: center;
  margin-bottom: 25px;
}
.bot-card .platform {
  height: 45px;
  width: 45px;
}
.bot-card h2 {
  margin-bottom: 5px;
}
.field {
  margin-bottom: 22px;
}
.hint {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.6;
  margin: 8px 0 0;
}
.bot-card button {
  width: 100%;
}
.bot-card .actions button {
  width: auto;
}
.editor-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 26px;
  align-items: start;
}
.editor-section {
  padding: 24px;
  border-bottom: 1px solid var(--line-soft);
}
.editor-section:last-child {
  border-bottom: 0;
}
.section-title {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 22px;
}
.section-title span {
  font-size: 11px;
  width: 22px;
  height: 22px;
  background: var(--brand-tint);
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: var(--brand);
}
.section-title h2 {
  font-size: 15px;
  margin: 0;
}
.editor-toolbar {
  border: 1px solid var(--line-strong);
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  padding: 6px;
  background: var(--surface);
  display: flex;
  gap: 3px;
}
.editor-toolbar button {
  border: none;
  background: transparent;
  padding: 6px 10px;
}
.rich-editor {
  min-height: 190px;
  max-height: 420px;
  overflow: auto;
  padding: 16px;
  border: 1px solid var(--line-strong);
  border-radius: 0 0 8px 8px;
  outline: none;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink);
}
.rich-editor:empty:before {
  content: attr(data-placeholder);
  color: #ab9c9e;
}
.counter {
  text-align: right;
  font-size: 11px;
  margin-top: 8px;
  color: var(--faint);
}
.counter.over {
  color: var(--danger);
}
.dropzone {
  border: 1px dashed #e8bcbf;
  border-radius: 9px;
  padding: 22px;
  text-align: center;
  background: var(--surface);
  cursor: pointer;
  color: #a9585e;
  transition: background 0.2s;
}
.dropzone:hover,
.dropzone.drag {
  background: var(--brand-blush);
}
.dropzone svg {
  width: 26px;
  height: 26px;
}
.dropzone strong {
  font-size: 12px;
  font-weight: 550;
  display: block;
  margin: 9px 0 5px;
  color: var(--brand-hover);
}
.dropzone small {
  font-size: 10px;
}
.photo-strip {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.photo-item {
  position: relative;
}
.photo-item img {
  width: 100%;
  height: 78px;
  object-fit: cover;
  border-radius: 6px;
}
.photo-tools {
  display: flex;
  justify-content: center;
  gap: 2px;
  margin-top: 3px;
}
.photo-tools button {
  font-size: 10px;
  padding: 3px 5px;
}
.button-fields {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 12px;
  margin-top: 18px;
}
.notice {
  border-radius: 8px;
  background: #fbf4e6;
  color: #7a6231;
  font-size: 12px;
  line-height: 1.6;
  padding: 12px 14px;
  margin-top: 14px;
}
.notice.green {
  background: var(--success-soft);
  color: var(--success);
}
.preview-wrap {
  position: sticky;
  top: 22px;
}
.preview-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
}
.preview-top h3 {
  font-size: 12px;
  margin: 0;
}
.segmented {
  display: flex;
  background: #f3eae9;
  border-radius: 7px;
  padding: 3px;
}
.segmented button {
  font-size: 10px;
  padding: 5px 9px;
  border: 0;
  background: transparent;
}
.segmented button.selected {
  background: #fff;
  box-shadow: 0 1px 3px #4a0d1214;
}
.phone {
  border: 1px solid var(--line-strong);
  border-radius: 18px;
  overflow: hidden;
  background: #f2e8e6;
  padding-bottom: 28px;
  min-height: 360px;
}
.phone-header {
  display: flex;
  gap: 11px;
  align-items: center;
  background: #fffdfc;
  padding: 15px;
  border-bottom: 1px solid var(--line);
}
.phone-header strong {
  font-size: 12px;
}
.phone-header small {
  font-size: 10px;
  color: var(--faint);
  display: block;
  margin-top: 4px;
}
.preview-date {
  text-align: center;
  font-size: 9px;
  color: var(--faint);
  margin: 15px 0;
}
.bubble {
  margin: 0 14px;
  background: white;
  border-radius: 10px 10px 10px 2px;
  overflow: hidden;
  box-shadow: 0 1px 2px #3a0a0e0d;
}
.bubble .author {
  font-size: 11px;
  font-weight: 600;
  color: var(--brand);
  padding: 12px 13px 5px;
}
.bubble-body {
  padding: 8px 13px 7px;
  font-size: 12px;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: var(--ink);
}
.bubble-time {
  text-align: right;
  padding: 0 12px 9px;
  font-size: 9px;
  color: #ae9fa1;
}
.preview-photos {
  display: grid;
  gap: 2px;
  grid-template-columns: repeat(2, 1fr);
}
.preview-photos img {
  width: 100%;
  height: 108px;
  object-fit: cover;
}
.preview-photos.single {
  grid-template-columns: 1fr;
}
.preview-photos.single img {
  height: 190px;
}
.preview-link {
  margin: 4px 14px 0;
  padding: 10px;
  background: var(--brand-soft);
  border-radius: 5px;
  display: block;
  text-align: center;
  font-size: 12px;
  font-weight: 550;
  color: var(--brand);
  text-decoration: none;
  overflow-wrap: anywhere;
}
.preview-disclaimer {
  font-size: 10px;
  color: var(--faint);
  text-align: center;
  line-height: 1.6;
  margin: 12px 0;
}
.editor-footer {
  padding: 18px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
}
.step-list {
  counter-reset: steps;
}
.step {
  padding: 17px 0;
  display: flex;
  gap: 15px;
  border-bottom: 1px solid var(--line-soft);
}
.step:last-child {
  border-bottom: 0;
}
.step:before {
  counter-increment: steps;
  content: counter(steps);
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: 8px;
  background: var(--brand-tint);
  font-size: 11px;
  color: var(--brand);
}
.step h3 {
  font-size: 13px;
  margin-bottom: 7px;
}
.step p {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 0;
}
.history-item {
  padding: 23px;
  border-bottom: 1px solid var(--line-soft);
}
.history-item header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 17px;
}
.history-item header h3 {
  margin: 0 0 6px;
}
.history-item header small {
  font-size: 10px;
  color: var(--faint);
}
.delivery {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin: 14px 0;
}
.delivery .info {
  flex: 1;
}
.delivery .error {
  font-size: 11px;
  color: var(--danger);
  max-width: 580px;
  margin-top: 7px;
  line-height: 1.5;
}
.history-item details {
  font-size: 12px;
  color: var(--muted);
  margin-top: 17px;
}
.snapshot {
  white-space: pre-wrap;
  padding: 15px;
  background: #faf6f5;
  border-radius: 8px;
  margin-top: 12px;
  overflow-wrap: anywhere;
}
.service-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 23px;
}
.service-grid code {
  background: var(--brand-soft);
  border: 1px solid var(--line);
  display: block;
  padding: 13px;
  border-radius: 7px;
  font-size: 12px;
  color: var(--brand-hover);
  margin: 10px 0 20px;
}
dialog {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 0;
  width: min(820px, calc(100vw - 36px));
  max-height: 88vh;
  color: var(--ink);
  box-shadow: 0 25px 100px #2a0a0d30;
}
dialog::backdrop {
  background: #2a0d1066;
  backdrop-filter: blur(3px);
}
dialog .modal-header {
  padding: 23px 26px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
dialog h2 {
  margin: 0;
}
dialog .modal-body {
  padding: 25px 26px;
}
dialog .modal-footer {
  padding: 18px 26px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--surface);
}
.send-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 25px;
}
.select-chat {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  border: 1px solid var(--line-strong);
  padding: 12px;
  margin-bottom: 9px;
  border-radius: 8px;
  font-weight: 400;
}
.select-chat input {
  margin-top: 8px;
}
.select-chat .info {
  flex: 1;
}
.select-chat.disabled {
  opacity: 0.55;
}
.error-inline {
  color: var(--danger);
  font-size: 12px;
  line-height: 1.6;
  margin-top: 12px;
}
.error-inline:not(:empty) {
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  border-left: 3px solid var(--danger);
  border-radius: 8px;
  padding: 9px 12px;
}
.hidden {
  display: none !important;
}
#toast {
  position: fixed;
  bottom: 25px;
  left: calc(50% + 80px);
  transform: translateX(-50%);
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 35px #2a0a0d20;
  border-radius: 10px;
  padding: 13px 20px;
  z-index: 100;
  max-width: 520px;
  display: none;
  font-size: 13px;
}
#toast.error {
  color: var(--danger);
  border-color: var(--danger-line);
  border-left: 4px solid var(--danger);
  background: var(--danger-soft);
}
.loading {
  padding: 80px;
  text-align: center;
  color: var(--faint);
}
.offline {
  background: var(--warning-soft);
  padding: 9px 38px;
  font-size: 12px;
  color: var(--warning);
}
.inline-row {
  display: flex;
  gap: 10px;
}
.inline-row input {
  flex: 1;
}
.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;
}
@media (min-width: 1600px) {
  .workspace {
    padding-top: 46px;
  }
  .ad-cover {
    height: 210px;
  }
}
@media (max-width: 1200px) {
  .overview-grid {
    grid-template-columns: 1fr 270px;
  }
  .workspace {
    padding: 28px;
  }
  .editor-grid {
    grid-template-columns: minmax(0, 1fr) 290px;
  }
  .ad-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .sidebar {
    width: 204px;
  }
  .main {
    margin-left: 204px;
  }
  .topbar {
    padding: 0 28px;
  }
}
@media (max-width: 950px) {
  .sidebar {
    width: 78px;
    padding: 24px 10px;
  }
  .brand {
    padding: 0 0 18px;
    justify-content: center;
  }
  .brand .logo {
    width: 44px;
  }
  .brand div,
  .nav-label,
  .nav button span,
  .sidebar-bottom {
    display: none;
  }
  .nav button {
    justify-content: center;
    padding: 14px;
  }
  .main {
    margin-left: 78px;
  }
  .overview-grid {
    grid-template-columns: 1fr;
  }
  .editor-grid {
    grid-template-columns: 1fr 275px;
  }
  .workspace {
    padding: 25px;
  }
  .metrics {
    gap: 12px;
  }
  .metric {
    padding: 18px;
  }
  .bots-grid {
    gap: 15px;
  }
  .bot-card {
    padding: 21px;
  }
}
@media (max-width: 700px) {
  .topbar {
    padding: 0 18px;
    height: 60px;
  }
  .top-right .chip {
    display: none;
  }
  .workspace {
    padding: 23px 16px;
  }
  .page-heading {
    flex-wrap: wrap;
    margin-bottom: 23px;
  }
  .page-heading .actions {
    flex-wrap: wrap;
  }
  h1 {
    font-size: 25px;
  }
  .metrics {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .metric {
    display: flex;
    align-items: center;
    gap: 20px;
    flex-wrap: wrap;
    padding: 16px;
  }
  .metric-head {
    flex: 1;
  }
  .metric-head svg {
    display: none;
  }
  .metric-value {
    font-size: 25px;
    margin: 0;
  }
  .metric-footer {
    display: none;
  }
  .editor-grid,
  .bots-grid,
  .service-grid,
  .send-grid {
    grid-template-columns: 1fr;
  }
  .preview-wrap {
    position: static;
    max-width: 340px;
    width: 100%;
    margin: auto;
  }
  .ad-grid {
    grid-template-columns: 1fr;
  }
  .button-fields {
    grid-template-columns: 1fr;
  }
  .list-toolbar {
    flex-wrap: wrap;
  }
  .search {
    width: 100%;
    max-width: none;
  }
  .editor-section {
    padding: 18px;
  }
  .photo-strip {
    grid-template-columns: repeat(3, 1fr);
  }
  .editor-footer {
    padding: 16px;
    gap: 10px;
    flex-wrap: wrap;
  }
  .overview-grid {
    gap: 16px;
  }
  .welcome {
    padding: 23px;
  }
  .welcome .lineart {
    display: none;
  }
  .send-grid .preview-wrap {
    display: none;
  }
  .sidebar {
    width: 64px;
    padding: 20px 7px;
  }
  .main {
    margin-left: 64px;
  }
  .brand .logo {
    width: 38px;
  }
  .nav button {
    padding: 13px 8px;
  }
  .topbar .breadcrumb {
    font-size: 11px;
  }
  .topbar .breadcrumb span {
    margin-left: 7px;
  }
  .chip {
    font-size: 10px;
  }
  .panel-pad {
    padding: 19px;
  }
  .panel-head {
    padding: 18px;
  }
  .modal-body {
    padding: 18px !important;
  }
  #toast {
    left: 50%;
    width: calc(100% - 40px);
  }
  .history-item {
    padding: 18px;
  }
  .history-item header {
    flex-wrap: wrap;
  }
  .delivery {
    gap: 8px;
  }
  .delivery .status {
    font-size: 9px;
  }
  .inline-row {
    flex-wrap: wrap;
  }
  .inline-row input {
    min-width: 100%;
  }
  .top-right {
    gap: 8px;
  }
}

/* Выход из админки */
.logout {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--muted);
  padding: 6px 11px;
  font-size: 12px;
  border-radius: 8px;
  white-space: nowrap;
}
.logout:hover {
  background: var(--brand-soft);
  border-color: var(--brand-line);
  color: var(--brand);
}
.sidebar .logout {
  border-color: #6b2a31;
  color: #ecd3d5;
  margin-top: 6px;
}
.sidebar .logout:hover {
  background: var(--brand-deep-hover);
  border-color: #8a3a42;
  color: #fff;
}
@media (max-width: 700px) {
  .topbar .logout {
    padding: 6px 8px;
  }
}

/* Экран входа */
.login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  background: var(--bg);
}
.login-hero {
  background: var(--brand-gradient);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 32px;
}
.login-hero .logo {
  width: min(260px, 60%);
  height: auto;
}
.login-hero strong {
  display: block;
  margin-top: 18px;
  font-size: clamp(34px, 4.4vw, 58px);
  font-weight: 900;
  letter-spacing: 0.5px;
  line-height: 1;
  text-transform: uppercase;
}
.login-hero span {
  display: block;
  margin-top: 8px;
  font-size: clamp(16px, 1.9vw, 25px);
  font-weight: 700;
}
.login-side {
  display: grid;
  place-items: center;
  padding: 32px 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px 30px 30px;
  box-shadow: 0 18px 60px #6d0b1114;
}
.login-card h1 {
  font-size: 26px;
  font-weight: 800;
  letter-spacing: -0.6px;
  margin-bottom: 8px;
}
.login-hint {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 22px;
}
.login-card label {
  display: block;
  margin-bottom: 16px;
  color: var(--ink-soft);
}
.login-card label input {
  display: block;
  margin-top: 7px;
  font-weight: 400;
}
.login-error {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid var(--danger-line);
  border-left: 3px solid var(--danger);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 12px;
  line-height: 1.5;
  margin-bottom: 16px;
}
.login-card button[type="submit"] {
  width: 100%;
  padding: 13px 15px;
  font-weight: 700;
  margin-top: 6px;
}
@media (max-width: 760px) {
  .login {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr;
  }
  .login-hero {
    padding: 34px 20px 30px;
  }
  .login-hero .logo {
    width: 120px;
  }
  .login-hero strong {
    font-size: 32px;
    margin-top: 12px;
  }
  .login-hero span {
    font-size: 15px;
  }
  .login-side {
    place-items: start center;
    padding: 0 16px 32px;
  }
  .login-card {
    margin-top: -14px;
    padding: 26px 20px 22px;
    border-radius: 16px;
  }
  .login-card h1 {
    font-size: 22px;
  }
}

/* Логотип (встроенный SVG) */
.logo {
  display: block;
  aspect-ratio: 524 / 544;
  height: auto;
  flex: none;
}
.brand .logo {
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.brand:hover .logo {
  transform: translateY(-3px) scale(1.03);
}

/* Анимации */
:root {
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.4, 0.64, 1);
}
@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes fade-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 16px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}
@keyframes draw {
  from {
    stroke-dashoffset: 1200;
  }
  to {
    stroke-dashoffset: 0;
  }
}
@keyframes rise {
  from {
    opacity: 0;
    transform: scaleY(0);
  }
  to {
    opacity: 1;
    transform: scaleY(1);
  }
}
@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 #2f6fd033;
  }
  50% {
    box-shadow: 0 0 0 5px #2f6fd000;
  }
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
@keyframes shine {
  from {
    transform: translateX(-120%) skewX(-20deg);
  }
  to {
    transform: translateX(260%) skewX(-20deg);
  }
}

/* Переход между разделами: содержимое появляется каскадом */
.workspace.enter > *,
.workspace.enter .metrics > *,
.workspace.enter .overview-grid > * > *,
.workspace.enter .ad-grid > *,
.workspace.enter .bots-grid > *,
.workspace.enter .service-grid > *,
.workspace.enter .history-item,
.workspace.enter tbody tr {
  animation: fade-up 0.45s var(--ease-out) both;
}
.workspace.enter > :nth-child(2),
.workspace.enter .metrics > :nth-child(1),
.workspace.enter .ad-grid > :nth-child(1),
.workspace.enter .bots-grid > :nth-child(1),
.workspace.enter .service-grid > :nth-child(1),
.workspace.enter tbody tr:nth-child(1) {
  animation-delay: 0.05s;
}
.workspace.enter > :nth-child(3),
.workspace.enter .metrics > :nth-child(2),
.workspace.enter .ad-grid > :nth-child(2),
.workspace.enter .bots-grid > :nth-child(2),
.workspace.enter .service-grid > :nth-child(2),
.workspace.enter .overview-grid > * > :nth-child(1),
.workspace.enter tbody tr:nth-child(2) {
  animation-delay: 0.1s;
}
.workspace.enter > :nth-child(n + 4),
.workspace.enter .metrics > :nth-child(3),
.workspace.enter .ad-grid > :nth-child(3),
.workspace.enter .overview-grid > * > :nth-child(2),
.workspace.enter tbody tr:nth-child(3) {
  animation-delay: 0.15s;
}
.workspace.enter .ad-grid > :nth-child(n + 4),
.workspace.enter .overview-grid > * > :nth-child(n + 3),
.workspace.enter tbody tr:nth-child(n + 4),
.workspace.enter .history-item:nth-child(n + 2) {
  animation-delay: 0.2s;
}

/* Меню: мягкая подсветка и полоска активного пункта */
.nav button {
  position: relative;
  transition:
    background 0.25s var(--ease-out),
    color 0.25s var(--ease-out),
    box-shadow 0.3s var(--ease-out),
    transform 0.2s var(--ease-out);
}
.nav button .icon {
  transition: transform 0.3s var(--ease-spring);
}
.nav button:hover .icon {
  transform: scale(1.12);
}
.nav button:active {
  transform: scale(0.97);
}
.nav button.active {
  animation: pop-in 0.3s var(--ease-out);
}
.nav button::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 10px;
  bottom: 10px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: #fff;
  transform: scaleY(0);
  transition: transform 0.3s var(--ease-spring);
}
.nav button.active::before {
  transform: scaleY(1);
}

/* Кнопки и карточки */
button {
  transition:
    background 0.2s,
    color 0.2s,
    border-color 0.2s,
    box-shadow 0.25s var(--ease-out),
    transform 0.15s var(--ease-out);
}
button:not(:disabled):active {
  transform: scale(0.97);
}
button.primary {
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px #d0141c26;
}
button.primary:not(:disabled):hover {
  box-shadow: 0 8px 22px #d0141c40;
  transform: translateY(-1px);
}
button.primary::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 40%;
  background: linear-gradient(90deg, transparent, #ffffff40, transparent);
  transform: translateX(-120%) skewX(-20deg);
  pointer-events: none;
}
button.primary:not(:disabled):hover::after {
  animation: shine 0.8s var(--ease-out);
}
button .icon {
  transition: transform 0.25s var(--ease-spring);
}
button:not(:disabled):hover .icon {
  transform: translateX(1px) scale(1.06);
}
.panel,
.metric,
.ad-card,
.bot-card,
.welcome {
  transition:
    box-shadow 0.3s var(--ease-out),
    transform 0.3s var(--ease-out),
    border-color 0.3s;
}
.metric:hover,
.ad-card:hover,
.bot-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 14px 34px #6d0b1114;
}
.metric-head svg {
  transition: transform 0.4s var(--ease-spring);
}
.metric:hover .metric-head svg {
  transform: scale(1.15) rotate(-6deg);
}
.welcome:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 50px #a80f1638;
}
.welcome .lineart {
  transition:
    transform 0.6s var(--ease-out),
    opacity 0.6s;
}
.welcome:hover .lineart {
  transform: translateY(-6px);
  opacity: 0.32;
}
tbody tr {
  transition: background 0.2s;
}
tbody tr:hover {
  background: var(--brand-soft);
}
input,
select,
textarea,
.rich-editor {
  transition:
    border-color 0.2s,
    box-shadow 0.25s var(--ease-out);
}
.status {
  transition:
    background 0.3s,
    color 0.3s;
}
.status.sending {
  animation: pulse 1.4s ease-in-out infinite;
}
.notice,
.error-inline:not(:empty) {
  animation: fade-in 0.3s var(--ease-out);
}
.photo-item {
  animation: pop-in 0.35s var(--ease-spring) both;
}

/* Модальные окна и уведомления */
dialog[open] {
  animation: pop-in 0.32s var(--ease-out);
}
dialog[open]::backdrop {
  animation: fade-in 0.25s ease-out;
}
#toast {
  animation: toast-in 0.35s var(--ease-spring);
}
.offline {
  animation: fade-up 0.3s var(--ease-out);
}

/* Загрузка */
.loading::before {
  content: "";
  display: block;
  width: 34px;
  height: 34px;
  margin: 0 auto 18px;
  border-radius: 50%;
  border: 3px solid var(--brand-tint);
  border-top-color: var(--brand);
  animation: spin 0.8s linear infinite;
}

/* Экран входа: логотип «рисуется», карточка выезжает */
.login-hero .logo.draw g:first-of-type path {
  stroke-dasharray: 1200;
  animation: draw 1.4s var(--ease-out) both;
}
.login-hero .logo.draw g:first-of-type path:nth-child(2) {
  animation-delay: 0.15s;
}
.login-hero .logo.draw g:first-of-type path:nth-child(3) {
  animation-delay: 0.3s;
}
.login-hero .logo.draw g:last-of-type path {
  transform-box: fill-box;
  transform-origin: top;
  animation: rise 0.7s var(--ease-out) both;
  animation-delay: 0.9s;
}
.login-hero .logo.draw g:last-of-type path:nth-child(n + 6) {
  animation-delay: 1s;
}
.login-hero .logo.draw g:last-of-type path:nth-child(n + 11) {
  animation-delay: 1.1s;
}
.login-hero strong,
.login-hero span {
  animation: fade-up 0.6s var(--ease-out) both;
  animation-delay: 0.6s;
}
.login-hero span {
  animation-delay: 0.75s;
}
.login-card {
  animation: pop-in 0.55s var(--ease-out) both;
  animation-delay: 0.2s;
}
.login-card button[type="submit"]:disabled::before {
  content: "";
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid #ffffff66;
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
}
