/* ==========================================================================
   Smart Labo Works — 顧客向けワークスペースUI（Step 6-4A）
   タスク中心型・3カラム構成（上部ヘッダー／左ナビ／中央作業スペース／右AIパネル）
   社内システム用の既存CSS（public/css/app.css）とは独立した顧客向け専用CSS。
   外部CDN・外部フォントへの依存なし。
   ========================================================================== */

:root {
  /* 配色（CEO指定の視覚基準に基づく） */
  --navy-900: #071C36;   /* ヘッダー */
  --navy-800: #0B2748;   /* 左サイドナビ */
  --blue: #0B6FFB;       /* 選択中メニュー・主要ボタン */
  --blue-dark: #0A5FD6;
  --teal: #0F9FA8;       /* AI補助色 */
  --bg: #F4F7FB;         /* ページ背景 */
  --card: #FFFFFF;       /* カード背景 */
  --text: #10213A;       /* 主文字 */
  --text-sub: #5F6B7A;   /* 補助文字 */
  --border: #DDE4EE;     /* 枠線 */
  --green: #1E8E5A;      /* 成功 */
  --orange: #B8720F;     /* 警告 */
  --red: #C93A3A;        /* エラー */
  --radius: 12px;
  --shadow: 0 1px 3px rgba(16, 33, 58, 0.08);
  --header-h: 64px;
}

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

html, body { min-height: 100vh; }

body {
  font-family: 'Hiragino Kaku Gothic ProN', 'Hiragino Sans', 'Yu Gothic UI', 'Meiryo', sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.7;
}

button { font-family: inherit; cursor: pointer; font-size: inherit; }
button:disabled { cursor: not-allowed; opacity: 0.55; }
input, select, textarea { font-family: inherit; font-size: 15px; }

/* フォーカスリングは消さない（視認性の高いリングを全操作要素へ） */
button:focus-visible, a:focus-visible, input:focus-visible,
select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(11, 111, 251, 0.55);
  outline-offset: 2px;
}

.icon { width: 22px; height: 22px; flex: none; }
.icon-lg { width: 26px; height: 26px; flex: none; }

/* ==========================================================================
   ログイン画面
   ========================================================================== */

#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--navy-900);
  padding: 24px;
}
#login-screen[hidden] { display: none; }

.login-box {
  background: var(--card);
  border-radius: 14px;
  padding: 44px 40px;
  width: 400px;
  max-width: 100%;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}
.login-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: center;
  color: var(--navy-900);
  margin-bottom: 6px;
}
.login-brand { font-size: 21px; font-weight: 700; text-align: center; margin-bottom: 4px; }
.login-sub { font-size: 13px; color: var(--text-sub); text-align: center; margin-bottom: 28px; }
.login-field { margin-bottom: 14px; }
.login-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
}
.login-field input {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: #FBFCFE;
  min-height: 44px;
}
.btn-login {
  width: 100%;
  min-height: 46px;
  padding: 12px;
  border: none;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  margin-top: 8px;
}
.btn-login:hover { background: var(--blue-dark); }
.login-error {
  color: var(--red);
  font-size: 13px;
  margin-top: 14px;
  min-height: 20px;
  text-align: center;
}

/* ==========================================================================
   アプリ全体（3カラムGrid）
   ========================================================================== */

#app { display: none; }
#app.visible {
  display: grid;
  min-height: 100vh;
  grid-template-rows: var(--header-h) 1fr;
  grid-template-columns: 220px minmax(0, 1fr) 320px;
  grid-template-areas:
    "header header header"
    "nav    main   aside";
}

/* ==========================================================================
   上部ヘッダー
   ========================================================================== */

.app-header {
  grid-area: header;
  background: var(--navy-900);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 12px;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-logo { display: flex; align-items: center; color: #fff; }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: 0.4px; white-space: nowrap; }
.brand-beta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 999px;
  padding: 1px 10px;
  white-space: nowrap;
}
.header-right { display: flex; align-items: center; gap: 6px; }
.company-name {
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.85);
  padding: 0 10px;
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 44px;
  min-height: 44px;
  border: none;
  border-radius: 10px;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
}
.icon-btn:hover { background: rgba(255, 255, 255, 0.12); }

/* パネル開閉ボタン（狭い画面でのみ表示） */
#toggle-nav, #toggle-aside { display: none; }

/* ユーザーメニュー */
.user-menu { position: relative; }
.user-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(16, 33, 58, 0.18);
  min-width: 240px;
  padding: 14px;
  z-index: 200;
}
.user-menu-panel[hidden] { display: none; }
.user-menu-email {
  font-size: 13px;
  color: var(--text-sub);
  margin-bottom: 12px;
  word-break: break-all;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.btn-logout, .btn-menu-item {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
  padding: 0 14px;
}
.btn-logout:hover, .btn-menu-item:hover { background: var(--bg); }
.btn-menu-item { margin-bottom: 8px; }

/* ==========================================================================
   左サイドナビゲーション
   ========================================================================== */

.side-nav {
  grid-area: nav;
  background: var(--navy-800);
  padding: 14px 10px;
  overflow-y: auto;
}
.side-nav ul { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 78px;
  padding: 12px 8px;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-size: 13.5px;
  font-weight: 600;
  position: relative;
}
.nav-item:hover { background: rgba(255, 255, 255, 0.1); }
.nav-item[aria-current="page"] { background: var(--blue); color: #fff; }
.nav-item .prep-badge {
  font-size: 10.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  padding: 0 8px;
}

/* ==========================================================================
   中央作業スペース
   ========================================================================== */

.workspace {
  grid-area: main;
  overflow-y: auto;
  padding: 28px 32px 36px;
  min-width: 0;
}
.workspace-inner { max-width: 980px; margin: 0 auto; }
.view[hidden] { display: none; }
.view-title { font-size: 22px; font-weight: 700; margin-bottom: 18px; }

.today-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.today-header .view-title { margin-bottom: 0; }

.task-overdue-warning {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #FDF2E3;
  color: #7A4B0B;
  border: 1px solid #F2D9AE;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 18px;
}
.task-overdue-warning[hidden] { display: none; }

/* --- 今日の仕事：タスク集計 --- */
.task-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}
.summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.summary-icon {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.summary-icon.todo { background: #E8F0FE; color: var(--blue); }
.summary-icon.doing { background: #E4F5F6; color: var(--teal); }
.summary-icon.done { background: #E7F3EC; color: var(--green); }
.summary-label { font-size: 13px; color: var(--text-sub); }
.summary-value { font-size: 26px; font-weight: 700; line-height: 1.2; }

/* --- 今日の仕事：現在のタスクカード --- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  box-shadow: var(--shadow);
}
.active-task { padding: 28px; margin-bottom: 18px; }
.task-empty { text-align: center; padding: 36px 20px; }
.task-empty-icon { color: var(--text-sub); margin-bottom: 14px; }
.task-empty-title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.task-empty-sub { font-size: 14px; color: var(--text-sub); margin-bottom: 22px; }

/* --- 今日の仕事：選択中タスクの表示 --- */
.task-context { font-size: 12.5px; color: var(--text-sub); margin-bottom: 14px; }
.task-title-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.task-title-row h2 { font-size: 18px; font-weight: 700; word-break: break-word; }
.task-badge-row { display: flex; gap: 8px; flex-wrap: wrap; }
.task-description {
  font-size: 14px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.8;
  background: var(--bg);
  border-radius: 10px;
  padding: 14px 16px;
  margin: 14px 0;
}
.task-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }

.badge.todo { background: #E8F0FE; color: var(--blue); }
.badge.in_progress { background: #E4F5F6; color: var(--teal); }
.badge.completed { background: #E7F3EC; color: var(--green); }
.badge.priority-low { background: #EEF1F6; color: var(--text-sub); }
.badge.priority-normal { background: #E8F0FE; color: var(--blue); }
.badge.priority-high { background: #FDF2E3; color: var(--orange); }
.badge.priority-urgent { background: #FBEDED; color: var(--red); }
.badge.overdue { background: #FBEDED; color: var(--red); }

/* --- 右パネル：作業中のタスク（status=in_progress） --- */
.working-tasks-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.working-task-item {
  display: block;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  font-size: 13px;
}
.working-task-item:hover { border-color: var(--teal); }
.working-task-title { font-weight: 600; margin-bottom: 4px; word-break: break-word; }
.working-task-meta { display: flex; gap: 8px; color: var(--text-sub); font-size: 12px; flex-wrap: wrap; }

/* --- タスクフォーム：顧客検索行 --- */
.contact-search-row { display: flex; gap: 8px; margin-bottom: 8px; }
.contact-search-row input { flex: 1; }
.contact-search-result { font-size: 12.5px; color: var(--text-sub); }

/* --- 前後タスク切り替え --- */
.task-navigation {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 10px 16px;
}
.task-navigation button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  font-size: 14px;
}

/* ==========================================================================
   ボタン共通
   ========================================================================== */

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 20px;
  border: none;
  border-radius: 10px;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
}
.btn-primary:hover { background: var(--blue-dark); }
.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  color: var(--text);
  font-size: 14px;
}
.btn-secondary:hover { background: var(--bg); }
.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--red);
  border-radius: 10px;
  background: #fff;
  color: var(--red);
  font-size: 14px;
  font-weight: 600;
}
.btn-danger:hover { background: #FBEDED; }

/* ==========================================================================
   右AIサイドパネル
   ========================================================================== */

.ai-panel {
  grid-area: aside;
  background: var(--bg);
  border-left: 1px solid var(--border);
  padding: 26px 20px;
  overflow-y: auto;
}
.ai-panel h2 { font-size: 15.5px; font-weight: 700; margin-bottom: 14px; }
.ai-panel h2 + .ai-empty { margin-bottom: 8px; }
.ai-cards { list-style: none; display: flex; flex-direction: column; gap: 12px; margin-bottom: 28px; }
.ai-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 64px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow);
  color: var(--text);
  text-align: left;
}
.ai-card:hover { border-color: var(--blue); }
.ai-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.ai-card-icon.c1 { background: #E8F0FE; color: var(--blue); }
.ai-card-icon.c2 { background: #E7F3EC; color: var(--green); }
.ai-card-icon.c3 { background: #EFEAF9; color: #6D4FC2; }
.ai-card-icon.c4 { background: #FDF2E3; color: var(--orange); }
.ai-card-label { flex: 1; font-size: 14.5px; font-weight: 600; }
.ai-card .prep-badge {
  font-size: 11px;
  color: var(--text-sub);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 1px 9px;
  white-space: nowrap;
}
.ai-empty {
  background: var(--card);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
  font-size: 13.5px;
  color: var(--text-sub);
}

/* ==========================================================================
   CRM（中央作業スペース内）
   ========================================================================== */

.crm-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}
.crm-toolbar input[type="text"] {
  padding: 10px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  width: 280px;
  max-width: 100%;
  background: var(--card);
  min-height: 44px;
}
.crm-toolbar select {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  min-height: 44px;
}
.crm-toolbar .spacer { flex: 1; }

.crm-section-title { font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.crm-section-sub { font-size: 13px; color: var(--text-sub); margin-bottom: 14px; }

.crm-table-wrap { overflow-x: auto; }
.crm-table { width: 100%; border-collapse: collapse; }
.crm-table thead th {
  text-align: left;
  font-size: 12.5px;
  color: var(--text-sub);
  font-weight: 600;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: #F8FAFD;
  white-space: nowrap;
}
.crm-table tbody td { padding: 14px 16px; font-size: 14px; border-bottom: 1px solid var(--border); }
.crm-table tbody tr:last-child td { border-bottom: none; }
.crm-table tbody tr:hover { background: #F8FAFD; cursor: pointer; }
.crm-kana { color: var(--text-sub); font-size: 11.5px; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 600;
}
.badge.active { background: #E7F3EC; color: var(--green); }
.badge.inactive { background: #EEF1F6; color: var(--text-sub); }

.empty-state { padding: 56px 20px; text-align: center; color: var(--text-sub); font-size: 14px; }
.row-actions { display: flex; gap: 6px; }
.row-actions button {
  font-size: 12.5px;
  padding: 8px 12px;
  min-height: 36px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
}
.row-actions button:hover { background: var(--bg); }

.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  font-size: 13.5px;
  color: var(--text-sub);
}
.pagination button {
  padding: 8px 14px;
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  font-size: 13.5px;
}

/* --- CRMフォーム・詳細 --- */
.form-card, .detail-card { padding: 26px; max-width: 720px; margin-bottom: 16px; }
.form-row { margin-bottom: 16px; }
.form-row label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.form-row .hint { font-size: 12px; color: var(--text-sub); margin-top: 4px; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  min-height: 44px;
}
.form-row textarea { min-height: 100px; resize: vertical; }
.form-row .error-text { color: var(--red); font-size: 12.5px; margin-top: 4px; display: none; }
.form-row.has-error input, .form-row.has-error textarea, .form-row.has-error select { border-color: var(--red); }
.form-row.has-error .error-text { display: block; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.required-mark { color: var(--red); }
.ai-draft-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #F4F7FB;
  color: var(--text-sub);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  min-height: 40px;
  font-size: 12.5px;
  margin-top: 8px;
}

.detail-row { display: flex; padding: 12px 0; border-bottom: 1px solid var(--border); }
.detail-row:last-child { border-bottom: none; }
.detail-label { width: 150px; flex: none; font-size: 13px; color: var(--text-sub); font-weight: 600; }
.detail-value { flex: 1; font-size: 14.5px; white-space: pre-wrap; word-break: break-word; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13.5px;
  color: var(--blue);
  margin-bottom: 12px;
  background: none;
  border: none;
  padding: 6px 4px;
  text-decoration: underline;
}

/* ==========================================================================
   業務レシピ管理（中央作業スペース内。ユーザーメニューからのみ入場）
   ========================================================================== */

.badge.draft { background: #EEF1F6; color: var(--text-sub); }
.badge.archived { background: #F4E8E8; color: #8A5A5A; }
.badge.category {
  background: #F4F7FB;
  color: var(--text-sub);
  border: 1px solid var(--border);
}

.workflow-version-label { font-size: 12px; color: var(--text-sub); }

/* --- レシピ詳細：ヘッダー（名称・状態・操作ボタン） --- */
.workflow-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}
.workflow-detail-title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.workflow-detail-title-row h2 { font-size: 19px; font-weight: 700; word-break: break-word; }
.workflow-detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.workflow-detail-meta { font-size: 12.5px; color: var(--text-sub); margin-bottom: 18px; }
.workflow-archived-notice {
  background: #F4E8E8;
  color: #8A5A5A;
  border: 1px solid #E5C9C9;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}
.workflow-empty-notice {
  background: #FDF2E3;
  color: #7A4B0B;
  border: 1px solid #F2D9AE;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 16px;
}

/* --- 業務レシピ実行の進捗表示（Step 6-4E） --- */
.wf-run-progress { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.wf-run-progress-text { font-size: 12.5px; color: var(--text-sub); white-space: nowrap; }
.wf-run-progress-bar-outer {
  width: 100%;
  height: 6px;
  border-radius: 4px;
  background: var(--border);
  overflow: hidden;
}
.wf-run-progress-bar-inner { height: 100%; background: var(--teal); border-radius: 4px; }
.wf-run-progress-bar-inner.completed { background: var(--green); }
.wf-run-progress-breakdown { font-size: 12px; color: var(--text-sub); margin-top: 4px; }

/* --- 業務ステップ：番号付き縦カード（1→2→3…と連結線でつなぐ） --- */
.step-list { list-style: none; }
.step-item { position: relative; display: flex; gap: 14px; padding-bottom: 18px; }
.step-item:last-child { padding-bottom: 0; }
.step-number-col { display: flex; flex-direction: column; align-items: center; flex: none; }
.step-number {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.step-connector { flex: 1; width: 2px; background: var(--border); margin: 4px 0; min-height: 16px; }
.step-item:last-child .step-connector { display: none; }
.step-card {
  flex: 1;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  min-width: 0;
}
.step-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.step-card-title { font-size: 15px; font-weight: 700; word-break: break-word; }
.step-card-actions { display: flex; gap: 4px; flex: none; }
.step-card-actions button {
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  font-size: 13px;
}
.step-card-actions button:hover { background: var(--bg); }
.step-card-actions button:disabled { opacity: 0.35; }
.step-card-description {
  font-size: 13.5px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.7;
  margin: 8px 0;
}
.step-card-meta { display: flex; gap: 8px 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-sub); margin-top: 8px; }

/* --- ステップ追加フォーム --- */
.step-form-card { border: 1px dashed var(--border); box-shadow: none; }

/* ==========================================================================
   トースト・モーダル
   ========================================================================== */

.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 999;
  padding: 12px 20px;
  border-radius: 10px;
  color: #fff;
  font-size: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  max-width: 380px;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none; /* 非表示中（opacity:0）でも下の操作（ログアウト等）を妨げない */
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.success { background: var(--green); }
.toast.error { background: var(--red); }
.toast.info { background: var(--navy-800); }

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 33, 58, 0.5);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 900;
  padding: 20px;
}
.modal-overlay.show { display: flex; }
.modal-box { background: #fff; border-radius: 14px; padding: 28px; width: 400px; max-width: 100%; }
.modal-box h3 { font-size: 16px; margin-bottom: 10px; }
.modal-box p { font-size: 13.5px; color: var(--text-sub); margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* --- ご意見・不具合報告（Step 6-6A） --- */
.feedback-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 850;
  display: none;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 12px 18px;
  border: none;
  border-radius: 999px;
  background: var(--navy-900);
  color: #fff;
  font-size: 13.5px;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(7, 28, 54, 0.35);
}
.feedback-fab:not([hidden]) { display: inline-flex; }
.feedback-fab:hover { background: var(--navy-800); }
.feedback-fab:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
@media (max-width: 640px) {
  .feedback-fab { right: 16px; bottom: 16px; padding: 12px; }
  .feedback-fab span { display: none; }
}

.feedback-modal-box { width: 480px; text-align: left; }
.feedback-modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.feedback-modal-header h3 { margin-bottom: 0; }
.feedback-modal-header .icon-btn { min-height: 36px; min-width: 36px; }

.feedback-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.feedback-tab {
  padding: 10px 4px;
  margin-right: 20px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--text-sub);
  font-size: 13.5px;
  font-weight: 600;
  min-height: 40px;
}
.feedback-tab[aria-selected="true"] { color: var(--blue); border-bottom-color: var(--blue); }
.feedback-tab:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }

.feedback-privacy-note {
  background: #FFF7E6;
  color: var(--orange);
  border: 1px solid #F3DDA6;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 12.5px;
  margin-bottom: 18px;
}

.feedback-submit-error {
  color: var(--red);
  font-size: 13px;
  margin-bottom: 12px;
}

.feedback-history-empty { color: var(--text-sub); font-size: 13.5px; padding: 20px 0; text-align: center; }
.feedback-history-items { list-style: none; display: flex; flex-direction: column; gap: 10px; max-height: 320px; overflow-y: auto; }
.feedback-history-item { border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.feedback-history-item-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.feedback-history-category { font-size: 12px; color: var(--text-sub); font-weight: 600; }
.feedback-history-title { font-size: 14px; font-weight: 600; margin-bottom: 4px; word-break: break-word; }
.feedback-history-meta { font-size: 12px; color: var(--text-sub); }

.feedback-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.feedback-status-badge::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.feedback-status-badge.status-received { background: #E8F0FE; color: var(--blue); }
.feedback-status-badge.status-in_review { background: #FFF7E6; color: var(--orange); }
.feedback-status-badge.status-planned { background: #EDE7FB; color: #6A3FC9; }
.feedback-status-badge.status-done { background: #E6F5EC; color: var(--green); }

/* パネル用バックドロップ（狭い画面での開閉時） */
.panel-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 33, 58, 0.4);
  z-index: 140;
  border: none;
  display: none;
}
.panel-backdrop.show { display: block; }

/* ==========================================================================
   レスポンシブ
   デスクトップ最優先。1200px以上=3カラム、900〜1199px=右パネル折りたたみ、
   899px以下=左右パネルとも開閉式。中央作業領域を最優先で確保する。
   ========================================================================== */

@media (max-width: 1199px) {
  #app.visible {
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-areas:
      "header header"
      "nav    main";
  }
  #toggle-aside { display: inline-flex; }
  .ai-panel {
    position: fixed;
    top: var(--header-h);
    right: 0;
    bottom: 0;
    width: 320px;
    max-width: 90vw;
    z-index: 150;
    transform: translateX(100%);
    transition: transform 0.2s ease;
    box-shadow: -8px 0 24px rgba(16, 33, 58, 0.15);
  }
  .ai-panel.open { transform: translateX(0); }
}

@media (max-width: 899px) {
  #app.visible {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "header"
      "main";
  }
  #toggle-nav { display: inline-flex; }
  .side-nav {
    position: fixed;
    top: var(--header-h);
    left: 0;
    bottom: 0;
    width: 220px;
    max-width: 80vw;
    z-index: 150;
    transform: translateX(-100%);
    transition: transform 0.2s ease;
    box-shadow: 8px 0 24px rgba(16, 33, 58, 0.2);
  }
  .side-nav.open { transform: translateX(0); }
  .workspace { padding: 20px 16px 28px; }
  .task-summary { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .company-name { display: none; }
  .brand-beta { display: none; }
}
