/* CSS变量 - 主题配色 */
:root {
  /* 默认主题 - 商务蓝 */
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #dbeafe;
  --secondary-color: #64748b;
  --secondary-hover: #475569;
  --success-color: #059669;
  --success-hover: #047857;
  --warning-color: #d97706;
  --warning-hover: #b45309;
  --danger-color: #dc2626;
  --danger-hover: #b91c1c;
  --info-color: #0891b2;
  --info-hover: #0e7490;

  /* 中性色 */
  --gray-50: #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-400: #94a3b8;
  --gray-500: #64748b;
  --gray-600: #475569;
  --gray-700: #334155;
  --gray-800: #1e293b;
  --gray-900: #0f172a;

  /* 背景和文字 */
  --bg-primary: #ffffff;
  --bg-secondary: var(--gray-50);
  --bg-tertiary: var(--gray-100);
  --text-primary: var(--gray-900);
  --text-secondary: var(--gray-600);
  --text-muted: var(--gray-500);

  /* 边框和阴影 */
  --border-color: var(--gray-200);
  --border-hover: var(--gray-300);
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);

  /* 圆角 */
  --radius-sm: 0.375rem;
  --radius-md: 0.5rem;
  --radius-lg: 0.75rem;
  --radius-xl: 1rem;
}

/* 深色主题 */
[data-theme="dark"] {
  --bg-primary: var(--gray-900);
  --bg-secondary: var(--gray-800);
  --bg-tertiary: var(--gray-700);
  --text-primary: var(--gray-100);
  --text-secondary: var(--gray-300);
  --text-muted: var(--gray-400);
  --border-color: var(--gray-700);
  --border-hover: var(--gray-600);
}

/* 绿色主题 */
[data-theme="green"] {
  --primary-color: #059669;
  --primary-hover: #047857;
  --primary-light: #d1fae5;
}

/* 紫色主题 */
[data-theme="purple"] {
  --primary-color: #7c3aed;
  --primary-hover: #6d28d9;
  --primary-light: #ede9fe;
}

/* 基础样式 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  background-color: var(--bg-secondary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
  /* 移动端优化 */
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

/* 主题切换器 */
.theme-switcher {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  gap: 8px;
  background: var(--bg-primary);
  padding: 8px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.theme-btn {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.theme-btn.active {
  transform: scale(1.1);
  box-shadow: 0 0 0 2px var(--primary-color);
}

.theme-btn.blue { background: linear-gradient(135deg, #2563eb, #1d4ed8); }
.theme-btn.green { background: linear-gradient(135deg, #059669, #047857); }
.theme-btn.purple { background: linear-gradient(135deg, #7c3aed, #6d28d9); }
.theme-btn.dark { background: linear-gradient(135deg, #374151, #1f2937); }

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* 首页样式 */
.home-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  max-width: 480px;
  margin: 0 auto;
  padding: 40px 20px;
}

.app-icon {
  width: 80px;
  height: 80px;
  background: var(--primary-color);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-lg);
  position: relative;
}

.app-icon::before {
  content: '';
  position: absolute;
  inset: -2px;
  background: linear-gradient(45deg, var(--primary-color), var(--primary-hover));
  border-radius: var(--radius-xl);
  z-index: -1;
}

.home-title {
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 12px;
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.home-subtitle {
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 16px;
  font-size: 1.125rem;
  font-weight: 400;
}

.vehicle-info {
  background: var(--primary-light);
  border: 1px solid var(--primary-color);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  margin-bottom: 32px;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.vehicle-id-label {
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
}

.vehicle-id-value {
  color: var(--primary-color);
  font-size: 1rem;
  font-weight: 700;
  font-family: 'Courier New', monospace;
  transition: color 0.3s ease;
}

.vehicle-id-value.loading {
  color: var(--text-muted);
  font-weight: 500;
}

.vehicle-id-value.error {
  color: var(--danger-color);
}

.vehicle-id-value.warning {
  color: var(--warning-color);
}

/* 表单样式 */
.form-group {
  margin-bottom: 20px;
  width: 100%;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  color: var(--text-primary);
  font-size: 0.875rem;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 16px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.form-group input:hover,
.form-group textarea:hover,
.form-group select:hover {
  border-color: var(--border-hover);
}

textarea {
  resize: vertical;
  min-height: 100px;
  font-family: inherit;
}

/* 消息输入区域 */
.message-input-section {
  margin-bottom: 24px;
  width: 100%;
}

.message-input-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message-input-container textarea {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-size: 16px;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  transition: all 0.2s ease;
  resize: vertical;
  min-height: 80px;
}

.message-input-container textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.quick-templates {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

.template-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: var(--bg-primary);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-sm);
}

.template-btn:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.template-btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* 主题颜色适配 */
[data-theme="green"] .template-btn:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

[data-theme="purple"] .template-btn:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
}

[data-theme="dark"] .template-btn {
  background: var(--bg-secondary);
  border-color: var(--border-color);
  color: var(--text-secondary);
}

[data-theme="dark"] .template-btn:hover {
  background: var(--primary-color);
  border-color: var(--primary-color);
  color: white;
}

/* 按钮组 */
.button-group {
  display: flex;
  gap: 16px;
  width: 100%;
}

.button-group button {
  flex: 1;
}

/* 按钮样式 */
.btn, button {
  padding: 12px 24px;
  border: none;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none !important;
}

.btn-primary, .notify-btn, .login-btn {
  background: var(--primary-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-primary:hover, .notify-btn:hover, .login-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-success, .call-btn {
  background: var(--success-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-success:hover, .call-btn:hover {
  background: var(--success-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.camera-btn {
  background: var(--warning-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

.camera-btn:hover {
  background: var(--warning-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-warning {
  background: var(--warning-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-warning:hover {
  background: var(--warning-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-danger {
  background: var(--danger-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-danger:hover {
  background: var(--danger-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-info {
  background: var(--info-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-info:hover {
  background: var(--info-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-secondary {
  background: var(--secondary-color);
  color: white;
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--secondary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
}

.btn:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

/* 触摸设备优化 */
@media (hover: none) and (pointer: coarse) {
  .btn, button, .quick-btn, .theme-btn {
    /* 移除hover效果，使用active状态 */
    transition: all 0.1s ease;
  }

  .btn:hover, button:hover, .quick-btn:hover, .theme-btn:hover {
    transform: none;
    box-shadow: var(--shadow-sm);
  }

  .btn:active, button:active, .quick-btn:active {
    transform: scale(0.98);
    transition: transform 0.1s ease;
  }

  /* 增加触摸目标大小 */
  .btn, button {
    min-height: 44px;
    min-width: 44px;
  }

  .btn-sm {
    min-height: 36px;
    min-width: 36px;
  }

  .theme-btn {
    min-width: 32px;
    min-height: 32px;
  }
}

/* 管理页面样式 */
.header {
  background: var(--bg-primary);
  padding: 24px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  margin-bottom: 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  border: 1px solid var(--border-color);
}

.header h1 {
  color: var(--text-primary);
  text-shadow: none;
  margin-bottom: 0;
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: -0.025em;
}

.header-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* 表格样式 */
.table-container {
  background: var(--bg-primary);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  border: 1px solid var(--border-color);
}

table {
  width: 100%;
  border-collapse: collapse;
}

th, td {
  padding: 16px 20px;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  font-size: 14px;
}

th {
  background: var(--bg-tertiary);
  font-weight: 600;
  color: var(--text-primary);
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tbody tr {
  transition: background-color 0.2s ease;
}

tbody tr:hover {
  background: var(--bg-secondary);
}

tbody tr:last-child td {
  border-bottom: none;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.actions button {
  white-space: nowrap;
}

/* 按钮颜色样式 */
.btn-success {
  background: #28a745;
  color: white;
}

.btn-success:hover {
  background: #218838;
}

.btn-primary {
  background: #007bff;
  color: white;
}

.btn-primary:hover {
  background: #0056b3;
}

/* 二维码模态框样式 */
#qrModal .modal-body {
  text-align: center;
}

#qrCodeContainer {
  margin: 20px 0;
}

#qrModal .link-display {
  background: #f5f5f5;
  padding: 10px;
  border-radius: 4px;
  word-break: break-all;
  font-family: monospace;
  margin: 10px 0;
}

/* 模态框样式 */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  background-color: var(--bg-primary);
  margin: 5% auto;
  padding: 0;
  border-radius: var(--radius-xl);
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border-color);
  animation: modalSlideIn 0.3s ease-out;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  padding: 24px 24px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h2 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.25rem;
  font-weight: 600;
}

.close {
  color: var(--text-muted);
  font-size: 24px;
  font-weight: bold;
  cursor: pointer;
  padding: 4px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.close:hover {
  color: var(--text-primary);
  background: var(--bg-secondary);
}

.modal-body {
  padding: 24px;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* 加载动画 */
.loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.loading::after {
  content: '';
  width: 32px;
  height: 32px;
  border: 3px solid var(--border-color);
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* 提示消息 */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--gray-900);
  color: white;
  padding: 12px 20px;
  border-radius: var(--radius-lg);
  font-size: 14px;
  font-weight: 500;
  z-index: 1001;
  opacity: 0;
  transition: all 0.3s ease;
  box-shadow: var(--shadow-lg);
  max-width: 90vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(-8px);
}

/* 状态指示器 */
.status-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

.status-indicator::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success-color);
}

.status-indicator.disabled::before {
  background: var(--gray-400);
}

/* 链接样式 */
a {
  color: var(--primary-color);
  text-decoration: none;
  transition: color 0.2s ease;
}

a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

/* 复选框样式 */
input[type="checkbox"] {
  width: auto;
  margin-right: 8px;
  accent-color: var(--primary-color);
}

/* 只读输入框 */
input[readonly] {
  background-color: var(--bg-tertiary);
  cursor: not-allowed;
  color: var(--text-muted);
}

/* 表单验证 */
input:invalid {
  border-color: var(--danger-color);
}

input:valid {
  border-color: var(--success-color);
}

/* 表单提示文字 */
.form-group small {
  display: block;
  margin-top: 4px;
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* 限流管理样式 */
.rate-limit-actions {
  margin-bottom: 20px;
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* 拍照功能样式 */
.camera-modal {
  max-width: 600px;
}

.photo-upload-area {
  margin-bottom: 20px;
}

.upload-prompt {
  text-align: center;
  padding: 40px 20px;
  background: var(--bg-tertiary);
  border: 2px dashed var(--border-color);
  border-radius: var(--radius-lg);
  transition: all 0.3s ease;
}

.upload-prompt:hover {
  border-color: var(--primary-color);
  background: var(--primary-light);
}

.upload-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.upload-prompt h3 {
  margin: 0 0 8px 0;
  color: var(--text-primary);
  font-size: 1.25rem;
}

.upload-prompt p {
  margin: 0 0 24px 0;
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.upload-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.upload-buttons .btn {
  min-width: 120px;
}

.photo-preview {
  text-align: center;
}

.photo-preview img {
  width: 100%;
  height: auto;
  max-height: 400px;
  object-fit: cover;
  border-radius: var(--radius-lg);
  margin-bottom: 16px;
  box-shadow: var(--shadow-md);
}

.photo-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.photo-actions .btn {
  min-width: 120px;
}

/* 文件输入隐藏 */
#photoFileInput {
  display: none !important;
}

/* 隐藏元素的通用类 */
.hidden {
  display: none !important;
}

/* 照片提示信息 */
.photo-tips {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 16px;
  font-size: 14px;
  color: var(--text-secondary);
}

.photo-tips p {
  margin: 0 0 8px 0;
  font-weight: 500;
  color: var(--text-primary);
}

.photo-tips ul {
  margin: 0;
  padding-left: 20px;
}

.photo-tips li {
  margin-bottom: 4px;
  line-height: 1.4;
}

/* 响应式设计 */

/* 大屏幕优化 (1200px+) */
@media (min-width: 1200px) {
  .container {
    max-width: 1400px;
  }

  .home-container {
    max-width: 520px;
  }

  .modal-content {
    max-width: 600px;
  }
}

/* 平板横屏 (768px - 1024px) */
@media (max-width: 1024px) and (min-width: 768px) {
  .header-actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  .header-actions .btn {
    font-size: 14px;
    padding: 10px 16px;
  }

  .quick-messages {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .table-container {
    font-size: 14px;
  }
}

/* 平板竖屏和小屏幕 (最大768px) */
@media (max-width: 768px) {
  /* 主题切换器 */
  .theme-switcher {
    top: 12px;
    right: 12px;
    padding: 4px;
    gap: 4px;
  }

  .theme-btn {
    width: 24px;
    height: 24px;
  }

  /* 容器布局 */
  .container {
    padding: 12px;
  }

  .home-container {
    padding: 24px 16px;
    min-height: calc(100vh - 48px);
  }

  /* 首页元素 */
  .app-icon {
    width: 64px;
    height: 64px;
    font-size: 32px;
    margin-bottom: 20px;
  }

  .home-title {
    font-size: 1.5rem;
    margin-bottom: 8px;
  }

  .home-subtitle {
    font-size: 1rem;
    margin-bottom: 24px;
  }

  /* 表单优化 */
  .form-group {
    margin-bottom: 16px;
  }

  .form-group input,
  .form-group textarea,
  .form-group select {
    padding: 14px 16px;
    font-size: 16px; /* 防止iOS缩放 */
    border-radius: var(--radius-lg);
  }

  textarea {
    min-height: 120px;
  }

  /* 消息输入区域 */
  .message-input-container textarea {
    min-height: 100px;
  }

  .quick-templates {
    gap: 6px;
  }

  .template-btn {
    width: 40px;
    height: 40px;
    font-size: 16px;
  }

  /* 按钮组 */
  .button-group {
    flex-direction: column;
    gap: 12px;
  }

  .btn, button {
    padding: 16px 24px;
    font-size: 16px;
    border-radius: var(--radius-lg);
    min-height: 48px; /* 触摸友好 */
  }

  /* 管理页面头部 */
  .header {
    flex-direction: column;
    gap: 16px;
    padding: 16px;
    text-align: center;
  }

  .header h1 {
    font-size: 1.5rem;
  }

  .header-actions {
    justify-content: center;
    width: 100%;
    gap: 8px;
  }

  .header-actions .btn {
    flex: 1;
    min-width: 0;
    font-size: 13px;
    padding: 12px 8px;
    white-space: nowrap;
  }

  /* 表格优化 */
  .table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--radius-md);
  }

  table {
    min-width: 600px; /* 确保表格有最小宽度 */
  }

  th, td {
    padding: 12px 8px;
    font-size: 12px;
    white-space: nowrap;
  }

  th:first-child,
  td:first-child {
    position: sticky;
    left: 0;
    background: var(--bg-primary);
    z-index: 1;
  }

  th:first-child {
    background: var(--bg-tertiary);
  }

  /* 操作按钮 */
  .actions {
    flex-direction: column;
    gap: 4px;
    min-width: 80px;
  }

  .actions .btn {
    padding: 6px 8px;
    font-size: 11px;
    min-height: auto;
  }

  /* 模态框 */
  .modal-content {
    width: 95%;
    max-width: none;
    margin: 5% auto;
    max-height: 90vh;
    overflow-y: auto;
  }

  .modal-header {
    padding: 16px;
  }

  .modal-header h2 {
    font-size: 1.125rem;
  }

  .modal-body {
    padding: 16px;
  }

  /* 状态指示器 */
  .status-indicator {
    font-size: 11px;
  }

  .status-indicator::before {
    width: 6px;
    height: 6px;
  }

  /* 限流管理 */
  .rate-limit-actions {
    flex-direction: column;
    gap: 8px;
  }

  .rate-limit-actions .btn {
    width: 100%;
  }
}

/* 小屏手机 (最大480px) */
@media (max-width: 480px) {
  .theme-switcher {
    top: 8px;
    right: 8px;
    padding: 2px;
    gap: 2px;
  }

  .theme-btn {
    width: 20px;
    height: 20px;
  }

  .container {
    padding: 8px;
  }

  .home-container {
    padding: 16px 12px;
  }

  .app-icon {
    width: 56px;
    height: 56px;
    font-size: 28px;
  }

  .home-title {
    font-size: 1.25rem;
  }

  .home-subtitle {
    font-size: 0.875rem;
  }

  .header {
    padding: 12px;
  }

  .header h1 {
    font-size: 1.25rem;
  }

  .header-actions {
    grid-template-columns: 1fr 1fr;
    display: grid;
    gap: 6px;
  }

  .header-actions .btn {
    font-size: 11px;
    padding: 10px 6px;
  }

  .quick-templates {
    gap: 8px;
    justify-content: center;
  }

  .template-btn {
    width: 44px;
    height: 44px;
    font-size: 18px;
  }

  .btn, button {
    padding: 14px 20px;
    font-size: 15px;
  }

  .modal-content {
    width: 98%;
    margin: 2% auto;
  }

  .modal-header,
  .modal-body {
    padding: 12px;
  }

  th, td {
    padding: 8px 4px;
    font-size: 11px;
  }

  .actions .btn {
    padding: 4px 6px;
    font-size: 10px;
  }
}

/* 横屏手机优化 */
@media (max-height: 500px) and (orientation: landscape) {
  .home-container {
    min-height: auto;
    padding: 16px;
  }

  .app-icon {
    width: 48px;
    height: 48px;
    font-size: 24px;
    margin-bottom: 12px;
  }

  .home-title {
    font-size: 1.125rem;
    margin-bottom: 6px;
  }

  .home-subtitle {
    font-size: 0.875rem;
    margin-bottom: 16px;
  }

  .message-input-container {
    gap: 8px;
  }

  .message-input-container textarea {
    min-height: 60px;
  }

  .quick-templates {
    gap: 4px;
  }

  .template-btn {
    width: 32px;
    height: 32px;
    font-size: 14px;
  }

  .button-group {
    flex-direction: row;
    gap: 12px;
  }

  .modal-content {
    max-height: 95vh;
  }
}