/* ============================================================
   705app · 界面样式
   风格取向：国产工程/政企内部系统 —— 藏青主色、密排表格、小圆角、
   弱阴影、粗边框分隔，不使用大圆角/渐变大色块等模板化观感。
   ============================================================ */

:root {
  --navy:      #14315c;
  --navy-700:  #0f2646;
  --navy-600:  #1b4a86;
  --navy-050:  #eaeff7;
  --red:       #c1272d;
  --bg:        #eef1f6;
  --panel:     #ffffff;
  --line:      #d9e0ea;
  --line-soft: #e8edf4;
  --text:      #1e2a3a;
  --muted:     #7183a0;
  --ok:        #1a7f4b;
  --warn:      #b26a00;
  --radius:    3px;
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
          "Microsoft YaHei", "Source Han Sans SC", "Noto Sans CJK SC", "WenQuanYi Micro Hei", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--navy-600); }

.boot {
  padding: 80px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ---------------- 按钮 ---------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 16px;
  font-family: inherit;
  font-size: 13px;
  line-height: 1;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, border-color .12s, color .12s;
}
.btn:hover { border-color: #bcc9db; background: #fafbfd; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--navy-600); border-color: var(--navy-600); }
.btn.ghost { background: #fff; color: var(--navy); border-color: #c3d0e2; }
.btn.danger { background: #fff; color: var(--red); border-color: #e3b7b9; }
.btn.danger:hover:not(:disabled) { background: #fdf4f4; border-color: var(--red); }
.btn.sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn.block { width: 100%; height: 38px; font-size: 14px; letter-spacing: 2px; }

/* ---------------- 登录页 ---------------- */
.login-wrap { display: flex; min-height: 100vh; }

.login-art {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px;
  color: #e8eef8;
  background:
    repeating-linear-gradient(0deg, rgba(255,255,255,.035) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.035) 0 1px, transparent 1px 44px),
    linear-gradient(150deg, #0d2143 0%, var(--navy) 45%, #1d4a83 100%);
}
.art-inner { max-width: 460px; }
.art-badge {
  display: inline-block;
  padding: 6px 14px;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #fff;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: var(--radius);
}
.art-inner h1 { margin: 26px 0 10px; font-size: 30px; font-weight: 600; letter-spacing: 3px; }
.art-sub { margin: 0 0 30px; font-size: 14px; color: #a9bfdc; letter-spacing: 1px; }
.art-points { margin: 0; padding-left: 18px; font-size: 13px; line-height: 2.1; color: #b9cbe4; }
.art-points li::marker { color: var(--red); }

.login-panel {
  flex: 0 0 460px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  background: var(--panel);
  border-left: 4px solid var(--navy);
}
.login-card { width: 100%; max-width: 320px; }
.login-card h2 { margin: 0 0 6px; font-size: 20px; font-weight: 600; letter-spacing: 1px; }
.login-tip { margin: 0 0 26px; font-size: 12.5px; color: var(--muted); }
.login-error {
  margin: 0 0 12px;
  padding: 8px 10px;
  font-size: 12.5px;
  color: var(--red);
  background: #fdf4f4;
  border: 1px solid #e9c9ca;
  border-radius: var(--radius);
}
.login-foot { margin: 22px 0 0; font-size: 11.5px; color: #9aa9bf; text-align: center; }

.field { display: block; margin-bottom: 16px; }
.field span { display: block; margin-bottom: 6px; font-size: 12.5px; color: #46586f; }
.field input, .field select, .field textarea {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  font-family: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: #fcfdfe;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .12s, box-shadow .12s;
}
.field textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.6; }
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--navy-600);
  box-shadow: 0 0 0 2px rgba(27,74,134,.12);
}

/* ---------------- 主框架 ---------------- */
.layout { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 54px;
  padding: 0 20px;
  background: var(--navy);
  border-bottom: 3px solid var(--navy-600);
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  font-size: 12px; font-weight: 700; letter-spacing: .5px;
  color: #fff;
  border: 1px solid rgba(255,255,255,.35);
  border-radius: var(--radius);
}
.sysname { font-size: 16px; font-weight: 500; letter-spacing: 2px; color: #f0f5fc; }
.topbar-right { display: flex; align-items: center; gap: 14px; font-size: 12.5px; color: #cfdcee; }
.whoami { color: #fff; }
.role-chip {
  padding: 2px 8px;
  font-size: 11.5px;
  color: #cfe0f5;
  background: rgba(255,255,255,.1);
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 10px;
}
.topbar-right .link { color: #cfdcee; cursor: pointer; text-decoration: none; }
.topbar-right .link:hover { color: #fff; text-decoration: underline; }

.body { flex: 1; display: flex; min-height: 0; }

.sidebar {
  flex: 0 0 200px;
  padding: 16px 0;
  background: var(--navy-700);
}
.menu-title {
  padding: 0 18px 10px;
  font-size: 11px;
  letter-spacing: 2px;
  color: #6d84a6;
}
.menu-item {
  position: relative;
  display: block;
  padding: 11px 18px;
  font-size: 13.5px;
  color: #c3d2e6;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .12s, color .12s;
}
.menu-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.menu-item.active { color: #fff; background: rgba(255,255,255,.1); border-left-color: var(--red); }

.content { flex: 1; min-width: 0; padding: 20px 22px 40px; }

.page-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 16px; }
.page-title { margin: 0; font-size: 17px; font-weight: 600; letter-spacing: 1px; }
.page-sub { font-size: 12.5px; color: var(--muted); }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  border-bottom: 1px solid var(--line-soft);
}
.card-body { padding: 16px; }

/* ---------------- 概览 ---------------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; }
.stat {
  padding: 16px 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 3px solid var(--navy-600);
  border-radius: var(--radius);
}
.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-value { margin-top: 8px; font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: 1px; }
.stat-foot { margin-top: 6px; font-size: 12px; color: #93a2b8; }

/* ---------------- 工具条 ---------------- */
.toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.input, .select {
  height: 32px;
  padding: 0 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: #fcfdfe;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}
.input { width: 220px; }
.input:focus, .select:focus { border-color: var(--navy-600); }

/* ---------------- 表格 ---------------- */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  padding: 10px 12px;
  font-weight: 600;
  font-size: 12.5px;
  color: #40546e;
  text-align: left;
  white-space: nowrap;
  background: #f5f7fb;
  border-bottom: 1px solid var(--line);
}
.tbl td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.tbl tbody tr:hover { background: #f8fafd; }
.tbl .num { text-align: right; font-variant-numeric: tabular-nums; }
.tbl .ops { white-space: nowrap; }
.tbl .ops .link { margin-right: 10px; font-size: 12.5px; color: var(--navy-600); cursor: pointer; }
.tbl .ops .link.danger { color: var(--red); }
.tbl .ops .link:hover { text-decoration: underline; }
.empty { padding: 44px 0; text-align: center; color: var(--muted); font-size: 13px; }

.tag {
  display: inline-block;
  padding: 1px 8px;
  font-size: 12px;
  line-height: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: #54677f;
  background: #f5f7fb;
}
.tag-ok    { color: var(--ok);   border-color: #b7dcc6; background: #f1faf4; }
.tag-run   { color: #1b5fa8;     border-color: #bcd4ee; background: #f1f7fd; }
.tag-draft { color: #6b7c93;     border-color: #d9e0ea; background: #f5f7fb; }
.tag-off   { color: var(--red);  border-color: #e9c9ca; background: #fdf4f4; }

/* ---------------- 分页 ---------------- */
.pager { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--line-soft); font-size: 12.5px; color: var(--muted); }
.pager .spacer { flex: 1; }
.pager .pager-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  cursor: pointer;
  font-size: 12.5px;
}
.pager .pager-btn:disabled { opacity: .5; cursor: not-allowed; }
.pager .pager-btn:not(:disabled):hover { border-color: var(--navy-600); color: var(--navy-600); }

/* ---------------- 弹窗 ---------------- */
.modal-mask {
  position: fixed; inset: 0; z-index: 60;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 80px 16px 40px;
  background: rgba(15,26,44,.45);
  overflow-y: auto;
}
.modal {
  width: 520px; max-width: 100%;
  background: var(--panel);
  border: 1px solid var(--line);
  border-top: 3px solid var(--navy);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(15,26,44,.18);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  font-size: 14px; font-weight: 600;
  border-bottom: 1px solid var(--line-soft);
}
.modal-head .x {
  border: 0; background: transparent; font-size: 20px; line-height: 1;
  color: #97a5b9; cursor: pointer; padding: 0 2px;
}
.modal-head .x:hover { color: var(--red); }
.modal-body { padding: 18px 16px; }
.modal-foot {
  display: flex; justify-content: flex-end; gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line-soft);
  background: #fafbfd;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.confirm-text { margin: 0; font-size: 13.5px; line-height: 1.7; color: #3d4f66; }

/* ---------------- 轻提示 ---------------- */
.toasts {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  z-index: 80; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none;
}
.toast {
  min-width: 180px; max-width: 460px;
  padding: 9px 16px;
  font-size: 13px;
  color: #fff;
  background: #33455c;
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(15,26,44,.22);
}
.toast-ok    { background: var(--ok); }
.toast-error { background: var(--red); }

/* ---------------- 响应式 ---------------- */
@media (max-width: 900px) {
  .login-art { display: none; }
  .login-panel { flex: 1 1 auto; border-left: 0; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .sidebar { flex-basis: 150px; }
  .form-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   业务模块补充样式（配件库 / 配置单编辑器 / 兼容性面板）
   ============================================================ */

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono  { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; letter-spacing: .2px; }

/* 两栏布局：左主区 + 右侧汇总/校验 */
.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  gap: 16px;
  align-items: start;
}
.side-col { display: flex; flex-direction: column; gap: 16px; }

/* 槽位选件按钮组 */
.slot-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 0 12px;
}

/* 明细行内的小输入框 */
.input.tiny { width: 100%; padding: 4px 6px; text-align: right; }
.select.wide { width: 100%; }

/* 金额汇总 */
.sum-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.sum-row:last-child { border-bottom: 0; }
.sum-row.big {
  margin-top: 6px;
  padding-top: 12px;
  border-top: 2px solid var(--line);
  border-bottom: 0;
  font-size: 15px;
}
.sum-row.big b { color: var(--red); font-size: 19px; }
.sum-row b.ok { color: var(--ok); }

/* 兼容性检查面板 */
.compat-ok {
  margin: 0 0 8px;
  padding: 8px 10px;
  border: 1px solid var(--ok);
  border-left-width: 3px;
  background: #f1f8f3;
  color: var(--ok);
  border-radius: var(--radius);
  font-weight: 500;
}
.compat-item {
  margin-bottom: 8px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-left-width: 3px;
  border-radius: var(--radius);
  background: var(--panel);
}
.compat-item.bad  { border-left-color: var(--red);  background: #fdf3f3; }
.compat-item.bad b { color: var(--red); }
.compat-item.warn { border-left-color: var(--warn); background: #fdf8ef; }
.compat-item.warn b { color: var(--warn); }
.compat-item > div { margin-top: 3px; color: var(--muted); }

/* 卡片底部按钮组 */
.card-body.actions { display: flex; flex-direction: column; gap: 8px; padding-top: 0; }

@media (max-width: 1100px) {
  .two-col { grid-template-columns: 1fr; }
}

/* 卡片右上角按钮组（导出/导入/新增） */
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* 复选框行 */
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text); cursor: pointer; }
.check input { width: 15px; height: 15px; }

/* 导入结果区 */
.import-result { margin-top: 12px; }
.import-result p { margin: 0 0 8px; }
.import-result .compat-ok,
.import-result .compat-item { margin-bottom: 6px; }

/* ============================================================
   合同 / 发票 / 账目 / 往来单位 模块补充样式
   ============================================================ */

/* 页内标签切换 */
.tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 14px;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}
.tab {
  position: relative;
  padding: 9px 16px;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .15s, border-color .15s;
  user-select: none;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--navy-700); font-weight: 600; border-bottom-color: var(--navy-600); }
.tab b {
  display: inline-block;
  margin-left: 4px;
  padding: 0 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--muted);
  background: var(--navy-050);
  border-radius: 9px;
}
.tab.active b { color: var(--navy-700); }

/* KPI 卡组 */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.kpi-label { font-size: 12.5px; color: var(--muted); }
.kpi-val { font-size: 21px; line-height: 1.25; letter-spacing: -.3px; }
.kpi-val.ok { color: var(--ok); }
.kpi-val.danger { color: var(--red); }
.kpi-sub { font-size: 11.5px; color: var(--muted); }

/* 区块小标题 */
.block-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

/* 账龄分布（横向条） */
.age-list { display: flex; flex-direction: column; gap: 9px; }
.age-row { display: grid; grid-template-columns: 92px minmax(0, 1fr) 160px; align-items: center; gap: 10px; }
.age-label { font-size: 12.5px; color: var(--muted); text-align: right; }
.age-bar {
  height: 16px;
  background: var(--navy-050);
  border-radius: 8px;
  overflow: hidden;
}
.age-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--navy-600), var(--navy-700));
  border-radius: 8px;
  transition: width .3s;
}
.age-bar i.hot { background: linear-gradient(90deg, #d95f4a, var(--red)); }
.age-val { font-size: 12.5px; color: var(--text); font-variant-numeric: tabular-nums; }

/* 紧凑表格（汇总/核销用） */
.tbl.dense th, .tbl.dense td { padding: 7px 9px; font-size: 12.5px; }

/* 核销明细小标签 */
.alloc-chip {
  display: inline-block;
  margin: 0 5px 4px 0;
  padding: 1px 7px;
  font-size: 11.5px;
  color: var(--navy-700);
  background: var(--navy-050);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  white-space: nowrap;
}
.alloc-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 12.5px;
  color: var(--muted);
}
.alloc-head .spacer { flex: 1; }

/* 表格里的内联状态下拉 */
.select.tiny-sel {
  width: auto;
  padding: 3px 6px;
  font-size: 12.5px;
}

/* 表格里的危险色文本 */
.tbl td .danger, .danger { color: var(--red); }

/* 小号按钮 */
.btn.tiny { padding: 3px 9px; font-size: 12px; }

/* 表单文本域跟随输入框样式 */
textarea.input { resize: vertical; line-height: 1.55; font-family: inherit; }

@media (max-width: 900px) {
  .age-row { grid-template-columns: 76px minmax(0, 1fr) 120px; }
}
