/* 送信履歴サイト。本社・店舗・印字担当が同じ画面を見る。
   店舗ではタブレットからも開くので、押す場所は指で届く大きさにする。 */

:root {
  --bg: #f4f4f6;
  --panel: #ffffff;
  --line: #e2e2e6;
  --text: #1c1c1e;
  --sub: #6c6c70;
  --key: #0a6db8;
  --done: #1a7f37;
  --soon: #c0392b;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
  font-size: 15px; -webkit-text-size-adjust: 100%;
}

header {
  display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap;
  padding: 14px 20px; background: var(--panel);
  border-bottom: 1px solid var(--line);
}
h1 { font-size: 18px; margin: 0; white-space: nowrap; }
#counts { color: var(--sub); font-size: 14px; }
#reload {
  margin-left: auto; height: 42px; padding: 0 18px;
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  font: inherit; color: var(--text);
}
#reload:active { background: #ececf0; }

#filters {
  display: flex; flex-wrap: wrap; gap: 10px;
  padding: 12px 20px; background: var(--panel);
  border-bottom: 1px solid var(--line);
}
#filters input[type=search], #filters select {
  height: 42px; padding: 0 12px; font: inherit;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
#filters input[type=search] { flex: 1; min-width: 220px; }
.near { display: flex; align-items: center; gap: 8px; color: var(--sub); }
.near input { width: 20px; height: 20px; }

main { padding: 16px 20px 40px; overflow-x: auto; }

table { border-collapse: collapse; width: 100%; background: var(--panel); }
th, td {
  padding: 10px 12px; text-align: left; vertical-align: top;
  border-bottom: 1px solid var(--line); white-space: nowrap;
}
/* 見出しは貼り付けない。貼り付けると、下の行が見出しに潜って
   文字が途中で切れて見えるため。 */
th {
  font-size: 13px; color: var(--sub); font-weight: 600;
  background: #fafafb; border-bottom: 2px solid var(--line);
}
tr.done td { background: #f4faf5; }
tr.done .c-name { color: var(--sub); }

.c-state { width: 108px; }
.c-num { text-align: right; }

.chk { display: flex; align-items: center; gap: 8px; }
.chk input { width: 24px; height: 24px; flex: 0 0 24px; }
.chk span { font-size: 12px; color: var(--sub); }

.prod { display: flex; align-items: center; gap: 8px; }
.prod img { width: 34px; height: 42px; object-fit: contain; }

.name { font-weight: 700; font-size: 16px; }
.name2 { color: var(--sub); font-size: 13px; }

.ok { color: var(--done); font-weight: 700; }
.soon { color: var(--soon); font-weight: 700; }

td.memo input, td.who input {
  width: 100%; min-width: 110px; height: 36px; padding: 0 8px;
  font: inherit; border: 1px solid var(--line); border-radius: 8px;
}

#empty { color: var(--sub); padding: 30px 0; }

/* 幅の狭い端末では、1件を1枚のカードとして縦に並べる */
@media (max-width: 900px) {
  thead { display: none; }
  table, tbody, tr, td { display: block; width: 100%; }
  tr {
    background: var(--panel); border-radius: 12px;
    margin-bottom: 12px; padding: 6px 4px;
    box-shadow: 0 1px 3px rgba(0,0,0,.06);
  }
  td {
    border: 0; padding: 7px 12px; white-space: normal;
    display: flex; justify-content: space-between; gap: 14px;
  }
  td::before {
    content: attr(data-label); color: var(--sub); font-size: 13px;
    flex: 0 0 auto;
  }
}

/* 印字担当の名簿 */
#staffbtn {
  margin-left: auto; height: 42px; padding: 0 18px;
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  font: inherit; color: var(--text);
}
#reload { margin-left: 0; }

#staff {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
/* hidden を付けても、上の display:flex の方が強くて消えない。
   消えないと透明な膜が画面全体を覆い、どこを押しても反応しなくなる。 */
#staff[hidden] { display: none; }
.staffbox {
  background: var(--panel); border-radius: 16px; padding: 24px;
  width: min(420px, 100%); max-height: 82vh; overflow-y: auto;
}
.staffbox h2 { margin: 0 0 6px; font-size: 17px; }
.staffbox .hint { margin: 0 0 16px; color: var(--sub); font-size: 13px; }
#stafflist { list-style: none; margin: 0 0 16px; padding: 0; }
#stafflist li {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line);
}
#stafflist button {
  height: 38px; padding: 0 14px; border: 1px solid var(--line);
  background: #fff; border-radius: 8px; font: inherit; color: var(--soon);
}
#stafflist .none { color: var(--sub); border: 0; padding: 12px 0; }
.staffadd { display: flex; gap: 10px; }
.staffadd input {
  flex: 1; height: 44px; padding: 0 12px; font: inherit;
  border: 1px solid var(--line); border-radius: 10px;
}
.staffadd button {
  height: 44px; padding: 0 20px; border: 0; border-radius: 10px;
  background: var(--key); color: #fff; font: inherit; font-weight: 700;
}
.staffbox .close {
  width: 100%; height: 46px; margin-top: 18px; border: 1px solid var(--line);
  background: #fff; border-radius: 10px; font: inherit; color: var(--text);
}
td.who select {
  width: 100%; min-width: 120px; height: 36px; padding: 0 6px;
  font: inherit; border: 1px solid var(--line); border-radius: 8px;
  background: #fff;
}

/* メール通知の設定 */
#mailbtn {
  height: 42px; padding: 0 18px;
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  font: inherit; color: var(--text);
}
#mail {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#mail[hidden] { display: none; }
.mailbox {
  background: var(--panel); border-radius: 16px; padding: 24px;
  width: min(520px, 100%); max-height: 86vh; overflow-y: auto;
}
.mailbox h2 { margin: 0 0 6px; font-size: 17px; }
.mailbox .hint { margin: 0 0 18px; color: var(--sub); font-size: 13px; }
.mailrow { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.mailrow label { flex: 0 0 130px; color: var(--sub); font-size: 14px; }
.mailrow input, .mailrow select {
  flex: 1; height: 42px; padding: 0 12px; font: inherit;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
}
.mailon { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.mailon input { width: 22px; height: 22px; }
#mailmsg { margin: 12px 0 0; font-size: 14px; min-height: 1.3em; }
#mailmsg.ok { color: var(--done); font-weight: 700; }
#mailmsg.ng { color: var(--soon); font-weight: 700; }
.mailbtns { display: flex; gap: 10px; margin-top: 18px; }
.mailbtns button {
  flex: 1; height: 46px; border-radius: 10px; font: inherit;
  border: 1px solid var(--line); background: #fff; color: var(--text);
}
.mailbtns .save { border: 0; background: var(--key); color: #fff; font-weight: 700; }

/* ---- ログイン ---------------------------------------------------------- */
#login {
  position: fixed; inset: 0; background: var(--bg); z-index: 60;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
#login[hidden] { display: none; }
.loginbox {
  background: var(--panel); border-radius: 16px; padding: 30px 26px;
  width: min(400px, 100%); box-shadow: 0 2px 12px rgba(0,0,0,.08);
}
.loginbox h2 { margin: 0 0 6px; font-size: 20px; }
.loginbox .hint { margin: 0 0 18px; color: var(--sub); font-size: 13px; }
.loginbox .small { margin: 16px 0 0; font-size: 12px; }
.loginbox input {
  width: 100%; height: 52px; padding: 0 14px; font: inherit; font-size: 17px;
  border: 1px solid var(--line); border-radius: 10px;
}
.loginbox .go {
  width: 100%; height: 52px; margin-top: 16px; border: 0; border-radius: 10px;
  background: var(--key); color: #fff; font: inherit; font-size: 17px;
  font-weight: 700;
}
#loginmsg { margin: 12px 0 0; min-height: 1.3em; font-size: 14px; }
#loginmsg.ng { color: var(--soon); font-weight: 700; }

/* いま誰で入っているか */
#who { color: var(--sub); font-size: 13px; }
#logout, #keybtn, #orderlink {
  height: 42px; padding: 0 16px;
  border: 1px solid var(--line); background: #fff; border-radius: 10px;
  font: inherit; color: var(--text);
}
/* 店舗の入力画面へ。接客で使う画面なので、目立つ色にしておく */
#orderlink {
  display: inline-flex; align-items: center; text-decoration: none;
  border-color: var(--key); color: var(--key); font-weight: 700;
}

/* ---- 新着 -------------------------------------------------------------- */
#newbadge {
  height: 42px; padding: 0 16px; border: 0; border-radius: 10px;
  background: var(--soon); color: #fff; font: inherit; font-weight: 700;
  animation: newpulse 1.6s ease-in-out infinite;
}
#newbadge[hidden] { display: none; }
@keyframes newpulse { 0%,100% { opacity: 1; } 50% { opacity: .65; } }
tr.new td { background: #fff6dc; }
tr.new td:first-child { box-shadow: inset 4px 0 0 var(--soon); }
@media (max-width: 900px) {
  tr.new { box-shadow: inset 4px 0 0 var(--soon), 0 1px 3px rgba(0,0,0,.06); }
  tr.new td:first-child { box-shadow: none; }
}

/* ---- 図面のボタン ------------------------------------------------------ */
a.zumen {
  display: inline-block; margin: 1px 2px 1px 0; padding: 5px 10px;
  border: 1px solid var(--line); border-radius: 8px; background: #fff;
  color: var(--key); font-size: 12px; font-weight: 700; text-decoration: none;
}
a.zumen:active { background: #ececf0; }

/* ---- お店ごとの宛先 ---------------------------------------------------- */
#m_shops .mailrow label { font-size: 13px; }
#m_shops[hidden] { display: none; }

/* ---- メール設定の案内 -------------------------------------------------- */
.mailbox .step {
  margin: 20px 0 8px; font-weight: 700; font-size: 14px;
  padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.mailbox .note {
  margin: 6px 0 12px; color: var(--sub); font-size: 12.5px; line-height: 1.6;
}
.mailbox .note.tameshi {
  margin-top: 18px; padding: 10px 12px; background: #f2f7fb;
  border-radius: 8px; color: var(--text);
}
.mailbox details {
  margin: 4px 0 0; border: 1px solid var(--line); border-radius: 10px;
  padding: 0 12px;
}
.mailbox details summary {
  cursor: pointer; padding: 12px 0; font-size: 13px; color: var(--sub);
}
.mailbox details[open] summary { border-bottom: 1px solid var(--line); }
.mailbox details .mailrow { margin-top: 12px; }

.mailrow label.mini { flex: 1; color: var(--sub); font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.mailrow label.mini input { width: 18px; height: 18px; flex: 0 0 18px; }

/* 見出しのボタンは折り返さない（狭い画面では行ごと下に回る） */
header button { white-space: nowrap; }
