/* style.css */
/* 目的：緑の紙を土台にした PC 向けの見た目（デザインの原本 docs/design/design-2026-08-31.dc.html のとおり） */
/* 責務：色と余白と並べ方、動きの型（nodeIn / ring / dotPop / toastIn）、それと見出しの筆記体フォントの取り込み。 */
/*       外（CDN・Google Fonts）からは読み込まない。フォントも自分のサーバーの /fonts/ に置いたものを使う（CSP のため）。 */
/*       画面は横に伸びない。カードは横に最大3枚まで（中身の最大幅 960px で押さえている） */

/* 見出し「Where's My Stuff」だけに使う筆記体。ライセンスは /fonts/LICENSE-Pacifico.txt */
@font-face {
  font-family: 'Pacifico';
  src: url('/fonts/pacifico-latin.woff2') format('woff2');
  font-display: swap;
}

:root {
  --ink: #1c231d;
  --quiet: #5c665d;
  --faint: #8a938b;
  --line: #e2e8e1;
  --line-soft: #dfe6de;
  --line-strong: #cfd8ce;
  --paper: #ffffff;
  --back: #f2f6f0;
  --green: #2f9e35;
  --green-dark: #237a28;
  --green-pale: #e6f4e6;
  --red: #9a3b2f;
  --red-pale: #fbeceb;
  --red-line: #ecd4d1;
  /* 中身の最大幅。カード1枚の下限 300px + すき間 14px で計算すると、
     3枚 = 928px は収まり、4枚 = 1242px は収まらない。だからカードは横に最大3枚まで */
  --content: 940px;
  /* 運送会社の色は「明るさ・鮮やかさは同じで色みだけ変える」。各カードが自分の色みを持つ */
  --hue: 160;
}

/* 動きの型（デザインの原本から） */
@keyframes nodeIn { 0% { opacity: 0; transform: translateY(-10px) scale(.98); } 100% { opacity: 1; transform: none; } }
@keyframes ring { 0% { box-shadow: 0 0 0 0 rgba(47,158,53,.45); } 70% { box-shadow: 0 0 0 14px rgba(47,158,53,0); } 100% { box-shadow: 0 0 0 0 rgba(47,158,53,0); } }
@keyframes dotPop { 0% { transform: scale(.2); } 60% { transform: scale(1.25); } 100% { transform: scale(1); } }
@keyframes toastIn { 0% { opacity: 0; transform: translateY(12px); } 100% { opacity: 1; transform: none; } }

* { box-sizing: border-box; }

html, body {
  /* 横スクロールは出さない（最後の保険。そもそも中身がはみ出さない作りにしてある） */
  overflow-x: hidden;
}

body {
  margin: 0;
  padding: 0 0 3rem;
  background: var(--back);
  color: var(--ink);
  font-family: system-ui, sans-serif;
  font-size: 16px;
  line-height: 1.6;
}

.hidden { display: none !important; }
.quiet { color: var(--quiet); font-size: 13px; }

/* 会社ごとの色み（数字は色相。明るさ・鮮やかさは共通） */
.c-yamato { --hue: 70; }
.c-sagawa { --hue: 250; }
.c-cainiao { --hue: 20; }
.c-japanpost { --hue: 160; }

/* ---- 上部バー -------------------------------------------------------- */

.bar {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 28px;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
}

/* バーの下端の緑の帯（左から 22% だけ） */
.bar-accent {
  position: absolute;
  left: 0;
  right: 0;
  bottom: -3px;
  height: 3px;
  background: linear-gradient(90deg, var(--green) 0 22%, transparent 22%);
}

/* アプリの名前。ここだけ筆記体（読めなければ system-ui に落ちる） */
h1.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  margin: 0;
  font-family: 'Pacifico', system-ui, sans-serif;
  font-weight: 400;
  font-size: 24px;
  line-height: 1.2;
}
.brand-icon { width: 34px; height: 34px; flex: none; border-radius: 8px; }

.bar-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}
.bar-count { font-size: 13px; color: var(--quiet); font-variant-numeric: tabular-nums; }

/* 三本線のボタン */
.menu-button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 38px;
  height: 38px;
  padding: 0;
  color: var(--ink);
  background: var(--back);
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.menu-button:hover { background: #e8f0e6; }
/* 三本線そのもの。真ん中の1本が span、上下の2本が ::before と ::after */
.menu-lines {
  position: relative;
  display: block;
  width: 17px;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.menu-lines::before,
.menu-lines::after {
  content: '';
  position: absolute;
  left: 0;
  width: 100%;
  height: 2px;
  border-radius: 2px;
  background: currentColor;
}
.menu-lines::before { top: -6px; }
.menu-lines::after { top: 6px; }

/* ---- ボタン ---------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 10px 14px;
  font-size: 13.5px;
  font-family: inherit;
  line-height: 1.3;
  color: var(--ink);
  background: var(--back);
  border: 1px solid var(--line);
  border-radius: 11px;
  text-decoration: none;
  cursor: pointer;
}
.btn:disabled { opacity: .5; cursor: default; }

.btn-primary { font-weight: 600; color: #fff; background: var(--green); border-color: var(--green); }
.btn-primary:hover { background: var(--green-dark); border-color: var(--green-dark); }
.btn-soft { color: var(--ink); background: var(--back); border-color: var(--line); }
.btn-soft:hover { background: #e8f0e6; }
.btn-danger { color: var(--red); background: var(--paper); border-color: var(--red-line); }
.btn-danger:hover { background: var(--red-pale); }
.btn-quiet { color: var(--quiet); background: transparent; border-color: transparent; }
.btn-quiet:hover { background: var(--back); }
.btn-wide { width: 100%; padding: 13px 0; font-size: 15px; border-radius: 13px; }

/* 上部バーの「＋荷物」だけは原本どおり丸く・影を持つ */
.btn-add {
  height: 38px;
  padding: 0 16px;
  font-size: 14px;
  border-radius: 19px;
  box-shadow: 0 6px 16px rgba(35, 122, 40, .3);
}
.btn-plus { font-size: 19px; line-height: 1; }

/* ---- 本体の枠 -------------------------------------------------------- */

main {
  /* 左右の余白（28px ずつ）は中身の外側なので、max-width にはその分を足す */
  max-width: calc(var(--content) + 56px);
  margin: 0 auto;
  padding: 26px 28px;
}

.centered { max-width: 30rem; margin: 3rem auto; text-align: center; }
/* ログインの入口・戻り口（app/bootstrap.php の mts_html_notice）が使う枠 */
.notice { max-width: 30rem; margin: 3rem auto; padding: 0 1rem; }

.list-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.list-title { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .06em; color: var(--quiet); }
.list-next { font-size: 12px; color: var(--faint); font-variant-numeric: tabular-nums; }

/* ---- 荷物の一覧 ------------------------------------------------------ */
/* 横に並ぶのは最大3枚。入りきらなければ2枚・1枚と縦に落ちる（横スクロールはしない） */
.parcels {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  gap: 14px;
  align-items: start;
}

/* カードと、その右上に重ねる「閉じる」を並べる枠 */
.parcel-item { position: relative; }

/* カード全体が押しボタン（押すと詳細の窓が開く） */
.parcel {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 12px;
  width: 100%;
  padding: 14px 16px 14px 12px;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.6;
  text-align: left;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 3px solid oklch(.58 .13 var(--hue));
  border-radius: 14px;
  cursor: pointer;
}
.parcel:hover { background: #fbfdfa; }

/* 登録した直後だけ、ふわっと出て緑の輪が広がる */
.parcel.just-added { animation: nodeIn .45s ease-out both, ring 1.6s ease-out .3s 1; }

/* 配達済みのカードは、右上の「閉じる」のぶんだけ右を空ける */
.parcel.delivered { padding-right: 74px; }

/* 一覧から外すだけの小さなボタン（消すのではないので、目立たせない） */
.parcel-close {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 3px 10px;
  font-family: inherit;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
  color: var(--quiet);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.parcel-close:hover { color: var(--green-dark); background: var(--green-pale); border-color: var(--green); }

.parcel-mark { display: flex; justify-content: center; padding-top: 2px; }
.carrier-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: oklch(.58 .13 var(--hue) / .12);
  color: oklch(.45 .13 var(--hue));
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}

.parcel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.parcel-name { font-size: 16px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }

.parcel-flag {
  flex: none;
  font-size: 11px;
  font-weight: 600;
  border-radius: 999px;
  padding: 2px 8px;
  white-space: nowrap;
}
.parcel-flag.new { color: var(--green-dark); background: var(--green-pale); animation: dotPop .5s ease-out .35s both; }
.parcel-flag.failing { color: var(--red); background: var(--red-pale); }

.parcel-summary { margin-top: 6px; font-size: 20px; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.parcel-summary.faded { color: var(--quiet); }
.parcel-note { margin-top: 8px; font-size: 12.5px; color: var(--quiet); }
.parcel-times { margin-top: 12px; font-size: 12px; color: var(--quiet); font-variant-numeric: tabular-nums; }

/* 進み具合の線（準備中・受付・輸送・配達店・完了） */
.progress { display: flex; align-items: center; gap: 6px; margin-top: 12px; }
.step {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  background: var(--paper);
}
.step.done { border: 0; background: var(--green); }
.step.now {
  width: 11px;
  height: 11px;
  border: 0;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 158, 53, .2);
}
.step-line { flex: 1; height: 2px; background: var(--line-soft); }
.step-line.done { background: var(--green); }
.progress-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--faint);
}

/* ---- 荷物が1件も無いとき --------------------------------------------- */

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 4rem 1rem;
  text-align: center;
}
.empty-art { display: flex; align-items: center; gap: 10px; color: var(--line-strong); }
.empty-dot { width: 10px; height: 10px; border-radius: 50%; border: 2px solid currentColor; }
.empty-line { width: 34px; height: 2px; background: currentColor; }
.empty-title { font-size: 15px; font-weight: 600; }
.empty-text { max-width: 26rem; font-size: 12.5px; color: var(--quiet); line-height: 1.7; }

/* ---- 知らせ ---------------------------------------------------------- */
/* 黒い帯。左の点が緑なら良い知らせ、赤ならうまくいかなかった知らせ。右端の「×」で消せる */
.message {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 12px 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--ink);
  color: var(--back);
  font-size: 13px;
  line-height: 1.5;
  animation: toastIn .4s ease-out both;
}
.message::before {
  content: '';
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #e07a6a;
}
.message.ok::before { background: #7fd47f; }
.message-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.message-close {
  flex: none;
  width: 22px;
  height: 22px;
  padding: 0;
  font-size: 15px;
  line-height: 1;
  color: inherit;
  background: transparent;
  border: 0;
  cursor: pointer;
}

/* 画面本体の知らせだけは、下の真ん中に浮かせる */
.toast {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 22px;
  z-index: 5;
  width: fit-content;
  max-width: min(560px, 92vw);
  margin: 0 auto;
}

/* ---- 入力欄 ---------------------------------------------------------- */

.field, .field-label { display: block; margin-top: 12px; font-size: 12px; color: var(--quiet); }
.input {
  display: block;
  width: 100%;
  margin-top: 5px;
  padding: 11px 12px;
  font-size: 16px;
  font-family: inherit;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
}
.input-mono { font-family: ui-monospace, monospace; }
/* 入力欄の下に付ける小さな説明（伝票番号が任意であることなど） */
.field-hint { margin: 5px 0 0; font-size: 11.5px; line-height: 1.5; color: var(--faint); }
select.input { padding: 10px 12px; }

/* 押しボタンで選ぶ並び（会社・確認の間隔）。中身は目に見えない radio なので、キーボードでも選べる */
.choice-row { display: flex; gap: 8px; margin-top: 5px; }
.choice { position: relative; flex: 1; display: block; min-width: 0; }
.choice input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.choice span {
  display: block;
  padding: 9px 4px;
  font-size: 13px;
  text-align: center;
  color: var(--quiet);
  background: var(--back);
  border: 1px solid var(--line);
  border-radius: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.choice input:hover + span { background: #e8f0e6; }
.choice input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }
/* 選ばれている間隔は緑地に白字 */
.choice input:checked + span { font-weight: 600; color: #fff; background: var(--green); border-color: var(--green); }
/* 選ばれている会社は、その会社の色 */
.choice-carrier input:checked + span {
  color: oklch(.45 .13 var(--hue));
  background: oklch(.58 .13 var(--hue) / .12);
  border-color: oklch(.58 .13 var(--hue) / .45);
}

/* ---- 窓（登録・詳細・メニュー） --------------------------------------- */

dialog {
  width: min(420px, 92vw);
  max-height: 85vh;
  overflow-y: auto;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 14px 18px 22px;
}
dialog::backdrop { background: rgba(28, 35, 29, .4); }

.sheet-title { font-size: 17px; font-weight: 600; }
#panel { width: min(480px, 92vw); }
#add-panel .btn-wide { margin-top: 16px; }
#add-close, #panel-close, #menu-close { display: block; width: 100%; margin-top: 14px; }

/* 荷物を開いた窓の中身 */
.detail-head { display: flex; align-items: center; gap: 8px; }
.detail-name { font-size: 18px; font-weight: 600; overflow-wrap: anywhere; }
.detail-sub { margin-top: 4px; font-size: 12.5px; color: var(--quiet); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.detail-actions { display: flex; gap: 8px; margin-top: 14px; }
.detail-actions .btn-primary { flex: 1; }
.section-title { margin: 20px 0 10px; font-size: 13px; font-weight: 600; letter-spacing: .06em; color: var(--quiet); }

/* 履歴（縦の点と線） */
.events { list-style: none; margin: 0; padding: 0 0 0 6px; }
.events li { display: grid; grid-template-columns: 18px 1fr; gap: 12px; }
.event-rail { display: flex; flex-direction: column; align-items: center; }
.event-dot { width: 10px; height: 10px; border-radius: 50%; background: #b9c9b8; margin-top: 6px; }
.events li:first-child .event-dot {
  width: 12px;
  height: 12px;
  margin-top: 5px;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(47, 158, 53, .16);
}
.event-line { flex: 1; width: 2px; background: var(--line-soft); }
/* いちばん下の線だけ、途中で消える */
.events li:last-child .event-line { background: linear-gradient(var(--line-soft) 0 40%, transparent 40%); }
.event-body { padding-bottom: 18px; }
.events li:last-child .event-body { padding-bottom: 0; }
.event-when { font-size: 11.5px; color: var(--faint); font-variant-numeric: tabular-nums; }
.event-summary { font-size: 15.5px; font-weight: 600; overflow-wrap: anywhere; }
.event-raw { font-size: 12.5px; color: var(--quiet); overflow-wrap: anywhere; }

/* ---- 三本線のメニュー ------------------------------------------------- */
/* 真ん中ではなく、上部バーのすぐ下・右端に出す */
.menu-panel {
  width: min(360px, 92vw);
  max-height: calc(100vh - 5rem);
  margin: 4rem 1rem auto auto;
  border-radius: 14px;
}
.menu-panel #menu-message { margin-top: 0; }

.menu-account {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}
.menu-email { font-size: 12.5px; color: var(--quiet); overflow-wrap: anywhere; }

/* 通知の区画（端末ごとに1回押す） */
#push { margin-top: 4px; }
.push-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.push-list { list-style: none; margin: 12px 0 0; padding: 0; }
.push-list li {
  color: var(--quiet);
  font-size: 12.5px;
  border-top: 1px solid var(--line);
  padding: 6px 0;
  overflow-wrap: anywhere;
}
.push-list li.here { color: var(--ink); }

/* ---- 画面が狭いとき（1列に落ちる） ----------------------------------- */

@media (max-width: 560px) {
  .bar { padding: 10px 14px; gap: 8px; }
  h1.brand { font-size: 19px; gap: 8px; }
  .brand-icon { width: 28px; height: 28px; }
  .bar-right { gap: 10px; }
  main { padding: 18px 14px; }
}
