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

:root {
  --bg: #f4f6fb;
  --surface: #ffffff;
  --border: #e3e7f0;
  --text: #1f2937;
  --muted: #8a94a6;
  --accent: #2563eb;
  --accent-soft: #dbeafe;
  --danger: #dc2626;
}

html, body { height: 100%; }

body {
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ---- 顶栏 ---- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.nav { display: flex; align-items: center; gap: 12px; }
.month-title { font-size: clamp(20px, 3vw, 30px); min-width: 200px; text-align: center; }

.btn, .btn-round {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
}
.btn { padding: 8px 16px; border-radius: 8px; font-size: 14px; }
.btn-round { width: 40px; height: 40px; border-radius: 50%; font-size: 22px; line-height: 1; }
.btn:hover, .btn-round:hover { background: var(--accent-soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: #1d4ed8; }

.account-area { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.account-area .dot { width: 8px; height: 8px; border-radius: 50%; background: #16a34a; }
.account-logout { border: 0; background: transparent; color: var(--accent); cursor: pointer; font: inherit; }
.account-logout:hover { text-decoration: underline; }

/* ---- 备案页脚 ---- */
.site-footer {
  flex: 0 0 auto;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  background: var(--surface);
  font-size: 12px;
  line-height: 1.3;
  text-align: center;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover,
.site-footer a:focus-visible {
  color: var(--accent);
  text-decoration: underline;
}

.site-footer a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

@media (max-width: 700px) {
  .site-footer {
    padding: 7px 12px;
    font-size: 11px;
  }
}

/* ---- 星期表头 ---- */
.weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.weekdays > div {
  text-align: center;
  padding: 8px 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
}

/* ---- 日历网格 ---- */
.calendar {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-template-rows: repeat(6, 1fr);
  gap: 8px;
  padding: 10px;
  min-height: 0;
}

.day {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  transition: box-shadow .2s ease, border-color .2s ease;
}
.day.other { opacity: .55; }
.day.today { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.day:hover { border-color: var(--accent); box-shadow: 0 10px 24px rgba(15, 23, 42, .14); }
.day.other:hover { opacity: 1; }

/* 大号半透明日期底图（锚定下半部，避免被记录遮挡） */
.day .date-bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(4rem, 11vw, 8rem);
  font-weight: 800;
  color: rgba(37, 99, 235, 0.10);
  pointer-events: none;
  user-select: none;
  z-index: 0;
  line-height: 1;
}
.day.today .date-bg { color: rgba(37, 99, 235, 0.18); }
.day.other .date-bg { color: rgba(37, 99, 235, 0.06); }

/* 左上小日期角标 */
.day .date-corner {
  position: absolute;
  top: 8px;
  left: 8px;
  z-index: 1;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(255,255,255,.7);
  padding: 2px 6px;
  border-radius: 6px;
}
.day.today .date-corner { color: var(--accent); }

/* 记录列表：位于上方，限制高度，底部留给日期底图 */
.day .items {
  position: relative;
  z-index: 1;
  flex: 0 0 auto;
  max-height: 62%;
  margin-top: 30px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  scrollbar-width: thin;
}
.day .item-row {
  display: flex;
  align-items: center;
  gap: 2px;
  background: rgba(219, 234, 254, 0.72);
  border-radius: 6px;
  padding: 2px 4px 2px 5px;
  font-size: 12px;
  line-height: 1.3;
}
.day .item-text {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.day .item-text:hover { text-decoration: underline; }
.day .icon-btn {
  flex-shrink: 0;
  width: 15px;
  height: 15px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.day .icon-btn:hover { background: rgba(37,99,235,.15); color: var(--accent); }
.day .icon-btn.del:hover { background: rgba(220,38,38,.12); color: var(--danger); }
.day .icon-btn.todo:hover { background: rgba(245,158,11,.15); color: #d97706; }

/* 编辑按钮（右上角，避免压住日期） */
.day .edit-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 2;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .1s;
}
.day .edit-btn:hover { background: var(--accent); color: #fff; transform: scale(1.08); }

/* ---- 弹窗 ---- */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 300;
}
.modal.hidden { display: none; }

.modal-card {
  width: min(560px, 92vw);
  max-height: 88vh;
  background: var(--surface);
  border-radius: 16px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 50px rgba(0,0,0,.2);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.modal-head h2 { font-size: 20px; }

.editor {
  flex: 1;
  min-height: 260px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  line-height: 1.6;
  font-family: inherit;
  outline: none;
}
.editor:focus { border-color: var(--accent); }

.editor-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
  font-size: 15px;
  outline: none;
}
.editor-input:focus { border-color: var(--accent); }

.bulk-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
}
.bl-row { display: flex; align-items: center; gap: 8px; }
.bl-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
}
.bl-input:focus { border-color: var(--accent); }

.modal-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.hint { color: #059669; font-size: 13px; }

/* ---- 原位放大层（悬停时从格子原位生长，内容大字号重渲染=清晰） ---- */
.zoom-overlay {
  position: fixed;
  z-index: 100;
  background: var(--surface);
  border: 1px solid var(--accent);
  border-radius: 12px;
  box-shadow: 0 24px 60px rgba(15, 23, 42, .28);
  overflow: hidden;
  padding: 10px;
  display: flex;
  flex-direction: column;
  transition: left .25s ease, top .25s ease, width .25s ease, height .25s ease;
}
.zoom-overlay.hidden { display: none; }

.zoom-overlay .zo-date-bg {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(6rem, 18vh, 11rem);
  font-weight: 800;
  color: rgba(37, 99, 235, 0.12);
  pointer-events: none;
  user-select: none;
}
.zoom-overlay .zo-date-corner {
  font-size: 17px;
  font-weight: 700;
  color: var(--accent);
}
.zoom-overlay .zo-items {
  margin-top: 18px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
  min-height: 0;
}
.zoom-overlay .zo-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 18px;
  line-height: 1.4;
  background: rgba(219, 234, 254, 0.72);
  border-radius: 8px;
  padding: 8px 10px;
}
.zoom-overlay .zo-item .zo-actions {
  display: flex;
  gap: 4px;
  margin-top: 2px;
  flex-shrink: 0;
}
.zoom-overlay .zo-item .zo-text { flex: 1; min-width: 0; word-break: break-word; }
.zoom-overlay .zo-empty { color: var(--muted); font-size: 16px; }
.zoom-overlay .zo-icon {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 5px;
  background: transparent;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.zoom-overlay .zo-icon:hover { background: rgba(37,99,235,.15); color: var(--accent); }
.zoom-overlay .zo-icon.del:hover { background: rgba(220,38,38,.12); color: var(--danger); }
.zoom-overlay .zo-add {
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 2;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s, transform .1s;
}
.zoom-overlay .zo-add:hover { background: var(--accent); color: #fff; transform: scale(1.08); }

/* ---- 左右布局：日历 + 右侧待办 ---- */
.main-area { flex: 1; display: flex; min-height: 0; }
.cal-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.todo-panel {
  width: 280px;
  flex-shrink: 0;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.todo-head {
  padding: 14px 16px 6px;
  border-bottom: 1px solid var(--border);
}
.todo-title { font-size: 18px; margin: 0; }
.todo-hint { display: block; margin-top: 4px; font-size: 12px; color: var(--muted); }

.todo-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px 14px;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.todo-empty { color: var(--muted); font-size: 14px; }

 .todo-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  cursor: grab;
  user-select: none;
  transition: transform .12s ease, box-shadow .12s ease, opacity .12s ease;
}
.todo-item:hover { box-shadow: 0 4px 12px rgba(15,23,42,.12); }
.todo-item.dragging { opacity: .4; transform: scale(.96); }
.todo-text { flex: 1; min-width: 0; white-space: pre-wrap; word-break: break-word; }
.todo-btn {
  flex-shrink: 0;
  width: 22px; height: 22px;
  border: none; border-radius: 5px;
  background: transparent; color: var(--muted);
  font-size: 13px; line-height: 1; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.todo-btn:hover { background: rgba(15,23,42,.08); color: var(--text); }
.todo-btn.edit:hover { background: rgba(59,130,246,.12); color: var(--accent); }
.todo-btn.del:hover { background: rgba(220,38,38,.12); color: var(--danger); }
.todo-foot {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
  justify-content: center;
}
.todo-add-btn { padding: 10px 26px; font-size: 15px; }
.todo-modal-card { width: min(560px, 92vw); }
.todo-editor { min-height: 300px; }
.record-editor { min-height: 300px; }
.todo-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
}
.todo-input:focus { border-color: var(--accent); }

/* 拖拽到格子的高亮 */
.day.drag-over {
  border-color: var(--accent);
  box-shadow: inset 0 0 0 3px var(--accent);
  background: var(--accent-soft);
}

/* ---- 手机验证码注册 / 登录 ---- */
.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
}
.login-overlay.hidden { display: none; }
.login-icp {
  position: absolute;
  right: 16px;
  bottom: 18px;
  left: 16px;
  color: #dbe4ea;
  font-size: 12px;
  line-height: 1.4;
  text-align: center;
}
.login-icp:hover,
.login-icp:focus-visible {
  color: #ffffff;
}
.login-icp:focus-visible {
  outline: 2px solid #ffffff;
  outline-offset: 3px;
  border-radius: 2px;
}

.login-card {
  background: var(--surface);
  border-radius: 18px;
  padding: 32px;
  width: min(420px, 92vw);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.3);
}
.login-brand { color: var(--accent); font-size: 13px; font-weight: 700; letter-spacing: .12em; margin-bottom: 10px; }
.login-title { font-size: 25px; margin: 0 0 8px; }
.login-desc { font-size: 14px; color: var(--muted); line-height: 1.6; margin: 0 0 22px; }
.login-field { display: block; margin-top: 14px; }
.login-field.hidden { display: none; }
.login-field > span { display: block; color: var(--text); font-size: 13px; font-weight: 600; margin-bottom: 7px; }
.login-field input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 17px;
  outline: none;
}
.login-field.locked input { color: var(--muted); background: var(--bg); }
.login-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.delivery-hint { min-height: 20px; color: var(--muted); font-size: 12px; margin-top: 10px; }
.login-error { min-height: 20px; color: var(--danger); font-size: 13px; margin-top: 8px; }
.login-btn { width: 100%; margin-top: 10px; padding: 11px; font-size: 16px; }
.login-btn:disabled { opacity: .6; cursor: wait; }
.login-resend { display: block; margin: 14px auto 0; border: 0; background: transparent; color: var(--accent); cursor: pointer; font-size: 13px; }
.login-resend.hidden { display: none; }
.login-resend:disabled { color: var(--muted); cursor: default; }
