/* 保证 JS 通过 hidden 属性控制显隐时，不被下面的 display 规则覆盖 */
[hidden] {
  display: none !important;
}

.admin-body {
  background: var(--background);
}

/* 登录 */
.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  padding: 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(24, 39, 75, .06);
}

.login-brand { margin: 0 0 6px; font-size: 19px; font-weight: 700; text-align: center; }

.login-card input {
  height: 44px;
  padding: 0 14px;
  border: 1px solid #dfe3e9;
  border-radius: 8px;
  outline: none;
}

.login-card input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36, 104, 229, .09); }

.login-btn {
  height: 44px;
  color: #fff;
  background: var(--primary);
  border: 0;
  border-radius: 8px;
  font-weight: 600;
}

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

.login-error { min-height: 18px; margin: 0; color: #d64545; font-size: 13px; text-align: center; }

/* 管理视图 */
.admin-view {
  min-height: 100vh;
  width: 100%;
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

.admin-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 0;
  margin-bottom: 8px;
}

.admin-header h1 { margin: 0; font-size: 20px; font-weight: 700; }

.admin-header-actions { display: flex; gap: 10px; }

.ghost-btn {
  padding: 8px 14px;
  color: #555c68;
  background: var(--white);
  border: 1px solid #dfe3e9;
  border-radius: 7px;
  text-decoration: none;
  cursor: pointer;
}

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

.primary-btn {
  padding: 8px 14px;
  color: #fff;
  background: var(--primary);
  border: 0;
  border-radius: 7px;
  font-weight: 500;
  cursor: pointer;
}

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

.admin-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.panel {
  min-width: 0;
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.panel-head h2 { margin: 0; font-size: 16px; font-weight: 600; }

.admin-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.admin-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid #edf0f4;
  border-radius: 8px;
}

.admin-item-main { flex: 1; min-width: 0; }

.admin-item-title { font-weight: 600; color: var(--text); }

.admin-item-sub {
  margin-top: 2px;
  font-size: 12px;
  color: #8a919c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-item-actions { display: flex; gap: 6px; flex-shrink: 0; }

.mini-btn {
  padding: 5px 10px;
  font-size: 12px;
  color: #555c68;
  background: var(--white);
  border: 1px solid #dfe3e9;
  border-radius: 6px;
  cursor: pointer;
}

.mini-btn:hover { color: var(--primary); border-color: var(--primary); }

.mini-btn.danger:hover { color: #d64545; border-color: #d64545; }

/* 弹窗 */
.modal {
  position: fixed;
  z-index: 200;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(28, 33, 41, .45);
}

.modal-card {
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px;
  background: var(--white);
  border-radius: 12px;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.modal-head h3 { margin: 0; font-size: 17px; font-weight: 600; }

.modal-close {
  width: 30px;
  height: 30px;
  color: #8d95a1;
  background: transparent;
  border: 0;
  border-radius: 6px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.modal-close:hover { background: #f0f2f5; }

.modal-form { display: flex; flex-direction: column; gap: 14px; }

.modal-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: #4f5967; }

.modal-form input,
.modal-form select,
.modal-form textarea {
  width: 100%;
  padding: 9px 12px;
  font: inherit;
  color: var(--text);
  background: var(--white);
  border: 1px solid #dfe3e9;
  border-radius: 7px;
  outline: none;
}

.modal-form input:focus,
.modal-form select:focus,
.modal-form textarea:focus { border-color: var(--primary); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.icon-row { display: flex; gap: 8px; }

.icon-row input { flex: 1; }

.icon-row .ghost-btn { flex-shrink: 0; }

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

@media (max-width: 800px) {
  .admin-view { padding: 0 16px 32px; }
  .admin-layout { grid-template-columns: minmax(0, 1fr); }
  .form-row { grid-template-columns: 1fr; }
}
