:root {
  --bg: #f4f6f5; --card: #fff; --text: #1d2422; --muted: #6b7672; --line: #dfe5e2;
  --primary: #1f6f5c; --primary-weak: #e3f1ec; --danger: #c0392b; --danger-weak: #fbe9e7;
  --warn: #b7791f; --warn-weak: #fdf3e1; --ok: #2e7d32; --ok-weak: #e8f5e9;
  --radius: 14px; --shadow: 0 1px 2px rgba(0,0,0,.06), 0 2px 8px rgba(0,0,0,.04);
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #121614; --card: #1c2220; --text: #e7ecea; --muted: #97a39f; --line: #2d3532;
    --primary: #4fb79a; --primary-weak: #1d3a32; --danger: #ef6b5b; --danger-weak: #3d2220;
    --warn: #e0a84a; --warn-weak: #3a2f1b; --ok: #6cc070; --ok-weak: #1f3420; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", sans-serif; }
#bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 8px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px; background: var(--primary); color: #fff; }
#bar h1 { flex: 1; margin: 0; font-size: 18px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#who { font-size: 13px; opacity: .9; white-space: nowrap; }
.icon-btn { background: none; border: 0; color: inherit; font-size: 30px; line-height: 1; padding: 0 8px 4px 0; cursor: pointer; }
main { max-width: 760px; margin: 0 auto; padding: 16px 16px calc(env(safe-area-inset-bottom) + 40px); }
h2 { font-size: 17px; margin: 24px 0 10px; }
h2:first-child { margin-top: 4px; }
.muted { color: var(--muted); } .center { text-align: center; } .small { font-size: 13px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin-bottom: 12px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.tile { display: flex; flex-direction: column; gap: 6px; padding: 18px 16px; border: 0; text-align: left; cursor: pointer;
  background: var(--card); color: var(--text); border-radius: var(--radius); box-shadow: var(--shadow); font: inherit; text-decoration: none; }
.tile .ic { font-size: 32px; line-height: 1; }
.tile b { font-size: 16px; } .tile span { font-size: 12px; color: var(--muted); line-height: 1.4; }
.tile.sub { flex-direction: row; align-items: center; padding: 14px 16px; }
.tile.sub .ic { font-size: 22px; }
.f { display: block; margin-bottom: 14px; }
.f > span { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; font-size: 16px; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--card); color: var(--text); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); outline-offset: -1px; }
textarea { min-height: 72px; resize: vertical; }
.btn { text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 10px 18px;
  font: inherit; font-weight: 700; border-radius: 12px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; }
.btn.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.block { display: flex; width: 100%; }
.btn.big { min-height: 64px; font-size: 18px; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 14px; font-weight: 600; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row > * { flex: 1; } .row > .shrink { flex: 0 0 auto; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--card); }
.seg button { flex: 1; min-height: 46px; border: 0; background: none; font: inherit; color: var(--text); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--primary); color: #fff; font-weight: 700; }
.badge { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--line); color: var(--text); white-space: nowrap; }
.badge.ok { background: var(--ok-weak); color: var(--ok); } .badge.ng { background: var(--danger-weak); color: var(--danger); }
.badge.warn { background: var(--warn-weak); color: var(--warn); } .badge.info { background: var(--primary-weak); color: var(--primary); }
.alert { padding: 12px 14px; border-radius: 12px; margin-bottom: 12px; font-weight: 600; }
.alert.ng { background: var(--danger-weak); color: var(--danger); } .alert.ok { background: var(--ok-weak); color: var(--ok); }
.alert.warn { background: var(--warn-weak); color: var(--warn); }
.list { list-style: none; margin: 0; padding: 0; }
.list > li { display: flex; gap: 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--line); }
.list > li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.thumb { width: 64px; height: 64px; object-fit: cover; border-radius: 10px; background: var(--line); cursor: zoom-in; flex: 0 0 auto; }
.photo-pick { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 4px; width: 100%; min-height: 150px;
  border: 2px dashed var(--line); border-radius: var(--radius); background: var(--card); color: var(--muted); font: inherit; cursor: pointer; }
.photo-pick img { max-width: 100%; max-height: 260px; border-radius: 10px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 6px; }
.grid .cell { position: relative; aspect-ratio: 1; }
.grid img { width: 100%; height: 100%; object-fit: cover; border-radius: 8px; cursor: zoom-in; background: var(--line); }
.grid .x { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 16px; cursor: pointer; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { padding: 8px 6px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
table.t th { font-size: 12px; color: var(--muted); font-weight: 600; }
table.t td.num, table.t th.num { text-align: right; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 8px; }
.stat { background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.stat b { display: block; font-size: 22px; line-height: 1.2; } .stat span { font-size: 12px; color: var(--muted); }
.clock { font-size: 40px; font-weight: 800; text-align: center; letter-spacing: .02em; font-variant-numeric: tabular-nums; }
#toast { position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%) translateY(20px);
  max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 12px; background: #222; color: #fff; font-weight: 600;
  opacity: 0; pointer-events: none; transition: .2s; z-index: 100; }
#toast.show { opacity: 1; transform: translateX(-50%); } #toast.err { background: var(--danger); }
.modal { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; justify-content: center; }
.modal .sheet { background: var(--card); width: 100%; max-width: 560px; max-height: 92vh; overflow: auto; border-radius: 18px 18px 0 0;
  padding: 18px 16px calc(env(safe-area-inset-bottom) + 18px); }
@media (min-width: 600px) { .modal { align-items: center; } .modal .sheet { border-radius: 18px; } }
.modal.img { background: rgba(0,0,0,.92); align-items: center; }
.modal.img img { max-width: 100%; max-height: 100%; object-fit: contain; }
.sheet h3 { margin: 0 0 14px; font-size: 17px; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.pin-pad button { min-height: 60px; font-size: 22px; font-weight: 700; border-radius: 14px; border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; }
.pin-dots { display: flex; justify-content: center; gap: 12px; margin: 10px 0; min-height: 18px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--primary); }
.day-row { display: flex; align-items: center; gap: 10px; padding: 10px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.day-row .d { width: 64px; font-variant-numeric: tabular-nums; } .day-row .d small { color: var(--muted); }
.day-row.sun .d { color: var(--danger); } .day-row.sat .d { color: #2f6fd0; }
.day-row.today { background: var(--primary-weak); border-radius: 8px; }
.day-row .grow { flex: 1; font-variant-numeric: tabular-nums; }
.progress { height: 8px; background: var(--line); border-radius: 99px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--primary); transition: width .2s; }
