:root {
  --cream: #fffaf0; --sand: #f8edd6; --paper: #fffdf8;
  --gold: #f4b42c; --gold-soft: #ffd877; --amber: #e2861b;
  --brown: #4a2a14; --brown-2: #6e4a30; --red: #d63a2f;
  --ink: #3b2414; --ink-2: #6b5443; --line: rgba(74, 42, 20, .14);
  --green: #3f8f5a; --green-soft: #e3f3e6;
  --shadow: 0 14px 30px -20px rgba(74, 42, 20, .5);
  --maru: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--cream); color: var(--ink); font-family: var(--maru); font-weight: 500; font-size: 16px; line-height: 1.8; letter-spacing: .02em; padding-bottom: calc(110px + env(safe-area-inset-bottom)); overflow-x: clip; }
h1, h2, h3, p, ul, fieldset { margin: 0; padding: 0; }
ul { list-style: none; }
button, textarea, input { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
img { max-width: 100%; height: auto; display: block; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
[hidden] { display: none !important; }
.nw { display: inline-block; }

/* 見本の帯 */
.demo-bar { background: var(--brown); color: #fff3d6; padding: 10px 16px; display: grid; gap: 8px; }
.demo-bar p { font-size: 13px; line-height: 1.6; max-width: 760px; margin: 0 auto; width: 100%; }
.demo-bar p b { background: var(--gold); color: var(--brown); border-radius: 6px; padding: 1px 8px; margin-right: 6px; }
.demo-bar__as { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; max-width: 760px; margin: 0 auto; width: 100%; }
.demo-bar__as button { border: 2px solid rgba(255, 243, 214, .4); background: transparent; color: #fff3d6; border-radius: 12px; min-height: 52px; font-weight: 900; line-height: 1.3; display: grid; place-items: center; }
.demo-bar__as small { font-size: 12px; font-weight: 700; opacity: .85; }
.demo-bar__as button.is-on { background: var(--gold); border-color: var(--gold); color: var(--brown); }

/* あたま */
.head { position: relative; background: var(--sand); overflow: hidden; padding: 20px 16px 22px; border-radius: 0 0 28px 28px; }
.head__mane { position: absolute; width: 240px; right: -70px; top: -110px; opacity: .3; pointer-events: none; }
.head__in { position: relative; max-width: 760px; margin: 0 auto; display: flex; align-items: flex-end; gap: 10px; }
.head__txt { flex: 1; min-width: 0; }
.head__sub { font-size: 13px; font-weight: 700; color: var(--brown-2); }
.head__title { font-size: 30px; font-weight: 900; line-height: 1.25; color: var(--brown); letter-spacing: .06em; }
.head__lead { margin-top: 6px; font-size: 14px; line-height: 1.7; color: var(--ink-2); }
.head__mascot { width: 80px; flex: none; margin-bottom: -6px; }
.who { position: relative; max-width: 760px; margin: 12px auto 0; font-size: 14px; font-weight: 700; color: var(--brown); }
.who span { display: inline-block; background: var(--paper); border-radius: 999px; padding: 6px 14px; box-shadow: var(--shadow); }
body[data-mode="recv"] .head { background: var(--green-soft); }

/* 切り替え */
.tabs { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 12px 12px 8px; background: var(--cream); max-width: 784px; margin: 0 auto; }
.tab { min-height: 48px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-weight: 900; font-size: 14px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 6px; }
.tab.is-on { background: var(--brown); border-color: var(--brown); color: #fff3d6; }
.tab__n { background: var(--red); color: #fff; border-radius: 999px; font-size: 12px; min-width: 22px; padding: 0 6px; line-height: 22px; text-align: center; }

.main { max-width: 760px; margin: 0 auto; padding: 8px 16px 0; display: grid; gap: 12px; }
.sec { font-size: 18px; font-weight: 900; color: var(--brown); margin-top: 6px; }
.sec--sub { color: var(--ink-2); font-size: 16px; margin-top: 14px; }
.lead { font-size: 14px; color: var(--ink-2); line-height: 1.7; }

/* カード */
.card { background: var(--paper); border: 2px solid var(--line); border-radius: 18px; padding: 16px; display: grid; gap: 8px; box-shadow: var(--shadow); }
.card.is-done { opacity: .72; box-shadow: none; }
.card__top { display: flex; flex-wrap: wrap; gap: 6px; }
.kind, .tag { font-weight: 900; font-size: 13px; line-height: 1; padding: 7px 11px; border-radius: 999px; white-space: nowrap; }
.kind { background: var(--sand); color: var(--brown); }
.tag--urgent { background: var(--red); color: #fff; }
.tag--due { background: #fff3d6; color: var(--brown); border: 1.5px solid var(--amber); }
.card__title { font-size: 18px; font-weight: 900; color: var(--brown); line-height: 1.5; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--ink-2); }
.body { font-size: 15px; line-height: 1.8; white-space: pre-wrap; }
.prog { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; }
.prog__bar { height: 12px; border-radius: 999px; background: var(--sand); overflow: hidden; }
.prog__bar i { display: block; height: 100%; background: var(--green); border-radius: 999px; }
.prog__t { font-size: 14px; font-weight: 900; color: var(--green); white-space: nowrap; }
.miss { font-size: 14px; font-weight: 700; color: var(--red); line-height: 1.7; }
.miss--ok { color: var(--green); }
.acts { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn { min-height: 46px; padding: 0 16px; border-radius: 12px; border: 2px solid var(--line); background: #fff; font-weight: 900; font-size: 15px; color: var(--brown); }
.btn--main { background: var(--amber); border-color: var(--amber); color: #fff; }
.btn--ok { background: var(--green); border-color: var(--green); color: #fff; }
.btn--ghost { border: 0; background: none; text-decoration: underline; color: var(--ink-2); min-height: 40px; }
.ok { font-weight: 900; color: var(--green); }

/* 棚 */
.shelf { display: grid; gap: 10px; }
.shelf__i { position: relative; text-align: left; background: var(--paper); border: 2px solid var(--line); border-radius: 16px; padding: 14px 16px; display: grid; gap: 2px; }
.shelf__i b { font-size: 16px; color: var(--brown); }
.shelf__i span { font-size: 14px; color: var(--ink-2); line-height: 1.6; }
.shelf__i small { font-size: 12px; color: var(--ink-2); }
.new { position: absolute; top: 12px; right: 12px; background: var(--red); color: #fff; font-style: normal; font-size: 11px; font-weight: 900; border-radius: 6px; padding: 0 6px; }

/* 先生の一覧・くわしく */
.people { display: grid; gap: 8px; }
.people li { background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: 10px 14px; display: grid; grid-template-columns: 1fr auto; gap: 0 10px; align-items: center; }
.people li b { color: var(--brown); }
.people li small { grid-column: 1; font-size: 13px; color: var(--ink-2); }
.people__st { grid-column: 2; grid-row: 1 / span 2; font-size: 13px; font-weight: 900; color: var(--red); }
.people li.is-ok .people__st { color: var(--green); }
.people--admin li { grid-template-columns: 1fr; }
.people--admin .acts { margin-top: 6px; }
.people li.is-off { opacity: .55; }
.facs { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px; }
.facs i { font-style: normal; font-size: 12px; font-weight: 700; background: var(--sand); border-radius: 999px; padding: 0 8px; }
.sum { display: flex; gap: 8px; flex-wrap: wrap; }
.sum__i { background: var(--green-soft); color: var(--green); font-weight: 900; border-radius: 999px; padding: 4px 12px; }
.install { background: #fff; border: 2px dashed var(--line); border-radius: 16px; padding: 14px 16px; display: grid; gap: 4px; font-size: 13px; color: var(--ink-2); line-height: 1.7; margin-top: 8px; }
.install b { color: var(--brown); font-size: 15px; }
.reset { justify-self: center; margin: 24px 0 8px; background: none; border: 0; text-decoration: underline; color: var(--ink-2); font-size: 13px; min-height: 44px; }

/* 下のボタン */
.bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 10px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--cream) 30%); }
.write { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; max-width: 728px; margin: 0 auto; min-height: 60px; border: 0; border-radius: 16px; background: var(--amber); color: #fff; font-size: 19px; font-weight: 900; box-shadow: 0 6px 0 #b8650f; }
.write svg { width: 24px; height: 24px; }

/* 窓 */
.sheet { border: 0; padding: 0; width: 100%; max-width: 600px; margin: auto auto 0; background: var(--paper); color: var(--ink); border-radius: 20px 20px 0 0; max-height: 92vh; overflow-y: auto; }
.sheet::backdrop { background: rgba(44, 26, 14, .5); }
.sheet__in { padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); display: grid; gap: 10px; }
.sheet__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sheet__head h2 { font-size: 20px; font-weight: 900; color: var(--brown); line-height: 1.4; }
.x { width: 48px; height: 48px; flex: none; border: 0; border-radius: 50%; background: var(--sand); font-size: 24px; line-height: 1; }
.kinds { border: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.kinds legend { font-size: 14px; font-weight: 700; margin-bottom: 6px; padding: 0; }
.kinds label { position: relative; }
.kinds input { position: absolute; opacity: 0; inset: 0; }
.kinds span { display: grid; place-items: center; text-align: center; min-height: 62px; padding: 6px 4px; border-radius: 14px; border: 2px solid var(--line); background: #fff; line-height: 1.35; }
.kinds b { font-size: 15px; white-space: nowrap; }
.kinds small { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
.kinds input:checked + span { border-color: var(--amber); background: #fff3d6; box-shadow: inset 0 0 0 1px var(--amber); }
.lbl { font-size: 14px; font-weight: 700; }
.in { width: 100%; min-height: 48px; border: 2px solid #e6d6bd; border-radius: 12px; background: #fff; padding: 10px 12px; font-size: 16px; }
textarea.in { line-height: 1.7; resize: vertical; }
.in:focus { outline: 3px solid var(--gold); border-color: var(--amber); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { min-height: 44px; padding: 0 14px; border-radius: 999px; border: 2px solid var(--line); background: #fff; font-weight: 900; font-size: 14px; }
.chip.is-on { background: var(--brown); border-color: var(--brown); color: #fff3d6; }
.count { font-size: 14px; font-weight: 900; color: var(--green); }
.check { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 6px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font-size: 14px; font-weight: 700; line-height: 1.5; }
.check input { width: 22px; height: 22px; flex: none; accent-color: var(--red); }
.check:has(input:checked) { border-color: var(--red); background: #fdecea; }
.hint { font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.send { min-height: 56px; border: 0; border-radius: 14px; background: var(--brown); color: #fff3d6; font-size: 18px; font-weight: 900; }

.toast { position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50; width: min(92vw, 560px); background: var(--brown); color: #fff3d6; border-radius: 14px; padding: 12px 16px; font-size: 14px; font-weight: 700; line-height: 1.6; text-align: center; box-shadow: var(--shadow); }

@media (min-width: 700px) {
  .head__title { font-size: 36px; }
  .head__mascot { width: 104px; }
  .sheet { margin: auto; border-radius: 20px; }
}
