:root {
  color-scheme: light;
  --paper: #f4f6f8;
  --panel: #ffffff;
  --ink: #101828;
  --muted: #667085;
  --line: #dfe3e8;
  --blue: #2864d8;
  --green: #16864b;
  --red: #b42318;
}

* { box-sizing: border-box; }
html,
body { max-width: 100%; overflow-x: hidden; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: "Aptos", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}

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

button { cursor: pointer; }

.admin-shell { min-height: 100vh; }

.login-view {
  display: grid;
  min-height: 100vh;
  padding: 24px;
  place-items: center;
}

.login-panel {
  display: grid;
  width: min(100%, 390px);
  gap: 18px;
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 18px 50px rgba(16, 24, 40, .09);
}

.admin-logo {
  display: block;
  width: min(100%, 220px);
  height: auto;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

h1,
h2 { margin: 0; letter-spacing: 0; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.08rem; }

label {
  display: grid;
  gap: 7px;
  color: #344054;
  font-size: .84rem;
  font-weight: 700;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #cfd5dd;
  border-radius: 6px;
  outline: 0;
  color: var(--ink);
  background: #fff;
}

input { height: 44px; padding: 0 12px; }
textarea { padding: 11px 12px; resize: vertical; }
select { height: 44px; padding: 0 34px 0 12px; }
input:focus,
textarea:focus,
select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(40, 100, 216, .12); }

.primary-button,
.quiet-button,
.danger-button {
  min-height: 42px;
  padding: 0 15px;
  border-radius: 6px;
  font-weight: 780;
}

.primary-button { border: 1px solid var(--blue); color: #fff; background: var(--blue); }
.quiet-button { border: 1px solid #cfd5dd; color: #344054; background: #fff; }
.danger-button { border: 1px solid var(--red); color: #fff; background: var(--red); }
.primary-button:disabled,
.quiet-button:disabled { cursor: wait; opacity: .6; }
.danger-button:disabled { cursor: not-allowed; opacity: .55; }

.form-message { min-height: 18px; margin: 0; color: var(--red); font-size: .82rem; }

.dashboard { padding-bottom: 48px; }

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px max(18px, calc((100% - 1120px) / 2));
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.admin-header > div:first-child > p:last-child {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .8rem;
}

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

.admin-tabs {
  display: flex;
  width: min(calc(100% - 36px), 1120px);
  gap: 4px;
  margin: 18px auto 0;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e9edf2;
}

.admin-tabs button {
  min-height: 38px;
  flex: 1;
  border: 0;
  border-radius: 5px;
  color: #667085;
  background: transparent;
  font-size: .82rem;
  font-weight: 780;
}

.admin-tabs button[aria-selected="true"] {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 1px 4px rgba(16, 24, 40, .1);
}

.admin-tabs button:focus-visible {
  outline: 3px solid rgba(40, 100, 216, .24);
  outline-offset: 1px;
}

.metrics,
.delivery-section,
.occurrence-rules-section,
.dashboard-grid,
.history-section {
  width: min(calc(100% - 36px), 1120px);
  margin-right: auto;
  margin-left: auto;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 22px;
}

.metrics article {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metrics span { display: block; color: var(--muted); font-size: .78rem; }
.metrics strong { display: block; margin-top: 8px; font-size: 1.7rem; }

.delivery-section { margin-top: 28px; }

.occurrence-rules-section {
  margin-top: 28px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.occurrence-rules-heading {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(520px, 1.3fr);
  gap: 24px;
  align-items: end;
}

.occurrence-rules-heading p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.45;
}

.occurrence-rule-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto auto auto;
  gap: 8px;
  align-items: center;
}

.channel-choice {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid #d8dee7;
  border-radius: 6px;
  background: #fafbfc;
  font-size: .72rem;
  white-space: nowrap;
}

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

.occurrence-rules-legend,
.occurrence-rule-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 90px 100px;
  gap: 12px;
  align-items: center;
}

.occurrence-rules-legend {
  padding: 16px 10px 8px;
  color: var(--muted);
  font-size: .66rem;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.occurrence-rules-legend span:not(:first-child) { text-align: center; }

.occurrence-rule-row {
  min-height: 54px;
  padding: 8px 10px;
  border-top: 1px solid #e8ebef;
}

.occurrence-rule-row strong {
  overflow: hidden;
  font-size: .83rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.occurrence-rule-row label {
  display: flex;
  justify-content: center;
}

.occurrence-rule-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--blue);
}

.occurrence-rule-row.is-unsaved strong::after {
  margin-left: 7px;
  padding: 3px 6px;
  border-radius: 999px;
  color: #825900;
  background: #fff4d6;
  content: "Detectada";
  font-size: .58rem;
  letter-spacing: .03em;
  text-transform: uppercase;
}

.global-pause-row {
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid var(--line);
}

.control-copy strong,
.control-copy span { display: block; }
.control-copy strong { font-size: .91rem; }
.control-copy span { margin-top: 4px; color: var(--muted); font-size: .78rem; }

.switch-control {
  position: relative;
  display: inline-flex;
  flex: 0 0 auto;
  cursor: pointer;
}

.switch-control input { position: absolute; width: 1px; height: 1px; opacity: 0; }

.switch-track {
  position: relative;
  width: 48px;
  height: 28px;
  border: 1px solid #b7c0cc;
  border-radius: 999px;
  background: #dfe3e8;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.switch-track::after {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(16, 24, 40, .24);
  content: "";
  transition: transform 140ms ease;
}

.switch-control input:checked + .switch-track { border-color: var(--red); background: var(--red); }
.switch-control input:checked + .switch-track::after { transform: translateX(20px); }
.switch-control input:focus-visible + .switch-track { outline: 3px solid rgba(40, 100, 216, .24); outline-offset: 2px; }
.switch-control input:disabled + .switch-track { cursor: wait; opacity: .58; }

.line-pause-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  column-gap: 22px;
}

.line-pause-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 48px;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  border-bottom: 1px solid #e8ebef;
}

.line-pause-name strong,
.line-pause-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-pause-name strong { font-size: .84rem; }
.line-pause-name small { margin-top: 2px; color: var(--muted); font-size: .72rem; }
.control-message { min-height: 18px; margin: 10px 0 0; color: var(--muted); font-size: .78rem; }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, .85fr) minmax(360px, 1.15fr);
  gap: 28px;
  margin-top: 28px;
}

.admin-section { min-width: 0; }
.section-heading { padding-bottom: 12px; border-bottom: 1px solid var(--line); }

.line-stats { display: grid; margin-top: 8px; }
.line-stat {
  display: grid;
  grid-template-columns: 34px 1fr auto;
  gap: 12px;
  align-items: center;
  min-height: 52px;
  border-bottom: 1px solid #e8ebef;
}

.line-stat-number {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: var(--badge-ink);
  background: var(--line-color);
  font-size: .75rem;
  font-weight: 850;
}

.line-stat span:nth-child(2) { font-size: .88rem; font-weight: 700; }
.line-stat strong { font-size: .9rem; }

.composer form { display: grid; gap: 16px; margin-top: 17px; }
fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
legend { margin-bottom: 8px; color: #344054; font-size: .84rem; font-weight: 750; }

.target-control {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e9edf2;
}

.target-control legend { position: absolute; width: 1px; height: 1px; overflow: hidden; }
.target-control label { display: block; padding: 9px; border-radius: 5px; text-align: center; }
.target-control label:has(input:checked) { color: var(--ink); background: #fff; box-shadow: 0 1px 4px rgba(16, 24, 40, .08); }
.target-control input { position: absolute; opacity: 0; pointer-events: none; }

.line-options > div { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.line-options label { display: flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 9px; border: 1px solid var(--line); border-radius: 6px; background: #fff; }
.line-options input { width: 16px; height: 16px; }
.line-options small { margin-left: auto; color: var(--red); font-size: .67rem; }
.line-options label:has(input:disabled) { background: #f2f4f7; }
.line-options:disabled { opacity: .45; }

.history-section { margin-top: 34px; }
.history-list { min-width: 0; margin-top: 8px; overflow: hidden; }
.history-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 110px 90px 140px;
  gap: 14px;
  align-items: center;
  min-width: 0;
  min-height: 58px;
  border-bottom: 1px solid #e8ebef;
  font-size: .82rem;
}
.history-row strong,
.history-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-row span { color: var(--muted); }
.empty-state { padding: 28px 0; color: var(--muted); text-align: center; }

.history-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 14px;
}

.history-pagination span { color: var(--muted); font-size: .74rem; }
.history-pagination button { min-height: 36px; padding: 0 12px; font-size: .74rem; }
.history-pagination button:disabled { cursor: default; opacity: .45; }

.confirm-dialog { width: min(calc(100% - 32px), 430px); padding: 0; border: 0; border-radius: 8px; }
.confirm-dialog::backdrop { background: rgba(16, 24, 40, .48); }
.confirm-dialog > div { padding: 22px; }
.confirm-dialog p:not(.eyebrow) { color: var(--muted); line-height: 1.45; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 20px; }

/* Blog editorial */

.blog-admin {
  width: min(calc(100% - 36px), 1280px);
  margin: 26px auto 0;
}

.content-toolbar,
.editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.content-toolbar {
  padding: 22px;
  border: 1px solid #d9e2ef;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .045);
}

.content-toolbar h2,
.editor-toolbar h2 {
  color: #101828;
  font-size: 1.25rem;
  letter-spacing: -.025em;
}

.content-toolbar > div > p:last-child,
.editor-toolbar > div > p:last-child {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: .82rem;
  line-height: 1.45;
}

.blog-list-controls {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 240px);
  gap: 10px;
  margin-top: 20px;
}

.blog-post-list {
  display: grid;
  gap: 9px;
  margin-top: 8px;
}

.blog-admin-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px 19px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.blog-admin-row:hover {
  border-color: #b6c8e9;
  box-shadow: 0 8px 22px rgba(36, 76, 145, .07);
}

.blog-admin-row h3 {
  margin: 8px 0 5px;
  color: #101828;
  font-size: 1rem;
  line-height: 1.35;
}

.blog-admin-row p {
  margin: 0;
  color: var(--muted);
  font-size: .76rem;
}

.blog-admin-row__badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.blog-admin-row__badges > span {
  padding: 4px 7px;
  border-radius: 999px;
  color: #475467;
  background: #f2f4f7;
  font-size: .65rem;
  font-weight: 780;
  letter-spacing: .045em;
  text-transform: uppercase;
}

.blog-admin-row__badges .status-chip--published { color: #137044; background: #e9f8ef; }
.blog-admin-row__badges .status-chip--scheduled { color: #825900; background: #fff5d8; }
.blog-admin-row__badges .status-chip--draft { color: #525d6f; background: #edf0f4; }

.blog-admin-row__meta {
  display: grid;
  justify-items: end;
  gap: 9px;
}

.blog-admin-row__meta > span {
  color: var(--muted);
  font-size: .7rem;
}

.blog-list-empty {
  display: grid;
  gap: 7px;
  padding: 42px 20px;
  border: 1px dashed #c8d1dc;
  border-radius: 8px;
  background: rgba(255, 255, 255, .62);
}

.blog-editor {
  min-width: 0;
}

.editor-toolbar {
  position: sticky;
  z-index: 8;
  top: 0;
  margin: 0 -18px 20px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 246, 248, .96);
  box-shadow: 0 9px 18px rgba(16, 24, 40, .04);
  backdrop-filter: blur(12px);
}

.editor-toolbar > div:nth-child(2) {
  min-width: 0;
  flex: 1;
}

.editor-toolbar h2,
.editor-toolbar > div:nth-child(2) > p:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.back-button { flex: 0 0 auto; }
.editor-toolbar__actions { display: flex; flex: 0 0 auto; gap: 8px; }

.editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 18px;
  align-items: start;
}

.editor-main,
.editor-sidebar {
  display: grid;
  min-width: 0;
  gap: 18px;
}

.editor-sidebar {
  position: sticky;
  top: 102px;
}

.editor-card {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 5px 16px rgba(16, 24, 40, .035);
}

.editor-card__heading {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 1px solid #e7eaee;
}

.editor-card__heading > span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  font-size: .67rem;
  font-weight: 850;
}

.editor-card__heading h3 {
  margin: 0;
  color: #101828;
  font-size: .95rem;
}

.editor-card__heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: .73rem;
  line-height: 1.45;
}

.editor-card__heading--actions {
  grid-template-columns: 30px minmax(180px, 1fr) auto;
  align-items: center;
}

.compact-heading { margin-bottom: 16px; }

.block-add-control {
  display: flex;
  align-items: center;
  gap: 7px;
}

.block-add-control select { width: 170px; }
.block-add-control button { white-space: nowrap; }

.form-grid {
  display: grid;
  gap: 14px;
}

.form-grid--two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.form-grid .span-two { grid-column: 1 / -1; }
.form-stack { display: grid; gap: 14px; }

.editor-form label small,
.field-help {
  color: var(--muted);
  font-size: .7rem;
  font-weight: 500;
  line-height: 1.45;
}

.checkbox-row {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  padding: 9px 11px;
  border: 1px solid #d8dee7;
  border-radius: 6px;
  background: #fafbfc;
}

.checkbox-row input,
.relation-lines input,
.station-options input {
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  accent-color: var(--blue);
}

.content-blocks,
.source-list {
  display: grid;
  gap: 12px;
}

.content-block {
  overflow: hidden;
  border: 1px solid #dbe1e9;
  border-radius: 8px;
  background: #fbfcfe;
}

.content-block:focus-within {
  border-color: #aebfdd;
  box-shadow: 0 0 0 3px rgba(40, 100, 216, .07);
}

.content-block__header {
  display: flex;
  min-height: 45px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 10px;
  border-bottom: 1px solid #e3e7ed;
  background: #f3f6fa;
}

.content-block__header > div:first-child {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .77rem;
}

.drag-mark { color: #98a2b3; letter-spacing: -3px; }

.content-block__actions,
.source-row__actions {
  display: flex;
  gap: 3px;
}

.content-block__actions button,
.source-row__actions button {
  min-height: 30px;
  padding: 0 8px;
  border: 0;
  border-radius: 5px;
  color: #596579;
  background: transparent;
  font-size: .68rem;
  font-weight: 730;
}

.content-block__actions button:hover,
.source-row__actions button:hover { color: #1f55b5; background: #e9eff9; }
.content-block__actions button:last-child:hover,
.source-row__actions button:last-child:hover { color: var(--red); background: #fff0ee; }
.content-block__actions button:disabled,
.source-row__actions button:disabled { cursor: default; opacity: .35; }

.content-block__body { padding: 15px; }
.block-heading-grid { grid-template-columns: 110px minmax(0, 1fr); }

.rich-text-field {
  overflow: hidden;
  border: 1px solid #cfd5dd;
  border-radius: 7px;
  background: #fff;
  transition: border-color 140ms ease, box-shadow 140ms ease;
}

.rich-text-field:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(40, 100, 216, .1);
}

.format-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 42px;
  padding: 5px 7px;
  border-bottom: 1px solid #e3e7ed;
  background: #f7f9fc;
}

.format-toolbar > span {
  width: 1px;
  height: 22px;
  margin: 0 3px;
  background: #d8dee7;
}

.format-toolbar button {
  min-width: 32px;
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid transparent;
  border-radius: 5px;
  color: #344054;
  background: transparent;
  font-size: .73rem;
  font-weight: 730;
}

.format-toolbar button:hover,
.format-toolbar button:focus-visible {
  border-color: #c8d4e7;
  color: #1f55b5;
  background: #fff;
  outline: 0;
}

.rich-text-editor {
  min-height: 132px;
  padding: 13px 14px;
  outline: 0;
  color: var(--ink);
  font-size: .88rem;
  font-weight: 450;
  line-height: 1.65;
  white-space: pre-wrap;
}

.rich-text-editor:empty::before {
  color: #98a2b3;
  content: attr(data-placeholder);
  pointer-events: none;
}

.rich-text-editor a { color: #1f55b5; text-decoration: underline; text-underline-offset: 2px; }
.rich-text-field > small { display: block; padding: 0 14px 11px; }

.blocks-empty {
  padding: 28px 14px;
  border: 1px dashed #cbd4df;
  border-radius: 8px;
  color: var(--muted);
  background: #fafbfc;
  font-size: .8rem;
  text-align: center;
}

.editor-fieldset + .editor-fieldset {
  margin-top: 25px;
  padding-top: 23px;
  border-top: 1px solid #e6e9ee;
}

.editor-fieldset legend {
  margin-bottom: 12px;
  color: #344054;
  font-size: .83rem;
}

.relation-lines {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.relation-lines label {
  display: grid;
  grid-template-columns: 17px 28px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  min-height: 42px;
  padding: 6px 8px;
  border: 1px solid #dfe4eb;
  border-radius: 7px;
  background: #fff;
  font-size: .74rem;
}

.relation-lines .line-stat-number { width: 27px; height: 27px; font-size: .68rem; }

.station-search { margin-bottom: 8px; }
.station-options {
  display: grid;
  max-height: 260px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 2px 12px;
  padding: 7px;
  overflow-y: auto;
  border: 1px solid #d8dee7;
  border-radius: 7px;
  background: #fafbfc;
}

.station-options label {
  display: flex;
  min-width: 0;
  min-height: 35px;
  align-items: center;
  gap: 8px;
  padding: 5px 7px;
  border-radius: 5px;
  font-size: .73rem;
}

.station-options label:hover,
.station-options label:has(input:checked) { background: #edf3ff; }
.station-options label span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.station-empty { grid-column: 1 / -1; padding: 20px; color: var(--muted); text-align: center; font-size: .75rem; }
.field-help { margin: 8px 0 0; }

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

.fieldset-heading legend { margin: 0; }
.compact-button { min-height: 34px; padding: 0 10px; font-size: .72rem; }

.source-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid #dfe4eb;
  border-radius: 7px;
  background: #fafbfc;
}

.source-row__fields {
  display: grid;
  grid-template-columns: .8fr 1.3fr .8fr;
  gap: 9px;
}

.editor-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 20px;
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fff;
}

.editor-footer .form-message { flex: 1; }
.editor-footer__delete { display: grid; flex: 0 0 auto; gap: 5px; }
.editor-footer__delete small { max-width: 210px; color: var(--muted); font-size: .7rem; line-height: 1.35; }
.editor-footer__actions { display: flex; flex: 0 0 auto; gap: 8px; }

.preview-dialog {
  width: min(calc(100% - 28px), 850px);
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(16, 24, 40, .25);
}

.preview-dialog::backdrop { background: rgba(16, 24, 40, .58); }

.preview-dialog__header {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.preview-dialog__header h2 { max-width: 600px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-dialog .article-body {
  max-width: 680px;
  max-height: calc(100vh - 108px);
  margin: 0 auto;
  padding: 30px 24px 50px;
  overflow-y: auto;
}

/* Telegram */

.telegram-admin {
  width: min(calc(100% - 36px), 1120px);
  margin: 26px auto 0;
}

.connection-badge {
  flex: 0 0 auto;
  padding: 7px 10px;
  border-radius: 999px;
  color: #667085;
  background: #eef1f5;
  font-size: .7rem;
  font-weight: 800;
}

.connection-badge.is-ready { color: #087443; background: #e5f7ed; }
.connection-badge.is-disabled { color: #825900; background: #fff4d6; }

.telegram-grid {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(420px, 1.1fr);
  gap: 22px;
  margin-top: 22px;
}

.telegram-card {
  padding: 20px;
  border: 1px solid #d9e2ef;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(16, 24, 40, .04);
}

.telegram-card--wide { grid-column: 1 / -1; }

.telegram-form {
  display: grid;
  gap: 15px;
  margin-top: 17px;
}

.telegram-form label small {
  color: var(--muted);
  font-size: .69rem;
  font-weight: 500;
  line-height: 1.45;
}

.telegram-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.telegram-send-button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 17px;
  border: 1px solid #168acd;
  border-radius: 6px;
  color: #fff;
  background: #229ed9;
  font-weight: 800;
}

.telegram-send-button:hover { background: #168acd; }
.telegram-send-button:disabled { cursor: wait; opacity: .6; }

.telegram-history { margin-top: 28px; }
.telegram-history .history-row { grid-template-columns: minmax(180px, 1fr) 110px 90px 140px; }
.telegram-history .status-sent { color: #087443; }
.telegram-history .status-failed { color: var(--red); }

@media (max-width: 760px) {
  .admin-header { align-items: flex-start; padding: 18px; }
  .header-actions { flex-direction: column; }
  .metrics { grid-template-columns: 1fr; }
  .dashboard-grid { grid-template-columns: 1fr; }
  .line-pause-grid { grid-template-columns: 1fr; }
  .line-options > div { grid-template-columns: repeat(2, 1fr); }
  .history-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px 14px;
    padding: 12px 0;
  }
  .history-row strong { grid-column: 1 / -1; }
  .history-row span:nth-child(3) { text-align: right; }
  .history-row span:nth-child(4) { grid-column: 1 / -1; font-size: .72rem; }
  .occurrence-rules-heading { grid-template-columns: 1fr; align-items: stretch; }
  .occurrence-rule-form { grid-template-columns: minmax(0, 1fr) auto auto; }
  .occurrence-rule-form > input { grid-column: 1 / -1; }

  .telegram-admin { width: min(calc(100% - 24px), 1120px); margin-top: 18px; }
  .telegram-grid { grid-template-columns: 1fr; }

  .blog-admin { width: min(calc(100% - 24px), 1280px); margin-top: 18px; }
  .content-toolbar { align-items: flex-start; padding: 18px; }
  .content-toolbar > div { min-width: 0; }
  .blog-admin-row { grid-template-columns: 1fr; }
  .blog-admin-row__meta { display: flex; align-items: center; justify-content: space-between; }

  .editor-toolbar {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 11px;
    margin-right: -12px;
    margin-left: -12px;
    padding: 12px;
  }
  .editor-toolbar > div:nth-child(2) { grid-row: 1; grid-column: 1 / -1; }
  .editor-toolbar .back-button { grid-row: 2; grid-column: 1; justify-self: start; }
  .editor-toolbar__actions { grid-row: 2; grid-column: 2; }
  .editor-layout { grid-template-columns: 1fr; }
  .editor-sidebar { position: static; }
  .editor-card { padding: 16px; }
  .editor-card__heading--actions { grid-template-columns: 30px minmax(0, 1fr); }
  .block-add-control { grid-column: 1 / -1; }
  .block-add-control select { min-width: 0; flex: 1; width: auto; }
  .relation-lines { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .station-options { grid-template-columns: 1fr; }
  .source-row { grid-template-columns: 1fr; }
  .source-row__fields { grid-template-columns: 1fr; }
  .source-row__actions { justify-content: flex-end; }
  .editor-footer { align-items: stretch; flex-direction: column; }
  .editor-footer__actions { display: grid; grid-template-columns: 1fr 1fr; }
  .editor-footer__delete { align-items: start; }
}

@media (max-width: 520px) {
  .blog-list-controls { grid-template-columns: 1fr; }
  .content-toolbar { flex-direction: column; }
  .content-toolbar .primary-button { width: 100%; }
  .connection-badge { align-self: flex-start; }
  .telegram-actions { grid-template-columns: 1fr; }
  .occurrence-rule-form { grid-template-columns: 1fr 1fr; }
  .occurrence-rule-form > input,
  .occurrence-rule-form > button { grid-column: 1 / -1; }
  .occurrence-rules-legend { display: none; }
  .occurrence-rule-row { grid-template-columns: minmax(0, 1fr) 70px 80px; padding-right: 0; padding-left: 0; }
  .history-pagination { display: grid; grid-template-columns: 1fr 1fr; }
  .history-pagination span { grid-row: 1; grid-column: 1 / -1; text-align: center; }
  .form-grid--two,
  .block-heading-grid { grid-template-columns: 1fr; }
  .form-grid .span-two { grid-column: auto; }
  .relation-lines { grid-template-columns: 1fr; }
  .content-block__header { align-items: flex-start; flex-direction: column; }
  .content-block__actions { width: 100%; justify-content: flex-end; }
  .editor-toolbar__actions .quiet-button { display: none; }
}
