:root {
  color-scheme: light only;
  --brand: #3d7eff;
  --brand-light: #eaf1ff;
  --text: #1a1d22;
  --text-2: #6b7280;
  --text-3: #9aa0a8;
  --line: #eceef1;
  --bg: #f5f6f8;
  --card: #fff;
  --red: #f2493c;
  --green: #16a34a;
  --orange: #f0892c;
  --tabbar-h: 54px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; background: var(--bg); position: relative; }
.loading { text-align: center; padding: 80px 0; color: var(--text-3); }

button { font: inherit; border: none; background: none; color: inherit; cursor: pointer; }
input, textarea { font: inherit; border: none; outline: none; background: none; color: var(--text); }
input[type=date] { -webkit-appearance: none; appearance: none; }

/* ---------- 导航栏 ---------- */
.navbar {
  position: sticky; top: 0; z-index: 40; height: 46px; background: #fff;
  display: flex; align-items: center; justify-content: center;
  border-bottom: 1px solid var(--line); padding: 0 12px;
  padding-top: env(safe-area-inset-top);
}
.nav-title { font-size: 16px; font-weight: 600; }
.nav-logo {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
  background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.nav-back {
  position: absolute; left: 8px; top: 50%; transform: translateY(-50%);
  font-size: 26px; color: var(--text); width: 40px; height: 40px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- 内容 ---------- */
.content { padding-bottom: calc(var(--tabbar-h) + 20px); }
.bottom-space { height: 24px; }
.view.has-footer .content { padding-bottom: 90px; }
/* tab 页 + 底部按钮栏：留出两者高度 */
.view.has-footer.on-tab .content { padding-bottom: calc(var(--tabbar-h) + 90px); }

/* ---------- 汇总条 ---------- */
.summary { display: flex; align-items: center; background: #eef4ff; padding: 13px 8px; }
.sum-item { flex: 1; text-align: center; }
.sum-num { font-size: 20px; font-weight: 700; color: var(--brand); line-height: 1.1; }
.sum-num.ot { color: var(--orange); }
.sum-label { font-size: 10px; color: var(--text-2); margin-top: 4px; }
.sum-split { width: 1px; height: 26px; background: #d3e0f7; }

/* ---------- 日历 ---------- */
.cal { background: #fff; padding: 8px 6px 12px; }
.cal-head { display: flex; align-items: center; justify-content: center; padding-bottom: 8px; }
.nav-btn { width: 40px; height: 34px; font-size: 22px; color: var(--text-2); display: flex; align-items: center; justify-content: center; }
.cal-title { font-size: 15px; font-weight: 600; min-width: 108px; text-align: center; }
.week { display: flex; padding-bottom: 4px; }
.week span { flex: 1; text-align: center; font-size: 12px; color: var(--text-2); }

/* 日历格子：Grid 固定 7 列 + 固定行高
   格内：① 备+日期 ② 农历 ③ 今天 ④ 补+班/休 ⑤ 加班 */
.days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: 78px;
  gap: 3px;
  padding: 0 3px;
  will-change: transform;
}

.day {
  height: 100%;
  position: relative; cursor: pointer;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  border-radius: 8px;
  background: transparent;
  transition: background .12s;
  overflow: hidden;
  padding: 5px 3px;
}
.day.empty { visibility: hidden; background: none; }

.day.worked { background: #dce8fb; }
.day.rest { background: #d9f0e2; }
.day.on { box-shadow: inset 0 0 0 2px var(--brand); }

/* ---- 第一行：日期绝对居中，「备」浮在左侧不占位 ---- */
.day .row1 {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 100%;
}
.day .num {
  font-size: 16px; font-weight: 600; line-height: 1.1;
  text-align: center; white-space: nowrap;
}
.day .mark {
  position: absolute; left: 0; top: 0; bottom: 0;
  display: flex; align-items: center;
  font-size: 9px; color: #f0a020; line-height: 1;
  white-space: nowrap;
}

/* ---- 第四行：班/休 绝对居中，「补」浮在左侧不占位 ---- */
.day .row4 {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 100%;
}
.day .mkbox {
  position: absolute; left: 0; top: 0; bottom: 0;
  display: flex; align-items: center;
}
.day .makeup {
  display: inline-block; font-style: normal;
  font-size: 9px; color: #fff; background: #f0a020;
  border-radius: 4px; padding: 0 3px; line-height: 1.45;
  white-space: nowrap;
}

.day .lunar { font-size: 9px; color: #a5aab3; line-height: 1.3; white-space: nowrap; }
.day .lunar.fest { color: #e5484d; font-weight: 700; }
.day .work { font-size: 14px; line-height: 1.2; white-space: nowrap; font-weight: 600; }
.day .rest-txt { font-size: 14px; color: #1fa363; font-weight: 600; line-height: 1.2; }
.day .ot { font-size: 10px; color: var(--orange); line-height: 1.3; white-space: nowrap; }
.day .today {
  display: inline-block; font-size: 9px; color: #fff; line-height: 1.4;
  background: var(--brand); border-radius: 9px; padding: 0 7px;
  white-space: nowrap;
}

/* ---------- 当日面板 ---------- */
.panel { background: #fff; margin-top: 8px; padding-bottom: 14px; }
.panel-head { display: flex; align-items: baseline; padding: 13px 16px 9px; border-bottom: 1px solid var(--line); }
.ph-date { font-size: 16px; font-weight: 700; white-space: nowrap; }
.ph-lunar { font-size: 12px; color: var(--text-3); margin-left: 7px; white-space: nowrap; }
.ph-lunar.fest { color: #e5484d; font-weight: 600; }
.entry { padding: 11px 16px 5px; }
.entry + .entry { border-top: 1px solid #f4f5f7; }
.entry-top { display: flex; align-items: center; justify-content: space-between; padding-bottom: 6px; }
.entry-type { font-size: 14px; font-weight: 600; }
.entry-actions { display: flex; }
.act { font-size: 12px; color: var(--brand); background: #eef4ff; border-radius: 4px; padding: 3px 9px; margin-left: 6px; }
.act.danger { color: var(--red); background: #fdeeed; }
.entry-row { font-size: 15px; line-height: 1.7; }
.entry-row.ot { color: var(--orange); }
.entry-row.note { font-size: 13px; color: var(--text-3); }
.panel-empty { text-align: center; color: var(--text-3); padding: 40px 0; font-size: 13px; }

/* ---------- 悬浮按钮 ---------- */
.fab {
  position: fixed; right: calc(50% - min(50vw, 280px) + 18px); bottom: calc(var(--tabbar-h) + 18px);
  width: 54px; height: 54px; border-radius: 50%; background: var(--brand); color: #fff;
  font-size: 28px; font-weight: 300; line-height: 1; z-index: 45;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(61,126,255,.42);
}
.fab:active { transform: scale(.94); }

/* ---------- tabbar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; height: var(--tabbar-h); background: #fff;
  border-top: 1px solid var(--line); display: flex; z-index: 50;
  padding-bottom: env(safe-area-inset-bottom);
  max-width: 560px; margin: 0 auto;
}
.tab { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 10px; color: var(--text-3); }
.tab.on { color: var(--brand); }
.tab img { width: 22px; height: 22px; display: block; opacity: .62; }
.tab.on img { opacity: 1; }

/* ---------- 卡片 / 行 ---------- */
.card { background: var(--card); border-radius: 10px; padding: 11px 14px; margin: 10px 12px; }
.card.rows { padding: 0 14px; }
.row { display: flex; align-items: center; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line); min-height: 46px; }
.card.rows .row:last-child { border-bottom: none; }
.row-label { font-size: 14px; flex: 0 0 auto; }
.row-value { font-size: 14px; color: var(--text-2); display: flex; align-items: center; }
.row-value.txt { color: var(--text); font-weight: 500; }
.row-value.txt.ot { color: var(--orange); }
.row-value.dim { color: #c3c7cd; font-weight: 400; }
.row-value.ot-on { color: var(--orange); font-weight: 600; }
.row-value.arrow::after { content: '›'; color: var(--text-3); font-size: 17px; margin-left: 4px; }
.row-input { flex: 1; min-width: 0; }
.row-input.right { text-align: right; color: var(--text); }
.sec-title { font-size: 12.5px; color: var(--text-3); margin: 13px 16px 4px; }
.tip { color: var(--text-3); font-size: 12px; }
.empty { text-align: center; color: var(--text-3); padding: 50px 0; font-size: 13px; }
.danger-text { color: var(--red); }

/* ---------- 表单快捷项 ---------- */
.presets { display: flex; flex-wrap: nowrap; }
.presets > .preset { flex: 1 1 0; min-width: 0; margin-right: 6px; }
.presets > .preset:last-child { margin-right: 0; }
.preset {
  height: 38px; line-height: 38px; text-align: center;
  background: #f1f3f6; color: var(--text-2); font-size: 14px;
  border-radius: 7px; padding: 0 6px; margin-bottom: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.preset.on { background: var(--brand); color: #fff; font-weight: 600; }
.sub-row { display: flex; align-items: center; padding: 9px 0 3px; flex-wrap: wrap; }
.sub-label { font-size: 14px; color: var(--text-2); margin-right: 12px; min-width: 62px; }
.sub-input {
  width: 76px; height: 38px; background: #f5f6f8; border-radius: 6px;
  text-align: center; font-size: 15px; margin-right: 6px; padding: 0 4px;
}
.split { border-top: 1px solid var(--line); margin-top: 6px; padding-top: 4px; }

/* ---------- 底部按钮栏 ---------- */
.footer-bar {
  position: fixed; left: 0; right: 0; bottom: 0; background: #fff;
  border-top: 1px solid var(--line); padding: 9px 12px calc(9px + env(safe-area-inset-bottom));
  display: flex; gap: 10px; z-index: 46;
  max-width: 560px; margin: 0 auto;
}
/* ⚠️ 用在有底部 tabbar 的页面时，必须抬到 tabbar 之上，
   否则按钮会被 tabbar 盖住点不到 */
.footer-bar.on-tab {
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: 9px;
}
.btn { flex: 1; height: 46px; line-height: 46px; text-align: center; border-radius: 23px; font-size: 16px; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.danger { background: #fff; color: var(--red); border: 1px solid #ffd3d0; flex: 0 0 96px; }
.btn:active { opacity: .85; }

/* ---------- 备注页 ---------- */
.input-card { background: #f2f3f5; border-radius: 10px; padding: 14px; margin: 14px 16px 0; }
.ta { width: 100%; min-height: 150px; font-size: 15px; line-height: 1.7; resize: vertical; }
.counter { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; }
.clear { font-size: 13px; color: var(--brand); }
.counter .num { font-size: 13px; color: var(--text-3); }
.hint { margin: 10px 16px 0; font-size: 13px; line-height: 1.6; }
.hint-ok { color: #1fa363; }
.hint-warn { color: var(--orange); }
.hint-plain { color: var(--text-3); }
.confirm-btn {
  display: block; width: calc(100% - 32px); margin: 16px auto 0; height: 48px; line-height: 48px;
  text-align: center; background: var(--brand); color: #fff; font-size: 16px; border-radius: 8px;
}
.hist-head { display: flex; align-items: baseline; margin: 22px 16px 12px; }
.hh-title { font-size: 16px; font-weight: 700; }
.hh-count { font-size: 13px; color: var(--text-3); margin-left: 3px; }
.hist-wrap { display: flex; flex-wrap: wrap; padding: 0 16px; }
.tag { display: inline-flex; align-items: center; background: #f2f3f5; border-radius: 7px; padding: 9px 10px; margin: 0 8px 8px 0; }
.tag-text { font-size: 14px; }
.tag-x { font-size: 17px; color: var(--text-3); margin-left: 8px; line-height: 1; padding: 0 2px; }
.hist-empty { color: var(--text-3); font-size: 13px; text-align: center; padding: 30px 0; }

/* ---------- 详情 ---------- */
.hero { background: linear-gradient(135deg,#4a86ff,#3d6fff); color: #fff; text-align: center; padding: 26px 0 24px; }
.hero-num { font-size: 52px; font-weight: 700; line-height: 1.05; }
.hero-label { font-size: 12px; opacity: .85; margin-top: 6px; }
.hero-num span { font-size: 15px; font-weight: 400; margin-left: 4px; }
.hero-sub { font-size: 12px; opacity: .85; margin-top: 4px; }

/* ---------- 统计 ---------- */
.tabs-row { display: flex; gap: 8px; margin: 12px 12px 0; }
.range-tab { flex: 1; height: 36px; line-height: 36px; text-align: center; border-radius: 18px; background: #eef0f4; color: var(--text-2); font-size: 14px; }
.range-tab.on { background: #fff; color: var(--text); font-weight: 600; }
.stat-cards { display: flex; gap: 8px; margin: 10px 0 0; }
.stat-card { flex: 1; background: #fff; border-radius: 10px; padding: 14px 6px; text-align: center; }
.stat-num { font-size: 18px; font-weight: 700; color: var(--brand); }
.stat-num.ot { color: var(--orange); }
.stat-label { font-size: 10px; color: var(--text-3); margin-top: 4px; }
.proj-item { padding: 9px 0; }
.proj-item + .proj-item { border-top: 1px solid #f4f5f7; }
.pi-head { display: flex; justify-content: space-between; align-items: center; }
.pi-work { font-size: 14px; font-weight: 600; color: var(--brand); }
.bar { height: 6px; background: #f0f2f5; border-radius: 3px; margin: 8px 0 5px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg,#6aa2ff,#3d7eff); border-radius: 3px; }

/* ---------- 项目 ---------- */
.pj-head { display: flex; justify-content: space-between; align-items: center; }
.pj-name { font-size: 16px; font-weight: 600; }
.pj-days { font-size: 12px; color: var(--text-3); }
.pj-foot { display: flex; margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }
.pf-item { flex: 1; text-align: center; }
.pf-item b { display: block; font-size: 15px; font-weight: 700; color: var(--brand); }
.pf-item b.ot { color: var(--orange); }
.pf-item span { display: block; font-size: 10px; color: var(--text-3); margin-top: 2px; }

/* ---------- 我的 ---------- */
.profile { background: linear-gradient(135deg,#4a86ff,#3d6fff); padding: 26px 16px 22px; text-align: center; }
.avatar-wrap { position: relative; width: 88px; height: 88px; margin: 0 auto; }
.avatar { width: 88px; height: 88px; border-radius: 50%; background: #fff; border: 3px solid rgba(255,255,255,.85); object-fit: cover; }
.avatar-badge {
  position: absolute; right: 0; bottom: 2px; width: 27px; height: 27px; line-height: 27px;
  background: #fff; color: var(--brand); border-radius: 50%; font-size: 12px; font-weight: 700;
  box-shadow: 0 2px 6px rgba(0,0,0,.16);
}
.pname { color: #fff; font-size: 19px; font-weight: 700; margin-top: 12px; }
.pname .edit { font-size: 13px; opacity: .7; margin-left: 5px; }
.ptip { color: rgba(255,255,255,.75); font-size: 11px; margin-top: 5px; }
.stats-bar {
  display: flex; align-items: center; background: #fff; margin: -11px 12px 0; border-radius: 10px;
  padding: 15px 0; box-shadow: 0 2px 8px rgba(30,60,140,.08);
}
.sb-item { flex: 1; text-align: center; }
.sb-item b { display: block; font-size: 20px; font-weight: 700; color: var(--brand); }
.sb-item span { display: block; font-size: 11px; color: var(--text-3); margin-top: 3px; }
.sb-split { width: 1px; height: 26px; background: var(--line); }

/* ---------- 弹窗 ---------- */
.modal-mask, .sheet-mask {
  position: fixed; inset: 0; background: rgba(0,0,0,.42); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fade .15s ease;
}
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 320px; padding: 20px;
  animation: pop .18s ease;
}
.modal-title { font-size: 16px; font-weight: 600; text-align: center; margin-bottom: 12px; }
.modal-body { font-size: 14px; color: var(--text-2); line-height: 1.6; text-align: center; margin-bottom: 6px; white-space: pre-wrap; }
.modal-input { width: 100%; height: 44px; background: #f5f6f8; border-radius: 8px; padding: 0 12px; font-size: 15px; margin-bottom: 4px; }
/* 信息弹窗：长文本自动换行 + 可滚动 */
.info-modal { max-width: 360px; }
.info-body {
  max-height: 58vh; overflow-y: auto; text-align: left;
  padding-right: 4px; margin: 4px 0;
  -webkit-overflow-scrolling: touch;
}
.info-h {
  font-size: 13.5px; font-weight: 700; color: var(--brand);
  margin: 14px 0 6px;
}
.info-h:first-child { margin-top: 0; }
.info-p {
  font-size: 13.5px; color: var(--text-2); line-height: 1.75;
  word-break: break-word; white-space: pre-wrap;
}
.modal-actions { display: flex; gap: 10px; margin-top: 16px; }
.mbtn { flex: 1; height: 44px; line-height: 44px; border-radius: 22px; font-size: 15px; text-align: center; }
.mbtn.cancel { background: #f1f3f6; color: var(--text-2); }
.mbtn.ok { background: var(--brand); color: #fff; }
.mbtn.ok.danger { background: var(--red); }

/* 底部选择器 */
.sheet-mask { align-items: flex-end; padding: 0; }
.sheet {
  background: #fff; width: 100%; max-width: 560px; border-radius: 14px 14px 0 0;
  animation: slideUp .2s ease; max-height: 72vh; display: flex; flex-direction: column;
}
.sheet-bar { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.sheet-title { font-size: 14px; font-weight: 600; }
.sheet-cancel { font-size: 14px; color: var(--text-3); }
.sheet-ok { font-size: 14px; color: var(--brand); font-weight: 600; }
.sheet-body { overflow-y: auto; padding: 6px 0 calc(6px + env(safe-area-inset-bottom)); }
.sheet-row { height: 42px; line-height: 42px; text-align: center; font-size: 15px; color: var(--text-2); }
.sheet-row.sel { color: var(--text); font-weight: 600; background: var(--brand-light); }

/* toast */
.toast {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%) scale(.9);
  background: rgba(0,0,0,.78); color: #fff; padding: 11px 20px; border-radius: 8px;
  font-size: 14px; z-index: 200; opacity: 0; pointer-events: none; transition: all .18s;
  max-width: 76vw; text-align: center; line-height: 1.5;
}
.toast.show { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.toast.warn { background: rgba(240,137,44,.94); }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* 自定义快捷项 */
.presets-row2 { margin-top: 2px; }
.preset-add { color: var(--brand); background: #eef3ff; border: 1px dashed #b9cdfb; }
.preset.on { background: var(--brand); color: #fff; }

/* 自定义选项弹窗 */
.cus-list { margin: 6px 0 10px; }
.cus-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px; background: #f7f8fa; border-radius: 10px; margin-bottom: 8px;
}
.cus-name { font-size: 14px; color: var(--text); }
.cus-short { color: #9aa0aa; font-size: 12px; }
.cus-del {
  border: 0; background: #fff0ef; color: #e5484d; border-radius: 8px;
  padding: 5px 12px; font-size: 13px;
}
.cus-form .modal-input { margin-bottom: 8px; }
.cus-tip { text-align: center; color: #8a8f99; font-size: 13px; margin: 10px 0; }

/* 空状态块 */
.empty-block { text-align: center; padding: 60px 24px; }
.empty-emoji { font-size: 48px; margin-bottom: 12px; }
.empty-t { font-size: 16px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-s { font-size: 13px; color: var(--text-3); }
.empty-block .btn { display: inline-block; padding: 0 28px; }

/* 版本号 */
.ver { text-align: center; font-size: 12px; color: #b6bcc6; margin: 18px 0 30px; }

/* 禁用行（已绑定邮箱等） */
.row.disabled { opacity: .55; }
.row.disabled .row-label, .row.disabled .row-value { color: #9aa0aa; }
.row-label.dim { color: #9aa0aa; }
