/* ============================================================
   库房进领存管理系统 —— 全局样式
   浅色商务风 + 手机自适应（只靠 CSS，不为手机另写页面）
   ============================================================ */
:root {
  --brand: #2b6cb0;
  --brand-dark: #1f4f85;
  --brand-soft: #eaf2fb;
  --bg: #f4f6f9;
  --panel: #ffffff;
  --border: #e3e8ef;
  --border-strong: #cfd8e3;
  --text: #1f2733;
  --text-sub: #6b7787;
  --text-mute: #9aa5b1;
  --ok: #2f855a;
  --warn: #b7791f;
  --danger: #c53030;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(23, 43, 77, 0.08), 0 4px 14px rgba(23, 43, 77, 0.05);
  --sidebar-w: 232px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

#app { height: 100%; }

/* ---------------------------------------------- 启动占位 */
.boot-loading {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-sub);
}
.boot-spinner {
  width: 34px; height: 34px;
  border: 3px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: bootspin 0.9s linear infinite;
}
@keyframes bootspin { to { transform: rotate(360deg); } }
.boot-hint { font-size: 12px; color: var(--text-mute); }
.boot-hint code { background: var(--brand-soft); padding: 1px 5px; border-radius: 4px; }

/* ---------------------------------------------- 布局 */
.layout { display: flex; height: 100%; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: #1f3552;
  color: #dfe7f1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sidebar-brand {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  white-space: nowrap;
  overflow: hidden;
}
.sidebar-brand .brand-dot {
  width: 9px; height: 9px; border-radius: 2px;
  background: #63b3ed; flex: 0 0 9px;
}
.sidebar-nav { flex: 1; overflow-y: auto; padding: 8px 0 24px; }
.sidebar-nav::-webkit-scrollbar { width: 6px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.18); border-radius: 3px; }

.menu-group-title {
  padding: 12px 16px 6px;
  font-size: 11px;
  letter-spacing: 1px;
  color: #8ea3bd;
  text-transform: uppercase;
}
.menu-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  cursor: pointer;
  color: #cddcee;
  font-size: 13.5px;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
  user-select: none;
}
.menu-item:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
.menu-item.is-active {
  background: rgba(99, 179, 237, 0.16);
  border-left-color: #63b3ed;
  color: #fff;
  font-weight: 600;
}
.menu-item .menu-icon { font-size: 15px; opacity: 0.9; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-h);
  flex: 0 0 var(--topbar-h);
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 18px;
}
.topbar-title { font-size: 15px; font-weight: 600; }
.topbar-crumb { font-size: 12px; color: var(--text-mute); }
.topbar-spacer { flex: 1; }
.topbar-user {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-sub); cursor: pointer;
  padding: 5px 9px; border-radius: 6px;
}
.topbar-user:hover { background: var(--brand-soft); }
.topbar-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.icon-btn { display: none; }

.page-body { flex: 1; overflow-y: auto; padding: 16px 18px 26px; }

/* ---------------------------------------------- 卡片 / 面板 */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
  margin-bottom: 14px;
}
.panel.tight { padding: 12px 14px; }
.panel-title {
  font-size: 14px; font-weight: 600; margin: 0 0 12px;
  display: flex; align-items: center; gap: 8px;
}
.panel-title::before {
  content: ""; width: 3px; height: 14px; border-radius: 2px; background: var(--brand);
}
.panel-head {
  display: flex; align-items: center; gap: 12px; margin-bottom: 12px;
}
.panel-head .panel-title { margin: 0; }
.panel-head .grow { flex: 1; }

.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filter-bar .el-input, .filter-bar .el-select, .filter-bar .el-date-editor { width: auto; }

/* ---------------------------------------------- 统计卡 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 12px;
}
.stat-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: ""; position: absolute; right: -18px; top: -18px;
  width: 62px; height: 62px; border-radius: 50%;
  background: var(--brand-soft);
}
.stat-label { font-size: 12.5px; color: var(--text-sub); position: relative; z-index: 1; }
.stat-value {
  font-size: 23px; font-weight: 700; margin-top: 6px;
  font-variant-numeric: tabular-nums;
  position: relative; z-index: 1;
}
.stat-value small { font-size: 12px; font-weight: 500; color: var(--text-mute); margin-left: 3px; }
.stat-card.is-warn .stat-value { color: var(--warn); }
.stat-card.is-danger .stat-value { color: var(--danger); }
.stat-card.is-ok .stat-value { color: var(--ok); }

/* ---------------------------------------------- 表格 */
.el-table { font-size: 13px; }
.el-table .cell { word-break: break-word; }
.num-cell { font-variant-numeric: tabular-nums; text-align: right; }
.row-danger { background: #fff7f7 !important; }
.row-warn { background: #fffaf0 !important; }
.qty-in { color: var(--ok); font-weight: 600; }
.qty-out { color: var(--danger); font-weight: 600; }

.table-pager { display: flex; justify-content: flex-end; padding-top: 12px; }

.muted { color: var(--text-mute); }
.sub { color: var(--text-sub); font-size: 12px; }
.nowrap { white-space: nowrap; }

/* ---------------------------------------------- 登录页 */
.login-wrap {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1f3552 0%, #2b6cb0 55%, #4a90d9 100%);
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 18px 50px rgba(10, 25, 45, 0.3);
  padding: 30px 28px 24px;
}
.login-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.login-sub { font-size: 12.5px; color: var(--text-sub); margin: 0 0 22px; }
.login-tip {
  margin-top: 16px; padding: 10px 12px;
  background: var(--brand-soft); border-radius: 6px;
  font-size: 12px; color: #2a4d75; line-height: 1.7;
}

/* ---------------------------------------------- 明细编辑表 */
.item-table .el-input-number { width: 100%; }
.item-table .el-input, .item-table .el-select { width: 100%; }
.detail-total {
  display: flex; justify-content: flex-end; gap: 22px;
  padding: 10px 4px 0; font-size: 13px; color: var(--text-sub);
}
.detail-total b { color: var(--text); font-size: 15px; font-variant-numeric: tabular-nums; }

/* ---------------------------------------------- 打印 */
.print-sheet { display: none; }

@media print {
  body { background: #fff; }
  .sidebar, .topbar, .filter-bar, .panel-head, .el-dialog__header,
  .el-dialog__footer, .table-pager, .no-print { display: none !important; }
  .print-sheet { display: block !important; }
  .el-dialog, .el-overlay { position: static !important; }
}

/* ---------------------------------------------- 手机适配 */
.sidebar-mask { display: none; }

@media (max-width: 768px) {
  .icon-btn {
    display: inline-flex; align-items: center; justify-content: center;
    width: 34px; height: 34px; border-radius: 6px; cursor: pointer;
    color: var(--text-sub); border: 1px solid var(--border);
  }
  .sidebar {
    position: fixed; z-index: 2200; height: 100%; left: 0; top: 0;
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    box-shadow: 4px 0 22px rgba(10, 25, 45, 0.28);
  }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-mask {
    display: block; position: fixed; inset: 0; z-index: 2100;
    background: rgba(16, 28, 45, 0.45);
  }
  .page-body { padding: 12px 12px 22px; }
  .topbar { padding: 0 12px; }
  .topbar-crumb { display: none; }
  .panel { padding: 12px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .stat-value { font-size: 19px; }
  .filter-bar .el-input, .filter-bar .el-select, .filter-bar .el-date-editor { width: 100%; }
  .detail-total { justify-content: space-between; gap: 8px; flex-wrap: wrap; }
  .el-dialog { width: 92% !important; margin-top: 6vh !important; }
  .el-drawer { width: 90% !important; }
  .table-pager { justify-content: center; }
}

/* ---------------------------------------------- 消息中心 */
.notice-badge { margin-right: 8px; line-height: 1; }
.notice-badge .el-badge__content { border: none; }

.notice-item {
  border: 1px solid var(--border);
  border-left: 4px solid var(--border-strong);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 10px;
  background: var(--panel);
}
.notice-item.level-warn { border-left-color: #e6a23c; }
.notice-item.level-danger { border-left-color: #f56c6c; background: #fff8f8; }
.notice-item.level-info { border-left-color: var(--brand); }
.notice-item.is-read { opacity: 0.7; }

.notice-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.notice-head .grow, .notice-foot .grow { flex: 1; }
.notice-title { font-weight: 600; font-size: 14px; }
.notice-body {
  white-space: pre-wrap;
  color: var(--text-sub);
  font-size: 13px;
  line-height: 1.8;
  margin: 8px 0 6px;
}
.notice-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

/* ---------------------------------------------- 批量导入 */
.import-warn {
  font-size: 12.5px;
  color: var(--warn);
  background: #fdf6ec;
  border-radius: 4px;
  padding: 6px 10px;
  margin-top: 6px;
}
.row-danger td { background: #fff5f5 !important; }

@media (max-width: 768px) {
  .notice-body { font-size: 12.5px; }
  .notice-foot { gap: 8px; }
}

/* ============================================================
   联网授权（License）
   ============================================================ */
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, "Courier New", monospace; font-size: 12.5px; }

.lic-banner {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 14px 18px; border-left: 4px solid var(--brand, #2563eb);
  background: linear-gradient(90deg, rgba(37, 99, 235, .06), rgba(37, 99, 235, 0));
}
.lic-banner-main { flex: 1 1 240px; min-width: 200px; }
.lic-status-line { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.lic-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--brand, #2563eb); box-shadow: 0 0 0 3px rgba(37, 99, 235, .15); }
.lic-msg { color: var(--text-sub, #6b7280); font-size: 12.5px; margin-top: 3px; line-height: 1.6; }
.lic-banner-side { display: flex; gap: 22px; flex-wrap: wrap; }
.lic-kv { font-size: 12.5px; color: var(--text-sub, #6b7280); }
.lic-kv b { display: block; font-size: 14px; color: var(--text-main, #1f2937); margin-top: 1px; font-weight: 600; }
.lic-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.lic-banner.lic-valid    { border-left-color: #059669; background: linear-gradient(90deg, rgba(5, 150, 105, .07), rgba(5, 150, 105, 0)); }
.lic-banner.lic-valid .lic-dot { background: #059669; box-shadow: 0 0 0 3px rgba(5, 150, 105, .15); }
.lic-banner.lic-success  { border-left-color: #059669; }
.lic-banner.lic-warning  { border-left-color: #d97706; background: linear-gradient(90deg, rgba(217, 119, 6, .07), rgba(217, 119, 6, 0)); }
.lic-banner.lic-warning .lic-dot { background: #d97706; box-shadow: 0 0 0 3px rgba(217, 119, 6, .15); }
.lic-banner.lic-danger   { border-left-color: #dc2626; background: linear-gradient(90deg, rgba(220, 38, 38, .08), rgba(220, 38, 38, 0)); }
.lic-banner.lic-danger .lic-dot { background: #dc2626; box-shadow: 0 0 0 3px rgba(220, 38, 38, .16); }
.lic-banner.lic-info     { border-left-color: #6b7280; }

.form-help { color: var(--text-sub, #6b7280); font-size: 12px; line-height: 1.6; margin-top: 3px; }

/* 授权失效：全局只读提示条 */
.license-block-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: 0 16px; padding: 10px 14px; border-radius: 8px;
  background: #fef2f2; border: 1px solid #fecaca; color: #991b1b; font-size: 13px;
}
.license-block-text { display: flex; align-items: flex-start; gap: 8px; flex: 1 1 320px; line-height: 1.65; }
.license-block-text .el-icon { margin-top: 3px; font-size: 16px; }

/* 移动端：授权横幅纵向堆叠 */
@media (max-width: 768px) {
  .lic-banner { padding: 12px 14px; }
  .lic-banner-side { gap: 14px; }
  .license-block-banner { margin: 0 10px; }
}
