/* fs-web 公共样式(落地页、代理后台、总后台共用;落地页另有 landing.css 覆盖成游戏风格) */
:root {
  --bg: #f4f6f9;
  --panel: #ffffff;
  --ink: #1d2433;
  --muted: #6b7486;
  --line: #dfe3ea;
  --accent: #2563eb;
  --accent-ink: #ffffff;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
  --side: #1f2937;
  --side-ink: #d1d5db;
  --radius: 6px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { background: var(--bg); color: var(--ink); font: 13px/1.5 var(--font); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 8px; font-weight: 600; }
h1 { font-size: 20px; } h2 { font-size: 16px; } h3 { font-size: 14px; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.mono { font-family: var(--mono); font-size: 12px; }
.danger-text { color: var(--danger); }
.ok-text { color: var(--ok); }
.warn-text { color: var(--warn); }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.spacer { flex: 1; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }

/* 按钮与输入 */
button, .btn {
  font: inherit; cursor: pointer; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-ink);
  border-radius: var(--radius); padding: 5px 12px; line-height: 1.4; white-space: nowrap;
}
button:hover { filter: brightness(1.08); }
button:disabled { opacity: .5; cursor: not-allowed; }
button.secondary { background: var(--panel); color: var(--ink); border-color: var(--line); }
button.danger { background: var(--danger); border-color: var(--danger); }
button.link { background: none; border: none; color: var(--accent); padding: 0 4px; }
button.small { padding: 2px 8px; font-size: 12px; }
input, select, textarea {
  font: inherit; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 5px 8px;
  min-width: 0;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(37, 99, 235, .25); border-color: var(--accent); }
input[readonly] { background: #f1f3f6; }
textarea { font-family: var(--mono); font-size: 12px; width: 100%; min-height: 90px; resize: vertical; }
input[type=checkbox] { width: auto; }
label { color: var(--muted); }

/* 表单:inline = 一行排开(筛选条),否则两列网格 */
form.fs-form { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 12px; align-items: center; max-width: 720px; }
form.fs-form .full { grid-column: 1 / -1; }
form.fs-form .checks { display: flex; flex-wrap: wrap; gap: 4px 14px; }
form.fs-form .checks .check { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
form.fs-form .actions { grid-column: 2; display: flex; gap: 8px; }
form.fs-form .hint { grid-column: 2; color: var(--muted); font-size: 12px; margin-top: -4px; }
form.fs-form.inline { display: flex; flex-wrap: wrap; gap: 6px 10px; max-width: none; align-items: center; }
form.fs-form.inline .field { display: flex; align-items: center; gap: 4px; }
form.fs-form.inline .actions { display: flex; gap: 6px; }

/* 面板、卡片 */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.panel + .panel { margin-top: 12px; }
.panel-title { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.panel-title h2, .panel-title h3 { margin: 0; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; }
.card .k { color: var(--muted); font-size: 12px; }
.card .v { font-size: 20px; font-weight: 600; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; }
.kv > div:nth-child(odd) { color: var(--muted); }

/* 表格:信息密度优先 */
.table-wrap { overflow-x: auto; }
table.fs-table { border-collapse: collapse; width: 100%; background: var(--panel); font-size: 12px; }
table.fs-table th, table.fs-table td { border-bottom: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; white-space: nowrap; }
table.fs-table td.wrap { white-space: normal; min-width: 160px; max-width: 420px; word-break: break-all; }
table.fs-table th { background: #f8fafc; color: var(--muted); font-weight: 600; position: sticky; top: 0; white-space: nowrap; }
table.fs-table tr:hover td { background: #f8fbff; }
table.fs-table td.num, table.fs-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.fs-table td .cell-json { font-family: var(--mono); max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
table.fs-table td.actions { white-space: nowrap; }
table.fs-table td.actions button + button { margin-left: 4px; }
.empty { color: var(--muted); padding: 12px; text-align: center; }

/* 纯 CSS 条形 */
.bar { position: relative; height: 14px; background: #eef2f7; border-radius: 3px; min-width: 80px; }
.bar > span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); border-radius: 3px; opacity: .75; }
.bar.green > span { background: var(--ok); }

/* 标签 */
.tag { display: inline-block; padding: 0 6px; border-radius: 3px; font-size: 11px; line-height: 18px; background: #e5e7eb; color: #374151; }
.tag.ok { background: #dcfce7; color: #166534; }
.tag.bad { background: #fee2e2; color: #991b1b; }
.tag.warn { background: #fef3c7; color: #92400e; }
/* 开关(列表里直接改,11-09) */
.switch { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; white-space: nowrap; user-select: none; }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch-track { position: relative; width: 32px; height: 18px; border-radius: 9px; background: #cbd5e1; transition: background .15s; flex: none; }
.switch-track::after { content: ''; position: absolute; left: 2px; top: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: left .15s; box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.switch input:checked + .switch-track { background: var(--ok); }
.switch input:checked + .switch-track::after { left: 16px; }
.switch input:disabled + .switch-track { opacity: .5; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch-text { font-size: 12px; }
.icon-s { width: 22px; height: 22px; object-fit: contain; vertical-align: middle; }

/* 分页 */
.pager { display: flex; gap: 8px; align-items: center; margin-top: 8px; color: var(--muted); }

/* 提示与弹窗 */
#fs-toast { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 1000; display: flex; flex-direction: column; gap: 6px; }
.toast { background: #111827; color: #fff; padding: 8px 14px; border-radius: var(--radius); box-shadow: 0 4px 14px rgba(0,0,0,.2); max-width: 80vw; }
.toast.error { background: var(--danger); }
.toast.ok { background: var(--ok); }
.modal-mask { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); display: flex; align-items: center; justify-content: center; z-index: 900; }
.modal { background: var(--panel); border-radius: 8px; padding: 16px 18px; width: min(520px, 92vw); max-height: 86vh; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.modal pre { background: #f6f8fa; padding: 8px; border-radius: 4px; max-height: 260px; overflow: auto; font-size: 12px; white-space: pre-wrap; word-break: break-all; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* 后台布局:左侧导航 + 右侧内容 */
.app { display: flex; min-height: 100vh; }
.side { width: 168px; flex: none; background: var(--side); color: var(--side-ink); padding: 10px 0; }
.side .brand { color: #fff; font-weight: 700; padding: 6px 16px 12px; font-size: 14px; }
.side a { display: block; color: var(--side-ink); padding: 7px 16px; text-decoration: none; }
.side a:hover { background: rgba(255,255,255,.06); }
.side a.active { background: rgba(255,255,255,.12); color: #fff; border-left: 3px solid #60a5fa; padding-left: 13px; }
/* 侧栏分组(总后台 / 代理后台):组名可点击折叠 */
.side .nav-group + .nav-group { margin-top: 4px; border-top: 1px solid rgba(255,255,255,.08); }
.side .nav-group-title { display: block; width: 100%; text-align: left; background: none; border: none; border-radius: 0; color: #9ca3af;
  font-size: 12px; font-weight: 600; letter-spacing: .05em; padding: 8px 16px 4px; cursor: pointer; filter: none; }
.side .nav-group-title::after { content: "▾"; float: right; }
.side .nav-group.collapsed .nav-group-title::after { content: "▸"; }
.side .nav-group.collapsed .nav-group-items { display: none; }
.side .nav-group-static .nav-group-title { cursor: default; }
.side .nav-group-static .nav-group-title::after { content: ""; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 10px; padding: 8px 16px; background: var(--panel); border-bottom: 1px solid var(--line); }
.content { padding: 14px 16px; }
.subtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; flex-wrap: wrap; }
.subtabs a { padding: 6px 12px; color: var(--muted); border-bottom: 2px solid transparent; text-decoration: none; }
.subtabs a.active { color: var(--accent); border-bottom-color: var(--accent); }

/* 登录框 */
.login-box { max-width: 340px; margin: 12vh auto 0; }
.login-box .panel { padding: 22px 24px; }
.login-box form.fs-form { grid-template-columns: 1fr; }
.login-box form.fs-form .actions { grid-column: 1; }
.login-box input { width: 100%; }

/* 树 */
ul.tree { list-style: none; padding-left: 18px; margin: 0; }
ul.tree.root { padding-left: 0; }
ul.tree li { margin: 4px 0; }
.tree-node { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 4px 6px; border-radius: 4px; }
.tree-node:hover { background: #f8fbff; }

@media (max-width: 760px) {
  .app { flex-direction: column; }
  .side { width: auto; display: flex; flex-wrap: wrap; padding: 4px; }
  .side .brand { width: 100%; padding: 6px 10px; }
  .side a { padding: 6px 10px; }
  .side a.active { border-left: none; padding-left: 10px; }
  .side .nav-group { display: flex; flex-wrap: wrap; align-items: center; width: 100%; }
  .side .nav-group-title { width: auto; padding: 6px 10px; }
  .side .nav-group-items { display: flex; flex-wrap: wrap; }
  form.fs-form { grid-template-columns: 1fr; }
  form.fs-form .actions, form.fs-form .hint { grid-column: 1; }
}

/* 11-04 代理后台改版:信息表、按钮配色、多行文本 */
button.warn { background: #e8a33d; border-color: #e8a33d; }
button.ok { background: #3a9d5d; border-color: #3a9d5d; }
.info-table th { width: 120px; text-align: left; white-space: nowrap; background: var(--bg, #f6f7f9); }
.info-table td { vertical-align: middle; }
.info-table textarea { width: 100%; box-sizing: border-box; margin-bottom: 6px; }
.pre-wrap { white-space: pre-wrap; }

/* 11-10 可搜索下拉(FS.combo):列表挂在 body 上、fixed 定位,弹窗里也不会被裁掉 */
.combo { display: inline-flex; position: relative; min-width: 0; }
.combo > input { min-width: 15em; width: 100%; }
form.fs-form:not(.inline) .combo { display: flex; }
.combo-list { position: fixed; z-index: 1000; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(15, 23, 42, .18); overflow: auto; max-width: min(520px, 94vw); padding: 2px 0; }
.combo-item { padding: 4px 10px; cursor: pointer; white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.combo-item.active { background: rgba(37, 99, 235, .1); }
.combo-item.picked { font-weight: 600; }
.combo-tip { padding: 4px 10px; color: var(--muted); font-size: 12px; }

/* 11-10 奖励编辑器:物品下拉 + 数量,一行一项 */
.reward-editor { display: flex; flex-direction: column; gap: 6px; }
.reward-editor .reward-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.reward-editor .reward-row .combo { flex: 1 1 260px; }
.reward-editor .reward-row input[type=number] { width: 9em; }
.reward-editor .reward-quick { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }


/* 11-10 代理后台首页推广链接卡片:醒目的主色边框 + 大号链接 + 复制按钮 */
.promo-card { background: linear-gradient(135deg, #eff6ff, #ffffff); border: 2px solid var(--accent); border-radius: 10px; padding: 16px 18px; margin-bottom: 12px; }
.promo-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.promo-head h2 { margin: 0; font-size: 18px; color: var(--accent); }
.promo-row { display: flex; gap: 8px; flex-wrap: wrap; }
.promo-row .promo-url { flex: 1 1 320px; font-family: var(--mono); font-size: 16px; padding: 10px 12px; background: #fff; border: 1px solid #bfdbfe; color: var(--ink); }
.promo-row .promo-copy { font-size: 16px; padding: 8px 22px; }
.promo-foot { display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: center; margin-top: 10px; }
.promo-foot strong { font-size: 15px; color: var(--ink); }
