:root {
  --green: #67c23a;
  --green-dark: #3aa92d;
  --blue: #409eff;
  --orange: #e6a23c;
  --red: #f56c6c;
  --sidebar: #304156;
  --sidebar-deep: #263445;
  --active: #1f2d3d;
  --bg: #f0f2f5;
  --line: #ebeef5;
  --text: #303133;
  --muted: #909399;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  font: 14px/1.5 "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 232px 1fr; }
.app-shell.collapsed { grid-template-columns: 58px 1fr; }
.app-shell.collapsed .brand-title,
.app-shell.collapsed .brand-subtitle,
.app-shell.collapsed .menu-search,
.app-shell.collapsed .menu-label,
.app-shell.collapsed .menu-count,
.app-shell.collapsed .menu-arrow,
.app-shell.collapsed .menu-group-title span:not(.menu-icon) { display: none; }

.sidebar { color: #bfcbd9; background: var(--sidebar); min-height: 100vh; overflow: hidden; }
.brand {
  height: 56px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 14px;
  color: #fff;
  background: #2b3b4f;
}
.brand-mark {
  width: 32px;
  height: 30px;
  border-radius: 4px;
  background: var(--green);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 700;
}
.brand-title { font-weight: 700; line-height: 18px; }
.brand-subtitle { color: #8aa4bd; font-size: 11px; }
.menu-search { padding: 10px; background: var(--sidebar-deep); }
.menu-search input {
  width: 100%;
  height: 30px;
  color: #d7dde5;
  background: #1f2d3d;
  border: 1px solid #3b4c60;
  border-radius: 4px;
  padding: 0 9px;
  outline: none;
}
.menu-tree { height: calc(100vh - 106px); overflow-y: auto; padding-bottom: 18px; }
.menu-group-title, .menu-item {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  color: #bfcbd9;
  border: 0;
  background: transparent;
  width: 100%;
  text-align: left;
}
.menu-group-title:hover, .menu-item:hover { color: #fff; background: var(--sidebar-deep); }
.menu-group.open > .menu-group-title { color: #fff; }
.menu-icon { width: 16px; text-align: center; color: #93a4b7; flex: none; }
.menu-arrow { margin-left: auto; color: #7b8a9b; }
.menu-count {
  margin-left: auto;
  min-width: 24px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  background: #1f2d3d;
  color: #8aa4bd;
  font-size: 12px;
  text-align: center;
}
.menu-children { display: none; background: #1f2d3d; }
.menu-group.open > .menu-children { display: block; }
.submenu-title {
  height: 34px;
  padding: 0 12px 0 30px;
  display: flex;
  align-items: center;
  color: #8aa4bd;
  font-size: 12px;
}
.menu-item { padding-left: 42px; font-size: 13px; line-height: 18px; }
.menu-item.active {
  color: var(--green);
  background: var(--active);
  border-right: 3px solid var(--green);
}

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: 50px;
  background: #fff;
  border-bottom: 1px solid #e6e8ee;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
}
.top-left, .top-actions { display: flex; align-items: center; gap: 12px; }
.system-title { font-weight: 700; color: #1f2d3d; }
.icon-btn {
  width: 30px;
  height: 30px;
  border: 1px solid #dcdfe6;
  background: #fff;
  color: #606266;
  border-radius: 3px;
}
.text-btn { border: 0; background: transparent; color: #606266; padding: 0; }
.text-btn:hover { color: var(--green); }
.user { padding-left: 12px; border-left: 1px solid #ebeef5; color: #606266; }
.tagbar {
  min-height: 34px;
  padding: 4px 12px;
  display: flex;
  gap: 6px;
  align-items: center;
  background: #fff;
  border-bottom: 1px solid #e6e8ee;
  overflow-x: auto;
}
.tag {
  height: 24px;
  padding: 0 10px;
  border: 1px solid #d8dce5;
  background: #fff;
  color: #606266;
  border-radius: 2px;
  white-space: nowrap;
}
.tag.active { color: var(--green); border-color: var(--green); }
.content { padding: 14px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; margin-bottom: 10px; }
.breadcrumb { color: #909399; font-size: 12px; margin-bottom: 3px; }
h1 { margin: 0; font-size: 18px; font-weight: 700; }
.page-summary { color: #909399; font-size: 12px; }

.query-card, .table-card, .process-card, .metric-card, .kanban-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 2px;
}
.query-card { padding: 16px 16px 4px; margin-bottom: 10px; }
.query-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(190px, 1fr));
  column-gap: 16px;
  row-gap: 12px;
}
.form-item { display: grid; grid-template-columns: 92px 1fr; align-items: center; gap: 8px; }
.form-item label { color: #606266; text-align: right; }
.el-input, .el-select {
  height: 32px;
  border: 1px solid #dcdfe6;
  border-radius: 4px;
  padding: 0 10px;
  color: #606266;
  background: #fff;
  width: 100%;
}
.query-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 12px 0; }
.btn {
  min-width: 68px;
  height: 32px;
  border-radius: 4px;
  border: 1px solid #dcdfe6;
  color: #606266;
  background: #fff;
}
.btn.primary { background: var(--green); border-color: var(--green); color: #fff; }
.btn.primary:hover { background: var(--green-dark); }
.btn.link { min-width: auto; border: 0; color: var(--green); background: transparent; }
.btn.danger { color: #fff; border-color: var(--red); background: var(--red); }
.btn.mini {
  min-width: 42px;
  height: 26px;
  padding: 0 8px;
  font-size: 12px;
  color: var(--green);
  border-color: #c2e7b0;
  background: #f0f9eb;
}
.btn.blue { color: #409eff; border-color: #b3d8ff; background: #ecf5ff; }

.home-panel { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.metric-card { padding: 16px; }
.metric-name { color: #909399; }
.metric-value { font-size: 28px; font-weight: 700; margin-top: 8px; }
.metric-foot { color: #909399; font-size: 12px; margin-top: 6px; }
.kanban-card { grid-column: span 2; padding: 14px; min-height: 230px; }
.mini-bars { display: grid; gap: 10px; margin-top: 14px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 48px; gap: 10px; align-items: center; color: #606266; }
.bar { height: 8px; border-radius: 4px; background: #ebeef5; overflow: hidden; }
.bar span { display: block; height: 100%; background: var(--green); }

.process-card { margin-bottom: 10px; padding: 14px; }
.process-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.process-title strong { font-size: 15px; }
.steps { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.step {
  border: 1px solid #e6e8ee;
  background: #fafafa;
  padding: 10px;
  min-height: 76px;
  border-radius: 2px;
}
.step strong { display: block; color: #303133; margin-bottom: 4px; }
.step span { color: #909399; font-size: 12px; }
.step.done { border-color: #c2e7b0; background: #f0f9eb; }
.step.warn { border-color: #faecd8; background: #fdf6ec; }

.table-card { overflow: hidden; }
.toolbar {
  height: 46px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
}
.toolbar-left, .toolbar-right { display: flex; gap: 8px; align-items: center; }
.hint { color: #909399; font-size: 12px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 1180px; }
th, td {
  height: 42px;
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: center;
  white-space: nowrap;
}
th { background: #f5f7fa; color: #606266; font-weight: 700; }
tr:hover td { background: #f5f7fa; }
.ops { display: flex; justify-content: center; gap: 6px; }
.status {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border-radius: 2px;
  font-size: 12px;
  border: 1px solid transparent;
}
.status.ok { color: #529b2e; background: #f0f9eb; border-color: #e1f3d8; }
.status.wait { color: #b88230; background: #fdf6ec; border-color: #faecd8; }
.status.info { color: #409eff; background: #ecf5ff; border-color: #d9ecff; }
.status.stop { color: #c45656; background: #fef0f0; border-color: #fde2e2; }
.pager { height: 46px; display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 0 12px; color: #606266; }
.page-no { min-width: 28px; height: 28px; border-radius: 3px; display: grid; place-items: center; background: var(--green); color: #fff; }

.drawer-mask { position: fixed; inset: 0; background: rgba(0,0,0,.22); z-index: 10; }
.drawer {
  position: fixed;
  right: 0;
  top: 0;
  z-index: 11;
  width: 560px;
  height: 100vh;
  background: #fff;
  box-shadow: -4px 0 14px rgba(0,0,0,.12);
  display: flex;
  flex-direction: column;
}
.drawer-head { height: 62px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.drawer-title { font-size: 16px; font-weight: 700; }
.drawer-sub { color: #909399; font-size: 12px; margin-top: 2px; }
.drawer-body { padding: 16px; overflow: auto; }
.detail-grid { display: grid; grid-template-columns: 132px 1fr; row-gap: 12px; }
.detail-grid dt { color: #909399; text-align: right; padding-right: 12px; }
.detail-grid dd { margin: 0; color: #303133; min-width: 0; overflow-wrap: anywhere; }
.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  background: #f0f9eb;
  border: 1px solid #e1f3d8;
  color: #529b2e;
  padding: 9px 16px;
  border-radius: 3px;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}

@media (max-width: 1280px) {
  .query-grid { grid-template-columns: repeat(2, 1fr); }
  .home-panel { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 920px) {
  .app-shell { grid-template-columns: 58px 1fr; }
  .brand-title, .brand-subtitle, .menu-search, .menu-label, .menu-count, .menu-arrow, .menu-group-title span:not(.menu-icon) { display: none; }
  .query-grid, .home-panel { grid-template-columns: 1fr; }
  .kanban-card { grid-column: auto; }
  .drawer { width: min(92vw, 560px); }
}
