/* PayHub 商户自助后台样式（独立于平台后台，青色系区分身份） */
:root {
  --brand: #0d9b76;
  --brand-dark: #0a7d5f;
  --brand-light: #ccfbf1;
  --ink: #0f172a;
  --ink-2: #475569;
  --ink-3: #94a3b8;
  --line: #e2e8f0;
  --bg: #f6f8fa;
  --white: #fff;
  --ok: #059669;
  --ok-bg: #ecfdf5;
  --warn: #b45309;
  --warn-bg: #fffbeb;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --blue: #2563eb;
  --blue-bg: #eff6ff;
  --radius: 10px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.muted { color: var(--ink-2); }
.tiny { font-size: 12px; }
.nowrap { white-space: nowrap; }

/* ---------------- 登录页 ---------------- */
.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(1200px 600px at 15% 0%, #d9f2ee 0%, #f6f8fa 55%), var(--bg);
  padding: 24px;
}
.login-wrap { width: 100%; max-width: 400px; }
.login-brand { display: flex; align-items: baseline; gap: 10px; margin-bottom: 18px; padding-left: 4px; }
.login-brand .logo { font-size: 20px; font-weight: 700; color: var(--brand-dark); display: flex; align-items: center; gap: 8px; }
.login-brand .dot { width: 10px; height: 10px; border-radius: 5px; background: var(--brand); display: inline-block; }
.login-brand .sub { font-size: 12px; color: var(--ink-3); }
.login-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 26px 24px 20px;
  box-shadow: 0 12px 32px rgba(15, 118, 110, .10);
}
.login-card h1 { margin: 0 0 4px; font-size: 18px; }
.login-card .hint { margin: 0 0 18px; font-size: 12px; color: var(--ink-3); line-height: 1.6; }
.login-card label { display: block; font-size: 12px; color: var(--ink-2); margin: 12px 0 6px; }
.login-card input {
  width: 100%; height: 40px; padding: 0 12px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 8px; background: #fbfcfd; outline: none;
}
.login-card input:focus { border-color: var(--brand); background: #fff; box-shadow: 0 0 0 3px rgba(15,118,110,.1); }
.btn-primary {
  width: 100%; height: 40px; margin-top: 18px;
  background: var(--brand); color: #fff; border: 0; border-radius: 8px;
  font-size: 14px; cursor: pointer;
}
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled { opacity: .7; cursor: default; }
.err { margin-top: 12px; font-size: 12px; color: var(--danger); background: var(--danger-bg); border-radius: 6px; padding: 8px 10px; display: none; }
.err.show { display: block; }
.login-card .foot { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); }
.login-tip { text-align: center; margin-top: 16px; font-size: 12px; color: var(--ink-3); }

/* ---------------- 应用框架 ---------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 216px; flex: 0 0 216px;
  background: #0b5a49; color: #d7ebe8;
  display: flex; flex-direction: column;
}
.brand { padding: 18px 18px 16px; border-bottom: 1px solid rgba(255,255,255,.1); }
.brand .logo { font-size: 16px; font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 9px; height: 9px; border-radius: 5px; background: #5eead4; }
.brand .ver { font-size: 11px; color: #8fb8b2; margin-top: 5px; }
.brand .mname { font-size: 12px; color: #cdeee9; margin-top: 8px; word-break: break-all; }
.nav { flex: 1; padding: 8px 0; }
.nav-item {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 18px; font-size: 13px; cursor: pointer; color: #b9d8d3;
  border-left: 3px solid transparent;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(255,255,255,.12); color: #fff; border-left-color: #2ad1a8; font-weight: 500; }
.nav-item .ico { width: 14px; text-align: center; font-size: 12px; opacity: .85; }
.sidebar-foot { padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.1); font-size: 12px; }
.who { color: #fff; margin-bottom: 8px; }
.link-btn { color: #9fd2cb; cursor: pointer; }
.link-btn:hover { color: #fff; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 56px; background: var(--white); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px; position: sticky; top: 0; z-index: 5;
}
.topbar .title { font-size: 15px; font-weight: 600; }
.topbar .right { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--ink-3); }
.content { padding: 20px 22px 40px; }

/* ---------------- 通用组件 ---------------- */
.card {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; margin-bottom: 16px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head h2 { margin: 0; font-size: 15px; }
.card-head .sub { font-size: 12px; color: var(--ink-3); margin-top: 4px; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 16px; }
.stat {
  background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px;
}
.stat .label { font-size: 12px; color: var(--ink-3); }
.stat .value { font-size: 24px; font-weight: 700; margin: 8px 0 4px; color: var(--ink); }
.stat .value .unit { font-size: 13px; font-weight: 400; color: var(--ink-2); margin-left: 2px; }
.stat .foot { font-size: 12px; color: var(--ink-3); }

table { width: 100%; border-collapse: collapse; }
/* 表格放进横向滚动容器：窄屏时表内滚动，不撑破整页 */
.table-wrap { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-wrap table { min-width: 620px; }
th, td { text-align: left; padding: 11px 10px; font-size: 13px; border-bottom: 1px solid var(--line); }
th { font-size: 12px; color: var(--ink-3); font-weight: 500; background: #fbfcfd; }
tr:last-child td { border-bottom: 0; }
.empty { text-align: center; color: var(--ink-3); padding: 34px 0; font-size: 13px; }

.tag { display: inline-block; padding: 2px 8px; border-radius: 5px; font-size: 12px; white-space: nowrap; }
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-idle { background: #f1f5f9; color: var(--ink-2); }
.tag-blue { background: var(--blue-bg); color: var(--blue); }
.tag-warn { background: var(--warn-bg); color: var(--warn); }
.tag-red { background: var(--danger-bg); color: var(--danger); }

.btn {
  height: 32px; padding: 0 13px; border: 1px solid var(--line); border-radius: 7px;
  background: var(--white); color: var(--ink); font-size: 13px; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: #cbd5e1; background: #fbfcfd; }
.btn-sm { height: 27px; padding: 0 9px; font-size: 12px; border-radius: 6px; }
.btn-brand { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-brand:hover { background: var(--brand-dark); }
.btn-danger { color: var(--danger); border-color: #fecaca; }
.btn-danger:hover { background: var(--danger-bg); }
.btn:disabled { opacity: .6; cursor: default; }

input[type=text], input[type=password], input[type=date], select {
  height: 32px; padding: 0 10px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 7px; background: #fff; outline: none;
}
input:focus, select:focus { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(15,118,110,.08); }
textarea { width: 100%; min-height: 70px; padding: 9px 10px; font-size: 13px; border: 1px solid var(--line); border-radius: 7px; outline: none; font-family: inherit; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.form-row .desc { font-size: 12px; color: var(--ink-3); margin-top: 5px; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pager { display: flex; justify-content: space-between; align-items: center; margin-top: 14px; font-size: 12px; color: var(--ink-3); }

.chart { display: flex; align-items: flex-end; gap: 14px; height: 150px; padding: 8px 4px 0; }
.chart .bar-wrap { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.chart .bar { width: 100%; max-width: 46px; background: linear-gradient(180deg, #2dd4bf, var(--brand)); border-radius: 5px 5px 0 0; min-height: 3px; }
.chart .cval { font-size: 11px; color: var(--ink-3); margin-bottom: 5px; }
.chart .clabel { font-size: 11px; color: var(--ink-3); margin-top: 6px; }

.notice { background: var(--warn-bg); border: 1px solid #fde68a; color: var(--warn); border-radius: 8px; padding: 10px 12px; font-size: 12px; line-height: 1.6; }
.secret-box {
  display: flex; align-items: center; gap: 8px; background: #0f172a; color: #7dd3fc;
  border-radius: 8px; padding: 10px 12px; font-size: 12px; overflow-x: auto;
}
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 10px 12px; font-size: 13px; }
.kv .k { color: var(--ink-3); font-size: 12px; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.45);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 20px;
}
.modal-mask.show { display: flex; }
.modal { background: #fff; border-radius: 12px; width: 100%; max-width: 760px; max-height: 86vh; display: flex; flex-direction: column; }
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; font-size: 15px; }
.modal-close { cursor: pointer; color: var(--ink-3); font-size: 18px; line-height: 1; }
.modal-body { padding: 18px 20px; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: #0f172a; color: #fff; padding: 10px 18px; border-radius: 8px;
  font-size: 13px; opacity: 0; pointer-events: none; transition: all .22s; z-index: 90;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--danger); }

/* ---------------- 窄屏：侧栏改抽屉 ---------------- */
.tb-left { display: flex; align-items: center; min-width: 0; }
.burger {
  display: none; align-items: center; justify-content: center;
  width: 34px; height: 30px; margin-right: 10px; border: 1px solid var(--line);
  border-radius: 8px; background: #fff; color: var(--ink-2); cursor: pointer; font-size: 17px; line-height: 1;
}
.nav-mask { position: fixed; inset: 0; background: rgba(4, 12, 10, .5); z-index: 55; display: none; }
.nav-mask.show { display: block; }

@media (max-width: 900px) {
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: 244px; z-index: 60;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(2, 8, 6, .45);
  }
  .sidebar.open { transform: none; }
  .burger { display: inline-flex; }
  .topbar { height: 52px; padding: 0 14px; }
  .content { padding: 14px 14px 32px; }
  .stat-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat .value { font-size: 20px; }
  .card { padding: 14px; }
  .card-head { flex-direction: column; align-items: flex-start; gap: 8px; }
  .toolbar { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .toolbar > * { min-width: 0; }
  .toolbar input[type=text] { grid-column: 1 / -1; }
  .toolbar select, .toolbar .btn { width: 100%; }
  .kv { grid-template-columns: 96px 1fr; font-size: 12.5px; }
  .modal { max-height: 88vh; }
  th, td { padding: 9px 8px; font-size: 12.5px; }
  .table-wrap th, .table-wrap td { white-space: nowrap; }
  .chart { height: 120px; gap: 8px; }
}
@media (max-width: 480px) {
  .stat-grid { grid-template-columns: 1fr; }
  .modal-foot { flex-wrap: wrap; justify-content: stretch; }
  .modal-foot .btn { flex: 1 1 100%; }
  .chart { height: 104px; gap: 6px; }
  .cval { font-size: 10px; }
}
