/* ==========================================================
   星云ERP / Ant Design 风格主题（覆盖 app.css 默认样式）
   主色 #1677ff · 内容底色 #f0f2f5 · 边框 #d9d9d9 · 头部 56px
   ========================================================== */
:root {
  --primary: #1677ff;
  --primary-hover: #4096ff;
  --danger: #ff4d4f;
  --success: #52c41a;
  --warning: #faad14;
  --muted: #8c8c8c;
  --border: #d9d9d9;
  --border-light: #f0f0f0;
  --bg: #f0f2f5;
  --text: #1f1f1f;
  --text-2: #595959;
  --radius: 6px;
  --shadow: 0 1px 2px rgba(0,0,0,.03), 0 1px 6px -1px rgba(0,0,0,.02);
}
body { background: var(--bg); color: var(--text); font-size: 14px; }

/* ---------- 侧边栏：浅色（星云默认） ---------- */
.shell-side { background: #fff !important; border-right: 1px solid var(--border-light); color: var(--text-2); width: 216px; flex: 0 0 216px; }
.shell-brand { color: var(--text); border-bottom: 1px solid var(--border-light); padding: 16px 14px; }
.shell-logo { background: var(--primary); color: #fff; border-radius: 6px; }
.shell-pin { border-color: var(--border); color: #8c8c8c; }
.shell-pin:hover { color: var(--primary); border-color: var(--primary); }
.shell-group-head { color: var(--text); border-radius: 0; }
.shell-group-head:hover { background: #f5f5f5; }
.shell-group-head .caret { color: #bfbfbf; }
.shell-group.open > .shell-group-head { color: var(--text); }
.shell-group.open > .shell-group-head .caret { color: var(--primary); }
.shell-children .shell-nav-item { color: var(--text-2); }
.shell-children .shell-nav-item:hover { background: #f5f5f5; color: var(--text); }
.shell-children .shell-nav-item.active { background: #e6f4ff; color: var(--primary); box-shadow: none; border-radius: 0 6px 6px 0; font-weight: 500; }
.shell-foot { border-top: 1px solid var(--border-light); color: var(--text-2); }
.shell-foot .who { color: var(--text); font-weight: 500; }
.shell-foot .who-sub { color: var(--muted); }
.shell.collapsed .shell-side { width: 64px; flex-basis: 64px; }

/* ---------- 顶栏 / 标签栏 ---------- */
.shell-top { height: 56px; background: #fff; border-bottom: 1px solid var(--border-light); padding: 0 16px; }
.shell-toggle { border: 1px solid var(--border); border-radius: var(--radius); color: var(--text-2); }
.shell-toggle:hover { color: var(--primary); border-color: var(--primary); }
.shell-crumb { color: var(--muted); font-size: 14px; }
.shell-crumb b { color: var(--text); font-weight: 500; }
.shell-tabs { background: #fff; border-bottom: 1px solid var(--border-light); padding: 6px 12px 0; gap: 4px; }
.shell-tab { background: #fff; border: 1px solid var(--border-light); border-bottom: none; color: var(--text-2); border-radius: 6px 6px 0 0; padding: 6px 12px; font-size: 13px; }
.shell-tab:hover { color: var(--primary); }
.shell-tab.active { color: var(--primary); font-weight: 500; border-color: #e6f4ff; background: #e6f4ff; }
.shell-content { background: var(--bg); padding: 16px; }

/* ---------- 卡片 ---------- */
.card { background: #fff; border: 1px solid var(--border-light); border-radius: 8px; box-shadow: var(--shadow); padding: 16px; }
.card-head { padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border-light); }
.card-head strong { font-size: 15px; font-weight: 600; color: var(--text); }
.muted { color: var(--muted); font-size: 12.5px; }

/* ---------- 按钮 ---------- */
.btn { height: 32px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--border); background: #fff; color: var(--text-2); font-size: 14px; transition: all .15s; }
.btn:hover { color: var(--primary); border-color: var(--primary); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 2px 0 rgba(22,119,255,.09); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }
.btn-danger { background: #fff; border-color: #ffccc7; color: var(--danger); }
.btn-danger:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12.5px; border-radius: 4px; }

/* ---------- 表单 ---------- */
.input, .select {
  height: 32px; padding: 0 11px; border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; font-size: 14px; color: var(--text); transition: all .15s;
}
textarea.input { height: auto; padding: 6px 11px; line-height: 1.6; resize: vertical; }
.input:hover, .select:hover { border-color: var(--primary-hover); }
.input:focus, .select:focus { border-color: var(--primary); box-shadow: 0 0 0 2px rgba(22,119,255,.1); outline: none; }
.input::placeholder { color: #bfbfbf; }
.field-label { font-size: 13px; color: var(--text-2); font-weight: 400; margin-bottom: 4px; }
.field { gap: 4px; }

/* ---------- 表格 ---------- */
.table-wrap { border-radius: 8px; overflow: hidden; }
.tbl { font-size: 13.5px; }
.tbl th {
  background: #fafafa; color: var(--text); font-weight: 600; font-size: 13px;
  border-bottom: 1px solid var(--border-light); padding: 11px 12px; white-space: nowrap;
}
.tbl td { border-bottom: 1px solid var(--border-light); padding: 11px 12px; color: var(--text-2); }
.tbl tbody tr:hover td { background: #fafafa; }
.tbl td.empty { color: var(--muted); padding: 40px 0; }

/* ---------- 徽标 / 统计卡 ---------- */
.badge { border-radius: 4px; padding: 1px 8px; font-size: 12px; line-height: 20px; font-weight: 400; border: 1px solid transparent; }
.badge-success { background: #f6ffed; border-color: #b7eb8f; color: var(--success); }
.badge-warning { background: #fffbe6; border-color: #ffe58f; color: #d48806; }
.badge-danger  { background: #fff2f0; border-color: #ffccc7; color: var(--danger); }
.stat-row { gap: 12px; }
.stat-card { background: #fff; border: 1px solid var(--border-light); border-radius: 8px; box-shadow: var(--shadow); padding: 14px 16px; }
.stat-label { font-size: 13px; color: var(--muted); }
.stat-value { font-size: 24px; font-weight: 600; color: var(--text); letter-spacing: .5px; }
.stat-card.danger .stat-value { color: var(--danger); }
.stat-card.warning .stat-value { color: #d48806; }
.stat-card.success .stat-value { color: var(--success); }

/* ---------- 弹窗 / 分页 / 提示 ---------- */
.modal-overlay { background: rgba(0,0,0,.45); }
.modal { border-radius: 8px; box-shadow: 0 6px 16px rgba(0,0,0,.08), 0 9px 28px 8px rgba(0,0,0,.05); }
.modal-head { border-bottom: 1px solid var(--border-light); font-weight: 600; }
.modal-footer { border-top: 1px solid var(--border-light); }
.pager .btn, .page-size { border-radius: 6px; }
.page-info { color: var(--muted); font-size: 13px; }
.toast { border-radius: 8px; box-shadow: 0 6px 16px rgba(0,0,0,.08); }
.toolbar { gap: 8px; margin-bottom: 14px; }
.row-actions { gap: 6px; }
.link { color: var(--primary); }

/* ---------- 登录页 ---------- */
.login-wrap { background: linear-gradient(135deg, #f0f5ff 0%, #f0f2f5 55%, #e6f4ff 100%); }
.login-card { border-radius: 12px; box-shadow: 0 12px 40px rgba(0,0,0,.08); border: 1px solid #fff; }
.login-logo { background: var(--primary); }
.login-btn { height: 38px; border-radius: var(--radius); font-size: 15px; }

/* ---------- 字体（对齐 Ant Design） ---------- */
body, .input, .select, .btn, .tbl, .modal, .toast {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
               "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "微软雅黑", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ===================== 弹窗（Ant Design） ===================== */
.modal-overlay {
  background: rgba(0,0,0,.45); backdrop-filter: none; padding: 24px;
  animation: overlay-in .16s ease;
}
@keyframes overlay-in { from { opacity: 0 } to { opacity: 1 } }
.modal-overlay.closing { animation: overlay-out .14s ease forwards; }
@keyframes overlay-out { to { opacity: 0 } }

.modal {
  width: var(--modal-w, 520px); max-width: calc(100vw - 32px); max-height: calc(100vh - 64px);
  background: #fff; border-radius: 8px; overflow: hidden;
  box-shadow: 0 6px 16px rgba(0,0,0,.08), 0 9px 28px 8px rgba(0,0,0,.05);
  animation: modal-zoom .2s cubic-bezier(.2,.8,.3,1);
  display: flex; flex-direction: column;
}
.modal-overlay.closing .modal { animation: modal-zoom-out .14s ease forwards; }
@keyframes modal-zoom { from { opacity: 0; transform: scale(.94) } to { opacity: 1; transform: none } }
@keyframes modal-zoom-out { to { opacity: 0; transform: scale(.96) } }

.modal-head {
  display: flex; align-items: flex-start; gap: 12px; flex: 0 0 auto;
  padding: 16px 20px; border-bottom: 1px solid #f0f0f0;
}
.modal-title-wrap { flex: 1; min-width: 0; }
.modal-title { font-size: 16px; font-weight: 600; color: #1f1f1f; line-height: 1.4; }
.modal-sub { font-size: 12.5px; color: #8c8c8c; margin-top: 3px; }
.modal-close {
  width: 28px; height: 28px; flex: 0 0 28px; border: 0; border-radius: 6px; background: transparent;
  color: #8c8c8c; font-size: 13px; cursor: pointer; display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.modal-close:hover { background: #f5f5f5; color: #595959; }
.modal-body { padding: 20px; overflow: auto; flex: 1 1 auto; }
.modal-footer {
  display: flex; justify-content: flex-end; gap: 8px; flex: 0 0 auto;
  padding: 12px 20px; border-top: 1px solid #f0f0f0; background: #fff;
}
.modal-footer .btn { min-width: 72px; }
.btn.loading { opacity: .65; pointer-events: none; }

/* 弹窗内表单与表格 */
.modal-body .form-grid { gap: 14px 16px; }
.modal-body .field-label { margin-bottom: 6px; }
.modal-body .card { box-shadow: none; border-color: #f0f0f0; }
.modal-body .table-wrap { border: 1px solid #f0f0f0; border-radius: 6px; overflow: hidden; }
.modal-body .tbl th { position: sticky; top: 0; z-index: 1; }

/* 单据信息条 */
.modal-meta {
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 18px;
  background: #fafafa; border: 1px solid #f0f0f0; border-radius: 8px;
  padding: 14px 16px; margin-bottom: 16px;
}
.modal-meta .meta-item { display: flex; gap: 8px; font-size: 13px; min-width: 0; }
.modal-meta .meta-k { color: #8c8c8c; flex: 0 0 auto; }
.modal-meta .meta-v { color: #1f1f1f; font-weight: 500; word-break: break-all; }
.modal-section-title { font-size: 14px; font-weight: 600; color: #1f1f1f; margin: 0 0 10px; }
.modal-total { margin-top: 12px; padding-top: 10px; border-top: 1px dashed #f0f0f0; font-size: 13px; color: #595959; text-align: right; }

@media (max-width: 640px) {
  .modal-overlay { padding: 12px; }
  .modal-meta { grid-template-columns: 1fr; }
  .modal-body { padding: 14px; }
  .modal-head { padding: 12px 14px; }
  .modal-footer { padding: 10px 14px; }
}

/* ---------- 趋势图为空 ---------- */
.trend { height: 150px; }
.trend-empty {
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed #e5e7eb; border-radius: 8px; background: #fafafa;
}
.trend-empty .muted { font-size: 13px; }
