/* ============================================
   {{__SITE_N__}} - 主站前端样式
   黑蓝白商务风格
   ============================================ */

/* ---------- CSS Variables ---------- */
:root {
  --primary-dark: #0a1628;
  --primary-deep: #0d1b3e;
  --primary-blue: #1a73e8;
  --primary-light: #2196f3;
  --primary-lighter: #64b5f6;
  --accent-gradient: linear-gradient(135deg, #1a73e8, #2196f3);
  --accent-gradient-hover: linear-gradient(135deg, #1557b0, #1a73e8);
  --white: #ffffff;
  --gray-50: #f8f9fa;
  --gray-100: #f0f2f5;
  --gray-200: #e8ecf1;
  --gray-300: #d4d9e0;
  --gray-400: #b0b8c4;
  --gray-500: #8c94a0;
  --gray-600: #6c757d;
  --gray-700: #495057;
  --gray-800: #343a40;
  --gray-900: #1a1a2e;
  --success: #28a745;
  --warning: #ffc107;
  --danger: #dc3545;
  --info: #17a2b8;
  --shadow-sm: 0 2px 8px rgba(10, 22, 40, 0.06);
  --shadow-md: 0 4px 20px rgba(10, 22, 40, 0.10);
  --shadow-lg: 0 8px 40px rgba(10, 22, 40, 0.14);
  --shadow-blue: 0 4px 16px rgba(26, 115, 232, 0.30);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  --transition: all 0.25s ease;
  --transition-slow: all 0.4s ease;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-family);
  background: var(--gray-100);
  color: var(--gray-800);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

a {
  color: var(--primary-blue);
  text-decoration: none;
  transition: var(--transition);
}
a:hover {
  color: var(--primary-light);
  text-decoration: none;
}

ul, ol {
  list-style: none;
}

img {
  max-width: 100%;
  height: auto;
}

/* ---------- Custom Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-track {
  background: var(--gray-100);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb {
  background: var(--gray-400);
  border-radius: 3px;
  transition: var(--transition);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--gray-500);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--gray-400) var(--gray-100);
}

/* ---------- Utility ---------- */
.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
}

.flex-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.flex-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.text-center { text-align: center; }
.text-right { text-align: right; }
.text-muted { color: var(--gray-500); }
.text-primary { color: var(--primary-blue); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: var(--warning); }

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  white-space: nowrap;
  outline: none;
  text-decoration: none;
  position: relative;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
/* Button loading state */
.btn-loading .btn-text {
  visibility: hidden;
}
.btn-loading .btn-loader {
  display: inline-flex !important;
}
.btn-loader {
  display: none;
  align-items: center;
  justify-content: center;
  position: absolute;
}
.btn-loader svg {
  animation: btn-spin 0.8s linear infinite;
}
@keyframes btn-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Button click feedback */
.btn:active:not(:disabled) {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent-gradient);
  color: var(--white);
  box-shadow: 0 4px 16px rgba(26, 115, 232, 0.30);
}
.btn-primary:hover:not(:disabled) {
  background: var(--accent-gradient-hover);
  box-shadow: 0 8px 28px rgba(26, 115, 232, 0.45);
  transform: translateY(-2px);
  color: var(--white);
}

.btn-outline {
  background: transparent;
  color: var(--primary-blue);
  border: 2px solid var(--primary-blue);
}
.btn-outline:hover:not(:disabled) {
  background: var(--primary-blue);
  color: var(--white);
}

.btn-danger {
  background: linear-gradient(135deg, #dc3545, #e74c3c);
  color: var(--white);
}
.btn-danger:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(220, 53, 69, 0.40);
  transform: translateY(-2px);
}

.btn-success {
  background: linear-gradient(135deg, #28a745, #34d058);
  color: var(--white);
}

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

.btn-lg {
  padding: 14px 32px;
  font-size: 16px;
  border-radius: var(--radius-md);
}

.btn-block {
  width: 100%;
  padding: 14px 24px;
  font-size: 15px;
}

.btn-ghost {
  background: transparent;
  color: var(--gray-600);
  border: 1px solid var(--gray-300);
}
.btn-ghost:hover:not(:disabled) {
  background: var(--gray-100);
  color: var(--gray-800);
}

/* ---------- Form Elements ---------- */
.form-group {
  margin-bottom: 24px;
}

.form-label {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-800);
  letter-spacing: 0.3px;
}

/* ---------- Input Wrapper (icon + input) ---------- */
.form-input-wrapper,
.input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.form-input-wrapper .input-icon,
.input-wrapper .input-icon {
  position: absolute;
  left: 16px;
  color: var(--gray-500);
  font-size: 18px;
  pointer-events: none;
  z-index: 1;
  transition: var(--transition);
}

/* Icon color change when input is focused */
.form-input-wrapper:focus-within .input-icon,
.input-wrapper:focus-within .input-icon {
  color: var(--primary-blue);
}

/* ---------- Toggle Password Button ---------- */
.toggle-password {
  position: absolute;
  right: 14px;
  background: none;
  border: none;
  color: var(--gray-500);
  font-size: 18px;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  z-index: 1;
}
.toggle-password:hover {
  color: var(--gray-700);
  background: var(--gray-100);
}

/* ---------- Text Input ---------- */
.form-input {
  width: 100%;
  padding: 14px 16px 14px 46px;
  font-size: 15px;
  font-family: var(--font-family);
  color: var(--gray-800);
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  outline: none;
  transition: var(--transition);
}
.form-input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.10), 0 2px 8px rgba(26, 115, 232, 0.06);
}
.form-input::placeholder {
  color: var(--gray-400);
  font-size: 14px;
}
.form-input.error {
  border-color: var(--danger);
  background: rgba(220, 53, 69, 0.02);
}
.form-input.error:focus {
  box-shadow: 0 0 0 4px rgba(220, 53, 69, 0.10);
}

.form-input.no-icon {
  padding-left: 16px;
}

.form-hint {
  margin-top: 6px;
  font-size: 13px;
  color: var(--gray-500);
}
.form-hint.error {
  color: var(--danger);
}

select.form-input {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%236c757d' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

textarea.form-input {
  resize: vertical;
  min-height: 100px;
  padding-top: 14px;
}

/* ---------- Form Options (remember me + forgot password) ---------- */
.form-options {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 4px 0 20px;
  gap: 12px;
}

/* Custom Checkbox */
.checkbox-label {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--gray-700);
  user-select: none;
  position: relative;
}
.checkbox-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.checkbox-custom {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-300);
  border-radius: 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
  background: var(--white);
}
.checkbox-input:checked + .checkbox-custom {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
}
.checkbox-input:checked + .checkbox-custom::after {
  content: '';
  width: 6px;
  height: 10px;
  border: solid var(--white);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-top: -2px;
}
.checkbox-input:focus-visible + .checkbox-custom {
  box-shadow: 0 0 0 4px rgba(26, 115, 232, 0.15);
}
.checkbox-label:hover .checkbox-custom {
  border-color: var(--primary-blue);
}

/* Forgot password link */
.link-forgot {
  font-size: 13px;
  color: var(--primary-blue);
  text-decoration: none;
  font-weight: 500;
  transition: var(--transition);
  white-space: nowrap;
}
.link-forgot:hover {
  color: #1557b0;
  text-decoration: underline;
}

/* ---------- Custom Checkbox (alternative) ---------- */
.form-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  color: var(--gray-700);
  user-select: none;
}
.form-checkbox input[type="checkbox"] {
  display: none;
}
.form-checkbox .checkmark {
  width: 20px;
  height: 20px;
  border: 2px solid var(--gray-300);
  border-radius: 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition);
  background: var(--white);
}
.form-checkbox .checkmark::after {
  content: '✓';
  font-size: 13px;
  font-weight: 700;
  color: var(--white);
  opacity: 0;
  transform: scale(0.5);
  transition: var(--transition);
}
.form-checkbox input[type="checkbox"]:checked + .checkmark {
  background: var(--primary-blue);
  border-color: var(--primary-blue);
}
.form-checkbox input[type="checkbox"]:checked + .checkmark::after {
  opacity: 1;
  transform: scale(1);
}
.form-checkbox:hover .checkmark {
  border-color: var(--primary-blue);
}
.form-checkbox input[type="checkbox"]:focus-visible + .checkmark {
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.15);
}

/* ---------- Form Row (Two Columns) ---------- */
.form-row {
  display: flex;
  gap: 16px;
  margin-bottom: 0;
}
.form-group-half {
  flex: 1;
  min-width: 0;
}

/* Input with appended button (e.g. send code) */
.input-group-append {
  display: flex;
  gap: 0;
}
.input-group-append .form-input {
  border-radius: 10px 0 0 10px;
  border-right: none;
}
.input-group-append .btn-send-code {
  border-radius: 0 10px 10px 0;
  padding: 12px 16px;
  font-size: 14px;
  white-space: nowrap;
  min-width: 105px;
  border: 2px solid var(--primary-blue);
  border-left: none;
  background: transparent;
  color: var(--primary-blue);
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1.4;
}
.input-group-append .btn-send-code:hover:not(:disabled) {
  background: var(--primary-blue);
  color: var(--white);
}
.input-group-append .btn-send-code:disabled,
.input-group-append .btn-send-code.btn-disabled {
  border-color: var(--gray-300);
  color: var(--gray-400);
  background: var(--gray-50);
  cursor: not-allowed;
}

/* Field hint text */
.field-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--gray-500);
}

/* Form agreement */
.form-agreement {
  margin-top: 16px;
  font-size: 13px;
  color: var(--gray-600);
}

/* ---------- Email Verification Box ---------- */
.verify-group {
  margin-bottom: 20px;
}
.verify-box {
  background: var(--gray-50);
  border: 1px solid var(--gray-200);
  border-radius: 12px;
  padding: 16px;
  transition: var(--transition);
}
.verify-box:focus-within {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.06);
}

.verify-row {
  display: flex;
  gap: 10px;
  margin-bottom: 12px;
}
.verify-email-wrap {
  flex: 1;
  min-width: 0;
}
.verify-email-wrap .form-input {
  padding-left: 44px;
}

.btn-send-verify {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 20px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  background: var(--accent-gradient);
  color: var(--white);
  box-shadow: var(--shadow-blue);
  transition: var(--transition);
  min-width: 120px;
  flex-shrink: 0;
}
.btn-send-verify:hover:not(:disabled) {
  box-shadow: 0 6px 20px rgba(26, 115, 232, 0.40);
  transform: translateY(-1px);
}
.btn-send-verify:active:not(:disabled) {
  transform: scale(0.97);
}
.btn-send-verify:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.btn-send-verify.counting {
  background: linear-gradient(135deg, #6c757d, #868e96);
  box-shadow: none;
}
.btn-send-verify.counting:hover {
  transform: none;
  box-shadow: none;
}
.send-loading {
  display: inline-flex;
  align-items: center;
}
.send-loading svg {
  animation: spin 1s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.verify-code-row {
  display: flex;
  gap: 12px;
  align-items: center;
}
.verify-code-row .input-wrapper {
  flex: 1;
  min-width: 0;
}
.verify-code-row .form-input {
  letter-spacing: 4px;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
  padding-left: 44px;
}

.verify-status {
  flex-shrink: 0;
  min-width: 100px;
  font-size: 13px;
}
.verify-status .status-idle {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--gray-500);
}
.verify-status .status-success {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--success);
  font-weight: 500;
}
.verify-status .status-error {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--danger);
  font-weight: 500;
}

@media (max-width: 480px) {
  .verify-box {
    padding: 12px;
  }
  .verify-row {
    flex-direction: column;
    gap: 8px;
  }
  .btn-send-verify {
    width: 100%;
    padding: 12px;
    min-width: auto;
  }
  .verify-code-row {
    flex-direction: column;
    gap: 8px;
  }
  .verify-status {
    width: 100%;
    text-align: center;
    min-width: auto;
  }
}
.form-agreement .link {
  color: var(--primary-blue);
  text-decoration: none;
}
.form-agreement .link:hover {
  text-decoration: underline;
}

/* ---------- Alert / Message ---------- */
.alert {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 20px;
  animation: alertSlideIn 0.35s ease;
}
.alert .alert-icon {
  font-size: 20px;
  flex-shrink: 0;
  margin-top: 1px;
}
.alert .alert-content {
  flex: 1;
}
.alert .alert-close {
  background: none;
  border: none;
  color: inherit;
  opacity: 0.5;
  cursor: pointer;
  padding: 2px;
  font-size: 16px;
  flex-shrink: 0;
  transition: var(--transition);
}
.alert .alert-close:hover {
  opacity: 1;
}

.alert-info {
  background: rgba(26, 115, 232, 0.08);
  color: var(--primary-blue);
  border: 1px solid rgba(26, 115, 232, 0.15);
}
.alert-success {
  background: rgba(40, 167, 69, 0.08);
  color: #1e7e34;
  border: 1px solid rgba(40, 167, 69, 0.15);
}
.alert-warning {
  background: rgba(255, 193, 7, 0.10);
  color: #856404;
  border: 1px solid rgba(255, 193, 7, 0.20);
}
.alert-danger {
  background: rgba(220, 53, 69, 0.08);
  color: #a71d2a;
  border: 1px solid rgba(220, 53, 69, 0.15);
}

@keyframes alertSlideIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Card ---------- */
.card {
  background: var(--white);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.card:hover {
  box-shadow: var(--shadow-md);
}
.card-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-200);
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-dark);
}
.card-body {
  padding: 24px;
}
.card-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--gray-200);
  background: var(--gray-50);
  border-radius: 0 0 var(--radius-md) var(--radius-md);
}

/* ---------- Modal / Dialog ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 22, 40, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  opacity: 0;
  visibility: hidden;
  transition: var(--transition);
}
.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 90%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(30px) scale(0.96);
  transition: var(--transition-slow);
}
.modal-overlay.active .modal {
  transform: translateY(0) scale(1);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-200);
}
.modal-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
}

.modal-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--gray-100);
  border-radius: 50%;
  cursor: pointer;
  font-size: 18px;
  color: var(--gray-600);
  transition: var(--transition);
}
.modal-close:hover {
  background: var(--gray-200);
  color: var(--gray-800);
}

.modal-body {
  padding: 24px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--gray-200);
}

.modal-lg {
  max-width: 640px;
}
.modal-sm {
  max-width: 360px;
}

/* ---------- Login / Register Page ---------- */
/* Light, clean authentication background with subtle gradient */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #f5f7fa 0%, #eef1f6 40%, #e8ecf1 100%);
  padding: 24px;
  position: relative;
  overflow: hidden;
}

/* Subtle decorative mesh background shapes */
.auth-page::before {
  content: '';
  position: absolute;
  top: -25%;
  right: -15%;
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, rgba(26, 115, 232, 0.06) 0%, transparent 60%);
  border-radius: 50%;
  pointer-events: none;
}

.auth-page::after {
  content: '';
  position: absolute;
  bottom: -25%;
  left: -15%;
  width: 500px;
  height: 500px;
  background: radial-gradient(circle, rgba(33, 150, 243, 0.05) 0%, transparent 55%);
  border-radius: 50%;
  pointer-events: none;
}

/* Extra decorative dot pattern (subtle) */
.auth-page .bg-dots {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-image: radial-gradient(rgba(26, 115, 232, 0.03) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
}

.auth-container {
  width: 100%;
  max-width: 420px;
  position: relative;
  z-index: 1;
}

/* ---------- Brand Area (dark text on light background) ---------- */
.auth-brand {
  text-align: center;
  margin-bottom: 32px;
}

.auth-brand .brand-logo {
  width: 72px;
  height: 72px;
  margin: 0 auto 16px;
  background: var(--white);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(10, 22, 40, 0.08);
  border: 1px solid var(--gray-200);
}
.auth-brand .brand-logo span {
  font-size: 32px;
  font-weight: 800;
  color: var(--primary-blue);
}

.auth-brand h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 6px;
  letter-spacing: -0.5px;
}
.auth-brand p {
  font-size: 14px;
  color: var(--gray-500);
}

/* ---------- Auth Card with top accent bar ---------- */
.auth-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: 0 2px 12px rgba(10, 22, 40, 0.05), 0 8px 40px rgba(10, 22, 40, 0.07);
  padding: 40px 36px 36px;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(4px);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Wider variant for registration page */
.auth-card-wide {
  max-width: 520px;
}

/* Top accent decorative bar */
.auth-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 36px;
  right: 36px;
  height: 4px;
  background: var(--accent-gradient);
  border-radius: 0 0 4px 4px;
}

/* Subtle card hover / focus-within lift */
.auth-card:focus-within {
  transform: translateY(-3px);
  box-shadow: 0 4px 24px rgba(10, 22, 40, 0.08), 0 16px 56px rgba(10, 22, 40, 0.10);
}

.auth-card .auth-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-dark);
  margin-bottom: 4px;
}
.auth-card .auth-subtitle {
  font-size: 14px;
  color: var(--gray-500);
  margin-bottom: 28px;
}

/* ---------- Divider ---------- */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 24px 0;
  color: var(--gray-400);
  font-size: 13px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gray-200);
}

/* ---------- Footer Links ---------- */
.auth-footer {
  text-align: center;
  margin-top: 20px;
  font-size: 14px;
  color: var(--gray-500);
}
.auth-footer a {
  color: var(--primary-blue);
  font-weight: 600;
  text-decoration: none;
  transition: var(--transition);
}
.auth-footer a:hover {
  color: var(--primary-light);
  text-decoration: underline;
}

/* ---------- Chat Layout ---------- */
.chat-layout {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Sidebar - Conversation List */
.chat-sidebar {
  width: 320px;
  min-width: 320px;
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.chat-sidebar-header {
  padding: 20px 16px 12px;
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
}

.chat-sidebar-header .sidebar-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.chat-sidebar-header .sidebar-title h2 {
  font-size: 18px;
  font-weight: 700;
  color: var(--primary-dark);
}

.chat-sidebar-header .sidebar-actions {
  display: flex;
  gap: 8px;
}

.chat-search {
  position: relative;
}
.chat-search .search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--gray-400);
  font-size: 16px;
}
.chat-search input {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: none;
  background: var(--gray-100);
  border-radius: var(--radius-sm);
  font-size: 14px;
  outline: none;
  transition: var(--transition);
  font-family: var(--font-family);
}
.chat-search input:focus {
  background: var(--gray-200);
}
.chat-search input::placeholder {
  color: var(--gray-400);
}

.chat-conversations {
  flex: 1;
  overflow-y: auto;
  padding: 8px 0;
}

.conversation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}
.conversation-item:hover {
  background: var(--gray-50);
}
.conversation-item.active {
  background: rgba(26, 115, 232, 0.06);
}
.conversation-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--primary-blue);
  border-radius: 0 3px 3px 0;
}

.conversation-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: var(--white);
  background: var(--accent-gradient);
  overflow: hidden;
  position: relative;
}
.conversation-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.conversation-avatar .online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 12px;
  height: 12px;
  background: var(--success);
  border: 2px solid var(--white);
  border-radius: 50%;
}

.conversation-info {
  flex: 1;
  min-width: 0;
}
.conversation-info .conv-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.conversation-info .conv-name .badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--primary-blue);
  color: var(--white);
  font-weight: 600;
}
.conversation-info .conv-preview {
  font-size: 13px;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.conversation-meta {
  flex-shrink: 0;
  text-align: right;
}
.conversation-meta .conv-time {
  font-size: 11px;
  color: var(--gray-400);
  display: block;
  margin-bottom: 4px;
}
.conversation-meta .unread-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--danger);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  border-radius: 10px;
}

/* ---------- Chat Main Area ---------- */
.chat-main {
  flex: 1;
  display: flex;
  flex-direction: column;
  height: 100vh;
  background: var(--gray-50);
}

.chat-main-header {
  padding: 16px 24px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-main-header .chat-partner {
  display: flex;
  align-items: center;
  gap: 12px;
}
.chat-main-header .chat-partner .partner-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-weight: 700;
  font-size: 16px;
  overflow: hidden;
}
.chat-main-header .chat-partner .partner-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.chat-main-header .chat-partner .partner-info h3 {
  font-size: 16px;
  font-weight: 700;
  color: var(--gray-800);
  margin-bottom: 2px;
}
.chat-main-header .chat-partner .partner-info span {
  font-size: 12px;
  color: var(--gray-500);
}

.chat-main-header .header-actions {
  display: flex;
  gap: 8px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.message {
  display: flex;
  gap: 10px;
  max-width: 75%;
  animation: messageIn 0.3s ease;
}

.message.sent {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.message.received {
  align-self: flex-start;
}

@keyframes messageIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.message-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--white);
  background: var(--accent-gradient);
  overflow: hidden;
}
.message-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.message-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.message-bubble {
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 14px;
  line-height: 1.6;
  word-break: break-word;
  position: relative;
}

.message.sent .message-bubble {
  background: var(--accent-gradient);
  color: var(--white);
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(26, 115, 232, 0.20);
}

.message.received .message-bubble {
  background: var(--white);
  color: var(--gray-800);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--gray-200);
}

.message-time {
  font-size: 11px;
  color: var(--gray-400);
  padding: 0 4px;
}

.message.sent .message-time {
  text-align: right;
}

/* System message */
.message-system {
  align-self: center;
  max-width: 100%;
}
.message-system .message-bubble {
  background: var(--gray-200);
  color: var(--gray-600);
  font-size: 12px;
  padding: 6px 16px;
  border-radius: var(--radius-xl);
}

/* Chat Input */
.chat-input-area {
  padding: 16px 24px;
  background: var(--white);
  border-top: 1px solid var(--gray-200);
  flex-shrink: 0;
}

.chat-input-wrapper {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  background: var(--gray-50);
  border: 2px solid var(--gray-200);
  border-radius: var(--radius-md);
  padding: 4px;
  transition: var(--transition);
}
.chat-input-wrapper:focus-within {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(26, 115, 232, 0.08);
}

.chat-input-wrapper textarea {
  flex: 1;
  border: none;
  background: transparent;
  padding: 8px 12px;
  font-size: 14px;
  font-family: var(--font-family);
  color: var(--gray-800);
  resize: none;
  outline: none;
  max-height: 120px;
  line-height: 1.5;
}
.chat-input-wrapper textarea::placeholder {
  color: var(--gray-400);
}

.chat-input-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 6px;
}

.chat-input-actions button {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 50%;
  color: var(--gray-500);
  cursor: pointer;
  font-size: 18px;
  transition: var(--transition);
}
.chat-input-actions button:hover {
  background: var(--gray-200);
  color: var(--gray-700);
}

.chat-send-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: var(--accent-gradient);
  border-radius: 50%;
  color: var(--white);
  cursor: pointer;
  font-size: 18px;
  transition: var(--transition);
  flex-shrink: 0;
}
.chat-send-btn:hover {
  box-shadow: var(--shadow-blue);
  transform: scale(1.05);
}
.chat-send-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Empty chat state */
.chat-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--gray-400);
  gap: 16px;
}
.chat-empty .empty-icon {
  font-size: 64px;
  opacity: 0.5;
}
.chat-empty h3 {
  font-size: 18px;
  color: var(--gray-600);
}
.chat-empty p {
  font-size: 14px;
  color: var(--gray-400);
}

/* ---------- Friends / Contacts Page ---------- */
.friends-page {
  padding: 24px;
  max-width: 800px;
  margin: 0 auto;
}

.friends-page .page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}
.friends-page .page-header h1 {
  font-size: 24px;
  font-weight: 800;
  color: var(--primary-dark);
}

.friends-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--gray-200);
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.friend-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 20px;
  background: var(--white);
  cursor: pointer;
  transition: var(--transition);
}
.friend-item:hover {
  background: var(--gray-50);
}
.friend-item:last-child {
  border-bottom: none;
}

.friend-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  color: var(--white);
  background: var(--accent-gradient);
  flex-shrink: 0;
  overflow: hidden;
}
.friend-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.friend-info {
  flex: 1;
  min-width: 0;
}
.friend-info .friend-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-800);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.friend-info .friend-name .status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.friend-info .friend-name .status-dot.online {
  background: var(--success);
}
.friend-info .friend-name .status-dot.offline {
  background: var(--gray-400);
}
.friend-info .friend-desc {
  font-size: 13px;
  color: var(--gray-500);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.friend-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* ---------- Toast / Notification ---------- */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 20000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 20px;
  background: var(--white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  border-left: 4px solid var(--primary-blue);
  min-width: 300px;
  max-width: 420px;
  pointer-events: auto;
  animation: slideInRight 0.35s ease;
  font-size: 14px;
  color: var(--gray-800);
}
.toast.success {
  border-left-color: var(--success);
}
.toast.error {
  border-left-color: var(--danger);
}
.toast.warning {
  border-left-color: var(--warning);
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(40px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.toast-icon {
  font-size: 20px;
  flex-shrink: 0;
}
.toast.success .toast-icon { color: var(--success); }
.toast.error .toast-icon { color: var(--danger); }
.toast.warning .toast-icon { color: var(--warning); }

.toast-message {
  flex: 1;
}
.toast-close {
  border: none;
  background: none;
  cursor: pointer;
  color: var(--gray-400);
  font-size: 16px;
  padding: 4px;
  transition: var(--transition);
}
.toast-close:hover {
  color: var(--gray-600);
}

/* ---------- Badge / Tag ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 12px;
}
.badge-primary {
  background: rgba(26, 115, 232, 0.10);
  color: var(--primary-blue);
}
.badge-success {
  background: rgba(40, 167, 69, 0.10);
  color: var(--success);
}
.badge-danger {
  background: rgba(220, 53, 69, 0.10);
  color: var(--danger);
}
.badge-warning {
  background: rgba(255, 193, 7, 0.15);
  color: #b8860b;
}

/* ---------- Loading Spinner ---------- */
.spinner {
  display: inline-block;
  width: 32px;
  height: 32px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary-blue);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.spinner-sm {
  width: 20px;
  height: 20px;
  border-width: 2px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.80);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  flex-direction: column;
  gap: 12px;
}
.loading-overlay span {
  font-size: 14px;
  color: var(--gray-600);
}

/* ---------- Dropdown ---------- */
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 180px;
  background: var(--white);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--gray-200);
  padding: 6px 0;
  opacity: 0;
  visibility: hidden;
  transform: translateY(8px);
  transition: var(--transition);
  z-index: 1000;
}
.dropdown-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  font-size: 14px;
  color: var(--gray-700);
  cursor: pointer;
  transition: var(--transition);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font-family);
}
.dropdown-item:hover {
  background: var(--gray-50);
  color: var(--primary-blue);
}
.dropdown-item.danger {
  color: var(--danger);
}
.dropdown-item.danger:hover {
  background: rgba(220, 53, 69, 0.06);
}
.dropdown-divider {
  height: 1px;
  background: var(--gray-200);
  margin: 4px 0;
}

/* ---------- Avatar Upload ---------- */
.avatar-upload {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.avatar-upload .avatar-preview {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--gray-200);
  background: var(--gray-100);
}
.avatar-upload .avatar-placeholder {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 36px;
  font-weight: 700;
  color: var(--white);
  background: var(--accent-gradient);
  border: 3px solid var(--gray-200);
}

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  .chat-sidebar {
    width: 280px;
    min-width: 280px;
  }
}

@media (max-width: 768px) {
  .chat-layout {
    flex-direction: column;
  }
  .chat-sidebar {
    width: 100%;
    min-width: 100%;
    height: auto;
    max-height: 45vh;
  }
  .chat-main {
    height: auto;
    flex: 1;
  }
  .chat-main-header {
    padding: 12px 16px;
  }
  .chat-messages {
    padding: 16px;
  }
  .message {
    max-width: 85%;
  }
  .chat-input-area {
    padding: 12px 16px;
  }

  .auth-card {
    padding: 28px 24px 24px;
  }
  .auth-card .auth-title {
    font-size: 18px;
  }
  .auth-card::before {
    left: 24px;
    right: 24px;
  }
  .auth-brand h1 {
    font-size: 22px;
  }

  .friends-page {
    padding: 16px;
  }
  .friend-actions .btn span {
    display: none;
  }

  .modal {
    width: 95%;
    border-radius: var(--radius-md);
  }
  .modal-header,
  .modal-body,
  .modal-footer {
    padding-left: 18px;
    padding-right: 18px;
  }

  .toast-container {
    left: 16px;
    right: 16px;
    top: 16px;
  }
  .toast {
    min-width: 0;
    width: 100%;
  }
}

@media (max-width: 480px) {
  .auth-page {
    padding: 16px;
  }
  .auth-card {
    padding: 24px 18px 20px;
  }
  .auth-card .auth-title {
    font-size: 17px;
  }
  .auth-card .auth-subtitle {
    font-size: 13px;
  }
  .auth-card::before {
    left: 18px;
    right: 18px;
  }
  .auth-brand {
    margin-bottom: 24px;
  }
  .auth-brand .brand-logo {
    width: 56px;
    height: 56px;
  }
  .auth-brand .brand-logo span {
    font-size: 24px;
  }
  .auth-brand h1 {
    font-size: 20px;
  }
  .auth-brand p {
    font-size: 13px;
  }
  .form-row {
    flex-direction: column;
    gap: 0;
  }
  .form-group-half {
    flex: none;
  }
  .input-group-append .btn-send-code {
    padding: 10px 12px;
    font-size: 12px;
    min-width: 80px;
  }

  .chat-sidebar {
    max-height: 35vh;
  }
  .conversation-item {
    padding: 10px 12px;
  }
  .conversation-avatar {
    width: 40px;
    height: 40px;
    font-size: 15px;
  }
  .message {
    max-width: 92%;
  }
  .chat-main-header .header-actions .btn span {
    display: none;
  }
}

/* ---------- Print ---------- */
@media print {
  .chat-sidebar,
  .chat-input-area,
  .chat-main-header .header-actions {
    display: none;
  }
  .chat-main-header {
    border-bottom: 1px solid #ccc;
  }
  .message-bubble {
    box-shadow: none !important;
    border: 1px solid #ddd !important;
  }
}

/* =============================================
   模板类名兼容层（与 chat.php 模板类名匹配）
   ============================================= */

/* 聊天页面整体布局 */
.chat-page {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--gray-50);
}

/* 顶部导航 */
.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  height: 60px;
  background: var(--white);
  border-bottom: 1px solid var(--gray-200);
  flex-shrink: 0;
  z-index: 100;
}
.header-left { display: flex; align-items: center; }
.header-brand { display: flex; align-items: center; gap: 10px; }
.header-title { font-size: 18px; font-weight: 700; color: var(--primary-dark); }
.header-nav { display: flex; align-items: center; gap: 4px; }
.nav-link {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px;
  text-decoration: none; font-size: 14px; color: var(--gray-600);
  transition: var(--transition);
}
.nav-link:hover { background: var(--gray-50); color: var(--primary-blue); }
.nav-link-logout:hover { background: #fef2f2; color: #dc2626; }

/* 主体区域（侧栏 + 聊天区） */
.chat-main {
  flex: 1;
  display: flex;
  overflow: hidden;
}

/* 左侧栏 */
.chat-sidebar {
  width: 340px;
  min-width: 340px;
  background: var(--white);
  border-right: 1px solid var(--gray-200);
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* 当前用户信息 */
.sidebar-current-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--gray-100);
}
.user-avatar {
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex; align-items: center; justify-content: center;
  color: var(--white); font-weight: 700; font-size: 18px;
  flex-shrink: 0; overflow: hidden;
  position: relative;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar-text { color: var(--white); }
.avatar-text.sm { font-size: 15px; }
.avatar-text.md { font-size: 18px; }
.online-dot {
  position: absolute; bottom: 1px; right: 1px;
  width: 12px; height: 12px;
  background: var(--success);
  border: 2px solid var(--white);
  border-radius: 50%;
}
.user-info { flex: 1; min-width: 0; }
.user-nickname { font-size: 15px; font-weight: 600; color: var(--gray-800); display: block; }
.user-status { font-size: 12px; color: var(--gray-500); }

/* 搜索框 */
.sidebar-search { padding: 12px 16px; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  background: var(--gray-100);
  border-radius: 8px;
  transition: var(--transition);
}
.search-box:focus-within { background: var(--gray-200); }
.search-input {
  border: none; background: transparent;
  font-size: 13px; color: var(--gray-800);
  outline: none; width: 100%;
  font-family: var(--font-family);
}
.search-input::placeholder { color: var(--gray-400); }

/* 会话列表 */
.sidebar-conversations {
  flex: 1; overflow-y: auto;
  padding: 4px 0;
}
.conversation-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 16px; cursor: pointer;
  transition: var(--transition);
}
.conversation-item:hover { background: var(--gray-50); }
.conversation-active { background: rgba(26,115,232,0.06); }
.conv-avatar {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent-gradient);
  display: flex; align-items: center; justify-content: center;
  color: var(--white); font-weight: 700; font-size: 17px;
  flex-shrink: 0; overflow: hidden;
}
.conv-avatar.md { width: 40px; height: 40px; font-size: 15px; }
.conv-avatar img { width: 100%; height: 100%; object-fit: cover; }
.conv-info { flex: 1; min-width: 0; }
.conv-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 2px; }
.conv-name { font-size: 14px; font-weight: 600; color: var(--gray-800); }
.conv-time { font-size: 11px; color: var(--gray-400); flex-shrink: 0; }
.conv-bottom { display: flex; justify-content: space-between; align-items: center; }
.conv-preview { font-size: 13px; color: var(--gray-500); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.conv-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  background: var(--danger); color: var(--white);
  font-size: 11px; font-weight: 700; border-radius: 10px;
  margin-left: 8px;
}
.sidebar-empty {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 40px 20px; color: var(--gray-500);
  gap: 8px; text-align: center;
}
.sidebar-empty p { font-size: 15px; font-weight: 600; color: var(--gray-600); margin: 0; }
.sidebar-empty span { font-size: 13px; }

/* 右侧聊天区域 */
.chat-content {
  flex: 1; display: flex; flex-direction: column;
  background: var(--gray-50); height: 100%;
}

/* 聊天头部 */
.chat-content-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 24px; background: var(--white);
  border-bottom: 1px solid var(--gray-200); flex-shrink: 0;
}
.chat-with-user { display: flex; align-items: center; gap: 12px; }
.chat-with-info { }
.chat-with-name { font-size: 16px; font-weight: 700; color: var(--gray-800); display: block; }
.chat-with-status { font-size: 12px; color: var(--gray-500); }
.chat-header-actions { display: flex; gap: 8px; }
.btn-icon {
  width: 36px; height: 36px; display: flex; align-items: center; justify-content: center;
  border: none; background: transparent; border-radius: 8px;
  color: var(--gray-500); cursor: pointer; transition: var(--transition);
}
.btn-icon:hover { background: var(--gray-100); color: var(--primary-blue); }

/* 消息区域 */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 24px;
  display: flex; flex-direction: column; gap: 12px;
}

/* 消息气泡 */
.message { display: flex; max-width: 75%; animation: messageIn 0.3s ease; }
.message-self { align-self: flex-end; flex-direction: row-reverse; }
.message-other { align-self: flex-start; }
@keyframes messageIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
.message-bubble {
  padding: 10px 16px; border-radius: 14px; font-size: 14px; line-height: 1.6;
  word-break: break-word; position: relative;
}
.message-self .message-bubble {
  background: var(--accent-gradient); color: var(--white);
  border-bottom-right-radius: 4px;
  box-shadow: 0 2px 8px rgba(26,115,232,0.2);
}
.message-other .message-bubble {
  background: var(--white); color: var(--gray-800);
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.06);
  border: 1px solid var(--gray-200);
}
.message-text { }
.message-encrypted-badge { display: inline-flex; align-items: center; gap: 2px; font-size: 10px; opacity: 0.7; margin-top: 4px; }
.message-meta { display: flex; align-items: center; gap: 6px; padding: 0 4px; margin-top: 2px; }
.message-time { font-size: 11px; color: var(--gray-400); }
.message-self .message-meta { justify-content: flex-end; }
.message-status { display: inline-flex; }
.status-read svg { fill: var(--primary-blue); }
.status-sent svg { fill: var(--gray-400); }

.messages-empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  color: var(--gray-500); gap: 12px; text-align: center;
}
.messages-empty p { font-size: 16px; font-weight: 600; color: var(--gray-600); margin: 0; }
.messages-empty span { font-size: 13px; }

/* 输入区域 */
.chat-input-area {
  padding: 16px 24px; background: var(--white);
  border-top: 1px solid var(--gray-200); flex-shrink: 0;
}
.chat-input-toolbar {
  display: flex; align-items: center; gap: 12px; margin-bottom: 8px;
}
.encryption-badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; color: var(--primary-blue); font-weight: 500;
}
.chat-input-row {
  display: flex; align-items: flex-end; gap: 12px;
}
.chat-input {
  flex: 1;
  border: 2px solid var(--gray-200); background: var(--gray-50);
  border-radius: 12px; padding: 10px 16px;
  font-size: 14px; font-family: var(--font-family);
  color: var(--gray-800); resize: none; outline: none;
  max-height: 120px; line-height: 1.5;
  transition: var(--transition);
}
.chat-input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.08);
}
.chat-input::placeholder { color: var(--gray-400); }

.btn-send {
  width: 44px; height: 44px; display: flex;
  align-items: center; justify-content: center;
  border: none; background: var(--accent-gradient);
  border-radius: 12px; color: var(--white); cursor: pointer;
  transition: var(--transition); flex-shrink: 0;
}
.btn-send:hover { box-shadow: 0 4px 14px rgba(26,115,232,0.35); transform: scale(1.05); }
.btn-send:active { transform: scale(0.95); }

/* 占位页面 */
.chat-content-placeholder {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 40px; text-align: center;
}
.placeholder-icon { margin-bottom: 8px; }
.placeholder-title { font-size: 22px; font-weight: 700; color: var(--gray-700); margin: 0 0 8px; }
.placeholder-desc { font-size: 14px; color: var(--gray-500); margin: 0 0 24px; max-width: 360px; line-height: 1.6; }

/* 移动端响应 */
@media (max-width: 768px) {
  .chat-header { padding: 0 16px; height: 52px; }
  .header-nav .nav-link span { display: none; }
  .chat-sidebar { width: 100%; min-width: 0; }
  .chat-content { display: none; }
  .chat-content.active { display: flex; position: fixed; inset: 0; z-index: 200; }
  .sidebar-conversations { max-height: none; }
  .message { max-width: 90%; }
  .chat-input-area { padding: 12px 16px; }
}
@media (max-width: 480px) {
  .message { max-width: 95%; }
  .chat-input { font-size: 15px; }
}

/* ============================================
   好友管理页面样式
   ============================================ */
.friends-page {
  min-height: 100vh;
  background: var(--gray-50);
}

.friends-main {
  padding: 24px;
  max-width: 960px;
  margin: 0 auto;
}

.friends-container {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 860px) {
  .friends-container {
    grid-template-columns: 1fr;
  }
}

/* 好友列表区块 */
.friends-list-section {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--gray-200);
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0;
}

.section-count {
  font-size: 13px;
  color: var(--gray-500);
  font-weight: 500;
}

/* 好友卡片列表 */
.friends-list {
  display: flex;
  flex-direction: column;
}

.friend-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 24px;
  border-bottom: 1px solid var(--gray-100);
  transition: var(--transition);
}
.friend-card:last-child { border-bottom: none; }
.friend-card:hover { background: var(--gray-50); }

.friend-card-avatar {
  width: 50px;
  height: 50px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  color: var(--white);
  background: var(--accent-gradient);
  overflow: hidden;
  position: relative;
}
.friend-card-avatar img { width: 100%; height: 100%; object-fit: cover; }
.friend-card-avatar .online-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 12px;
  height: 12px;
  background: var(--success);
  border: 2px solid var(--white);
  border-radius: 50%;
}
.friend-card-avatar .online-dot.offline { background: var(--gray-400); }

.friend-card-info {
  flex: 1;
  min-width: 0;
}
.friend-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--gray-800);
  display: block;
  margin-bottom: 2px;
}
.friend-username {
  font-size: 12px;
  color: var(--gray-500);
  display: block;
  margin-bottom: 1px;
}
.friend-status {
  font-size: 12px;
  color: var(--gray-400);
}

.friend-card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-icon-danger {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  border-radius: 8px;
  color: var(--gray-400);
  cursor: pointer;
  transition: var(--transition);
}
.btn-icon-danger:hover {
  background: #fef2f2;
  color: var(--danger);
}

/* 好友列表空状态 */
.friends-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  color: var(--gray-500);
  gap: 12px;
  text-align: center;
}
.friends-empty p {
  font-size: 16px;
  font-weight: 600;
  color: var(--gray-600);
  margin: 0;
}
.friends-empty span {
  font-size: 13px;
  color: var(--gray-400);
}

/* 右侧操作区域 */
.friends-actions-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 搜索卡片 */
.friend-search-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
}

.card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0 0 14px;
}

.search-box-lg {
  display: flex;
  gap: 8px;
}
.search-box-lg .search-input {
  flex: 1;
  padding: 10px 14px;
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  font-size: 14px;
  font-family: var(--font-family);
  color: var(--gray-800);
  outline: none;
  transition: var(--transition);
  background: var(--white);
}
.search-box-lg .search-input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 3px rgba(26,115,232,0.08);
}
.search-box-lg .search-input::placeholder { color: var(--gray-400); }

/* 搜索结果 */
.search-results {
  margin-top: 14px;
  border-top: 1px solid var(--gray-100);
  padding-top: 14px;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--gray-50);
}
.search-result-item:last-child { border-bottom: none; }

.search-result-empty {
  padding: 20px 0;
  text-align: center;
  color: var(--gray-500);
  font-size: 14px;
}

.result-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  background: var(--accent-gradient);
  overflow: hidden;
}
.result-avatar img { width: 100%; height: 100%; object-fit: cover; }

.result-info {
  flex: 1;
  min-width: 0;
}
.result-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  display: block;
}
.result-username {
  font-size: 12px;
  color: var(--gray-500);
  display: block;
}

/* 好友请求卡片 */
.friend-requests-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 20px 24px;
}

/* 请求列表 */
.requests-list { }

.request-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-50);
}
.request-item:last-child { border-bottom: none; }

.request-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  color: var(--white);
  background: var(--accent-gradient);
  overflow: hidden;
}
.request-avatar img { width: 100%; height: 100%; object-fit: cover; }

.request-info {
  flex: 1;
  min-width: 0;
}
.request-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-800);
  display: block;
  margin-bottom: 2px;
}
.request-message {
  font-size: 12px;
  color: var(--gray-500);
  display: block;
}

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

.btn-outline-danger {
  background: transparent;
  color: var(--danger);
  border: 2px solid var(--danger);
}
.btn-outline-danger:hover:not(:disabled) {
  background: var(--danger);
  color: var(--white);
}

/* 请求空状态 */
.requests-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px;
  color: var(--gray-500);
  gap: 10px;
  text-align: center;
}
.requests-empty p {
  font-size: 14px;
  color: var(--gray-500);
  margin: 0;
}

/* ============================================
   个人设置页面样式
   ============================================ */
.profile-page {
  min-height: 100vh;
  background: var(--gray-50);
}

.profile-main {
  padding: 24px;
  max-width: 720px;
  margin: 0 auto;
}

.profile-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

/* 用户信息头部卡片 */
.profile-header-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 32px 24px 24px;
  text-align: center;
  position: relative;
}

.profile-avatar-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.profile-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.profile-avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  font-weight: 700;
  color: var(--white);
}

.avatar-upload-btn {
  position: absolute;
  bottom: 0;
  right: -4px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--gray-600);
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.avatar-upload-btn:hover {
  border-color: var(--primary-blue);
  color: var(--primary-blue);
  box-shadow: var(--shadow-blue);
}

.profile-nickname-display {
  font-size: 20px;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 4px 0 0;
}

.profile-username-display {
  font-size: 14px;
  color: var(--gray-500);
}

/* 统计信息 */
.profile-stats {
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--gray-100);
}

.stat-item {
  text-align: center;
}
.stat-value {
  display: block;
  font-size: 22px;
  font-weight: 800;
  color: var(--primary-dark);
}
.stat-label {
  display: block;
  font-size: 12px;
  color: var(--gray-500);
  margin-top: 2px;
}

/* 设置卡片 */

.profile-settings {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.settings-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
}

.settings-card-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--primary-dark);
  margin: 0 0 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--gray-100);
}

/* 设置表单 */
.settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-form .form-group {
  margin-bottom: 0;
}

.settings-form .form-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--gray-700);
  margin-bottom: 6px;
  display: block;
}

.settings-form .input-wrapper {
  position: relative;
}

.settings-form .form-input {
  width: 100%;
  padding: 12px 16px;
  font-size: 14px;
  font-family: var(--font-family);
  color: var(--gray-800);
  background: var(--white);
  border: 2px solid var(--gray-200);
  border-radius: 10px;
  outline: none;
  transition: var(--transition);
}
.settings-form .form-input:focus {
  border-color: var(--primary-blue);
  box-shadow: 0 0 0 4px rgba(26,115,232,0.08);
}
.settings-form .form-input::placeholder { color: var(--gray-400); }

.form-textarea {
  resize: vertical;
  min-height: 120px;
  font-family: var(--font-family);
}

.field-hint {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--gray-500);
}

/* 公钥管理 */
.key-info {
  margin-bottom: 16px;
}

.key-status {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}
.status-ok {
  background: rgba(40,167,69,0.10);
  color: var(--success);
}
.status-warn {
  background: rgba(255,193,7,0.12);
  color: #b8860b;
}

.key-fingerprint {
  font-size: 12px;
  color: var(--gray-500);
}
.key-fingerprint code {
  background: var(--gray-100);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--gray-700);
}

.key-description {
  font-size: 13px;
  color: var(--gray-500);
  line-height: 1.6;
  margin: 0;
}

.form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

/* 账号信息 */
.account-info {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--gray-50);
}
.info-row:last-child { border-bottom: none; }

.info-label {
  font-size: 14px;
  color: var(--gray-600);
  font-weight: 500;
}

.info-value {
  font-size: 14px;
  color: var(--gray-800);
  font-weight: 600;
}
.info-value code {
  background: var(--gray-100);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
  color: var(--gray-700);
}

/* 响应式适配 - 移动端好友/设置页面 */
@media (max-width: 768px) {
  .friends-main { padding: 16px; }
  .profile-main { padding: 16px; }
  .friends-container { grid-template-columns: 1fr; }
  .friend-card { padding: 12px 16px; }
  .section-header { padding: 16px 16px 12px; }
  .friend-search-card { padding: 16px; }
  .friend-requests-card { padding: 16px; }
  .settings-card { padding: 20px 16px; }
  .profile-header-card { padding: 24px 16px 20px; }
  .profile-stats { gap: 24px; }
  .profile-avatar { width: 68px; height: 68px; }
  .profile-avatar-placeholder { width: 68px; height: 68px; font-size: 26px; }
  .stat-value { font-size: 18px; }
  .request-item { flex-wrap: wrap; }
  .request-actions { width: 100%; justify-content: flex-end; }
  .friend-card-actions .btn .btn-text { display: none; }
  .form-actions { flex-direction: column; }
  .form-actions .btn { width: 100%; }
}

@media (max-width: 480px) {
  .friends-main { padding: 12px; }
  .profile-main { padding: 12px; }
  .profile-stats { gap: 16px; }
}
