:root {
  --bg: #eef1f5;
  --panel: #ffffff;
  --stroke: #d8dee8;
  --text: #1b2430;
  --text-muted: #5a687a;
  --blue: #1f6feb;
  --blue-soft: #e8f0fe;
  --navy: #050530;
  --teal: #0d4f5c;
  --teal-soft: #e6f4f6;
  --ok: #1b7a4a;
  --ok-bg: #e8f6ee;
  --warn: #b45309;
  --warn-bg: #fff7ed;
  --bad: #c62828;
  --bad-bg: #fdecea;
  --font: "Segoe UI", system-ui, sans-serif;
  --mono: Consolas, monospace;
  --header-h: 56px;
  --footer-h: 56px;
  --subnav-h: 45px;
  --tabs-h: 47px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
}

#app {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.topnav {
  height: var(--header-h);
  background: var(--navy);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 0;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.bettrader-header {
  background: linear-gradient(180deg, #07093a 0%, #050530 100%);
}

.topnav .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-right: 32px;
  flex-shrink: 0;
}

.topnav .logo-img {
  height: 32px;
  width: auto;
  max-width: min(200px, 42vw);
  display: block;
  object-fit: contain;
  object-position: left center;
}

.topnav-main {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
}

.topnav nav {
  display: flex;
  gap: 2px;
}

.top-link {
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.82);
  padding: 10px 14px;
  border-radius: 0;
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  font-family: inherit;
}

.top-link:hover:not(:disabled) {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.top-link:disabled {
  cursor: default;
  opacity: 0.55;
}

.top-link.active {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  box-shadow: inset 0 -2px 0 #f5a623;
}

.top-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding-left: 16px;
}

.top-link-logout {
  margin-left: 8px;
  padding-left: 12px;
  border-left: 1px solid rgba(255, 255, 255, 0.22);
}

.top-link-logout:hover:not(:disabled) {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.top-link-utility {
  font-size: 12px;
  font-weight: 500;
  padding: 8px 10px;
  color: rgba(255, 255, 255, 0.75);
}

.config-subnav {
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--stroke);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 20;
}

.config-sub-link {
  appearance: none;
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  font-family: inherit;
}

.config-sub-link:hover {
  color: var(--text);
  background: #f8fafc;
}

.config-sub-link.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
  font-weight: 600;
}

.page {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.editor-header {
  background: linear-gradient(135deg, var(--teal), #0a3d47);
  color: #fff;
  padding: 18px 20px 20px;
  flex-shrink: 0;
}

.editor-header .btn.editor-back {
  margin-bottom: 12px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
}

.editor-header .btn.editor-back:hover {
  background: rgba(255, 255, 255, 0.24);
  border-color: rgba(255, 255, 255, 0.55);
  color: #fff;
}

.editor-header-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

.editor-title-row--with-menu {
  justify-content: space-between;
  width: 100%;
}

.editor-title-text {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  min-width: 0;
}

.editor-actions-wrap {
  position: relative;
  flex-shrink: 0;
}

.editor-header .editor-menu-btn {
  min-width: 40px;
  padding: 8px 14px;
  font-size: 20px;
  line-height: 1;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.4);
  color: #fff;
}

.editor-header .editor-menu-btn:hover {
  background: rgba(255, 255, 255, 0.24);
}

.editor-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  border: none;
  background: transparent;
  cursor: default;
}

.editor-menu-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 50;
  min-width: 240px;
  max-width: 280px;
  padding: 8px 0;
  background: #fff;
  color: var(--text);
  border: 1px solid var(--stroke);
  border-radius: 10px;
  box-shadow: 0 12px 40px rgba(15, 23, 42, 0.18);
}

.editor-menu-heading {
  margin: 0;
  padding: 8px 16px 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.editor-menu-item {
  display: block;
  width: 100%;
  padding: 10px 16px;
  border: none;
  background: none;
  text-align: left;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
}

.editor-menu-item:hover:not(:disabled) {
  background: #f1f5f9;
}

.editor-menu-item:disabled {
  color: var(--text-muted);
  cursor: not-allowed;
}

.editor-menu-item-danger:not(:disabled) {
  color: #b91c1c;
}

.editor-menu-item-danger:hover:not(:disabled) {
  background: #fef2f2;
}

.editor-menu-hint {
  margin: 0;
  padding: 4px 16px 8px;
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
}

.editor-menu-divider {
  margin: 6px 0;
  border: none;
  border-top: 1px solid var(--stroke);
}

.editor-stat-muted dd {
  opacity: 0.85;
  font-size: 14px;
}

.tm-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, 0.45);
}

.tm-modal {
  width: 100%;
  max-width: 420px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
  overflow: hidden;
}

.tm-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--stroke);
}

.tm-modal-head h2 {
  margin: 0;
  font-size: 1.125rem;
  font-weight: 600;
}

.tm-modal-head-danger {
  background: #fef2f2;
  border-bottom-color: #fecaca;
}

.tm-modal-head-danger h2 {
  color: #991b1b;
}

.tm-modal-close {
  border: none;
  background: none;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px;
}

.tm-modal-body {
  padding: 20px;
}

.tm-modal-body p {
  margin: 0 0 10px;
  line-height: 1.5;
}

.tm-modal-body p:last-child {
  margin-bottom: 0;
}

.tm-modal-note {
  margin: 0 0 14px;
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.45;
  color: #78350f;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
}

.tm-modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

.tm-modal-field input,
.tm-modal-field select {
  font: inherit;
  font-weight: 400;
  padding: 10px 12px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
}

.tm-modal-field input:focus,
.tm-modal-field select:focus {
  outline: 2px solid var(--teal);
  outline-offset: 1px;
}

.tm-modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 20px;
  border-top: 1px solid var(--stroke);
  background: #f8fafc;
}

.editor-header h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.25;
  letter-spacing: -0.02em;
}

.editor-header .editor-mode-badge {
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 999px;
}

.editor-header .badge.live {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.editor-header .badge.prematch {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

.editor-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  margin: 0;
}

.editor-stat {
  background: rgba(0, 0, 0, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  padding: 10px 16px;
  min-width: 7.5rem;
}

.editor-stat dt {
  margin: 0 0 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.78);
}

.editor-stat dd {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
  color: #fff;
}

.editor-header .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  font-size: 13px;
  opacity: 0.95;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge.prematch {
  background: #dbeafe;
  color: #1e40af;
}

.badge.live {
  background: #fce7f3;
  color: #9d174d;
}

.workspace-tabs {
  display: flex;
  gap: 0;
  background: var(--panel);
  border-bottom: 1px solid var(--stroke);
  padding: 0 12px;
  flex-shrink: 0;
  position: sticky;
  top: var(--subnav-h);
  z-index: 15;
}

.tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  padding: 12px 16px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
}

.tab.active {
  color: var(--blue);
  font-weight: 700;
  border-bottom-color: var(--blue);
}

@media (max-height: 900px) {
  .editor-header {
    padding: 10px 16px 12px;
  }

  .editor-header .btn.editor-back {
    margin-bottom: 6px;
  }

  .editor-header-main {
    gap: 8px;
  }

  .editor-header h1 {
    font-size: 1.25rem;
  }

  .editor-stats {
    gap: 8px;
  }
}

.workspace-body {
  min-height: 0;
  overflow: auto;
  padding: 16px 20px 80px;
}

.workspace-body.workspace-body--assign,
.workspace-body.workspace-body--markets {
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: calc(100dvh - var(--subnav-h) - var(--tabs-h));
  padding: 12px 16px calc(var(--footer-h) + 12px);
}

.editor-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: var(--footer-h);
  background: var(--panel);
  border-top: 1px solid var(--stroke);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 0 20px;
  z-index: 40;
  pointer-events: auto;
}

.editor-footer-hint {
  margin: 0 auto 0 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.35;
  align-self: center;
}

.editor-footer-hint--next {
  color: var(--text);
  font-weight: 600;
}

.panel-actions--pending {
  border-top-color: #bfdbfe;
}

.panel-actions--pending .btn.primary:not([disabled]) {
  box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.2);
}

.btn {
  border: 1px solid var(--stroke);
  background: var(--panel);
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 500;
}

.btn.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

.btn.primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn.ghost {
  border-color: transparent;
  background: transparent;
  color: var(--blue);
}

.card {
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 8px;
}

.list-page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 24px 32px;
  width: 100%;
}

.templates-list-page {
  max-width: none;
  padding: 16px 24px 28px;
}

.templates-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.templates-page-head h1 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 650;
  color: var(--navy, #050530);
}

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

.templates-toolbar {
  padding: 14px 16px;
  margin-bottom: 12px;
}

.templates-page-title {
  min-width: 0;
}

.templates-page-lead {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 400;
  max-width: 42rem;
}

.templates-filter-search {
  flex: 1 1 280px;
  min-width: 240px;
  max-width: 420px;
}

.templates-filter-search .market-search-wrap {
  width: 100%;
  height: 38px;
}

.templates-toolbar .market-search-input {
  height: 38px;
  padding: 0 36px 0 10px !important;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  font-size: 14px;
  line-height: 36px;
  color: var(--text);
  background: #fff;
}

.templates-meta-row .market-search-status {
  padding: 0;
}

.templates-search-wrap {
  position: relative;
  display: block;
}

.templates-search-input {
  width: 100%;
  height: 38px;
  padding: 0 34px 0 10px;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  box-sizing: border-box;
}

.templates-search-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.templates-search-clear:hover {
  background: #f1f5f9;
  color: var(--text);
}

.templates-search-clear[hidden] {
  display: none;
}

.templates-seg {
  display: flex;
  flex-wrap: nowrap;
  align-items: stretch;
  gap: 4px;
  height: 38px;
  padding: 3px;
  box-sizing: border-box;
  background: #f1f5f9;
  border-radius: 8px;
}

.templates-seg-btn {
  display: inline-flex;
  align-items: center;
  height: 100%;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  padding: 0 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
  text-transform: none;
  letter-spacing: 0;
  white-space: nowrap;
}

.templates-seg-btn:hover {
  background: rgba(255, 255, 255, 0.7);
}

.templates-seg-btn.is-on {
  background: #fff;
  color: var(--blue);
  box-shadow: 0 0 0 1px var(--stroke);
}

.templates-seg-count {
  font-weight: 700;
  color: var(--text-muted);
  margin-left: 2px;
}

.templates-seg-btn.is-on .templates-seg-count {
  color: var(--blue);
}

.templates-mode {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.templates-mode.prematch {
  background: #dbeafe;
  color: #1e40af;
}

.templates-mode.live {
  background: #fce7f3;
  color: #9d174d;
}

.templates-row-open {
  cursor: pointer;
}

.templates-row-open:hover {
  background: #f8fafc;
}

.templates-row-open:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}

.templates-view-only {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 500;
}

.templates-empty {
  padding: 28px 16px !important;
  text-align: center;
  color: var(--text-muted);
  font-size: 14px;
}

.templates-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px 20px;
}

.templates-filter {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.templates-filter-lbl {
  display: block;
  line-height: 1.2;
  min-height: 14px;
}

.templates-filter select {
  min-width: 160px;
  height: 38px;
  padding: 0 10px;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  font-size: 14px;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text);
  box-sizing: border-box;
}

.templates-filter-check {
  text-transform: none;
}

.templates-filter-check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  white-space: nowrap;
}

.templates-filter-check-row input {
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
}

.templates-filter-action {
  justify-content: flex-end;
}

.templates-filter-action .templates-filter-lbl {
  visibility: hidden;
}

.btn-link.templates-clear-filters {
  background: none;
  border: none;
  color: var(--blue);
  font-size: 13px;
  font-weight: 500;
  padding: 0;
  height: 38px;
  line-height: 38px;
  cursor: pointer;
  font-family: inherit;
  text-transform: none;
  letter-spacing: normal;
  white-space: nowrap;
}

.btn-link.templates-clear-filters:hover {
  text-decoration: underline;
}

.templates-meta-row {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--stroke);
  font-size: 13px;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
}

.btn-link.templates-sample-toggle {
  background: none;
  border: none;
  color: var(--blue);
  font-size: 13px;
  font-weight: 600;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

.btn-link.templates-sample-toggle:hover {
  text-decoration: underline;
}

.templates-table-card {
  padding: 0;
  overflow: hidden;
}

.templates-table-scroll {
  overflow: auto;
  max-height: calc(100vh - var(--header-h) - 220px);
}

table.templates-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.template-name-cell strong {
  display: block;
  font-weight: 600;
  color: var(--text);
}

.template-id-line {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
  font-family: var(--mono);
}

.templates-muted {
  color: var(--text-muted);
}

.templates-markets-count {
  font-variant-numeric: tabular-nums;
}

.templates-status {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
}

.templates-status.on {
  background: var(--ok-bg);
  color: var(--ok);
}

.templates-status.off {
  background: #f1f5f9;
  color: var(--text-muted);
}

.templates-row-inactive {
  opacity: 0.85;
}

.templates-col-actions {
  white-space: nowrap;
  text-align: right;
  width: 1%;
}

.templates-edit {
  font-size: 12px;
  padding: 5px 14px;
}

.list-page h1 {
  margin: 0 0 8px;
}

.subtle {
  color: var(--text-muted);
  margin: 0 0 20px;
}

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

table.data th,
table.data td {
  text-align: left;
  padding: 12px 14px;
  border-bottom: 1px solid var(--stroke);
}

table.data th {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: #f8f9fb;
}

.markets-tab-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.config-clipboard-bar {
  margin: 0;
  flex-shrink: 0;
}

.markets-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr);
  gap: 16px;
  align-items: stretch;
  width: 100%;
  max-width: 100%;
  min-height: 0;
  height: 100%;
}

@media (max-width: 900px) {
  .markets-layout {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(200px, 1fr) minmax(220px, 1fr);
  }

  .market-list-panel .toolbar {
    position: sticky;
    top: 0;
    z-index: 3;
  }

  .market-list-panel,
  .markets-layout .detail-panel {
    min-height: 0;
    overflow: hidden;
  }
}

.detail-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.market-list-panel {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.market-list-panel .toolbar {
  padding: 12px;
  border-bottom: 1px solid var(--stroke);
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex-shrink: 0;
  background: var(--panel);
}

.market-list-panel .toolbar input[type="search"],
.market-list-panel .toolbar select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--stroke);
  border-radius: 6px;
}

.market-search-wrap {
  position: relative;
  width: 100%;
}

.market-search-input {
  width: 100%;
  padding-right: 36px !important;
  box-sizing: border-box;
}

.market-search-clear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.market-search-clear:hover {
  background: #f1f5f9;
  color: var(--text);
}

.market-search-clear[hidden] {
  display: none;
}

.market-search-status {
  margin: 0;
  padding: 10px 12px 0;
  font-size: 12px;
  color: var(--text-muted);
}

.market-search-status-count {
  font-weight: 700;
  color: var(--text);
}

.market-search-empty {
  padding: 24px 16px;
  text-align: center;
}

.market-search-empty-title {
  margin: 0 0 8px;
  font-weight: 600;
  font-size: 15px;
}

.market-search-empty-detail {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

.market-list-empty {
  padding: 12px;
}

mark.search-hit {
  background: #fef08a;
  color: inherit;
  padding: 0 2px;
  border-radius: 2px;
  font-weight: inherit;
}

.market-list-panel .toolbar label.toolbar-filter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  padding: 2px 0;
  margin: 0;
}

.market-list-panel .toolbar label.toolbar-filter input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  padding: 0;
  flex-shrink: 0;
  accent-color: var(--blue);
}

.market-list-panel .toolbar label.toolbar-filter span {
  line-height: 1.25;
}

.market-rows {
  flex: 1 1 0%;
  min-width: 0;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}

.detail-scroll {
  flex: 1 1 0%;
  min-height: 0;
  padding: 16px;
  box-sizing: border-box;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

@media (min-width: 901px) {
  .market-list-panel,
  .markets-layout .detail-panel {
    min-height: 0;
    height: auto;
    max-height: none;
    overflow: hidden;
    align-self: stretch;
  }
}

.market-group {
  border-bottom: 1px solid var(--stroke);
}

.market-group-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  background: #f8fafc;
  border-bottom: 1px solid var(--stroke);
}

.market-group-toggle {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: none;
  background: transparent;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-align: left;
  cursor: pointer;
}

.market-group-toggle:hover {
  background: #f1f5f9;
}

.market-group-activate-all,
.market-group-deactivate-all,
.market-group-bulk-btn {
  flex-shrink: 0;
  margin: 4px 10px 4px 0;
  padding: 5px 12px;
  border-radius: 6px;
  background: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  cursor: pointer;
  border: 1px solid var(--stroke);
  color: var(--text);
}

.market-group-bulk-btn.is-open {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-soft);
}

.group-settings-sheet {
  padding: 10px 12px 12px;
  background: #fff;
  border-bottom: 1px solid var(--stroke);
}

.group-settings-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
}

.group-settings-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 8px;
}

.group-settings-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
  min-width: 0;
}

.group-settings-fields select,
.group-settings-field select {
  margin-left: 0;
  width: 100%;
  max-width: 28rem;
  padding: 8px 10px;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  font: inherit;
}

.market-group-activate-all {
  border: 1px solid var(--teal);
  color: var(--teal);
}

.market-group-activate-all:hover {
  background: var(--teal-soft);
}

.market-group-deactivate-all {
  border: 1px solid #94a3b8;
  color: #475569;
}

.market-group-deactivate-all:hover {
  background: #f1f5f9;
}

.market-group-bulk-bar {
  display: flex;
  justify-content: flex-end;
  padding: 8px 10px;
  background: #f8fafc;
  border-bottom: 1px solid var(--stroke);
}

.market-group-bulk-bar .market-group-activate-all,
.market-group-bulk-bar .market-group-deactivate-all {
  margin: 0;
}

.market-group-chevron {
  width: 14px;
  flex-shrink: 0;
  color: var(--text-muted);
}

.market-group-label {
  flex: 0 1 auto;
  color: var(--text);
}

.market-group-count {
  flex-shrink: 0;
  margin-left: 6px;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  background: #e2e8f0;
  padding: 1px 6px;
  border-radius: 10px;
}

.market-group.is-collapsed .market-group-body {
  display: none;
}

.market-row {
  width: 100%;
  text-align: left;
  border: none;
  border-bottom: 1px solid var(--stroke);
  background: var(--panel);
  padding: 7px 10px;
  display: grid;
  --market-row-cols: minmax(0, 1.35fr) minmax(44px, 0.8fr) minmax(40px, 0.55fr) minmax(40px, 0.55fr) minmax(40px, 0.55fr) minmax(64px, 0.9fr) minmax(92px, 0.82fr) minmax(50px, 0.68fr);
  grid-template-columns: var(--market-row-cols);
  column-gap: 8px;
  align-items: center;
  cursor: pointer;
  font: inherit;
  color: inherit;
  min-width: 0;
}

.market-row:focus-visible {
  outline: 2px solid var(--accent, #0d9488);
  outline-offset: -2px;
}

.market-row-head {
  cursor: default;
  background: #f1f5f9;
  padding: 9px 10px;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid #cbd5e1;
  --market-row-cols: minmax(0, 1.35fr) minmax(44px, 0.8fr) minmax(40px, 0.55fr) minmax(40px, 0.55fr) minmax(40px, 0.55fr) minmax(64px, 0.9fr) minmax(92px, 0.82fr) minmax(50px, 0.68fr);
  grid-template-columns: var(--market-row-cols);
}

.market-row-head .market-row-title,
.market-row-head .market-row-stat,
.market-row-head .market-row-cell {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
  color: var(--text);
  white-space: normal;
  line-height: 1.25;
  text-align: center;
}

.market-row-head .market-row-title {
  text-align: left;
}

.market-row-stat {
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--text-muted);
  line-height: 1.25;
  min-width: 0;
}

.market-row-stat.muted {
  color: #cbd5e1;
}

.market-row-uof {
  font-weight: 600;
  color: var(--text);
}

.market-row-title {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.25;
  min-width: 0;
  overflow: hidden;
}

.market-row-name {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.market-row-cell {
  display: flex;
  align-items: center;
  min-width: 0;
}

.market-row-keys {
  justify-content: center;
}

.market-row-keys-h {
  text-align: center;
}

.market-row-keys .pill {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.market-row-active {
  justify-content: center;
}

.market-row-active .pill {
  font-size: 10px;
  padding: 1px 5px;
}

.market-row-meta {
  display: none;
}

.market-row .pill {
  margin-left: 0;
}

.pill.cap.cap-muted {
  background: transparent;
  color: var(--text-muted);
  font-weight: 500;
}

.market-row:hover {
  background: #f8fafc;
}

.market-row.selected {
  background: var(--blue-soft);
  box-shadow: inset 3px 0 0 var(--blue);
}

.market-group-body .market-row {
  padding-left: 14px;
}

.pill {
  display: inline-block;
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 4px;
  margin-left: 6px;
}

.pill.on {
  background: var(--ok-bg);
  color: var(--ok);
}

.pill.off {
  background: #f1f5f9;
  color: var(--text-muted);
}

.pill.cap {
  font-weight: 600;
  vertical-align: middle;
  white-space: nowrap;
}

.pill.cap.cap-timeline-disabled,
.pill.cap.keyless {
  background: #fef3c7;
  color: #92400e;
}

.pill.cap.cap-key-derived {
  background: #ede9fe;
  color: #5b21b6;
}

.pill.cap.cap-keys-configured,
.pill.cap.keys {
  background: #dbeafe;
  color: #1e40af;
}

.pill.cap.cap-keys-not-configured,
.pill.cap.timeline-ready {
  background: #e0f2fe;
  color: #0369a1;
}

.pill.cap.per-key {
  background: #e0e7ff;
  color: #3730a3;
}

.callout-soft {
  font-size: 12px;
  color: var(--text-muted);
  background: #f0f9ff;
  border: 1px solid #bae6fd;
  border-radius: 8px;
  padding: 8px 10px;
  margin-top: 10px;
}

.key-preview-state {
  border-left: 3px solid #0284c7;
  padding-left: 12px;
}

.pill.cap.head {
  font-size: 12px;
  margin-left: 10px;
}

.market-detail-head h2.market-title-row {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.25;
}

.market-detail-head .pill.cap.head {
  font-size: 14px;
  font-weight: 600;
  padding: 4px 10px;
  margin-left: 0;
}

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

.layers-intro-single {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 10px 12px;
  color: #78350f;
}

.layer-keys-unavailable {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  background: #f8fafc;
  border: 1px dashed var(--stroke);
  opacity: 1;
}

.layer-keys-unavailable .key-unavail-badge {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #e2e8f0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.layer-keys-unavailable h3 {
  margin: 0 0 6px;
  font-size: 15px;
  color: var(--text);
}

.layer-keys-unavailable p {
  margin: 0 0 8px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

.layer-keys-unavailable .key-unavail-hint {
  font-size: 12px;
  margin-bottom: 0;
}

.detail-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  text-align: center;
  position: relative;
  padding: 32px 20px;
  box-sizing: border-box;
}

.detail-empty-watermarks {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(10px, 2vh, 20px);
  pointer-events: none;
  user-select: none;
  padding: 24px 16px;
  box-sizing: border-box;
}

.detail-empty-watermarks span {
  font-size: clamp(1.15rem, 2.5vw, 2rem);
  font-weight: 600;
  color: rgba(15, 23, 42, 0.06);
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.detail-empty-message {
  position: relative;
  z-index: 1;
  max-width: 22rem;
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .detail-scroll.detail-empty-state {
    min-height: auto;
    padding: 28px 16px 36px;
    justify-content: flex-start;
  }

  .detail-empty-watermarks {
    position: relative;
    inset: auto;
    width: 100%;
    padding: 0;
    margin: 0 0 20px;
  }

  .detail-empty-watermarks span {
    font-size: 1.125rem;
    color: rgba(15, 23, 42, 0.08);
  }

  .detail-empty-message {
    font-size: 14px;
    max-width: none;
  }
}

@media (min-width: 901px) {
  .detail-scroll.detail-empty-state {
    min-height: min(300px, calc(100dvh - 220px));
  }
}

.market-detail-head {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 12px;
}

.market-detail-head-main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.market-detail-title-block {
  min-width: 0;
  flex: 1;
}

.market-detail-close-icon {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: #fff;
  color: var(--text-muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.market-detail-close-icon:hover {
  background: #f8fafc;
  color: var(--text);
  border-color: #cbd5e1;
}

.market-detail-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 10px 12px 10px 8px;
  background: #f8fafc;
  border: 1px solid var(--stroke);
  border-radius: 10px;
}

.market-detail-toolbar-config {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
  min-width: 0;
  flex: 1;
  margin-left: -2px;
}

.market-detail-toolbar .layers-intro {
  margin: 0;
  padding: 0 0 0 12px;
  background: transparent;
  border: none;
  border-radius: 0;
  border-left: 1px solid #e2e8f0;
  flex: 1 1 160px;
  line-height: 1.35;
}

.market-detail-toolbar .layers-intro-single {
  background: transparent;
  border: none;
  border-left: 1px solid #fcd34d;
  padding-left: 12px;
  color: #92400e;
}

.market-detail-toolbar-end {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-left: auto;
}

.config-transfer-btn-detail {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}

.market-detail-head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.market-row-config {
  justify-content: center;
  overflow: visible;
}

.market-row-config-h {
  font-size: 11px;
}

.market-row-config .config-copy-panel,
.market-row-config .config-paste-menu {
  z-index: 40;
}

.config-transfer-cluster {
  display: flex;
  align-items: center;
  gap: 4px;
  position: relative;
}

.config-transfer-cluster--row {
  justify-content: center;
  flex-wrap: wrap;
  max-width: 100%;
  gap: 3px 4px;
}

.config-row-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 26px;
  padding: 2px 7px;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.2;
  white-space: nowrap;
  color: var(--accent, #0d9488);
}

.config-row-btn:hover {
  background: #f0fdfa;
  border-color: #99f6e4;
}

.config-row-btn-copy {
  color: var(--text-muted);
  border-color: #e2e8f0;
}

.config-row-btn-copy:hover {
  color: var(--accent, #0d9488);
}

.config-row-btn-paste {
  background: #0d9488;
  border-color: #0f766e;
  color: #fff;
}

.config-row-btn-paste:hover {
  background: #0f766e;
  border-color: #115e59;
}

.config-row-btn-more,
.config-paste-more.config-row-btn-more {
  min-width: 22px;
  padding: 2px 4px;
  font-size: 10px;
  color: var(--text-muted);
  background: #f8fafc;
}

.config-row-btn-more:hover,
.config-paste-more.config-row-btn-more:hover {
  color: var(--text);
  background: #f1f5f9;
}

.config-transfer-copy,
.config-transfer-paste {
  position: relative;
  display: flex;
  align-items: center;
  gap: 2px;
}

.config-transfer-btn,
.config-clipboard-hint strong {
  color: var(--accent, #0d9488);
}

.config-transfer-btn {
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
}

.config-icon-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: var(--accent, #0d9488);
}

.config-icon-btn:hover {
  background: #f0fdfa;
  border-color: #99f6e4;
}

.config-paste-btn {
  font-size: 13px;
  padding: 6px 12px;
}

.config-paste-more {
  border: 1px solid var(--stroke);
  background: #fff;
  border-radius: 6px;
  width: 28px;
  height: 32px;
  cursor: pointer;
  color: var(--text-muted);
}

.config-paste-more:hover {
  background: #f8fafc;
}

.config-copy-panel,
.config-paste-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 30;
  min-width: 220px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

.config-transfer-copy .config-copy-panel {
  right: auto;
  left: 0;
}

.config-copy-heading {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent, #0d9488);
}

.config-copy-option {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 4px 0;
  cursor: pointer;
}

.config-copy-option-all {
  border-bottom: 1px solid var(--stroke);
  margin-bottom: 6px;
  padding-bottom: 8px;
  font-weight: 600;
}

.config-copy-run {
  width: 100%;
  margin-top: 10px;
}

.config-paste-menu-item {
  display: block;
  width: 100%;
  text-align: left;
  border: none;
  background: transparent;
  padding: 8px 6px;
  border-radius: 6px;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

.config-paste-menu-item:hover {
  background: #f1f5f9;
}

.config-paste-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  margin: 0 0 14px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ecfdf5 0%, #f0fdfa 100%);
  border: 1px solid #99f6e4;
}

.config-paste-banner-text {
  font-size: 14px;
}

.config-paste-banner-note {
  font-size: 13px;
  font-weight: 500;
  color: #0f766e;
}

.config-paste-banner-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.config-clipboard-hint {
  margin: 0 10px 10px;
  padding: 10px 12px;
  font-size: 13px;
  border-radius: 8px;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #134e4a;
}

.market-detail-head h2 {
  margin: 0 0 4px;
}

.market-active-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  padding: 8px 12px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}

.market-active-toggle input {
  width: 18px;
  height: 18px;
  accent-color: var(--ok);
}

.market-active-toggle input:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.market-active-toggle--disabled {
  opacity: 0.85;
  cursor: not-allowed;
}

.market-active-block {
  margin: 6px 0 0;
  font-size: 12px;
  max-width: 22rem;
}

.market-group-activate-all:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.market-group-activate-all:disabled:hover {
  background: #fff;
}

.detail-panel h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

.config-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.chip {
  border: 1px solid var(--stroke);
  background: #f8fafc;
  padding: 8px 12px;
  border-radius: 8px;
  text-align: left;
  min-width: 120px;
}

.chip.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.chip .chip-label {
  font-weight: 600;
  display: block;
}

.chip .chip-bind {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.schema-tag {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 10px;
  padding: 6px 10px;
  background: #f8fafc;
  border-radius: 6px;
  border: 1px solid var(--stroke);
}

.config-form {
  width: 100%;
}

.config-section {
  padding: 10px 0;
  border-bottom: 1px solid var(--stroke);
}

.config-section:first-child {
  padding-top: 0;
}

.config-section:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.config-section-title {
  margin: 0 0 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px 12px;
  width: 100%;
  max-width: none;
}

.field-grid.field-grid-pricing {
  grid-template-columns: 1fr;
  gap: 12px;
}

.field-grid label.field-wide,
.field-grid label.full-width,
.field-grid label.span-2 {
  grid-column: 1 / -1;
}

@media (max-width: 520px) {
  .field-grid label.span-2 {
    grid-column: 1 / -1;
  }
}

.checkbox-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  align-items: flex-start;
}

.checkbox-strip .checkbox-row {
  flex: 1 1 220px;
  min-width: 0;
}

.field-grid label.checkbox-row,
.checkbox-strip label.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-weight: 400;
  cursor: pointer;
}

.field-grid label.checkbox-row.align-end {
  justify-content: flex-start;
  align-self: end;
  padding-bottom: 8px;
}

.cutoff-block {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cutoff-group-title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.cutoff-group-body {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px 24px;
  padding: 12px 14px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: #f8fafc;
}

.cutoff-injury-check {
  margin: 0;
  font-weight: 500;
}

.cutoff-seconds-field {
  margin: 0;
  font-weight: 400;
}

.cutoff-seconds-input {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.cutoff-seconds-input input[type="number"] {
  width: 72px;
  padding: 8px 10px;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  background: #fff;
}

.cutoff-seconds-lbl {
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.field-grid label.checkbox-row input[type="checkbox"],
.checkbox-strip label.checkbox-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  flex-shrink: 0;
  padding: 0;
  border-radius: 3px;
}

.field-grid label.checkbox-row span,
.checkbox-strip label.checkbox-row span {
  line-height: 1.35;
  flex: 1;
  min-width: 0;
}

.config-form fieldset.asian-lines {
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 8px 12px;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  width: 100%;
}

.config-form fieldset.asian-lines label.checkbox-row.inline {
  flex: 0 0 auto;
  font-weight: 500;
  font-size: 13px;
}

.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;
}

.field-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
}

.field-grid input,
.field-grid select {
  padding: 8px 10px;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  font-weight: 400;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.field-grid input.input-invalid,
.field-grid select.input-invalid {
  border-color: #dc2626;
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.35);
}

.field-validation {
  display: block;
  font-size: 12px;
  line-height: 1.3;
  color: #dc2626;
  font-weight: 500;
}

.field-hint {
  margin: 8px 0 0;
  font-size: 12px;
}

.panel-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--stroke);
}

.layers-intro {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 16px;
  padding: 10px 12px;
  background: #f8fafc;
  border-radius: 8px;
  border: 1px solid var(--stroke);
}

.config-layers {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.layer-card {
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 14px 16px;
  background: var(--panel);
}

.layer-card.layer-market {
  border-left: 4px solid var(--blue);
}

.layer-card.layer-timeline {
  border-left: 4px solid var(--teal);
}

.layer-card.layer-key {
  border-left: 4px solid #7c3aed;
}

.layer-card.layer-key.is-editing {
  background: #faf8ff;
}

.layer-head {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
  align-items: flex-start;
}

.market-detail-close {
  font-size: 13px;
  white-space: nowrap;
}

.layer-step {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--navy);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.layer-head h3 {
  margin: 0 0 4px;
  font-size: 15px;
}

.layer-scope {
  margin: 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.45;
}

.key-empty-state {
  padding: 16px;
  background: #f8fafc;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

.key-scope-line {
  margin: 0 0 12px;
  font-size: 13px;
}

.timeline-interactive .slot {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 56px;
  min-height: 64px;
  padding: 8px 10px;
  line-height: 1.2;
  text-align: center;
}

.timeline-interactive .slot-time {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  opacity: 1;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.timeline-interactive button.slot.slot-add {
  cursor: pointer;
  border: 1px dashed #cbd5e1;
  background: #fff;
  color: var(--text-muted);
}

.timeline-interactive button.slot.slot-add:hover {
  border-color: var(--teal);
  color: var(--teal);
  background: var(--teal-soft);
}

.timeline-interactive button.slot.slot-add:hover .slot-time {
  color: var(--teal);
}

.slot-plus {
  font-weight: 700;
  font-size: 20px;
  line-height: 1;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  border: 1px dashed #cbd5e1;
  background: #f8fafc;
  flex-shrink: 0;
}

.timeline-interactive button.slot.slot-add:hover .slot-plus {
  border-color: var(--teal);
  background: #fff;
}

.slot.slot-add-custom {
  min-width: 64px;
  cursor: pointer;
  border: 1px dashed #cbd5e1;
  background: #fff;
  color: var(--text-muted);
}

.slot.slot-add-custom.is-open {
  min-width: 92px;
  gap: 4px;
  padding: 6px 8px 8px;
  cursor: default;
}

.slot.slot-add-custom .timeline-custom-input {
  width: 72px;
  padding: 4px 6px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  border: 1px solid var(--stroke);
  border-radius: 4px;
  color: var(--text);
}

.slot.slot-add-custom .timeline-custom-input:focus {
  outline: 2px solid var(--teal);
  outline-offset: 0;
}

.slot.slot-add-custom.is-open .slot-plus {
  width: 24px;
  height: 24px;
  font-size: 16px;
  border-style: solid;
  cursor: pointer;
}

.timeline-custom-error {
  font-size: 11px;
  color: var(--bad);
  font-weight: 600;
  line-height: 1.25;
  max-width: 88px;
  text-align: center;
}

.timeline-legend {
  margin: 12px 0 0;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
}

.timeline-legend .leg {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  margin-right: 4px;
}

.timeline-legend .keyed-sample {
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 600;
}

.timeline-legend .add-sample {
  border: 1px dashed var(--stroke);
  font-weight: 700;
}

.key-editor-inner {
  padding-top: 4px;
}

.section-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 20px 0 8px;
}

.timeline {
  display: flex;
  align-items: stretch;
  gap: 8px;
  overflow-x: auto;
  padding: 14px 12px;
  background: #f8fafc;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  scrollbar-gutter: stable;
}

.timeline .slot {
  flex-shrink: 0;
  font-size: 15px;
  padding: 8px 10px;
  background: #f1f5f9;
  border-radius: 8px;
  color: var(--text-muted);
  border: none;
  cursor: default;
  font-family: inherit;
}

.timeline button.slot.keyed {
  cursor: pointer;
  background: var(--teal-soft);
  color: var(--teal);
  font-weight: 700;
  font-size: 17px;
  border: 1px solid rgba(13, 148, 136, 0.25);
}

.timeline button.slot.keyed .slot-time {
  font-size: 12px;
  font-weight: 600;
  color: #0f766e;
}

.timeline button.slot.keyed:hover,
.timeline button.slot.keyed.selected {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

.key-editor {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  background: #f8fafc;
}

.key-editor h3 {
  margin: 0 0 12px;
  font-size: 14px;
}

.key-editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  align-items: center;
}

.key-editor-actions .spacer {
  flex: 1;
}

.btn.danger {
  color: var(--bad);
  border-color: #fecaca;
  background: var(--bad-bg);
}

.key-list li {
  gap: 12px;
  align-items: center;
}

.key-list .btn-link {
  border: none;
  background: none;
  color: var(--blue);
  padding: 4px 8px;
  font-size: 13px;
  font-weight: 500;
}

.key-editor-inner.config-form {
  width: 100%;
}

.key-editor-actions.panel-actions {
  flex-wrap: wrap;
}

.margin-block {
  margin-top: 0;
  max-width: none;
  width: 100%;
}

.margin-block > label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 10px;
}

.margin-segments {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-bottom: 10px;
}

.margin-segments label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
}

.margin-segments input[type="radio"] {
  accent-color: var(--teal);
  width: 14px;
  height: 14px;
}

.margin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 10px;
}

.margin-table th {
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 6px 8px;
  border-bottom: 1px solid var(--stroke);
}

.margin-table td {
  padding: 8px;
  text-align: center;
  border-bottom: 1px solid var(--stroke-soft, var(--stroke));
}

.margin-table td.row-label {
  text-align: left;
  font-weight: 500;
  color: var(--text);
  width: 88px;
}

.margin-table tr.normal td {
  color: var(--text-muted);
}

.margin-table input.odds-input {
  width: 72px;
  padding: 6px 8px;
  border: 1px solid var(--stroke);
  border-radius: 4px;
  text-align: center;
  background: #f1f5f9;
}

.margin-slider-wrap {
  padding: 8px 0 12px;
  position: relative;
  z-index: 2;
  cursor: pointer;
}

.margin-slider-wrap:focus-within {
  outline: 2px solid var(--teal-soft);
  outline-offset: 2px;
  border-radius: 6px;
}

.margin-slider-wrap input[type="range"] {
  width: 100%;
  max-width: none;
  accent-color: var(--teal);
  pointer-events: auto;
  cursor: pointer;
}

.copy-from-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-width: 280px;
}

.copy-from-row select {
  padding: 8px 10px;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  background: #fff;
}

.key-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.key-list li {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--stroke-soft, var(--stroke));
  font-size: 13px;
}

.callout {
  background: var(--teal-soft);
  border: 1px solid #b8e0e6;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

.assign-intro {
  margin: 0 0 10px;
}

.assign-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.assign-filters .btn.assign-filter {
  font-size: 12px;
  padding: 6px 12px;
}

.assign-filters .btn.assign-filter.active {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: var(--blue);
}

.assign-workspace {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.assign-tree-panel {
  padding: 14px;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.assign-tree-heading {
  margin: 0 0 4px;
  font-size: 15px;
}

.assign-tree-meta {
  margin: 0 0 10px;
  font-size: 12px;
}

.assign-search {
  width: 100%;
  margin-bottom: 12px;
  padding: 8px 10px;
  border: 1px solid var(--stroke);
  border-radius: 6px;
}

.assign-tree-root {
  padding-left: 0;
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.tree-leaf label {
  flex-wrap: wrap;
}

.tree-leaf-label {
  flex: 1;
  min-width: 0;
}

.pill.assign-tag {
  font-size: 10px;
  padding: 1px 6px;
  margin-left: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pill.assign-tag.assign-tag-other {
  background: #ede9fe;
  color: #5b21b6;
  font-weight: 500;
}

.assign-filter-help {
  margin: -4px 0 12px;
  font-size: 12px;
  line-height: 1.45;
}

.assign-layout {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
  gap: 16px;
  align-items: stretch;
}

@media (max-width: 900px) {
  .assign-layout {
    grid-template-columns: 1fr;
  }

  .workspace-body.workspace-body--assign {
    overflow: auto;
  }

  .assign-tree-root {
    max-height: 50vh;
  }

  .assign-selection-scroll {
    max-height: 40vh;
  }
}

.tree-toggle {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.tree-toggle .btn.active {
  background: var(--blue-soft);
  border-color: var(--blue);
  color: var(--blue);
}

.tree ul {
  list-style: none;
  margin: 0;
  padding-left: 20px;
}

.tree > ul {
  padding-left: 0;
}

.tree-node {
  margin: 4px 0;
}

.tree-node label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 0;
}

.tree-node .folder {
  font-weight: 600;
}

.tree-node .folder .assign-folder-count {
  font-weight: 600;
  color: var(--blue);
}

.assign-selection-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.assign-selection-panel h3 {
  margin: 0;
  font-size: 15px;
  flex-shrink: 0;
}

.assign-selection-stats {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  flex-shrink: 0;
}

.assign-stat {
  background: #f8fafc;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 8px 10px;
  min-width: 0;
}

.assign-stat-num {
  display: block;
  font-size: 18px;
  font-weight: 700;
  color: var(--blue);
  line-height: 1.2;
}

.assign-stat-lbl {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  margin-top: 2px;
  line-height: 1.3;
}

.assign-selection-delta.card-inset {
  flex-shrink: 0;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
}

.assign-delta-title {
  margin: 0 0 6px;
  font-weight: 600;
  font-size: 13px;
  color: var(--text);
}

.assign-delta-summary {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--text-muted);
}

.assign-delta-subhead {
  margin: 8px 0 4px;
  font-size: 12px;
}

.assign-delta-subhead.assign-delta-add {
  color: #047857;
}

.assign-delta-subhead.assign-delta-remove {
  color: #b91c1c;
}

.assign-delta-names {
  margin: 0 0 4px;
  padding-left: 18px;
  font-size: 13px;
}

.assign-delta-line {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

.assign-selection-lead {
  margin: -4px 0 0;
  font-size: 12px;
  line-height: 1.45;
}

.selection-scroll-title {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.assign-selection-scroll {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fafafa;
}

.selection-group {
  margin-bottom: 12px;
}

.selection-group:last-child {
  margin-bottom: 0;
}

.selection-group-head {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.selection-group-list {
  margin: 0;
  padding-left: 16px;
  font-size: 13px;
}

.selection-group-list li {
  margin: 2px 0;
}

.selection-item-label {
  font-weight: 500;
}

.selection-empty {
  margin: 0;
}

.selection-basket {
  padding: 14px;
}

.selection-basket .selection-actions {
  flex-shrink: 0;
  display: flex;
  gap: 8px;
}

.log-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
}

.log-filters input,
.log-filters select {
  padding: 8px 10px;
  border: 1px solid var(--stroke);
  border-radius: 6px;
}

.log-row {
  border-bottom: 1px solid var(--stroke);
}

.log-row summary {
  padding: 12px 8px;
  cursor: pointer;
  list-style: none;
  display: grid;
  grid-template-columns: 148px 88px 1.1fr 1fr 1.6fr;
  gap: 12px;
  align-items: center;
  font-size: 13px;
}

.log-table-head {
  display: grid;
  grid-template-columns: 148px 88px 1.1fr 1fr 1.6fr;
  gap: 12px;
  padding: 8px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.log-table-card {
  padding: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.log-col-summary {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.log-tab-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.log-scope-pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #0369a1;
}

.log-filters--extended {
  align-items: flex-end;
}

.log-market-search-field {
  flex: 1 1 220px;
  min-width: 200px;
  max-width: 320px;
}

.log-text-search-field {
  flex: 1 1 280px;
  min-width: 220px;
  max-width: 420px;
}

.log-text-search-wrap {
  width: 100%;
}

.log-search-status {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.log-search-status-count {
  font-weight: 700;
  color: var(--text);
}

.log-market-search-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.log-market-search-wrap {
  width: 100%;
}

.log-market-search-status {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-muted);
}

.log-market-search-status-count {
  font-weight: 700;
  color: var(--text);
}

.log-date-field,
.log-market-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}

.log-date-field input,
.log-market-field input {
  padding: 8px 10px;
  border: 1px solid var(--stroke);
  border-radius: 6px;
  font-size: 13px;
}

.log-archive-hint {
  margin: 0 0 10px;
}

.log-load-older-wrap {
  margin-top: 16px;
  text-align: center;
}

.log-empty {
  padding: 16px;
  margin: 0;
}

.log-detail-wrap {
  padding: 0 8px 12px 148px;
  font-size: 13px;
}

.log-detail-wrap ul {
  margin: 4px 0 12px;
  padding-left: 20px;
}

.log-detail-label {
  margin: 8px 0 4px;
  font-weight: 600;
  font-size: 12px;
}

.log-detail-json {
  font-family: var(--mono);
  font-size: 12px;
  background: #f8fafc;
  margin: 8px 0 0;
  padding: 10px;
  border-radius: 6px;
  white-space: pre-wrap;
}

.log-row summary::-webkit-details-marker {
  display: none;
}

.log-row .log-detail {
  padding: 0 8px 12px 148px;
  font-family: var(--mono);
  font-size: 12px;
  background: #f8fafc;
  margin: 0 8px 8px;
  border-radius: 6px;
  white-space: pre-wrap;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.kpi {
  padding: 14px;
  text-align: center;
}

.kpi .num {
  font-size: 1.5rem;
  font-weight: 700;
}

.kpi .lbl {
  font-size: 12px;
  color: var(--text-muted);
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}

.status-dot.on {
  background: var(--ok);
}

.status-dot.off {
  background: #94a3b8;
}

.toast {
  position: fixed;
  bottom: 72px;
  right: 20px;
  max-width: min(440px, calc(100vw - 40px));
  background: var(--navy);
  color: #fff;
  padding: 12px 16px;
  border-radius: 8px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 50;
  font-size: 13px;
  line-height: 1.45;
  white-space: pre-line;
}

.toast--detail {
  white-space: normal;
  padding: 14px 16px;
}

.toast-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
}

.toast-subtitle {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.82);
}

.toast-skips {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 10px;
}

.toast-skip {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-left: 3px solid rgba(255, 255, 255, 0.35);
}

.toast-skip--missing {
  background: rgba(245, 158, 11, 0.16);
  border-left-color: #fbbf24;
}

.toast-skip--incomplete {
  background: rgba(96, 165, 250, 0.16);
  border-left-color: #93c5fd;
}

.toast-skip--config {
  background: rgba(52, 211, 153, 0.14);
  border-left-color: #6ee7b7;
}

.toast-skip-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: none;
}

.toast-skip--missing .toast-skip-label {
  color: #fde68a;
}

.toast-skip--incomplete .toast-skip-label {
  color: #bfdbfe;
}

.toast-skip--config .toast-skip-label {
  color: #a7f3d0;
}

.toast-skip-markets {
  font-size: 13px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.95);
}

.toast-hint {
  margin: 10px 0 0;
  font-size: 12px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.68);
}

.toast--undo {
  pointer-events: auto;
}

.toast-actions {
  margin-top: 10px;
}

.toast-undo {
  border: 1px solid rgba(255, 255, 255, 0.45);
  background: #fff;
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-family: inherit;
}

.toast-undo:hover {
  background: #f1f5f9;
}

.toast.show {
  opacity: 1;
}

/* --- Responsive layout (markets, editor, logs) --- */

@media (max-width: 1280px) {
  .market-row > :nth-child(4),
  .market-row > :nth-child(5),
  .market-row-head > :nth-child(4),
  .market-row-head > :nth-child(5) {
    display: none;
  }

  .market-row,
  .market-row-head {
    --market-row-cols: minmax(0, 1.45fr) minmax(44px, 0.75fr) minmax(40px, 0.55fr) minmax(64px, 0.9fr) minmax(88px, 0.85fr) minmax(50px, 0.68fr);
  }
}

@media (max-width: 1024px) {
  .market-row > :nth-child(2),
  .market-row-head > :nth-child(2) {
    display: none;
  }

  .market-row,
  .market-row-head {
    --market-row-cols: minmax(0, 1.5fr) minmax(40px, 0.55fr) minmax(64px, 0.9fr) minmax(84px, 0.82fr) minmax(50px, 0.68fr);
  }

  .log-row summary,
  .log-table-head {
    grid-template-columns: 120px 72px minmax(0, 1fr) minmax(0, 1fr);
  }

  .log-row summary > :nth-child(4),
  .log-table-head > :nth-child(4) {
    display: none;
  }
}

@media (max-width: 768px) {
  .market-row > :nth-child(3),
  .market-row-head > :nth-child(3) {
    display: none;
  }

  .market-row,
  .market-row-head {
    --market-row-cols: minmax(0, 1fr) minmax(64px, 0.95fr) minmax(80px, 0.82fr) minmax(48px, 0.72fr);
    column-gap: 6px;
    padding-left: 8px;
    padding-right: 8px;
  }

  .workspace-body {
    padding: 12px 12px calc(var(--footer-h) + 16px);
  }

  .list-page,
  .templates-list-page {
    padding-left: 12px;
    padding-right: 12px;
  }

  .editor-header {
    padding: 14px 12px 16px;
  }

  .editor-header h1 {
    font-size: 1.25rem;
  }

  .market-detail-toolbar-config {
    flex: 1 1 100%;
  }

  .market-detail-toolbar .layers-intro {
    flex: 1 1 100%;
    border-left: none;
    padding-left: 0;
    margin-top: 2px;
  }

  .market-detail-toolbar-end {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }

  .config-paste-banner-actions {
    width: 100%;
  }

  .config-paste-banner-actions .btn {
    flex: 1 1 auto;
  }

  .log-filters--extended .log-text-search-field,
  .log-filters--extended .log-market-search-field {
    flex: 1 1 100%;
    max-width: none;
    min-width: 0;
  }
}

@media (max-width: 640px) {
  .editor-footer {
    flex-wrap: wrap;
    height: auto;
    min-height: var(--footer-h);
    padding: 10px 12px;
    gap: 8px;
  }

  .editor-footer-hint {
    flex: 1 1 100%;
    margin: 0;
    order: -1;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: calc(var(--footer-h) + 12px);
  }

  .market-row-config .config-copy-panel,
  .market-row-config .config-paste-menu {
    max-width: min(280px, calc(100vw - 32px));
  }

  .market-group-bulk-btn {
    width: 100%;
    text-align: center;
  }

  .log-row summary,
  .log-table-head {
    grid-template-columns: 96px minmax(0, 1fr) minmax(0, 1.2fr);
    gap: 8px;
    font-size: 12px;
  }

  .log-row summary > :nth-child(3),
  .log-table-head > :nth-child(3) {
    display: none;
  }
}

@media (max-width: 480px) {
  .config-transfer-cluster--row {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  .config-transfer-cluster--row .config-transfer-copy,
  .config-transfer-cluster--row .config-transfer-paste {
    width: 100%;
    justify-content: center;
  }

  .config-row-btn {
    flex: 1;
  }

  .workspace-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .tab {
    padding: 10px 12px;
    font-size: 13px;
    white-space: nowrap;
  }
}

.auth-gate {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(160deg, var(--navy) 0%, #0d4f5c 55%, var(--bg) 55%);
}

.auth-gate-card {
  width: 100%;
  max-width: 400px;
  padding: 28px 24px 24px;
  background: var(--panel);
  border: 1px solid var(--stroke);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(5, 5, 48, 0.12);
}

.auth-gate-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.auth-gate-eyebrow {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.auth-gate-logo {
  display: block;
  height: 22px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  flex-shrink: 0;
}

.auth-gate-title {
  margin: 0 0 20px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}

.auth-gate-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.auth-gate-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.auth-gate-field input {
  padding: 10px 12px;
  border: 1px solid var(--stroke);
  border-radius: 8px;
  font: inherit;
  font-weight: 400;
}

.auth-gate-field input:focus {
  outline: 2px solid var(--blue-soft);
  border-color: var(--blue);
}

.auth-gate-error {
  margin: 0;
  font-size: 13px;
  color: var(--bad);
  line-height: 1.45;
}

.auth-gate-error code {
  font-size: 12px;
}

.auth-gate-submit {
  width: 100%;
  margin-top: 4px;
}
