/* 仪皇电商ERP管理系统 —— 全局样式
   设计取向：干净、克制、专业。界面需直接用于软著说明书截图。 */

:root {
  --c-primary: #1f5fd6;
  --c-primary-dark: #17489f;
  --c-bg: #f4f6fa;
  --c-panel: #ffffff;
  --c-line: #e3e8f0;
  --c-text: #1f2733;
  --c-text-sub: #6b7688;
  --c-danger: #d9383f;
  --c-warn: #e08b1a;
  --c-ok: #1f9d5a;
  --sidebar-w: 224px;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  color: var(--c-text);
  background: var(--c-bg);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }

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

.sidebar {
  width: var(--sidebar-w);
  background: #16223a;
  color: #c8d4e8;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid #22314f;
}

.brand-mark {
  width: 34px; height: 34px;
  border-radius: 7px;
  background: var(--c-primary);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px;
  flex-shrink: 0;
}

.brand-name { font-size: 13px; font-weight: 600; color: #fff; line-height: 1.5; }
.brand-ver { font-size: 11px; color: #7f8fb0; }

.nav { flex: 1; padding: 10px 8px; overflow-y: auto; }

.nav-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px;
  border-radius: 6px;
  font-size: 13.5px;
  margin-bottom: 2px;
  transition: background .15s;
}
.nav-item:hover { background: #1e2c49; color: #fff; }
.nav-item.active { background: var(--c-primary); color: #fff; font-weight: 600; }
.nav-icon { width: 16px; text-align: center; opacity: .9; }

.sidebar-foot {
  padding: 12px 16px;
  border-top: 1px solid #22314f;
  font-size: 11px;
  color: #6d7c98;
}

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

.topbar {
  height: 52px;
  background: #fff;
  border-bottom: 1px solid var(--c-line);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
  flex-shrink: 0;
}
.crumb { font-size: 14px; font-weight: 600; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user-chip { font-size: 13px; color: var(--c-text-sub); }
.logout { font-size: 13px; color: var(--c-primary); }
.logout:hover { text-decoration: underline; }

.content { flex: 1; padding: 20px 22px; }
.pagefoot {
  padding: 12px 22px;
  font-size: 11.5px;
  color: #97a2b5;
  border-top: 1px solid var(--c-line);
  background: #fff;
}

/* ------------------------------------------------------------ 登录页 */
.login-wrap {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #16223a 0%, #1f3a6d 55%, #1f5fd6 100%);
}
.login-card {
  width: 380px;
  background: #fff;
  border-radius: 12px;
  padding: 34px 32px 24px;
  box-shadow: 0 18px 50px rgba(8, 18, 40, .3);
}
.login-head { text-align: center; margin-bottom: 22px; }
.login-logo {
  width: 52px; height: 52px; margin: 0 auto 12px;
  border-radius: 12px; background: var(--c-primary); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 700;
}
.login-title { margin: 0; font-size: 19px; letter-spacing: .5px; }
.login-ver { margin: 5px 0 0; font-size: 12px; color: var(--c-text-sub); letter-spacing: 1px; }

.login-form .field { display: block; margin-bottom: 15px; }
.field-label { display: block; font-size: 12.5px; color: var(--c-text-sub); margin-bottom: 6px; }
.login-form input {
  width: 100%; height: 40px; padding: 0 12px;
  border: 1px solid var(--c-line); border-radius: 6px;
  font-size: 14px; outline: none; transition: border-color .15s;
}
.login-form input:focus { border-color: var(--c-primary); box-shadow: 0 0 0 3px rgba(31,95,214,.12); }

.login-foot { margin-top: 18px; text-align: center; font-size: 11.5px; color: #9aa5b8; }

/* ------------------------------------------------------------ 组件 */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  height: 36px; padding: 0 16px;
  border: 1px solid var(--c-line); border-radius: 6px;
  background: #fff; color: var(--c-text);
  font-size: 13.5px; cursor: pointer; transition: all .15s;
}
.btn:hover { border-color: var(--c-primary); color: var(--c-primary); }
.btn-primary { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.btn-primary:hover { background: var(--c-primary-dark); border-color: var(--c-primary-dark); color: #fff; }
.btn-block { width: 100%; height: 42px; font-size: 15px; letter-spacing: 2px; }

.alert { padding: 10px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 14px; }
.alert-error { background: #fdeaea; color: #a32227; border: 1px solid #f5c6c8; }

.page-head { margin-bottom: 16px; }
.page-head h2 { margin: 0 0 4px; font-size: 18px; }
.muted { color: var(--c-text-sub); font-size: 12.5px; margin: 0; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 16px; }

.card {
  background: var(--c-panel);
  border: 1px solid var(--c-line);
  border-radius: var(--radius);
  padding: 16px 18px;
}
.card.stat { padding: 16px 18px; }
.card.stat.warn { border-left: 3px solid var(--c-warn); }
.stat-label { font-size: 12.5px; color: var(--c-text-sub); }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 6px; letter-spacing: .5px; }

.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.card-head h3 { margin: 0; font-size: 15px; }

.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th {
  text-align: left; font-weight: 600; color: var(--c-text-sub);
  padding: 9px 10px; border-bottom: 1px solid var(--c-line); background: #fafbfd;
}
.table td { padding: 9px 10px; border-bottom: 1px solid #f0f3f8; }
.table tbody tr:hover { background: #f8faff; }
.danger { color: var(--c-danger); font-weight: 600; }
.empty { padding: 26px; text-align: center; color: #a5aebf; font-size: 13px; }

/* ------------------------------------------------------------ 表单与筛选 */
.filter-form { display: flex; flex-direction: column; gap: 10px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.field.inline { display: flex; flex-direction: column; margin: 0; }
.field.inline .field-label { margin-bottom: 5px; }
.filter-form input[type=text], .filter-form input[type=date], .filter-form select,
.op-box input, .op-box select, .inline-form input[type=file] {
  height: 34px; padding: 0 10px; border: 1px solid var(--c-line);
  border-radius: 6px; font-size: 13px; outline: none; background: #fff;
  min-width: 150px; color: var(--c-text);
}
.filter-form input:focus, .filter-form select:focus, .op-box input:focus { border-color: var(--c-primary); }

.inline-form { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.import-box { padding: 14px; background: #f7f9fc; border: 1px dashed var(--c-line);
  border-radius: 6px; margin-bottom: 14px; }
.hidden { display: none; }

.card-actions { margin-left: auto; display: flex; gap: 8px; }
.btn-sm { height: 30px; padding: 0 12px; font-size: 12.5px; }
.btn-danger { border-color: #e9b7ba; color: var(--c-danger); }
.btn-danger:hover { background: var(--c-danger); border-color: var(--c-danger); color: #fff; }

/* ------------------------------------------------------------ 表格增强 */
.num { text-align: right; font-variant-numeric: tabular-nums; }
.strong { font-weight: 700; }
.link { color: var(--c-primary); }
.link:hover { text-decoration: underline; }
.tag { display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 12px; background: #eef2f8; color: #47536b; }
.tag-shipped, .tag-signed { background: #e6f2ff; color: #17509e; }
.tag-finished { background: #e6f7ec; color: #12703f; }
.tag-cancelled { background: #f6ecec; color: #9a3a3f; }
.tag-refunding { background: #fdf1e0; color: #91591a; }
.tag-pending_pay, .tag-paid, .tag-pending_audit, .tag-audited, .tag-pending_pick, .tag-picked {
  background: #eef2f8; color: #47536b; }

.pager { display: flex; align-items: center; gap: 12px; justify-content: center; padding-top: 14px; }

/* ------------------------------------------------------------ 详情页 */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
@media (max-width: 1000px) { .grid-2 { grid-template-columns: 1fr; } }

.kv { display: grid; grid-template-columns: 92px 1fr; gap: 7px 12px; margin: 0; font-size: 13px; }
.kv dt { color: var(--c-text-sub); }
.kv dd { margin: 0; }

.stat-value.sm { font-size: 17px; }

.op-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(228px, 1fr)); gap: 12px; }
.op-box { border: 1px solid var(--c-line); border-radius: 8px; padding: 12px;
  display: flex; flex-direction: column; gap: 8px; background: #fcfdff; }
.op-title { font-size: 13px; font-weight: 600; color: #2b3550; }
.op-box input, .op-box select { width: 100%; min-width: 0; }
.op-box .btn { width: 100%; }

.page-actions { margin-top: 4px; }

.alert-ok { background: #e8f6ee; color: #14713f; border: 1px solid #bfe4cd; }

/* ------------------------------------------------------------ 表单栅格 */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }

.form-grid input, .filter-form textarea, form textarea, form .field input,
.sku-form input, .map-form input, .map-form select, .inline-form select,
.inline-form input[type=number], .inline-form input[type=text] {
  height: 34px; padding: 0 10px; border: 1px solid var(--c-line);
  border-radius: 6px; font-size: 13px; outline: none; background: #fff;
  width: 100%; min-width: 0; color: var(--c-text); box-sizing: border-box;
}
form textarea { height: auto; padding: 8px 10px; font-family: inherit; resize: vertical; }
.field { display: block; margin-bottom: 12px; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px;
  color: var(--c-text-sub); white-space: nowrap; }
.check input { width: auto; height: auto; }
.ok-text { color: var(--c-ok); font-weight: 600; }

/* ------------------------------------------------------------ 选项卡 */
.tabs { display: flex; gap: 6px; margin-bottom: 14px; }
.tab { padding: 8px 16px; border: 1px solid var(--c-line); border-bottom: none;
  border-radius: 7px 7px 0 0; background: #eef2f8; font-size: 13.5px; color: #4a566e; }
.tab.active { background: #fff; color: var(--c-primary); font-weight: 600;
  border-color: var(--c-line); position: relative; top: 1px; }
.tab:hover { color: var(--c-primary); }

/* ------------------------------------------------------------ SKU 区块 */
.sku-block { border: 1px solid var(--c-line); border-radius: 8px;
  padding: 12px; margin-bottom: 12px; background: #fcfdff; }
.sku-code { font-size: 13px; color: #2b3550; margin-bottom: 9px; }
.sku-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 9px; }
.sku-form input { flex: 1 1 120px; min-width: 110px; }
.map-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding-top: 9px; border-top: 1px dashed var(--c-line); }
.map-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.map-form input, .map-form select { flex: 0 1 150px; }
.sku-del { margin-top: 9px; }

/* ------------------------------------------------------------ 标签片与图表 */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px;
  background: #eef2f8; border-radius: 14px; font-size: 13px; color: #46536b; }
.chip b { color: var(--c-primary); font-size: 14px; }

/* ------------------------------------------------------------ 权限矩阵 */
.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 10px; }
.perm-box { border: 1px solid var(--c-line); border-radius: 8px; padding: 10px 12px; background: #fcfdff; }
.perm-title { font-size: 13px; font-weight: 600; color: #2b3550; margin-bottom: 8px;
  padding-bottom: 6px; border-bottom: 1px solid var(--c-line); }
.perm-item { display: flex; align-items: flex-start; gap: 7px; padding: 3px 0;
  font-size: 13px; color: #46536b; white-space: normal; line-height: 1.5; }
.perm-item input { margin-top: 3px; flex: none; }
.perm-item em { display: block; font-style: normal; font-size: 11px; color: #97a2b5; }
.wrap { word-break: break-all; }

.chart { display: flex; align-items: flex-end; gap: 6px; height: 180px;
  padding: 10px 4px 0; border-bottom: 1px solid var(--c-line); }
.bar-wrap { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: flex-end; height: 100%; position: relative; }
.bar { width: 100%; max-width: 42px; background: linear-gradient(180deg, #4a86e8, #1f5fd6);
  border-radius: 4px 4px 0 0; min-height: 3px; transition: opacity .15s; }
.bar-wrap:hover .bar { opacity: .8; }
.bar-label { font-size: 10px; color: #97a2b5; margin-top: 4px; white-space: nowrap;
  transform: rotate(-45deg); transform-origin: center; }
.bar-value { position: absolute; bottom: 100%; font-size: 11px; color: #5a6478; }
