:root {
  --page-bg: #f5f7fa;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #d9e0ea;
  --primary: #1f6f78;
  --primary-strong: #155b63;
  --danger: #b42318;
  --danger-bg: #fff1f0;
  --success: #067647;
  --success-bg: #ecfdf3;
  --shadow: 0 18px 42px rgba(31, 41, 55, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--page-bg);
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(31, 111, 120, 0.12), transparent 38%),
    linear-gradient(180deg, #f8fbfc 0%, #eef3f5 100%);
}

.auth-shell {
  width: min(420px, 100%);
}

.auth-panel {
  width: 100%;
  padding: 28px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-brand {
  margin-bottom: 22px;
}

.auth-brand h1,
.admin-topbar h1,
.admin-section h2 {
  margin: 0;
  letter-spacing: 0;
}

.auth-brand h1 {
  font-size: 28px;
}

.auth-brand p,
.admin-topbar p,
.admin-section__head p {
  margin: 6px 0 0;
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label {
  display: grid;
  gap: 7px;
  font-size: 14px;
  font-weight: 700;
}

.auth-form input {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

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

.password-toggle {
  position: absolute;
  top: 50%;
  right: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: #6b7280;
  cursor: pointer;
  transform: translateY(-50%);
}

.password-toggle svg {
  width: 18px;
  height: 18px;
  display: block;
}

.password-toggle.is-visible {
  color: var(--primary);
}

.primary-btn,
.table-button,
.table-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 6px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}

.primary-btn {
  min-height: 46px;
  background: var(--primary);
  color: #fff;
}

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

.table-button,
.table-action {
  background: #fff;
  border-color: var(--line);
  color: var(--text);
}

.auth-links {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
}

.auth-links a,
.admin-topbar a {
  color: var(--primary);
  font-weight: 700;
  text-decoration: none;
}

.notice {
  margin-bottom: 14px;
  padding: 11px 12px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 700;
}

.notice--error {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #f4c7c3;
}

.notice--success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #abefc6;
}

.admin-page {
  min-height: 100vh;
}

.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.96);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(10px);
}

.admin-topbar h1 {
  font-size: 22px;
}

.admin-topbar nav {
  display: flex;
  gap: 16px;
  white-space: nowrap;
}

.admin-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 20px auto 36px;
  display: grid;
  gap: 18px;
}

.admin-section {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.admin-section__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.admin-section h2 {
  font-size: 19px;
}

.admin-table-wrap {
  overflow-x: auto;
}

.admin-search-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.admin-search-form {
  display: flex;
  gap: 12px;
  align-items: center;
}

.admin-search-input {
  flex: 1 1 auto;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
  font: inherit;
}

.admin-lookup-card {
  display: grid;
  gap: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.admin-lookup-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}

.admin-lookup-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.admin-lookup-actions {
  justify-content: flex-start;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.admin-table th,
.admin-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

.admin-table th {
  color: #374151;
  background: #f8fafc;
  font-weight: 800;
}

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

.admin-actions form {
  margin: 0;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.status--ok {
  background: var(--success-bg);
  color: var(--success);
}

.status--danger {
  background: var(--danger-bg);
  color: var(--danger);
}

.code-cell {
  font-family: Consolas, "SFMono-Regular", monospace;
  font-weight: 800;
  letter-spacing: 0;
}

@media (max-width: 720px) {
  .auth-page {
    padding: 16px;
  }

  .auth-panel {
    padding: 22px;
  }

  .admin-topbar,
  .admin-section__head {
    align-items: flex-start;
    flex-direction: column;
  }

  .admin-shell {
    width: calc(100% - 20px);
    margin-top: 10px;
  }

  .admin-search-form {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-lookup-grid {
    grid-template-columns: 1fr;
  }
}
