:root {
  --bg: #f1f5f4;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --brand: #0f766e;
  --brand-soft: #ccfbf1;
  --border: #e2e8f0;
  --shadow: 0 1px 3px rgba(15, 23, 42, .08);
}

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

body {
  margin: 0;
  font-family: -apple-system, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  padding-bottom: 40px;
}

/* 顶栏 */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  background: var(--brand); color: #fff;
  padding: 12px 14px;
  box-shadow: var(--shadow);
}
.navbtn {
  width: 40px; height: 40px; flex: 0 0 auto;
  border: none; border-radius: 12px;
  background: rgba(255,255,255,.18); color: #fff;
  font-size: 26px; line-height: 1; cursor: pointer;
}
.navbtn:active { background: rgba(255,255,255,.32); }
.datewrap { text-align: center; flex: 1; }
.datewrap input[type=date] {
  border: none; background: transparent; color: #fff;
  font-size: 17px; font-weight: 600; text-align: center;
  width: 100%;
}
.datelabel { font-size: 12px; opacity: .85; margin-top: 2px; }

main { max-width: 560px; margin: 0 auto; padding: 14px; }

.card {
  background: var(--card); border-radius: 16px;
  padding: 14px 14px 4px; margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.field { margin-bottom: 14px; }
.field > label {
  display: block; font-size: 14px; font-weight: 600;
  color: var(--ink); margin-bottom: 8px;
}
.muted { color: var(--muted); font-weight: 400; font-size: 12px; }

/* 点选按钮组 */
.choices { display: flex; gap: 8px; flex-wrap: wrap; }
.choices button {
  flex: 1 1 auto; min-width: 60px;
  padding: 11px 6px; border-radius: 12px;
  border: 1.5px solid var(--border); background: #fff;
  color: var(--ink); font-size: 15px; cursor: pointer;
  transition: all .12s;
}
.choices button:active { transform: scale(.96); }
.choices button.on {
  background: var(--brand); border-color: var(--brand);
  color: #fff; font-weight: 600;
}

/* 输入框 */
input[type=number], input[type=text], input[type=time] {
  width: 100%; padding: 11px 12px;
  border: 1.5px solid var(--border); border-radius: 12px;
  font-size: 16px; background: #fff; color: var(--ink);
}
input:focus { outline: none; border-color: var(--brand); }

.inline { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline .unit { font-size: 13px; color: var(--muted); flex: 0 0 auto; }
.inline input[type=time] { width: auto; flex: 1 1 110px; }
.inline input[type=number] { width: auto; flex: 1 1 70px; }

.row2 { display: flex; gap: 12px; }
.row2 > div { flex: 1; }
.row2 label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; }

.weekly { border: 1.5px dashed var(--brand-soft); }
.weekly-title {
  font-size: 12px; color: var(--brand); font-weight: 700;
  margin-bottom: 12px; letter-spacing: .5px;
}

.save {
  width: 100%; padding: 15px;
  border: none; border-radius: 14px;
  background: var(--brand); color: #fff;
  font-size: 17px; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 12px rgba(15,118,110,.25);
}
.save:active { transform: scale(.99); }
.save.saved { background: #059669; }

.actions { margin-top: 12px; text-align: center; }
.ghost {
  display: inline-block; padding: 11px 18px;
  border: 1.5px solid var(--border); border-radius: 12px;
  background: #fff; color: var(--brand); font-size: 15px;
  font-weight: 600; text-decoration: none;
}
.ghost:active { background: var(--brand-soft); }

/* 历史 */
.history { max-width: 560px; margin: 8px auto 0; padding: 0 14px; }
.hist-title { font-size: 13px; color: var(--muted); font-weight: 600; margin: 8px 0; }
.hist-item {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border-radius: 12px; padding: 12px 14px;
  margin-bottom: 8px; box-shadow: var(--shadow); cursor: pointer;
}
.hist-item .hd { font-weight: 700; font-size: 14px; flex: 0 0 62px; }
.hist-item .hb { font-size: 13px; color: var(--muted); flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-item .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--brand); flex: 0 0 auto; }

.toast {
  position: fixed; left: 50%; bottom: 40px; transform: translateX(-50%) translateY(20px);
  background: rgba(15,23,42,.92); color: #fff;
  padding: 12px 22px; border-radius: 24px; font-size: 15px;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
