:root {
  --bg: #FFF8F0;
  --card-bg: #FFFFFF;
  --border: #F0E6D8;
  --accent: #D4A574;
  --accent-dark: #8B5E3C;
  --text-dark: #3D2B1F;
  --text-muted: #8B7355;
  --text-faint: #C4B8A2;
  --danger: #EF4444;
  --success: #10B981;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text-dark);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 40px;
}

.card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

.header {
  margin-bottom: 16px;
}

.header .username {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
  margin: 0 0 4px;
}

.header .bio {
  font-size: 14px;
  color: var(--text-muted);
  white-space: pre-wrap;
  margin: 0;
}

.header-with-avatar {
  display: flex;
  align-items: center;
  gap: 12px;
}
.header-with-avatar .avatar {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
  background: var(--border);
}

/* 返回导航：箭头 + 上一页标题，整行可点，比单独一行小字链接的点击区域大，手机上好点 */
.page-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 16px;
  text-decoration: none;
  padding: 4px 0;
}

.page-nav-arrow {
  font-size: 20px;
  line-height: 1;
  color: var(--text-dark);
}

.page-nav-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--text-dark);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-primary { background: var(--accent); color: #FFF; }
.btn-primary:disabled { background: var(--text-faint); cursor: not-allowed; }
.btn-secondary { background: var(--accent-dark); color: #FFF; }
.btn-outline { background: #FFF; color: var(--accent); border: 1px solid var(--accent); }
.btn-block { width: 100%; }

.hint {
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
}

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

.error-box {
  background: #FEF2F2;
  border: 1px solid #FCA5A5;
  color: var(--danger);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 14px;
  margin-bottom: 16px;
}

.success-box {
  background: #ECFDF5;
  border: 1px solid #6EE7B7;
  color: #047857;
  border-radius: 10px;
  padding: 16px;
  font-size: 14px;
  text-align: center;
}

/* 日历 */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.calendar-header .month-label {
  font-size: 17px;
  font-weight: 700;
}

.calendar-header button {
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-dark);
  cursor: pointer;
  padding: 10px 14px;
  line-height: 1;
}

.week-row, .day-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.week-row div {
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  padding: 4px 0;
}

.day-cell {
  aspect-ratio: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border-radius: 10px;
  border: 2px solid transparent;
  font-size: 14px;
  cursor: pointer;
  background: none;
  overflow: hidden;
}

.day-cell .day-num { line-height: 1; }

.day-cell.empty { cursor: default; }
.day-cell.busy { background: #DBEAFE; }
.day-cell.available { background: #FBEEDB; }
.day-cell.selected { border-color: var(--accent); }
.day-cell.selected .day-num { color: var(--accent); font-weight: 700; }

/* 角标以前是绝对定位贴在格子右上角、里面还放了数字，手机上格子很小时容易
   顶到格子外面、看着像"飘"到旁边去了。现在换成固定大小的纯色圆点：
   1) 不绝对定位，跟日期数字一样正常排版、垂直堆叠在下面，格子多小都不会跑出去
   2) 不放文字，尺寸完全固定，不存在"数字撑大了容器"这类跟内容长度相关的问题
   当天有没有排期光看格子背景色（忙碌/空位）已经能分辨，圆点只是再加一个强调，
   不需要靠它传递具体数量。 */
.day-cell .day-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent-dark);
  flex-shrink: 0;
}

/* 时段列表 */
.group-title {
  font-size: 12px;
  font-weight: 700;
  margin: 14px 0 4px;
  padding: 2px 8px;
  border-radius: 6px;
  display: inline-block;
}
.group-title:first-of-type { margin-top: 4px; }
.group-title-available { color: var(--accent-dark); background: #FBEEDB; }
.group-title-busy { color: var(--text-muted); background: #F0EDE8; }

.slot-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.slot-item:last-child { border-bottom: none; }
.slot-time { color: var(--text-dark); font-weight: 600; }
.slot-theme { color: var(--text-muted); }

.slot-item-available .slot-time { color: var(--accent-dark); }
.slot-item-available .btn { flex-shrink: 0; padding: 8px 14px; font-size: 13px; }

.slot-item-readonly { border-bottom: none; padding: 4px 0 0; }
.slot-item-readonly .slot-time { font-size: 16px; }

/* 表单 */
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.field input, .field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  /* 16px 起步：iOS Safari 对 <16px 的输入框聚焦时会自动放大整个页面 */
  font-size: 16px;
  color: var(--text-dark);
  background: #FFF;
  font-family: inherit;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--accent);
}
.field textarea { resize: vertical; min-height: 70px; }

.busy-ref-title {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 6px;
}

/* 作品图相册 */
.photo-grid-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.photo-col-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.photo-col-toggle .col-btn {
  border: none;
  background: #FFF;
  color: var(--text-muted);
  font-size: 12px;
  padding: 5px 10px;
  cursor: pointer;
}
.photo-col-toggle .col-btn.active {
  background: var(--accent);
  color: #FFF;
}
.photo-grid {
  display: grid;
  gap: 8px;
}
.photo-grid-1col { grid-template-columns: 1fr; }
.photo-grid-2col { grid-template-columns: 1fr 1fr; }
.photo-item {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  background: var(--border);
  overflow: hidden;
}
.photo-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* 作品图预览层 */
.lightbox {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.lightbox.open { display: flex; }
.lightbox-img {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
}
.lightbox-close,
.lightbox-nav {
  position: absolute;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
.lightbox-close {
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  font-size: 16px;
}
.lightbox-nav {
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  font-size: 24px;
}
.lightbox-prev { left: 12px; }
.lightbox-next { right: 12px; }
.lightbox-save {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
}

/* 申请表单里的参考图选择预览 */
.photo-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.photo-preview-item {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--border);
}
