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

:root {
  --admin-bg: #f7f2ea;
  --admin-panel: #fffdf8;
  --admin-panel-soft: #f3eadc;
  --admin-sidebar: #62533f;
  --admin-sidebar-text: #efe7d9;
  --admin-text: #41362b;
  --admin-subtext: #7b6d60;
  --admin-border: #e5d8c8;
  --admin-primary: #7a8f55;
  --admin-primary-dark: #647547;
  --admin-accent: #c7953d;
  --admin-success: #5e8f64;
  --admin-danger: #bf5f52;
  --admin-warning: #b98437;
}

body {
  font-family: 'PingFang SC', 'Hiragino Sans GB', sans-serif;
  font-size: 14px;
  color: var(--admin-text);
  background:
    radial-gradient(circle at top right, rgba(199,149,61,0.12), transparent 24%),
    linear-gradient(180deg, #fbf7f0 0%, var(--admin-bg) 100%);
  line-height: 1.5;
}

/* ──────────────── 布局 ──────────────── */
.layout {
  display: flex;
  min-height: 100vh;
}

/* ──────────────── 侧边栏 ──────────────── */
.sidebar {
  width: 220px;
  background: linear-gradient(180deg, #6d5c45 0%, var(--admin-sidebar) 100%);
  color: #fff;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.sidebar-title {
  padding: 24px 20px 20px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  color: var(--admin-sidebar-text);
}

.nav { padding: 12px 0; flex: 1; }

.nav-item {
  display: block;
  padding: 10px 20px;
  color: rgba(255,244,228,0.78);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  border-radius: 0;
  transition: color 0.15s, background 0.15s;
  margin: 2px 8px;
  border-radius: 8px;
}

.nav-item:hover {
  background: rgba(255,255,255,0.06);
  color: #fffdf7;
}

.nav-item.active {
  background: linear-gradient(135deg, var(--admin-primary) 0%, var(--admin-primary-dark) 100%);
  color: #fff;
}

.sidebar-logout {
  padding: 14px 20px;
  color: rgba(255,244,228,0.56);
  font-size: 13px;
  cursor: pointer;
  border-top: 1px solid rgba(255,255,255,0.06);
  margin-top: auto;
  transition: color 0.15s;
}
.sidebar-logout:hover { color: #f1f5f9; }

/* ──────────────── 主内容 ──────────────── */
.main {
  flex: 1;
  padding: 28px 32px;
  min-width: 0;
}

.page-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--admin-text);
}

/* ──────────────── 账单明细工具栏 ──────────────── */
.detail-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 14px;
  background: var(--admin-panel);
  border: 1px solid var(--admin-border);
  border-radius: 10px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.select-all-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--admin-text);
  cursor: pointer;
  user-select: none;
}
.select-all-wrap input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--admin-primary);
}
.detail-selected-count {
  font-size: 12px;
  color: var(--admin-subtext);
  font-weight: 600;
}
.detail-toolbar-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
}
.col-check { width: 36px; padding-left: 14px !important; padding-right: 4px !important; }
.col-check input[type="checkbox"] {
  width: 16px; height: 16px; cursor: pointer;
  accent-color: var(--admin-primary);
}

/* 行末省略按钮（菜单本身浮在 body 上，见 .floating-row-menu） */
.row-menu-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border: 1px solid var(--admin-border);
  background: var(--admin-panel);
  color: var(--admin-subtext);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  margin-left: 4px;
  vertical-align: middle;
}
.row-menu-btn:hover { border-color: var(--admin-primary); color: var(--admin-primary-dark); }
.floating-row-menu {
  position: fixed;
  min-width: 120px;
  background: var(--admin-panel);
  border: 1px solid var(--admin-border);
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(83,64,33,0.16);
  z-index: 1200;
  padding: 4px;
}
.row-menu-item {
  padding: 7px 10px;
  font-size: 13px;
  border-radius: 6px;
  cursor: pointer;
  color: var(--admin-text);
  white-space: nowrap;
}
.row-menu-item:hover { background: #f6efe3; }
.row-menu-item-danger { color: var(--admin-danger); }
.row-menu-item-danger:hover { background: #fbeeea; }

.expense-qty {
  color: var(--admin-subtext);
  font-size: 12px;
  margin-left: 4px;
  font-weight: 500;
}

/* ──────────────── 员工搜索栏 ──────────────── */
.user-search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.user-search-bar input {
  flex: 0 1 320px;
  padding: 8px 12px;
  border: 1.5px solid var(--admin-border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--admin-text);
  background: var(--admin-panel);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}
.user-search-bar input:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(122,143,85,0.14);
}
.user-search-hint {
  font-size: 12px;
  color: var(--admin-subtext);
}

/* ──────────────── 待办速览卡片 ──────────────── */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.dashboard-card {
  background: var(--admin-panel);
  border: 1px solid var(--admin-border);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 6px 16px rgba(83,64,33,0.05);
  transition: transform 0.12s, box-shadow 0.12s;
}
.dashboard-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(83,64,33,0.08);
}
.dashboard-card-label {
  font-size: 12px;
  color: var(--admin-subtext);
  font-weight: 600;
  letter-spacing: 0.04em;
}
.dashboard-card-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--admin-text);
  margin: 6px 0 4px;
  line-height: 1.1;
}
.dashboard-card-hint {
  font-size: 11px;
  color: var(--admin-subtext);
  line-height: 1.4;
}
.dashboard-card-warn .dashboard-card-value { color: var(--admin-warning); }
.dashboard-card-primary .dashboard-card-value { color: var(--admin-primary-dark); }

@media (max-width: 900px) {
  .dashboard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ──────────────── 筛选栏 ──────────────── */
.filter-bar {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-bar select,
.filter-bar input {
  padding: 8px 12px;
  border: 1.5px solid var(--admin-border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--admin-text);
  background: var(--admin-panel);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  font-family: inherit;
}

.filter-bar select:focus,
.filter-bar input:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(122,143,85,0.14);
}

.filter-bar button {
  padding: 8px 20px;
  background: linear-gradient(135deg, var(--admin-primary) 0%, var(--admin-primary-dark) 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: background 0.15s;
}
.filter-bar button:hover { background: var(--admin-primary-dark); }

/* ──────────────── 表格 ──────────────── */
.table-wrap {
  overflow-x: auto;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(83,64,33,0.08);
}

.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--admin-panel);
  border-radius: 12px;
  overflow: hidden;
}

.table th,
.table td {
  padding: 13px 16px;
  text-align: left;
  border-bottom: 1px solid #f1f5f9;
}

.table th {
  background: #f6efe3;
  font-weight: 600;
  color: var(--admin-subtext);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table tbody tr {
  transition: background 0.1s;
}
.table tbody tr:hover { background: #f8fafc; }
.table tr:last-child td { border-bottom: none; }

.empty {
  text-align: center;
  color: #9b8f83;
  padding: 48px 0;
  font-size: 14px;
}

/* ──────────────── 状态标签 ──────────────── */
.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}

.tag-unsubmitted { background: #efe7da; color: #6d604f; }
.tag-pending     { background: #f9edd7; color: #9a6c27; }
.tag-reimbursed  { background: #e5f1e4; color: #2f6b39; }
.tag-rejected    { background: #f7e3e0; color: #9a4138; }
.tag-submitted   { background: #efe7da; color: #7b6d60; }
.tag-approved    { background: #edf4e4; color: #476434; }
.tag-draft       { background: #efe7da; color: #6d604f; }

/* ──────────────── 卡片 ──────────────── */
.card {
  background: var(--admin-panel);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  padding: 20px;
  margin-bottom: 20px;
}

.risk-banner {
  margin: 0 0 14px;
  padding: 14px 16px;
  border-radius: 12px;
  border: 1px solid var(--admin-border);
  background: var(--admin-panel-soft);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.45);
}

.risk-banner-warning {
  border-color: rgba(185, 132, 55, 0.28);
  background: linear-gradient(180deg, rgba(243, 234, 220, 0.92) 0%, rgba(255, 247, 237, 0.98) 100%);
  box-shadow: inset 4px 0 0 rgba(185, 132, 55, 0.9), 0 6px 18px rgba(83,64,33,0.04);
}

.risk-banner-title {
  font-size: 13px;
  font-weight: 700;
  color: #7c5419;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
}

.risk-banner-text {
  font-size: 13px;
  line-height: 1.7;
  color: #8a5b1f;
}

.risk-banner-compact {
  padding: 12px 14px;
  margin-bottom: 0;
}

.risk-banner-compact .risk-banner-title,
.risk-banner-compact .risk-banner-text {
  font-size: 12px;
}

/* ──────────────── 账单概要栏 ──────────────── */
.summary-bar {
  display: flex;
  gap: 0;
  background: var(--admin-panel);
  border-radius: 12px;
  margin-bottom: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  overflow: hidden;
}

.summary-bar-item {
  flex: 1;
  padding: 16px 20px;
  border-right: 1px solid #f1f5f9;
  font-size: 14px;
}
.summary-bar-item:last-child { border-right: none; }

.summary-bar-label {
  font-size: 12px;
  color: var(--admin-subtext);
  margin-bottom: 4px;
}

.summary-bar-value {
  font-size: 18px;
  font-weight: 700;
  color: var(--admin-text);
}

.detail-summary-shell {
  background: var(--admin-panel);
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 10px 28px rgba(83,64,33,0.08);
  margin-bottom: 14px;
  overflow: hidden;
}

.detail-ledger-row {
  display: flex;
  align-items: center;
  min-height: 58px;
}

.detail-ledger-head {
  background: #f6efe3;
  border-bottom: 1px solid var(--admin-border);
}

.detail-ledger-body {
  background: var(--admin-panel);
}

.detail-ledger-cell {
  flex: 1;
  padding: 14px 16px;
  font-size: 13px;
  color: var(--admin-subtext);
  border-right: 1px solid #f1e6d8;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
}

.detail-ledger-row .detail-ledger-cell:last-child {
  border-right: none;
}

.detail-ledger-title {
  flex: 2.3;
  font-size: 16px;
  font-weight: 700;
  color: var(--admin-text);
  white-space: normal;
  line-height: 1.45;
}

.detail-ledger-title-sub {
  flex: 2.3;
  color: var(--admin-subtext);
  font-weight: 600;
  white-space: normal;
  line-height: 1.45;
}

.detail-ledger-amount {
  font-size: 16px;
  font-weight: 700;
  color: var(--admin-text);
}

.detail-ledger-count {
  font-size: 14px;
  font-weight: 700;
  color: var(--admin-text);
}

.detail-status-chip {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: 999px;
  background: #edf4e4;
  color: #476434;
  font-size: 12px;
  font-weight: 700;
}

/* ──────────────── 工具栏 ──────────────── */
.toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  justify-content: space-between;
}

/* ──────────────── 按钮 ──────────────── */
.btn-back {
  padding: 8px 14px;
  border: 1.5px solid var(--admin-border);
  border-radius: 8px;
  background: #fff;
  cursor: pointer;
  font-size: 14px;
  color: var(--admin-subtext);
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.btn-back:hover { border-color: #d1c1aa; background: #faf4ea; }

.btn-reimburse {
  padding: 8px 18px;
  background: var(--admin-success);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-reimburse:hover { background: #4e7f53; }

.btn-export {
  padding: 8px 18px;
  background: var(--admin-panel);
  color: var(--admin-primary);
  border: 1.5px solid var(--admin-primary);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  transition: background 0.15s, color 0.15s;
}
.btn-export:hover { background: var(--admin-primary); color: #fff; }

/* 表格内小按钮 */
.btn-sm {
  padding: 5px 12px;
  border-radius: 6px;
  border: 1.5px solid var(--admin-primary);
  color: var(--admin-primary);
  background: var(--admin-panel);
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  font-family: inherit;
  margin-right: 6px;
  transition: background 0.15s, color 0.15s;
}
.btn-sm:hover { background: var(--admin-primary); color: #fff; }

.btn-sm.btn-danger { border-color: var(--admin-danger); color: var(--admin-danger); }
.btn-sm.btn-danger:hover { background: var(--admin-danger); color: #fff; }

.btn-sm.btn-success { border-color: var(--admin-success); color: var(--admin-success); }
.btn-sm.btn-success:hover { background: var(--admin-success); color: #fff; }

/* ──────────────── Tab 按钮 ──────────────── */
.tab-group {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  background: #efe7da;
  padding: 4px;
  border-radius: 10px;
  width: fit-content;
}

.tab-btn {
  padding: 7px 18px;
  border: none;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--admin-subtext);
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.tab-btn:hover { color: var(--admin-text); }
.tab-btn.active {
  background: var(--admin-panel);
  color: var(--admin-primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* ──────────────── 弹窗 ──────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(34, 28, 22, 0.42);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1200;
  padding: 20px;
}

.dialog-box {
  width: 100%;
  max-width: 420px;
  background: var(--admin-panel);
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(83,64,33,0.18);
  padding: 24px;
}

.dialog-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--admin-text);
  margin-bottom: 10px;
}

.dialog-message {
  font-size: 14px;
  line-height: 1.7;
  color: var(--admin-subtext);
  white-space: pre-line;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

.modal {
  background: var(--admin-panel);
  border-radius: 16px;
  padding: 28px;
  width: 400px;
  max-width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-title {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--admin-text);
}

.form-group {
  margin-bottom: 16px;
}

.form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--admin-subtext);
  margin-bottom: 6px;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid var(--admin-border);
  border-radius: 8px;
  font-size: 14px;
  color: var(--admin-text);
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--admin-primary);
  box-shadow: 0 0 0 3px rgba(122,143,85,0.12);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 24px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}

.pay-modal {
  display: flex;
  flex-direction: column;
}

.pay-modal-content {
  flex: 0 0 auto;
}

.pay-modal-qr-wrap {
  flex: 0 0 auto;
}

.pay-modal-qr {
  background: #fff;
}

.btn-primary {
  padding: 9px 22px;
  background: linear-gradient(135deg, var(--admin-primary) 0%, var(--admin-primary-dark) 100%);
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--admin-primary-dark); }

.btn-secondary {
  padding: 9px 22px;
  background: var(--admin-panel);
  color: var(--admin-subtext);
  border: 1.5px solid var(--admin-border);
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  transition: border-color 0.15s, background 0.15s;
}
.btn-secondary:hover { border-color: #d1c1aa; background: #faf4ea; }

/* ──────────────── Token 输入栏（兼容旧代码） ──────────────── */
.token-bar {
  display: none; /* 服务端 Cookie 鉴权后此栏不再显示 */
}

/* ──────────────── 统计卡片 ──────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--admin-panel);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
}

.stat-label {
  font-size: 12px;
  color: var(--admin-subtext);
  font-weight: 500;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.stat-value {
  font-size: 26px;
  font-weight: 700;
  color: var(--admin-text);
}

.stat-sub {
  font-size: 12px;
  color: #a29588;
  margin-top: 4px;
}

/* ──────────────── 图片缩略图 ──────────────── */
.thumb {
  width: 40px;
  height: 40px;
  border-radius: 6px;
  object-fit: cover;
  cursor: pointer;
  border: 1.5px solid var(--admin-border);
  transition: opacity 0.15s;
}
.thumb:hover { opacity: 0.85; }

/* ──────────────── 展开区 ──────────────── */
.expand-row td {
  background: #f8fafc;
  padding: 16px 20px;
}

/* ──────────────── 响应式 ──────────────── */
@media (max-width: 768px) {
  .sidebar { width: 180px; }
  .main { padding: 20px 16px; }
  .detail-ledger-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
  .detail-ledger-cell,
  .detail-ledger-row .detail-ledger-cell:last-child {
    border-right: 1px solid #f1e6d8;
    border-bottom: 1px solid #f1e6d8;
  }
  .detail-ledger-title,
  .detail-ledger-title-sub { grid-column: 1 / -1; }
}
