:root {
  --ink: #12211c;
  --muted: #6d7a74;
  --line: #dde4df;
  --soft: #f3f6f3;
  --paper: #fbfcfa;
  --green: #0c6b4f;
  --green-dark: #074936;
  --green-light: #dff1e8;
  --amber: #e28a35;
  --red: #c95a48;
  --shadow: 0 24px 70px rgba(20, 45, 35, 0.12);

  /* デザイントークン: 角丸スケール */
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-pill: 999px;

  /* デザイントークン: シャドウスケール（--shadowは既存の強調用に維持） */
  --shadow-sm: 0 2px 8px rgba(20, 45, 35, 0.08);
  --shadow-md: 0 10px 30px rgba(20, 45, 35, 0.1);

  /* デザイントークン: タイポグラフィスケール */
  --fs-2xs: 11px;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 14px;
  --fs-md: 16px;
  --fs-lg: 20px;
  --fs-xl: 24px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: "DM Sans", "Noto Sans JP", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

button,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 248px 1fr;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 248px;
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding: 30px 20px 20px;
  color: white;
  background:
    radial-gradient(circle at 40% 0%, rgba(54, 143, 111, 0.22), transparent 31%),
    #10251d;
}

.sidebar-close,
.sidebar-backdrop {
  display: none;
}

.brand {
  display: flex;
  gap: 11px;
  align-items: center;
  padding: 0 10px;
  color: white;
  text-decoration: none;
}

.brand-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 11px;
  background: #e9f5ef;
}

.brand-mark svg {
  width: 25px;
  fill: none;
  stroke: var(--green-dark);
  stroke-width: 2.3;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 17px;
  line-height: 1.1;
  letter-spacing: 0.01em;
}

.brand small {
  margin-top: 2px;
  color: #a9bbb4;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.main-nav {
  display: grid;
  gap: 7px;
  margin-top: 52px;
}

.nav-item {
  width: 100%;
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 13px;
  border: 0;
  border-radius: 10px;
  color: #aebdb7;
  background: transparent;
  cursor: pointer;
  text-align: left;
  transition: 160ms ease;
}

.nav-item:hover {
  color: white;
  background: rgba(255, 255, 255, 0.06);
}

.nav-item.active {
  color: white;
  background: rgba(236, 247, 242, 0.12);
  box-shadow: inset 3px 0 #65bd94;
}

.nav-icon {
  width: 22px;
  font-size: 19px;
  text-align: center;
}

.nav-count {
  min-width: 22px;
  margin-left: auto;
  padding: 2px 6px;
  border-radius: 20px;
  color: #c9dad3;
  background: rgba(255, 255, 255, 0.1);
  font-size: 11px;
  text-align: center;
}

.sidebar-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 14px 11px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.pulse {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64d29e;
  box-shadow: 0 0 0 5px rgba(100, 210, 158, 0.1);
}

.sidebar-note strong,
.sidebar-note small,
.user-card strong,
.user-card small {
  display: block;
}

.sidebar-note strong {
  font-size: 12px;
  font-weight: 500;
}

.sidebar-note small {
  margin-top: 3px;
  color: #7f948b;
  font-size: 9px;
}

.user-card {
  display: grid;
  grid-template-columns: 38px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 18px 8px 0;
}

.avatar {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--green-dark);
  background: #b9ddcc;
  font-weight: 700;
}

.user-card strong {
  font-size: 12px;
}

.user-card small {
  margin-top: 3px;
  color: #81958d;
  font-size: 10px;
}

.user-card button {
  border: 0;
  color: #80968d;
  background: transparent;
  cursor: pointer;
}

.main-content {
  grid-column: 2;
  min-width: 0;
}

.topbar {
  height: 74px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 252, 250, 0.92);
  backdrop-filter: blur(12px);
}

.breadcrumb span,
.breadcrumb strong {
  display: block;
}

.breadcrumb span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.breadcrumb strong {
  font-size: 14px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.language-switcher {
  display: inline-flex;
  padding: 3px;
  border: 1px solid #cbd8d1;
  border-radius: 999px;
  background: #f2f7f4;
}

.language-switcher button {
  min-width: 58px;
  padding: 6px 9px;
  border: 0;
  border-radius: 999px;
  color: #60736a;
  background: transparent;
  cursor: pointer;
  font-size: 9px;
  font-weight: 700;
}

.language-switcher button.active {
  color: white;
  background: var(--green-dark);
  box-shadow: 0 3px 9px rgba(15, 76, 54, 0.2);
}

.auth-language-switch {
  width: fit-content;
  margin: 0 0 12px auto;
}

.draft-state {
  color: #75827c;
  font-size: 11px;
}

.draft-state i {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 7px;
  border-radius: 50%;
  background: #51ae82;
}

.draft-state[data-status="dirty"] i,
.draft-state[data-status="error"] i {
  background: #c97852;
}

.draft-state[data-status="saving"] i {
  background: #d2a83c;
}

.draft-save-button {
  padding: 8px 11px;
  border: 1px solid #cbd8d1;
  border-radius: 999px;
  color: var(--green);
  background: white;
  cursor: pointer;
  font-size: 10px;
  font-weight: 700;
}

.draft-save-button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.icon-button,
.mobile-menu {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  cursor: pointer;
}

.mobile-menu {
  display: none;
}

.workspace {
  min-height: calc(100vh - 74px);
  display: grid;
  grid-template-columns: minmax(520px, 1fr) 390px;
}

.conversation-panel {
  min-width: 0;
  padding: 46px clamp(36px, 5vw, 82px) 34px;
}

.conversation-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 30px;
}

.eyebrow {
  color: var(--green);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
}

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

.conversation-heading h1 {
  margin: 12px 0 10px;
  font-size: clamp(30px, 3vw, 43px);
  line-height: 1.22;
  letter-spacing: -0.04em;
}

.conversation-heading p {
  color: var(--muted);
  font-size: 13px;
}

.step-badge {
  flex: 0 0 auto;
  width: 74px;
  height: 74px;
  display: flex;
  align-items: baseline;
  justify-content: center;
  padding-top: 24px;
  border: 1px solid #d7e1dc;
  border-radius: 50%;
  background: white;
}

.step-badge span {
  position: absolute;
  margin-top: -13px;
  color: var(--muted);
  font-size: 7px;
  letter-spacing: 0.16em;
}

.step-badge strong {
  font-size: 23px;
}

.step-badge small {
  color: var(--muted);
  font-size: 11px;
}

.progress-track {
  position: relative;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin: 28px 0 38px;
}

.progress-track::before,
.progress-fill {
  content: "";
  position: absolute;
  top: 10px;
  right: 0;
  left: 0;
  height: 2px;
  background: #dfe6e2;
}

.progress-fill {
  z-index: 1;
  width: 0;
  right: auto;
  background: var(--green);
  transition: width 400ms ease;
}

.progress-step {
  position: relative;
  z-index: 2;
  color: #9aa49f;
  text-align: center;
}

.progress-step:first-of-type {
  text-align: left;
}

.progress-step:last-of-type {
  text-align: right;
}

.progress-step b {
  width: 21px;
  height: 21px;
  display: inline-grid;
  place-items: center;
  border: 1px solid #cfd9d4;
  border-radius: 50%;
  background: var(--paper);
  font-size: 9px;
}

.progress-step span {
  display: block;
  margin-top: 7px;
  font-size: 9px;
}

.progress-step.active {
  color: var(--green);
}

.progress-step.active b {
  border-color: var(--green);
  color: white;
  background: var(--green);
}

.chat-stream {
  max-height: 280px;
  overflow-y: auto;
  scrollbar-width: thin;
}

.message {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.message.user {
  justify-content: flex-end;
}

.message-avatar {
  flex: 0 0 auto;
  width: 29px;
  height: 29px;
  display: grid;
  place-items: center;
  margin-top: 18px;
  border-radius: 9px;
  color: white;
  background: var(--green);
  font-size: 8px;
  font-weight: 700;
}

.message-body {
  max-width: 80%;
}

.message-author {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 9px;
}

.message.user .message-author {
  text-align: right;
}

.bubble {
  padding: 14px 16px;
  border-radius: 4px 16px 16px 16px;
  color: #304039;
  background: #eef3f0;
  font-size: 12px;
  line-height: 1.75;
}

.message.user .bubble {
  border-radius: 16px 4px 16px 16px;
  color: white;
  background: var(--green);
}

.quick-prompts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0 12px 39px;
}

.quick-prompts button {
  padding: 11px 13px;
  border: 1px solid #dce4df;
  border-radius: 10px;
  color: #425049;
  background: white;
  cursor: pointer;
  font-size: 10px;
  line-height: 1.45;
  text-align: left;
  transition: 160ms ease;
}

.quick-prompts button:hover {
  border-color: #9ebcad;
  transform: translateY(-1px);
}

.quick-prompts span {
  display: block;
  margin-bottom: 3px;
  color: var(--green);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.composer {
  margin-top: 13px;
  overflow: hidden;
  border: 1px solid #ccd8d2;
  border-radius: 14px;
  background: white;
  box-shadow: 0 10px 30px rgba(28, 52, 42, 0.05);
  transition: 180ms ease;
}

.composer:focus-within {
  border-color: #7ca892;
  box-shadow: 0 0 0 3px rgba(32, 117, 83, 0.08);
}

.composer textarea {
  width: 100%;
  min-height: 82px;
  display: block;
  padding: 17px 18px 8px;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 12px;
  line-height: 1.6;
}

.composer textarea::placeholder {
  color: #a5afaa;
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 9px 9px 13px;
}

.composer-actions > div {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #98a39e;
  font-size: 9px;
}

.attach-button {
  width: 25px;
  height: 25px;
  border: 1px solid #d8e0dc;
  border-radius: 7px;
  background: transparent;
  cursor: pointer;
}

.send-button {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 14px;
  border: 0;
  border-radius: 9px;
  color: white;
  background: var(--green);
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
}

.send-button:disabled {
  color: #87938e;
  background: #e6ebe8;
  cursor: not-allowed;
}

.send-button span {
  font-size: 15px;
}

.analysis-panel {
  padding: 42px 31px;
  border-left: 1px solid var(--line);
  background:
    linear-gradient(rgba(239, 244, 240, 0.82), rgba(239, 244, 240, 0.82)),
    repeating-linear-gradient(0deg, transparent, transparent 27px, rgba(31, 88, 63, 0.04) 28px);
}

.analysis-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.analysis-header h2 {
  margin: 7px 0 0;
  font-size: 21px;
}

.analysis-status {
  padding: 5px 9px;
  border-radius: 20px;
  color: #77837e;
  background: #e0e7e3;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.analysis-status.active {
  color: var(--green-dark);
  background: #cfe9dd;
}

.empty-analysis {
  max-width: 230px;
  margin: 120px auto 0;
  text-align: center;
}

.radar {
  position: relative;
  width: 100px;
  height: 100px;
  display: grid;
  place-items: center;
  margin: 0 auto 25px;
  border: 1px solid #b8cbc1;
  border-radius: 50%;
}

.radar span {
  position: absolute;
  width: 67%;
  height: 67%;
  border: 1px solid #c9d7d0;
  border-radius: 50%;
}

.radar span:nth-child(2) {
  width: 35%;
  height: 35%;
}

.radar span:nth-child(3) {
  width: 5px;
  height: 5px;
  border: 0;
  background: var(--green);
}

.radar i {
  position: absolute;
  width: 50%;
  height: 1px;
  left: 50%;
  background: var(--green);
  transform-origin: left;
  animation: scan 3s linear infinite;
}

@keyframes scan {
  to { transform: rotate(360deg); }
}

.empty-analysis h3 {
  margin-bottom: 10px;
  font-size: 16px;
  line-height: 1.5;
}

.empty-analysis p {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.7;
}

.severity-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 25px;
  padding: 16px 17px;
  border-left: 4px solid var(--red);
  border-radius: 8px;
  background: white;
  box-shadow: 0 8px 25px rgba(35, 60, 49, 0.05);
}

.severity-card span,
.severity-card strong {
  display: block;
}

.severity-card div > span {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 8px;
}

.severity-card strong {
  font-size: 15px;
}

.severity-level {
  padding: 5px 8px;
  border-radius: 5px;
  color: #a33d2f;
  background: #f8dfda;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.analysis-section {
  margin-top: 24px;
}

.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 11px;
}

.section-title h3 {
  margin: 0;
  font-size: 11px;
}

.section-title span {
  color: var(--muted);
  font-size: 8px;
}

.section-title .attention {
  color: #ae6c2c;
}

.fact-list {
  margin: 0;
  overflow: hidden;
  border: 1px solid #dce4df;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.fact-list div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 9px;
  padding: 9px 11px;
  border-bottom: 1px solid #e4eae6;
}

.fact-list div:last-child {
  border-bottom: 0;
}

.fact-list dt {
  color: var(--muted);
  font-size: 8px;
}

.fact-list dd {
  margin: 0;
  font-size: 9px;
  font-weight: 600;
}

.missing-list {
  display: grid;
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.missing-list li {
  position: relative;
  padding: 8px 10px 8px 27px;
  border-radius: 7px;
  color: #765632;
  background: #f8eee1;
  font-size: 9px;
}

.missing-list li::before {
  content: "!";
  position: absolute;
  left: 10px;
  font-weight: 700;
}

.report-button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 24px;
  padding: 13px 15px;
  border: 0;
  border-radius: 9px;
  color: white;
  background: var(--green-dark);
  cursor: pointer;
  font-size: 10px;
}

.report-button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.hidden {
  display: none !important;
}

.placeholder-view {
  min-height: calc(100vh - 74px);
  padding: 70px clamp(40px, 7vw, 110px);
}

.placeholder-view h1 {
  margin: 12px 0 7px;
  font-size: 38px;
}

.placeholder-view > p {
  color: var(--muted);
}

.system-card {
  margin-top: 24px;
  display: grid;
  gap: 14px;
}

.system-card-actions {
  margin-top: 4px;
}

.system-card-title {
  margin: 0 0 4px;
  font-size: 15px;
  color: var(--green-dark);
}

.system-hint {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}

#system-signup-state.is-open {
  color: var(--green);
  font-weight: 700;
}

#system-signup-state.is-closed {
  color: var(--red);
}

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

.history-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 24px;
  margin-top: 40px;
  align-items: start;
}

.history-search-panel {
  max-width: 1120px;
}

.history-search-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.history-search-grid .search-field {
  min-width: 0;
}

.history-search-panel .search-field select {
  width: 100%;
  max-width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid #cfdbd4;
  border-radius: 10px;
  color: var(--ink);
  background: white;
  box-sizing: border-box;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 事例レビューのソース絞り込み：複数選択トグルボタン群（全幅・折返し） */
.corpus-source-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
  align-items: center;
}

.corpus-source-filter-label {
  font-size: 12px;
  color: var(--muted, #5c6f67);
  margin-right: 2px;
}

.corpus-source-btn {
  display: inline-flex;
  align-items: center;
  padding: 5px 12px;
  border: 1px solid var(--line, #cfdbd4);
  border-radius: 999px;
  background: white;
  color: var(--ink);
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
}

.corpus-source-btn:hover {
  border-color: var(--green);
}

.corpus-source-btn.active {
  background: var(--green);
  color: white;
  border-color: var(--green);
}

.corpus-source-btn-count {
  margin-left: 6px;
  opacity: 0.7;
  font-size: 11px;
}

.search-results-header.compact {
  display: grid;
  gap: 4px;
  margin-top: 0;
}

.history-item {
  display: grid;
  grid-template-columns: 95px 1fr auto;
  align-items: center;
  gap: 18px;
  width: 100%;
  padding: 20px;
  border: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: inherit;
  text-align: left;
  background: white;
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.history-item:hover,
.history-item:focus-visible,
.history-item.active {
  border-color: rgba(28, 95, 69, 0.35);
  box-shadow: 0 16px 40px rgba(18, 33, 28, 0.08);
  transform: translateY(-1px);
}

.history-item:focus-visible {
  outline: 2px solid rgba(28, 95, 69, 0.2);
  outline-offset: 3px;
}

.history-list strong,
.history-list small {
  display: block;
}

.history-list small {
  margin-top: 5px;
  color: var(--muted);
}

.history-item > b {
  color: var(--green);
  font-size: 11px;
}

/* English status labels are substantially longer than Japanese badges. Keep
   the narrow history column readable instead of squeezing titles one word per
   line. */
html[lang="en"] #history-list .history-item {
  grid-template-columns: 1fr;
  gap: 10px;
}

html[lang="en"] #history-list .history-item .status-pill,
html[lang="en"] #history-list .history-item > b {
  width: fit-content;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

html[lang="en"] .history-list strong,
html[lang="en"] .control-card h3,
html[lang="en"] .corpus-list-main strong {
  overflow-wrap: anywhere;
}

/* Canonical incident edits remain Japanese by design. The English judge view
   shows the localized read-only detail and avoids mixing the source-language
   edit controls into that presentation. Switching back to Japanese restores
   the unchanged editor. */
html[lang="en"] #history-view .detail-edit-section {
  display: none;
}

.history-empty {
  padding: 35px;
  border: 1px dashed #cbd8d1;
  border-radius: 12px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  text-align: center;
}

.incident-detail-panel {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 22px 54px rgba(18, 33, 28, 0.08);
}

.incident-detail-header,
.detail-toolbar,
.detail-link-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.incident-detail-header {
  align-items: flex-start;
}

.incident-detail-header h2 {
  margin: 8px 0 0;
  font-size: 26px;
}

.incident-detail-summary {
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.7;
}

.detail-toolbar {
  margin-top: 18px;
  flex-wrap: wrap;
}

.detail-status-editor {
  display: grid;
  grid-template-columns: minmax(160px, 220px) auto;
  gap: 10px 12px;
  align-items: end;
}

.compact-field {
  gap: 6px;
}

.compact-field select {
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid #cfdbd4;
  border-radius: 10px;
  color: var(--ink);
  background: white;
}

.detail-status-editor small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 11px;
}

.detail-edit-section,
.detail-approval-section {
  padding: 18px;
  border: 1px solid #dce4df;
  border-radius: 14px;
  background: rgba(248, 251, 255, 0.72);
}

.detail-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.detail-section-header h3 {
  margin: 0;
}

.detail-section-header small {
  color: var(--muted);
  font-size: 11px;
}

.detail-edit-form,
.detail-approval-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.detail-edit-form .full-span,
.detail-approval-form .full-span,
.detail-edit-actions {
  grid-column: 1 / -1;
}

.detail-edit-form textarea,
.detail-approval-form textarea {
  min-height: 92px;
  padding: 12px 14px;
  border: 1px solid #cfdbd4;
  border-radius: 10px;
  color: var(--ink);
  background: white;
  resize: vertical;
  font: inherit;
}

.detail-edit-actions {
  display: flex;
  justify-content: flex-end;
}

.approval-status {
  display: inline-flex;
  margin-top: 8px;
  padding: 4px 9px;
  border-radius: 999px;
  color: var(--green);
  background: rgba(61, 122, 91, 0.1);
  font-size: 10px;
  font-weight: 700;
}

.approval-history {
  display: grid;
  gap: 10px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.approval-history-item {
  padding: 13px 14px;
  border: 1px solid #dce4df;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.78);
}

.approval-history-item > div {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.approval-history-item strong,
.approval-history-item time {
  font-size: 11px;
}

.approval-history-item time {
  margin-left: auto;
  color: var(--muted);
}

.approval-history-item p {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.approval-decision {
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
}

.approval-decision.approved {
  color: #286044;
  background: #e1f2e9;
}

.approval-decision.returned {
  color: #8b4c2f;
  background: #f8e8df;
}

.detail-link-row {
  flex-wrap: wrap;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 22px 0 0;
}

.detail-meta-grid div {
  padding: 14px;
  border-radius: 12px;
  background: var(--soft);
}

.detail-meta-grid dt,
.detail-meta-grid dd {
  margin: 0;
}

.detail-meta-grid dt {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.detail-meta-grid dd {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
}

.detail-meta-empty {
  grid-column: 1 / -1;
  padding: 18px;
  border: 1px dashed #cbd8d1;
  border-radius: 12px;
  color: var(--muted);
  text-align: center;
}

.detail-section {
  margin-top: 22px;
}

.detail-section h3 {
  margin: 0 0 12px;
  font-size: 14px;
}

.detail-list,
.attachment-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.detail-list li {
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--soft);
  font-size: 12px;
  line-height: 1.7;
}

.detail-subsections {
  display: grid;
  gap: 12px;
}

.detail-subsections article {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #dce4df;
  background: rgba(255, 255, 255, 0.7);
}

.detail-subsections strong {
  display: block;
  margin-bottom: 10px;
  font-size: 12px;
}

.attachment-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  background: white;
}

.attachment-chip span,
.attachment-chip small {
  display: block;
}

.attachment-chip small {
  color: var(--muted);
  font-size: 11px;
}

.search-panel {
  max-width: 980px;
  margin-top: 34px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(135deg, rgba(223, 241, 232, 0.55), rgba(255, 255, 255, 0.95));
}

.search-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 14px;
}

.search-field {
  display: grid;
  gap: 7px;
}

.search-field span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.search-field input {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid #cfdbd4;
  border-radius: 10px;
  color: var(--ink);
  background: white;
}

.search-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
}

.toggle-field {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--muted);
  font-size: 11px;
}

.search-buttons {
  display: flex;
  gap: 10px;
}

.search-results-header {
  max-width: 980px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-top: 26px;
}

.search-results-header strong,
.search-results-header small {
  display: block;
}

.search-results-header strong {
  font-size: 16px;
}

.search-results-header small {
  color: var(--muted);
  font-size: 11px;
}

.control-results {
  max-width: 980px;
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.control-card {
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: white;
  box-shadow: 0 16px 40px rgba(18, 33, 28, 0.05);
}

.control-card-header,
.control-card-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.control-card-header {
  justify-content: space-between;
}

.control-card-header > b {
  color: var(--green);
  font-size: 11px;
}

.control-card h3 {
  margin: 14px 0 8px;
  font-size: 21px;
}

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

.control-metadata {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.control-metadata div {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--soft);
}

.control-metadata dt,
.control-metadata dd {
  margin: 0;
}

.control-metadata dt {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.control-metadata dd {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
}

.control-card-footer {
  color: var(--muted);
  font-size: 11px;
}

.control-rank-reason {
  display: block;
  margin-top: 12px;
  color: var(--green);
  font-size: 11px;
}

.status-pill {
  display: inline-block;
  width: max-content;
  padding: 5px 9px;
  border-radius: 20px;
  font-size: 9px;
  font-weight: 700;
}

.status-pill.high {
  color: #9d3e31;
  background: #f8ddd8;
}

.status-pill.medium {
  color: #936020;
  background: #fae8c9;
}

.status-pill.low {
  color: #176c4e;
  background: #dcefe6;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 240px));
  gap: 14px;
  margin-top: 40px;
}

.insight-grid article {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}

.insight-grid span,
.insight-grid strong,
.insight-grid small {
  display: block;
}

.insight-grid span {
  color: var(--muted);
  font-size: 11px;
}

.insight-grid strong {
  margin: 14px 0 6px;
  font-size: 32px;
}

.insight-grid small {
  color: var(--green);
}

/* 安全インサイト: 実データ集計の横棒チャート（外部ライブラリ非依存） */
.insights-charts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 20px;
}

.insights-chart-card {
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: white;
  box-shadow: var(--shadow-sm);
}

.insights-chart-card h3 {
  margin: 0 0 12px;
  font-size: var(--fs-sm);
  color: var(--muted);
}

.insights-bar-list {
  display: grid;
  gap: 9px;
}

.insights-bar-row {
  display: grid;
  grid-template-columns: 84px 1fr 44px;
  align-items: center;
  gap: 8px;
}

.insights-bar-label {
  font-size: var(--fs-xs);
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.insights-bar-track {
  height: 8px;
  border-radius: var(--radius-pill);
  background: var(--soft);
  overflow: hidden;
}

.insights-bar-fill {
  height: 100%;
  border-radius: var(--radius-pill);
  background: var(--green);
}

.insights-bar-count {
  font-size: var(--fs-2xs);
  color: var(--muted);
  text-align: right;
}

@media (max-width: 820px) {
  .insights-charts {
    grid-template-columns: 1fr;
  }
}

.report-modal {
  width: min(900px, calc(100vw - 30px));
  max-height: 90vh;
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.report-modal::backdrop {
  background: rgba(11, 27, 21, 0.72);
  backdrop-filter: blur(4px);
}

.modal-header,
.report-meta,
.report-summary,
.icam-grid,
.prevention,
.modal-actions {
  margin-right: 34px;
  margin-left: 34px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 30px;
}

.modal-header h2 {
  margin: 7px 0 0;
}

.modal-header button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  cursor: pointer;
  font-size: 20px;
}

.report-meta {
  display: flex;
  gap: 26px;
  margin-top: 22px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
}

.report-meta strong {
  margin-left: 5px;
  color: var(--ink);
}

.report-summary {
  margin-top: 24px;
}

.report-summary h3 {
  margin: 12px 0 8px;
  font-size: 21px;
}

.report-summary p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.icam-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 22px;
}

.icam-grid article {
  position: relative;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8faf8;
}

.icam-grid article > span {
  position: absolute;
  right: 14px;
  color: #d3ded8;
  font-size: 22px;
  font-weight: 700;
}

.icam-grid h4 {
  margin: 0 0 10px;
  font-size: 11px;
}

.icam-grid ul {
  margin: 0;
  padding-left: 17px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.8;
}

.prevention {
  margin-top: 24px;
}

.prevention h3 {
  font-size: 15px;
}

.prevention div {
  display: grid;
  grid-template-columns: 55px 1fr;
  gap: 15px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.prevention span {
  color: var(--green);
  font-size: 9px;
  font-weight: 700;
}

.prevention p {
  margin: 0;
  font-size: 10px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 25px 0 30px;
}

.secondary-button,
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 11px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
}

.secondary-button {
  border: 1px solid var(--line);
  background: white;
}

.primary-button {
  border: 1px solid var(--green);
  color: white;
  background: var(--green);
}

.disabled-link {
  opacity: 0.45;
  pointer-events: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 1040px) {
  .workspace {
    grid-template-columns: minmax(480px, 1fr) 330px;
  }

  .conversation-panel {
    padding-right: 35px;
    padding-left: 35px;
  }

  .analysis-panel {
    padding-right: 22px;
    padding-left: 22px;
  }
}

@media (max-width: 820px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    width: 245px;
    transform: translateX(-100%);
    transition: transform 220ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 20px 0 60px rgba(0, 0, 0, 0.25);
  }

  .sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    position: absolute;
    top: 16px;
    right: 14px;
    width: 32px;
    height: 32px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: white;
    font-size: 15px;
    line-height: 1;
    cursor: pointer;
    z-index: 11;
  }

  .sidebar.open ~ .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 9;
    background: rgba(6, 20, 15, 0.45);
  }

  .main-content {
    width: 100%;
  }

  .mobile-menu {
    display: block;
  }

  .topbar {
    padding: 0 18px;
  }

  .breadcrumb {
    margin-right: auto;
    margin-left: 12px;
  }

  .draft-state {
    display: none;
  }

  .draft-save-button {
    padding: 7px 9px;
    font-size: 9px;
  }

  .top-actions {
    gap: 9px;
  }

  .language-switcher button {
    min-width: auto;
    padding: 6px 8px;
  }

  .workspace {
    display: block;
  }

  .conversation-panel {
    padding: 32px 20px;
  }

  .analysis-panel {
    min-height: 450px;
    padding: 32px 20px;
    border-top: 1px solid var(--line);
    border-left: 0;
  }

  .empty-analysis {
    margin-top: 65px;
  }

  .quick-prompts {
    margin-left: 0;
  }
}

@media (max-width: 520px) {
  .conversation-heading h1 {
    font-size: 30px;
  }

  .step-badge {
    width: 62px;
    height: 62px;
    padding-top: 18px;
  }

  .quick-prompts {
    grid-template-columns: 1fr;
  }

  .message-body {
    max-width: 88%;
  }

  .insight-grid,
  .icam-grid,
  .control-metadata,
  .search-grid,
  .history-search-grid,
  .detail-meta-grid {
    grid-template-columns: 1fr;
  }

  .history-layout {
    grid-template-columns: 1fr;
  }

  .history-item {
    grid-template-columns: 1fr;
  }

  .search-actions,
  .search-results-header,
  .detail-toolbar,
  .detail-status-editor,
  .detail-link-row,
  .incident-detail-header {
    align-items: stretch;
  }

  .detail-status-editor {
    grid-template-columns: 1fr;
  }

  .detail-section-header,
  .detail-edit-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .detail-edit-form,
  .detail-approval-form {
    grid-template-columns: 1fr;
  }

  .approval-history-item time {
    width: 100%;
    margin-left: 0;
  }

  .search-actions,
  .search-results-header,
  .detail-toolbar,
  .detail-link-row,
  .incident-detail-header {
    flex-direction: column;
  }

  .search-buttons {
    width: 100%;
  }

  .search-buttons .secondary-button,
  .search-buttons .primary-button {
    flex: 1;
  }

  .report-meta {
    display: grid;
    gap: 7px;
  }

  .modal-actions {
    flex-direction: column-reverse;
  }
}

@media print {
  body * {
    visibility: hidden;
  }

  .report-modal,
  .report-modal * {
    visibility: visible;
  }

  .report-modal {
    position: absolute;
    inset: 0;
    width: 100%;
    max-height: none;
    box-shadow: none;
  }

  .modal-header button,
  .modal-actions {
    display: none;
  }
}

/* ─── Intake view ─────────────────────────────────────────────────────────── */

.intake-form {
  max-width: 820px;
}

.intake-fields {
  display: grid;
  gap: 14px;
}

.intake-textarea-label {
  width: 100%;
}

.intake-textarea-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.intake-textarea-heading label {
  font-weight: 700;
}

.intake-demo-fill {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid #a9c9ba;
  border-radius: 999px;
  color: var(--green-dark);
  background: #f3faf7;
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.intake-demo-fill:hover {
  border-color: var(--green);
  background: #e9f5ef;
}

.intake-demo-fill:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.intake-textarea-label textarea {
  width: 100%;
  min-height: 160px;
  padding: 14px 16px;
  border: 1px solid #cfdbd4;
  border-radius: 10px;
  color: var(--ink);
  background: white;
  resize: vertical;
  font: inherit;
  font-size: 13px;
  line-height: 1.7;
  transition: border-color 180ms ease, box-shadow 180ms ease;
}

.intake-textarea-label textarea:focus {
  outline: none;
  border-color: #7ca892;
  box-shadow: 0 0 0 3px rgba(32, 117, 83, 0.08);
}

.intake-processing-status {
  display: grid;
  gap: 10px;
  max-width: 820px;
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid #bdd9cd;
  border-radius: 12px;
  background: #f3faf7;
}

.intake-processing-status.hidden {
  display: none;
}

.intake-processing-copy {
  display: flex;
  align-items: center;
  gap: 10px;
}

.intake-processing-copy > span:last-child {
  display: grid;
  gap: 1px;
}

.intake-processing-copy strong {
  color: var(--green-dark);
  font-size: 12px;
}

.intake-processing-copy small {
  color: var(--muted);
  font-size: 10px;
}

.intake-processing-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid #c9ded4;
  border-top-color: var(--green);
  border-radius: 50%;
  animation: intake-processing-spin 0.8s linear infinite;
}

.intake-processing-status.complete .intake-processing-spinner {
  border: 0;
  animation: none;
}

.intake-processing-status.complete .intake-processing-spinner::before {
  content: "✓";
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: white;
  background: var(--green);
  font-size: 11px;
  font-weight: 900;
}

.intake-processing-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.intake-processing-steps li {
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--muted);
  background: #e7ece9;
  text-align: center;
  font-size: 9px;
  font-weight: 700;
}

.intake-processing-steps li.active {
  color: white;
  background: var(--green);
}

.intake-processing-steps li.done {
  color: var(--green-dark);
  background: #d7eee3;
}

@keyframes intake-processing-spin {
  to {
    transform: rotate(360deg);
  }
}

/* 新規作成 / 過去の報告を再編集 の切替セグメント */
.build-week-evidence {
  display: grid;
  grid-template-columns: 1.15fr repeat(4, minmax(0, 1fr));
  max-width: 820px;
  margin: 16px 0 18px;
  border: 1px solid #cfe1d8;
  border-radius: 14px;
  overflow: hidden;
  background: linear-gradient(135deg, #f1f8f4 0%, #fbfdfc 100%);
  box-shadow: 0 10px 26px rgba(18, 67, 49, 0.06);
}

.build-week-evidence-title,
.build-week-evidence-item {
  display: flex;
  min-width: 0;
  padding: 12px 13px;
  flex-direction: column;
  justify-content: center;
}

.build-week-evidence-title {
  color: white;
  background: var(--green-dark);
}

.build-week-evidence-title span {
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.14em;
  opacity: 0.72;
}

.build-week-evidence-title strong {
  margin-top: 2px;
  font-size: 13px;
}

.build-week-evidence-item {
  border-left: 1px solid #dce9e2;
}

.build-week-evidence-item strong {
  color: var(--green-dark);
  font-size: 15px;
  line-height: 1.2;
}

.build-week-evidence-item span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.35;
}

.intake-judge-summary {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid #b9d8ca;
  border-radius: 16px;
  color: #173b2e;
  background:
    radial-gradient(circle at top right, rgba(80, 176, 132, 0.16), transparent 36%),
    linear-gradient(135deg, #f2faf6 0%, #fbfefd 100%);
}

.intake-judge-summary-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.intake-judge-summary-eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.13em;
}

.intake-judge-summary h3 {
  margin: 0;
  font-size: 18px;
}

.intake-judge-summary-head p {
  max-width: 540px;
  margin: 0;
  color: #536b61;
  font-size: 11px;
  line-height: 1.55;
}

.intake-judge-summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.intake-judge-summary-grid article {
  padding: 11px;
  border: 1px solid #d9e9e1;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.82);
}

.intake-judge-summary-grid span,
.intake-judge-summary-grid small {
  display: block;
  color: #61776d;
  font-size: 9px;
  line-height: 1.35;
}

.intake-judge-summary-grid strong {
  display: block;
  margin: 4px 0;
  color: var(--green-dark);
  font-size: 18px;
}

.intake-judge-summary-footer {
  display: flex;
  gap: 12px;
  margin: 12px 0 0;
  color: #3c5f50;
  font-size: 10px;
  line-height: 1.45;
}

.intake-judge-summary-footer strong {
  color: #9a4f18;
}

.intake-mode {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  max-width: 820px;
  margin: 4px 0 18px;
}

.intake-mode-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease,
    background 0.16s ease;
}

.intake-mode-btn:hover,
.intake-mode-btn:focus-visible {
  border-color: rgba(12, 107, 79, 0.35);
  box-shadow: 0 12px 30px rgba(18, 33, 28, 0.07);
  transform: translateY(-1px);
}

.intake-mode-btn:focus-visible {
  outline: 2px solid rgba(12, 107, 79, 0.2);
  outline-offset: 3px;
}

.intake-mode-btn.active {
  border-color: var(--green);
  background: var(--green-light);
  box-shadow: 0 12px 30px rgba(12, 107, 79, 0.12);
}

.intake-mode-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9px;
  background: var(--soft);
  color: var(--green);
  font-size: 18px;
  font-weight: 600;
}

.intake-mode-btn.active .intake-mode-icon {
  background: white;
}

.intake-mode-body {
  display: grid;
  gap: 2px;
}

.intake-mode-body strong {
  font-size: 13px;
}

.intake-mode-body small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

/* 過去の報告 選択パネル */
.intake-revise-panel {
  max-width: 820px;
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.7);
}

.intake-revise-search-field {
  margin-bottom: 12px;
}

.intake-revise-list {
  display: grid;
  gap: 8px;
  max-height: 320px;
  overflow-y: auto;
  margin: 0;
  padding: 0;
  list-style: none;
}

.intake-revise-item {
  display: grid;
  /* The translated classification badge is wider than the Japanese badge.
     Let both edge columns size to their content and reserve the flexible
     middle column for the ellipsized report title. */
  grid-template-columns: max-content minmax(0, 1fr) max-content;
  align-items: center;
  gap: 14px;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.intake-revise-item:hover,
.intake-revise-item:focus-visible {
  border-color: rgba(12, 107, 79, 0.35);
  box-shadow: 0 12px 30px rgba(18, 33, 28, 0.07);
  transform: translateY(-1px);
}

.intake-revise-item:focus-visible {
  outline: 2px solid rgba(12, 107, 79, 0.2);
  outline-offset: 2px;
}

.intake-revise-item-body {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.intake-revise-item-body strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.intake-revise-item-body small {
  color: var(--muted);
  font-size: 11px;
}

.intake-revise-item-status {
  color: var(--green);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}

.intake-revise-empty {
  padding: 22px;
  border: 1px dashed #cbd8d1;
  border-radius: 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  text-align: center;
  list-style: none;
}

.intake-text-english-preview {
  min-height: 190px;
  padding: 14px 16px;
  border: 1px solid #cbd8d1;
  border-radius: 10px;
  background: white;
  color: var(--ink);
  font: inherit;
  line-height: 1.65;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

/* 下書きに読み込んだ元報告を示すバナー */
.intake-revise-source {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  max-width: 820px;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--green);
  border-radius: 12px;
  background: var(--green-light);
  color: var(--green-dark);
  font-size: 12px;
  line-height: 1.6;
}

.intake-revise-source-icon {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  border-radius: 8px;
  background: white;
  color: var(--green);
  font-size: 14px;
}

.intake-revise-source-clear {
  flex-shrink: 0;
  margin-left: auto;
  padding: 6px 12px;
  border: 1px solid var(--green);
  border-radius: 8px;
  background: white;
  color: var(--green-dark);
  font-size: 11px;
  cursor: pointer;
  transition: background 0.16s ease;
}

.intake-revise-source-clear:hover,
.intake-revise-source-clear:focus-visible {
  background: white;
  box-shadow: 0 6px 16px rgba(12, 107, 79, 0.15);
}

@media (max-width: 720px) {
  .intake-textarea-heading {
    align-items: flex-start;
  }

  .intake-processing-steps {
    grid-template-columns: 1fr;
  }

  .intake-mode {
    grid-template-columns: 1fr;
  }

  .build-week-evidence {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .build-week-evidence-title {
    grid-column: 1 / -1;
  }

  .build-week-evidence-item:nth-child(even) {
    border-left: 0;
  }

  .intake-judge-summary-head {
    display: block;
  }

  .intake-judge-summary-head p {
    margin-top: 8px;
  }

  .intake-judge-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .intake-judge-summary-footer {
    display: block;
  }

  .intake-revise-item {
    grid-template-columns: max-content minmax(0, 1fr);
  }

  .intake-revise-item-status {
    display: none;
  }
}

.intake-error {
  padding: 10px 14px;
  border-radius: 8px;
  color: #8b3428;
  background: #fce8e4;
  font-size: 12px;
}

.auth-notice {
  padding: 10px 14px;
  border-radius: 8px;
  color: var(--green-dark);
  background: var(--green-light);
  font-size: 12px;
}

.intake-results {
  max-width: 820px;
  margin-top: 32px;
}

.intake-review-notice {
  padding: 14px 18px;
  margin-bottom: 24px;
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  color: #765028;
  background: #fdf3e3;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.65;
}

.intake-ai-status,
.intake-grounding-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 12px;
}
.intake-ai-status.hidden,
.intake-grounding-summary.hidden { display: none; }
.ai-provider-badge,
.basis-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.5;
}
.ai-provider-badge.local { color: var(--green-dark); background: var(--green-light); }
.ai-provider-badge.cloud { color: #22578a; background: #e5f0fb; }
.basis-fact { color: #22578a; background: #e5f0fb; }
.basis-inference { color: #765028; background: #fdf3e3; }
.basis-confirmation { color: #8a3526; background: #fbeae6; }

/* P3 deterministic-guard warnings — safety-critical, red-accented */
.intake-warnings {
  padding: 14px 18px;
  margin-bottom: 16px;
  border-left: 4px solid var(--red);
  border-radius: 8px;
  background: #fbeae6;
  color: #8a3526;
  font-size: 13px;
  line-height: 1.6;
}
.intake-warnings.hidden { display: none; }
.intake-warnings-title { font-weight: 700; margin-bottom: 6px; }
.intake-warnings ul { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 6px; }
.intake-warnings li { display: flex; gap: 8px; align-items: baseline; }
.warn-tag {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
}
.warn-tag.warn-cls { background: var(--amber); }
.warn-tag.warn-countermeasure { background: #8a3526; }

/* ②強化-2 analysis confidence badge */
.intake-confidence {
  margin-bottom: 20px;
  font-size: 12px;
  color: #667;
  font-weight: 600;
}
.intake-confidence.hidden { display: none; }
.conf-badge {
  display: inline-block;
  padding: 1px 10px;
  border-radius: 999px;
  font-weight: 700;
  color: #fff;
}
.conf-badge.conf-high { background: var(--green); }
.conf-badge.conf-medium { background: var(--amber); }
.conf-badge.conf-low { background: var(--red); }

/* ②強化-2 retrieval reasons list */
.retrieval-reasons {
  margin: 8px 0 0;
  padding-left: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}
.retrieval-reasons li {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: baseline;
  padding: 8px 12px;
  border: 1px solid var(--green-light);
  border-radius: 8px;
  font-size: 12px;
}
.retr-src { font-weight: 700; color: var(--green-dark); }
.retr-score { color: #667; }
.retr-reasons { color: #334; }
.retr-meta { color: #889; width: 100%; }

.intake-results-grid {
  display: grid;
  gap: 0;
}

.intake-question-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.intake-question-list li {
  padding: 10px 14px;
  border-radius: 9px;
  background: var(--soft);
  font-size: 12px;
  line-height: 1.65;
}

/* ── 報告書ファースト：できた報告書を主役に表示 ────────────────── */
.intake-report-hero {
  margin-top: 8px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 22px 54px rgba(18, 33, 28, 0.08);
}

.intake-report-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.intake-report-head .eyebrow {
  color: var(--green);
}

.intake-report-title {
  margin: 2px 0 0;
  font-size: 20px;
}

.intake-report-frame-wrap {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  background: #fff;
}

.intake-report-frame {
  display: block;
  width: 100%;
  height: 620px;
  border: 0;
  background: #fff;
}

/* 生成中スケルトン（枠に重ねる） */
.intake-report-skeleton {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  padding: 40px;
  background: #fff;
}

.intake-report-skeleton.hidden {
  display: none;
}

.intake-report-skeleton-inner {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(560px, 100%);
}

.skeleton-line {
  height: 14px;
  border-radius: 6px;
  background: linear-gradient(90deg, #eef2ef 25%, #e2e9e4 37%, #eef2ef 63%);
  background-size: 400% 100%;
  animation: intake-skeleton 1.4s ease infinite;
}

.skeleton-line.skeleton-title {
  height: 22px;
  width: 45%;
  margin-bottom: 6px;
}

@keyframes intake-skeleton {
  0% {
    background-position: 100% 50%;
  }
  100% {
    background-position: 0 50%;
  }
}

.intake-report-skeleton-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

/* 報告書描画エラー（空白の代わりに原因＋再試行を出す） */
.intake-report-error {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 40px;
  text-align: center;
  background: #fff;
}

.intake-report-error.hidden {
  display: none;
}

.intake-report-error p {
  margin: 0;
  max-width: 460px;
  color: #8b3428;
  font-size: 13px;
  line-height: 1.7;
}

/* SIの4つの価値（事故分析・原因分析・類似災害検索・再発防止提案）サマリーバー。
   アコーディオンを開かなくても常時見える位置に置く。 */
.intake-value-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.intake-value-summary.hidden {
  display: none;
}

.intake-trust-flow {
  margin-bottom: 14px;
  padding: 14px 16px;
  border: 1px solid #bdd9cd;
  border-radius: 14px;
  background: linear-gradient(135deg, #f3faf7 0%, #f8fbff 100%);
}

.intake-trust-flow.hidden {
  display: none;
}

.intake-trust-flow-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 12px;
}

.intake-trust-flow-eyebrow {
  color: var(--green);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.intake-trust-flow h3 {
  margin: 2px 0 0;
  color: var(--green-dark);
  font-size: 15px;
}

.intake-trust-flow-head p,
.intake-trust-flow-note {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.intake-trust-flow-head p {
  max-width: 520px;
  text-align: right;
}

.intake-trust-steps {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.intake-trust-step {
  position: relative;
  display: flex;
  gap: 7px;
  min-width: 0;
  padding: 9px;
  border: 1px solid #d7e4de;
  border-radius: 10px;
  background: #fff;
}

.intake-trust-step:not(:last-child)::after {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: -8px;
  content: "›";
  color: #7da491;
  font-weight: 800;
  transform: translateY(-50%);
}

.intake-trust-step-number {
  display: grid;
  place-items: center;
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #d9eee5;
  color: var(--green-dark);
  font-size: 10px;
  font-weight: 800;
}

.intake-trust-step-copy {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.intake-trust-step-copy strong {
  color: var(--ink);
  font-size: 10px;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.intake-trust-step-copy small {
  color: var(--green-dark);
  font-size: 9px;
  line-height: 1.35;
}

.intake-trust-step.attention .intake-trust-step-number,
.intake-trust-step.warning .intake-trust-step-number {
  background: #f9e4c5;
  color: #8a5a26;
}

.intake-trust-step.muted {
  background: #f6f7f6;
}

.intake-trust-step.muted .intake-trust-step-number {
  background: #e6e9e7;
  color: var(--muted);
}

.intake-trust-step.human {
  border-color: #9fc8b5;
  background: #edf7f2;
}

.intake-trust-flow-note {
  margin-top: 9px;
  font-weight: 600;
}

.value-card {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--soft);
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 3px;
}

.value-card-label {
  font-size: var(--fs-2xs);
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--muted);
}

.value-card-metric {
  font-size: var(--fs-lg);
  color: var(--green-dark);
  line-height: 1.2;
}

.value-card small {
  color: var(--muted);
  font-size: var(--fs-xs);
}

.value-card-alert {
  border-color: var(--red);
  background: #fdf1ef;
}

.value-card-alert .value-card-metric {
  color: var(--red);
}

.value-card-alert small {
  color: #9d3e31;
  font-weight: 600;
}

.severity-escalation-summary {
  grid-column: 1 / -1;
  padding: 13px 16px;
  border: 1px solid #c9d9e6;
  border-left: 4px solid var(--green);
  border-radius: var(--radius-md);
  background: #f7fbfd;
}

.severity-escalation-heading {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 7px;
  color: var(--green-dark);
  font-size: var(--fs-sm);
}

.severity-escalation-summary p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: var(--fs-xs);
  line-height: 1.55;
}

.severity-escalation-narrative {
  padding-top: 5px;
  border-top: 1px solid #dce7ee;
}

.severity-escalation-alert {
  border-color: #d89084;
  border-left-color: var(--red);
  background: #fdf1ef;
}

.severity-escalation-alert .severity-escalation-heading {
  color: var(--red);
}

@media (max-width: 720px) {
  .intake-value-summary {
    grid-template-columns: repeat(2, 1fr);
  }

  .intake-trust-flow-head {
    display: grid;
  }

  .intake-trust-flow-head p {
    text-align: left;
  }

  .intake-trust-steps {
    grid-template-columns: 1fr;
  }

  .intake-trust-step:not(:last-child)::after {
    top: auto;
    right: 50%;
    bottom: -10px;
    transform: translateX(50%) rotate(90deg);
  }

  .severity-escalation-heading {
    display: grid;
  }
}

/* 要確認チップ列（第2段B）：報告書のすぐ上に不足項目を出す */
.intake-report-flags {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid #ecd9bf;
  border-radius: 12px;
  background: #fdf6ec;
}

.intake-report-flags.hidden {
  display: none;
}

.intake-report-flags-label {
  flex-shrink: 0;
  padding: 2px 10px;
  border-radius: 999px;
  background: #ae6c2c;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}

.intake-report-flags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.intake-flag-chip {
  padding: 5px 12px;
  border: 1px solid #e0c39a;
  border-radius: 999px;
  background: #fff;
  color: #8a5a26;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  transition:
    border-color 0.16s ease,
    box-shadow 0.16s ease,
    transform 0.16s ease;
}

.intake-flag-chip:hover,
.intake-flag-chip:focus-visible {
  border-color: #ae6c2c;
  box-shadow: 0 6px 16px rgba(174, 108, 44, 0.16);
  transform: translateY(-1px);
}

.intake-flag-chip:focus-visible {
  outline: 2px solid rgba(174, 108, 44, 0.25);
  outline-offset: 2px;
}

.intake-report-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.intake-stale-notice {
  display: flex;
  align-items: baseline;
  gap: 8px 14px;
  margin-top: 14px;
  padding: 12px 14px;
  border: 1px solid #e3b678;
  border-left: 4px solid #c9771f;
  border-radius: 10px;
  background: #fff5e7;
  color: #744719;
  font-size: 13px;
  line-height: 1.6;
}

.intake-stale-notice strong {
  flex: 0 0 auto;
  color: #64390f;
}

.intake-stale-notice.hidden {
  display: none;
}

/* 別タブで開く＝補助アクションとして控えめに */
.intake-ghost-action {
  margin-left: auto;
  opacity: 0.85;
}

/* 補足ループ（第4段E）：報告書直下の副次アクション。主アクションと競合しない控えめな見た目。 */
.intake-report-supplement {
  margin-top: 16px;
  padding: 14px 16px;
  border: 1px dashed #cdd8d1;
  border-radius: 12px;
  background: rgba(243, 246, 243, 0.6);
}

.intake-report-supplement-head {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 8px;
}

.intake-report-supplement-head strong {
  font-size: 13px;
  color: var(--ink);
}

.intake-report-supplement-head small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.intake-report-supplement textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cfdbd4;
  border-radius: 8px;
  color: var(--ink);
  background: #fff;
  resize: vertical;
  font: inherit;
  font-size: 13px;
  line-height: 1.6;
}

.intake-report-supplement textarea:focus {
  outline: none;
  border-color: #7ca892;
  box-shadow: 0 0 0 3px rgba(32, 117, 83, 0.08);
}

.intake-report-supplement-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}

.intake-question-note {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

/* ── 根拠と分析：既定は畳む ─────────────────────────────────── */
.intake-analysis-details {
  margin-top: 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.6);
}

.intake-analysis-summary {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 16px 20px;
  cursor: pointer;
  list-style: none;
  font-weight: 600;
  color: var(--ink);
}

.intake-analysis-summary::-webkit-details-marker {
  display: none;
}

.intake-analysis-summary::before {
  content: "▸";
  color: var(--green);
  transition: transform 0.16s ease;
}

.intake-analysis-details[open] .intake-analysis-summary::before {
  transform: rotate(90deg);
}

.intake-analysis-summary-hint {
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.intake-analysis-body {
  padding: 4px 20px 20px;
}

@media (max-width: 720px) {
  .intake-report-frame {
    height: 460px;
  }

  .intake-ghost-action {
    margin-left: 0;
  }
}

.intake-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.intake-style-field {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: auto;
  font-size: 12px;
  color: var(--muted);
}

.intake-style-field span {
  white-space: nowrap;
}

.intake-style-field select {
  font-size: 12px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
}

.intake-draft-status {
  color: var(--green);
  font-size: 12px;
  font-weight: 600;
}

.intake-submission-readiness {
  margin-top: 28px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
}

.intake-submission-readiness .sr-optional {
  color: #ae6c2c;
  font-size: 8px;
}

.sr-note {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.sr-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
}

.sr-tier h4 {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--ink);
}

.sr-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.sr-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 9px;
  background: var(--soft);
  font-size: 12px;
  line-height: 1.5;
}

.sr-list .sr-mark {
  flex: none;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
}

.sr-list .sr-label {
  flex: 1;
}

.sr-list .sr-state {
  flex: none;
  color: var(--muted);
  font-size: 10px;
}

.sr-list .sr-present .sr-mark {
  background: var(--green-light);
  color: var(--green-dark);
}

.sr-list .sr-unknown .sr-mark {
  background: #f6e6cf;
  color: #ae6c2c;
}

.sr-list .sr-empty {
  background: transparent;
  color: var(--muted);
  justify-content: flex-start;
}

.intake-supplement {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.intake-supplement label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
}

.intake-supplement textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cfdbd4;
  border-radius: 10px;
  color: var(--ink);
  background: white;
  resize: vertical;
  font: inherit;
  font-size: 13px;
  line-height: 1.7;
  transition: border-color 180ms ease, box-shadow 180ms ease;
  box-sizing: border-box;
}

.intake-supplement textarea:focus {
  outline: none;
  border-color: #7ca892;
  box-shadow: 0 0 0 3px rgba(32, 117, 83, 0.08);
}

.profile-selector .profile-select {
  width: 100%;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border, rgba(255, 255, 255, 0.12));
  background: var(--surface-2, rgba(255, 255, 255, 0.04));
  color: inherit;
  font: inherit;
}
.profile-applied {
  font-size: 12px;
  opacity: 0.75;
}
.profile-applied.hidden {
  display: none;
}

/* ── Output Profile Render ── */
.output-profile-render.hidden {
  display: none;
}

.profile-render-body {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 10px;
}

.profile-block h4 {
  font-size: 13px;
  margin: 0 0 6px;
  opacity: 0.85;
}

.profile-items {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.profile-items li {
  position: relative;
  padding: 7px 10px 7px 24px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #dce4df;
  font-size: 9px;
  line-height: 1.55;
}

.profile-items li::before {
  content: "›";
  position: absolute;
  left: 9px;
  font-weight: 700;
  opacity: 0.5;
}

.profile-group {
  padding-left: 10px;
  border-left: 2px solid #dce4df;
  margin-bottom: 8px;
}

.profile-group h5 {
  font-size: 12px;
  opacity: 0.7;
  margin: 6px 0 4px;
}

.profile-empty {
  font-size: 12px;
  opacity: 0.5;
  margin: 0;
}

.profile-confidence {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid #dce4df;
  opacity: 0.85;
}
.profile-confidence.hidden {
  display: none;
}
.confidence-high {
  color: #4caf50;
  border-color: rgba(76, 175, 80, 0.3);
}
.confidence-medium {
  color: #ff9800;
  border-color: rgba(255, 152, 0, 0.3);
}
.confidence-low {
  color: #f44336;
  border-color: rgba(244, 67, 54, 0.3);
}

/* ─── Intake attach area ────────────────────────────────────── */
.intake-attach {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
  margin-bottom: 4px;
}

.intake-attach-status {
  font-size: 12px;
  color: var(--muted);
}

.intake-attachment-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  width: 100%;
}

.intake-attachment-list li {
  padding: 4px 10px;
  border-radius: 20px;
  background: var(--soft);
  border: 1px solid var(--line);
  font-size: 12px;
  color: var(--ink);
}

.intake-attachment-list.hidden {
  display: none;
}

/* ─── Control Quality Advisory ─────────────────────────────── */
.intake-control-advisory {
  margin-top: 16px;
  padding: 12px 16px;
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  background: #fdf3e3;
  color: #765028;
  font-size: 12px;
  line-height: 1.6;
}

.intake-control-advisory.hidden {
  display: none;
}

.intake-control-advisory small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
}

/* ─── Recommended Controls (past-case citations) ────────────── */
.recommended-note {
  margin: 0 0 10px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

.recommended-controls {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 8px;
}

.recommended-controls li {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--soft);
  font-size: 12px;
  line-height: 1.55;
}

.recommended-action {
  flex: 1;
  min-width: 0;
}

.recommended-controls li small {
  width: 100%;
  color: var(--muted);
  font-size: 11px;
}

.recommended-source-link {
  color: var(--green-dark);
  text-underline-offset: 2px;
}

/* ─── Control Level Badges ──────────────────────────────────── */
.ctrl-badge {
  flex: none;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.ctrl-badge.lvl-elim {
  background: #dceede;
  color: #1d6b3a;
}

.ctrl-badge.lvl-eng {
  background: var(--green-light);
  color: var(--green-dark);
}

.ctrl-badge.lvl-admin {
  background: #fbe9d2;
  color: #8a5a16;
}

.ctrl-badge.lvl-ppe {
  background: #f1e2d0;
  color: #92531b;
}

.ctrl-badge.lvl-unknown {
  background: #e8eae6;
  color: #6d7a74;
}

/* ─── Corpus Review view ────────────────────────────────────────────────── */

.corpus-status-badge {
  display: inline-block;
  flex: none;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
}

.corpus-status-confirmed {
  color: var(--green-dark);
  background: var(--green-light);
}

.corpus-status-pending {
  color: var(--muted);
  background: var(--soft);
}

.corpus-list-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.corpus-list-main strong {
  font-size: 12px;
  line-height: 1.45;
  word-break: break-all;
}

.corpus-list-main small {
  color: var(--muted);
  font-size: 11px;
}

/* Override history-item grid for corpus list items (badge replaces status b) */
#corpus-list .history-item {
  grid-template-columns: 1fr auto;
  gap: 12px;
}

/* corpus は上部余白を詰め、一覧/詳細（各ペインは viewport 高さで内部スクロール）を
   早く見せる。ページ全体を固定高にすると背の高いヘッダでペインが潰れるため、
   body スクロールは許容しつつ各ペインを viewport 高さに収める方式にする。 */
#corpus-view {
  padding-top: 20px;
}

/* コーパスは反復レビュー用途＝定型の見出し/説明/検索パネルの余白を詰め、
   一覧・詳細ペインを画面上方に引き上げてスクロール前に見せる。
   すべて #corpus-view 限定＝他プレースホルダビュー（報告/入力/履歴/システム/ユーザー）は不変。 */
#corpus-view .eyebrow {
  margin-bottom: 2px;
}

#corpus-view h1 {
  font-size: 22px;
  margin: 4px 0 4px;
}

#corpus-view > p {
  margin: 0 0 4px;
  font-size: 12px;
  color: var(--muted);
}

#corpus-view .history-search-panel {
  margin-top: 14px;
  padding: 14px 16px;
}

#corpus-view .search-actions {
  margin-top: 10px;
}

/* corpus は master-detail を再配分＝一覧を細く・詳細を広く（詳細が主役）。
   既定の .history-layout は 報告履歴ビューと共有のため、上書きは #corpus-view に限定。 */
#corpus-view .history-layout {
  grid-template-columns: minmax(240px, 300px) minmax(0, 1fr);
  margin-top: 14px;
}

/* 一覧列は viewport 高さに収め、事例一覧（#corpus-list）だけを内部スクロールに。
   100件あってもページ全体が縦に伸びず、左の一覧が独立してスクロールする。
   ページャは列下部に固定（一覧スクロールでは動かない）。 */
.corpus-list-column {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  min-height: 0;
  max-height: calc(100vh - 96px);
}

#corpus-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* 事例一覧のスクロールバー：スクロール可能時は常時表示し、独自の幅を占めて内容
   （カード右端のレビュー状態バッジ）に重ならない非オーバーレイにする。
   WebKit/Blink（Chrome・Safari）は幅を明示した ::-webkit-scrollbar で実現。
   ※ 標準プロパティ scrollbar-width を併記すると Chromium が ::-webkit-scrollbar を
   無視して macOS のオーバーレイ（幅0・内容に重畳）へ戻るため、標準プロパティは
   ::-webkit-scrollbar 非対応（＝Firefox）のときだけ @supports で当てる。 */
#corpus-list::-webkit-scrollbar {
  width: 10px;
}

#corpus-list::-webkit-scrollbar-track {
  background: transparent;
}

#corpus-list::-webkit-scrollbar-thumb {
  background: #a3b5ac;
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: content-box;
}

#corpus-list::-webkit-scrollbar-thumb:hover {
  background: #7f948b;
}

@supports not selector(::-webkit-scrollbar) {
  #corpus-list {
    scrollbar-width: thin;
    scrollbar-color: #a3b5ac transparent;
  }
}

.corpus-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 8px;
}

#corpus-page-info {
  color: var(--muted);
  font-size: 12px;
}

.corpus-meta-list {
  margin: 18px 0 0;
  overflow: hidden;
  border: 1px solid #dce4df;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
}

.corpus-meta-list div {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 9px;
  padding: 9px 11px;
  border-bottom: 1px solid #e4eae6;
}

.corpus-meta-list div:last-child {
  border-bottom: 0;
}

.corpus-meta-list dt {
  color: var(--muted);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.corpus-meta-list dd {
  margin: 0;
  font-size: 11px;
  font-weight: 600;
  word-break: break-all;
}

.corpus-section {
  margin-top: 18px;
}

.corpus-section-title {
  margin: 0 0 8px;
  font-size: 13px;
}

/* 詳細パネルをコンテナに。原因/対策の2列化はビューポートでなく
   詳細パネル自身の幅で判定する（狭い詳細では1列にして詰まりを防ぐ）。
   併せて viewport 高さに収めて内部スクロールに＝一覧・詳細とも各ペイン内で
   スクロールし、長い事例でもページ全体が縦に伸びない。 */
#corpus-detail {
  container-type: inline-size;
  min-height: 0;
  max-height: calc(100vh - 96px);
  overflow-y: auto;
}

.corpus-cause-control {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  align-items: start;
}

@container (min-width: 460px) {
  .corpus-cause-control {
    grid-template-columns: 1fr 1fr;
  }
}

.corpus-cause-control-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}

.corpus-detail-list {
  font-size: 12px;
}

.detail-list-item {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--soft);
  font-size: 12px;
  line-height: 1.65;
}

.corpus-reviewed-by {
  margin-top: 14px;
  font-size: 11px;
  color: var(--muted);
}

.corpus-review-form {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.corpus-review-form label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.corpus-review-form textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid #cfdbd4;
  border-radius: 10px;
  color: var(--ink);
  background: white;
  resize: vertical;
  font: inherit;
  font-size: 13px;
  line-height: 1.65;
  transition: border-color 180ms ease, box-shadow 180ms ease;
  box-sizing: border-box;
}

.corpus-review-form textarea:focus {
  outline: none;
  border-color: #7ca892;
  box-shadow: 0 0 0 3px rgba(32, 117, 83, 0.08);
}

.corpus-review-form textarea:disabled {
  background: var(--soft);
  color: var(--muted);
}

.corpus-review-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.corpus-review-actions .primary-button,
.corpus-review-actions .secondary-button {
  flex: 1 1 auto;
}

@media (max-width: 520px) {
  .corpus-review-actions {
    flex-direction: column;
  }
}

/* ─── Auth overlays (login / forced password change) ───────────────────── */

.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(11, 27, 21, 0.72);
  backdrop-filter: blur(4px);
}

.auth-card {
  width: 100%;
  max-width: 380px;
  padding: 34px 30px;
  border-radius: 18px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.auth-brand {
  margin-bottom: 22px;
  color: var(--ink);
}

.auth-card h2 {
  margin: 0 0 6px;
  font-size: 21px;
}

.auth-subtitle {
  margin: 0 0 22px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form input {
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid #cfdbd4;
  border-radius: 10px;
  color: var(--ink);
  background: white;
  font: inherit;
}

.auth-form input:focus {
  outline: none;
  border-color: #7ca892;
  box-shadow: 0 0 0 3px rgba(32, 117, 83, 0.08);
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
}

.auth-setup-complete {
  display: grid;
  gap: 14px;
}

.auth-setup-complete .auth-subtitle {
  margin-bottom: 0;
}

.auth-alt {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.auth-alt-link {
  padding: 0;
  border: none;
  background: none;
  color: var(--green);
  font: inherit;
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}

.auth-alt-link:hover {
  color: var(--green-dark);
}

@media (max-width: 520px) {
  .auth-overlay {
    align-items: flex-start;
    overflow-y: auto;
    padding: 12px;
  }

  .auth-card {
    margin: auto 0;
    padding: 28px 20px;
  }

  .auth-alt {
    line-height: 1.6;
  }
}

/* ─── User management view ──────────────────────────────────────────────── */

.users-toolbar {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
  flex-wrap: wrap;
}

.users-create-form {
  margin-top: 20px;
}

.users-form-hint {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.users-onetime-notice {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  max-width: 980px;
  margin-top: 20px;
  padding: 16px 18px;
  border-left: 4px solid var(--green);
  border-radius: 8px;
  background: var(--green-light);
  color: var(--green-dark);
}

.users-onetime-notice strong {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
}

.users-onetime-notice p {
  margin: 0 0 10px;
  font-size: 12px;
  line-height: 1.6;
}

.users-onetime-notice code {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 6px;
  background: white;
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 700;
  user-select: all;
}

.users-table-wrap {
  max-width: 980px;
  margin-top: 24px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: white;
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.users-table th,
.users-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}

.users-table th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.users-table tbody tr:last-child td {
  border-bottom: 0;
}

.users-table td.users-actions-cell {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  white-space: normal;
}

.users-table td.users-actions-cell button {
  padding: 7px 11px;
  font-size: 10px;
}

.users-tenant-context {
  margin: -8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.users-status-pill {
  display: inline-block;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 700;
}

.users-status-pill.active {
  color: #176c4e;
  background: #dcefe6;
}

.users-status-pill.inactive {
  color: #9d3e31;
  background: #f8ddd8;
}

@media (max-width: 520px) {
  .users-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .users-onetime-notice {
    flex-direction: column;
  }
}

/* 四視点 対策立案（システムの中核・FOUR_VIEWPOINTS_DESIGN.md） */
.viewpoints-note {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
  line-height: 1.6;
}
.countermeasure-viewpoints {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 720px) {
  .countermeasure-viewpoints {
    grid-template-columns: 1fr;
  }
}
.viewpoint-card {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  border-left-width: 4px;
}
.viewpoint-state { border-left-color: #4a90d9; }
.viewpoint-action { border-left-color: var(--amber); }
.viewpoint-mgmt { border-left-color: var(--green); }
.viewpoint-special { border-left-color: var(--red); }
.viewpoint-title {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
}
.viewpoint-findings,
.viewpoint-countermeasures {
  list-style: none;
  margin: 0;
  padding: 0;
}
.viewpoint-findings li {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
  padding-left: 14px;
  position: relative;
}
.viewpoint-findings li::before {
  content: "•";
  position: absolute;
  left: 2px;
}
.viewpoint-countermeasures {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}
.viewpoint-countermeasures li {
  font-size: 13px;
  color: var(--ink);
  line-height: 1.55;
}
.grounding-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
}
.grounding-sources {
  color: #778;
  font-size: 10px;
}
.timing-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 1px 7px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: 1px;
  white-space: nowrap;
}
.timing-now { background: #fbe3dc; color: #a63d2a; }
.timing-soon { background: #fdefd9; color: #9a5c1a; }
.timing-perm { background: var(--green-light); color: var(--green-dark); }

/* バッジ/ピル統一トークン（7系統: status-pill/corpus-status-badge/users-status-pill/
   timing-badge/ctrl-badge/conf-badge/warn-tag）。個別クラスの色分けルールは維持し、
   ジオメトリ・タイポグラフィのみここで揃える（カスケード順で個別指定を上書き）。 */
.status-pill,
.corpus-status-badge,
.users-status-pill,
.timing-badge,
.ctrl-badge,
.conf-badge,
.warn-tag {
  border-radius: var(--radius-pill);
  font-size: var(--fs-2xs);
  font-weight: 700;
  padding: 4px 10px;
  letter-spacing: 0.01em;
}
.viewpoint-empty {
  font-size: 12px;
  color: var(--muted);
  margin: 0;
}
.intake-localization-status {
  margin: 0.75rem 0;
  padding: 0.8rem 1rem;
  border-left: 4px solid #2563eb;
  border-radius: 0.45rem;
  background: #eff6ff;
  color: #1e3a5f;
  font-weight: 700;
}

.intake-localization-status.error {
  border-left-color: #c2410c;
  background: #fff7ed;
  color: #7c2d12;
}

.intake-results.english-localizing .intake-report-flags,
.intake-results.english-localizing .intake-report-frame,
.intake-results.english-localizing .intake-analysis-details,
.intake-results.english-localization-failed .intake-report-flags,
.intake-results.english-localization-failed .intake-report-frame,
.intake-results.english-localization-failed .intake-analysis-details {
  visibility: hidden;
}
