/* ============================================================
   作成と配達の写真（社外版）― 製作・配達の社員がスマホで使う画面
   ★社内の画面（app/public/shashin.css）と同じ見た目。直すときは両方

   ★文字の大きさ
    倍率は --fs の1か所だけで持ち、寸法はすべて rem で書く。
    html { font-size: calc(16px * var(--fs)) } なので
      標準 1 → 16px ／ 大 1.375 → 22px（既定）／ 特大 1.6 → 25.6px ／ 最大 1.9 → 30.4px
    いちばん小さい注記でも 0.82rem（既定で18px）を下回らせない。
   ★片手で押すので、押すところは高さ 3.2rem 以上。
   ★スマホ幅 390px で横にはみ出さない。長い店名は折り返す。
   ============================================================ */
:root {
  --fs: 1.375;
  --kikyo: #5b4b9e;
  --kikyo-soft: #ece9f6;
  --haitatsu: #1f6f8b;        /* 配達の段階は青で、作成（紫）と見分ける */
  --haitatsu-soft: #e6f0f4;
  --now: var(--kikyo);
  --now-soft: var(--kikyo-soft);
  --ink: #1d1d1f;
  --sub: #6e6e73;
  --line: #e3e3e8;
  --bg: #f5f5f7;
  --card: #ffffff;
  --ok: #2f9e6e;
  --ok-bg: #eaf6f0;
  --todo: #8a8a8f;
  --todo-bg: #efeff2;
  --ng: #d9384a;
  --wait: #8a6100;
  --wait-bg: #fff3d6;
}
body.delivered { --now: var(--haitatsu); --now-soft: var(--haitatsu-soft); }
html { font-size: calc(16px * var(--fs)); }
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: -apple-system, "Hiragino Sans", "Segoe UI", system-ui, sans-serif;
  font-size: 1rem; line-height: 1.6; -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }

.bar {
  display: flex; align-items: center; gap: .4rem;
  padding: .7rem 1rem; background: var(--card); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.bar h1 { flex: 1 1 auto; min-width: 0; margin: 0; font-size: 1rem; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar h1::before { content: ""; display: inline-block; width: .6rem; height: .6rem; border-radius: 50%; background: var(--now); margin-right: .5rem; vertical-align: .18rem; }
/* 右に「◯◯さん　出る」 */
.titlebox { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.who { padding-left: 1.1rem; min-width: 0; color: var(--sub); font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar .btn { flex: none; }

/* 段階の切替＝この画面でいちばん大事な2つ。いちばん上に大きく置く */
.stage { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; padding: .7rem 1rem .2rem; max-width: 44rem; margin: 0 auto; }
.stage button {
  font: inherit; font-weight: 700; font-size: 1.24rem; line-height: 1.25;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .1rem;
  min-height: 4rem; border-radius: 1rem; border: 2px solid var(--line); background: var(--card); color: var(--sub); cursor: pointer;
}
.stage button small { font-size: .82rem; font-weight: 400; }
.stage button[data-stage="作成"].on { background: var(--kikyo); border-color: var(--kikyo); color: #fff; }
.stage button[data-stage="配達"].on { background: var(--haitatsu); border-color: var(--haitatsu); color: #fff; }

.tools { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; padding: .6rem 1rem; max-width: 44rem; margin: 0 auto; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: .7rem; overflow: hidden; background: var(--card); }
.seg button { white-space: nowrap; font: inherit; border: 0; background: none; padding: .45rem .9rem; color: var(--sub); cursor: pointer; min-height: 2.4rem; }
.seg button.on { background: var(--now); color: #fff; }
.seg.small button { font-size: .82rem; padding: .4rem .6rem; }
#dayPick { font: inherit; padding: .35rem .5rem; border: 1px solid var(--line); border-radius: .6rem; background: var(--card); min-height: 2.4rem; max-width: 100%; }

/* お届け先をひらいている間は、日付と絞り込みを隠す（段階の切替は残す） */
body.inDest .tools { display: none; }

main { padding: .2rem 1rem 3rem; max-width: 44rem; margin: 0 auto; }
.daylabel { margin: .2rem 0 .2rem; font-size: 1.1rem; font-weight: 600; }
.note { color: var(--sub); font-size: .86rem; margin: .6rem 0; }
.note.tight { margin: 0 0 .8rem; font-size: .82rem; }

.btn { white-space: nowrap; font: inherit; border: 1px solid var(--now); background: var(--now); color: #fff; border-radius: .7rem; padding: .55rem 1rem; min-height: 2.6rem; cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; }
.btn.ghost { background: var(--card); color: var(--now); }
.btn:disabled { opacity: .45; cursor: default; }

/* 一覧：1件1枚の札。お届け先の名前がいちばん大きい */
.list { display: flex; flex-direction: column; gap: .7rem; }
.card { display: block; width: 100%; text-align: left; font: inherit; color: inherit; background: var(--card); border: 1px solid var(--line); border-radius: 1rem; padding: .9rem 1rem; cursor: pointer; min-height: 3.2rem; }
.card:active { background: var(--now-soft); }
.card .name { font-size: 1.24rem; font-weight: 700; line-height: 1.35; word-break: break-all; }
.card .sub { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .3rem .6rem; color: var(--sub); font-size: .86rem; margin-top: .3rem; }
.marks { display: flex; align-items: center; gap: .5rem; margin-left: auto; }
.mini { font-size: .82rem; color: var(--sub); white-space: nowrap; }
.pill { flex: none; font-size: .86rem; padding: .15rem .7rem; border-radius: 999px; background: var(--todo-bg); color: var(--todo); white-space: nowrap; }
.pill.ok { background: var(--ok-bg); color: var(--ok); font-weight: 600; }
.tag { font-size: .82rem; padding: 0 .45rem; border-radius: 999px; background: var(--todo-bg); color: var(--todo); white-space: nowrap; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.waiting { background: var(--wait-bg); color: var(--wait); }

/* お届け先1件 */
.back { margin: .2rem 0 .6rem; }
.head h2 { margin: 0; font-size: 1.9rem; line-height: 1.3; word-break: break-all; }
.meta { margin: .2rem 0 0; font-size: 1rem; }

.pickItems h3, .itemList h3, .photos h3 { font-size: 1.14rem; margin: 1.4rem 0 .5rem; }
.photos h4 { font-size: 1rem; margin: 1.2rem 0 .4rem; color: var(--sub); }
.itemcards { display: flex; flex-direction: column; gap: .5rem; }
.item { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; width: 100%; text-align: left; font: inherit; color: inherit; background: var(--card); border: 2px solid var(--line); border-radius: .9rem; padding: .7rem .9rem; min-height: 3.2rem; cursor: pointer; }
.item .t { font-size: 1.1rem; font-weight: 600; line-height: 1.35; word-break: break-all; }
.item .s { font-size: .82rem; color: var(--sub); word-break: break-all; }
.item.on { border-color: var(--now); background: var(--now-soft); }
.item.on .t::before { content: "✓ "; color: var(--now); font-weight: 700; }
.item.all .t { font-size: 1.14rem; }

.itemList ul { margin: .2rem 0 0; padding-left: 1.2rem; }
.itemList li { margin: .2rem 0; word-break: break-all; }
.itemList .s { font-size: .82rem; color: var(--sub); }

.shoot { display: grid; grid-template-columns: 1fr; gap: .7rem; margin: 1.2rem 0; }
.big { display: flex; align-items: center; justify-content: center; min-height: 3.6rem; border-radius: 1rem; border: 2px solid var(--now); color: var(--now); background: var(--card); font-weight: 700; font-size: 1.14rem; cursor: pointer; user-select: none; text-align: center; }
.big.primary { background: var(--now); color: #fff; min-height: 4.4rem; font-size: 1.36rem; }
.big:active { opacity: .8; }
.big.off { opacity: .4; pointer-events: none; }
.progress { margin: 0; text-align: center; font-weight: 600; color: var(--now); }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(6.8rem, 1fr)); gap: .5rem; }
.grid.small { grid-template-columns: repeat(auto-fill, minmax(4.6rem, 1fr)); }
.ph { position: relative; background: var(--card); border: 1px solid var(--line); border-radius: .8rem; overflow: hidden; }
.ph img { display: block; width: 100%; aspect-ratio: 3 / 4; object-fit: cover; background: #ddd; }
.ph .cap { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .2rem .3rem; padding: .2rem .5rem; font-size: .82rem; color: var(--sub); }
.ph .cap.end { justify-content: flex-end; padding-top: 0; }
.ph .what { word-break: break-all; line-height: 1.35; }
.ph .del { font: inherit; font-size: .82rem; border: 0; background: none; color: var(--ng); cursor: pointer; padding: .2rem .3rem; }
.grid .empty { grid-column: 1 / -1; }
.empty { color: var(--sub); font-size: .9rem; padding: 1rem; border: 1px dashed var(--line); border-radius: .8rem; text-align: center; }

.toast { position: fixed; left: 50%; bottom: 1.2rem; transform: translateX(-50%); background: var(--ink); color: #fff; padding: .7rem 1.2rem; border-radius: .9rem; font-size: 1rem; max-width: 92vw; z-index: 20; box-shadow: 0 .4rem 1.4rem rgba(0,0,0,.2); }
.toast.ng { background: var(--ng); }

/* 文字の大きさの切替は一番下（上は段階と日付だけにして、一覧を上に出す） */
.foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .4rem .6rem; white-space: nowrap; padding: 1.2rem 1rem 2.4rem; color: var(--sub); font-size: .86rem; }

/* ---- 社外版だけのもの：ログイン ---- */
.login { max-width: 26rem; margin: 6vh auto; padding: 0 1.2rem 3rem; }
.login h1 { font-size: 1.6rem; margin: 0 0 1.4rem; }
.login label { display: block; margin: 1rem 0 .3rem; font-weight: 600; }
.login input[type="password"], .login input[type="text"] { font: inherit; width: 100%; padding: .7rem .8rem; min-height: 3.2rem; border: 1px solid var(--line); border-radius: .8rem; background: var(--card); }
.login .btn { width: 100%; justify-content: center; margin-top: 1.4rem; min-height: 3.4rem; font-size: 1.14rem; }
.login .err { color: var(--ng); font-weight: 600; margin-top: .8rem; min-height: 1.6rem; word-break: break-all; }
.login .note { margin-top: 1.6rem; }
.pickname { margin: 1.2rem 0 .6rem; font-weight: 600; }
/* なまえは大きいボタンで並べる（片手で押せる大きさ） */
.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(8rem, 1fr)); gap: .6rem; }
.names .nameBtn {
  font: inherit; font-size: 1.24rem; font-weight: 700;
  min-height: 4rem; border-radius: 1rem; border: 2px solid var(--line);
  background: var(--card); color: var(--ink); cursor: pointer; word-break: break-all;
}
.names .nameBtn.on { border-color: var(--kikyo); background: var(--kikyo-soft); color: var(--kikyo); }
.names .nameBtn:active { opacity: .8; }
.names .nameBtn:disabled { opacity: .45; cursor: default; }
.backpass { width: 100%; justify-content: center; margin-top: 1.4rem; }
