:root {
  color-scheme: light;
  --bg: #f6f8fb;
  --panel: #ffffff;
  --text: #1b2430;
  --muted: #6b7280;
  --line: #d8dee9;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --accent: #b45309;
  --danger: #b91c1c;
  --soft: #eef7f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

a {
  color: var(--primary);
  text-decoration: none;
}

input,
select,
textarea,
button {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
  padding: 10px 11px;
}

textarea {
  resize: vertical;
}

button,
.button {
  display: inline-flex;
  width: auto;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  padding: 9px 14px;
}

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

button.primary:hover,
.button.primary:hover {
  background: var(--primary-dark);
}

label {
  display: grid;
  gap: 6px;
  color: #374151;
  font-weight: 600;
}

label small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.5;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: auto;
}

h1,
h2 {
  margin: 0;
  line-height: 1.2;
}

h1 {
  font-size: 26px;
}

h2 {
  margin-bottom: 14px;
  font-size: 18px;
}

p {
  margin: 6px 0 0;
}

small,
.muted {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 22px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 24px;
}

.brand-mark {
  display: inline-flex;
  width: 46px;
  height: 46px;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--soft);
  color: var(--primary);
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong {
  display: block;
  font-size: 15px;
}

nav {
  display: grid;
  gap: 6px;
}

nav a,
.logout {
  display: block;
  border-radius: 6px;
  color: #374151;
  padding: 10px 12px;
}

nav a.active,
nav a:hover {
  background: var(--soft);
  color: var(--primary);
  font-weight: 700;
}

.logout {
  position: absolute;
  right: 18px;
  bottom: 20px;
  left: 18px;
  border: 1px solid var(--line);
  text-align: center;
}

.main {
  margin-left: 248px;
  padding: 28px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.panel,
.metric {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.panel {
  margin-bottom: 18px;
  padding: 18px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric {
  padding: 16px;
}

.metric span,
.kv span {
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.grid {
  display: grid;
  gap: 18px;
}

.grid.two {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.form-grid.compact {
  margin-bottom: 16px;
}

.wide {
  grid-column: 1 / -1;
}

.actions {
  display: flex;
  justify-content: flex-end;
}

.mini-form,
.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.mini-form > *,
.filters > * {
  flex: 1 1 180px;
}

.mini-form button,
.filters button {
  flex: 0 0 auto;
}

.filters {
  margin-bottom: 14px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 11px 12px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f9fafb;
  color: #4b5563;
  font-size: 12px;
  font-weight: 700;
}

tr:last-child td {
  border-bottom: 0;
}

.strong {
  font-weight: 700;
}

.status,
.tag {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: var(--soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  padding: 3px 9px;
}

.tag {
  margin-top: 4px;
  background: #fff7ed;
  color: var(--accent);
}

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

.funnel-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfdff;
  padding: 9px 10px;
}

.detail-head {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.kv {
  display: grid;
  gap: 4px;
}

.kv strong {
  min-height: 22px;
  font-size: 15px;
}

.flash {
  margin-bottom: 14px;
  border: 1px solid #99f6e4;
  border-radius: 8px;
  background: #ecfdf5;
  color: #065f46;
  padding: 10px 12px;
}

.flash.danger {
  border-color: #fecaca;
  background: #fef2f2;
  color: var(--danger);
}

.login-page {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 14px 42px rgba(15, 23, 42, 0.10);
  display: grid;
  gap: 14px;
  padding: 24px;
}

.login-brand {
  margin-bottom: 2px;
}

.compliance-footer {
  margin-top: 26px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.compliance-footer a {
  color: var(--muted);
}

.login-page .compliance-footer {
  margin-top: 14px;
}

@media (max-width: 980px) {
  .sidebar {
    position: static;
    width: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .logout {
    position: static;
    margin-top: 10px;
  }

  nav {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .main {
    margin-left: 0;
    padding: 18px;
  }

  .metrics,
  .grid.two,
  .detail-head,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .page-head {
    display: grid;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 13px;
  }

  nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  h1 {
    font-size: 22px;
  }

  .main {
    padding: 14px;
  }

  .panel {
    padding: 14px;
  }

  .metric strong {
    font-size: 21px;
  }

  .mini-form > *,
  .filters > * {
    flex-basis: 100%;
  }
}
