:root {
  --bg: #f3f5f4;
  --text: #20312d;
  --muted: #536660;
  --border: #d5dfda;
  --primary: #126b53;
  --primary-strong: #0b503f;
  --surface-soft: #f5f8f6;
  --shadow: none;
}
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
button:focus-visible, a:focus-visible, summary:focus-visible, [tabindex="0"]:focus-visible {
  outline: 3px solid #318dba;
  outline-offset: 2px;
}
button, input, select, textarea { max-width: 100%; min-width: 0; }
button:disabled { cursor: not-allowed; }
.brand-lockup { display: inline-flex; align-items: center; gap: 11px; font-weight: 700; }
.brand-lockup::before {
  content: ""; width: 34px; height: 34px; flex: 0 0 34px;
  background: url("signal.svg") center / contain no-repeat;
}
.service-bar { background: #104b3e; color: white; }
.service-bar > div {
  max-width: 1168px; min-height: 64px; margin: auto; padding: 10px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.service-bar .brand-lockup { font-size: 18px; }
.bar-context { color: #dcf0e8; font-size: 13px; }
.user-shell {
  display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: start; align-content: start; min-height: 0;
  max-width: 1168px; padding: 32px 28px 56px; gap: 20px;
}
.hero-copy {
  grid-column: 1 / -1; display: grid;
  grid-template-columns: minmax(0, 1fr) auto; align-items: center;
  gap: 16px; padding: 0; min-height: 0;
}
.hero-copy h1 { order: 0; margin: 0; font-size: 30px; color: #152e26; }
.trust-strip {
  order: 1; width: auto; justify-self: end; background: transparent; border: 0;
  gap: 16px; overflow: visible; flex-wrap: wrap;
}
.trust-strip span, .trust-strip span + span {
  display: inline-flex; align-items: center; gap: 6px; flex: initial;
  padding: 0; border: 0; white-space: nowrap; color: var(--muted); font-size: 12px;
}
.trust-strip b { color: #15644e; font-family: Consolas, monospace; }
.usage-notice {
  order: 2; grid-column: 1 / -1; width: 100%; margin: 0; padding: 12px 16px;
  border: 1px solid #ebce83; border-left: 4px solid #b8780e; border-radius: 5px;
  background: #fff8e4; color: #66491a; box-shadow: none;
}
.usage-notice strong { color: #644510; font-size: 16px; }
.usage-notice p { color: #69521e; font-size: 14px; font-weight: 500; }
.hero-copy .shop-link { order: 3; margin: 0; max-width: 285px; min-height: 48px; }
.receiver-panel, .result-board {
  min-width: 0; border: 1px solid var(--border); border-radius: 6px; background: white;
}
.receiver-panel { padding: 0 22px 20px; }
.board-heading {
  border-bottom: 1px solid var(--border); background: #f8faf9;
  color: #233a31; font-size: 17px; line-height: 1.45; padding: 14px 22px;
  border-radius: 6px 6px 0 0;
}
.receiver-panel > .board-heading { margin: 0 -22px 18px; }
.field-head span { font-weight: 500; color: var(--muted); }
.input-row { grid-template-columns: minmax(0,1fr) auto; }
.receiver-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.receiver-actions button { padding-inline: 8px; white-space: normal; }
button.secondary, .copy-button:not(:disabled) { border: 1px solid #c2d3cb; background: white; color: #245341; }
button.secondary:hover:not(:disabled), .copy-button:hover:not(:disabled) { background: #e5f2ec; color: #154733; }
button:disabled, button.secondary:disabled { background: #ecf0ee; color: #65746d; border: 1px solid #d3dbd6; }
.steps-details { margin-top: 20px; border-top: 1px solid #e3e9e5; padding-top: 13px; font-size: 13px; color: var(--muted); }
.steps-details summary { cursor: pointer; width: fit-content; }
.receive-steps { border: 0; background: transparent; padding: 0; color: #40534a; }
.receive-steps li span { color: #225540; background: #e3f0e8; }
.status-card { min-height: 0; border: 0; border-left: 3px solid #438b74; padding: 10px 12px; border-radius: 2px; }
.status-card:empty, .admin-section .status:empty { display: none; }
.result-board { display: block; }
.result-board > .board-heading { margin: 0; }
.result-board > .result-card {
  position: relative; min-height: 0; margin: 0; padding: 18px 22px;
  display: block; box-shadow: none; border: 0; border-radius: 0; border-bottom: 1px solid #e0e7e3;
}
.result-board > .result-card[hidden], .shop-link[hidden] { display: none; }
.result-board > .result-card:last-child { border-radius: 0 0 6px 6px; }
.result-label { margin: 0 0 8px; color: #465c50; font-size: 13px; }
.result-content { align-items: center; justify-content: space-between; flex-wrap: wrap; }
.result-value { font-size: 25px; line-height: 1.3; }
.link-value, .prize-value, .lottery-result { font-size: 15px; }
.result-badge { position: absolute; right: 22px; top: 15px; padding: 2px 6px; border-radius: 3px; font-size: 10px; }
.code-card { background: #eff8f3; }
.code-card .code { font: 700 29px/1.3 Consolas, monospace; color: #145a44; }
.link-card { background: #f7f9fc; }
.lottery-card { background: #fffaeb; }
.result-meta { font-weight: 500; }

.admin-page .shell {
  max-width: 1580px; min-height: 100vh; margin: 0 auto; padding: 0;
  display: grid; grid-template: auto 1fr / 192px minmax(0, 1fr); align-items: start;
}
.admin-page .topbar {
  grid-column: 1 / -1; display: flex; flex-flow: row wrap; align-items: center; margin: 0;
  padding: 12px 24px; min-height: 62px; background: white; border-bottom: 1px solid var(--border);
}
.topbar .brand-lockup { margin: 0; font-size: 20px; }
.admin-page #logout { margin-left: auto; }
#menuToggle { display: none; }
.admin-nav {
  grid-column: 1; grid-row: 2; align-self: stretch; display: flex; flex-flow: column nowrap;
  gap: 2px; padding: 12px 10px 24px; margin: 0; background: white; border-right: 1px solid var(--border);
}
.nav-group { padding: 12px 10px 4px; color: var(--muted); font-size: 11px; font-weight: 700; }
.admin-nav button, .admin-nav a {
  text-decoration: none; color: #35483d; min-height: 32px; text-align: left; font-size: 14px;
  line-height: 1.35; font-weight: 550; background: transparent; border: 0; border-radius: 4px; padding: 7px 12px;
}
.admin-nav button:hover:not(:disabled), .admin-nav a:hover { color: #114b38; background: #eff5f1; }
.admin-nav button.active { color: #12523d; background: #deeee4; box-shadow: inset 3px 0 #1a7758; }
.admin-section { grid-column: 2; grid-row: 2; min-width: 0; padding: 24px; }
.view-title { margin: 0 0 18px; color: #192e24; font-size: 25px; }
.view-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.view-heading .view-title { margin: 0; }
.admin-section .panel, .tool-page .panel { border-radius: 0; border-width: 0 0 1px; padding: 18px; overflow-x: auto; }
.admin-section .grid { grid-template-columns: repeat(auto-fit, minmax(min(165px,100%), 1fr)); }
.admin-section .grid > .panel { border-left: 3px solid #50967d; }
.admin-section .grid > .panel:nth-child(2) { border-left-color: #b68048; }
.admin-section .grid > .panel:nth-child(3) { border-left-color: #607aa1; }
.admin-section .stat-card { min-height: 60px; border: 0; border-left: 1px solid #d4dfd7; border-radius: 0; background: white; }
.admin-section .toolbar { grid-template-columns: repeat(auto-fit, minmax(min(155px,100%),1fr)); }
.admin-section select, .admin-section input, .inventory-filters label { min-width: 0; }
.admin-section .bulk-channel-actions .field-inline { min-width: min(220px, 100%); }
.admin-section table, .docs-shell table { font-size: 13px; background: white; }
.admin-section th, .docs-shell th { background: #edf2ef; color: #43554a; }
.admin-section td, .admin-section th { padding: 9px 10px; vertical-align: middle; }
.admin-section tr:hover td { background: #f2f7f4; }
.inventory-filters { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 14px; border-block: 1px solid var(--border); padding: 16px 0; }
.inventory-filters label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.inventory-metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); padding: 20px 0; gap: 8px; }
.inventory-metrics > div { padding-left: 13px; border-left: 2px solid #bacbc2; }
.inventory-metrics > div:nth-child(3) { border-color: #4b9579; }
.inventory-metrics > div:last-child { border-color: #b88855; }
.inventory-metrics span, .inventory-metrics strong { display: block; overflow-wrap: anywhere; }
.inventory-metrics span { color: var(--muted); font-size: 13px; }
.inventory-metrics strong { font-size: 26px; }
.inventory-table td:nth-child(n+4), .inventory-table th:nth-child(n+4) { text-align: right; white-space: nowrap; }
.inventory-table td:first-child, .inventory-table td:nth-child(5) { color: #126244; font-weight: 700; }
.inventory-table th, .inventory-table td { white-space: nowrap; }
#inventoryStatus:not(:empty) { margin: 0; padding: 24px; background: white; text-align: center; }
.login-page .shell { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-page .panel { width: min(100%,420px); margin: 0; padding: 30px; border-top: 4px solid var(--primary); }
.tool-brand { margin-bottom: 28px; color: var(--primary-strong); font-size: 14px; }
.login-page h1 { font-size: 24px; margin-bottom: 20px; }
.login-page label { margin: 12px 0 6px; }
.login-page .actions button { width: 100%; }
.login-page .status:empty { display: none; }
.tool-page .shell { max-width: 1060px; }
.tool-page .docs-shell { max-width: 960px; overflow-wrap: anywhere; }
.tool-page pre { color: #e9f4ed; background: #24362f; }
.partner-page .channel-header h1 { font-size: 34px; }
.partner-page .channel-workspace { min-height: 0; box-shadow: none; }
.partner-page .result-panel { background: #f1f7f3; }
.partner-page .step-index { border-radius: 6px; }
@media (max-width: 900px) {
  .admin-page .shell { grid-template-columns: 156px minmax(0,1fr); }
  .admin-section { padding: 16px; }
}
@media (max-width: 740px) {
  .service-bar > div { min-height: 52px; padding: 8px 16px; }
  .user-shell { grid-template-columns: minmax(0,1fr); padding: 20px 14px 32px; gap: 14px; }
  .hero-copy { grid-template-columns: minmax(0,1fr); gap: 12px; }
  .hero-copy h1, .partner-page .channel-header h1 { font-size: 25px; }
  .trust-strip { justify-self: start; gap: 12px; }
  .receiver-panel { padding: 0 16px 14px; }
  .receiver-panel > .board-heading { margin-inline: -16px; }
  .board-heading, .result-board > .result-card { padding-inline: 16px; }
  .result-badge { right: 16px; }
  .admin-page .shell { display: block; }
  .admin-page .topbar { padding: 10px 12px; gap: 6px; }
  .admin-page .topbar h1 { font-size: 16px; }
  .admin-page .topbar button { min-height: 36px; padding: 6px 10px; font-size: 13px; }
  .admin-page #logout { margin-left: 0; }
  #menuToggle { display: inline-block; margin-left: auto; }
  .admin-nav { display: none; }
  .admin-nav.is-open { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); border-bottom: 1px solid var(--border); }
  .nav-group { grid-column: 1 / -1; }
  .admin-section { padding: 16px 12px; }
  .view-title { font-size: 22px; }
  .inventory-filters { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 10px; }
  .inventory-filters label:last-child { grid-column: 1 / -1; }
  .inventory-metrics { grid-template-columns: repeat(2,minmax(0,1fr)); row-gap: 14px; }
}
