:root {
  color-scheme: dark;
  --bg: #09111f;
  --surface: #111c2d;
  --surface-2: #162338;
  --line: #26364d;
  --text: #edf3fa;
  --muted: #91a1b6;
  --accent: #75a7d8;
  --good: #55c69a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }
.brand { display: inline-flex; align-items: center; gap: .65rem; font-weight: 700; letter-spacing: -.01em; }
.brand-mark { display: grid; place-items: center; width: 1.8rem; height: 1.8rem; border: 1px solid #4a607c; border-radius: .45rem; color: #b9d6f2; font-size: .85rem; }
.eyebrow { margin: 0 0 .6rem; color: var(--accent); font-size: .73rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.muted { color: var(--muted); }
.public-header, .app-header { height: 4rem; padding: 0 clamp(1.25rem, 4vw, 4rem); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; }
.quiet-link { color: var(--muted); font-size: .87rem; }
.quiet-link:hover { color: var(--text); }
.public-main { min-height: calc(100vh - 4rem); display: grid; place-items: center; padding: 3rem 1.25rem; }
.intro-panel { max-width: 760px; text-align: center; }
.intro-panel h1 { margin: 0; font-size: clamp(2.25rem, 6vw, 4.5rem); line-height: 1.03; letter-spacing: -.055em; }
.lede { max-width: 620px; margin: 1.5rem auto; color: #a9b7c9; font-size: 1.1rem; line-height: 1.7; }
.flow { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: .75rem; margin-top: 2.5rem; color: var(--muted); font-size: .8rem; }
.flow span { padding: .65rem .85rem; border: 1px solid var(--line); border-radius: .45rem; background: rgba(17,28,45,.7); }
.flow i { color: #53677f; font-style: normal; }
.auth-body { display: grid; place-items: center; padding: 2rem 1rem; }
.auth-wrap { width: min(100%, 400px); }
.auth-brand { margin: 0 0 1.25rem; }
.auth-card { padding: 2rem; border: 1px solid var(--line); border-radius: .75rem; background: var(--surface); box-shadow: 0 24px 70px rgba(0,0,0,.25); }
.auth-card h1 { margin: 0; font-size: 1.75rem; }
.auth-card > .muted { margin: .5rem 0 1.5rem; font-size: .9rem; }
label { display: block; margin: 1rem 0 .45rem; color: #bdc9d8; font-size: .82rem; font-weight: 600; }
input { width: 100%; padding: .72rem .8rem; border: 1px solid #32445d; border-radius: .4rem; outline: none; background: #0c1625; color: var(--text); }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(117,167,216,.12); }
button, .button { display: inline-block; margin-top: 1.25rem; padding: .72rem 1rem; border: 0; border-radius: .4rem; background: #d7e8f7; color: #0b1726; font-weight: 700; cursor: pointer; }
.auth-card button { width: 100%; }
button:disabled { cursor: not-allowed; opacity: .45; }
.alert { padding: .7rem .8rem; border: 1px solid #74434c; border-radius: .4rem; background: #2e1b24; color: #efbcc4; font-size: .85rem; }
.app-header { position: relative; z-index: 2; padding: 0 1.5rem; background: #0d1726; }
.owner-menu { display: flex; align-items: center; gap: 1rem; color: var(--muted); font-size: .8rem; }
.owner-menu form { margin: 0; }
.button-quiet { width: auto; margin: 0; padding: .45rem .7rem; border: 1px solid var(--line); background: transparent; color: #c2cedc; font-size: .78rem; }
.app-shell { display: grid; grid-template-columns: 220px 1fr; min-height: calc(100vh - 4rem); }
.sidebar { padding: 1.5rem 1rem; border-right: 1px solid var(--line); background: #0c1625; }
.sidebar a, .sidebar span { display: flex; justify-content: space-between; margin-bottom: .25rem; padding: .65rem .75rem; border-radius: .4rem; color: #8293a9; font-size: .85rem; }
.sidebar .nav-active { background: var(--surface-2); color: var(--text); }
.sidebar span { opacity: .55; }
.sidebar small { font-size: .62rem; letter-spacing: .05em; text-transform: uppercase; }
.dashboard { width: 100%; max-width: 1200px; padding: 2.25rem clamp(1.25rem, 4vw, 3rem); }
.page-heading { display: flex; align-items: end; justify-content: space-between; margin-bottom: 1.75rem; }
.page-heading h1 { margin: 0; font-size: 1.8rem; letter-spacing: -.035em; }
.environment { padding: .35rem .6rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: .68rem; text-transform: uppercase; }
.health-grid, .stats-grid { display: grid; gap: 1rem; }
.health-grid { grid-template-columns: repeat(2, 1fr); }
.stats-grid { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); margin-top: 1rem; }
.health-card, .stat-card, .empty-state { border: 1px solid var(--line); border-radius: .6rem; background: var(--surface); }
.health-card { display: flex; align-items: flex-start; gap: .8rem; padding: 1.1rem; }
.health-card strong { font-size: .9rem; }
.health-card p { margin: .25rem 0 0; color: var(--muted); font-size: .75rem; }
.status-dot { width: .5rem; height: .5rem; margin-top: .35rem; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 4px rgba(85,198,154,.1); }
.stat-card { padding: 1.25rem; }
.stat-card span { display: block; color: var(--muted); font-size: .78rem; }
.stat-card strong { display: block; margin-top: .65rem; font-size: 1.85rem; font-weight: 600; }
.stat-card .state-text { font-size: 1.05rem; text-transform: capitalize; }
.empty-state { display: flex; align-items: center; gap: 1rem; margin-top: 1rem; padding: 1.25rem; }
.empty-icon { display: grid; place-items: center; flex: 0 0 2.5rem; height: 2.5rem; border-radius: .5rem; background: var(--surface-2); color: var(--accent); }
.empty-state h2 { margin: 0 0 .3rem; font-size: .95rem; }
.empty-state p { margin: 0; color: var(--muted); font-size: .78rem; }
.empty-state button { margin: 0 0 0 auto; font-size: .78rem; }
.empty-state .button { margin: 0 0 0 auto; font-size: .78rem; }
.action-panel, .config-card, .secret-panel { margin-top: 1rem; padding: 1.25rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--surface); }
.action-panel { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.action-panel h2, .config-card h2, .secret-panel h2 { margin: 0 0 .35rem; font-size: 1rem; }
.action-panel p, .secret-panel p { margin: 0; color: var(--muted); font-size: .8rem; }
.button-row, .inline-actions, .table-actions { display: flex; align-items: center; gap: .55rem; flex-wrap: wrap; }
.button-row .button, .inline-actions button { margin: 0; font-size: .78rem; }
.button-secondary { border: 1px solid var(--line); background: transparent; color: #c8d5e4; }
.config-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.status-badge { display: inline-block; padding: .28rem .5rem; border-radius: 999px; font-size: .68rem; font-weight: 700; text-transform: capitalize; }
.status-active { background: rgba(85,198,154,.12); color: #83dbb9; }
.status-paused { background: rgba(222,170,84,.12); color: #e5bd7b; }
.status-unset { background: #243146; color: #a6b4c6; }
.status-routed { background: rgba(85,198,154,.12); color: #83dbb9; }
.status-success { background: rgba(85,198,154,.12); color: #83dbb9; }
.status-pending, .status-processing { background: rgba(117,167,216,.12); color: #a9c9e8; }
.status-failed, .status-invalid { background: rgba(205,104,120,.12); color: #ef9baa; }
.notice { padding: .75rem; border: 1px solid #35455c; border-radius: .4rem; background: #0d1828; color: #aebdce; font-size: .8rem; }
.details { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin: 1.25rem 0; }
.details div { min-width: 0; }
.details dt { margin-bottom: .35rem; color: var(--muted); font-size: .7rem; text-transform: uppercase; }
.details dd { margin: 0; font-size: .82rem; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .82em; }
.code-block, .secret-panel > code { display: block; overflow-wrap: anywhere; margin-top: 1rem; padding: .8rem; border: 1px solid #34465f; border-radius: .4rem; background: #091321; color: #c6dcf0; user-select: all; }
.secret-panel { border-color: #526c89; background: #132238; }
.compact-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.table-wrap { overflow-x: auto; margin-top: 1rem; border: 1px solid var(--line); border-radius: .6rem; }
.embedded-table { border-radius: .4rem; }
table { width: 100%; border-collapse: collapse; background: var(--surface); font-size: .75rem; }
th, td { padding: .8rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; white-space: nowrap; }
th { color: var(--muted); font-size: .65rem; letter-spacing: .04em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
td strong, td small { display: block; }
td small { margin-top: .2rem; color: var(--muted); }
.table-actions { max-width: 180px; white-space: normal; }
.table-actions form { margin: 0; }
.table-actions a, .link-button { color: #a9c9e8; font-size: .72rem; }
.link-button { margin: 0; padding: 0; background: none; font-weight: 500; }
.form-page { max-width: 860px; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: .2rem 1rem; }
.form-actions { grid-column: 1 / -1; }
.field-help { margin: .35rem 0 0; color: var(--muted); font-size: .7rem; }
.field.full { grid-column: 1 / -1; }
.field small, .field-error { display: block; margin-top: .35rem; color: var(--muted); font-size: .7rem; }
.field-error { color: #ef9ba9; }
select { width: 100%; padding: .72rem .8rem; border: 1px solid #32445d; border-radius: .4rem; background: #0c1625; color: var(--text); font: inherit; }
input[readonly] { color: var(--muted); cursor: not-allowed; }
.latest-received { margin: .75rem 0 0; color: var(--muted); font-size: .74rem; }
.filter-bar { display: flex; align-items: end; gap: .65rem; flex-wrap: wrap; padding: .8rem; border: 1px solid var(--line); border-radius: .5rem; background: var(--surface); }
.filter-bar label { margin: 0; }
.filter-bar input, .filter-bar select { width: auto; min-width: 150px; }
.filter-bar button { margin: 0; padding: .66rem .85rem; }
.filter-bar .quiet-link { padding: .55rem; }
.detail-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wrap-value { overflow-wrap: anywhere; white-space: normal; }
.payload-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
pre { overflow: auto; max-height: 480px; margin: 1rem 0 0; padding: .8rem; border: 1px solid #34465f; border-radius: .4rem; background: #091321; color: #c6dcf0; font: .72rem/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }

@media (max-width: 720px) {
  .owner-menu > span { display: none; }
  .app-shell { display: block; }
  .sidebar { display: flex; overflow-x: auto; padding: .6rem 1rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar a, .sidebar span { flex: 0 0 auto; gap: .5rem; margin: 0 .2rem 0 0; }
  .health-grid, .stats-grid, .details, .form-grid, .payload-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .action-panel { align-items: flex-start; flex-direction: column; }
  .empty-state { align-items: flex-start; flex-wrap: wrap; }
  .empty-state button { width: 100%; margin: .25rem 0 0; }
}
