:root {
  --bg: #0f1218;
  --panel: #171c25;
  --panel-2: #1f2633;
  --line: #2a3444;
  --text: #e7ecf3;
  --muted: #8a97ab;
  --brand: #ff6b35;
  --brand-2: #ffa94d;
  --ok: #2ecc71;
  --warn: #f1c40f;
  --err: #ff5c5c;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 10% -10%, #1b2330 0%, var(--bg) 55%) fixed;
  color: var(--text);
  font: 14px/1.6 "Segoe UI", "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  min-height: 100vh;
}

a { color: var(--brand-2); text-decoration: none; }
h1, h2, h3, h4 { margin: 0 0 12px; font-weight: 650; letter-spacing: .2px; }
h1 { font-size: 20px; }
h3 { font-size: 15px; color: var(--muted); font-weight: 600; }

header.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px;
  background: rgba(15, 18, 24, .82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
header.top .logo { font-weight: 700; font-size: 16px; }
header.top .logo span { color: var(--brand); }
header.top .spacer { flex: 1; }
header.top .chip {
  font-size: 12px; color: var(--muted); border: 1px solid var(--line);
  padding: 3px 9px; border-radius: 999px;
}

.wrap { max-width: 1240px; margin: 0 auto; padding: 22px 16px 60px; }
.wrap.narrow { max-width: 460px; }

.card {
  background: linear-gradient(180deg, var(--panel) 0%, #141922 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .25);
}

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 14px; }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }

label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 4px; }

input, select, textarea, button {
  font: inherit; color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 11px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(255,107,53,.14); }
input[type="number"] { width: 110px; }
textarea { width: 100%; min-height: 120px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }

button {
  cursor: pointer; background: var(--panel-2);
  border: 1px solid var(--line);
}
button:hover { border-color: #3b4a60; }
button.primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border: none; color: #17110c; font-weight: 700;
}
button.primary:hover { filter: brightness(1.06); }
button.ghost { background: transparent; }
button.danger { border-color: #5a2a2a; color: #ffb3b3; }
button:disabled { opacity: .5; cursor: not-allowed; }
button.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
tbody tr:hover { background: rgba(255, 255, 255, .02); }
td.mono, .mono { font-family: ui-monospace, Consolas, monospace; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.tabs button {
  border-radius: 999px; padding: 7px 15px; font-size: 13px; color: var(--muted);
  background: transparent;
}
.tabs button.active { color: #17110c; background: linear-gradient(135deg, var(--brand), var(--brand-2)); border-color: transparent; font-weight: 700; }

.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi .num { font-size: 26px; font-weight: 700; letter-spacing: .5px; }
.kpi .lbl { font-size: 12px; color: var(--muted); }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; border: 1px solid var(--line); color: var(--muted); }
.badge.ok { color: var(--ok); border-color: rgba(46,204,113,.4); background: rgba(46,204,113,.08); }
.badge.warn { color: var(--warn); border-color: rgba(241,196,15,.4); background: rgba(241,196,15,.08); }
.badge.err { color: var(--err); border-color: rgba(255,92,92,.4); background: rgba(255,92,92,.08); }

.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.mt { margin-top: 12px; }
.codebox {
  font-family: ui-monospace, Consolas, monospace; font-size: 13px;
  background: #0b0e13; border: 1px solid var(--line); border-radius: 9px;
  padding: 12px; white-space: pre-wrap; word-break: break-all; user-select: all;
}
.rowsplit { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.rowsplit:last-child { border-bottom: none; }

/* toast */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 99; }
.toast {
  min-width: 220px; max-width: 380px; padding: 10px 14px; border-radius: 10px;
  background: var(--panel-2); border: 1px solid var(--line);
  box-shadow: 0 12px 30px rgba(0,0,0,.4); animation: slide .18s ease-out;
}
.toast.ok { border-color: rgba(46,204,113,.5); }
.toast.err { border-color: rgba(255,92,92,.5); }
.toast.warn { border-color: rgba(241,196,15,.5); }
@keyframes slide { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* modal */
.modal-mask {
  position: fixed; inset: 0; background: rgba(5, 7, 10, .66);
  display: flex; align-items: center; justify-content: center; padding: 18px; z-index: 90;
}
.modal {
  width: min(640px, 100%); max-height: 86vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 20px;
}
.modal .foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.spec-row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 8px 10px; padding: 10px 0; border-bottom: 1px dashed var(--line);
}
.spec-row:last-child { border-bottom: none; }
.spec-row .name { flex: 0 0 auto; min-width: 64px; font-weight: 600; white-space: nowrap; }
.spec-row .price { flex: 0 0 auto; color: var(--brand-2); font-weight: 700; white-space: nowrap; }
.spec-row > span, .spec-row .badge { flex: 0 0 auto; white-space: nowrap; }
.spec-row input[type="number"] { flex: 0 0 72px; width: 72px; }
.spec-row button { flex: 0 0 auto; white-space: nowrap; }
/* 下载连接行：长了就省略号，不要把卡片挤变形 */
.dl-line { display: flex; gap: 8px; align-items: center; margin: 2px 0 6px; min-width: 0; }
.dl-line a { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dl-line button { flex: 0 0 auto; }

.sw { display: flex; gap: 6px; }
.sw button { flex: 1; }

/* 顶部 KPI 行：三个指标同一底线对齐 */
.topkpi-row { align-items: flex-end; }
.topkpis { display: flex; align-items: flex-end; gap: 48px; flex: 1; min-width: 0; }
.topkpis .kpi { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.topkpis .kpi .lbl { line-height: 1.2; }
.topkpis .kpi .num { line-height: 1.15; }

/* 后台「现有软件/卡种」按大类折叠 */
.goods-group {
  border: 1px solid var(--line);
  border-radius: 10px;
  margin-bottom: 10px;
  background: rgba(255, 255, 255, .015);
  overflow: hidden;
}
.goods-group > summary {
  cursor: pointer;
  padding: 11px 14px;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  user-select: none;
}
.goods-group > summary::-webkit-details-marker { display: none; }
.goods-group > summary::before {
  content: "▸";
  color: var(--muted);
  transition: transform .15s ease;
  display: inline-block;
}
.goods-group[open] > summary::before { transform: rotate(90deg); }
.goods-group[open] > summary { border-bottom: 1px solid var(--line); }
.goods-item { padding: 12px 14px; border-bottom: 1px dashed var(--line); }
.goods-item:last-child { border-bottom: none; }
.goods-item h4 { font-size: 14px; font-weight: 700; }

/* 分类小窗：只显示商品名 + 价格 */
.cat-list { margin: 6px 0 2px; }
.cat-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 6px; border-bottom: 1px solid var(--line); cursor: pointer;
}
.cat-item:last-child { border-bottom: none; }
.cat-item:active { background: rgba(255, 169, 77, .08); }
.cat-item .ci-name { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-item .ci-price { color: var(--brand-2); font-weight: 700; white-space: nowrap; }
.cat-item .ci-arrow { color: var(--muted); font-size: 18px; line-height: 1; }

/* 手机端：公告不再吸顶、字号收紧，会员公告收成精简版 */
@media (max-width: 780px) {
  .notice-bar {
    position: static;
    padding: 7px 10px;
    gap: 6px;
    align-items: center;
  }
  .notice-bar .nb-icon { font-size: 13px; }
  .notice-bar .nb-wrap { text-align: left; }
  .notice-bar .nb-line1 { font-size: 11.5px; line-height: 1.35; letter-spacing: 0; }
  .notice-bar .nb-line1 b { padding: 0 4px; }
  .notice-bar .nb-line2 { font-size: 11px; line-height: 1.3; margin-top: 2px; }
  .app-layout { display: block; }
  /* 会员公告：手机端常驻一条“状态条”，点一下展开明细（避免滚动时高度变化导致抖动） */
  .member-panel {
    position: sticky; top: 0; z-index: 18;
    margin-bottom: 10px;
    padding: 7px 12px;
    overflow: hidden;
    max-height: 40px;
    transition: max-height .18s ease, box-shadow .18s ease;
  }
  .member-panel .mp-compact {
    display: flex; align-items: center; gap: 10px;
    font-size: 12.5px; line-height: 1.5; white-space: nowrap; overflow: hidden;
  }
  .member-panel .mp-compact b { color: var(--brand-2); }
  .member-panel .mp-arrow { margin-left: auto; color: var(--muted); font-size: 11px; }
  .member-panel.expand {
    max-height: 520px;
    box-shadow: 0 10px 26px rgba(0, 0, 0, .5);
  }
  .member-panel.expand h3,
  .member-panel.expand .member-stair,
  .member-panel.expand .rowsplit,
  .member-panel.expand #mNext { display: block; }
  .member-panel h3, .member-panel .member-stair, .member-panel .rowsplit, .member-panel #mNext,
  .member-panel > .muted.small { display: none; }
  .member-panel.expand > .muted.small { display: block; }
  .member-panel .member-stair { display: none; }
  .member-panel #mNext { display: none; }
  .member-panel p.muted.small:last-child { display: none; }
  .member-panel h3 { font-size: 14px; }
  .member-panel .rowsplit { padding: 4px 0; }
  .topkpis { gap: 20px; }
  .topkpis .kpi .num { font-size: 22px; }
}

/* 左侧栏 + 主内容（会员公告已隐藏，单列布局） */
.app-layout { display: grid; grid-template-columns: 264px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1080px) { .app-layout { grid-template-columns: 1fr; } }
.app-main { min-width: 0; }
.member-panel { position: sticky; top: 122px; }
.member-stair .st {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 12.5px;
}
.member-stair .st:last-child { border-bottom: none; }
.member-stair .st.cur { color: var(--brand-2); font-weight: 700; }
.member-stair .st .lv { color: var(--muted); }

/* 顶部公告条（显眼） */
.notice-bar {
  position: sticky; top: 53px; z-index: 19;
  display: flex; align-items: flex-start; justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  background: linear-gradient(90deg, #e01b24 0%, #ff7a18 55%, #ffb703 100%);
  color: #fff;
  box-shadow: 0 6px 18px rgba(224, 27, 36, .28);
  border-bottom: 1px solid rgba(255, 255, 255, .25);
}
.notice-bar .nb-icon { font-size: 16px; line-height: 1.35; animation: nb-blink 1.6s ease-in-out infinite; }
.notice-bar .nb-wrap { flex: 0 1 auto; min-width: 0; max-width: 1240px; text-align: center; }
.notice-bar .nb-line1 { font-weight: 700; font-size: 14px; letter-spacing: .2px; line-height: 1.45; }
.notice-bar .nb-line1 b { background: rgba(0, 0, 0, .22); padding: 1px 6px; border-radius: 6px; }
.notice-bar .nb-line2 { font-size: 12.5px; opacity: .95; margin-top: 3px; line-height: 1.4; }
@keyframes nb-blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* 分类胶囊（发卡网风格） */
.pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--muted); font-size: 13px; cursor: pointer; user-select: none;
  transition: all .15s;
}
.pill:hover { border-color: #3b4a60; color: var(--text); }
.pill.active {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-color: transparent; color: #17110c; font-weight: 700;
}
.pill .n { opacity: .7; font-size: 11.5px; }
.pill-del { color: var(--err); cursor: pointer; margin-left: 2px; }
.cat-badge {
  display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px;
  background: rgba(255, 169, 77, .12); color: var(--brand-2); border: 1px solid rgba(255,169,77,.3);
}

.login-tabs { display: flex; margin-bottom: 4px; }
.login-tabs button { flex: 1; border-radius: 9px 9px 0 0; }
.login-tabs button.active { background: var(--panel-2); color: var(--brand-2); font-weight: 700; }
