/* ============================================================
   基础设计系统（买家页 + 管理后台共用）
   风格：参考 iPhone 官网的黑白极简风——大字号、留白、细分割线、
   黑色胶囊按钮、无阴影、无装饰图标、不加载外部资源。
   ============================================================ */

:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-soft: #f5f5f7;
  --surface-muted: #f5f5f7;
  --text: #1d1d1f;
  --text-soft: #424245;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --line-strong: #86868b;
  --accent: #1d1d1f;
  --accent-strong: #000000;
  --accent-soft: #f5f5f7;
  --danger: #b42318;
  --danger-soft: #f5f5f7;
  --success: #1d1d1f;
  --success-soft: #f5f5f7;
  --warning: #6e6e73;
  --warning-soft: #f5f5f7;
  --radius-lg: 28px;
  --radius: 18px;
  --radius-sm: 12px;
  --radius-pill: 980px;
  --shadow-sm: none;
  --shadow: none;
  --font-sans:
    -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display', 'Segoe UI',
    'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono:
    'SF Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, 'Liberation Mono', monospace;
  --page-max: 1180px;
  --reading-max: 720px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.47059;
  font-weight: 400;
  letter-spacing: -0.022em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1,
h2,
h3 {
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: -0.025em;
}

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

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
  letter-spacing: inherit;
}

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

button {
  cursor: pointer;
}

::selection {
  background: var(--text);
  color: #fff;
}

:focus-visible {
  outline: 2px solid var(--text);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ------------------------------------------------------------ 布局 */
.container {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 24px;
}

.container-narrow {
  width: 100%;
  max-width: var(--reading-max);
  margin: 0 auto;
  padding: 0 24px;
}

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

.stack-sm {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.wrap {
  flex-wrap: wrap;
}

.grow {
  flex: 1 1 auto;
  min-width: 0;
}

.mt-0 { margin-top: 0 !important; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mt-32 { margin-top: 32px; }
.mt-40 { margin-top: 40px; }
.mb-8 { margin-bottom: 8px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }

/* ------------------------------------------------------------ 文字 */
.muted { color: var(--muted); }
.small { font-size: 15px; }
.tiny { font-size: 12.5px; }
.strong { font-weight: 600; }
.mono { font-family: var(--font-mono); }
.break-anywhere {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.section-title {
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.divider {
  height: 1px;
  background: var(--line);
  border: 0;
  margin: 0;
}

/* ------------------------------------------------------------ 卡片 */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.card-pad {
  padding: 28px;
}

.card-soft {
  background: var(--surface-soft);
  border-color: transparent;
}

/* ------------------------------------------------------------ 按钮 */
.btn {
  --btn-bg: var(--surface-soft);
  --btn-color: var(--text);
  --btn-border: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 12px 24px;
  border: 1px solid var(--btn-border);
  border-radius: var(--radius-pill);
  background: var(--btn-bg);
  color: var(--btn-color);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  text-align: center;
  transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  --btn-bg: #e8e8ed;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  --btn-bg: #1d1d1f;
  --btn-color: #ffffff;
}

.btn-primary:hover {
  --btn-bg: #333336;
}

.btn-accent {
  --btn-bg: #1d1d1f;
  --btn-color: #ffffff;
}

.btn-accent:hover {
  --btn-bg: #333336;
}

.btn-ghost {
  --btn-bg: transparent;
  --btn-color: var(--text);
  min-height: 38px;
  padding: 8px 4px;
  border-radius: 0;
  font-size: 15px;
}

.btn-ghost:hover {
  --btn-bg: transparent;
  text-decoration: underline;
  text-underline-offset: 4px;
}

.btn-danger {
  --btn-bg: transparent;
  --btn-color: var(--danger);
  min-height: 38px;
  padding: 8px 12px;
  font-size: 15px;
}

.btn-danger:hover {
  --btn-bg: var(--surface-soft);
}

.btn-block {
  width: 100%;
}

.btn-lg {
  min-height: 54px;
  padding: 15px 30px;
  font-size: 17px;
}

.btn-sm {
  min-height: 34px;
  padding: 7px 16px;
  font-size: 14px;
}

.btn[disabled],
.btn.is-loading {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
  pointer-events: none;
}

.btn .spinner {
  width: 16px;
  height: 16px;
  border-width: 1.5px;
  border-color: currentColor transparent currentColor transparent;
}

/* ------------------------------------------------------------ 表单 */
.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

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

.hint {
  font-size: 14px;
  color: var(--muted);
  line-height: 1.5;
}

.input,
.textarea,
.select {
  width: 100%;
  min-height: 52px;
  padding: 14px 18px;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 17px;
  transition: border-color 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  appearance: none;
}

.input::placeholder,
.textarea::placeholder {
  color: #86868b;
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: var(--text);
  background: var(--surface);
  box-shadow: 0 0 0 4px rgba(0, 0, 0, 0.06);
}

.input[aria-invalid='true'],
.textarea[aria-invalid='true'] {
  border-color: var(--danger);
  background: var(--surface);
}

.input-mono {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
}

.textarea {
  min-height: 160px;
  resize: vertical;
  line-height: 1.6;
}

.select {
  padding-right: 44px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5l5-5' fill='none' stroke='%236e6e73' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  background-size: 12px 8px;
}

.form-error {
  display: none;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
}

.form-error.is-visible {
  display: block;
}

.field-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 0;
}

/* ------------------------------------------------------------ 标签 / 徽章 */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  background: var(--surface-soft);
  color: var(--muted);
  white-space: nowrap;
}

.badge-accent {
  background: #1d1d1f;
  color: #fff;
}

.badge-success {
  background: #1d1d1f;
  color: #fff;
}

.badge-warning {
  background: var(--surface-soft);
  color: var(--muted);
}

.badge-muted {
  background: var(--surface-soft);
  color: var(--muted);
}

.badge-danger {
  background: var(--surface-soft);
  color: var(--danger);
}

/* ------------------------------------------------------------ 提示 / 空状态 */
.notice {
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  font-size: 14px;
  line-height: 1.55;
}

.notice-warning {
  background: var(--surface-soft);
  color: var(--text-soft);
}

.notice-danger {
  background: var(--surface-soft);
  color: var(--text);
  box-shadow: inset 3px 0 0 var(--danger);
}

.notice-success {
  background: var(--surface-soft);
  color: var(--text);
}

.empty-state {
  padding: 56px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 15px;
}

/* ------------------------------------------------------------ 加载 */
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 2px solid var(--line);
  border-top-color: var(--text);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: var(--surface-soft);
  border-radius: var(--radius-sm);
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.6), transparent);
  animation: shimmer 1.3s infinite;
}

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

@keyframes shimmer {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

.loading-block {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 64px 24px;
  color: var(--muted);
  font-size: 14px;
}

/* ------------------------------------------------------------ Toast */
.toast-region {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 1000;
  width: min(92vw, 420px);
  pointer-events: none;
}

.toast {
  padding: 12px 20px;
  border-radius: var(--radius-pill);
  background: rgba(29, 29, 31, 0.94);
  color: #fff;
  font-size: 14px;
  line-height: 1.45;
  text-align: center;
  animation: toast-in 0.18s ease-out;
}

.toast-success {
  background: rgba(29, 29, 31, 0.94);
}

.toast-error {
  background: rgba(29, 29, 31, 0.94);
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ------------------------------------------------------------ 无障碍 */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

/* ------------------------------------------------------------ 动效偏好 */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 734px) {
  .container,
  .container-narrow {
    padding: 0 20px;
  }

  .card-pad {
    padding: 22px;
  }

  .btn-lg {
    min-height: 50px;
    font-size: 16px;
  }
}
