:root {
  --teal: #0f766e;
  --teal-l: #e6f4f2;
  --red: #c2410c;
  --green: #15803d;
  --line: #e2e5e9;
  --txt: #1f2937;
  --muted: #6b7280;
  --bg: #f5f6f8;
  --radius: 12px;
}

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

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--txt);
  font: 15px/1.5 -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  padding-bottom: 26px;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  background: var(--teal);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.brand b {
  font-size: 18px;
}

.brand span {
  font-size: 12px;
  opacity: .85;
}

.top-right {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}

.who {
  background: rgba(255, 255, 255, .2);
  padding: 2px 8px;
  border-radius: 999px;
}

.tabs {
  display: flex;
  position: sticky;
  top: 46px;
  z-index: 19;
  background: #fff;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tabs button {
  flex: 1;
  min-width: 62px;
  padding: 11px 4px;
  border: 0;
  background: none;
  font-size: 15px;
  color: var(--muted);
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.tabs button.on {
  color: var(--teal);
  font-weight: 700;
  border-bottom-color: var(--teal);
}

.page {
  display: none;
  padding: 10px 10px 0;
  max-width: 1180px;
  margin: 0 auto;
}

.page.on {
  display: block;
}

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

.muted {
  color: var(--muted);
  font-size: 12px;
}

.mini {
  border: 1px solid rgba(255, 255, 255, .5);
  background: rgba(255, 255, 255, .12);
  color: #fff;
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 12px;
}

.round {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 20px;
  line-height: 1;
}

.primary {
  background: var(--teal);
  color: #fff;
  border: 0;
  border-radius: 9px;
  padding: 9px 14px;
  font-size: 15px;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.primary:disabled {
  opacity: .5;
}

.ghost {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 8px 13px;
}

.daybar {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 8px 10px;
}

.daypick {
  flex: 1;
  text-align: center;
}

#fillDate {
  border: 0;
  background: none;
  font-size: 19px;
  font-weight: 700;
  text-align: center;
  width: 100%;
}

.daychips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 8px 0;
  padding-bottom: 2px;
}

.daychips button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 9px;
  padding: 5px 9px;
  font-size: 13px;
  line-height: 1.3;
}

.daychips button.on {
  border-color: var(--teal);
  background: var(--teal-l);
  color: var(--teal);
  font-weight: 700;
}

.daychips i {
  font-style: normal;
  font-size: 11px;
  color: var(--muted);
  display: block;
}

.searchbar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.searchbar input,
.filters input,
.filters select,
.card input,
.card select,
.barrow input,
.barrow select {
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 10px;
  background: #fff;
  min-width: 0;
}

.searchbar input {
  flex: 1;
}

.searchbar .mini {
  background: #fff;
  color: var(--muted);
  border: 1px solid var(--line);
}

.grouptabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin-bottom: 8px;
}

.grouptabs button {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13px;
}

.grouptabs button.on {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.people {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 7px;
}

.person {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 6px 8px;
  text-align: center;
  cursor: pointer;
}

.person .nm {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
}

.person .gp {
  font-size: 11px;
  color: var(--muted);
}

.person .badge {
  display: inline-block;
  margin-top: 4px;
  font-size: 11px;
  border-radius: 999px;
  padding: 1px 7px;
  background: #f1f3f5;
  color: var(--muted);
}

.person.has {
  border-color: var(--teal);
  background: var(--teal-l);
}

.person .badge.d {
  background: #fde8e8;
  color: var(--red);
}

.person .badge.p {
  background: #e4f5e9;
  color: var(--green);
}

.fill-tip {
  margin: 10px 0 16px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}

.weekbar,
.barrow {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.weekbar > div {
  flex: 1;
  text-align: center;
}

.sec {
  margin: 14px 0 6px;
  font-size: 14px;
  color: var(--teal);
}

.table {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tr {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
}

.tr.head {
  background: #f8faf9;
  font-size: 12px;
  color: var(--muted);
}

.tr .c1 {
  flex: 0 0 96px;
  font-weight: 600;
}

.tr .c2 {
  flex: 1;
  min-width: 0;
}

.tr .num {
  flex: 0 0 46px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.tr .act {
  flex: 0 0 auto;
  display: flex;
  gap: 5px;
}

.tr button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  padding: 3px 8px;
  font-size: 12px;
}

.neg {
  color: var(--red);
  font-weight: 700;
}

.pos {
  color: var(--green);
  font-weight: 700;
}

.zero {
  color: var(--muted);
}

.rec {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
}

.rec .r1 {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.rec .cat {
  font-size: 11px;
  background: var(--teal-l);
  color: var(--teal);
  border-radius: 999px;
  padding: 1px 8px;
}

.rec .desc {
  margin-top: 3px;
  white-space: pre-wrap;
  word-break: break-word;
}

.rec .meta {
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.rec img {
  width: 44px;
  height: 44px;
  object-fit: cover;
  border-radius: 6px;
  margin-top: 4px;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 8px;
}

.filters .chk {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 13px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
}

.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
}

.kpi b {
  display: block;
  font-size: 21px;
  line-height: 1.2;
}

.kpi span {
  font-size: 12px;
  color: var(--muted);
}

.bar {
  height: 7px;
  background: #f1f3f5;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 3px;
}

.bar i {
  display: block;
  height: 100%;
  background: var(--red);
}

.sheet-wrap {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-mask {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, .45);
}

.sheet {
  position: relative;
  width: 100%;
  max-width: 620px;
  max-height: 92vh;
  overflow-y: auto;
  background: #fff;
  border-radius: 16px 16px 0 0;
  padding: 10px 12px calc(14px + env(safe-area-inset-bottom));
}

.sheet-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.field {
  margin-top: 10px;
}

.lab {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.chips button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 5px 11px;
  font-size: 13px;
}

.chips button.on {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

textarea,
.sheet input[type=text],
.sheet input:not([type]) {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 9px 10px;
}

.hint {
  margin-top: 6px;
}

.suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
}

.suggest button {
  border: 1px dashed #b9c3cc;
  background: #fbfcfd;
  border-radius: 7px;
  padding: 3px 8px;
  font-size: 12px;
}

.scorebox {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.stepper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.stepper button {
  width: 36px;
  height: 36px;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: #fff;
  font-size: 19px;
}

#fScore {
  width: 66px;
  text-align: center;
  font-size: 18px;
  font-weight: 700;
}

.preset {
  display: flex;
  gap: 5px;
}

.preset button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 7px;
  padding: 4px 9px;
  font-size: 13px;
}

.rulelist {
  max-height: 168px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 8px;
  background: #fbfcfd;
  font-size: 12px;
}

.rulelist div {
  padding: 4px 0;
  border-bottom: 1px dashed #eceff1;
}

.rulelist b {
  color: var(--red);
}

.rtag {
  font-size: 11px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 6px;
}

.rulelist .hit {
  cursor: pointer;
  color: var(--teal);
}

.rulelist .hit.on {
  background: var(--teal-l);
  font-weight: 700;
}

.existing {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.existing .rec {
  padding: 6px 8px;
}

.sheet-foot {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  position: sticky;
  bottom: 0;
  background: #fff;
  padding-top: 8px;
}

.sheet-foot .primary,
.sheet-foot .ghost {
  flex: 1;
}

.thumbs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 6px;
}

.thumbs span {
  position: relative;
}

.thumbs img {
  width: 54px;
  height: 54px;
  object-fit: cover;
  border-radius: 8px;
  display: block;
}

.thumbs em {
  position: absolute;
  right: -4px;
  top: -4px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: rgba(15, 23, 42, .7);
  color: #fff;
  font-style: normal;
  font-size: 12px;
  text-align: center;
  line-height: 19px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, .92);
  color: #fff;
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
  z-index: 90;
}

.toast.on {
  opacity: 1;
}

.prompt-wrap {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, .4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 80;
}

.prompt {
  background: #fff;
  border-radius: 12px;
  padding: 14px;
  width: min(320px, 88vw);
}

.prompt input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  margin: 8px 0;
}

.prompt > div {
  display: flex;
  gap: 8px;
}

.prompt button {
  flex: 1;
}

@media (min-width: 780px) {
  .people {
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  }

  .filters {
    grid-template-columns: repeat(3, 1fr);
  }
}
