:root {
  color-scheme: dark;
  --bg: #0f141a;
  --surface: #161d25;
  --surface-2: #1d2631;
  --surface-3: #111820;
  --surface-hover: #1a2733;
  --line: #334252;
  --line-soft: #263442;
  --text: #f3f7fb;
  --muted: #99b2c9;
  --blue: #4aa3ff;
  --blue-dark: #153c61;
  --green: #22c77a;
  --green-bg: #123c2b;
  --red: #ff6674;
  --red-bg: #462029;
  --yellow: #f5c451;
  --yellow-bg: #392f16;
  --focus: #79c4ff;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
body { min-height: 100%; margin: 0; background: var(--bg); color: var(--text); font-size: 13px; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button {
  min-height: 34px;
  border: 1px solid #3c5871;
  border-radius: 5px;
  background: #173c5f;
  color: var(--text);
  padding: 7px 11px;
  cursor: pointer;
}
button:hover { border-color: var(--focus); background: #1c4a73; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 2px solid var(--focus);
  outline-offset: 2px;
}
button:disabled { cursor: default; opacity: .46; }
input, select, textarea {
  width: 100%;
  min-width: 0;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #10171f;
  color: var(--text);
  padding: 8px 10px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
input::placeholder, textarea::placeholder { color: #6f879d; }
textarea { resize: vertical; line-height: 1.45; }
label { display: grid; gap: 6px; color: #bfd0df; font-size: 12px; }
label small { color: var(--muted); font-weight: 400; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 19px; }
h2 { font-size: 17px; }
h3 { font-size: 14px; }
.muted { color: var(--muted); }
.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;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  background: #111923f2;
  backdrop-filter: blur(12px);
  padding: 8px 16px;
}
.brand-row, .top-actions { display: flex; align-items: center; gap: 10px; }
.brand-copy { display: grid; gap: 2px; }
.brand-copy strong { color: var(--yellow); font-size: 15px; }
.brand-copy span { font-size: 11px; }
.home-link, .icon-button {
  width: 35px;
  height: 35px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: transparent;
  color: var(--yellow);
  padding: 0;
}
.home-link:hover, .icon-button:hover { border-color: var(--focus); background: #172331; }
.home-link svg, .icon-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.loading-line { position: absolute; left: 0; right: 0; bottom: -3px; height: 3px; overflow: hidden; background: #16202b; }
.loading-line span { display: block; width: 35%; height: 100%; background: linear-gradient(90deg, var(--blue), var(--green)); animation: loading 1.05s ease-in-out infinite; }
@keyframes loading { from { transform: translateX(-115%); } to { transform: translateX(315%); } }

.login-panel { position: fixed; inset: 56px 0 0; z-index: 70; display: grid; place-items: center; padding: 18px; background: #0d1319ee; }
.login-panel[hidden], .app-shell[hidden] { display: none; }
.login-box { width: min(360px, 100%); display: grid; gap: 13px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); padding: 21px; box-shadow: 0 20px 55px #0008; }
.login-box h1 { margin-bottom: -5px; }

.app-shell { width: min(1580px, 100%); display: grid; gap: 12px; margin: 0 auto; padding: 16px; }
.panel { min-width: 0; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); overflow: hidden; box-shadow: 0 8px 28px #0002; }
.panel-heading, .section-heading {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-2);
  padding: 11px 14px;
}
.panel-heading > div:first-child, .section-heading > div:first-child { min-width: 0; display: grid; gap: 4px; }
.panel-heading p { max-width: 780px; color: var(--muted); line-height: 1.4; }
.eyebrow { color: #8fb7da; font-size: 10px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.text-button { min-height: 29px; border-color: transparent; background: transparent; color: #8fcaff; padding: 4px 6px; }
.text-button:hover { border-color: #365876; background: #15283a; }
.primary-button { border-color: #3f7cb1; background: #1762a1; font-weight: 650; }
.primary-button:hover { background: #1b71b9; }
.success-button { border-color: #27855e; background: #176541; font-weight: 700; }
.success-button:hover { border-color: #44d395; background: #1d7b51; }

.scope-grid { display: grid; grid-template-columns: minmax(360px, 1.45fr) minmax(430px, 1fr); gap: 18px; padding: 14px; }
.office-selector-block { min-width: 0; display: grid; align-content: start; gap: 9px; }
.field-heading { min-height: 29px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.field-heading > div { display: flex; align-items: baseline; gap: 8px; }
.office-selector { min-height: 44px; display: flex; flex-wrap: wrap; gap: 7px; }
.office-chip { position: relative; display: inline-flex; }
.office-chip input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.office-chip span {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #101820;
  color: #b9cde0;
  padding: 7px 12px;
  cursor: pointer;
}
.office-chip span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #617589; box-shadow: 0 0 0 3px #25313c; }
.office-chip input:checked + span { border-color: #3986c7; background: #163651; color: #fff; }
.office-chip input:checked + span::before { background: var(--green); box-shadow: 0 0 0 3px #1e6249; }
.office-chip input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }
.anchor-fields { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(160px, .8fr) auto; align-items: end; gap: 9px; }
.load-context-button { white-space: nowrap; }
.inline-message { min-height: 0; color: var(--muted); padding: 0 14px; line-height: 1.4; }
.inline-message:not(:empty) { min-height: 37px; border-top: 1px solid var(--line-soft); padding-block: 9px; }
.inline-message.error { color: #ffabb3; background: #351d24; }
.inline-message.success { color: #82e5b5; background: #123024; }

.draft-grid { min-width: 0; display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(340px, .75fr); gap: 12px; }
.composer-form { display: grid; grid-template-columns: minmax(200px, .7fr) minmax(200px, .7fr) minmax(340px, 1.4fr); gap: 12px; padding: 14px; }
.body-field { grid-column: 3; grid-row: 1 / span 3; }
.body-field textarea { min-height: 218px; }
.body-field-footer { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; color: var(--muted); line-height: 1.35; }
.body-field-footer > :first-child { min-width: 0; }
.character-count { flex: 0 0 auto; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.character-count.warning { color: var(--red); font-weight: 700; }
.image-field { grid-column: 1 / 3; min-width: 0; display: grid; align-content: start; gap: 7px; border: 1px solid var(--line-soft); border-radius: 5px; background: #111820; padding: 10px; }
.image-field.selected { border-color: #3f718e; background: #12202b; }
.image-field-heading { display: flex; align-items: center; justify-content: space-between; gap: 9px; }
.image-field-heading > label { color: #bfd0df; }
.content-scope-badge, .broadcast-image-scope { border: 1px solid #426986; border-radius: 999px; background: #173047; color: #a9d5f5; padding: 2px 7px; font-size: 8px; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
#broadcast-image { min-height: 38px; padding: 0; color: var(--muted); }
#broadcast-image::file-selector-button { min-height: 36px; margin-right: 10px; border: 0; border-right: 1px solid var(--line); background: #173c5f; color: var(--text); padding: 7px 11px; cursor: pointer; }
#broadcast-image::file-selector-button:hover { background: #1c4a73; }
#broadcast-image:disabled::file-selector-button { cursor: default; }
.image-help { color: var(--muted); font-size: 9px; line-height: 1.4; }
.image-preview { min-width: 0; display: grid; grid-template-columns: 82px minmax(0, 1fr) auto; align-items: center; gap: 10px; border: 1px solid #36546b; border-radius: 5px; background: #0e171f; padding: 8px; }
.image-preview[hidden] { display: none; }
.image-preview img { width: 82px; height: 64px; border: 1px solid #3e5669; border-radius: 4px; background: #0b1117; object-fit: cover; }
.image-preview-copy { min-width: 0; display: grid; gap: 3px; }
.image-preview-copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-preview-copy span { color: var(--muted); font-size: 9px; line-height: 1.35; }
.image-remove-button { align-self: center; }
.field-message { min-height: 0; color: var(--muted); font-size: 10px; line-height: 1.35; }
.field-message:empty { display: none; }
.field-message.error { color: #ffabb3; }
.field-message.success { color: #82e5b5; }
.technical-key { grid-column: 1 / 3; min-width: 0; display: grid; align-content: start; gap: 6px; color: var(--muted); font-size: 11px; }
.technical-key code { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border: 1px solid var(--line-soft); background: #10171f; color: #8eb4d3; padding: 8px 9px; }
.summary-metrics { display: grid; grid-template-columns: repeat(4, 1fr); border-bottom: 1px solid var(--line); }
.summary-metrics > div { min-width: 0; display: grid; gap: 3px; border-right: 1px solid var(--line-soft); padding: 11px; }
.summary-metrics > div:last-child { border-right: 0; }
.summary-metrics span { color: #8fb7da; font-size: 9px; text-transform: uppercase; }
.summary-metrics strong { font-size: 22px; }
.summary-metrics small { overflow: hidden; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.summary-status-color { display: flex; align-items: center; gap: 5px; color: #c7d8e6 !important; }
.summary-status-color[hidden] { display: none; }
.physical-summary { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 12px; padding: 12px 14px; }
.physical-summary > span { color: #b9cde0; font-size: 12px; }
.physical-summary strong { grid-column: 2; grid-row: 1 / span 2; color: var(--green); font-size: 30px; }
.physical-summary small { color: var(--muted); }
.content-summary { display: grid; gap: 2px; border-top: 1px solid var(--line-soft); border-bottom: 1px solid var(--line-soft); background: #111820; padding: 10px 14px; }
.content-summary > span { color: #8fb7da; font-size: 9px; letter-spacing: .04em; text-transform: uppercase; }
.content-summary strong { color: #dceaf5; font-size: 12px; }
.content-summary small { color: var(--muted); font-size: 9px; }
.preview-button { width: calc(100% - 28px); margin: 0 14px 14px; }

.targets-heading { min-height: 64px; }
.destination-tabs { display: none; border-bottom: 1px solid var(--line); background: #111820; }
.destination-tab { flex: 1; border: 0; border-bottom: 2px solid transparent; border-radius: 0; background: transparent; color: var(--muted); }
.destination-tab span { display: inline-grid; min-width: 20px; min-height: 20px; place-items: center; border-radius: 10px; background: #293747; color: #c3d6e7; padding: 0 5px; font-size: 10px; }
.destination-tab.active { border-bottom-color: var(--blue); background: #172331; color: var(--text); }
.destination-grid { min-height: 430px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.destination-column { min-width: 0; display: grid; grid-template-rows: auto auto 1fr; border-right: 1px solid var(--line); background: var(--surface-3); }
.destination-column:nth-child(2) { grid-template-rows: auto auto auto 1fr; }
.destination-column:last-child { grid-template-rows: auto auto auto auto minmax(0, 1fr); border-right: 0; }
.destination-column-heading { min-height: 53px; display: flex; align-items: center; justify-content: space-between; gap: 9px; border-bottom: 1px solid var(--line-soft); padding: 8px 11px; }
.destination-column-heading > div { display: grid; gap: 2px; }
.destination-column-heading h3 { font-size: 15px; }
.announcement-rule, .status-rule { min-height: 39px; border-bottom: 1px solid #5d4f25; background: var(--yellow-bg); color: #efd883; padding: 10px 11px; font-size: 11px; }
.status-rule { border-color: #315574; background: #14283a; color: #9bc9ed; }
.status-color-fieldset { min-width: 0; margin: 0; border: 0; border-bottom: 1px solid var(--line-soft); background: #121d27; padding: 10px 11px 11px; }
.status-color-legend { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #d7e5f1; padding: 0; font-size: 11px; font-weight: 650; }
.status-scope-badge { border: 1px solid #426986; border-radius: 999px; background: #173047; color: #a9d5f5; padding: 2px 6px; font-size: 8px; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.status-color-options { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.status-color-option { position: relative; display: block; color: #d5e1eb; cursor: pointer; }
.status-color-option input { position: absolute; width: 1px; height: 1px; min-height: 1px; margin: 0; opacity: 0; pointer-events: none; }
.status-color-chip { min-height: 36px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid #3b4c5c; border-radius: 5px; background: #17222c; padding: 6px 7px; font-size: 10px; line-height: 1; }
.status-color-option:hover .status-color-chip { border-color: #66839b; background: #1a2935; }
.status-color-option input:checked + .status-color-chip { border-color: #85c8ff; background: #1c3244; box-shadow: inset 0 0 0 1px #85c8ff; }
.status-color-option input:focus-visible + .status-color-chip { outline: 2px solid var(--focus); outline-offset: 2px; }
.status-color-option-dot { width: 16px; height: 16px; flex: 0 0 16px; border: 1px solid #ffffff80; border-radius: 50%; background: var(--status-color); box-shadow: 0 0 0 1px #0005; }
.status-color-option-dot.automatic,
.status-color-dot.automatic { background: conic-gradient(#4f789b 0 20%, #537d69 0 40%, #7667a8 0 60%, #a86455 0 80%, #9a6076 0); }
.status-color-check { width: 11px; color: #a9d8ff; opacity: 0; font-weight: 800; }
.status-color-option input:checked + .status-color-chip .status-color-check { opacity: 1; }
.status-color-fieldset:disabled .status-color-options, .status-color-fieldset:disabled .status-color-preview { opacity: .42; }
.status-color-fieldset:disabled .status-color-option { cursor: default; }
.status-color-fieldset:disabled .status-color-option:hover .status-color-chip { border-color: #3b4c5c; background: #17222c; }
.status-color-help { display: block; margin-top: 7px; color: #8ba5ba; font-size: 9px; line-height: 1.4; }
.status-color-preview { min-height: 54px; display: grid; align-content: center; gap: 3px; margin-top: 8px; overflow: hidden; border: 1px solid #ffffff52; border-radius: 6px; background: var(--status-color); color: #fff; padding: 8px 10px; box-shadow: inset 0 0 22px #0001; }
.status-color-preview[hidden] { display: none; }
.status-color-fieldset.image-inactive { border-bottom-color: #4c5964; background: #171d22; }
.status-color-preview.automatic { background: linear-gradient(115deg, #4f789b, #537d69, #7667a8, #a86455, #9a6076); }
.status-color-preview > span { font-size: 8px; letter-spacing: .05em; opacity: .82; text-transform: uppercase; }
.status-color-preview > strong { display: -webkit-box; overflow: hidden; font-size: 11px; line-height: 1.35; white-space: pre-wrap; overflow-wrap: anywhere; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
.search-field { border-bottom: 1px solid var(--line-soft); padding: 8px; }
.search-field input { min-height: 33px; }
.target-list { min-height: 320px; max-height: 530px; overflow: auto; }
.target-card { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 9px; border-bottom: 1px solid var(--line-soft); background: transparent; padding: 11px; cursor: pointer; }
.target-card:hover { background: var(--surface-hover); }
.target-card.selected { background: #182d40; box-shadow: inset 3px 0 0 var(--blue); }
.target-card.blocked { cursor: default; opacity: .72; background: #18171b; }
.target-card input { width: 17px; min-height: 17px; margin: 2px 0 0; accent-color: var(--blue); }
.target-card-main { min-width: 0; display: grid; gap: 6px; }
.target-card-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.target-card-title strong { min-width: 0; overflow: hidden; line-height: 1.35; text-overflow: ellipsis; }
.target-meta, .target-executors { display: flex; flex-wrap: wrap; gap: 4px 9px; color: var(--muted); font-size: 10px; line-height: 1.35; }
.target-meta .audience { color: #7be7b4; }
.target-executors { display: grid; gap: 3px; }
.target-executors b { color: #b9cde0; font-weight: 550; }
.blocking-reasons { display: grid; gap: 3px; border-left: 2px solid var(--red); color: #ffabb3; padding-left: 7px; font-size: 10px; line-height: 1.35; }
.badge, .state-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 22px;
  border: 1px solid #3d5264;
  border-radius: 4px;
  background: #1c2935;
  color: #c3d6e7;
  padding: 2px 7px;
  font-size: 10px;
  white-space: nowrap;
}
.badge.available, .state-badge.ready, .state-badge.succeeded, .state-badge.dispatched, .state-badge.completed { border-color: #237c56; background: var(--green-bg); color: #7be7b4; }
.badge.blocked, .state-badge.failed, .state-badge.cancelled { border-color: #9b3f4a; background: var(--red-bg); color: #ffabb3; }
.state-badge.pending, .state-badge.queued, .state-badge.running, .state-badge.dispatching { border-color: #326b99; background: #17334b; color: #8dcbff; }
.state-badge.warning, .state-badge.partial { border-color: #8a7029; background: var(--yellow-bg); color: #f9d879; }
.state-badge.neutral { color: var(--muted); }
.empty-state { min-height: 180px; display: grid; place-items: center; color: #7891a8; padding: 22px; text-align: center; line-height: 1.45; }
.empty-state.compact { min-height: 82px; }

.preview-heading { flex-wrap: wrap; }
.preview-actions { display: flex; align-items: center; gap: 8px; }
.plan-summary { display: grid; grid-template-columns: repeat(5, minmax(100px, 1fr)); border-bottom: 1px solid var(--line); background: #111820; }
.plan-metric { min-height: 65px; display: grid; align-content: center; gap: 3px; border-right: 1px solid var(--line-soft); padding: 9px 13px; }
.plan-metric:last-child { border-right: 0; }
.plan-metric span { color: #8fb7da; font-size: 9px; letter-spacing: .04em; text-transform: uppercase; }
.plan-metric strong { font-size: 20px; }
.plan-warnings { grid-column: 1 / -1; display: grid; gap: 4px; border-top: 1px solid #5d4f25; background: var(--yellow-bg); color: #efd883; padding: 9px 12px; }
.broadcast-image-strip { grid-column: 1 / -1; min-width: 0; display: grid; grid-template-columns: 50px minmax(0, 1fr) auto; align-items: center; gap: 10px; border-top: 1px solid #315b75; background: #122634; padding: 8px 12px; }
.broadcast-image-strip > img, .broadcast-image-kind { width: 50px; height: 42px; display: grid; place-items: center; border: 1px solid #48708c; border-radius: 4px; background: #0d1821; color: #9dcdf4; object-fit: cover; font-size: 9px; font-weight: 750; }
.broadcast-image-strip > div { min-width: 0; display: grid; gap: 2px; }
.broadcast-image-strip > div > span { color: #8fb7da; font-size: 8px; letter-spacing: .04em; text-transform: uppercase; }
.broadcast-image-strip > div > strong { overflow: hidden; color: #dceaf5; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.broadcast-image-strip > div > small { color: var(--muted); font-size: 9px; }
.status-color-strip { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 9px; border-top: 1px solid #35576f; background: #142532; color: #b9cde0; padding: 8px 12px; font-size: 10px; }
.status-color-strip strong { color: #dceaf5; font-size: 10px; }
.status-color-dot { width: 11px; height: 11px; flex: 0 0 11px; border: 1px solid #ffffff80; border-radius: 50%; background: var(--status-color); box-shadow: 0 0 0 1px #0005; }
.status-color-inline { width: fit-content; display: inline-flex !important; align-items: center; gap: 5px; color: #b9d8ee !important; font-size: 10px !important; }
.plan-list { max-height: 520px; overflow: auto; }
.plan-row { min-height: 72px; display: grid; grid-template-columns: 30px minmax(200px, 1.2fr) minmax(160px, .8fr) minmax(180px, .8fr) minmax(160px, .75fr) auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--line-soft); padding: 9px 12px; }
.plan-row:last-child { border-bottom: 0; }
.plan-index { color: #6e879c; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; }
.plan-primary, .plan-cell { min-width: 0; display: grid; gap: 3px; }
.plan-primary strong, .plan-cell strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-primary span, .plan-cell span { color: var(--muted); font-size: 10px; line-height: 1.35; }
.plan-command { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; color: #a7cae7; font-size: 10px; }
.plan-row.blocked { background: #24191d; }

.history-workspace { min-height: 300px; display: grid; grid-template-columns: minmax(280px, 31%) minmax(0, 1fr); }
.history-list { max-height: 570px; overflow: auto; border-right: 1px solid var(--line); background: var(--surface-3); }
.history-row { width: 100%; min-height: 79px; display: grid; gap: 5px; border: 0; border-bottom: 1px solid var(--line-soft); border-radius: 0; background: transparent; text-align: left; padding: 10px 12px; }
.history-row:hover { border-color: var(--line-soft); background: var(--surface-hover); }
.history-row.active { background: #1b3043; box-shadow: inset 3px 0 0 var(--blue); }
.history-row-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.history-row-top strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.history-row-meta { display: flex; flex-wrap: wrap; gap: 5px 11px; color: var(--muted); font-size: 10px; }
.history-image-indicator { color: #91cef7; font-weight: 650; }
.history-detail { min-width: 0; max-height: 570px; overflow: auto; background: #10171f; }
.detail-header { position: sticky; top: 0; z-index: 2; display: grid; gap: 9px; border-bottom: 1px solid var(--line); background: #17212bf5; padding: 13px 15px; }
.history-detail > .status-color-strip { border-top: 0; border-bottom: 1px solid #35576f; }
.history-detail > .broadcast-image-strip { border-top: 0; border-bottom: 1px solid #315b75; }
.detail-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.detail-title > div { min-width: 0; display: grid; gap: 3px; }
.detail-title h3 { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 16px; }
.detail-stats { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--muted); font-size: 10px; }
.detail-body { border-bottom: 1px solid var(--line); color: #c8d7e4; padding: 12px 15px; line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.detail-target { display: grid; grid-template-columns: minmax(190px, 1fr) minmax(150px, .75fr) minmax(130px, .65fr) auto; align-items: center; gap: 10px; border-bottom: 1px solid var(--line-soft); padding: 10px 15px; }
.detail-target > div { min-width: 0; display: grid; gap: 3px; }
.detail-target span, .detail-target code { color: var(--muted); font-size: 10px; overflow-wrap: anywhere; }
.detail-target .target-timing { width: fit-content; line-height: 1.4; font-variant-numeric: tabular-nums; }
.detail-target .target-timing.published { color: #7be7b4; }
.detail-target .target-timing.result { color: #f9d879; }
.detail-target .target-error { grid-column: 1 / -1; border-left: 2px solid var(--red); color: #ffabb3; padding-left: 7px; }
.toast { position: fixed; z-index: 90; right: 18px; bottom: 18px; max-width: min(450px, calc(100vw - 36px)); border: 1px solid #52718d; border-radius: 6px; background: #1b2b39; padding: 11px 14px; box-shadow: 0 12px 34px #0009; }
.toast.error { border-color: var(--red); background: var(--red-bg); }

@media (max-width: 1180px) {
  .scope-grid { grid-template-columns: 1fr; }
  .draft-grid { grid-template-columns: 1fr; }
  .composer-form { grid-template-columns: 1fr 1fr; }
  .body-field { grid-column: 1 / -1; grid-row: auto; }
  .image-field, .technical-key { grid-column: 1 / -1; }
  .body-field textarea { min-height: 145px; }
  .plan-row { grid-template-columns: 28px minmax(180px, 1fr) minmax(150px, .8fr) minmax(150px, .8fr) auto; }
  .plan-command { grid-column: 2 / 5; }
}

@media (max-width: 850px) {
  .app-shell { padding: 10px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .top-actions { width: 100%; justify-content: flex-end; }
  .destination-tabs { display: flex; }
  .destination-grid { display: block; min-height: 420px; }
  .destination-column { display: none; min-height: 420px; border-right: 0; }
  .destination-column.active { display: grid; }
  .target-list { max-height: 580px; }
  .history-workspace { grid-template-columns: 1fr; }
  .history-list { max-height: 360px; border-right: 0; border-bottom: 1px solid var(--line); }
  .history-detail { max-height: none; }
  .plan-row { grid-template-columns: 26px minmax(180px, 1fr) auto; align-items: start; }
  .plan-cell { grid-column: 2; }
  .plan-command { grid-column: 2; }
  .plan-row > .state-badge { grid-column: 3; grid-row: 1; }
  .detail-target { grid-template-columns: 1fr auto; }
}

@media (max-width: 620px) {
  .app-shell { padding: 7px; }
  .topbar { padding-inline: 10px; }
  .top-actions { justify-content: flex-start; overflow-x: auto; }
  #last-update { display: none; }
  .panel-heading, .section-heading { align-items: flex-start; flex-direction: column; }
  .panel-heading > .state-badge { align-self: flex-start; }
  .scope-grid { padding: 11px; }
  .anchor-fields { grid-template-columns: 1fr; }
  .load-context-button { width: 100%; }
  .composer-form { grid-template-columns: 1fr; padding: 11px; }
  .body-field, .image-field, .technical-key { grid-column: auto; }
  .body-field-footer { flex-direction: column; gap: 3px; }
  .image-field-heading { align-items: flex-start; flex-direction: column; }
  .image-preview { grid-template-columns: 72px minmax(0, 1fr); }
  .image-preview img { width: 72px; height: 58px; }
  .image-remove-button { grid-column: 1 / -1; width: 100%; }
  .broadcast-image-strip { grid-template-columns: 44px minmax(0, 1fr); }
  .broadcast-image-strip > img, .broadcast-image-kind { width: 44px; height: 40px; }
  .broadcast-image-scope { grid-column: 1 / -1; width: fit-content; }
  .summary-metrics { grid-template-columns: repeat(2, 1fr); }
  .summary-metrics > div:nth-child(2) { border-right: 0; }
  .summary-metrics > div:nth-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
  .destination-tab { padding-inline: 5px; }
  .destination-tab span { display: none; }
  .destination-column-heading { align-items: flex-start; }
  .preview-heading { align-items: stretch; }
  .preview-actions { width: 100%; align-items: stretch; flex-direction: column; }
  .preview-actions .state-badge { align-self: flex-start; }
  .plan-summary { grid-template-columns: repeat(2, 1fr); }
  .plan-metric { border-bottom: 1px solid var(--line-soft); }
  .plan-metric:nth-child(even) { border-right: 0; }
  .plan-metric:nth-child(5) { grid-column: 1 / -1; border-bottom: 0; }
  .plan-row { grid-template-columns: 23px minmax(0, 1fr); }
  .plan-row > .state-badge { grid-column: 2; grid-row: auto; }
  .detail-target { grid-template-columns: 1fr; }
  .detail-target .target-error { grid-column: auto; }
}
