:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-muted: #eef2f7;
  --text: #1d2733;
  --muted: #647184;
  --line: #d9e0ea;
  --primary: #146b75;
  --primary-strong: #0d525a;
  --primary-soft: #d9f0f2;
  --focus: #155eef;
  --green-bg: #dff4e6;
  --green-text: #17683a;
  --blue-bg: #dcecff;
  --blue-text: #1559a6;
  --cyan-bg: #dff6fb;
  --cyan-text: #15687a;
  --orange-bg: #ffe8cc;
  --orange-text: #9a4b00;
  --gray-bg: #eceff3;
  --gray-text: #546172;
  --red-bg: #ffe0e0;
  --red-text: #ad2525;
  --yellow-bg: #fff2bf;
  --yellow-text: #806000;
  --shadow: 0 14px 36px rgba(31, 42, 55, 0.08);
}

* {
  box-sizing: border-box;
}

/* HTML hidden 属性を確実に効かせる（display:grid/flex 等の明示指定に UA の display:none が負ける問題） */
[hidden] {
  display: none !important;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: "Yu Gothic UI", "Hiragino Kaku Gothic ProN", Meiryo, system-ui, sans-serif;
  line-height: 1.65;
}

a {
  color: var(--primary);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

button,
input {
  font: inherit;
}

:focus-visible {
  outline: 3px solid rgba(21, 94, 239, 0.32);
  outline-offset: 2px;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 32px 16px;
  background:
    linear-gradient(135deg, rgba(20, 107, 117, 0.16), rgba(255, 255, 255, 0) 38%),
    linear-gradient(315deg, rgba(240, 170, 50, 0.18), rgba(255, 255, 255, 0) 34%),
    var(--bg);
}

.login-shell {
  width: min(100%, 520px);
}

.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: clamp(28px, 6vw, 48px);
}

.login-panel h1 {
  margin: 8px 0 16px;
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.2;
}

.login-lead,
.login-note {
  color: var(--muted);
}

.login-lead {
  margin: 0 0 28px;
}

.login-note {
  margin: 18px 0 0;
  font-size: 14px;
}

/* 外部委託ログイン / パスワード変更 */
.login-ext {
  margin-top: 20px;
  display: grid;
  gap: 12px;
}
.login-ext__panel {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  background: var(--surface-muted, #f7f8f9);
}
.login-ext__lead {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.6;
}
.login-ext__form {
  display: grid;
  gap: 12px;
}
.login-field {
  display: grid;
  gap: 6px;
}
.login-field__label {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text);
}
.login-field__input {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.95rem;
  font-family: inherit;
  box-sizing: border-box;
  background: var(--surface);
}
.login-ext__error {
  margin: 0;
  color: #b00020;
  font-weight: 700;
  font-size: 0.9rem;
  min-height: 1.2em;
}
.login-ext__ok {
  margin: 0;
  color: var(--primary-strong, #0d5c64);
  font-weight: 700;
  font-size: 0.9rem;
  min-height: 1.2em;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 10px clamp(16px, 5vw, 48px);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header h1 {
  margin: 2px 0 0;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.25;
}

.user-nav {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.current-user {
  color: var(--muted);
  font-size: 14px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 6px 0 56px;
}

/* ユーザー管理画面のみ幅を広げる（他ページは .page-shell のまま） */
.page-shell.page-shell--wide {
  width: min(1600px, calc(100% - 24px));
}

.eyebrow {
  margin: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.section-heading h2 {
  margin: 3px 0 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.25;
}

.section-heading p {
  margin: 0;
  color: var(--muted);
  max-width: 560px;
}

.section-heading--split {
  align-items: center;
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 14px;
  margin-bottom: 20px;
}

/* ヘッダー内パンくず: 余白・フォントを最小限に（eyebrow の上） */
.site-header .breadcrumb {
  font-size: 12px;
  margin-bottom: 4px;
  gap: 6px;
}

.button[hidden] { display: none; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 15px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.button:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.button--primary {
  background: var(--primary);
  color: #fff;
}

.button--primary:hover {
  background: var(--primary-strong);
}

.button--secondary {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--line);
}

.button--ghost {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.button--wide {
  width: 100%;
}

.button-icon {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #fff;
  color: var(--primary);
  font-weight: 800;
}

.feature-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.feature-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(31, 42, 55, 0.05);
}

.feature-card h3 {
  margin: 10px 0 8px;
  line-height: 1.35;
}

.category-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.metric {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.filter-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) minmax(240px, 2fr) minmax(220px, 1.4fr) auto;
  align-items: end;
  gap: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
}

.filter-group {
  min-width: 0;
}

.field-label {
  display: block;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.search-input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
  background: #fff;
  color: var(--text);
}

.segmented {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 11px;
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.chip[aria-pressed="true"] {
  background: var(--primary-soft);
  border-color: rgba(20, 107, 117, 0.45);
  color: var(--primary-strong);
}

.result-count {
  display: inline-flex;
  justify-content: center;
  min-width: 132px;
  min-height: 38px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted);
  font-weight: 700;
}

.feature-card {
  display: flex;
  flex-direction: column;
  min-height: 310px;
  padding: 18px;
}

.feature-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.feature-id {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 4px 9px;
  border-radius: 8px;
  background: #17212d;
  color: #fff;
  font-weight: 800;
  font-size: 13px;
}

.feature-card h3 {
  font-size: 18px;
}

.feature-card__summary {
  margin: 0 0 14px;
  color: var(--muted);
}

.badge-row,
.feature-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.badge--verifying {
  background: var(--green-bg);
  color: var(--green-text);
}

.badge--in_progress {
  background: var(--blue-bg);
  color: var(--blue-text);
}

.badge--spec_shared {
  background: var(--cyan-bg);
  color: var(--cyan-text);
}

.badge--requirement {
  background: var(--orange-bg);
  color: var(--orange-text);
}

.badge--not_started,
.badge--disabled {
  background: var(--gray-bg);
  color: var(--gray-text);
}

.badge--urgent_important {
  background: var(--red-bg);
  color: var(--red-text);
}

.badge--important {
  background: var(--yellow-bg);
  color: var(--yellow-text);
}

.feature-meta {
  margin: 14px 0;
  color: var(--muted);
  font-size: 13px;
}

.feature-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 8px;
  border-radius: 8px;
  background: var(--surface-muted);
}

.feature-link {
  margin-top: auto;
  align-self: flex-start;
  color: var(--primary-strong);
  font-weight: 800;
}

.feature-link--muted {
  color: var(--muted);
  cursor: default;
}

.empty-state {
  grid-column: 1 / -1;
  background: var(--surface);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 960px) {
  .filter-panel {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .site-header,
  .section-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .site-header {
    position: static;
  }

  .user-nav {
    justify-content: flex-start;
    width: 100%;
  }

  .filter-panel {
    grid-template-columns: 1fr;
  }

  .button--secondary {
    width: 100%;
  }
}

@media (max-width: 420px) {
  .page-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 2px;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .login-panel {
    padding: 24px 18px;
  }
}

/* ローカルログイン補足 */
.login-note--dev {
  color: var(--muted);
  font-size: 0.8rem;
}

/* 自己完結ツール（マスキング / 職務経歴書生成） */
.tool-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.tool-lead { color: var(--muted); margin: 0; line-height: 1.7; }
.tool-actions { display: flex; flex-wrap: wrap; gap: 12px; }
.tool-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
  font-size: 0.95rem;
  font-family: inherit;
  resize: vertical;
}
.tool-result { border-top: 1px solid var(--line); padding-top: 16px; }
.tool-result__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}
.tool-result__head h2 { margin: 0; font-size: 1.1rem; }
.mask-report { color: var(--primary-strong); font-size: 0.86rem; margin: 0 0 10px; }
.ca02-review-notice { border: 1px solid var(--red-text); background: var(--red-bg); color: var(--red-text); border-radius: 10px; padding: 12px 14px; margin: 0 0 10px; font-size: 0.86rem; font-weight: 600; }
.iv-result { white-space: pre-wrap; line-height: 1.65; font-size: 0.9rem; color: var(--text); min-height: 40px; }
.iv-result:empty::before { content: 'ここに質問候補が表示されます。'; color: var(--muted); }

/* CA-06 面接感想フォーム */
.field-required { color: var(--red-text); font-size: 0.8rem; margin-left: 4px; }
.isv-questions { display: flex; flex-direction: column; gap: 14px; }
.isv-history { display: flex; flex-direction: column; gap: 12px; }
.isv-history-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-muted);
  padding: 14px 16px;
}
.isv-history-card__meta {
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 10px;
  font-weight: 600;
}
.isv-kv { display: grid; grid-template-columns: minmax(120px, 180px) 1fr; gap: 6px 12px; margin: 0; }
.isv-kv dt { margin: 0; font-weight: 700; font-size: 0.88rem; color: var(--muted); }
.isv-kv dd { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: 0.92rem; }

/* CA-22 確度ダッシュボード */
.conf-disclaimer {
  border-left: 4px solid var(--orange-text);
  padding: 10px 14px;
  background: var(--orange-bg);
  border-radius: 0 10px 10px 0;
  color: var(--text);
}
.conf-warnings { margin-top: 4px; }
.conf-list { display: flex; flex-direction: column; gap: 16px; }
.conf-summary { margin-bottom: 8px; font-size: 0.92rem; }
.conf-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.conf-card__head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}
.conf-card__title { margin: 0; font-size: 1.05rem; flex: 1 1 auto; }
.conf-score {
  font-size: 1.4rem;
  font-weight: 800;
  color: var(--primary-strong);
  min-width: 2.5rem;
  text-align: right;
}
.conf-rank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 4.5rem;
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 0.86rem;
  letter-spacing: 0.02em;
}
.conf-rank--a { background: var(--green-bg); color: var(--green-text); }
.conf-rank--b { background: var(--blue-bg); color: var(--blue-text); }
.conf-rank--c { background: var(--orange-bg); color: var(--orange-text); }
.conf-sales {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  font-size: 0.9rem;
  color: var(--muted);
  font-weight: 600;
}
.conf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.conf-block {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-muted);
  padding: 12px 14px;
}
.conf-block h4 { margin: 0 0 8px; font-size: 0.9rem; }
.conf-block ul { margin: 0; padding-left: 1.15rem; font-size: 0.9rem; line-height: 1.55; }
.conf-block--up { border-color: #9ed4b0; background: #f3fbf6; }
.conf-block--down { border-color: #f0b4b4; background: #fff6f6; }
.conf-block--actions { border-color: #b7d4f0; background: #f3f8ff; }
.conf-empty { color: var(--muted); list-style: none; margin-left: -1.15rem; }
.conf-notes { font-size: 0.88rem; color: var(--muted); }
.conf-notes h4 { margin: 0 0 6px; font-size: 0.88rem; color: var(--text); }
.conf-notes ul { margin: 0; padding-left: 1.15rem; }
.conf-empty-state {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 20px;
  background: var(--surface-muted);
}
.conf-empty-state p { margin: 0 0 8px; }
.conf-empty-state p:last-child { margin-bottom: 0; }
.tool-output {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 16px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 460px;
  overflow: auto;
  font-size: 0.9rem;
  line-height: 1.7;
}

/* ポータル共通 AIチャットウィジェット（右側） */
.ai-chat__toggle {
  position: fixed; right: 20px; bottom: 20px; z-index: 50;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--primary); color: #fff; border: none;
  font-weight: 700; font-size: 1rem; cursor: pointer;
  box-shadow: var(--shadow);
}
.ai-chat__panel {
  position: fixed; right: 20px; bottom: 88px; z-index: 50;
  width: min(380px, calc(100vw - 40px)); height: min(560px, calc(100vh - 140px));
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden;
}
/* hidden 属性を尊重（display:flex が UA の display:none を上書きしてしまう問題の修正） */
.ai-chat__panel[hidden] { display: none; }
.ai-chat__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--primary); color: #fff; font-weight: 600;
}
.ai-chat__head-actions { display: flex; align-items: center; gap: 6px; }
.ai-chat__clear {
  background: transparent; border: 1px solid rgba(255,255,255,0.45); color: #fff;
  font-size: 0.72rem; line-height: 1; padding: 4px 8px; border-radius: 999px; cursor: pointer;
}
.ai-chat__clear:disabled, .ai-chat__send:disabled, .ai-preset:disabled { opacity: 0.55; cursor: default; }
.ai-chat__close { background: transparent; border: none; color: #fff; font-size: 1.2rem; cursor: pointer; }
.ai-chat__log { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.ai-bubble { max-width: 85%; padding: 9px 12px; border-radius: 12px; font-size: 0.9rem; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.ai-bubble--user { align-self: flex-end; background: var(--primary-soft); color: var(--primary-strong); }
.ai-bubble--assistant { align-self: flex-start; background: var(--surface-muted); color: var(--text); }
.ai-chat__form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.ai-chat__input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 8px; font-family: inherit; resize: none; }
.ai-chat__note { margin: 0; padding: 0 12px 10px; color: var(--muted); font-size: 0.78rem; }

/* PDFマスキング Web UI */
.mask-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); }
.mask-toolbar__check { font-size: 0.86rem; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.mask-toolbar__spacer { flex: 1; }
.mask-layout { display: grid; grid-template-columns: 1fr 300px; gap: 16px; margin-top: 14px; }
.mask-viewer { background: var(--surface-muted); border: 1px solid var(--line); border-radius: 12px; padding: 14px; overflow: auto; max-height: 78vh; }
.mask-stage { position: relative; margin: 0 auto; }
.mask-stage img { display: block; width: 100%; height: auto; }
/* UAの [hidden]{display:none} が .mask-stage img の display:block に負けるのを防ぐ */
.mask-stage img[hidden] { display: none; }
.mask-stage__placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  padding: 24px;
  color: var(--muted);
  font-size: 0.92rem;
  text-align: center;
  line-height: 1.6;
}
.mask-stage__placeholder[hidden] { display: none; }
.mask-overlay { position: absolute; inset: 0; cursor: crosshair; }
.mask-box { position: absolute; box-sizing: border-box; cursor: pointer; }
.mask-box--on { background: #000; }
.mask-box--off { background: rgba(255, 214, 0, 0.35); border: 1px solid #c79a00; }
.mask-box--draft { background: rgba(20, 107, 117, 0.25); border: 1px dashed var(--primary); pointer-events: none; }
.mask-side { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; max-height: 78vh; }
.mask-side__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; font-weight: 600; }
.mask-side__head select { border: 1px solid var(--line); border-radius: 8px; padding: 4px 6px; }
.cand-list { overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.cand-row { display: grid; grid-template-columns: auto 1fr auto auto; gap: 8px; align-items: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; font-size: 0.84rem; }
.cand-word { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cand-meta { color: var(--muted); font-size: 0.76rem; white-space: nowrap; }
.cand-empty { color: var(--muted); font-size: 0.84rem; }
.cand-dict { border: 1px solid var(--line); background: var(--surface-muted); border-radius: 6px; cursor: pointer; font-size: 0.72rem; padding: 2px 6px; white-space: nowrap; }
.cand-dict:disabled { opacity: 0.55; cursor: default; }
@media (max-width: 860px) { .mask-layout { grid-template-columns: 1fr; } }

/* マスキング: 3カラム（ファイル/辞書・ビューア・候補） */
.mask-layout--3 { grid-template-columns: 240px 1fr 280px; }
.mask-queue { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: var(--shadow); max-height: 78vh; overflow-y: auto; }
.file-list { display: flex; flex-direction: column; gap: 6px; }
.file-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); cursor: pointer; text-align: left; font-size: 0.82rem; }
.file-row--active { border-color: var(--primary); background: var(--primary-soft); }
.file-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-status { font-size: 0.72rem; padding: 1px 6px; border-radius: 999px; white-space: nowrap; }
.file-status--完了 { background: var(--green-bg); color: var(--green-text); }
.file-status--レビュー中 { background: var(--blue-bg); color: var(--blue-text); }
.file-status--エラー { background: var(--red-bg); color: var(--red-text); }
.dict-add { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.dict-add .search-input { flex: 1; min-width: 110px; }
.dict-add select { border: 1px solid var(--line); border-radius: 8px; padding: 4px; }
.dict-list { display: flex; flex-direction: column; gap: 4px; }
.dict-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 0.8rem; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px; }
.dict-del { background: transparent; border: none; color: var(--red-text); cursor: pointer; font-size: 1rem; }
@media (max-width: 980px) { .mask-layout--3 { grid-template-columns: 1fr; } }

/* AIチャット クイック質問チップ */
.ai-chat__presets { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 12px 8px; max-height: 88px; overflow-y: auto; }
.ai-preset { font-size: 0.74rem; padding: 4px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface-muted); cursor: pointer; color: var(--text); text-align: left; }

/* 左固定サイドナビ */
.side-nav {
  position: fixed; top: 0; left: 0; bottom: 0; width: 260px; z-index: 60;
  background: var(--primary-strong); color: #fff;
  display: flex; flex-direction: column; padding: 18px 14px;
  box-shadow: 2px 0 14px rgba(31,42,55,0.12);
}
.side-nav__brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; line-height: 1.2; padding: 6px 8px 16px; flex-shrink: 0; }
.side-nav__logo { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 9px; background: rgba(255,255,255,0.18); font-size: 0.95rem; }
/* リスト領域は独自縦スクロール（ヘッダー／フッターは固定）
   scrollbar-gutter: stable で開閉時のスクロールバー出現による幅揺れ・折り返し変化を抑止。
   非対応ブラウザは常時スクロールバーで幅を固定（@supports not フォールバック） */
.side-nav__list {
  display: flex; flex-direction: column; gap: 4px; margin-top: 6px;
  flex: 1; overflow-y: auto; min-height: 0;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,0.35) transparent;
}
@supports not (scrollbar-gutter: stable) {
  .side-nav__list {
    overflow-y: scroll;
  }
}
.side-nav__list::-webkit-scrollbar { width: 6px; }
.side-nav__list::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.35); border-radius: 4px; }
.side-nav__item { color: rgba(255,255,255,0.86); text-decoration: none; padding: 8px 12px; border-radius: 9px; font-size: 12px; font-weight: 500; line-height: 1.35; }
.side-nav__item:hover { background: rgba(255,255,255,0.12); color: #fff; }
.side-nav__item--active { background: #fff; color: var(--primary-strong); font-weight: 700; }
.side-nav__item--disabled,
.side-nav__item--disabled:hover { color: rgba(255,255,255,0.55); background: transparent; cursor: default; }
.side-nav__error { color: #fecaca; background: rgba(239, 68, 68, 0.15); border-radius: 8px; padding: 8px 12px; margin: 0 0 10px; font-size: 11px; line-height: 1.4; }
.it-unavailable { display: inline-block; margin-left: 6px; color: var(--muted); font-size: 0.82em; font-weight: 400; }
.side-nav__foot { margin-top: auto; padding: 10px 12px; border-top: 1px solid rgba(255,255,255,0.18); flex-shrink: 0; }
.side-nav__foot a { color: rgba(255,255,255,0.86); text-decoration: none; font-size: 0.86rem; }
.side-nav__foot a:hover { color: #fff; }
.side-nav-toggle { display: none; position: fixed; top: 12px; left: 12px; z-index: 70; width: 42px; height: 42px; border: none; border-radius: 9px; background: var(--primary-strong); color: #fff; font-size: 1.1rem; cursor: pointer; box-shadow: var(--shadow); }

/* サイドナビ分のオフセット（portalページのみ body.has-side-nav） */
body.has-side-nav { padding-left: 260px; }

.side-nav-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 55;
  background: rgba(15, 23, 32, 0.45);
  border: 0;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

@media (max-width: 860px) {
  body.has-side-nav { padding-left: 0; }
  .side-nav-toggle { display: block; }
  .side-nav { transform: translateX(-100%); transition: transform 0.2s ease; }
  body.side-nav-open .side-nav { transform: translateX(0); }
  body.side-nav-open .side-nav-backdrop { display: block; }
  /* トグルと被らないよう、狭幅ではヘッダ左に余白 */
  body.has-side-nav .site-header, body.has-side-nav .login-shell { padding-left: 58px; }
}

/* サイドナビ セクション見出し（折りたたみトグル）— 項目より大きく。薄い背景は既存 primary 系 */
.side-nav__section {
  display: block; margin: 14px 12px 4px; padding: 6px 10px; width: calc(100% - 24px);
  font-size: 14px; letter-spacing: 0.02em; font-family: inherit; font-weight: 700;
  color: rgba(255,255,255,0.92); background: rgba(255,255,255,0.10); border: none;
  border-radius: 8px; text-align: left; cursor: pointer; line-height: 1.3;
}
.side-nav__section:hover { color: #fff; background: rgba(255,255,255,0.16); }
.side-nav__group { display: flex; flex-direction: column; gap: 2px; }
.side-nav__group[hidden] { display: none; }

/* トップ横断検索（タイトル直下） */
.portal-search-root { margin-top: 12px; max-width: 520px; }
.portal-search { position: relative; }
.portal-search__label {
  display: block; font-size: 0.78rem; font-weight: 600; color: var(--muted);
  margin-bottom: 4px;
}
.portal-search__input { width: 100%; }
.portal-search__results {
  list-style: none; margin: 4px 0 0; padding: 4px 0;
  position: absolute; left: 0; right: 0; z-index: 40;
  max-height: 280px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow);
}
.portal-search__results[hidden] { display: none !important; }
.portal-search__results [role="option"].is-active .portal-search__hit,
.portal-search__results [role="option"][aria-selected="true"] .portal-search__hit {
  background: var(--surface-muted);
}
.portal-search__hit {
  display: block; padding: 8px 12px; color: var(--text); text-decoration: none;
  font-size: 0.92rem; line-height: 1.35;
}
.portal-search__hit:hover { background: var(--surface-muted); text-decoration: none; }

/* トップ: お知らせ */
.announcements {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 8px 0;
  margin-bottom: 28px;
}
.announcements__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 12px 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-muted, #f4f5f7);
  border: 1px solid var(--line);
}
.announcements__tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
  line-height: 1.2;
}
.announcements__tab:hover {
  background: rgba(255, 255, 255, 0.7);
  color: inherit;
}
.announcements__tab[aria-selected="true"] {
  background: var(--surface);
  border-color: var(--line);
  color: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.announcements__tab:focus-visible {
  outline: 2px solid var(--primary, #2f6fed);
  outline-offset: 2px;
}
.announcements__panel {
  padding: 0;
}
.announcements__panel[hidden] {
  display: none !important;
}
.announcements__list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.announcements__item {
  display: grid;
  grid-template-columns: 7.5rem minmax(7rem, auto) 1fr;
  gap: 12px 16px;
  align-items: baseline;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
}
.announcements__item:last-child { border-bottom: none; }
.announcements__date {
  color: var(--muted);
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.announcements__kind-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  white-space: nowrap;
}
.announcements__kind-badge--general {
  background: var(--gray-bg);
  color: var(--gray-text);
}
.announcements__kind-badge--release {
  background: var(--blue-bg);
  color: var(--blue-text);
}
.announcements__kind-badge--initiative {
  background: var(--orange-bg);
  color: var(--orange-text);
}
.announcements__kind-badge--restricted {
  background: var(--red-bg, #fde8e8);
  color: var(--red-text, #9b1c1c);
}
.announcements__title {
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  color: var(--primary-strong);
  font: inherit;
  font-weight: 600;
  font-size: 0.95rem;
  text-align: left;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.announcements__title:hover { color: var(--primary); }
.announcements__empty {
  margin: 0;
  padding: 16px 18px;
  color: var(--muted);
  font-size: 0.9rem;
}

/* お知らせ / 施策詳細モーダル */
.portal-modal {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(23, 33, 45, 0.55);
  overflow: auto;
}
.portal-modal__panel {
  width: min(100%, 640px);
  max-height: min(90vh, 800px);
  overflow: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 20px 48px rgba(31, 42, 55, 0.22);
  padding: 20px 22px 18px;
  position: relative;
}
.portal-modal__close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 1px solid var(--line);
  background: var(--surface-muted);
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 4px 10px;
}
.portal-modal__date {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.84rem;
}
.portal-modal__title {
  margin: 0 32px 14px 0;
  font-size: 1.15rem;
  line-height: 1.4;
}
.portal-modal__body {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.portal-modal__body p { margin: 0 0 0.75em; }
.portal-modal__body a { color: var(--primary-strong); }
.portal-modal__meta {
  margin: 16px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.portal-modal__actions {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

/* 管理: お知らせ */
.admin-announcements__form {
  display: grid;
  gap: 10px;
  max-width: 640px;
  margin-bottom: 18px;
}
.admin-announcements__form label {
  display: grid;
  gap: 4px;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
}
.admin-announcements__form input,
.admin-announcements__form textarea,
.admin-announcements__form select {
  font: inherit;
  font-weight: 400;
  color: var(--text);
}
.admin-announcements__row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
}
.admin-announcements__row label { flex: 1 1 160px; }
.admin-announcements__depts {
  display: grid;
  gap: 6px;
}
.admin-announcements__depts[data-disabled="true"] {
  opacity: 0.55;
}
.admin-announcements__dept-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted, #f4f5f7);
  max-height: 9rem;
  overflow: auto;
}
.admin-announcements__dept-list label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
  color: var(--text);
  font-size: 0.9rem;
  cursor: pointer;
}
.admin-announcements__dept-hint {
  margin: 0;
  font-size: 0.82rem;
  color: var(--muted);
}
.admin-announcements__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.admin-announcements__msg {
  margin: 0;
  font-size: 0.86rem;
}
.admin-announcements__table-wrap {
  overflow-x: auto;
}
.admin-announcements__inactive {
  opacity: 0.55;
}

/* 部署ダッシュボード */
.dash-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; margin-bottom: 18px; }
.dash-metric { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.dash-metric__num { font-size: 1.6rem; font-weight: 700; color: var(--primary-strong); }
.dash-metric__label { font-size: 0.82rem; color: var(--muted); }
.dash-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; }
.dash-card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; box-shadow: var(--shadow); }
.dash-card h3 { margin: 0 0 12px; font-size: 1rem; }
.dash-muted { color: var(--muted); line-height: 1.7; margin: 0; }
.dash-links { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.dash-links .button { width: 100%; text-align: center; }
@media (max-width: 720px) { .dash-grid { grid-template-columns: 1fr; } }

/* ダッシュボード お知らせ（部署別・最新情報） */
.dash-news { display: flex; flex-direction: column; gap: 12px; }
.news-list { display: flex; flex-direction: column; gap: 8px; max-height: 320px; overflow-y: auto; }
.news-item { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.news-item__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.news-item__title { font-weight: 600; font-size: 0.92rem; }
.news-item__body { margin: 6px 0 4px; color: var(--text); font-size: 0.86rem; line-height: 1.6; white-space: pre-wrap; }
.news-item__meta { color: var(--muted); font-size: 0.74rem; }
.news-del { background: transparent; border: none; color: var(--red-text); cursor: pointer; font-size: 1rem; line-height: 1; }
.news-form { display: flex; flex-direction: column; gap: 8px; border-top: 1px dashed var(--line); padding-top: 12px; }
.news-form .button { align-self: flex-start; }

/* 部署ダッシュボード 連携ステータス */
.dash-integrations { margin-bottom: 18px; }
.dash-int__head { margin: 0 0 10px; font-size: 1rem; }
.dash-int__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.dash-int__item { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 6px; }
.dash-int__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.dash-int__name { font-weight: 600; font-size: 0.9rem; }
.dash-int__note { color: var(--muted); font-size: 0.78rem; }

/* PDFツール（結合・並べ替え・圧縮） */
.pdf-section-title { margin: 0 0 8px; font-size: 1.05rem; }

/* Admin: PORTERS 書き込み権限 */
.admin-porters-write-perms__warn {
  margin: 0 0 12px;
  padding: 10px 12px;
  border: 1px solid #d4a574;
  background: #fff8e8;
  color: #5a3e00;
  font-size: 0.85rem;
  line-height: 1.5;
  border-radius: 6px;
}
.admin-porters-write-perms__form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 16px;
}
.admin-porters-write-perms__label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--muted);
}
.admin-porters-write-perms__search,
.admin-porters-write-perms__select {
  min-width: 220px;
  max-width: 360px;
  padding: 6px 8px;
  font-size: 0.9rem;
}
.admin-porters-write-perms__picker {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.admin-porters-write-perms__subhead {
  margin: 12px 0 8px;
  font-size: 0.95rem;
}
.admin-porters-write-perms__table { min-width: 480px; }
.admin-porters-write-perms__hint {
  margin: 4px 0 0;
  font-size: 0.78rem;
}
.admin-porters-write-perms__error {
  margin: 0;
  color: #b00020;
  font-weight: 700;
}

/* Admin: PORTERS 書込セーフガード */
.admin-porters-safeguard__status {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin: 0 0 12px;
}
.admin-porters-safeguard__badge {
  font-size: 0.95rem;
  padding: 0.35em 0.7em;
  line-height: 1.4;
}
.admin-porters-safeguard__badge--on {
  background: var(--green-bg);
  color: var(--green-text);
  border: 1px solid #9ed0b0;
}
.admin-porters-safeguard__badge--off {
  font-weight: 800;
}
.admin-porters-safeguard__meta {
  margin: 0 0 12px;
  font-size: 0.82rem;
  line-height: 1.5;
}
.admin-porters-safeguard__form {
  display: grid;
  gap: 12px;
  max-width: 520px;
}
.admin-porters-safeguard__note {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
}
.admin-porters-safeguard__error {
  margin: 0;
  color: #b00020;
  font-weight: 700;
}
.admin-porters-safeguard__warn {
  margin: 0;
  color: #a12020;
  font-weight: 700;
}
.admin-porters-safeguard__disarm-btn {
  background: #a12020;
  border-color: #8a1a1a;
}
.admin-porters-safeguard__disarm-btn:hover {
  background: #8a1a1a;
}

/* Admin: PORTERS API利用状況 */
.admin-porters-usage__form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  margin-bottom: 12px;
}
.admin-porters-usage__form label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--muted);
}
.admin-porters-usage__metrics { margin: 12px 0; }
.admin-porters-usage__total .dash-metric__num { font-size: 2rem; }
.admin-porters-usage__progress { width: 100%; height: 1rem; accent-color: var(--primary); }
.admin-porters-usage__period { font-size: 0.8rem; margin: 6px 0 14px; }
.admin-porters-usage__breakdown { overflow-x: auto; margin-top: 14px; }
.admin-porters-usage__subhead { margin: 0 0 6px; font-size: 0.95rem; }
.admin-porters-usage__table { min-width: 320px; }

/* Admin: PORTERS メタデータ同期 / スケジュール */
.admin-meta-status,
.admin-sched-meta {
  margin: 0 0 10px;
  font-weight: 600;
}
.admin-meta-note {
  margin: 0 0 12px;
}
.admin-meta-actions,
.admin-sched-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 12px;
}
.admin-sched-banner {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e2b93b;
  background: #fff8e1;
  color: #6b4e00;
  font-weight: 700;
  font-size: 0.9rem;
  line-height: 1.5;
}
.admin-sched-table {
  margin: 0 0 12px;
}
.admin-sched-table .admin-ext-form__input {
  width: 4.5rem;
  min-width: 3.5rem;
  display: inline-block;
}
.admin-sched-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.9rem;
  cursor: pointer;
}
.admin-sched-values {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  font-size: 0.88rem;
}
.admin-sched-times {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 6px 0 0;
}
.admin-sched-time-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
}
.admin-sched-time-row .admin-sched-time-remove {
  padding: 2px 8px;
  font-size: 0.8rem;
}
.admin-sched-time-add {
  padding: 2px 8px;
  font-size: 0.8rem;
}
.admin-sched-weekdays {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 8px;
  max-width: 12rem;
}
.admin-sched-weekday-label {
  font-size: 0.85rem;
}
.admin-sched-table .admin-sched-dates {
  width: 11rem;
  min-width: 8rem;
}

/* くそでか注意書き（セーフガード解除確認） */
.porters-safeguard-disarm {
  position: fixed;
  inset: 0;
  z-index: 10000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(90, 0, 0, 0.88);
  overflow: auto;
}
.porters-safeguard-disarm__panel {
  width: min(100%, 720px);
  max-height: min(96vh, 900px);
  overflow: auto;
  padding: 28px 24px 24px;
  border-radius: 16px;
  border: 4px solid #ff4d4d;
  background: linear-gradient(180deg, #3b0000 0%, #1a0000 100%);
  color: #fff5f5;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
}
.porters-safeguard-disarm__title {
  margin: 0 0 16px;
  font-size: clamp(1.45rem, 4.2vw, 2.1rem);
  font-weight: 900;
  line-height: 1.35;
  color: #ffe066;
  text-align: center;
  text-shadow: 0 2px 0 #5a0000;
  letter-spacing: 0.02em;
}
.porters-safeguard-disarm__lead {
  margin: 0 0 12px;
  font-size: clamp(1.05rem, 2.6vw, 1.25rem);
  font-weight: 800;
  line-height: 1.55;
  color: #fff;
}
.porters-safeguard-disarm__sub {
  margin: 0 0 20px;
  font-size: 0.98rem;
  font-weight: 600;
  line-height: 1.55;
  color: #ffd0d0;
}
.porters-safeguard-disarm__step {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}
.porters-safeguard-disarm__understand {
  justify-self: center;
  min-height: 48px;
  padding: 0 28px;
  font-weight: 800;
  font-size: 1.05rem;
  background: #fff;
  color: #7a1515;
  border: 2px solid #ffb3b3;
}
.porters-safeguard-disarm__label {
  font-weight: 700;
  font-size: 0.95rem;
  color: #ffe8e8;
}
.porters-safeguard-disarm__input,
.porters-safeguard-disarm__textarea {
  width: 100%;
  border: 2px solid #e07070;
  border-radius: 10px;
  padding: 10px 12px;
  background: #2a0000;
  color: #fff;
  font: inherit;
}
.porters-safeguard-disarm__input::placeholder,
.porters-safeguard-disarm__textarea::placeholder {
  color: rgba(255, 220, 220, 0.55);
}
.porters-safeguard-disarm__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 6px;
}
.porters-safeguard-disarm__confirm {
  min-height: 48px;
  font-weight: 900;
  font-size: 1.02rem;
  background: #e74c3c;
  border-color: #c0392b;
  color: #fff;
}
.porters-safeguard-disarm__confirm:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.porters-safeguard-disarm__confirm:not(:disabled):hover {
  background: #c0392b;
}
.porters-safeguard-disarm__error {
  margin: 8px 0 0;
  min-height: 1.2em;
  color: #ffb3b3;
  font-weight: 700;
}

/* Admin: 外部委託ユーザー作成 / 組織割当 / パスワード再設定 */
.admin-ext-form {
  display: grid;
  gap: 12px;
  max-width: 480px;
}
.admin-ext-form__field {
  display: grid;
  gap: 6px;
}
.admin-ext-form__label {
  font-size: 0.86rem;
  font-weight: 700;
}
.admin-ext-form__input {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 0.9rem;
  font-family: inherit;
  box-sizing: border-box;
  background: var(--surface);
}
.admin-ext-form__note {
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.5;
}
.admin-ext-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.admin-form-error {
  margin: 0;
  color: #b00020;
  font-weight: 700;
  font-size: 0.88rem;
}
.admin-org-banner {
  margin: 0 0 12px;
  font-size: 0.88rem;
}
.admin-users-table {
  min-width: 1400px;
}
/* ユーザー行は必ず1行（必要なら表全体を横スクロール） */
.admin-users-table th,
.admin-users-table td,
.admin-users-table .admin-col-name,
.admin-users-table .admin-col-job {
  white-space: nowrap;
  vertical-align: middle;
}
.admin-users-table .admin-col-name {
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.admin-users-table tbody tr {
  height: 46px;
}
.admin-user-row--dirty {
  background: rgba(47, 125, 79, 0.06);
}
.admin-users-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin: 0 0 14px;
  align-items: flex-end;
}
.admin-users-filters__field {
  display: grid;
  gap: 4px;
  min-width: 110px;
}
.admin-users-filters__label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
}
.admin-users-filters__input,
.admin-users-filters__select {
  min-width: 110px;
  max-width: 160px;
}
.admin-users-filters__combo {
  max-width: 200px;
}
.admin-user-ops {
  display: flex;
  gap: 8px;
  align-items: center;
}
.admin-user-ops__status {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.admin-users-bulk {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.admin-users-bulk__status {
  margin: 0;
  flex: 1 1 200px;
}
.admin-org-select {
  max-width: 140px;
  font-size: 0.82rem;
  padding: 4px 6px;
}
.admin-role-select {
  max-width: 160px;
}
.admin-job-type-select,
.admin-dept-multi-select {
  display: none;
}
.admin-compact-multiselect {
  display: inline-block;
  width: 180px;
  vertical-align: middle;
}
.admin-compact-multiselect__trigger {
  display: block;
  width: 100%;
  max-width: none;
  height: 32px;
  overflow: hidden;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}
.admin-compact-multiselect__trigger::after {
  content: "▼";
  float: right;
  margin-left: 8px;
  font-size: 0.65rem;
}
.admin-compact-multiselect__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.admin-compact-multiselect__panel {
  position: fixed;
  z-index: 1000;
  width: 272px;
  max-height: min(320px, calc(100vh - 24px));
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.18);
}
.admin-compact-multiselect__panel[hidden] {
  display: none;
}
.admin-compact-multiselect__option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 4px 6px;
  white-space: normal;
  cursor: pointer;
}
.admin-compact-multiselect__option:hover,
.admin-compact-multiselect__option:focus-within {
  background: #eef4fb;
}
.admin-status-select {
  max-width: 120px;
}
.admin-reset-pw {
  display: grid;
  gap: 8px;
  min-width: 160px;
}
.admin-reset-pw__panel {
  display: grid;
  gap: 6px;
}
.admin-reset-pw__input {
  min-width: 160px;
  max-width: 220px;
}
.admin-reset-pw__msg {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.4;
}
.pdf-doc-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.pdf-doc-row { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.pdf-move { border: 1px solid var(--line); background: var(--surface-muted); border-radius: 6px; cursor: pointer; width: 26px; }
.pdf-move:disabled { opacity: 0.4; cursor: default; }
.pdf-doc-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pdf-page-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin: 10px 0; max-height: 560px; overflow-y: auto; }
.pdf-page { border: 1px solid var(--line); border-radius: 8px; padding: 6px; text-align: center; background: var(--surface); cursor: grab; }
.pdf-page--excluded { opacity: 0.4; }
.pdf-page--dragging { opacity: 0.5; cursor: grabbing; }
.pdf-page--dragover { outline: 2px dashed var(--accent, #2f7d4f); outline-offset: 2px; }
.pdf-page img { width: 100%; height: auto; border: 1px solid var(--line); transition: transform 0.15s ease; cursor: zoom-in; }
.pdf-num-input { max-width: 160px; }
/* ページ拡大モーダル（別窓表示） */
.pdf-modal { position: fixed; inset: 0; background: rgba(0,0,0,0.62); display: none; align-items: center; justify-content: center; z-index: 1000; padding: 24px; }
.pdf-modal__inner { position: relative; max-width: 92vw; max-height: 92vh; background: var(--surface); border-radius: 10px; padding: 12px; box-shadow: var(--shadow); overflow: auto; }
.pdf-modal__cap { font-size: 0.82rem; color: var(--muted); margin: 0 0 8px; }
.pdf-modal__img { display: block; max-width: 86vw; max-height: 82vh; width: auto; height: auto; margin: 0 auto; }
.pdf-modal__close { position: absolute; top: 6px; right: 8px; border: 1px solid var(--line); background: var(--surface-muted); border-radius: 6px; cursor: pointer; font-size: 1rem; line-height: 1; padding: 4px 10px; }
.pdf-page__cap { font-size: 0.72rem; color: var(--muted); margin: 4px 0; }
.pdf-page__ctrl { display: flex; gap: 4px; justify-content: center; }
.pdf-page__ctrl button { border: 1px solid var(--line); background: var(--surface-muted); border-radius: 6px; cursor: pointer; font-size: 0.72rem; padding: 2px 6px; }
.pdf-page__ctrl button:disabled { opacity: 0.4; cursor: default; }
.pdf-compress-modes { border: 1px solid var(--line); border-radius: 8px; display: flex; flex-direction: column; gap: 8px; padding: 12px; margin: 8px 0; }
.pdf-warning { border: 1px solid var(--red-text); background: var(--red-bg); color: var(--red-text); border-radius: 10px; padding: 12px 14px; margin: 8px 0; font-size: 0.86rem; }
.pdf-warning ul { margin: 8px 0; padding-left: 18px; }
.pdf-confirm { display: inline-flex; gap: 6px; align-items: center; font-weight: 600; }

/* ===== 施策一覧テーブル（自動化バックログの管理表。アプリ導線ではない） ===== */
.initiatives-table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
.initiatives-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; min-width: 920px; }
.initiatives-table thead th { position: sticky; top: 0; background: var(--surface-muted); color: var(--muted); text-align: left; font-weight: 700; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.initiatives-table tbody td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--text); }
.initiatives-table tbody tr:last-child td { border-bottom: none; }
.initiatives-table tbody tr:hover { background: var(--surface-muted); }
.initiatives-table .it-id { font-weight: 700; white-space: nowrap; color: var(--muted); }
.initiatives-table .it-cat { white-space: nowrap; }
.initiatives-table .it-title { font-weight: 700; min-width: 160px; }
.initiatives-table .it-summary { color: var(--muted); min-width: 300px; line-height: 1.5; }
.initiatives-table .it-owner { white-space: nowrap; }
/* 対象部署（featureDepartments。施策名プレフィックスとは無関係） */
.initiatives-table .it-feature-depts { min-width: 140px; max-width: 220px; }
.initiatives-table .it-dept-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.initiatives-table .it-dept-tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--surface-muted);
  border: 1px solid var(--line);
  color: var(--text);
  white-space: nowrap;
}
.initiatives-table .it-dept-tag--all { color: var(--muted); font-weight: 600; }
.initiatives-table .it-dept-checks { display: flex; flex-direction: column; gap: 2px; }
.initiatives-table .it-dept-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
}
.initiatives-table .it-dept-check input { margin: 0; }
.initiatives-table .it-dept-save-status {
  display: block;
  margin-top: 4px;
  font-size: 0.72rem;
  color: var(--muted);
  min-height: 1em;
}
.initiatives-table .it-dept-save-status--ok { color: var(--accent, #2f7d4f); }
.initiatives-table .it-dept-save-status--err { color: #b42318; }
/* 管理者の進捗編集（C-04） */
.initiatives-table .it-op { white-space: nowrap; }
.initiatives-table .it-op .button { padding: 4px 10px; font-size: 0.8rem; margin-right: 6px; }
.initiatives-table td select, .initiatives-table td .it-owner-input { font-size: 0.82rem; padding: 4px 6px; max-width: 150px; }
.initiatives-table tr.it-row-edited .it-id { border-left: 3px solid var(--accent, #2f7d4f); padding-left: 9px; }
.portal-cta .button { align-self: center; }
/* 部署別施策一覧は #feature-grid(=CSSグリッド)内に表を置くため、全幅スパンさせる */
.feature-grid .initiatives-table-wrap { grid-column: 1 / -1; }
@media (max-width: 720px) { .initiatives-table { font-size: 0.8rem; min-width: 680px; } }

/* PORTERS Read確認 */
.porters-read-form {
  display: grid;
  grid-template-columns: minmax(220px, 1.5fr) minmax(180px, 1fr) 110px 110px auto;
  gap: 12px;
  align-items: end;
}

.porters-read-form__small .search-input {
  min-width: 0;
}

.porters-read-output {
  display: grid;
  gap: 16px;
}

.porters-read-summary,
.porters-read-resource__head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.porters-read-resource {
  display: grid;
  gap: 10px;
}

.porters-read-resource__head h3 {
  margin: 0;
  font-size: 1rem;
}

.porters-read-table {
  min-width: 980px;
}

.porters-read-table td {
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 960px) {
  .porters-read-form {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .porters-read-form {
    grid-template-columns: 1fr;
  }
}

/* PDF 統合ページ（タブ） */
.tool-suite__tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 16px;
  padding: 4px;
  border-radius: 12px;
  background: var(--surface-muted, #f4f5f7);
  border: 1px solid var(--line);
}
.tool-suite__tab {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
  line-height: 1.2;
}
.tool-suite__tab:hover {
  background: rgba(255, 255, 255, 0.7);
  color: inherit;
}
.tool-suite__tab[aria-selected="true"] {
  background: var(--surface);
  border-color: var(--line);
  color: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}
.tool-suite__tab:focus-visible {
  outline: 2px solid var(--primary, #2f6fed);
  outline-offset: 2px;
}
.tool-suite__tab[hidden],
.tool-suite__panel[hidden] {
  display: none !important;
}
.tool-suite__panel--frame {
  min-height: 70vh;
}
.tool-suite__frame {
  display: block;
  width: 100%;
  min-height: 75vh;
  border: 0;
  background: var(--surface, #fff);
  border-radius: 12px;
}

/* 旧URLを iframe 埋め込みするときの外枠抑制 */
html.yc-embed body.has-side-nav {
  padding-left: 0 !important;
}
html.yc-embed .site-header,
html.yc-embed .side-nav,
html.yc-embed .side-nav-toggle,
html.yc-embed .breadcrumb,
html.yc-embed .user-nav,
html.yc-embed #chat-widget-root,
html.yc-embed .chat-widget {
  display: none !important;
}
html.yc-embed .page-shell {
  max-width: none;
  margin: 0;
  padding: 12px 16px 24px;
}
html.yc-embed .site-header + .page-shell,
html.yc-embed body > .page-shell {
  padding-top: 8px;
}

