:root {
  --bg: #f4f5f7;
  --side: #1b2430;
  --side-2: #151c26;
  --text: #1c2330;
  --muted: #667085;
  --line: #e4e7ec;
  --card: #ffffff;
  --accent: #1f4e79;
  --accent-2: #2b6ca3;
  --warn-bg: #fff7e6;
  --warn: #8a5a00;
  --danger-bg: #fdecea;
  --danger: #8b1e1e;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
  --radius: 8px;
  --font: "Source Han Sans SC", "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Source Sans 3", sans-serif;
  --mono: "IBM Plex Mono", "Source Code Pro", ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.55;
}
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 6px; font-weight: 650; letter-spacing: 0.01em; }
h2 { font-size: 16px; margin: 0 0 10px; font-weight: 650; }
.muted { color: var(--muted); }
.small, .tiny { color: var(--muted); }
.tiny { font-size: 12px; line-height: 1.4; }
.hint, .note { color: var(--muted); font-size: 13px; margin: 8px 0 16px; }
.note { background: #eef3f8; border: 1px solid #d7e2ee; padding: 10px 12px; border-radius: var(--radius); color: #31445a; }
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px;
  flex: 0 0 220px;
  background: var(--side);
  color: #e8edf3;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
}
.brand { padding: 22px 18px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.brand-kicker { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: #9aa7b5; margin-bottom: 4px; }
.brand-title { font-size: 16px; font-weight: 650; }
.sidebar nav { padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; }
.sidebar nav a {
  color: #d5dee8;
  padding: 8px 10px;
  border-radius: 6px;
  text-decoration: none;
}
.sidebar nav a:hover { background: rgba(255,255,255,0.06); }
.sidebar nav a.active { background: #2a3b50; color: #fff; font-weight: 600; }
.sidebar-foot { margin-top: auto; padding: 16px 18px 20px; color: #9aa7b5; font-size: 12px; }
.sidebar-foot p { margin: 0 0 10px; }
button.linkish, .linkish {
  background: none; border: 0; color: #c9d6e3; cursor: pointer; padding: 0; font: inherit;
}
button.linkish:hover { text-decoration: underline; }
.content { flex: 1; padding: 28px 32px 48px; max-width: 1280px; }
.page-head { margin-bottom: 18px; }
.page-head .lead-id { font-size: 18px; font-family: var(--mono); margin: 0; }
.back { display: inline-block; margin-bottom: 8px; font-size: 13px; }
.tag {
  display: inline-block;
  margin-left: 8px;
  font-size: 12px;
  font-family: var(--font);
  background: #eef3f8;
  color: #3b4d61;
  border-radius: 999px;
  padding: 1px 8px;
  vertical-align: middle;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 8px;
  box-shadow: var(--shadow);
  align-items: end;
}
.filters label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); min-width: 140px; }
.filters label.grow { flex: 1; min-width: 220px; }
.filters label.check { flex-direction: row; align-items: center; gap: 8px; min-width: auto; color: var(--text); font-size: 13px; padding-bottom: 4px; }
.filters input[type="text"],
.filters input[type="search"],
.filters input[type="date"],
.filters select,
.login-card input {
  border: 1px solid #cfd6de;
  border-radius: 6px;
  padding: 6px 8px;
  font: inherit;
  color: var(--text);
  background: #fff;
  width: 100%;
}
.filter-actions { display: flex; gap: 8px; align-items: center; padding-bottom: 1px; }
button, .btn-light {
  border-radius: 6px;
  padding: 7px 14px;
  font: inherit;
  cursor: pointer;
  border: 1px solid transparent;
}
button[type="submit"], .login-card button {
  background: var(--accent);
  color: #fff;
}
button[type="submit"]:hover, .login-card button:hover { background: #173c5e; }
.btn-light {
  background: #fff;
  border-color: #cfd6de;
  color: var(--text);
  text-decoration: none;
  display: inline-block;
}
.btn-light:hover { background: #f7f8fa; text-decoration: none; }
.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin: 16px 0; }
.kpi-row.compact { grid-template-columns: repeat(5, 1fr); }
.kpi, .type-card, .block, .table-wrap, .login-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.kpi { padding: 14px 16px; }
.kpi-label { color: var(--muted); font-size: 12px; }
.kpi-value { font-size: 22px; font-weight: 650; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.kpi-sub { color: var(--muted); font-size: 12px; }
.card-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin: 8px 0 20px; }
.type-card { padding: 16px 18px; color: inherit; text-decoration: none; display: block; }
.type-card:hover { border-color: #b9c8d8; text-decoration: none; }
.type-name { color: var(--muted); font-size: 13px; }
.type-count { font-size: 28px; font-weight: 650; margin: 4px 0 10px; }
.type-count span { font-size: 13px; color: var(--muted); font-weight: 500; }
.type-card dl { margin: 0; display: grid; gap: 6px; }
.type-card dl div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.type-card dt { color: var(--muted); }
.type-card dd { margin: 0; font-variant-numeric: tabular-nums; }
.block { padding: 16px 18px; margin: 16px 0; }
.fields { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 18px; margin: 0; }
.fields div { min-width: 0; }
.fields dt { color: var(--muted); font-size: 12px; }
.fields dd { margin: 2px 0 0; word-break: break-word; font-variant-numeric: tabular-nums; }
.fields .is-payment dd { font-weight: 600; }
.table-wrap { overflow: auto; margin: 8px 0; }
table { width: 100%; border-collapse: collapse; background: var(--card); }
th, td { border-bottom: 1px solid var(--line); padding: 8px 10px; text-align: left; vertical-align: top; }
th { font-size: 12px; color: var(--muted); font-weight: 600; background: #f8fafc; position: sticky; top: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.dense td, table.dense th { padding: 6px 8px; font-size: 13px; }
tbody tr:hover { background: #f7fafc; }
.row-flag { background: #fffaf0; }
.empty { color: var(--muted); text-align: center; }
.alert { border-radius: var(--radius); padding: 10px 12px; margin: 0 0 12px; }
.alert.warn { background: var(--warn-bg); color: var(--warn); border: 1px solid #f0d7a3; }
.alert.danger { background: var(--danger-bg); color: var(--danger); border: 1px solid #f2c4c1; }
.warn-text { color: var(--warn); }
.pager { display: flex; gap: 12px; align-items: center; margin-top: 12px; }
.plain { margin: 0; padding-left: 18px; color: #3b4d61; }
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #eef1f5;
}
.login-card { width: 360px; padding: 28px 28px 24px; }
.login-card h1 { margin: 4px 0 8px; }
.login-card label { display: block; margin: 16px 0 6px; color: var(--muted); font-size: 13px; }
.login-card button { width: 100%; margin-top: 18px; padding: 9px 14px; }
.flash { background: #eef3f8; border: 1px solid #d7e2ee; padding: 8px 10px; border-radius: 6px; margin-bottom: 12px; }
@media (max-width: 1100px) {
  .kpi-row, .kpi-row.compact, .card-grid, .fields { grid-template-columns: 1fr 1fr; }
  .content { padding: 20px; }
}
@media (max-width: 800px) {
  .shell { flex-direction: column; }
  .sidebar { width: 100%; flex: none; position: static; min-height: 0; }
  .sidebar nav { flex-direction: row; flex-wrap: wrap; }
  .kpi-row, .kpi-row.compact, .card-grid, .fields { grid-template-columns: 1fr; }
}

th.sortable a {
  color: inherit;
  text-decoration: none;
  white-space: nowrap;
  display: inline-block;
}
th.sortable a:hover { color: var(--text); }
th.sorted a { color: var(--text); }
th.sortable .sort-ind { margin-left: 4px; font-size: 11px; }
th.num.sortable a { display: block; text-align: right; }

/* Inquiry module */
.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}
.subnav a {
  display: inline-block;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  font-size: 13px;
  text-decoration: none;
}
.subnav a:hover { background: #f7f8fa; text-decoration: none; }
.subnav a.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.tag-pending { background: var(--warn-bg); color: var(--warn); }
.tag-empty { background: #eef3f8; color: #3b4d61; }
.tag-second { background: #eef0f8; color: #3c3f6e; }
h3.subhead { font-size: 14px; margin: 16px 0 8px; font-weight: 650; }
.inquiry-overview { margin-top: 28px; }
.inquiry-overview .kpi-sub { min-height: 2.4em; }
