:root {
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-2: #eef4f6;
  --ink: #13202b;
  --muted: #607080;
  --line: #d8e2e7;
  --line-strong: #b8c8d0;
  --teal: #08746f;
  --teal-dark: #075a56;
  --blue: #2c5b8e;
  --accent: #b8691b;
  --danger: #b42318;
  --success-bg: #e5f5ef;
  --success-line: #b7dccf;
  --warning-bg: #fff3d7;
  --warning-line: #e6cb88;
  --focus: rgba(8, 116, 111, 0.18);
  --shadow: 0 10px 30px rgba(19, 32, 43, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
}

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

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(220px, 1fr);
  gap: 20px;
  align-items: center;
  min-height: 68px;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.brand,
.status-area,
.panel-head,
.action-row,
.export-box {
  display: flex;
  align-items: center;
}

.brand {
  gap: 10px;
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  color: #fff;
  background: var(--teal);
  border-radius: 7px;
  font-size: 15px;
}

.mode-switch {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.mode-tab,
.small-button,
.ghost-button,
.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 7px;
  border: 1px solid transparent;
  font-weight: 700;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.mode-tab {
  min-width: 104px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
}

.mode-tab:hover {
  color: var(--ink);
  background: #fff;
}

.mode-tab.active {
  color: #fff;
  background: var(--teal);
}

.status-area {
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.member-box {
  display: grid;
  gap: 5px;
  justify-items: end;
  padding: 6px 8px;
  background: #f8fbfc;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.member-login,
.member-session {
  display: flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-end;
}

.member-input {
  width: 132px;
  min-height: 34px;
  padding: 0 9px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
}

.member-input:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--focus);
}

.member-status,
.member-usage {
  max-width: 180px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.member-usage {
  color: var(--teal-dark);
}

.status-pill,
.result-state {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.status-pill {
  color: #7a4a05;
  background: var(--warning-bg);
  border: 1px solid var(--warning-line);
}

.status-pill.ok {
  color: var(--teal-dark);
  background: var(--success-bg);
  border-color: var(--success-line);
}

.status-pill.error {
  color: var(--danger);
  background: #fff0ed;
  border-color: #f3b9b1;
}

.small-button,
.ghost-button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  background: #fff;
  border-color: var(--line);
}

.small-button:hover,
.ghost-button:hover,
.secondary-button:hover {
  color: var(--teal-dark);
  border-color: var(--line-strong);
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 26px 28px 34px;
}

.workspace-intro {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: end;
  margin-bottom: 18px;
}

.kicker {
  margin: 0 0 5px;
  color: var(--teal-dark);
  font-size: 13px;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 8px;
  font-size: 34px;
  line-height: 1.2;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 20px;
  line-height: 1.25;
}

h3 {
  margin-bottom: 10px;
  font-size: 16px;
}

.workspace-intro p:not(.kicker) {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
}

.workbench {
  display: grid;
  grid-template-columns: minmax(360px, 0.92fr) minmax(420px, 1.08fr);
  gap: 18px;
  align-items: stretch;
}

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

.input-panel,
.result-panel {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 190px);
  padding: 18px;
}

.panel-head {
  justify-content: space-between;
  gap: 16px;
  min-height: 46px;
  margin-bottom: 14px;
}

.field-label {
  display: block;
  margin: 8px 0 7px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

textarea {
  width: 100%;
  min-height: 210px;
  padding: 13px 14px;
  color: var(--ink);
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 7px;
  outline: none;
  resize: vertical;
  line-height: 1.7;
}

textarea::placeholder {
  color: #687989;
}

textarea:focus,
select:focus,
input:focus,
button:focus-visible,
.upload-box:focus-within {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--focus);
  outline: none;
}

.settings-drawer {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  justify-content: flex-end;
  background: rgba(19, 32, 43, 0.26);
}

.settings-panel {
  width: min(460px, 100%);
  height: 100%;
  overflow: auto;
  padding: 20px;
  background: var(--surface);
  border-left: 1px solid var(--line);
  box-shadow: -8px 0 24px rgba(19, 32, 43, 0.12);
}

.settings-status {
  margin-bottom: 14px;
  padding: 11px 12px;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
}

.settings-status.ok {
  color: var(--teal-dark);
  background: var(--success-bg);
  border-color: var(--success-line);
}

.settings-status.warn {
  color: #7a4a05;
  background: var(--warning-bg);
  border-color: var(--warning-line);
}

.settings-input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  color: var(--ink);
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.settings-section {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.settings-section-title {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.settings-toggle {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.settings-toggle input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--teal);
}

.settings-toggle strong,
.settings-toggle small {
  display: block;
}

.settings-toggle small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex: 0 0 auto;
}

.settings-help {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.settings-help.ok {
  color: var(--teal-dark);
}

.settings-help.warn {
  color: #7a4a05;
}

.member-page {
  min-height: 100vh;
}

.member-topbar {
  grid-template-columns: minmax(180px, 1fr) auto;
}

.member-shell {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 34px 28px 42px;
}

.member-account-bar {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(420px, 1.2fr);
  gap: 22px;
  align-items: end;
  padding-bottom: 20px;
  margin-bottom: 22px;
  border-bottom: 1px solid var(--line);
}

.member-account-compact {
  grid-template-columns: 1fr;
}

.member-account-bar h1 {
  margin-bottom: 0;
  font-size: 30px;
}

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

.member-summary-grid div {
  display: grid;
  gap: 4px;
  min-height: 72px;
  padding: 12px 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.member-summary-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.member-summary-grid strong {
  min-width: 0;
  color: var(--ink);
  font-size: 16px;
  overflow-wrap: anywhere;
}

.member-content-grid {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.member-mode-anonymous .member-content-grid {
  grid-template-columns: minmax(280px, 360px);
  justify-content: center;
}

.member-mode-authenticated .member-content-grid {
  grid-template-columns: 1fr;
}

.member-center-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.member-center-menu {
  display: grid;
  gap: 2px;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.member-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 0 18px;
  color: #6d7c82;
  background: #fff;
  border: 0;
  border-left: 4px solid transparent;
  font-size: 15px;
  font-weight: 900;
  text-align: left;
  cursor: pointer;
}

.member-menu-item:hover {
  color: var(--teal-dark);
  background: #f4faf9;
}

.member-menu-item.active {
  color: var(--teal-dark);
  background: linear-gradient(90deg, #e3f5f2 0%, #fff 100%);
  border-left-color: var(--teal);
}

.member-menu-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: currentColor;
  font-size: 18px;
  line-height: 1;
}

.member-center-main {
  display: grid;
  gap: 18px;
  min-width: 0;
}

.member-panel {
  display: none;
  min-width: 0;
}

.member-panel.active {
  display: grid;
  gap: 12px;
}

.member-panel h3 {
  margin-bottom: 0;
}

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

.member-home-grid div {
  display: grid;
  gap: 6px;
  min-height: 84px;
  padding: 14px;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.member-home-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.member-home-grid strong {
  min-width: 0;
  color: var(--ink);
  font-size: 17px;
  overflow-wrap: anywhere;
}

.member-auth-section,
.member-dashboard-section {
  min-width: 0;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.member-auth-section {
  position: sticky;
  top: 84px;
}

.member-dashboard-section {
  display: grid;
  gap: 18px;
}

.member-section-head {
  margin-bottom: 16px;
}

.member-section-head h2 {
  margin-bottom: 6px;
}

.member-section-head p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.member-auth-actions {
  align-items: center;
}

.member-auth-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(90px, 1fr));
  gap: 4px;
  padding: 4px;
  margin-bottom: 14px;
  background: #edf4f3;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.member-auth-tab {
  min-height: 36px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 5px;
  font-weight: 900;
  cursor: pointer;
}

.member-auth-tab.active {
  color: #fff;
  background: var(--teal);
}

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

.member-settings-card {
  display: grid;
  gap: 10px;
  min-width: 0;
  padding: 14px;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.member-settings-card .ghost-button {
  justify-self: start;
}

.member-account-actions {
  justify-content: flex-start;
}

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

.member-cost-grid span {
  min-height: 40px;
  padding: 10px 12px;
  color: var(--teal-dark);
  background: #f1f8f7;
  border: 1px solid #c9e1de;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.member-recharge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.member-recharge-card {
  display: grid;
  gap: 8px;
  min-height: 142px;
  padding: 14px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: left;
  cursor: pointer;
}

.member-recharge-card:hover {
  border-color: #75a7c9;
}

.member-recharge-card span,
.member-recharge-card strong,
.member-recharge-card small {
  display: block;
}

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

.payment-shell {
  width: min(760px, calc(100% - 32px));
  margin: 28px auto;
}

.payment-panel {
  display: grid;
  gap: 18px;
  padding: 24px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.payment-panel h1 {
  margin: 0;
  font-size: 26px;
}

.payment-summary {
  display: grid;
  gap: 0;
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.payment-summary div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
}

.payment-summary div:last-child {
  border-bottom: 0;
}

.payment-summary dt {
  color: var(--muted);
}

.payment-summary dd {
  margin: 0;
  font-weight: 800;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.payment-methods {
  display: grid;
  gap: 12px;
}

.payment-methods h2 {
  font-size: 18px;
}

.payment-method-buttons {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.payment-qr-panel {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 16px;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 8px;
  text-align: center;
}

.payment-qr-panel img {
  width: min(260px, 78vw);
  aspect-ratio: 1;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.payment-qr-panel span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.qrcode-cashier {
  justify-items: center;
  gap: 22px;
  min-height: 620px;
  padding: 34px 24px;
  text-align: center;
}

.qrcode-provider {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--ink);
  font-size: 22px;
}

.qrcode-provider span {
  display: inline-grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: #fff;
  background: #1677ff;
  border-radius: 8px;
  font-weight: 900;
}

.qrcode-amount {
  color: #202a35;
  font-size: 48px;
  line-height: 1;
  font-weight: 500;
}

.qrcode-image {
  width: min(260px, 76vw);
  aspect-ratio: 1;
  object-fit: contain;
  background: #fff;
}

.qrcode-divider {
  width: min(610px, 84%);
  height: 1px;
  margin-top: 14px;
  background: var(--line);
}

.qrcode-instruction {
  max-width: 320px;
  margin: 0;
  color: var(--ink);
  line-height: 1.8;
}

.payment-proof-form {
  display: grid;
  gap: 10px;
  width: min(420px, 100%);
}

.payment-proof-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: left;
}

.payment-proof-form input {
  min-height: 40px;
  padding: 8px 10px;
  color: var(--ink);
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.order-timeline {
  display: grid;
  gap: 10px;
}

.order-timeline h2 {
  font-size: 18px;
}

.member-record-section {
  display: grid;
  gap: 10px;
}

.member-record-section h3 {
  margin-bottom: 0;
}

.member-record-list {
  display: grid;
  gap: 9px;
  color: var(--muted);
  font-size: 13px;
}

.member-record-item {
  display: grid;
  gap: 7px;
  padding: 12px;
  color: var(--muted);
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.member-record-item div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

.member-record-item span {
  color: var(--muted);
  white-space: nowrap;
}

.member-record-item strong {
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
  text-align: right;
  overflow-wrap: anywhere;
}

.admin-page {
  min-height: 100vh;
  background: #eef3f5;
}

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

.admin-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 14px;
  background: #111d26;
  color: #dce7eb;
}

.admin-brand {
  color: #fff;
  padding: 0 6px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.admin-nav {
  display: grid;
  gap: 4px;
}

.admin-nav a,
.admin-back-link {
  min-height: 40px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: #b7c6cc;
  border-radius: 7px;
  font-weight: 700;
}

.admin-nav a:hover,
.admin-nav a.active,
.admin-back-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.admin-back-link {
  margin-top: auto;
}

.admin-main {
  min-width: 0;
  padding: 24px;
}

.admin-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 20px;
}

.admin-topbar h1 {
  margin-bottom: 0;
  font-size: 28px;
}

.admin-session {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-login-panel,
.admin-section,
.admin-empty {
  padding: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-login-panel {
  max-width: 420px;
  margin-bottom: 18px;
}

.admin-login-panel .primary-button {
  margin-top: 14px;
}

.admin-view {
  display: grid;
  gap: 16px;
}

.admin-metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.admin-metric-grid div {
  display: grid;
  gap: 6px;
  min-height: 86px;
  padding: 16px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-metric-grid span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-metric-grid strong {
  color: var(--ink);
  font-size: 28px;
}

.admin-section h2 {
  margin-bottom: 14px;
  font-size: 18px;
}

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

.admin-row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-order-panel {
  display: grid;
  gap: 12px;
}

.admin-order-tools {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.admin-order-filters,
.admin-order-search {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.admin-order-filters .small-button.active {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

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

.admin-reconciliation-grid div {
  display: grid;
  gap: 4px;
  min-height: 72px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.admin-reconciliation-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.admin-reconciliation-grid strong {
  color: var(--ink);
  font-size: 18px;
}

.admin-order-search input {
  min-width: min(260px, 100%);
  min-height: 34px;
  padding: 0 10px;
  color: var(--ink);
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
}

.admin-order-detail {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.admin-order-detail h3,
.admin-detail-list h4 {
  margin: 0;
}

.admin-exception-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.admin-proof-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.admin-proof-panel h4 {
  margin: 0;
}

.admin-proof-panel img {
  width: min(320px, 100%);
  max-height: 420px;
  object-fit: contain;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.admin-proof-panel a {
  justify-self: start;
  color: var(--teal-dark);
  font-weight: 800;
}

.admin-exception-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.admin-exception-head h4 {
  margin: 0;
}

.admin-detail-list {
  display: grid;
  gap: 8px;
}

.admin-table-wrap table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.admin-table-wrap th,
.admin-table-wrap td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 13px;
}

.admin-table-wrap th {
  color: var(--muted);
  background: #f7fafb;
  font-weight: 800;
  white-space: nowrap;
}

.admin-table-wrap td {
  color: var(--ink);
  overflow-wrap: anywhere;
}

.admin-settings-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(120px, 1fr)) auto;
  gap: 10px;
  align-items: end;
}

.admin-settings-form.compact {
  grid-template-columns: minmax(180px, 1fr) minmax(120px, 0.5fr) minmax(180px, 1fr) auto;
}

.admin-config-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
  align-items: end;
}

.admin-input-field {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.admin-input-field input,
.admin-input-field select,
.admin-input-field textarea {
  min-height: 40px;
  padding: 0 10px;
  color: var(--ink);
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.admin-input-field textarea {
  min-height: 88px;
  padding: 10px;
  resize: vertical;
}

.admin-checkbox-field > span:last-child {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
}

.admin-checkbox-field input {
  min-height: auto;
  width: 16px;
  height: 16px;
}

.admin-checkbox-field em {
  font-style: normal;
  font-weight: 700;
}

.admin-config-grid .primary-button {
  min-height: 40px;
}

.admin-upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.admin-upload-card {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.admin-upload-card span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.admin-upload-card input {
  min-height: 40px;
}

.admin-kv-list {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 10px 16px;
  margin: 0;
}

.admin-kv-list dt {
  color: var(--muted);
  font-weight: 800;
}

.admin-kv-list dd {
  margin: 0;
  color: var(--ink);
  overflow-wrap: anywhere;
}

.literature-text {
  min-height: 130px;
}

.rewrite-controls {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 0 12px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.control-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.control-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.control-select {
  flex: 1;
  width: min(320px, 100%);
  min-height: 36px;
  padding: 0 36px 0 12px;
  color: var(--ink);
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 800;
}

.control-select:focus {
  border-color: var(--accent);
  outline: 3px solid rgba(29, 140, 126, 0.16);
}

.language-select {
  max-width: 160px;
}

.upload-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.upload-box {
  display: grid;
  gap: 3px;
  min-height: 76px;
  padding: 13px;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 7px;
}

.upload-box input {
  width: 100%;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.upload-title {
  font-weight: 800;
}

.upload-copy {
  color: var(--muted);
  font-size: 13px;
}

.secondary-button {
  padding: 0 14px;
  color: var(--blue);
  background: #fff;
  border-color: var(--line);
}

.primary-button {
  min-height: 42px;
  padding: 0 18px;
  color: #fff;
  background: var(--teal);
}

.primary-button:hover {
  background: var(--teal-dark);
}

.ghost-button {
  min-width: 68px;
}

.markdown-card {
  display: grid;
  gap: 7px;
  margin-top: 14px;
  padding: 13px 14px;
  color: var(--teal-dark);
  background: var(--success-bg);
  border: 1px solid var(--success-line);
  border-radius: 7px;
}

.markdown-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.markdown-card strong {
  display: block;
  margin-top: 2px;
}

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

.action-row {
  flex-wrap: wrap;
  gap: 12px;
  margin-top: auto;
  padding-top: 16px;
}

.inline-note {
  color: var(--muted);
  font-size: 13px;
}

.result-state {
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

.result-state.ok {
  color: var(--teal-dark);
  background: var(--success-bg);
  border-color: var(--success-line);
}

.result-state.warn {
  color: #7a4a05;
  background: var(--warning-bg);
  border-color: var(--warning-line);
}

.result-layout {
  display: grid;
  grid-template-rows: minmax(260px, 1fr) minmax(150px, auto) auto;
  gap: 12px;
  min-height: 0;
  flex: 1;
}

.result-layout.compact-result {
  grid-template-rows: minmax(360px, 1fr) auto;
}

.result-card,
.export-box {
  min-width: 0;
  padding: 14px;
  background: #fbfdfe;
  border: 1px solid var(--line);
  border-radius: 7px;
}

#resultPreview {
  overflow: auto;
  min-height: 230px;
  max-height: 42dvh;
  margin: 0;
  padding: 12px;
  color: #243341;
  white-space: pre-wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  line-height: 1.7;
}

.notes-box {
  min-height: 92px;
  color: var(--muted);
  white-space: pre-wrap;
}

.export-box {
  position: relative;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  background: linear-gradient(180deg, #f8fbfb 0%, #eef7f6 100%);
  border-color: #cfe2df;
}

.export-box h3 {
  margin-bottom: 6px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.25;
}

.export-box p {
  max-width: 520px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.export-actions .primary-button,
.export-actions .ghost-button {
  min-width: 112px;
  min-height: 44px;
  padding: 0 18px;
  white-space: nowrap;
}

.export-actions .primary-button {
  box-shadow: 0 8px 18px rgba(0, 121, 111, 0.18);
}

.export-actions .ghost-button {
  color: var(--teal-dark);
  background: #fff;
  border-color: #bfd9d6;
}

.export-actions .ghost-button:hover {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.is-hidden {
  display: none !important;
}

@media (max-width: 1120px) {
  .topbar {
    grid-template-columns: 1fr;
    padding: 14px 20px;
  }

  .mode-switch,
  .status-area {
    justify-self: start;
  }

  .workspace-intro,
  .workbench,
  .member-account-bar,
  .member-center-layout,
  .member-content-grid {
    grid-template-columns: 1fr;
  }

  .member-auth-section {
    position: static;
  }

  .admin-app {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    height: auto;
  }

  .admin-nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .admin-metric-grid,
  .admin-reconciliation-grid,
  .admin-settings-form,
  .admin-settings-form.compact,
  .admin-config-grid,
  .admin-upload-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .input-panel,
  .result-panel {
    min-height: auto;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 20px 14px 28px;
  }

  .mode-switch {
    width: 100%;
    overflow-x: auto;
  }

  .mode-tab {
    min-width: max-content;
  }

  .status-area,
  .export-box,
  .settings-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .export-actions {
    width: 100%;
  }

  h1 {
    font-size: 26px;
  }

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

  .member-cost-grid {
    grid-template-columns: 1fr;
  }

  .member-settings-grid {
    grid-template-columns: 1fr;
  }

  .member-shell {
    padding: 24px 14px 32px;
  }

  .member-summary-grid {
    grid-template-columns: 1fr;
  }

  .member-center-menu {
    display: flex;
    gap: 4px;
    overflow-x: auto;
    padding: 4px;
  }

  .member-menu-item {
    flex: 0 0 auto;
    min-height: 46px;
    padding: 0 14px;
    border-left: 0;
    border-bottom: 3px solid transparent;
    border-radius: 6px;
    font-size: 14px;
  }

  .member-menu-item.active {
    background: #e3f5f2;
    border-bottom-color: var(--teal);
  }

  .member-home-grid {
    grid-template-columns: 1fr;
  }

  .admin-main {
    padding: 18px 14px 28px;
  }

  .admin-topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-nav,
  .admin-metric-grid,
  .admin-reconciliation-grid,
  .admin-settings-form,
  .admin-settings-form.compact,
  .admin-config-grid,
  .admin-upload-grid {
    grid-template-columns: 1fr;
  }

  .member-record-item div {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .member-record-item strong {
    text-align: left;
  }

  .control-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .platform-select {
    width: 100%;
  }

  .primary-button,
  .secondary-button,
  .ghost-button,
  .small-button {
    width: 100%;
  }

  .settings-panel {
    border-left: 0;
  }

  .member-shell {
    padding: 28px 14px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}
.site-announcement {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin: 0 auto;
  padding: 0.8rem clamp(1rem, 4vw, 3rem);
  color: #6b3f00;
  background: #fff4d6;
  border-bottom: 1px solid #f0d28a;
}

.site-announcement.is-hidden {
  display: none;
}
