:root {
  --bg: #f6f7f2;
  --surface: #ffffff;
  --surface-soft: #eef4ee;
  --ink: #202520;
  --muted: #6d756b;
  --line: #d9dfd3;
  --green: #246d52;
  --green-dark: #174d3a;
  --teal: #176f7a;
  --amber: #a96019;
  --red: #a83f39;
  --blue: #2f5d89;
  --shadow: 0 20px 50px rgba(38, 45, 34, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(232, 239, 229, 0.9), rgba(246, 247, 242, 0.4) 32rem),
    var(--bg);
  font-family:
    Inter, "PingFang SC", "Microsoft YaHei", "Noto Sans SC", system-ui, -apple-system, sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.icon-sprite {
  display: none;
}

svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: min(1180px, calc(100% - 2rem));
  min-height: 72px;
  margin: 0 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--green-dark);
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 1.05rem;
}

.brand span {
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.system-state {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 34px;
  padding: 0 0.75rem;
  border: 1px solid rgba(36, 109, 82, 0.2);
  border-radius: 999px;
  color: var(--green-dark);
  background: rgba(255, 255, 255, 0.72);
  font-size: 0.875rem;
  white-space: nowrap;
}

.system-state span {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: #32a873;
  box-shadow: 0 0 0 5px rgba(50, 168, 115, 0.16);
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(320px, 410px) minmax(0, 1fr);
  gap: 1rem;
  width: min(1180px, calc(100% - 2rem));
  margin: 1.25rem auto 3rem;
  align-items: stretch;
}

.lookup-panel,
.result-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.lookup-panel {
  display: flex;
  flex-direction: column;
  min-height: 620px;
  padding: 1.25rem;
}

.result-panel {
  min-height: 620px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.eyebrow {
  margin: 0 0 0.45rem;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 700;
}

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

h1 {
  margin-bottom: 0;
  font-size: 2.2rem;
  line-height: 1.08;
}

h2 {
  margin-bottom: 0.45rem;
  font-size: 1.25rem;
}

h3 {
  margin-bottom: 0.3rem;
  font-size: 1rem;
}

.icon-button,
.copy-button,
.method-tab,
.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  border: 0;
  border-radius: 8px;
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.icon-button:active,
.copy-button:active,
.method-tab:active,
.secondary-button:active,
.primary-button:active {
  transform: translateY(1px);
}

.icon-button {
  width: 38px;
  height: 38px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
}

.lookup-form {
  margin-top: 2.25rem;
}

.lookup-form label {
  display: block;
  margin-bottom: 0.55rem;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.6rem;
}

.search-row input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 0.9rem;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.search-row input:focus {
  border-color: rgba(36, 109, 82, 0.62);
  box-shadow: 0 0 0 4px rgba(36, 109, 82, 0.12);
}

.primary-button {
  min-width: 96px;
  min-height: 48px;
  padding: 0 1rem;
  color: #fff;
  background: var(--green);
  font-weight: 800;
}

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

.lookup-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
  margin-top: 1rem;
}

.lookup-meta div {
  min-height: 86px;
  padding: 0.9rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
}

.lookup-meta span,
.lookup-meta strong {
  display: block;
}

.lookup-meta span {
  color: var(--muted);
  font-size: 0.78rem;
}

.lookup-meta strong {
  margin-top: 0.45rem;
  font-size: 1rem;
}

.security-note {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  margin-top: auto;
  padding: 0.85rem;
  border: 1px solid rgba(47, 93, 137, 0.2);
  border-radius: 8px;
  color: #24425e;
  background: rgba(47, 93, 137, 0.08);
  font-size: 0.88rem;
  line-height: 1.55;
}

.security-note svg {
  flex: 0 0 auto;
  margin-top: 0.15rem;
}

.empty-state,
.not-found {
  display: grid;
  min-height: 620px;
  place-items: center;
  padding: 2rem;
  text-align: center;
}

.empty-state p,
.not-found p {
  max-width: 25rem;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.empty-icon {
  display: grid;
  width: 62px;
  height: 62px;
  margin: 0 auto 1rem;
  place-items: center;
  border-radius: 8px;
  color: var(--green);
  background: var(--surface-soft);
}

.empty-icon svg {
  width: 1.6rem;
  height: 1.6rem;
}

.result-content {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 620px;
}

.result-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  padding: 1.25rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg, #fff, #f0f5ee);
}

.order-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.order-title h2 {
  margin: 0;
  overflow-wrap: anywhere;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 0.65rem;
  border-radius: 999px;
  color: #fff;
  background: var(--amber);
  font-size: 0.78rem;
  font-weight: 800;
}

.result-header p {
  margin: 0.45rem 0 0;
  color: var(--muted);
}

.amount-block {
  min-width: 180px;
  text-align: right;
}

.amount-block span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.amount-block strong {
  display: block;
  margin-top: 0.25rem;
  color: var(--green-dark);
  font-size: 2rem;
  line-height: 1;
}

.result-body {
  display: grid;
  grid-template-columns: minmax(210px, 260px) minmax(0, 1fr);
  gap: 1rem;
  padding: 1.25rem;
}

.usage-strip {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(320px, 1.4fr);
  gap: 1rem;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: #fbfcf8;
}

.usage-title span,
.usage-metrics span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.usage-title strong {
  display: block;
  margin-top: 0.25rem;
  overflow-wrap: anywhere;
  font-size: 1.05rem;
}

.usage-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.65rem;
}

.usage-metrics div {
  min-height: 72px;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.usage-metrics strong {
  display: block;
  margin-top: 0.25rem;
  color: var(--green-dark);
  font-size: 1.7rem;
  line-height: 1;
}

.usage-progress {
  grid-column: 1 / -1;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e0e5da;
}

.usage-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--teal));
}

.info-column {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.info-row {
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--line);
}

.info-row:last-child {
  border-bottom: 0;
}

.info-row span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
}

.info-row strong {
  display: block;
  margin-top: 0.25rem;
  overflow-wrap: anywhere;
}

.method-tabs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.55rem;
}

.method-tab {
  min-height: 48px;
  justify-content: flex-start;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  color: var(--muted);
  background: #fff;
  font-weight: 800;
  text-align: left;
}

.method-tab svg {
  flex: 0 0 auto;
}

.method-tab.is-active {
  border-color: rgba(36, 109, 82, 0.45);
  color: var(--green-dark);
  background: rgba(36, 109, 82, 0.09);
}

.payment-detail {
  display: flex;
  flex-direction: column;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.detail-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
}

.detail-head p {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.detail-accent {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 0.65rem;
  border-radius: 999px;
  color: var(--blue);
  background: rgba(47, 93, 137, 0.1);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.field-list {
  display: grid;
}

.field-row {
  display: grid;
  grid-template-columns: minmax(98px, 140px) minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
  min-height: 58px;
  padding: 0.72rem 1rem;
  border-bottom: 1px solid var(--line);
}

.field-row:last-child {
  border-bottom: 0;
}

.field-label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.field-value {
  min-width: 0;
  overflow-wrap: anywhere;
  font-weight: 800;
}

.copy-button {
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  color: var(--teal);
  background: #fff;
}

.copy-button:hover,
.icon-button:hover {
  border-color: rgba(23, 111, 122, 0.38);
  color: var(--teal);
  background: rgba(23, 111, 122, 0.08);
}

.card-result {
  display: grid;
  gap: 1rem;
  padding: 1.25rem;
}

.card-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: center;
  min-height: 150px;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(135deg, var(--green-dark), #1b6f76);
}

.card-hero span,
.card-hero p {
  color: rgba(255, 255, 255, 0.74);
}

.card-hero h2 {
  margin: 0.25rem 0;
  font-size: 1.8rem;
  line-height: 1.15;
}

.usage-ring {
  display: grid;
  width: 108px;
  height: 108px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  text-align: center;
}

.usage-ring strong {
  display: block;
  font-size: 2.1rem;
  line-height: 1;
}

.usage-ring span {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.75rem;
}

.card-factors {
  display: grid;
  grid-template-columns: 1.45fr 0.75fr 0.75fr;
  gap: 0.75rem;
}

.factor-card {
  position: relative;
  min-height: 116px;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.factor-card span,
.usage-summary span,
.history-head span,
.history-row span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.factor-card strong {
  display: block;
  margin-top: 0.55rem;
  padding-right: 2.6rem;
  overflow-wrap: anywhere;
  font-size: 1.55rem;
  line-height: 1.12;
}

.factor-card-number strong {
  font-size: 1.85rem;
}

.factor-card .copy-button {
  position: absolute;
  right: 0.85rem;
  bottom: 0.85rem;
}

.usage-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcf8;
}

.usage-summary div:not(.usage-progress) {
  min-height: 76px;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.usage-summary strong {
  display: block;
  margin-top: 0.2rem;
  color: var(--green-dark);
  font-size: 1.9rem;
  line-height: 1;
}

.usage-history {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.history-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  padding: 1rem;
  border-bottom: 1px solid var(--line);
  background: #fbfcf8;
}

.history-head h3 {
  margin: 0;
}

.history-list {
  display: grid;
}

.history-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 80px 96px;
  gap: 0.75rem;
  align-items: center;
  min-height: 68px;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--line);
}

.history-row:last-child {
  border-bottom: 0;
}

.history-row strong {
  display: block;
  margin-bottom: 0.25rem;
}

.history-count,
.history-rest {
  font-weight: 800;
  text-align: right;
}

.history-count {
  color: var(--red);
}

.history-rest {
  color: var(--green-dark);
}

.method-warning {
  display: flex;
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid rgba(169, 96, 25, 0.25);
  color: #6d4218;
  background: rgba(169, 96, 25, 0.08);
  font-size: 0.88rem;
  line-height: 1.55;
}

.result-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.65rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--line);
  background: #fbfcf8;
}

.secondary-button {
  min-height: 40px;
  padding: 0 0.85rem;
  border: 1px solid var(--line);
  color: var(--ink);
  background: #fff;
  font-weight: 800;
}

.secondary-button:hover {
  border-color: rgba(36, 109, 82, 0.38);
  color: var(--green-dark);
  background: rgba(36, 109, 82, 0.07);
}

.toast {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  z-index: 10;
  max-width: min(320px, calc(100vw - 2rem));
  padding: 0.75rem 0.9rem;
  border-radius: 8px;
  color: #fff;
  background: rgba(32, 37, 32, 0.92);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition:
    opacity 160ms ease,
    transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .lookup-panel,
  .result-panel,
  .empty-state,
  .not-found,
  .result-content {
    min-height: auto;
  }

  .lookup-panel {
    gap: 1.25rem;
  }

  .security-note {
    margin-top: 0;
  }
}

@media (max-width: 680px) {
  .topbar,
  .app-shell {
    width: min(100% - 1rem, 1180px);
  }

  .topbar {
    min-height: 64px;
  }

  .system-state {
    display: none;
  }

  .lookup-panel,
  .result-panel {
    border-radius: 8px;
  }

  .search-row,
  .lookup-meta,
  .result-header,
  .usage-strip,
  .card-hero,
  .card-factors,
  .usage-summary,
  .history-row,
  .result-body,
  .field-row {
    grid-template-columns: 1fr;
  }

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

  .amount-block {
    min-width: 0;
    text-align: left;
  }

  .method-tabs {
    grid-template-columns: 1fr;
  }

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

  .field-row {
    gap: 0.35rem;
  }

  .copy-button {
    width: 100%;
  }

  .factor-card .copy-button {
    position: static;
    margin-top: 0.85rem;
  }

  .factor-card strong {
    padding-right: 0;
  }

  .result-actions {
    flex-direction: column;
  }
}

@media (max-width: 460px) {
  .usage-metrics {
    grid-template-columns: 1fr;
  }
}

@media print {
  body {
    background: #fff;
  }

  .topbar,
  .lookup-panel,
  .result-actions,
  .toast {
    display: none;
  }

  .app-shell {
    display: block;
    width: 100%;
    margin: 0;
  }

  .result-panel,
  .payment-detail {
    border: 0;
    box-shadow: none;
  }
}
