:root {
  --bg: #f2f5f9;
  --panel: #ffffff;
  --line: #d7dfeb;
  --text: #132139;
  --muted: #657897;
  --primary: #0a6c62;
  --primary-dark: #07524b;
  --accent: #d8f0e8;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 8% 8%, #dfebff 0, transparent 36%),
    radial-gradient(circle at 90% 15%, #e5f6ef 0, transparent 34%),
    var(--bg);
}

.admin-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 250px 1fr;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 20px 14px;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.4px;
  margin-bottom: 20px;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.menu-item {
  text-decoration: none;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
}

.menu-item:hover {
  background: #f7f9fd;
  border-color: var(--line);
}

.menu-item.active {
  background: var(--accent);
  border-color: #b6e4d7;
  color: #05453f;
}

.main {
  display: flex;
  flex-direction: column;
}

.topbar {
  height: 64px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
}

.topbar-title {
  font-size: 20px;
  font-weight: 700;
}

.topbar-meta {
  color: var(--muted);
  font-size: 13px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.content {
  padding: 20px;
  display: grid;
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 28px rgba(15, 42, 70, 0.06);
}

.section-card {
  padding: 18px;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  padding: 16px;
  background: linear-gradient(145deg, #fff, #f6fbff);
}

.stat-label {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 34px;
  font-weight: 700;
}

h3 {
  margin: 0 0 8px;
}

.muted {
  color: var(--muted);
  font-size: 14px;
}

.quick-actions {
  margin-top: 12px;
  display: flex;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 10px;
  border: 0;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  text-decoration: none;
  cursor: pointer;
}

.btn.ghost {
  background: #fff;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn.btn-sm {
  padding: 6px 10px;
  font-size: 13px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 12px;
}

.form-grid > div {
  min-width: 0;
}

label {
  display: block;
  margin-bottom: 5px;
  font-size: 13px;
  color: var(--muted);
}

input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
}

textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 14px;
  resize: vertical;
  font-family: inherit;
}

select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  background: #fff;
}

.full {
  grid-column: 1 / -1;
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 10px 6px;
  font-size: 14px;
}

.empty-box {
  margin-top: 10px;
  background: #f8fbff;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 20px;
  color: var(--muted);
}

.pager-form {
  margin: 12px 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.pager-bar {
  margin-top: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.pager-actions {
  display: flex;
  gap: 8px;
}

.btn.disabled {
  opacity: 0.55;
  pointer-events: none;
}

.alert {
  border-radius: 10px;
  padding: 10px 12px;
  margin: 10px 0;
  font-size: 14px;
}

.alert.error {
  background: #ffeef0;
  color: #8f1f2f;
  border: 1px solid #ffd0d7;
}

.alert.success {
  background: #e9f9ef;
  color: #165b2a;
  border: 1px solid #bdeac8;
}

.alert.info {
  background: #eef4ff;
  color: #1c3f76;
  border: 1px solid #cfe0ff;
}

.inline-form {
  display: inline;
}

.inline-actions {
  margin: 6px 0 8px;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.inline-label {
  color: var(--muted);
  font-size: 13px;
}

.delete-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.delete-form input {
  width: 92px;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 13px;
}

.user-actions {
  display: grid;
  gap: 6px;
}

.user-actions .delete-form input[type="text"],
.user-actions .delete-form input[type="password"] {
  width: 120px;
}

.note-preview {
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 26, 42, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  padding: 16px;
}

.modal-panel {
  width: 100%;
  max-width: 560px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 18px 40px rgba(10, 25, 50, 0.18);
}

.modal-backdrop[hidden] {
  display: none !important;
}

.password-wrap {
  position: relative;
}

.password-wrap input {
  padding-right: 44px;
}

.password-eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  border-radius: 8px;
  width: 30px;
  height: 28px;
  cursor: pointer;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
}

.password-eye svg {
  width: 15px;
  height: 15px;
  fill: #6a7d9a;
  display: block;
  flex: 0 0 auto;
}

.password-eye .eye-open {
  display: none;
}

.password-eye .eye-off {
  display: block;
}

.password-eye.is-visible .eye-open {
  display: block;
}

.password-eye.is-visible .eye-off {
  display: none;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login-wrap {
  width: 100%;
  max-width: 360px;
  padding: 16px;
}

.login-card {
  padding: 16px;
}

.login-form {
  display: grid;
  gap: 8px;
}

.login-mini {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.captcha-box {
  margin: 8px 0 10px;
  padding: 8px 10px;
  border: 1px dashed var(--line);
  border-radius: 10px;
  background: #f8fbff;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

.captcha-label {
  color: var(--muted);
  font-size: 13px;
}

.captcha-code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 20px;
  letter-spacing: 2px;
  color: #0b3f7f;
  font-weight: 700;
}

.captcha-box.compact {
  margin: 8px 0 10px;
  padding: 6px 10px;
}

.xml-box {
  margin-top: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fbfcff;
  overflow: auto;
  max-height: 70vh;
  white-space: pre;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.5;
}

.stats-visual-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.stat-panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fbfcff;
}

.bar-row {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 120px 1fr 40px;
  align-items: center;
  gap: 8px;
}

.bar-label {
  font-size: 12px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar-wrap {
  height: 10px;
  border-radius: 999px;
  background: #e6edf8;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2c8f7f, #0b6e63);
}

.bar-fill-alt {
  background: linear-gradient(90deg, #5c7cff, #3553d3);
}

.bar-value {
  font-size: 12px;
  color: var(--text);
  text-align: right;
}

@media (max-width: 960px) {
  .admin-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .menu {
    flex-direction: row;
    overflow: auto;
  }

  .cards-grid {
    grid-template-columns: 1fr;
  }

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

  .stats-visual-grid {
    grid-template-columns: 1fr;
  }

  .bar-row {
    grid-template-columns: 90px 1fr 32px;
  }
}
