:root {
  --bg: #eef2f6;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbe3ed;
  --accent: #0a7cff;
  --accent-dark: #075ec4;
  --danger: #d92d20;
  --ok: #248a3d;
  --shadow: 0 18px 48px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  padding: 0 16px;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: var(--accent);
  font-weight: 700;
  cursor: pointer;
}

button:hover {
  background: var(--accent-dark);
}

button.small {
  min-height: 30px;
  padding: 0 10px;
  border-radius: 8px;
  font-size: 12px;
}

button.danger {
  border: 1px solid #ffd0cb;
  color: var(--danger);
  background: #fff1f0;
}

button.danger:hover {
  background: #ffe4e0;
}

button.secondary,
button.quiet {
  color: var(--text);
  background: #eef3f8;
}

button.secondary:hover,
button.quiet:hover {
  background: #e0e8f1;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: #fff;
  outline: none;
}

textarea {
  min-height: 92px;
  padding-top: 10px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 124, 255, 0.12);
}

.hidden {
  display: none !important;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 30% 20%, rgba(10, 124, 255, 0.15), transparent 34%),
    linear-gradient(145deg, #f7fbff, #e8eef6);
}

.login-card {
  width: min(420px, 100%);
  padding: 34px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
}

.brand-mark {
  display: grid;
  width: 58px;
  height: 58px;
  place-items: center;
  border-radius: 16px;
  color: #fff;
  background: linear-gradient(145deg, #0a7cff, #123a76);
  font-size: 30px;
  font-weight: 900;
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 22px;
}

.login-card h1 {
  margin: 22px 0 6px;
  font-size: 30px;
}

.login-card p {
  margin: 0 0 26px;
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 14px;
}

.stack span,
.movement-grid span,
.user-grid span {
  display: block;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.error {
  min-height: 22px;
  margin-top: 16px;
  color: var(--danger);
}

.app-shell {
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  background: #101828;
  color: #fff;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 28px;
}

.brand-row strong,
.brand-row span {
  display: block;
}

.brand-row span {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.62);
  font-size: 13px;
}

.tabs {
  display: grid;
  gap: 8px;
}

.tabs button {
  justify-content: flex-start;
  width: 100%;
  color: rgba(255, 255, 255, 0.74);
  background: transparent;
  text-align: left;
}

.tabs button.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.sidebar .quiet {
  position: absolute;
  right: 16px;
  bottom: 18px;
  left: 16px;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.content {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.topbar h2 {
  margin: 0;
  font-size: 28px;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--muted);
}

.status,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--accent-dark);
  background: #e7f1ff;
  font-size: 13px;
  font-weight: 800;
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.card {
  padding: 20px;
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.card + .card {
  margin-top: 16px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.card-head h3 {
  margin: 0;
  font-size: 18px;
}

.actions,
.import-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.actions input {
  width: 260px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.stat {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.two-col {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.6fr);
  gap: 16px;
}

.table-wrap {
  max-height: 58vh;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-soft);
  color: #334155;
  font-weight: 900;
}

td {
  color: #334155;
}

.muted-pill {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--muted);
  background: #eef3f8;
  font-size: 12px;
  font-weight: 800;
}

.movement-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.movement-grid .wide {
  grid-column: 1 / -1;
}

.movement-grid button {
  grid-column: 1 / -1;
}

.user-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.check {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.check input {
  width: auto;
  min-height: auto;
}

.result {
  margin-top: 12px;
  color: var(--ok);
  font-weight: 800;
}

.health-box {
  min-height: 220px;
  margin: 0;
  padding: 8px;
  overflow: hidden;
  border-radius: 14px;
  background: var(--panel-soft);
}

.health-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.health-row:last-child {
  border-bottom: 0;
}

.health-row span,
.health-row strong,
.health-row small {
  display: block;
}

.health-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.health-row strong {
  margin-top: 4px;
  font-size: 16px;
}

.health-row small {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.45;
}

.health-status {
  flex: 0 0 auto;
  min-width: 48px;
  padding: 6px 8px;
  border-radius: 999px;
  text-align: center;
  font-size: 12px;
  font-style: normal;
  font-weight: 900;
}

.health-status.ok {
  color: var(--ok);
  background: #eaf7ee;
}

.health-status.warn {
  color: #a15c00;
  background: #fff4db;
}

.health-status.danger {
  color: var(--danger);
  background: #fff1f2;
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .tabs {
    grid-template-columns: repeat(3, 1fr);
  }

  .sidebar .quiet {
    position: static;
    margin-top: 14px;
  }

  .stats-grid,
  .two-col,
  .movement-grid,
  .user-grid {
    grid-template-columns: 1fr;
  }
}
