@charset "UTF-8";
/* =============================================================================
   眞光寺 業務システム — 配置と大きさ
   -----------------------------------------------------------------------------
   **色と文字サイズは theme.css に分けてあります。**
   見た目を変えたいときは theme.css だけを直してください。
   このファイルには色を直接書かないこと（すべて var(--…) を通す）。

   利用者は高齢者。大きめに、迷わないように（設計メモ §7-0）。
     - 本文 18px 以上
     - 押せるものは最小 44px
     - アイコンだけのボタンを作らない。必ず文字を添える
   ========================================================================== */



* { box-sizing: border-box; }

html { font-size: var(--size-base); }

body {
    margin: 0;
    font-family: var(--font-ui);
    font-size: 1rem;
    line-height: 1.7;
    color: var(--ink);
    background: var(--ground);
}

h1, h2, h3 { line-height: 1.4; margin: 0 0 0.6em; }
h1 { font-size: var(--size-title); }
h2 { font-size: var(--size-large); }

a { color: var(--accent); }
a:focus-visible, button:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
    outline: 3px solid var(--accent);
    outline-offset: 2px;
}

/* --- 全体の骨格 --------------------------------------------------------- */

.site-header {
    background: var(--accent);
    color: var(--accent-ink);
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: var(--gap);
    flex-wrap: wrap;
}
.site-header a { color: var(--accent-ink); }
/* 帯の中のボタンは、地の色に合わせて枠線だけにする。
   そうしないと .site-header a の白文字が白地のボタンに乗って読めなくなる。 */
.site-header .btn {
    color: var(--accent-ink);
    background: transparent;
    border-color: var(--accent-ink);
}
.site-header .btn:hover {
    color: var(--accent);
    background: var(--accent-ink);
}
.site-title {
    font-size: var(--size-large);
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}
.site-header .spacer { flex: 1; }
.site-user { font-size: var(--size-small); }

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 24px 20px 64px;
}

/* 現在位置。どの画面でも常に出す */
.breadcrumb {
    font-size: var(--size-small);
    color: var(--ink-weak);
    margin-bottom: 12px;
}
.breadcrumb a { color: var(--ink-weak); }
.breadcrumb .sep { margin: 0 8px; }

/* --- 押せるもの --------------------------------------------------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: var(--tap);
    min-width: var(--tap);
    padding: 8px 20px;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--ink);
    background: var(--paper);
    border: 2px solid var(--line-strong);
    border-radius: var(--radius);
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--ground); }
.btn-primary {
    color: var(--accent-ink);
    background: var(--accent);
    border-color: var(--accent);
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-danger { color: var(--error); border-color: var(--error); }
.btn-danger:hover { background: var(--error-weak); }
.btn[disabled], .btn[aria-disabled="true"] {
    color: var(--ink-weak);
    background: var(--ground);
    border-color: var(--line);
    cursor: not-allowed;
}
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }

/* --- 知らせ ------------------------------------------------------------- */

.flash {
    padding: 14px 18px;
    margin-bottom: var(--gap);
    border: 2px solid;
    border-radius: var(--radius);
    font-weight: 700;
}
.flash-info  { color: var(--ok);    background: var(--ok-weak);    border-color: var(--ok); }
.flash-warn  { color: var(--warn);  background: var(--warn-weak);  border-color: var(--warn); }
.flash-error { color: var(--error); background: var(--error-weak); border-color: var(--error); }

/* --- カード ------------------------------------------------------------- */

.card {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 24px;
}

/* --- メインメニュー ------------------------------------------------------ */

.menu {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: var(--gap);
    list-style: none;
    padding: 0;
    margin: 0;
}
.menu-item {
    display: block;
    min-height: 108px;
    padding: 18px 20px;
    background: var(--paper);
    border: 2px solid var(--line-strong);
    border-radius: var(--radius);
    text-decoration: none;
    color: var(--ink);
}
.menu-item:hover { background: var(--accent-weak); border-color: var(--accent); }
.menu-item .name { display: block; font-size: var(--size-large); font-weight: 700; }
.menu-item .desc { display: block; font-size: var(--size-small); color: var(--ink-weak); }
.menu-item .count { display: block; font-size: var(--size-small); color: var(--ink-weak); }
.menu-item.is-pending {
    background: var(--ground);
    border-style: dashed;
    border-color: var(--line);
    cursor: not-allowed;
}
.menu-item.is-pending .name { color: var(--ink-weak); }
.badge-pending {
    display: inline-block;
    margin-left: 8px;
    padding: 2px 10px;
    font-size: var(--size-small);
    font-weight: 700;
    color: var(--warn);
    background: var(--warn-weak);
    border: 1px solid var(--warn);
    border-radius: 999px;
    vertical-align: middle;
}

/* --- 入力 --------------------------------------------------------------- */

.field { margin-bottom: 20px; }
.field > label {
    display: block;
    font-weight: 700;
    margin-bottom: 6px;
}
.field .hint { font-size: var(--size-small); color: var(--ink-weak); }

input[type="text"], input[type="password"], input[type="date"],
input[type="number"], select, textarea {
    width: 100%;
    min-height: var(--tap);
    padding: 8px 12px;
    font-family: inherit;
    font-size: 1rem;
    color: var(--ink);
    background: var(--paper);
    border: 2px solid var(--line-strong);
    border-radius: var(--radius);
}
textarea { min-height: calc(var(--tap) * 2); line-height: 1.6; resize: vertical; }
.field.has-error input, .field.has-error textarea, .field.has-error select {
    border-color: var(--error);
}
/* エラーはダイアログではなく、その欄のそばに文字で出す（設計メモ §9-7） */
.field-error {
    margin-top: 6px;
    font-size: var(--size-small);
    font-weight: 700;
    color: var(--error);
}

/* 氏名・法名は帳票と同じ字形で見せる */
.name-field, .name-text { font-family: var(--font-name); }

/* --- ログイン ----------------------------------------------------------- */

.login-wrap {
    max-width: 460px;
    margin: 8vh auto;
    padding: 0 20px;
}
.login-wrap .card { padding: 32px; }
.login-wrap h1 { text-align: center; margin-bottom: 24px; }
.login-wrap .btn { width: 100%; }

/* --- 表 ----------------------------------------------------------------- */

.table-wrap { overflow-x: auto; }
table.list {
    width: 100%;
    border-collapse: collapse;
    background: var(--paper);
    font-size: var(--size-small);
}
table.list th, table.list td {
    padding: 10px 12px;
    border: 1px solid var(--line);
    text-align: left;
    vertical-align: top;
}
table.list thead th {
    background: var(--ground);
    white-space: nowrap;
    position: sticky;
    top: 0;
}
table.list tbody tr:hover { background: var(--accent-weak); }

/* --- 印刷 --------------------------------------------------------------- */

@media print {
    .site-header, .breadcrumb, .btn-row, .no-print { display: none !important; }
    body { background: var(--paper); }
    .container { max-width: none; padding: 0; }
}

/* =============================================================================
   一覧の共通部品（設計メモ §7-1 / §7-3）
   ========================================================================== */

.search { margin-bottom: var(--gap); }

table.search-table thead th { padding: 8px 10px; }
table.search-table .search-inputs th { padding: 6px; background: var(--paper); }
table.search-table .search-inputs input {
    min-height: 40px;
    padding: 4px 8px;
    font-size: var(--size-small);
}

.sort-link {
    color: var(--ink);
    text-decoration: none;
    display: inline-block;
    min-height: 28px;
}
.sort-link:hover { text-decoration: underline; }
.sort-mark { margin-left: 4px; }

.search-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    align-items: center;
    margin-top: 12px;
}
.search-help {
    font-size: var(--size-small);
    color: var(--ink-weak);
}
.search-help code {
    background: var(--ground);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 1px 6px;
    margin-right: 2px;
}

.search-state { margin: 12px 0 0; font-size: var(--size-small); }
.chip {
    display: inline-block;
    margin: 2px 6px 2px 0;
    padding: 4px 12px;
    background: var(--accent-weak);
    border: 1px solid var(--accent);
    border-radius: 999px;
}

/* --- 件数とページ送り ------------------------------------------------------ */

.pager {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: var(--gap) 0;
}
.pager-count { margin: 0; }
.pager-links { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.pager-links .btn { padding: 6px 14px; }
.pager-gap { padding: 0 4px; color: var(--ink-weak); }

/* --- フォーム -------------------------------------------------------------- */

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0 24px;
}
.form-grid .full { grid-column: 1 / -1; }

.required {
    margin-left: 8px;
    padding: 1px 8px;
    font-size: var(--size-small);
    color: var(--accent-ink);
    background: var(--accent);
    border-radius: 4px;
    vertical-align: middle;
}

.form-buttons {
    position: sticky;
    bottom: 0;
    margin-top: var(--gap);
    padding: 12px 0;
    background: var(--ground);
    border-top: 2px solid var(--line);
}
.form-buttons .spacer { flex: 1; }

.record-nav {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: var(--gap);
}
.record-position { font-size: var(--size-small); color: var(--ink-weak); }

/* --- 削除できないときの案内 ------------------------------------------------ */

.blocked { border-color: var(--error); border-width: 2px; }
.blocked h2 { color: var(--error); }
.blocked-list { font-size: var(--size-large); line-height: 2; }

/* =============================================================================
   現在帳（一覧とフォーム）
   ========================================================================== */

.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--gap);
    flex-wrap: wrap;
}
.page-head h1 { margin-bottom: 12px; }
.page-head .code {
    font-family: monospace;
    font-size: var(--size-large);
    color: var(--ink-weak);
    margin-right: 12px;
}

table.list td.empty {
    text-align: center;
    padding: 32px;
    color: var(--ink-weak);
}

/* フォームは左に入力、右に関連する記録 */
.form-layout {
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    gap: var(--gap);
    align-items: start;
}
@media (max-width: 1000px) {
    .form-layout { grid-template-columns: 1fr; }
}

.related { display: flex; flex-direction: column; gap: var(--gap); }
.related .card { padding: 16px 20px; }
.related h2 { font-size: var(--size-base); margin-bottom: 10px; }

.house-name { font-size: var(--size-large); margin: 0 0 8px; }

.portal-count {
    font-size: var(--size-small);
    font-weight: 400;
    color: var(--ink-weak);
    margin-left: 8px;
}
.portal table.list { font-size: var(--size-small); }
.portal table.list th, .portal table.list td { padding: 6px 8px; }

.record-meta {
    margin: 8px 0 0;
    font-size: var(--size-small);
    color: var(--ink-weak);
}

label.checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: var(--tap);
    font-weight: 700;
    cursor: pointer;
}
label.checkbox input[type="checkbox"] {
    width: 24px;
    height: 24px;
    accent-color: var(--accent);
}

/* =============================================================================
   一覧を固定幅にする
   -----------------------------------------------------------------------------
   列を可変にすると、内容によって幅が動いて読みにくい。
   colgroup で幅を決め打ちし、収まらないときは横にすべらせる。
   ========================================================================== */

.container-wide { max-width: 1800px; }

table.list.fixed {
    /* 幅は列幅の合計を style 属性で入れている（listing.py の table_width）。
       max-content や auto では「確定した幅」にならず、table-layout: fixed が
       効かなくなって列幅の指定が無視される。 */
    table-layout: fixed;
    min-width: 100%;
}
table.list.fixed th, table.list.fixed td {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;      /* 電話番号などを折り返さない */
}
/* 検索欄は列幅いっぱいに */
table.list.fixed .search-inputs th { overflow: visible; }

table.list td.code { font-family: monospace; font-size: var(--size-base); }
table.list td.tel  { font-variant-numeric: tabular-nums; }

/* 横にすべらせるとき、見出しと検索行を上に貼り付ける */
.table-wrap { overflow-x: auto; }
/* すべることが分かるようにする。
   横スクロール棒は 100 行の表の下端にあり、画面外で見つけられないため、
   表の左右の端に影を出す。続きがあるときだけ現れ、端まで見ると消える。 */
.table-wrap {
    scrollbar-color: var(--line-strong) var(--ground);
    background:
        linear-gradient(to right, var(--paper) 40%, transparent) left  / 44px 100% no-repeat,
        linear-gradient(to left,  var(--paper) 40%, transparent) right / 44px 100% no-repeat,
        radial-gradient(farthest-side at 0   50%, var(--shade), transparent) left  / 16px 100% no-repeat,
        radial-gradient(farthest-side at 100% 50%, var(--shade), transparent) right / 16px 100% no-repeat;
    background-attachment: local, local, scroll, scroll;
}
.table-wrap::-webkit-scrollbar { height: 14px; }
.table-wrap::-webkit-scrollbar-track { background: var(--ground); }
.table-wrap::-webkit-scrollbar-thumb {
    background: var(--line-strong);
    border-radius: 7px;
}
table.list.fixed thead th { position: sticky; top: 0; z-index: 1; }
table.list.fixed thead tr.search-inputs th { top: 2.9rem; }

/* --- 過去帳 --------------------------------------------------------------- */

.page-head .homyo { margin-left: 16px; color: var(--ink-weak); }

table.list td.num { text-align: right; font-variant-numeric: tabular-nums; }

.big-value { font-size: var(--size-large); margin: 0 0 6px; }
.big-value .code {
    font-family: monospace;
    font-size: var(--size-small);
    color: var(--ink-weak);
    margin-left: 10px;
}

/* 年回表。過ぎた回忌は控えめに */
table.list tr.past td { color: var(--ink-weak); background: var(--ground); }

/* 一覧の見出しの中に置く小さめのボタン */
.btn-small {
    min-height: 32px;
    padding: 2px 12px;
    font-size: var(--size-small);
    font-weight: 400;
    float: right;
}

/* =============================================================================
   年回忌出力
   ========================================================================== */

.period { margin-bottom: var(--gap); }
.mode-tabs { display: flex; gap: 10px; margin-bottom: var(--gap); }

.period-picker {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}
.period-form {
    display: flex;
    gap: 8px;
    align-items: center;
    margin: 0;
}
.period-form label { font-weight: 700; }
.period-form input.year { width: 6em; text-align: right; }
.period-form select { width: 5em; }

.stats {
    display: flex;
    gap: var(--gap);
    flex-wrap: wrap;
    align-items: center;
    margin: var(--gap) 0;
    padding: 16px 20px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 7em;
    padding: 4px 12px;
    border-right: 1px solid var(--line);
}
.stat:last-of-type { border-right: none; }
.stat-value { font-size: var(--size-title); font-weight: 700; line-height: 1.2; }
.stat-label { font-size: var(--size-small); color: var(--ink-weak); }
.stat.is-target .stat-value { color: var(--accent); }
.stat.is-warn .stat-value { color: var(--warn); }
.stat-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-left: auto; }

/* 通知書の対象から外れる行 */
table.list tr.excluded td { background: var(--ground); color: var(--ink-weak); }
table.list td.reason { color: var(--warn); font-size: var(--size-small); }

/* --- 合計行・同名の注意 --------------------------------------------------- */

.total-line {
    margin: var(--gap) 0;
    padding: 12px 20px;
    font-size: var(--size-large);
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.total-amount { color: var(--accent); }
.total-line .hint { font-size: var(--size-small); }

ul.same-name { list-style: none; padding: 0; margin: 0 0 var(--gap); }
ul.same-name li { padding: 6px 0; border-bottom: 1px solid var(--line); }
ul.same-name .code { font-family: monospace; margin-right: 10px; }

/* --- 宛名ラベル ----------------------------------------------------------- */

.label-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: var(--gap);
    align-items: start;
}
@media (max-width: 1000px) { .label-layout { grid-template-columns: 1fr; } }
.label-layout > div { display: flex; flex-direction: column; gap: var(--gap); }

table.list.plain th {
    width: 8em;
    background: var(--ground);
    white-space: nowrap;
}

.label-preview {
    padding: 12px;
    background: var(--ground);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}
.label-preview img {
    display: block;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    background: var(--paper);
    border: 1px solid var(--line-strong);
}

.print-target { margin-top: var(--gap); font-size: var(--size-large); }
.print-target strong { font-family: var(--font-name); }

.print-form { margin-top: 12px; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

.label-layout .hint { font-size: var(--size-small); color: var(--ink-weak); }
.label-layout td .hint { margin-left: 8px; }
