:root {
  --ink: #1b3e51;
  --ink-soft: #234b61;
  --brand-red: #c1272d;
  --brand-red-deep: #a51f24;
  --mist: #eef3f6;
  --line: #d5e0e6;
  --text: #1a2433;
  --muted: #667789;
  --row-alt: #f2f7fa;
  --font: "Manrope", "Noto Sans SC", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: var(--font);
  background:
    radial-gradient(900px 400px at 0% 0%, rgba(193,39,45,.08), transparent 55%),
    var(--mist);
  color: var(--text);
}
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(900px 420px at 12% 0%, rgba(193, 39, 45, 0.1), transparent 55%),
    radial-gradient(800px 380px at 90% 100%, rgba(47, 111, 143, 0.14), transparent 50%),
    linear-gradient(180deg, #f4f7fa 0%, #e8eef3 100%);
}
.login-card {
  width: 400px;
  background: #fff;
  border-radius: 18px;
  padding: 28px 28px 26px;
  border: 1px solid rgba(213, 224, 230, 0.95);
  box-shadow: 0 18px 48px rgba(27, 62, 81, 0.12);
}
.login-brand {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.login-logo {
  height: 72px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
  display: block;
}
.login-card h1 {
  margin: 0 0 4px;
  font-size: 22px;
  color: var(--ink);
  text-align: center;
}
.login-card .hint {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}
.layout {
  display: flex;
  min-height: 100vh;
  width: 100%;
}
.sidebar {
  width: 220px;
  background: linear-gradient(180deg, var(--ink), var(--ink-soft));
  color: #fff;
  padding: 16px 0;
  flex-shrink: 0;
}
.brand {
  padding: 8px 18px 20px;
}
.sidebar-logo {
  width: 100%;
  max-width: 160px;
  height: auto;
  display: block;
  background: #fff;
  border-radius: 10px;
  padding: 8px 10px;
  margin-bottom: 10px;
}
.brand span {
  display: block;
  font-size: 12px;
  font-weight: 500;
  opacity: .78;
  letter-spacing: 0.02em;
}
.menu-item {
  padding: 12px 22px;
  cursor: pointer;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.menu-item:hover,
.menu-item.active {
  background: rgba(255,255,255,.08);
  border-left-color: var(--brand-red);
}
.main {
  flex: 1;
  min-width: 0;
  padding: 20px 24px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.topbar h2 { margin: 0; font-size: 22px; color: var(--ink); }
.panel {
  background: rgba(255,255,255,.94);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  box-shadow: 0 10px 30px rgba(27,62,81,.06);
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
  align-items: center;
}
.table-scroll {
  width: 100%;
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1100px;
  font-size: 13px;
}
.data-table th,
.data-table td {
  padding: 10px 8px;
  text-align: center;
  white-space: nowrap;
  vertical-align: middle;
  border-bottom: 1px solid #e6edf4;
}
.data-table th {
  background: var(--ink);
  color: #f4f7fb;
  font-weight: 600;
  border-bottom: 3px solid var(--brand-red);
}
.data-table tbody tr:nth-child(even) td { background: var(--row-alt); }
.data-table tbody tr:hover td { background: #e8f2f7; }
.data-table .left { text-align: left; max-width: 180px; white-space: normal; }
.data-table .empty { padding: 28px; color: var(--muted); background: #fff; }
.data-table .ops { white-space: nowrap; }
.data-table.compact { min-width: 720px; }
.pager {
  margin-top: 14px;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
  font-size: 13px;
  color: var(--muted);
}
.input, .field input, .field select {
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 14px;
  width: 140px;
  background: #fff;
}
.input.wide, .toolbar select.wide { width: 180px; }
.toolbar select.input { width: 140px; }
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}
.field input, .field select { width: 100%; }
.field.check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}
.field.check input { width: auto; height: auto; }
.btn {
  height: 36px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 13px;
}
.btn:hover { background: #f5f7fa; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(135deg, var(--brand-red), var(--brand-red-deep));
  border-color: var(--brand-red-deep);
  color: #fff;
}
.btn-primary:hover {
  background: linear-gradient(135deg, #d12f35, var(--brand-red));
  border-color: var(--brand-red);
  color: #fff;
  filter: none;
}
.btn-success {
  background: var(--ink);
  border-color: #153242;
  color: #fff;
}
.btn-success:hover {
  background: var(--ink-soft);
  border-color: var(--ink-soft);
  color: #fff;
  filter: none;
}
.btn-block { width: 100%; margin-top: 8px; }
.link {
  border: 0;
  background: none;
  color: #2f6f8f;
  cursor: pointer;
  padding: 0 4px;
  font-size: 13px;
}
.link.danger { color: var(--brand-red); }
.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 12px;
}
.tag-on { background: #e8f8ef; color: #1f8a4c; }
.tag-off { background: #eef1f5; color: #778; }
.error { color: var(--brand-red); font-size: 13px; margin-top: 10px; text-align: center; }
.ok { color: #1f8a4c; font-size: 13px; margin-top: 10px; }
.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(19,41,54,.52);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal {
  width: 760px;
  max-width: 100%;
  max-height: 90vh;
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  padding: 20px 22px;
}
.modal.narrow { width: 420px; }
.modal h3 { margin: 0 0 16px; color: var(--ink); }
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px 14px;
}
.form-grid .full { grid-column: 1 / -1; }
.modal-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
@media (max-width: 900px) {
  .form-grid { grid-template-columns: 1fr 1fr; }
  .sidebar { width: 168px; }
  .sidebar-logo { max-width: 130px; }
}
