/* maddyポータル（WAS-2056）。使う端末はPCとiPad（10/24刀禰さん指示。ステーションの方はiPadで作業することが多い）。
   幅の狭い表示（iPadの画面分割など）にも崩れないよう、640px以下の並べ方も残す。10/22に確定したモック（事業/訪問看護BPO/確認画面モック/請求までのお願い_モック.html）の
   「お願い」のタブの見た目を引き継ぐ。枠は SmartHR Design System のトークン、一覧は Todoist の今日のビューに倣う */
:root {
  --main: #0077c7; --main-dark: #006bb3; --main-light: #e6f1fa; --link: #0071c1;
  --danger: #e01e5a; --green: #0f7f85;
  --text: #23221e; --text-grey: #66707a; --text-light: #9aa3ab;
  --border: #e6ebf0; --bg: #f3f6f9; --white: #fff;
  --fs-xs: .75rem; --fs-s: .857rem; --fs-m: 1rem; --fs-l: 1.2rem; --fs-xl: 1.5rem;
  --r-s: 4px; --r-m: 6px; --r-l: 8px;
  --layer1: 0 1px 2px 0 rgba(3,3,2,.18);
}
* { box-sizing: border-box; }
/* 時刻の帯の下（ホーム画面から開いたとき）にはページの外側の色が出るので、見出しと同じ青にする。新しいiOSは時刻の帯の設定を見ずに
   この色をぼかして出すため、薄い地の色のままだと上がもやのように見えた（10/29 WAS-2386）。本文は地の色で画面の高さいっぱいに敷く */
html { font-size: 16px; -webkit-text-size-adjust: 100%; background: var(--main); }
body { margin: 0; min-height: 100vh; min-height: 100dvh; background: var(--bg); color: var(--text);
  font-family: system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  font-size: var(--fs-m); line-height: 1.5; }
button, input, textarea { font: inherit; }
/* iPadのSafariで、押した所に残る色の四角を出さない（押したことは開いた形とボタンの色で分かる） */
button, summary { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

.appbar { background: var(--main); color: var(--white); padding-top: env(safe-area-inset-top); }
.appbar .in { max-width: 960px; margin: 0 auto; padding: 0 24px; height: 48px; display: flex; align-items: center; justify-content: space-between; }
.logo { font-weight: 700; font-size: var(--fs-s); }
.logo span { font-weight: 400; opacity: .85; margin-left: 8px; }
.signout { background: none; border: 1px solid rgba(255,255,255,.6); color: var(--white); border-radius: var(--r-s); font-size: var(--fs-xs); padding: 4px 10px; cursor: pointer; }

main { max-width: 960px; margin: 0 auto; padding: 32px 24px 96px; }
h1 { font-size: var(--fs-xl); line-height: 1.25; margin: 0; }
.sub { color: var(--text-grey); font-size: var(--fs-s); margin-top: 4px; }
.panel { background: var(--white); border-radius: var(--r-l); box-shadow: var(--layer1); }

/* ログイン */
.auth { max-width: 460px; }
.auth .panel { padding: 28px 24px; }
.auth h1 { font-size: var(--fs-l); margin-bottom: 4px; }
.lead { color: var(--text-grey); font-size: var(--fs-s); margin: 0 0 20px; line-height: 1.7; }
.auth label { display: block; font-size: var(--fs-s); margin: 14px 0 6px; }
.auth input { width: 100%; font-size: 17px; padding: 12px; border: 1px solid var(--border); border-radius: var(--r-l); }
.auth input.code { letter-spacing: 6px; text-align: center; font-size: 22px; }
.wide { width: 100%; margin-top: 20px; padding: 13px; font-size: var(--fs-m); border: 0; border-radius: var(--r-l); background: var(--main); color: var(--white); cursor: pointer; }
.wide:disabled { opacity: .6; }
.link { background: none; border: 0; color: var(--link); padding: 6px; font-size: var(--fs-s); cursor: pointer; text-decoration: underline; }
.auth .link { display: block; margin: 10px auto 0; }
.error { color: var(--danger); font-size: var(--fs-s); margin: 14px 0 0; line-height: 1.6; min-height: 1em; }
.error.banner { background: #fdeef3; border-radius: var(--r-l); padding: 10px 16px; margin-top: 16px; min-height: 0; }

/* 今のお願いと、締めまでの日程（1つの枠） */
.overview { margin-top: 20px; padding: 18px 24px 20px; }
.ov-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.ov-head .now { font-size: var(--fs-l); font-weight: 700; }
.ov-head .now b { color: var(--main); font-size: var(--fs-xl); margin: 0 2px; }
.ov-head .min { color: var(--text-grey); font-weight: 400; font-size: var(--fs-m); }
.ov-head .min b { color: var(--text); font-size: var(--fs-m); font-weight: 700; }
.refresh { display: flex; align-items: center; gap: 10px; font-size: var(--fs-xs); color: var(--text-grey); }
.btn.small { min-height: 30px; padding: 0 12px; font-size: var(--fs-xs); font-weight: 700; color: var(--main); }

.steps { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.track { position: relative; padding-top: 50px; }
/* 今日の丸の中心を線（top 55〜58px）に合わせる: 丸は13pxなので、マーカーの下端を 63px にする */
/* 線（グレー）は最初の点から最後の点まで。点 i は列 i の真ん中 */
.track::before { content: ""; position: absolute; top: 55px; left: calc(50% / var(--n)); right: calc(50% / var(--n)); height: 3px; border-radius: 2px; background: var(--border); }
.fill { position: absolute; top: 55px; left: calc(50% / var(--n)); height: 3px; border-radius: 2px; background: var(--main); }
/* 塗りは最初の点から今日まで（width は今日の位置から最初の点の分を引く） */
.pin { position: absolute; top: 0; height: 63px; justify-content: flex-end; transform: translateX(-50%); z-index: 2; pointer-events: none; display: flex; flex-direction: column; align-items: center; }
.pin-label { display: flex; flex-direction: column; align-items: center; padding-bottom: 6px; color: var(--main); font-weight: 700; line-height: 1.2; white-space: nowrap; }
.pin-label em { font-style: normal; font-size: var(--fs-xs); }
.pin-label span { font-size: var(--fs-xs); }
.pin::after { content: ""; width: 13px; height: 13px; border-radius: 50%; background: var(--main); box-shadow: 0 0 0 4px var(--main-light); }
.stepper { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(var(--n, 5), 1fr); }
.stepper li { position: relative; padding: 22px 4px 0; text-align: center; }
.stepper .dot { position: absolute; top: -1px; left: 50%; transform: translateX(-50%); width: 13px; height: 13px; border-radius: 50%; background: var(--white); border: 2px solid var(--text-light); z-index: 1; }
.stepper li.done .dot { background: var(--main); border-color: var(--main); }
.stepper li.next .dot { border-color: var(--main); border-width: 3px; }
.stepper li b { display: block; font-size: var(--fs-s); color: var(--text); white-space: nowrap; }
.stepper li.done b, .stepper li.done .lbl { color: var(--text-light); }
.stepper li.next b { color: var(--main); }
.stepper .lbl { display: block; font-size: var(--fs-xs); color: var(--text-grey); line-height: 1.4; }

.reload { display: inline-flex; align-items: center; gap: 6px; }
.reload.busy::before { content: ""; width: 12px; height: 12px; border: 2px solid var(--main-light); border-top-color: var(--main); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* 起動中の表示（ログインか一覧を出したら消す） */
.booting { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 96px 24px; color: var(--text-grey); font-size: var(--fs-s); }
.booting .spinner { width: 18px; height: 18px; border: 2px solid var(--main-light); border-top-color: var(--main); border-radius: 50%; animation: spin .8s linear infinite; }

/* お願いの一覧（Todoist風） */
.todo { margin-top: 16px; padding: 8px 24px 16px; }
.todo:empty { display: none; }
.sec { padding: 16px 0 8px; border-bottom: 1px solid var(--border); }
.sec .h { display: flex; align-items: baseline; gap: 8px; }
.sec h2 { font-size: var(--fs-m); margin: 0; }
.sec .why { font-size: var(--fs-xs); color: var(--text-grey); margin-top: 2px; }

.task { border-bottom: 1px solid var(--border); margin: 0 -12px; padding: 0 12px; border-radius: var(--r-m); }
.row { display: flex; gap: 12px; padding: 12px 0; cursor: pointer; align-items: flex-start; width: 100%; background: none; border: 0; text-align: left; color: inherit; }
.check { flex: none; width: 20px; height: 20px; margin-top: 2px; border-radius: 50%; border: 2px solid var(--text-light);
  background: var(--white); display: grid; place-items: center; color: var(--text-light); }
.check::after { content: ""; width: 5px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-1px, -1px); opacity: 0; }
.task.open { background: transparent; box-shadow: inset 3px 0 0 var(--main); }
.chev { flex: none; width: 9px; height: 9px; margin: 8px 6px 0 0; border-right: 2px solid var(--text-light); border-bottom: 2px solid var(--text-light); transform: rotate(45deg); transition: transform .15s; }
.task.open .chev { transform: rotate(-135deg); margin-top: 12px; border-color: var(--main); }
.task.done .check { border-color: var(--text-light); background: var(--text-light); color: var(--white); }
.task.done .check::after { opacity: 1; }
.body { flex: 1; min-width: 0; }
.title { overflow-wrap: anywhere; }
.task.unread .title::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--main); margin-right: 8px; vertical-align: middle; }
.meta { display: flex; gap: 6px 8px; align-items: center; font-size: var(--fs-xs); color: var(--text-grey); margin-top: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 4px; min-height: 24px; padding: 0 8px 0 6px; border-radius: 10000px;
  font-size: var(--fs-s); font-weight: 700; white-space: nowrap; }
.chip svg { width: 14px; height: 14px; fill: currentColor; }
.chip small { font-size: var(--fs-xs); font-weight: 400; margin-left: 2px; opacity: .8; }
.chip.who { background: #eef1f4; color: var(--text); }
.chip.to { background: #fff1de; color: #8a4b00; }
.chip.ibow { background: #f1ecfa; color: #5b3e96; }
.chip.reply { background: #e5f4f4; color: var(--green); }
.chip.plus { background: #eaf6ec; color: #1e7b34; }
.status { display: inline-flex; align-items: center; min-height: 22px; font-size: var(--fs-xs); font-weight: 700; color: var(--main); background: var(--main-light); border-radius: 10000px; padding: 0 10px; }
.status.green { color: var(--green); background: #e5f4f4; }
.status.grey { color: var(--text-grey); background: #eef1f4; }
.preview { font-size: var(--fs-s); color: var(--text-grey); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task.open .preview { display: none; }

.detail { display: none; padding: 0 0 16px; font-size: var(--fs-s); }
.task.open .detail { display: block; }
.detail .whyp { margin: 0 0 6px; color: var(--text-grey); }
.detail .duep { margin: 0 0 12px; color: var(--text-grey); font-size: var(--fs-xs); }
.choices { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.btn { min-height: 36px; padding: 0 14px; border-radius: var(--r-s); border: 1px solid var(--border); background: var(--white);
  color: var(--text); font-size: var(--fs-s); font-weight: 700; cursor: pointer; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--main); border-color: var(--main); color: var(--white); }
.btn.ghost { border-color: transparent; color: var(--link); font-weight: 400; background: none; }
.choices input { min-height: 36px; border: 1px solid var(--border); border-radius: var(--r-s); padding: 0 8px; font-size: var(--fs-s); background: var(--white); }
.choices .pair { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.item-error { color: var(--danger); font-size: var(--fs-xs); margin-top: 8px; }

/* やり取り */
.thread { margin: 0 0 12px; }
.older summary { color: var(--link); cursor: pointer; font-size: var(--fs-xs); margin-bottom: 8px; }
.msg { margin: 0 0 10px; }
.msg .from { font-size: var(--fs-xs); font-weight: 700; color: var(--text-grey); }
.msg .from.us { color: var(--main); }
.msg .text { color: var(--text-grey); white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.current .text { color: var(--text); background: var(--main-light); border-radius: 2px 12px 12px 12px; padding: 10px 14px; margin-top: 4px; text-wrap: pretty; line-break: strict; }
.comment { margin-top: 6px; font-size: var(--fs-xs); }
.btn.consult-open { padding: 0; min-height: 32px; font-size: var(--fs-s); font-weight: 400; color: var(--link); background: none; border-color: transparent; }
@media (pointer: coarse) { .btn.consult-open { padding: 0; min-height: 44px; } }
.comment .box { display: grid; gap: 6px; margin-top: 6px; }
.comment textarea { width: 100%; min-height: 72px; border: 1px solid var(--border); border-radius: var(--r-s); padding: 8px; font-size: var(--fs-s); resize: vertical; background: var(--white); }
.comment .note { color: var(--text-grey); }
.comment .box .btn { justify-self: start; }

/* 自分の答え */
.myanswer { margin-bottom: 12px; padding: 10px 12px; background: var(--white); border: 1px solid var(--border); border-radius: var(--r-m); }
.myanswer .lbl { font-size: var(--fs-xs); color: var(--text-grey); font-weight: 700; }
.myanswer .val { color: var(--text); margin: 2px 0 4px; overflow-wrap: anywhere; }
.myanswer .acts { display: flex; gap: 12px; align-items: center; }

.replies { margin-top: 16px; padding: 4px 24px 8px; box-shadow: inset 4px 0 0 var(--main), var(--layer1); }
.replies .sec { border-bottom-color: #cfe2f2; }
.replies .sec h2 { color: var(--main); }
.replies .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--main); align-self: center; }
.replies .task { border-bottom: none; }
.replies .task.open { background: transparent; box-shadow: none; }

.badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10000px;
  background: var(--main); color: var(--white); font-size: var(--fs-xs); font-weight: 700; line-height: 1; align-self: center; }
.badge.grey { background: var(--border); color: var(--text-grey); }

.empty { margin-top: 16px; padding: 16px 24px; color: var(--text-grey); font-size: var(--fs-s); }
.empty p { margin: 0; }
.donelist { margin-top: 16px; padding: 12px 24px; }
.donelist summary { cursor: pointer; font-weight: 700; font-size: var(--fs-s); color: var(--text-grey); }
.donelist .done-items { margin-top: 4px; }
.donelist .task:last-child { border-bottom: none; }
.donelist .task .title { color: var(--text-grey); }
footer { margin-top: 24px; font-size: var(--fs-s); color: var(--text-grey); }

/* マウスのある画面（PC）だけ、乗せたときに色を変える。iPadでは押した後に色が残るので付けない */
@media (hover: hover) {
  .task:not(.done) .row:hover .title { color: var(--main); }
  .btn:hover { background: var(--bg); }
  .btn.primary:hover { background: var(--main-dark); }
}

/* 指で押す画面（iPad）。押す所を44px以上にし、入力欄の文字を16pxにする（16pxより小さいと、入力のときにSafariが画面を拡大する） */
@media (pointer: coarse) {
  .btn { min-height: 44px; padding: 0 18px; font-size: var(--fs-m); }
  .choices input { min-height: 44px; font-size: 16px; }
  .comment textarea { font-size: 16px; }
  .link { min-height: 44px; font-size: var(--fs-m); }
  .signout { min-height: 40px; padding: 6px 16px; font-size: var(--fs-s); }
  .btn.small { min-height: 44px; padding: 0 16px; font-size: var(--fs-s); }
  .row { padding: 14px 0; }
  .older summary { padding: 10px 0; font-size: var(--fs-s); }
  .toast { font-size: var(--fs-m); }
}

/* 答えた直後の通知（取り消せるときは「取り消す」） */
.toast { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 10;
  background: var(--text); color: var(--white); border-radius: var(--r-l); padding: 10px 16px; font-size: var(--fs-s);
  display: flex; gap: 12px; align-items: center; max-width: calc(100% - 32px); box-shadow: 0 4px 12px rgba(0,0,0,.2); }
.toast .link { color: #8cc8ff; padding: 0; white-space: nowrap; }

@media (max-width: 640px) {
  main { padding: 20px 16px 96px; }
  .appbar .in { padding: 0 16px; }
  .overview, .todo, .replies, .donelist, .empty { padding-left: 16px; padding-right: 16px; }
  .detail { padding-left: 0; }
  .track { padding-top: 0; }
  .track::before, .fill, .pin { display: none; }
  .stepper { grid-template-columns: 1fr; gap: 10px; }
  .stepper li { padding: 0 0 0 22px; text-align: left; }
  .stepper .dot { top: 3px; left: 0; transform: none; }
    .stepper li b { display: inline; margin-right: 8px; }
  .stepper .lbl { display: inline; }
  .ov-head .now { font-size: var(--fs-m); }
  .ov-head .now b { font-size: var(--fs-l); }
}
