:root {
  --bg: #0b0f17;
  --bg-soft: #111725;
  --panel: #151c2c;
  --panel-2: #1b2436;
  --border: #232e44;
  --border-soft: #1c2537;
  --text: #e6ecf7;
  --text-dim: #93a1bd;
  --text-mute: #64738f;
  --accent: #4f8cff;
  --accent-soft: rgba(79, 140, 255, .14);
  --green: #23c98b;
  --green-soft: rgba(35, 201, 139, .14);
  --red: #ff6b6b;
  --red-soft: rgba(255, 107, 107, .14);
  --amber: #ffb648;
  --amber-soft: rgba(255, 182, 72, .14);
  --purple: #a78bfa;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 28px rgba(0, 0, 0, .38);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.muted { color: var(--text-mimute); color: var(--text-mute); }
.mono { font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace; }

/* ---------------- 登录 ---------------- */
.login-screen {
  position: fixed; inset: 0; display: grid; place-items: center; z-index: 50;
}
.login-bg {
  position: absolute; inset: 0;
  background:
    radial-gradient(700px 400px at 20% 10%, rgba(79,140,255,.20), transparent 60%),
    radial-gradient(600px 400px at 85% 80%, rgba(167,139,250,.16), transparent 60%);
}
.login-card {
  position: relative; width: 380px; padding: 34px;
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 16px; box-shadow: var(--shadow);
}
.login-logo { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.login-logo h1 { font-size: 22px; letter-spacing: .5px; }
.login-logo p { font-size: 12.5px; color: var(--text-mute); margin-top: 2px; }
.logo-mark {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--purple));
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: 15px;
  letter-spacing: .5px;
}
.logo-mark.small { width: 30px; height: 30px; border-radius: 8px; font-size: 12px; }
.login-error {
  margin-top: 12px; padding: 9px 12px; border-radius: var(--radius-sm);
  background: var(--red-soft); color: var(--red); font-size: 13px;
}
.login-hint { margin-top: 16px; text-align: center; font-size: 12px; color: var(--text-mute); }
.login-hint code {
  background: var(--panel-2); padding: 2px 6px; border-radius: 4px;
  font-family: ui-monospace, monospace; color: var(--text-dim);
}

/* ---------------- 布局 ---------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 218px; flex: none; background: var(--bg-soft);
  border-right: 1px solid var(--border-soft);
  display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 10px; padding: 20px 18px;
  font-weight: 700; font-size: 16px; letter-spacing: .4px;
  border-bottom: 1px solid var(--border-soft);
}
.nav { padding: 12px 10px; flex: 1; }
.nav a {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  color: var(--text-dim); text-decoration: none; border-radius: var(--radius-sm);
  margin-bottom: 2px; font-size: 13.5px; transition: .15s;
}
.nav a:hover { background: var(--panel); color: var(--text); }
.nav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.nav .ico { width: 16px; text-align: center; font-size: 13px; opacity: .9; }
.sidebar-foot { padding: 14px; border-top: 1px solid var(--border-soft); }
.scheduler-status {
  display: flex; align-items: center; gap: 8px; font-size: 12px;
  color: var(--text-mute); margin-bottom: 10px;
}
.scheduler-status .dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}
.scheduler-status.paused .dot { background: var(--amber); box-shadow: 0 0 0 3px var(--amber-soft); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 18px 26px; border-bottom: 1px solid var(--border-soft);
  background: rgba(11,15,23,.85); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topbar h2 { font-size: 18px; font-weight: 650; }
.topbar p { font-size: 12.5px; margin-top: 1px; }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.content { padding: 22px 26px 60px; flex: 1; }

/* ---------------- 按钮 ---------------- */
.btn {
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  padding: 8px 14px; border-radius: var(--radius-sm); cursor: pointer;
  font-size: 13px; font-family: inherit; transition: .15s; white-space: nowrap;
}
.btn:hover { background: #222d42; border-color: #2e3b55; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.btn-primary:hover { background: #3d7cf0; border-color: #3d7cf0; }
.btn-danger { background: var(--red-soft); border-color: rgba(255,107,107,.35); color: var(--red); }
.btn-danger:hover { background: rgba(255,107,107,.22); }
.btn-success { background: var(--green-soft); border-color: rgba(35,201,139,.35); color: var(--green); }
.btn-success:hover { background: rgba(35,201,139,.22); }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 11px; font-size: 12.5px; }
.btn-block { width: 100%; padding: 10px; }
.icon-btn {
  background: none; border: none; color: var(--text-mute); cursor: pointer;
  font-size: 15px; padding: 4px 8px; border-radius: 6px;
}
.icon-btn:hover { background: var(--panel-2); color: var(--text); }

/* ---------------- 表单 ---------------- */
.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: 12.5px; color: var(--text-dim); margin-bottom: 6px; }
input, select, textarea {
  width: 100%; padding: 9px 11px; background: var(--bg-soft);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  color: var(--text); font-size: 13.5px; font-family: inherit; outline: none;
  transition: .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 68px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.form-grid .full { grid-column: 1 / -1; }
.checkbox { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.checkbox input { width: auto; margin: 0; accent-color: var(--accent); }

/* ---------------- 卡片/网格 ---------------- */
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
@media (max-width: 1150px) { .grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 820px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 18px;
}
.panel-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px; gap: 12px;
}
.panel-head h3 { font-size: 14.5px; font-weight: 620; }

.stat {
  background: var(--panel); border: 1px solid var(--border-soft);
  border-radius: var(--radius); padding: 16px 18px; position: relative; overflow: hidden;
}
.stat::after {
  content: ''; position: absolute; right: -20px; top: -20px;
  width: 80px; height: 80px; border-radius: 50%; background: var(--accent-soft);
}
.stat .label { font-size: 12px; color: var(--text-mute); margin-bottom: 7px; }
.stat .value { font-size: 24px; font-weight: 700; letter-spacing: -.4px; }
.stat .value small { font-size: 13px; font-weight: 500; color: var(--text-mute); margin-left: 3px; }
.stat .sub { font-size: 11.5px; color: var(--text-mute); margin-top: 5px; }
.stat.green::after { background: var(--green-soft); }
.stat.red::after { background: var(--red-soft); }
.stat.amber::after { background: var(--amber-soft); }
.stat.purple::after { background: rgba(167,139,250,.14); }

/* ---------------- 表格 ---------------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; padding: 9px 12px; color: var(--text-mute); font-weight: 500;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .4px;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
td { padding: 11px 12px; border-bottom: 1px solid var(--border-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: rgba(255,255,255,.018); }
.empty { padding: 44px 20px; text-align: center; color: var(--text-mute); font-size: 13px; }
.empty .big { font-size: 34px; margin-bottom: 10px; opacity: .35; }

/* ---------------- 标签 ---------------- */
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px;
  border-radius: 20px; font-size: 11.5px; font-weight: 500; white-space: nowrap;
  background: var(--panel-2); color: var(--text-dim); border: 1px solid var(--border);
}
.tag.green { background: var(--green-soft); color: var(--green); border-color: rgba(35,201,139,.3); }
.tag.red { background: var(--red-soft); color: var(--red); border-color: rgba(255,107,107,.3); }
.tag.amber { background: var(--amber-soft); color: var(--amber); border-color: rgba(255,182,72,.3); }
.tag.blue { background: var(--accent-soft); color: var(--accent); border-color: rgba(79,140,255,.3); }
.tag.purple { background: rgba(167,139,250,.14); color: var(--purple); border-color: rgba(167,139,250,.3); }

/* ---------------- 虚拟卡 ---------------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.vcard {
  position: relative; border-radius: 14px; padding: 18px; min-height: 176px;
  background: linear-gradient(135deg, #1c2740, #131a29);
  border: 1px solid var(--border); overflow: hidden;
  display: flex; flex-direction: column; justify-content: space-between;
}
.vcard.visa { background: linear-gradient(135deg, #1d3a63, #14233c); }
.vcard.mastercard { background: linear-gradient(135deg, #3c2a52, #1e1730); }
.vcard.amex { background: linear-gradient(135deg, #1a4a52, #122a30); }
.vcard.unionpay { background: linear-gradient(135deg, #4a2530, #2a1620); }
.vcard.frozen { filter: grayscale(.65); opacity: .78; }
.vcard.expired { filter: grayscale(1); opacity: .6; }
.vcard-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.vcard-brand { font-size: 11px; letter-spacing: 1.4px; text-transform: uppercase; color: rgba(255,255,255,.62); font-weight: 600; }
.vcard-label { font-size: 15px; font-weight: 640; margin-top: 3px; }
.vcard-num {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 15.5px; letter-spacing: 1.6px; margin: 14px 0 12px; color: rgba(255,255,255,.9);
  word-break: break-all;
}
.vcard-bot { display: flex; justify-content: space-between; align-items: flex-end; gap: 10px; }
.vcard-field { font-size: 10px; color: rgba(255,255,255,.5); letter-spacing: .6px; text-transform: uppercase; }
.vcard-field b { display: block; font-size: 12.5px; color: rgba(255,255,255,.88); font-weight: 500; letter-spacing: .4px; margin-top: 2px; text-transform: none; }
.vcard-bal { text-align: right; }
.vcard-bal b { font-size: 16px; font-weight: 700; color: #fff; }
.vcard-actions { display: flex; gap: 6px; margin-top: 12px; flex-wrap: wrap; }
.vcard-actions .btn { background: rgba(255,255,255,.09); border-color: rgba(255,255,255,.14); color: rgba(255,255,255,.88); padding: 5px 10px; font-size: 12px; }
.vcard-actions .btn:hover { background: rgba(255,255,255,.16); }
.vcard-chip {
  position: absolute; right: 18px; top: 62px; width: 38px; height: 28px;
  border-radius: 5px; background: linear-gradient(135deg, #d9b168, #b08a45); opacity: .9;
}

/* ---------------- 模态 ---------------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(5,8,14,.72); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 100; padding: 20px;
}
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  width: 100%; max-width: 560px; max-height: 88vh; display: flex; flex-direction: column;
  box-shadow: var(--shadow);
}
.modal.wide { max-width: 720px; }
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border-soft);
}
.modal-head h3 { font-size: 15.5px; font-weight: 620; }
.modal-body { padding: 20px; overflow-y: auto; }
.modal-foot {
  padding: 14px 20px; border-top: 1px solid var(--border-soft);
  display: flex; justify-content: flex-end; gap: 10px;
}

/* ---------------- Toast ---------------- */
.toast-wrap { position: fixed; top: 18px; right: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast {
  padding: 11px 16px; border-radius: var(--radius-sm); font-size: 13px;
  background: var(--panel-2); border: 1px solid var(--border); box-shadow: var(--shadow);
  animation: slideIn .22s ease; max-width: 340px;
}
.toast.success { border-color: rgba(35,201,139,.45); color: var(--green); }
.toast.error { border-color: rgba(255,107,107,.45); color: var(--red); }
.toast.warning { border-color: rgba(255,182,72,.45); color: var(--amber); }
@keyframes slideIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }

/* ---------------- 下拉 ---------------- */
.bell-wrap { position: relative; }
.badge {
  position: absolute; top: -3px; right: -3px; background: var(--red); color: #fff;
  font-size: 10px; min-width: 16px; height: 16px; border-radius: 8px;
  display: grid; place-items: center; padding: 0 4px; font-weight: 600;
}
.dropdown {
  position: absolute; right: 0; top: 38px; width: 340px; max-height: 400px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); z-index: 60; padding: 8px;
}
.notif {
  padding: 9px 11px; border-radius: var(--radius-sm); margin-bottom: 4px;
  border-left: 2.5px solid var(--accent); background: var(--bg-soft);
}
.notif.success { border-left-color: var(--green); }
.notif.warning { border-left-color: var(--amber); }
.notif.error { border-left-color: var(--red); }
.notif b { font-size: 13px; display: block; margin-bottom: 2px; }
.notif p { font-size: 12px; color: var(--text-mute); line-height: 1.45; }
.notif time { font-size: 10.5px; color: var(--text-mute); display: block; margin-top: 4px; }

/* ---------------- 图表 ---------------- */
.chart-box { position: relative; height: 240px; }
.chart-box.tall { height: 300px; }

/* ---------------- 工具条 ---------------- */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px; flex-wrap: wrap;
}
.toolbar-left { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: 9px; }
.filter-select { width: auto; min-width: 130px; }
.search-input { width: 220px; }

.hint {
  display: flex; gap: 9px; padding: 11px 13px; border-radius: var(--radius-sm);
  background: var(--accent-soft); border: 1px solid rgba(79,140,255,.24);
  font-size: 12.5px; color: var(--text-dim); line-height: 1.5; margin-bottom: 14px;
}
.hint.warn { background: var(--amber-soft); border-color: rgba(255,182,72,.26); }
.hint .i { flex: none; }

.row-actions { display: flex; gap: 6px; justify-content: flex-end; }
.nowrap { white-space: nowrap; }
.amt-debit { color: var(--red); font-weight: 600; }
.amt-credit { color: var(--green); font-weight: 600; }
.right { text-align: right; }
.center { text-align: center; }
