[hidden] {
  display: none !important;
}

/* 管理页全屏布局 */
.admin-body {
  background: var(--bg-alt);
  min-height: 100vh;
}

:root {
  --bg: #ffffff;
  --bg-alt: #f6f7f9;
  --surface: #ffffff;
  --text: #1a1d23;
  --text-muted: #6b7280;
  --border: #e5e7eb;
  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --danger: #dc2626;
  --danger-bg: #fef2f2;
  --radius: 10px;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

[data-theme='dark'] {
  --bg: #0f1117;
  --bg-alt: #161922;
  --surface: #1b1f2a;
  --text: #e5e7eb;
  --text-muted: #9ca3af;
  --border: #2a2f3a;
  --primary: #818cf8;
  --primary-hover: #a5b4fc;
  --danger: #f87171;
  --danger-bg: #2a1616;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html[data-theme='dark'] {
  color-scheme: dark;
}

body {
  font-family: system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn--primary {
  background: var(--primary);
  color: #fff;
}

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

.btn--ghost {
  background: transparent;
  border-color: var(--border);
}

.btn--ghost:hover {
  border-color: var(--text-muted);
}

.btn--danger {
  background: transparent;
  border-color: var(--border);
  color: var(--danger);
}

.btn--danger:hover {
  background: var(--danger-bg);
  border-color: var(--danger);
}

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

.btn--block {
  width: 100%;
}

/* ---------- Login ---------- */

.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login__card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.login__title {
  font-size: 22px;
}

.login__hint {
  color: var(--text-muted);
  font-size: 14px;
  margin-top: -10px;
}

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

.login__field span {
  font-size: 13px;
  color: var(--text-muted);
}

.login__field input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}

.login__field input:focus {
  outline: none;
  border-color: var(--primary);
}

.login__error {
  color: var(--danger);
  font-size: 13px;
}

.login__back {
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
}

.login__back:hover {
  color: var(--primary);
}

/* ---------- Admin layout ---------- */

.admin {
  max-width: 900px;
  margin: 0 auto;
  padding: 24px 20px 60px;
}

.admin__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.admin__title {
  font-size: 20px;
}

.admin__actions {
  display: flex;
  gap: 10px;
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
}

.tabs__tab {
  padding: 10px 18px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tabs__tab:hover {
  color: var(--text);
}

.tabs__tab.is-active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  font-weight: 600;
}

.panel {
  display: none;
}

.panel.is-active {
  display: block;
}

.panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel__head h2 {
  font-size: 17px;
}

.admin__error {
  color: var(--danger);
  font-size: 14px;
  margin-bottom: 12px;
}

/* ---------- List items ---------- */

.list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.list__empty {
  color: var(--text-muted);
  padding: 24px 0;
  text-align: center;
}

.list-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.list-item__main {
  flex: 1;
  min-width: 0;
}

.list-item__main h4 {
  font-size: 15px;
  margin-bottom: 4px;
}

.list-item__main p {
  color: var(--text-muted);
  font-size: 13px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.list-item__meta {
  display: inline-block;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.list-item__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ---------- Forms & dialogs ---------- */

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

.field span {
  font-size: 13px;
  color: var(--text-muted);
}

.field .field__hint {
  font-size: 12px;
  color: var(--text-muted);
}

.field input,
.field textarea {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--primary);
}

.profile-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 520px;
}

.profile-form .btn {
  align-self: flex-start;
}

.dialog {
  border: none;
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  padding: 0;
  width: min(560px, calc(100vw - 40px));
}

.dialog--wide {
  width: min(720px, calc(100vw - 40px));
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.dialog form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 28px;
}

.dialog h3 {
  font-size: 18px;
}

.dialog__actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 20px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 100;
  box-shadow: var(--shadow);
}

@media (max-width: 560px) {
  .admin__header {
    flex-direction: column;
    align-items: flex-start;
  }
}
