/* UID 码牌收款系统 - 共享后台样式（参照第三方支付平台 go 风格） */
* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: "Microsoft YaHei", -apple-system, sans-serif; background: #f2f5f9; color: #26313d; font-size: 14px; }
a { color: #2563eb; text-decoration: none; }

/* ================= 顶栏 ================= */
.topbar { display: flex; align-items: center; gap: 14px; padding: 0 20px; height: 56px; background: #ffffff; border-bottom: 1px solid #e3e8f0; position: sticky; top: 0; z-index: 10; box-shadow: 0 1px 4px rgba(30, 60, 110, .06); }
.topbar .brand { font-size: 17px; font-weight: 700; color: #2563eb; white-space: nowrap; }
.topbar nav { display: flex; gap: 4px; flex: 1; overflow-x: auto; scrollbar-width: none; }
.topbar nav::-webkit-scrollbar { display: none; }
.topbar nav a { padding: 7px 12px; border-radius: 6px; color: #526079; white-space: nowrap; cursor: pointer; }
.topbar nav a.on, .topbar nav a.active, .topbar nav a:hover { background: #eaf2ff; color: #2563eb; }
.topbar .user { color: #526079; font-size: 13px; white-space: nowrap; }
.topbar .logout { cursor: pointer; color: #dc2626; border: 1px solid #f3c1c1; padding: 5px 12px; border-radius: 6px; white-space: nowrap; }
.nav-toggle { display: none; }

/* ================= 主体 ================= */
.container { margin: 0 auto; padding: 20px; }
.page-title { font-size: 17px; font-weight: 700; color: #1b2533; margin-bottom: 14px; }

.card { background: #ffffff; border: 1px solid #e3e8f0; border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; overflow-x: auto; box-shadow: 0 1px 3px rgba(30, 60, 110, .05); }
.card h4 { font-size: 14px; margin-bottom: 12px; color: #1b2533; }

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: #ffffff; border: 1px solid #e3e8f0; border-radius: 10px; padding: 14px 16px; box-shadow: 0 1px 3px rgba(30, 60, 110, .05); }
.stat span { display: block; color: #7a8699; font-size: 13px; margin-bottom: 8px; }
.stat b { display: block; font-size: 22px; font-weight: 700; color: #2563eb; }

/* ================= 服务器状态（看板） ================= */
.sys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.sys-item .sys-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; color: #526079; font-size: 13px; }
.sys-item .sys-head b { color: #1b2533; font-size: 16px; }
.sys-item .sys-bar { height: 8px; background: #e7ecf3; border-radius: 4px; overflow: hidden; margin-bottom: 6px; }
.sys-item .sys-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #2563eb, #5aa2ff); transition: width .6s; }
.sys-item .sys-bar i.danger { background: linear-gradient(90deg, #dc2626, #f87171); }
.sys-item .sys-sub { color: #7a8699; font-size: 12px; min-height: 16px; }

/* ================= 表格 ================= */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 9px 12px; border-bottom: 1px solid #e9edf4; white-space: nowrap; font-size: 13px; }
th { color: #7a8699; font-weight: 600; background: #f6f8fb; }
tr:hover td { background: #f7faff; }
.warn-line td { background: #fff9ee; }
tr.warn-line:hover td { background: #fff4de; }

/* 状态徽章（胶囊） */
.tag { display: inline-block; padding: 2px 10px; border-radius: 10px; font-size: 12px; }
.t-green { background: #d9f5e7; color: #0a7a4d; }
.t-red { background: #fde0de; color: #c62a26; }
.t-org { background: #fdf0d3; color: #b7791f; }
.t-gry { background: #eef1f5; color: #7a8699; }
.t-blu { background: #dbe9ff; color: #1d4ed8; }

/* ================= 按钮 ================= */
.btn { cursor: pointer; border: 0; border-radius: 6px; padding: 8px 16px; font-size: 14px; background: #2563eb; color: #fff; }
.btn:hover { opacity: .9; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.grn { background: #059669; }
.btn.red { background: #dc2626; }
.btn.org { background: #d97706; }
.btn.blue { background: #2563eb; }
.btn.gry { background: #8a97a8; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
td button { padding: 4px 10px; font-size: 12px; }
td button + button { margin-left: 6px; }

/* ================= 表单 ================= */
input, select, textarea { background: #ffffff; border: 1px solid #cfd8e6; color: #26313d; border-radius: 6px; padding: 8px 10px; font-size: 14px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37, 99, 235, .12); }
input[readonly], textarea[readonly] { background: #f2f5f9; }
.frm { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin-bottom: 12px; }
.frm label { font-size: 12px; color: #7a8699; display: block; margin-bottom: 4px; }
.bar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.pager { display: flex; justify-content: flex-end; gap: 10px; align-items: center; margin-top: 12px; color: #7a8699; font-size: 13px; }
.pager button { padding: 5px 12px; border: 1px solid #cfd8e6; border-radius: 6px; background: #fff; cursor: pointer; }
.pager button:hover { border-color: #2563eb; color: #2563eb; }
.pager button:disabled { opacity: .5; cursor: not-allowed; }
.pager input[type=number], .pager select { padding: 5px 8px; border: 1px solid #cfd8e6; border-radius: 6px; background: #fff; font-size: 13px; color: #526079; }
.pager input[type=number]:focus, .pager select:focus { outline: none; border-color: #2563eb; }
button.ghost { background: transparent; border: 1px solid #cfd8e6; color: #526079; }
button.ghost:hover { border-color: #2563eb; color: #2563eb; }

.muted { color: #7a8699; }
.team-checks { display: flex; flex-wrap: wrap; gap: 8px; padding: 10px; border: 1px solid #e3e8f0; border-radius: 8px; background: #fafbfc; max-height: 172px; overflow: auto; }
.team-chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 14px; border: 1px solid #cfd8e6; border-radius: 20px; background: #fff; font-size: 13px; color: #4a5568; cursor: pointer; user-select: none; transition: all .15s; }
.team-chip:hover { border-color: #2563eb; color: #2563eb; }
.team-chip.on { border-color: #2563eb; background: rgba(37, 99, 235, .08); color: #2563eb; font-weight: 600; }
.team-chip .tick { display: none; font-weight: 700; }
.team-chip.on .tick { display: inline; }
.team-label { display: flex; align-items: center; gap: 10px; }
.team-label .ops { margin-left: auto; display: flex; align-items: center; gap: 4px; font-size: 12px; }
.team-label .ops a { color: #2563eb; text-decoration: none; padding: 2px 6px; border-radius: 4px; }
.team-label .ops a:hover { background: rgba(37, 99, 235, .08); }
.team-label .cnt { color: #27ae60; font-weight: 600; }
.events { max-height: 260px; overflow: auto; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13px; align-items: center; }
.kv span { color: #7a8699; }
.kv b { color: #26313d; word-break: break-all; font-weight: 600; }
.result { background: #f6f8fb; border: 1px solid #e3e8f0; border-radius: 8px; padding: 14px; margin-top: 14px; font-size: 13px; line-height: 2; }
a.link { color: #2563eb; }

/* ================= 弹窗 ================= */
.dlg { display: none; position: fixed; inset: 0; background: rgba(23, 38, 66, .45); align-items: center; justify-content: center; z-index: 100; }
.dlg.on { display: flex; }
.dlg .box { background: #ffffff; border: 1px solid #dbe3ee; border-radius: 10px; padding: 20px; width: 520px; max-width: 94vw; max-height: 86vh; overflow: auto; box-shadow: 0 12px 40px rgba(23, 38, 66, .18); }
.dlg h4 { margin-bottom: 12px; color: #1b2533; }

/* ================= 提示 ================= */
.toast { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); background: #ffffff; border: 1px solid #dbe3ee; color: #26313d; padding: 10px 20px; border-radius: 8px; z-index: 999; display: none; box-shadow: 0 6px 24px rgba(23, 38, 66, .16); }
.toast.show { display: block; }

.hide { display: none; }

/* ================= 省市搜索选择 ================= */
.region-picker { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.combo { position: relative; }
.combo-input { width: 100%; }
.combo-list { position: absolute; top: 100%; left: 0; right: 0; max-height: 220px; overflow: auto; background: #fff; border: 1px solid #cfd8e6; border-radius: 6px; margin-top: 4px; z-index: 30; box-shadow: 0 6px 20px rgba(23, 38, 66, .12); }
.combo-item { padding: 8px 10px; cursor: pointer; font-size: 13px; color: #26313d; }
.combo-item:hover { background: #eaf2ff; }
.combo-item.on { background: #eaf2ff; color: #2563eb; }
.combo-empty { padding: 10px; color: #7a8699; font-size: 13px; text-align: center; }

/* ================= 登录页 ================= */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.login-wrap { width: 100%; display: flex; align-items: center; justify-content: center; }
.login-card { width: 360px; background: #ffffff; border: 1px solid #e3e8f0; border-radius: 12px; padding: 34px 30px; box-shadow: 0 12px 40px rgba(23, 38, 66, .12); }
.login-card h1 { font-size: 20px; color: #2563eb; text-align: center; margin-bottom: 6px; }
.login-card .sub { text-align: center; color: #7a8699; font-size: 13px; margin-bottom: 24px; }
.login-card label { display: block; font-size: 13px; color: #526079; margin-bottom: 6px; }
.login-card input { width: 100%; margin-bottom: 14px; }
.login-card button {
  width: 100%; padding: 12px; margin-top: 4px; font-size: 15px; font-weight: 600;
  letter-spacing: 6px; text-indent: 6px; color: #fff;
  background: linear-gradient(135deg, #3b82f6, #2563eb); border: 0; border-radius: 8px; cursor: pointer;
  box-shadow: 0 6px 16px rgba(37, 99, 235, .35); transition: all .15s ease;
}
.login-card button:hover { background: linear-gradient(135deg, #2563eb, #1d4ed8); box-shadow: 0 8px 20px rgba(37, 99, 235, .45); transform: translateY(-1px); }
.login-card button:active { transform: translateY(0); box-shadow: 0 4px 10px rgba(37, 99, 235, .35); }
.login-card .err { color: #dc2626; font-size: 13px; margin-top: 10px; min-height: 18px; text-align: center; }

/* ================= 导航自适应（PC 宽度不足时自动折叠为汉堡菜单） ================= */
.topbar.collapsed .nav-toggle { display: inline-block; margin-left: auto; font-size: 22px; line-height: 1; cursor: pointer; color: #526079; padding: 6px 10px; border-radius: 6px; }
.topbar.collapsed .nav-toggle:active { background: #eaf2ff; color: #2563eb; }
.topbar.collapsed nav { display: none; position: absolute; top: 56px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 2px; padding: 8px 10px; background: #ffffff; border-bottom: 1px solid #e3e8f0; box-shadow: 0 10px 20px rgba(23, 38, 66, .12); z-index: 9; }
.topbar.collapsed nav.open { display: flex; }
.topbar.collapsed nav a { padding: 12px 14px; }
.topbar.collapsed .user { display: none; }

/* ================= 移动端适配 ================= */
@media (max-width: 768px) {
  .topbar { height: 56px; padding: 0 12px; gap: 10px; }
  .topbar nav { display: none; position: absolute; top: 56px; left: 0; right: 0; flex-direction: column; align-items: stretch; gap: 2px; padding: 8px 10px; background: #ffffff; border-bottom: 1px solid #e3e8f0; box-shadow: 0 10px 20px rgba(23, 38, 66, .12); }
  .topbar nav.open { display: flex; }
  .topbar nav a { padding: 12px 14px; }
  .topbar .user { display: none; }
  .nav-toggle { display: inline-block; margin-left: auto; font-size: 22px; line-height: 1; cursor: pointer; color: #526079; padding: 6px 10px; border-radius: 6px; }
  .nav-toggle:active { background: #eaf2ff; color: #2563eb; }
  .container { padding: 12px 10px; }
  .card { padding: 14px; }
  th, td { padding: 8px; font-size: 12px; }
  .grid { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; }
  .stat { padding: 12px; }
  .stat b { font-size: 18px; }
  .frm { grid-template-columns: 1fr; }
  .dlg .box { padding: 16px; }
  .pager { flex-wrap: wrap; justify-content: center; }
  .login-card { max-width: 92vw; }
  /* 手机端顶栏：品牌名显示不下时换行（不省略），按钮与汉堡在下一行 */
  .topbar { height: auto; min-height: 56px; padding: 8px 12px; flex-wrap: wrap; align-content: center; }
  .topbar nav { top: 100%; }
  .topbar .brand { order: -1; flex: 1 1 auto; min-width: 0; white-space: normal; line-height: 1.25; font-size: 15px; word-break: break-all; }
  .topbar .logout { padding: 4px 8px; font-size: 12px; white-space: nowrap; }
  .topbar .nav-toggle { flex: 0 0 auto; }
  .region-picker { grid-template-columns: 1fr; }
  /* 表格卡片化：仅作用于有表头的表格（.m-card，由 mobile.js 标记） */
  table.m-card { display: block; }
  table.m-card thead { display: none; }
  table.m-card tbody { display: block; }
  table.m-card tbody tr { display: block; background: #fff; border: 1px solid #e3e8f0; border-radius: 8px; padding: 4px 12px; margin-bottom: 10px; }
  table.m-card tbody td { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px 12px; padding: 7px 0; border-bottom: 1px dashed #e3e8f0; white-space: normal; }
  table.m-card tbody td:last-child { border-bottom: 0; }
  table.m-card tbody td::before { content: attr(data-label); color: #7a8699; flex: 0 0 auto; margin-right: auto; }
  table.m-card tbody td > * { flex: 1 1 auto; text-align: right; }
  table.m-card tbody td > button, table.m-card tbody td > a, table.m-card tbody td > code, table.m-card tbody td > .tag { flex: 0 0 auto; }
}
