:root {
  --ink: #17212b;
  --muted: #687681;
  --line: #dbe3e7;
  --soft: #f4f7f8;
  --paper: #ffffff;
  --navy: #102b3f;
  --teal: #0e8f8f;
  --teal-dark: #086c6c;
  --orange: #d97835;
  --red: #b44b4b;
  --green: #287d5b;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: #eef2f3; font-size: 15px; }
a { color: inherit; text-decoration: none; }
button, input, textarea { font: inherit; }
.shell { min-height: 100vh; }
.topbar { min-height: 70px; padding: 0 4vw; display: flex; align-items: center; gap: 34px; background: var(--navy); color: #fff; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 190px; }
.brand-mark, .login-mark { width: 38px; height: 38px; display: grid; place-items: center; background: #d9b66f; color: var(--navy); font-weight: 800; letter-spacing: .04em; }
.brand strong { display: block; font-size: 15px; }
.brand small { display: block; margin-top: 2px; color: #b9c8cf; font-size: 11px; }
.nav { display: flex; align-self: stretch; align-items: center; gap: 21px; }
.nav a { height: 100%; display: inline-flex; align-items: center; color: #c9d5da; border-bottom: 3px solid transparent; }
.nav a:hover, .nav a.active { color: #fff; border-bottom-color: #d9b66f; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 18px; }
.muted { color: var(--muted); font-size: 13px; }
.topbar .muted { color: #b9c8cf; font-size: 12px; }
.link-button, .text-link, .back-link { border: 0; background: none; color: var(--teal-dark); cursor: pointer; padding: 0; }
.topbar .link-button { color: #fff; font-size: 13px; }
.main { max-width: 1320px; margin: 0 auto; padding: 38px 4vw 70px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 30px; margin-bottom: 27px; }
.eyebrow { color: var(--teal-dark); font-size: 11px; font-weight: 800; letter-spacing: .13em; margin: 0 0 8px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 7px; font-size: clamp(28px, 4vw, 42px); letter-spacing: -.02em; }
h2 { margin-bottom: 0; font-size: 18px; }
.subtitle { color: var(--muted); margin-bottom: 0; }
.primary-button, .small-button { border: 0; border-radius: 4px; cursor: pointer; font-weight: 700; }
.primary-button { padding: 11px 16px; color: #fff; background: var(--teal); }
.primary-button:hover { background: var(--teal-dark); }
.small-button { padding: 7px 9px; color: var(--teal-dark); background: #e7f3f2; font-size: 12px; }
.small-button.danger { color: var(--red); background: #faeaea; }
.status-row { min-height: 44px; display: flex; align-items: center; gap: 9px; margin-bottom: 16px; padding: 12px 15px; background: var(--paper); border: 1px solid var(--line); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #9aa6ab; }
.status-dot.on { background: var(--green); box-shadow: 0 0 0 4px #ddefe7; }
.status-dot.off { background: var(--orange); box-shadow: 0 0 0 4px #f9e9dc; }
.status-spacer { flex: 1; }
.integration, .tag, .run-status { display: inline-flex; align-items: center; padding: 4px 8px; border-radius: 3px; font-size: 12px; font-weight: 700; }
.integration.ready, .tag.green, .run-status.ok { color: var(--green); background: #e1f2e9; }
.integration.pending, .tag.gray, .run-status.error { color: #7c6a54; background: #f4ede2; }
.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 17px; }
.metric { min-height: 132px; padding: 19px; background: var(--paper); border: 1px solid var(--line); }
.metric span, .metric small { display: block; color: var(--muted); }
.metric strong { display: block; margin: 11px 0 3px; font-size: 31px; line-height: 1; }
.metric em { font-size: 14px; font-style: normal; font-weight: 600; }
.metric small { font-size: 12px; }
.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; margin-bottom: 17px; }
.panel { margin-bottom: 17px; padding: 22px; background: var(--paper); border: 1px solid var(--line); }
.panel-heading { display: flex; align-items: start; justify-content: space-between; gap: 15px; padding-bottom: 16px; margin-bottom: 4px; border-bottom: 1px solid var(--line); }
.panel-heading .eyebrow { margin-bottom: 5px; }
.order-search { display: flex; align-items: center; gap: 7px; width: min(470px, 100%); }
.order-search input { min-width: 0; padding: 7px 9px; }
.order-search .small-button { white-space: nowrap; }
.run-detail { display: grid; grid-template-columns: auto 1fr 1fr; align-items: center; gap: 14px; padding-top: 15px; }
.run-detail strong, .run-detail small, td strong, td small { display: block; }
.run-detail small, td small { margin-top: 4px; color: var(--muted); font-size: 12px; }
.notice { display: flex; flex-direction: column; gap: 6px; margin-top: 13px; padding: 14px; border-left: 3px solid var(--teal); background: #eef8f7; }
.notice span { color: var(--muted); font-size: 13px; }
.notice.warning { border-left-color: var(--orange); background: #fbf5ed; }
.notice.success { border-left-color: var(--green); background: #eff8f3; }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 760px; border-collapse: collapse; }
th, td { padding: 13px 10px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; font-weight: 800; }
tbody tr:last-child td { border-bottom: 0; }
.table-link { color: var(--teal-dark); font-weight: 800; }
.table-link:hover, .text-link:hover, .back-link:hover { text-decoration: underline; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.row-actions { display: flex; gap: 6px; }
.empty { padding: 26px 0 7px; color: var(--muted); }
.broadcast-form { display: grid; gap: 12px; margin-top: 15px; }
textarea, input { width: 100%; border: 1px solid #c9d4d9; border-radius: 3px; background: #fff; padding: 10px 11px; color: var(--ink); }
textarea:focus, input:focus { outline: 2px solid #b9e2df; border-color: var(--teal); }
.settings-form label { display: grid; gap: 7px; color: var(--ink); font-weight: 700; }
.settings-form label small { color: var(--muted); font-weight: 400; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; padding-top: 16px; }
.check-label { align-content: start; }
.check-label input { width: auto; justify-self: start; accent-color: var(--teal); }
.form-actions { display: flex; justify-content: end; }
.flash-stack { display: grid; gap: 8px; margin-bottom: 17px; }
.flash { padding: 11px 14px; border-left: 3px solid var(--teal); background: #eaf7f5; }
.flash.error { border-color: var(--red); background: #fbeeee; }
.flash.success { border-color: var(--green); background: #eef8f2; }
.detail-list { margin: 0; }
.detail-list div { display: grid; grid-template-columns: 110px 1fr; gap: 15px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.detail-list div:last-child { border-bottom: 0; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; white-space: pre-wrap; }
.latest-event { display: grid; gap: 9px; padding-top: 15px; }
.latest-event time, .latest-event small, .timeline time, .timeline small { color: var(--muted); font-size: 12px; }
.timeline { padding-top: 13px; }
.timeline-item { position: relative; display: grid; grid-template-columns: 18px 1fr; gap: 12px; padding: 0 0 22px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ""; position: absolute; left: 4px; top: 10px; bottom: -2px; width: 1px; background: var(--line); }
.timeline-item:last-child::before { display: none; }
.timeline-dot { position: relative; z-index: 1; width: 9px; height: 9px; margin-top: 3px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 4px #dcf1ef; }
.timeline-item time, .timeline-item strong, .timeline-item p, .timeline-item small { display: block; }
.timeline-item strong { margin-top: 5px; }
.timeline-item p { margin: 5px 0 3px; }
.login-page { min-height: 100vh; display: grid; place-items: center; background: #eef2f3; }
.login-shell { width: min(420px, calc(100% - 40px)); padding: 35px; background: #fff; border: 1px solid var(--line); }
.login-mark { width: 48px; height: 48px; margin-bottom: 25px; font-size: 17px; }
.login-shell h1 { font-size: 30px; }
.login-copy, .login-foot { color: var(--muted); }
.login-form { display: grid; gap: 8px; margin-top: 26px; }
.login-form label { margin-top: 7px; color: var(--ink); font-size: 13px; font-weight: 700; }
.login-form .primary-button { margin-top: 14px; padding: 13px; }
.login-foot { margin: 25px 0 0; font-size: 12px; }
.back-link { display: inline-block; margin-bottom: 24px; font-size: 13px; }
@media (max-width: 850px) {
  .topbar { flex-wrap: wrap; gap: 14px; padding: 14px 5vw 0; }
  .nav { order: 3; width: 100%; height: 42px; gap: 18px; overflow-x: auto; }
  .topbar-actions { margin-left: auto; }
  .main { padding: 28px 5vw 55px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .two-column { grid-template-columns: 1fr; gap: 0; }
}
@media (max-width: 540px) {
  .page-heading { align-items: start; flex-direction: column; gap: 16px; }
  .page-heading form, .page-heading form button { width: 100%; }
  .metric-grid { gap: 9px; }
  .metric { min-height: 112px; padding: 14px; }
  .metric strong { font-size: 26px; }
  .panel { padding: 16px; }
  .order-search { width: 100%; flex-wrap: wrap; }
  .order-search input { flex: 1 1 100%; }
  .status-row { flex-wrap: wrap; }
  .status-spacer { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .run-detail { grid-template-columns: 1fr; gap: 9px; }
  .login-shell { padding: 25px; }
}
