:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #5b6475;
  --line: #d9e1e8;
  --panel: #ffffff;
  --page: #f5f7fa;
  --accent: #1f7a68;
  --accent-strong: #155d50;
  --gold: #d6a13a;
  --danger: #b42318;
  font-family: Inter, Arial, Helvetica, sans-serif;
}

html {
  min-width: 320px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  overflow-x: clip;
}

a {
  color: inherit;
}

img,
svg,
video {
  max-width: 100%;
  height: auto;
}

.material-symbols-rounded {
  flex: 0 0 auto;
  display: inline-flex;
  font-size: 1.25rem;
  line-height: 1;
  vertical-align: -0.2em;
}

.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 20;
  transform: translateY(-180%);
  background: var(--ink);
  color: #fff;
  padding: 10px 12px;
  text-decoration: none;
  font-weight: 900;
}

.skip-link:focus {
  transform: translateY(0);
}

.login-page {
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) max(18px, env(safe-area-inset-bottom)) max(18px, env(safe-area-inset-left));
  background:
    linear-gradient(135deg, rgba(31, 122, 104, 0.10), rgba(214, 161, 58, 0.08)),
    var(--page);
}

.login-shell {
  width: min(1080px, 100%);
  min-height: min(680px, calc(100vh - 56px));
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 24px 70px rgba(17, 24, 39, 0.14);
}

.brand-panel,
.login-card {
  padding: clamp(28px, 5vw, 58px);
}

.brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-right: 1px solid var(--line);
  background:
    linear-gradient(rgba(255, 255, 255, 0.86), rgba(255, 255, 255, 0.92)),
    repeating-linear-gradient(90deg, rgba(31, 122, 104, 0.13) 0 1px, transparent 1px 68px),
    repeating-linear-gradient(0deg, rgba(214, 161, 58, 0.14) 0 1px, transparent 1px 68px);
}

.brand-mark,
.login-icon {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin-bottom: 28px;
  background: var(--ink);
  color: #bff4df;
}

.brand-mark .material-symbols-rounded,
.login-icon .material-symbols-rounded {
  font-size: 2rem;
}

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

h1,
h2,
p {
  margin-top: 0;
  overflow-wrap: anywhere;
}

h1 {
  margin-bottom: 16px;
  font-size: 4rem;
  line-height: 0.94;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 12px;
  font-size: 1.45rem;
  letter-spacing: 0;
}

.lede {
  max-width: 620px;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.65;
}

.signal-grid {
  display: grid;
  gap: 12px;
  margin-top: 34px;
  color: #273244;
  font-weight: 700;
}

.signal-grid span {
  display: flex;
  align-items: center;
  gap: 10px;
}

.signal-grid i {
  width: 10px;
  height: 10px;
  background: var(--gold);
}

.login-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.compact-login {
  width: min(460px, 100%);
  min-height: auto;
  grid-template-columns: 1fr;
  justify-self: center;
  align-self: center;
}

.compact-login .login-card {
  min-height: 520px;
  padding: clamp(30px, 6vw, 46px);
}

.login-card-centered {
  align-items: stretch;
}

.login-card-centered .brand-mark {
  margin-bottom: 22px;
}

.login-card-centered h1 {
  margin-bottom: 30px;
  font-size: 2.35rem;
  line-height: 1.05;
}

.login-card-centered .login-form {
  margin-top: 0;
}

.muted {
  color: var(--muted);
  line-height: 1.55;
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 22px;
}

label {
  display: grid;
  gap: 7px;
  color: #273244;
  font-weight: 800;
}

input,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfcfe;
  color: var(--ink);
  padding: 13px 14px;
  font: inherit;
}

select {
  min-height: 47px;
}

input:focus,
select:focus {
  outline: 3px solid rgba(31, 122, 104, 0.22);
  border-color: var(--accent);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  padding: 11px 15px;
  border: 1px solid transparent;
  text-decoration: none;
  font-weight: 900;
  cursor: pointer;
  text-align: center;
  overflow-wrap: anywhere;
}

.button.primary {
  background: var(--accent);
  color: #fff;
}

.button.primary:hover {
  background: var(--accent-strong);
}

.button.ghost {
  margin-top: 10px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
}

.button.danger {
  border-color: #f1b3ad;
  background: #fff;
  color: var(--danger);
}

.button.compact {
  min-height: 38px;
  padding: 8px 12px;
}

.alert {
  margin: 12px 0 0;
  padding: 11px 12px;
  border-left: 5px solid var(--danger);
  background: #fff0ed;
  color: #641e16;
  font-weight: 700;
}

.app-page {
  background: #f7f8fb;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 max(18px, env(safe-area-inset-right)) 0 max(18px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
}

.app-title {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-size: 1.05rem;
  font-weight: 900;
  min-width: 0;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 9px;
  color: #273244;
  text-decoration: none;
  font-weight: 900;
}

.nav-link.active {
  color: var(--accent);
}

.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 8px 12px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.session-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.dashboard {
  width: min(1120px, calc(100% - 32px - env(safe-area-inset-left) - env(safe-area-inset-right)));
  margin: 0 auto;
  padding: 44px 0 max(44px, env(safe-area-inset-bottom));
}

.dashboard-hero {
  padding: 12px 0 30px;
}

.dashboard-hero h1 {
  max-width: 760px;
}

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

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

.metric-card {
  min-height: 210px;
  min-width: 0;
  padding: 24px;
  border: 1px solid var(--line);
  background: #fff;
}

.metric-card .material-symbols-rounded {
  margin-bottom: 28px;
  color: var(--accent);
  font-size: 2rem;
}

.metric-card p,
.secure-panel p {
  color: var(--muted);
  line-height: 1.6;
}

.secure-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-top: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  background: #fff;
  min-width: 0;
}

.panel-icon {
  color: var(--gold);
  font-size: 4rem;
}

.pwa-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 18px;
  margin-top: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  background: #fff;
}

.pwa-copy {
  min-width: 0;
}

.pwa-copy p {
  max-width: 760px;
  color: var(--muted);
  line-height: 1.6;
}

.pwa-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.pwa-actions .button {
  min-width: 190px;
}

.button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.pwa-status {
  padding: 12px 14px;
  border-left: 5px solid var(--accent);
  background: #edf8f6;
  color: #273244;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.pwa-status[data-kind="ok"] {
  border-color: var(--accent);
  background: #edf8f6;
}

.pwa-status[data-kind="warn"] {
  border-color: var(--gold);
  background: #fff8e6;
}

.pwa-status[data-kind="error"] {
  border-color: var(--danger);
  background: #fff0ed;
}

.ios-install-steps {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.5;
}

.form-panel,
.event-list {
  display: grid;
  gap: 18px;
  margin-top: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  background: #fff;
}

.form-panel p,
.event-list p {
  color: var(--muted);
  line-height: 1.6;
}

.token-form {
  display: grid;
  gap: 16px;
  max-width: 760px;
}

.compact-form {
  max-width: 340px;
}

textarea {
  width: 100%;
  min-height: 132px;
  resize: vertical;
  border: 1px solid var(--line);
  background: #fbfcfe;
  color: var(--ink);
  padding: 13px 14px;
  font: inherit;
  line-height: 1.45;
}

textarea:focus {
  outline: 3px solid rgba(31, 122, 104, 0.22);
  border-color: var(--accent);
}

code {
  padding: 2px 5px;
  background: #eef3f6;
  color: #273244;
  overflow-wrap: anywhere;
}

.event-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 14px 0;
  border-top: 1px solid var(--line);
}

.event-row .material-symbols-rounded {
  color: var(--accent);
}

.event-row p {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.spec-page {
  width: min(1180px, calc(100% - 32px - env(safe-area-inset-left) - env(safe-area-inset-right)));
}

.spec-hero {
  padding-bottom: 22px;
}

.spec-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.spec-meta span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: #273244;
  font-weight: 800;
}

.spec-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  background: #fff;
}

.spec-toc a {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  color: #273244;
  text-decoration: none;
  font-weight: 900;
}

.spec-toc a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.spec-section {
  display: grid;
  gap: 18px;
  margin-top: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  background: #fff;
}

.spec-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.spec-heading > .material-symbols-rounded {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: #edf8f6;
  color: var(--accent);
  font-size: 1.7rem;
}

.spec-heading h2 {
  margin-bottom: 0;
}

.spec-section p,
.spec-list {
  color: var(--muted);
  line-height: 1.6;
}

.definition-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.definition-grid > div {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  background: #fbfcfe;
}

.definition-grid strong {
  display: block;
  margin-bottom: 7px;
  color: var(--ink);
}

.definition-grid p {
  margin-bottom: 0;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
}

.spec-table {
  width: 100%;
  min-width: 680px;
  border-collapse: collapse;
  background: #fff;
}

.spec-table th,
.spec-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  line-height: 1.5;
}

.spec-table th {
  background: #f1f5f7;
  color: #273244;
  font-size: 0.82rem;
  text-transform: uppercase;
}

.formula {
  margin: 0;
  overflow-x: auto;
  white-space: pre-wrap;
  padding: 16px;
  background: #111827;
  color: #e5edf4;
  font: 0.93rem/1.55 Consolas, "Liberation Mono", monospace;
}

.spec-callout {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  padding: 16px;
  border-left: 5px solid var(--accent);
  background: #edf8f6;
}

.spec-callout.danger {
  border-color: var(--danger);
  background: #fff0ed;
}

.spec-callout .material-symbols-rounded {
  color: var(--accent);
  font-size: 1.7rem;
}

.spec-callout.danger .material-symbols-rounded {
  color: var(--danger);
}

.spec-callout strong {
  display: block;
  margin-bottom: 4px;
}

.spec-callout p {
  margin-bottom: 0;
}

.spec-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
}

.docs-page {
  width: min(1280px, calc(100% - 32px - env(safe-area-inset-left) - env(safe-area-inset-right)));
}

.docs-hero {
  padding-bottom: 22px;
}

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

.docs-sidebar {
  position: sticky;
  top: 86px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  background: #fff;
}

.docs-nav {
  display: grid;
  gap: 8px;
}

.docs-nav a {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  background: #fbfcfe;
  color: #273244;
  text-decoration: none;
  font-weight: 900;
}

.docs-nav a:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.docs-content {
  min-width: 0;
}

.docs-section {
  display: grid;
  gap: 18px;
  min-width: 0;
  margin-bottom: 18px;
  padding: 28px;
  border: 1px solid var(--line);
  background: #fff;
  scroll-margin-top: 92px;
}

.docs-section p {
  color: var(--muted);
  line-height: 1.6;
}

.docs-section h3 {
  margin: 8px 0 -4px;
  color: #273244;
  font-size: 1.05rem;
}

.docs-section > p:last-child {
  margin-bottom: 0;
}

.strategy-page {
  width: min(1280px, calc(100% - 32px - env(safe-area-inset-left) - env(safe-area-inset-right)));
}

.strategy-hero {
  padding-bottom: 22px;
}

.strategy-status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.strategy-status-strip > div,
.activation-panel,
.profile-sidebar,
.profile-editor,
.preview-panel,
.settings-panel {
  min-width: 0;
  border: 1px solid var(--line);
  background: #fff;
}

.strategy-status-strip > div {
  display: grid;
  gap: 6px;
  padding: 16px;
}

.strategy-status-strip .material-symbols-rounded {
  color: var(--accent);
  font-size: 1.65rem;
}

.strategy-status-strip strong {
  color: var(--ink);
}

.strategy-status-strip p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.strategy-activation {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.activation-panel {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.button-row .button.ghost,
.button-row .button.danger {
  margin-top: 0;
}

.strategy-workbench {
  display: grid;
  grid-template-columns: minmax(230px, 0.72fr) minmax(0, 2fr) minmax(300px, 0.98fr);
  gap: 16px;
  align-items: start;
  margin-top: 18px;
}

.profile-sidebar,
.profile-editor,
.preview-panel {
  padding: 20px;
}

.profile-sidebar {
  position: sticky;
  top: 86px;
  display: grid;
  gap: 16px;
}

.sidebar-heading,
.editor-toolbar,
.section-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.section-title {
  justify-content: flex-start;
  align-items: center;
}

.section-title .material-symbols-rounded {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  background: #edf8f6;
  color: var(--accent);
  font-size: 1.45rem;
}

.section-title h3 {
  margin: 0;
  font-size: 1.1rem;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}

.icon-button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.profile-list {
  display: grid;
  gap: 8px;
}

.profile-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fbfcfe;
  color: #273244;
  text-align: left;
  cursor: pointer;
}

.profile-row.active {
  border-color: var(--accent);
  background: #edf8f6;
}

.profile-row .material-symbols-rounded {
  color: var(--accent);
}

.profile-row strong,
.profile-row small {
  display: block;
  overflow-wrap: anywhere;
}

.profile-row small {
  margin-top: 3px;
  color: var(--muted);
  text-transform: capitalize;
}

.profile-editor {
  display: grid;
  gap: 18px;
}

#strategy-form {
  display: grid;
  gap: 18px;
}

.strategy-message {
  padding: 12px 14px;
  border-left: 5px solid var(--accent);
  background: #edf8f6;
  color: #273244;
  line-height: 1.45;
}

.strategy-message[hidden] {
  display: none;
}

.strategy-message[data-kind="ok"] {
  border-color: var(--accent);
  background: #edf8f6;
}

.strategy-message[data-kind="warn"] {
  border-color: var(--gold);
  background: #fff8e6;
}

.strategy-message[data-kind="error"] {
  border-color: var(--danger);
  background: #fff0ed;
}

.editor-grid {
  display: grid;
  gap: 16px;
}

.settings-panel {
  display: grid;
  gap: 16px;
  padding: 20px;
}

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

.field-grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.field-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.toggle-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(180px, 0.7fr);
  gap: 14px;
  align-items: end;
}

.check-row {
  min-height: 47px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 13px;
  border: 1px solid var(--line);
  background: #fbfcfe;
}

.check-row input {
  width: auto;
  min-width: 18px;
  height: 18px;
  padding: 0;
}

.check-row span {
  min-width: 0;
}

.strategy-preview {
  position: sticky;
  top: 86px;
  display: grid;
  gap: 16px;
}

.preview-panel {
  display: grid;
  gap: 16px;
}

.preview-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.preview-metrics > div {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fbfcfe;
}

.preview-metrics span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

.preview-metrics strong {
  font-size: 1.05rem;
  overflow-wrap: anywhere;
}

.list-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.list-preview span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: #273244;
  font-weight: 900;
}

.preview-warning {
  padding: 10px 12px;
  border-left: 5px solid var(--gold);
  background: #fff8e6;
  color: #583f00;
  font-weight: 800;
  line-height: 1.45;
}

.preview-warning[hidden] {
  display: none;
}

.preview-history {
  display: grid;
  gap: 8px;
}

.preview-history-row {
  display: grid;
  gap: 3px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  background: #fbfcfe;
}

.preview-history-row strong {
  color: var(--ink);
  font-size: 0.9rem;
}

.preview-history-row span,
.preview-history-row small {
  color: var(--muted);
  line-height: 1.45;
}

.preview-history-row[data-kind="warn"] {
  border-color: rgba(214, 161, 58, 0.65);
  background: #fffaf0;
}

.muted-row {
  color: var(--muted);
}

.compact-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.5;
}

.runner-page {
  width: min(1280px, calc(100% - 32px - env(safe-area-inset-left) - env(safe-area-inset-right)));
}

.runner-hero {
  padding-bottom: 22px;
}

.runner-status-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.runner-status-strip > div {
  display: grid;
  gap: 6px;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  background: #fff;
}

.runner-status-strip .material-symbols-rounded {
  color: var(--accent);
  font-size: 1.65rem;
}

.production-strip .material-symbols-rounded {
  color: var(--danger);
}

.runner-status-strip p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.runner-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(230px, 0.65fr);
  gap: 16px;
  align-items: start;
  margin-top: 18px;
}

.runner-control,
.instance-sidebar,
.runner-report {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  background: #fff;
}

.runner-control {
  display: grid;
  gap: 16px;
}

.runner-form {
  display: grid;
  gap: 16px;
}

.instance-sidebar {
  position: sticky;
  top: 86px;
  display: grid;
  gap: 16px;
}

.runner-report {
  grid-column: 1 / -1;
  display: grid;
  gap: 16px;
}

.instance-list {
  display: grid;
  gap: 8px;
}

.instance-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  background: #fbfcfe;
  color: #273244;
  text-align: left;
  cursor: pointer;
}

.instance-row.active {
  border-color: var(--accent);
  background: #edf8f6;
}

.instance-row .material-symbols-rounded {
  color: var(--accent);
}

.instance-row strong,
.instance-row small {
  display: block;
  overflow-wrap: anywhere;
}

.instance-row small {
  margin-top: 3px;
  color: var(--muted);
}

.runner-progress {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #eef3f6;
}

.runner-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
}

.runner-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.runner-metrics > div {
  min-width: 0;
  padding: 13px;
  border: 1px solid var(--line);
  background: #fbfcfe;
}

.runner-metrics span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.runner-metrics strong {
  display: block;
  color: var(--ink);
  font-size: 1.04rem;
  overflow-wrap: anywhere;
}

.runner-log {
  display: grid;
  gap: 0;
}

.streamer-page {
  width: min(1280px, calc(100% - 32px - env(safe-area-inset-left) - env(safe-area-inset-right)));
}

.streamer-hero {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.stream-status {
  min-width: 220px;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.stream-status strong,
.stream-status span {
  display: block;
}

.stream-status strong {
  margin-bottom: 2px;
  font-size: 0.94rem;
}

.stream-status div span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.status-light {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #9aa4b2;
  box-shadow: 0 0 0 5px rgba(154, 164, 178, 0.14);
}

.stream-status[data-stream-status="ok"] .status-light {
  background: #1f7a68;
  box-shadow: 0 0 0 5px rgba(31, 122, 104, 0.16);
}

.stream-status[data-stream-status="warn"] .status-light {
  background: var(--gold);
  box-shadow: 0 0 0 5px rgba(214, 161, 58, 0.18);
}

.stream-status[data-stream-status="error"] .status-light {
  background: var(--danger);
  box-shadow: 0 0 0 5px rgba(180, 35, 24, 0.14);
}

.stream-control-panel,
.quote-headline,
.price-ladder,
.chart-panel,
.quote-metrics,
.stream-log-panel {
  border: 1px solid var(--line);
  background: #fff;
}

.stream-control-panel {
  padding: 18px;
}

.stream-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(120px, 150px) auto auto;
  align-items: end;
  gap: 14px;
}

.stream-mode,
.stream-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.mode-button {
  min-height: 47px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid var(--line);
  background: #fff;
  color: #273244;
  padding: 10px 12px;
  font: inherit;
  font-weight: 900;
  cursor: pointer;
}

.mode-button.active {
  border-color: rgba(31, 122, 104, 0.4);
  background: rgba(31, 122, 104, 0.08);
  color: var(--accent-strong);
}

.quote-headline {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(180px, 0.45fr) minmax(220px, 0.65fr);
  gap: 18px;
  align-items: stretch;
  margin-top: 18px;
  padding: 22px;
}

.quote-headline h2 {
  margin-bottom: 8px;
  font-size: 2rem;
}

.quote-price-block,
.quote-bbo {
  border-left: 1px solid var(--line);
  padding-left: 18px;
}

.quote-price-block span,
.quote-bbo span,
.quote-price-block small,
.quote-bbo small {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.quote-price-block strong {
  display: block;
  margin: 4px 0;
  font-size: 2.4rem;
  line-height: 1;
  overflow-wrap: anywhere;
}

.quote-price-block small[data-change="up"] {
  color: var(--accent-strong);
}

.quote-price-block small[data-change="down"] {
  color: var(--danger);
}

.quote-bbo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.quote-bbo strong {
  display: block;
  margin: 6px 0 2px;
  font-size: 1.55rem;
  overflow-wrap: anywhere;
}

.stream-layout {
  display: grid;
  grid-template-columns: minmax(210px, 0.62fr) minmax(0, 1.7fr) minmax(260px, 0.8fr);
  gap: 18px;
  align-items: start;
  margin-top: 18px;
}

.price-ladder,
.chart-panel,
.quote-metrics,
.stream-log-panel {
  padding: 20px;
}

.ladder-meta {
  margin-bottom: 14px;
  color: var(--muted);
  font-weight: 800;
}

.ladder-track {
  display: grid;
  gap: 0;
  border-left: 3px solid #d8e1e7;
}

.ladder-tick {
  min-height: 42px;
  display: grid;
  grid-template-columns: 22px 1fr;
  align-items: center;
  color: #273244;
}

.ladder-tick span {
  height: 2px;
  background: #aab5c1;
}

.ladder-tick strong {
  padding-left: 10px;
  font-size: 0.95rem;
}

.ladder-tick.active {
  color: var(--accent-strong);
}

.ladder-tick.active span {
  height: 4px;
  background: var(--accent);
}

.ladder-tick.active strong {
  font-size: 1.15rem;
}

.chart-panel canvas {
  width: 100%;
  min-height: 240px;
  display: block;
  border: 1px solid var(--line);
  background: #fff;
}

.quote-metrics dl {
  display: grid;
  gap: 0;
  margin: 0;
}

.quote-metrics dl div {
  display: grid;
  grid-template-columns: minmax(100px, 0.8fr) minmax(0, 1fr);
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.quote-metrics dt {
  color: var(--muted);
  font-weight: 800;
}

.quote-metrics dd {
  margin: 0;
  color: var(--ink);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.stream-log-panel {
  margin-top: 18px;
}

.stream-log {
  display: grid;
  gap: 8px;
}

.stream-log-row {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #fbfcfe;
}

.stream-log-row span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.stream-log-row strong {
  overflow-wrap: anywhere;
}

.stream-log-row[data-kind="ok"] {
  border-color: rgba(31, 122, 104, 0.28);
}

.stream-log-row[data-kind="error"] {
  border-color: rgba(180, 35, 24, 0.24);
  background: #fff8f6;
}

@media (max-width: 1360px) and (min-width: 1181px) {
  .topbar {
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .nav-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  .site-nav {
    width: 100%;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-top: 10px;
  }

  .site-nav.is-open {
    display: flex;
  }

  .nav-link,
  .session-pill,
  .button.compact {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .button.ghost {
    margin-top: 0;
  }
}

@media (max-width: 1180px) {
  .login-page {
    padding: 0;
    place-items: stretch;
  }

  .login-shell {
    min-height: 100svh;
    grid-template-columns: 1fr;
    border: 0;
  }

  .login-page .compact-login {
    width: 100%;
    min-height: 100svh;
  }

  .compact-login .login-card {
    min-height: 100svh;
  }

  .brand-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  h1 {
    font-size: 2.75rem;
    line-height: 1;
  }

  .topbar {
    min-height: 64px;
    flex-wrap: wrap;
    gap: 10px;
    padding-top: 10px;
    padding-bottom: 10px;
  }

  .nav-toggle {
    display: inline-flex;
    margin-left: auto;
  }

  .site-nav {
    width: 100%;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
    padding-top: 10px;
  }

  .site-nav.is-open {
    display: flex;
  }

  .nav-link,
  .session-pill,
  .button.compact {
    width: 100%;
    justify-content: center;
    min-height: 44px;
  }

  .button.ghost {
    margin-top: 0;
  }

  .dashboard {
    width: min(100% - 24px, 1120px);
    padding-top: 30px;
  }

  .metric-grid,
  .token-grid,
  .docs-layout,
  .strategy-status-strip,
  .strategy-activation,
  .strategy-workbench,
  .runner-status-strip,
  .runner-layout,
  .streamer-hero,
  .stream-form,
  .quote-headline,
  .stream-layout,
  .field-grid.two,
  .field-grid.three,
  .toggle-grid {
    grid-template-columns: 1fr;
  }

  .streamer-hero {
    display: grid;
  }

  .stream-status {
    width: 100%;
  }

  .quote-price-block,
  .quote-bbo {
    border-left: 0;
    border-top: 1px solid var(--line);
    padding-left: 0;
    padding-top: 16px;
  }

  .profile-sidebar,
  .docs-sidebar,
  .strategy-preview,
  .instance-sidebar {
    position: static;
  }

  .runner-report {
    grid-column: auto;
  }

  .runner-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .secure-panel {
    align-items: stretch;
    flex-direction: column;
    padding: 24px;
  }

  .pwa-panel {
    padding: 24px;
  }

  .form-panel,
  .event-list,
  .docs-section,
  .spec-section {
    padding: 24px;
  }

  .definition-grid {
    grid-template-columns: 1fr;
  }

  .spec-toc {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .docs-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .spec-toc a {
    justify-content: center;
  }

  .docs-nav a {
    justify-content: center;
    text-align: center;
  }

  .pwa-actions {
    flex-direction: column;
  }

  .pwa-actions .button {
    width: 100%;
    min-width: 0;
  }

  .editor-toolbar,
  .sidebar-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .editor-toolbar .button-row,
  .activation-panel .button-row,
  .runner-control .button-row {
    flex-direction: column;
    align-items: stretch;
  }

  .stream-mode,
  .stream-actions {
    width: 100%;
  }

  .mode-button,
  .stream-actions .button {
    flex: 1 1 0;
  }

  .panel-icon {
    align-self: flex-start;
  }
}

@media (max-width: 520px) {
  .brand-panel,
  .login-card {
    padding: 26px 20px;
  }

  .brand-mark,
  .login-icon {
    width: 48px;
    height: 48px;
    margin-bottom: 22px;
  }

  .signal-grid {
    margin-top: 26px;
  }

  .login-card-centered h1 {
    font-size: 2.05rem;
  }

  .button {
    width: 100%;
  }

  .docs-nav {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 0;
    padding: 20px;
  }

  .runner-metrics {
    grid-template-columns: 1fr;
  }

  .quote-headline,
  .price-ladder,
  .chart-panel,
  .quote-metrics,
  .stream-log-panel {
    padding: 18px;
  }

  .quote-price-block strong {
    font-size: 2rem;
  }

  .quote-bbo {
    grid-template-columns: 1fr;
  }

  .stream-log-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 360px) {
  .brand-panel,
  .login-card {
    padding: 22px 16px;
  }

  h1 {
    font-size: 2rem;
  }

  .login-card-centered h1 {
    font-size: 1.85rem;
  }

  .lede {
    font-size: 1rem;
  }

  .topbar {
    padding-left: 12px;
    padding-right: 12px;
  }

  .dashboard {
    width: calc(100% - 20px);
  }

  .spec-toc {
    grid-template-columns: 1fr;
  }

  .spec-section {
    padding: 20px;
  }

  .docs-section {
    padding: 20px;
  }

  .spec-heading {
    gap: 10px;
  }

  .spec-heading > .material-symbols-rounded {
    width: 38px;
    height: 38px;
    font-size: 1.45rem;
  }
}
