:root {
  --bg: #f5f6f8;
  --panel: #fff;
  --line: #e6e8ec;
  --text: #1f2329;
  --muted: #7a8290;
  --brand: #a3402f;
  --brand-soft: #f6e9e6;
  --ok: #1f9d55;
  --warn: #c47f17;
  --bad: #d64545;
  --radius: 10px;
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 14px/1.6 -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}
a { color: var(--brand); text-decoration: none; }
button, input, select, textarea { font: inherit; }
button {
  border: 0; border-radius: 8px; padding: 8px 16px; cursor: pointer;
  background: var(--brand); color: #fff;
}
button.ghost { background: #fff; color: var(--text); border: 1px solid var(--line); }
button.danger { background: var(--bad); }
button:disabled { opacity: .55; cursor: not-allowed; }
input, select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; color: var(--text); outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); }
textarea { min-height: 88px; resize: vertical; font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

.layout { display: flex; min-height: 100vh; }
.sidebar {
  width: 210px; background: #241d1b; color: #e9e2df; padding: 22px 14px;
  display: flex; flex-direction: column; gap: 6px; flex-shrink: 0;
}
.brand { font-size: 17px; font-weight: 600; letter-spacing: 1px; padding: 0 10px 18px; color: #fff; }
.brand small { display: block; font-size: 11px; color: #9c8f8a; letter-spacing: 0; font-weight: 400; margin-top: 4px; }
.nav-item { padding: 10px 12px; border-radius: 8px; color: #cfc5c1; cursor: pointer; }
.nav-item:hover { background: #332a27; color: #fff; }
.nav-item.active { background: var(--brand); color: #fff; }
.sidebar .foot { margin-top: auto; font-size: 12px; color: #9c8f8a; padding: 10px; }

.main { flex: 1; padding: 24px 28px 40px; min-width: 0; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 20px; margin: 0; font-weight: 600; }
.page-head .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.head-actions { display: flex; gap: 10px; align-items: center; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; }
.panel h2 { font-size: 15px; margin: 0 0 14px; font-weight: 600; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 12px; color: var(--muted); }
.field .hint { font-size: 11px; color: var(--muted); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
th { color: var(--muted); font-weight: 500; background: #fafbfc; }
tr:hover td { background: #fcfcfd; }
.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; }
.tag.on { background: #e9f7ef; color: var(--ok); }
.tag.off { background: #fdecec; color: var(--bad); }
.tag.warn { background: #fdf4e3; color: var(--warn); }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, Consolas, monospace; font-size: 12px; }

.login-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(140deg, #241d1b, #4a332c 60%, #7b4a3c); }
.login-box { width: 360px; background: #fff; padding: 32px; border-radius: 14px; box-shadow: 0 20px 60px rgba(0,0,0,.28); }
.login-box h1 { font-size: 20px; margin: 0 0 6px; }
.login-box p { color: var(--muted); font-size: 12px; margin: 0 0 22px; }
.login-box .field { margin-bottom: 14px; }
.login-box button { width: 100%; padding: 11px; margin-top: 6px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card .k { font-size: 12px; color: var(--muted); }
.card .v { font-size: 24px; font-weight: 600; margin-top: 6px; }
.card .v small { font-size: 12px; color: var(--muted); font-weight: 400; margin-left: 4px; }

.bar { height: 8px; background: var(--brand-soft); border-radius: 99px; overflow: hidden; min-width: 80px; }
.bar > i { display: block; height: 100%; background: var(--brand); }

.toast {
  position: fixed; left: 50%; top: 24px; transform: translateX(-50%) translateY(-20px);
  background: #241d1b; color: #fff; padding: 10px 18px; border-radius: 8px; opacity: 0;
  transition: .22s; pointer-events: none; z-index: 50; max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.err { background: var(--bad); }

.modal-mask { position: fixed; inset: 0; background: rgba(20,16,15,.42); display: grid; place-items: center; z-index: 40; padding: 20px; }
.modal { background: #fff; border-radius: 12px; padding: 22px; width: min(720px, 96vw); max-height: 88vh; overflow: auto; }
.modal h3 { margin: 0 0 16px; font-size: 16px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.hidden { display: none !important; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: flex-end; margin-top: 12px; }
.upload { display: flex; gap: 8px; align-items: center; }
.upload input[type=file] { display: none; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 900px) {
  .split { grid-template-columns: 1fr; }
  .sidebar { width: 64px; padding: 16px 8px; }
  .brand, .nav-item span, .sidebar .foot { display: none; }
  .nav-item { text-align: center; }
  .main { padding: 16px; }
}
