:root {
  --ink: #102a2c;
  --ink-soft: #1a3d40;
  --panel: #143638;
  --bg: #e8eef0;
  --bg-deep: #dce6e9;
  --surface: #ffffff;
  --accent: #c9a24a;
  --accent-ink: #8b6914;
  --accent-soft: rgba(201, 162, 74, 0.14);
  --line: #d5dee2;
  --muted: #5f7278;
  --success: #2a7a62;
  --danger: #b42318;
  --shadow: 0 12px 40px rgba(16, 42, 44, 0.08);
  --radius: 14px;
  --font-ui: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  --font-display: "Songti SC", "STSong", "SimSun", "Noto Serif SC", serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-ui);
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 90% -10%, rgba(201, 162, 74, 0.12), transparent 55%),
    linear-gradient(160deg, #f2f6f7 0%, var(--bg) 45%, var(--bg-deep) 100%);
}

a { color: var(--accent-ink); text-decoration: none; }
a:hover { color: var(--ink); }

.layout { display: flex; min-height: 100vh; }

.sidebar {
  width: 248px;
  flex-shrink: 0;
  background:
    linear-gradient(180deg, rgba(201, 162, 74, 0.08), transparent 28%),
    linear-gradient(165deg, var(--ink) 0%, var(--panel) 100%);
  color: #f4f7f7;
  padding: 28px 18px;
  position: relative;
  overflow: hidden;
}
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(90deg, transparent 0 46%, rgba(201, 162, 74, 0.05) 46% 54%, transparent 54%),
    linear-gradient(0deg, transparent 0 46%, rgba(201, 162, 74, 0.05) 46% 54%, transparent 54%);
  background-size: 28px 28px;
  pointer-events: none;
  opacity: 0.45;
}
.sidebar-brand {
  position: relative;
  z-index: 1;
  margin: 0 10px 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(201, 162, 74, 0.28);
}
.sidebar-brand .eyebrow {
  display: block;
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 8px;
}
.sidebar-brand h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.sidebar-brand p {
  margin: 8px 0 0;
  color: rgba(244, 247, 247, 0.62);
  font-size: 12px;
}
.nav {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(244, 247, 247, 0.82);
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav a .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: rgba(201, 162, 74, 0.35);
  flex-shrink: 0;
}
.nav a:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  text-decoration: none;
  transform: translateX(2px);
}
.nav a.active {
  background: rgba(201, 162, 74, 0.16);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(201, 162, 74, 0.35);
}
.nav a.active .dot { background: var(--accent); }
.nav-foot {
  position: relative;
  z-index: 1;
  margin-top: auto;
  padding-top: 24px;
}
.sidebar { display: flex; flex-direction: column; }

.main {
  flex: 1;
  padding: 28px 36px 48px;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 22px;
}
.page-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.page-sub {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(213, 222, 226, 0.9);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 18px;
  box-shadow: var(--shadow);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.card-head h3 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}
.card-head .muted { margin: 0; }

.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}
.stat {
  position: relative;
  overflow: hidden;
  padding: 22px;
}
.stat::after {
  content: "";
  position: absolute;
  right: -20px;
  top: -20px;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: var(--accent-soft);
}
.stat h3 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.stat p {
  margin: 10px 0 0;
  font-family: var(--font-display);
  font-size: 34px;
  font-weight: 700;
  color: var(--ink);
  position: relative;
  z-index: 1;
}

.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  background: rgba(16, 42, 44, 0.05);
  border-radius: 999px;
}
.tabs a {
  padding: 7px 14px;
  border-radius: 999px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 2px 8px rgba(16, 42, 44, 0.08);
}

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}
th {
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
tbody tr:hover { background: rgba(16, 42, 44, 0.02); }
.thumb {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 8px;
  vertical-align: middle;
  border: 1px solid var(--line);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: linear-gradient(180deg, #d4b05c 0%, var(--accent) 100%);
  color: #1c1608;
  border: none;
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  box-shadow: 0 6px 16px rgba(201, 162, 74, 0.28);
  transition: transform .15s ease, filter .15s ease;
}
.btn:hover {
  filter: brightness(1.03);
  transform: translateY(-1px);
  text-decoration: none;
  color: #1c1608;
}
.btn:active { transform: translateY(0); }
.btn-ink {
  background: var(--ink);
  color: #fff;
  box-shadow: 0 6px 16px rgba(16, 42, 44, 0.18);
}
.btn-ink:hover { color: #fff; }
.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
  box-shadow: none;
}
.btn-ghost:hover { background: rgba(16, 42, 44, 0.04); color: var(--ink); }
.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  margin-bottom: 6px;
  letter-spacing: 0.03em;
}
.field .hint {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}
input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  background: #fff;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(201, 162, 74, 0.7);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.filter-bar {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 12px;
  align-items: end;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 12px;
  font-weight: 600;
}
.tag-ok { background: rgba(42, 122, 98, 0.12); color: var(--success); }
.tag-muted { background: rgba(95, 114, 120, 0.12); color: var(--muted); }
.tag-warn { background: rgba(180, 35, 24, 0.1); color: var(--danger); }

.muted { color: var(--muted); font-size: 13px; }
.error { color: var(--danger); margin-bottom: 12px; font-size: 14px; }
.empty {
  padding: 36px 16px;
  text-align: center;
  color: var(--muted);
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 24, 26, 0.55);
  backdrop-filter: blur(4px);
  display: none !important;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 1000;
  opacity: 0;
  transition: opacity .18s ease;
}
.modal-overlay.open {
  display: flex !important;
  opacity: 1;
}
.modal {
  width: min(520px, 100%);
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 24px 80px rgba(10, 24, 26, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.4);
  transform: translateY(10px) scale(0.98);
  transition: transform .2s ease;
  max-height: calc(100vh - 48px);
  overflow: auto;
}
.modal-overlay.open .modal { transform: translateY(0) scale(1); }
.modal-lg { width: min(640px, 100%); }
.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 20px 22px 12px;
  border-bottom: 1px solid var(--line);
}
.modal-head h3 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 20px;
}
.modal-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
}
.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
  color: var(--muted);
}
.modal-close:hover { background: var(--bg); color: var(--ink); }
.modal-body { padding: 18px 22px 8px; }
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 22px 20px;
}

body.modal-open { overflow: hidden; }

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  background-color: #102a2c;
  /* 相对 css 路径，兼容 /haoting context-path */
  background-image:
    linear-gradient(115deg, rgba(16, 42, 44, 0.78) 0%, rgba(16, 42, 44, 0.48) 48%, rgba(8, 20, 22, 0.62) 100%),
    radial-gradient(900px 420px at 78% 18%, rgba(201, 162, 74, 0.2), transparent 58%),
    var(--login-bg, url("../images/login-bg.jpg"));
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.login-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(0deg, rgba(16, 42, 44, 0.45) 0%, transparent 42%),
    linear-gradient(90deg, rgba(16, 42, 44, 0.28), transparent 55%);
  pointer-events: none;
}
.login-wrap::after {
  content: "";
  position: absolute;
  inset: auto -8% -18% auto;
  width: min(52vw, 560px);
  height: min(52vw, 560px);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(201, 162, 74, 0.16), transparent 68%);
  z-index: -1;
  pointer-events: none;
}
.login-card {
  width: min(400px, 100%);
  background: rgba(255, 255, 255, 0.93);
  border-radius: 20px;
  padding: 32px 28px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(12px);
  position: relative;
  z-index: 1;
}
.login-card .brand {
  font-family: var(--font-display);
  font-size: 26px;
  margin: 0 0 6px;
}
.login-card .brand-sub {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 960px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; }
  .grid { grid-template-columns: 1fr; }
  .form-row, .filter-bar { grid-template-columns: 1fr; }
  .main { padding: 20px 16px 40px; }
  .topbar { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    transition: none !important;
    animation: none !important;
  }
}
