/* ============ 进销存管理系统 全局样式 ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
body {
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px; color: #333; background: #f0f2f5;
}
a { text-decoration: none; color: inherit; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }

/* ---------- 顶部导航 ---------- */
.topbar {
  height: 56px; background: #1f2d3d; color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; position: fixed; top: 0; left: 0; right: 0; z-index: 100;
}
.topbar .logo { font-size: 18px; font-weight: 700; letter-spacing: 1px; }
.topbar .logo span { color: #409eff; }
.topbar .user-area { display: flex; align-items: center; gap: 16px; font-size: 13px; }
.topbar .user-area .username { color: #e6e6e6; }
.topbar .user-area .role-tag {
  background: rgba(255,255,255,.15); padding: 2px 10px; border-radius: 10px; font-size: 12px;
}
.topbar .user-area a { color: #f56c6c; margin-left: 4px; }

/* ---------- 侧边菜单 ---------- */
.sidebar {
  position: fixed; top: 56px; bottom: 0; left: 0; width: 210px;
  background: #2b3a4d; overflow-y: auto; z-index: 90;
}
.sidebar .menu-item { color: #c0c4cc; }
.sidebar .menu-parent {
  padding: 13px 20px; font-size: 14px; cursor: pointer;
  display: flex; align-items: center; gap: 8px; transition: background .2s;
}
.sidebar .menu-parent:hover { background: #33465c; color: #fff; }
.sidebar .menu-parent .arrow { margin-left: auto; font-size: 10px; transition: transform .2s; }
.sidebar .menu-parent.open .arrow { transform: rotate(90deg); }
.sidebar .submenu { display: none; background: #223141; }
.sidebar .menu-parent.open + .submenu { display: block; }
.sidebar .submenu a {
  display: block; padding: 11px 20px 11px 44px; font-size: 13px; color: #a8b2c1;
}
.sidebar .submenu a:hover, .sidebar .submenu a.active { color: #409eff; background: #1d2a38; }

/* ---------- 内容区 ---------- */
.content {
  margin-left: 210px; padding: 76px 20px 20px; min-height: 100vh;
}
.content iframe { width: 100%; height: calc(100vh - 96px); border: 0; background: #fff; border-radius: 6px; }

/* ---------- 页面通用 ---------- */
.page { background: #fff; border-radius: 6px; padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.page-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar input, .toolbar select {
  height: 34px; padding: 0 10px; border: 1px solid #dcdfe6; border-radius: 4px; outline: none; min-width: 130px;
}
.toolbar input:focus, .toolbar select:focus { border-color: #409eff; }
.toolbar .spacer { flex: 1; }
.btn {
  height: 34px; padding: 0 16px; border: 1px solid #dcdfe6; border-radius: 4px;
  background: #fff; color: #333; font-size: 13px; transition: all .15s;
}
.btn:hover { border-color: #409eff; color: #409eff; }
.btn.primary { background: #409eff; border-color: #409eff; color: #fff; }
.btn.primary:hover { background: #66b1ff; }
.btn.success { background: #67c23a; border-color: #67c23a; color: #fff; }
.btn.success:hover { background: #85ce61; }
.btn.danger { background: #f56c6c; border-color: #f56c6c; color: #fff; }
.btn.danger:hover { background: #f78989; }
.btn.warn { background: #e6a23c; border-color: #e6a23c; color: #fff; }
.btn.warn:hover { background: #ebb563; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 表格 ---------- */
.grid { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid th {
  background: #f5f7fa; padding: 10px 8px; text-align: left; font-weight: 600;
  border-bottom: 1px solid #e4e7ed; white-space: nowrap;
}
.grid td { padding: 9px 8px; border-bottom: 1px solid #f0f0f0; }
.grid tr:hover td { background: #f9fcff; }
.grid .num { text-align: right; font-variant-numeric: tabular-nums; }
.grid .empty { text-align: center; padding: 40px 0; color: #999; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 3px; font-size: 12px; }
.tag.green { background: #f0f9eb; color: #67c23a; }
.tag.red { background: #fef0f0; color: #f56c6c; }
.tag.gray { background: #f4f4f5; color: #909399; }
.tag.blue { background: #ecf5ff; color: #409eff; }
.tag.orange { background: #fdf6ec; color: #e6a23c; }

/* ---------- 分页 ---------- */
.pager { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 14px; font-size: 13px; color: #606266; }
.pager button {
  height: 28px; min-width: 28px; padding: 0 8px; border: 1px solid #dcdfe6; background: #fff; border-radius: 4px; font-size: 12px;
}
.pager button:hover:not(:disabled) { border-color: #409eff; color: #409eff; }
.pager button:disabled { color: #c0c4cc; cursor: not-allowed; }
.pager button.active { background: #409eff; border-color: #409eff; color: #fff; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,.45); z-index: 200; align-items: flex-start; justify-content: center;
}
.modal-mask.show { display: flex; }
.modal {
  background: #fff; border-radius: 8px; width: 560px; margin-top: 8vh;
  box-shadow: 0 8px 30px rgba(0,0,0,.2); max-height: 84vh; display: flex; flex-direction: column;
}
.modal.wide { width: 820px; }
.modal .modal-head {
  padding: 14px 18px; border-bottom: 1px solid #eee; font-size: 15px; font-weight: 700;
  display: flex; justify-content: space-between; align-items: center;
}
.modal .modal-head .close { cursor: pointer; color: #999; font-size: 18px; }
.modal .modal-head .close:hover { color: #333; }
.modal .modal-body { padding: 18px; overflow-y: auto; }
.modal .modal-foot { padding: 12px 18px; border-top: 1px solid #eee; text-align: right; display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- 表单 ---------- */
.form-row { display: flex; align-items: center; margin-bottom: 14px; }
.form-row label { width: 90px; text-align: right; padding-right: 10px; color: #606266; flex-shrink: 0; }
.form-row label.req::before { content: "* "; color: #f56c6c; }
.form-row input, .form-row select, .form-row textarea {
  flex: 1; height: 34px; padding: 0 10px; border: 1px solid #dcdfe6; border-radius: 4px; outline: none;
}
.form-row textarea { height: 70px; padding: 8px 10px; resize: vertical; }
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: #409eff; }
.form-row .hint { color: #909399; font-size: 12px; margin-left: 8px; }

/* ---------- 明细表（单据） ---------- */
.detail-bar { display: flex; gap: 8px; align-items: center; margin: 6px 0 10px; }
.detail-bar select, .detail-bar input { height: 32px; border: 1px solid #dcdfe6; border-radius: 4px; padding: 0 8px; outline: none; }
.detail-grid { max-height: 300px; overflow-y: auto; }
.detail-grid td .del { color: #f56c6c; cursor: pointer; }
.detail-total { text-align: right; font-size: 14px; margin-top: 10px; color: #303133; }
.detail-total b { color: #f56c6c; font-size: 16px; }

/* ---------- 看板卡片 ---------- */
.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.card {
  background: #fff; border-radius: 8px; padding: 18px; box-shadow: 0 1px 4px rgba(0,0,0,.06);
  display: flex; align-items: center; gap: 14px;
}
.card .icon {
  width: 48px; height: 48px; border-radius: 8px; color: #fff; font-size: 22px;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.card .icon.b1 { background: #409eff; } .card .icon.b2 { background: #67c23a; }
.card .icon.b3 { background: #e6a23c; } .card .icon.b4 { background: #f56c6c; }
.card .num { font-size: 24px; font-weight: 700; line-height: 1.2; }
.card .label { font-size: 13px; color: #909399; margin-top: 2px; }
.panel { background: #fff; border-radius: 8px; padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.06); margin-bottom: 16px; }
.panel h3 { font-size: 15px; margin-bottom: 12px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel table { width: 100%; border-collapse: collapse; font-size: 13px; }
.panel td, .panel th { padding: 8px; border-bottom: 1px solid #f0f0f0; text-align: left; }

/* ---------- Toast ---------- */
#toastWrap { position: fixed; top: 70px; left: 50%; transform: translateX(-50%); z-index: 999; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  padding: 10px 20px; border-radius: 4px; color: #fff; font-size: 13px; box-shadow: 0 3px 10px rgba(0,0,0,.2);
  animation: toastIn .25s ease;
}
.toast.ok { background: #67c23a; } .toast.err { background: #f56c6c; } .toast.info { background: #409eff; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: translateY(0); } }

/* 登录页 */
.login-wrap {
  height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1f2d3d 0%, #2b5876 100%);
}
.login-box {
  width: 380px; background: #fff; border-radius: 10px; padding: 36px 32px; box-shadow: 0 10px 40px rgba(0,0,0,.25);
}
.login-box h1 { font-size: 22px; text-align: center; margin-bottom: 4px; }
.login-box .sub { text-align: center; color: #909399; font-size: 13px; margin-bottom: 26px; }
.login-box .form-row label { width: auto; display: block; text-align: left; padding: 0; margin-bottom: 6px; color: #333; }
.login-box .form-row { display: block; margin-bottom: 18px; }
.login-box input { width: 100%; height: 40px; }
.login-box .btn { width: 100%; height: 42px; font-size: 15px; }
.login-box .tip { text-align: center; color: #909399; font-size: 12px; margin-top: 14px; }
