:root {
  /* 數字（餘額、步驟編號）：Georgia 預設為舊式數字（1 較矮、9 下沉），改用等高等寬的數字字型。 */
  --numeral-font: "Times New Roman", Times, "Noto Serif TC", serif;
  --ink: #17231d;
  --paper: #f3eddf;
  --paper-deep: #e8deca;
  --forest: #173f30;
  --forest-bright: #246247;
  --mint: #92c8a5;
  --copper: #b9673f;
  --gold: #d2a64c;
  --line: rgba(23, 35, 29, 0.18);
  --muted: #68716a;
  --error: #9d332d;
  --success: #176340;
  --shadow: 0 24px 70px rgba(31, 44, 36, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 4%, rgba(210, 166, 76, 0.16), transparent 27rem),
    linear-gradient(180deg, #f7f2e8 0%, var(--paper) 58%, #eee6d6 100%);
  font-family: "Noto Serif TC", "Source Han Serif TC", "Microsoft JhengHei", serif;
  min-height: 100vh;
}

.paper-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  opacity: 0.26;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.86' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.12'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

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

button,
select {
  cursor: pointer;
}

.topbar {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand {
  color: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 13px;
}

.brand-mark {
  width: 49px;
  aspect-ratio: 1;
  border-radius: 50%;
  color: var(--paper);
  background: var(--forest);
  display: grid;
  place-items: center;
  font-family: Georgia, serif;
  font-weight: 700;
  font-size: 14px;
  letter-spacing: 0.08em;
  box-shadow: inset 0 0 0 3px var(--forest), inset 0 0 0 4px rgba(243, 237, 223, 0.7);
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-size: 18px;
  letter-spacing: 0.16em;
}

.brand-copy small,
.eyebrow,
.system-state,
.label,
dt,
th,
footer {
  font-family: "Aptos Narrow", "DIN Condensed", "Microsoft JhengHei", sans-serif;
  letter-spacing: 0.14em;
}

.brand-copy small {
  font-size: 9px;
  color: var(--muted);
}

.system-state {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12px;
  font-weight: 700;
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--forest-bright);
  box-shadow: 0 0 0 0 rgba(36, 98, 71, 0.35);
  animation: pulse 2.2s infinite;
}

main {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
}

.hero {
  min-height: 460px;
  padding: 74px 0 58px;
  display: grid;
  grid-template-columns: 1.35fr 0.65fr;
  gap: 70px;
  align-items: center;
}

.eyebrow {
  margin: 0 0 15px;
  color: var(--copper);
  font-size: 11px;
  font-weight: 800;
}

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

h1 {
  margin-bottom: 24px;
  max-width: 760px;
  font-family: "Iowan Old Style", "Noto Serif TC", "Microsoft JhengHei", serif;
  font-size: clamp(44px, 6.3vw, 82px);
  line-height: 1.08;
  letter-spacing: -0.045em;
  font-weight: 700;
}

.hero-lead {
  max-width: 650px;
  font-size: 17px;
  line-height: 1.9;
  color: #4e5a52;
}

.prototype-note {
  margin-top: 30px;
  display: inline-flex;
  gap: 14px;
  align-items: center;
  padding: 10px 15px;
  border: 1px solid rgba(185, 103, 63, 0.35);
  background: rgba(255, 250, 239, 0.6);
  font-family: "Microsoft JhengHei", sans-serif;
  font-size: 12px;
}

.prototype-note strong {
  color: var(--copper);
}

.coin-stage {
  position: relative;
  min-height: 330px;
  display: grid;
  place-items: center;
}

.coin {
  position: relative;
  z-index: 2;
  width: min(260px, 72vw);
  aspect-ratio: 1;
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #f8e9bd;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.16), transparent 18%),
    radial-gradient(circle, #2a6a4c 0%, #194632 58%, #123426 100%);
  border: 3px solid #d3ad5c;
  box-shadow:
    inset 0 0 0 9px #173f30,
    inset 0 0 0 11px rgba(226, 188, 107, 0.75),
    0 28px 60px rgba(23, 63, 48, 0.26);
  transform: rotate(-7deg);
  animation: coinFloat 5s ease-in-out infinite;
}

.coin::before,
.coin::after {
  content: "✦";
  position: absolute;
  top: 48%;
  color: var(--gold);
  font-size: 19px;
}

.coin::before { left: 28px; }
.coin::after { right: 28px; }

.coin strong {
  font-family: var(--numeral-font);
  font-variant-numeric: lining-nums tabular-nums;
  font-size: 58px;
  letter-spacing: 0.04em;
  line-height: 1;
}

.coin-kicker,
.coin-year {
  font-family: "Microsoft JhengHei", sans-serif;
  letter-spacing: 0.16em;
}

.coin-kicker {
  margin-bottom: 13px;
  font-size: 16px;
}

.coin-year {
  margin-top: 13px;
  font-size: 8px;
}

.orbit {
  position: absolute;
  border: 1px solid rgba(23, 63, 48, 0.2);
  border-radius: 50%;
}

.orbit::after {
  content: "";
  position: absolute;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--copper);
  top: 12%;
  left: 12%;
}

.orbit-one {
  width: 320px;
  height: 320px;
  animation: spin 18s linear infinite;
}

.orbit-two {
  width: 375px;
  height: 230px;
  transform: rotate(28deg);
  animation: spinTilt 24s linear infinite reverse;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(290px, 0.75fr) minmax(420px, 1.25fr);
  gap: 22px;
  align-items: stretch;
}

.balance-card,
.transfer-card,
.ledger-section {
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.balance-card {
  color: #f8f0dc;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.04), transparent 45%),
    var(--forest);
  padding: 32px;
  position: relative;
  overflow: hidden;
}

.balance-card::after {
  content: "LHC";
  position: absolute;
  right: -18px;
  bottom: -38px;
  font-family: Georgia, serif;
  font-size: 120px;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.035);
}

.card-heading,
.section-heading,
.form-footer {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 22px;
}

.card-heading select {
  max-width: 230px;
  margin-top: 7px;
  padding: 5px 24px 5px 0;
  color: #fff8e7;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0;
  background: transparent;
}

.card-heading option {
  color: var(--ink);
}

.seal {
  padding: 6px 8px;
  border: 1px solid rgba(240, 209, 143, 0.6);
  color: #f1d99e;
  font: 700 9px/1 "Aptos Narrow", sans-serif;
  letter-spacing: 0.14em;
}

.label {
  margin-bottom: 4px;
  color: rgba(250, 242, 221, 0.66);
  font-size: 10px;
  font-weight: 700;
}

.balance-block {
  margin: 55px 0 52px;
}

.balance-block div {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.balance-block strong {
  font-family: var(--numeral-font);
  font-variant-numeric: lining-nums tabular-nums;
  font-size: clamp(58px, 7vw, 90px);
  font-weight: 400;
  line-height: 1;
}

.balance-block span {
  color: #eccf8e;
  font: 700 13px/1 "Aptos Narrow", sans-serif;
  letter-spacing: 0.15em;
}

.wallet-meta {
  margin: 0;
  display: grid;
  gap: 15px;
  position: relative;
  z-index: 1;
}

.wallet-meta div {
  padding-top: 13px;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  display: flex;
  justify-content: space-between;
  gap: 18px;
}

dt {
  color: rgba(250, 242, 221, 0.6);
  font-size: 9px;
}

dd {
  margin: 0;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

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

.transfer-card,
.ledger-section {
  background: rgba(255, 252, 244, 0.74);
}

.transfer-card {
  padding: 32px;
}

.section-heading {
  margin-bottom: 28px;
}

.section-heading h2 {
  margin: 0;
  font-size: 27px;
  letter-spacing: -0.02em;
}

.step-mark {
  color: var(--paper-deep);
  font-family: var(--numeral-font);
  font-variant-numeric: lining-nums tabular-nums;
  font-size: 47px;
  font-weight: 700;
  line-height: 1;
}

form {
  display: grid;
  gap: 18px;
}

label {
  display: grid;
  gap: 8px;
  font-family: "Microsoft JhengHei", sans-serif;
  font-size: 12px;
  font-weight: 700;
}

label em {
  color: var(--copper);
  font-size: 10px;
  font-style: normal;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  border: 1px solid rgba(23, 35, 29, 0.22);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.48);
  outline: none;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input,
select {
  height: 47px;
  padding: 0 13px;
}

textarea {
  resize: vertical;
  padding: 12px 13px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--forest-bright);
  background: #fffdf7;
  box-shadow: 0 0 0 3px rgba(36, 98, 71, 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.amount-field {
  position: relative;
}

.amount-field input {
  padding-right: 58px;
}

.amount-field b {
  position: absolute;
  right: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--copper);
  font: 700 10px/1 "Aptos Narrow", sans-serif;
  letter-spacing: 0.12em;
}

.form-footer {
  align-items: center;
  margin-top: 3px;
}

.form-footer p {
  margin: 0;
  max-width: 270px;
  color: var(--muted);
  font-family: "Microsoft JhengHei", sans-serif;
  font-size: 11px;
  line-height: 1.5;
}

button {
  min-width: 145px;
  padding: 14px 16px;
  color: #fff8e9;
  border: 1px solid var(--forest);
  background: var(--forest);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  font-weight: 700;
  transition: transform 160ms ease, background 160ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-2px);
  background: var(--forest-bright);
}

button:disabled {
  cursor: wait;
  opacity: 0.6;
}

.form-message {
  min-height: 20px;
  margin: 0;
  font-family: "Microsoft JhengHei", sans-serif;
  font-size: 12px;
  font-weight: 700;
}

.form-message.error { color: var(--error); }
.form-message.success { color: var(--success); }

.ledger-section {
  margin: 22px 0 80px;
  padding: 32px;
}

.ledger-heading {
  align-items: flex-end;
}

.ledger-count {
  padding-bottom: 4px;
  color: var(--muted);
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 11px;
}

.ledger-table-wrap {
  overflow-x: auto;
  border-top: 1px solid var(--ink);
}

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

th,
td {
  padding: 16px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

td {
  font-family: "Microsoft JhengHei", sans-serif;
  font-size: 12px;
}

.tx-id,
.amount,
.category-badge,
.status-badge {
  font-family: "Cascadia Mono", Consolas, monospace;
}

.tx-id {
  color: var(--muted);
  font-size: 10px;
}

.memo-main {
  display: block;
  margin-bottom: 4px;
  font-weight: 700;
}

.memo-route {
  color: var(--muted);
  font-size: 10px;
}

.category-badge,
.status-badge {
  display: inline-block;
  padding: 5px 7px;
  border: 1px solid var(--line);
  font-size: 9px;
}

.status-badge.success {
  color: var(--success);
  border-color: rgba(23, 99, 64, 0.3);
  background: rgba(23, 99, 64, 0.06);
}

.status-badge.failed {
  color: var(--error);
  border-color: rgba(157, 51, 45, 0.28);
  background: rgba(157, 51, 45, 0.05);
}

.align-right {
  text-align: right;
}

.amount {
  color: var(--forest);
  font-weight: 700;
}

.empty-state {
  padding: 30px;
  text-align: center;
  color: var(--muted);
}

footer {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 18px 0 30px;
  border-top: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: 9px;
}

.reveal {
  opacity: 0;
  transform: translateY(18px);
  animation: reveal 700ms cubic-bezier(0.2, 0.75, 0.25, 1) forwards;
}

.delay-1 { animation-delay: 100ms; }
.delay-2 { animation-delay: 180ms; }
.delay-3 { animation-delay: 260ms; }

@keyframes reveal {
  to { opacity: 1; transform: translateY(0); }
}

@keyframes coinFloat {
  0%, 100% { transform: translateY(0) rotate(-7deg); }
  50% { transform: translateY(-12px) rotate(-3deg); }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes spinTilt {
  from { transform: rotate(28deg); }
  to { transform: rotate(388deg); }
}

@keyframes pulse {
  70% { box-shadow: 0 0 0 8px rgba(36, 98, 71, 0); }
  100% { box-shadow: 0 0 0 0 rgba(36, 98, 71, 0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media (max-width: 850px) {
  .hero {
    grid-template-columns: 1fr;
    gap: 20px;
    padding-top: 54px;
  }

  .coin-stage {
    min-height: 290px;
  }

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

@media (max-width: 560px) {
  .topbar,
  main,
  footer {
    width: min(100% - 26px, 1180px);
  }

  .brand-copy small,
  .system-state span:last-child {
    display: none;
  }

  .hero {
    padding-top: 42px;
  }

  h1 {
    font-size: 43px;
  }

  .orbit-one { width: 280px; height: 280px; }
  .orbit-two { width: 300px; height: 190px; }
  .coin { width: 220px; }
  .coin strong { font-size: 50px; }

  .balance-card,
  .transfer-card,
  .ledger-section {
    padding: 23px;
  }

  .form-row {
    grid-template-columns: 1fr;
  }

  .form-footer {
    align-items: stretch;
    flex-direction: column;
  }

  button {
    width: 100%;
  }

  footer {
    flex-direction: column;
  }
}
[hidden] { display: none !important; }

.auth-state { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 12px; color: var(--ink); font-family: "Microsoft JhengHei", sans-serif; font-size: 13px; }
#signedInAs { overflow-wrap: anywhere; }
.auth-state button, .login-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  min-width: 0;
  width: auto;
  color: #fff8e9;
  background: var(--forest);
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}
.login-panel {
  width: min(560px, calc(100% - 32px));
  margin: 12vh auto;
  padding: clamp(28px, 6vw, 56px);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--paper);
  text-align: center;
}
.login-panel h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); }
.login-panel p { margin: 18px 0 28px; color: var(--muted); line-height: 1.7; }
.login-panel #loginMessage { margin-bottom: 6px; }
.login-panel .login-note { margin-top: 0; color: var(--copper); font-weight: 700; }
.login-button { display: inline-block; color: var(--paper); }

/* ---- 唯讀錢包 ---------------------------------------------------------- */
.nav-link { color: inherit; font-family: "Microsoft JhengHei", sans-serif; font-size: 13px; font-weight: 700; }
.wallet-workspace { margin-top: 36px; }
.wallet-owner { display: block; margin-top: 6px; font-size: 22px; }
.address-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; word-break: break-all; }
.ghost-button, .small-button {
  min-width: 0;
  padding: 6px 12px;
  font-size: 12px;
  display: inline-flex;
}
.ghost-button { color: inherit; background: transparent; border-color: rgba(248, 240, 220, 0.4); }
.ghost-button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.1); }
.summary-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin: 0 0 28px; }
.summary-grid div { padding: 14px 16px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.45); }
.summary-grid dt { color: var(--muted); font-family: "Microsoft JhengHei", sans-serif; font-size: 12px; }
.summary-grid dd { margin: 6px 0 0; font-size: 20px; font-weight: 700; word-break: break-all; }
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 22px;
  min-width: 145px;
  padding: 14px 16px;
  color: #fff8e9;
  background: var(--forest);
  border: 1px solid var(--forest);
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
}
.button-link:hover { background: var(--forest-bright); }
.button-link.secondary, button.secondary { color: var(--forest); background: transparent; }
.amount.in { color: var(--success); }
.amount.out { color: var(--copper); }
.nowrap { white-space: nowrap; }
.status-dot.frozen { background: var(--copper); }
.notice-panel {
  margin: 40px 0;
  padding: 32px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 244, 0.74);
}

/* ---- 管理後台 ---------------------------------------------------------- */
.admin-page main { padding-bottom: 60px; }
.admin-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 28px 0 12px; }
.admin-tabs button {
  min-width: 0;
  padding: 10px 16px;
  color: var(--forest);
  background: transparent;
  display: inline-flex;
}
.admin-tabs button[aria-selected="true"] { color: #fff8e9; background: var(--forest); }
.admin-panel {
  padding: 28px;
  border: 1px solid var(--line);
  background: rgba(255, 252, 244, 0.74);
  box-shadow: var(--shadow);
}
.admin-panel h2 { margin: 0 0 18px; font-size: 24px; }
.admin-panel h3 { margin: 24px 0 10px; font-size: 16px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 18px; }
.toolbar input, .toolbar select {
  min-width: 0;
  flex: 1 1 180px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  background: #fffdf7;
}
.toolbar button, .toolbar .button-link { min-width: 0; padding: 11px 16px; }
.inline-label { display: flex; align-items: center; gap: 6px; flex: 1 1 170px; font-size: 13px; }
.inline-label input { flex: 1; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin: 16px 0; }
.stat-card { padding: 18px; border: 1px solid var(--line); background: #fffdf7; }
.stat-card span { display: block; color: var(--muted); font-family: "Microsoft JhengHei", sans-serif; font-size: 12px; }
.stat-card strong { display: block; margin-top: 8px; font-size: 22px; word-break: break-all; }
.detail-box { margin-top: 20px; padding: 18px; border: 1px dashed var(--line); background: #fffdf7; overflow-wrap: anywhere; }
.hint { margin: 0 0 16px; color: var(--muted); font-family: "Microsoft JhengHei", sans-serif; font-size: 13px; line-height: 1.7; }
.check-result { margin: 18px 0; padding: 12px 16px; font-weight: 700; }
.check-result.ok { color: var(--success); background: rgba(146, 200, 165, 0.25); }
.check-result.bad { color: var(--error); background: rgba(157, 51, 45, 0.12); }
.small-button.danger, button.danger { color: var(--error); background: transparent; border-color: var(--error); }
.empty-cell { color: var(--muted); text-align: center; }
.token-value { display: block; margin-top: 10px; padding: 10px; background: var(--paper-deep); word-break: break-all; user-select: all; }
.db-banner { margin-top: 20px; padding: 14px 18px; color: #fff8e9; background: var(--copper); font-weight: 700; }

@media (max-width: 560px) {
  .summary-grid { grid-template-columns: 1fr; }
  .admin-panel { padding: 20px; }
  .toolbar button, .toolbar .button-link, .admin-tabs button, .ghost-button, .small-button { width: auto; }
  .button-link { width: 100%; }
}

@media (max-width: 560px) {
  .topbar { flex-wrap: wrap; gap: 12px; }
  .auth-state { width: 100%; justify-content: space-between; }
  .auth-state button { width: auto; }
}

/* ---- 使用者搜尋建議與 API 說明 ------------------------------------------- */
.search-box { position: relative; flex: 3 1 260px; display: flex; }
.search-box input { flex: 1; }
.suggestions {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 20;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  max-height: 320px;
  overflow-y: auto;
  border: 1px solid var(--line);
  background: #fffdf7;
  box-shadow: var(--shadow);
}
.suggestions li {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 12px;
  padding: 10px 14px;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.suggestions li:hover, .suggestions li:focus { outline: none; background: rgba(146, 200, 165, 0.25); }
.suggestions li span { color: var(--muted); font-size: 13px; }
.api-doc table { min-width: 0; margin-bottom: 8px; }
.api-doc td code { overflow-wrap: anywhere; }
.api-doc ul.hint { padding-left: 20px; }
.code-block {
  margin: 0 0 12px;
  padding: 14px;
  overflow-x: auto;
  background: var(--forest);
  color: #f8f0dc;
  font-size: 12px;
  line-height: 1.6;
}

/* ---- 一次性名單匯入 ---- */
.import-box { margin-bottom: 20px; }
.import-box h3 { margin-top: 0; }
.import-box textarea { width: 100%; box-sizing: border-box; margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--line); background: #fffdf7; font-family: "Cascadia Mono", Consolas, monospace; font-size: 13px; }
.import-list { max-height: 240px; overflow-y: auto; margin: 0 0 12px; padding-left: 20px; font-size: 13px; line-height: 1.7; }
/* Google 表單比對結果表格：過長時在框內捲動、表頭固定 */
.roster-table-wrap { max-height: 440px; overflow: auto; margin: 0 0 20px; }
.roster-table thead th { position: sticky; top: 0; z-index: 1; background: var(--paper, #fbf8f1); }
.roster-table td, .roster-table th { font-size: 13px; }
.roster-table .roster-check { width: 36px; text-align: center; }
.roster-table input[type="checkbox"] { width: 16px; height: 16px; min-height: 0; margin: 0; padding: 0; vertical-align: middle; }

/* 上線前清空資料區塊 */
.danger-box { border-color: var(--error); }
.danger-box h3 { color: var(--error); }
.danger-box .toolbar button.danger { color: #fff; background: var(--error); border-color: var(--error); }

/* ---- 手機版（RWD）：表格在外框內左右捲動時不折行；表單欄位滿版 ---- */
.tx-id, td.nowrap, th { white-space: nowrap; }
@media (max-width: 560px) {
  .toolbar input, .toolbar select, .toolbar .search-box { flex: 1 1 100%; }
  .toolbar button { flex: 1 1 auto; }
  .ledger-table-wrap { -webkit-overflow-scrolling: touch; }
  .admin-tabs button { padding: 9px 12px; }
}
#issueForm { margin-bottom: 40px; padding-bottom: 28px; border-bottom: 1px solid var(--line); }

/* ---- 權限與審核（ADR-024） ---- */
.tab-badge { display: inline-block; min-width: 20px; margin-left: 4px; padding: 1px 6px; border-radius: 999px;
  color: #fff; background: var(--error); font-size: 12px; line-height: 18px; text-align: center; }
.align-center { text-align: center !important; }
.permission-picks { gap: 6px 18px; }
.inline-check { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; }
.approval-hint { color: var(--forest); font-weight: 600; }
.admin-panel input[type="checkbox"], .toolbar input[type="checkbox"] {
  flex: none; width: 18px; height: 18px; min-height: 0; padding: 0; margin: 0; accent-color: var(--forest);
}
.permission-picks .inline-check { flex: 0 0 auto; white-space: nowrap; }
.memo-route { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.toolbar #approvalFilter { flex: 0 1 220px; }
.schedule-toggle { flex: 0 0 auto; }
.schedule-toggle input[type="checkbox"] { flex: 0 0 auto; width: 18px; height: 18px; padding: 0; }

/* LHX 錢包圖示（icon.svg）取代文字徽章 */
.brand-mark:has(img) { background: none; box-shadow: none; border-radius: 13px; overflow: hidden; }
.brand-mark img { display: block; width: 100%; height: 100%; }

/* ---- 後台排版優化（2026-10-02）：說明與表格字體加大、區塊間距一致；僅套用於管理後台 ---- */
.admin-page .hint { font-size: 15px; line-height: 1.85; color: #535c55; }
.admin-page .form-message { font-size: 15px; font-weight: 700; }
.admin-page .admin-panel { padding: 32px 36px; }
.admin-page .admin-panel h2 { font-size: 26px; margin-bottom: 14px; }
.admin-page .admin-panel h3 { margin: 32px 0 12px; font-size: 18px; }
.admin-page .admin-panel h2 + .hint, .admin-page .admin-panel h3 + .hint { margin-top: 0; }
.admin-page th { font-size: 13px; letter-spacing: .03em; color: #4f5951; }
.admin-page td { font-size: 14px; line-height: 1.6; }
.admin-page .tx-id { font-size: 12.5px; }
.admin-page .memo-route { font-size: 13px; }
.admin-page .category-badge, .admin-page .status-badge { font-size: 12px; padding: 4px 9px; }
.admin-page .stat-card span, .admin-page .summary-grid dt { font-size: 14px; }
.admin-page .stat-card strong { font-size: 26px; }
.admin-page .toolbar input, .admin-page .toolbar select, .admin-page .admin-panel textarea { font-size: 15px; }
.admin-page .inline-label, .admin-page .inline-check { font-size: 15px; }
.admin-page .detail-box { padding: 22px 24px; }
.admin-page .ledger-table-wrap { margin-top: 6px; }
.admin-page td .button-link { width: auto; white-space: nowrap; }
/* 備份清單操作：下載、還原、刪除按鈕大小一致 */
.backup-actions { display: flex; gap: 6px; flex-wrap: nowrap; }
.admin-page .backup-actions .small-button { box-sizing: border-box; width: 64px; min-width: 64px; height: 32px; padding: 0 8px;
  justify-content: center; align-items: center; gap: 0; font-size: 12px; line-height: 1; }
@media (max-width: 560px) {
  .admin-page .admin-panel { padding: 22px 18px; }
  .admin-page .hint { font-size: 14.5px; }
}
/* 管理員表格欄位多：角色與時間不折行，表格在外框內左右捲動 */
.admin-page #adminBody td:nth-child(2), .admin-page #adminBody td:nth-last-child(2), .admin-page #adminHead th { white-space: nowrap; }
.admin-page #adminBody, .admin-page #adminHead { font-size: 14px; }
.admin-page .ledger-table-wrap table:has(#adminBody) { min-width: 1080px; }
/* 分頁列：一般桌面寬度維持一行 */
.admin-page .admin-tabs { gap: 6px; }
.admin-page .admin-tabs button { padding: 9px 13px; font-size: 15px; }

/* 主辦單位收款碼（ADR-028） */
.qr-panel { margin-top: 16px; }
.qr-box { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.qr-box[hidden] { display: none; }
.qr-box img { background: #fff; border-radius: 10px; width: 200px; height: 200px; border: 1px solid rgba(0, 0, 0, 0.08); }
.qr-box code { word-break: break-all; }

/* 資料表排序（table-sort.js）：可排序的欄位標題顯示箭頭 */
th[data-sortable] { cursor: pointer; user-select: none; }
th[data-sortable]::after { content: " ↕"; opacity: 0.35; font-size: 0.85em; }
th[data-sortable][aria-sort="ascending"]::after { content: " ▲"; opacity: 0.9; }
th[data-sortable][aria-sort="descending"]::after { content: " ▼"; opacity: 0.9; }
th[data-sortable]:focus-visible { outline: 2px solid currentColor; outline-offset: -2px; }
