:root {
  --bg: #f5f6f7;
  --card: #ffffff;
  --line: #e4e6ea;
  --text: #1f2328;
  --muted: #6b7280;
  --accent: #1d9e75;
  --accent-bg: #e1f5ee;
  --accent-strong: #0f6e56;
  --danger: #c0392b;
  --radius: 12px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

.wrap {
  max-width: 560px;
  margin: 0 auto;
  padding: 10px 14px 48px;
}

header.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

header.top h1 {
  font-size: 14px;
  font-weight: 600;
  margin: 0;
  color: #9ca3af;
}

header.top .me {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 600;
}

/* 名字：不用纯黑，走天蓝偏青渐变 */
header.top .me .name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: .5px;
  color: #1ea7dd;
}

@supports ((-webkit-background-clip: text) or (background-clip: text)) {
  header.top .me .name {
    background: linear-gradient(135deg, #8ee6ff 0%, #4cc9f0 45%, #1ea7dd 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    color: transparent;
  }
}

header.top .avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: cover;
  border: 0.5px solid var(--line);
  background: #fff;
}

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

.card h2 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 10px;
}

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

button, .chip {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 12px;
  cursor: pointer;
}

button:active { background: #f0f1f3; }

.chip.active {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 600;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  padding: 10px 16px;
  width: 100%;
}

.btn-primary.cancel {
  background: #fff;
  color: var(--danger);
  border-color: #f0c8c2;
}

.btn-mini {
  font-size: 12px;
  padding: 3px 9px;
  color: var(--muted);
}

.btn-mini.danger { color: var(--danger); }

input[type="date"], input[type="number"], input[type="text"] {
  font: inherit;
  font-size: 14px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  width: 100%;
}

label.field { display: block; font-size: 12px; color: var(--muted); margin-bottom: 2px; }

/* 日历 */
.cal-head { font-size: 14px; font-weight: 600; margin: 0 0 10px; }
.grid7 { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.dow { text-align: center; font-size: 11px; color: var(--muted); padding-bottom: 2px; }

.day {
  height: 46px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: #fafbfc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  color: var(--text);
  cursor: pointer;
  padding: 0;
  position: relative;
}

.day.empty { background: transparent; border-color: transparent; cursor: default; }
.day.outside { opacity: .35; }
.day.today { border: 1px dashed #9aa0a6; font-weight: 600; }
.day.signed {
  background: var(--accent-bg);
  border-color: var(--accent);
  color: var(--accent-strong);
  font-weight: 600;
}
.day .dot { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); margin-top: 3px; }

/* 已锁定：底色更实，右上角带小锁，点击不可取消 */
.day.locked { background: #cdeadd; border-color: var(--accent-strong); }
.day .lock-mark { position: absolute; top: 4px; right: 4px; }

.lock-mark {
  display: inline-block;
  width: 6px;
  height: 5px;
  border-radius: 1px;
  background: var(--accent-strong);
  position: relative;
  flex: none;
  vertical-align: -1px;
}
.lock-mark::before {
  content: "";
  position: absolute;
  left: 1px;
  top: -3px;
  width: 4px;
  height: 4px;
  border: 1px solid var(--accent-strong);
  border-bottom: none;
  border-radius: 3px 3px 0 0;
}

.lock-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  font-size: 12px;
  color: var(--muted);
}
.lock-actions { display: inline-flex; gap: 6px; flex: none; }
.locked-tag { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-strong); }

.month-block + .month-block { margin-top: 16px; }
.month-title { font-size: 13px; font-weight: 600; color: var(--muted); margin: 0 0 8px; }

/* 统计 */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.stat { background: #fafbfc; border-radius: 10px; padding: 10px 8px; text-align: center; }
.stat .k { font-size: 11px; color: var(--muted); }
.stat .v { font-size: 21px; font-weight: 600; line-height: 1.3; }
.stat .v.warn { color: var(--danger); }

/* 列表 */
.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #f0f1f3;
  font-size: 14px;
}
.list li:last-child { border-bottom: none; }
.list .meta { font-size: 12px; color: var(--muted); }
.empty-tip { font-size: 13px; color: var(--muted); padding: 6px 0; }

.pay-form { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.pay-form .full { grid-column: 1 / -1; }

.toast {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  background: #1f2328;
  color: #fff;
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 8px;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.toast.show { opacity: .92; }

.gate { max-width: 320px; margin: 80px auto; }
.note { font-size: 12px; color: var(--muted); margin-top: 8px; }

.fold {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  cursor: pointer;
  list-style: none;
  font-size: 14px;
  font-weight: 600;
  padding: 2px 0;
}
.fold::-webkit-details-marker { display: none; }
.fold::after {
  content: "";
  width: 7px;
  height: 7px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: rotate(45deg);
  transition: transform .18s;
  flex: none;
  margin-left: 4px;
}
details[open] > .fold::after { transform: rotate(-135deg); }
.inline-confirm {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--muted);
  margin-left: 6px;
}
.inline-confirm .btn-mini { border-color: var(--color-border-secondary, #d0d3d8); }

/* 解锁弹层 */
.mask {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(31, 35, 40, .45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.dialog {
  background: var(--card);
  border-radius: 14px;
  padding: 18px;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 14px 36px rgba(0, 0, 0, .2);
}

.dialog h3 {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 12px;
}

.dialog .err {
  font-size: 12px;
  color: var(--danger);
  min-height: 17px;
  margin-top: 6px;
}

.dialog-tip {
  font-size: 12px;
  color: var(--muted);
  margin-top: 8px;
}
.dialog-tip code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: #f2f4f6;
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  color: var(--accent-strong);
}

.dialog-actions { display: flex; gap: 8px; margin-top: 10px; }
.dialog-actions button { flex: 1; }
.dialog-actions .btn-primary { font-size: 14px; padding: 9px; }
