/* ===== 基本設定 ===== */

* {
  box-sizing: border-box;
}

.pwa-status { max-width: 1200px; margin: 12px auto; font-size: 13px; color: #555; }
.pwa-status button { margin: 8px; }
.pwa-status button[hidden] { display: none; }
.task-form .deadline-option, .edit-modal-content .deadline-option {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
}
.task-form .deadline-option input, .edit-modal-content .deadline-option input {
  width: 20px;
  height: 20px;
  min-width: 20px;
  padding: 0;
}
input[type="date"]:disabled { opacity: 0.5; }
.daily-task-info .suggestion-label { color: #2563eb; font-weight: bold; }
.app-guides, .category-controls { max-width: 1200px; margin: 16px auto; }
.app-guides details, .info-panel { border: 1px solid #d5dbe5; border-radius: 10px; background: white; padding: 16px; margin: 10px 0; line-height: 1.7; overflow-wrap: anywhere; }
.app-guides summary { cursor: pointer; font-weight: bold; min-height: 32px; }
.app-guides ol { padding-left: 24px; }
.app-guides li { margin: 8px 0; }
.backup-controls .info-panel { width: 100%; }
.info-panel[hidden] { display: none; }
.info-panel h2 { margin-bottom: 8px; }
.info-panel p { margin: 12px 0; }
#backupTaskPreview { max-height: 200px; overflow-y: auto; }
#backupText, #importBackupText { width: 100%; padding: 10px; font-size: 16px; box-sizing: border-box; }
#lineBackupNotice { padding: 12px; margin: 12px 0; background: #fff3cd; }
#lineBackupNotice[hidden], #downloadBackupButton[hidden] { display: none; }
.category-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.category-controls select { padding: 10px; font-size: 16px; max-width: 100%; min-height: 44px; }
.category-tabs { display: flex; gap: 8px; flex-wrap: wrap; width: 100%; }
.category-tab { min-height: 44px; max-width: 100%; overflow-wrap: anywhere; background: white; color: #2563eb; border: 1px solid #d5dbe5; }
.category-tab[aria-pressed="true"] { background: #2563eb; color: white; border-color: #2563eb; font-weight: bold; }
.category-tab:focus-visible { outline: 3px solid #60a5fa; outline-offset: 2px; }
.category-suggestions { display: flex; flex-wrap: wrap; gap: 6px; }
.category-suggestion { background: #eff6ff; color: #2563eb; border: 1px solid #d5dbe5; min-height: 44px; padding: 8px 12px; max-width: 100%; overflow-wrap: anywhere; }
#mobileCompletedSlot .completed-preview { background: white; padding: 18px; border: 1px solid #e5e7eb; border-radius: 12px; margin: 0 0 24px; }
#mobileCompletedSlot .completed-item { overflow-wrap: anywhere; }
#categoryStatus { font-size: 13px; width: 100%; }

/* データ管理と狭い画面での操作 */
.backup-controls, #storageMessage {
  max-width: 1200px;
  margin: 16px auto;
}
.backup-controls { display: flex; gap: 12px; flex-wrap: wrap; }
.backup-controls p { width: 100%; margin: 0; font-size: 14px; }
#storageMessage { padding: 12px; background: #fff3cd; overflow-wrap: anywhere; }
.modal-open { overflow: hidden; }

body {
  font-family: Arial, sans-serif;
  background-color: #f5f6f8;
  color: #222;
  margin: 0;
  padding: 24px;
}

/* ===== ヘッダー ===== */

.app-header {
  max-width: 1200px;
  margin: 0 auto 24px;
}

h1 {
  font-size: 28px;
  margin: 0 0 8px;
}

.app-header p {
  color: #777;
  font-size: 13px;
  margin: 0;
}

/* ===== 全体レイアウト ===== */

.app-container {
  max-width: 1200px;
  margin: 0 auto;
}

.app-layout {
  display: grid;
  grid-template-columns: 1fr 1.8fr;
  gap: 24px;
  align-items: start;
}

/* ===== パネル ===== */

.task-form-panel,
.task-list-panel,
.completed-panel {
  background-color: transparent;
  padding: 0;
  border: none;
  box-shadow: none;
}

h2 {
  font-size: 18px;
  margin: 0 0 16px;
}

/* ===== タスク登録 ===== */

.task-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-form label {
  font-size: 12px;
  color: #777;
}

.task-form input,
.task-form select {
  width: 100%;
  padding: 12px;
  background-color: #f0f0f0;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
}

.task-form input:focus,
.task-form select:focus {
  outline: none;
  border-color: #2563eb;
}

button {
  background-color: #2563eb;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  cursor: pointer;
}

button:hover {
  filter: brightness(0.92);
}

#addButton {
  width: 100%;
  margin-top: 4px;
  font-weight: bold;
}

/* ===== タスク一覧 ===== */

ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

/* ===== タスクカード ===== */
#taskList li {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;

  background-color: white;
  border: 1px solid #ddd;
  border-radius: 14px;

  padding: 18px;
  margin-bottom: 12px;
}

/* タスクの情報 */
.task-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.task-info span {
  font-size: 16px;
  font-weight: bold;
  overflow-wrap: anywhere;
}

.task-info small {
  font-size: 12px;
  color: #888;
}

/* 進捗率 */
#taskList input[type="range"] {
  width: 100%;
  max-width: none;
  accent-color: #16a34a;
  cursor: pointer;
}

#taskList p {
  text-align: left;
  margin: 4px 0;
  font-size: 13px;
}

/* ===== 操作ボタン ===== */

.button-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

li button {
  background-color: #16a34a;
  padding: 8px 12px;
  font-size: 13px;
}

.edit-button {
  background-color: #f59e0b;
}

.delete-button {
  background-color: #ef4444;
}

/* ===== 達成履歴 ===== */

.completed-panel {
  margin-top: 36px;
  padding-top: 24px;
  border-top: 1px solid #ddd;
}

#completedList li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 10px;
  background-color: white;
  padding: 14px;
  margin-bottom: 8px;
  border-radius: 10px;
  border-left: 4px solid #16a34a;
}

/* 名前・日時は左、操作ボタンは常に右。同じ位置で長文を折り返す。 */
#completedList li.completed-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  grid-template-rows: auto auto;
  column-gap: 12px;
  row-gap: 6px;
}
#completedList .completed-item strong {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}
#completedList .completed-item small {
  grid-column: 1;
  grid-row: 2;
  min-width: 0;
  overflow-wrap: anywhere;
}
#completedList .completed-item button {
  grid-column: 2;
  grid-row: 1 / 3;
  justify-self: end;
  align-self: center;
  white-space: nowrap;
  min-height: 44px;
}

#completedList small {
  color: #888;
  font-size: 12px;
}

/* ===== スマホ対応 ===== */

@media (max-width: 768px) {
  body {
    padding: 16px;
  }

  .app-layout {
    grid-template-columns: 1fr;
  }

  .button-group {
    width: 100%;
  }
}
/* ===== 進捗エリア ===== */
.progress-container {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.progress-container p {
  margin: 0;
  font-size: 13px;
  color: #555;
}

.progress-container input[type="range"] {
  width: 100%;
  accent-color: #16a34a;
  cursor: pointer;
}

/* ===== ボタン配置 ===== */
#taskList .button-group {
  display: flex;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

/* ===== タスク件数 ===== */
#taskCount {
  font-size: 13px;
  font-weight: normal;
  color: #888;
  margin-left: 6px;
}

/* ===== すべて見るボタン ===== */
.view-all-button {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 12px;

  background-color: #fff;
  color: #2563eb;
  border: 1px solid #d5dbe5;
  border-radius: 10px;

  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
}

.view-all-button:hover {
  background-color: #eff6ff;
}

/* hidden属性が付いている間は非表示 */
.view-all-button[hidden] {
  display: none;
}

/* ===== 画面切り替え ===== */

/* hidden属性が付いている画面を非表示にする */
#homeScreen[hidden],
#allTasksScreen[hidden] {
  display: none;
}

/* ===== 全タスク画面 ===== */

.all-tasks-header {
  margin-bottom: 24px;
}

.all-tasks-header h2 {
  margin-top: 18px;
  margin-bottom: 6px;
}

#allTasksCount {
  color: #888;
  font-size: 13px;
  margin: 0;
}

/* 戻るボタン */
.back-button {
  background-color: white;
  color: #2563eb;
  border: 1px solid #d5dbe5;
}

.back-button:hover {
  background-color: #eff6ff;
}

/* 検索・並び替え・絞り込み */
.task-controls {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 24px;
}

.control-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-field label {
  font-size: 12px;
  color: #777;
}

.control-field input,
.control-field select {
  width: 100%;
  padding: 12px;
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 14px;
}

/* 全タスク画面でも同じカードデザイン */
#allTasksList li {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 12px;
}

#allTasksList input[type="range"] {
  width: 100%;
  accent-color: #16a34a;
  cursor: pointer;
}

#allTasksList p {
  text-align: left;
  margin: 4px 0;
  font-size: 13px;
}

/* 検索結果なし */
#emptyTaskMessage {
  text-align: center;
  color: #888;
  padding: 32px 0;
}

#emptyTaskMessage[hidden] {
  display: none;
}

/* スマホ対応 */
@media (max-width: 768px) {
  .task-controls {
    grid-template-columns: 1fr;
  }
}

/* ===== 自動スケジュール表示 ===== */

.schedule-text {
  font-size: 12px;
  color: #2563eb;
  margin-top: 4px;
}

.schedule-ready {
  display: block;
  background-color: #fff3e0;
  color: #92400e;
  font-weight: bold;

  border-left: 4px solid #f59e0b;
  border-radius: 6px;

  padding: 12px 14px;
  margin-top: 8px;
}

/* ===== 優先スコア ===== */

.task-info .priority-score {
  display: inline-block;
  align-self: flex-start;
  width: auto;
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: bold;
}

/* 最優先 */
.task-info .priority-urgent {
  background-color: #fef2f2;
  color: #dc2626;
}

/* 優先 */
.task-info .priority-high {
  background-color: #fff7ed;
  color: #b45309;
}

/* 通常 */
.task-info .priority-normal {
  background-color: #eff6ff;
  color: #2563eb;
}

/* ===== 締切超過 ===== */

.schedule-overdue {
  display: block;
  background-color: #fee2e2;
  color: #991b1b;
  font-weight: bold;

  border-left: 4px solid #dc2626;
  border-radius: 6px;

  padding: 12px 14px;
  margin-top: 8px;
}

/* ===== 進捗100% ===== */

.schedule-finished {
  display: block;
  background-color: #dcfce7;
  color: #166534;
  font-weight: bold;

  border-left: 4px solid #16a34a;
  border-radius: 6px;

  padding: 12px 14px;
  margin-top: 8px;
}

/* ===== 今日のプラン ===== */

.daily-plan-panel {
  margin-bottom: 36px;
}

.daily-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.summary-card {
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px;

  display: flex;
  flex-direction: column;
  gap: 8px;
}

.summary-card span {
  color: #777;
  font-size: 13px;
}

.summary-card strong {
  color: #2563eb;
  font-size: 24px;
}

.daily-task-panel {
  margin-bottom: 20px;
}

.daily-task-panel h3 {
  font-size: 15px;
  margin: 0 0 12px;
}

.daily-task-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;

  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 10px;

  padding: 14px;
  margin-bottom: 8px;
}

.daily-task-info {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.daily-task-info strong {
  font-size: 14px;
  overflow-wrap: anywhere;
}

.daily-task-info small {
  font-size: 12px;
  color: #888;
}

.daily-score {
  flex-shrink: 0;
  background-color: #eff6ff;
  color: #2563eb;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: bold;
}

#todayEmptyMessage {
  color: #888;
  font-size: 13px;
  padding: 12px 0;
}

#todayEmptyMessage[hidden] {
  display: none;
}

@media (max-width: 768px) {
  .daily-summary {
    gap: 8px;
  }

  .summary-card {
    padding: 12px;
  }

  .summary-card strong {
    font-size: 20px;
  }
}

/* ===== タスク移行 ===== */

.daily-task-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.migrate-button {
  background-color: #e2e8f0;
  color: #334155;
  padding: 8px 12px;
  font-size: 12px;
  font-weight: bold;
  border-radius: 8px;
}

.migrate-button:hover {
  background-color: #cbd5e1;
}

.migration-text {
  color: #64748b;
  font-size: 12px;
}

@media (max-width: 768px) {
  .daily-task-item {
    align-items: flex-start;
  }

  .daily-task-actions {
    flex-direction: column;
    align-items: flex-end;
  }
}

/* ===== 編集モーダル ===== */

.edit-modal {
  position: fixed;
  inset: 0;

  background-color: rgba(0, 0, 0, 0.5);

  display: flex;
  justify-content: center;
  align-items: center;

  padding: 20px;
  z-index: 1000;
}

.edit-modal[hidden] {
  display: none;
}

.edit-modal-content {
  background-color: white;
  padding: 28px;
  border-radius: 14px;

  width: 100%;
  max-width: 440px;
  max-height: 90vh;
  max-height: 90dvh;
  overflow-y: auto;

  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
}

.edit-modal-content h2 {
  margin-top: 0;
  margin-bottom: 20px;
}

.edit-modal-content label {
  display: block;
  margin-top: 14px;
  margin-bottom: 6px;
  font-size: 14px;
  font-weight: bold;
}

.edit-modal-content input,
.edit-modal-content select {
  width: 100%;
  box-sizing: border-box;

  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 8px;

  font-size: 14px;
}

.edit-modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

#cancelEditButton {
  background-color: #e5e7eb;
  color: #374151;
}

#saveEditButton {
  background-color: #2563eb;
  color: white;
}

.edit-modal-buttons button {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

.edit-modal-buttons button:hover {
  opacity: 0.85;
}

/* ===== デイリーレビュー ===== */

.daily-review-panel {
  margin-bottom: 36px;
}

.review-summary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.review-summary-card {
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 18px;

  display: flex;
  flex-direction: column;
  gap: 8px;
}

.review-summary-card span {
  color: #777;
  font-size: 13px;
}

.review-summary-card strong {
  color: #2563eb;
  font-size: 24px;
}

.review-card {
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.review-card h3 {
  margin-top: 0;
  font-size: 16px;
}

.review-completed-item {
  padding: 10px;
  margin-bottom: 8px;
  border-radius: 8px;

  background-color: #f0fdf4;
  color: #166534;

  list-style: none;
}

.review-remaining-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;

  padding: 10px;
  margin-bottom: 8px;

  border-radius: 8px;
  background-color: #fff7ed;

  list-style: none;
}

#reviewCompletedList,
#reviewRemainingList {
  padding-left: 0;
}

#reviewMemo {
  width: 100%;
  box-sizing: border-box;

  padding: 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;

  font-size: 14px;
  resize: vertical;
}

#saveReviewButton {
  margin-top: 12px;

  padding: 10px 18px;
  background-color: #2563eb;
  color: white;

  border: none;
  border-radius: 8px;
  cursor: pointer;
}

#saveReviewButton:hover {
  background-color: #1d4ed8;
}

#reviewSaveMessage {
  color: #16a34a;
  font-size: 13px;
  font-weight: bold;
}

#reviewSaveMessage[hidden] {
  display: none;
}

@media (max-width: 768px) {
  .review-summary-card {
    padding: 12px;
  }

  .review-remaining-item {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ===== 左側フォーム＋右側コンテンツ ===== */

.taskflow-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  max-width: 1600px;
  margin: 0 auto;
  padding: 24px;
}

/* 左側のタスク追加エリア */
.taskflow-sidebar {
  position: sticky;
  top: 20px;
  min-width: 0;
}

/* 右側のメインコンテンツ */
.taskflow-main {
  min-width: 0;
}

/* スマホでは縦並び */
@media (max-width: 900px) {
  .taskflow-layout {
    grid-template-columns: 1fr;
    padding: 16px;
  }

  .taskflow-sidebar {
    position: static;
  }
}

/* ===== クリック可能なおすすめタスク ===== */

.daily-task-clickable {
  cursor: pointer;
  transition: background-color 0.2s;
}

.daily-task-clickable:hover {
  background-color: #eff6ff;
}

.daily-task-clickable:focus-visible {
  outline: 3px solid #60a5fa;
  outline-offset: 2px;
}

/* ===== 移動先のタスクを強調 ===== */

.task-highlight {
  animation: taskHighlight 2s ease-out;
}

@keyframes taskHighlight {
  0% {
    background-color: #bfdbfe;
    box-shadow: 0 0 0 4px #93c5fd;
  }

  100% {
    background-color: transparent;
    box-shadow: none;
  }
}

/* ===== TaskFlow 新しいホームレイアウト ===== */

/* メインコンテンツの横幅を広げる */
.app-container {
  max-width: 1600px;
  width: calc(100% - 48px);
  margin: 0 auto;
}

/* 左右2カラム */
.taskflow-layout {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

/* 左側：タスク追加 */
.taskflow-sidebar {
  position: sticky;
  top: 20px;
  min-width: 0;
}

/* 右側：今日のプランなど */
.taskflow-main {
  min-width: 0;
}

/* 進行中のタスクを右側いっぱいに表示 */
.taskflow-main .app-layout {
  display: block;
}

.taskflow-main .task-list-panel {
  width: 100%;
  box-sizing: border-box;
}

/* スマホ・狭い画面では縦並び */
@media (max-width: 900px) {
  .app-container {
    width: calc(100% - 32px);
  }

  .taskflow-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .taskflow-sidebar {
    position: static;
  }
}

/* ===== 左側の達成履歴 ===== */

.taskflow-sidebar .completed-details {
  margin-top: 20px;
  width: 100%;
  box-sizing: border-box;
}

.taskflow-sidebar .completed-details summary {
  cursor: pointer;
  padding: 16px;

  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;

  font-size: 14px;
  font-weight: bold;
  color: #374151;
}

.taskflow-sidebar .completed-details summary:hover {
  background-color: #f8fafc;
}

.taskflow-sidebar .completed-details[open] summary {
  border-radius: 12px 12px 0 0;
}

.taskflow-sidebar .completed-details #completedList {
  margin: 0;
  padding: 12px;

  background-color: white;
  border: 1px solid #e5e7eb;
  border-top: none;
  border-radius: 0 0 12px 12px;

  list-style: none;

  max-height: 320px;
  overflow-y: auto;
}

.taskflow-sidebar .completed-item {
  display: flex;
  flex-direction: column;
  gap: 5px;

  padding: 10px 8px;
  border-bottom: 1px solid #f1f5f9;
}

.taskflow-sidebar .completed-item:last-child {
  border-bottom: none;
}

.taskflow-sidebar .completed-item strong {
  font-size: 13px;
  color: #166534;
  overflow-wrap: anywhere;
}

.taskflow-sidebar .completed-item small {
  font-size: 11px;
  color: #94a3b8;
}

.taskflow-sidebar .completed-empty {
  padding: 12px 4px;
  font-size: 12px;
  color: #94a3b8;
}

/* ===== 達成履歴プレビュー ===== */

.taskflow-sidebar .completed-preview {
  margin-top: 20px;
  padding: 18px;
  background-color: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
}

.taskflow-sidebar .completed-preview h2 {
  margin-top: 0;
  margin-bottom: 16px;
  font-size: 17px;
}

.taskflow-sidebar .completed-preview #completedList {
  padding: 0;
  margin: 0;
  list-style: none;

  max-height: none;
  overflow: visible;
}

.taskflow-sidebar .completed-preview .completed-item {
  display: flex;
  flex-direction: column;
  gap: 5px;

  padding: 12px 0;
  border-bottom: 1px solid #f1f5f9;
}

.taskflow-sidebar .completed-preview .completed-item strong {
  font-size: 13px;
  color: #166534;
  overflow-wrap: anywhere;
}

.taskflow-sidebar .completed-preview .completed-item small {
  font-size: 11px;
  color: #94a3b8;
}

.taskflow-sidebar .completed-preview .view-all-button {
  width: 100%;
  margin-top: 16px;
}

.taskflow-sidebar .completed-preview .view-all-button[hidden] {
  display: none;
}

@media (max-width: 900px) {
  .app-container { width: 100%; }
  .taskflow-layout { padding: 0; }
  .task-form input, .task-form select,
  .control-field input, .control-field select,
  .edit-modal-content input, .edit-modal-content select,
  #reviewMemo { font-size: 16px; min-width: 0; }
  button, li button, .migrate-button { min-height: 44px; }
  .daily-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .summary-card { min-width: 0; }
  .summary-card span { overflow-wrap: anywhere; }
  .review-remaining-item span { overflow-wrap: anywhere; min-width: 0; }
  .edit-modal { padding: 12px; }
  .edit-modal-content { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  .task-highlight { animation: none; outline: 3px solid #93c5fd; }
}

/* 今日のタスクを先頭に置くアプリ用の画面構成 */
body { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
.app-header { display: flex; align-items: center; gap: 12px; max-width: 1200px; }
.app-header h1 { flex: 1; margin: 0; }
.app-header button { min-height: 44px; }
.taskflow-layout { display: block; padding: 0; }
.taskflow-sidebar { display: none; }
.app-container { width: 100%; max-width: 1200px; }
#backupScreen[hidden] { display: none; }
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; z-index: 900; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); background: white; border-top: 1px solid #d5dbe5; }
.bottom-nav button { background: #f5f6f8; color: #555; min-height: 48px; padding: 10px 4px; }
.bottom-nav button[aria-current="page"] { background: #eff6ff; color: #2563eb; font-weight: bold; box-shadow: inset 0 -3px #2563eb; }
.completion-undo { position: fixed; z-index: 950; bottom: calc(86px + env(safe-area-inset-bottom)); left: 12px; right: 12px; max-width: 680px; margin: 0 auto; padding: 12px; border-radius: 12px; background: #1e293b; color: white; box-shadow: 0 4px 18px #0003; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.completion-undo[hidden] { display: none; }
#completionUndoMessage { flex: 1 1 160px; min-width: 0; max-height: 72px; overflow-y: auto; overflow-wrap: anywhere; font-size: 14px; }
.completion-undo button { min-height: 44px; padding: 8px 12px; }
#dismissCompletionUndo { background: transparent; border: 1px solid #94a3b8; }
body:has(.completion-undo:not([hidden])) { padding-bottom: calc(210px + env(safe-area-inset-bottom)); }
.task-dialog { width: min(520px, calc(100% - 24px)); max-height: 90vh; max-height: 90dvh; overflow-y: auto; border: 0; border-radius: 16px; padding: 24px; background: white; color: #222; }
.task-dialog::backdrop { background: rgba(0,0,0,.5); }
.task-dialog[open] { display: block; }
.task-dialog #cancelAddButton { margin-top: 16px; width: 100%; background: #e5e7eb; color: #374151; }
body:has(dialog[open]) { overflow: hidden; }
.task-menu details { border-bottom: 1px solid #e5e7eb; padding: 10px 0; }
.task-menu summary { min-height: 44px; cursor: pointer; overflow-wrap: anywhere; }
.task-menu details button { display: block; margin: 8px 0; width: 100%; text-align: left; overflow-wrap: anywhere; }
.task-accordion { width: 100%; }
.task-accordion > summary, .subtask-group > summary { cursor: pointer; color: #2563eb; padding: 10px 0; min-height: 44px; }
.task-folded-info { display: flex; flex-direction: column; gap: 8px; margin: 8px 0; overflow-wrap: anywhere; }
.task-accordion .button-group { margin-top: 12px; }
.subtask-group { border-top: 1px solid #e5e7eb; width: 100%; }
.subtask-group > ul { padding-left: 10px; border-left: 3px solid #dbeafe; }
#taskList .subtask-group li, #allTasksList .subtask-group li { padding: 12px; }
@media (max-width: 600px) {
  .app-header { gap: 8px; }
  .app-header h1 { font-size: 24px; }
  .app-header button { padding: 10px; font-size: 13px; }
  .task-dialog { padding: 20px; }
}

/* 今日のタスクと締切を続けて確認するホーム */
#homeScreen { max-width: 760px; margin: 0 auto; }
.daily-plan-panel, .deadline-chart-panel, .home-accordion {
  background: white; border: 1px solid #e1e5eb; border-radius: 16px; margin-bottom: 16px; padding: 18px;
}
.home-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.home-section-heading h2 { margin: 0; font-size: 20px; }
.home-section-heading strong { color: #6b7280; font-size: 13px; }
#todayTaskList .daily-task-item { border: 0; border-top: 1px solid #eef0f3; border-radius: 0; margin: 0; padding: 14px 0; min-height: 66px; }
#todayTaskList .daily-task-info strong { font-size: 16px; }
#todayTaskList .daily-task-info { flex: 1; }
#todayTaskList .daily-task-actions { flex-direction: row; flex-wrap: nowrap; align-items: center; }
#todayTaskList .daily-score { white-space: nowrap; }
.score-urgent { background: #fef2f2; color: #dc2626; }
.score-high { background: #fff7ed; color: #b45309; }
.score-normal { background: #eff6ff; color: #2563eb; }
.today-open { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 44px; text-align: left; background: transparent; color: #222; padding: 0; }
.today-open:focus-visible { outline: 3px solid #60a5fa; outline-offset: 4px; }
.today-open .daily-task-info { min-width: 0; }
.suggested-tasks { border-top: 1px dashed #cbd5e1; margin-top: 14px; padding-top: 14px; }
.suggested-tasks[hidden] { display: none; }
.suggested-tasks h3 { margin: 0; font-size: 16px; color: #2563eb; }
.suggested-tasks > p, .field-help { font-size: 12px; color: #64748b; line-height: 1.7; margin: 8px 0; }
#suggestedTaskList .daily-task-item { border: 0; border-top: 1px solid #eef0f3; margin: 0; padding: 10px 0; }
#suggestedTaskList .daily-task-info { flex: 1; }
#suggestedTaskList .daily-task-info small:not(.suggestion-label) { display: none; }
#suggestedTaskList .daily-task-actions { flex-direction: row; flex-wrap: nowrap; }
#completionChecksSection[hidden] { display: none; }
#completionChecksSection > p { font-size: 12px; color: #64748b; line-height: 1.7; }
#completionChecksList .daily-task-info { flex: 1; }
#completionChecksList .daily-task-info small:not(.suggestion-label) { display: none; }
#completionChecksList .daily-task-actions { flex-direction: row; flex-wrap: nowrap; }
#addTaskAdvanced { padding: 10px 0; }
#addTaskAdvanced > summary { cursor: pointer; min-height: 44px; color: #2563eb; }
#addTaskAdvanced > .task-form { margin-top: 8px; }
.filter-notice { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; margin-bottom: 16px; border-radius: 12px; background: #eff6ff; color: #1d4ed8; flex-wrap: wrap; }
.filter-notice[hidden], .bulk-actions[hidden] { display: none; }
.list-toolbar, .list-pagination, .bulk-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.list-toolbar label, .task-selection { min-height: 44px; display: flex; gap: 8px; align-items: center; }
.task-selection { font-size: 13px; color: #475569; overflow-wrap: anywhere; }
.task-selection input { flex: 0 0 20px; width: 20px; height: 20px; }
.bulk-actions { padding: 12px; border-radius: 12px; border: 1px solid #cbd5e1; }
.bulk-actions p { width: 100%; font-size: 13px; margin: 0; }
.bulk-actions:not([hidden]) {
  position: fixed; z-index: 940;
  left: 12px; right: 12px; bottom: calc(78px + env(safe-area-inset-bottom));
  max-width: 760px; margin: 0 auto; background: white;
  display: flex; flex-direction: column; align-items: stretch; gap: 8px;
  box-shadow: 0 4px 24px #0002;
  max-height: 35vh; max-height: 35dvh; overflow-y: auto;
}
.bulk-actions > p { grid-column: 1 / -1; font-size: 12px; }
.bulk-actions button { min-height: 44px; padding: 8px 4px; font-size: 13px; }
.bulk-selection-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.bulk-selection-controls button { background: #eff6ff; color: #2563eb; padding: 8px 10px; }
.bulk-task-buttons { display: flex; align-items: stretch; gap: 8px; width: 100%; }
.bulk-task-buttons button { flex: 1; min-width: 0; padding: 8px; overflow-wrap: anywhere; }
#bulkCompleteButton { background: #16a34a; color: white; }
#bulkMigrateButton { background: #e2e8f0; color: #334155; }
.bulk-task-buttons button:disabled { opacity: .45; cursor: default; }
#bulkDeleteButton { background: #dc2626; }
#selectionCount { text-align: center; font-weight: bold; font-size: 13px; }
#bulkResult:empty { display: none; }
body:has(#allTasksScreen:not([hidden]) #bulkActions:not([hidden])) {
  padding-bottom: calc(110px + 35vh + env(safe-area-inset-bottom));
  padding-bottom: calc(110px + 35dvh + env(safe-area-inset-bottom));
}
body:has(#allTasksScreen:not([hidden]) #bulkActions:not([hidden])) .completion-undo { bottom: auto; top: calc(12px + env(safe-area-inset-top)); }
.list-pagination { justify-content: center; }
.count-explanation { font-size: 12px; color: #64748b; line-height: 1.7; margin: 8px 0; }
.count-explanation summary { cursor: pointer; padding: 6px 0; }
.count-explanation p { margin: 6px 0; }
.task-memo {
  border: 1px solid #b6d9a4;
  border-top: 5px solid #76aa59;
  border-radius: 3px 3px 12px 3px;
  padding: 0 12px;
  margin-top: 6px;
  background: #edf7d9;
  color: #24452b;
  box-shadow: 1px 3px 5px #24452b14;
  min-width: 0;
}
.task-memo[open] { padding-bottom: 12px; }
.task-memo > summary, .score-help > summary { cursor: pointer; min-height: 44px; display: flex; align-items: center; font-size: 13px; color: #475569; }
.task-memo textarea { width: 100%; box-sizing: border-box; min-height: 100px; max-height: 32vh; max-height: 32dvh; overflow-y: auto; resize: vertical; padding: 12px; font-family: inherit; font-size: 16px; line-height: 1.6; border: 1px solid #cbd5e1; border-radius: 8px; }
.task-memo button { min-height: 44px; margin-top: 8px; }
.task-memo > summary { display: block; padding: 10px 0; overflow-wrap: anywhere; line-height: 1.7; color: #24452b; font-size: 14px; }
.task-memo-body { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.8; font-size: 14px; max-height: 32vh; max-height: 32dvh; overflow-y: auto; padding: 10px 0; background: transparent; border-top: 1px dashed #b6d9a4; color: #24452b; }
.task-memo textarea { background: #f7fce9; border-color: #89b772; color: #24452b; }
.task-memo textarea:focus-visible, .task-memo > summary:focus-visible { outline: 3px solid #3f7c47; outline-offset: 2px; }
.task-memo .field-help { color: #3c6040; }
.task-memo-body[role="button"] { cursor: text; }
.task-memo-body:focus-visible { outline: 3px solid #60a5fa; outline-offset: 2px; }
.task-memo [hidden] { display: none; }
.task-memo[hidden] { display: none; }
.score-help { font-size: 13px; }
.score-help > p { font-size: 13px; line-height: 1.7; margin: 4px 0 10px; color: #64748b; }
.install-hint { max-width: 860px; margin: 8px auto 16px; padding: 10px 12px; border: 1px solid #bfdbfe; border-radius: 10px; background: #eff6ff; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.install-hint[hidden] { display: none; }
.install-hint span { flex: 1 1 180px; }
.install-hint button { min-height: 44px; padding: 8px 10px; }
#dismissInstallHint { background: transparent; color: #475569; }
.install-guide { margin: 16px 0; padding: 12px; border-radius: 10px; background: #f8fafc; line-height: 1.8; font-size: 14px; }
.install-guide h3 { font-size: 17px; }
#toggleSelectionButton { border: 1px solid #2563eb; background: #eff6ff; color: #1d4ed8; min-height: 44px; }
#toggleSelectionButton[aria-pressed="true"] { background: #1d4ed8; color: white; border-color: #1d4ed8; }
#allTasksList .task-selection { padding: 10px; border-radius: 8px; background: #eff6ff; color: #1e40af; border: 1px solid #93c5fd; font-weight: bold; }
.task-selection input { accent-color: #1d4ed8; }
#allTasksList > li.task-selected { border: 2px solid #2563eb; background: #f5f9ff; }
.bulk-actions:not([hidden]) { background: #eff6ff; color: #1e3a8a; border: 2px solid #2563eb; }
.bulk-selection-controls button { background: white; color: #1d4ed8; border: 1px solid #2563eb; }
#selectionCount { background: #1d4ed8; color: white; border-radius: 6px; padding: 8px 10px; }
#bulkMigrateButton { background: #1d4ed8; color: white; }
.bulk-task-buttons button:disabled { opacity: 1; background: #dbe3ee !important; color: #475569 !important; cursor: default; }
.list-pagination button:disabled { opacity: .45; cursor: default; }
#allTasksList.compact-list > li { padding: 12px; gap: 6px; margin-bottom: 8px; }
#allTasksList.compact-list > li > .task-info { flex-direction: row; align-items: center; gap: 10px; flex-wrap: wrap; }
#allTasksList.compact-list > li > .task-info > span:first-child { flex: 1 1 160px; }
#allTasksList.compact-list .task-accordion > summary { padding: 6px 0; }
.subtask-card .task-info { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.subtask-card .task-info > span:first-child { grid-column: 1; }
.subtask-card .task-info > .priority-score { grid-column: 1; }
.subtask-card .task-info > .subtask-complete { grid-column: 2; grid-row: 1 / 3; min-height: 44px; white-space: nowrap; }
.today-chevron { color: #8892a0; font-size: 26px; }
#todayTaskList .daily-task-info small:not(.suggestion-label) { display: none; }
.home-accordion > summary { display: flex; align-items: center; justify-content: space-between; font-size: 16px; font-weight: bold; cursor: pointer; min-height: 36px; list-style: none; }
.home-accordion > summary::-webkit-details-marker { display: none; }
.home-accordion > summary::after { content: "⌄"; color: #6b7280; }
.home-accordion[open] > summary::after { content: "⌃"; }
.home-accordion[open] > summary { margin-bottom: 16px; }
.home-accordion .daily-task-panel { margin: 16px 0 0; }
.home-accordion .review-card:last-child { margin-bottom: 0; }
#mobileCompletedSlot .completed-preview { padding: 0; margin: 0; border: 0; }
#mobileCompletedSlot .completed-preview > h2 { display: none; }
.deadline-chart-panel h2 { margin-bottom: 6px; font-size: 20px; }
#deadlineChartSummary, .chart-hint, .chart-explanation { font-size: 12px; color: #6b7280; line-height: 1.6; }
#deadlineChartSummary { margin: 0 0 12px; }
.deadline-chart-row { display: grid; grid-template-columns: 6em minmax(0,1fr) 3em; gap: 10px; align-items: center; width: 100%; background: transparent; color: #374151; border-radius: 6px; padding: 7px 0; min-height: 40px; text-align: left; font-size: 14px; }
.deadline-chart-row:hover:not(:disabled) { background: #f8fafc; }
.deadline-chart-row:focus-visible { outline: 3px solid #60a5fa; outline-offset: 2px; }
.deadline-chart-row:disabled { cursor: default; color: #6b7280; }
.chart-track { display: block; height: 15px; background: #edf0f4; border-radius: 4px; overflow: hidden; }
.chart-bar { display: block; height: 100%; border-radius: 4px; background: #2563eb; }
.deadline-overdue .chart-bar { background: #ef4444; }
.deadline-today .chart-bar { background: #f59e0b; }
.deadline-tomorrow .chart-bar { background: #3b82f6; }
.deadline-later .chart-bar { background: #93c5fd; }
.deadline-none .chart-bar { background: #9ca3af; }
.chart-count { text-align: right; font-variant-numeric: tabular-nums; }
.chart-hint { margin: 10px 0 0; text-align: center; }
.chart-explanation { margin-top: 8px; }
.chart-explanation summary { cursor: pointer; }
#clearDeadlineFilter { margin-top: 8px; background: #eff6ff; color: #2563eb; }
#clearDeadlineFilter[hidden] { display: none; }
@media (max-width: 600px) {
  .daily-plan-panel, .deadline-chart-panel, .home-accordion { padding: 14px; }
  .deadline-chart-row { gap: 8px; font-size: 13px; }
}

/* 分類は引き出し、主な操作は下部ナビに集約 */
.app-header, .pwa-status, #storageMessage { max-width: 860px; margin-left: auto; margin-right: auto; }
.app-header { margin-bottom: 8px; }
.app-header h1 { color: #2563eb; font-size: 26px; text-align: center; }
#menuButton { background: transparent; color: #334155; font-size: 24px; padding: 6px 10px; }
#openAddButton { border-radius: 10px; }
.pwa-status { font-size: 12px; line-height: 1.6; color: #64748b; margin-top: 0; margin-bottom: 14px; }
.pwa-status[data-state="ready"] { text-align: center; }
.pwa-status[data-state="ready"] #pwaStatus::before { content: "● "; color: #22c55e; }
.pwa-status[data-state="update"], .pwa-status[data-state="error"] { padding: 10px 12px; border-radius: 10px; background: #fff7ed; color: #9a3412; }
#allTasksScreen, #backupScreen { max-width: 860px; margin: 0 auto; }
.all-tasks-header { margin-bottom: 12px; }
.all-tasks-header h2 { margin-top: 12px; font-size: 22px; }
.task-controls { grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 10px; margin-bottom: 12px; }
.task-controls .control-field:first-child { grid-column: 1 / -1; }
.control-field input, .control-field select { font-size: 16px; padding: 11px; border-color: #e1e5eb; }
.control-field label { color: #64748b; }
.list-toolbar { justify-content: space-between; }
.list-toolbar button, .back-button { background: #f1f5f9; border: 1px solid #e1e5eb; color: #475569; }
#toggleSelectionButton[aria-pressed="true"] { color: #2563eb; background: #eff6ff; border-color: #93c5fd; }
#allTasksList > li { border-color: #e1e5eb; box-shadow: 0 1px 3px #0f172a05; }
#allTasksList > li > .task-info { display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 10px; }
#allTasksList > li > .task-info > span:first-child { flex: 1 1 150px; font-size: 17px; line-height: 1.5; }
.card-metadata { font-size: 12px; color: #64748b; line-height: 1.7; overflow-wrap: anywhere; }
.task-info .priority-score { white-space: nowrap; font-size: 12px; border-radius: 6px; padding: 4px 8px; }
.task-accordion > summary { background: #f5f7fb; border-radius: 7px; padding: 9px 10px; color: #64748b; font-size: 13px; }
#allTasksList.compact-list .task-accordion > summary { padding: 8px 10px; }
.task-menu { position: fixed; top: 0; bottom: 0; left: 0; right: auto; margin: 0; height: 100vh; height: 100dvh; max-height: 100vh; max-height: 100dvh; width: min(380px, 88vw); border-radius: 0 16px 16px 0; padding: max(22px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom)); box-sizing: border-box; }
.drawer-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.drawer-heading h2 { margin: 0; font-size: 20px; }
#closeMenuButton { background: transparent; color: #475569; font-size: 26px; padding: 4px 10px; min-height: 44px; }
.task-menu .category-controls { margin: 18px 0; }
.task-menu .category-tabs { display: flex; flex-direction: column; gap: 0; border: 1px solid #e1e5eb; border-radius: 12px; overflow: hidden; }
.task-menu .category-tab { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left; border: 0; border-bottom: 1px solid #edf0f4; border-radius: 0; background: white; color: #334155; min-height: 58px; padding: 14px; }
.task-menu .category-tab:last-child { border-bottom: 0; }
.task-menu .category-tab[aria-pressed="true"] { color: #2563eb; background: #eff6ff; box-shadow: inset 3px 0 #2563eb; }
.menu-category-count { color: #64748b; font-size: 13px; white-space: nowrap; flex-shrink: 0; }
.drawer-guides { border-top: 1px solid #e1e5eb; margin-top: 24px; padding-top: 12px; }
.drawer-guides button { width: 100%; display: block; text-align: left; background: transparent; color: #334155; padding: 15px 0; min-height: 48px; border-radius: 0; border-bottom: 1px solid #edf0f4; }
.drawer-note { color: #64748b; font-size: 12px; line-height: 1.7; margin-top: 28px; }
@media (max-width: 600px) {
  .app-header h1 { font-size: 23px; }
  .task-menu { padding-left: 16px; padding-right: 16px; }
}
