/* 薬の注文表: スマホ向けの見た目 */
:root {
  --vb: 0px;
  --main: #2f7d6d;
  --main-soft: #e3f1ed;
  --danger: #c0473a;
  --ink: #222;
  --sub: #6b6b6b;
  --line: #e2e2e2;
  --bg: #f6f7f6;
}
* { box-sizing: border-box; }
/* 画面全体はスクロールさせず、#view だけをスクロールする（iPhone で固定部品が浮く対策） */
html, body { height: 100%; overflow: hidden; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", sans-serif;
  color: var(--ink); background: var(--bg); font-size: 16px;
  -webkit-text-size-adjust: 100%;
}
#view {
  height: 100%; overflow-y: auto; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch;
  padding: calc(env(safe-area-inset-top) + 12px) 14px calc(env(safe-area-inset-bottom) + 40px);
}
.screen { max-width: 560px; margin: 0 auto; }
h1 { font-size: 22px; margin: 24px 0 6px; }
.lead { color: var(--sub); margin: 0 0 16px; }
.small { font-size: 13px; color: var(--sub); }
.center { text-align: center; }
.err { color: var(--danger); font-size: 14px; min-height: 1em; margin: 6px 0 0; }

.card { background: #fff; border-radius: 14px; padding: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 14px; }
input, select {
  font-size: 17px; /* 16px 以上でないと iPhone が勝手に拡大する */
  width: 100%; padding: 11px 12px; border: 1px solid #ccc; border-radius: 10px; background: #fff; color: var(--ink);
}
select { width: auto; min-width: 7.5em; }
.row { display: flex; gap: 8px; align-items: center; }
.row input { flex: 1; }
.lbl { display: block; font-size: 13px; color: var(--sub); margin: 4px 0 4px; }
.lbl + * { margin-bottom: 10px; }

.btn {
  font-size: 16px; padding: 11px 16px; border-radius: 10px; border: 1px solid #ccc; background: #fff; color: var(--ink);
  white-space: nowrap;
}
.btn.primary { background: var(--main); border-color: var(--main); color: #fff; font-weight: 600; }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; font-weight: 600; }
.btn.wide { width: 100%; margin-top: 4px; }
#f-login .btn { width: 100%; margin-top: 10px; }
.link { background: none; border: none; color: var(--main); font-size: 14px; padding: 8px 4px; }

.names { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 8px; margin-bottom: 16px; }
.names button { font-size: 17px; padding: 14px 8px; border-radius: 12px; border: 1px solid var(--line); background: #fff; }
.names button:active { background: var(--main-soft); }

.top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.top .title { font-weight: 700; font-size: 18px; }
.who { background: var(--main-soft); color: var(--main); border: none; border-radius: 999px; padding: 6px 12px; font-size: 14px; }

.tabs { display: flex; background: #e9ecea; border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.tabs button { flex: 1; border: none; background: none; padding: 9px; border-radius: 10px; font-size: 15px; color: var(--sub); }
.tabs button.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

.suggest-wrap { position: relative; }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 2px); z-index: 5;
  background: #fff; border: 1px solid #ccc; border-radius: 10px; max-height: 260px; overflow-y: auto;
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
}
.suggest button {
  display: flex; justify-content: space-between; width: 100%; text-align: left; border: none; background: none;
  padding: 11px 12px; font-size: 16px; border-bottom: 1px solid var(--line); color: var(--ink);
}
.suggest button:last-child { border-bottom: none; }
.suggest .meta { color: var(--sub); font-size: 13px; margin-left: 8px; white-space: nowrap; }

.list-head { display: flex; justify-content: space-between; align-items: baseline; margin: 4px 2px 8px; font-weight: 600; }
.items { list-style: none; margin: 0 0 16px; padding: 0; }
.items li {
  background: #fff; border-radius: 12px; padding: 11px 12px; margin-bottom: 8px;
  display: flex; align-items: center; gap: 10px; box-shadow: 0 1px 2px rgba(0,0,0,.05);
}
.items .main { flex: 1; min-width: 0; }
.items .drug { font-size: 17px; font-weight: 600; word-break: break-all; }
.items .by { font-size: 13px; color: var(--sub); margin-top: 2px; }
.items .qty { font-size: 17px; font-weight: 700; white-space: nowrap; }
.items .del { border: none; background: #f1e3e1; color: var(--danger); border-radius: 8px; padding: 6px 9px; font-size: 14px; }
.items .add { border: none; background: var(--main-soft); color: var(--main); border-radius: 8px; padding: 6px 9px; font-size: 14px; white-space: nowrap; }
.empty { text-align: center; color: var(--sub); padding: 24px 0; }

.search { margin-bottom: 12px; }
.batch h3 { font-size: 15px; margin: 14px 2px 8px; color: var(--sub); }

.foot { display: flex; flex-wrap: wrap; gap: 6px 14px; justify-content: center; margin-top: 24px; border-top: 1px solid var(--line); padding-top: 10px; }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 24px - var(--vb));
  background: rgba(30,30,30,.92); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 15px; z-index: 20;
  max-width: 90vw;
}
