:root {
  --ink: #101c33;
  --ink-2: #33445f;
  --muted: #75849b;
  --line: #e3e9f2;
  --bg: #f4f7fc;
  --card: #fff;
  --accent: #ff6a2b;
  --navy: #12325a;
  --danger: #cf3d3d;
  --ok: #178f6b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
}
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }

/* login */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(1200px 600px at 20% 0%, #1b4478 0%, #0b1729 70%);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #fff;
  border-radius: 18px;
  padding: 30px;
  box-shadow: 0 30px 70px rgba(4, 14, 30, 0.4);
}
.login-card h1 { margin: 0; font-size: 21px; }
.login-sub { color: var(--muted); font-size: 13px; margin: 4px 0 20px; }
.login-card label {
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12.5px; color: var(--muted); margin-bottom: 14px;
}
.login-card input {
  border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 13px; font-size: 14px; outline: none; color: var(--ink);
}
.login-card input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 106, 43, 0.14); }
.login-error { color: var(--danger); font-size: 13px; min-height: 20px; margin: 0 0 10px; }
.login-card button {
  width: 100%; border: 0; border-radius: 10px; padding: 11px;
  background: var(--navy); color: #fff; font-size: 14px; font-weight: 600;
}
.login-card button:disabled { opacity: 0.6; }

/* app layout */
.app { display: grid; grid-template-columns: 214px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  background: #0d1b30; color: #b9c7dc;
  display: flex; flex-direction: column; padding: 20px 14px;
  position: sticky; top: 0; height: 100vh;
}
.side-brand { font-size: 16px; font-weight: 700; color: #fff; padding: 0 10px 16px; display: flex; flex-direction: column; }
.side-brand small { font-size: 11px; font-weight: 400; color: #7d8da6; letter-spacing: 0.1em; }
#side-nav { display: flex; flex-direction: column; gap: 4px; }
#side-nav button {
  text-align: left; border: 0; background: transparent; color: #b9c7dc;
  padding: 9px 12px; border-radius: 9px; font-size: 13.5px;
}
#side-nav button:hover { background: rgba(255, 255, 255, 0.07); color: #fff; }
#side-nav button.active { background: var(--accent); color: #fff; font-weight: 600; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding: 12px 6px 0; font-size: 12.5px; }
.side-foot a { color: #9fb2cc; }
.side-foot button {
  border: 1px solid rgba(255, 255, 255, 0.18); background: transparent;
  color: #b9c7dc; padding: 7px; border-radius: 8px; font-size: 12.5px;
}
.side-foot button:hover { border-color: var(--accent); color: #fff; }

.main { padding: 26px 30px 50px; min-width: 0; }
.main-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 20px; }
.main-head h1 { margin: 0; font-size: 24px; }
.main-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.head-actions { display: flex; align-items: center; gap: 10px; }
.chip { font-size: 12px; background: #e8eef8; color: var(--ink-2); padding: 4px 10px; border-radius: 999px; }

.btn {
  border: 1px solid var(--line); background: #fff; color: var(--ink);
  padding: 9px 18px; border-radius: 9px; font-size: 13.5px; font-weight: 600;
}
.btn:hover { border-color: #c3d2e8; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: #1a4475; }
.btn.danger { color: var(--danger); border-color: #f0cccc; }
.btn.small { padding: 5px 11px; font-size: 12.5px; }

/* overview */
.stat-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: 13px;
  padding: 14px 16px; display: flex; flex-direction: column;
}
.stat b { font-size: 22px; }
.stat span { font-size: 12px; color: var(--muted); }
.panel { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-top: 16px; }
.panel h2 { font-size: 15px; margin: 0 0 12px; }
.mini-list { margin: 0; padding: 0; list-style: none; }
.mini-list li { padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13.5px; display: flex; justify-content: space-between; gap: 12px; }
.mini-list li:last-child { border-bottom: 0; }
.mini-list small { color: var(--muted); white-space: nowrap; }

/* table */
.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar input {
  flex: 1; max-width: 320px; border: 1px solid var(--line); border-radius: 9px;
  padding: 8px 12px; font-size: 13.5px; outline: none;
}
.toolbar input:focus { border-color: var(--accent); }
.toolbar .count { font-size: 12.5px; color: var(--muted); margin-left: auto; }

.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: 14px; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th { text-align: left; font-size: 12px; color: var(--muted); font-weight: 600; padding: 11px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 11px 14px; border-bottom: 1px solid #eef2f8; vertical-align: top; }
tr:last-child td { border-bottom: 0; }
tr:hover td { background: #fafcff; }
td .title { font-weight: 600; }
td .sub { color: var(--muted); font-size: 12px; }
.tag { display: inline-block; font-size: 11.5px; background: #eef3fb; color: #2b4a72; padding: 1px 8px; border-radius: 999px; margin-right: 4px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* editor */
.modal { position: fixed; inset: 0; background: rgba(9, 18, 32, 0.55); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal-card { background: #fff; border-radius: 16px; width: min(720px, 100%); max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 0; font-size: 16px; }
.modal-head button { border: 0; background: transparent; font-size: 15px; color: var(--muted); }
.editor { padding: 18px 22px; overflow: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.editor .field { display: flex; flex-direction: column; gap: 5px; }
.editor .field.full { grid-column: span 2; }
.editor label { font-size: 12.5px; color: var(--muted); }
.editor input, .editor select, .editor textarea {
  border: 1px solid var(--line); border-radius: 9px; padding: 8px 11px;
  font-size: 13.5px; outline: none; color: var(--ink); width: 100%;
}
.editor textarea { min-height: 78px; resize: vertical; }
.editor input:focus, .editor select:focus, .editor textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(255, 106, 43, 0.1); }
.editor .check { flex-direction: row; align-items: center; gap: 8px; }
.editor .check input { width: auto; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 22px; border-top: 1px solid var(--line); background: #fbfcfe; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: 34px; transform: translateX(-50%);
  background: #10233d; color: #fff; padding: 10px 20px; border-radius: 999px;
  font-size: 13.5px; z-index: 80; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.25);
}
.toast.error { background: var(--danger); }

.empty { color: var(--muted); font-size: 13.5px; padding: 30px; text-align: center; }

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 8px; }
  #side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-foot { flex-direction: row; margin-top: 0; margin-left: auto; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .editor { grid-template-columns: 1fr; }
  .editor .field.full { grid-column: span 1; }
  .main { padding: 18px; }
}
