/* =====================================================================
   LDP - SAP Fiori 风格样式
   ===================================================================== */
:root {
  --brand: #0a6ed1;
  --brand-dark: #085caf;
  --brand-light: #ebf5fe;
  --shell: #354a5f;
  --shell-hover: #283848;
  --bg: #f5f6f7;
  --surface: #ffffff;
  --border: #d9d9d9;
  --border-light: #e5e5e5;
  --text: #32363a;
  --text-sub: #6a6d70;
  --ok: #107e3e;
  --warn: #e9730c;
  --err: #bb0000;
  --info: #0a6ed1;
  --radius: 6px;
  --shadow: 0 1px 4px rgba(0,0,0,.08), 0 0 2px rgba(0,0,0,.06);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "72", "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------------- 登录页 ---------------- */
.login-view {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #354a5f 0%, #0a6ed1 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  background: #fff; width: 380px; border-radius: 10px;
  box-shadow: 0 12px 40px rgba(0,0,0,.3); padding: 38px 36px 30px;
}
.login-brand { text-align: center; margin-bottom: 26px; }
.login-logo {
  font-size: 40px; font-weight: 800; color: var(--brand); letter-spacing: 3px;
}
.login-sub { font-size: 15px; color: var(--text); margin-top: 4px; font-weight: 600; }
.login-desc { font-size: 12px; color: var(--text-sub); margin-top: 8px; }
.login-form .fld { display: block; margin-bottom: 16px; }
.fld > span { display: block; font-size: 13px; color: var(--text-sub); margin-bottom: 5px; }
.login-form input {
  width: 100%; height: 38px; padding: 0 12px; font-size: 14px;
  border: 1px solid var(--border); border-radius: var(--radius); outline: none;
}
.login-form input:focus { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-light); }
.login-error { color: var(--err); font-size: 13px; min-height: 18px; margin-bottom: 6px; }
.login-tip { font-size: 11px; color: var(--text-sub); text-align: center; margin-top: 14px; line-height: 1.6; }

/* ---------------- 按钮 ---------------- */
.btn {
  height: 32px; padding: 0 16px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border); background: #fff; color: var(--brand);
  border-radius: var(--radius); transition: .12s; white-space: nowrap;
}
.btn:hover { background: var(--brand-light); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-danger { color: var(--err); border-color: #f0b9b9; }
.btn-danger:hover { background: #fce8e8; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--brand-light); }
.btn-block { width: 100%; height: 38px; font-size: 14px; margin-top: 6px; }
.btn-sm { height: 26px; padding: 0 10px; font-size: 12px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------------- 顶栏 ---------------- */
.app-view { display: flex; flex-direction: column; height: 100vh; }
.shellbar {
  height: 44px; background: var(--shell); color: #fff;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 12px; flex-shrink: 0; z-index: 50;
}
.shellbar-left, .shellbar-right { display: flex; align-items: center; gap: 10px; }
.shellbar-burger {
  background: transparent; border: none; color: #fff; font-size: 20px;
  cursor: pointer; width: 32px; height: 32px; border-radius: 4px;
}
.shellbar-burger:hover { background: var(--shell-hover); }
.shellbar-logo { font-weight: 800; font-size: 16px; letter-spacing: 1px; }
.shellbar-title { font-size: 14px; opacity: .85; }
.shellbar-engine {
  font-size: 11px; background: rgba(255,255,255,.15); padding: 3px 8px;
  border-radius: 10px;
}
.shellbar-user { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 4px 8px; border-radius: 4px; position: relative; }
.shellbar-user:hover { background: var(--shell-hover); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%; background: var(--brand);
  display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700;
}
.user-name { font-size: 13px; }
.user-menu {
  position: absolute; top: 46px; right: 12px; width: 220px; background: #fff;
  color: var(--text); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0,0,0,.25);
  display: none; overflow: hidden; z-index: 60;
}
.user-menu.show { display: block; }
.user-menu-head { padding: 14px 16px; background: var(--bg); border-bottom: 1px solid var(--border-light); }
.user-menu-name { font-weight: 700; }
.user-menu-role { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.user-menu-item { display: block; padding: 10px 16px; color: var(--text); font-size: 13px; }
.user-menu-item:hover { background: var(--brand-light); text-decoration: none; }

/* ---------------- 布局 ---------------- */
.app-body { display: flex; flex: 1; overflow: hidden; }
.sidenav {
  width: 244px; background: #fff; border-right: 1px solid var(--border-light);
  overflow-y: auto; flex-shrink: 0; transition: margin-left .2s;
}
.sidenav.collapsed { margin-left: -244px; }
.nav-group-title {
  font-size: 11px; text-transform: uppercase; color: var(--text-sub);
  padding: 14px 16px 6px; letter-spacing: .5px; font-weight: 700;
}
.nav-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 16px;
  font-size: 13px; color: var(--text); cursor: pointer; border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--bg); text-decoration: none; }
.nav-item.active { background: var(--brand-light); border-left-color: var(--brand); color: var(--brand); font-weight: 600; }
.nav-ico { width: 18px; text-align: center; opacity: .8; }
.content { flex: 1; overflow-y: auto; padding: 20px 24px; }

/* ---------------- 页面标题 ---------------- */
.page-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  margin-bottom: 16px; gap: 12px; flex-wrap: wrap;
}
.page-title { font-size: 20px; font-weight: 700; }
.page-sub { font-size: 13px; color: var(--text-sub); margin-top: 3px; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.crumbs { font-size: 12px; color: var(--text-sub); margin-bottom: 8px; }
.crumbs a { color: var(--text-sub); }

/* ---------------- 卡片 ---------------- */
.card {
  background: var(--surface); border: 1px solid var(--border-light);
  border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 16px;
}
.card-head {
  padding: 12px 16px; border-bottom: 1px solid var(--border-light);
  font-weight: 700; font-size: 14px; display: flex; justify-content: space-between; align-items: center;
}
.card-body { padding: 16px; }
.card-body.nopad { padding: 0; }

/* ---------------- 工具条 ---------------- */
.toolbar {
  display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap;
}
.toolbar input, .toolbar select {
  height: 32px; padding: 0 10px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13px; outline: none;
}
.toolbar input:focus, .toolbar select:focus { border-color: var(--brand); }
.toolbar .spacer { flex: 1; }
.search-input { min-width: 200px; }

/* ---------------- 表格 ---------------- */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
table.tbl th {
  text-align: left; padding: 10px 12px; background: #fafafa;
  border-bottom: 1px solid var(--border); color: var(--text-sub);
  font-weight: 700; white-space: nowrap;
}
table.tbl td {
  padding: 9px 12px; border-bottom: 1px solid var(--border-light); white-space: nowrap;
}
table.tbl tr:hover td { background: #fafcff; }
table.tbl td.wrap { white-space: normal; max-width: 320px; }
.tbl-empty { padding: 40px; text-align: center; color: var(--text-sub); }
.row-actions { display: flex; gap: 4px; }

/* ---------------- 分页 ---------------- */
.pager { display: flex; align-items: center; gap: 8px; padding: 12px; justify-content: flex-end; font-size: 13px; }
.pager button {
  height: 28px; min-width: 28px; border: 1px solid var(--border); background: #fff;
  border-radius: 4px; cursor: pointer;
}
.pager button:disabled { opacity: .4; cursor: not-allowed; }

/* ---------------- 徽标/状态 ---------------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 11px; font-size: 11px;
  font-weight: 600; line-height: 18px;
}
.badge-grey { background: #eaecee; color: #5a5d60; }
.badge-blue { background: #d3e9fd; color: #0a6ed1; }
.badge-green { background: #e0f3e6; color: #107e3e; }
.badge-orange { background: #fcead2; color: #b45309; }
.badge-red { background: #fbe0e0; color: #bb0000; }

/* ---------------- 表单 / 弹窗 ---------------- */
.modal-host {
  position: fixed; inset: 0; background: rgba(0,0,0,.45);
  display: flex; align-items: flex-start; justify-content: center; z-index: 200; padding: 40px 16px;
  overflow-y: auto;
}
.modal {
  background: #fff; border-radius: 8px; width: 560px; max-width: 100%;
  box-shadow: 0 16px 48px rgba(0,0,0,.35);
}
.modal.wide { width: 820px; }
.modal-head {
  padding: 14px 18px; border-bottom: 1px solid var(--border-light);
  font-weight: 700; font-size: 15px; display: flex; justify-content: space-between; align-items: center;
}
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: var(--text-sub); }
.modal-body { padding: 18px; max-height: 64vh; overflow-y: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--border-light); display: flex; justify-content: flex-end; gap: 8px; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.form-field { display: flex; flex-direction: column; }
.form-field.full { grid-column: 1 / -1; }
.form-field label { font-size: 12px; color: var(--text-sub); margin-bottom: 4px; }
.form-field label .req { color: var(--err); }
.form-field input, .form-field select, .form-field textarea {
  height: 34px; padding: 0 10px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 13px; outline: none; font-family: inherit;
}
.form-field textarea { height: auto; min-height: 90px; padding: 8px 10px; resize: vertical; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--brand); }
.form-field .hint { font-size: 11px; color: var(--text-sub); margin-top: 3px; }
.code-area { font-family: Consolas, "Courier New", monospace; font-size: 12px; }

/* ---------------- Toast ---------------- */
.toast-host { position: fixed; top: 56px; right: 18px; z-index: 300; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: #fff; border-left: 4px solid var(--info); border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0,0,0,.22); padding: 11px 16px; font-size: 13px;
  min-width: 240px; max-width: 380px; animation: slidein .2s;
}
.toast.ok { border-left-color: var(--ok); }
.toast.err { border-left-color: var(--err); }
.toast.warn { border-left-color: var(--warn); }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------------- 仪表盘 ---------------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.tile {
  background: var(--surface); border: 1px solid var(--border-light); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; cursor: pointer; transition: .12s;
}
.tile:hover { box-shadow: 0 4px 14px rgba(0,0,0,.14); transform: translateY(-1px); }
.tile-label { font-size: 12px; color: var(--text-sub); }
.tile-value { font-size: 30px; font-weight: 700; margin-top: 6px; }
.tile-foot { font-size: 11px; color: var(--text-sub); margin-top: 6px; }
.tile.accent { background: var(--brand); color: #fff; }
.tile.accent .tile-label, .tile.accent .tile-foot { color: rgba(255,255,255,.85); }

.stat-row { display: flex; gap: 14px; flex-wrap: wrap; }
.stat-row .card { flex: 1; min-width: 280px; }
.kv { display: flex; justify-content: space-between; padding: 7px 0; border-bottom: 1px dashed var(--border-light); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-sub); }
.kv .v { font-weight: 600; }

.bar-row { display: flex; align-items: center; gap: 10px; margin: 7px 0; font-size: 12px; }
.bar-row .bar-label { width: 130px; color: var(--text-sub); }
.bar-track { flex: 1; height: 14px; background: var(--bg); border-radius: 7px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--brand); border-radius: 7px; }
.bar-row .bar-num { width: 40px; text-align: right; font-weight: 600; }

/* ---------------- 详情 ---------------- */
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px 20px; }
.detail-item .dl { font-size: 11px; color: var(--text-sub); }
.detail-item .dv { font-size: 13px; font-weight: 600; margin-top: 2px; word-break: break-all; }
pre.json {
  background: #1e2a38; color: #cfe3f7; padding: 14px; border-radius: var(--radius);
  font-size: 12px; overflow: auto; max-height: 420px; line-height: 1.5;
}
.tree-node { padding: 4px 0 4px 18px; border-left: 1px dashed var(--border); font-size: 13px; }
.empty-hint { color: var(--text-sub); padding: 24px; text-align: center; }

.loading { padding: 40px; text-align: center; color: var(--text-sub); }
.spinner {
  width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--brand);
  border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 10px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 流程时间线 */
.timeline { list-style: none; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--border); }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before {
  content: ''; position: absolute; left: -7px; top: 2px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--brand); border: 2px solid #fff;
}
.timeline .tl-status { font-weight: 700; font-size: 13px; }
.timeline .tl-meta { font-size: 11px; color: var(--text-sub); margin-top: 2px; }

@media (max-width: 720px) {
  .form-grid { grid-template-columns: 1fr; }
  .sidenav { position: absolute; height: 100%; z-index: 40; box-shadow: 4px 0 16px rgba(0,0,0,.15); }
  .shellbar-title { display: none; }
}
