:root {
  --navy: #0f2f5f;
  --navy-dark: #092242;
  --blue: #1554a5;
  --blue-soft: #eaf1fa;
  --canvas: #f4f7fb;
  --surface: #ffffff;
  --text: #13233b;
  --muted: #66758b;
  --line: #dce4ee;
  --warning: #9a6410;
  --warning-bg: #fff7df;
  --danger: #b43d3d;
  --shadow: 0 12px 30px rgba(25, 59, 103, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  padding: 0 0 5rem;
  background: var(--canvas);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.entry-mask {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 15%, rgba(55, 118, 195, 0.22), transparent 32%),
    var(--navy-dark);
}

.entry-panel {
  width: min(100%, 390px);
  padding: 38px;
  color: #fff;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  box-shadow: 0 28px 70px rgba(1, 14, 30, 0.35);
}

.entry-mark {
  width: 46px;
  height: 46px;
  margin-bottom: 22px;
  display: grid;
  place-items: center;
  color: var(--navy-dark);
  background: #fff;
  border-radius: 9px;
  font-family: Georgia, serif;
  font-size: 28px;
}

.entry-panel h2 {
  margin: 4px 0 8px;
  color: #fff;
  font-size: 28px;
  letter-spacing: -0.02em;
}

.entry-panel p {
  margin: 0 0 24px;
  color: #b9cce3;
}

.entry-panel input[type="password"] {
  margin-bottom: 8px;
  color: #fff;
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.22);
}

.entry-panel input[type="password"]::placeholder {
  color: #9db1c9;
}

.entry-panel button {
  width: 100%;
  color: var(--navy-dark);
  background: #fff;
  font-weight: 700;
}

.entry-error {
  min-height: 28px;
  color: #ffd3d3;
  font-size: 13px;
}

button,
input,
select,
textarea {
  font: inherit;
}

.topbar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 100;
  height: 64px;
  padding: 0 32px 0 286px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text);
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.topbar-brand {
  color: #52637a;
  font-size: 13px;
  letter-spacing: 0.08em;
}

#admin-username {
  font-weight: 600;
  font-size: 14px;
}

.admin-layout {
  min-height: 100vh;
  padding-top: 64px;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 110;
  width: 262px;
  overflow-y: auto;
  color: var(--text);
  background: #fff;
  border-right: 1px solid var(--line);
}

.sidebar-title {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 64px;
  padding: 0 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--navy-dark);
  background: #fff;
  font-weight: 650;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--line);
}

.sidebar-mark {
  width: 30px;
  height: 30px;
  display: inline-grid;
  place-items: center;
  color: #fff;
  background: var(--navy);
  border-radius: 7px;
  font-family: Georgia, serif;
  font-size: 19px;
}

.sidebar ul {
  list-style: none;
  margin: 0;
  padding: 16px 12px 30px;
}

.sidebar li:not(.sidebar-group-title) {
  min-height: 42px;
  margin: 2px 0;
  padding: 9px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 7px;
  color: #30435d;
  cursor: pointer;
  transition: background 180ms ease, color 180ms ease, transform 180ms ease;
}

.sidebar li:not(.sidebar-group-title):hover {
  color: var(--navy);
  background: #eef4fb;
  transform: translateX(2px);
}

.sidebar li.active {
  color: #0d4385;
  background: #e3eefb;
  box-shadow: inset 3px 0 0 var(--blue);
}

.sidebar-group-title {
  padding: 18px 12px 6px;
  color: #6c7c91;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: default;
}

.nav-icon {
  width: 24px;
  color: #7d8ca0;
  font-family: Consolas, monospace;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.sidebar li.active .nav-icon {
  color: var(--blue);
}

.main-content {
  min-height: calc(100vh - 64px);
  margin-left: 262px;
  padding: 34px clamp(24px, 4vw, 64px) 80px;
  overflow-x: auto;
}

#main-content {
  width: min(100%, 1380px);
  margin: 0 auto;
}

.module-context {
  margin-bottom: 24px;
  padding: 26px 28px 28px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  color: var(--text);
  background: #fff;
  border: 1px solid #cdd9e7;
  border-radius: 12px 12px 5px 5px;
  box-shadow: 0 8px 24px rgba(25, 59, 103, 0.08);
}

.module-eyebrow {
  margin-bottom: 7px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.module-context h1 {
  margin: 0;
  max-width: 800px;
  font-size: clamp(24px, 3vw, 38px);
  line-height: 1.15;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.module-context p {
  max-width: 68ch;
  margin: 10px 0 0;
  color: #55677e;
}

.context-actions {
  min-width: 210px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
}

.edit-status {
  min-height: 38px;
  padding: 9px 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 650;
}

.edit-status {
  color: #42546c;
  background: #f4f7fa;
  border: 1px solid #d5dee8;
}

.edit-status.editing {
  color: #744b08;
  background: #fff1c9;
  border-color: #e4c16c;
}

.module-workspace {
  padding: 4px 0 0;
}

h1,
h2,
h3 {
  color: var(--text);
}

.module-workspace > h2,
.module-title {
  margin: 28px 0 12px;
  text-align: left;
  font-size: 20px;
  letter-spacing: -0.01em;
}

.module-workspace > h2::after,
.module-title::after {
  content: "在下方填写后保存；点击列表中的编辑可修改已有数据";
  margin-left: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0;
}

form,
.card {
  width: 100%;
  margin: 12px 0 24px;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px 22px;
  scroll-margin-top: 86px;
}

.card form {
  margin: 0;
  padding: 0;
  border: 0;
  box-shadow: none;
}

.form-row {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 6px;
}

label {
  width: auto;
  color: #31445f;
  font-size: 13px;
  font-weight: 650;
}

input[type="text"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="password"],
input[type="file"],
select,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 11px;
  color: var(--text);
  background: #f8fafc;
  border: 1px solid #cfd9e5;
  border-radius: 6px;
  outline: none;
  transition: border 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  background: #fff;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(21, 84, 165, 0.12);
}

form > button,
.form-row > button {
  align-self: end;
}

button {
  min-height: 38px;
  padding: 8px 15px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  transition: transform 160ms ease, background 160ms ease, opacity 160ms ease;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(38, 119, 216, 0.35);
  outline-offset: 2px;
}

button:active {
  transform: translateY(1px);
}

button[type="submit"] {
  color: #fff;
  background: var(--blue);
  font-weight: 650;
}

button[type="submit"]:hover {
  background: var(--navy);
}

button[type="button"] {
  color: #30435d;
  background: #e8edf3;
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

table {
  width: 100%;
  margin-top: 18px;
  border-collapse: separate;
  border-spacing: 0;
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

th,
td {
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
  border-bottom: 1px solid #edf1f5;
}

th {
  color: #40526b;
  background: #f5f8fb;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

td {
  color: #253650;
  font-size: 13px;
}

tbody tr {
  transition: background 150ms ease;
}

tbody tr:hover {
  background: #f5f9fe;
}

tbody tr:last-child td {
  border-bottom: 0;
}

td img {
  width: 56px;
  height: 44px;
  padding: 3px;
  object-fit: contain;
  background: #f6f8fb;
  border: 1px solid var(--line);
  border-radius: 5px;
}

.action-btn {
  min-height: 30px;
  margin: 2px 5px 2px 0;
  padding: 5px 10px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 12px;
  font-weight: 650;
}

.action-btn:hover {
  color: #fff;
  background: var(--blue);
}

.delete-btn {
  color: var(--danger);
  background: #fbeeee;
}

.delete-btn:hover {
  background: var(--danger);
}

.edit-row,
.edit-row:hover {
  background: var(--warning-bg) !important;
  box-shadow: inset 4px 0 0 #d69b32;
}

.fixed-bottom-btn,
#back-to-top-btn {
  position: static !important;
  float: right;
  width: 46px;
  height: 46px;
  margin: 16px 0 0 10px;
  padding: 0;
  display: inline-grid;
  place-items: center;
  border-radius: 9px;
  box-shadow: 0 10px 24px rgba(24, 57, 101, 0.18);
}

.fixed-bottom-btn {
  color: #fff;
  background: var(--blue);
  font-size: 20px;
}

#back-to-top-btn {
  color: var(--blue);
  background: #fff;
  font-size: 18px;
}

.module-workspace::after {
  content: "";
  display: block;
  clear: both;
}

@media (max-width: 900px) {
  .sidebar {
    width: 218px;
  }

  .topbar {
    padding-left: 240px;
  }

  .main-content {
    margin-left: 218px;
    padding: 24px 18px 70px;
  }

  .module-context {
    align-items: stretch;
    flex-direction: column;
  }

  .context-actions {
    min-width: 0;
    flex-direction: row;
  }

  form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .topbar {
    height: 54px;
    padding: 0 14px;
  }

  .topbar-brand {
    display: none;
  }

  .admin-layout {
    padding-top: 54px;
  }

  .sidebar {
    position: relative;
    width: 100%;
    max-height: none;
  }

  .sidebar-title {
    height: 54px;
  }

  .main-content {
    margin-left: 0;
    padding: 18px 12px 64px;
  }

  .module-context {
    padding: 22px 18px;
  }

  .context-actions {
    flex-direction: column;
  }

  form,
  .card {
    padding: 16px;
  }

  table {
    min-width: 720px;
  }
}
