/* ═══════════════════════════════════════
   个人邮局系统 · 设计系统基础
═══════════════════════════════════════ */

:root {
  /* 颜色 */
  --accent: #0071e3;
  --accent-hover: #0077ed;
  --accent-light: rgba(0, 113, 227, .15);
  --destructive: #ff3b30;
  --success: #34c759;
  --warning: #ff9f0a;

  /* 背景 (Light Theme) */
  --bg: #fbfbfd;
  --bg-white: #ffffff;
  --bg-sidebar: rgba(245, 245, 247, 0.8);
  --bg-sidebar-hover: #e8e8ed;
  --bg-card: #ffffff;
  --bg-input: rgba(0, 0, 0, 0.04);
  --bg-overlay: rgba(255, 255, 255, .7);

  /* 文字 */
  --text: #1d1d1f;
  --text-secondary: #86868b;
  --text-tertiary: #6e6e73;
  --text-sidebar: #1d1d1f;
  --text-sidebar-dim: #86868b;

  /* 边框 */
  --border: rgba(0, 0, 0, .08);
  --border-dark: rgba(0, 0, 0, .12);
  --divider: rgba(0, 0, 0, .05);

  /* 阴影 */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, .04);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, .08);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .1);
  --shadow-xl: 0 30px 60px rgba(0, 0, 0, .15);

  /* 圆角 */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --r-full: 980px;

  /* 字体 */
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SF Mono", "Menlo", "Consolas", monospace;

  /* 动效 */
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --dur-fast: .2s;
  --dur-base: .4s;
  --dur-slow: .6s;

  /* 侧边栏宽度 */
  --sidebar-w: 240px;
}

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

html {
  font-size: 15px;
  -webkit-text-size-adjust: 100%;
}

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

a {
  text-decoration: none;
  color: inherit;
}

ul,
ol {
  list-style: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
}

img {
  display: block;
  max-width: 100%;
}

/* ── 通用组件 ── */

/* 按钮 */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: var(--r-full);
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  transition: all var(--dur-fast) var(--ease);
  cursor: pointer;
  white-space: nowrap;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
}

.btn-primary:hover {
  background: var(--accent-hover);
  transform: scale(1.02);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: rgba(0, 0, 0, 0.08);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

.btn-ghost:hover {
  background: var(--accent-light);
}

.btn-danger {
  background: rgba(255, 59, 48, .1);
  color: var(--destructive);
  border: none;
}

.btn-danger:hover {
  background: rgba(255, 59, 48, .2);
}

.btn-icon {
  padding: 8px;
  border-radius: var(--r-md);
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.btn-icon:hover {
  background: var(--bg-input);
}

/* 输入框 */
.input {
  width: 100%;
  background: var(--bg-input);
  border: 1.5px solid transparent;
  border-radius: var(--r-md);
  padding: 10px 14px;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color var(--dur-fast);
}

.input:focus {
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.15);
}

.input::placeholder {
  color: var(--text-tertiary);
}

/* 标签/徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-full);
  font-size: 11px;
  font-weight: 600;
  background: var(--accent);
  color: #fff;
}

.badge-gray {
  background: var(--text-tertiary);
}

/* 分割线 */
.divider {
  height: 1px;
  background: var(--divider);
  margin: 0;
}

/* 空状态 */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  gap: 12px;
  color: var(--text-secondary);
  text-align: center;
  padding: 40px;
}

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

.empty-state h3 {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
}

.empty-state p {
  font-size: 14px;
  line-height: 1.6;
}

/* 滚动条 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, .15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, .25);
}

/* 模态框 */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  backdrop-filter: blur(4px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn var(--dur-fast) var(--ease);
}

.modal {
  background: var(--bg-white);
  border-radius: var(--r-xl);
  padding: 28px;
  width: 480px;
  max-width: calc(100vw - 40px);
  box-shadow: var(--shadow-xl);
  animation: slideUp var(--dur-base) var(--ease-spring);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 18px;
  font-weight: 700;
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--bg-input);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--dur-fast);
}

.modal-close:hover {
  background: rgba(0, 0, 0, 0.08);
}

/* Toast 通知 */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-sidebar);
  color: #f5f5f7;
  padding: 12px 20px;
  border-radius: var(--r-full);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 500;
  transition: transform var(--dur-base) var(--ease-spring);
  white-space: nowrap;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

/* 动画 */
@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(.96);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: .5;
  }
}