/* Matching Automation Portal - スタイル */

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0f1117;
  color: #e0e0e0;
  min-height: 100vh;
}

header {
  background: #1a1d2e;
  border-bottom: 1px solid #2a2d3e;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

header h1 {
  font-size: 20px;
  color: #7c8cf8;
  font-weight: 600;
}

#server-time {
  font-size: 12px;
  color: #888;
}

nav {
  background: #1a1d2e;
  padding: 0 24px;
  display: flex;
  gap: 4px;
  border-bottom: 1px solid #2a2d3e;
}

nav button {
  background: transparent;
  border: none;
  color: #888;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 3px solid transparent;
  transition: all 0.2s;
}

nav button:hover, nav button.active {
  color: #7c8cf8;
  border-bottom-color: #7c8cf8;
}

.tab-content { display: none; padding: 24px; }
.tab-content.active { display: block; }

h2 {
  font-size: 18px;
  color: #c0c0d0;
  margin-bottom: 16px;
  font-weight: 500;
}

/* カードグリッド */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.card {
  background: #1a1d2e;
  border: 1px solid #2a2d3e;
  border-radius: 8px;
  padding: 16px;
  text-align: center;
}

.card-label {
  font-size: 12px;
  color: #888;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.card-value {
  font-size: 28px;
  font-weight: 700;
  color: #7c8cf8;
}

.card-value.ok { color: #4caf50; }
.card-value.ng { color: #f44336; }

/* テーブル */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  background: #1a1d2e;
  color: #888;
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid #2a2d3e;
  font-weight: 500;
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr {
  border-bottom: 1px solid #1f2235;
  transition: background 0.15s;
}

tbody tr:hover { background: #1a1d2e; }

tbody td {
  padding: 10px 12px;
  color: #c0c0d0;
}

.score-high { color: #4caf50; font-weight: 600; }
.score-mid  { color: #ff9800; }
.score-low  { color: #f44336; }

.status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.status-match   { background: #1b5e20; color: #81c784; }
.status-date    { background: #0d47a1; color: #64b5f6; }
.status-like    { background: #4a148c; color: #ce93d8; }
.status-cand    { background: #1a1a1a; color: #888; }
.status-fadeout { background: #3e1010; color: #ef9a9a; }

/* ボタン */
.btn-primary {
  background: #7c8cf8;
  color: #fff;
  border: none;
  padding: 8px 18px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: opacity 0.2s;
}

.btn-primary:hover { opacity: 0.85; }

.btn-action {
  background: #1a1d2e;
  color: #c0c0d0;
  border: 1px solid #2a2d3e;
  padding: 8px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  transition: all 0.2s;
}

.btn-action:hover {
  border-color: #7c8cf8;
  color: #7c8cf8;
}

.btn-chat {
  background: transparent;
  color: #7c8cf8;
  border: 1px solid #7c8cf8;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.btn-close {
  background: #2a2d3e;
  color: #c0c0d0;
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
  margin-top: 12px;
}

/* アクショングリッド */
.action-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

/* フィルターバー */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
}

.filter-bar select {
  background: #1a1d2e;
  color: #c0c0d0;
  border: 1px solid #2a2d3e;
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 14px;
}

.filter-bar button {
  background: #2a2d3e;
  color: #c0c0d0;
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  cursor: pointer;
}

/* 結果ボックス */
.result-box {
  background: #1a1d2e;
  border: 1px solid #2a2d3e;
  border-radius: 6px;
  padding: 12px 16px;
  margin-top: 12px;
  font-size: 13px;
  color: #c0c0d0;
  white-space: pre-wrap;
  word-break: break-all;
}

/* コマンドフォーム */
.command-form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.command-form input {
  background: #1a1d2e;
  color: #e0e0e0;
  border: 1px solid #2a2d3e;
  border-radius: 4px;
  font-size: 14px;
}

.command-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  color: #888;
}

.command-presets button {
  background: #2a2d3e;
  color: #c0c0d0;
  border: none;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

/* モーダル */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

#modal-content {
  background: #1a1d2e;
  border: 1px solid #2a2d3e;
  border-radius: 10px;
  width: 90%;
  max-width: 560px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  padding: 20px;
}

#modal-header {
  font-size: 16px;
  font-weight: 600;
  color: #c0c0d0;
  margin-bottom: 12px;
}

#chat-messages {
  flex: 1;
  overflow-y: auto;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 40vh;
}

.msg-bubble {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  max-width: 85%;
  word-break: break-all;
}

.msg-me {
  background: #3a3d6e;
  color: #d0d0ff;
  align-self: flex-end;
}

.msg-partner {
  background: #2a2d3e;
  color: #c0c0d0;
  align-self: flex-start;
}

.msg-time {
  font-size: 10px;
  color: #666;
  margin-top: 2px;
}

#send-area {
  display: flex;
  gap: 8px;
}

#send-input {
  flex: 1;
  background: #0f1117;
  color: #e0e0e0;
  border: 1px solid #2a2d3e;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
}

/* KPIカード */
.kpi-app-section { margin-bottom: 20px; }
.kpi-app-title {
  font-size: 14px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 10px;
  font-weight: 600;
}

/* QA管理タブ */
.qa-item {
  background: #1a1d2e;
  border: 1px solid #2a2d3e;
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 8px;
}

.qa-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.qa-triggers {
  font-size: 13px;
  color: #7c8cf8;
  font-weight: 600;
}

.qa-answer {
  font-size: 13px;
  color: #c0c0d0;
  white-space: pre-wrap;
  word-break: break-all;
}

.btn-qa-del {
  background: transparent;
  color: #f44336;
  border: 1px solid #f44336;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
  flex-shrink: 0;
}

/* 関係観プロフィール */
.rel-field-label {
  font-size: 12px;
  color: #888;
  margin-bottom: 6px;
  font-weight: 500;
}

.rel-textarea {
  width: 100%;
  background: #1a1d2e;
  color: #e0e0e0;
  border: 1px solid #2a2d3e;
  border-radius: 6px;
  padding: 10px;
  font-size: 14px;
  resize: vertical;
  line-height: 1.6;
}

.rel-textarea:focus {
  outline: none;
  border-color: #7c8cf8;
}

/* 設定タブ */
.settings-section {
  background: #1a1d2e;
  border: 1px solid #2a2d3e;
  border-radius: 8px;
  padding: 16px 20px;
  margin-bottom: 16px;
}

.settings-section-title {
  font-size: 13px;
  font-weight: 600;
  color: #7c8cf8;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 14px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 600px) {
  .settings-grid { grid-template-columns: 1fr; }
}

.settings-field { display: flex; flex-direction: column; gap: 6px; }

.settings-label {
  font-size: 12px;
  color: #888;
  font-weight: 500;
}

.settings-input {
  background: #0f1117;
  color: #e0e0e0;
  border: 1px solid #2a2d3e;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  width: 100%;
}

.settings-input:focus {
  outline: none;
  border-color: #7c8cf8;
}

/* 好き理由ボタン */
.btn-like-reason {
  background: transparent;
  color: #ff9800;
  border: 1px solid #ff9800;
  padding: 4px 10px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
  margin-left: 6px;
}

.btn-like-reason:hover { background: rgba(255,152,0,0.1); }

/* 好き理由モーダル */
#lr-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1100;
}

#lr-modal-content {
  background: #1a1d2e;
  border: 1px solid #ff9800;
  border-radius: 12px;
  width: 90%;
  max-width: 520px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.lr-modal-header {
  font-size: 15px;
  font-weight: 600;
  color: #ff9800;
}

.lr-modal-label {
  font-size: 12px;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.lr-modal-reply {
  background: #0f1117;
  border: 1px solid #2a2d3e;
  border-radius: 8px;
  padding: 16px;
  font-size: 15px;
  color: #e0e0e0;
  line-height: 1.7;
  min-height: 80px;
  white-space: pre-wrap;
  word-break: break-all;
}

.lr-modal-note {
  font-size: 12px;
  color: #666;
}

.lr-modal-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* 掘り下げ想定 */
.lr-followup-item {
  background: #0f1117;
  border: 1px solid #2a2d3e;
  border-radius: 6px;
  padding: 12px 14px;
  margin-bottom: 8px;
  position: relative;
}

.lr-followup-q {
  font-size: 12px;
  color: #ff9800;
  font-weight: 600;
  margin-bottom: 6px;
}

.lr-followup-a {
  font-size: 14px;
  color: #e0e0e0;
  line-height: 1.6;
  padding-right: 60px;
  white-space: pre-wrap;
  word-break: break-all;
}

.lr-followup-copy {
  position: absolute;
  top: 10px;
  right: 10px;
  background: transparent;
  color: #7c8cf8;
  border: 1px solid #7c8cf8;
  padding: 2px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 11px;
}
