:root {
  --bg: #f2f5f8;
  --panel: #fff;
  --text: #17202a;
  --muted: #667085;
  --line: #d9e0e7;
  --primary: #0f766e;
  --primary-dark: #115e59;
  --danger: #b91c1c;
  --warning: #b45309;
  --info: #1d4ed8;
  --soft: #f8fafc;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font-size: 14px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }

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

.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 26px;
  box-shadow: 0 18px 40px rgba(16, 24, 40, .12);
}

.brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--primary);
  font-size: 20px;
  font-weight: 800;
}
.brand strong { display: block; }
.brand small { color: var(--muted); }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 650; }
input, textarea, select {
  width: 100%;
  border: 1px solid #b8c2cf;
  border-radius: 7px;
  padding: 9px 10px;
  outline: none;
  background: #fff;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, .12);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  border: 1px solid #b8c2cf;
  border-radius: 7px;
  padding: 8px 12px;
  background: #fff;
  color: var(--text);
}
.button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.button.small { min-height: 28px; padding: 4px 8px; font-size: 12px; }
.button.danger { color: var(--danger); border-color: #e7a5a5; }
.button:disabled { opacity: .55; cursor: not-allowed; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 210px 1fr; }
.sidebar { background: #101828; color: #cbd5e1; padding: 18px 12px; }
.sidebar .brand { color: #fff; }
.nav { display: flex; flex-direction: column; gap: 5px; margin-top: 24px; }
.nav button {
  text-align: left;
  border: 0;
  border-radius: 8px;
  padding: 10px;
  color: #cbd5e1;
  background: transparent;
}
.nav button.active, .nav button:hover { background: var(--primary); color: #fff; }

.main { min-width: 0; padding: 22px; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  gap: 16px;
}
h1, h2 { margin: 0; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }

.grid { display: grid; gap: 14px; }
.grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  min-width: 0;
}
.stat { font-size: 28px; font-weight: 760; margin-top: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  text-align: left;
}
th { background: var(--soft); color: #475467; font-size: 12px; white-space: nowrap; }
.row-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row-actions input { width: 74px; padding: 6px; }
.badge {
  display: inline-flex;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 650;
}
.badge.green { background: #dcfce7; color: #15803d; }
.badge.gray { background: #f2f4f7; color: #475467; }
.badge.red { background: #fee2e2; color: var(--danger); }
.badge.blue { background: #dbeafe; color: var(--info); }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  padding: 12px 16px;
  border-radius: 8px;
  color: #fff;
  background: #1f2937;
  box-shadow: 0 12px 30px rgba(16, 24, 40, .2);
}
.toast.error { background: var(--danger); }

@media (max-width: 920px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { padding: 12px; }
  .nav { flex-direction: row; margin-top: 10px; overflow-x: auto; }
  .grid.cols-4 { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}
