:root {
  font-family: Inter, "Noto Sans SC", system-ui, sans-serif;
  color: #223443;
  background: #f4f7fa;
  font-size: 14px;
  --accent: #0b8b79;
  --line: #e7edf1;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
button,
input,
select {
  font: inherit;
}
button,
a,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
a {
  color: inherit;
  text-decoration: none;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid #51baab;
  outline-offset: 2px;
}
[hidden] {
  display: none !important;
}
aside {
  position: fixed;
  inset: 0 auto 0 0;
  width: 238px;
  background: #102a3a;
  color: #c0cfda;
  display: flex;
  flex-direction: column;
  padding: 29px 19px;
  z-index: 10;
}
.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 10px;
  color: white;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 2px;
}
.brand small {
  display: block;
  letter-spacing: 2px;
  font-size: 10px;
  font-weight: 400;
  color: #91a8b7;
  margin-top: 3px;
}
.brand-mark {
  display: grid;
  place-items: center;
  background: #21b59d;
  color: #fff;
  width: 39px;
  height: 42px;
  border-radius: 11px;
  font-size: 30px;
}
.workspace {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #314958;
  border-radius: 9px;
  padding: 12px 9px;
  font-size: 12px;
  margin: 30px 0 25px;
}
.workspace small {
  display: block;
  font-size: 10px;
  color: #819aa9;
  margin-top: 5px;
}
.avatar {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 9px;
  background: #e6f4ef;
  color: #16836d;
  font-weight: 600;
}
.workspace .avatar {
  background: #234b56;
  color: #7ce0cf;
}
.dot {
  margin-left: auto;
  background: #38c19a;
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
nav {
  overflow: auto;
}
nav .caption {
  font-size: 10px;
  color: #6f8b9c;
  letter-spacing: 2px;
  margin: 20px 14px 9px;
}
nav button {
  display: flex;
  align-items: center;
  gap: 13px;
  border: 0;
  width: 100%;
  text-align: left;
  color: #adc0cc;
  background: transparent;
  padding: 12px 14px;
  border-radius: 7px;
  margin: 3px 0;
  font-size: 13px;
}
nav button.active {
  color: #8bf1d5;
  background: #19483f;
}
nav button:hover {
  background: #234453;
  color: white;
}
nav svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
}
.side-bottom {
  margin-top: auto;
  padding-top: 22px;
}
.simulation-pill {
  font-size: 11px;
  color: #7bd0bd;
  padding: 10px;
  border: 1px solid #2c555b;
  border-radius: 6px;
}
.side-bottom p {
  font-size: 10px;
  text-align: center;
  color: #738d9d;
}
.side-export {
  background: none;
  border: 0;
  color: #9cb4c3;
  font-size: 11px;
  padding: 8px;
}
.main {
  margin-left: 238px;
}
header {
  height: 78px;
  display: flex;
  align-items: center;
  padding: 0 36px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  gap: 12px;
}
.breadcrumb {
  font-size: 12px;
  color: #7c8c99;
}
.breadcrumb span {
  margin: 0 12px;
  color: #c9d0d6;
}
.breadcrumb strong {
  color: #354a59;
  font-weight: 500;
}
.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
}
.environment {
  font-size: 10px;
  letter-spacing: 1px;
  color: #19806e;
  background: #edf8f3;
  border: 1px solid #d7eee4;
  border-radius: 5px;
  padding: 6px 9px;
}
.icon-btn {
  border: 0;
  background: none;
  color: #6b7c8a;
  font-size: 20px;
  padding: 6px;
}
.divider {
  width: 1px;
  height: 24px;
  background: var(--line);
}
.small {
  width: 32px;
  height: 32px;
}
#account {
  font-size: 11px;
}
#account small {
  display: block;
  font-size: 9px;
  color: #99a3ad;
  margin-top: 4px;
}
main {
  max-width: 1600px;
  margin: auto;
  padding: 32px 36px 20px;
}
.page-title {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 26px;
}
.eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  color: #83949f;
  margin: 0 0 8px;
}
.page-title h1 {
  font-size: 26px;
  letter-spacing: 0.5px;
  margin: 0;
  font-weight: 600;
}
.page-title p {
  color: #8a98a3;
  font-size: 12px;
  margin: 9px 0 0;
}
.actions {
  display: flex;
  gap: 9px;
  align-items: center;
}
.btn {
  padding: 9px 14px;
  border: 1px solid #dce5e9;
  border-radius: 6px;
  background: white;
  color: #475d6b;
  white-space: nowrap;
  font-size: 12px;
}
.btn:hover {
  border-color: #80bcae;
  color: #137b69;
}
.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}
.btn.danger {
  color: #b95151;
}
.welcome {
  background: linear-gradient(110deg, #e5f3ee, #f1f8f4);
  border: 1px solid #d7e9e1;
  border-radius: 9px;
  padding: 23px 26px;
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 23px;
  position: relative;
  overflow: hidden;
}
.welcome .symbol {
  width: 49px;
  height: 49px;
  display: grid;
  place-items: center;
  background: white;
  border: 1px solid #d3e8df;
  border-radius: 12px;
  color: #178e75;
  font-size: 26px;
}
.welcome h2 {
  font-size: 16px;
  font-weight: 600;
  margin: 0 0 8px;
}
.welcome p {
  font-size: 12px;
  color: #719085;
  margin: 0;
}
.welcome .tag {
  margin-left: auto;
}
.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 23px;
}
.metric {
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 21px 23px;
}
.metric-top {
  display: flex;
  justify-content: space-between;
  color: #84949f;
  font-size: 12px;
}
.metric-icon {
  font-size: 16px;
  color: #1b9985;
}
.metric strong {
  display: block;
  font-size: 29px;
  font-weight: 600;
  letter-spacing: 0.5px;
  margin: 10px 0;
}
.metric small {
  font-size: 10px;
  color: #98a4ad;
}
.metric em {
  font-style: normal;
  font-size: 10px;
  color: #25997e;
  margin-right: 6px;
}
.grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 22px;
  margin-bottom: 23px;
}
.panel {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: hidden;
  margin-bottom: 22px;
}
.grid .panel {
  margin-bottom: 0;
}
.panel-head {
  padding: 20px 23px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.panel-head h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
}
.panel-head small {
  font-size: 10px;
  color: #91a0ab;
  display: block;
  margin-top: 5px;
}
.panel-body {
  padding: 0 23px 23px;
}
.tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 4px;
  background: #f0f3f6;
  color: #7d8c98;
  white-space: nowrap;
}
.tag.green {
  background: #eaf7ef;
  color: #269376;
}
.tag.amber {
  background: #fff6e8;
  color: #be8a37;
}
.tag.red {
  background: #fff0f0;
  color: #bd6262;
}
.tag.blue {
  background: #edf3ff;
  color: #5d81be;
}
.text-link {
  border: 0;
  background: none;
  padding: 3px;
  color: #15927b;
  font-size: 11px;
}
.chart {
  height: 216px;
  padding: 0 0 8px;
}
.chart svg {
  height: 100%;
  width: 100%;
  overflow: visible;
}
.legend {
  display: flex;
  gap: 18px;
  font-size: 10px;
  color: #8a9aa5;
}
.legend i {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #19a287;
  margin-right: 5px;
}
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.quick {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  text-align: left;
  padding: 16px 12px;
}
.quick span {
  color: #18907c;
  font-size: 20px;
}
.quick strong {
  display: block;
  font-size: 12px;
  font-weight: 500;
  margin-top: 8px;
}
.quick small {
  display: block;
  color: #94a1ab;
  font-size: 10px;
  margin-top: 5px;
}
.table-wrap {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  white-space: nowrap;
}
th {
  font-size: 10px;
  color: #82939f;
  background: #f8fafb;
  font-weight: 500;
  text-align: left;
  padding: 12px 22px;
  border-block: 1px solid #eef2f5;
}
td {
  padding: 16px 22px;
  border-bottom: 1px solid #f0f3f5;
  color: #556a78;
}
tbody tr:last-child td {
  border-bottom: 0;
}
.identity {
  display: flex;
  align-items: center;
  gap: 10px;
}
.identity strong {
  font-weight: 500;
  color: #3d5361;
}
.identity small {
  display: block;
  font-size: 9px;
  margin-top: 4px;
  color: #9aa7b0;
}
.tiny-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: #edf2f7;
  color: #6a8297;
  border-radius: 7px;
}
.number {
  font-variant-numeric: tabular-nums;
  font-family: Inter, system-ui;
}
.empty {
  text-align: center;
  padding: 45px 20px;
  color: #8a9ba5;
  font-size: 12px;
}
.empty span {
  display: block;
  font-size: 25px;
  color: #bfccd4;
  margin-bottom: 10px;
}
.toolbar {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.toolbar input {
  max-width: 300px;
}
.toolbar .count {
  margin-left: auto;
  font-size: 11px;
  color: #8d9ca5;
}
input,
select,
textarea {
  border: 1px solid #dbe4e9;
  border-radius: 6px;
  padding: 10px 11px;
  background: white;
  color: #435a68;
  min-width: 0;
}
input::placeholder {
  color: #a6b1b9;
}
label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: #6d8290;
}
dialog {
  border: 1px solid #dfe8ed;
  border-radius: 13px;
  box-shadow: 0 24px 80px #102a3a35;
  padding: 0;
  max-width: 650px;
  width: calc(100% - 32px);
  max-height: 88vh;
}
dialog::backdrop {
  background: #0b223654;
  backdrop-filter: blur(3px);
}
.modal-head {
  padding: 24px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-head h2 {
  font-size: 19px;
  margin: 0;
}
.modal-body {
  padding: 24px;
  display: grid;
  gap: 18px;
}
.modal-foot {
  border-top: 1px solid var(--line);
  padding: 17px 24px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.help {
  font-size: 11px;
  color: #8b9da7;
  line-height: 1.8;
}
.notice {
  background: #eff7f4;
  border: 1px solid #dcece5;
  padding: 14px 16px;
  border-radius: 7px;
  color: #4f8172;
  font-size: 12px;
  line-height: 1.8;
  margin-bottom: 20px;
}
.notice.amber {
  background: #fff8eb;
  border-color: #f3e9d1;
  color: #9a8051;
}
.balls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ball {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: #f2f6f8;
  border: 1px solid #dfe9ed;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 600;
  color: #527080;
}
.ball:last-child {
  background: #e6f6ed;
  color: #16866b;
  border-color: #bfe2ce;
}
.sources {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.source-card {
  padding: 23px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 9px;
}
.source-card h2 {
  font-size: 16px;
}
.source-card p {
  font-size: 11px;
  color: #8b9ba5;
  line-height: 1.9;
  word-break: break-all;
}
.source-card .balls {
  margin: 20px 0;
}
.source-card .btn {
  margin-top: 12px;
}
.rule-tabs {
  display: flex;
  gap: 9px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.rule-tabs button.active {
  background: #e5f4ed;
  color: #0a8b73;
  border-color: #bce2d2;
}
.rule-text {
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 2;
  color: #627885;
  padding: 0 24px 24px;
}
.rule-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  padding: 0 24px 24px;
  gap: 15px;
}
.rule-summary div {
  padding: 16px;
  background: #f7fafb;
  border-radius: 6px;
}
.rule-summary small {
  font-size: 10px;
  color: #90a0ac;
  display: block;
}
.rule-summary strong {
  display: block;
  margin-top: 8px;
  font-size: 17px;
}
.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 17px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}
.status-row:last-child {
  border: 0;
}
footer {
  max-width: 1600px;
  margin: 0 auto;
  padding: 13px 36px 25px;
  font-size: 9px;
  letter-spacing: 1px;
  color: #a4b0b8;
  display: flex;
  justify-content: space-between;
}
#toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  background: #173c42;
  color: white;
  border-radius: 8px;
  padding: 14px 24px;
  font-size: 12px;
  z-index: 100;
  transition: 0.2s;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}
#toast.error {
  background: #9c4e4e;
}
#menu {
  display: none;
}
#login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(ellipse at 30% 20%, #e1f4ed, #f4f7fa 65%);
}
.login-card {
  width: min(420px, 92vw);
  padding: 40px;
  background: white;
  border: 1px solid var(--line);
  border-radius: 15px;
  box-shadow: 0 10px 45px #153c3910;
  display: grid;
  gap: 20px;
}
.login-card h1 {
  font-size: 24px;
  margin: 0;
}
.login-card p {
  font-size: 12px;
  color: #81949e;
  margin: 0;
}
.login-card small {
  font-size: 10px;
  color: #9aabb5;
  line-height: 1.8;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: #f6f9fa;
  padding: 16px;
  font-size: 11px;
  max-height: 50vh;
  overflow: auto;
}
.page-loading {
  text-align: center;
  padding: 80px;
  color: #82969f;
}
@media (min-width: 1500px) {
  main {
    padding-top: 40px;
  }
  .metric {
    padding: 25px;
  }
  .chart {
    height: 250px;
  }
}
@media (max-width: 1100px) {
  aside {
    width: 205px;
  }
  .main {
    margin-left: 205px;
  }
  header {
    padding: 0 23px;
  }
  main {
    padding: 26px 23px;
  }
  .metrics {
    gap: 12px;
  }
  .metric {
    padding: 16px;
  }
  .metric strong {
    font-size: 24px;
  }
  .sources {
    grid-template-columns: 1fr;
  }
  .grid {
    grid-template-columns: 1.3fr 1fr;
  }
}
@media (max-width: 760px) {
  aside {
    transform: translateX(-100%);
    width: 238px;
    transition: 0.2s;
  }
  body.nav-open aside {
    transform: translateX(0);
  }
  .main {
    margin-left: 0;
  }
  #menu {
    display: block;
  }
  header {
    padding: 0 16px;
    height: 65px;
  }
  .header-right {
    gap: 8px;
  }
  .header-right #account,
  .divider {
    display: none;
  }
  .environment {
    font-size: 9px;
    padding: 5px;
  }
  .breadcrumb {
    font-size: 10px;
  }
  .breadcrumb span {
    margin: 0 5px;
  }
  main {
    padding: 24px 16px;
  }
  .page-title {
    align-items: flex-start;
    flex-wrap: wrap;
  }
  .page-title h1 {
    font-size: 23px;
  }
  .page-title p {
    font-size: 11px;
  }
  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid {
    grid-template-columns: 1fr;
  }
  .welcome {
    padding: 18px 15px;
    gap: 12px;
  }
  .welcome .tag {
    display: none;
  }
  .welcome p {
    font-size: 10px;
  }
  .welcome h2 {
    font-size: 14px;
  }
  .panel-head {
    padding: 18px;
  }
  .panel-body {
    padding: 0 18px 18px;
  }
  th,
  td {
    padding: 13px 16px;
  }
  .rule-summary {
    grid-template-columns: 1fr 1fr;
  }
  footer {
    padding: 16px;
    font-size: 8px;
  }
  footer span {
    letter-spacing: 0;
  }
  .actions {
    flex-wrap: wrap;
  }
}

/* Rule editor reuses the existing console panels and form controls. */
.rule-top, .rule-pages { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin: 16px 0; }
.rule-top { align-items: flex-end; }
.rule-top label { min-width: 180px; }
.rule-top > .help { display: flex; align-items: center; min-height: 44px; }
.rule-top select, .rule-top > .btn { height: 44px; }
#rule-editor select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, #536875 50%), linear-gradient(135deg, #536875 50%, transparent 50%);
  background-position: right 17px center, right 12px center;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}
.rule-grid { display: grid; grid-template-columns: repeat(auto-fit,minmax(190px,1fr)); gap: 16px; margin: 16px 0; }
.rule-grid label, .rule-top label, .rule-search, .rule-sample-grid label { display: flex; flex-direction: column; gap: 8px; color: #405666; font-size: 13px; }
.rule-check { display: flex !important; flex-direction: row !important; align-items: center; gap: 9px; }
.rule-check input { width: 18px; min-height: 18px; }
.rule-grid input, .rule-grid select, .rule-top select, .rule-sample-grid input { width: 100%; min-height: 44px; }
.rule-target-grid { align-items: end; }
.rule-target-grid .rule-check { min-height: 44px; }
#rule-rebate-rate:disabled {
  background: #eef2f5;
  border-color: #dce4ea;
  color: #667b89;
  opacity: 1;
  cursor: not-allowed;
  user-select: none;
}
.rule-weight { width: 110px; min-height: 44px; }
.rule-weight:disabled { background: #eef2f5; color: #667b89; cursor: not-allowed; opacity: 1; }
.rule-recovery { padding: 16px; background: #fff8e8; border: 1px solid #e4c989; border-radius: 8px; margin: 16px 0; }
.rule-recovery .btn + .btn { margin-left: 12px; }
#rule-table td:last-child { text-align: right; }
#rule-table [data-contribution] { display: block; }
@media (min-width: 1100px) {
  .rule-target-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) max-content minmax(0, 2fr); }
  .rule-target-grid > label:last-child { max-width: 220px; }
}
#rule-editor details { margin: 16px 0; }
#rule-editor summary { cursor: pointer; padding: 12px 0; font-weight: 600; }
.rule-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 24px; }
.rule-metrics small, .rule-history small { display: block; color: #536875; }
.rule-metrics > div, #rule-sample > div { padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; background: #f8fafb; }
.rule-metrics strong, #rule-sample dd { display: block; margin: 6px 0 0; font-size: 20px; font-weight: 650; line-height: 1.2; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.rule-sample-grid { display: grid; grid-template-columns: minmax(140px, 1fr) minmax(0, 4fr); gap: 16px; margin: 20px 0; }
.rule-result-label { margin-bottom: 8px; font-size: 13px; color: #405666; }
#rule-sample { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 0; }
#rule-sample dt { font-size: 13px; color: #405666; }
.rule-metrics > .rule-result-total, #rule-sample > .rule-result-total { background: #eaf7f2; border-color: #a9d7c9; color: #155c4e; }
.rule-result-total strong, #rule-sample .rule-result-total dd { font-size: 26px; font-weight: 750; }
#rule-table table { font-variant-numeric: tabular-nums; }
#rule-table :is(th, td):is(:nth-child(2), :nth-child(3), :nth-child(5), :nth-child(6)) { text-align: right; }
.rule-feedback { margin: 12px 0; color: #176c5a; overflow-wrap: anywhere; }
.rule-feedback.error { color: #a32b24; background: #fff2f0; padding: 12px; border-radius: 8px; }
.rule-override { display: flex; gap: 6px; min-width: 190px; }
.rule-override select { width: 85px; min-height: 44px; }
.rule-override input { width: 110px; min-height: 44px; }
.rule-search { max-width: 360px; margin: 20px 0; }
.rule-history > div { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 12px 0; border-bottom: 1px solid #e7eeeb; }
.rule-history span { flex: 1; min-width: 220px; overflow-wrap: anywhere; }
#rule-editor .panel-body { min-width: 0; }
#rule-editor .btn { min-height: 44px; }
#rule-editor .btn:disabled { opacity: .55; cursor: default; }
#rule-editor .help { color: #536875; line-height: 1.7; }
@media(max-width: 520px) { .rule-grid, .rule-metrics { grid-template-columns: 1fr; } .rule-top { align-items: stretch; } .rule-top > * { width: 100%; } }
@media(max-width: 840px) { .rule-sample-grid { grid-template-columns: minmax(0, 1fr); } #rule-sample { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.rule-grid .rule-check input[type="checkbox"], .rule-check input[type="checkbox"] {
  width: 18px; height: 18px; min-height: 18px; padding: 0; flex: 0 0 18px;
}
.rule-top .help { overflow-wrap: anywhere; }
.rule-card-toolbar { display: flex; gap: 16px; align-items: end; justify-content: space-between; margin: 24px 0 12px; max-width: 1440px; }
.rule-card-toolbar h3 { margin: 0 0 12px; font-size: 17px; color: #243d35; }
.rule-card-toolbar label { max-width: 220px; }
.rule-card-toolbar select { min-height: 44px; }
.rule-odds-image { display: block; max-width: 100%; border-radius: 10px; }
#rule-advanced { border-top: 1px solid var(--line); padding-top: 12px; }
#rule-advanced > summary { color: #405666; }
@media(max-width: 520px) {
  .rule-card-toolbar { align-items: start; flex-direction: column; }
  .rule-card-toolbar h3 { margin: 0; }
}

.wallet-banner { background:#eef7f4; border:1px solid #c7e0d6; border-radius:8px; padding:14px 18px; color:#24574b; }
.wallet-message { color:#24574b; overflow-wrap:anywhere; margin:12px 0; min-height:24px; }
.wallet-select { display:flex; gap:12px; align-items:end; margin:18px 0; flex-wrap:wrap; }
.wallet-select label { flex:1; min-width:200px; max-width:500px; }
.wallet-form { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:16px; margin:16px 0; align-items:end; }
.wallet-form .btn { justify-self:start; }
.wallet-metrics { display:grid; grid-template-columns:repeat(3,minmax(0,1fr)); gap:16px; }
.wallet-metrics > div { border:1px solid var(--line); border-radius:8px; background:#f8fafb; padding:18px; }
.wallet-metrics strong { display:block; margin:8px 0; font-size:28px; color:#155c4e; font-variant-numeric:tabular-nums; overflow-wrap:anywhere; }
#wallet-editor small { display:block; color:#536875; }
#wallet-editor summary { cursor:pointer; padding:12px 0; font-weight:600; }
#wallet-editor :is(input,select,.btn) { min-height:44px; }
#wallet-editor :disabled { background:#eef2f5; color:#667b89; cursor:not-allowed; opacity:.7; }
#wallet-editor .table-wrap { max-width:100%; }
#wallet-editor td { font-variant-numeric:tabular-nums; }
.wallet-id { overflow-wrap:anywhere; max-width:280px; }
.wallet-detail { display:grid; grid-template-columns:150px minmax(0,1fr); gap:12px; }
.wallet-detail dd { margin:0; overflow-wrap:anywhere; }
@media(max-width:650px){.wallet-form,.wallet-metrics {grid-template-columns:minmax(0,1fr);} .wallet-detail{grid-template-columns:minmax(0,1fr);gap:6px;} .wallet-detail dd{margin-bottom:12px;} }
.wallet-message.error { color:#9b3027; background:#fff3f0; border-radius:8px; padding:12px 16px; }
.payment-form { display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;align-items:end;margin:16px 0; }
.payment-form .btn { justify-self:start; }
.payment-check {display:flex;gap:10px;align-items:center;min-height:44px;}
#payment-editor .payment-check input {width:18px;min-height:18px;height:18px;}
.payment-metrics {display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:16px;}
.payment-metrics>div{padding:18px;background:#eef7f4;border:1px solid #c7e0d6;border-radius:8px;}
.payment-metrics strong{display:block;font-size:26px;color:#155c4e;margin:8px 0;font-variant-numeric:tabular-nums;overflow-wrap:anywhere;}
#payment-editor :is(input,select,.btn){min-height:44px;}
#payment-editor :disabled{background:#eef2f5;color:#667b89;cursor:not-allowed;opacity:.7;}
#payment-editor summary{padding:12px 0;cursor:pointer;font-weight:600;}
.payment-warning{padding:12px 16px;background:#fff8e8;color:#77501d;border-radius:8px;overflow-wrap:anywhere;}
.payment-status{display:flex;gap:16px;align-items:center;flex-wrap:wrap;overflow-wrap:anywhere;}
.payment-status strong{font-size:20px;color:#155c4e;}
.payment-proof{max-height:240px;overflow:auto;background:#f8fafb;padding:14px;font-size:12px;}
#payment-editor .wallet-detail{margin:20px 0;}
@media(max-width:650px){.payment-form,.payment-metrics{grid-template-columns:minmax(0,1fr);}}
#payment-editor .wallet-id {display:block;color:#536875;margin-top:4px;}
.finance-tabs { margin:18px 0; }
.finance-tabs [aria-current="page"] { background:#eaf7f2;border-color:#6bb69f;color:#155c4e; }
#finance-editor :is(input,select,.btn){min-height:44px;}
#finance-editor :disabled{background:#eef2f5;color:#667b89;opacity:.7;cursor:not-allowed;}
#finance-editor .table-wrap {max-width:100%;}
#finance-editor summary{cursor:pointer;padding:10px 0;}
#finance-editor td{font-variant-numeric:tabular-nums;}
.game-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(220px,1fr));gap:18px;margin:18px 0;align-items:end}
.game-grid label{display:flex;flex-direction:column;gap:8px;min-width:0}
.game-grid .game-toggle{flex-direction:row;align-items:center;min-height:48px}
.game-grid input[type=checkbox]{width:18px;height:18px;flex:0 0 18px}
.game-grid input:disabled{background:#edf1f4;color:#81909e;cursor:not-allowed}
.game-grid textarea{width:100%;resize:vertical;min-height:110px}
.game-preview{white-space:pre-wrap;padding:16px;background:#f4f8fa;border-radius:8px;font:inherit}

/* B1–B3 operational views: preserve the existing palette and calculation controls. */
.ops-toolbar,.ops-context,.ops-row-actions,.ops-save-bar{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.ops-toolbar{justify-content:space-between;margin:0 0 18px}.ops-toolbar .help{margin:0;flex:1;min-width:220px}
.ops-context{align-items:end;margin:0 0 22px}.ops-context>label{display:flex;flex-direction:column;gap:8px;min-width:250px;max-width:440px;flex:1}
.ops-context select{width:100%;min-height:44px}.ops-row-actions .btn{white-space:nowrap}
.ops-save-bar{margin-top:24px;padding-top:20px;border-top:1px solid var(--line)}
.ops-metrics{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:16px;margin:18px 0 24px}
.ops-metrics>:is(a,div){display:flex;flex-direction:column;gap:10px;background:#fff;border:1px solid var(--line);border-radius:12px;padding:22px;min-width:0}
.ops-metrics>a:hover{border-color:#64af9f}.ops-metrics small{font-size:14px;color:#526775}.ops-metrics strong{font-size:32px;color:#175b4d;font-variant-numeric:tabular-nums}.ops-metrics span{font-size:12px;color:#667b87}
.ops-guide{padding:18px 22px;border-radius:10px;background:#eaf5f1;border:1px solid #c5dfd5;margin-bottom:24px;display:flex;gap:20px;flex-wrap:wrap;line-height:1.8}
.ops-guide a{color:#126953;text-decoration:underline;text-underline-offset:4px}
.ops-badge{display:inline-flex;border-radius:6px;padding:5px 9px;font-size:12px;line-height:1.4;background:#eef2f5;color:#4c606c;white-space:nowrap}.ops-badge.green{color:#126953;background:#e5f4ed}.ops-badge.amber{color:#85580e;background:#fff3d9}.ops-badge.red{color:#a23636;background:#ffebeb}
.ops-sub,.ops-attention{display:block;margin-top:7px;font-size:12px;line-height:1.5}.ops-sub{color:#637986}.ops-attention{color:#9a4f12}
.ops-groups-table td{vertical-align:middle}.ops-groups-table strong{font-size:14px}.ops-groups-table td:first-child{min-width:190px}.ops-groups-table .ops-row-actions{gap:10px;min-width:190px}
.ops-empty{padding:28px 12px;text-align:center;color:#607481;line-height:1.7}.ops-empty strong{color:#304a58}.ops-loading{padding:28px;min-height:120px;background:white;border:1px solid var(--line);border-radius:10px}
.ops-note{color:#657b88;font-size:12px;line-height:1.7}.ops-inline-note{padding:12px 16px;border-left:3px solid #48a48d;background:#f0f7f4;line-height:1.7}
.ops-tasks>div{display:flex;align-items:center;justify-content:space-between;gap:20px;padding:16px 0;border-bottom:1px solid var(--line)}.ops-tasks>div:last-child{border:0}.ops-tasks p{margin:8px 0 0;color:#617682;line-height:1.7}
.ops-steps{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px;list-style:none;padding:0;counter-reset:step;margin:0 0 24px}.ops-steps li{counter-increment:step;padding:18px;background:#f6f9fa;border:1px solid var(--line);border-radius:8px;line-height:1.6}.ops-steps li:before{content:counter(step);display:inline-grid;place-items:center;width:26px;height:26px;border-radius:50%;background:#e0f1eb;color:#126953;font-weight:600;margin-right:10px}.ops-steps strong{font-size:14px}.ops-steps span{display:block;color:#657b88;font-size:13px;margin-top:10px}
.ops-connect>summary,.ops-legacy>summary{padding:18px 22px;font-weight:600;cursor:pointer}.ops-connect form>details{margin:16px 0}.ops-connect form>details label{display:flex;flex-direction:column;gap:8px;max-width:420px;margin:12px 0}
.ops-stage-grid,.ops-asset-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:18px}.ops-stage,.ops-asset{border:1px solid var(--line);border-radius:10px;padding:18px;min-width:0;display:flex;flex-direction:column;gap:10px}.ops-stage h3{margin:0;font-size:15px}.ops-stage p,.ops-asset p{margin:0;color:#617682;line-height:1.6;font-size:13px;overflow-wrap:anywhere}.ops-stage img,.ops-asset img{width:100%;height:170px;object-fit:contain;background:#f5f7f9;border-radius:6px}.ops-stage-empty{height:170px;display:grid;place-items:center;background:#f5f7f9;color:#7c8c96;border-radius:6px}.ops-stage .btn{align-self:flex-start}.ops-asset .ops-row-actions{margin-top:auto;gap:7px}.ops-asset .btn{padding:8px 10px;font-size:12px}
#game-config .game-grid{grid-template-columns:repeat(3,minmax(0,1fr))}.game-grid .game-toggle{min-height:44px;padding:8px 0}.game-grid label:not(.game-toggle)>:is(input,select),.ops-connect input,.payment-form :is(input,select),.wallet-form :is(input,select){min-height:44px;width:100%;min-width:0}.game-grid input[type=checkbox]{width:18px;height:18px}.game-grid textarea{font:inherit;line-height:1.6}.game-grid input[type=file]{max-width:100%;padding:8px}
#game-config details{margin:16px 0;border-top:1px solid var(--line);padding-top:12px}#game-config details>summary{padding:10px 0;cursor:pointer;font-weight:500}#game-config .ops-save-bar .help{flex:1;min-width:220px}
#ops-page-body .toolbar .btn[aria-current=page]{background:#e7f3ee;color:#126953;border-color:#a8cfc0}
.nav-extra{margin-top:20px;border-top:1px solid #314958;padding-top:12px}.nav-extra summary{padding:12px 8px;font-size:12px;cursor:pointer;color:#bacdd6}.nav-extra p{font-size:11px;padding:0 8px;line-height:1.6;color:#a6bdc9}.nav-extra button{font-size:12px!important}
#nav .caption{margin-top:22px}#nav .caption:first-child{margin-top:0}
.ops-payment-tools>summary{font-weight:600;padding:18px 22px;cursor:pointer}.ops-payment-tools>.panel{margin:0;border:0}
#payment-editor .payment-status{gap:16px;flex-wrap:wrap}#payment-editor .payment-status>span{overflow-wrap:anywhere}.wallet-id{max-width:220px;overflow-wrap:anywhere}.wallet-detail dd{overflow-wrap:anywhere}.ops-status-filter{display:flex;align-items:flex-start;gap:8px}#payment-editor .ops-toolbar{align-items:flex-end}.ops-status-filter select{min-height:40px;min-width:160px}
.btn{min-height:38px}button:disabled{cursor:not-allowed}.game-grid :disabled,.payment-form :disabled,.wallet-form :disabled{background:#edf1f4;color:#81909e}
@media(max-width:1100px){.ops-metrics{grid-template-columns:repeat(2,minmax(0,1fr))}.ops-asset-grid{grid-template-columns:repeat(2,minmax(0,1fr))}#game-config .game-grid{grid-template-columns:repeat(2,minmax(0,1fr))}}
@media(max-width:650px){.ops-stage-grid,.ops-asset-grid,.ops-steps,#game-config .game-grid{grid-template-columns:minmax(0,1fr)}.ops-metrics{gap:10px}.ops-metrics>:is(a,div){padding:16px}.ops-metrics strong{font-size:26px}.ops-context>label{min-width:100%;max-width:none}.ops-tasks>div{align-items:flex-start;flex-direction:column}.ops-toolbar{align-items:flex-start}.ops-guide{padding:16px}.ops-status-filter{width:100%}.ops-groups-table .ops-row-actions{min-width:170px}.ops-save-bar .btn{flex:1}.game-grid input,.game-grid select,.payment-form input,.payment-form select{font-size:16px}}
.ops-stage .btn{margin-top:auto}.ops-message-content{white-space:pre-wrap;line-height:1.65;min-width:180px;max-width:560px;overflow-wrap:anywhere}.ops-message-content p{white-space:pre-wrap;margin:10px 0}.ops-message-content summary{white-space:normal;line-height:1.6}

/* Bot records keep columns readable; narrow screens scroll inside the table. */
.bot-table{min-width:850px}
