/* ============ 基调：米白 / 石材灰 / 木色 / 暖橙 ============ */
:root {
  --bg: #f6f1e8;
  --card: #fffdf8;
  --line: #e6ddcc;
  --stone: #6f6a5f;
  --stone-light: #a8a294;
  --wood: #9c7a54;
  --wood-light: #e9dfd0;
  --orange: #d9732f;
  --orange-dark: #c0641f;
  --orange-light: #fbe9dc;
  --text: #3a362f;
  --danger: #b3402e;
  --danger-light: #f8e5e0;
  --ok: #5c7a4e;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(90, 75, 50, 0.08);
}

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

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

body {
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
}

.skip-link {
  position: fixed; left: 16px; top: 12px; z-index: 120;
  background: var(--text); color: #fff; padding: 10px 14px;
  border-radius: 8px; transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }

/* ============ 顶栏 ============ */
.topbar {
  max-width: 1280px;
  margin: 0 auto;
  padding: 18px 20px 0;
}
.brand { display: flex; align-items: center; gap: 12px; }
.logo-block {
  width: 40px; height: 40px; border-radius: 10px; flex: none;
  background: linear-gradient(135deg, var(--wood) 0%, var(--orange) 100%);
}
.logo-block.small { width: 28px; height: 28px; border-radius: 7px; }
.brand h1 { font-size: 20px; font-weight: 700; }
.sub { font-size: 13px; color: var(--stone); }

.demo-banner {
  margin-top: 10px;
  background: var(--orange-light);
  border: 1px solid var(--orange);
  color: var(--orange-dark);
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 14px;
  display: inline-block;
}

.tabs {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 14px;
  border-bottom: 2px solid var(--line);
  padding-bottom: 0;
}
.tab {
  border: none; background: transparent; cursor: pointer;
  font-size: 16px; color: var(--stone);
  padding: 10px 16px; border-radius: 10px 10px 0 0;
  border-bottom: 3px solid transparent;
  min-height: 44px;
  touch-action: manipulation;
}
.tab.active {
  color: var(--orange-dark); font-weight: 600;
  background: var(--card);
  border-bottom: 3px solid var(--orange);
}

/* ============ 主体 ============ */
main { max-width: 1280px; margin: 0 auto; padding: 20px; }
.view { display: none; }
.view.active { display: block; }

.page-head {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 12px; margin-bottom: 14px;
}
.page-head h2 { font-size: 20px; }
.date-line { color: var(--stone); font-size: 15px; }

.cta {
  background: var(--orange); color: #fff; border: none;
  font-size: 17px; font-weight: 600;
  padding: 14px 28px; border-radius: 999px; cursor: pointer;
  box-shadow: var(--shadow);
  min-height: 48px;
  touch-action: manipulation;
}
.cta:hover { background: var(--orange-dark); }

.empty-hint {
  background: var(--wood-light);
  border: 1px dashed var(--wood);
  color: var(--wood);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 15px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-title { font-weight: 700; font-size: 17px; margin-bottom: 12px; }
.card-title.separate { margin-top: 22px; }

.muted { color: var(--stone); font-size: 14px; margin-bottom: 10px; }
.muted.small { font-size: 13px; }
.auto-save-tip { color: var(--stone-light); font-size: 13px; margin-top: 6px; }
.voice-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.voice-btn[aria-pressed="true"] { background: var(--danger-light); border-color: var(--danger); color: var(--danger); font-weight: 600; }
.voice-status { color: var(--stone); font-size: 14px; }
.voice-privacy { color: var(--stone-light); font-size: 12px; margin-top: 8px; }

/* ============ 表单 ============ */
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; flex: 1; min-width: 220px; }
.field > span { font-size: 14px; color: var(--stone); }

input[type="text"], select, textarea {
  font-family: inherit; font-size: 16px; color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
}
textarea { resize: vertical; line-height: 1.7; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--wood);
  box-shadow: 0 0 0 3px rgba(156, 122, 84, 0.15);
}

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--orange-dark);
  outline-offset: 2px;
}

/* ============ 按钮 ============ */
.btn {
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font-size: 15px; padding: 10px 18px; border-radius: 10px; cursor: pointer;
  min-height: 44px;
  touch-action: manipulation;
}
.btn:active, .cta:active, .tab:active { opacity: 0.78; }
.btn:hover { border-color: var(--wood); background: var(--wood-light); }
.btn.primary { background: var(--orange); border-color: var(--orange); color: #fff; font-weight: 600; }
.btn.primary:hover { background: var(--orange-dark); }
.btn.wood { background: var(--wood); border-color: var(--wood); color: #fff; }
.btn.wood:hover { background: #85663f; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger:hover { background: #9a3626; }
.btn.small { font-size: 13px; padding: 6px 12px; min-height: 34px; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn-row.right { justify-content: flex-end; }
.btn-col { display: flex; flex-direction: column; gap: 10px; align-items: stretch; max-width: 320px; }

/* ============ 配图 ============ */
.photo-tip { color: var(--stone); font-size: 13px; margin-bottom: 10px; }
.photo-input { font-size: 14px; }
.photo-list { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.photo-item { width: 160px; }
.photo-item img {
  width: 160px; height: 120px; object-fit: cover;
  border-radius: 10px; border: 1px solid var(--line);
  display: block;
}
.photo-item .pname {
  font-size: 12px; color: var(--stone);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-top: 4px;
}
.photo-item input {
  font-size: 13px; padding: 6px 8px; margin-top: 4px;
}
.photo-item .btn { margin-top: 6px; }
.photo-gone {
  background: var(--wood-light); border: 1px dashed var(--wood);
  color: var(--wood); border-radius: 10px; padding: 10px 12px;
  font-size: 13px; margin-top: 10px;
}

/* ============ 生成任务区 ============ */
.warn-strip {
  background: var(--orange-light); border: 1px solid var(--orange);
  color: var(--orange-dark); border-radius: 8px;
  padding: 8px 12px; font-size: 14px; margin: 12px 0;
}
.online-generate {
  background: #faf7f0; border: 1px solid var(--line);
  border-radius: 10px; padding: 14px; margin-bottom: 12px;
}
.access-field { max-width: 360px; }
.online-generate .btn[disabled] { opacity: 0.62; cursor: wait; }

/* ============ 文案条目 ============ */
.copy-item {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}
.copy-head {
  display: flex; justify-content: space-between; align-items: center;
  flex-wrap: wrap; gap: 8px; margin-bottom: 8px;
}
.copy-meta { font-size: 14px; color: var(--stone); }
.badge {
  display: inline-block; font-size: 12px; border-radius: 999px;
  padding: 2px 10px; margin-left: 6px;
}
.badge.demo { background: var(--wood-light); color: var(--wood); border: 1px solid var(--wood); }
.badge.status { border: 1px solid currentColor; }
.st-material { color: var(--stone); }
.st-generated { color: var(--wood); }
.st-pending { color: var(--orange-dark); }
.st-published { color: var(--ok); }

.copy-text {
  white-space: pre-wrap; word-break: break-word;
  background: #faf7f0; border: 1px solid var(--line);
  border-radius: 10px; padding: 12px; font-size: 15px;
  max-height: 180px; overflow: hidden; position: relative;
}
.copy-item.expanded .copy-text { max-height: none; }
.copy-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

/* ============ 日历 ============ */
.calendar { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.day-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px;
  box-shadow: var(--shadow);
}
.day-num { font-size: 13px; color: var(--stone-light); font-weight: 600; }
.day-card input {
  font-weight: 600; margin: 4px 0 8px; background: transparent;
  border-color: transparent; padding: 6px 4px;
}
.day-card input:hover, .day-card input:focus { background: #fff; border-color: var(--line); }
.day-card .btn-row { margin-top: 6px; }

/* ============ 红线 ============ */
.redline-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.redline-item {
  display: flex; align-items: center; gap: 10px;
  background: #faf7f0; border: 1px solid var(--line);
  border-radius: 10px; padding: 8px 12px; font-size: 15px;
}
.redline-item input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--orange); flex: none; }
.redline-item .del { margin-left: auto; }
.inline-add { display: flex; gap: 10px; }
.inline-add input { flex: 1; }

/* ============ 反馈 ============ */
.fb-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; margin: 10px 0; }
.fb-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--stone); }
.fb-grid input { padding: 8px 10px; }

/* ============ 向导 / 弹窗 ============ */
.overlay {
  position: fixed; inset: 0; background: rgba(58, 54, 47, 0.45);
  display: flex; align-items: center; justify-content: center;
  padding: 16px; z-index: 50; overflow: auto;
}
.overlay[hidden] { display: none; }
.toast[hidden] { display: none; }
.demo-banner[hidden] { display: none; }
.wizard {
  background: var(--card); border-radius: 16px;
  max-width: 560px; width: 100%; padding: 22px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
  max-height: 92vh; overflow: auto;
}
.wizard-head { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 17px; margin-bottom: 14px; }
.step-panel { display: none; }
.step-panel.active { display: block; }
.step-panel h3 { font-size: 17px; margin-bottom: 12px; color: var(--wood); }
.wizard-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 18px; border-top: 1px solid var(--line); padding-top: 14px;
}
.step-ind { color: var(--stone-light); font-size: 14px; }

.modal {
  background: var(--card); border-radius: 14px;
  max-width: 420px; width: 100%; padding: 20px;
}
.modal p { margin-bottom: 16px; font-size: 15px; }

.toast {
  position: fixed; left: 50%; bottom: 32px; transform: translateX(-50%);
  background: var(--text); color: #fff;
  border-radius: 999px; padding: 10px 22px;
  font-size: 14px; z-index: 99; box-shadow: var(--shadow);
  max-width: 90vw; text-align: center;
}
.toast.ok { background: var(--ok); }
.toast.err { background: var(--danger); }

.foot {
  max-width: 1280px; margin: 0 auto; padding: 10px 20px 30px;
  color: var(--stone-light); font-size: 13px; text-align: center;
}

/* ============ 手机适配 360–390 ============ */
@media (max-width: 720px) {
  body { font-size: 15px; }
  .topbar, main, .foot { padding-left: 14px; padding-right: 14px; }
  .brand h1 { font-size: 17px; }
  .tabs {
    display: flex; flex-wrap: nowrap; overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-bottom: 2px solid var(--line);
  }
  .tab { flex: none; font-size: 15px; padding: 10px 12px; }
  .field { min-width: 100%; }
  .field-row { flex-direction: column; gap: 0; }
  .calendar { grid-template-columns: 1fr; }
  .cta { width: 100%; }
  .btn-row .btn { flex: 1; }
  .copy-actions .btn { flex: 1; }
  .photo-item { width: calc(50% - 7px); }
  .photo-item img { width: 100%; }
  .wizard { padding: 16px; }
  .inline-add { flex-direction: column; }
  .btn-col { max-width: none; }
  .voice-row .voice-btn { width: 100%; }
}

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