:root {
  --acc: #4f46e5;
  --acc2: #6366f1;
  --pink: #ec4899;
  --green: #10b981;
  --orange: #f59e0b;
  --red: #ef4444;
  --bg: #f4f5f7;
  --card: #fff;
  --text: #1f2937;
  --text-light: #6b7280;
  --border: #e5e7eb;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  background: var(--bg); color: var(--text); font-family: "Noto Sans SC", -apple-system, sans-serif;
  font-size: 14px;
}
.hidden { display: none !important; }

.screen { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }

/* ====== 登录 ====== */
#loginScreen {
  background: linear-gradient(135deg, #1e3a8a, #6366f1, #ec4899);
  padding: 60px 24px 40px;
  display: flex; align-items: center; justify-content: center;
}
.login-card {
  width: 100%; max-width: 360px;
  background: #fff; border-radius: 18px; padding: 32px 24px;
  text-align: center; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-logo {
  width: 70px; height: 70px; border-radius: 50%; margin: 0 auto 14px;
  background: linear-gradient(135deg, #4f46e5, #ec4899); color: #fff;
  font-size: 30px; display: flex; align-items: center; justify-content: center;
}
.login-card h1 { font-size: 22px; }
.login-card .sub { color: #6b7280; font-size: 13px; margin: 6px 0 22px; }
.form { display: flex; flex-direction: column; gap: 12px; }
.form input {
  border: 1px solid var(--border); border-radius: 10px;
  padding: 14px 14px; font-size: 15px; outline: none;
}
.form input:focus { border-color: var(--acc); }
.err { color: var(--red); font-size: 13px; min-height: 18px; }

/* ====== 通用按钮 ====== */
.btn-primary {
  background: var(--acc); color: #fff; border: none;
  padding: 12px 18px; border-radius: 10px; font-size: 15px; font-weight: 500;
  cursor: pointer; transition: all .15s;
}
.btn-primary.big { padding: 14px; font-size: 16px; }
.btn-primary:active { background: #4338ca; transform: scale(.98); }
.btn-primary:disabled { opacity: .5; }
.btn-ghost {
  background: transparent; border: none; color: #fff; padding: 8px 12px;
  border-radius: 8px; font-size: 14px; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
}
.btn-secondary {
  background: #fff; color: var(--text); border: 1px solid var(--border);
  padding: 10px 14px; border-radius: 8px; font-size: 14px; cursor: pointer;
}

/* ====== 头部 ====== */
.m-header {
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  padding: max(20px, env(safe-area-inset-top)) 16px 16px;
  color: #fff; display: flex; align-items: center; justify-content: space-between;
}
.me { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: rgba(255,255,255,.2); display: flex; align-items: center; justify-content: center;
  font-size: 16px;
}
.name { font-size: 15px; font-weight: 600; }
.role { font-size: 11px; color: rgba(255,255,255,.85); }
.header-title {
  flex: 1; font-size: 16px; font-weight: 500; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  margin: 0 8px;
}

/* ====== 标签页 ====== */
.m-tabs {
  background: #fff; display: flex;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 5;
}
.m-tabs .tab {
  flex: 1; padding: 14px 0; text-align: center; font-size: 14px; color: var(--text-light);
  cursor: pointer; position: relative;
}
.m-tabs .tab.active { color: var(--acc); font-weight: 600; }
.m-tabs .tab.active::after {
  content: ''; position: absolute; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 36px; height: 3px; background: var(--acc); border-radius: 2px;
}
.tab span {
  background: var(--red); color: #fff; font-size: 11px;
  padding: 1px 7px; border-radius: 8px; margin-left: 4px;
}
.tab span:empty { display: none; }

/* ====== 任务列表 ====== */
.m-list { padding: 12px; padding-bottom: 80px; }
.task-card {
  background: #fff; border-radius: 12px; padding: 14px 16px;
  margin-bottom: 10px; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
  transition: all .15s;
}
.task-card:active { transform: scale(.98); }
.task-card .row1 {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px;
}
.task-card .title { font-weight: 600; font-size: 15px; flex: 1; padding-right: 8px; }
.task-card .badge { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 500; }
.task-card .desc { color: var(--text-light); font-size: 12px; margin: 4px 0; }
.task-card .row2 {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 11px; color: var(--text-light); margin-top: 6px;
}
.task-card .meta-tag {
  display: inline-block; background: #f3f4f6; padding: 2px 8px; border-radius: 6px;
  margin-right: 4px; color: var(--text);
}
.badge.status-pending { background: #fef3c7; color: #92400e; }
.badge.status-in_progress { background: #dbeafe; color: #1e40af; }
.badge.status-done { background: #d1fae5; color: #065f46; }
.badge.status-skipped { background: #f3f4f6; color: #6b7280; }

.bottom-tip {
  position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px;
}
.bottom-tip .btn-ghost {
  color: var(--text-light); background: #fff;
  box-shadow: 0 2px 8px rgba(0,0,0,.08); font-size: 12px;
  padding: 8px 14px; border-radius: 16px;
}

/* ====== 空状态 ====== */
.empty-mobile {
  padding: 60px 20px; text-align: center; color: var(--text-light);
}
.empty-mobile i { font-size: 40px; color: #d1d5db; margin-bottom: 10px; }

/* ====== 详情 / 填报 ====== */
.m-detail { padding: 12px 14px 100px; }
.detail-card {
  background: #fff; border-radius: 12px; padding: 16px;
  margin-bottom: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.detail-card .label-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-light); margin-bottom: 10px;
}
.detail-card h2 { font-size: 17px; margin-bottom: 6px; }
.detail-card .desc { color: var(--text-light); font-size: 13px; line-height: 1.6; }

/* 一键拨号大按钮 */
.dial-card {
  background: linear-gradient(135deg, #10b981, #059669); color: #fff;
  border-radius: 12px; padding: 18px; margin-bottom: 12px;
  display: flex; align-items: center; gap: 14px;
  text-decoration: none; box-shadow: 0 6px 18px rgba(16,185,129,.3);
}
.dial-card .ring {
  width: 50px; height: 50px; border-radius: 50%;
  background: rgba(255,255,255,.25);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.dial-card .info { flex: 1; }
.dial-card .info .label { font-size: 12px; opacity: .85; }
.dial-card .info .number { font-size: 22px; font-weight: 700; letter-spacing: 1px; }

/* 表单字段 */
.field {
  background: #fff; border-radius: 12px; padding: 12px 14px; margin-bottom: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
}
.field .lbl {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 13px; color: var(--text-light); margin-bottom: 6px;
}
.field .lbl .req { color: var(--red); margin-left: 2px; }
.field input, .field textarea, .field select {
  width: 100%; border: none; outline: none; padding: 6px 0;
  font-size: 15px; background: transparent;
  font-family: inherit;
}
.field textarea { min-height: 60px; resize: vertical; }
.field .options-multi { display: flex; flex-wrap: wrap; gap: 6px; }
.field .options-multi label {
  display: inline-flex; align-items: center; gap: 4px;
  background: #f3f4f6; padding: 6px 10px; border-radius: 14px;
  font-size: 13px; cursor: pointer;
}
.field .options-multi input { width: auto; margin: 0; }
.field .options-pill {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.field .options-pill .pill {
  padding: 7px 14px; border-radius: 14px; background: #f3f4f6;
  font-size: 13px; cursor: pointer; transition: all .15s;
  border: 1px solid transparent;
}
.field .options-pill .pill.active {
  background: var(--acc); color: #fff; border-color: var(--acc);
}

.action-bar {
  position: fixed; bottom: 0; left: 0; right: 0;
  background: #fff; padding: 10px 14px max(10px, env(safe-area-inset-bottom));
  box-shadow: 0 -2px 12px rgba(0,0,0,.08);
  display: flex; gap: 8px;
}
.action-bar .btn-primary { flex: 1; padding: 14px; font-size: 16px; }

/* ====== Toast ====== */
.toast {
  position: fixed; left: 50%; top: 80px; transform: translateX(-50%) translateY(-20px);
  background: rgba(15,23,42,.92); color: #fff; padding: 10px 18px;
  border-radius: 8px; font-size: 13px; max-width: 80vw;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 9999;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast.success { background: #047857; }
.toast.error { background: #b91c1c; }
