/* 檀家台帳 — 見やすさ優先の作り（2026-11 作り直し）
   ・年配の方が読みやすいよう、本文は 18px・UDゴシック。文字と背景のコントラストは 4.5:1 以上。
   ・色は苔色（キーカラー）＋朱（注意）＋金茶（飾り）にしぼる。色だけで区別せず、必ず文字や印を添える。
   ・中身はカード型。スマホは1列、PCは広い画面を使って2〜4列に並べる。
   ・押せるところは高さ 44px 以上。 */
:root {
  --moss-900: #1F4A33;   /* 苔色（濃）…ヘッダー・主ボタン */
  --moss-700: #2F6B4A;   /* 苔色 …枠・リンク */
  --moss-300: #9DBF9A;
  --moss-100: #E6F0E4;   /* 若苔（薄）…選択中・ホバー */
  --moss-50:  #F3F8F1;
  --shu: #A93A26;        /* 朱 …注意・今年の回忌 */
  --shu-100: #FBE9E3;
  --kin: #B8913A;        /* 金茶（飾り線） */
  --bg: #F5F1E8;         /* 生成り（背景・模様なし） */
  --paper: #FFFFFF;      /* カードの面 */
  --line: #D9D1BF;
  --line-soft: #ECE6D8;
  --ink: #1C1A16;        /* 墨（本文） */
  --label: #555048;      /* 見出し語（白地で 7:1 以上） */
  --danger: #CE0000;
  --focus: #E08A3C;
  --radius: 10px;
  --mincho: "BIZ UDPMincho", "Hiragino Mincho ProN", "Yu Mincho", "YuMincho", "Noto Serif JP", serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); background: var(--bg);
  font-family: "BIZ UDPGothic", "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", Meiryo, sans-serif;
  font-size: 18px; line-height: 1.7;
}
a { color: var(--moss-900); text-underline-offset: 3px; }
a:hover { color: var(--moss-700); }
small { color: var(--label); font-size: .86em; }
b { font-weight: 700; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.pre { white-space: pre-wrap; }
.muted { color: var(--label); }
.small { font-size: .85rem; }

/* ───────── ヘッダー ───────── */
.top {
  background-color: var(--moss-900); color: #fff; border-bottom: 4px solid var(--shu);
  /* 青海波はヘッダーの帯にだけ、ごく薄く */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='24' viewBox='0 0 48 24'%3E%3Cg fill='none' stroke='%23FFFFFF' stroke-opacity='.07' stroke-width='1.2'%3E%3Cpath d='M0 24a24 24 0 0 1 48 0M6 24a18 18 0 0 1 36 0M12 24a12 12 0 0 1 24 0M18 24a6 6 0 0 1 12 0'/%3E%3Cpath d='M-24 12a24 24 0 0 1 48 0M24 12a24 24 0 0 1 48 0'/%3E%3C/g%3E%3C/svg%3E");
}
.top-in { max-width: 1320px; margin: 0 auto; padding: 10px 24px; display: flex; align-items: center; gap: 12px 28px; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; flex: none; }
.brand:hover { color: #fff; }
.kappa { width: 50px; height: 50px; flex: none; background: #F4EFE3; border-radius: 50%; padding: 3px; border: 2px solid var(--kin); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; font-family: var(--mincho); }
.brand-temple { font-size: .8rem; letter-spacing: .3em; }
.brand-name { font-size: 1.45rem; font-weight: 700; letter-spacing: .12em; }

.nav { display: flex; gap: 6px; flex-wrap: wrap; }
.nav a {
  display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 6px 16px;
  color: #fff; text-decoration: none; font-size: 1.05rem; font-weight: 700;
  border-radius: 8px; border: 2px solid transparent;
}
.nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav a[aria-current="page"] { background: #fff; color: var(--moss-900); border-color: #fff; }
.nav-ico { width: 22px; height: 22px; flex: none; }
.nav-short { display: none; }
.me { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: .95rem; flex: none; }
.me-name { color: #fff; }
.me-name:hover { color: #fff; }
.badge { background: #fff; color: var(--moss-900); border-radius: 999px; padding: 1px 10px; font-weight: 700; font-size: .8rem; }
.badge-edit { background: #FFE2C7; color: #5A2A00; }
.linkbtn { background: none; border: 0; color: #fff; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; font: inherit; padding: 8px 4px; min-height: 44px; }
.inline { display: inline; }

/* ───────── 本体 ───────── */
.main { max-width: 1320px; margin: 0 auto; padding: 24px 24px 8px; }
.foot { max-width: 1320px; margin: 0 auto; padding: 16px 24px 40px; color: var(--label); font-size: .9rem; display: flex; gap: 8px; align-items: center; }
.kappa-s { width: 28px; height: 28px; flex: none; }

/* 面（白いカード） */
.panel { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 20px; }
.panel-plain { background: none; border: 0; padding: 0; }
h1 { font-family: var(--mincho); font-size: 1.75rem; line-height: 1.35; margin: 0 0 10px; letter-spacing: .06em; }
h2 { font-family: var(--mincho); font-size: 1.35rem; line-height: 1.4; margin: 0 0 14px; letter-spacing: .05em; display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
h2::before { content: ""; align-self: center; width: 6px; height: 1.1em; border-radius: 3px; background: var(--moss-700); flex: none; }
h1 small, h2 small { font-family: initial; font-size: 1rem; font-weight: 400; letter-spacing: 0; }
.count { color: var(--label); font-family: initial; font-weight: 400; font-size: 1rem; letter-spacing: 0; }
.count b { color: var(--ink); font-size: 1.15em; }
.hint { color: var(--label); font-size: .95rem; margin: 10px 0 0; }
.empty { color: var(--label); margin: 0; padding: 12px 0; }
.updated { color: var(--label); font-size: .9rem; margin: 14px 0 0; }
.back { margin: 0 0 12px; }
.back a { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
.title-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; }
.title-row h1, .title-row h2 { margin: 0; }
.spread { justify-content: space-between; margin-bottom: 14px; }
.flash { background: var(--moss-100); border: 1px solid var(--moss-700); border-left-width: 6px; color: var(--moss-900); border-radius: var(--radius); padding: 12px 16px; margin: 0 0 18px; font-weight: 700; }
.flash::before { content: "✓ "; }

/* ───────── ボタン ───────── */
.btn-main, .btn-sub, .btn-danger {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 48px; padding: 8px 22px;
  font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; border-radius: 8px; line-height: 1.3; text-align: center;
}
.btn-main { background: var(--moss-900); color: #fff; border: 2px solid var(--moss-900); font-size: 1.1rem; letter-spacing: .12em; padding: 8px 32px; }
.btn-main:hover { background: var(--moss-700); border-color: var(--moss-700); color: #fff; }
.btn-sub { background: #fff; color: var(--moss-900); border: 2px solid var(--moss-700); font-size: 1rem; }
.btn-sub:hover { background: var(--moss-100); color: var(--moss-900); }
.btn-danger { background: #fff; color: var(--danger); border: 2px solid var(--danger); font-size: 1rem; }
.btn-danger:hover { background: #FDEEEE; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 0; }
.danger-zone { margin-top: 24px; padding-top: 16px; border-top: 2px dashed var(--line); display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ───────── 検索 ───────── */
.search-panel { padding: 26px 28px; }
.search { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 6px; }
.search input[type="search"] {
  flex: 1 1 320px; min-width: 0; min-height: 60px; font: inherit; font-size: 1.25rem; padding: 10px 18px;
  border: 3px solid var(--moss-700); border-radius: 10px; background: #fff; color: var(--ink);
}
.search input[type="search"]::placeholder { color: #6E685D; }
.search button {
  min-height: 60px; padding: 8px 36px; font-family: var(--mincho); font-size: 1.25rem; font-weight: 700; letter-spacing: .25em;
  border: 0; border-radius: 10px; background: var(--moss-900); color: #fff; cursor: pointer;
}
.search button:hover { background: var(--moss-700); }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; font-size: 1rem; color: var(--ink); cursor: pointer; }
.check input { width: 24px; height: 24px; accent-color: var(--moss-900); flex: none; }

/* ───────── 入口：全体の数 ───────── */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 0 0 20px; }
.stat { display: block; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; color: var(--ink); text-decoration: none; }
a.stat:hover { border-color: var(--moss-700); background: var(--moss-50); color: var(--ink); }
.stat-label { display: block; color: var(--label); font-size: 1rem; font-weight: 700; }
.stat-num { display: block; font-size: 2.4rem; font-weight: 700; line-height: 1.2; font-variant-numeric: tabular-nums; color: var(--moss-900); }
.stat-num small { font-size: 1rem; margin-left: 4px; color: var(--label); font-weight: 400; }
.stat-sub { display: block; color: var(--label); font-size: .9rem; }
.stat-go { color: var(--moss-700); font-weight: 700; }
.dash { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.quick { display: grid; gap: 10px; }
.quick a {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 60px; padding: 10px 18px;
  border: 2px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); text-decoration: none; font-weight: 700; font-size: 1.05rem;
}
.quick a:hover { border-color: var(--moss-700); background: var(--moss-50); color: var(--ink); }
.quick a::after { content: "›"; font-size: 1.6rem; line-height: 1; color: var(--moss-700); }
.quick small { display: block; font-weight: 400; }
.more { margin: 14px 0 0; }
.more a { font-weight: 700; display: inline-flex; min-height: 44px; align-items: center; }

/* ───────── カード（一覧・家族・故人・年回忌 共通） ───────── */
.cards { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); }
.cards-3 { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.card {
  position: relative; display: flex; flex-direction: column; gap: 6px; height: 100%;
  padding: 16px 44px 16px 18px; background: #fff; color: var(--ink); text-decoration: none;
  border: 1px solid var(--line); border-left: 6px solid var(--moss-700); border-radius: var(--radius);
}
a.card:hover { background: var(--moss-50); border-color: var(--moss-700); color: var(--ink); }
a.card::after { content: "›"; position: absolute; right: 16px; top: 50%; transform: translateY(-50%); font-size: 2rem; line-height: 1; color: var(--moss-700); }
.card-left { border-left-color: #8C857A; background: #FAF8F3; }
.card-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.name { font-family: var(--mincho); font-weight: 700; font-size: 1.35rem; line-height: 1.35; color: var(--moss-900); }
.kana { color: var(--label); font-size: .9rem; margin: 0; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: .95rem; color: var(--label); }
.addr { display: block; font-size: 1rem; }
.code { color: var(--label); font-size: .92rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag { display: inline-block; background: var(--moss-100); color: var(--moss-900); border: 1px solid var(--moss-300); border-radius: 6px; padding: 0 8px; font-size: .88rem; font-weight: 700; line-height: 1.7; white-space: nowrap; }
.tag-warn { background: var(--shu-100); color: var(--shu); border-color: #E3B5A9; }
.tag-plain { background: #F2F0EA; color: var(--ink); border-color: var(--line); }

/* カードの中の「見出し語：値」 */
.kv { display: grid; grid-template-columns: 5.5em 1fr; gap: 4px 12px; margin: 4px 0 0; font-size: 1rem; }
.kv dt { color: var(--label); font-size: .92rem; padding-top: 1px; }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.card-foot { margin-top: auto; padding-top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.card-foot .btn-sub { min-height: 44px; padding: 4px 18px; }

/* 家族・故人のカード（押す場所は下の「変更」ボタン） */
.pcard { padding-right: 18px; }
.pcard .name { font-size: 1.3rem; }
.pcard-dead { border-left-color: #6B5B3E; }

/* ───────── 檀家の詳細 ───────── */
.detail { display: grid; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); gap: 20px; align-items: start; }
.detail-side { position: sticky; top: 16px; }
.detail-main { min-width: 0; }
.detail-side .panel { border-top: 6px solid var(--moss-700); }
.who h1 { font-size: 2rem; margin: 2px 0 0; }
.who .kana { font-size: 1rem; }
.who-tags { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; }
.info { display: grid; grid-template-columns: 4.5em 1fr; gap: 10px 14px; margin: 18px 0 0; padding-top: 16px; border-top: 1px solid var(--line-soft); }
.info dt { color: var(--label); font-size: .95rem; font-weight: 700; }
.info dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.tel-link { font-weight: 700; font-size: 1.1rem; }
.kubun { list-style: none; padding: 0; margin: 18px 0 0; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kubun li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; border: 1px solid var(--line); border-radius: 8px; padding: 6px 12px; font-size: .95rem; background: #fff; }
.kubun li b { white-space: nowrap; }
.kubun li.on { border-color: var(--moss-700); background: var(--moss-100); }
.kubun li.on b { color: var(--moss-900); }
.kubun li.off b, .kubun li.none b { color: var(--label); font-weight: 400; }
.kubun li.none { border-style: dashed; }
.side-actions { display: grid; gap: 10px; margin-top: 18px; }
.jump { display: none; }
.now { background: var(--shu-100); color: var(--shu); font-weight: 700; padding: 0 8px; border-radius: 6px; border: 1px solid #E3B5A9; }
.now::before { content: "● "; }
.next-kaiki { font-weight: 700; }
.hist { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: .95rem; }
.hist li { padding: 6px 0; border-bottom: 1px solid var(--line-soft); }
.hist li:last-child { border-bottom: 0; }

/* ───────── 年回忌 ───────── */
.yearbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; }
.yearbar h1 { margin: 0; margin-right: auto; }
.yearnav { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; align-items: center; }
.yearnav a, .yearnav span.cur {
  display: inline-flex; align-items: center; min-height: 48px; padding: 4px 18px; font-weight: 700;
  border: 2px solid var(--moss-700); border-radius: 8px; background: #fff; color: var(--moss-900); text-decoration: none;
}
.yearnav a:hover { background: var(--moss-100); }
.months { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 8px; margin: 18px 0 0; }
.months a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 64px; padding: 4px;
  border: 2px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); text-decoration: none; font-weight: 700; line-height: 1.3;
}
.months a:hover { border-color: var(--moss-700); background: var(--moss-50); }
.months a small { font-weight: 400; }
.months a.zero { color: var(--label); font-weight: 400; }
.months a[aria-current="page"] { background: var(--moss-900); color: #fff; border-color: var(--moss-900); }
.months a[aria-current="page"] small { color: #fff; }
.month-h { font-family: var(--mincho); font-size: 1.35rem; margin: 28px 0 12px; padding-bottom: 6px; border-bottom: 2px solid var(--line); display: flex; align-items: baseline; gap: 12px; }
.month-h:first-child { margin-top: 0; }
.kdate { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; }
.kdate-day { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.done { color: var(--moss-900); font-weight: 700; }
.done::before { content: "✓ "; }
.inline-form { margin-top: 12px; }

/* ───────── 表（変更の記録・利用者） スマホでは1件ずつのカードにする ───────── */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 1rem; }
.tbl th { text-align: left; color: var(--label); font-weight: 700; font-size: .92rem; border-bottom: 2px solid var(--line); padding: 8px 10px; white-space: nowrap; }
.tbl td { border-bottom: 1px solid var(--line-soft); padding: 10px; vertical-align: top; }
.tbl tbody tr:hover td { background: var(--moss-50); }
.tbl td b { font-family: var(--mincho); }
.audit td { max-width: 340px; }
tr.muted td { color: var(--label); }
.pager { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 16px 0 0; }

/* ───────── 入力 ───────── */
.form { display: grid; gap: 16px; margin-top: 10px; }
.grid2 { grid-template-columns: 1fr 1fr; gap: 16px 24px; }
.grid2 .wide { grid-column: 1 / -1; }
.field { display: grid; gap: 6px; margin: 0; min-width: 0; align-content: start; }
fieldset.field { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px 14px; }
.field > span, .field legend { color: var(--ink); font-size: 1rem; font-weight: 700; }
.field small { font-weight: 400; }
.field em { font-style: normal; color: #fff; background: var(--shu); border-radius: 4px; padding: 0 6px; font-size: .8rem; margin-left: 6px; font-weight: 700; }
.field input:not([type=checkbox]), .field select, .field textarea, .pair input, .pair select, .date-row input, .date-row select,
.tbl.hoyo input:not([type=checkbox]), .inline input[type=password], .inline select, .pick-search input {
  font: inherit; font-size: 1.05rem; min-height: 50px; padding: 8px 12px; border: 2px solid #8FB08C; border-radius: 8px;
  background: #fff; color: var(--ink); min-width: 0; width: 100%;
}
.field textarea { resize: vertical; min-height: 7em; }
.field input:focus, .field select:focus, .field textarea:focus, .date-row input:focus, .date-row select:focus, .pair input:focus, .pair select:focus {
  border-color: var(--moss-900); outline: 3px solid var(--focus); outline-offset: 1px;
}
.pair { display: flex; gap: 8px; }
.pair select { flex: 0 1 50%; } .pair input { flex: 1 1 50%; }
.date-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.date-row select { width: auto; }
.date-row input { width: 4.2em; text-align: right; }
.dgrp { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.date-row .dgrp input { width: 4.2em; flex: none; }
.date-row .dgrp select { width: auto; flex: none; min-width: 5.6em; }
.kubun-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px 14px; }
.kubun-edit label { display: grid; gap: 4px; font-size: .95rem; }
.kubun-edit select { width: 100%; }
.code-big { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.err { background: #FDEEEE; border: 1px solid var(--danger); border-left-width: 6px; color: #620000; border-radius: 8px; padding: 12px 16px; margin: 0 0 16px; }
.err ul { margin: 4px 0 0; padding-left: 1.2em; }
.tbl.hoyo td { vertical-align: middle; }
.tbl.hoyo input[type=checkbox] { width: 26px; height: 26px; accent-color: var(--moss-900); }
.form-foot { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.pick { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); }
.pick-btn { width: 100%; min-height: 60px; text-align: left; font: inherit; cursor: pointer; background: #fff; border: 1px solid var(--line); border-left: 6px solid var(--moss-700); border-radius: var(--radius); padding: 10px 14px; color: var(--ink); }
.pick-btn:hover { background: var(--moss-50); border-color: var(--moss-700); }
.confirm-box { background: var(--shu-100); border: 2px solid #E3B5A9; border-radius: var(--radius); padding: 16px 18px; display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; }
.confirm-box p { margin: 0; width: 100%; }
.narrow { max-width: 1000px; }
.login { max-width: 460px; margin: 48px auto; }
.login .btn-main { width: 100%; }
.msg h1 { font-size: 1.4rem; }

/* ───────── 回忌・忌日の切り替えタブ ───────── */
.subnav { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 10px; margin: 0 0 20px; }
.subnav a {
  display: flex; flex-direction: column; justify-content: center; min-height: 64px; padding: 8px 14px;
  background: #fff; color: var(--ink); text-decoration: none; line-height: 1.35;
  border: 2px solid var(--line); border-bottom-width: 5px; border-radius: 10px;
}
.subnav a b { font-family: var(--mincho); font-size: 1.1rem; letter-spacing: .04em; }
.subnav a small { font-size: .82rem; }
.subnav a:hover { border-color: var(--moss-700); background: var(--moss-50); color: var(--ink); }
.subnav a[aria-current="page"] { background: var(--moss-100); border-color: var(--moss-900); color: var(--moss-900); }
.subnav a[aria-current="page"] b { color: var(--moss-900); }
.subnav a[aria-current="page"] small { color: var(--moss-700); }

/* 月をえらぶ帯（12個だけのとき） */
.months-12 { grid-template-columns: repeat(12, minmax(0, 1fr)); }

/* 日をえらぶ帯（1〜31） */
.days { display: grid; grid-template-columns: repeat(16, minmax(0, 1fr)); gap: 6px; margin: 16px 0 0; }
.days a {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 48px; padding: 2px;
  border: 2px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink);
  text-decoration: none; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2;
}
.days a small { font-weight: 400; font-size: .76rem; }
.days a:hover { border-color: var(--moss-700); background: var(--moss-50); }
.days a.zero { color: var(--label); font-weight: 400; }
.days a[aria-current="page"] { background: var(--moss-900); color: #fff; border-color: var(--moss-900); }
.days a[aria-current="page"] small { color: #fff; }
.days-all { grid-column: span 4; flex-direction: row !important; gap: 8px; }

/* 絞り込みの並び */
.filters { display: flex; flex-wrap: wrap; align-items: end; gap: 10px 22px; }
.pick-inline { display: grid; gap: 4px; }
.pick-inline > span { color: var(--ink); font-size: .95rem; font-weight: 700; }
.pick-inline select { font: inherit; font-size: 1.05rem; min-height: 50px; padding: 8px 12px; border: 2px solid #8FB08C; border-radius: 8px; background: #fff; color: var(--ink); }

/* カードや表の中に並べる故人 */
.deadlist { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.deadlist > li {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 8px;
  padding: 7px 10px; border: 1px solid var(--line-soft); border-left: 4px solid #6B5B3E; border-radius: 6px; background: var(--moss-50);
}
.deadlist > li.sho { border-left-color: var(--shu); background: var(--shu-100); }
.deadlist > li b { font-family: var(--mincho); font-size: 1.1rem; }
.deadlist > li small { width: 100%; }

/* 忌日表・案内の表 */
.kijitsu-tbl .dayrow td { background: var(--moss-100); border-bottom: 2px solid var(--moss-300); padding: 8px 10px; }
.kijitsu-tbl .dayrow b { font-family: var(--mincho); font-size: 1.15rem; color: var(--moss-900); }
.kijitsu-tbl tbody tr.dayrow:hover td { background: var(--moss-100); }
.annai-tbl td { vertical-align: top; }
.annai-tbl .tel-cell { white-space: nowrap; font-variant-numeric: tabular-nums; }
.printonly-h { display: none; }

/* ───────── 中くらいの画面 ───────── */
@media (max-width: 1100px) {
  .top-in { flex-wrap: wrap; }
  .nav { order: 3; width: 100%; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .dash { grid-template-columns: 1fr; }
  .detail { grid-template-columns: 1fr; }
  .detail-side { position: static; }
  .months { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .months a:first-child { grid-column: 1 / -1; flex-direction: row; gap: 8px; min-height: 52px; }
  .months-12, .months-12 a:first-child { grid-template-columns: repeat(6, minmax(0, 1fr)); grid-column: auto; flex-direction: column; gap: 0; min-height: 64px; }
  .days { grid-template-columns: repeat(8, minmax(0, 1fr)); }
  .days-all { grid-column: 1 / -1; }
  .subnav { grid-auto-flow: row; grid-template-columns: 1fr 1fr; }
}

/* ───────── スマホ ───────── */
@media (max-width: 700px) {
  body { font-size: 17px; padding-bottom: 76px; }   /* 下のタブの分あける */
  .top-in { padding: 8px 14px; gap: 8px; flex-wrap: nowrap; }
  .kappa { width: 42px; height: 42px; }
  .brand-name { font-size: 1.2rem; }
  .brand-temple { font-size: .72rem; }
  .me { gap: 6px; font-size: .85rem; }
  .me-name { max-width: 6em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  /* メニューは画面の下にタブで固定（親指で押しやすい） */
  .nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0;
    background: var(--moss-900); border-top: 3px solid var(--shu); padding: 4px 4px calc(4px + env(safe-area-inset-bottom));
  }
  .nav a { flex-direction: column; gap: 2px; min-height: 60px; padding: 4px 2px; font-size: .78rem; border-radius: 8px; justify-content: center; text-align: center; line-height: 1.2; }
  .nav-ico { width: 24px; height: 24px; }
  .nav-long { display: none; }
  .nav-short { display: inline; }

  .main { padding: 14px 12px 8px; }
  .foot { padding: 12px 14px 24px; }
  .panel { padding: 16px; border-radius: 8px; margin-bottom: 14px; }
  .search-panel { padding: 18px 16px; }
  h1 { font-size: 1.45rem; }
  .who h1 { font-size: 1.6rem; }
  h2 { font-size: 1.2rem; }
  .search { gap: 10px; }
  .search-panel .spread { margin-bottom: 6px; }
  .search-panel .spread .btn-sub { display: none; }   /* スマホでは「よく使う画面」から登録する */
  .search input[type="search"] { flex-basis: 100%; font-size: 1.1rem; min-height: 56px; }
  .search button { flex: 1 1 auto; min-height: 56px; }
  .stats { gap: 10px; margin-bottom: 14px; }
  .stat { padding: 12px 14px; }
  .stat-num { font-size: 1.9rem; }
  .cards, .cards-3, .pick { grid-template-columns: 1fr; gap: 10px; }
  .card { padding: 14px 40px 14px 14px; }
  .pcard { padding-right: 14px; }
  .card-foot .btn-sub { flex: 1 1 auto; }
  .grid2 { grid-template-columns: 1fr; }
  .months { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
  .months a { min-height: 56px; }
  .months-12, .months-12 a:first-child { grid-template-columns: repeat(4, minmax(0, 1fr)); min-height: 56px; }
  .days { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 5px; }
  .days a { min-height: 46px; }
  .days-all { grid-column: 1 / -1; min-height: 50px; }
  .subnav { grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
  .subnav a { min-height: 58px; padding: 6px 10px; }
  .subnav a b { font-size: 1rem; }
  .subnav a small { display: none; }
  .filters { gap: 10px 16px; }
  .pick-inline { width: 100%; }
  /* 忌日表の「日」の見出し行は、スマホでも見出しのまま */
  .tbl .dayrow { border-left-color: var(--kin); padding: 6px 12px; background: var(--moss-100); }
  .tbl .dayrow td { display: block; background: none; }
  .tbl .dayrow td::before { display: none; }
  .yearbar h1 { width: 100%; }
  .yearnav { width: 100%; display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; }
  .yearnav a, .yearnav span.cur { justify-content: center; padding: 4px 8px; }
  /* 詳細の上に「家族へ・故人へ」の飛び先 */
  .jump { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 8px; margin: 0 0 14px; }
  .jump a { display: flex; align-items: center; justify-content: center; min-height: 48px; border: 2px solid var(--moss-700); border-radius: 8px; background: #fff; text-decoration: none; font-weight: 700; }
  .btn-main { width: 100%; }
  .actions .btn-sub, .side-actions .btn-sub { flex: 1 1 auto; }

  /* 表 → カード */
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { border: 1px solid var(--line); border-left: 6px solid var(--moss-700); border-radius: 8px; margin-bottom: 10px; padding: 8px 12px; background: #fff; }
  .tbl tbody tr:hover td { background: none; }
  .tbl td { border: 0; padding: 3px 0; display: grid; grid-template-columns: 6.6em 1fr; gap: 10px; max-width: none; }
  .tbl td::before { content: attr(data-l); color: var(--label); font-size: .88rem; font-weight: 700; }
  .tbl td:empty { display: none; }
  .tbl td > .v { min-width: 0; overflow-wrap: anywhere; }
  .tbl td > .v .code, .annai-tbl .tel-cell { white-space: normal; }   /* 長い屋号・連名も折り返す */
  .tbl td:has(> .v:empty) { display: none; }   /* 中身が無い欄は、見出しごと出さない */
  .tbl.hoyo td { grid-template-columns: 4em 1fr; align-items: center; }
}
@media (max-width: 380px) {
  .me .badge { display: none; }
}
@media print {
  .top, .nav, .foot, .actions, .card-foot, .jump, .search-panel,
  .noprint, .subnav, .months, .days, .filters, .pager { display: none !important; }
  body { background: #fff; font-size: 11pt; padding: 0; }
  .main { padding: 0; max-width: none; }
  .panel { border: 0; padding: 0; margin: 0; }
  .card { border-color: #999; break-inside: avoid; }
  .printonly-h { display: flex; margin-bottom: 10px; }
  .cards, .cards-3 { grid-template-columns: 1fr 1fr; gap: 8px; }
  .deadlist > li { background: none; break-inside: avoid; }
  .deadlist > li.sho { background: none; border-left-width: 6px; }
  .tbl { font-size: 10pt; }
  .tbl tr, .tbl td { break-inside: avoid; }
  .tbl thead { display: table-header-group; }
  .kijitsu-tbl .dayrow td { background: #EEE; }
  .now, .tag { border: 1px solid #999; background: none !important; }
  a { text-decoration: none; color: #000; }
}
