:root {
  --bg: #f5f3ef;
  --surface: #ffffff;
  --border: #e0dbd3;
  --text: #1a1814;
  --text2: #7a746c;
  --accent: #1d4ed8;
  --accent-bg: #eff6ff;
  --send: #15803d;
  --danger: #b91c1c;
  --bubble-out: #1d4ed8;
  --bubble-in: #f0ede8;
  --radius: 16px;
  --radius-sm: 10px;
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  overflow: hidden;
}

/* ヘッダー */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 14px 16px 12px;
  flex-shrink: 0;
}
.header-title {
  font-size: 17px; font-weight: 700; letter-spacing: -0.3px;
  display: flex; align-items: center; gap: 8px;
}

/* タブ */
.tabs {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex; overflow-x: auto; scrollbar-width: none;
  padding: 0 8px; flex-shrink: 0;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex-shrink: 0; padding: 12px 18px;
  font-size: 14px; font-weight: 500; color: var(--text2);
  border-bottom: 2.5px solid transparent;
  cursor: pointer; white-space: nowrap; background: none;
  border-left: none; border-right: none; border-top: none;
  transition: all 0.15s;
}
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* チャットエリア */
.chat-area {
  flex: 1; overflow-y: auto;
  padding: 16px 14px;
  display: flex; flex-direction: column; gap: 8px;
  min-height: 0;
}
.date-label {
  align-self: center; font-size: 11px; color: var(--text2);
  background: rgba(0,0,0,0.06); padding: 3px 12px;
  border-radius: 20px; margin: 4px 0;
}
.bubble-wrap { display: flex; flex-direction: column; }
.bubble-wrap.out { align-items: flex-end; }
.bubble-wrap.in  { align-items: flex-start; }
.store-name { font-size: 11px; color: var(--text2); margin-bottom: 3px; margin-left: 4px; }
.bubble {
  max-width: 82%; padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px; line-height: 1.6; word-break: break-all;
}
.bubble.out { background: var(--bubble-out); color: #fff; border-bottom-right-radius: 4px; }
.bubble.in  { background: var(--bubble-in); color: var(--text); border-bottom-left-radius: 4px; }
.bubble-time { font-size: 10px; color: var(--text2); margin-top: 3px; padding: 0 4px; }
.broadcast-badge {
  font-size: 10px; color: #fff; background: var(--accent);
  padding: 2px 8px; border-radius: 20px;
  margin-bottom: 3px; align-self: flex-end;
}
.empty {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 8px; color: var(--text2); padding: 40px 20px;
}
.empty svg { width: 48px; height: 48px; opacity: 0.3; }
.empty p { font-size: 13px; }

/* 入力エリア */
.input-area {
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 10px 12px;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  flex-shrink: 0;
}

/* OCRボタン */
.ocr-btn {
  width: 100%; padding: 12px;
  background: var(--accent-bg);
  border: 1.5px dashed #93c5fd;
  border-radius: var(--radius-sm);
  color: var(--accent); font-size: 14px; font-weight: 600;
  cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 8px; margin-bottom: 6px;
}
.ocr-btn:active { opacity: 0.7; }
.ocr-btn svg { width: 20px; height: 20px; flex-shrink: 0; }
.ocr-status {
  font-size: 12px; color: var(--text2);
  text-align: center; min-height: 16px; margin-bottom: 6px;
}
.ocr-status.loading { color: var(--accent); }
.ocr-status.error   { color: var(--danger); }

/* テキストエリア＋送信ボタン */
.compose {
  display: flex; gap: 8px; align-items: flex-end;
}
.compose textarea {
  flex: 1;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-size: 14px; font-family: inherit;
  color: var(--text); background: var(--surface);
  resize: none; min-height: 44px; max-height: 140px;
  line-height: 1.5; outline: none;
  transition: border-color 0.15s;
}
.compose textarea:focus { border-color: var(--accent); }
.btn-send {
  width: 44px; height: 44px; border-radius: 50%;
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.15s; color: #fff;
}
.btn-send:active { transform: scale(0.92); }
.btn-send svg { width: 18px; height: 18px; }
.btn-single { background: var(--send); }
.btn-all    { background: var(--accent); }

/* トースト */
.toast {
  position: fixed; bottom: 130px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1a1814; color: #fff;
  padding: 10px 20px; border-radius: 24px;
  font-size: 13px; opacity: 0;
  transition: all 0.25s; pointer-events: none;
  white-space: nowrap; z-index: 200;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
input[type="file"] { display: none; }