/* ==========================================================================
   晟昱安供应链管理平台 — 后台样式
   admin.astrumlinksc.com
   ========================================================================== */

:root {
  --navy: #0B2E4F;
  --navy-deep: #071E36;
  --navy-sidebar: #0A2642;
  --steel: #2E6DA4;
  --steel-light: #5B8FC7;
  --amber: #E8A020;
  --amber-light: #F5C86A;
  --green: #1E9E6A;
  --red: #D64545;
  --orange: #E07B39;
  --blue: #3B7FD4;

  --ink: #1C2B3A;
  --gray: #6B7C8D;
  --gray-light: #9BAAB8;
  --line: #E4EAF1;
  --bg: #F4F7FA;
  --white: #FFFFFF;

  --sidebar-w: 232px;
  --header-h: 60px;
  --radius: 4px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: "Microsoft YaHei", "PingFang SC", -apple-system, sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--steel); text-decoration: none; }
a:hover { text-decoration: underline; }

input, button, select, textarea {
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

/* ==========================================================================
   登录页
   ========================================================================== */
.login-body {
  min-height: 100vh;
  display: flex;
  background: var(--bg);
}

.login-left {
  flex: 1;
  background: linear-gradient(140deg, var(--navy-deep) 0%, var(--navy) 60%, #154B78 100%);
  color: var(--white);
  padding: 60px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}
.login-left::after {
  content: '';
  position: absolute;
  right: -160px; bottom: -180px;
  width: 480px; height: 480px;
  border-radius: 50%;
  background: rgba(232, 160, 32, .08);
}
.login-left::before {
  content: '';
  position: absolute;
  right: 80px; top: -100px;
  width: 340px; height: 340px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, .1);
}
.login-left > * { position: relative; z-index: 2; }

.login-logo { display: flex; align-items: center; gap: 12px; }
.login-logo .mark {
  width: 44px; height: 44px;
  background: var(--amber);
  color: var(--navy-deep);
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700;
}
.login-logo .cn { font-size: 18px; font-weight: 700; }
.login-logo .en { font-size: 11px; color: #9FB6CC; letter-spacing: .8px; text-transform: uppercase; }

.login-pitch { max-width: 460px; }
.login-pitch h1 {
  font-size: 34px;
  line-height: 1.4;
  font-weight: 700;
  margin-bottom: 18px;
}
.login-pitch h1 span { color: var(--amber); }
.login-pitch p { color: #B9CDDF; font-size: 15px; }
.login-points { margin-top: 32px; }
.login-points li {
  list-style: none;
  padding: 9px 0 9px 26px;
  position: relative;
  color: #C9D9E7;
  font-size: 14.5px;
}
.login-points li::before {
  content: '';
  position: absolute; left: 0; top: 17px;
  width: 8px; height: 8px;
  background: var(--amber);
  border-radius: 50%;
}
.login-foot { font-size: 13px; color: #7C95AC; }

.login-right {
  width: 470px;
  flex-shrink: 0;
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 50px;
}
.login-box { width: 100%; max-width: 340px; }
.login-box h2 { font-size: 24px; color: var(--navy); margin-bottom: 8px; }
.login-box .sub { color: var(--gray); font-size: 14px; margin-bottom: 34px; }

.field { margin-bottom: 20px; }
.field label {
  display: block;
  font-size: 13.5px;
  color: var(--ink);
  margin-bottom: 8px;
  font-weight: 500;
}
.field input[type="text"],
.field input[type="password"] {
  width: 100%;
  height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #FBFCFD;
  transition: border-color .2s, box-shadow .2s;
}
.field input:focus {
  border-color: var(--steel);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(46, 109, 164, .12);
}

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 62px !important; }
.pw-toggle {
  position: absolute;
  right: 6px; top: 50%;
  transform: translateY(-50%);
  background: none;
  border: 0;
  color: var(--gray);
  cursor: pointer;
  font-size: 13px;
  padding: 6px 8px;
}
.pw-toggle:hover { color: var(--steel); }

.form-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 4px 0 24px;
  font-size: 13.5px;
}
.form-row .check { display: flex; align-items: center; gap: 6px; color: var(--gray); cursor: pointer; }
.form-row input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--navy); cursor: pointer; }

.login-btn {
  width: 100%;
  height: 46px;
  background: var(--navy);
  color: var(--white);
  border: 0;
  border-radius: var(--radius);
  font-size: 15.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s;
}
.login-btn:hover { background: var(--steel); }
.login-btn:active { background: var(--navy-deep); }

.login-msg {
  display: none;
  background: #FDF0F0;
  border: 1px solid #F5CACA;
  color: var(--red);
  font-size: 13.5px;
  padding: 10px 12px;
  border-radius: var(--radius);
  margin-bottom: 18px;
}
.login-msg.show { display: block; }

.login-tips {
  margin-top: 26px;
  padding: 14px 16px;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 12.5px;
  color: var(--gray);
  line-height: 1.85;
}
.login-tips b { color: var(--navy); }

/* 演示账号表格 */
.tips-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0;
  font-size: 12.5px;
}
.tips-table td {
  padding: 3px 0;
  border: 0;
  background: none;
  color: var(--gray);
}
.tips-table td:nth-child(1) {
  font-family: Consolas, monospace;
  color: var(--navy);
  font-weight: 600;
  width: 76px;
}
.tips-table td:nth-child(2) {
  font-family: Consolas, monospace;
  color: var(--steel);
  width: 116px;
}
.tips-table td:nth-child(3) { color: var(--gray-light); }
.tips-foot {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px dashed rgba(0, 0, 0, .1);
  font-size: 12.5px;
  color: var(--gray);
}

/* 数据库状态提示框 */
.alert {
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 20px;
  font-size: 13.5px;
  line-height: 1.7;
}
.alert-error {
  background: #FDF0F0;
  border: 1px solid #F5CACA;
  color: #A83232;
}
.alert-warn {
  background: #FDF8EC;
  border: 1px solid #F2E0B8;
  color: #8A6520;
}
.alert-title { font-weight: 700; margin-bottom: 6px; font-size: 14px; }
.alert-body { opacity: .92; }
.alert-foot {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed rgba(0, 0, 0, .1);
  font-size: 12.5px;
  opacity: .82;
}
.alert code, .login-tips code {
  background: rgba(0, 0, 0, .06);
  border: 1px solid rgba(0, 0, 0, .09);
  padding: 1px 6px;
  border-radius: 2px;
  font-family: Consolas, monospace;
  font-size: 12px;
}

/* 后台内页通用提示条 */
.alert-ok, .alert-error-box, .ok-box {
  border-radius: var(--radius);
  padding: 11px 16px;
  margin-bottom: 18px;
  font-size: 13.5px;
}
.alert-ok, .ok-box {
  background: #E8F7F1;
  border: 1px solid #B8E4D2;
  color: #14764F;
}
.alert-error-box {
  background: #FDF0F0;
  border: 1px solid #F5CACA;
  color: #A83232;
}

/* 登录按钮禁用态 */
.login-btn:disabled { background: #B8C4D0; cursor: not-allowed; }
.login-btn:disabled:hover { background: #B8C4D0; }

/* 顶栏数据库连接指示 */
.db-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12.5px;
  padding: 4px 11px;
  border-radius: 20px;
  background: #E8F7F1;
  border: 1px solid #B8E4D2;
  color: #14764F;
  white-space: nowrap;
}
.db-chip .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--green);
  animation: dbBlink 2.2s ease-in-out infinite;
}
@keyframes dbBlink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* 顶栏文字链接 */
.fw-link {
  color: var(--gray);
  font-size: 13px;
  text-decoration: none;
  transition: color .2s;
  white-space: nowrap;
}
.fw-link:hover { color: var(--steel); text-decoration: none; }

/* 新增用户表单 */
.create-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.create-form input[type="text"],
.create-form input[type="password"],
.create-form select {
  height: 32px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  font-size: 13px;
  background: var(--white);
  min-width: 130px;
  flex: 1;
  max-width: 180px;
}
.create-form input:focus, .create-form select:focus {
  border-color: var(--steel);
  outline: none;
}
.create-form button { flex-shrink: 0; height: 32px; }

/* 操作链接内的隐藏表单 */
.op-links form { display: inline; }

.login-tips code {
  background: var(--white);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: 2px;
  font-family: Consolas, monospace;
  color: var(--steel);
}

@media (max-width: 900px) {
  .login-left { display: none; }
  .login-right { width: 100%; padding: 32px 24px; }
}

/* ==========================================================================
   后台整体框架
   ========================================================================== */
.layout { display: flex; min-height: 100vh; }

/* 侧边栏 */
.sidebar {
  width: var(--sidebar-w);
  background: var(--navy-sidebar);
  color: #A8C0D6;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  z-index: 150;
  transition: transform .25s;
}
.sidebar-head {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 20px;
  border-bottom: 1px solid rgba(255, 255, 255, .08);
  flex-shrink: 0;
}
.sidebar-head .mark {
  width: 32px; height: 32px;
  background: var(--amber);
  color: var(--navy-deep);
  border-radius: 3px;
  display: flex; align-items: center; justify-content: center;
  font-size: 17px; font-weight: 700;
  flex-shrink: 0;
}
.sidebar-head .t { color: var(--white); font-size: 14.5px; font-weight: 600; line-height: 1.25; }
.sidebar-head .s { font-size: 10px; color: #7A93AB; letter-spacing: .5px; text-transform: uppercase; }

.sidebar-nav { flex: 1; overflow-y: auto; padding: 14px 0; }
.nav-group-label {
  font-size: 11px;
  color: #6E8699;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  padding: 14px 20px 8px;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 20px;
  color: #A8C0D6;
  font-size: 14px;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all .18s;
  text-decoration: none;
}
.nav-item:hover { background: rgba(255,255,255,.05); color: var(--white); text-decoration: none; }
.nav-item.active {
  background: rgba(232, 160, 32, .1);
  border-left-color: var(--amber);
  color: var(--white);
}
.nav-item .ico { width: 18px; text-align: center; font-size: 15px; flex-shrink: 0; }
.nav-item .badge {
  margin-left: auto;
  background: var(--red);
  color: var(--white);
  font-size: 11px;
  padding: 1px 7px;
  border-radius: 9px;
  font-weight: 600;
}

.sidebar-foot {
  padding: 14px 20px;
  border-top: 1px solid rgba(255, 255, 255, .08);
  font-size: 12.5px;
  flex-shrink: 0;
}
.sidebar-foot a { color: #7A93AB; }
.sidebar-foot .ver { color: #5B7387; font-size: 11px; margin-top: 4px; }

/* 主区域 */
.main { margin-left: var(--sidebar-w); flex: 1; display: flex; flex-direction: column; min-width: 0; }

.header {
  height: var(--header-h);
  background: var(--white);
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 100;
}
.menu-toggle {
  display: none;
  background: none;
  border: 0;
  font-size: 22px;
  color: var(--navy);
  cursor: pointer;
  line-height: 1;
}
.page-title { font-size: 17px; font-weight: 600; color: var(--navy); }
.page-crumb { font-size: 12.5px; color: var(--gray-light); margin-top: 1px; }

.header-right { margin-left: auto; display: flex; align-items: center; gap: 18px; }

.search-box {
  display: flex;
  align-items: center;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  height: 34px;
  gap: 7px;
}
.search-box input {
  border: 0;
  background: none;
  width: 170px;
  font-size: 13.5px;
}
.search-box input:focus { width: 210px; }

.icon-btn {
  position: relative;
  background: none;
  border: 0;
  font-size: 19px;
  cursor: pointer;
  color: var(--gray);
  line-height: 1;
  padding: 4px;
}
.icon-btn:hover { color: var(--navy); }
.icon-btn .dot {
  position: absolute;
  top: 2px; right: 0;
  width: 8px; height: 8px;
  background: var(--red);
  border-radius: 50%;
  border: 1.5px solid var(--white);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius);
  transition: background .18s;
}
.user-chip:hover { background: var(--bg); }
.avatar {
  width: 32px; height: 32px;
  background: var(--navy);
  color: var(--white);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 13.5px;
  font-weight: 600;
  flex-shrink: 0;
}
.user-chip .name { font-size: 13.5px; font-weight: 500; }
.user-chip .role { font-size: 11.5px; color: var(--gray-light); }

/* 内容区 */
.content { padding: 24px; flex: 1; }
.page-intro { color: var(--gray); font-size: 13.5px; margin-bottom: 22px; }

/* 数据卡片 */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}
.stat-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: '';
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--steel);
}
.stat-card.amber::before { background: var(--amber); }
.stat-card.green::before { background: var(--green); }
.stat-card.red::before { background: var(--red); }

.stat-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 12px;
}
.stat-label { font-size: 13.5px; color: var(--gray); }
.stat-ico {
  width: 36px; height: 36px;
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 17px;
  background: rgba(46, 109, 164, .1);
}
.stat-num {
  font-size: 28px;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.2;
  font-family: "DIN Alternate", Consolas, monospace;
}
.stat-foot { margin-top: 9px; font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.trend-up { color: var(--green); font-weight: 600; }
.trend-down { color: var(--red); font-weight: 600; }
.trend-flat { color: var(--gray); font-weight: 600; }

/* 面板 */
.panel {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 22px;
}
.panel-head {
  height: 50px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 12px;
}
.panel-head h3 { font-size: 15px; color: var(--navy); font-weight: 600; }
.panel-head .sub { font-size: 12.5px; color: var(--gray-light); }
.panel-head .actions { margin-left: auto; display: flex; gap: 9px; align-items: center; }
.panel-body { padding: 20px; }
.panel-body.flush { padding: 0; }

.col-2 { display: grid; grid-template-columns: 1.5fr 1fr; gap: 22px; }
.col-2-even { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }

/* 按钮 */
.btn-s {
  height: 30px;
  padding: 0 13px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: all .18s;
  text-decoration: none;
}
.btn-s:hover { border-color: var(--steel); color: var(--steel); text-decoration: none; }
.btn-s-primary { background: var(--navy); border-color: var(--navy); color: var(--white); }
.btn-s-primary:hover { background: var(--steel); border-color: var(--steel); color: var(--white); }

select.sel {
  height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 8px;
  font-size: 13px;
  background: var(--white);
  cursor: pointer;
}

/* 表格 */
table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
}
table.data th {
  background: #F7FAFC;
  color: var(--gray);
  font-weight: 600;
  font-size: 12.5px;
  text-align: left;
  padding: 11px 14px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
table.data td {
  padding: 12px 14px;
  border-bottom: 1px solid #F0F4F8;
  color: var(--ink);
}
table.data tbody tr:hover { background: #FAFCFE; }
table.data tbody tr:last-child td { border-bottom: 0; }
.mono { font-family: Consolas, "Courier New", monospace; font-size: 13px; }
.muted { color: var(--gray-light); }
.strong { font-weight: 600; }
.num { text-align: right; font-family: Consolas, monospace; }

/* 状态标签 */
.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 2px;
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}
.tag-green { background: #E8F7F1; color: var(--green); }
.tag-amber { background: #FDF3E0; color: var(--orange); }
.tag-red { background: #FCEBEB; color: var(--red); }
.tag-blue { background: #EAF2FC; color: var(--blue); }
.tag-gray { background: #F0F3F6; color: var(--gray); }

/* 操作链接 */
.op-links { display: flex; gap: 12px; }
.op-links a { font-size: 13px; }
.op-links a.danger { color: var(--red); }

/* 图表：CSS 柱状图 */
.chart-bar {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  height: 220px;
  padding: 16px 4px 0;
  border-bottom: 1px solid var(--line);
}
.chart-bar .bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  height: 100%;
  position: relative;
}
.chart-bar .bar {
  width: 100%;
  max-width: 46px;
  background: linear-gradient(180deg, var(--steel-light), var(--steel));
  border-radius: 2px 2px 0 0;
  transition: opacity .2s;
}
.chart-bar .bar-item:hover .bar { opacity: .82; }
.chart-bar .bar-val {
  font-size: 12.5px;
  color: var(--ink);
  font-weight: 600;
  margin-bottom: 5px;
  font-family: Consolas, monospace;
}
.chart-labels {
  display: flex;
  gap: 14px;
  padding: 9px 4px 0;
}
.chart-labels span {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--gray);
}

/* 进度条 */
.progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 0;
  border-bottom: 1px solid #F0F4F8;
}
.progress-row:last-child { border-bottom: 0; }
.progress-row .pl { width: 110px; font-size: 13.5px; flex-shrink: 0; }
.progress-track {
  flex: 1;
  height: 8px;
  background: #EDF1F6;
  border-radius: 4px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: var(--steel);
  border-radius: 4px;
}
.progress-fill.amber { background: var(--amber); }
.progress-fill.green { background: var(--green); }
.progress-fill.red { background: var(--red); }
.progress-row .pv {
  width: 84px;
  text-align: right;
  font-size: 13px;
  font-family: Consolas, monospace;
  flex-shrink: 0;
}

/* 面包屑导航 */
.crumb {
  font-size: 12.5px;
  color: var(--gray-light);
  margin-bottom: 16px;
}
.crumb a { color: var(--gray); }
.crumb a:hover { color: var(--steel); }
.crumb span { margin: 0 6px; }

/* 分页 */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  font-size: 13px;
  color: var(--gray);
}
.pager-btns { display: flex; gap: 6px; }
.pager-btns a, .pager-btns span {
  min-width: 30px;
  height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}
.pager-btns .on { background: var(--navy); border-color: var(--navy); color: var(--white); font-weight: 600; }
.pager-btns a:hover { border-color: var(--steel); color: var(--steel); text-decoration: none; }

/* 搜索筛选栏 */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.filters input[type="text"], .filters select {
  height: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 10px;
  font-size: 13px;
  background: var(--white);
  cursor: pointer;
}
.filters input[type="text"] { width: 190px; cursor: text; }

/* 空状态 */
.empty {
  text-align: center;
  padding: 64px 20px;
  color: var(--gray-light);
}
.empty .ico { font-size: 42px; margin-bottom: 14px; opacity: .5; }
.empty p { font-size: 14px; }

/* 遮罩（移动端侧边栏） */
.mask {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(7, 30, 54, .45);
  z-index: 140;
}
.mask.show { display: block; }

/* ==========================================================================
   响应式
   ========================================================================== */
@media (max-width: 1200px) {
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .col-2, .col-2-even { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main { margin-left: 0; }
  .menu-toggle { display: block; }
  .search-box input { width: 110px; }
  .search-box input:focus { width: 150px; }
  .user-chip .name, .user-chip .role { display: none; }
  .content { padding: 16px; }
  .stat-grid { grid-template-columns: 1fr; }
  .header { padding: 0 14px; }
  table.data { font-size: 12.5px; }
  table.data th, table.data td { padding: 9px 10px; }
}
