/* incho-todo（一覧）スタイル。
 * ベースは incho-post の styles.css（同じ部品を使う入力画面を移植しているため）。
 * テーマは .theme-list（ティール）= incho-post のピンク（スタッフ版）・ブルー（院長メモ）と
 * 見分けがつく色にしてある。一覧固有の部品（カード・グループ見出し・FAB・シート・トースト）は末尾に追加。
 */
:root {
  --grad-top: #fdf2f8;
  --grad-bottom: #f1ecff;
  --ink: #4c3644;
  --h1: #b23a6b;
  --sub: #8f6c84;
  --label: #8a3f64;
  --req: #e34b78;
  --field-border: #ecc9d9;
  --field-bg: #fffdfe;
  --field-ink: #3a2a34;
  --placeholder: #bd97ac;
  --focus: #f083ab;
  --focus-ring: rgba(240,131,171,.22);
  --btn-g1: #f97fa6;
  --btn-g2: #e85084;
  --btn-shadow: rgba(232,80,132,.30);
  --btn-text-shadow: rgba(122,40,72,.30);
  --btn-disabled: #f0c4d5;
  --sec-ink: #b23a6b;
  --sec-border: #efbdd0;
  --card-border: #ffdbe9;
  --card-shadow: rgba(232,120,165,.16);
  --msg-ok-bg: #fdeef5;
  --msg-ok-ink: #b23a6b;
  --msg-ok-border: #ffcfe2;
  --msg-err-bg: #fff0f1;
  --msg-err-ink: #cf3f5d;
  --msg-err-border: #ffccd5;
  --img-border: #ecc9d9;
  --link-ink: #cf3f5d;
}

/* 一覧アプリのテーマ（ティール）。incho-post のピンク/ブルーと見分けるため */
.theme-list {
  --grad-top: #eefaf7;
  --grad-bottom: #e6f4f6;
  --ink: #24403c;
  --h1: #0f8a7e;
  --sub: #6c8a86;
  --label: #1f6f66;
  --req: #d9534f;
  --field-border: #c7e3de;
  --field-bg: #fdfffe;
  --field-ink: #233835;
  --placeholder: #9dbdb8;
  --focus: #34aa9c;
  --focus-ring: rgba(52,170,156,.22);
  --btn-g1: #34aa9c;
  --btn-g2: #0f8a7e;
  --btn-shadow: rgba(15,138,126,.30);
  --btn-text-shadow: rgba(9,80,73,.30);
  --btn-disabled: #b7dcd6;
  --sec-ink: #0f8a7e;
  --sec-border: #b7dcd6;
  --card-border: #d3ebe6;
  --card-shadow: rgba(60,150,140,.16);
  --msg-ok-bg: #eaf7f4;
  --msg-ok-ink: #12756b;
  --msg-ok-border: #c9e7e1;
  --msg-err-bg: #fdeeee;
  --msg-err-ink: #c94141;
  --msg-err-border: #f6cccc;
  --img-border: #c7e3de;
  --link-ink: #c94141;
}

* { box-sizing: border-box; -webkit-text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  min-height: 100vh;
  padding: 20px 16px 96px;   /* FAB のぶん下に余白 */
  font-family: "Hiragino Maru Gothic ProN", "Hiragino Kaku Gothic ProN",
               -apple-system, BlinkMacSystemFont, "Segoe UI", "Meiryo", sans-serif;
  background: linear-gradient(180deg, var(--grad-top) 0%, var(--grad-bottom) 100%);
  background-attachment: fixed;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 560px; margin: 0 auto; }
h1 { font-size: 20px; margin: 0 0 4px; color: var(--h1); letter-spacing: .02em; }
.sub { font-size: 12px; color: var(--sub); margin: 0 0 16px; }

label {
  display: block; font-size: 13.5px; color: var(--label);
  margin: 16px 0 5px; font-weight: 700;
}
label .req { color: var(--req); font-weight: 700; margin-left: 4px; }

textarea, input[type="text"], input[type="password"], input[type="date"],
input[type="datetime-local"], select {
  width: 100%;
  padding: 13px 14px;
  font-size: 16px;               /* iOSの自動ズーム防止に16px以上 */
  border: 1.5px solid var(--field-border);
  border-radius: 14px;
  background: var(--field-bg);
  color: var(--field-ink);
  font-family: inherit;
  line-height: 1.5;
  transition: border-color .15s ease, box-shadow .15s ease;
}
textarea::placeholder, input::placeholder { color: var(--placeholder); }
textarea:focus, input:focus, select:focus {
  outline: none;
  border-color: var(--focus);
  box-shadow: 0 0 0 3px var(--focus-ring);
  background: #fff;
}
textarea { resize: vertical; }
#raw { min-height: 130px; }
#f_content { min-height: 84px; }

button {
  -webkit-appearance: none; appearance: none;
  width: 100%;
  padding: 15px;
  font-size: 17px;
  font-weight: 700;
  border: none;
  border-radius: 999px;
  color: #fff;
  text-shadow: 0 1px 2px var(--btn-text-shadow);
  background: linear-gradient(135deg, var(--btn-g1) 0%, var(--btn-g2) 100%);
  margin-top: 16px;
  cursor: pointer;
  box-shadow: 0 8px 18px var(--btn-shadow);
  transition: transform .05s ease, box-shadow .15s ease, opacity .15s ease;
}
button:active { transform: translateY(1px); }
button:disabled {
  background: var(--btn-disabled); color: #fff; text-shadow: none;
  box-shadow: none; cursor: default;
}
button.secondary {
  background: #fff; color: var(--sec-ink); text-shadow: none;
  border: 1.5px solid var(--sec-border); box-shadow: none;
  margin-top: 10px;
}

.card {
  background: #fff;
  border: 1.5px solid var(--card-border);
  border-radius: 22px;
  padding: 18px 18px 22px;
  margin-top: 16px;
  box-shadow: 0 10px 28px var(--card-shadow);
}
.hidden { display: none !important; }

.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 3px solid rgba(255,255,255,.55); border-top-color: #fff;
  border-radius: 50%; animation: spin .8s linear infinite;
  vertical-align: -2px; margin-right: 8px;
}
@keyframes spin { to { transform: rotate(360deg); } }

.msg { margin-top: 14px; padding: 12px 14px; border-radius: 14px; font-size: 14px; font-weight: 600; }
.msg.ok  { background: var(--msg-ok-bg); color: var(--msg-ok-ink); border: 1.5px solid var(--msg-ok-border); }
.msg.err { background: var(--msg-err-bg); color: var(--msg-err-ink); border: 1.5px solid var(--msg-err-border); }
.empty { min-height: 0; }

.hint { font-size: 12.5px; color: var(--sub); margin-top: 12px; line-height: 1.55; }

/* 写真: labelをボタン風に（iOSでファイル選択を確実に開くため） */
label.btnlike {
  display: block; width: 100%; text-align: center;
  padding: 15px; font-size: 17px; font-weight: 700;
  border-radius: 999px; cursor: pointer;
  background: #fff; color: var(--sec-ink);
  border: 1.5px solid var(--sec-border);
  margin: 6px 0 0; box-shadow: none;
  -webkit-tap-highlight-color: transparent;
}
label.btnlike:active { transform: translateY(1px); }
.vh {
  position: absolute; width: 1px; height: 1px;
  opacity: 0; overflow: hidden; clip: rect(0 0 0 0);
}
#photoPreview { margin-top: 12px; text-align: center; }
#photoImg {
  max-width: 100%; max-height: 240px; border-radius: 14px;
  border: 1.5px solid var(--img-border); display: block; margin: 0 auto 8px;
}
button.linklike {
  -webkit-appearance: none; appearance: none;
  width: auto; margin: 0 auto; padding: 6px 14px;
  background: none; color: var(--link-ink); text-shadow: none;
  box-shadow: none; border: none; border-radius: 999px;
  font-size: 13.5px; font-weight: 700; cursor: pointer;
}

/* ===== AI振り分けの待ち演出（入力画面。incho-post から移植） ===== */
.ai-progress {
  display: flex; align-items: center; gap: 9px;
  margin: 2px 0 8px; font-size: 14.5px; font-weight: 700; color: var(--h1);
}
.ai-progress .spinner {
  border-color: rgba(0,0,0,.12); border-top-color: var(--h1);
  margin: 0; vertical-align: middle;
}
.ai-busy { font-size: 12.5px; color: var(--sub); margin: 0 0 12px; min-height: 0; }

.frow .skel { display: none; }
.frow.pending .ctl { display: none; }
.frow.pending .skel { display: block; }
.frow.revealing .ctl { animation: fadeIn .22s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

.skel {
  height: 47px; margin-top: 0; border-radius: 14px;
  background: linear-gradient(100deg, #e9e9ee 30%, #f4f4f7 50%, #e9e9ee 70%);
  background-size: 200% 100%;
  animation: shimmer 1.2s ease-in-out infinite;
}
.skel.tall { height: 84px; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.card.streaming .ctl { pointer-events: none; }

/* ===== ここから一覧（ホーム）固有 ===== */

.lhead { display: flex; align-items: center; gap: 10px; }
.lhead h1 { flex: 1; }
.iconbtn {
  width: 40px; height: 40px; min-width: 40px; padding: 0; margin: 0;
  border-radius: 50%; font-size: 19px; line-height: 1;
  box-shadow: 0 4px 12px var(--btn-shadow);
}

/* グループ（超過／今日／それ以外） */
.group { margin-top: 18px; }
.ghead {
  font-size: 14px; font-weight: 700; margin: 0 0 8px; padding: 0 2px;
  display: flex; align-items: center; gap: 8px; color: var(--label);
}
.ghead-overdue { color: #c0392b; }
.ghead-today   { color: #b5730d; }
.ghead-other   { color: var(--label); }
.gcount {
  font-size: 12px; font-weight: 700; color: #fff; background: var(--sub);
  border-radius: 999px; padding: 1px 9px; min-width: 26px; text-align: center;
}
.ghead-overdue .gcount { background: #c0392b; }
.ghead-today   .gcount { background: #b5730d; }

/* タスクカード */
.tcard {
  background: #fff; border: 1.5px solid var(--card-border); border-left-width: 5px;
  border-radius: 16px; padding: 12px 14px; margin-bottom: 10px;
  box-shadow: 0 6px 16px var(--card-shadow);
  transition: opacity .18s ease, transform .18s ease;
}
.tcard.urg-high { border-left-color: #e05555; }
.tcard.urg-mid  { border-left-color: #e2a53c; }
.tcard.urg-low  { border-left-color: #7fb8b0; }
.tcard.busy { opacity: .55; pointer-events: none; }
.tcard.leaving { opacity: 0; transform: translateX(28px); }

.tcontent { font-size: 15.5px; font-weight: 700; color: var(--field-ink); word-break: break-word; }
.tmeta { margin-top: 5px; font-size: 12.5px; color: var(--sub); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.tmeta .od { color: #c0392b; font-weight: 700; }
.tmeta .td { color: #b5730d; font-weight: 700; }

.tchips { margin-top: 9px; display: flex; flex-wrap: wrap; gap: 7px; }
.chip {
  -webkit-appearance: none; appearance: none;
  width: auto; margin: 0; padding: 6px 12px;
  font-size: 12.5px; font-weight: 700; line-height: 1.3;
  border-radius: 999px; cursor: pointer;
  background: #fff; color: var(--sec-ink);
  border: 1.5px solid var(--sec-border);
  box-shadow: none; text-shadow: none;
}
.chip.cat { border-style: dashed; }
.chip.done { background: linear-gradient(135deg, var(--btn-g1) 0%, var(--btn-g2) 100%); color: #fff; border: none; }
.chip.sent { color: #2f6db0; border-color: #cfe0f4; }
.chip.static { cursor: default; color: var(--sub); border-color: var(--card-border); background: #fafafa; }
.chip.photo { text-decoration: none; display: inline-block; }

.empty-note {
  margin-top: 28px; text-align: center; font-size: 14px; color: var(--sub);
}

/* FAB（右下・入力画面へ） */
.fab {
  position: fixed; right: 18px; bottom: 18px; z-index: 30;
  width: 60px; height: 60px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; font-weight: 700; text-decoration: none; color: #fff;
  background: linear-gradient(135deg, var(--btn-g1) 0%, var(--btn-g2) 100%);
  box-shadow: 0 10px 22px var(--btn-shadow);
  -webkit-tap-highlight-color: transparent;
}
.fab:active { transform: translateY(1px); }

/* 操作シート（スヌーズ3択・カテゴリ変更） */
.sheet-back {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(20,40,38,.38);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn .15s ease;
}
.sheet {
  width: 100%; max-width: 560px; background: #fff;
  border-radius: 22px 22px 0 0; padding: 18px 18px 24px;
  max-height: 80vh; overflow-y: auto;
  animation: slideUp .18s ease;
}
@keyframes slideUp { from { transform: translateY(18px); } to { transform: none; } }
.sheet-title { font-size: 15.5px; font-weight: 700; margin: 0 0 2px; color: var(--h1); }
.sheet-sub { font-size: 12.5px; color: var(--sub); margin: 0 0 8px; word-break: break-word; }
.sheet-opt {
  width: 100%; text-align: left; margin-top: 8px; padding: 14px 16px;
  font-size: 15px; font-weight: 700; border-radius: 14px;
  background: #fff; color: var(--field-ink);
  border: 1.5px solid var(--sec-border); box-shadow: none; text-shadow: none;
}
.sheet-opt .osub { display: block; font-size: 12px; font-weight: 600; color: var(--sub); margin-top: 2px; }
.sheet-opt.current { border-color: var(--focus); background: var(--msg-ok-bg); }

/* トースト（アンドゥ・エラー） */
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  z-index: 50; max-width: 92vw;
  display: flex; align-items: center; gap: 12px;
  background: #23423e; color: #fff;
  padding: 12px 14px 12px 18px; border-radius: 999px;
  box-shadow: 0 10px 26px rgba(0,0,0,.28);
  font-size: 14px; font-weight: 600;
  animation: toastIn .18s ease;
}
.toast.err { background: #a93636; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 10px); } to { opacity: 1; transform: translate(-50%, 0); } }
.toast-action {
  width: auto; margin: 0; padding: 7px 14px;
  font-size: 13px; font-weight: 700; border-radius: 999px;
  background: rgba(255,255,255,.18); color: #fff;
  border: 1.5px solid rgba(255,255,255,.55);
  box-shadow: none; text-shadow: none; white-space: nowrap;
}

/* 入力画面ヘッダーの「一覧へ戻る」 */
.backlink {
  display: inline-block; font-size: 13px; font-weight: 700;
  color: var(--sec-ink); text-decoration: none; margin-bottom: 10px;
}

@media (prefers-reduced-motion: reduce) {
  .skel { animation: none; }
  .ai-progress .spinner { animation: none; }
  .frow.revealing .ctl { animation: none; }
  .sheet-back, .sheet, .toast { animation: none; }
  .tcard { transition: none; }
}
