:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-soft: #f9fbfd;
  --line: #dbe3ec;
  --line-strong: #bdcad8;
  --text: #182433;
  --muted: #66758a;
  --accent: #0f766e;
  --accent-strong: #0b5f59;
  --warning: #a15c00;
  --danger-bg: #fff8eb;
  --shadow: 0 12px 30px rgba(31, 45, 61, 0.08);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}

h1, h2, p { margin: 0; }

h1 {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0;
}

.topbar p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.button {
  height: 36px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-weight: 650;
  font-size: 13px;
  background: var(--surface);
  color: var(--text);
}

.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

.button.primary:hover { background: var(--accent-strong); }
.button.secondary:hover { border-color: #8ea0b3; background: #f7fafc; }

.layout {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 290px;
  gap: 16px;
  padding: 16px;
  flex: 1;
}

.side, .detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

.panel, .workbench {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.panel {
  padding: 16px;
}

.panel h2 {
  font-size: 14px;
  font-weight: 750;
  margin-bottom: 12px;
}

.rules {
  margin: 0;
}

.rules dt {
  font-size: 12px;
  font-weight: 750;
  color: var(--text);
  margin-top: 12px;
}

.rules dt:first-child { margin-top: 0; }

.rules dd {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.55;
  font-size: 12px;
}

.workbench {
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.summary {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 1px;
  background: var(--line);
  border-bottom: 1px solid var(--line);
}

.metric {
  background: var(--surface-soft);
  padding: 14px 16px;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 6px;
}

.metric strong {
  font-size: 18px;
  letter-spacing: 0;
}

.tabs {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.tab {
  height: 30px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  padding: 0 10px;
  font-weight: 650;
  cursor: pointer;
}

.tab.active {
  color: var(--accent-strong);
  border-color: #a9d5cf;
  background: #ecf8f6;
}

.tableWrap {
  overflow: auto;
  height: calc(100vh - 196px);
}

table {
  width: 100%;
  min-width: 1180px;
  border-collapse: separate;
  border-spacing: 0;
}

th, td {
  height: 36px;
  border-bottom: 1px solid var(--line);
  border-right: 1px solid #edf1f5;
  padding: 0 9px;
  white-space: nowrap;
  text-align: left;
  background: #fff;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #f2f6fa;
  color: #405066;
  font-size: 12px;
  font-weight: 750;
}

td.number, th.number { text-align: right; }

tr:hover td { background: #f8fbfd; }
tr.selected td { background: #eaf7f5; }

input.cell {
  width: 96px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 0 7px;
  font: inherit;
  text-align: right;
  background: transparent;
}

input.cell:hover, input.cell:focus {
  border-color: #98b9b4;
  background: #fff;
  outline: none;
}

.warnings {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
}

.warning {
  background: var(--danger-bg);
  color: var(--warning);
  border: 1px solid #f0d7aa;
  border-radius: 6px;
  padding: 9px 10px;
  font-size: 12px;
  line-height: 1.45;
}

.empty {
  color: var(--muted);
  font-size: 13px;
}

.employeeDetail {
  display: grid;
  gap: 8px;
}

.detailRow {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid #edf1f5;
  padding-bottom: 8px;
  font-size: 13px;
}

.detailRow span:first-child { color: var(--muted); }
.detailRow span:last-child { font-weight: 700; text-align: right; }

.log {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  max-height: 180px;
  overflow: auto;
}

@media (max-width: 1180px) {
  .layout {
    grid-template-columns: 220px minmax(0, 1fr);
  }
  .detail {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 760px) {
  .topbar {
    height: auto;
    gap: 12px;
    align-items: flex-start;
    flex-direction: column;
    padding: 14px;
  }
  .actions {
    width: 100%;
    flex-wrap: wrap;
  }
  .button { flex: 1; min-width: 108px; }
  .layout {
    grid-template-columns: 1fr;
    padding: 10px;
  }
  .summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .detail {
    display: flex;
  }
  .tableWrap {
    height: 58vh;
  }
}
