/* ファミオスの見た目。
 *
 * 対象は 40〜60代を含む家族全員。決まり（docs/PRODUCT.md）:
 *  - 本文 18px 以上、押すものは 52px 以上、1画面1目的
 *  - 温かい紙色 + 深緑。病院・管理画面・警告の見た目にしない
 *  - 赤は「本当に取り返しがつかない操作」だけ
 */
:root {
  --paper:   #faf6ee;   /* 背景。白より一段温かい紙色 */
  --ink:     #33302a;   /* 文字。真っ黒より柔らかい */
  --muted:   #7a7466;
  --green:   #3a7d5c;   /* 主役。お茶の深緑 */
  --green-d: #2d6248;
  --cream:   #ffffff;
  --line:    #e5ddcd;
  --accent:  #e8833a;   /* 温かい橙。強調はこれ1色 */
  --danger:  #c0392b;   /* 取り返しがつかない操作だけ */
  --radius:  14px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 18px/1.75 -apple-system, "Hiragino Sans", "Noto Sans JP", sans-serif;
}
.wrap { max-width: 720px; margin: 0 auto; padding: 0 16px; }

/* --- 上の帯 --- */
.topbar { background: var(--green); color: #fff; }
.topbar .wrap { display: flex; align-items: center; gap: 12px; min-height: 58px; }
.logo { color: #fff; text-decoration: none; font-size: 20px; }
.ws-name { font-size: 15px; opacity: .9; overflow: hidden; text-overflow: ellipsis;
           white-space: nowrap; max-width: 40%; }
.account { margin-left: auto; }
.top-link { color: #fff; text-decoration: none; font-size: 16px; padding: 8px; }

.page { padding: 18px 16px 60px; }
.back { display: inline-block; margin: 0 0 10px; color: var(--green-d);
        text-decoration: none; font-size: 16px; padding: 8px 8px 8px 0; }

/* --- カード --- */
.card { background: var(--cream); border: 1px solid var(--line);
        border-radius: var(--radius); padding: 20px; margin: 0 0 16px; }
.card-title { margin: 0 0 12px; font-size: 20px; }
.card p { margin: 0 0 12px; }
.muted { color: var(--muted); }
.small { font-size: 15px; }

/* --- ボタン。指で押すものは全部 52px 以上 --- */
.btn {
  display: inline-block; min-height: 52px; padding: 12px 22px;
  border-radius: var(--radius); border: 1.5px solid var(--green);
  background: var(--cream); color: var(--green-d);
  font-size: 18px; font-weight: 600; line-height: 1.5;
  text-decoration: none; text-align: center; cursor: pointer;
}
.btn.primary { background: var(--green); color: #fff; }
.btn.big { display: block; width: 100%; font-size: 19px; }
.btn.quiet { border-color: var(--line); color: var(--muted); }
/* 赤は取り返しのつかない操作だけ（＝消す）。枠だけにして、画面の主役にしない */
.btn.danger { border-color: var(--danger); color: var(--danger); }
.btn + .btn { margin-left: 8px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.actions .btn { flex: 1; margin-left: 0; }

/* --- 入力。ラベルは上、欄は大きく --- */
.field { display: block; margin: 0 0 16px; }
.field-label { display: block; font-size: 16px; font-weight: 600; margin-bottom: 6px; }
.field .req { color: var(--accent); font-size: 13px; font-weight: 600; margin-left: 6px; }
.field input, .field textarea, .field select {
  width: 100%; min-height: 52px; padding: 12px 14px;
  border: 1.5px solid var(--line); border-radius: 12px;
  background: #fff; color: var(--ink); font: inherit;
}
.field textarea { min-height: 96px; }
/* Safari は select の min-height を無視する（実測 27px。指では押しにくい）。
 * 見た目をこちらで作り直して、決めた 52px を取り戻す。
 * 矢印は data URI の SVG。画像ファイルを1つも増やさないため。 */
.field select {
  -webkit-appearance: none; appearance: none;
  height: 52px; padding-right: 46px;
  background-image: url("data:image/svg+xml,<svg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%2014%209'><path%20d='M1%201.5L7%207.5L13%201.5'%20fill='none'%20stroke='%237a7466'%20stroke-width='2'%20stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 16px center;
  background-size: 14px 9px;
}
/* ファイル選択も指で押す。Safari の既定は文字だけで当たりが小さい */
.field input[type="file"] { padding: 12px 14px; line-height: 28px; }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: 3px solid rgba(58, 125, 92, .35); border-color: var(--green);
}
.hint { display: block; font-size: 14px; color: var(--muted); margin-top: 4px; }

/* --- お知らせ。不安を煽らない --- */
.flash { border-radius: 12px; padding: 12px 16px; margin: 0 0 14px; font-size: 16px; }
.flash.ok    { background: #e8f2e9; color: #2d6248; }
.flash.error { background: #fbeee9; color: #8f4a2e; }

/* --- 一覧の行。行ごと押せる --- */
.rows { margin: 0; padding: 0; list-style: none; }
.rows li { border-top: 1px solid var(--line); }
.rows li:first-child { border-top: 0; }
.row-link { display: flex; align-items: center; gap: 12px;
            min-height: 60px; padding: 10px 4px;
            color: inherit; text-decoration: none; }
.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 600; }
.row-sub { font-size: 14px; color: var(--muted); }
.row-side { font-size: 14px; color: var(--muted); white-space: nowrap; }

/* --- タスクの札 --- */
.tag { display: inline-block; font-size: 13px; padding: 2px 10px;
       border-radius: 999px; background: #eee7d8; color: #6b6353; }
.tag.doing { background: #fdeed9; color: #9a5b1e; }
.tag.done  { background: #e8f2e9; color: #2d6248; }
.tag.high  { background: #fdeed9; color: #9a5b1e; }

/* --- ダッシュボードの大きな入口 --- */
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { display: block; background: var(--cream); border: 1px solid var(--line);
        border-radius: var(--radius); padding: 18px 16px; min-height: 92px;
        text-decoration: none; color: inherit; }
.tile b { display: block; font-size: 18px; color: var(--green-d); }
.tile span { font-size: 14px; color: var(--muted); }

/* --- カレンダー（Phase 7） ---
 * 月表示は**狭い画面で最初に壊れる**（7列を 390px に並べる）。だから升の幅は
 * grid の 1fr に任せ、px で決め打ちしない。文字も入れない（読めないから）。
 *
 * 印は 予定＝緑の丸 / たすことの期限＝橙の四角。**色と形の両方で変える**
 * （色の見分けがつきにくい人がいる。色だけに頼らない）。
 * **赤は使わない。** 赤は取り返しのつかない操作だけ（docs/PRODUCT.md §7）。 */
.card.cal { padding: 16px 10px; }
/* 狭い画面では、カードを紙の端まで広げて升の幅を稼ぐ（46px → 50px）。
 * ページの左右余白 16px のうち 10px を借りるだけなので、横にはみ出さない。 */
@media (max-width: 420px) {
  .card.cal { margin-left: -10px; margin-right: -10px; padding: 16px 8px; }
}

.cal-nav { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; }
.cal-nav .btn { flex: 0 0 auto; min-width: 74px; padding: 12px 8px; font-size: 16px; }
.cal-title { flex: 1; text-align: center; font-size: 19px; }

.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-h { text-align: center; font-size: 14px; font-weight: 600; padding: 2px 0 6px; }
.cal-h.wknd { color: var(--muted); }

/* 升そのものが押すもの。高さ 56px（PRODUCT.md の 52px 以上）。
 * 幅は 1fr なので 390px でおよそ 50px になる。 */
.cal-d {
  display: flex; flex-direction: column; align-items: center;
  min-height: 56px; padding: 6px 2px 4px;
  border: 1px solid var(--line); border-radius: 10px;
  background: var(--cream); color: inherit; text-decoration: none;
}
.cal-d.wknd  { background: var(--paper); }
.cal-d.out   { opacity: .38; }              /* 前月・翌月の日 */
.cal-d.today { border: 2px solid var(--green); padding: 5px 1px 3px; }
.cal-n { font-size: 16px; line-height: 1.2; }
/* 印は最大4つ（3つ＋「＋」）。**1行に収まる幅で組む。**
 * gap 3px だと 390px（升 49.7px）で「＋」だけが2行目に落ちて、その升だけ
 * 背が高くなる。9px×3 + ＋10px + gap 2px×3 = 43px なら収まる。 */
.cal-m { display: flex; flex-wrap: nowrap; justify-content: center;
         gap: 2px; margin-top: 4px; min-height: 9px; }
.cal-m i, .cal-legend i { display: inline-block; flex: 0 0 auto;
                          width: 9px; height: 9px; font-style: normal; }
.cal-m i.ev, .cal-legend i.ev { background: var(--green); border-radius: 50%; }
.cal-m i.tk, .cal-legend i.tk { background: var(--accent); border-radius: 2px; }
.cal-m i.more { width: auto; height: 9px; font-size: 10px; line-height: 9px;
                color: var(--muted); }
.cal-legend { margin: 12px 0 0; font-size: 14px; color: var(--muted); }
.cal-legend i { vertical-align: middle; margin: 0 6px 0 16px; }
.cal-legend i:first-child { margin-left: 0; }
/* 予定の種類の札。たすことの札（.tag.doing など）と混ざらない落ち着いた緑 */
.tag.ev { background: #e8f2e9; color: #2d6248; }

/* --- 書類・写真 --- */
/* しまい場所のチップ。押すものなので 44px 以上の高さを確保する
 * （52px の決まりは主ボタンの話。チップは補助だが、それでも指で外さない大きさに） */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px;
        min-height: 44px; padding: 8px 14px;
        border: 1.5px solid var(--line); border-radius: 999px;
        background: var(--cream); color: var(--ink);
        font-size: 15px; text-decoration: none; }
.chip b { font-weight: 600; color: var(--muted); font-size: 14px; }
.chip.on { border-color: var(--green); background: #e8f2e9; color: var(--green-d); }
.chip.on b { color: var(--green-d); }
/* 縦長の書類をそのまま出すと1画面を埋めてしまうので、高さで抑えて全体を見せる */
.doc-preview { display: block; max-width: 100%; height: auto; max-height: 60vh;
               margin: 0 auto; border: 1px solid var(--line);
               border-radius: 12px; object-fit: contain; }
.inline { margin: 0; }

/* --- 玄関（未ログイン） --- */
.hero { text-align: center; padding: 30px 0 10px; }
.hero h1 { font-size: 26px; margin: 0 0 10px; line-height: 1.3; }
.hero p { font-size: 17px; color: var(--muted); }

/* LP の「はじめかた」。番号を丸で見せる（手順であることが一目で分かる） */
.lp-steps { margin: 0 0 14px; padding: 0; list-style: none; counter-reset: lp; }
.lp-steps li { position: relative; padding: 9px 0 9px 42px; counter-increment: lp;
               font-size: 17px; }
.lp-steps li::before { content: counter(lp); position: absolute; left: 0; top: 7px;
  width: 28px; height: 28px; border-radius: 50%; background: var(--green); color: #fff;
  font-size: 15px; font-weight: 600; display: flex; align-items: center;
  justify-content: center; }

.footer { border-top: 1px solid var(--line); margin-top: 30px; }
.footer .wrap { padding: 16px; font-size: 13px; color: var(--muted); }

@media (min-width: 720px) {
  .page { padding-top: 28px; }
  /* 入口は4つ（親・実家・書類・家族）。数が変わったらここも見直す */
  .tiles { grid-template-columns: repeat(4, 1fr); }
}

/* 本文のリンク。ブラウザ既定の青は紙色の画面で浮くので、深緑に揃える */
.card a:not(.btn), .flash a { color: var(--green-d); }

/* --- 月額プラン（Phase 10） --------------------------------------------- */
/* フッターのリンク。カードの外なので、色を決めないと既定の紫が出る
   （ROADMAP.md「カードの外に置いたリンク」の教訓） */
.foot-nav { margin-bottom: 6px; }
.foot-nav a { color: var(--muted); text-decoration: underline;
              margin-right: 14px; }
.flash.info { background: #eef1f6; color: #45536b; }
.pricing-lead { font-size: 22px; margin: 0 0 8px; }
.plans { width: 100%; border-collapse: collapse; font-size: 16px;
         margin: 0 0 14px; }
.plans th, .plans td { border-top: 1px solid var(--line); padding: 10px 8px;
                       text-align: left; }
.plans thead th { border-top: 0; font-size: 15px; color: var(--muted); }
.plans td { text-align: center; }
