* { box-sizing: border-box; }
html,
body.dbadmin-body {
  height: 100%;
  max-height: 100vh;
  max-height: 100dvh;
}
body.dbadmin-body {
  margin: 0;
  padding: 0;
  overflow: hidden;
  font: 14px/1.5 "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: #1a1410;
  color: #f5efe6;
  scrollbar-width: thin;
  scrollbar-color: rgba(196, 165, 116, 0.45) rgba(26, 20, 16, 0.35);
}

body.dbadmin-body ::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

body.dbadmin-body ::-webkit-scrollbar-track {
  background: rgba(26, 20, 16, 0.35);
  border-radius: 999px;
}

body.dbadmin-body ::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(107, 78, 53, 0.95), rgba(139, 69, 24, 0.85));
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
  cursor: pointer;
}

body.dbadmin-body ::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(180deg, rgba(196, 165, 116, 0.95), rgba(139, 69, 24, 0.95));
  background-clip: padding-box;
  cursor: pointer;
}

body.dbadmin-body ::-webkit-scrollbar-thumb:active {
  background: linear-gradient(180deg, rgba(240, 210, 168, 0.95), rgba(160, 90, 44, 0.95));
  background-clip: padding-box;
  cursor: grabbing;
}

body.dbadmin-body ::-webkit-scrollbar-corner {
  background: transparent;
}

.login-wrap {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at top, #3d2a1c 0%, #1a1410 60%);
}
.login-card {
  width: 380px;
  padding: 36px 32px;
  background: #2a211a;
  border: 1px solid #6b4e35;
  border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0,0,0,.35);
}
.login-card h1 {
  margin: 0 0 8px;
  font-size: 22px;
  color: #f0d2a8;
}
.hint { margin: 0 0 12px; color: #a89078; font-size: 13px; }
.login-card label { display: block; margin-bottom: 8px; margin-top: 8px; color: #d4c0a8; }
.login-card input,
.modal input,
.modal textarea,
.modal select,
#keyword {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #6b4e35;
  border-radius: 8px;
  background: #1a1410;
  color: #f5efe6;
  outline: none;
}
.login-card input:focus,
.modal input:focus,
.modal textarea:focus,
.modal select:focus,
#keyword:focus { border-color: #c4a574; }
.captcha-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 4px;
}
.captcha-row input { flex: 1; margin-bottom: 0; }
.captcha-img {
  height: 38px;
  border-radius: 8px;
  border: 1px solid #6b4e35;
  cursor: pointer;
  background: #fff;
}
#loginBtn,
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid #6b4e35;
  background: #3d2a1c;
  color: #f5efe6;
  cursor: pointer;
  user-select: none;
  transition: background-color .12s ease, border-color .12s ease, transform .1s ease, filter .12s ease, box-shadow .12s ease;
}
#loginBtn:hover,
.btn:hover:not(.link):not(:disabled) {
  filter: brightness(1.12);
}
#loginBtn:active,
.btn:active:not(.link):not(:disabled) {
  transform: translateY(1px) scale(0.96);
  filter: brightness(0.9);
  box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.4);
}
.btn:disabled {
  opacity: 0.55;
  cursor: default;
}
#loginBtn {
  width: 100%;
  margin-top: 16px;
  padding: 12px;
  background: #8b4518;
  border-color: #a05a2c;
  font-weight: 600;
}
.btn.primary { background: #8b4518; border-color: #a05a2c; }
.btn.ghost { background: transparent; }
.btn.danger { background: #7a1f14; border-color: #a03a2b; }
.btn.link {
  background: transparent;
  border: none;
  color: #7eb6ff;
  padding: 0 8px 0 0;
}
.btn.link.danger-text { color: #ff8a7a; }
.btn.link:hover { filter: brightness(1.15); }
.btn.link:active { filter: brightness(0.85); }
.err { color: #ff8a7a; margin-top: 12px; }

.console {
  height: 100%;
  max-height: 100vh;
  max-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  background: #241c16;
  border-bottom: 1px solid #6b4e35;
  flex-shrink: 0;
}
.brand { font-size: 18px; font-weight: 700; color: #f0d2a8; }
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.db-switch {
  display: inline-flex;
  border: 1px solid #6b4e35;
  border-radius: 8px;
  overflow: hidden;
  background: #1a1410;
}
.db-switch-btn {
  flex: 1 1 0;
  min-width: 72px;
  padding: 7px 14px;
  border: none;
  background: transparent;
  color: #d4c0a8;
  cursor: pointer;
  font: inherit;
  line-height: 1.2;
  text-align: center;
  user-select: none;
  transition: background-color .12s ease, color .12s ease, filter .12s ease;
}
.db-switch-btn + .db-switch-btn {
  border-left: 1px solid #6b4e35;
}
.db-switch-btn:hover { background: #2a211a; color: #f5efe6; }
.db-switch-btn:active { filter: brightness(0.88); }
.db-switch-btn.active {
  background: #8b4518;
  color: #fff;
  font-weight: 600;
}
.db-switch-btn.active:active { filter: brightness(0.92); }
.layout {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}
.sidebar {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
  border-right: 1px solid #6b4e35;
  background: #201810;
  padding: 16px 12px;
}
.sidebar h2 {
  margin: 0 0 12px;
  font-size: 13px;
  color: #a89078;
  font-weight: 600;
  flex-shrink: 0;
}
#collectionList {
  list-style: none;
  margin: 0;
  padding: 0 4px 0 0;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-gutter: stable;
}
.nav-item {
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  margin-bottom: 6px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #e8dcc8;
  cursor: pointer;
}
.nav-item:hover { background: #2a211a; }
.nav-item.active {
  background: #3d2a1c;
  border-color: #6b4e35;
  color: #f0d2a8;
}
.main {
  flex: 1;
  min-width: 0;
  min-height: 0;
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.main-header {
  flex-shrink: 0;
}
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.toolbar-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
}
#keyword { max-width: 280px; }
.meta { display: flex; gap: 16px; margin-bottom: 10px; color: #a89078; }
.table-wrap {
  flex: 1;
  min-height: 0;
  border: 1px solid #6b4e35;
  border-radius: 10px;
  overflow: auto;
  background: #201810;
  scrollbar-gutter: stable;
}
table#dataTable {
  width: max-content;
  min-width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: auto;
}
#dataTable th,
#dataTable td {
  padding: 10px 12px;
  border-bottom: 1px solid #3d2a1c;
  text-align: left;
  white-space: nowrap;
  vertical-align: middle;
}
#dataTable th {
  background: #2a211a;
  color: #f0d2a8;
  font-weight: 600;
  position: sticky;
  top: 0;
  z-index: 1;
}
#dataTable td.empty { text-align: center; color: #a89078; padding: 28px; }
#dataTable th.ops,
#dataTable td.ops {
  position: sticky;
  right: 0;
  white-space: nowrap;
  box-shadow: -8px 0 10px -6px rgba(0, 0, 0, 0.45);
  border-left: 1px solid #6b4e35;
}
#dataTable th.ops {
  top: 0;
  z-index: 3;
  background: #2a211a;
}
#dataTable td.ops {
  z-index: 2;
  background: #201810;
}
.pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  flex-shrink: 0;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 20px;
}
.modal-card {
  width: min(720px, 100%);
  background: #2a211a;
  border: 1px solid #6b4e35;
  border-radius: 12px;
  padding: 20px;
}
.modal-card.sm { width: min(400px, 100%); }
.modal-card h3 { margin: 0 0 8px; color: #f0d2a8; }
.modal textarea {
  font-family: Consolas, "Courier New", monospace;
  font-size: 13px;
  resize: vertical;
  margin: 10px 0;
}
.modal-pwd { margin: 12px 0; }
.modal-pwd label { display: block; margin-bottom: 6px; color: #d4c0a8; }
.transfer-field { margin: 12px 0; }
.transfer-field label { display: block; margin-bottom: 6px; color: #d4c0a8; }
.transfer-field select { width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
