/* =============================================================
   Ropplen Harassment — Application Styles
   design-system.css のトークンを正とし、旧変数名はエイリアスで維持。
   ダークモードは廃止（ライトモード固定）。全画面 <html data-theme="light">。
   ============================================================= */

/* ---------- Token Aliases (旧変数 → Design System) ---------- */
:root {
  color-scheme: light;
  /* Background / Surface */
  --bg:               var(--color-bg-base);
  --bg-subtle:        var(--color-bg-subtle);
  --surface:          var(--color-bg-surface);
  --surface-solid:    var(--color-bg-surface-solid);
  --surface-elevated: var(--color-bg-surface);
  --hover:            var(--color-bg-hover);
  --selected:         var(--color-bg-selected);
  --pressed:          var(--color-bg-pressed);
  /* Text */
  --text:           var(--color-text-primary);
  --text-secondary: var(--color-text-secondary);
  --text-tertiary:  var(--color-text-tertiary);
  --text-inverse:   var(--color-text-inverse);
  /* Border */
  --line:        var(--color-border-default);
  --line-subtle: var(--color-border-subtle);
  /* Accent / Feedback */
  --accent:         var(--color-accent-default);
  --accent-hover:   var(--color-accent-hover);
  --accent-pressed: var(--color-accent-pressed);
  --success:        var(--color-success-default);
  --warning:        var(--color-warning-default);
  --danger:         var(--color-danger-default);
  /* Effects */
  --shadow-xs: var(--effect-shadow-xs);
  --shadow-sm: var(--effect-shadow-sm);
  --shadow-md: var(--effect-shadow-md);
  --focus:     var(--effect-shadow-focus);
  /* Size */
  --sidebar-w: var(--size-sidebar-w);
  /* Font — DS の Inter 系 + 日本語フォールバック */
  --font-app: var(--font-sans), "Hiragino Sans", "Yu Gothic", "Meiryo", sans-serif;
}

/* ============================================================= */
/* Base Reset                                                     */
/* ============================================================= */
* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at top left, rgba(10,132,255,0.10), transparent 320px),
    var(--bg);
  color: var(--text);
  font-family: var(--font-app);
  letter-spacing: 0;
}

button, select, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }

button:focus-visible,
a:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

h1, h2, h3, p { margin-top: 0; }

/* ============================================================= */
/* App Shell / Sidebar                                            */
/* ============================================================= */
.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: calc(100vh - 52px);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: var(--space-20);
  padding: var(--space-20) var(--space-16);
  border-right: 1px solid var(--line-subtle);
  background: color-mix(in srgb, var(--surface-solid) 78%, transparent);
  backdrop-filter: blur(var(--effect-blur-surface));
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-8);
  padding: var(--space-8) var(--space-8) var(--space-12);
  text-align: center;
}

.brand-logo {
  height: 36px;
  width: auto;
  flex: 0 0 auto;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 var(--space-4);
  color: var(--text-tertiary);
  font-size: var(--type-caption-size);
  font-weight: 600;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand h1 {
  margin: 0;
  font-size: var(--type-body-lg-size);
  line-height: 1.35;
  font-weight: var(--type-h3-weight);
  word-break: keep-all;
  text-align: center;
}

.nav-list {
  display: grid;
  gap: var(--space-4);
}

.nav-item {
  width: 100%;
  min-height: var(--size-control-lg);
  display: flex;
  align-items: center;
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  padding: 0 var(--space-12);
  text-align: left;
  text-decoration: none;
  font-size: var(--type-body-md-size);
  font-weight: var(--type-label-md-weight);
  transition: background-color .15s ease, color .15s ease;
}

.nav-item:hover {
  background: var(--hover);
  color: var(--text);
}

.nav-item.active {
  border-color: var(--line-subtle);
  background: var(--selected);
  color: var(--accent);
}

.download-item {
  margin-top: var(--space-4);
  border-color: var(--line);
  background: var(--surface-elevated);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

.source-card {
  margin-top: auto;
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: var(--space-16);
}

.source-card h2 {
  margin-bottom: var(--space-12);
  font-size: var(--type-body-md-size);
  font-weight: var(--type-h3-weight);
}

.source-card ul,
.checklist ul {
  display: grid;
  gap: var(--space-8);
  margin: 0;
  padding: 0;
  list-style: none;
}

.source-card li,
.checklist li {
  display: flex;
  gap: var(--space-8);
  color: var(--text-secondary);
  font-size: var(--type-body-sm-size);
  line-height: 1.5;
}

.source-card li::before,
.checklist li::before {
  content: "";
  width: 6px;
  height: 6px;
  margin-top: 7px;
  border-radius: var(--radius-pill);
  flex: 0 0 auto;
  background: var(--accent);
}

/* ============================================================= */
/* Workspace                                                      */
/* ============================================================= */
.workspace {
  display: grid;
  gap: var(--space-16);
  padding: var(--space-20);
}

/* ============================================================= */
/* Panels (shared card style)                                     */
/* ============================================================= */
.mode-switch,
.tutorial-panel,
.qa-chat-panel,
.learning-panel,
.video-panel,
.phone-panel,
.control-strip,
.scenario-panel,
.chat-panel,
.coach-panel,
.report-panel,
.members-panel {
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.mode-switch {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4);
}

.mode-btn {
  flex: 1;
  min-height: var(--size-control-md);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-secondary);
  font-size: var(--type-body-sm-size);
  font-weight: 600;
}

.mode-btn:hover {
  background: var(--hover);
  color: var(--text);
}

.mode-btn.active {
  border-color: var(--line-subtle);
  background: var(--surface-solid);
  color: var(--accent);
  box-shadow: var(--shadow-xs);
}

.mode-view[hidden] { display: none; }

.tutorial-panel {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(360px, 1.3fr) auto;
  align-items: center;
  gap: var(--space-16);
  padding: var(--space-16);
}

.tutorial-panel h2,
.panel-heading h2 {
  margin: 0;
  font-size: var(--type-h2-size);
  line-height: var(--type-h2-lh);
  font-weight: var(--type-h2-weight);
}

.tutorial-panel ol,
.learning-steps {
  display: grid;
  gap: var(--space-12);
  margin: 0;
  padding: 0;
  list-style: none;
}

.tutorial-panel ol {
  grid-template-columns: repeat(3, 1fr);
}

.tutorial-panel li,
.learning-steps li {
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
  padding: var(--space-12);
}

.tutorial-panel strong,
.tutorial-panel span,
.learning-steps strong,
.learning-steps span { display: block; }

.tutorial-panel strong,
.learning-steps strong {
  font-size: var(--type-body-sm-size);
  font-weight: var(--type-h3-weight);
}

.tutorial-panel span,
.learning-steps span {
  margin-top: var(--space-4);
  color: var(--text-secondary);
  font-size: var(--type-caption-size);
  line-height: 1.45;
}

.tutorial-actions {
  display: grid;
  gap: var(--space-8);
  min-width: 152px;
}

.qa-chat-panel,
.learning-panel,
.video-panel,
.phone-panel,
.scenario-panel,
.chat-panel,
.coach-panel,
.report-panel,
.members-panel {
  padding: var(--space-16);
}

.panel-heading { margin-bottom: var(--space-16); }
.panel-heading.horizontal {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: var(--space-16);
}

/* ============================================================= */
/* Scenario / QA layouts                                          */
/* ============================================================= */
.scenario-mode,
.qa-layout {
  display: grid;
  gap: var(--space-16);
}

.qa-layout {
  grid-template-columns: minmax(420px, 1.2fr) minmax(300px, 0.8fr);
  align-items: start;
}

/* ============================================================= */
/* Chat / QA Messages                                             */
/* ============================================================= */
.qa-log,
.chat-log {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: var(--space-12);
  padding: var(--space-2) var(--space-2) var(--space-12);
}

.qa-log  { min-height: 320px; max-height: 500px; }
.chat-log { height: 342px; }

.qa-message,
.message {
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-lg);
  padding: var(--space-12);
  line-height: var(--type-body-md-lh);
  font-size: var(--type-body-md-size);
}

.qa-message { width: 100%; white-space: pre-line; }

.qa-message.user,
.message.staff {
  align-self: flex-end;
  max-width: 86%;
  background: var(--selected);
  border-color: color-mix(in srgb, var(--accent) 26%, var(--line));
}

.qa-message.answer,
.message.customer { background: var(--surface-solid); }

.message.coach {
  width: 100%;
  max-width: 100%;
  background: var(--bg-subtle);
  color: var(--text-secondary);
}

.qa-message b,
.message b {
  display: block;
  margin-bottom: var(--space-4);
  color: var(--text-tertiary);
  font-size: var(--type-caption-size);
  font-weight: var(--type-h3-weight);
}

/* ============================================================= */
/* Quick Questions / Reply Actions                                */
/* ============================================================= */
.quick-questions,
.qa-actions,
.reply-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-8);
}

.quick-questions {
  justify-content: flex-start;
  margin: 0 0 var(--space-16);
}

.reply-form {
  display: grid;
  gap: var(--space-12);
  margin-top: var(--space-2);
  padding-top: var(--space-16);
  border-top: 1px solid var(--line-subtle);
}

/* ============================================================= */
/* Document List (利用者UI: 手引書ダウンロード)                     */
/* ============================================================= */
.doc-list { display: grid; gap: var(--space-12); }
.doc-card {
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-lg);
  background: var(--surface-solid);
  padding: var(--space-16);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-12);
  align-items: start;
}
.doc-card h3 {
  margin: 0 0 var(--space-4);
  font-size: var(--type-body-lg-size);
  font-weight: var(--type-h3-weight);
}
.doc-card p {
  margin: 0 0 var(--space-8);
  color: var(--text-secondary);
  font-size: var(--type-body-sm-size);
  line-height: 1.6;
}
.doc-card .doc-meta {
  color: var(--text-tertiary);
  font-size: var(--type-caption-size);
}

/* ============================================================= */
/* Form Controls — aligned to DS tokens                           */
/* ============================================================= */
select,
input,
textarea {
  border: 1px solid var(--comp-input-border);
  border-radius: var(--radius-md);
  background: var(--comp-input-bg);
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}

select:hover, input:hover, textarea:hover {
  border-color: var(--comp-input-border-hover);
}
select:focus, input:focus, textarea:focus {
  border-color: var(--comp-input-border-focus);
  box-shadow: var(--focus);
}

select, input {
  height: var(--size-control-lg);
  padding: 0 var(--space-12);
}

textarea {
  width: 100%;
  min-height: 104px;
  resize: vertical;
  padding: var(--space-12);
  line-height: 1.6;
}

textarea::placeholder,
input::placeholder { color: var(--comp-input-placeholder); }

/* ============================================================= */
/* Buttons — DS-aligned                                           */
/* ============================================================= */
.ghost-button,
.primary-button,
.quick-questions button,
.qa-actions button,
.topic-card,
.video-chapters button {
  min-height: var(--size-control-md);
  border: 1px solid var(--comp-button-secondary-border);
  border-radius: var(--radius-md);
  background: var(--comp-button-secondary-bg);
  color: var(--comp-button-secondary-fg);
  padding: 0 14px;
  font-size: var(--type-label-md-size);
  font-weight: var(--type-label-md-weight);
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease;
  box-shadow: var(--effect-shadow-xs);
}

.ghost-button:hover,
.quick-questions button:hover,
.qa-actions button:hover,
.topic-card:hover,
.video-chapters button:hover {
  background: var(--comp-button-secondary-bg-hover);
}

.primary-button {
  border-color: transparent;
  background: var(--comp-button-primary-bg);
  color: var(--comp-button-primary-fg);
  box-shadow: none;
}

.primary-button:hover { background: var(--comp-button-primary-bg-hover); }
.primary-button:active { background: var(--comp-button-primary-bg-pressed); }

/* ============================================================= */
/* Topic Cards                                                    */
/* ============================================================= */
.topic-cards { display: grid; gap: var(--space-12); }

.topic-card {
  height: auto;
  padding: var(--space-16);
  text-align: left;
}

.topic-card strong,
.topic-card span { display: block; }
.topic-card strong { margin-bottom: var(--space-4); font-size: var(--type-body-md-size); }
.topic-card span { color: var(--text-secondary); font-size: var(--type-body-sm-size); line-height: 1.5; }

/* ============================================================= */
/* Video Panel                                                    */
/* ============================================================= */
.video-layout {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 280px;
  gap: var(--space-16);
}

.video-player-wrap {
  position: relative;
  min-height: 300px;
}

.video-player-wrap video {
  width: 100%;
  border-radius: var(--radius-xl);
  background: #000;
  display: block;
}

/* video が src 未設定のときは非表示、プレースホルダを表示 */
.video-player-wrap video:not([src]) { display: none; }
.video-player-wrap video[src] ~ .video-frame { display: none; }

.video-frame {
  min-height: 300px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, rgba(10,132,255,0.76), rgba(17,18,20,0.42)),
    url("assets/training-room.png");
  background-position: center;
  background-size: cover;
  color: #fff;
  padding: var(--space-24);
  text-align: center;
}

.play-mark {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  margin: 0 auto var(--space-16);
  border: 1px solid rgba(255,255,255,0.42);
  border-radius: var(--radius-pill);
  background: rgba(255,255,255,0.14);
  font-size: 26px;
}

.video-frame p {
  margin: 0;
  font-size: var(--type-h2-size);
  line-height: 1.35;
  font-weight: var(--type-h2-weight);
}

.video-chapters {
  display: grid;
  align-content: start;
  gap: var(--space-8);
}

.video-chapters h3,
.checklist h3,
.escalation-box h3,
.mini-report h3,
.report-panel h3 {
  margin-bottom: var(--space-12);
  font-size: var(--type-body-lg-size);
  font-weight: var(--type-h3-weight);
}

.video-chapters button {
  height: auto;
  padding: var(--space-12);
  text-align: left;
}

.video-chapters button.active {
  border-color: var(--accent);
  background: var(--selected);
  color: var(--accent);
}

.video-notes,
.coach-feedback,
.escalation-box,
.phone-message,
.report-summary-grid section {
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  padding: var(--space-16);
  line-height: var(--type-body-md-lh);
  font-size: var(--type-body-md-size);
}

.video-notes { margin-top: var(--space-16); }

/* ============================================================= */
/* Phone Panel (DOM remnant — non-nav)                            */
/* ============================================================= */
.phone-panel { padding: var(--space-16); }

.phone-panel .panel-heading span {
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  color: var(--accent);
  padding: var(--space-4) var(--space-12);
  font-size: var(--type-caption-size);
  font-weight: var(--type-h3-weight);
}

.phone-layout {
  display: grid;
  grid-template-columns: minmax(420px, 1.2fr) minmax(280px, 0.8fr);
  gap: var(--space-16);
  align-items: start;
}

.phone-console,
.phone-summary {
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-xl);
  background: var(--surface-solid);
  padding: var(--space-16);
}

.call-card {
  display: flex;
  gap: var(--space-12);
  align-items: center;
  margin-bottom: var(--space-16);
  padding: var(--space-16);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
}

.call-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--selected);
  color: var(--accent);
  font-weight: 700;
}

.call-card h3,
.phone-summary h3 {
  margin: 0 0 var(--space-4);
  font-size: var(--type-h3-size);
  font-weight: var(--type-h3-weight);
}

.call-card p:not(.eyebrow) {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--type-body-sm-size);
  line-height: 1.55;
}

.phone-log {
  display: grid;
  gap: var(--space-12);
  min-height: 220px;
  margin-bottom: var(--space-12);
}

.phone-message { margin: 0; }

.phone-message b {
  display: block;
  margin-bottom: var(--space-4);
  color: var(--text-tertiary);
  font-size: var(--type-caption-size);
  font-weight: var(--type-h3-weight);
}

.phone-message.caller { background: var(--surface-solid); }
.phone-message.ai {
  background: var(--selected);
  border-color: color-mix(in srgb, var(--accent) 24%, var(--line));
}

.phone-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-8);
}

.phone-summary dl { display: grid; gap: var(--space-12); margin: 0 0 var(--space-16); }
.phone-summary div { padding-bottom: var(--space-12); border-bottom: 1px solid var(--line-subtle); }
.phone-summary dt {
  margin-bottom: var(--space-4);
  font-size: var(--type-caption-size);
  font-weight: var(--type-h3-weight);
  color: var(--text-tertiary);
}
.phone-summary dd {
  margin: 0;
  color: var(--text-secondary);
  font-size: var(--type-body-md-size);
  line-height: 1.6;
}

/* ============================================================= */
/* Members Panel                                                  */
/* ============================================================= */
.members-panel { padding: var(--space-16); }

.members-panel .panel-heading span {
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  color: var(--accent);
  padding: var(--space-4) var(--space-12);
  font-size: var(--type-caption-size);
  font-weight: var(--type-h3-weight);
}

.member-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-12);
  margin-bottom: var(--space-16);
}

.member-stats section,
.member-directory,
.member-editor,
.member-card {
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-xl);
  background: var(--surface-solid);
}

.member-stats section { padding: var(--space-16); }
.member-stats span {
  display: block;
  color: var(--text-secondary);
  font-size: var(--type-caption-size);
  font-weight: var(--type-h3-weight);
}
.member-stats strong {
  display: block;
  margin-top: var(--space-8);
  font-size: var(--type-display-md-size);
  line-height: 1;
  font-weight: 700;
}

.members-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1.25fr) minmax(300px, 0.75fr);
  gap: var(--space-16);
  align-items: start;
}

.member-directory,
.member-editor { padding: var(--space-16); }

.member-toolbar {
  display: grid;
  grid-template-columns: 1fr 180px;
  gap: var(--space-12);
  margin-bottom: var(--space-12);
}

.member-toolbar label,
.member-form label {
  display: grid;
  gap: var(--space-4);
}

.member-toolbar span,
.member-form span {
  color: var(--text-secondary);
  font-size: var(--type-caption-size);
  font-weight: var(--type-h3-weight);
}

.member-list { display: grid; gap: var(--space-12); }

.member-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-12);
  padding: var(--space-16);
}

.member-card h3 {
  margin: 0 0 var(--space-4);
  font-size: var(--type-body-lg-size);
  font-weight: var(--type-h3-weight);
}

.member-meta,
.member-progress,
.member-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-8);
  align-items: center;
}

.member-meta {
  color: var(--text-secondary);
  font-size: var(--type-body-sm-size);
  line-height: 1.5;
}

.member-progress { margin-top: var(--space-12); }

.member-progress i {
  width: 150px;
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--text-tertiary) 20%, transparent);
}

.member-progress b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.member-pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  padding: 0 var(--space-12);
  font-size: var(--type-caption-size);
  font-weight: var(--type-h3-weight);
}

.member-pill.completed {
  background: color-mix(in srgb, var(--success) 14%, transparent);
  color: var(--success);
}

.member-pill.follow {
  background: color-mix(in srgb, var(--warning) 18%, transparent);
  color: var(--warning);
}

.member-actions { justify-content: flex-end; }

.member-actions button {
  min-height: var(--size-control-md);
  border: 1px solid var(--comp-button-secondary-border);
  border-radius: var(--radius-md);
  background: var(--comp-button-secondary-bg);
  color: var(--comp-button-secondary-fg);
  padding: 0 var(--space-12);
  font-size: var(--type-caption-size);
  font-weight: var(--type-h3-weight);
  transition: background-color .15s ease;
}

.member-actions button:hover { background: var(--comp-button-secondary-bg-hover); }

.member-editor h3 {
  margin-bottom: var(--space-12);
  font-size: var(--type-h3-size);
  font-weight: var(--type-h3-weight);
}

.member-form { display: grid; gap: var(--space-12); }

.member-note {
  margin-top: var(--space-16);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  padding: var(--space-12);
  font-size: var(--type-body-sm-size);
  line-height: 1.65;
}

/* ============================================================= */
/* Control Strip / Training Grid                                  */
/* ============================================================= */
.control-strip {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 180px 180px auto auto;
  gap: var(--space-12);
  align-items: end;
  padding: var(--space-12);
}

.control-strip label {
  display: grid;
  gap: var(--space-4);
  min-width: 0;
}

.control-strip span {
  color: var(--text-secondary);
  font-size: var(--type-caption-size);
  font-weight: 600;
}

.training-grid {
  display: grid;
  grid-template-columns: minmax(240px, 0.9fr) minmax(360px, 1.35fr) minmax(280px, 0.95fr);
  gap: var(--space-16);
  align-items: start;
}

.scenario-panel p {
  color: var(--text-secondary);
  line-height: 1.72;
}

/* ============================================================= */
/* Risk Meter / Guideline Points                                  */
/* ============================================================= */
.risk-meter {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: var(--space-8);
  align-items: center;
  margin: var(--space-16) 0;
  color: var(--text-secondary);
  font-size: var(--type-caption-size);
  font-weight: var(--type-h3-weight);
}

.risk-meter div,
.report-row i {
  height: 8px;
  overflow: hidden;
  border-radius: var(--radius-pill);
  background: color-mix(in srgb, var(--text-tertiary) 20%, transparent);
}

.risk-meter i,
.report-row b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
}

.risk-meter i { width: 48%; }

.guideline-points { display: grid; gap: var(--space-12); margin: 0; }
.guideline-points div {
  padding-top: var(--space-12);
  border-top: 1px solid var(--line-subtle);
}
.guideline-points dt { font-size: var(--type-body-sm-size); font-weight: var(--type-h3-weight); }
.guideline-points dd {
  margin: var(--space-4) 0 0;
  color: var(--text-secondary);
  font-size: var(--type-body-sm-size);
  line-height: 1.55;
}

/* ============================================================= */
/* Badges / Score / Heat                                          */
/* ============================================================= */
#turnBadge,
#scoreValue,
.qa-chat-panel .panel-heading span,
.video-panel .panel-heading span {
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  padding: var(--space-4) var(--space-12);
  font-size: var(--type-caption-size);
  font-weight: var(--type-h3-weight);
}

.heat-panel {
  margin-bottom: var(--space-12);
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-subtle);
  padding: var(--space-12);
}

.heat-panel div {
  display: flex;
  justify-content: space-between;
  gap: var(--space-12);
  margin-bottom: var(--space-8);
  font-size: var(--type-body-sm-size);
}

.heat-panel span {
  color: var(--text-secondary);
  font-weight: var(--type-h3-weight);
}

.heat-panel meter { width: 100%; height: 12px; }

.heat-panel[data-status="yellow"] {
  border-color: color-mix(in srgb, var(--warning) 52%, var(--line));
}

.heat-panel[data-status="red"],
.heat-panel[data-status="max"] {
  border-color: color-mix(in srgb, var(--danger) 58%, var(--line));
}

.heat-panel[data-status="max"] { animation: pulseWarning 1s infinite; }

@keyframes pulseWarning {
  50% { box-shadow: 0 0 0 4px color-mix(in srgb, var(--danger) 18%, transparent); }
}

/* ============================================================= */
/* Score Ring / Coach Panel                                       */
/* ============================================================= */
.score-ring {
  width: 146px;
  height: 146px;
  position: relative;
  display: grid;
  place-items: center;
  margin: var(--space-8) auto var(--space-20);
  border-radius: 50%;
  background: conic-gradient(var(--accent) 0deg, color-mix(in srgb, var(--text-tertiary) 18%, transparent) 0deg);
}

.score-ring::after {
  content: "";
  position: absolute;
  inset: 12px;
  border-radius: 50%;
  background: var(--surface-solid);
}

.score-ring span,
.score-ring small { position: relative; z-index: 1; }
.score-ring span { font-size: var(--type-display-lg-size); font-weight: 700; }
.score-ring small {
  position: absolute;
  z-index: 1;
  margin-top: 50px;
  color: var(--text-tertiary);
  font-size: var(--type-caption-size);
  font-weight: var(--type-h3-weight);
}

.checklist,
.escalation-box,
.mini-report { margin-top: var(--space-16); }

.checklist li.done::before { background: var(--success); }
.checklist li.warn::before { background: var(--warning); }
.checklist li.miss::before { background: var(--danger); }

.report-row {
  display: grid;
  grid-template-columns: 112px 1fr 34px;
  gap: var(--space-8);
  align-items: center;
  margin-bottom: var(--space-8);
  color: var(--text-secondary);
  font-size: var(--type-caption-size);
  font-weight: var(--type-h3-weight);
}

.report-row b { width: 0%; }

.badge-text {
  margin: var(--space-12) 0 0;
  color: var(--accent);
  font-size: var(--type-body-sm-size);
  font-weight: var(--type-h3-weight);
}

/* ============================================================= */
/* Report Panel                                                   */
/* ============================================================= */
.report-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-16);
}

.report-summary-grid p,
.report-summary-grid li {
  color: var(--text-secondary);
  font-size: var(--type-body-md-size);
  line-height: 1.7;
}

.report-summary-grid ul { margin: 0; padding-left: 18px; }

/* ============================================================= */
/* Footer                                                         */
/* ============================================================= */
.footer {
  min-height: 52px;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-12) var(--space-16);
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-20);
  border-top: 1px solid var(--line-subtle);
  background: var(--surface-solid);
  color: var(--text-secondary);
  font-size: var(--type-caption-size);
  text-align: center;
}

.footer p { margin: 0; }
.footer a {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}
.footer a:hover { text-decoration: underline; }

/* ============================================================= */
/* Hero (§4: 削除済み — CSS のみ残存。表示されない)                */
/* ============================================================= */
.hero {
  min-height: 216px;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: flex-end;
  border: 1px solid var(--line-subtle);
  border-radius: var(--radius-xl);
  background: var(--surface-solid);
  box-shadow: var(--shadow-sm);
}
.hero img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; filter: saturate(0.96) contrast(1.02); }
.hero::after {
  content: "";
  position: absolute; inset: 0;
  background:
    linear-gradient(90deg, rgba(17,18,20,0.68), rgba(17,18,20,0.22) 52%, rgba(17,18,20,0.04)),
    linear-gradient(0deg, rgba(17,18,20,0.18), transparent 52%);
}
.hero-copy, .hero-status { position: relative; z-index: 1; }
.hero-copy { max-width: 680px; padding: 26px; color: #fff; }
.hero-copy p { margin-bottom: 10px; color: rgba(255,255,255,0.82); font-size: 14px; line-height: 1.5; }
.hero-copy h2 { margin: 0; font-size: clamp(28px, 4vw, 42px); line-height: 1.16; font-weight: 650; }
.hero-status { min-width: 164px; margin: 0 18px 18px auto; border: 1px solid rgba(255,255,255,0.22); border-radius: var(--radius-lg); background: rgba(255,255,255,0.14); color: #fff; padding: 12px; backdrop-filter: blur(16px); }
.hero-status span, .hero-status strong { display: block; }
.hero-status span { color: rgba(255,255,255,0.72); font-size: 12px; }
.hero-status strong { margin-top: 4px; font-size: 13px; font-weight: 650; }

/* ============================================================= */
/* Workspace Actions (top bar)                                    */
/* ============================================================= */
.workspace-actions { display: flex; gap: var(--space-12); }
.workspace-actions .primary-button {
  min-height: var(--size-control-lg);
  padding: 0 var(--space-20);
}

/* ============================================================= */
/* Responsive                                                     */
/* ============================================================= */
@media (max-width: 1160px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; display: grid; grid-template-columns: 1fr; }
  .nav-list { grid-auto-flow: column; grid-auto-columns: max-content; overflow-x: auto; }
  .nav-item { white-space: nowrap; }
  .source-card { display: none; }
  .training-grid { grid-template-columns: 1fr 1fr; }
  .qa-layout,
  .tutorial-panel,
  .video-layout,
  .phone-layout,
  .members-layout,
  .member-stats,
  .control-strip,
  .report-summary-grid { grid-template-columns: 1fr; }
  .tutorial-panel ol { grid-template-columns: 1fr; }
  .chat-panel { grid-column: 1 / -1; order: 3; }
}

@media (max-width: 760px) {
  .workspace { padding: var(--space-16); }
  .sidebar { padding: var(--space-16); }
  .hero { min-height: 300px; }
  .hero::after { background: linear-gradient(0deg, rgba(17,18,20,0.78), rgba(17,18,20,0.18)); }
  .hero-copy { padding: var(--space-20); }
  .hero-status { display: none; }
  .mode-switch, .reply-actions { display: grid; }
  .member-toolbar, .member-card { grid-template-columns: 1fr; }
  .training-grid, .qa-layout { grid-template-columns: 1fr; }
  .chat-log { height: 340px; }
  .qa-message.user, .message { max-width: 96%; }
}
