:root {
  --ink: #10213e;
  --muted: #74829a;
  --line: rgba(35, 74, 132, 0.12);
  --panel: rgba(255, 255, 255, 0.92);
  --navy: #071b58;
  --blue: #2364dc;
  --cyan: #05bff4;
  --green: #19a980;
  --amber: #f4b23b;
  --danger: #df5b65;
  --shadow: 0 18px 50px rgba(14, 41, 91, 0.1);
  --radius: 22px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: #edf3fb; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
  background:
    radial-gradient(circle at 12% 8%, rgba(0, 191, 244, 0.13), transparent 27rem),
    radial-gradient(circle at 92% 2%, rgba(35, 100, 220, 0.12), transparent 30rem),
    linear-gradient(180deg, #f7faff 0%, #edf3fb 100%);
  overflow-x: hidden;
}

button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
[hidden] { display: none !important; }

.ambient {
  position: fixed;
  pointer-events: none;
  border-radius: 999px;
  filter: blur(20px);
  opacity: 0.7;
  z-index: 0;
}
.ambient-a { width: 21rem; height: 21rem; left: -10rem; top: 25%; background: rgba(5, 191, 244, 0.1); }
.ambient-b { width: 26rem; height: 26rem; right: -12rem; bottom: -8rem; background: rgba(35, 100, 220, 0.1); }

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(5, 19, 52, 0.94), rgba(8, 42, 98, 0.92)),
    radial-gradient(circle at 70% 20%, rgba(5, 191, 244, 0.25), transparent 36rem);
  color: #fff;
}
.login-gate::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.03) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(to bottom, #000, transparent 90%);
}
.login-card {
  position: relative;
  width: min(480px, 100%);
  padding: 42px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 30px;
  background: linear-gradient(160deg, rgba(255,255,255,.13), rgba(255,255,255,.055));
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(20px);
}
.login-logo { width: 184px; height: auto; display: block; filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.2)); }
.eyebrow {
  display: block;
  margin-top: 34px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: #7ee6ff;
}
.login-card h1 { margin: 12px 0 14px; font-size: clamp(34px, 5vw, 54px); line-height: 1.08; letter-spacing: -0.045em; }
.login-card p { margin: 0 0 28px; color: rgba(255,255,255,.72); line-height: 1.8; font-size: 14px; }
.login-help { display: block; margin-top: 20px; text-align: center; color: rgba(255,255,255,.58); font-size: 13px; }

.app-shell {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 244px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 26px 18px 20px;
  display: flex;
  flex-direction: column;
  background: rgba(255, 255, 255, 0.82);
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.brand { padding: 4px 10px 26px; }
.brand img { width: 156px; height: auto; display: block; }
.side-nav { display: grid; gap: 5px; }
.nav-item {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 13px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: #64738c;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  transition: 0.2s ease;
}
.nav-item:hover { color: var(--blue); background: rgba(35, 100, 220, 0.06); transform: translateX(2px); }
.nav-item.active { color: #fff; background: linear-gradient(135deg, var(--navy), #1648a4); box-shadow: 0 12px 24px rgba(20, 64, 155, 0.22); }
.nav-ico {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(35, 100, 220, 0.08);
  font-size: 15px;
}
.nav-item.active .nav-ico { background: rgba(255,255,255,.12); }
.side-foot { margin-top: auto; display: grid; gap: 8px; padding: 18px 10px 0; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.side-foot a, .side-foot button { border: 0; background: transparent; padding: 6px 0; text-align: left; color: inherit; }

.workspace { min-width: 0; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 92px;
  padding: 20px clamp(20px, 3vw, 42px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  background: rgba(247, 250, 255, 0.8);
  border-bottom: 1px solid rgba(35, 74, 132, 0.08);
  backdrop-filter: blur(20px);
}
.topbar-kicker { font-size: 10px; font-weight: 800; letter-spacing: .15em; color: #8b9ab0; }
.topbar h2 { margin: 5px 0 0; font-size: clamp(22px, 2.4vw, 32px); letter-spacing: -0.035em; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.balance-pill, .wallet-chip {
  min-height: 44px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.8);
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 6px 18px rgba(17, 49, 104, 0.04);
}
.balance-pill span { font-size: 10px; font-weight: 800; color: var(--muted); }
.balance-pill strong { font-family: "DIN Alternate", "Avenir Next", sans-serif; font-size: 16px; }
.wallet-chip { color: var(--ink); font-size: 12px; font-weight: 700; }
.wallet-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(25,169,128,.1); }
.view { padding: clamp(18px, 2.6vw, 38px); max-width: 1550px; margin: 0 auto; }

.mobile-nav { display: none; }
.hero-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(300px, .85fr); gap: 20px; }
.panel {
  background: var(--panel);
  border: 1px solid rgba(35, 74, 132, 0.1);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero-card {
  position: relative;
  overflow: hidden;
  min-height: 278px;
  padding: clamp(26px, 3vw, 42px);
  color: #fff;
  background:
    radial-gradient(circle at 88% 15%, rgba(5, 191, 244, 0.38), transparent 25rem),
    linear-gradient(132deg, #071b58, #123e91 60%, #1560bc);
}
.hero-card::after {
  content: "";
  position: absolute;
  width: 310px;
  height: 310px;
  right: -100px;
  bottom: -185px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 50%;
  box-shadow: 0 0 0 36px rgba(255,255,255,.025), 0 0 0 72px rgba(255,255,255,.018);
}
.hero-card h1 { margin: 14px 0 8px; font-size: clamp(34px, 5vw, 62px); letter-spacing: -0.06em; line-height: 1; }
.hero-card h1 small { font-size: 15px; letter-spacing: 0; color: rgba(255,255,255,.67); margin-left: 8px; }
.hero-card p { max-width: 550px; margin: 0; color: rgba(255,255,255,.68); line-height: 1.7; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 26px; position: relative; z-index: 2; }
.metric-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 28px; position: relative; z-index: 2; }
.metric { padding: 14px 16px; border-radius: 16px; background: rgba(255,255,255,.09); border: 1px solid rgba(255,255,255,.11); }
.metric span { display: block; font-size: 11px; color: rgba(255,255,255,.55); }
.metric strong { display: block; margin-top: 6px; font-family: "DIN Alternate", sans-serif; font-size: 20px; }

.stack { display: grid; gap: 20px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 4px 0 14px; }
.section-head h3 { margin: 0; font-size: 20px; letter-spacing: -0.03em; }
.section-head p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.panel-pad { padding: 22px; }
.asset-mini { min-height: 124px; padding: 18px; display: flex; flex-direction: column; justify-content: space-between; }
.asset-mini .asset-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.asset-mini .asset-value { font-family: "DIN Alternate", sans-serif; font-size: clamp(24px, 2.6vw, 34px); letter-spacing: -.03em; }
.asset-symbol { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; color: #fff; background: linear-gradient(135deg, var(--blue), var(--cyan)); font-size: 10px; font-weight: 800; }

.btn {
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  font-size: 13px;
  transition: .18s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.btn-primary { background: linear-gradient(135deg, var(--blue), #3086f5); color: #fff; box-shadow: 0 12px 24px rgba(35,100,220,.2); }
.btn-cyan { background: linear-gradient(135deg, #07b9ec, #37d8ff); color: #052c53; }
.btn-ghost { background: rgba(35,100,220,.07); color: var(--blue); border-color: rgba(35,100,220,.1); }
.btn-outline { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-danger { background: rgba(223,91,101,.1); color: var(--danger); border-color: rgba(223,91,101,.12); }
.btn-sm { padding: 7px 11px; border-radius: 10px; font-size: 11px; }
.btn-lg { width: 100%; min-height: 54px; border-radius: 16px; font-size: 15px; }

.package-card, .mode-card, .task-card, .market-order, .recent-card, .quick-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 8px 26px rgba(17, 49, 104, .06);
}
.package-card { padding: 20px; position: relative; overflow: hidden; }
.package-card::after { content: ""; position: absolute; width: 100px; height: 100px; right: -34px; top: -42px; border-radius: 50%; background: rgba(5,191,244,.09); }
.package-card h4 { margin: 12px 0 5px; font-size: 20px; }
.package-price { font-family: "DIN Alternate", sans-serif; font-size: 28px; color: var(--blue); letter-spacing: -.03em; }
.package-meta { margin: 14px 0 18px; display: grid; gap: 9px; color: var(--muted); font-size: 12px; }
.package-meta div { display: flex; justify-content: space-between; gap: 12px; }
.package-meta b { color: var(--ink); }
.tag { display: inline-flex; align-items: center; padding: 4px 9px; border-radius: 999px; font-size: 10px; font-weight: 800; background: rgba(35,100,220,.08); color: var(--blue); }
.tag.green { background: rgba(25,169,128,.1); color: var(--green); }
.tag.amber { background: rgba(244,178,59,.14); color: #9c6500; }
.tag.danger { background: rgba(223,91,101,.12); color: var(--danger); }

.mode-card { padding: 22px; }
.mode-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; color: #fff; font-size: 20px; background: linear-gradient(135deg, var(--navy), var(--blue)); }
.mode-card h4 { margin: 16px 0 6px; font-size: 18px; }
.mode-card p { margin: 0 0 18px; color: var(--muted); font-size: 12px; line-height: 1.7; }

.field { display: grid; gap: 7px; }
.field > span, .label { font-size: 11px; font-weight: 800; color: #718099; }
.input, .select, .textarea {
  width: 100%;
  border: 1px solid rgba(35, 74, 132, .14);
  background: rgba(248, 251, 255, .9);
  border-radius: 12px;
  min-height: 44px;
  padding: 10px 13px;
  color: var(--ink);
  outline: 0;
  transition: .18s ease;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 4px rgba(35,100,220,.08); background: #fff; }
.textarea { min-height: 92px; resize: vertical; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.note { padding: 12px 14px; border-radius: 13px; background: rgba(35,100,220,.055); color: #5d6e87; font-size: 12px; line-height: 1.65; }
.note.warn { background: rgba(244,178,59,.1); color: #805d16; }

.list { display: grid; gap: 10px; }
.row-card { padding: 15px 16px; border-radius: 15px; border: 1px solid var(--line); background: rgba(255,255,255,.76); }
.row-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.row-title { font-size: 14px; font-weight: 800; }
.row-sub { color: var(--muted); font-size: 11px; margin-top: 5px; line-height: 1.55; }
.row-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; font-size: 11px; color: var(--muted); }
.row-meta b { color: var(--ink); }
.empty { padding: 54px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); margin-bottom: 8px; font-size: 16px; }
.skeleton { min-height: 120px; border-radius: var(--radius); background: linear-gradient(90deg, #eef3fa 25%, #f8fbff 50%, #eef3fa 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.tabs { display: flex; flex-wrap: wrap; gap: 7px; padding: 5px; border-radius: 14px; background: rgba(35,100,220,.055); }
.tab { border: 0; border-radius: 10px; background: transparent; padding: 9px 13px; color: var(--muted); font-size: 12px; font-weight: 700; }
.tab.active { background: #fff; color: var(--blue); box-shadow: 0 5px 16px rgba(17,49,104,.08); }
.split { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: 20px; align-items: start; }
.book { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.book-side h4 { margin: 0 0 10px; font-size: 12px; color: var(--muted); }
.order-line { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid rgba(35,74,132,.07); font-size: 12px; }
.order-line:last-child { border-bottom: 0; }
.mono { font-family: "SFMono-Regular", Menlo, monospace; }
.pos { color: var(--green); }
.neg { color: var(--danger); }

table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 10px; border-bottom: 1px solid rgba(35,74,132,.075); text-align: left; font-size: 12px; white-space: nowrap; }
th { color: var(--muted); font-size: 10px; letter-spacing: .04em; text-transform: uppercase; }
.table-wrap { overflow-x: auto; }

.modal-root { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(4, 16, 43, .56); backdrop-filter: blur(8px); }
.modal {
  width: min(620px, 100%);
  max-height: min(86vh, 850px);
  overflow: auto;
  padding: 24px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(3,18,52,.32);
  animation: modal-in .22s ease both;
}
.modal.wide { width: min(880px, 100%); }
@keyframes modal-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.modal-head h3 { margin: 0; font-size: 23px; letter-spacing: -.035em; }
.modal-head p { margin: 6px 0 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.icon-btn { width: 36px; height: 36px; border: 0; border-radius: 11px; background: #eff4fb; color: var(--muted); font-size: 18px; }
.toast {
  position: fixed;
  z-index: 100;
  right: 24px;
  bottom: 28px;
  max-width: min(420px, calc(100vw - 32px));
  padding: 13px 17px;
  border-radius: 14px;
  background: rgba(7,27,88,.94);
  color: #fff;
  box-shadow: 0 16px 42px rgba(3,18,52,.28);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: .2s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: rgba(146, 42, 56, .96); }

.signature-pad { width: 100%; height: 190px; border: 1px dashed rgba(35,74,132,.24); border-radius: 16px; background: #f8fbff; touch-action: none; }
.document-preview { max-height: 280px; overflow: auto; padding: 16px; border-radius: 14px; background: #f6f9fe; color: #53637c; font-size: 12px; line-height: 1.8; }

@media (max-width: 1120px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { display: none; }
  .topbar { min-height: 76px; padding: 14px 16px; }
  .topbar-kicker { display: none; }
  .topbar h2 { font-size: 22px; margin: 0; }
  .balance-pill { display: none; }
  .wallet-chip { min-height: 38px; padding: 0 11px; }
  .view { padding: 16px 14px 92px; }
  .mobile-nav {
    position: fixed;
    z-index: 40;
    left: 10px;
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    padding: 7px;
    border: 1px solid rgba(35,74,132,.12);
    border-radius: 18px;
    background: rgba(255,255,255,.92);
    box-shadow: 0 15px 40px rgba(17,49,104,.16);
    backdrop-filter: blur(18px);
  }
  .mobile-nav button { border: 0; padding: 8px 2px; border-radius: 11px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 700; }
  .mobile-nav button.active { background: var(--navy); color: #fff; }
  .grid-2, .grid-3, .grid-4, .form-grid, .split { grid-template-columns: 1fr; }
  .metric-row { grid-template-columns: 1fr 1fr; }
  .metric-row .metric:last-child { grid-column: 1 / -1; }
  .login-card { padding: 30px 24px; }
}

@media (max-width: 520px) {
  .hero-card { min-height: auto; padding: 24px 20px; }
  .hero-card h1 { font-size: 38px; }
  .hero-card h1 small { display: block; margin: 8px 0 0; }
  .metric-row { grid-template-columns: 1fr; }
  .metric-row .metric:last-child { grid-column: auto; }
  .panel-pad, .mode-card, .package-card { padding: 18px; }
  .book { grid-template-columns: 1fr; }
  .modal-root { padding: 10px; align-items: end; }
  .modal { max-height: 92vh; border-radius: 22px 22px 14px 14px; padding: 20px; }
  .wallet-chip span:last-child { max-width: 88px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .toast { right: 16px; bottom: 92px; }
}
