:root {
  color: #17191c;
  background: #eef0f2;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  --accent: #c51f32;
  --ink: #17191c;
  --muted: #697078;
  --line: #d5d9dd;
  --surface: #ffffff;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; min-height: 100vh; }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }
code, pre { font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace; }

.topbar {
  min-height: 76px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  color: #fff;
  background: #202328;
  border-bottom: 3px solid var(--accent);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 225px; }
.brand-mark { display: grid; place-items: center; width: 40px; height: 40px; background: var(--accent); font-weight: 800; }
.brand div { display: grid; gap: 2px; }
.brand strong { font-size: 17px; }
.brand span:last-child { color: #aeb4bb; font-size: 11px; text-transform: uppercase; }
.connection { display: flex; align-items: end; justify-content: flex-end; gap: 10px; flex: 1; }
label { display: grid; gap: 5px; }
label > span, .bound-request span { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; }
.connection label > span { color: #aeb4bb; }
input, select, textarea {
  width: 100%;
  border: 1px solid #c8cdd2;
  border-radius: 3px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  outline: none;
}
input:focus, select:focus, textarea:focus { border-color: #555d66; box-shadow: 0 0 0 2px rgba(255,255,255,.18); }
.connection input { width: clamp(140px, 17vw, 235px); border-color: #4d535a; background: #2b2f35; color: #fff; }
button { border: 1px solid #bfc5ca; border-radius: 3px; background: #fff; color: var(--ink); padding: 9px 13px; font-weight: 700; }
button:hover:not(:disabled) { border-color: #697078; background: #f5f6f7; }
button.primary { border-color: #fff; background: #fff; color: #202328; }
button.critical { width: 100%; border-color: var(--accent); background: var(--accent); color: #fff; padding: 12px; }

.workspace { display: grid; grid-template-columns: minmax(280px, 350px) minmax(430px, 1fr) minmax(300px, 370px); min-height: calc(100vh - 79px); }
.queue, .inspector, .actions { min-width: 0; padding: 24px; background: var(--surface); }
.queue, .inspector { border-right: 1px solid var(--line); }
.section-heading, .detail-heading, .payload-heading, .form-heading { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.eyebrow { margin: 0 0 5px; color: var(--accent); font-size: 11px; font-weight: 800; text-transform: uppercase; }
h1, h2, h3, p { letter-spacing: 0; }
h1 { margin: 0; font-size: 22px; line-height: 1.15; }
h2 { margin: 0; font-size: 24px; line-height: 1.2; }
h3 { margin: 0; font-size: 15px; }
.filters { display: flex; gap: 4px; margin: 22px 0 12px; }
.filter { padding: 6px 10px; color: var(--muted); background: transparent; border-color: transparent; }
.filter.active { color: var(--ink); border-bottom-color: var(--accent); }
.feed-status, .action-status { min-height: 18px; margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.message-list { display: grid; border-top: 1px solid var(--line); }
.message-row { display: grid; gap: 8px; width: 100%; padding: 14px 12px; border: 0; border-bottom: 1px solid var(--line); border-radius: 0; text-align: left; background: #fff; }
.message-row:hover { background: #f5f6f7; }
.message-row.selected { box-shadow: inset 3px 0 var(--accent); background: #f5f6f7; }
.row-top { display: flex; justify-content: space-between; align-items: center; }
.row-top strong { font-size: 12px; }
.row-top span { color: var(--muted); font-size: 10px; font-weight: 800; }
.row-top span[data-priority="CRITICAL"], .priority[data-priority="CRITICAL"] { color: var(--accent); }
.row-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 650; }
.message-row code { overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; }
.list-empty { padding: 20px 0; color: var(--muted); }

.inspector { background: #f8f9fa; }
.empty-state { max-width: 470px; margin: 30vh auto 0; text-align: center; }
.empty-code { display: inline-block; margin-bottom: 12px; color: var(--muted); font: 700 11px "SFMono-Regular", monospace; }
.empty-state p { color: var(--muted); }
.priority { align-self: center; border: 1px solid currentColor; padding: 5px 8px; font-size: 11px; font-weight: 800; }
.detail-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 30px 0 0; border-top: 1px solid var(--line); }
.detail-fields div { min-width: 0; padding: 16px 12px 16px 0; border-bottom: 1px solid var(--line); }
.detail-fields dt { color: var(--muted); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.detail-fields dd { margin: 7px 0 0; overflow-wrap: anywhere; font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }
.payload-section { margin-top: 28px; }
.payload-heading span { color: var(--muted); font-size: 11px; }
pre { max-height: 330px; margin: 12px 0 0; overflow: auto; padding: 16px; background: #22262b; color: #e9edf0; font-size: 12px; line-height: 1.6; }

.actions { display: flex; flex-direction: column; gap: 22px; }
.action-block { border-top: 3px solid var(--accent); padding-top: 16px; }
.action-block p, .muted { color: var(--muted); font-size: 13px; line-height: 1.55; }
.bound-request { display: grid; gap: 7px; margin: 16px 0; padding: 11px; background: #f0f2f4; }
.bound-request code { overflow-wrap: anywhere; font-size: 11px; }
.publish-form { margin-top: 8px; padding-top: 22px; border-top: 1px solid var(--line); }
.form-heading { align-items: center; margin-bottom: 14px; }
.toggle { display: flex; align-items: center; gap: 6px; }
.toggle input { width: 16px; height: 16px; }
.publish-form fieldset { display: grid; gap: 13px; margin: 0; padding: 0; border: 0; }
.publish-form textarea { resize: vertical; }
.action-status[data-kind="success"] { color: #12653b; }
.action-status[data-kind="error"] { color: var(--accent); }

@media (max-width: 1060px) {
  .topbar { align-items: flex-start; flex-direction: column; }
  .connection { width: 100%; justify-content: stretch; }
  .connection label { flex: 1; }
  .connection input { width: 100%; }
  .workspace { grid-template-columns: 320px minmax(430px, 1fr); }
  .actions { grid-column: 1 / -1; border-top: 1px solid var(--line); }
}

@media (max-width: 720px) {
  .connection { display: grid; grid-template-columns: 1fr; }
  .workspace { display: block; }
  .queue, .inspector { border-right: 0; border-bottom: 1px solid var(--line); }
  .inspector { min-height: 520px; }
  .empty-state { margin-top: 120px; }
  .detail-fields { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: no-preference) {
  .message-row { transition: background-color 140ms ease, box-shadow 140ms ease; }
  .action-status:not(:empty) { animation: status-in 180ms ease-out; }
  #record-detail:not([hidden]) { animation: detail-in 180ms ease-out; }
  @keyframes status-in { from { opacity: 0; transform: translateY(4px); } }
  @keyframes detail-in { from { opacity: 0; transform: translateY(6px); } }
}
