:root {
  --green: #148a52;
  --green-deep: #0f7344;
  --ink: #1c2430;
  --muted: #6b7686;
  --line: #e6ece8;
  --page: #f5f7f6;
  --card: #fff;
  --danger: #d14343;
  --shadow: 0 10px 30px rgba(22, 48, 36, 0.06);
  --header: 72px;
  --side: 228px;
  font-family: "Manrope", "Noto Sans SC", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  background: linear-gradient(#f3f7f2 0, var(--page) 180px);
  color: var(--ink);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  height: var(--header);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 28px;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid #edf1ee;
  backdrop-filter: blur(10px);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 28px; letter-spacing: -0.04em; }
.brand svg { width: 36px; height: 36px; display: block; }
.user-btn {
  width: 42px; height: 42px; border-radius: 50%; border: 0;
  background: #1d2430; color: #fff; display: grid; place-items: center;
}
.user-menu {
  position: absolute; right: 22px; top: 64px;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); min-width: 160px; padding: 6px;
}
.user-menu a, .user-menu button {
  display: block; width: 100%; text-align: left;
  background: none; border: 0; border-radius: 10px;
  padding: 10px 12px; color: var(--ink);
}
.user-menu a:hover, .user-menu button:hover { background: #f3f7f4; }

.shell { display: flex; min-height: calc(100vh - var(--header) - 64px); }
.side { width: var(--side); padding: 28px 18px 40px 32px; flex: none; }
.menu-label { margin: 0 12px 10px; color: #8b95a3; font-size: 13px; font-weight: 700; }
.menu a {
  display: block; margin: 2px 0; padding: 11px 14px; border-radius: 10px;
  color: #5d6876; font-weight: 650; font-size: 15px;
}
.menu a.is-on, .menu a:hover { background: #eceff1; color: #2a3340; }
.content { flex: 1; padding: 28px 36px 48px; min-width: 0; }
.foot {
  height: 64px; display: grid; place-items: center;
  color: #9aa3ae; font-size: 13px; background: #f7f8f7; border-top: 1px solid #eef1ef;
}

h1 { margin: 0 0 16px; font-size: 26px; letter-spacing: -0.03em; }
h2 { margin: 28px 0 14px; font-size: 22px; }
.panel {
  background: var(--card); border: 1px solid #eef2ef; border-radius: 16px;
  box-shadow: var(--shadow); padding: 22px 24px;
}
.lead { margin: 0; font-size: 20px; font-weight: 800; }
.sub { margin: 8px 0 0; color: var(--muted); font-size: 14px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.btn {
  border: 0; border-radius: 8px; padding: 10px 16px; font-weight: 750;
  background: var(--green); color: #fff;
}
.btn:hover { background: var(--green-deep); }
.btn:disabled { opacity: 0.55; cursor: default; }
.btn-line { background: #f3f4f6; color: #4b5563; }
.btn-line:hover { background: #e7eaee; }
.bar { height: 8px; border-radius: 99px; background: #e8edf0; margin: 18px 0 10px; overflow: hidden; }
.bar > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #19a463, #0e7d49); }
.quiet { color: #7b8794; font-size: 14px; }

.shortcuts { display: grid; gap: 14px; }
.shortcut {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 20px;
}
.shortcut strong { display: block; font-size: 16px; }
.shortcut span { color: var(--muted); font-size: 13px; }
.mark {
  width: 54px; height: 54px; border-radius: 50%; flex: none;
  display: grid; place-items: center; color: #fff;
  background: conic-gradient(#148a52 0 78%, #d9efe4 0);
}
.mark.cart { background: #fff7e8; color: #e39b2b; }

.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.cards.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile, .plan {
  background: #fff; border: 1px solid #eef1ef; border-radius: 18px;
  box-shadow: var(--shadow); padding: 18px;
}
.tile { display: flex; gap: 12px; align-items: flex-start; min-height: 132px; }
.tile p, .plan li { color: var(--muted); font-size: 13px; line-height: 1.55; }
.plan { text-align: center; padding: 28px 22px 22px; }
.plan h3 { margin: 0; font-size: 22px; }
.plan .price { margin: 18px 0 0; font-size: 40px; font-weight: 800; letter-spacing: -0.04em; }
.plan .unit { color: var(--muted); margin: 4px 0 18px; }
.plan ul { list-style: none; padding: 18px 0 0; margin: 8px 0 0; text-align: left; border-top: 1px solid #f0f2f4; }
.plan li { margin: 7px 0; }
.plan .btn { width: 100%; }

.empty {
  min-height: 420px; display: grid; place-items: center; text-align: center;
}
.empty p { margin: 8px 0 0; color: var(--green); font-weight: 750; }

.keys, .orders { display: grid; gap: 12px; }
.key, .order {
  background: #fff; border: 1px solid #eef1ef; border-radius: 14px;
  padding: 16px 18px; box-shadow: var(--shadow);
  display: flex; justify-content: space-between; gap: 16px; align-items: center;
}
.key code, .order code {
  display: block; margin-top: 6px; color: #3d4a3f; font-size: 13px;
  word-break: break-all; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.order b { font-size: 16px; }
.meta { color: var(--muted); font-size: 13px; margin-top: 4px; }

.stats { display: grid; gap: 10px; margin-top: 16px; }
.stat { display: flex; justify-content: space-between; padding: 12px 2px; border-top: 1px solid #f1f3f5; color: #4b5563; }
.balance { font-size: 42px; font-weight: 800; margin: 0; letter-spacing: -0.04em; }
.invite-code { font-size: 28px; font-weight: 800; letter-spacing: 0.08em; }

.form { display: grid; gap: 12px; max-width: 460px; }
label { display: grid; gap: 6px; font-size: 13px; color: #526070; font-weight: 700; }
input, select {
  height: 44px; border: 1px solid #e3e8ee; border-radius: 10px; padding: 0 12px; background: #fff;
}
textarea { border: 1px solid #e3e8ee; border-radius: 10px; padding: 10px 12px; min-height: 88px; }
.alert { color: var(--danger); font-size: 13px; min-height: 18px; }
.auth {
  min-height: 100vh; display: grid; place-items: center; padding: 32px 16px;
}
.auth-card { width: min(440px, 100%); padding: 28px; }
.tabs { display: flex; gap: 8px; margin-bottom: 18px; }
.tabs button { background: #f3f5f4; color: #526070; }
.tabs button.is-on { background: var(--green); color: #fff; }

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%);
  background: #1d2430; color: #fff; border-radius: 999px; padding: 10px 16px;
  z-index: 40; font-size: 14px;
}
.mask {
  position: fixed; inset: 0; background: rgba(18, 28, 24, 0.35);
  display: grid; place-items: center; z-index: 30; padding: 20px;
}
.dialog { width: min(560px, 100%); }
.dialog h3 { margin: 0 0 8px; }

.pay-wait { position: fixed; inset: 0; background: rgba(245, 247, 246, 0.86); display: grid; place-items: center; z-index: 35; }
.pay-card { width: min(420px, calc(100% - 32px)); text-align: center; }
.spin {
  width: 36px; height: 36px; margin: 0 auto 12px; border-radius: 50%;
  border: 3px solid #d7eee3; border-top-color: var(--green); animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.cs-launcher, .cs-panel { position: fixed; right: 22px; bottom: 22px; z-index: 50; }
.cs-launcher[hidden], .cs-panel[hidden], .cs-fab[hidden] { display: none !important; }
.cs-launcher {
  width: 280px; background: #fff; border-radius: 16px; box-shadow: 0 16px 40px rgba(17, 40, 30, 0.16);
  padding: 16px 16px 14px; border: 1px solid #eef2ef;
}
.cs-launcher h3 { margin: 0 0 4px; font-size: 16px; }
.cs-online { display: flex; align-items: center; gap: 8px; color: #5f6b76; font-size: 13px; margin-bottom: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.15); }
.cs-faces { display: flex; justify-content: flex-end; margin-top: -28px; }
.cs-faces span, .cs-fab {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: #148a52; color: #fff; border: 2px solid #fff; font-size: 12px;
}
.cs-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 49; width: 56px; height: 56px;
  border-width: 0; box-shadow: 0 10px 24px rgba(20, 138, 82, 0.35); font-size: 22px;
}
.cs-panel {
  width: min(380px, calc(100vw - 24px)); height: min(640px, calc(100vh - 32px));
  background: #fff; border-radius: 18px; overflow: hidden;
  box-shadow: 0 20px 50px rgba(17, 40, 30, 0.2); display: flex; flex-direction: column;
}
.cs-head { background: #178a45; color: #fff; padding: 14px 14px 18px; }
.cs-head-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.cs-head button { background: transparent; border: 0; color: #fff; font-size: 18px; }
.cs-hello {
  margin-top: 14px; background: rgba(255,255,255,0.12); border-radius: 14px; padding: 12px;
  display: flex; gap: 10px; align-items: center;
}
.cs-hello b { display: block; }
.cs-hello small { opacity: 0.9; }
.cs-body { flex: 1; overflow: auto; padding: 16px; background: #f7f8f7; display: flex; flex-direction: column; gap: 10px; }
.bubble { max-width: 82%; padding: 10px 12px; border-radius: 14px; line-height: 1.5; font-size: 14px; white-space: pre-wrap; word-break: break-word; }
.bubble.agent { background: #fff; border: 1px solid #e8eeea; align-self: flex-start; }
.bubble.mine { background: #178a45; color: #fff; align-self: flex-end; }
.cs-input { display: flex; gap: 8px; padding: 10px; border-top: 1px solid #eef1ef; align-items: flex-end; }
.cs-input textarea { flex: 1; min-height: 42px; max-height: 96px; resize: none; }
.cs-input button { height: 42px; }
.cs-note { text-align: center; color: #9aa3ae; font-size: 12px; padding-bottom: 8px; }
.menu-toggle { display: none; border: 0; background: #f3f5f4; border-radius: 10px; padding: 8px 10px; }

@media (max-width: 980px) {
  .cards, .cards.three { grid-template-columns: 1fr 1fr; }
  .side { position: fixed; z-index: 15; background: #fff; height: calc(100vh - var(--header)); transform: translateX(-110%); transition: transform .2s; box-shadow: var(--shadow); }
  .side.is-open { transform: none; }
  .menu-toggle { display: inline-flex; }
  .content { padding: 20px 16px 40px; }
}
@media (max-width: 640px) {
  .cards, .cards.three { grid-template-columns: 1fr; }
  .brand { font-size: 22px; }
  .cs-launcher { width: calc(100vw - 24px); right: 12px; }
}
