:root {
  --bg-main: #f8fafc;
  --bg-surface: #ffffff;
  --bg-sidebar: #f1f5f9;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #94a3b8;

  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;

  --success-color: #10b981;
  --success-hover: #059669;
  --success-light: #ecfdf5;

  --danger-color: #ef4444;
  --danger-hover: #dc2626;
  --danger-light: #fef2f2;

  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', Consolas, Monaco, monospace;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -2px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -4px rgba(0, 0, 0, 0.03);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-main);
  color: var(--text-primary);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  height: 100vh;
  overflow: hidden;
}

.app-layout {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

/* Navbar */
.app-navbar {
  height: 64px;
  background-color: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 38px;
  height: 38px;
  background-color: var(--primary-light);
  color: var(--primary-color);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.brand-subtitle {
  font-size: 11px;
  color: var(--text-muted);
}

.server-status-bar {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--success-light);
  color: #065f46;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  background-color: var(--success-color);
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(16, 185, 129, 0); }
}

.port-chip {
  display: inline-flex;
  align-items: center;
  background-color: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: 12px;
  gap: 6px;
}

.chip-label {
  font-weight: 600;
  color: var(--text-secondary);
}

.chip-val {
  font-family: var(--font-mono);
  color: var(--primary-color);
  font-weight: 600;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--primary-color);
  color: #fff;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
}

.btn-success {
  background-color: var(--success-color);
  color: #fff;
}
.btn-success:hover {
  background-color: var(--success-hover);
}

.btn-outline {
  background-color: #ffffff;
  border-color: var(--border-color);
  color: var(--text-secondary);
}
.btn-outline:hover {
  background-color: var(--bg-sidebar);
  color: var(--text-primary);
}

.btn-ghost {
  background-color: transparent;
  color: var(--text-secondary);
}
.btn-ghost:hover {
  background-color: var(--bg-sidebar);
}

.btn-danger {
  color: var(--danger-color);
}
.btn-danger:hover {
  background-color: var(--danger-light);
  color: var(--danger-hover);
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}

.btn-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-icon:hover {
  background-color: var(--bg-sidebar);
  color: var(--text-primary);
}

/* Workspace Layout */
.app-workspace {
  display: grid;
  grid-template-columns: 240px 380px 1fr;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
.app-sidebar {
  background-color: var(--bg-surface);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
  overflow-y: auto;
}

.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  margin-bottom: 10px;
}

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

.badge-sm {
  background-color: var(--bg-sidebar);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 1px 6px;
  border-radius: 999px;
  font-weight: 600;
}

.nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.nav-item:hover {
  background-color: var(--bg-sidebar);
  color: var(--text-primary);
}

.nav-item.active {
  background-color: var(--primary-light);
  color: var(--primary-color);
  font-weight: 600;
}

.nav-count {
  margin-left: auto;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  background-color: var(--bg-sidebar);
  color: var(--text-secondary);
}

.nav-item.active .nav-count {
  background-color: #dbeafe;
  color: var(--primary-color);
}

.sidebar-section {
  margin-bottom: 24px;
}

.inbox-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 280px;
  overflow-y: auto;
}

/* Group Tree Hierarchical UI (转发邮箱母账号 -> 下属别名层级结构) */
.group-tree-container {
  display: flex;
  flex-direction: column;
  gap: 3px;
  max-height: 280px;
  overflow-y: auto;
  padding-right: 2px;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-xs-icon {
  background: transparent;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1px 5px;
  font-size: 11px;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  transition: all 0.15s;
}

.btn-xs-icon:hover {
  background-color: var(--bg-surface);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.group-node {
  border-radius: var(--radius-sm);
  transition: all 0.15s;
}

.group-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-primary);
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}

.group-header:hover {
  background-color: var(--bg-sidebar);
}

.group-header.active {
  background-color: var(--primary-light);
  color: var(--primary-color);
  font-weight: 600;
}

.group-title-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.group-caret {
  font-size: 9px;
  color: var(--text-muted);
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  flex-shrink: 0;
}

.group-node.open .group-caret {
  transform: rotate(90deg);
}

.group-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.group-badges {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.group-children {
  display: none;
  flex-direction: column;
  gap: 2px;
  margin-left: 14px;
  padding-left: 8px;
  border-left: 1.5px solid var(--border-color);
  margin-top: 2px;
  margin-bottom: 4px;
}

.group-node.open .group-children {
  display: flex;
}

.group-alias-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  gap: 6px;
}

.group-alias-item:hover {
  background-color: var(--bg-sidebar);
  color: var(--text-primary);
}

.group-alias-item.active {
  background-color: var(--primary-light);
  color: var(--primary-color);
  font-weight: 600;
}

.group-alias-label {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.mini-code-pill {
  background-color: rgba(16, 185, 129, 0.1);
  color: var(--success-color);
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.forward-accent {
  color: #7c3aed !important;
  background-color: rgba(139, 92, 246, 0.08);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
}

.badge-forward {
  background-color: rgba(139, 92, 246, 0.1);
  color: #7c3aed;
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 500;
}

.inbox-alias-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s;
  gap: 8px;
}

.inbox-alias-item:hover {
  background-color: var(--bg-sidebar);
  color: var(--text-primary);
}

.inbox-alias-item.active {
  background-color: var(--primary-light);
  color: var(--primary-color);
  font-weight: 600;
}

.group-label {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.group-icon {
  font-size: 13px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.empty-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 12px 0;
}

.w-full {
  width: 100%;
}

/* Mail List Panel */
.app-list-panel {
  background-color: #fafbfc;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.list-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-surface);
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 12px;
  flex: 1;
  color: var(--text-muted);
}

.search-box input {
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text-primary);
  width: 100%;
  font-family: inherit;
}

.mail-cards-container {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* Mail Card */
.mail-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
}

.mail-card:hover {
  border-color: #cbd5e1;
  box-shadow: var(--shadow-sm);
}

.mail-card.active {
  border-color: var(--primary-color);
  background-color: #f8faff;
  box-shadow: 0 0 0 1px var(--primary-color);
}

.mail-card.unread::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 16px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--primary-color);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.card-top-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-card-delete {
  background: transparent;
  border: none;
  color: var(--text-muted);
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.4;
  transition: all 0.15s ease;
  padding: 0;
}

.mail-card:hover .btn-card-delete {
  opacity: 0.85;
}

.btn-card-delete:hover {
  background-color: #fee2e2;
  color: #ef4444;
  opacity: 1 !important;
  transform: scale(1.05);
}

.card-sender {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-time {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

.card-to {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.card-subject {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-otp-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: #f0fdf4;
  border: 1px solid #bbf7d0;
  color: #15803d;
  font-size: 12px;
  font-weight: 700;
  font-family: var(--font-mono);
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  margin-top: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.card-otp-chip:hover {
  background-color: #dcfce7;
  border-color: #86efac;
}

.card-otp-chip .service-pill {
  font-size: 10px;
  background: #dcfce7;
  padding: 1px 4px;
  border-radius: 4px;
  font-weight: 600;
}

/* Detail Panel */
.app-detail-panel {
  background-color: var(--bg-surface);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.empty-detail-state {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  text-align: center;
  padding: 40px;
}

.empty-icon {
  font-size: 48px;
  margin-bottom: 16px;
}

.empty-detail-state h3 {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.detail-content {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.detail-header {
  padding: 20px 24px 12px;
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-surface);
}

.detail-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.detail-subject {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* OTP Highlight Banner */
.otp-highlight-banner {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #86efac;
  border-radius: var(--radius-md);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.otp-banner-left {
  display: flex;
  align-items: baseline;
  gap: 12px;
  flex-wrap: wrap;
}

.otp-tag {
  background-color: #166534;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}

.otp-value {
  font-size: 26px;
  font-weight: 800;
  font-family: var(--font-mono);
  color: #14532d;
  letter-spacing: 2px;
}

.otp-desc {
  font-size: 12px;
  color: #166534;
}

.detail-meta-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
  font-size: 13px;
}

.meta-row {
  display: flex;
  gap: 8px;
}

.meta-label {
  color: var(--text-muted);
  width: 50px;
  flex-shrink: 0;
}

.meta-val.highlight {
  color: var(--text-primary);
  font-weight: 500;
}

.detail-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border-color);
  margin-top: 8px;
}

.tab-btn {
  background: transparent;
  border: none;
  outline: none;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.tab-btn:hover {
  color: var(--text-primary);
}

.tab-btn.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.tab-panels {
  flex: 1;
  overflow: hidden;
  position: relative;
  background-color: var(--bg-surface);
}

.tab-panel {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 20px;
}

.tab-panel.active {
  display: block;
}

.html-preview-frame {
  width: 100%;
  height: 100%;
  border: none;
  background-color: #fff;
}

.text-preview, .raw-preview {
  font-family: var(--font-mono);
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text-primary);
  line-height: 1.6;
}

.otp-table-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.otp-card-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 14px;
  background-color: var(--bg-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.otp-code-big {
  font-size: 20px;
  font-weight: 700;
  font-family: var(--font-mono);
  color: var(--primary-color);
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
}

.modal-card {
  background-color: var(--bg-surface);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 600px;
  max-height: 88vh;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-card.modal-lg {
  max-width: 860px;
}

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

.btn-close {
  background: transparent;
  border: none;
  font-size: 24px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 20px;
  overflow-y: auto;
}

.modal-footer {
  padding: 12px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background-color: #fafbfc;
}

.markdown-body h4 {
  margin: 16px 0 8px;
  color: var(--text-primary);
}

.markdown-body ol {
  padding-left: 20px;
  margin-bottom: 12px;
}

.markdown-body li {
  margin-bottom: 6px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* Inline code pill for general markdown text */
.markdown-body :not(pre) > code {
  font-family: var(--font-mono);
  background-color: #e2e8f0;
  color: #0f172a;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 500;
}

/* Wizard Steps */
.wizard-steps-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 16px;
}

.wizard-step-box {
  display: flex;
  gap: 14px;
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.step-num {
  background-color: var(--primary-color);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  height: fit-content;
  white-space: nowrap;
}

.step-content {
  flex: 1;
}

.step-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.step-desc {
  font-size: 13px;
  color: var(--text-secondary);
}

.email-chips-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.email-chip {
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--primary-color);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.email-chip:hover {
  background-color: #dbeafe;
  border-color: #93c5fd;
}

.config-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
  font-size: 12px;
}

.config-table th, .config-table td {
  border: 1px solid var(--border-color);
  padding: 8px 10px;
  text-align: left;
}

.config-table th {
  background-color: #f1f5f9;
  font-weight: 600;
}

/* Forms & Config Grid */
.config-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.config-card {
  background-color: #fafbfc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px;
}

.config-card h4 {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: 14px;
  color: var(--text-primary);
}

.form-group {
  margin-bottom: 14px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}

.form-input, .form-textarea {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  outline: none;
  font-family: inherit;
  background-color: #fff;
  transition: border-color 0.15s;
}

.form-input:focus, .form-textarea:focus {
  border-color: var(--primary-color);
}

.form-help {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 4px;
}

.preset-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.stat-box {
  background-color: #fff;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}

.stat-title {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
}

.stat-value {
  font-size: 18px;
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--primary-color);
  margin-top: 2px;
}

/* Code Generator Modal Styles & Code Blocks */
.code-snippets-tabs {
  margin-top: 12px;
}

.tab-row {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.code-tab {
  background: var(--bg-sidebar);
  border: 1px solid var(--border-color);
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--text-secondary);
}

.code-tab.active {
  background-color: var(--primary-color);
  color: #fff;
  border-color: var(--primary-color);
}

/* HIGH-CONTRAST PROFESSIONAL CODE BLOCK */
.code-block-wrapper {
  position: relative;
  background-color: #0b132b !important;
  border: 1px solid #1e293b !important;
  border-radius: var(--radius-md);
  padding: 16px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.code-block-wrapper pre {
  margin: 0 !important;
  background: transparent !important;
  border: none !important;
  padding: 0 !important;
  overflow-x: auto;
}

.code-block-wrapper code,
.markdown-body .code-block-wrapper code,
.markdown-body pre code {
  font-family: var(--font-mono) !important;
  font-size: 13px !important;
  color: #38bdf8 !important; /* High-contrast bright cyan */
  background: transparent !important;
  background-color: transparent !important;
  padding: 0 !important;
  border-radius: 0 !important;
  line-height: 1.65 !important;
  display: block;
  white-space: pre !important;
  letter-spacing: 0.02em;
}

.copy-snippet-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background-color: rgba(255, 255, 255, 0.12) !important;
  color: #f8fafc !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 4px;
}
.copy-snippet-btn:hover {
  background-color: rgba(255, 255, 255, 0.25) !important;
  color: #ffffff !important;
}

/* Toast */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 1000;
}

.toast {
  background-color: #0f172a;
  color: #fff;
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.2s ease-out;
}

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

.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary-color);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 8px;
}

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

.loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 0;
  color: var(--text-muted);
  font-size: 13px;
}

/* Login Screen / Overlay */
.login-backdrop {
  position: fixed;
  inset: 0;
  background: radial-gradient(circle at 50% 35%, rgba(30, 41, 59, 0.95) 0%, rgba(15, 23, 42, 0.98) 100%);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 20px;
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 400px;
  padding: 36px 30px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.35);
  text-align: center;
  animation: loginSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes loginSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-header {
  margin-bottom: 24px;
}

.login-brand-icon {
  width: 52px;
  height: 52px;
  background-color: var(--primary-light);
  color: var(--primary-color);
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 14px;
}

.login-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.45;
}

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

.pwd-input-wrap .form-input {
  padding-right: 42px;
  font-size: 14px;
  height: 42px;
}

.btn-pwd-eye {
  position: absolute;
  right: 10px;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 14px;
  opacity: 0.6;
  transition: opacity 0.15s;
  padding: 4px;
}

.btn-pwd-eye:hover {
  opacity: 1;
}

.login-err-tip {
  color: #ef4444;
  font-size: 12px;
  font-weight: 500;
  margin-top: 6px;
  text-align: left;
}

.btn-lg {
  padding: 10px 18px;
  font-size: 14px;
  height: 42px;
  justify-content: center;
}

/* ==========================================================================
   Visitor Pickup Page Styles (访客专属取件页面)
   ========================================================================== */
.guest-body {
  background-color: #f8fafc;
  color: var(--text-primary);
  min-height: 100vh;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.guest-layout {
  max-width: 1380px;
  width: 100%;
  margin: 0 auto;
  padding: 16px 20px 24px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  box-sizing: border-box;
  gap: 16px;
}

.guest-header {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
  gap: 12px;
}

.guest-header-left {
  display: flex;
  align-items: center;
  gap: 14px;
}

.guest-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.guest-page-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

.guest-mailbox-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background-color: var(--primary-light);
  color: var(--primary-color);
  border: 1px solid rgba(37, 99, 235, 0.2);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.guest-mailbox-pill:hover {
  background-color: rgba(37, 99, 235, 0.15);
}

.btn-pill-copy {
  background: transparent;
  border: none;
  color: var(--primary-color);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  padding: 2px;
}

.guest-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.guest-sse-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--success-color);
  background-color: rgba(16, 185, 129, 0.1);
  padding: 4px 10px;
  border-radius: 20px;
}

.guest-sse-badge.disconnected {
  color: #f59e0b;
  background-color: rgba(245, 158, 11, 0.1);
}

/* Hero OTP Box */
.guest-hero-card {
  background: linear-gradient(135deg, #ffffff 0%, #f0f7ff 100%);
  border: 1px solid #bae6fd;
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.06);
  transition: all 0.2s ease;
}

.guest-hero-card.active-code {
  border-color: #38bdf8;
  background: linear-gradient(135deg, #f8fafc 0%, #e0f2fe 100%);
  box-shadow: 0 6px 20px rgba(14, 165, 233, 0.12);
}

.hero-card-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
}

.hero-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.hero-service-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: #0369a1;
}

.hero-code-display {
  display: flex;
  align-items: baseline;
  margin: 4px 0;
}

.hero-code-val {
  font-family: var(--font-mono);
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  line-height: 1;
}

.hero-code-val.has-code {
  color: #0284c7;
  text-shadow: 0 2px 8px rgba(2, 132, 199, 0.2);
}

.hero-desc {
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 680px;
}

.hero-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.btn-hero-copy {
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-md);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.25);
  transition: all 0.2s ease;
}

.btn-hero-copy:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.35);
}

.btn-hero-copy.btn-copy-success {
  background-color: #10b981 !important;
  border-color: #10b981 !important;
}

.hero-time-tip {
  font-size: 11.5px;
  color: var(--text-muted);
}

/* Guest Workspace */
.guest-workspace {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 16px;
  flex: 1;
  min-height: 0;
}

.guest-list-panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 240px);
}

.guest-list-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 8px;
  background-color: #fafbfc;
}

.guest-list-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.guest-search-input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  background-color: #ffffff;
  outline: none;
  box-sizing: border-box;
}

.guest-search-input:focus {
  border-color: var(--primary-color);
}

.guest-cards-container {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guest-detail-panel {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  max-height: calc(100vh - 240px);
}

@media (max-width: 900px) {
  .guest-workspace {
    grid-template-columns: 1fr;
    max-height: none;
  }
  .guest-list-panel, .guest-detail-panel {
    max-height: 500px;
  }
  .hero-right {
    align-items: flex-start;
    width: 100%;
  }
  .btn-hero-copy {
    width: 100%;
  }
}

/* Sidebar Copy Link Button */
.btn-copy-alias-link {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: 0;
  transition: all 0.15s ease;
}

.group-alias-item:hover .btn-copy-alias-link {
  opacity: 1;
}

.btn-copy-alias-link:hover {
  color: var(--primary-color);
  background-color: var(--primary-light);
}

/* Export Links Modal */
.export-links-box {
  width: 100%;
  font-family: var(--font-mono);
  font-size: 12px;
  background-color: #f8fafc;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 10px;
  box-sizing: border-box;
  resize: vertical;
  line-height: 1.6;
}

