* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: #333;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
  background: #f0f2f5;
}

button,
input,
textarea,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.layout {
  min-width: 1280px;
  min-height: 100vh;
}

/* ========== 顶部导航 ========== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid #e8e8e8;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 32px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: #fff;
  background: #1890ff;
  border-radius: 4px;
  font-size: 14px;
  font-weight: 600;
}

.logo-text {
  color: #1890ff;
  font-size: 16px;
  font-weight: 600;
}

.top-nav {
  display: flex;
  gap: 24px;
}

.top-nav-item {
  color: #666;
  font-size: 14px;
  line-height: 48px;
}

.top-nav-item:hover,
.top-nav-item.active {
  color: #1890ff;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 20px;
  color: #666;
  font-size: 13px;
}

.topbar-user {
  color: #333;
}

/* ========== 主体布局 ========== */
.body-wrap {
  display: flex;
  min-height: calc(100vh - 48px);
}

/* ========== 左侧菜单 ========== */
.sidebar {
  flex-shrink: 0;
  width: 200px;
  padding: 8px 0;
  background: #fff;
  border-right: 1px solid #e8e8e8;
}

.menu-group {
  margin-bottom: 2px;
}

.menu-title {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 16px;
  color: #333;
  font-size: 14px;
  cursor: default;
}

.menu-icon {
  width: 16px;
  text-align: center;
  font-size: 13px;
}

.submenu {
  padding-left: 0;
}

.submenu-item {
  display: block;
  height: 36px;
  padding: 0 16px 0 40px;
  color: #666;
  font-size: 13px;
  line-height: 36px;
}

.submenu-item:hover {
  color: #1890ff;
  background: #f5f5f5;
}

.submenu-item.active {
  color: #1890ff;
  background: #e6f7ff;
  border-right: 3px solid #1890ff;
}

.submenu-item.parent {
  padding-left: 40px;
  color: #333;
  font-weight: 500;
}

.submenu.nested .submenu-item {
  padding-left: 56px;
}

.submenu-group.open .nested {
  display: block;
}

/* ========== 主内容区 ========== */
.main {
  flex: 1;
  padding: 12px;
  overflow: auto;
}

.content-panel {
  min-height: calc(100vh - 72px);
  background: #fff;
  border: 1px solid #e8e8e8;
}

/* Tab */
.content-tabs {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 16px;
  border-bottom: 1px solid #e8e8e8;
}

.content-tab {
  height: 44px;
  margin-right: 24px;
  padding: 0 2px;
  color: #666;
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.content-tab.active {
  color: #1890ff;
  border-bottom-color: #1890ff;
}

.content-tab-tip {
  margin-left: auto;
  color: #ff4d4f;
  font-size: 12px;
}

/* 筛选区 */
.filter-bar {
  padding: 16px 16px 8px;
  border-bottom: 1px solid #f0f0f0;
}

.filter-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 16px;
}

.filter-item {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #666;
  font-size: 13px;
}

.filter-item span {
  white-space: nowrap;
}

.filter-item input,
.filter-item select {
  width: 160px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid #d9d9d9;
  border-radius: 2px;
}

.filter-item input[type="date"] {
  width: 140px;
}

.filter-item em {
  color: #999;
  font-style: normal;
}

.filter-actions {
  display: flex;
  gap: 8px;
  margin-left: auto;
}

/* 操作栏 */
.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
}

.selection-info {
  color: #666;
  font-size: 13px;
}

.selection-info strong {
  color: #1890ff;
}

.action-bar-right {
  display: flex;
  gap: 8px;
}

/* 按钮 */
.btn {
  height: 32px;
  min-width: 64px;
  padding: 0 15px;
  border: 1px solid transparent;
  border-radius: 2px;
  cursor: pointer;
}

.btn.primary {
  color: #fff;
  background: #1890ff;
  border-color: #1890ff;
}

.btn.primary:hover {
  background: #40a9ff;
}

.btn.ghost {
  color: #333;
  background: #fff;
  border-color: #d9d9d9;
}

.btn:disabled {
  color: #bfbfbf;
  background: #f5f5f5;
  border-color: #d9d9d9;
  cursor: not-allowed;
}

.icon-btn-filter {
  width: 32px;
  min-width: 32px;
  padding: 0;
  color: #666;
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 2px;
  font-size: 16px;
}

/* 表格 */
.table-wrap {
  padding: 0 16px 16px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.data-table th,
.data-table td {
  height: 40px;
  padding: 8px 10px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 1px solid #f0f0f0;
  text-align: left;
}

.data-table th {
  color: #333;
  background: #e6f4ff;
  font-weight: 500;
}

.data-table tbody tr:nth-child(even) {
  background: #fafafa;
}

.data-table tbody tr:hover {
  background: #e6f7ff;
}

.data-table tbody tr.disabled-row {
  color: #bfbfbf;
  background: #fafafa;
}

.data-table .check-col {
  width: 44px;
  text-align: center;
}

/* 状态标签 */
.status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 2px;
  font-size: 12px;
}

.status.waiting {
  color: #d48806;
  background: #fffbe6;
}

.status.pending {
  color: #fff;
  background: #595959;
}

.status.success {
  color: #389e0d;
  background: #f6ffed;
}

.status.reject {
  color: #cf1322;
  background: #fff1f0;
}

.status.idle {
  color: #666;
  background: #f5f5f5;
}

.text-btn {
  margin-right: 10px;
  padding: 0;
  color: #1890ff;
  background: transparent;
  border: 0;
  cursor: pointer;
}

.text-btn.disabled {
  color: #bfbfbf;
  cursor: not-allowed;
}

/* 分页 */
.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
  color: #666;
  font-size: 13px;
}

.page-btn {
  min-width: 28px;
  height: 28px;
  color: #666;
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 2px;
  cursor: pointer;
}

.page-btn.active {
  color: #1890ff;
  border-color: #1890ff;
}

.pagination select {
  height: 28px;
  border: 1px solid #d9d9d9;
  border-radius: 2px;
}

/* ========== 业务逻辑说明区 ========== */
.biz-logic-panel {
  margin: 16px;
  padding: 16px 20px;
  background: #fffbe6;
  border: 1px solid #ffe58f;
  border-radius: 4px;
}

.biz-logic-panel h3 {
  margin: 0 0 12px;
  color: #ad6800;
  font-size: 15px;
  font-weight: 600;
}

.biz-logic-panel ul {
  margin: 0;
  padding-left: 20px;
  color: #614700;
  line-height: 1.8;
}

.biz-logic-panel li {
  margin-bottom: 4px;
}

/* ========== 弹窗 ========== */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.45);
}

.apply-modal,
.preview-modal {
  position: fixed;
  left: 50%;
  top: 50%;
  z-index: 101;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transform: translate(-50%, -50%);
}

.apply-modal {
  width: 480px;
}

.preview-modal {
  width: 560px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 48px;
  padding: 0 16px;
  border-bottom: 1px solid #f0f0f0;
  flex-shrink: 0;
}

.modal-header h2,
.modal-header h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 500;
}

.icon-btn {
  width: 28px;
  height: 28px;
  color: #999;
  background: transparent;
  border: 0;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.apply-form {
  flex: 1;
  padding: 16px;
  overflow-y: auto;
  min-height: 0;
}

.form-row {
  display: block;
  margin-bottom: 16px;
}

.form-row span {
  display: block;
  margin-bottom: 6px;
  color: #333;
}

.form-row b {
  color: #ff4d4f;
  font-weight: 400;
}

.form-row input,
.form-row textarea {
  width: 100%;
  border: 1px solid #d9d9d9;
  border-radius: 2px;
  color: #333;
  background: #fff;
}

.form-row input {
  height: 32px;
  padding: 0 11px;
}

.form-row textarea {
  height: 72px;
  padding: 8px 11px;
  resize: none;
}

.form-row input:disabled {
  color: #999;
  background: #f5f5f5;
}

.form-row input:focus,
.form-row textarea:focus {
  outline: none;
  border-color: #1890ff;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2);
}

.radio-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.radio-group label {
  cursor: pointer;
}

.radio-group input {
  width: auto;
  height: auto;
  margin-right: 6px;
}

.counter {
  display: block;
  margin-top: -18px;
  padding-right: 4px;
  color: #999;
  text-align: right;
  font-size: 12px;
  font-style: normal;
}

.error {
  display: block;
  min-height: 16px;
  margin-top: 4px;
  color: #ff4d4f;
  font-size: 12px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid #f0f0f0;
  flex-shrink: 0;
}

/* Toast */
.toast {
  position: fixed;
  left: 50%;
  top: 64px;
  z-index: 200;
  transform: translateX(-50%);
  padding: 10px 20px;
  color: #fff;
  background: rgba(0, 0, 0, 0.75);
  border-radius: 4px;
}

/* 预览弹窗内容 */
.preview-modal .invoice-preview {
  padding: 24px;
  background: #fafafa;
}

.invoice-card {
  min-height: 240px;
  padding: 24px 32px;
  background: #fffdf7;
  border: 1px solid #f0e6d2;
}

.invoice-card h4 {
  margin: 0 0 20px;
  color: #ad6800;
  font-size: 20px;
  text-align: center;
  letter-spacing: 4px;
}

.invoice-card p {
  margin: 12px 0;
}

.invoice-card span {
  color: #666;
}

.preview-note {
  margin-top: 24px !important;
  color: #999;
  font-size: 12px;
}

.hidden {
  display: none !important;
}
