/* 家賃の入金チェック v2。日本の業務ソフト風・きっちり。色はピタットハウスのホームページの黄緑（2026-10-11に取得）
   色はここ（:root）だけで決める。ほかに上書きする仕組みを置かない */
:root {
  --g: #6EB92B;      /* ピタットハウスの黄緑（帯・選択中のタブ・アクセント） */
  --g-d: #3F7A12;    /* 濃い緑（主ボタン・見出しの文字。白文字が読める濃さ） */
  --g-l: #EBF2DF;    /* うすい黄緑（表の見出し・帯） */
  --g-ll: #F6F9F1;
  --bg: #F5F6F3;     /* 画面の地 */
  --red: #C62828; --red-bg: #FDE4E2;
  --red2: #A61B1B; --red2-bg: #F7C6C1;   /* 2か月続けて未入金 */
  --yel: #8A6200; --yel-bg: #FFF4C2;
  --line: #D6DCCF; --txt: #292929; --sub: #5B6157;
  --r: 4px;
}
* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0; background: var(--bg); color: var(--txt); font-variant-numeric: tabular-nums;
  font-family: "Meiryo UI", Meiryo, "Yu Gothic UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
  line-height: 1.6;
}
[hidden] { display: none !important; }
h1 { font-size: 1.15rem; margin: 0; font-weight: 700; }
h2 { font-size: 1.1rem; margin: 0 0 12px; color: var(--g-d); }
h3 { font-size: 1rem; margin: 18px 0 8px; }
.hint { color: var(--sub); font-size: .88rem; }
a { color: var(--g-d); }
.red { color: var(--red); }
.num { display: inline-block; min-width: 1.6em; text-align: center; background: var(--g); color: #fff; border-radius: 99px; margin-right: 8px; font-size: .9rem; }

header {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  background: #fff; color: var(--txt); padding: 8px 20px; border-top: 4px solid var(--g); border-bottom: 1px solid var(--line); height: 56px;
}
header .logo { display: flex; align-items: center; gap: 10px; }
header .mk { width: 30px; height: 30px; border-radius: var(--r); background: var(--g); color: #fff; display: grid; place-items: center; font-weight: 800; }
header .sp { flex: 1; }
header .pill { background: var(--g-l); color: var(--g-d); border-radius: var(--r); padding: 2px 10px; font-size: .9rem; }
header .x { font-size: .9rem; white-space: nowrap; }
.badge { background: var(--yel-bg); color: var(--yel); border: 1px solid #e8d48a; border-radius: var(--r); padding: 0 8px; font-size: .8rem; }

nav#nav { display: flex; gap: 0; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 56px; z-index: 19; overflow-x: auto; }
nav#nav button {
  border: 0; border-bottom: 3px solid transparent; background: transparent; padding: 11px 16px 9px; font-size: .98rem; color: var(--sub); border-radius: 0; white-space: nowrap; cursor: pointer; min-height: 0;
}
nav#nav button b { display: inline-block; width: 1.45em; height: 1.45em; line-height: 1.45em; border-radius: var(--r); background: var(--g-l); color: var(--g-d); margin-right: 6px; font-size: .82rem; text-align: center; }
nav#nav button.on { color: var(--g-d); font-weight: 700; border-bottom-color: var(--g); background: transparent; }
nav#nav button.on b { background: var(--g); color: #fff; }
nav#nav button:hover:not(.on) { background: var(--g-ll); }

main { max-width: 1280px; margin: 0 auto; padding: 18px 20px 60px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: var(--r); padding: 18px 20px; margin-bottom: 16px; animation: fin .3s ease-out; }
@keyframes fin { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .card { animation: none; } }

label { display: block; font-size: .88rem; color: var(--sub); margin: 8px 0 3px; }
input, select, textarea {
  font: inherit; font-size: 1rem; padding: 7px 10px; border: 1px solid #b9c2ae; border-radius: var(--r); background: #fff; color: var(--txt); min-height: 40px;
}
input:focus, select:focus { outline: 2px solid var(--g); outline-offset: 0; border-color: var(--g); }
input[type=checkbox] { min-height: 0; width: 18px; height: 18px; vertical-align: -3px; accent-color: var(--g-d); }
button {
  font: inherit; font-size: .95rem; padding: 7px 16px; border-radius: var(--r); border: 1px solid #b9c2ae; background: #fff; color: var(--txt); cursor: pointer; min-height: 38px;
}
button:hover { background: var(--g-ll); }
button.p { background: var(--g-d); border-color: var(--g-d); color: #fff; font-weight: 700; }
button.p:hover { background: #336410; }
button.p:disabled { background: #a9b8a0; border-color: #a9b8a0; cursor: default; }
button.s { font-size: .88rem; padding: 4px 10px; min-height: 32px; }
button.danger { color: var(--red); border-color: #e5a9a4; }
button.wide { width: 100%; margin-top: 14px; }
.row { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: flex-end; }
.row > div { min-width: 0; }
.bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.msg { color: var(--red); margin-top: 10px; min-height: 1.4em; }
.msg.okmsg { color: var(--g-d); }
.clog textarea { width: 100%; }

/* 表 */
.wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; background: #fff; }
th, td { border-bottom: 1px solid #e6ece0; padding: 8px 10px; text-align: left; vertical-align: middle; }
th { background: var(--g-l); color: var(--g-d); font-weight: 700; white-space: nowrap; position: sticky; top: 0; border-bottom: 2px solid var(--g); }
td.n, th.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
td.nw { white-space: nowrap; }
tr.ng td { background: var(--red-bg); }
tr.warn td { background: var(--yel-bg); }
tr.ng2 td { background: var(--red2-bg); }
tr.ng2 td:first-child { box-shadow: inset 5px 0 0 var(--red2); }
.tag.streak { background: var(--red2); color: #fff; font-weight: 700; display: block; width: max-content; margin-bottom: 2px; }
/* 電話：スマホは押すと発信。パソコンでは番号を大きく出す */
a.tel { color: var(--g-d); font-weight: 700; font-size: 1.12rem; letter-spacing: .02em; text-decoration: none; border-bottom: 1px dashed var(--g); white-space: nowrap; }
a.tel.big { font-size: 1.6rem; }
td .last { display: block; font-size: .85rem; line-height: 1.4; max-width: 240px; margin-bottom: 4px; }
td .last b { display: block; font-weight: 700; color: var(--sub); font-size: .78rem; }
/* 0件・読み込み中・エラー */
.emptybox { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 28px 12px; text-align: center; color: var(--sub); }
.emptybox b { color: var(--txt); }
.okbox { border: 1px solid #b7d79a; background: var(--g-l); color: var(--g-d); border-radius: var(--r); padding: 10px 14px; margin: 6px 0 10px; }
.errbox { border: 1px solid #e5a9a4; background: var(--red-bg); color: var(--red); border-radius: var(--r); padding: 10px 14px; margin: 6px 0; }
tr.sk td span, .skl { display: block; height: 22px; border-radius: var(--r); background: #e9ece5; animation: blink 1.2s ease-in-out infinite; }
.skl { height: 40px; margin: 6px 0; }
@keyframes blink { 50% { opacity: .45; } }
tr.off td { color: #999; }
tr.ask td { background: #fff8e8; }
.st { font-weight: 700; white-space: nowrap; }
.st.ok { color: var(--g-d); }
.st.ng { color: var(--red); }
.st.warn { color: var(--yel); }
.why { display: block; font-size: .82rem; color: var(--sub); font-weight: 400; }
tr.ng .why { color: var(--red); }
.tag { display: inline-block; border-radius: 6px; padding: 0 8px; font-size: .82rem; background: #eee; white-space: nowrap; }
.tag.tainou { background: var(--red); color: #fff; }
.tag.auto { background: var(--g-l); color: var(--g-d); }
.tag.ask { background: var(--yel-bg); color: var(--yel); }

/* 入金の状況：合計 */
.counts { display: flex; gap: 10px; flex-wrap: wrap; margin: 4px 0 12px; }
.counts span { border-radius: var(--r); padding: 6px 14px; font-weight: 700; }
.counts small { font-weight: 700; color: var(--red2); margin-left: 4px; }
.counts .all { background: #fff; border: 1px solid var(--line); color: var(--sub); font-weight: 400; }
.counts .all b { color: var(--txt); }
.counts .hogo { flex-basis: 100%; }
div.hogo { flex-basis: 100%; border: 1px solid var(--line); border-radius: var(--r); padding: 8px 14px; background: #fff; font-variant-numeric: tabular-nums; }
div.hogo.ok { border-color: #b7d79a; background: var(--g-ll); }
div.hogo.ok > b:last-of-type { color: var(--g-d); }
div.hogo.warn { border-color: #e8d48a; background: var(--yel-bg); }
div.hogo.warn > b:last-of-type { color: var(--yel); }
.counts .ok { background: var(--g-l); color: var(--g-d); }
.counts .ng { background: var(--red-bg); color: var(--red); }
.counts .warn { background: var(--yel-bg); color: var(--yel); }

/* 資料の読み込み */
.kinds { display: flex; flex-wrap: wrap; gap: 6px; }
.kinds button.on { background: var(--g-d); color: #fff; border-color: var(--g-d); font-weight: 700; }
.drop { display: block; border: 2px dashed var(--g); border-radius: var(--r); padding: 22px; text-align: center; background: var(--g-ll); cursor: pointer; color: var(--g-d); }
.drop.over { background: var(--g-l); }
.drop b { display: block; font-size: 1.05rem; }

.login { position: fixed; inset: 0; background: var(--g-l); display: grid; place-items: center; z-index: 50; padding: 16px; }
.login .card { width: 100%; max-width: 380px; }
.login input, .login select { width: 100%; }

.dlg { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 55; display: grid; place-items: center; padding: 16px; }
.dlg .panel { background: #fff; border-radius: var(--r); width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto; padding: 18px 20px; }
.dlg .ph { display: flex; align-items: center; justify-content: space-between; border-bottom: 2px solid var(--g); margin-bottom: 10px; }
.dlg .ph h2 { margin: 0 0 6px; }
.dlg .who2 { margin: 4px 0; }
.dlg textarea { width: 100%; }
.batches { list-style: none; padding: 0; margin: 6px 0 0; }
.batches li { padding: 4px 0; border-bottom: 1px dashed var(--line); }
.batches li.off { color: #999; }
.clog { list-style: none; padding: 0; margin: 0; }
.clog li { border-left: 3px solid var(--g); padding: 4px 10px; margin-bottom: 8px; background: var(--g-ll); }
.clog p { margin: 2px 0 0; white-space: pre-wrap; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: #2b3a1e; color: #fff; padding: 10px 20px; border-radius: 10px; z-index: 60; max-width: 90vw; }
.toast.err { background: var(--red); }
.busy { position: fixed; inset: 0; background: rgba(255,255,255,.7); display: grid; place-items: center; z-index: 70; font-weight: 700; color: var(--g-d); }

@media (max-width: 700px) {
  header { padding: 8px 12px; height: 52px; } main { padding: 12px; }
  header .pill { display: none; }
  header h1 { font-size: .98rem; white-space: nowrap; }
  header .mk { width: 26px; height: 26px; }
  header .badge, header .x { white-space: nowrap; }
  header .x { padding: 4px 10px; min-height: 32px; font-size: .85rem; }
  nav#nav { top: 52px; padding: 0 4px; }
  nav#nav button { padding: 10px 10px 8px; font-size: .9rem; }
  .card { padding: 14px; }
  /* 表をカードの縦並びに（列名を左に小さく） */
  table.cards thead { display: none; }
  table.cards, table.cards tbody, table.cards tr, table.cards td { display: block; width: 100%; }
  table.cards tr { border-bottom: 2px solid var(--line); padding: 6px 0; }
  table.cards td { border: 0; padding: 3px 12px 3px 7.6rem; position: relative; min-height: 1.9em; overflow-wrap: anywhere; }
  table.cards td[data-l]::before { content: attr(data-l); position: absolute; left: 12px; top: 5px; width: 6.4rem; color: var(--sub); font-size: .8rem; font-weight: 400; }
  table.cards td:not([data-l]) { padding-left: 12px; }
  table.cards .st { white-space: normal; }
  table.cards td.n { text-align: left; }
  table.cards td.mhide { display: none; }
  table.cards td.who { font-weight: 700; font-size: 1.05rem; }
  .wrap { border: 0; }
  a.tel { font-size: 1.25rem; }
}
@media print {
  header, nav#nav, .noprint { display: none !important; }
  .card { border: 0; padding: 0; }
  tr.ng td { background: #fde4e2 !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}

/* v2：一覧の列幅（物件名が縦に細く折れないように） */
table.cards td[data-l="物件"] { min-width: 10em; }
table.cards td[data-l="連絡の記録"] { min-width: 15em; }
td button.s { white-space: nowrap; }
@media (max-width: 700px) {
  table.cards td[data-l="物件"], table.cards td[data-l="連絡の記録"] { min-width: 0; }
  td .last { max-width: none; }
}
