/* ===========================================================
 * YFMS 基金账户管理系统 —— 样式（深色金融风格 / PC 端适配）
 * =========================================================== */
:root {
  --bg: #0f1420;
  --bg-2: #131a27;
  --panel: #161d2b;
  --panel-2: #1b2436;
  --border: #26314a;
  --border-2: #33405e;
  --text: #e6ecf5;
  --text-2: #c8d3e5;
  --muted: #8b98ad;
  --accent: #4f7cff;
  --accent-2: #6c8dff;
  --up: #ff4d4f;      /* 涨 → 红 */
  --down: #2ecc71;    /* 跌 → 绿 */
  --warn: #ffb020;
  --radius: 10px;
  --shadow: 0 6px 22px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(1200px 600px at 20% -10%, #1a2338 0%, var(--bg) 55%);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Segoe UI", system-ui, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-2); text-decoration: none; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #2b3652; border-radius: 6px; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100%;
  display: flex; align-items: center; justify-content: center;
  padding: 40px 20px;
}
.login-card {
  width: 420px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 14px; box-shadow: var(--shadow); padding: 30px 32px 26px;
}
.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand .logo {
  width: 52px; height: 52px; margin: 0 auto 12px; border-radius: 14px;
  background: linear-gradient(135deg, #4f7cff, #7b5cff);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 20px; color: #fff; letter-spacing: -1px;
}
.login-brand h1 { margin: 0 0 4px; font-size: 20px; letter-spacing: .5px; }
.login-brand p { margin: 0; color: var(--muted); font-size: 12px; }
.role-tabs { display: flex; gap: 8px; background: var(--bg-2); padding: 4px; border-radius: 10px; margin-bottom: 18px; }
.role-tabs button {
  flex: 1; padding: 9px 0; border: 0; border-radius: 8px; cursor: pointer;
  background: transparent; color: var(--muted); font-size: 13px; font-weight: 600; transition: .18s;
}
.role-tabs button.active { background: var(--accent); color: #fff; }
.login-tip { margin-top: 16px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.7; }
.login-tip code { background: var(--bg-2); padding: 1px 6px; border-radius: 4px; color: var(--text-2); }

/* ---------- 布局 ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; flex: 0 0 216px; background: var(--panel);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { padding: 18px 18px 14px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid var(--border); }
.sidebar .brand .logo {
  width: 34px; height: 34px; border-radius: 9px; flex: 0 0 34px;
  background: linear-gradient(135deg, #4f7cff, #7b5cff);
  display: flex; align-items: center; justify-content: center; font-weight: 800; color: #fff; font-size: 14px;
}
.sidebar .brand b { font-size: 14px; display: block; }
.sidebar .brand span { font-size: 11px; color: var(--muted); }
.nav { padding: 10px 10px; flex: 1; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 8px;
  color: var(--text-2); font-size: 13px; margin-bottom: 3px; cursor: pointer; transition: .15s;
}
.nav a:hover { background: var(--panel-2); }
.nav a.active { background: rgba(79, 124, 255, .16); color: #a9c0ff; font-weight: 600; }
.nav a .ic { width: 18px; text-align: center; opacity: .9; }
.sidebar .foot { padding: 12px; border-top: 1px solid var(--border); font-size: 11px; color: var(--muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 58px; background: var(--panel); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; padding: 0 22px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { margin: 0; font-size: 16px; font-weight: 600; }
.topbar .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.user-box { display: flex; align-items: center; gap: 12px; }
.user-box .who { text-align: right; }
.user-box .who b { display: block; font-size: 13px; }
.user-box .who span { font-size: 11px; color: var(--muted); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: linear-gradient(135deg, #4f7cff, #7b5cff);
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: #fff;
}
.content { padding: 20px 22px 40px; flex: 1; }

/* ---------- 通用组件 ---------- */
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 16px; overflow: hidden;
}
.card-hd {
  padding: 13px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.card-hd h3 { margin: 0; font-size: 14px; font-weight: 600; }
.card-hd .desc { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 8px; }
.card-bd { padding: 16px; }
.card-bd.tight { padding: 0; }

.grid { display: grid; gap: 14px; }
.sub-title {
  font-size: 12px; font-weight: 600; color: var(--text); opacity: .75;
  margin-bottom: 10px; padding-left: 8px; border-left: 3px solid var(--brand, #4f7cff);
}
.g4 { grid-template-columns: repeat(4, 1fr); }
.g3 { grid-template-columns: repeat(3, 1fr); }
.g2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1280px) { .g4 { grid-template-columns: repeat(2, 1fr); } }

.stat {
  background: linear-gradient(160deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 16px;
}
.stat .lb { font-size: 12px; color: var(--muted); display: flex; align-items: center; justify-content: space-between; }
.stat .vl { font-size: 24px; font-weight: 700; margin-top: 8px; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat .ex { font-size: 12px; color: var(--muted); margin-top: 6px; }
.up { color: var(--up); }
.down { color: var(--down); }
.muted { color: var(--muted); }

table.tb { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tb th {
  text-align: left; padding: 10px 12px; background: var(--bg-2); color: var(--muted);
  font-weight: 600; font-size: 12px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
table.tb td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.tb tbody tr:hover { background: rgba(79, 124, 255, .06); }
table.tb .num { text-align: right; font-variant-numeric: tabular-nums; }
.tb-wrap { overflow-x: auto; }
.empty { padding: 34px 0; text-align: center; color: var(--muted); font-size: 13px; }

/* ---------- 批量操作条 ---------- */
.batch-bar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-top: 1px solid var(--border); font-size: 12px;
}
.batch-bar .sep { width: 1px; height: 18px; background: var(--border); }
.batch-bar input[type="date"] { width: auto; padding: 5px 8px; font-size: 12px; }
.batch-bar input[type="checkbox"] { width: auto; cursor: pointer; }
.batch-bar label.chk { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--text-2); }
table.tb input[type="checkbox"] { width: auto; cursor: pointer; }
table.tb th.col-chk, table.tb td.col-chk { width: 34px; text-align: center; padding-left: 8px; padding-right: 8px; }

/* ---------- 分页 ---------- */
.pager {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  flex-wrap: wrap; padding: 10px 12px; border-top: 1px solid var(--border);
}
.pager .p-info { font-size: 12px; color: var(--muted); }
.pager .p-btns { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.pager .p-num {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: 7px;
  border: 1px solid var(--border-2); background: var(--panel-2); color: var(--text-2);
  font-size: 12px; cursor: pointer; font-family: inherit; font-variant-numeric: tabular-nums;
}
.pager .p-num:hover { border-color: var(--accent); color: #fff; }
.pager .p-num.active { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.pager .p-num:disabled { opacity: .45; cursor: not-allowed; }
.pager .p-ellipsis { color: var(--muted); font-size: 12px; padding: 0 2px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px;
  border: 1px solid var(--border-2); background: var(--panel-2); color: var(--text-2);
  cursor: pointer; font-size: 13px; transition: .15s; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); color: #fff; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn.primary:hover { background: #4069e8; }
.btn.danger { color: #ff7a7c; border-color: #5a2b30; }
.btn.danger:hover { background: #3a1e21; border-color: var(--up); color: #ff9b9d; }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 6px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; }

input, select, textarea {
  background: var(--bg-2); border: 1px solid var(--border-2); color: var(--text);
  padding: 8px 10px; border-radius: 8px; font-size: 13px; outline: none; width: 100%;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
input[readonly] { color: var(--muted); }
label.fl { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
@media (max-width: 1100px) { .form-grid { grid-template-columns: repeat(2, 1fr); } }

.tag {
  display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 600;
}
.tag.ok { background: rgba(46, 204, 113, .14); color: #4ade80; }
.tag.no { background: rgba(255, 77, 79, .14); color: #ff8789; }
.tag.info { background: rgba(79, 124, 255, .16); color: #9db5ff; }
.tag.warn { background: rgba(255, 176, 32, .16); color: #ffc457; }

.chart-box { position: relative; padding: 6px 8px 4px; }
.chart-box canvas { width: 100%; height: 320px; display: block; }
.tip {
  position: absolute; display: none; pointer-events: none; z-index: 5;
  background: rgba(12, 17, 26, .95); border: 1px solid var(--tipBorder, #33405e);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; line-height: 1.75; white-space: nowrap;
  box-shadow: var(--shadow);
}
.tip b { color: #fff; }

.seg { display: inline-flex; background: var(--bg-2); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button {
  border: 0; background: transparent; color: var(--muted); padding: 5px 13px;
  border-radius: 6px; cursor: pointer; font-size: 12px; font-family: inherit;
}
.seg button.active { background: var(--accent); color: #fff; font-weight: 600; }

.notice {
  background: rgba(79, 124, 255, .08); border: 1px solid rgba(79, 124, 255, .25);
  border-radius: 8px; padding: 10px 14px; font-size: 13px; color: var(--text-2); margin-bottom: 16px;
  display: flex; gap: 10px; align-items: flex-start;
}
.alert { padding: 10px 14px; border-radius: 8px; font-size: 13px; margin-bottom: 14px; }
.alert.err { background: rgba(255, 77, 79, .12); border: 1px solid rgba(255, 77, 79, .3); color: #ff9b9d; }
.alert.ok { background: rgba(46, 204, 113, .12); border: 1px solid rgba(46, 204, 113, .3); color: #6ee7a8; }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(6, 10, 18, .68); z-index: 100;
  display: none; align-items: center; justify-content: center; padding: 24px;
  backdrop-filter: blur(2px);
}
.mask.show { display: flex; }
.modal {
  width: 560px; max-width: 100%; max-height: 88vh; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border-2); border-radius: 12px; box-shadow: var(--shadow);
}
.modal.sm { width: 420px; }
.modal-hd { padding: 14px 18px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-hd h3 { margin: 0; font-size: 15px; }
.modal-hd .x { cursor: pointer; color: var(--muted); font-size: 18px; line-height: 1; }
.modal-bd { padding: 18px; }
.modal-ft { padding: 12px 18px; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- 其他 ---------- */
.kv { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--border); font-size: 13px; }
.kv:last-child { border-bottom: 0; }
.kv span { color: var(--muted); }
.kv b { font-variant-numeric: tabular-nums; }
.toast {
  position: fixed; left: 50%; top: 26px; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 8px;
  padding: 10px 18px; font-size: 13px; z-index: 200; box-shadow: var(--shadow); display: none;
}
.toast.show { display: block; animation: fade .25s; }
@keyframes fade { from { opacity: 0; transform: translate(-50%, -8px); } to { opacity: 1; transform: translate(-50%, 0); } }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form .f { flex: 1; min-width: 150px; }
.mono { font-variant-numeric: tabular-nums; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.8; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.sec-title { font-size: 13px; font-weight: 600; margin: 0 0 8px; }
