:root {
  --ink: #14261c;
  --muted: #5a6b60;
  --line: #d5e0d8;
  --paper: #f2f6f1;
  --card: #ffffff;
  --brand: #0b3d28;
  --brand-2: #146c43;
  --accent: #2f6f8f;
  --warn: #a67c1a;
  --danger: #9b3b2e;
  --ok: #1f8a58;
  --shadow: 0 18px 40px rgba(11, 61, 40, 0.08);
  --radius: 18px;
  --font: "Outfit", "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --display: "Noto Serif SC", "Songti SC", "SimSun", serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, rgba(20, 108, 67, 0.12), transparent 60%),
    radial-gradient(900px 420px at 100% 0%, rgba(47, 111, 143, 0.10), transparent 55%),
    linear-gradient(180deg, #e8f0ea 0%, var(--paper) 42%, #eef3ef 100%);
}

button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }

#app { min-height: 100vh; }

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}
.login-visual {
  position: relative;
  padding: 64px;
  color: #f5faf6;
  background:
    linear-gradient(145deg, rgba(11,61,40,.92), rgba(20,108,67,.78)),
    url("data:image/svg+xml,%3Csvg width='160' height='160' viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M0 80h160M80 0v160' stroke='%23ffffff' stroke-opacity='.05' stroke-width='1'/%3E%3C/svg%3E");
  overflow: hidden;
}
.login-visual::after {
  content: "";
  position: absolute;
  right: -80px; bottom: -80px;
  width: 360px; height: 360px;
  border-radius: 50%;
  background: rgba(255,255,255,.06);
}
.brand-mark {
  font-family: var(--display);
  font-size: 56px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin-bottom: 18px;
}
.brand-title {
  font-family: var(--display);
  font-size: 40px;
  font-weight: 700;
  line-height: 1.25;
  max-width: 10em;
}
.brand-sub {
  margin-top: 18px;
  font-size: 16px;
  opacity: .88;
  max-width: 28em;
  line-height: 1.7;
}
.login-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid rgba(213,224,216,.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 36px 34px;
}
.login-card h1 {
  font-family: var(--display);
  font-size: 28px;
  margin: 0 0 8px;
}
.login-card p { margin: 0 0 28px; color: var(--muted); }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--muted);
}
.field input, .field select, .field textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fbfdfb;
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus, .field select:focus, .field textarea:focus {
  border-color: var(--brand-2);
  box-shadow: 0 0 0 3px rgba(20,108,67,.12);
}
.btn {
  border: none;
  cursor: pointer;
  border-radius: 12px;
  padding: 12px 18px;
  font-weight: 600;
  transition: transform .12s, opacity .12s, background .12s;
}
.btn:hover { transform: translateY(-1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  width: 100%;
}
.btn-secondary {
  background: #e8f1eb;
  color: var(--brand);
}
.btn-ghost {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
}
.btn-danger { background: #f6e8e5; color: var(--danger); }
.btn-ok { background: #e5f5ec; color: var(--ok); }
.btn-warn { background: #f7efd9; color: var(--warn); }
.btn-sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.demo-tip {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #f0f6f2;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.shell {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: linear-gradient(180deg, #0b3d28 0%, #124f35 100%);
  color: #eef7f1;
  padding: 28px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.side-brand {
  padding: 8px 12px 28px;
}
.side-brand .mark {
  font-family: var(--display);
  font-size: 28px;
  font-weight: 700;
}
.side-brand .name {
  margin-top: 6px;
  font-size: 13px;
  opacity: .78;
  line-height: 1.5;
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 12px;
  margin-bottom: 6px;
  color: rgba(255,255,255,.78);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.nav-item:hover, .nav-item.active {
  background: rgba(255,255,255,.12);
  color: #fff;
}
.nav-item .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor; opacity: .7;
}
.side-foot {
  margin-top: 28px;
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,.12);
  font-size: 13px;
  opacity: .8;
}

.main {
  padding: 28px 32px 48px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 24px;
}
.topbar h2 {
  font-family: var(--display);
  font-size: 30px;
  margin: 0 0 6px;
}
.topbar .desc { color: var(--muted); margin: 0; }

.grid-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 18px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--brand-2);
}
.stat-card .label { color: var(--muted); font-size: 13px; }
.stat-card .value {
  margin-top: 10px;
  font-size: 34px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.stat-card.warn::before { background: var(--warn); }
.stat-card.accent::before { background: var(--accent); }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  margin-bottom: 18px;
}
.panel h3 {
  margin: 0 0 16px;
  font-size: 18px;
  font-family: var(--display);
}
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
.row .field { flex: 1; min-width: 160px; margin-bottom: 0; }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
table.data th, table.data td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
table.data th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .04em;
  text-transform: uppercase;
}
table.data tr:hover td { background: #f7fbf8; }

.tag {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}
.tag-ok { background: #e5f5ec; color: var(--ok); }
.tag-warn { background: #f7efd9; color: var(--warn); }
.tag-danger { background: #f6e8e5; color: var(--danger); }
.tag-info { background: #e8eef3; color: var(--accent); }

.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.empty {
  padding: 36px 12px;
  text-align: center;
  color: var(--muted);
}
.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  z-index: 50;
  animation: rise .25s ease;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}
.modal-mask {
  position: fixed; inset: 0;
  background: rgba(15, 30, 22, .45);
  display: flex; align-items: center; justify-content: center;
  z-index: 40;
  padding: 20px;
}
.modal {
  width: min(480px, 100%);
  background: #fff;
  border-radius: 18px;
  padding: 24px;
  box-shadow: var(--shadow);
}
.modal-lg {
  width: min(920px, 100%);
  max-height: calc(100vh - 40px);
  overflow: auto;
}
.modal h3 { margin: 0 0 8px; font-family: var(--display); }
.modal p { margin: 0 0 16px; color: var(--muted); line-height: 1.6; }
.detail-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}
.detail-sub { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0 0 !important; }
.detail-meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 12px 14px;
  background: #f0f6f2;
  border-radius: 12px;
  margin-bottom: 16px;
  font-size: 13px;
  color: var(--muted);
}
.detail-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}
.detail-grid h4 {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--brand);
}
.kv-list { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.kv:last-child { border-bottom: none; }
.kv-k {
  padding: 10px 12px;
  background: #f7fbf8;
  color: var(--muted);
  font-weight: 600;
}
.kv-v { padding: 10px 12px; word-break: break-all; }
.kv-v.missing { color: #a67c1a; }
.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.photo-box { margin-top: 12px; }
.photo-box img { max-width: 100%; border-radius: 12px; border: 1px solid var(--line); }
.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: #eef7f1 !important; }
.table-wrap { overflow-x: auto; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); font-size: 12px; }
.hint-line {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
}
.nav-item { justify-content: flex-start; }
.nav-label { flex: 1; }
.nav-badge {
  min-width: 20px;
  padding: 1px 7px;
  border-radius: 999px;
  background: #c47f17;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  text-align: center;
}
.bar-sub { font-size: 11px; color: var(--muted); font-weight: 400; margin-top: 2px; }

.module-bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 160px 1fr 88px; gap: 10px; align-items: center; }
.bar-track {
  height: 10px;
  background: #e7eee9;
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--brand-2), #3dab74);
  border-radius: 999px;
}
.export-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.export-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 18px;
  background: linear-gradient(180deg, #fff, #f7fbf8);
}
.export-card h4 { margin: 0 0 8px; font-size: 16px; }
.export-card p { margin: 0 0 14px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.preview-box {
  display: flex; gap: 18px; flex-wrap: wrap;
  padding: 14px 16px;
  background: #f0f6f2;
  border-radius: 12px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 14px;
}
.preview-box strong { color: var(--ink); }

@media (max-width: 1100px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .shell { grid-template-columns: 1fr; }
  .sidebar { height: auto; position: relative; }
  .grid-stats, .export-grid, .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .grid-stats, .export-grid { grid-template-columns: 1fr; }
  .main { padding: 18px; }
  .kv { grid-template-columns: 1fr; }
}
