[hidden] { display: none !important; }
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
  background: #f5f6f8;
  color: #1f2328;
  font-size: 14px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
}
.top h1 { font-size: 18px; margin: 0; display: flex; align-items: center; gap: 10px; }
.top h1 .brand-logo { height: 42px; width: auto; display: block; }

.site-footer {
  text-align: center;
  padding: 18px 24px 24px;
  color: #6b7280;
  font-size: 12px;
  border-top: 1px solid #e5e7eb;
  margin-top: 30px;
  background: #fff;
}
.top-actions { display: flex; align-items: center; gap: 12px; }
.btn-link {
  color: #2563eb;
  text-decoration: none;
  font-size: 13px;
  padding: 6px 12px;
  border: 1px solid #bfdbfe;
  border-radius: 6px;
  background: #eff6ff;
}
.btn-link:hover { background: #dbeafe; }

main { padding: 20px; max-width: 1200px; margin: 0 auto; }

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
}
.card h2 { margin: 0 0 16px; font-size: 16px; }

form label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #4b5563;
}
form input {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
}
form input:focus { border-color: #3b82f6; }

.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px 20px;
}
.row-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 14px;
}

button {
  padding: 8px 16px;
  border: 0;
  border-radius: 6px;
  background: #2563eb;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
button:hover:not(:disabled) { background: #1d4ed8; }
button:disabled { opacity: 0.6; cursor: not-allowed; }
button.ghost {
  background: transparent;
  color: #4b5563;
  border: 1px solid #d1d5db;
}
button.ghost:hover:not(:disabled) { background: #f3f4f6; }
button.danger {
  background: transparent;
  color: #b91c1c;
  border: 1px solid #fecaca;
  padding: 4px 10px;
  font-size: 12px;
}
button.danger:hover:not(:disabled) { background: #fef2f2; }

.err { color: #b91c1c; min-height: 1em; margin: 8px 0 0; }
.muted { color: #6b7280; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #f0f1f3;
  vertical-align: middle;
}
th { color: #6b7280; font-weight: 500; background: #fafbfc; }
td.mono { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 12px; }

.secret {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  user-select: none;
}
.secret .value { font-family: ui-monospace, "SF Mono", Consolas, monospace; }
.secret .hint { font-size: 11px; color: #9ca3af; }

body.login-mode .top { display: none; }
body.login-mode { background: #030a10; }
body.login-mode main { padding: 0; max-width: none; }

#login-view {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-top: 0;
  padding: 32px 16px 48px;
  background: #030a10;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}
.login-cover {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-cover img {
  max-width: min(360px, 80%);
  width: auto;
  height: auto;
  object-fit: contain;
  display: block;
}
.login-box {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f3f4f6;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}
.login-box h2 { color: #f9fafb; }
.login-box form label { color: #d1d5db; }
.login-box form input {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.25);
  color: #f9fafb;
}
.login-box form input::placeholder { color: rgba(243, 244, 246, 0.5); }
.login-box form input:focus { border-color: #93c5fd; background: rgba(255, 255, 255, 0.14); }
#login-view form { display: flex; flex-direction: column; gap: 12px; }
.captcha-row { display: flex; gap: 10px; align-items: center; }
.captcha-row input { flex: 1; }
.captcha-row img {
  height: 40px;
  width: 130px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #f3f4f6;
  cursor: pointer;
  user-select: none;
}

#form-status { color: #6b7280; font-size: 13px; }

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  background: #111827;
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
  z-index: 100;
}
.toast.show { opacity: 1; }

.row-actions-cell { white-space: nowrap; }
.row-actions-cell button { padding: 4px 10px; font-size: 12px; margin-right: 4px; }
.row-actions-cell button:last-child { margin-right: 0; }
tr.editing { background: #fffbeb; }
.edit-input {
  width: 100%;
  padding: 4px 8px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 12px;
  border: 1px solid #f59e0b;
  border-radius: 4px;
  outline: none;
}

.modal-mask {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.modal {
  background: #fff;
  border-radius: 8px;
  padding: 20px 22px;
  width: min(480px, 92vw);
  box-shadow: 0 20px 50px rgba(0,0,0,0.25);
}
.modal h3 { margin: 0 0 14px; font-size: 16px; }
.modal-field { display: block; margin-bottom: 12px; font-size: 13px; color: #374151; }
.modal-field input {
  display: block; width: 100%; margin-top: 4px;
  padding: 6px 10px; font-size: 13px;
  border: 1px solid #d1d5db; border-radius: 4px;
  font-family: ui-monospace, "SF Mono", Consolas, monospace;
  box-sizing: border-box;
}
.modal-field input:focus { outline: none; border-color: #2563eb; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
