:root {
  --bg: #f2f0ea;
  --card: #fffdf8;
  --ink: #1c1a16;
  --muted: #6d675c;
  --line: #e4ddd0;
  --accent: #0f6e56;
  --warn: #c45c26;
  --danger: #a33b2b;
  --ok: #1f7a45;
  --radius: 14px;
  font-family: "PingFang SC", "Helvetica Neue", "Segoe UI", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
.m-body {
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.m-login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}
.m-login-card {
  width: min(400px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px 18px;
}
.m-login-card h1 { margin: 0 0 4px; font-size: 1.35rem; }
.m-login-card label { display: block; margin: 14px 0 6px; color: var(--muted); font-size: 0.9rem; }
.m-login-card input,
.m-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 16px; /* 避免 iOS 自动放大 */
  background: #fff;
  color: var(--ink);
}

/* 自定义选择器：避免 Android WebView 原生 select 难看 */
.m-picker-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-size: 16px;
  text-align: left;
  cursor: pointer;
}
.m-picker-btn:active { background: #f7f3ea; }
.m-picker-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.m-picker-text.placeholder { color: var(--muted); }
.m-picker-chev {
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
  transform: translateY(-1px);
}
.m-picker-sheet {
  max-height: min(78vh, 640px);
}
.m-picker-sheet #taskPickerFilter {
  margin: 4px 0 10px;
}
.m-picker-list {
  max-height: min(56vh, 480px);
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.m-picker-item {
  display: block;
  width: 100%;
  padding: 14px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font-size: 16px;
  text-align: left;
  cursor: pointer;
}
.m-picker-item:last-child { border-bottom: 0; }
.m-picker-item:active,
.m-picker-item.on {
  background: #e8f5f0;
  color: var(--accent);
  font-weight: 600;
}
.m-picker-empty {
  padding: 28px 12px;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
}

/* 日期时间滚轮 */
.m-dt-wheels {
  position: relative;
  display: flex;
  gap: 4px;
  height: 220px;
  margin: 8px 0 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
}
.m-dt-col {
  flex: 1;
  min-width: 0;
  height: 100%;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: y mandatory;
  text-align: center;
  padding: 88px 0;
}
#dtColDate { flex: 1.35; }
#dtColHour,
#dtColMin { flex: 0.85; }
.m-dt-col[hidden] { display: none !important; }
.m-dt-item {
  height: 44px;
  line-height: 44px;
  scroll-snap-align: center;
  font-size: 0.98rem;
  color: #9a9488;
  user-select: none;
  padding: 0 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-sizing: border-box;
}
.m-dt-item.on {
  color: var(--ink);
  font-weight: 700;
  font-size: 1.05rem;
}
.m-dt-mask {
  pointer-events: none;
  position: absolute;
  left: 8px;
  right: 8px;
  top: 50%;
  height: 44px;
  margin-top: -22px;
  border-radius: 10px;
  border: 1px solid #d7efe6;
  background: rgba(15, 110, 86, 0.08);
  box-sizing: border-box;
}
.m-err {
  margin-top: 10px;
  padding: 10px 12px;
  background: #f8e8e4;
  color: var(--danger);
  border-radius: 10px;
  font-size: 0.92rem;
}

.m-top {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 253, 248, 0.94);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  padding: 12px 14px calc(10px + env(safe-area-inset-top, 0));
  padding-top: calc(12px + env(safe-area-inset-top, 0));
}
.m-top-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.m-top h1 { margin: 0; font-size: 1.15rem; }
.m-top-links {
  margin-top: 8px;
  display: flex;
  gap: 14px;
  font-size: 0.9rem;
}
.m-top-links a { color: var(--accent); text-decoration: none; }

.m-main {
  padding: 12px 12px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.m-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.m-card h2 {
  margin: 0 0 12px;
  font-size: 1.02rem;
}
.m-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.m-row h2, .m-row h3 { margin: 0; }
.m-muted { color: var(--muted); font-size: 0.88rem; }
.m-center { text-align: center; margin-top: 14px; }
.m-center a { color: var(--accent); }
.m-label {
  display: block;
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 0.88rem;
}
.m-line {
  margin: 10px 0 0;
  font-size: 0.92rem;
  word-break: break-word;
}
.m-k {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 2px;
}
.m-v {
  font-weight: 600;
  word-break: break-all;
  font-size: 0.95rem;
}

.m-badge {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}
.m-badge.on { background: #dff3e6; color: var(--ok); }
.m-badge.off { background: #f1e6e3; color: var(--danger); }

.m-status-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 10px;
}
.m-sched-block {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.m-sched-block .m-row { margin-bottom: 8px; }
.m-sched-block h2 { font-size: 1rem; }
.m-item-compact { padding: 10px 12px; }
.m-item-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
}
.m-item-name {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 46%;
  font-weight: 600;
  font-size: 0.98rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.m-item-aside {
  flex: 1 1 auto;
  min-width: 0;
  text-align: right;
  color: var(--muted);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
  word-break: break-word;
}
.m-item-compact .m-item-meta {
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.m-item-compact .m-item-actions {
  margin-top: 8px;
  justify-content: flex-end;
}

.m-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 12px;
  padding: 12px 14px;
  font-size: 0.98rem;
  cursor: pointer;
  text-align: center;
}
.m-btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.m-btn-warn {
  background: var(--warn);
  border-color: var(--warn);
  color: #fff;
}
.m-btn-danger {
  background: transparent;
  border-color: #ecc4bc;
  color: var(--danger);
}
.m-btn-sm {
  padding: 8px 12px;
  font-size: 0.88rem;
}
.m-btn:disabled { opacity: 0.45; }
.m-login-card .m-btn { width: 100%; margin-top: 16px; }

.m-cmd-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 14px;
}
.m-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.m-mt { margin-top: 14px; }

.m-list { display: flex; flex-direction: column; gap: 8px; }
.m-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}
.m-item.dim { opacity: 0.55; }
.m-item.unread { border-color: #e8a090; background: #fff8f6; }
.m-item-title {
  font-weight: 600;
  font-size: 0.98rem;
  word-break: break-word;
}
.m-item-meta {
  margin-top: 6px;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
  word-break: break-word;
}
.m-item-actions {
  margin-top: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.m-empty {
  color: var(--muted);
  text-align: center;
  padding: 18px 8px;
  font-size: 0.92rem;
}
.m-ok { color: var(--ok); font-weight: 600; }
.m-fail { color: var(--danger); font-weight: 600; }

.m-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 10px;
}
.m-tab {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 8px 0;
  font-size: 0.88rem;
  cursor: pointer;
}
.m-tab.on {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
.m-tab-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 10px;
}
.m-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 10px;
}

.m-modal[hidden] { display: none !important; }
.m-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.m-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 24, 28, 0.45);
}
.m-modal-sheet {
  position: relative;
  z-index: 1;
  width: 100%;
  max-height: min(92vh, 720px);
  overflow: auto;
  background: var(--card);
  border-radius: 18px 18px 0 0;
  padding: 16px 14px calc(18px + env(safe-area-inset-bottom, 0));
  box-shadow: 0 -10px 40px rgba(0,0,0,0.16);
}
.m-modal-sheet h3 { margin: 0; font-size: 1.05rem; }

.m-toast {
  position: fixed;
  left: 50%;
  bottom: calc(22px + env(safe-area-inset-bottom, 0));
  transform: translateX(-50%);
  z-index: 200;
  max-width: calc(100% - 32px);
  padding: 10px 14px;
  border-radius: 12px;
  background: #1c1a16;
  color: #fff;
  font-size: 0.92rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.2);
}
.m-toast.err { background: var(--danger); }

a.link, .m-item a {
  color: var(--accent);
  text-decoration: none;
}
