:root {
  --ink: #20262e;
  --muted: #687281;
  --soft: #f4f7f6;
  --soft-2: #edf3f1;
  --surface: #ffffff;
  --line: #dde5e2;
  --teal: #0f8f83;
  --teal-dark: #0b6f66;
  --deep-teal: #113d3a;
  --coral: #d95c45;
  --gold: #b8872e;
  --sky: #256f9c;
  --green: #307a59;
  --danger: #b42318;
  --shadow: 0 14px 36px rgba(30, 43, 52, 0.1);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--soft);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  letter-spacing: 0;
  text-rendering: optimizeLegibility;
}

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

button {
  cursor: pointer;
}

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

a {
  color: inherit;
}

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

.hidden {
  display: none !important;
}

.primary-btn,
.ghost-btn,
.danger-btn,
.link-btn {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 700;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.primary-btn {
  background: var(--teal);
  color: #fff;
  box-shadow: 0 8px 18px rgba(15, 143, 131, 0.18);
}

.primary-btn:hover {
  background: var(--teal-dark);
  transform: translateY(-1px);
}

.ghost-btn {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.ghost-btn:hover {
  border-color: rgba(15, 143, 131, 0.35);
  box-shadow: 0 8px 18px rgba(30, 43, 52, 0.08);
}

.danger-btn {
  background: #fff6f4;
  border-color: #f3c6be;
  color: var(--danger);
}

.link-btn {
  min-height: auto;
  border: 0;
  background: transparent;
  color: var(--teal);
  padding: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 11px;
  border: 1px solid rgba(15, 143, 131, 0.18);
  background: #eef9f7;
  color: var(--teal-dark);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  z-index: 1000;
  transform: translateX(-50%) translateY(20px);
  max-width: min(420px, calc(100vw - 32px));
  padding: 11px 14px;
  border-radius: 8px;
  background: rgba(32, 38, 46, 0.94);
  color: #fff;
  font-size: 14px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.h5-body {
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(15, 143, 131, 0.11), transparent 340px),
    linear-gradient(90deg, rgba(217, 92, 69, 0.08), transparent 40%),
    var(--soft);
}

.h5-shell {
  width: 100%;
  min-height: 100vh;
  margin: 0 auto;
  background: transparent;
  display: flex;
  flex-direction: column;
}

.h5-top {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(250, 252, 251, 0.94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
  padding: 14px 16px 11px;
}

.brand-row,
.section-title,
.card-head,
.admin-topbar,
.form-actions,
.table-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-name {
  margin: 0;
  font-size: 21px;
  line-height: 1.2;
  font-weight: 850;
}

.brand-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.h5-main {
  flex: 1;
  padding: 14px 14px 104px;
}

.h5-page {
  display: none;
}

.h5-page.active {
  display: block;
}

.market-hero {
  display: grid;
  gap: 16px;
  margin-bottom: 16px;
  border: 1px solid rgba(17, 61, 58, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(17, 61, 58, 0.98), rgba(15, 113, 104, 0.94)),
    var(--deep-teal);
  color: #fff;
  overflow: hidden;
  padding: 20px;
  box-shadow: 0 18px 42px rgba(17, 61, 58, 0.16);
}

.market-kicker {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.14);
  color: #dcf7f2;
  font-size: 12px;
  font-weight: 800;
}

.market-copy h2 {
  margin: 12px 0 8px;
  font-size: 26px;
  line-height: 1.18;
}

.market-copy p {
  max-width: 640px;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  line-height: 1.7;
}

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

.market-stats div {
  min-height: 78px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
  padding: 12px;
}

.market-stats span {
  display: block;
  color: rgba(255, 255, 255, 0.72);
  font-size: 12px;
}

.market-stats strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  line-height: 1;
}

.quote-toolbar,
.news-toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 14px;
}

.search-input,
.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.55;
}

.search-input:focus,
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 143, 131, 0.12);
}

.chip-scroll {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 0 14px;
  scrollbar-width: none;
}

.chip-scroll::-webkit-scrollbar {
  display: none;
}

.chip {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  padding: 0 14px;
  white-space: nowrap;
  box-shadow: 0 5px 14px rgba(30, 43, 52, 0.04);
}

.chip.active {
  background: var(--deep-teal);
  border-color: rgba(15, 143, 131, 0.4);
  color: #fff;
  font-weight: 700;
}

.quote-list,
.news-list,
.plan-list,
.order-list {
  display: grid;
  gap: 12px;
}

.quote-card,
.news-card,
.profile-block,
.plan-card,
.order-card,
.panel,
.stat-card {
  border: 1px solid rgba(208, 219, 216, 0.9);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(30, 43, 52, 0.07);
}

.quote-card,
.news-card,
.profile-block,
.plan-card,
.order-card {
  padding: 16px;
}

.quote-card,
.news-card,
.plan-card,
.order-card {
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.quote-card:hover,
.news-card:hover,
.plan-card:hover,
.order-card:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 143, 131, 0.28);
  box-shadow: 0 16px 34px rgba(30, 43, 52, 0.1);
}

.quote-card h3,
.news-card h3,
.plan-card h3 {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
  font-weight: 800;
}

.quote-meta,
.news-meta,
.profile-meta,
.order-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 9px 0;
  color: var(--muted);
  font-size: 12px;
}

.price-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #eef2f1;
}

.price-main {
  color: var(--coral);
  font-size: 24px;
  font-weight: 800;
}

.member-price {
  color: var(--green);
  font-size: 13px;
}

.trend-up {
  color: var(--coral);
}

.trend-down {
  color: var(--sky);
}

.trend-stable {
  color: var(--gold);
}

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fff;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 8px 12px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(251, 252, 252, 0.96);
  backdrop-filter: blur(16px);
}

.nav-tab {
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  padding: 10px 6px;
  font-size: 13px;
  font-weight: 700;
}

.nav-tab.active {
  background: var(--deep-teal);
  color: #fff;
  box-shadow: 0 8px 18px rgba(17, 61, 58, 0.18);
}

.profile-hero {
  display: grid;
  gap: 10px;
}

.profile-block strong {
  display: block;
  font-size: 20px;
}

.status-line {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.plan-card {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 14px;
}

.plan-price {
  color: var(--coral);
  font-size: 22px;
  font-weight: 800;
  text-align: right;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  align-items: flex-end;
  justify-content: center;
  background: rgba(24, 32, 38, 0.42);
  padding: 16px;
}

.modal-backdrop.show {
  display: flex;
}

.modal {
  width: min(520px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.modal-head {
  position: sticky;
  top: 0;
  background: #fff;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.modal-body {
  padding: 16px;
}

.modal-head h2 {
  margin: 0;
  font-size: 18px;
}

.close-btn {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 20px;
  line-height: 1;
}

.login-form,
.settings-grid,
.form-grid {
  display: grid;
  gap: 12px;
}

.code-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.pay-box {
  text-align: center;
}

.pay-box img {
  display: block;
  width: 220px;
  max-width: 100%;
  height: auto;
  margin: 10px auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.detail-content {
  white-space: pre-wrap;
  line-height: 1.75;
  color: #38424c;
}

.admin-body {
  min-height: 100vh;
  background: #f6f8fa;
}

.admin-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-panel {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 26px;
}

.login-panel h1 {
  margin: 0 0 8px;
  font-size: 24px;
}

.admin-shell {
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 18px 14px;
}

.sidebar h1 {
  margin: 0 0 18px;
  font-size: 20px;
}

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

.admin-nav button {
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  text-align: left;
  padding: 0 12px;
  font-weight: 700;
}

.admin-nav button.active {
  background: #e8f5f2;
  color: var(--teal-dark);
}

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

.admin-topbar {
  margin-bottom: 16px;
}

.admin-topbar h2 {
  margin: 0;
  font-size: 22px;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 14px;
}

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

.stat-card {
  padding: 14px;
}

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

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 22px;
}

.panel {
  padding: 16px;
  overflow: hidden;
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 17px;
}

.form-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
}

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

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: #47515d;
  font-size: 13px;
  font-weight: 700;
}

.field.full {
  grid-column: 1 / -1;
}

.field.span-2 {
  grid-column: span 2;
}

.switch-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  background: #fff;
}

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

th {
  color: #47515d;
  background: #f9fbfb;
  white-space: nowrap;
}

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

.table-actions {
  justify-content: flex-start;
}

.small-btn {
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 9px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.small-btn.danger {
  color: var(--danger);
  border-color: #f3c6be;
  background: #fff6f4;
}

.small-btn.good {
  color: var(--teal-dark);
  border-color: rgba(15, 143, 131, 0.35);
  background: #eef9f7;
}

.status-tag {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  border-radius: 999px;
  padding: 0 8px;
  font-size: 12px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
}

.status-tag.on {
  background: #eef9f7;
  border-color: rgba(15, 143, 131, 0.28);
  color: var(--teal-dark);
}

.status-tag.off {
  background: #fff6f4;
  border-color: #f3c6be;
  color: var(--danger);
}

.admin-note {
  color: var(--muted);
  line-height: 1.65;
  font-size: 13px;
}

@media (min-width: 760px) {
  .h5-shell {
    box-shadow: none;
  }

  .h5-top {
    padding: 18px 24px 16px;
  }

  .h5-top > .brand-row,
  .h5-top > .quote-meta,
  .h5-main {
    width: 100%;
    max-width: 1180px;
    margin-left: auto;
    margin-right: auto;
  }

  .brand-name {
    font-size: 24px;
  }

  .brand-sub {
    font-size: 13px;
  }

  .h5-main {
    padding: 24px 24px 110px;
  }

  .market-hero {
    grid-template-columns: minmax(0, 1.35fr) minmax(360px, 0.65fr);
    align-items: end;
    padding: 28px;
    margin-bottom: 20px;
  }

  .market-copy h2 {
    font-size: 34px;
  }

  .quote-toolbar,
  .news-toolbar {
    width: min(720px, 100%);
    grid-template-columns: minmax(0, 1fr) auto;
    margin-bottom: 14px;
  }

  .chip-scroll {
    flex-wrap: wrap;
    overflow: visible;
  }

  .quote-list {
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 16px;
  }

  .news-list {
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 16px;
  }

  .profile-hero {
    grid-template-columns: minmax(280px, 0.8fr) minmax(0, 1.2fr);
    align-items: start;
    gap: 14px;
  }

  .profile-hero > .profile-block:first-child {
    position: sticky;
    top: 104px;
    grid-row: span 2;
  }

  .plan-list,
  .order-list {
    gap: 12px;
  }

}

@media (min-width: 1060px) {
  .bottom-nav {
    top: 16px;
    bottom: auto;
    left: 50%;
    right: auto;
    transform: translateX(-50%);
    width: 360px;
    margin: 0;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 12px 30px rgba(30, 43, 52, 0.1);
    padding: 7px;
  }
}

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

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .admin-nav button {
    text-align: center;
  }

  .stat-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .h5-shell {
    width: 100%;
    box-shadow: none;
  }

  .market-hero {
    padding: 18px;
  }

  .market-copy h2 {
    font-size: 24px;
  }

  .market-copy p {
    font-size: 14px;
  }

  .market-stats {
    gap: 8px;
  }

  .market-stats div {
    min-height: 70px;
    padding: 10px;
  }

  .market-stats strong {
    font-size: 20px;
  }

  .quote-toolbar,
  .news-toolbar,
  .code-row,
  .plan-card {
    grid-template-columns: 1fr;
  }

  .plan-price {
    text-align: left;
  }

  .admin-main {
    padding: 14px;
  }

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

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

  .field.span-2 {
    grid-column: 1;
  }

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