:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --panel-soft: #f0f3ec;
  --ink: #18201d;
  --muted: #64706a;
  --line: #dfe5dc;
  --accent: #176b5c;
  --accent-strong: #0e4e43;
  --warn: #a74724;
  --danger: #a92828;
  --shadow: 0 18px 45px rgba(28, 38, 34, 0.12);
  font-family: "Avenir Next", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(23, 107, 92, 0.08), transparent 40%),
    radial-gradient(circle at 85% 10%, rgba(190, 105, 55, 0.12), transparent 26%),
    var(--bg);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

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

textarea {
  min-height: 110px;
  resize: vertical;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.hidden {
  display: none !important;
}

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

.login-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 18px;
  padding: 34px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.login-panel h1,
.topbar h2 {
  margin: 0;
  letter-spacing: 0;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.muted {
  margin: 6px 0 0;
  color: var(--muted);
}

.error {
  min-height: 18px;
  margin: 0;
  color: var(--danger);
  font-size: 13px;
}

.primary,
.secondary,
.ghost,
.danger {
  min-height: 40px;
  border-radius: 6px;
  padding: 0 14px;
  font-weight: 700;
}

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

.primary:hover {
  background: var(--accent-strong);
}

.secondary {
  background: var(--panel-soft);
  color: var(--ink);
  border: 1px solid var(--line);
}

.ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}

.danger {
  background: #fff0ec;
  color: var(--warn);
  border: 1px solid #f0c7b8;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px;
  background: #111b18;
  color: #eef7f2;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: #dfeee6;
  color: #15392f;
  font-weight: 800;
}

.brand small {
  display: block;
  margin-top: 2px;
  color: #9fb3aa;
}

#navList {
  display: grid;
  gap: 6px;
  flex: 1;
}

.nav-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 40px;
  padding: 0 12px;
  border-radius: 6px;
  color: #dce8e2;
  background: transparent;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: #20322d;
  color: #fff;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 2;
  min-height: 86px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 28px;
  background: rgba(246, 247, 244, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.admin-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

.content {
  display: grid;
  gap: 18px;
  padding: 24px 28px 42px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
}

.metric,
.panel,
.table-panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(34, 45, 41, 0.06);
}

.metric {
  padding: 18px;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 26px;
}

.metric-alert strong {
  color: var(--warn);
}

.panel {
  padding: 18px;
}

.panel h3,
.table-panel h3 {
  margin: 0 0 14px;
}

.filters {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}

.table-panel {
  overflow: hidden;
}

.table-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  font-size: 13px;
}

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

th {
  position: sticky;
  top: 0;
  background: #f9faf7;
  color: var(--muted);
  font-weight: 700;
}

td {
  color: #28342f;
}

.mono {
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 12px;
}

.clip {
  max-width: 320px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--accent-strong);
  font-weight: 700;
  font-size: 12px;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pagination {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 0.55fr);
  gap: 18px;
}

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

.form-grid .full {
  grid-column: 1 / -1;
}

.json-box {
  max-height: 300px;
  overflow: auto;
  padding: 12px;
  border-radius: 6px;
  background: #101816;
  color: #dff2e8;
  font-size: 12px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 8px;
  background: #10201b;
  color: #fff;
  box-shadow: var(--shadow);
}

@media (max-width: 960px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

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

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .metrics,
  .filters,
  .split,
  .form-grid {
    grid-template-columns: 1fr;
  }
}
