:root {
  --blue: #1677ff;
  --blue-soft: #eaf2ff;
  --text: #14171f;
  --text-2: #6b7280;
  --line: #e9ecf1;
  --bg: #f4f6f9;
  --warn: #d97706;
  --ok: #0f9d58;
}

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

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 16px calc(96px + env(safe-area-inset-bottom));
}

.hd { margin-bottom: 14px; }
.hd-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.hd h1 { font-size: 19px; font-weight: 500; margin: 0; letter-spacing: .2px; }
.hd-sub { margin: 4px 0 0; color: var(--text-2); font-size: 13px; display: flex; justify-content: space-between; align-items: center; }
.hd-sub .link { color: var(--blue); text-decoration: none; font-size: 12px; }
.nav-row { display: flex; gap: 16px; margin-top: 10px; }
.nav-row a { font-size: 13px; color: var(--blue); text-decoration: none; padding: 4px 0; border-bottom: 2px solid transparent; }
.nav-row a.on { border-bottom-color: var(--blue); font-weight: 600; }
.nav-row a.muted { color: var(--text-2); }
.nav-row a.view-switch { margin-left: auto; color: var(--text-2); font-size: 12px; }
.demo-flag { display: inline-block; margin-left: 6px; font-size: 11px; color: #b45309; background: #fef3c7; border-radius: 5px; padding: 1px 6px; vertical-align: middle; }

.week-select {
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  padding: 4px 8px;
  border: 1px solid var(--blue-soft);
  border-radius: 999px;
  max-width: 62vw;
  font-family: inherit;
}
.badge {
  background: var(--blue-soft);
  color: var(--blue);
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

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

.card-hd {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 10px;
}
.card-hd h2 { font-size: 14px; font-weight: 500; margin: 0; }
.hint, .src { font-size: 12px; color: var(--text-2); }

.metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.metric {
  background: #f8fafc;
  border-radius: 10px;
  padding: 10px 12px;
}
.metric span { display: block; font-size: 12px; color: var(--text-2); }
.metric strong { display: block; font-size: 19px; font-weight: 500; margin-top: 2px; }
.metric.accent { background: var(--blue-soft); }
.metric.accent strong { color: var(--blue); }

.note { font-size: 12px; color: var(--text-2); margin: 10px 0 8px; }
.cap-warn { margin: 8px 0 0; padding: 9px 11px; border-radius: 8px; background: #fff7e6; border: 1px solid #ffd591; color: #ad4e00; font-size: 12px; line-height: 1.5; }

.proj-list { padding-bottom: 8px; }
.proj {
  display: grid;
  grid-template-columns: 1fr 78px 58px;
  align-items: center;
  gap: 8px;
  padding: 10px 0;
  border-top: 1px solid #f3f5f8;
}
.proj:first-child { border-top: none; }
.p-name { font-size: 14px; }
.p-meta { font-size: 12px; color: var(--text-2); margin-top: 2px; }
.p-input { position: relative; display: flex; align-items: center; }
.p-input input {
  width: 100%;
  height: 36px;
  border: 1px solid #dfe3ea;
  border-radius: 9px;
  padding: 0 22px 0 10px;
  font-size: 15px;
  text-align: right;
  color: var(--text);
  background: #fff;
  outline: none;
  font-family: inherit;
}
.p-input input:focus { border-color: var(--blue); }
.p-input .unit {
  position: absolute;
  right: 8px;
  font-size: 12px;
  color: var(--text-2);
  pointer-events: none;
}
.p-hours { text-align: right; font-size: 15px; color: var(--blue); font-variant-numeric: tabular-nums; }
.p-hours small { font-size: 11px; color: var(--text-2); }

.non-proj .p-name { color: var(--text-2); }

.bar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  background: rgba(255,255,255,.97);
  border-top: 1px solid var(--line);
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 14px;
}
.bar-sum { display: flex; flex-direction: column; min-width: 76px; }
.sum-pct { font-size: 16px; font-weight: 500; }
.sum-pct.bad { color: var(--warn); }
.sum-pct.good { color: var(--ok); }
.sum-h { font-size: 12px; color: var(--text-2); }

.btn {
  flex: 1;
  height: 44px;
  border: none;
  border-radius: 22px;
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  font-family: inherit;
}
.btn:disabled { background: #c9d3e2; }

.result-card .row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 8px 0;
  border-top: 1px solid #f3f5f8;
}
.result-card .row:first-child { border-top: none; }
.result-card .row b { font-weight: 500; }
.chain-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 7px 0;
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); flex: none; }
.dot.done { background: var(--ok); }

.foot-note { font-size: 12px; color: #98a1ae; padding: 2px 2px 0; line-height: 1.6; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 100px;
  transform: translate(-50%, 12px);
  background: rgba(20, 23, 31, .92);
  color: #fff;
  font-size: 13px;
  padding: 10px 16px;
  border-radius: 10px;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  pointer-events: none;
  max-width: 80vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

a.badge { text-decoration: none; }

.form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid #f3f5f8;
}
.form-row:first-child { border-top: none; }
.form-row label { font-size: 14px; flex: 1; }
.form-row select {
  width: 54%;
  height: 36px;
  border: 1px solid #dfe3ea;
  border-radius: 9px;
  padding: 0 8px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
  font-family: inherit;
  outline: none;
}
.form-row select:focus { border-color: var(--blue); }

.behalf-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; padding: 9px 11px; background: var(--blue-soft); border-radius: 10px; font-size: 12px; color: var(--blue); }
.behalf-row[hidden] { display: none; }
.behalf-row label { font-weight: 600; white-space: nowrap; }
.behalf-row select { flex: 1; min-width: 120px; padding: 5px 8px; border: 1px solid rgba(0,0,0,.1); border-radius: 7px; background: #fff; color: var(--text); font-family: inherit; font-size: 12px; }
.behalf-tip { color: var(--text-2); font-size: 11px; }
