/* たいけんノート
   色は 2 色だけ。深緑（hero）＝週末そのもの、テラコッタ（accent）＝手を動かすところ。
   紙のような下地に置いて、グラデーションは使わない。 */

:root {
  --paper:   #f4f1ea;
  --surface: #ffffff;
  --sunk:    #ece7dc;
  --ink:     #1d2a2c;
  --muted:   #6c787a;
  --line:    #e0dacd;
  --hero:    #2e6b57;
  --hero-sub:#eaf1ed;
  --hero-soft:#a9cbba;
  --accent:  #c9572a;
  --accent-sub:#fbeee7;
  --warn:    #a97a12;
  --warn-sub:#faf1d8;
  --warn-line:#e6cf92;
  --radius:  14px;
  --tap:     46px;
  --safe-b:  env(safe-area-inset-bottom, 0px);
}

html[data-theme="dark"] {
  --paper:   #11171a;
  --surface: #1a2226;
  --sunk:    #232d31;
  --ink:     #e8e5dd;
  --muted:   #96a3a5;
  --line:    #2b373b;
  --hero:    #74b697;
  --hero-sub:#1d2e28;
  --hero-soft:#3f6f5a;
  --accent:  #e8875a;
  --accent-sub:#33241c;
  --warn:    #d6a94a;
  --warn-sub:#332a14;
  --warn-line:#5a4a22;
}

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) {
    --paper:   #11171a;
    --surface: #1a2226;
    --sunk:    #232d31;
    --ink:     #e8e5dd;
    --muted:   #96a3a5;
    --line:    #2b373b;
    --hero:    #74b697;
    --hero-sub:#1d2e28;
    --hero-soft:#3f6f5a;
  --hero-soft:#3f6f5a;
    --accent:  #e8875a;
    --accent-sub:#33241c;
    --warn:    #d6a94a;
    --warn-sub:#332a14;
    --warn-line:#5a4a22;
  }
}

* { box-sizing: border-box; }

/* .gate や .sheet が display を指定するので、hidden を後ろから効かせ直す */
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.6 -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: none;
}

h1, h2, h3 { margin: 0; font-weight: 700; letter-spacing: .01em; }
p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
.muted { color: var(--muted); font-size: 13px; }
.err { color: var(--accent); font-size: 13px; margin-top: 6px; }

.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8;
      stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ── ヘッダ ── */
.top {
  position: sticky; top: 0; z-index: 20;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px 0;
}
.top-row { display: flex; align-items: center; justify-content: space-between; }
.brand { display: flex; align-items: center; gap: 7px; font-size: 16px; color: var(--hero); }
.icon-btn {
  width: var(--tap); height: var(--tap); display: grid; place-items: center;
  background: none; border: 0; border-radius: 50%; color: var(--muted); cursor: pointer;
}
.icon-btn:active { background: var(--sunk); }

.banner {
  margin: 8px 0 10px; padding: 9px 12px; border-radius: 10px;
  background: var(--hero-sub); border-left: 3px solid var(--hero);
  font-size: 13px; line-height: 1.5;
}
.banner b { color: var(--hero); }

/* ── 本体 ── */
main { padding: 14px 14px calc(84px + var(--safe-b)); max-width: 620px; margin: 0 auto; }
.section { margin-bottom: 22px; }
.section > h2 { font-size: 13px; color: var(--muted); letter-spacing: .06em; margin-bottom: 8px; }

/* 週末ナビ */
.weeknav { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; }
.weeknav .date { flex: 1; text-align: center; font-size: 16px; font-weight: 700; }
.weeknav .date small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); }
.nav-btn {
  width: var(--tap); height: var(--tap); border: 1px solid var(--line); background: var(--surface);
  border-radius: 12px; display: grid; place-items: center; color: var(--ink); cursor: pointer;
}

/* 見出し（土/日） */
.dayhead {
  display: flex; align-items: baseline; gap: 8px;
  margin: 18px 0 8px; font-size: 13px; color: var(--muted); font-weight: 700; letter-spacing: .08em;
}
.dayhead::after { content: ""; flex: 1; height: 1px; background: var(--line); }

/* スロットカード */
.slot {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px; margin-bottom: 10px;
}
.slot.fixed { border-left: 3px solid var(--hero); }
.slot.rested { opacity: .5; }
.slot-head { display: flex; align-items: center; gap: 8px; margin-bottom: 2px; }
.slot-head .name { font-weight: 700; font-size: 15px; }
.slot-head .time { font-size: 12px; color: var(--muted); margin-left: auto; font-variant-numeric: tabular-nums; }
.badge {
  font-size: 11px; padding: 2px 7px; border-radius: 999px;
  background: var(--hero-sub); color: var(--hero); font-weight: 700;
}
.badge.warn { background: var(--accent-sub); color: var(--accent); }

.entry { border-top: 1px dashed var(--line); margin-top: 10px; padding-top: 10px; }
.entry:first-of-type { border-top: 0; margin-top: 6px; padding-top: 0; }
.entry-title { font-weight: 700; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.entry-title .st { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--sunk); color: var(--muted); font-weight: 700; }
.entry-title .st.decided { background: var(--hero-sub); color: var(--hero); }
.entry-title .st.done { background: var(--hero); color: #fff; }
.entry-title .st.skipped { text-decoration: line-through; }
.entry-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.chip {
  font-size: 11px; padding: 3px 8px; border-radius: 999px;
  background: var(--sunk); color: var(--muted);
}
.chip.on { background: var(--hero); color: #fff; }

.row-actions { display: flex; gap: 7px; margin-top: 10px; flex-wrap: wrap; }

/* ボタン */
.btn {
  min-height: 40px; padding: 0 14px; border-radius: 11px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  font-size: 14px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
}
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--hero); border-color: var(--hero); color: #fff; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--accent); border-color: var(--accent); }
.btn.block { width: 100%; min-height: var(--tap); }
.btn.sm { min-height: 34px; font-size: 13px; padding: 0 11px; }
.btn[disabled] { opacity: .45; }

.add-slot {
  width: 100%; min-height: 40px; margin-top: 10px;
  border: 1px dashed var(--line); border-radius: 11px; background: transparent;
  color: var(--muted); font-size: 13px; font-weight: 700; cursor: pointer;
  display: flex; align-items: center; justify-content: center; gap: 6px;
}

/* 休養週末 */
.rest-bar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 12px;
}
.rest-bar .txt { flex: 1; font-size: 13px; }
.rest-bar.on { background: var(--hero-sub); border-color: var(--hero); }

/* 場所リスト */
.place {
  display: flex; align-items: center; gap: 10px; width: 100%;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 12px; margin-bottom: 8px; text-align: left; cursor: pointer; color: inherit;
}
.place .n { font-weight: 700; flex: 1; }
.place .cnt { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.place .pass { font-size: 11px; color: var(--accent); font-weight: 700; }

/* 記録リスト */
.rec {
  display: block; width: 100%; text-align: left; cursor: pointer; color: inherit;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 12px; margin-bottom: 8px;
}
.rec.filled { border-left: 3px solid var(--hero); }
.rec > span { display: block; }
.rec .d { font-size: 12px; color: var(--muted); }
.rec .t { font-weight: 700; margin-top: 1px; }
.rec .g { font-size: 12px; color: var(--accent); margin-top: 4px; font-weight: 700; }

/* 入力 */
label.f { display: block; margin-bottom: 14px; }
label.f > span { display: block; font-size: 12px; color: var(--muted); font-weight: 700; margin-bottom: 5px; }
input[type="text"], input[type="password"], input[type="date"], textarea, select {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 11px;
  background: var(--surface); color: var(--ink); min-height: var(--tap);
}
textarea { min-height: 72px; resize: vertical; line-height: 1.6; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--hero); outline-offset: -1px; }

.seg { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.seg button {
  flex: 1; min-height: var(--tap); border: 0; background: var(--surface); color: var(--muted);
  font-weight: 700; cursor: pointer;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button.on { background: var(--hero); color: #fff; }

.check { display: flex; align-items: center; gap: 10px; min-height: var(--tap); cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--hero); }

/* 3ルールカード */
.rule { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; }
.rule .no { font-size: 11px; font-weight: 700; color: var(--accent); letter-spacing: .1em; }
.rule .q { font-weight: 700; margin: 2px 0 8px; }
.rule .hint { font-size: 12px; color: var(--muted); margin-bottom: 8px; }

.photos { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.photos img { width: 76px; height: 76px; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.photos .ph { position: relative; }
.photos .ph button {
  position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; border-radius: 50%;
  border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer;
}
.photos .ph button .ic { width: 14px; height: 14px; stroke-width: 2.6; }

/* タブ */
.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.tab {
  flex: 1; min-height: 58px; border: 0; background: none; color: var(--muted); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 11px; font-weight: 700;
}
.tab.is-on { color: var(--hero); }
.tab.is-on .ic { stroke-width: 2.1; }

/* PIN */
.gate { position: fixed; inset: 0; background: var(--paper); display: grid; place-items: center; padding: 24px; z-index: 60; }
.gate-card { width: 100%; max-width: 320px; }
.gate-card h2 { display: flex; align-items: center; gap: 8px; color: var(--hero); margin-bottom: 6px; }
.gate-card input { margin: 16px 0 4px; text-align: center; letter-spacing: .35em; font-size: 20px; }
.gate-card .btn { margin-top: 14px; }

/* シート */
.sheet { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; }
.sheet-back { position: absolute; inset: 0; background: rgba(12, 20, 22, .45); }
.sheet-body {
  position: relative; width: 100%; max-width: 620px; margin: 0 auto;
  background: var(--paper); border-radius: 18px 18px 0 0;
  max-height: 92vh; overflow-y: auto; padding: 0 14px calc(20px + var(--safe-b));
  animation: up .18s ease-out;
}
@keyframes up { from { transform: translateY(18px); } }
.sheet-head {
  position: sticky; top: 0; background: var(--paper); z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 14px;
}
.sheet-head h2 { font-size: 16px; }

/* トースト */
.toast {
  position: fixed; left: 50%; bottom: calc(76px + var(--safe-b)); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 999px;
  font-size: 13px; font-weight: 700; z-index: 70; max-width: 90vw; text-align: center;
}

.empty { color: var(--muted); font-size: 13px; padding: 14px 2px; }
.queued { color: var(--warn); font-size: 12px; font-weight: 700; }

.link {
  background: none; border: 0; padding: 0; color: var(--hero);
  font-size: 11px; font-weight: 700; text-decoration: underline; cursor: pointer;
}
a.btn { text-decoration: none; }

/* ══ ダッシュボード ══ */

.range-seg { margin-bottom: 14px; }

.bars { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.bar-row { margin-bottom: 11px; }
.bar-row:last-child { margin-bottom: 0; }
.bar-top { display: flex; align-items: baseline; gap: 8px; font-size: 12px; margin-bottom: 4px; }
.bar-top .nm { font-weight: 700; }
.bar-top .src { color: var(--muted); font-size: 11px; }
.bar-top .num { margin-left: auto; color: var(--muted); font-variant-numeric: tabular-nums; }
.bar-track { display: flex; height: 12px; border-radius: 999px; background: var(--sunk); overflow: hidden; }
.bar-fill { height: 100%; }
/* 習い事で担保済み＝薄い緑、週末に追加した分＝濃い緑 */
.bar-fill.covered { background: var(--hero-soft); }
.bar-fill.added { background: var(--hero); }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 12px; font-size: 11px; color: var(--muted); }
.legend span { display: flex; align-items: center; gap: 5px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: block; }
.legend i.covered { background: var(--hero-soft); }
.legend i.added { background: var(--hero); }

.alert {
  background: var(--warn-sub); border: 1px solid var(--warn-line); border-left: 3px solid var(--warn);
  border-radius: 12px; padding: 11px 12px; margin-bottom: 8px;
}
.alert .hd { display: flex; align-items: center; gap: 7px; font-weight: 700; font-size: 14px; color: var(--warn); }
.alert .dt { font-size: 12px; color: var(--muted); margin-top: 4px; }

.soft {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 11px 12px; font-size: 13px;
}
.soft.ok { border-left: 3px solid var(--hero); }
.soft.miss { border-left: 3px solid var(--warn); }

.pcount { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-bottom: 1px solid var(--line); }
.pcount:last-child { border-bottom: 0; }
.pcount .n { font-weight: 700; flex: 1; font-size: 14px; }
.pcount .y { font-variant-numeric: tabular-nums; font-weight: 700; }
.pcount.pass { background: var(--hero-sub); }
.pcount.pass .y { color: var(--hero); }
.pcount .t { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }

/* ══ 旅行 ══ */

.policy {
  font-size: 12px; color: var(--muted); background: var(--sunk);
  border-radius: 10px; padding: 9px 12px; margin-bottom: 14px; line-height: 1.5;
}

.trip { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 10px; }
.trip.next { border-left: 3px solid var(--accent); }
.trip-head { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.trip-head .nm { font-weight: 700; font-size: 15px; }
.trip-head .cd { margin-left: auto; font-size: 12px; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.trip .meta { font-size: 12px; color: var(--muted); margin-top: 3px; }
.trip .memo { font-size: 13px; margin-top: 8px; white-space: pre-wrap; }
.trip .memo b { display: block; font-size: 11px; color: var(--muted); margin-bottom: 1px; }

.st-trip { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--sunk); color: var(--muted); font-weight: 700; }
.st-trip.booked { background: var(--hero); color: #fff; }
.st-trip.done { background: var(--hero-sub); color: var(--hero); }

.rules { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 9px; }
.rules .r { font-size: 11px; padding: 3px 8px; border-radius: 999px; background: var(--sunk); color: var(--muted); }
.rules .r.on { background: var(--hero-sub); color: var(--hero); font-weight: 700; }

.task { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-top: 1px dashed var(--line); font-size: 13px; }
.task input { width: 20px; height: 20px; accent-color: var(--hero); flex: none; }
.task .tt { flex: 1; }
.task.done .tt { color: var(--muted); text-decoration: line-through; }
.task .who { font-size: 11px; color: var(--muted); }
.task .due { font-size: 11px; color: var(--accent); font-variant-numeric: tabular-nums; }

.lane { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; color: inherit; cursor: pointer;
        background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; margin-bottom: 8px; }
.lane .l { flex: 1; }
.lane .l b { display: block; font-size: 14px; }
.lane .l small { display: block; font-size: 11px; color: var(--muted); }
.lane .v { text-align: right; }
.lane .v b { display: block; font-variant-numeric: tabular-nums; }
.lane .v small { display: block; font-size: 11px; color: var(--muted); }
.lane.stale { border-color: var(--warn-line); background: var(--warn-sub); }
.lane.stale .v small { color: var(--warn); font-weight: 700; }

.verdict { border-radius: 12px; padding: 12px; margin-bottom: 10px; border: 1px solid var(--line); }
.verdict .lb { font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 7px; }
.verdict .tx { font-size: 13px; margin-top: 4px; }
.verdict.go { background: var(--hero); border-color: var(--hero); color: #fff; }
.verdict.no { background: var(--accent-sub); border-color: var(--accent); }
.verdict.no .lb { color: var(--accent); }
.verdict.pending { background: var(--sunk); }
.verdict.pending .lb { color: var(--muted); }

.tri { display: flex; gap: 0; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.tri button { min-width: 40px; min-height: 36px; border: 0; background: var(--surface); color: var(--muted); font-weight: 700; cursor: pointer; }
.tri button + button { border-left: 1px solid var(--line); }
.tri button.on { background: var(--hero); color: #fff; }
.tri button.on[data-v="0"] { background: var(--accent); }
.station { border: 1px solid var(--line); border-radius: 12px; padding: 11px; margin-bottom: 10px; background: var(--surface); }
.station .cks { display: flex; flex-direction: column; gap: 8px; margin-top: 9px; }
.station .ck { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.station .ck span { flex: 1; }

/* タブが5つになるぶん、文字を詰める */
.tab { font-size: 10px; }
.tab .ic { width: 19px; height: 19px; }
