:root {
  color-scheme: light;
  --ink: #172033;
  --ink-soft: #566176;
  --muted: #7d8798;
  --line: #dfe4ec;
  --line-strong: #cbd3df;
  --surface: #ffffff;
  --surface-soft: #f5f7fa;
  --canvas: #edf1f6;
  --nav: #10192b;
  --nav-soft: #1b2941;
  --accent: #335cff;
  --accent-dark: #2447d9;
  --accent-soft: #e9eeff;
  --success: #12805c;
  --success-soft: #e3f6ef;
  --warning: #9a6410;
  --warning-soft: #fff3d8;
  --danger: #be334a;
  --danger-soft: #fde9ed;
  --info: #276c9b;
  --info-soft: #e5f3fb;
  --shadow-sm: 0 1px 2px rgb(18 29 48 / 8%);
  --shadow-lg: 0 24px 70px rgb(10 20 40 / 24%);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--canvas);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px;
  line-height: 1.55;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

button,
select,
input[type="checkbox"],
input[type="radio"] {
  cursor: pointer;
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 3px solid rgb(51 92 255 / 30%);
  outline-offset: 2px;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  z-index: 1000;
  top: 10px;
  left: 10px;
  transform: translateY(-150%);
  padding: 8px 12px;
  border-radius: 8px;
  color: #fff;
  background: var(--accent-dark);
}

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

.unlock-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 28px 18px;
  background:
    radial-gradient(circle at 18% 18%, rgb(80 116 255 / 20%), transparent 30rem),
    radial-gradient(circle at 82% 88%, rgb(24 151 118 / 13%), transparent 30rem),
    var(--nav);
}

.unlock-card {
  width: min(100%, 440px);
  padding: 42px;
  border: 1px solid rgb(255 255 255 / 12%);
  border-radius: 22px;
  color: #fff;
  background: rgb(22 34 57 / 88%);
  box-shadow: var(--shadow-lg);
  backdrop-filter: blur(16px);
}

.unlock-card h1 {
  margin: 8px 0 5px;
  font-size: 31px;
  letter-spacing: -0.03em;
}

.unlock-copy {
  margin: 0 0 26px;
  color: #bdc7d8;
}

.unlock-card label {
  color: #e8ecf4;
  font-weight: 600;
}

.unlock-card input {
  border-color: rgb(255 255 255 / 18%);
  color: #fff;
  background: rgb(7 14 27 / 52%);
}

.unlock-card input::placeholder {
  color: #7f8ca2;
}

.security-note {
  margin: 22px 0 0;
  color: #8794aa;
  font-size: 12px;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 11px;
  color: #fff;
  background: linear-gradient(145deg, #5175ff, #2849dc);
  box-shadow: 0 8px 22px rgb(40 73 220 / 28%);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.brand-mark--large {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  font-size: 15px;
}

.eyebrow,
.section-kicker {
  margin: 0;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.unlock-card .eyebrow {
  margin-top: 24px;
  color: #92a8ff;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  grid-template-columns: 244px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  z-index: 10;
  top: 0;
  display: flex;
  height: 100vh;
  flex-direction: column;
  padding: 24px 16px 18px;
  color: #dce4f2;
  background: var(--nav);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 8px 25px;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  color: #fff;
  font-size: 15px;
}

.brand span {
  margin-top: 1px;
  color: #7f8ca2;
  font-size: 11px;
}

.nav-list {
  display: grid;
  gap: 5px;
}

.nav-item {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  color: #9da9bc;
  background: transparent;
  text-align: left;
  transition: color 120ms ease, background 120ms ease;
}

.nav-item:hover {
  color: #fff;
  background: rgb(255 255 255 / 6%);
}

.nav-item.is-active {
  color: #fff;
  background: var(--nav-soft);
  box-shadow: inset 3px 0 var(--accent);
}

.nav-item > span:first-child {
  width: 19px;
  color: #7992ff;
  text-align: center;
  font-size: 17px;
}

.nav-badge {
  min-width: 21px;
  margin-left: auto;
  padding: 1px 6px;
  border-radius: 999px;
  color: #fff;
  background: var(--danger);
  font-size: 11px;
  font-weight: 750;
  line-height: 19px;
  text-align: center;
}

.sidebar-footer {
  display: grid;
  gap: 12px;
  margin-top: auto;
}

.connection-state {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 8px;
  color: #8d9bb0;
  font-size: 12px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34c38f;
  box-shadow: 0 0 0 4px rgb(52 195 143 / 12%);
}

.workspace {
  min-width: 0;
  padding: 34px clamp(20px, 4vw, 58px) 52px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.topbar h1 {
  margin: 4px 0 1px;
  font-size: clamp(25px, 3vw, 34px);
  letter-spacing: -0.035em;
}

.topbar-description {
  margin: 0;
  color: var(--ink-soft);
}

.topbar-actions,
.dialog-actions,
.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view-page {
  animation: page-in 180ms ease-out;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-notice {
  margin: -10px 0 20px;
  padding: 10px 13px;
  border: 1px solid #bad9eb;
  border-radius: 9px;
  color: #225c7f;
  background: var(--info-soft);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card {
  display: grid;
  min-height: 136px;
  align-content: space-between;
  padding: 19px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.metric-card > span {
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}

.metric-card strong {
  margin: 6px 0 2px;
  font-size: 32px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.metric-card small {
  color: var(--muted);
}

.metric-card--accent {
  border-color: transparent;
  color: #fff;
  background: linear-gradient(135deg, #3159f3, #4b70ff);
}

.metric-card--accent > span,
.metric-card--accent small {
  color: #dfe6ff;
}

.overview-grid {
  display: grid;
  grid-template-columns: minmax(250px, 0.75fr) minmax(0, 1.7fr);
  gap: 18px;
}

.conversion-metric-grid .metric-card { min-height: 122px; }
.conversion-monitor-panel { margin-top: 18px; }
.conversion-monitor-table { min-width: 1040px; }
.conversion-monitor-table th:nth-child(n + 3):nth-child(-n + 8),
.conversion-monitor-table td:nth-child(n + 3):nth-child(-n + 8) {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.panel {
  min-width: 0;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel-header,
.toolbar,
.selection-bar,
.poll-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-header {
  margin-bottom: 16px;
}

.panel h2,
.dialog h2 {
  margin: 2px 0 0;
  font-size: 18px;
  letter-spacing: -0.015em;
}

.pending-panel {
  margin-bottom: 18px;
  border-color: #ead59d;
}

.panel-description {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.heading-count {
  display: inline-grid;
  min-width: 24px;
  min-height: 24px;
  margin-left: 5px;
  place-items: center;
  border-radius: 999px;
  color: var(--warning);
  background: var(--warning-soft);
  font-size: 12px;
  vertical-align: 2px;
}

.health-list {
  display: grid;
  gap: 14px;
}

.health-row {
  display: grid;
  grid-template-columns: 92px 1fr 32px;
  align-items: center;
  gap: 10px;
}

.health-row span:first-child {
  color: var(--ink-soft);
}

.health-track,
.progress-track {
  overflow: hidden;
  height: 7px;
  border-radius: 999px;
  background: #e9edf3;
}

.health-progress,
.batch-progress {
  width: 100%;
  height: 7px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  color: var(--accent);
  background: #e9edf3;
  accent-color: var(--accent);
  appearance: none;
}

.health-progress::-webkit-progress-bar,
.batch-progress::-webkit-progress-bar {
  border-radius: 999px;
  background: #e9edf3;
}

.health-progress::-webkit-progress-value,
.batch-progress::-webkit-progress-value {
  border-radius: 999px;
  background: var(--accent);
}

.health-progress::-moz-progress-bar,
.batch-progress::-moz-progress-bar {
  border-radius: 999px;
  background: var(--accent);
}

.health-progress--success { color: var(--success); accent-color: var(--success); }
.health-progress--muted { color: #9ba6b8; accent-color: #9ba6b8; }
.health-progress--danger { color: var(--danger); accent-color: var(--danger); }
.health-progress--success::-webkit-progress-value { background: var(--success); }
.health-progress--muted::-webkit-progress-value { background: #9ba6b8; }
.health-progress--danger::-webkit-progress-value { background: var(--danger); }
.health-progress--success::-moz-progress-bar { background: var(--success); }
.health-progress--muted::-moz-progress-bar { background: #9ba6b8; }
.health-progress--danger::-moz-progress-bar { background: var(--danger); }

.health-fill,
.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.health-fill--success { background: var(--success); }
.health-fill--muted { background: #9ba6b8; }
.health-fill--danger { background: var(--danger); }

.health-row strong {
  text-align: right;
}

.button,
.icon-button {
  border: 0;
  font-weight: 650;
  transition: transform 100ms ease, background 120ms ease, border-color 120ms ease;
}

.button:active:not(:disabled),
.icon-button:active:not(:disabled) {
  transform: translateY(1px);
}

.button {
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 9px;
}

.button--primary {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 5px 13px rgb(51 92 255 / 18%);
}

.button--primary:hover:not(:disabled) { background: var(--accent-dark); }

.button--secondary {
  border: 1px solid var(--line-strong);
  color: var(--ink);
  background: var(--surface);
}

.button--secondary:hover:not(:disabled),
.button--quiet:hover:not(:disabled) { background: var(--surface-soft); }

.button--quiet {
  border: 1px solid transparent;
  color: var(--ink-soft);
  background: transparent;
}

.unlock-card .button--quiet {
  color: #bfc9da;
}

.button--text {
  min-height: 30px;
  padding: 4px 6px;
  color: var(--accent);
  background: transparent;
}

.button--text:hover:not(:disabled) { color: var(--accent-dark); }

.button--danger-quiet {
  border: 1px solid #efbcc5;
  color: var(--danger);
  background: var(--danger-soft);
}

.button--danger-quiet:hover:not(:disabled) { background: #fbdbe1; }

.button--sidebar {
  width: 100%;
  border: 1px solid rgb(255 255 255 / 10%);
  color: #aeb9ca;
  background: rgb(255 255 255 / 4%);
}

.button--sidebar:hover { color: #fff; background: rgb(255 255 255 / 8%); }
.button--small { min-height: 32px; padding: 5px 10px; font-size: 12px; }
.button--wide { width: 100%; }

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 8px 11px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
}

textarea {
  resize: vertical;
}

input[type="checkbox"],
input[type="radio"] {
  width: 16px;
  min-height: 16px;
  accent-color: var(--accent);
}

.password-field {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 7px;
}

.stack {
  display: grid;
  gap: 11px;
}

.stack--tight { gap: 6px; }

.check-line {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 13px;
}

.check-line input {
  flex: 0 0 auto;
  margin-top: 2px;
}

.toolbar {
  margin-bottom: 14px;
}

.filter-group {
  width: min(100%, 650px);
}

.search-field {
  width: min(100%, 400px);
}

.selection-bar {
  min-height: 49px;
  margin: 0 -20px;
  padding: 8px 20px;
  border-block: 1px solid var(--line);
  color: var(--ink-soft);
  background: var(--surface-soft);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  white-space: nowrap;
}

tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfc; }
tbody tr.is-disabled { opacity: 0.7; }

.device-table { min-width: 1060px; }
.pairing-table { min-width: 940px; }
.check-cell { width: 38px; text-align: center; }
.check-cell input { display: block; margin: auto; }

.primary-cell {
  display: grid;
  gap: 2px;
  min-width: 150px;
}

.primary-cell strong { font-weight: 680; }
.primary-cell small,
.secondary-text { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.row-actions {
  display: flex;
  gap: 4px;
  white-space: nowrap;
}

.verification-code {
  display: inline-block;
  min-width: 86px;
  padding: 7px 10px;
  border: 1px solid #ecd18e;
  border-radius: 7px;
  color: #76500e;
  background: #fff9ea;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-align: center;
}

.status {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.status--ok { color: var(--success); background: var(--success-soft); }
.status--warn { color: var(--warning); background: var(--warning-soft); }
.status--error { color: var(--danger); background: var(--danger-soft); }
.status--info { color: var(--info); background: var(--info-soft); }
.status--muted { color: #616c7d; background: #edf0f4; }

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.chip {
  max-width: 190px;
  overflow: hidden;
  padding: 2px 7px;
  border: 1px solid #d7ddf0;
  border-radius: 6px;
  color: #445274;
  background: #f4f6fc;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.empty-cell {
  padding: 42px 16px;
  color: var(--muted);
  text-align: center;
}

.table-summary {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.progress-block {
  display: grid;
  min-width: 100px;
  gap: 5px;
}

.progress-block small { color: var(--muted); }

.page-error {
  color: var(--danger);
}

.dialog {
  width: min(calc(100vw - 30px), 520px);
  max-height: min(calc(100vh - 32px), 850px);
  max-height: min(calc(100dvh - 32px), 850px);
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 16px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}

.dialog[open] {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.dialog[open]:has(> .dialog-footer) {
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.dialog--wide { width: min(calc(100vw - 30px), 720px); }
.dialog--xwide { width: min(calc(100vw - 30px), 1080px); }

.dialog::backdrop {
  background: rgb(7 13 26 / 58%);
  backdrop-filter: blur(3px);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.dialog-body {
  min-height: 0;
  padding: 21px 22px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.dialog-footer {
  z-index: 1;
  flex: 0 0 auto;
  justify-content: flex-end;
  margin: 0;
  padding: 13px 22px calc(13px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
  box-shadow: 0 -8px 20px rgb(23 32 51 / 5%);
}

.icon-button {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  color: var(--ink-soft);
  background: transparent;
  font-size: 24px;
  line-height: 1;
}

.icon-button:hover { background: var(--surface-soft); }

.dialog-actions {
  justify-content: flex-end;
  margin-top: 7px;
}

.dialog-actions--split { justify-content: space-between; }
.dialog-actions--split > div { display: flex; gap: 8px; }

.field-hint,
.form-error {
  margin: 0;
  font-size: 12px;
}

.field-hint { color: var(--muted); }
.field-label { display: block; margin-bottom: 7px; font-weight: 650; }

.form-error {
  padding: 9px 11px;
  border: 1px solid #f1bac5;
  border-radius: 8px;
  color: #9f263b;
  background: var(--danger-soft);
}

.token-result {
  display: grid;
  gap: 12px;
}

.token-result h3 { margin: 0; font-size: 17px; }

.token-result code {
  display: block;
  padding: 14px;
  overflow-wrap: anywhere;
  border: 1px solid #f0d69b;
  border-radius: 9px;
  color: #62440f;
  background: #fffaee;
  font-size: 13px;
  user-select: all;
}

.single-action-result {
  display: grid;
  gap: 9px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.single-action-result-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.single-action-result pre {
  max-height: 250px;
  margin: 0;
  padding: 11px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

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

.detail-grid > div {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.detail-grid span,
.detail-grid strong {
  display: block;
}

.detail-grid span {
  color: var(--muted);
  font-size: 11px;
}

.detail-grid strong {
  margin-top: 3px;
  overflow-wrap: anywhere;
  font-size: 13px;
}

.form-section {
  margin-top: 21px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.model-config-section {
  margin-top: 20px;
}

.model-config-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.model-config-heading h3 {
  margin: 0;
  font-size: 14px;
}

.model-config-heading > div {
  display: flex;
  gap: 4px;
}

.model-config-warning { margin-bottom: 9px; }

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

.model-profile-card {
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.model-profile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  margin-bottom: 9px;
}

.model-profile-header h4 {
  margin: 0;
  font-size: 13px;
}

.model-profile-row {
  display: grid;
  gap: 1px;
  margin-top: 7px;
}

.model-profile-row span {
  color: var(--muted);
  font-size: 10px;
}

.model-profile-row strong {
  overflow: hidden;
  font-size: 12px;
  font-weight: 620;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.model-profile-row--url strong {
  overflow-wrap: anywhere;
  white-space: normal;
}

.model-profile-row--pending strong {
  color: var(--warning);
}

.model-profile-test {
  width: 100%;
  margin-top: 11px;
}

.diagnostic {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-soft);
}

.diagnostic summary {
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 650;
}

.diagnostic pre,
td pre {
  max-height: 260px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  border-top: 1px solid var(--line);
  color: #3d485c;
  background: #f8fafc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

fieldset {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

legend {
  margin-bottom: 7px;
  font-weight: 650;
}

.radio-card {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  cursor: pointer;
}

.radio-card:has(input:checked) {
  border-color: #9bafff;
  background: var(--accent-soft);
}

.radio-card input { margin-top: 3px; }
.radio-card strong,
.radio-card small { display: block; }
.radio-card small { margin-top: 1px; color: var(--muted); }

.two-column-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.inline-warning,
.cancel-note {
  margin: 0;
  padding: 9px 11px;
  border: 1px solid #efd59e;
  border-radius: 8px;
  color: #79500c;
  background: var(--warning-soft);
  font-size: 12px;
}

.poll-bar {
  margin: 17px 0 8px;
  color: var(--muted);
  font-size: 12px;
}

.cancel-note { margin-top: 16px; }

td details summary {
  color: var(--accent);
  cursor: pointer;
  font-weight: 650;
  white-space: nowrap;
}

td details pre {
  min-width: 280px;
  margin-top: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.toast {
  position: fixed;
  z-index: 100;
  right: 22px;
  bottom: 22px;
  max-width: min(430px, calc(100vw - 44px));
  padding: 12px 15px;
  border: 1px solid #b8c5ee;
  border-radius: 10px;
  color: #20315f;
  background: #f1f4ff;
  box-shadow: 0 13px 35px rgb(17 29 51 / 18%);
}

.toast.is-error {
  border-color: #efbcc5;
  color: #8e2638;
  background: var(--danger-soft);
}

@media (max-width: 1080px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-grid { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .app-shell { display: block; }

  .sidebar {
    position: sticky;
    display: grid;
    height: auto;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 11px 14px;
  }

  .brand { padding: 0; }
  .brand > div:last-child { display: none; }
  .nav-list { display: flex; min-width: 0; gap: 3px; overflow-x: auto; }
  .nav-item { width: auto; padding: 8px 10px; white-space: nowrap; }
  .nav-item > span:first-child { display: none; }
  .sidebar-footer { margin: 0; }
  .connection-state { display: none; }
  .button--sidebar { width: auto; white-space: nowrap; }
  .workspace { padding: 25px 16px 40px; }
}

@media (max-width: 620px) {
  .topbar,
  .toolbar,
  .selection-bar { align-items: stretch; flex-direction: column; }
  .topbar-actions { width: 100%; }
  .topbar-actions .button { flex: 1; }
  .filter-group { align-items: stretch; flex-direction: column; }
  .search-field { width: 100%; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { min-height: 118px; padding: 15px; }
  .panel { padding: 15px; }
  .selection-bar { margin-inline: -15px; padding-inline: 15px; }
  .detail-grid { grid-template-columns: 1fr 1fr; }
  .model-profile-grid { grid-template-columns: 1fr; }
  .model-config-heading { align-items: flex-start; flex-direction: column; }
  .two-column-fields { grid-template-columns: 1fr; }
  .dialog {
    width: calc(100vw - 16px);
    max-height: calc(100vh - 16px);
    max-height: calc(100dvh - 16px);
  }
  .dialog-body { padding: 17px; }
  .dialog-header { padding: 17px; }
  .dialog-footer { padding: 12px 17px calc(12px + env(safe-area-inset-bottom)); }
  .dialog-actions--split { align-items: stretch; flex-direction: column-reverse; }
  .dialog-actions--split > div { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 440px) {
  .unlock-card { padding: 30px 22px; }
  .metric-grid { grid-template-columns: 1fr; }
  .sidebar { grid-template-columns: auto 1fr; }
  .button--sidebar { display: none; }
  .detail-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
