:root {
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #17202a;
  background: #f4f7f8;
  --teal: #0b7568;
  --ink: #17202a;
  --muted: #65737d;
  --line: #dfe7ea;
  --soft: #edf4f2;
}
* { box-sizing: border-box; }
body { min-height: 100vh; margin: 0; display: grid; grid-template-columns: 240px minmax(0, 1fr); background: #f4f7f8; }
button, input { font: inherit; }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 20px; border-right: 1px solid var(--line); background: #fff; }
.brand { display: grid; gap: 4px; margin-bottom: 24px; }
.brand span, .page-head p { color: var(--teal); font-size: 12px; font-weight: 900; text-transform: uppercase; }
.brand strong { font-size: 20px; }
nav { display: grid; gap: 8px; }
nav button { min-height: 40px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); text-align: left; padding: 0 12px; font-weight: 850; cursor: pointer; gap: 10px; }
nav button.active { border-color: rgba(11, 117, 104, 0.3); background: var(--soft); color: var(--teal); }
main { padding: 22px; }
.hidden { display: none !important; }
.page-head { display: flex; justify-content: space-between; gap: 14px; align-items: end; margin-bottom: 18px; }
.page-head h1 { margin: 0; font-size: 28px; }
.page-head p { margin: 0 0 6px; }
.page-head a, button { min-height: 38px; border: 0; border-radius: 8px; padding: 0 14px; background: var(--teal); color: #fff; font-weight: 850; text-decoration: none; display: inline-flex; align-items: center; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.stats article, .panel, .table-card { border: 1px solid var(--line); border-radius: 8px; background: #fff; box-shadow: 0 8px 24px rgba(23, 32, 42, 0.06); }
.stats article { padding: 16px; }
.stats span, dt, th, .hint { color: var(--muted); }
.stats strong { display: block; margin-top: 6px; font-size: 24px; }
.grid { display: grid; gap: 14px; margin-bottom: 14px; }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel { padding: 16px; }
.panel h2 { margin: 0 0 12px; font-size: 18px; }
.stack { display: grid; gap: 12px; }
label { display: grid; gap: 6px; color: var(--muted); font-size: 13px; font-weight: 850; }
input { width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
dl { display: grid; gap: 10px; margin: 0; }
dl div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); padding-bottom: 8px; }
dd { margin: 0; font-weight: 850; }
.copy-line { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.hint { margin: 8px 0 0; line-height: 1.7; }
.balance { margin: 0; font-size: 24px; font-weight: 900; }
.security-panel { min-height: 100%; }
.security-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; align-items: start; }
.security-entry { display: grid; gap: 12px; }
.security-entry strong { font-size: 20px; line-height: 1.2; }
.security-entry .hint { margin: 0; }
.security-panel { grid-row: span 2; }
.orders-layout { display: grid; grid-template-columns: minmax(560px, 1.25fr) minmax(360px, 0.9fr); gap: 14px; align-items: start; }
.order-detail { position: sticky; top: 24px; }
.detail-kicker { margin: 0 0 4px; color: var(--teal); font-size: 12px; font-weight: 900; text-transform: uppercase; }
.order-detail .panel-title h2 { margin: 0; }
.order-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.order-meta div { display: grid; gap: 6px; min-height: 70px; border: 1px solid var(--line); border-radius: 8px; padding: 10px; background: #f8fbfb; }
.order-meta span, .detail-head span { color: var(--muted); font-size: 12px; font-weight: 850; }
.order-meta strong { overflow-wrap: anywhere; }
.detail-block { display: grid; gap: 10px; margin-top: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.detail-head { display: flex; justify-content: space-between; gap: 10px; align-items: center; }
.detail-head h3 { margin: 0; font-size: 15px; }
.detail-block pre { overflow: auto; margin: 0; border-radius: 8px; padding: 12px; background: #17202a; color: #f7fbfa; white-space: pre-wrap; overflow-wrap: anywhere; font: inherit; line-height: 1.7; }
.invoice-progress p { margin: 0; line-height: 1.6; }

.empty-cell {
  height: 76px;
  color: var(--muted);
  text-align: center;
}

.table-action { min-height: 32px; padding: 0 10px; white-space: nowrap; }
.table-action.active { background: var(--ink); }
.pagination-bar { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 10px; min-height: 58px; border-top: 1px solid var(--line); padding: 12px; }
.pagination-bar span { margin-right: auto; color: var(--muted); font-size: 13px; font-weight: 850; }
.pagination-bar button { min-height: 32px; padding: 0 10px; }
.pagination-bar button:disabled { cursor: not-allowed; background: #edf1f3; color: #94a2ab; }
.table-card { overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { white-space: nowrap; background: #f8fbfb; }
.tag { display: inline-block; border-radius: 999px; padding: 3px 8px; background: var(--soft); color: var(--teal); font-size: 12px; font-weight: 900; }
.warn { background: #fff3d7; color: #9a5a00; }
@media (max-width: 900px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .stats, .two-col { grid-template-columns: 1fr; }
}

body {
  grid-template-columns: 260px minmax(0, 1fr);
  background:
    linear-gradient(120deg, rgba(11, 117, 104, 0.07), transparent 34%),
    linear-gradient(230deg, rgba(217, 154, 43, 0.08), transparent 28%),
    #f4f7f8;
}

:root {
  --teal-dark: #07584f;
  --panel: #ffffff;
  --gold: #d99a2b;
  --rose: #b3475f;
  --blue: #315d8c;
  --shadow: 0 12px 30px rgba(23, 32, 42, 0.07);
}

.sidebar {
  display: grid;
  align-content: start;
  gap: 18px;
  width: 260px;
  background: rgba(255, 255, 255, 0.94);
}

.brand { padding-bottom: 4px; }
.brand strong { line-height: 1.2; }

.profile-card {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(11, 117, 104, 0.18);
  border-radius: 8px;
  padding: 12px;
  background: #f7fbfa;
}

.avatar {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
}

.profile-card strong,
.profile-card span { display: block; }
.profile-card span { margin-top: 3px; color: var(--muted); font-size: 12px; }

nav button { min-height: 42px; }

.nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  flex: 0 0 24px;
  place-items: center;
  border-radius: 7px;
  background: #edf1f3;
  color: var(--muted);
  font-size: 13px;
  font-weight: 950;
}

.nav-icon svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

nav button.active .nav-icon {
  background: var(--teal);
  color: #fff;
}

main {
  width: min(1280px, 100%);
  padding: 24px;
}

.page-head { margin-bottom: 16px; }
.page-head h1 { font-size: 30px; line-height: 1.15; }

.account-state,
.tag {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--soft);
  color: var(--teal);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.muted-tag { background: #edf1f3; color: var(--muted); }
.amber-tag { background: #fff3d7; color: #9a5a00; }

.account-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: end;
  margin-bottom: 14px;
  border: 1px solid rgba(11, 117, 104, 0.16);
  border-radius: 8px;
  padding: 20px;
  background: linear-gradient(135deg, #ffffff, #eff8f5);
  box-shadow: var(--shadow);
}

.account-hero span,
.table-head span { color: var(--muted); }

.account-hero strong {
  display: block;
  margin-top: 6px;
  font-size: 38px;
  line-height: 1;
}

.account-hero p {
  max-width: 520px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.primary-link {
  min-height: 38px;
  border-radius: 8px;
  padding: 0 14px;
  background: var(--teal);
  color: #fff;
  font-weight: 850;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

button:hover,
button:focus-visible,
.primary-link:hover,
.primary-link:focus-visible { background: var(--teal-dark); }

.stats article,
.panel,
.table-card {
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-title,
.table-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.table-head {
  padding: 14px 16px 0;
}

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

input:focus {
  outline: none;
  border-color: rgba(11, 117, 104, 0.5);
  box-shadow: 0 0 0 3px rgba(11, 117, 104, 0.11);
}

tbody tr:hover { background: #fbfdfd; }

.warn { background: #fff3d7; color: #9a5a00; }
.bad { background: #ffe7ec; color: var(--rose); }
.blue { background: #edf4fb; color: var(--blue); }

.nav-group {
  display: grid;
  gap: 7px;
}

.nav-group > span {
  padding: 8px 10px 1px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.secondary-link,
.ghost-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 14px;
  background: #fff;
  color: var(--ink);
  font-weight: 850;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.hero-actions,
.panel-actions,
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.overview-hero strong {
  max-width: 650px;
  font-size: 38px;
  line-height: 1.14;
}

.overview-grid,
.referral-layout {
  display: grid;
  gap: 14px;
  margin-bottom: 14px;
}

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

.overview-panel {
  display: grid;
  min-height: 236px;
  align-content: start;
  gap: 12px;
}

.overview-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.overview-panel > button {
  width: fit-content;
  margin-top: auto;
}

.metric-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fbfb;
}

.metric-row span { color: var(--muted); }
.account-panel { grid-column: span 3; }

.referral-layout {
  grid-template-columns: minmax(360px, 1.25fr) repeat(2, minmax(240px, 0.75fr));
}

.referral-link-panel { align-content: start; }
.referral-rule { background: linear-gradient(135deg, #fff, #fff8e9); }
.referral-rule .hint { margin-top: 0; }
.delivery-head { align-items: start; }
.delivery-head .detail-actions { justify-content: flex-end; }
.detail-actions span { width: 100%; text-align: right; }
.detail-actions button { min-height: 32px; padding: 0 10px; }

.detail-block pre.masked-delivery {
  border: 1px dashed rgba(11, 117, 104, 0.35);
  background: #f3f8f7;
  color: var(--muted);
}

.secondary-link:hover,
.secondary-link:focus-visible,
.ghost-button:hover,
.ghost-button:focus-visible {
  border-color: rgba(11, 117, 104, 0.28);
  background: var(--soft);
  color: var(--teal);
}

button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  border-color: var(--line);
  background: #edf1f3;
  color: #94a2ab;
}

.form-error {
  margin: -2px 0 0;
  border: 1px solid rgba(179, 71, 95, 0.22);
  border-radius: 8px;
  padding: 10px 12px;
  background: #ffe7ec;
  color: var(--rose);
  font-size: 13px;
  font-weight: 850;
}

input.input-error {
  border-color: rgba(179, 71, 95, 0.55);
  box-shadow: 0 0 0 3px rgba(179, 71, 95, 0.12);
}

@media (max-width: 980px) {
  body { grid-template-columns: 1fr; }
  .sidebar { position: static; width: auto; height: auto; }
  main { padding: 16px; }
  .stats, .two-col { grid-template-columns: 1fr; }
  .account-hero, .page-head { align-items: start; flex-direction: column; }
  .copy-line, .orders-layout, .security-grid, .overview-grid, .referral-layout { grid-template-columns: 1fr; }
  .account-panel { grid-column: auto; }
  .overview-panel { min-height: auto; }
  .overview-hero strong { font-size: 28px; }
  .delivery-head .detail-actions { justify-content: flex-start; }
  .detail-actions span { text-align: left; }
  .order-detail { position: static; }
  .security-panel { grid-row: auto; }
}
