:root {
  --help-bg: #f3f7fb;
  --help-panel: #ffffff;
  --help-panel-soft: #f8fbff;
  --help-line: #dbe5f0;
  --help-line-strong: #c7d5e5;
  --help-text: #17212b;
  --help-muted: #6b7a8c;
  --help-primary: #2563eb;
  --help-primary-hover: #1d4ed8;
  --help-success-bg: #ecfdf5;
  --help-success-border: #a7f3d0;
  --help-success-text: #047857;
  --help-error-bg: #fef2f2;
  --help-error-border: #fecaca;
  --help-error-text: #b91c1c;
  --help-warning-bg: #fff7ed;
  --help-warning-border: #fed7aa;
  --help-warning-text: #c2410c;
  --help-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  --help-radius-xl: 24px;
  --help-radius-lg: 16px;
  --help-radius-md: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Yu Gothic UI", "Meiryo", sans-serif;
  color: var(--help-text);
  background:
    radial-gradient(circle at top left, #dbeafe 0, transparent 24%),
    radial-gradient(circle at top right, #e0f2fe 0, transparent 20%),
    linear-gradient(180deg, #f8fbff 0%, #eef4f9 100%);
  min-height: 100vh;
}

.help-page {
  max-width: 1220px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

.help-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.help-top-links {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.help-top-links a {
  display: inline-flex;
  align-items: center;
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid var(--help-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--help-text);
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(15, 23, 42, 0.04);
}

.help-logout-button {
  min-width: 120px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid var(--help-line-strong);
  border-radius: 12px;
  background: #ffffff;
  color: var(--help-text);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}

.help-hero-card {
  margin-bottom: 18px;
  padding: 28px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 28px;
  background: linear-gradient(135deg, rgba(255,255,255,0.94), rgba(255,255,255,0.82));
  box-shadow: var(--help-shadow);
}

.help-hero-eyebrow {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 12px;
  margin-bottom: 14px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--help-primary);
  font-size: 13px;
  font-weight: 700;
}

.help-hero-title {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.15;
  letter-spacing: 0.02em;
}

.help-hero-description {
  margin: 0;
  color: var(--help-muted);
  font-size: 15px;
  line-height: 1.8;
}

.help-notice-card {
  margin-bottom: 20px;
  padding: 16px 18px;
  border: 1px solid var(--help-warning-border);
  border-radius: 18px;
  background: var(--help-warning-bg);
  color: var(--help-warning-text);
}

.help-notice-card strong {
  display: block;
  margin-bottom: 6px;
  font-size: 15px;
}

.help-notice-card p {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
}

.help-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.help-chat-card,
.help-side-card {
  background: var(--help-panel);
  border: 1px solid var(--help-line);
  border-radius: var(--help-radius-xl);
  box-shadow: var(--help-shadow);
  padding: 20px;
}

.help-side-card {
  position: sticky;
  top: 20px;
}

.help-card-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.help-card-header h2 {
  margin: 0;
  font-size: 24px;
}

.help-card-header p {
  margin: 6px 0 0;
  color: var(--help-muted);
  font-size: 13px;
  line-height: 1.7;
}

.help-chat-area {
  height: 440px;
  overflow-y: auto;
  padding: 16px;
  border: 1px solid var(--help-line);
  border-radius: 18px;
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.help-message {
  max-width: 84%;
  margin-bottom: 14px;
}

.help-message-label {
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
  color: var(--help-muted);
}

.help-message-body {
  padding: 14px 16px;
  border-radius: 16px;
  font-size: 14px;
  line-height: 1.8;
  white-space: normal;
  overflow-wrap: anywhere;
}

.help-message-bot {
  margin-right: auto;
}

.help-message-bot .help-message-body {
  border: 1px solid var(--help-line);
  background: #ffffff;
}

.help-message-user {
  margin-left: auto;
}

.help-message-user .help-message-label {
  text-align: right;
}

.help-message-user .help-message-body {
  background: linear-gradient(135deg, var(--help-primary), #3b82f6);
  color: #ffffff;
}

.help-answer-box {
  display: grid;
  gap: 10px;
}

.help-answer-badge {
  display: inline-flex;
  justify-self: start;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.help-answer-badge.is-faq {
  background: var(--help-success-bg);
  border: 1px solid var(--help-success-border);
  color: var(--help-success-text);
}

.help-answer-badge.is-unanswered {
  background: var(--help-warning-bg);
  border: 1px solid var(--help-warning-border);
  color: var(--help-warning-text);
}

.help-answer-text {
  font-size: 14px;
  line-height: 1.8;
}

.help-answer-meta {
  color: var(--help-muted);
  font-size: 12px;
}

.help-related-link-wrap {
  margin-top: 4px;
}

.help-related-link {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--help-primary);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.help-related-link:hover {
  background: #dbeafe;
}

.help-input-area {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--help-line);
  border-radius: 18px;
  background: var(--help-panel-soft);
}

.help-question-input {
  width: 100%;
  min-height: 86px;
  resize: vertical;
  padding: 12px 14px;
  border: 1px solid var(--help-line-strong);
  border-radius: 14px;
  background: #ffffff;
  color: var(--help-text);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.6;
  outline: none;
}

.help-question-input:focus {
  border-color: var(--help-primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.help-question-input:disabled {
  background: #f1f5f9;
  cursor: not-allowed;
}

.help-input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
}

.help-count {
  color: var(--help-muted);
  font-size: 13px;
  font-weight: 700;
}

.help-count.is-warning {
  color: var(--help-warning-text);
}

.help-primary-button {
  min-width: 140px;
  min-height: 46px;
  padding: 0 18px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--help-primary), #3b82f6);
  color: #ffffff;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.24);
}

.help-primary-button:hover {
  background: linear-gradient(135deg, var(--help-primary-hover), #2563eb);
}

.help-primary-button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  box-shadow: none;
}

.help-secondary-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--help-line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--help-text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.help-faq-list {
  display: grid;
  gap: 10px;
}

.help-faq-button {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--help-line);
  border-radius: 16px;
  background: #ffffff;
  color: var(--help-text);
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.16s ease;
}

.help-faq-button:hover {
  background: #f8fbff;
  border-color: var(--help-line-strong);
  transform: translateY(-1px);
}

.help-faq-button strong {
  display: block;
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.5;
}

.help-faq-button small {
  display: block;
  margin-top: 8px;
  color: var(--help-muted);
  font-size: 12px;
  line-height: 1.5;
}

.help-faq-category {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--help-primary);
  font-size: 11px;
  font-weight: 800;
}

.help-empty {
  padding: 18px;
  border: 1px solid var(--help-line);
  border-radius: 16px;
  background: #ffffff;
  color: var(--help-muted);
  font-size: 14px;
  line-height: 1.7;
}

.help-empty.is-error {
  border-color: var(--help-error-border);
  background: var(--help-error-bg);
  color: var(--help-error-text);
}

.result,
.error,
.warning {
  margin-top: 16px;
  padding: 14px 16px;
  border-radius: 14px;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.7;
}

.result {
  background: var(--help-success-bg);
  border: 1px solid var(--help-success-border);
  color: var(--help-success-text);
}

.error {
  background: var(--help-error-bg);
  border: 1px solid var(--help-error-border);
  color: var(--help-error-text);
}

.warning {
  background: var(--help-warning-bg);
  border: 1px solid var(--help-warning-border);
  color: var(--help-warning-text);
}

@media (max-width: 960px) {
  .help-layout {
    grid-template-columns: 1fr;
  }

  .help-side-card {
    position: static;
  }

  .help-chat-area {
    height: 380px;
  }
}

@media (max-width: 640px) {
  .help-page {
    padding: 20px 14px 36px;
  }

  .help-hero-card {
    padding: 22px 18px;
    border-radius: 22px;
  }

  .help-hero-title {
    font-size: 28px;
  }

  .help-card-header {
    align-items: stretch;
    flex-direction: column;
  }

  .help-message {
    max-width: 100%;
  }

  .help-input-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .help-primary-button {
    width: 100%;
  }

  .help-topbar {
    align-items: stretch;
  }

  .help-top-links {
    width: 100%;
  }

  .help-top-links a {
    flex: 1;
    justify-content: center;
  }

  .help-logout-button {
    width: 100%;
  }
}

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

.help-admin-layout {
  display: grid;
  grid-template-columns: 400px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.help-admin-form-card,
.help-admin-table-card {
  background: var(--help-panel);
  border: 1px solid var(--help-line);
  border-radius: var(--help-radius-xl);
  box-shadow: var(--help-shadow);
  padding: 20px;
}

.help-admin-form-card {
  position: sticky;
  top: 20px;
}

.help-form-section {
  padding: 14px;
  border: 1px solid var(--help-line);
  border-radius: 18px;
  background: var(--help-panel-soft);
}

.help-form-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.help-form-grid label,
.help-filter-grid label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 800;
  color: #334155;
}

.help-required-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  min-height: 22px;
  padding: 0 8px;
  margin-left: 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  background: #dbeafe;
  color: #1d4ed8;
}

.help-input,
.help-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--help-line-strong);
  border-radius: 12px;
  background: #ffffff;
  color: var(--help-text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
}

.help-input {
  min-height: 42px;
}

.help-textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.6;
}

.help-input:focus,
.help-textarea:focus {
  border-color: var(--help-primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.help-field-note {
  margin: 6px 0 0;
  color: var(--help-muted);
  font-size: 12px;
  line-height: 1.6;
}

.help-submit-area {
  margin-top: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.help-table-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.help-table-header h2 {
  margin: 0;
  font-size: 24px;
}

.help-table-header p {
  margin: 6px 0 0;
  color: var(--help-muted);
  font-size: 13px;
  line-height: 1.7;
}

.help-filter-card {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--help-line);
  border-radius: 18px;
  background: var(--help-panel-soft);
}

.help-filter-grid {
  display: grid;
  grid-template-columns: 200px minmax(220px, 1fr) 150px auto;
  gap: 12px;
  align-items: end;
}

.help-filter-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.help-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--help-line);
  border-radius: 18px;
  background: #ffffff;
}

.help-admin-table {
  width: 100%;
  min-width: 980px;
  border-collapse: separate;
  border-spacing: 0;
}

.help-admin-table th,
.help-admin-table td {
  border-bottom: 1px solid var(--help-line);
  padding: 12px 10px;
  text-align: left;
  vertical-align: middle;
  font-size: 14px;
  line-height: 1.5;
}

.help-admin-table th {
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.help-admin-table tr:last-child td {
  border-bottom: none;
}

.help-admin-table tr.is-inactive {
  background: #f8fafc;
  color: #64748b;
}

.help-id-col {
  width: 64px;
  text-align: center;
  white-space: nowrap;
}

.help-question-col {
  min-width: 280px;
}

.help-number-col {
  width: 88px;
  text-align: right;
  white-space: nowrap;
}

.help-action-col {
  width: 180px;
}

.help-table-subtext {
  margin-top: 6px;
  color: var(--help-muted);
  font-size: 12px;
  line-height: 1.5;
}

.help-category-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--help-primary);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.help-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  min-width: 56px;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.help-status-active {
  background: var(--help-success-bg);
  border: 1px solid var(--help-success-border);
  color: var(--help-success-text);
}

.help-status-inactive {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  color: #64748b;
}

.help-action-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.help-danger-button {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--help-error-border);
  border-radius: 10px;
  background: #fff5f5;
  color: var(--help-error-text);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.help-danger-button:hover {
  background: var(--help-error-bg);
}

.help-muted-text {
  color: var(--help-muted);
}

@media (max-width: 1100px) {
  .help-admin-layout {
    grid-template-columns: 1fr;
  }

  .help-admin-form-card {
    position: static;
  }

  .help-filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .help-filter-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .help-filter-grid {
    grid-template-columns: 1fr;
  }

  .help-filter-actions {
    flex-direction: column;
  }

  .help-filter-actions .help-secondary-button,
  .help-submit-area .help-primary-button,
  .help-submit-area .help-secondary-button {
    width: 100%;
  }

  .help-admin-form-card,
  .help-admin-table-card {
    padding: 16px;
  }
}

/* =========================================================
   質問ログ一覧画面
========================================================= */

.help-chat-logs-filter-grid {
  display: grid;
  grid-template-columns: 180px 180px 180px auto;
  gap: 12px;
  align-items: end;
}

.help-chat-log-question-col {
  min-width: 320px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.7;
}

.help-chat-log-faq-col {
  min-width: 260px;
  white-space: normal;
  overflow-wrap: anywhere;
  line-height: 1.7;
}

.help-chat-logs-table {
  min-width: 1080px;
}

@media (max-width: 900px) {
  .help-chat-logs-filter-grid {
    grid-template-columns: 1fr 1fr;
  }

  .help-chat-logs-filter-grid .help-filter-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .help-chat-logs-filter-grid {
    grid-template-columns: 1fr;
  }

  .help-chat-logs-filter-grid .help-filter-actions {
    flex-direction: column;
  }

  .help-chat-logs-filter-grid .help-filter-actions .help-secondary-button {
    width: 100%;
  }
}