/*
 * LOOP 运营后台 · one stylesheet, dark only.
 * Colours and the seven type bands follow loop-mobile `loop_theme.dart`
 * (LoopColors / LoopTypography). Lime is reserved for the primary button.
 */

:root {
  color-scheme: dark;
  --ink: #050604;
  --chalk: #f3f5ef;
  --lime: #b8ff20;
  --lime-highlight: #c6ff45;
  --graphite: #171a16;
  --elevated: #1d1e1c;
  --hairline: #242523;
  --panel: rgb(243 245 239 / 5.5%);
  --card2: rgb(243 245 239 / 10%);
  --line: rgb(243 245 239 / 13%);
  --line2: rgb(243 245 239 / 22%);
  --text2: rgb(243 245 239 / 68%);
  --text3: rgb(243 245 239 / 58%);
  --rise: #22c55e;
  --rise-soft: rgb(34 197 94 / 13%);
  --danger: #ff6b82;
  --danger-soft: rgb(255 107 130 / 13%);
  --warning: #ffc75f;
  --market: #68b9ff;

  /* Bands: 1 display · 2 heading · 3 title · 4 body · 5 caption · 6 label · 7 figures */
  --band-display: 600 26px/1.2 var(--sans);
  --band-heading: 600 20px/1.25 var(--sans);
  --band-title: 600 15px/1.3 var(--sans);
  --band-body: 400 14px/1.4 var(--sans);
  --band-caption: 400 12px/1.35 var(--sans);
  --band-label: 500 13px/1.25 var(--sans);
  --sans:
    -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "PingFang SC",
    "Noto Sans SC", "HarmonyOS Sans SC", "Microsoft YaHei", sans-serif;
  --mono: "IBM Plex Mono", "SF Mono", Menlo, "PingFang SC", monospace;

  --radius-card: 16px;
  --radius-control: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  background: var(--ink);
  color: var(--chalk);
  font: var(--band-body);
}

a {
  color: var(--chalk);
  text-decoration-color: var(--line2);
  text-underline-offset: 3px;
}

a:hover {
  text-decoration-color: var(--chalk);
}

h1 {
  font: var(--band-display);
  margin: 8px 0 16px;
}

h2 {
  font: var(--band-heading);
  margin: 0 0 12px;
}

h3 {
  font: var(--band-title);
  margin: 0 0 4px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 24px;
  padding: 12px 24px;
  background: rgb(5 6 4 / 92%);
  border-bottom: 1px solid var(--hairline);
}

.brand {
  font: var(--band-title);
  text-decoration: none;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  flex: 1;
}

.nav a,
.tabs a {
  font: var(--band-label);
  color: var(--text3);
  text-decoration: none;
  padding: 8px 12px;
  border-radius: var(--radius-control);
}

.nav a:hover,
.tabs a:hover {
  color: var(--chalk);
}

.nav a.active,
.tabs a.active {
  color: var(--chalk);
  background: var(--card2);
}

.logout {
  margin: 0;
}

.page {
  max-width: 1280px;
  margin: 0 auto;
  padding: 16px 24px 48px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 20px;
  margin-bottom: 16px;
}

.panel.narrow {
  max-width: 560px;
}

.login {
  margin: 12vh auto 0;
}

.scroll-x {
  overflow-x: auto;
}

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

.small {
  font: var(--band-caption);
}

.mono {
  font-family: var(--mono);
  font-size: 12px;
}

.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.nowrap {
  white-space: nowrap;
}

.prose {
  white-space: pre-wrap;
}

.empty {
  color: var(--text3);
  padding: 24px 0;
  text-align: center;
}

.notice {
  color: var(--warning);
  font: var(--band-caption);
}

/* S319 · Decision 0015: what waits for this session, under the menu on every page. */
.pending-banner {
  list-style: none;
  margin: 0 0 12px;
  padding: 10px 14px;
  display: grid;
  gap: 6px;
  border: 1px solid rgb(255 199 95 / 35%);
  border-radius: var(--radius-card);
  background: rgb(255 199 95 / 8%);
  color: var(--warning);
  font: var(--band-caption);
}

.pending-banner > li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
}

.pending-banner a {
  color: var(--chalk);
  white-space: nowrap;
}

/* Flash line: the one place a write reports back. */
/* S290: the result of the last write, under the page title, until the next navigation. */
.flash {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  font: var(--band-title);
  border: 1px solid currentColor;
  border-left-width: 6px;
  border-radius: var(--radius-control);
  padding: 14px 16px;
  margin: 0 0 20px;
}

.flash-icon {
  flex: none;
  margin-top: -1px;
}

.flash-text {
  flex: 1;
  margin: 0;
  color: var(--chalk);
  overflow-wrap: anywhere;
}

.flash.ok {
  color: var(--rise);
  background: rgb(34 197 94 / 20%);
}

.flash.error {
  color: var(--danger);
  background: rgb(255 107 130 / 20%);
}

.flash .code {
  font-family: var(--mono);
  font-size: 12px;
  margin-right: 12px;
  color: var(--danger);
}

/* S302: a page that helps resolve the refusal (e.g. the holding community). */
.flash-link {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.flash-close {
  flex: none;
  font: var(--band-caption);
  color: var(--text2);
  background: transparent;
  border: 1px solid var(--line2);
  border-radius: 8px;
  padding: 3px 10px;
  cursor: pointer;
}

.flash-close:hover {
  color: var(--chalk);
}

tr.just-saved td {
  background: rgb(34 197 94 / 13%);
}

/* S313: the draft the 矿池 page just saved, in 「挖矿参数」's pending list. */
.plain-list > li.just-saved {
  background: rgb(34 197 94 / 13%);
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  /* A grid item defaults to min-width:auto; 0 lets a long value wrap. */
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 16px;
}

.stat .label {
  font: var(--band-caption);
  color: var(--text3);
}

.stat .label,
.stat .value {
  min-width: 0;
  overflow-wrap: anywhere;
}

.stat .value {
  font: var(--band-display);
  font-variant-numeric: tabular-nums;
}

/* Token amounts: one band smaller so a 4-decimal value fits a 180px card. */
.stat .value.amount {
  font: var(--band-heading);
  font-variant-numeric: tabular-nums;
  cursor: help;
}

.stat .value .unit {
  font: var(--band-label);
  color: var(--text3);
}

.stat a {
  font: var(--band-caption);
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
}

th {
  font: var(--band-caption);
  color: var(--text3);
  text-align: left;
  padding: 8px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: top;
}

tbody tr:last-child td {
  border-bottom: 0;
}

table.edit td {
  padding: 6px;
}

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

.row-actions form {
  margin: 0;
}

/* The reviewer's pending drafts (S129): one line each, wrapping on phones. */
.plain-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 10px;
}

.plain-list > li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.pager {
  display: flex;
  gap: 16px;
  justify-content: flex-end;
  padding-top: 12px;
  font: var(--band-label);
}

/* Status pills: colour by meaning, never lime. */
.pill {
  display: inline-block;
  font: var(--band-caption);
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--card2);
  color: var(--text2);
  white-space: nowrap;
}

.pill.verified,
.pill.approved,
.pill.listed,
.pill.trading {
  color: var(--rise);
  background: var(--rise-soft);
}

.pill.rejected,
.pill.hidden,
.pill.paused {
  color: var(--danger);
  background: var(--danger-soft);
}

.pill.pending,
.pill.pending_approval {
  color: var(--warning);
}

/* Forms */
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font: var(--band-label);
  color: var(--text2);
}

label.inline {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

input,
select,
textarea {
  font: var(--band-body);
  color: var(--chalk);
  background: var(--graphite);
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  padding: 8px 12px;
  min-height: 40px;
  min-width: 0;
}

input.mono {
  font-family: var(--mono);
  font-size: 12px;
}

input.order {
  width: 72px;
}

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

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid var(--line2);
  outline-offset: 1px;
}

input:disabled {
  opacity: 0.5;
}

.hint {
  font: var(--band-caption);
  color: var(--text3);
}

fieldset.choices {
  display: flex;
  gap: 24px;
  border: 0;
  padding: 0;
  margin: 0;
}

fieldset.choices legend {
  font: var(--band-label);
  color: var(--text2);
  margin-bottom: 8px;
}

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

.grid-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  align-items: start;
}

.grid-form .actions {
  grid-column: 1 / -1;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px;
  margin-bottom: 16px;
}

.inline-form {
  display: flex;
  gap: 8px;
  margin: 0;
}

.inline-form input {
  width: 160px;
}

.tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 16px;
}

.actions {
  display: flex;
  justify-content: flex-end;
}

.facts {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px 16px;
  margin: 0;
}

.facts dt {
  font: var(--band-caption);
  color: var(--text3);
  padding-top: 2px;
}

.facts dd {
  margin: 0;
  /* Exact 18-decimal amounts are long unbroken runs; keep them in the column. */
  min-width: 0;
  overflow-wrap: anywhere;
}

/* Buttons: lime is the primary action and nothing else. */
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font: var(--band-label);
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}

.button.primary {
  background: var(--lime);
  color: var(--ink);
  font-weight: 600;
}

.button.primary:hover {
  background: var(--lime-highlight);
}

.button.ghost {
  background: transparent;
  color: var(--chalk);
  border-color: var(--line2);
}

.button.ghost:hover {
  background: var(--card2);
}

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

/* Promotion preview, drawn like the app's intel card. */
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.promo {
  background: var(--elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  padding: 16px;
}

.promo p {
  margin: 0 0 8px;
  color: var(--text2);
}

@media (width <= 720px) {
  .topbar,
  .page {
    padding-left: 16px;
    padding-right: 16px;
  }

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

.stack.compact {
  gap: 6px;
  min-width: 180px;
}

.num.warn {
  color: var(--warning);
}

pre {
  font-family: var(--mono);
  font-size: 12px;
  white-space: pre-wrap;
  word-break: break-all;
  background: var(--graphite);
  border-radius: 8px;
  padding: 8px;
  margin: 4px 0;
  max-width: 420px;
}

details summary {
  cursor: pointer;
  font: var(--band-label);
  color: var(--text2);
}

.actions {
  gap: 12px;
}

/* S128: who is signed in, and as what. */
.who {
  display: flex;
  align-items: center;
  gap: 8px;
  font: var(--band-label);
  color: var(--text2);
}

.who a {
  color: var(--text3);
}

.pill.role {
  color: var(--market);
}

.pill.awaiting_approval {
  color: var(--warning);
}

.pill.accepted,
.pill.passed,
.pill.active {
  color: var(--rise);
  background: var(--rise-soft);
}

.pill.failed,
.pill.disabled {
  color: var(--danger);
  background: var(--danger-soft);
}

.pill.deploying {
  color: var(--market);
}

/* The one-time password: big enough to read off and type once. */
.secret {
  font-family: var(--mono);
  font-size: 20px;
  letter-spacing: 1px;
  padding: 12px 16px;
  background: var(--graphite);
  border: 1px solid var(--line2);
  border-radius: var(--radius-control);
  user-select: all;
  word-break: break-all;
}

.break {
  word-break: break-all;
}

table.kv td {
  padding: 6px 12px;
}

.panel > form + form {
  margin-top: 12px;
}

fieldset.stack-choices {
  flex-wrap: wrap;
  gap: 12px 24px;
}

.actions.bar {
  margin-bottom: 16px;
}

.version {
  padding: 16px 0;
  border-top: 1px solid var(--hairline);
}

.version:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.version details {
  margin: 12px 0;
}

.record {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--graphite);
  border-radius: var(--radius-control);
}

fieldset.plain {
  border: 0;
  padding: 0;
  margin: 0;
  min-width: 0;
}

/* S130 · Decision 0111: login lock, CLI approval trail. */
.locked {
  color: var(--warning);
}

.pill.channel {
  color: var(--warning);
  background: rgb(255 199 95 / 13%);
}

.pill.bypass {
  color: var(--danger);
  background: var(--danger-soft);
  font-weight: 600;
}

/* S132 · Decision 0112: deployment executor progress. */
.pill.activated {
  color: var(--rise);
  background: var(--rise-soft);
  font-weight: 600;
}

.pill.claimed,
.pill.broadcast,
.pill.confirmed,
.pill.awaiting_executor {
  color: var(--market);
}

.pill.reorged,
.pill.failed.retrying,
.pill.event-warn {
  color: var(--warning);
  background: rgb(255 199 95 / 13%);
}

.pill.event-bad {
  color: var(--danger);
  background: var(--danger-soft);
  font-weight: 600;
}

.record.failure {
  border-left: 3px solid var(--danger);
}

.bad,
tr.mismatch td {
  color: var(--danger);
}

tr.mismatch {
  background: var(--danger-soft);
}

table.timeline tr.tagged.warn td:first-child {
  box-shadow: inset 3px 0 0 var(--warning);
}

table.timeline tr.tagged.bad td:first-child {
  box-shadow: inset 3px 0 0 var(--danger);
}

/* S138 · Decision 0116: funding check and replay result. */
.funding.alert {
  border-color: var(--danger);
  box-shadow: inset 3px 0 0 var(--danger);
}

.funding p {
  overflow-wrap: anywhere;
}

.stat .value.bad {
  color: var(--danger);
}

.ok {
  color: var(--rise);
}

.muted.warn {
  color: var(--warning);
}

/* S142 · Decision 0120: snapshot publication, retry grants, no-holder closure. */
.pill.mismatch,
.pill.closed_no_holders {
  color: var(--danger);
  background: var(--danger-soft);
  font-weight: 600;
}

.pill.released {
  color: var(--warning);
  background: rgb(255 199 95 / 13%);
}

tr.highlight td {
  background: var(--graphite);
}

/* S145 · Decision 0122: reviewer rejections, product kind. */
.tabs {
  flex-wrap: wrap;
}

.tabs.kinds {
  margin-top: -8px;
}

.pill.submitted,
.pill.in_review {
  color: var(--warning);
}

.pill.returned {
  color: var(--warning);
  background: rgb(255 199 95 / 13%);
}

.pill.kind {
  color: var(--text2);
}

.button.danger {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}

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

.record.rejection {
  border-left: 3px solid var(--danger);
}

.actions.split {
  gap: 8px;
  flex-wrap: wrap;
}

/* S274 (loop-api 0173): logo and project NFT picture thumbnails. */
.asset-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.asset-row > span {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.asset-thumb {
  flex: none;
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--graphite);
}

/* S183: launch desk campaigns. */
.cover-thumb {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 40px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--graphite);
}

.cover-thumb.empty-cover {
  font: var(--band-caption);
  color: var(--text3);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pill.pinned {
  color: var(--lime);
}

.pill.campaign-published {
  color: var(--rise);
}

.pill.campaign-draft {
  color: var(--warning);
}

.pill.campaign-archived {
  color: var(--text3);
}

.field-error {
  font: var(--band-caption);
  color: var(--danger);
}

[aria-invalid="true"] {
  border-color: var(--danger);
}

.cover-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.campaign-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 16px;
  align-items: start;
}

@media (width <= 960px) {
  .campaign-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* The App's ledger card, low saturation: dark ground, lime hairline. */
.ledger-card {
  display: flex;
  gap: 12px;
  align-items: stretch;
  min-height: 112px;
  padding: 14px;
  background: var(--graphite);
  border: 1px solid rgb(184 255 32 / 45%);
  border-radius: var(--radius-card);
}

.ledger-text {
  flex: 1;
  min-width: 0;
}

.ledger-text h3 {
  margin: 0 0 6px;
  font: var(--band-title);
  overflow-wrap: anywhere;
}

.ledger-text p {
  margin: 0;
  font: var(--band-caption);
  color: var(--text2);
  overflow-wrap: anywhere;
}

.ledger-cover {
  position: relative;
  flex: 0 0 120px;
  border-radius: 10px;
  background: var(--elevated);
  overflow: hidden;
}

.ledger-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.6);
}

.ledger-days {
  position: absolute;
  right: 6px;
  bottom: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  font: var(--band-caption);
  color: var(--lime);
  background: rgb(5 6 4 / 72%);
}

/* S187: square timeline posts. */
.square-text {
  max-width: 420px;
  overflow-wrap: anywhere;
}

.square-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.pill.square-kind-system {
  color: var(--lime);
}

.hint.over {
  color: var(--danger);
}

/* S301: page-level warning banner; the community coefficient list. */
.banner {
  border: 1px solid currentColor;
  border-left-width: 6px;
  border-radius: var(--radius-control);
  padding: 14px 16px;
  margin: 0 0 20px;
}

.banner p {
  margin: 0 0 8px;
  color: var(--chalk);
}

.banner p:last-child {
  margin-bottom: 0;
}

.banner.warn {
  color: var(--warning);
  background: rgb(255 199 95 / 14%);
}

.callout-list {
  margin: 0 0 12px;
  padding-left: 18px;
  color: var(--text2);
}

.callout-list li + li {
  margin-top: 4px;
}

.coefficient-list {
  max-height: 420px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-control);
  margin: 8px 0 12px;
}

.coefficient-list table {
  width: 100%;
}

.coefficient-list thead th {
  position: sticky;
  top: 0;
  background: var(--graphite);
}

.inline-filter {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  max-width: 360px;
}

.refused {
  color: var(--danger);
  font: var(--band-label);
  overflow-wrap: anywhere;
}

tr.refused-row td {
  background: var(--danger-soft);
}

fieldset.choices.stacked {
  flex-direction: column;
  gap: 10px;
}

fieldset.choices.stacked .notice,
fieldset.choices.stacked .refused,
fieldset.choices.stacked .muted {
  margin: 0;
}

.freeze-choice {
  color: var(--chalk);
}

/* S332 · Decision 0262: beta feedback. */
.feedback-excerpt {
  max-width: 420px;
  overflow-wrap: anywhere;
}

.feedback-body {
  margin: 0;
  overflow-wrap: anywhere;
}

.feedback-images {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.feedback-images img {
  display: block;
  width: 200px;
  max-height: 400px;
  object-fit: contain;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--graphite);
}

/* Decision 0018: a promotion row's picture — link, upload, thumbnail at the
   App card's 248:92. A fixed column width so nothing spills out of the cell;
   on a phone the edit table scrolls inside its panel (.scroll-x). */
.promo-image {
  display: grid;
  gap: 6px;
  width: 200px;
  max-width: 100%;
}

.promo-image input[data-image-url] {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.promo-upload {
  position: relative;
  min-height: 32px;
  padding: 4px 12px;
  justify-self: start;
  overflow: hidden;
}

.promo-upload input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.promo-thumb {
  display: block;
  width: 100%;
  max-width: 248px;
  aspect-ratio: 248 / 92;
  object-fit: cover;
  border-radius: 8px;
  background: var(--elevated);
}

.promo-thumb[hidden] {
  display: none;
}

.promo-image .hint {
  overflow-wrap: anywhere;
}

.promo .promo-thumb {
  margin-bottom: 10px;
}

/* Decision 0021: a picture-only card previews the picture alone, card wide. */
.promo-image-only .promo-thumb {
  max-width: 100%;
}

/* Decision 0019: four text columns (中文 + 英文 title / subtitle). A fixed
   input width so a cell never spills; the table scrolls in .scroll-x. */
table.edit input.promo-text {
  width: 160px;
  max-width: 100%;
  box-sizing: border-box;
}

.promo-en {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--hairline);
}

.promo-en h3,
.promo h3,
.promo p {
  overflow-wrap: anywhere;
}
