/* Da's time slots 样式 */
* { box-sizing: border-box; }

/* 表单控件默认不继承字体，统一成页面字体 */
button, input, select, textarea { font-family: inherit; }

body {
  margin: 0;
  font-family: "华文中宋", "STZhongsong", "SimSun", "Songti SC", serif;
  background: #f7f8fa;
  color: #222;
}

.page-header {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 16px 10px;
  /* 撑到能装下右侧「头像 + 两行说明」，两块纵向齐平 */
  min-height: 200px;
}

.header-main {
  min-width: 0;
  min-height: 170px;
  display: flex;
  flex-direction: column;
  justify-content: center; /* 与右侧「头像＋字」同一垂直中轴 */
}

.page-header h1 {
  margin: 0;
  font-size: 28px;
  font-weight: 700;
}

.subtitle {
  margin: 8px 0 0;
  font-size: 16px;
  color: #555;
}

/* 说明文字右边界对齐到「周三」列的右边界：60px 时间列 + 3/5 剩余宽度 */
.subtitle.hint {
  margin-top: 6px;
  font-size: 16px;
  color: #7d7d7d;
  max-width: calc(60px + (100% - 60px) * 0.6);
}

/* 右上角小像＋说明，纵向撑满左侧标题区（与 title 区同高） */
.header-side {
  position: absolute;
  top: 20px;
  bottom: 36px;
  right: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  text-align: center;
}

.side-bottom {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.da-face {
  display: block;
  width: 101px;
  height: auto;
  mix-blend-mode: multiply; /* 去掉白底，融进浅灰背景 */
}

.side-note {
  margin: 4px 0 0;
  font-size: 14px;
  line-height: 1.45;
  color: #8a8a8a;
  white-space: nowrap;
}

.side-note .forgot {
  font-weight: 700;
  color: #5f5f5f;
}

/* 周切换控件（忘忘字正下方） */
.week-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.week-label {
  font-size: 14px; /* 与「忘忘忘忘忘」同字号 */
  font-weight: 700;
  color: #222;
  border: 1px solid #000; /* 细黑外框线 */
  border-radius: 4px;
  padding: 3px 10px;
  line-height: 1.2;
  white-space: nowrap;
  background: #fff;
}

.week-arrow {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: #000;
  font-size: 0;
  line-height: 0;
  padding: 0;
  cursor: pointer;
}

.week-arrow svg { display: block; }
.week-arrow:hover { opacity: 0.6; }
.week-arrow:active { opacity: 0.4; }

.page-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 12px 16px 40px;
}

.status {
  font-size: 13px;
  color: #888;
  padding: 6px 2px;
}
.status.warn { color: #b45309; }

/* ---------- 网格 ---------- */
.grid {
  display: flex;
  border: 1px solid #d8dce2;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  min-width: 720px;
}

.time-col {
  flex: 0 0 60px;
  border-right: 1px solid #d8dce2;
  background: #fafbfc;
}

.time-col .corner {
  height: 44px;
  border-bottom: 1px solid #d8dce2;
}

.time-labels {
  position: relative;
}

.time-tick {
  position: absolute;
  right: 8px;
  transform: translateY(-50%);
  font-size: 12px;
  color: #888;
  background: #fafbfc;
  padding: 0 2px;
}

.day-col {
  flex: 1 1 0;
  position: relative;
  border-right: 1px solid #e6e9ee;
}

.day-col:last-child { border-right: none; }

.day-head {
  height: 44px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid #d8dce2;
  background: #fafbfc;
  font-size: 13px;
  font-weight: 600;
}

.day-head .dow { font-size: 13px; }
.day-head .date { font-size: 11px; color: #888; font-weight: 400; }
.day-head.today { background: #fff7e6; }
.day-head.today .dow { color: #d48806; }

/* 网格背景：整点粗线（首条在 08:00，即 44px 处，之后每 88px）+ 每15分钟细线（22px） */
.day-body {
  position: relative;
  cursor: pointer;
  background-image:
    repeating-linear-gradient(to bottom, #dfe3e9 0, #dfe3e9 1px, transparent 1px, transparent 88px),
    repeating-linear-gradient(to bottom, #eef0f3 0, #eef0f3 1px, transparent 1px, transparent 22px);
  background-position: 0 44px, 0 0;
}

/* 家庭时间 block（浅蓝，仅提示） */
.family-block {
  position: absolute;
  left: 0;
  right: 0;
  background: rgba(173, 216, 230, 0.45);
  border-left: 3px solid rgba(100, 149, 237, 0.35);
  pointer-events: none; /* 不挡点击，仍可约 */
  z-index: 1;
}

.family-block .family-label {
  position: sticky;
  top: 2px;
  font-size: 11px;
  color: #5b83ad;
  padding: 2px 4px;
}

/* 本地批量事件（data.js 写入，不可在页面删除） */
.event-block {
  position: absolute;
  background: rgba(120, 120, 120, 0.16);
  border: 1px solid rgba(120, 120, 120, 0.4);
  border-radius: 4px;
  font-size: 11px;
  color: #444;
  padding: 2px 4px;
  overflow: hidden;
  z-index: 2;
  cursor: default;
}

/* 访问者预约块 */
.booking {
  position: absolute;
  border-radius: 4px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  font-size: 12px;
  padding: 1px 4px;
  overflow: hidden;
  cursor: pointer;
  z-index: 3;
  line-height: 1.25;
}

.booking:hover {
  filter: brightness(0.94);
  z-index: 4;
}

.booking .b-name { font-weight: 650; }
.booking .b-time { font-size: 10px; opacity: 0.75; display: block; }
.booking .b-note { font-size: 10px; opacity: 0.8; display: block; }

/* ---------- modal ---------- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal.hidden { display: none; }

.modal-card {
  background: #fff;
  border-radius: 10px;
  padding: 20px 22px;
  width: 340px;
  max-width: 100%;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.18);
}

.modal-card h2 {
  margin: 0 0 14px;
  font-size: 17px;
}

.form-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.form-row label {
  flex: 0 0 72px;
  font-size: 13px;
  color: #555;
}

.form-row input,
.form-row select {
  flex: 1;
  padding: 7px 8px;
  border: 1px solid #cfd4db;
  border-radius: 6px;
  font-size: 14px;
}

.form-static { font-size: 14px; font-weight: 600; }

.req { color: #c0392b; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 18px;
}

.btn {
  padding: 7px 16px;
  border: 1px solid #cfd4db;
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
  cursor: pointer;
}

.btn:hover { background: #f2f4f7; }

.btn.primary {
  background: #2f6fed;
  border-color: #2f6fed;
  color: #fff;
}

.btn.primary:hover { background: #255ed0; }

.btn.danger {
  background: #e74c3c;
  border-color: #e74c3c;
  color: #fff;
}

.btn.danger:hover { background: #cf3e2e; }

.detail-body {
  font-size: 14px;
  line-height: 1.8;
}

.detail-body .kv { display: flex; gap: 8px; }
.detail-body .kv .k { flex: 0 0 72px; color: #777; }

/* ---------- toast ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 40px;
  transform: translateX(-50%);
  background: rgba(30, 30, 30, 0.88);
  color: #fff;
  font-size: 13px;
  padding: 9px 18px;
  border-radius: 20px;
  z-index: 200;
  transition: opacity 0.25s;
}

.toast.hidden { opacity: 0; pointer-events: none; }

/* ---------- 页头补充 ---------- */
/* 时间列角标 */
.time-col .corner {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 8px;
  font-size: 11px;
  color: #a6adb7;
}

/* 首尾刻度不越过边界 */
.time-tick.first { transform: none; }
.time-tick.last { transform: translateY(-100%); }

/* ---------- 横向滚动容器 ---------- */
.grid-wrap { overflow-x: auto; padding-bottom: 4px; }

/* ---------- 图例 ---------- */
.legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 10px 0 0;
  font-size: 12px;
  color: #7b838d;
}
.legend .sw {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  margin-left: 10px;
}
.legend .sw.family {
  background: rgba(173, 216, 230, 0.7);
  border-left: 3px solid rgba(100, 149, 237, 0.5);
}
.legend .sw.event { background: rgba(120, 120, 120, 0.28); border: 1px solid rgba(120, 120, 120, 0.5); }
.legend .sw.booking { background: hsl(210, 62%, 82%); border: 1px solid rgba(0, 0, 0, 0.18); }

/* 窄屏 */
@media (max-width: 760px) {
  .page-header h1 { font-size: 22px; }
  .subtitle, .subtitle.hint { font-size: 14px; }
  .da-face { width: 64px; }
  .side-note { font-size: 11px; }
  .week-label { font-size: 11px; }
  .week-arrow { width: 24px; height: 24px; }
  .week-arrow svg { width: 12px; height: 12px; }
  .modal-card { width: 100%; }
}
