/*
  委託先アプリ（デモ）の見た目。/common.css に足りない分だけ（色・カード・ボタン・印・日付の帯・ダイアログ・シートは共通のもの）。
  画面の幅いっぱいに出す。スマホ幅（390px）は1列。タブレット（720px から。縦・横とも）は、案件の一覧と通知は日ごとのまとまりを、
  レポートは週のカードを横に並べる。案件とレポートの週の画面は 760px から2列。
*/

.app { min-height: 100vh; min-height: 100dvh; background: var(--page-bg); }
.app.has-tabbar { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
.app-main { max-width: 1440px; margin: 0 auto; padding: 12px 16px 28px; outline: none; }

/* 2列（案件・レポートの週）。狭い画面では上から順に1列 */
.cols > * + * { margin-top: var(--gap); }
/* 日ごとのまとまり（案件の一覧・通知）。狭い画面では縦に続ける */
.days > .day + .day { margin-top: 20px; }

@media (min-width: 720px) {
  .app-main { padding: 20px 24px 32px; }
  /* 日ごとのまとまりを並べる（幅に合わせて2〜3列） */
  .days { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 20px 16px; align-items: start; }
  .days > .day + .day { margin-top: 0; }
  /* レポートの週の一覧：カードを並べる */
  .list--cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
  .list--cards > li { display: flex; min-width: 0; }
  .list--cards > li > .list__item { flex: 1 1 auto; min-width: 0; margin: 0; }
}
/* 2列は 760px から（列の幅が、大きな電話番号が1行に入る幅になってから） */
@media (min-width: 760px) {
  .cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); align-items: start; }
  .cols > * + * { margin-top: 0; }
}
.m-0 { margin: 0 !important; }
.alert-ink { color: var(--alert-ink) !important; }

/* 下のタブ（予約・完了済み案件・レポート・現金精算・マイページ） */
/* 帯は幅いっぱい。タブは広い画面でも真ん中に寄せる（1つ200pxまで） */
.tabbar {
  position: fixed; z-index: 30; bottom: 0; left: 0; right: 0;
  display: grid; grid-template-columns: repeat(5, minmax(0, 200px)); justify-content: center;
  background: var(--surface); border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabbar__item {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: 60px; color: var(--ink-2); font-size: 0.75rem; font-weight: 600; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.tabbar__item svg { width: 24px; height: 24px; }
.tabbar__item span { white-space: nowrap; }
/* 「完了済み案件」：5つ並べて入らない狭い画面（〜379px。1つ76px より狭い）では「完了済み」 */
.tabbar__label--short { display: none; }
@media (max-width: 379px) {
  .tabbar__label--long { display: none; }
  .tabbar__label--short { display: inline; }
}
.tabbar__item.is-active { color: var(--primary-ink); }
.tabbar__item:active { background: var(--surface-2); }

/* 電波がないとき */
.offline-note .btn { flex: none; white-space: nowrap; }
.offline-note__title { display: block; }
.offline-note__sub { display: block; color: var(--ink-2); font-size: 0.8rem; font-weight: 500; }
.offline-note {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 8px 16px; background: var(--surface-3); color: var(--ink); font-size: 0.875rem; font-weight: 600;
}

/* ログイン */
.login-wrap { max-width: 400px; margin: 12px auto 0; }
.login .field:first-of-type { margin-top: 0; }
.login__submit { margin-top: 20px; }

/* 印の並び */
.badges { display: flex; flex-wrap: wrap; gap: 4px 0; margin-top: 8px; }
.card > .badges:first-child { margin: 0 0 10px; }
.badge--companion { background: var(--primary); border-color: var(--primary); color: #fff; }
/* 同行案件の印の右の「？」：押せる大きさ（44px）のまま、印の並びの高さは変えない */
.badges { align-items: center; }
.help-btn { width: 44px; height: 44px; margin: -10px -6px -10px -8px; color: var(--primary-ink); }
.help-list { margin: 0; padding-left: 1.2em; }
.help-list li + li { margin-top: 8px; }

/* 一覧のカード */
.job { display: flex; flex-direction: column; gap: 2px; }
.job__time { font-size: 1.1rem; font-weight: 700; }
.job__menu { font-weight: 700; }
/* 完了した案件：灰色のカード（赤の印は赤のまま） */
.list__item.job--done { background: var(--surface-3); box-shadow: none; }
a.list__item.job--done:hover, a.list__item.job--done:active { background: #e4e6ee; }
.job--done .job__time, .job--done .job__menu { color: var(--ink-2); }
.job--done .job__where { color: var(--ink-3); }
.job--done .badge:not(.badge--alert):not(.badge--tentative):not(.badge--companion) { background: var(--surface); color: var(--ink-2); }
.list-done { margin-top: 28px; }

/* 案件の画面：いつ・どこ・何を */
.facts { display: grid; grid-template-columns: 4em minmax(0, 1fr); gap: 12px 10px; margin: 0; }
.facts > dt { color: var(--ink-2); font-size: 0.85rem; font-weight: 700; padding-top: 2px; }
.facts > dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.facts > dd > * + * { margin-top: 4px; }
.facts--sub { grid-template-columns: max-content minmax(0, 1fr); gap: 2px 10px; margin-top: 6px; font-size: 0.9rem; }
.facts--sub > dt { font-weight: 600; padding-top: 0; }
.facts > dd > .facts--sub { margin-top: 6px; }
.when { margin: 0; font-size: 1.15rem; font-weight: 700; }
.cust-name { margin: 2px 0 0; font-size: 1.15rem; font-weight: 700; }
/* 電話番号は大きく（押してもかけない。長押しで選べる） */
.phone {
  margin: 2px 0 0; font-size: 1.75rem; font-weight: 700; line-height: 1.25; letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums; user-select: all; -webkit-user-select: all; white-space: nowrap;
}
.partner + .partner { margin-top: 10px; }
.note { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--line); }
.note__label { margin: 0 0 2px; font-size: 0.8rem; font-weight: 700; color: var(--ink-2); }
.note__text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.share-no { margin-top: 12px; text-align: right; }
.facts > dd > .model + .model { margin-top: 2px; }
/* 型番は途中で切らずに次の行へ（長いときだけ折り返す） */
.model__no { display: inline-block; max-width: 100%; overflow-wrap: anywhere; }

/* 進みの下のボタン。「戻す」は記録の時刻と並べて右に */
.next { margin-top: 16px; }
.undo-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.next > .btn + .undo-row { margin-top: 8px; }

/* カードの見出しの右に印 */
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.card__head .card__title { margin: 0; }
.card__head .badge { margin: 0; }
.sub-title { margin: 18px 0 6px; font-size: 0.92rem; color: var(--ink-2); }

/* 明細の行 */
.items { list-style: none; margin: 0; padding: 0; }
.item { padding: 10px 0; border-bottom: 1px solid var(--line); }
.item:first-child { padding-top: 2px; }
.item__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.item__name { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.item__name .badge { margin-left: 6px; }
.item__amount { font-weight: 700; }
.item__meta { color: var(--ink-2); font-size: 0.85rem; margin-top: 2px; }
.item__ops { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.item__ops .btn--ghost { padding-left: 8px; padding-right: 8px; }
.item__del { color: var(--ink-2); }
.stepper { display: inline-flex; align-items: center; gap: 2px; border: 1px solid var(--line-strong); border-radius: var(--radius-pill); padding: 2px; }
.stepper__btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--primary-ink); cursor: pointer;
  transition: background-color var(--dur-fast), transform var(--dur-fast) var(--ease);
}
.stepper__btn svg { width: 18px; height: 18px; }
.stepper__btn:hover { background: var(--primary-soft); }
.stepper__btn:active { transform: scale(0.94); background: var(--primary-soft-2); }
.stepper__btn:disabled { color: var(--ink-3); background: transparent; cursor: not-allowed; }
.stepper__btn .spinner { width: 16px; height: 16px; }
.stepper__n { min-width: 2em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.item-group { margin: 16px 0 2px; font-size: 0.85rem; font-weight: 700; color: var(--ink-2); }
.item-group:first-of-type { margin-top: 0; }
.card > .card__title + .item-group { margin-top: 0; }
.sum-line { display: flex; justify-content: space-between; gap: 8px; padding: 8px 0 0; font-weight: 600; }
.sum-line--total { margin-top: 8px; padding-top: 10px; border-top: 1px solid var(--line-strong); font-size: 1.05rem; font-weight: 700; }

/* シートの中 */
.tpl__group { margin: 12px 12px 2px; font-size: 0.8rem; font-weight: 700; color: var(--ink-2); }
.tpl__group:first-child { margin-top: 0; }
.sheet__body > .tpl > .tpl__group:first-child { margin-top: 0; }
.sheet-form .field:first-child { margin-top: 4px; }
.sheet-form > .btn { margin-top: 18px; }
.sheet__body .grid-2b .field { margin: 14px 0; }

/* 会計 */
.sums { display: grid; grid-template-columns: 1fr auto; gap: 6px 0; margin: 0; align-items: baseline; }
.sums > dt { color: var(--ink-2); }
.sums > dd { margin: 0; padding-left: 12px; font-weight: 600; }
.sums > dd.strong { font-weight: 700; font-size: 1.05rem; }
.sums__big { font-size: 1.5rem; font-weight: 700 !important; }
.sums > .sums__part { font-size: 0.9rem; }
.sums > dd.sums__part { font-weight: 500; }
.sums > .sums__line { padding-top: 6px; border-top: 1px solid var(--line); }
.pays { list-style: none; margin: 0; padding: 0; }
.pay { padding: 10px 0; border-top: 1px solid var(--line); }
.pay__head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-weight: 700; }
.pay__meta { margin: 2px 0 0; color: var(--ink-2); font-size: 0.85rem; overflow-wrap: anywhere; }
.pay__ops { margin-top: 2px; text-align: right; }
.pay.is-voided .pay__head { color: var(--ink-3); }
.pay.is-voided .pay__amount { text-decoration: line-through; }

/* 写真 */
.photo-grid { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.photo-grid li { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.photo-grid__btn { display: block; padding: 0; aspect-ratio: 1 / 1; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2); cursor: zoom-in; }
.photo-grid__btn img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-grid__cap { font-size: 0.75rem; color: var(--ink-2); text-align: center; }
.photo-large { display: block; width: 100%; max-height: 70vh; object-fit: contain; border-radius: var(--radius-sm); }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; pointer-events: none; }
label.btn { position: relative; cursor: pointer; }
label.btn:focus-within { box-shadow: var(--ring); }
label.btn[aria-disabled="true"] { opacity: 0.55; pointer-events: none; }
.upload-box:not(:empty) { margin-top: 10px; }

/* レポート */
.week__meta { display: block; margin-top: 2px; }
.big-amount { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin: 4px 0 0; }
.big-amount strong { font-size: 1.75rem; }
.lines { list-style: none; margin: 8px 0 0; padding: 0; }
.line { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; padding: 8px 0; border-top: 1px solid var(--line); font-size: 0.92rem; }
.line--job { display: block; }
.line__top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.line__main { min-width: 0; overflow-wrap: anywhere; }
.line__sub { margin: 2px 0 0; color: var(--ink-2); font-size: 0.8rem; overflow-wrap: anywhere; }

/* 現金精算：振込先（口座番号はコピー） */
.cash__week { margin: 6px 0 0; }
.account { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 16px; margin: 0; align-items: center; }
.account > dt { color: var(--ink-2); font-size: 0.9rem; }
.account > dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.account__number { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.account__no { font-size: 1.5rem; font-weight: 700; letter-spacing: 0.06em; user-select: all; -webkit-user-select: all; }
.copy-btn { gap: 6px; }
.copy-btn svg { width: 18px; height: 18px; }
.copy-buffer { position: fixed; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* 知らせ */
.notif { display: flex; flex-direction: column; gap: 2px; }
.notif__top { display: flex; align-items: center; gap: 6px; }
.notif__top .badge { margin: 0; }
.notif__dot { width: 9px; height: 9px; border-radius: 50%; background: var(--primary); flex: none; }
.notif__title { font-weight: 500; }
.notif.is-unread .notif__title { font-weight: 700; }
.notif__body { color: var(--ink-2); font-size: 0.875rem; overflow-wrap: anywhere; }

/* マイページ：見出しごとの行の並び */
.me-group__title { margin: 4px 0 8px; font-size: 0.92rem; font-weight: 700; color: var(--ink-2); }
.stack > .me-group + .me-group { margin-top: 20px; }
.kv { display: flex; justify-content: space-between; gap: 12px; }
.kv__k { color: var(--ink-2); flex: none; }
.kv__v { text-align: right; min-width: 0; overflow-wrap: anywhere; }
.kv__line { display: block; }
/* 長い一覧（対応地域）は名前の下に左寄せで */
.kv--block { flex-direction: column; gap: 4px; }
.kv--block .kv__v { text-align: left; line-height: 1.7; }

@media (max-width: 360px) {
  .phone { font-size: 1.5rem; }
  .item__ops { flex-wrap: wrap; }
}

/* 現金精算の「精算の流れ」：4つの段階を矢印でつなぐ。スマホは縦、640px からは横に並べる */
.flow-card { margin-top: var(--gap); }
.flow { display: flex; flex-direction: column; align-items: stretch; gap: 2px; }
.flow__step { padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); min-width: 0; }
.flow__step p { margin: 0; }
.flow__when { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.flow__date span { white-space: nowrap; }
.flow__no { display: inline-grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: var(--on-primary); font-size: 0.78rem; font-weight: 700; }
.flow__what { margin-top: 4px !important; font-size: 0.9rem; }
.flow__dir { margin-top: 4px !important; font-size: 0.8rem; font-weight: 700; color: var(--primary-ink); }
.flow__date { margin-top: 6px !important; font-size: 0.85rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.flow__arrow { display: flex; justify-content: center; align-items: center; color: var(--ink-3); }
.flow__arrow svg { width: 20px; height: 20px; transform: rotate(90deg); }
.flow__note { margin: 6px 0 0; font-size: 0.85rem; color: var(--ink-2); }
.flow + .flow__note { margin-top: 12px; }
@media (min-width: 640px) {
  .flow { flex-direction: row; }
  .flow__step { flex: 1 1 0; }
  .flow__when { flex-direction: column; align-items: flex-start; gap: 6px; }
  .flow__arrow { flex: none; width: 18px; }
  .flow__arrow svg { transform: none; }
}


/* 回答のシートの同意の文と条件（業務委託基本契約。2026-12-01）・委託金の変更の確認 */
.reply-consent { margin: 12px 8px 8px; padding: 12px; border-radius: 8px; background: var(--surface-2); font-size: 0.9rem; line-height: 1.6; }
.reply-consent[hidden] { display: none; }
.facts--terms { grid-template-columns: max-content minmax(0, 1fr); gap: 6px 12px; margin: 8px 8px 16px; font-size: 0.9rem; }
.consent-card .facts--terms { margin: 8px 0 12px; }
.ml-1 { margin-left: 6px; }
/* 回答のシート：会話の要約・大事な条件と共通の事項の文（送信のボタンの上。メールの回答の画面と同じ並び） */
.reply-block { margin: 0 8px 16px; font-size: 0.9rem; line-height: 1.6; }
.reply-block__title { margin: 0 0 6px; font-size: 0.92rem; font-weight: 700; color: var(--ink-2); }
.reply-block__list { margin: 0; padding-left: 1.2em; }
.reply-block__list li + li { margin-top: 4px; }
.reply-block__text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.reply-block__list + .reply-block__text { margin-top: 8px; }

/* 条件の表をカードの中で左右いっぱいに（基本契約・店への支払い） */
.facts--flush { margin-left: 0; margin-right: 0; }
/* 別紙1の値：項目名の下に値（長い項目名でも値の幅を狭めない） */
.facts--annex { grid-template-columns: minmax(0, 1fr); gap: 0; margin: 4px 0 0; }
.facts--annex > dt { padding-top: 8px; font-size: 0.8rem; }
.facts--annex > dt:first-child { padding-top: 0; }
.facts--annex > dd { font-weight: 600; }
.card > .sub-title:first-of-type { margin-top: 4px; }
.pre-wrap { white-space: pre-wrap; }

/* 予約の一覧の上の基本契約のお願い（押すと基本契約の画面） */
.contract-note { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 0 0 12px; text-decoration: none; }
.contract-note svg { flex: none; width: 18px; height: 18px; }

/* 再訪のご依頼：訪問できる日時の候補（2026-12-02） */
.revisit-row + .revisit-row { border-top: 1px solid var(--line); margin-top: 8px; }

/* ---- iPhone などのブラウザ（2026-12-04） ---- */
/* 横向きの iPhone：画面の左右の切り欠き（safe-area）に中身・上の帯・下のタブがかからないように（切り欠きのない端末は今までどおり） */
.topbar { padding-left: max(8px, env(safe-area-inset-left)); padding-right: max(8px, env(safe-area-inset-right)); }
.tabbar { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
.app-main { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
@media (min-width: 720px) {
  .app-main { padding-left: max(24px, env(safe-area-inset-left)); padding-right: max(24px, env(safe-area-inset-right)); }
}
/* iPhone の Safari（-webkit-touch-callout があるのは iOS だけ）：日付・時間の欄が枠からはみ出さず、中身を左に寄せる */
@supports (-webkit-touch-callout: none) {
  input[type="date"], input[type="time"] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; }
  input[type="date"]::-webkit-date-and-time-value, input[type="time"]::-webkit-date-and-time-value { text-align: left; }
}
/* お客様の家の写真：iPhone で長押ししたときの「写真に保存」のメニューを出さない（私物の写真のアプリ・iCloud に残さない。スクリーンショットまでは止められない） */
.photo-grid img, .photo-large { -webkit-touch-callout: none; }
