:root {
  color-scheme: light;
  --primary: #5a55e7;
  --primary-dark: #4540c7;
  --primary-soft: #eeedff;
  --accent: #16a977;
  --accent-soft: #e8f9f2;
  --danger: #e04461;
  --danger-soft: #fff0f3;
  --warning: #d78914;
  --warning-soft: #fff7e8;
  --ink: #1f2230;
  --muted: #737786;
  --line: #e7e8ee;
  --canvas: #f6f7fa;
  --surface: #fff;
  --shadow: 0 18px 55px rgba(34, 36, 54, 0.12);
  font-family: Inter, "Segoe UI", "Microsoft YaHei UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-width: 320px; scroll-behavior: smooth; }
body { min-height: 100vh; margin: 0; background: var(--canvas); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(90, 85, 231, 0.2);
  outline-offset: 2px;
}

.site-shell { display: flex; min-height: 100vh; flex-direction: column; }
.site-header {
  position: sticky;
  z-index: 30;
  top: 0;
  display: grid;
  min-height: 76px;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: center;
  gap: 22px;
  padding: 12px max(24px, calc((100vw - 1380px) / 2));
  border-bottom: 1px solid rgba(229, 230, 237, 0.9);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
}

.brand, .account-nav, .main-nav, .hero-actions, .metric-row, .card-top, .card-meta,
.card-actions, .page-heading, .status-line, .detail-row, .tabs, .form-actions,
.table-user, .setting-row, .site-footer > div, .balance-line { display: flex; align-items: center; }

.brand { width: fit-content; gap: 11px; }
.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(145deg, #665ff3, #4b47d4);
  box-shadow: 0 8px 19px rgba(90, 85, 231, 0.24);
}
.brand-mark svg { width: 29px; height: 29px; fill: none; stroke: #fff; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; font-weight: 760; }
.brand small { margin-top: 3px; color: #9a9daa; font-size: 9px; letter-spacing: 1.1px; text-transform: uppercase; }
.main-nav { gap: 4px; }
.main-nav a { padding: 9px 13px; border-radius: 9px; color: #5d6170; font-size: 13px; font-weight: 600; }
.main-nav a:hover { background: #f3f3f7; color: var(--ink); }
.account-nav { justify-content: flex-end; gap: 8px; }
.account-summary { display: grid; margin-right: 5px; text-align: right; }
.account-summary strong { font-size: 12px; }
.account-summary span { margin-top: 3px; color: var(--accent); font-size: 11px; font-weight: 650; }

.button {
  display: inline-flex;
  min-height: 39px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 680;
  transition: transform 150ms ease, background 150ms ease, border-color 150ms ease, box-shadow 150ms ease;
}
.button:hover:not(:disabled) { transform: translateY(-1px); }
.button:active:not(:disabled) { transform: translateY(0); }
.button:disabled { cursor: not-allowed; opacity: 0.55; }
.button-primary { background: var(--primary); color: #fff; box-shadow: 0 7px 18px rgba(90, 85, 231, 0.18); }
.button-primary:hover:not(:disabled) { background: var(--primary-dark); box-shadow: 0 9px 24px rgba(90, 85, 231, 0.25); }
.button-ghost { border-color: var(--line); background: #fff; color: #565a68; }
.button-ghost:hover:not(:disabled) { border-color: #d5d6df; background: #f9f9fb; }
.button-danger { background: var(--danger); color: #fff; }
.button-success { background: var(--accent); color: #fff; }
.button-small { min-height: 32px; padding: 0 10px; border-radius: 8px; font-size: 11px; }

main { width: 100%; max-width: 1440px; flex: 1; margin: 0 auto; padding: 30px 30px 55px; }
.hero {
  position: relative;
  overflow: hidden;
  min-height: 330px;
  padding: 55px 58px;
  border: 1px solid #e5e4ff;
  border-radius: 26px;
  background: linear-gradient(125deg, #f4f2ff 0%, #fff 48%, #eafaf4 100%);
}
.hero::before, .hero::after { position: absolute; border-radius: 50%; content: ""; filter: blur(2px); }
.hero::before { top: -120px; right: 120px; width: 280px; height: 280px; background: rgba(102, 95, 243, 0.1); }
.hero::after { right: -90px; bottom: -140px; width: 320px; height: 320px; background: rgba(22, 169, 119, 0.1); }
.hero-content { position: relative; z-index: 1; max-width: 700px; }
.eyebrow { display: inline-flex; padding: 6px 10px; border-radius: 999px; background: #fff; color: var(--primary); box-shadow: 0 5px 16px rgba(60, 58, 110, 0.08); font-size: 11px; font-weight: 750; letter-spacing: 0.4px; }
.hero h1 { max-width: 680px; margin: 20px 0 14px; font-size: clamp(34px, 4.2vw, 58px); line-height: 1.09; letter-spacing: -2px; }
.gradient-text { background: linear-gradient(90deg, var(--primary), #8b4fdb, var(--accent)); background-clip: text; color: transparent; }
.hero p { max-width: 620px; margin: 0; color: var(--muted); font-size: 14px; line-height: 1.85; }
.hero-actions { gap: 10px; margin-top: 25px; }
.hero-points { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 25px; }
.hero-point { padding: 12px 14px; border: 1px solid rgba(226, 226, 236, 0.9); border-radius: 12px; background: rgba(255,255,255,.68); }
.hero-point strong, .hero-point span { display: block; }
.hero-point strong { font-size: 12px; }
.hero-point span { margin-top: 5px; color: var(--muted); font-size: 10px; }

.section { margin-top: 28px; padding: 25px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: 0 7px 25px rgba(35, 37, 52, 0.045); }
.page-heading { justify-content: space-between; gap: 20px; margin-bottom: 21px; }
.page-heading h1, .page-heading h2, .auth-panel h1 { margin: 0; letter-spacing: -0.4px; }
.page-heading h1 { font-size: 25px; }
.page-heading h2 { font-size: 18px; }
.page-heading p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.search { width: 280px; height: 39px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fafafd; font-size: 12px; }
.search:focus { border-color: #aaa6f7; outline: 0; box-shadow: 0 0 0 3px rgba(90,85,231,.09); }

.service-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.service-card { display: flex; min-height: 205px; flex-direction: column; padding: 18px; border: 1px solid var(--line); border-radius: 16px; background: #fff; transition: transform 160ms ease, border-color 160ms ease, box-shadow 160ms ease; }
.service-card:hover { border-color: #d9d7ff; box-shadow: 0 11px 29px rgba(50, 48, 100, 0.09); transform: translateY(-2px); }
.card-top { align-items: flex-start; justify-content: space-between; gap: 10px; }
.service-icon { display: grid; width: 43px; height: 43px; place-items: center; border-radius: 13px; background: var(--primary-soft); color: var(--primary); font-size: 15px; font-weight: 780; }
.availability { padding: 4px 7px; border-radius: 999px; background: var(--accent-soft); color: #14825e; font-size: 9px; font-weight: 700; }
.service-card h3 { margin: 14px 0 6px; font-size: 14px; }
.card-meta { flex-wrap: wrap; gap: 6px; }
.chip { padding: 4px 7px; border-radius: 7px; background: #f4f4f7; color: #6b6f7b; font-size: 10px; }
.card-actions { justify-content: space-between; gap: 12px; margin-top: auto; padding-top: 16px; }
.price { display: grid; }
.price span { color: var(--muted); font-size: 9px; }
.price strong { margin-top: 2px; color: var(--primary-dark); font-size: 20px; }

.auth-layout { display: grid; min-height: 610px; grid-template-columns: 1.1fr .9fr; overflow: hidden; border: 1px solid var(--line); border-radius: 24px; background: #fff; box-shadow: var(--shadow); }
.auth-aside { display: grid; padding: 55px; place-content: center; background: linear-gradient(145deg, #5752de, #3733a9); color: #fff; }
.auth-aside h2 { max-width: 430px; margin: 0 0 12px; font-size: 37px; letter-spacing: -1.2px; }
.auth-aside p { max-width: 450px; margin: 0; color: rgba(255,255,255,.72); font-size: 13px; line-height: 1.8; }
.auth-features { display: grid; gap: 10px; margin-top: 26px; }
.auth-feature { padding: 11px 13px; border: 1px solid rgba(255,255,255,.15); border-radius: 10px; background: rgba(255,255,255,.07); font-size: 11px; }
.auth-panel { display: grid; padding: 52px; place-content: center; }
.auth-panel form { width: min(360px, 100%); }
.auth-panel h1 { font-size: 25px; }
.auth-panel > div > p { margin: 8px 0 23px; color: var(--muted); font-size: 12px; }

.field { display: grid; gap: 7px; margin-bottom: 14px; }
.field span { color: #565a67; font-size: 11px; font-weight: 680; }
.field input, .field select, .field textarea { width: 100%; border: 1px solid #dddfe6; border-radius: 9px; background: #fff; color: var(--ink); font-size: 12px; }
.field input, .field select { height: 41px; padding: 0 11px; }
.field textarea { min-height: 85px; padding: 10px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: #9d99f6; outline: 0; box-shadow: 0 0 0 3px rgba(90,85,231,.08); }
.form-actions { justify-content: flex-end; gap: 8px; margin-top: 18px; }
.form-actions .button-primary { min-width: 120px; }
.form-hint { margin-top: 15px; color: var(--muted); font-size: 11px; text-align: center; }
.form-hint a { color: var(--primary); font-weight: 650; }
.form-error { margin-bottom: 13px; padding: 10px 12px; border-radius: 9px; background: var(--danger-soft); color: var(--danger); font-size: 11px; }

.metric-row { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; margin-bottom: 20px; }
.metric { padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.metric span, .metric strong { display: block; }
.metric span { color: var(--muted); font-size: 10px; }
.metric strong { margin-top: 7px; font-size: 23px; }
.metric-accent { border-color: #dcefe8; background: linear-gradient(135deg, #f4fffb, #fff); }
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .75fr); gap: 18px; }
.list { display: grid; gap: 9px; }
.order-row { display: grid; grid-template-columns: minmax(170px, 1.3fr) minmax(120px, .8fr) 115px 100px; align-items: center; gap: 12px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 11px; background: #fff; font-size: 11px; }
.order-row:hover { border-color: #d9d7ff; }
.order-title strong, .order-title span { display: block; }
.order-title span { margin-top: 4px; color: var(--muted); font-size: 9px; }
.status { display: inline-flex; width: fit-content; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 999px; font-size: 9px; font-weight: 720; }
.status::before { width: 6px; height: 6px; border-radius: 50%; background: currentColor; content: ""; }
.status-wait { background: var(--warning-soft); color: var(--warning); }
.status-success { background: var(--accent-soft); color: var(--accent); }
.status-danger { background: var(--danger-soft); color: var(--danger); }
.status-neutral { background: #f1f2f5; color: #777b87; }
.ledger-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; padding: 12px 0; border-bottom: 1px solid #f0f0f3; font-size: 11px; }
.ledger-row:last-child { border-bottom: 0; }
.ledger-row span { display: block; color: var(--muted); font-size: 9px; margin-top: 3px; }
.amount-positive { color: var(--accent); }
.amount-negative { color: var(--danger); }

.activation-card { max-width: 760px; margin: 30px auto; padding: 28px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: var(--shadow); }
.activation-hero { padding: 23px; border-radius: 15px; background: linear-gradient(135deg, var(--primary-soft), #f9f9ff); text-align: center; }
.activation-hero span { color: var(--muted); font-size: 10px; }
.activation-hero strong { display: block; margin-top: 8px; font-family: "Cascadia Mono", Consolas, monospace; font-size: 30px; letter-spacing: 1px; user-select: all; }
.code-box { margin-top: 14px; padding: 18px; border: 1px dashed #b8b5f8; border-radius: 13px; background: #fbfaff; text-align: center; }
.code-box strong { display: block; color: var(--primary-dark); font-family: "Cascadia Mono", Consolas, monospace; font-size: 28px; letter-spacing: 4px; user-select: all; }
.code-box span { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; }
.detail-list { margin-top: 17px; }
.detail-row { justify-content: space-between; gap: 20px; padding: 11px 2px; border-bottom: 1px solid #f0f0f3; font-size: 11px; }
.detail-row span { color: var(--muted); }
.detail-row strong { text-align: right; }
.pulse { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--warning); animation: pulse 1.5s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(215,137,20,0); } 0%,100% { box-shadow: 0 0 0 0 rgba(215,137,20,.25); } }

.tabs { gap: 5px; margin-bottom: 20px; padding: 5px; border-radius: 11px; background: #f1f2f6; }
.tab { flex: 1; padding: 9px 10px; border: 0; border-radius: 8px; background: transparent; color: #686c79; cursor: pointer; font-size: 11px; font-weight: 680; }
.tab.active { background: #fff; color: var(--primary); box-shadow: 0 3px 12px rgba(35,37,52,.07); }
.admin-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 17px; }
.admin-card { padding: 20px; border: 1px solid var(--line); border-radius: 15px; background: #fff; }
.admin-card h3 { margin: 0 0 16px; font-size: 14px; }
.setting-row { justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px solid #f0f0f3; }
.setting-row:last-child { border-bottom: 0; }
.setting-row strong, .setting-row small { display: block; }
.setting-row strong { font-size: 11px; }
.setting-row small { margin-top: 3px; color: var(--muted); font-size: 9px; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 10px; }
.data-table th, .data-table td { padding: 11px 9px; border-bottom: 1px solid #eeeef2; text-align: left; white-space: nowrap; }
.data-table th { color: var(--muted); font-weight: 650; }
.data-table td { color: #4e5260; }
.inline-actions { display: flex; gap: 5px; }

.empty { display: grid; min-height: 220px; place-content: center; padding: 25px; color: var(--muted); text-align: center; }
.empty strong { color: var(--ink); font-size: 14px; }
.empty p { max-width: 420px; margin: 7px auto 0; font-size: 11px; line-height: 1.6; }
.page-loading { display: grid; min-height: 420px; place-content: center; color: var(--muted); text-align: center; font-size: 11px; }
.spinner { display: inline-block; width: 19px; height: 19px; border: 2px solid rgba(90,85,231,.17); border-top-color: var(--primary); border-radius: 50%; animation: spin .75s linear infinite; }
.page-loading .spinner { width: 30px; height: 30px; margin: auto; }
@keyframes spin { to { transform: rotate(360deg); } }

.modal { position: fixed; z-index: 100; inset: 0; display: grid; overflow-y: auto; place-items: center; padding: 28px; }
.modal-backdrop { position: fixed; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(22,24,35,.48); backdrop-filter: blur(3px); }
.modal-panel { position: relative; z-index: 1; width: min(540px, 100%); max-height: calc(100vh - 56px); overflow-y: auto; padding: 26px; border-radius: 18px; background: #fff; box-shadow: var(--shadow); }
.modal-panel h2 { margin: 0 0 6px; font-size: 19px; }
.modal-panel > p { margin: 0 0 20px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.modal-close { position: absolute; top: 15px; right: 15px; width: 32px; height: 32px; border: 0; border-radius: 50%; background: #f2f2f5; color: #747784; cursor: pointer; }
.notice { margin: 13px 0; padding: 10px 12px; border-radius: 9px; background: var(--warning-soft); color: #936217; font-size: 10px; line-height: 1.6; }
.toast-region { position: fixed; z-index: 200; top: 90px; right: 22px; display: grid; width: min(350px, calc(100vw - 44px)); gap: 8px; }
.toast { padding: 12px 14px; border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 10px; background: #fff; box-shadow: 0 10px 30px rgba(35,37,52,.14); font-size: 11px; line-height: 1.5; }
.toast.error { border-left-color: var(--danger); }

.site-footer { display: flex; min-height: 86px; align-items: center; justify-content: space-between; gap: 25px; padding: 18px max(30px, calc((100vw - 1380px) / 2)); border-top: 1px solid var(--line); background: #fff; }
.site-footer > div { gap: 10px; }
.site-footer strong { font-size: 12px; }
.site-footer span, .site-footer p { color: var(--muted); font-size: 9px; }
.site-footer p { margin: 0; text-align: right; }

@media (max-width: 1050px) {
  .site-header { grid-template-columns: 1fr auto; }
  .main-nav { display: none; }
  .service-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .metric-row { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .site-header { min-height: 68px; padding: 10px 15px; }
  .brand small, .account-summary { display: none; }
  .account-nav .button { min-height: 35px; padding: 0 10px; }
  main { padding: 18px 13px 35px; }
  .hero { min-height: auto; padding: 34px 25px; border-radius: 19px; }
  .hero h1 { font-size: 34px; letter-spacing: -1px; }
  .hero-points { grid-template-columns: 1fr; }
  .service-grid, .admin-grid { grid-template-columns: 1fr; }
  .section { padding: 18px; border-radius: 16px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .search { width: 100%; }
  .auth-layout { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .auth-panel { min-height: 540px; padding: 30px 22px; }
  .order-row { grid-template-columns: 1fr auto; }
  .order-row > *:nth-child(2) { display: none; }
  .metric-row { grid-template-columns: 1fr 1fr; }
  .site-footer { align-items: flex-start; flex-direction: column; padding: 20px 16px; }
  .site-footer p { text-align: left; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
