/* CareCheck 独自の画面部品 */
:root {
  --st-todo: #6b7480;
  --st-todo-bg: #f1f3f5;
  --st-done: #1f6b45;
  --st-done-bg: #e5f3ea;
  --st-more: #a3320f;
  --st-more-bg: #fdeee6;
  --st-na: #4b5563;
  --st-na-bg: #eceff3;
}

.tabs-3 { grid-template-columns: 1fr 1fr 1fr; }
.panel-inner { max-width: 760px; margin: 0 auto; padding: 14px 12px; display: flex; flex-direction: column; gap: 14px; }
.panel-inner.wide { max-width: 1440px; }

/* 進み具合（タブの下に固定） */
.progress-strip {
  position: sticky; top: 80px; z-index: 19; background: #fff; border-bottom: 1px solid var(--line);
  padding: 6px 16px 8px;
}
.progress-line { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; }
.progress-label { font-weight: 700; }
.progress-label strong { color: var(--theme-dark); font-size: 1.15rem; }
.progress-counts { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: .84rem; }
.pc-done { color: var(--st-done); font-weight: 700; }
.pc-todo { color: var(--st-todo); font-weight: 700; }
.pc-more { color: var(--st-more); font-weight: 700; }
.pc-na { color: var(--st-na); }
.progress-bar { height: 10px; background: var(--st-todo-bg); border-radius: 6px; overflow: hidden; margin-top: 4px; }
.progress-bar span { display: block; height: 100%; width: 0; background: var(--theme); transition: width .25s; }

/* 種類の選択 */
.kind-choice span { min-height: 62px; font-size: 1.05rem; }

/* ② 確認する */
.draft-banner { margin: 0; }
.filter-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.filter-btn[aria-pressed="true"] { background: var(--theme); color: #fff; }
.filter-row .btn { padding: 4px 6px; }
#filter-note { margin: 0; }

.check-layout { display: block; }
.item-list { display: flex; flex-direction: column; gap: 8px; }
.list-group { font-size: .95rem; margin: 10px 0 2px; padding-left: 8px; border-left: 5px solid var(--theme); }
.list-group:first-child { margin-top: 0; }

.item-row, .detail-pane { scroll-margin-top: 150px; }
.item-row { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); border-left: 6px solid var(--st-todo); }
.item-row[data-status="done"] { border-left-color: var(--st-done); }
.item-row[data-status="more"] { border-left-color: var(--st-more); }
.item-row[data-status="na"] { border-left-color: #a8b0ba; }
.item-row.is-open { border-color: var(--theme); border-left-width: 6px; box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.row-head {
  width: 100%; min-height: 60px; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto 18px; align-items: center; gap: 8px;
  padding: 8px 10px; background: none; border: 0; text-align: left; cursor: pointer; font-weight: 700; border-radius: var(--radius);
}
.row-head:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.row-no {
  display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex: none;
  border-radius: 50%; background: var(--theme-light); color: var(--theme-dark); font-weight: 700; font-size: .92rem;
}
.row-name { overflow-wrap: anywhere; line-height: 1.35; }
.row-chips { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; }
.row-arrow::before { content: "▾"; color: var(--muted); }
.item-row.is-open .row-arrow::before { content: "▴"; }
.row-body:empty { display: none; }
.row-body { padding: 0 12px 14px; }

.chip { display: inline-block; font-size: .76rem; font-weight: 700; padding: 2px 8px; border-radius: 12px; white-space: nowrap; border: 1px solid transparent; }
.chip-todo { background: var(--st-todo-bg); color: var(--st-todo); border-color: #d5dae0; }
.chip-done { background: var(--st-done-bg); color: var(--st-done); }
.chip-more { background: var(--st-more-bg); color: var(--st-more); }
.chip-na { background: var(--st-na-bg); color: var(--st-na); }
.chip-issue { background: #fff; color: var(--st-more); border-color: var(--st-more); }
.focus-mark {
  display: inline-block; margin-left: 6px; font-size: .7rem; padding: 0 6px; border-radius: 4px; vertical-align: 2px;
  background: var(--theme-light); color: var(--theme-dark); border: 1px solid var(--theme-mid); font-weight: 700;
}

/* 詳細 */
.detail { display: flex; flex-direction: column; gap: 12px; }
.detail-head { display: none; align-items: center; gap: 10px; flex-wrap: wrap; }
.detail-no {
  display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%;
  background: var(--theme); color: #fff; font-weight: 700; font-size: 1.1rem;
}
.detail-title { margin: 0; font-size: 1.2rem; flex: 1; min-width: 12em; }
.std-tag { font-size: .74rem; padding: 2px 8px; border: 1px solid var(--line); border-radius: 12px; color: var(--muted); }
.d-sec h4 { margin: 0 0 4px; font-size: .98rem; color: var(--theme-dark); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-hint { margin: 0; font-weight: normal; }
.draft-tag { font-size: .7rem; padding: 1px 7px; border-radius: 4px; background: #fff8e1; border: 1px solid #e8c766; color: #6b5200; font-weight: 700; }
.check-points li, .ask-list li { margin-bottom: 4px; }
.check-points { list-style: "□ "; }
.ask-list { list-style: "💬 "; }
.d-more { border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; background: var(--bg-soft); }
.d-more summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; font-weight: 700; color: var(--theme-dark); }
.d-more[open] { padding-bottom: 8px; }
.official { background: #fff; border-left: 4px solid var(--line); padding: 6px 10px; margin: 4px 0; font-size: .92rem; }
.record-box {
  display: flex; flex-direction: column; gap: 14px; padding: 12px; border-radius: 12px;
  background: var(--theme-light); border: 1px solid var(--theme-mid);
}
.record-box .label { display: block; font-weight: 700; margin-bottom: 6px; color: var(--theme-dark); }

.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.status-btn {
  min-height: 64px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font-weight: 700; font-size: 1.05rem;
  display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; touch-action: manipulation; padding: 6px;
}
.status-icon {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; border-radius: 50%;
  border: 2px solid currentColor; font-size: .9rem; flex: none;
}
.status-todo { color: var(--st-todo); }
.status-done { color: var(--st-done); }
.status-more { color: var(--st-more); }
.status-na { color: var(--st-na); }
.status-btn[aria-pressed="true"] { color: #fff; border-color: transparent; }
.status-todo[aria-pressed="true"] { background: var(--st-todo); }
.status-done[aria-pressed="true"] { background: var(--st-done); }
.status-more[aria-pressed="true"] { background: var(--st-more); }
.status-na[aria-pressed="true"] { background: var(--st-na); }
.status-btn:focus-visible, .issue-btn:focus-visible, .next-item:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.reason-box { margin: 10px 0 0; }

.issue-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.issue-btn {
  min-height: 52px; border: 2px solid var(--line); border-radius: 10px; background: #fff; font-weight: 700; cursor: pointer; padding: 4px 6px;
  touch-action: manipulation; line-height: 1.3;
}
.issue-btn[aria-pressed="true"] { border-color: var(--theme); background: var(--theme-light); color: var(--theme-dark); }
.issue-btn[aria-pressed="true"]::before { content: "✓ "; }

textarea {
  width: 100%; padding: 10px 12px; font-size: 1rem; line-height: 1.6; border: 2px solid var(--line); border-radius: 10px;
  background: #fff; resize: vertical; font-family: inherit; color: inherit;
}
textarea:focus { border-color: var(--theme); outline: none; }
textarea:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.detail-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* ③ まとめ */
.sum-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sum-box { border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; background: #fff; }
.sum-label { font-size: .82rem; color: var(--muted); }
.sum-value { font-size: 1.4rem; }
.sum-all .sum-value { color: var(--theme-dark); }
.sum-done .sum-value { color: var(--st-done); }
.sum-more .sum-value, .sum-issue .sum-value { color: var(--st-more); }
.next-list { list-style: none; padding: 0; margin: 8px 0 0; display: flex; flex-direction: column; gap: 8px; }
.next-item {
  width: 100%; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 8px; align-items: center; text-align: left;
  min-height: 56px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: #fff; cursor: pointer;
}
.next-item:hover { background: var(--theme-light); }
.next-main { display: flex; flex-direction: column; min-width: 0; }
.next-name { font-weight: 700; overflow-wrap: anywhere; }
.next-memo { font-size: .84rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.copy-area { min-height: 240px; font-size: .9rem; }
.toast { width: max-content; text-align: center; }
.app-footer { padding: 6px 16px 18px; }
.nowrap { white-space: nowrap; }
.series-foot { text-align: center; color: var(--muted); font-size: .8rem; letter-spacing: .04em; margin: 0; }

/* PC：左に一覧、右に詳細 */
@media (min-width: 960px) {
  .progress-strip { top: 86px; }
  .check-layout { display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 16px; align-items: start; }
  .item-list { position: sticky; top: 170px; max-height: calc(100vh - 270px); overflow: auto; padding-right: 4px; gap: 6px; }
  .row-head { min-height: 52px; grid-template-columns: 30px minmax(0, 1fr) auto; padding: 6px 8px; font-size: .92rem; }
  .row-no { width: 28px; height: 28px; font-size: .82rem; }
  .row-arrow { display: none; }
  .row-chips { flex-direction: row; flex-wrap: wrap; justify-content: flex-end; }
  .item-row.is-open { background: var(--theme-light); }
  .detail-pane { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 20px; min-height: 300px; }
  .detail-head { display: flex; }
  .status-grid { grid-template-columns: repeat(4, 1fr); }
  .filter-row { max-width: 560px; }
  .sum-grid { grid-template-columns: repeat(6, 1fr); }
}

@media (max-width: 480px) {
  .progress-strip { top: 76px; padding-left: 12px; padding-right: 12px; }
  .progress-counts { font-size: .78rem; }
  .row-name { font-size: .95rem; }
  .issue-btn { font-size: .9rem; }
  .sum-grid { grid-template-columns: repeat(3, 1fr); }
  .tab { font-size: .98rem; }
}

/* スマホでは記録欄の余白を少し詰め、ボタンの文字が2行に割れにくくする */
@media (max-width: 480px) {
  .record-box { padding: 10px 8px; }
  .status-grid, .issue-grid { gap: 6px; }
  .status-btn { font-size: .98rem; gap: 6px; padding: 6px 4px; }
  .status-icon { width: 24px; height: 24px; font-size: .8rem; }
  .issue-btn { padding: 4px 2px; font-size: .86rem; }
}

/* CareTools（アプリ一覧）へのリンク（画面の下部） */
.portal-foot { text-align: center; margin: 2px 0 0; font-size: .85rem; }
.portal-link { display: inline-block; padding: 8px 12px; color: var(--theme-dark); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.portal-link::after { content: " ↗"; }
