/* ============================================
   发票管理系统 — 样式表
   ============================================
   ⚠️ 修改原则：
   1. 只改样式，不碰逻辑（JS在 invoice.js）
   2. 高危区域有注释，不要误删覆盖规则
   3. 改完后对照冒烟检查清单验证
   ============================================ */

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,sans-serif; background: #f5f6fa; color: #333; font-size: 16px; min-height: 100vh; }
.container { max-width: 900px; margin: 0 auto; padding: 12px; }
/* 管理后台全宽模式 */
body.admin-full .container { max-width: none; padding: 12px 20px; }
@media (min-width: 768px) {
  .container { padding: 32px 40px; }
  body.admin-full .container { padding: 20px 30px; }
  h1 { font-size: 28px; padding: 20px 0 16px; }
  h2 { font-size: 20px; }
  input,textarea,select { font-size: 15px; padding: 12px; }
  button.submit { padding: 14px; font-size: 18px; }
  .tab-bar button { font-size: 16px; padding: 14px 0; }
  table { font-size: 13px; width: 100%; }
  th,td { padding: 7px 5px; }
}
@media (max-width: 767px) {
  .container { padding: 8px; }
  h1 { font-size: 18px; }
  input,textarea,select { font-size: 16px; padding: 10px; }
  .ft-btn { padding: 6px 12px; font-size: 13px; }
}
h1 { text-align: center; font-size: 20px; padding: 16px 0 8px; color: #1a73e8; }
h2 { font-size: 16px; margin: 12px 0 8px; color: #555; border-bottom: 1px solid #e0e0e0; padding-bottom: 6px; }

.tab-bar { display: flex; gap: 4px; margin: 12px 0; }
.tab-bar button { flex: 1; padding: 10px 0; border: none; background: #e8e8e8; color: #555; font-size: 15px; border-radius: 6px 6px 0 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.tab-bar button.active { background: #1a73e8; color: #fff; }

.tab { display: none; }
.tab.active { display: block; }

label { display: block; font-size: 13px; color: #666; margin: 10px 0 4px; }
/* ⚠️ 危险区域：appearance:none 会把 checkbox/radio 的勾选样式干掉，
   下面三行必须跟着，否则勾选框无视觉反馈！不要合并或删除！ */
input,textarea,select { width: 100%; padding: 10px; font-size: 16px; border: 1px solid #ccc; border-radius: 6px; -webkit-appearance: none; appearance: none; background: #fff; }
input[type="checkbox"], input[type="radio"] { -webkit-appearance: auto; appearance: auto; width: auto; display: inline-block; } /* 必须覆盖上一行 */
input[type="checkbox"] { width: 18px; height: 18px; accent-color: #1a73e8; cursor: pointer; }
input[type="radio"] { width: 18px; height: 18px; accent-color: #1a73e8; cursor: pointer; }
input:focus,textarea:focus,select:focus { outline: none; border-color: #1a73e8; }
textarea { min-height: 60px; resize: vertical; }
button.submit { width: 100%; padding: 12px; margin-top: 14px; background: #1a73e8; color: #fff; border: none; border-radius: 8px; font-size: 17px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button.submit:active { background: #1558b0; }
.hint { font-size: 12px; color: #999; margin-top: 4px; }

/* 列表表格 */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; min-width: 500px; }
th,td { padding: 8px 6px; border-bottom: 1px solid #eee; text-align: left; vertical-align: top; }
th { background: #f0f4ff; color: #333; position: sticky; top: 0; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.badge.pending,.badge.未开票 { background: #fff3cd; color: #856404; }
.badge.approved,.badge.已开票 { background: #d4edda; color: #155724; }
.badge.rejected,.badge.已拒绝 { background: #f8d7da; color: #721c24; }

/* 管理端操作 */
.action-btns button { padding: 5px 10px; margin: 2px 2px 2px 0; border: none; border-radius: 4px; font-size: 12px; cursor: pointer; }
.btn-pass { background: #28a745; color: #fff; }
.btn-reject { background: #dc3545; color: #fff; }
.btn-file { background: #6c757d; color: #fff; font-size: 11px; }

/* 模态框 */
.modal-mask { display: none; position: fixed; top:0;left:0;right:0;bottom:0; background: rgba(0,0,0,.45); z-index: 100; }
.modal-mask.show { display: flex; align-items: center; justify-content: center; }
.modal { background: #fff; border-radius: 10px; width: 92%; max-width: 400px; padding: 20px; max-height: 80vh; overflow-y: auto; }
.modal h3 { margin-bottom: 12px; }
.modal label { margin-top: 10px; }
.modal .btn-row { display: flex; gap: 8px; margin-top: 14px; }
.modal .btn-row button { flex: 1; padding: 10px; border: none; border-radius: 6px; font-size: 15px; cursor: pointer; }
.modal .btn-confirm { background: #1a73e8; color: #fff; }
.modal .btn-cancel { background: #e0e0e0; color: #333; }

/* 批量处理 */
.batch-bar { display: none; align-items: center; gap: 8px; margin: 8px 0; padding: 10px 12px; background: #e8f0fe; border-radius: 8px; font-size: 14px; }
.batch-bar.show { display: flex; }
.batch-bar .sel-count { color: #1a73e8; font-weight: 600; }
.batch-bar button { padding: 6px 14px; border: none; border-radius: 5px; font-size: 13px; cursor: pointer; color: #fff; }
.batch-bar .btn-batch-approve { background: #28a745; }
.batch-bar .btn-batch-reject { background: #dc3545; }
.batch-bar .btn-batch-reset { background: #ffc107; color: #333; }
.batch-bar .btn-clear-sel { background: #6c757d; }
.row-check { width: 16px; height: 16px; cursor: pointer; accent-color: #1a73e8; }

/* 查询栏 */
.query-bar { display: flex; gap: 6px; margin: 8px 0; }
.query-bar input { flex: 1; }
.query-bar button { padding: 0 14px; border: none; background: #1a73e8; color: #fff; border-radius: 6px; font-size: 14px; white-space: nowrap; cursor: pointer; -webkit-tap-highlight-color: transparent; }

.admin-header { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.admin-header select { width: auto; min-width: 80px; }
.admin-header button { padding: 8px 12px; border: none; background: #1a73e8; color: #fff; border-radius: 6px; font-size: 14px; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.filter-tabs { display: flex; gap: 2px; background: #f0f0f0; border-radius: 8px; padding: 3px; }
.ft-btn { padding: 7px 18px; border: none; background: transparent; color: #555; border-radius: 6px; font-size: 14px; cursor: pointer; transition: .2s; }
.ft-btn:hover { background: #e0e0e0; color: #333; }
.ft-btn.active { background: #fff; color: #1a73e8; font-weight: 600; box-shadow: 0 1px 3px rgba(0,0,0,.1); }

.pwd-row { display: flex; gap: 6px; margin: 8px 0; }
.pwd-row input { flex: 1; }
.pwd-row button { padding: 0 14px; border: none; background: #1a73e8; color: #fff; border-radius: 6px; font-size: 14px; cursor: pointer; -webkit-tap-highlight-color: transparent; }

.file-link { color: #1a73e8; text-decoration: underline; font-size: 12px; word-break: break-all; }
.remark-cell { max-width: 120px; word-break: break-all; font-size: 12px; color: #c00; }
/* 复制按钮 */
.cell-copy { display: flex; align-items: center; justify-content: space-between; white-space: nowrap; min-width: 140px; }
.cc-text { font-size: 14px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; }
.cc-btn-area { display: inline-flex; flex-shrink: 0; margin-left: 8px; }
.btn-copy { padding: 2px 12px; border: 1px solid #d0d0d0; border-radius: 4px; background: linear-gradient(#fafafa, #f0f0f0); color: #555; font-size: 12px; cursor: pointer; line-height: 1.5; font-weight: 500; transition: all .15s; white-space: nowrap; }
.btn-copy:hover { background: #1a73e8; color: #fff; border-color: #1a73e8; }
.btn-copy:active { transform: scale(.95); }
.btn-copy:disabled { opacity: .35; cursor: default; }
/* 管理后台表格自适应 */
#adminTable { table-layout: auto; width: 100%; border: 1px solid #e0e0e0; }
#adminTable th, #adminTable td { white-space: nowrap; font-size: 14px; padding: 8px 7px; border-right: 1px solid #f0f0f0; vertical-align: middle; }
#adminTable th:last-child, #adminTable td:last-child { border-right: none; }
#adminTable .remark-cell { white-space: normal; max-width: none; font-size: 14px; }
#adminTable .file-link { white-space: normal; font-size: 13px; }
/* 复制按钮统一占位 */
#adminTable .btn-copy { visibility: visible; }
#adminTable .cell-copy { min-width: max-content; }

/* 我的记录 - 手机卡片式 */
.my-card { background: #fff; border-radius: 10px; padding: 14px 16px; margin-bottom: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.my-card-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.my-card-no { font-size: 13px; color: #888; }
.my-card-body { display: grid; grid-template-columns: auto 1fr; gap: 7px 10px; font-size: 14px; }
.my-card-body .lbl { color: #999; white-space: nowrap; }
.my-card-body .val { color: #333; word-break: break-all; }
.my-card-remark { margin-top: 8px; padding: 7px 10px; background: #fff3cd; border-radius: 6px; font-size: 13px; color: #7a5800; word-break: break-all; }
.my-card-download { margin-top: 10px; }
.my-card-download a { display: flex; align-items: center; gap: 6px; padding: 9px 14px; background: #e8f0fe; border-radius: 8px; color: #1a73e8; font-size: 14px; text-decoration: none; font-weight: 500; }
.my-card-download a:active { background: #d2e3fc; }
.my-card-download .dl-icon { font-size: 18px; }

/* 加载动画 */
.loading-mask { position: fixed; top:0;left:0;right:0;bottom:0; background: #f5f6fa; z-index: 9999; display: flex; flex-direction: column; align-items: center; justify-content: center; transition: opacity .4s ease; }
.loading-mask.hide { opacity: 0; pointer-events: none; }
.loading-spinner { width: 40px; height: 40px; border: 3px solid #e0e0e0; border-top-color: #1a73e8; border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { margin-top: 14px; font-size: 14px; color: #999; }
