/* =========================================================
   サウンドクルー ヘルプデスク — 共通スタイル
   利用画面 (index.html) と管理画面 (admin/index.html) で共用。

   配色・原則は docs/06_デザイン指針.md（公式サイト enjoy.co.jp の実測色）に準拠。
     - 薄い色の上に薄い文字を置かない
     - 色付き地に白文字の吹き出しを使わない
     - 本文 17px / 行間 1.7 / 注釈も 14px 未満にしない
     - タップ領域 48px 以上
   スマホ優先。PC は max-width: 720px で中央寄せ（レイアウト切替なし）。
   ========================================================= */

/* ---------- カラートークン（ライト） ----------
   かっこ内は白地・カード地に対する実測コントラスト比。 */
:root {
  color-scheme: light;

  --c-bg: #ffffff;
  --c-bg-soft: #f4f4f4;          /* 帯・ゼブラ・出典カード */
  --c-surface: #ffffff;
  --c-text: #222222;             /* 本文 15.9:1 */
  --c-text-muted: #555555;       /* 補足 7.5:1 */
  --c-text-subtle: #6b6b6b;      /* 注釈 5.3:1（指針の #777 は 4.48:1 で不足のため微調整） */
  --c-border: #e3e7e6;
  --c-border-strong: #ccd4d2;

  --c-mint: #0ec9a4;             /* 第 1 アクセント（線・図形専用） */
  --c-mint-deep: #0aa98a;        /* 面として使うミント */
  --c-mint-ink: #0a7a63;         /* ミント系の文字色 5.3:1 */
  --c-mint-pale: #d6f7ef;
  --c-mint-tint: rgba(64, 242, 202, 0.12);
  --c-mint-soft-border: #b6ece0;

  --c-orange: #fb8e28;           /* 第 2 アクセント */
  --c-orange-ink: #331800;       /* オレンジ地の上の文字 6.5:1（白文字は 2.3:1 で不可） */
  --c-orange-pale: #fff3e6;
  --c-orange-line: #fb8e28;

  --c-navy: #0d2137;             /* 見出し・強い文字 16.3:1 */
  --c-link: #154fc1;             /* 7.2:1 */

  --c-error-bg: #fdecea;
  --c-error-text: #8a1c13;       /* 8.1:1 on --c-error-bg */
  --c-error-line: #e09b93;

  --c-ok-text: #1a6e3c;
  --c-ng-text: #a3281c;

  --c-step-bg: #d6f7ef;
  --c-step-text: #0a7a63;        /* 4.6:1 on --c-step-bg */

  --c-input-bg: #ffffff;
  --shadow-card: 0 1px 2px rgba(13, 33, 55, 0.06);
  --shadow-pop: 0 6px 20px rgba(13, 33, 55, 0.14);
  --focus-ring: 0 0 0 3px rgba(10, 122, 99, 0.45);

  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 10px;
  --tap: 48px;                   /* タップ領域の最小値 */
}

/* ---------- カラートークン（ダーク: システム設定に自動追従） ----------
   本文 4.5:1 以上・ボタン 3:1 以上を実測して確認済み。 */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;

    --c-bg: #121417;
    --c-bg-soft: #1c2024;
    --c-surface: #1c2024;
    --c-text: #f2f4f5;             /* 16.7:1 on 地 / 14.9:1 on カード */
    --c-text-muted: #aeb6bc;       /* 8.4:1 */
    --c-text-subtle: #9aa3aa;      /* 7.2:1 */
    --c-border: #2c3238;
    --c-border-strong: #3d454c;

    --c-mint: #0ec9a4;             /* 8.7:1 on 地 */
    --c-mint-deep: #0ec9a4;
    --c-mint-ink: #5fe3c5;         /* 11.1:1 */
    --c-mint-pale: rgba(14, 201, 164, 0.20);
    --c-mint-tint: rgba(14, 201, 164, 0.16);
    --c-mint-soft-border: rgba(14, 201, 164, 0.42);

    --c-orange: #ffa24d;           /* 9.3:1 on 地 */
    --c-orange-ink: #331800;       /* 7.6:1 on --c-orange */
    --c-orange-pale: #2e2318;
    --c-orange-line: #ffa24d;

    --c-navy: #f2f4f5;             /* ダークではネイビーの代わりに明るい文字 */
    --c-link: #8fb4ff;

    --c-error-bg: #3a1e1b;
    --c-error-text: #ffb4ac;       /* 9.0:1 on --c-error-bg */
    --c-error-line: #b8564a;

    --c-ok-text: #6fd79e;
    --c-ng-text: #ff9f95;

    --c-step-bg: rgba(14, 201, 164, 0.22);
    --c-step-text: #6fe8ca;

    --c-input-bg: #1c2024;
    --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.45);
    --shadow-pop: 0 6px 20px rgba(0, 0, 0, 0.6);
    --focus-ring: 0 0 0 3px rgba(95, 227, 197, 0.55);
  }
}

/* ---------- リセット ---------- */
* {
  box-sizing: border-box;
}

/* [hidden] は常に非表示（display:flex 等に負けないように） */
[hidden] {
  display: none !important;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
}

body {
  background: var(--c-bg);
  color: var(--c-text);
  font-family: "Noto Sans JP", -apple-system, BlinkMacSystemFont, "Hiragino Sans",
    "Hiragino Kaku Gothic ProN", "Yu Gothic", Meiryo, system-ui, sans-serif;
  font-size: 17px;      /* 本文 17px */
  line-height: 1.7;     /* 行間 1.7 */
  -webkit-text-size-adjust: 100%;
  overscroll-behavior-y: contain;
}

button, input, select, textarea {
  font-family: inherit;
  font-size: 17px;      /* iOS Safari の自動ズーム防止（16px 以上） */
  color: inherit;
}

button {
  cursor: pointer;
}

a {
  color: var(--c-link);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus-ring);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ---------- 共通ボタン ---------- */
.btn {
  min-height: var(--tap);
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 17px;
  font-weight: 700;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  line-height: 1.3;
  transition: filter 0.15s ease, background-color 0.15s ease;
}

.btn:active {
  filter: brightness(0.94);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
  pointer-events: none;
}

/* 主ボタン: オレンジ地 + 濃い文字（白文字は 2.3:1 しか出ないため使わない） */
.btn-primary {
  background: var(--c-orange);
  color: var(--c-orange-ink);
  border-color: var(--c-orange);
}

/* 副ボタン: 白地 + ミント枠 + ミントの濃い文字 */
.btn-secondary {
  background: var(--c-surface);
  color: var(--c-mint-ink);
  border-color: var(--c-mint-soft-border);
}

/* ヘッダー用のミント角丸ボタン */
.btn-ghost {
  background: var(--c-mint-pale);
  color: var(--c-mint-ink);
  border-color: var(--c-mint-soft-border);
  min-height: var(--tap);
  border-radius: 999px;
  font-size: 15px;
  padding: 0 14px;
}

.btn-icon {
  background: transparent;
  color: var(--c-text);
  width: var(--tap);
  min-height: var(--tap);
  padding: 0;
  font-size: 22px;
  border-radius: var(--radius-md);
  border-color: transparent;
}

.btn-block {
  width: 100%;
}

.btn-danger {
  background: var(--c-error-bg);
  color: var(--c-error-text);
  border-color: var(--c-error-line);
}

/* ---------- フォーム部品 ---------- */
.field {
  display: block;
  margin-bottom: 18px;
}

.field-label {
  display: block;
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--c-text);
}

select,
input[type="text"],
input[type="password"],
input[type="search"],
input[type="month"] {
  width: 100%;
  min-height: var(--tap);
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--c-border-strong);
  background: var(--c-input-bg);
  color: var(--c-text);
  appearance: none;
  -webkit-appearance: none;
}

select:focus,
input:focus,
textarea:focus {
  border-color: var(--c-mint-deep);
}

select {
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%),
    linear-gradient(135deg, currentColor 50%, transparent 50%);
  background-position: calc(100% - 20px) calc(50% + 1px), calc(100% - 15px) calc(50% + 1px);
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 38px;
}

input[type="checkbox"] {
  width: 22px;
  height: 22px;
  accent-color: var(--c-mint-deep);
}

::placeholder {
  color: var(--c-text-subtle);
  opacity: 1;
}

.error-text {
  color: var(--c-error-text);
  background: var(--c-error-bg);
  border-left: 4px solid var(--c-error-line);
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 15px;
  font-weight: 700;
  margin: 4px 0 14px;
}

.notice-text {
  color: var(--c-text-muted);
  font-size: 15px;
  margin: 4px 0 14px;
}

/* =========================================================
   利用者画面: ログイン / チャット
   ========================================================= */

.app-shell {
  height: 100vh;
  height: 100dvh;
  height: var(--app-height, 100dvh);
  max-width: 720px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  background: var(--c-bg);
}

@media (min-width: 721px) {
  .app-shell {
    border-left: 1px solid var(--c-border);
    border-right: 1px solid var(--c-border);
  }
}

.screen {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* --- ログイン画面 --- */
.login-screen {
  align-items: center;
  justify-content: center;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
  overflow-y: auto;
}

.login-card {
  width: 100%;
  max-width: 420px;
}

.brand-mark {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: var(--c-mint-deep);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  box-shadow: 0 4px 14px rgba(10, 169, 138, 0.28);
}

.brand-mark svg {
  width: 40px;
  height: 40px;
  display: block;
}

.app-title {
  font-size: 22px;
  line-height: 1.45;
  margin: 0 0 8px;
  color: var(--c-navy);
  font-weight: 700;
  text-align: center;
}

.app-sub {
  color: var(--c-text-muted);
  margin: 0 0 28px;
  font-size: 16px;
  text-align: center;
}

/* --- チャット画面: ヘッダー（白地・下に薄いグレーの線） --- */
.chat-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  padding-top: calc(8px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg);
}

.chat-header-info {
  min-width: 0;
}

.chat-store-name {
  font-weight: 700;
  font-size: 17px;
  line-height: 1.35;
  color: var(--c-navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-user-name {
  font-size: 14px;
  line-height: 1.4;
  color: var(--c-text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.menu-wrap {
  position: relative;
}

.menu-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  background: var(--c-surface);
  border: 1px solid var(--c-border-strong);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-pop);
  min-width: 170px;
  overflow: hidden;
  z-index: 30;
}

.menu-item {
  display: block;
  width: 100%;
  min-height: var(--tap);
  text-align: left;
  padding: 12px 18px;
  background: none;
  border: none;
  font-size: 17px;
  color: var(--c-text);
}

.menu-item:active {
  background: var(--c-bg-soft);
}

/* --- メッセージ一覧 --- */
.messages {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;                 /* 吹き出し間 12px */
}

.msg-row {
  display: flex;
  flex-direction: column;
  animation: fadeInUp 0.18s ease-out;
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}

.msg-row.user {
  align-items: flex-end;
}

.msg-row.ai {
  align-items: flex-start;
}

.bubble {
  max-width: 88%;
  padding: 14px 16px;        /* 吹き出し内 14〜16px */
  border-radius: var(--radius-lg);
  font-size: 17px;
  line-height: 1.7;
  word-break: break-word;
}

/* 利用者: 薄いミント地 + 濃い文字（白文字は使わない） */
.bubble.user {
  background: var(--c-mint-tint);
  color: var(--c-text);
  border: 1px solid var(--c-mint-soft-border);
  border-bottom-right-radius: 4px;
}

/* AI: 白地 + 薄いミントの枠線 */
.bubble.ai {
  background: var(--c-surface);
  color: var(--c-text);
  border: 1px solid var(--c-mint-pale);
  border-bottom-left-radius: 4px;
  box-shadow: var(--shadow-card);
}

@media (prefers-color-scheme: dark) {
  .bubble.ai {
    border-color: var(--c-mint-soft-border);
  }
}

/* 未回答: 薄いオレンジ地 + 左に太いオレンジの縦線 */
.bubble.warn {
  background: var(--c-orange-pale);
  color: var(--c-text);
  border: 1px solid var(--c-orange-line);
  border-left-width: 5px;
  border-radius: 6px var(--radius-lg) var(--radius-lg) 6px;
}

.bubble.error {
  background: var(--c-error-bg);
  color: var(--c-error-text);
  border: 1px solid var(--c-error-line);
  border-left-width: 5px;
  border-radius: 6px var(--radius-lg) var(--radius-lg) 6px;
  font-weight: 700;
}

.bubble p {
  margin: 0 0 10px;
}

.bubble p:last-child {
  margin-bottom: 0;
}

/* 回答の 1 行目（結論）は太字で少し大きく */
.bubble.ai .answer-lead {
  font-weight: 700;
  font-size: 18px;
  line-height: 1.6;
  color: var(--c-navy);
  margin-bottom: 12px;
}

.bubble ul {
  margin: 10px 0;
  padding-left: 1.3em;
}

.bubble ol {
  margin: 10px 0;
  padding-left: 1.3em;
}

.bubble ol:last-child,
.bubble ul:last-child {
  margin-bottom: 0;
}

.bubble li {
  margin-bottom: 6px;
}

.bubble li:last-child {
  margin-bottom: 0;
}

/* AI 回答の手順は丸数字風のマーク */
.bubble.ai ol {
  list-style: none;
  padding-left: 0;
  counter-reset: step;
}

.bubble.ai ol > li {
  counter-increment: step;
  position: relative;
  padding-left: 36px;
  margin-bottom: 10px;
}

.bubble.ai ol > li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 3px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--c-step-bg);
  color: var(--c-step-text);
  font-size: 15px;
  font-weight: 700;
  line-height: 26px;
  text-align: center;
}

.bubble strong {
  font-weight: 700;
}

.bubble img.msg-photo {
  display: block;
  max-width: 180px;
  max-height: 180px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  object-fit: cover;
  border: 1px solid var(--c-border);
}

/* 「考え中…」バブル */
.bubble.thinking {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 18px 18px;
}

.thinking-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--c-mint-deep);
  opacity: 0.35;
  animation: thinkingPulse 1.2s infinite ease-in-out;
}

.thinking-dot:nth-child(2) { animation-delay: 0.15s; }
.thinking-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes thinkingPulse {
  0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1); }
}

/* AI 回答の下: 出典カード・フィードバック */
.msg-meta {
  margin-top: 8px;
  max-width: 88%;
}

.msg-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.source-card {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-sm);
  padding: 7px 11px;
  font-size: 14px;
  line-height: 1.4;
  color: var(--c-text-muted);
  word-break: break-word;
}

.source-card .source-icon {
  flex-shrink: 0;
}

.feedback-row {
  display: flex;
  gap: 8px;
}

.feedback-btn {
  min-height: var(--tap);
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--c-border-strong);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 15px;
  font-weight: 600;
}

.feedback-btn.selected,
.feedback-btn:disabled {
  background: var(--c-bg-soft);
  color: var(--c-text-subtle);
  border-color: var(--c-border);
  pointer-events: none;
}

.retry-row {
  margin-top: 10px;
}

.retry-btn {
  min-height: var(--tap);
  padding: 0 16px;
  font-size: 16px;
}

/* --- 初回の空状態: よくある質問 --- */
.chat-empty {
  padding: 8px 2px 4px;
}

.chat-empty-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--c-navy);
  margin: 0 0 4px;
}

.chat-empty-sub {
  font-size: 15px;
  color: var(--c-text-muted);
  margin: 0 0 16px;
}

.faq-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--c-mint-ink);
  margin: 0 0 8px;
}

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.faq-btn {
  min-height: var(--tap);
  width: 100%;
  text-align: left;
  justify-content: flex-start;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--c-mint-soft-border);
  background: var(--c-surface);
  color: var(--c-text);
  font-size: 16px;
  font-weight: 600;
  line-height: 1.5;
  display: flex;
  align-items: center;
  gap: 10px;
}

.faq-btn::before {
  content: "";
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--c-mint-deep);
}

.faq-btn:active {
  background: var(--c-mint-tint);
}

/* --- 入力欄（下部固定） --- */
.composer {
  flex-shrink: 0;
  border-top: 1px solid var(--c-border);
  background: var(--c-bg);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
}

.image-preview-wrap {
  padding: 2px 4px 10px;
}

.image-preview {
  position: relative;
  display: inline-block;
}

.image-preview img {
  max-height: 88px;
  max-width: 88px;
  border-radius: var(--radius-sm);
  display: block;
  object-fit: cover;
  border: 1px solid var(--c-border-strong);
}

.image-remove-btn {
  position: absolute;
  top: -10px;
  right: -10px;
  width: 30px;
  height: 30px;
  min-height: 0;
  border-radius: 50%;
  background: var(--c-navy);
  color: #ffffff;
  border: 2px solid var(--c-bg);
  font-size: 16px;
  line-height: 1;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

@media (prefers-color-scheme: dark) {
  .image-remove-btn {
    background: #f2f4f5;
    color: #121417;
  }
}

.safety-line {
  margin: 8px 0 0;
  text-align: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--c-text-muted);
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 8px;
}

/* カメラ: 白地にミント枠 */
.composer-icon-btn {
  flex-shrink: 0;
  width: var(--tap);
  min-height: var(--tap);
  background: var(--c-surface);
  border: 1px solid var(--c-mint-soft-border);
  border-radius: var(--radius-md);
  font-size: 22px;
}

.composer-textarea {
  flex: 1;
  resize: none;
  max-height: 120px;
  min-height: var(--tap);
  padding: 12px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--c-border-strong);
  background: var(--c-input-bg);
  color: var(--c-text);
  font-size: 17px;
  line-height: 1.5;
  font-family: inherit;
}

/* 送信: オレンジ */
.composer-send-btn {
  flex-shrink: 0;
  min-width: 76px;
  border-radius: var(--radius-lg);
  padding: 0 16px;
}

/* =========================================================
   管理画面
   ========================================================= */

.admin-shell {
  max-width: 960px;
  margin: 0 auto;
  min-height: 100dvh;
  min-height: var(--app-height, 100dvh);
  display: flex;
  flex-direction: column;
}

.admin-login-screen {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 16px;
  padding-top: calc(10px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--c-border);
  background: var(--c-bg);
}

.admin-header h1 {
  font-size: 20px;
  margin: 0;
  color: var(--c-navy);
  font-weight: 700;
}

.admin-main {
  flex: 1;
  padding: 0 16px 40px;
  overflow-y: auto;
}

/* タブ: ミントの下線 */
.tabs {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 0;
  border-bottom: 1px solid var(--c-border);
  margin-bottom: 20px;
  position: sticky;
  top: 0;
  background: var(--c-bg);
  z-index: 5;
}

.tab-btn {
  flex-shrink: 0;
  min-height: var(--tap);
  padding: 0 14px;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--c-text-muted);
  font-size: 16px;
  font-weight: 700;
  border-radius: 0;
}

.tab-btn.active {
  color: var(--c-mint-ink);
  border-bottom-color: var(--c-mint-deep);
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

.panel-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--c-navy);
  margin: 4px 0 16px;
}

h3.panel-title {
  font-size: 17px;
}

.panel-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 16px;
  align-items: center;
}

.panel-toolbar select,
.panel-toolbar input {
  width: auto;
  min-width: 150px;
  flex: 1 1 170px;
}

.stat-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-bottom: 22px;
}

.stat-card {
  background: var(--c-surface);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  border: 1px solid var(--c-border);
  border-top: 3px solid var(--c-mint-deep);
}

.stat-card-label {
  font-size: 14px;
  color: var(--c-text-muted);
  margin-bottom: 2px;
}

.stat-card-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--c-navy);
  line-height: 1.3;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 16px;
}

thead th {
  text-align: left;
  padding: 12px 14px;
  background: var(--c-surface);
  color: var(--c-text);
  font-weight: 700;
  font-size: 15px;
  white-space: nowrap;
  border-bottom: 2px solid var(--c-mint-deep);
}

tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--c-border);
  vertical-align: middle;
  line-height: 1.6;
  /* 列が潰れて 1 文字ずつ縦に折れるのを防ぐ（狭いときは .table-wrap が横スクロール） */
  min-width: 112px;
}

/* 日時・操作の列は折り返さない */
tbody td:first-child,
tbody td:last-child {
  white-space: nowrap;
}

/* 未回答リストは列が多いので、文章の列に幅を確保して横スクロールさせる */
.table-unanswered {
  min-width: 880px;
}

.table-unanswered td:nth-child(4),
.table-unanswered td:nth-child(5) {
  min-width: 220px;
}

/* ゼブラ */
tbody tr:nth-child(even) td {
  background: var(--c-bg-soft);
}

tbody tr:last-child td {
  border-bottom: none;
}

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border-strong);
  color: var(--c-text-muted);
}

.pill-open {
  color: var(--c-text);
  background: var(--c-orange-pale);
  border-color: var(--c-orange-line);
}

.pill-done {
  color: var(--c-text-muted);
}

.pill-active {
  color: var(--c-ok-text);
  border-color: currentColor;
  background: transparent;
}

.pill-inactive {
  color: var(--c-ng-text);
  border-color: currentColor;
  background: transparent;
}

.empty-state {
  color: var(--c-text-muted);
  padding: 28px 8px;
  text-align: center;
  font-size: 16px;
}

td .empty-state {
  padding: 18px 8px;
}

.convo-item {
  border: 1px solid var(--c-border);
  border-left: 4px solid var(--c-mint-deep);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 12px;
  background: var(--c-surface);
}

.convo-item-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 14px;
  color: var(--c-text-muted);
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.convo-msg {
  font-size: 16px;
  padding: 8px 0;
  border-top: 1px solid var(--c-border);
}

.convo-msg:first-child {
  border-top: none;
}

.convo-msg .role-label {
  display: inline-block;
  font-weight: 700;
  font-size: 14px;
  margin-right: 8px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--c-bg-soft);
  border: 1px solid var(--c-border-strong);
  color: var(--c-text-muted);
}

.store-form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--c-border);
}

.store-form-row input[type="text"],
.store-form-row input[type="password"] {
  width: auto;
  flex: 1 1 150px;
  min-width: 130px;
}

.inline-label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  font-size: 16px;
  color: var(--c-text);
  white-space: nowrap;
}

.doc-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--c-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.doc-list li {
  padding: 12px 14px;
  border-bottom: 1px solid var(--c-border);
  font-size: 16px;
}

.doc-list li:nth-child(even) {
  background: var(--c-bg-soft);
}

.doc-list li:last-child {
  border-bottom: none;
}

.doc-title {
  font-weight: 700;
}

.doc-meta {
  color: var(--c-text-muted);
  font-size: 14px;
}

.section-gap {
  margin-top: 32px;
}
