/* 发票管理系统 - 全局样式（响应式，适配电脑端与手机端） */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --primary: #1a5dd8;
  --primary-dark: #12479f;
  --danger: #d93026;
  --success: #1a9e5c;
  --warning: #e6a23c;
  --bg: #f2f4f8;
  --card: #ffffff;
  --border: #e3e7ef;
  --text: #26282e;
  --text-secondary: #6b7280;
  --radius: 10px;
  --shadow: 0 2px 10px rgba(16, 32, 64, 0.08);
}

html, body { height: 100%; }
body {
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 登录页 ---------- */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a5dd8 0%, #2f7fe0 55%, #6ab0f0 100%);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.22);
  padding: 36px 32px;
}
.login-card h1 { font-size: 22px; text-align: center; margin-bottom: 6px; }
.login-card .sub { text-align: center; color: var(--text-secondary); font-size: 13px; margin-bottom: 24px; }
.login-tip {
  margin-top: 16px;
  padding: 10px 12px;
  background: #f6f8fc;
  border-radius: 8px;
  font-size: 12px;
  color: var(--text-secondary);
  border-left: 3px solid var(--primary);
}

/* ---------- 通用组件 ---------- */
.container { max-width: 1080px; margin: 0 auto; padding: 16px; }
.admin-container { max-width: 1440px; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 { font-size: 16px; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.card-title-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.card-title-bar h2 { margin-bottom: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.15s;
  background: #eef1f6;
  color: var(--text);
  white-space: nowrap;
}
.btn:hover { opacity: 0.88; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn-outline { background: transparent; border: 1px solid var(--border); }
.btn-outline-primary { background: transparent; border: 1px solid var(--primary); color: var(--primary); }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px 18px; }
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label { font-size: 13px; color: var(--text-secondary); }
.form-group label .req { color: var(--danger); margin-left: 2px; }
.form-group .hint { font-size: 12px; color: var(--text-secondary); }
.form-group .readonly-note { padding: 8px 12px; background: #f6f8fc; border-radius: 6px; font-size: 13px; color: var(--text-secondary); }

input[type="text"], input[type="password"], input[type="number"], input[type="date"],
input[type="file"], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  background: #fff;
  color: var(--text);
  transition: border-color 0.15s;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); }
textarea { resize: vertical; min-height: 68px; }
input[type="file"] { padding: 6px; background: #fafbfe; }
input:disabled, input[readonly] { background: #f2f4f8; color: #8a90a0; }

.dup-alert {
  display: none;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  background: #fdf0ef;
  color: var(--danger);
  border: 1px solid #f5c6c2;
}
.dup-alert.show { display: block; }
.dup-alert .btn { margin-top: 8px; }

/* 密码强度规则条 */
.pwd-rules { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.pwd-rule {
  font-size: 11px; padding: 2px 8px; border-radius: 12px;
  background: #f0f2f7; color: var(--text-secondary); transition: all .15s;
}
.pwd-rule.met { background: #e9f7f0; color: var(--success); }
.pwd-rule.miss { background: #fdf0ef; color: var(--danger); }

/* 金额/收款状态徽章 */
.badge-pay-partial { background: #fff6e6; color: #b26a00; }
.badge-pay-over { background: #fdf0ef; color: var(--danger); }
.badge-pay-full { background: #e9f7f0; color: var(--success); }
.badge-ocr { background: #eef4ff; color: var(--primary); }
.badge-ocr-warn { background: #fff6e6; color: #b26a00; }
.badge-ocr-bad { background: #fdf0ef; color: var(--danger); }

/* 金额不一致提示（表单内） */
.amt-warn {
  font-size: 12px; padding: 8px 12px; border-radius: 8px; margin-top: 6px;
  background: #fff6e6; color: #b26a00; border: 1px solid #f3d9a4; display: none;
}
.amt-warn.show { display: block; }

.alert-msg {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
  display: none;
}
.alert-msg.show { display: block; }
.alert-msg.error { background: #fdf0ef; color: var(--danger); border: 1px solid #f5c6c2; }
.alert-msg.success { background: #e9f7f0; color: var(--success); border: 1px solid #b9e6d0; }
.alert-msg.info { background: #eef4ff; color: var(--primary); border: 1px solid #c4d8f8; }

/* ---------- 顶部导航 ---------- */
.topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 4px rgba(16, 32, 64, 0.05);
  position: sticky;
  top: 0;
  z-index: 100;
}
.topbar-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 16px;
  height: 54px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 600; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), #4f9df0);
  color: #fff; display: flex; align-items: center; justify-content: center; font-size: 15px;
}
.topbar-nav { display: flex; align-items: center; gap: 12px; }
.user-chip { font-size: 13px; color: var(--text-secondary); display: flex; align-items: center; gap: 6px; }

.bell { position: relative; background: none; border: none; font-size: 16px; cursor: pointer; padding: 6px; color: var(--text); }
.bell .badge {
  position: absolute; top: -2px; right: -2px;
  background: var(--danger); color: #fff;
  font-size: 10px; min-width: 16px; height: 16px;
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  padding: 0 4px; font-weight: 600;
}
.bell .badge.hide { display: none; }

.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 8px 16px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; }
/* .one-line：管理端开票管理/开票记录表格——列宽按内容自适应，单行完整显示全部内容，不再省略 */
.table-wrap.one-line { overflow-x: auto; }
.table-wrap.one-line table { min-width: 0; width: 100%; table-layout: auto; }
.table-wrap.one-line th,
.table-wrap.one-line td { padding: 6px 10px; font-size: 12px; white-space: nowrap; }
table { width: 100%; border-collapse: collapse; min-width: 640px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 13px; vertical-align: top; }
th { background: #f8fafc; color: var(--text-secondary); font-weight: 600; white-space: nowrap; }
tr:hover td { background: #fafbfe; }

.badge-status { display: inline-block; padding: 2px 10px; border-radius: 20px; font-size: 12px; white-space: nowrap; }
.badge-pending { background: #fff6e6; color: #b26a00; }
.badge-issued { background: #e9f7f0; color: var(--success); }
.badge-rejected { background: #fdf0ef; color: var(--danger); }

.amount-strong { font-weight: 600; }

.file-link { display: inline-flex; align-items: center; gap: 4px; color: var(--primary); cursor: pointer; }
.file-link:hover { text-decoration: underline; }

.empty { text-align: center; color: var(--text-secondary); padding: 32px 0; }

/* ---------- 通知弹出层 ---------- */
.notify-panel {
  position: fixed;
  top: 60px;
  right: 12px;
  width: 340px;
  max-width: calc(100vw - 24px);
  background: var(--card);
  border-radius: 12px;
  box-shadow: 0 8px 30px rgba(16, 32, 64, 0.18);
  border: 1px solid var(--border);
  z-index: 200;
  display: none;
  max-height: 70vh;
  overflow-y: auto;
}
.notify-panel.show { display: block; }
.notify-panel .np-head { padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; display: flex; justify-content: space-between; align-items: center; }
.notify-item { padding: 12px 16px; border-bottom: 1px solid #f0f2f7; }
.notify-item:last-child { border-bottom: none; }
.notify-item .ni-title { font-size: 13px; font-weight: 600; }
.notify-item .ni-content { font-size: 12px; color: var(--text-secondary); margin-top: 3px; }
.notify-item .ni-time { font-size: 11px; color: #9aa3b2; margin-top: 4px; }
.notify-item.unread { background: #f4f8ff; }
.notify-item .btn { margin-top: 8px; }

/* ---------- 详情弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(16, 24, 40, 0.45);
  z-index: 300;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.modal-mask.show { display: flex; }
.modal {
  background: var(--card);
  border-radius: 14px;
  width: 100%;
  max-width: 560px;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 16px 50px rgba(16, 24, 40, 0.3);
}
.modal-head { padding: 16px 20px; border-bottom: 1px solid var(--border); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { font-size: 16px; }
.modal-body { padding: 18px 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.close-x { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-secondary); line-height: 1; }

.detail-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px 16px; }
.detail-item .di-label { font-size: 12px; color: var(--text-secondary); }
.detail-item .di-value { font-size: 14px; margin-top: 2px; word-break: break-all; }
.detail-item.full { grid-column: 1 / -1; }

.img-preview { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); margin-top: 8px; display: block; }

/* ---------- 筛选条 ---------- */
.filter-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 14px; }
.filter-bar select, .filter-bar input { width: auto; min-width: 140px; }
.filter-bar input[type="text"] { flex: 1; min-width: 160px; }

/* ---------- 手机端适配 ---------- */
@media (max-width: 640px) {
  body { font-size: 14px; }
  .container { padding: 10px; }
  .card { padding: 14px; }
  .form-grid { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .topbar-inner { height: 50px; padding: 0 12px; }
  .brand { font-size: 15px; }
  .brand .logo { width: 26px; height: 26px; font-size: 13px; }
  .user-chip .hide-mobile { display: none; }
  .tabs { gap: 2px; }
  .tab { padding: 8px 12px; font-size: 13px; }
  th, td { padding: 8px 10px; font-size: 12px; }
  .btn { padding: 7px 12px; }
  .modal { max-width: 100%; }
  .notify-panel { top: 52px; right: 8px; width: calc(100vw - 16px); }
  .filter-bar select, .filter-bar input { min-width: 120px; }
}

.footer-note { text-align: center; color: var(--text-secondary); font-size: 12px; padding: 12px 0 24px; }