/* 実食メモ — 白基調・暖色（内見ナビの青と区別する） */
:root {
  --bg: #faf6f1;
  --card: #ffffff;
  --text: #2a2118;
  --sub: #6b5d50;
  --line: #e6dcd1;
  --accent: #c2410c;
  --accent2: #9a3412;
  --grad: linear-gradient(135deg, #c2410c, #9a3412);
  --danger: #b91c1c;
  --ok: #15803d;
  --star: #d97706;
}
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}
button, input, textarea { font-family: inherit; font-size: 16px; color: inherit; }
button { cursor: pointer; }
input, textarea { -webkit-appearance: none; appearance: none; }

/* ヘッダー */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
}
.brand { font-weight: 800; font-size: 18px; color: var(--accent); flex: 1; }
.back-btn { border: 0; background: none; color: var(--accent); font-weight: 700; font-size: 17px; padding: 4px 0; }
.sync-badge { font-size: 12px; color: var(--sub); white-space: nowrap; }
.sync-badge.pending { color: var(--accent); font-weight: 700; }
.sync-badge.error { color: var(--danger); font-weight: 700; }

/* 共通 */
.view { padding: 14px; max-width: 640px; margin: 0 auto; }
.primary-btn {
  border: 0; border-radius: 12px; padding: 12px 16px;
  background: var(--grad); color: #fff; font-weight: 700;
}
.secondary-btn {
  border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px;
  background: var(--card); color: var(--accent); font-weight: 700;
}
.danger-btn {
  border: 1px solid #f3c7c7; border-radius: 12px; padding: 12px 16px;
  background: #fff5f5; color: var(--danger); font-weight: 700;
}
.text-btn { border: 0; background: none; color: var(--accent); font-weight: 700; padding: 6px 4px; }
.wide { width: 100%; display: block; }
.big { font-size: 17px; padding: 14px; }
.empty { color: var(--sub); text-align: center; padding: 40px 10px; line-height: 1.8; }
.hint { color: var(--sub); font-size: 13px; line-height: 1.7; margin-top: 12px; }
.foot-note { text-align: center; margin-top: 30px; }

/* ログイン */
.login-wrap { position: fixed; inset: 0; z-index: 50; background: var(--bg); display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 28px 22px; width: 100%; max-width: 360px; }
.login-card h1 { color: var(--accent); font-size: 22px; margin-bottom: 6px; }
.login-card p { color: var(--sub); font-size: 14px; margin-bottom: 16px; }
.login-card input[type="password"] { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.login-error { color: var(--danger); font-size: 13px; min-height: 18px; margin-bottom: 8px; }

/* 訪問一覧 */
.visit-list { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.visit-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 12px 14px; display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
}
.visit-card .thumb { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; background: #eee; flex: none; }
.visit-card .thumb.none { display: flex; align-items: center; justify-content: center; color: var(--sub); font-size: 22px; }
.visit-card .meta { flex: 1; min-width: 0; }
.visit-card .name { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.visit-card .name.blank { color: var(--sub); font-weight: 500; }
.visit-card .sub { color: var(--sub); font-size: 13px; margin-top: 3px; }
.visit-card .chev { color: var(--sub); font-size: 20px; }

/* 訪問ページ */
.visit-head { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; margin-bottom: 10px; }
.v-name { width: 100%; border: 0; border-bottom: 1px solid var(--line); padding: 8px 2px; font-size: 18px; font-weight: 800; background: transparent; }
.v-name::placeholder { font-weight: 500; color: #b8aa9c; }
.v-row { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.v-date { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: var(--card); font-size: 15px; }
.v-count { color: var(--sub); font-size: 13px; }

.tabs { display: flex; gap: 4px; margin-bottom: 12px; overflow-x: auto; }
.tab {
  border: 1px solid var(--line); background: var(--card); color: var(--sub);
  padding: 8px 12px; border-radius: 999px; font-size: 14px; font-weight: 700; white-space: nowrap; flex: 1;
}
.tab.active { background: var(--accent); border-color: var(--accent); color: #fff; }

/* 料理カード */
.dish-list { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.dish-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px;
  padding: 10px 12px; display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left;
}
.dish-card .thumb { width: 72px; height: 72px; border-radius: 10px; object-fit: cover; background: #f0e9e1; flex: none; }
.dish-card .thumb.none { display: flex; align-items: center; justify-content: center; color: #b8aa9c; font-size: 24px; }
.dish-card .body { flex: 1; min-width: 0; }
.dish-card .title { display: flex; align-items: center; gap: 6px; }
.dish-card .name { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; }
.dish-card .name.blank { color: var(--sub); font-weight: 500; }
.dish-card .star { color: var(--star); font-size: 18px; }
.dish-card .price { color: var(--accent); font-weight: 700; font-size: 14px; margin-top: 2px; }
.dish-card .comment { color: var(--sub); font-size: 13px; margin-top: 4px; line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.dish-card .badge { display: inline-block; font-size: 11px; color: var(--sub); border: 1px solid var(--line); border-radius: 999px; padding: 1px 7px; margin-top: 4px; }

/* 写真タブ */
.photo-actions { display: flex; gap: 10px; }
.photo-actions .photo-btn { flex: 1; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 12px; }
.photo-grid img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; background: #eee; display: block; }
.photo-grid .ph { position: relative; }
.photo-grid .ph.pending::after {
  content: "未送信"; position: absolute; right: 4px; bottom: 4px; font-size: 10px;
  background: rgba(194, 65, 12, .9); color: #fff; border-radius: 6px; padding: 1px 5px;
}

/* 店メモ */
.memo { width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--card); line-height: 1.7; margin-top: 8px; }
.danger-zone { margin-top: 24px; display: flex; flex-direction: column; gap: 10px; }

/* チップ */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 6px; }
.chip {
  border: 1px solid var(--line); background: var(--card); color: var(--accent);
  border-radius: 999px; padding: 5px 10px; font-size: 13px; font-weight: 700;
}
.chip:active { background: #fdece4; }

/* 料理シート */
.sheet { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: flex; flex-direction: column; }
.sheet-head {
  display: flex; align-items: center; gap: 8px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.sheet-title { flex: 1; text-align: center; font-weight: 800; }
.star-btn { border: 0; background: none; font-size: 26px; color: #c9bdb0; padding: 0 4px; line-height: 1; }
.star-btn.on { color: var(--star); }
.sheet-body { flex: 1; overflow-y: auto; padding: 14px; max-width: 640px; width: 100%; margin: 0 auto; padding-bottom: calc(30px + env(safe-area-inset-bottom)); }
.photo-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 10px; min-height: 8px; }
.photo-strip .ph { position: relative; flex: none; }
.photo-strip img { width: 110px; height: 110px; object-fit: cover; border-radius: 12px; background: #eee; display: block; }
.photo-strip .ph.pending::after {
  content: "未送信"; position: absolute; right: 4px; bottom: 4px; font-size: 10px;
  background: rgba(194, 65, 12, .9); color: #fff; border-radius: 6px; padding: 1px 5px;
}
.fld { display: block; margin-top: 16px; }
.fld > span { display: block; font-size: 13px; color: var(--sub); font-weight: 700; margin-bottom: 6px; }
.fld input[type="text"], .fld textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 12px; padding: 12px; background: var(--card); line-height: 1.6;
}
.price-wrap { display: flex; align-items: center; gap: 8px; }
.price-wrap input { flex: 1; font-size: 20px; font-weight: 700; text-align: right; }
.yen { color: var(--sub); }
.sheet-foot { display: flex; gap: 8px; margin-top: 24px; }
.sheet-foot button { flex: 1; padding: 12px 8px; }

/* ビューア */
.viewer { position: fixed; inset: 0; z-index: 40; background: #000; display: flex; align-items: center; justify-content: center; }
.viewer img { max-width: 100%; max-height: 100%; object-fit: contain; }
.viewer-top {
  position: absolute; top: 0; left: 0; right: 0; display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: linear-gradient(rgba(0,0,0,.6), transparent);
}
.viewer-btn { border: 0; background: rgba(255,255,255,.15); color: #fff; font-weight: 700; padding: 8px 12px; border-radius: 10px; }
.viewer-btn.danger { background: rgba(185, 28, 28, .8); }
.viewer-pos { color: #fff; font-size: 13px; }
.viewer-right { display: flex; gap: 8px; }
.viewer-nav {
  position: absolute; top: 50%; transform: translateY(-50%); border: 0; background: rgba(255,255,255,.15); color: #fff;
  font-size: 28px; width: 44px; height: 60px; border-radius: 10px;
}
.viewer-nav.left { left: 8px; } .viewer-nav.right { right: 8px; }

/* カメラロール保存バー */
.roll-bar {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 55;
  display: flex; gap: 8px; align-items: center;
  background: #2a2118; padding: 8px; border-radius: 16px; box-shadow: 0 6px 20px rgba(0,0,0,.25);
}
.roll-bar .primary-btn { flex: 1; }
.roll-dismiss { border: 0; background: rgba(255,255,255,.12); color: #fff; width: 40px; height: 40px; border-radius: 12px; font-size: 16px; flex: none; }
.roll-hint { font-size: 12px; }

/* トースト */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #2a2118; color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 60;
  max-width: calc(100% - 32px); text-align: center;
}
.toast.error { background: var(--danger); }
.has-roll-bar .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }
