/* 品牌色取自 IP大师 logo 的绿 → 蓝渐变，和小程序一致 */
:root {
  --brand: #0fb5c8;
  --brand-dark: #0b8fd8;
  --brand-grad: linear-gradient(135deg, #12d3a0 0%, #0bb8d6 50%, #1a8cff 100%);
  --text: #1f2329;
  --text-2: #646a73;
  --text-3: #a0a6ad;
  --line: #eef0f3;
  --bg: #f4f6fa;
  --danger: #e5484d;
  --success: #12a37a;
  --warn: #f08c00;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 -apple-system, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  -webkit-tap-highlight-color: transparent;
}
a { color: var(--brand-dark); text-decoration: none; cursor: pointer; }
button, input, textarea, select { font: inherit; color: inherit; }

/* 电脑上也按手机宽度居中显示 */
#app { max-width: 640px; margin: 0 auto; min-height: 100vh; }
.page { padding: 14px 14px calc(28px + env(safe-area-inset-bottom)); }
.page.with-tabs { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.page.with-bottom { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; height: 48px; padding: 0 8px;
  background: #fff; border-bottom: 1px solid var(--line);
}
.topbar .back { width: 40px; height: 40px; display: flex; align-items: center; justify-content: center; font-size: 22px; color: var(--text); cursor: pointer; }
.topbar .title { flex: 1; text-align: center; font-weight: 600; font-size: 16px; margin-right: 40px; }

.card { background: #fff; border-radius: 12px; padding: 16px; margin-bottom: 12px; }
.card-title { font-size: 16px; font-weight: 600; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.muted { color: var(--text-2); }
.faint { color: var(--text-3); font-size: 13px; }
.center { text-align: center; }
.mono { font-family: Menlo, "SF Mono", Consolas, monospace; letter-spacing: .5px; }
.danger { color: var(--danger); }
.success { color: var(--success); }

.row { display: flex; justify-content: space-between; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: none; }
.row .label { color: var(--text-2); flex-shrink: 0; margin-right: 14px; }
.row .value { text-align: right; word-break: break-all; }

.btn {
  display: flex; align-items: center; justify-content: center; width: 100%;
  height: 46px; border-radius: 23px; border: none; cursor: pointer;
  font-size: 16px; font-weight: 600; color: #fff; background: var(--brand-grad);
}
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-ghost { background: #fff; color: var(--brand-dark); border: 1px solid var(--brand); }
.btn-danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); }
.btn-small { display: inline-flex; width: auto; height: 30px; padding: 0 14px; font-size: 13px; font-weight: 500; border-radius: 15px; }
.actions { display: flex; gap: 10px; margin-top: 12px; }
.actions .btn { flex: 1; }

.field { margin-bottom: 14px; }
.field-label { color: var(--text-2); font-size: 14px; margin-bottom: 6px; }
.req { color: var(--danger); margin-left: 2px; }
.input, .textarea, select.input {
  width: 100%; height: 44px; padding: 0 12px; border: 1px solid #e3e6eb; border-radius: 8px;
  background: #fafbfc; outline: none; font-size: 15px;
}
.textarea { height: auto; min-height: 76px; padding: 10px 12px; resize: vertical; }
.input:focus, .textarea:focus { border-color: var(--brand); background: #fff; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 12px; line-height: 20px; white-space: nowrap; }
.tag-green { background: #e6f7f0; color: var(--success); }
.tag-orange { background: #fff4e5; color: var(--warn); }
.tag-red { background: #fdecec; color: var(--danger); }
.tag-gray { background: #f0f1f3; color: var(--text-2); }
.tag-blue { background: #e8f3ff; color: var(--brand-dark); }

.empty { text-align: center; color: var(--text-3); padding: 48px 0; }
.load-more { text-align: center; color: var(--text-3); font-size: 13px; padding: 14px 0; cursor: pointer; }
.notice { background: #fff4e5; color: var(--warn); border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; font-size: 14px; }

/* 登录 */
.login { padding: 56px 24px 32px; }
.hero-login { text-align: center; margin-bottom: 32px; }
.hero-login img { width: 72px; height: 72px; border-radius: 16px; }
.hero-login .title { font-size: 22px; font-weight: 700; margin-top: 12px; }
.hero-login .subtitle { color: var(--text-3); font-size: 13px; margin-top: 6px; }
.code-row { display: flex; gap: 10px; }
.code-row .input { flex: 1; }
.code-row .btn { width: 120px; height: 44px; border-radius: 8px; font-size: 14px; flex-shrink: 0; }
.agree { display: flex; align-items: flex-start; gap: 8px; margin-top: 18px; font-size: 13px; color: var(--text-2); cursor: pointer; }
.box { width: 16px; height: 16px; border: 1px solid #c4c8ce; border-radius: 4px; flex-shrink: 0; margin-top: 2px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #fff; }
.box.on { background: var(--brand); border-color: var(--brand); }
.tip { text-align: center; margin-top: 22px; }

/* 首页 */
.hero { background: var(--brand-grad); color: #fff; border-radius: 14px; padding: 18px; margin-bottom: 12px; }
.hero-top { display: flex; justify-content: space-between; align-items: flex-start; }
.hero .name { font-size: 18px; font-weight: 600; }
.hero .meta { opacity: .85; font-size: 13px; margin-top: 2px; }
.hero .remain-label { opacity: .85; font-size: 13px; margin-top: 18px; }
.hero .remain { font-size: 40px; font-weight: 700; line-height: 1.2; }
.hero .unit { font-size: 15px; margin-left: 4px; font-weight: 500; }
.stats { display: flex; margin-top: 14px; border-top: 1px solid rgba(255,255,255,.25); padding-top: 12px; }
.stat { flex: 1; text-align: center; }
.stat .num { font-size: 18px; font-weight: 600; }
.stat .lbl { opacity: .85; font-size: 12px; }
.hero .tag { background: rgba(255,255,255,.9); }
.issue { margin: 6px 0 8px; }

.list-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.list-row:last-child { border-bottom: none; }
.list-row .code { font-size: 15px; }

/* 列表页 */
.search { margin-bottom: 10px; display: flex; gap: 8px; }
.search .input { background: #fff; }
.search .btn { width: 72px; height: 44px; border-radius: 8px; font-size: 14px; flex-shrink: 0; }
.tabs { display: flex; gap: 6px; margin-bottom: 10px; overflow-x: auto; }
.tabs .tab { padding: 5px 14px; border-radius: 16px; background: #fff; color: var(--text-2); font-size: 14px; white-space: nowrap; cursor: pointer; }
.tabs .tab.active { background: var(--brand); color: #fff; }
.item { cursor: pointer; }
.item-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.item-name { font-size: 16px; font-weight: 600; margin-right: 6px; }
.item-meta { margin-top: 6px; }
.quota { display: flex; justify-content: space-between; margin-top: 12px; }
.quota .q { flex: 1; text-align: center; }
.q-num { font-size: 18px; font-weight: 600; }
.total { margin: 0 2px 8px; }

/* 开码 */
.stepper { display: flex; align-items: center; justify-content: center; gap: 12px; }
.step { width: 44px; height: 44px; border-radius: 22px; background: #f0f3f7; display: flex; align-items: center; justify-content: center; font-size: 22px; cursor: pointer; user-select: none; }
.step.off { opacity: .4; cursor: not-allowed; }
.qty { width: 110px; height: 48px; text-align: center; font-size: 24px; font-weight: 600; border: 1px solid #e3e6eb; border-radius: 10px; }
.hint { text-align: center; margin-top: 10px; }
.done-title { font-size: 18px; font-weight: 600; color: var(--success); margin-bottom: 4px; }
.copy { color: var(--brand-dark); font-size: 13px; }

/* 额度记录 */
.ledger-item { display: flex; justify-content: space-between; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.ledger-item:last-child { border-bottom: none; }
.ledger-item .right { text-align: right; flex-shrink: 0; }
.amount { font-size: 17px; font-weight: 600; }

/* 渠道经理 */
.sales-hero { display: flex; justify-content: space-between; align-items: center; background: var(--brand-grad); color: #fff; border-radius: 14px; padding: 18px; margin-bottom: 12px; }
.sales-hero .hero-name { font-size: 18px; font-weight: 600; }
.sales-hero .hero-meta { opacity: .85; font-size: 13px; }
.sales-hero .hero-num { font-size: 26px; font-weight: 700; text-align: right; }
.bottom-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 14px calc(10px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); }
.bottom-bar .inner { max-width: 612px; margin: 0 auto; }
.head { display: flex; justify-content: space-between; align-items: flex-start; }
.head .name { font-size: 18px; font-weight: 600; }

/* 我的 */
.profile { display: flex; align-items: center; gap: 12px; background: #fff; border-radius: 12px; padding: 16px; margin-bottom: 12px; cursor: pointer; }
.profile img { width: 52px; height: 52px; border-radius: 12px; }
.profile .copy-col { flex: 1; min-width: 0; }
.profile .p-name { font-size: 17px; font-weight: 600; }
.grid { display: flex; }
.grid-item { flex: 1; text-align: center; cursor: pointer; padding: 6px 0; }
.grid-num { font-size: 20px; font-weight: 600; }
.menu-item { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.menu-item:last-child { border-bottom: none; }
.group-heading { color: var(--text-3); font-size: 13px; margin: 16px 4px 8px; display: block; }

/* 协议 */
.doc { background: #fff; border-radius: 12px; padding: 18px; line-height: 1.75; font-size: 14px; }
.doc h1 { font-size: 20px; margin: 0 0 4px; }
.doc h2 { font-size: 16px; margin: 18px 0 6px; }
.doc p { margin: 6px 0; color: #333; }
.doc .meta { color: var(--text-3); font-size: 12px; margin-bottom: 12px; }

/* 底部菜单 */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; justify-content: center; background: #fff; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar .inner { display: flex; width: 100%; max-width: 640px; }
.tabbar a { flex: 1; text-align: center; padding: 8px 0 6px; color: var(--text-3); font-size: 12px; }
.tabbar a .ico { display: block; font-size: 20px; line-height: 24px; }
.tabbar a.active { color: var(--brand-dark); font-weight: 600; }

/* 提示 / 弹窗 */
.toast {
  position: fixed; left: 50%; top: 45%; transform: translate(-50%, -50%); z-index: 100;
  max-width: 80vw; padding: 10px 16px; border-radius: 8px; background: rgba(0,0,0,.78); color: #fff; font-size: 14px; text-align: center;
}
.modal { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; padding: 24px; }
.modal[hidden], .toast[hidden], .tabbar[hidden] { display: none; }
.modal .dialog { width: 100%; max-width: 340px; background: #fff; border-radius: 14px; overflow: hidden; }
.modal .d-body { padding: 22px 20px 18px; text-align: center; }
.modal .d-title { font-weight: 600; font-size: 17px; margin-bottom: 8px; }
.modal .d-content { color: var(--text-2); font-size: 14px; white-space: pre-wrap; word-break: break-all; }
.modal .d-actions { display: flex; border-top: 1px solid var(--line); }
.modal .d-actions button { flex: 1; height: 48px; border: none; background: #fff; font-size: 16px; cursor: pointer; }
.modal .d-actions button + button { border-left: 1px solid var(--line); }
.modal .d-actions .primary { color: var(--brand-dark); font-weight: 600; }

/* ── 表格（电脑） ─────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; font-weight: 500; color: var(--text-2); background: #f7f8fa; padding: 10px 12px; white-space: nowrap; border-bottom: 1px solid var(--line); }
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tbody tr[data-go], .tbl tbody tr { transition: background .15s; }
.tbl tbody tr[data-go] { cursor: pointer; }
.tbl tbody tr:hover { background: #f5fbfd; }
.tbl .mono { font-size: 13px; }
.nowrap { white-space: nowrap; }
.desktop-only { display: none !important; }
.btn-white { background: #fff; color: var(--brand-dark); }

/* ── 电脑布局：左侧菜单 + 宽内容区 ─────────────────────────── */
@media (min-width: 900px) {
  body.desktop:not(.bare) { padding-left: 232px; }
  body.desktop #app { max-width: none; margin: 0; }
  body.desktop .page { max-width: 1180px; margin: 0 auto; padding: 24px 32px 40px; }
  body.desktop .page.with-bottom { padding-bottom: 40px !important; }
  body.desktop .page.narrow { max-width: 620px; }
  body.desktop .desktop-only { display: inline-flex !important; }
  body.desktop .bottom-bar { display: none; }
  body.desktop .tabbar { display: none; }

  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 232px; z-index: 20;
    background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column;
  }
  .sidebar[hidden] { display: none; }
  .side-brand { display: flex; align-items: center; gap: 10px; padding: 20px 18px; border-bottom: 1px solid var(--line); }
  .side-brand img { width: 38px; height: 38px; border-radius: 9px; }
  .side-title { font-weight: 700; font-size: 15px; }
  .side-sub { color: var(--text-3); font-size: 12px; }
  .side-nav { flex: 1; padding: 12px 10px; }
  .side-nav a { display: block; padding: 10px 14px; margin-bottom: 4px; border-radius: 8px; color: var(--text-2); font-size: 15px; }
  .side-nav a:hover { background: #f4f6fa; color: var(--text); }
  .side-nav a.active { background: #e8f6fa; color: var(--brand-dark); font-weight: 600; }
  .side-foot { padding: 16px 18px; border-top: 1px solid var(--line); }
  .side-user { font-weight: 600; }
  .side-foot a { display: inline-block; margin-top: 6px; }

  /* 页头：返回 + 标题，不再是手机那种通栏白条 */
  body.desktop .topbar { position: static; max-width: 1180px; margin: 0 auto; height: auto; padding: 22px 32px 0; background: transparent; border: none; }
  body.desktop .topbar .title { text-align: left; font-size: 20px; margin-right: 0; }
  body.desktop .topbar .back { width: 32px; height: 32px; margin-right: 6px; border-radius: 8px; background: #fff; border: 1px solid var(--line); font-size: 20px; }
  body.desktop .topbar + .page { padding-top: 16px; }

  /* 两栏 */
  .two-col { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; align-items: start; }
  .two-col.detail { grid-template-columns: 420px minmax(0, 1fr); }
  .recent-card { min-height: 100%; }

  .card { padding: 20px; border-radius: 12px; }
  .list-card { padding: 8px 8px 4px; }
  .list-card .card-title { padding: 10px 10px 0; }
  .search { max-width: 560px; }
  .sales-hero .hero-right { display: flex; align-items: center; gap: 24px; }
  .sales-hero .btn-white { height: 40px; padding: 0 20px; font-size: 15px; width: auto; border-radius: 20px; }
  .hero .remain { font-size: 46px; }
  .grid-item { padding: 12px 0; }

  /* 电脑上的列表（授权码 / 代理）直接是一块白底表格 */
  #list > .tbl-wrap { background: #fff; border-radius: 12px; }
  .list-card #list > .tbl-wrap { border-radius: 8px; }

  /* 登录页：中间一张卡片，背景用品牌渐变淡色 */
  body.bare { background: linear-gradient(160deg, #e9fbf6 0%, #eaf5ff 100%); }
  body.bare .login { max-width: 420px; margin: 8vh auto 0; background: #fff; border-radius: 18px; padding: 40px 36px 28px; box-shadow: 0 10px 40px rgba(26, 140, 255, .08); }
  body.bare .login .card { padding: 0; }
  body.bare .page { max-width: 820px; margin: 0 auto; }
  body.bare .topbar { max-width: 820px; margin: 0 auto; background: transparent; border: none; }
}
