:root {
  color-scheme: dark;
  --bg: #0f1216;
  --panel: #161b22;
  --line: #303947;
  --fg: #e6edf3;
  --muted: #a5afbd;
  --accent: #3989fa;
  --error: #ff9391;
  --ok: #75d898;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font:
    16px/1.6 Inter,
    "Segoe UI",
    "Microsoft YaHei",
    sans-serif;
}
button,
input,
select,
textarea {
  font: inherit;
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #10161e;
}
button {
  padding: 9px 15px;
  min-height: 44px;
  cursor: pointer;
  transition:
    border-color 0.15s,
    background 0.15s;
}
button:hover {
  border-color: var(--accent);
  background: #1c2c43;
}
button:disabled {
  opacity: 0.55;
  cursor: wait;
}
button.primary {
  background: #2365c7;
  border-color: #3989fa;
}
button.danger,
.error {
  color: var(--error);
}
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
input,
select,
textarea {
  padding: 9px 11px;
  width: 100%;
  min-height: 44px;
}
input[type="checkbox"] {
  width: 19px;
  min-height: 19px;
  accent-color: var(--accent);
}
textarea {
  resize: vertical;
  font:
    14px/1.6 Consolas,
    monospace;
}
label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
small,
.muted {
  color: var(--muted);
  font-size: 13px;
}
.topbar {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.brand {
  font-size: 18px;
  font-weight: 650;
}
nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  flex: 1;
}
nav button {
  background: transparent;
  border-color: transparent;
}
nav button.active {
  border-color: var(--accent);
  background: #1a2a43;
}
main {
  max-width: 1480px;
  margin: auto;
  padding: 20px 24px 48px;
}
.tab {
  display: none;
}
.tab.active {
  display: block;
}
[hidden] {
  display: none !important;
}
.panel,
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 18px;
}
.panel-head,
.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.panel-head {
  justify-content: space-between;
  margin-bottom: 16px;
}
.row {
  margin-top: 14px;
}
.panel-head .row {
  margin-top: 0;
}
.row label {
  flex: 1;
  min-width: 180px;
}
h1,
h2,
h3 {
  margin: 0 0 14px;
}
h1,
h2 {
  font-size: 19px;
}
h3 {
  font-size: 16px;
  margin-top: 20px;
}
.panel-head h1,
.panel-head h2 {
  margin: 0;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}
.card .value {
  font-size: 26px;
  margin-top: 7px;
}
.card .label {
  color: var(--muted);
  font-size: 14px;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.capability-field {
  display: grid;
  align-content: start;
  gap: 5px;
  min-width: 0;
}
.capability-picker {
  position: relative;
  margin: 0;
}
.capability-picker summary,
.capability-options {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #10161e;
}
.capability-picker summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 11px;
}
.capability-picker summary::-webkit-details-marker {
  display: none;
}
.capability-picker summary::after {
  content: "";
  flex: 0 0 7px;
  height: 7px;
  border: solid var(--muted);
  border-width: 0 1px 1px 0;
  transform: rotate(45deg);
}
.capability-picker[open] summary::after {
  transform: rotate(225deg);
}
.capability-selection {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-width: 0;
}
.capability-tag {
  max-width: 100%;
  padding: 0 5px;
  border-radius: 4px;
  background: #1a2a43;
  font-size: 13px;
}
.capability-options {
  position: absolute;
  z-index: 1;
  top: calc(100% + 4px);
  inset-inline: 0;
  max-height: 16rem;
  overflow: auto;
  padding: 4px;
  box-shadow: 0 8px 18px #0006;
}
.capability-options label {
  min-height: 44px;
  padding: 4px 7px;
  border-radius: 5px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.capability-options label:hover {
  background: #1c2c43;
}
.capability-options input {
  flex-shrink: 0;
}
.checks {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  margin: 14px 0;
}
.checks label {
  flex-direction: row;
  align-items: center;
}
.table-wrap {
  overflow-x: auto;
  max-width: 100%;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
th,
td {
  text-align: left;
  padding: 12px 9px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
th {
  color: var(--muted);
  font-weight: 500;
  white-space: nowrap;
}
td input,
td select {
  min-width: 100px;
}
td .row {
  margin: 0;
  gap: 8px;
}
tr:last-child td {
  border-bottom: 0;
}
.mono {
  font-family: Consolas, monospace;
  overflow-wrap: anywhere;
}
.out {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #0d131b;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13px;
}
.out:empty {
  display: none;
}
.list-item {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--line);
  padding: 17px 0;
  flex-wrap: wrap;
}
.list-item:last-child {
  border-bottom: 0;
}
.list-item p {
  margin: 3px 0;
}
.list-item .row {
  margin: 0;
}
#notice {
  min-height: 26px;
  margin: 0 0 16px;
  color: var(--ok);
}
#notice.error {
  color: var(--error);
}
.login-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
}
.login-card {
  width: min(90vw, 380px);
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
}
.login-card input {
  margin: 12px 0;
}
.login-card button {
  width: 100%;
}
.err {
  color: var(--error);
}
@media (max-width: 700px) {
  main {
    padding: 16px 12px;
  }
  .topbar {
    padding: 12px;
  }
  .panel {
    padding: 15px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .row > * {
    flex: 1;
  }
  nav {
    flex-basis: 100%;
  }
  .list-item {
    gap: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
progress {
  display: block;
  width: 100%;
  min-width: 90px;
  height: 6px;
  margin-top: 8px;
  accent-color: var(--accent);
}
fieldset {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  min-width: 0;
  display: grid;
  gap: 12px;
}
legend {
  padding: 0 8px;
}
.check-label {
  flex-direction: row;
  align-items: center;
}
.model-picker {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 8px;
  max-height: 340px;
  overflow: auto;
  margin: 14px 0;
  padding: 6px;
}
.model-picker label {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  overflow-wrap: anywhere;
}
.chart-wrap {
  width: 100%;
  min-height: 240px;
  overflow: hidden;
}
canvas {
  display: block;
  max-width: 100%;
}
details {
  margin-top: 16px;
}
summary {
  cursor: pointer;
  min-height: 44px;
  padding: 8px 0;
}
dialog {
  width: min(560px, calc(100vw - 32px));
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 24px;
}
dialog::backdrop {
  background: rgb(0 0 0 / 65%);
}

:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #fff;
  --line: #e5e7eb;
  --fg: #20232a;
  --muted: #667085;
  --accent: #4f46e5;
  --error: #b42318;
  --ok: #067647;
  --control: #fff;
  --hover: #f0f1ff;
}
.login-body {
  margin: 0;
  padding: 24px 16px;
  min-height: 100dvh;
  box-sizing: border-box;
}
.login-card {
  width: min(100%, 420px);
  padding: 36px;
  box-shadow: 0 12px 40px #1018280a;
  box-sizing: border-box;
}
.login-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  background: var(--accent);
  color: white;
  border-radius: 12px;
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 20px;
}
.login-card h1 {
  margin: 0;
  font-size: 24px;
}
.login-card > .muted {
  margin: 6px 0 28px;
  font-size: 14px;
}
.login-card label {
  display: block;
  margin-top: 16px;
}
.login-card input {
  width: 100%;
  margin: 8px 0 0;
  min-height: 44px;
}
.login-password {
  display: flex;
  gap: 8px;
  align-items: center;
}
.login-password input {
  min-width: 0;
}
.login-password button {
  width: auto;
  min-height: 44px;
  margin-top: 8px;
}
#loginSubmit {
  margin-top: 24px;
  min-height: 44px;
}
.login-card .err {
  min-height: 22px;
  margin: 16px 0 0;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111318;
  --panel: #191c23;
  --line: #343843;
  --fg: #edf0f5;
  --muted: #adb5c5;
  --accent: #a5a1ff;
  --error: #fda29b;
  --ok: #75e0a7;
  --control: #151820;
  --hover: #25283a;
}
body {
  font:
    14px/1.6 Inter,
    "Segoe UI",
    "Microsoft YaHei",
    sans-serif;
  background: var(--bg);
}
button,
input,
select,
textarea {
  background: var(--control);
  border-color: var(--line);
  border-radius: 8px;
  font-size: 14px;
}
button {
  min-height: 38px;
  padding: 7px 12px;
  font-weight: 500;
  white-space: nowrap;
}
button:hover {
  background: var(--hover);
  border-color: var(--accent);
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}
button.primary {
  background: #4f46e5;
  border-color: #4f46e5;
  color: #fff;
}
button.primary:hover {
  background: #4338ca;
}
button.danger {
  color: var(--error);
}
input,
select,
textarea {
  min-height: 40px;
}
select:not([multiple]) {
  appearance: none;
  padding-inline-end: 32px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    right 17px center,
    right 12px center;
  background-repeat: no-repeat;
  background-size: 5px 5px;
  cursor: pointer;
}
select:not([multiple]):disabled {
  cursor: default;
  opacity: 0.65;
}
select option {
  background-color: var(--panel);
  color: var(--fg);
}
select[multiple] {
  min-height: 110px;
  padding: 8px;
}
select[multiple] option {
  padding: 6px 9px;
  border-radius: 4px;
}
select[multiple] option:checked {
  background: var(--hover);
  color: var(--accent);
}
@supports (appearance: base-select) and selector(::picker(select)) {
  select:not([multiple]),
  select:not([multiple])::picker(select) {
    appearance: base-select;
  }
  select:not([multiple]) {
    align-items: center;
    gap: 8px;
    padding-inline-end: 11px;
    background-image: none;
  }
  select:not([multiple])::picker-icon {
    content: "";
    flex: 0 0 7px;
    height: 7px;
    border: solid var(--muted);
    border-width: 0 1px 1px 0;
    transform: rotate(45deg);
  }
  select:not([multiple]):open::picker-icon {
    transform: rotate(225deg);
  }
  select:not([multiple])::picker(select) {
    max-height: min(18rem, 50vh);
    max-width: min(36rem, calc(100vw - 24px));
    margin-block: 4px;
    padding: 4px;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    color: var(--fg);
    box-shadow: 0 8px 24px #10182820;
  }
  select:not([multiple]) option {
    min-height: 44px;
    padding: 8px 10px;
    border-radius: 6px;
    white-space: normal;
    overflow-wrap: anywhere;
    cursor: pointer;
  }
  select:not([multiple]) option:hover,
  select:not([multiple]) option:focus-visible,
  select:not([multiple]) option:checked {
    background: var(--hover);
  }
  select:not([multiple]) option:checked {
    color: var(--accent);
    font-weight: 600;
  }
  select:not([multiple]) option:disabled {
    color: var(--muted);
    cursor: default;
  }
  select:not([multiple]) option::checkmark {
    order: 1;
    margin-inline-start: auto;
  }
}
small,
.muted {
  font-size: 12px;
  color: var(--muted);
}
.topbar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 220px;
  padding: 28px 18px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  flex-wrap: nowrap;
  gap: 28px;
  border-right: 1px solid var(--line);
  border-bottom: 0;
  background: var(--panel);
  z-index: 20;
}
.brand {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.4px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 0 10px;
}
.brand .muted {
  font-size: 12px;
  font-weight: 400;
}
.topbar nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.topbar nav button {
  border: 0;
  text-align: left;
  padding: 12px 14px;
  font-size: 14px;
  color: var(--muted);
  background: transparent;
}
.topbar nav button.active {
  background: var(--hover);
  color: var(--accent);
  font-weight: 600;
}
#logout {
  margin-top: auto;
  background: transparent;
}
main {
  margin: 0 0 0 220px;
  padding: 24px 30px 48px;
  max-width: none;
  width: auto;
}
.console-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 14px;
}
#themeToggle {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
#themeToggle::before {
  content: "";
  width: 13px;
  height: 13px;
  border-radius: 50%;
  box-shadow: inset 4px -2px 0 currentColor;
}
#themeToggle[aria-pressed="true"] {
  color: var(--accent);
  background: var(--hover);
}
.panel {
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  margin-bottom: 20px;
  box-shadow: 0 1px 2px #10182805;
}
.panel-head {
  gap: 16px;
  margin-bottom: 18px;
}
h1 {
  font-size: 20px;
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.3px;
}
h2 {
  font-size: 17px;
  font-weight: 650;
}
h3 {
  font-size: 15px;
  margin: 24px 0 12px;
}
.toolbar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin: 18px 0 12px;
}
.toolbar .search {
  min-width: 220px;
  flex: 1;
  max-width: 420px;
}
.toolbar > label {
  min-width: 180px;
}
.channel-model-field {
  flex: 0 1 220px;
  min-width: 180px;
}
.channel-filter-bar input[type="search"],
.channel-filter-bar > button,
.channel-filter-bar summary {
  min-height: 44px;
}
.channel-model-picker #channelModelSelection {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.channel-model-picker .capability-options {
  z-index: 11;
}
.channel-model-picker .capability-options button {
  display: block;
  width: 100%;
  min-height: 44px;
  text-align: left;
  white-space: normal;
  overflow-wrap: anywhere;
  background: transparent;
  border-color: transparent;
}
.channel-model-picker .capability-options button:hover,
.channel-model-picker .capability-options button[aria-pressed="true"] {
  background: var(--hover);
}
.channel-model-picker .capability-options button[aria-pressed="true"] {
  color: var(--accent);
  font-weight: 600;
}
.table-wrap {
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: auto;
  margin-top: 14px;
}
table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
  font-size: 13px;
}
th {
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  padding: 12px 14px;
  position: static;
}
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: 0;
}
tbody tr:hover {
  background: var(--bg);
}
.text-button {
  padding: 0;
  min-height: 24px;
  background: none;
  border: 0;
  color: var(--accent);
  font-weight: 600;
  text-align: left;
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.text-button:hover {
  background: none;
  text-decoration: underline;
}
.cell-note {
  display: block;
  font-size: 12px;
  margin-top: 4px;
  color: var(--muted);
  max-width: 300px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.inline-number {
  width: 82px;
  padding: 6px 8px;
  height: 34px;
  min-height: 34px;
}
#channelList .inline-number {
  vertical-align: middle;
}
#channelList [data-channel-number="weight"] + .cell-note {
  display: inline-block;
  margin: 0 0 0 8px;
  vertical-align: middle;
}
.row {
  gap: 10px;
}
.row.filter-row {
  align-items: flex-end;
}
.row.filter-row > button,
.row.filter-row > label > :is(input, select) {
  min-height: 44px;
}
.actions {
  gap: 6px;
}
.row.actions {
  margin: 0;
  flex-wrap: nowrap;
}
.actions button,
.action-menu summary {
  font-size: 12px;
  padding: 6px 9px;
  min-height: 34px;
}
.column-picker,
.action-menu {
  position: relative;
}
.action-menu {
  margin: 0;
}
summary {
  cursor: pointer;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 8px 12px;
  background: var(--control);
}
.column-picker > div {
  position: absolute;
  right: 0;
  z-index: 10;
  width: 190px;
  padding: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px #10182815;
  border-radius: 9px;
}
.column-picker .check {
  display: flex;
  flex-direction: row;
  align-items: center;
  margin: 7px 0;
}
.action-menu[open] > div {
  position: fixed;
  z-index: 60;
  min-width: 180px;
  padding: 7px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: 0 8px 24px #10182820;
  border-radius: 9px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.action-menu > div button {
  text-align: left;
  border: 0;
  background: transparent;
}
.cards {
  gap: 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 20px;
}
.card .label {
  font-size: 13px;
  color: var(--muted);
}
.card .value {
  font-size: 27px;
  font-weight: 650;
  line-height: 1.4;
  margin-top: 9px;
}
.list-item {
  border-bottom: 1px solid var(--line);
  padding: 15px 0;
}
.list-item:last-child {
  border-bottom: 0;
}
.subnav {
  display: flex;
  gap: 8px;
  padding: 0 0 18px;
}
.subnav button.active {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--hover);
}
.editor-dialog {
  width: min(1180px, calc(100vw - 40px));
  max-width: 1180px;
  max-height: 90vh;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel);
  color: var(--fg);
  box-shadow: 0 24px 80px #10182830;
}
.editor-dialog[open] {
  display: flex;
  flex-direction: column;
}
dialog::backdrop {
  background: #10182880;
  backdrop-filter: blur(2px);
}
.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
  background: var(--panel);
}
.dialog-header h2 {
  margin: 0;
  font-size: 18px;
}
.dialog-body {
  padding: 22px 24px;
  overflow: auto;
  min-height: 0;
}
.dialog-body .panel {
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
}
.dialog-body > form > h2 {
  display: none;
}
.dialog-body form > .row:last-child {
  position: sticky;
  bottom: -22px;
  background: var(--panel);
  padding: 16px 0;
  margin-top: 20px;
  border-top: 1px solid var(--line);
  z-index: 5;
}
.editor-dialog > form {
  padding: 22px 24px;
  overflow: auto;
}
.key-dialog {
  max-width: 600px;
}
.editor-dialog.key-dialog > form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  padding: 0;
  overflow: hidden;
}
.key-fields > :is(label, .capability-field, .key-total-quota) {
  margin-bottom: 14px;
}
.key-total-quota .row {
  align-items: flex-end;
  margin: 0 0 6px;
}
.key-total-quota label:first-child {
  flex: 1 1 8rem;
  min-width: 0;
}
.key-fields > fieldset {
  min-width: 0;
  margin: 0;
}
.key-dialog-footer {
  flex-shrink: 0;
  padding: 12px clamp(16px, 4vw, 24px);
  border-top: 1px solid var(--line);
}
.key-dialog-footer .dialog-notice:empty {
  display: none;
}
.key-dialog-footer button {
  min-height: 44px;
}
.key-model-picker .capability-options {
  position: static;
  margin-top: 4px;
  max-height: 12rem;
  box-shadow: none;
}
.key-model-picker .capability-options label:hover {
  background: var(--hover);
}
.key-dialog :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.key-dialog .error {
  color: var(--error);
}
.key-dialog .key-quota-fields {
  gap: 10px;
}
.key-name-cell,
.key-model-cell {
  min-width: 9rem;
  overflow-wrap: anywhere;
}
.key-usage-line {
  display: block;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.price-multiplier {
  color: var(--ok);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.channel-multipliers {
  margin: 0;
}
.channel-multipliers summary {
  min-height: 0;
  padding: 2px 0;
}
.channel-multiplier-row,
.pricing-rule {
  overflow-wrap: anywhere;
}
#channelMappingRows [data-map="multiplier"] {
  color: var(--ok);
  min-width: 6rem;
}
#channelMappingRows [data-map="pricing"] {
  min-width: 8rem;
}
.key-actions {
  white-space: nowrap;
}
.key-actions button + button {
  margin-left: 6px;
}
.editor-pane .panel-head h1 {
  font-size: 18px;
}
.form-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.checks,
.check {
  align-items: center;
}
.check {
  display: flex;
  flex-direction: row;
  gap: 9px;
  margin: 12px 0;
}
input[type="checkbox"] {
  flex-shrink: 0;
}
.out {
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 9px;
  padding: 16px;
  max-height: 420px;
  overflow: auto;
  font-size: 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
#notice {
  margin: 0 0 14px;
  min-height: 20px;
  color: var(--ok);
}
#notice:empty {
  display: none;
}
#notice.error {
  color: var(--error);
}
#notice a,
.dialog-notice a {
  color: inherit;
  font-weight: 600;
}
#migrationBanner {
  border-color: #fdb022;
  background: var(--panel);
}
.capability-picker summary,
.capability-options {
  background: var(--control);
  border-color: var(--line);
}
.capability-tag {
  background: var(--hover);
  color: var(--accent);
  border-color: var(--line);
}
[hidden] {
  display: none !important;
}
@media (max-width: 1100px) {
  .topbar {
    width: 180px;
  }
  main {
    margin-left: 180px;
    padding: 20px;
  }
  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 760px) {
  .topbar {
    position: relative;
    width: auto;
    padding: 14px 16px;
    gap: 14px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding: 0;
  }
  .topbar nav {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 4px;
  }
  .topbar nav button {
    padding: 8px 10px;
  }
  #logout {
    position: absolute;
    right: 16px;
    top: 14px;
  }
  main {
    margin: 0;
    padding: 16px 12px;
  }
  .panel {
    padding: 16px;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .editor-dialog {
    width: calc(100vw - 16px);
    max-height: 95vh;
  }
  .dialog-header {
    padding: 14px 16px;
  }
  .dialog-body,
  .editor-dialog > form {
    padding: 16px;
  }
  .toolbar > label {
    min-width: 0;
    flex: 1;
  }
  .toolbar .search {
    min-width: 180px;
  }
  .channel-filter-bar .search {
    flex-basis: 100%;
    max-width: none;
  }
  .channel-model-field {
    flex: 1 1 140px;
    min-width: 0;
  }
  .row.filter-row > label {
    flex: 1 1 116px;
    min-width: 116px;
  }
  .card {
    padding: 16px;
  }
  .card .value {
    font-size: 24px;
  }
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}

.request-detail-dialog {
  width: min(900px, calc(100vw - 40px));
}
.request-detail-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}
.request-status {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--muted);
  font-weight: 600;
}
.request-status.success,
.request-success {
  color: var(--ok);
}
.request-status.failed,
.request-status.interrupted {
  color: var(--error);
}
.request-status.running {
  color: var(--accent);
}
.request-meta {
  display: grid;
  grid-template-columns: 130px minmax(0, 1fr);
  gap: 10px 20px;
  margin: 0;
  font-size: 13px;
}
.request-meta dt {
  color: var(--muted);
}
.request-meta dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}
.request-meta .mono {
  font-size: 12px;
}
.request-card {
  margin-top: 26px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.request-card h3 {
  margin: 0 0 16px;
  font-size: 14px;
}
.request-card p {
  margin: 12px 0 0;
  overflow-wrap: anywhere;
}
.request-card details,
.request-route-notes {
  margin-top: 12px;
}
.request-card details > .request-meta {
  padding: 14px 10px 4px;
}
.request-card summary,
.request-raw > summary {
  font-size: 12px;
  white-space: normal;
}
.request-timeline {
  margin: 0;
  padding: 0;
  list-style: none;
}
.request-step {
  position: relative;
  display: flex;
  gap: 14px;
  padding: 0 0 22px;
}
.request-step::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 28px;
  bottom: 0;
  width: 1px;
  background: var(--line);
}
.request-step:last-child {
  padding-bottom: 0;
}
.request-step:last-child::before {
  display: none;
}
.request-step > div {
  min-width: 0;
  flex: 1;
  padding-top: 3px;
  overflow-wrap: anywhere;
}
.request-step strong {
  font-size: 13px;
}
.request-step small {
  display: block;
  line-height: 1.6;
  margin-top: 4px;
}
.request-step.selected > div {
  background: var(--hover);
  border-radius: 6px;
  padding: 8px;
}
.request-step-number {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--bg);
  color: var(--fg);
  font-weight: 600;
  z-index: 1;
}
.request-total {
  font-weight: 700;
  color: var(--accent);
}
.request-errors {
  border-color: var(--error);
}
.request-errors p {
  white-space: pre-wrap;
}
.request-raw {
  margin-top: 22px;
}
.request-raw pre {
  max-height: 300px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
@media (max-width: 600px) {
  .request-meta {
    grid-template-columns: 94px minmax(0, 1fr);
    gap: 9px 12px;
  }
  .request-card {
    padding: 14px;
  }
  .request-detail-dialog {
    width: calc(100vw - 16px);
  }
}
